2626 PROTOCOL_VERSION ,
2727)
2828from acp .schema import (
29- ContentBlock1 ,
29+ AgentMessageChunk ,
30+ AgentThoughtChunk ,
31+ AllowedOutcome ,
32+ ContentToolCallContent ,
3033 PermissionOption ,
3134 RequestPermissionRequest ,
3235 RequestPermissionResponse ,
33- RequestPermissionOutcome1 ,
34- RequestPermissionOutcome2 ,
35- SessionUpdate1 ,
36- SessionUpdate2 ,
37- SessionUpdate3 ,
38- SessionUpdate4 ,
39- SessionUpdate5 ,
40- ToolCallContent1 ,
36+ TextContentBlock ,
37+ ToolCallStart ,
4138 ToolCallUpdate ,
39+ UserMessageChunk ,
4240)
4341
4442
@@ -130,9 +128,9 @@ def _send_cost_hint(self) -> None:
130128 cost = float (getattr (self .model , "cost" , 0.0 ))
131129 except Exception :
132130 cost = 0.0
133- hint = SessionUpdate3 (
131+ hint = AgentThoughtChunk (
134132 sessionUpdate = "agent_thought_chunk" ,
135- content = ContentBlock1 (type = "text" , text = f"__COST__:{ cost :.2f} " ),
133+ content = TextContentBlock (type = "text" , text = f"__COST__:{ cost :.2f} " ),
136134 )
137135 try :
138136 loop = asyncio .get_running_loop ()
@@ -142,15 +140,15 @@ def _send_cost_hint(self) -> None:
142140
143141 async def on_tool_start (self , title : str , command : str , tool_call_id : str ) -> None :
144142 """Send a tool_call start notification for a bash command."""
145- update = SessionUpdate4 (
143+ update = ToolCallStart (
146144 sessionUpdate = "tool_call" ,
147145 toolCallId = tool_call_id ,
148146 title = title ,
149147 kind = "execute" ,
150148 status = "pending" ,
151149 content = [
152- ToolCallContent1 (
153- type = "content" , content = ContentBlock1 (type = "text" , text = f"```bash\n { command } \n ```" )
150+ ContentToolCallContent (
151+ type = "content" , content = TextContentBlock (type = "text" , text = f"```bash\n { command } \n ```" )
154152 )
155153 ],
156154 rawInput = {"command" : command },
@@ -166,13 +164,13 @@ async def on_tool_complete(
166164 status : str = "completed" ,
167165 ) -> None :
168166 """Send a tool_call_update with the final output and return code."""
169- update = SessionUpdate5 (
167+ update = ToolCallUpdate (
170168 sessionUpdate = "tool_call_update" ,
171169 toolCallId = tool_call_id ,
172170 status = status ,
173171 content = [
174- ToolCallContent1 (
175- type = "content" , content = ContentBlock1 (type = "text" , text = f"```ansi\n { output } \n ```" )
172+ ContentToolCallContent (
173+ type = "content" , content = TextContentBlock (type = "text" , text = f"```ansi\n { output } \n ```" )
176174 )
177175 ],
178176 rawOutput = {"output" : output , "returncode" : returncode },
@@ -185,8 +183,8 @@ def add_message(self, role: str, content: str, **kwargs):
185183 if not getattr (self , "_emit_updates" , True ) or role != "assistant" :
186184 return
187185 text = str (content )
188- block = ContentBlock1 (type = "text" , text = text )
189- update = SessionUpdate2 (sessionUpdate = "agent_message_chunk" , content = block )
186+ block = TextContentBlock (type = "text" , text = text )
187+ update = AgentMessageChunk (sessionUpdate = "agent_message_chunk" , content = block )
190188 try :
191189 loop = asyncio .get_running_loop ()
192190 loop .create_task (self ._send (update ))
@@ -203,14 +201,15 @@ def _confirm_action_sync(self, tool_call_id: str, command: str) -> bool:
203201 PermissionOption (optionId = "reject-once" , name = "Reject" , kind = "reject_once" ),
204202 ],
205203 toolCall = ToolCallUpdate (
204+ sessionUpdate = "tool_call_update" ,
206205 toolCallId = tool_call_id ,
207206 title = "bash" ,
208207 kind = "execute" ,
209208 status = "pending" ,
210209 content = [
211- ToolCallContent1 (
210+ ContentToolCallContent (
212211 type = "content" ,
213- content = ContentBlock1 (type = "text" , text = f"```bash\n { command } \n ```" ),
212+ content = TextContentBlock (type = "text" , text = f"```bash\n { command } \n ```" ),
214213 )
215214 ],
216215 rawInput = {"command" : command },
@@ -222,7 +221,7 @@ def _confirm_action_sync(self, tool_call_id: str, command: str) -> bool:
222221 except Exception :
223222 return False
224223 out = resp .outcome
225- if isinstance (out , RequestPermissionOutcome2 ) and out .optionId in ("allow-once" , "allow-always" ):
224+ if isinstance (out , AllowedOutcome ) and out .optionId in ("allow-once" , "allow-always" ):
226225 return True
227226 return False
228227
@@ -253,7 +252,7 @@ def execute_action(self, action: dict) -> dict: # type: ignore[override]
253252 # Mark in progress
254253 self ._schedule (
255254 self ._send (
256- SessionUpdate5 (
255+ ToolCallUpdate (
257256 sessionUpdate = "tool_call_update" ,
258257 toolCallId = tool_id ,
259258 status = "in_progress" ,
@@ -428,9 +427,9 @@ async def prompt(self, params: PromptRequest) -> PromptResponse:
428427 await self ._client .sessionUpdate (
429428 SessionNotification (
430429 sessionId = params .sessionId ,
431- update = SessionUpdate2 (
430+ update = AgentMessageChunk (
432431 sessionUpdate = "agent_message_chunk" ,
433- content = ContentBlock1 (
432+ content = TextContentBlock (
434433 type = "text" ,
435434 text = (
436435 "mini-swe-agent load error: "
@@ -476,9 +475,9 @@ async def prompt(self, params: PromptRequest) -> PromptResponse:
476475 await self ._client .sessionUpdate (
477476 SessionNotification (
478477 sessionId = params .sessionId ,
479- update = SessionUpdate2 (
478+ update = AgentMessageChunk (
480479 sessionUpdate = "agent_message_chunk" ,
481- content = ContentBlock1 (type = "text" , text = "Human mode: please submit a bash command." ),
480+ content = TextContentBlock (type = "text" , text = "Human mode: please submit a bash command." ),
482481 ),
483482 )
484483 )
@@ -508,9 +507,9 @@ async def prompt(self, params: PromptRequest) -> PromptResponse:
508507 await self ._client .sessionUpdate (
509508 SessionNotification (
510509 sessionId = params .sessionId ,
511- update = SessionUpdate2 (
510+ update = AgentMessageChunk (
512511 sessionUpdate = "agent_message_chunk" ,
513- content = ContentBlock1 (
512+ content = TextContentBlock (
514513 type = "text" ,
515514 text = (
516515 "Agent finished. Type a new task in the next message to continue, or do nothing to end."
@@ -528,9 +527,9 @@ async def prompt(self, params: PromptRequest) -> PromptResponse:
528527 await self ._client .sessionUpdate (
529528 SessionNotification (
530529 sessionId = params .sessionId ,
531- update = SessionUpdate2 (
530+ update = AgentMessageChunk (
532531 sessionUpdate = "agent_message_chunk" ,
533- content = ContentBlock1 (type = "text" , text = f"Error while processing: { e } " ),
532+ content = TextContentBlock (type = "text" , text = f"Error while processing: { e } " ),
534533 ),
535534 )
536535 )
0 commit comments