Skip to content

Commit a35648c

Browse files
committed
fix lint errors
Signed-off-by: Frost Ming <me@frostming.com>
1 parent 9edf3be commit a35648c

File tree

5 files changed

+41
-41
lines changed

5 files changed

+41
-41
lines changed

src/acp/agent/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async def createTerminal(self, params: CreateTerminalRequest) -> TerminalHandle:
9797
params,
9898
CreateTerminalResponse,
9999
)
100-
return TerminalHandle(create_response.terminalId, params.sessionId, self._conn)
100+
return TerminalHandle(create_response.terminal_id, params.session_id, self._conn)
101101

102102
async def terminalOutput(self, params: TerminalOutputRequest) -> TerminalOutputResponse:
103103
return await request_model(

src/acp/contrib/permissions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def __init__(self) -> None:
2929
def default_permission_options() -> tuple[PermissionOption, PermissionOption, PermissionOption]:
3030
"""Return a standard approval/reject option set."""
3131
return (
32-
PermissionOption(optionId="approve", name="Approve", kind="allow_once"),
33-
PermissionOption(optionId="approve_for_session", name="Approve for session", kind="allow_always"),
34-
PermissionOption(optionId="reject", name="Reject", kind="reject_once"),
32+
PermissionOption(option_id="approve", name="Approve", kind="allow_once"),
33+
PermissionOption(option_id="approve_for_session", name="Approve for session", kind="allow_always"),
34+
PermissionOption(option_id="reject", name="Reject", kind="reject_once"),
3535
)
3636

3737

@@ -83,8 +83,8 @@ async def request_for(
8383
raise MissingPermissionOptionsError()
8484

8585
request = RequestPermissionRequest(
86-
sessionId=self._session_id,
87-
toolCall=tool_call,
86+
session_id=self._session_id,
87+
tool_call=tool_call,
8888
options=list(option_set),
8989
)
9090
return await self._requester(request)

src/acp/contrib/tool_calls.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,29 +93,29 @@ def to_view(self) -> TrackedToolCallView:
9393

9494
def to_tool_call_model(self) -> ToolCall:
9595
return ToolCall(
96-
toolCallId=self.tool_call_id,
96+
tool_call_id=self.tool_call_id,
9797
title=self.title,
9898
kind=self.kind,
9999
status=self.status,
100100
content=_copy_model_list(self.content),
101101
locations=_copy_model_list(self.locations),
102-
rawInput=self.raw_input,
103-
rawOutput=self.raw_output,
102+
raw_input=self.raw_input,
103+
raw_output=self.raw_output,
104104
)
105105

106106
def to_start_model(self) -> ToolCallStart:
107107
if self.title is None:
108108
raise _MissingToolCallTitleError()
109109
return ToolCallStart(
110-
sessionUpdate="tool_call",
111-
toolCallId=self.tool_call_id,
110+
session_update="tool_call",
111+
tool_call_id=self.tool_call_id,
112112
title=self.title,
113113
kind=self.kind,
114114
status=self.status,
115115
content=_copy_model_list(self.content),
116116
locations=_copy_model_list(self.locations),
117-
rawInput=self.raw_input,
118-
rawOutput=self.raw_output,
117+
raw_input=self.raw_input,
118+
raw_output=self.raw_output,
119119
)
120120

121121
def update(
@@ -155,8 +155,8 @@ def update(
155155
kwargs["rawInput"] = raw_input
156156
if raw_output is not UNSET:
157157
self.raw_output = raw_output
158-
kwargs["rawOutput"] = raw_output
159-
return ToolCallProgress(sessionUpdate="tool_call_update", toolCallId=self.tool_call_id, **kwargs)
158+
kwargs["raw_output"] = raw_output
159+
return ToolCallProgress(session_update="tool_call_update", tool_call_id=self.tool_call_id, **kwargs)
160160

161161
def append_stream_text(
162162
self,

src/acp/helpers.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ def text_block(text: str) -> TextContentBlock:
8383

8484

8585
def image_block(data: str, mime_type: str, *, uri: str | None = None) -> ImageContentBlock:
86-
return ImageContentBlock(type="image", data=data, mimeType=mime_type, uri=uri)
86+
return ImageContentBlock(type="image", data=data, mime_type=mime_type, uri=uri)
8787

8888

8989
def audio_block(data: str, mime_type: str) -> AudioContentBlock:
90-
return AudioContentBlock(type="audio", data=data, mimeType=mime_type)
90+
return AudioContentBlock(type="audio", data=data, mime_type=mime_type)
9191

9292

9393
def resource_link_block(
@@ -103,19 +103,19 @@ def resource_link_block(
103103
type="resource_link",
104104
name=name,
105105
uri=uri,
106-
mimeType=mime_type,
106+
mime_type=mime_type,
107107
size=size,
108108
description=description,
109109
title=title,
110110
)
111111

112112

113113
def embedded_text_resource(uri: str, text: str, *, mime_type: str | None = None) -> TextResourceContents:
114-
return TextResourceContents(uri=uri, text=text, mimeType=mime_type)
114+
return TextResourceContents(uri=uri, text=text, mime_type=mime_type)
115115

116116

117117
def embedded_blob_resource(uri: str, blob: str, *, mime_type: str | None = None) -> BlobResourceContents:
118-
return BlobResourceContents(uri=uri, blob=blob, mimeType=mime_type)
118+
return BlobResourceContents(uri=uri, blob=blob, mime_type=mime_type)
119119

120120

121121
def resource_block(
@@ -129,11 +129,11 @@ def tool_content(block: ContentBlock) -> ContentToolCallContent:
129129

130130

131131
def tool_diff_content(path: str, new_text: str, old_text: str | None = None) -> FileEditToolCallContent:
132-
return FileEditToolCallContent(type="diff", path=path, newText=new_text, oldText=old_text)
132+
return FileEditToolCallContent(type="diff", path=path, new_text=new_text, old_text=old_text)
133133

134134

135135
def tool_terminal_ref(terminal_id: str) -> TerminalToolCallContent:
136-
return TerminalToolCallContent(type="terminal", terminalId=terminal_id)
136+
return TerminalToolCallContent(type="terminal", terminal_id=terminal_id)
137137

138138

139139
def plan_entry(
@@ -146,27 +146,27 @@ def plan_entry(
146146

147147

148148
def update_plan(entries: Iterable[PlanEntry]) -> AgentPlanUpdate:
149-
return AgentPlanUpdate(sessionUpdate="plan", entries=list(entries))
149+
return AgentPlanUpdate(session_update="plan", entries=list(entries))
150150

151151

152152
def update_user_message(content: ContentBlock) -> UserMessageChunk:
153-
return UserMessageChunk(sessionUpdate="user_message_chunk", content=content)
153+
return UserMessageChunk(session_update="user_message_chunk", content=content)
154154

155155

156156
def update_user_message_text(text: str) -> UserMessageChunk:
157157
return update_user_message(text_block(text))
158158

159159

160160
def update_agent_message(content: ContentBlock) -> AgentMessageChunk:
161-
return AgentMessageChunk(sessionUpdate="agent_message_chunk", content=content)
161+
return AgentMessageChunk(session_update="agent_message_chunk", content=content)
162162

163163

164164
def update_agent_message_text(text: str) -> AgentMessageChunk:
165165
return update_agent_message(text_block(text))
166166

167167

168168
def update_agent_thought(content: ContentBlock) -> AgentThoughtChunk:
169-
return AgentThoughtChunk(sessionUpdate="agent_thought_chunk", content=content)
169+
return AgentThoughtChunk(session_update="agent_thought_chunk", content=content)
170170

171171

172172
def update_agent_thought_text(text: str) -> AgentThoughtChunk:
@@ -175,17 +175,17 @@ def update_agent_thought_text(text: str) -> AgentThoughtChunk:
175175

176176
def update_available_commands(commands: Iterable[AvailableCommand]) -> AvailableCommandsUpdate:
177177
return AvailableCommandsUpdate(
178-
sessionUpdate="available_commands_update",
179-
availableCommands=list(commands),
178+
session_update="available_commands_update",
179+
available_commands=list(commands),
180180
)
181181

182182

183183
def update_current_mode(current_mode_id: str) -> CurrentModeUpdate:
184-
return CurrentModeUpdate(sessionUpdate="current_mode_update", currentModeId=current_mode_id)
184+
return CurrentModeUpdate(session_update="current_mode_update", current_mode_id=current_mode_id)
185185

186186

187187
def session_notification(session_id: str, update: SessionUpdate) -> SessionNotification:
188-
return SessionNotification(sessionId=session_id, update=update)
188+
return SessionNotification(session_id=session_id, update=update)
189189

190190

191191
def start_tool_call(
@@ -200,15 +200,15 @@ def start_tool_call(
200200
raw_output: Any | None = None,
201201
) -> ToolCallStart:
202202
return ToolCallStart(
203-
sessionUpdate="tool_call",
204-
toolCallId=tool_call_id,
203+
session_update="tool_call",
204+
tool_call_id=tool_call_id,
205205
title=title,
206206
kind=kind,
207207
status=status,
208208
content=list(content) if content is not None else None,
209209
locations=list(locations) if locations is not None else None,
210-
rawInput=raw_input,
211-
rawOutput=raw_output,
210+
raw_input=raw_input,
211+
raw_output=raw_output,
212212
)
213213

214214

@@ -266,13 +266,13 @@ def update_tool_call(
266266
raw_output: Any | None = None,
267267
) -> ToolCallProgress:
268268
return ToolCallProgress(
269-
sessionUpdate="tool_call_update",
270-
toolCallId=tool_call_id,
269+
session_update="tool_call_update",
270+
tool_call_id=tool_call_id,
271271
title=title,
272272
kind=kind,
273273
status=status,
274274
content=list(content) if content is not None else None,
275275
locations=list(locations) if locations is not None else None,
276-
rawInput=raw_input,
277-
rawOutput=raw_output,
276+
raw_input=raw_input,
277+
raw_output=raw_output,
278278
)

tests/test_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
def test_serialize_params_uses_meta_aliases() -> None:
66
chunk = AgentMessageChunk(
7-
sessionUpdate="agent_message_chunk",
7+
session_update="agent_message_chunk",
88
content=TextContentBlock(type="text", text="demo", field_meta={"inner": "value"}),
99
field_meta={"outer": "value"},
1010
)
@@ -17,7 +17,7 @@ def test_serialize_params_uses_meta_aliases() -> None:
1717

1818
def test_serialize_params_omits_meta_when_absent() -> None:
1919
chunk = AgentMessageChunk(
20-
sessionUpdate="agent_message_chunk",
20+
session_update="agent_message_chunk",
2121
content=TextContentBlock(type="text", text="demo"),
2222
)
2323

@@ -29,7 +29,7 @@ def test_serialize_params_omits_meta_when_absent() -> None:
2929

3030
def test_field_meta_can_be_set_by_name_on_models() -> None:
3131
chunk = AgentMessageChunk(
32-
sessionUpdate="agent_message_chunk",
32+
session_update="agent_message_chunk",
3333
content=TextContentBlock(type="text", text="demo", field_meta={"inner": "value"}),
3434
field_meta={"outer": "value"},
3535
)

0 commit comments

Comments
 (0)