agentpool 2.2.3__py3-none-any.whl → 2.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. acp/__init__.py +0 -4
  2. acp/acp_requests.py +20 -77
  3. acp/agent/connection.py +8 -0
  4. acp/agent/implementations/debug_server/debug_server.py +6 -2
  5. acp/agent/protocol.py +6 -0
  6. acp/client/connection.py +38 -29
  7. acp/client/implementations/default_client.py +3 -2
  8. acp/client/implementations/headless_client.py +2 -2
  9. acp/connection.py +2 -2
  10. acp/notifications.py +18 -49
  11. acp/schema/__init__.py +2 -0
  12. acp/schema/agent_responses.py +21 -0
  13. acp/schema/client_requests.py +3 -3
  14. acp/schema/session_state.py +63 -29
  15. acp/task/supervisor.py +2 -2
  16. acp/utils.py +2 -2
  17. agentpool/__init__.py +2 -0
  18. agentpool/agents/acp_agent/acp_agent.py +278 -263
  19. agentpool/agents/acp_agent/acp_converters.py +150 -17
  20. agentpool/agents/acp_agent/client_handler.py +35 -24
  21. agentpool/agents/acp_agent/session_state.py +14 -6
  22. agentpool/agents/agent.py +471 -643
  23. agentpool/agents/agui_agent/agui_agent.py +104 -107
  24. agentpool/agents/agui_agent/helpers.py +3 -4
  25. agentpool/agents/base_agent.py +485 -32
  26. agentpool/agents/claude_code_agent/FORKING.md +191 -0
  27. agentpool/agents/claude_code_agent/__init__.py +13 -1
  28. agentpool/agents/claude_code_agent/claude_code_agent.py +654 -334
  29. agentpool/agents/claude_code_agent/converters.py +4 -141
  30. agentpool/agents/claude_code_agent/models.py +77 -0
  31. agentpool/agents/claude_code_agent/static_info.py +100 -0
  32. agentpool/agents/claude_code_agent/usage.py +242 -0
  33. agentpool/agents/events/__init__.py +22 -0
  34. agentpool/agents/events/builtin_handlers.py +65 -0
  35. agentpool/agents/events/event_emitter.py +3 -0
  36. agentpool/agents/events/events.py +84 -3
  37. agentpool/agents/events/infer_info.py +145 -0
  38. agentpool/agents/events/processors.py +254 -0
  39. agentpool/agents/interactions.py +41 -6
  40. agentpool/agents/modes.py +13 -0
  41. agentpool/agents/slashed_agent.py +5 -4
  42. agentpool/agents/tool_wrapping.py +18 -6
  43. agentpool/common_types.py +35 -21
  44. agentpool/config_resources/acp_assistant.yml +2 -2
  45. agentpool/config_resources/agents.yml +3 -0
  46. agentpool/config_resources/agents_template.yml +1 -0
  47. agentpool/config_resources/claude_code_agent.yml +9 -8
  48. agentpool/config_resources/external_acp_agents.yml +2 -1
  49. agentpool/delegation/base_team.py +4 -30
  50. agentpool/delegation/pool.py +104 -265
  51. agentpool/delegation/team.py +57 -57
  52. agentpool/delegation/teamrun.py +50 -55
  53. agentpool/functional/run.py +10 -4
  54. agentpool/mcp_server/client.py +73 -38
  55. agentpool/mcp_server/conversions.py +54 -13
  56. agentpool/mcp_server/manager.py +9 -23
  57. agentpool/mcp_server/registries/official_registry_client.py +10 -1
  58. agentpool/mcp_server/tool_bridge.py +114 -79
  59. agentpool/messaging/connection_manager.py +11 -10
  60. agentpool/messaging/event_manager.py +5 -5
  61. agentpool/messaging/message_container.py +6 -30
  62. agentpool/messaging/message_history.py +87 -8
  63. agentpool/messaging/messagenode.py +52 -14
  64. agentpool/messaging/messages.py +2 -26
  65. agentpool/messaging/processing.py +10 -22
  66. agentpool/models/__init__.py +1 -1
  67. agentpool/models/acp_agents/base.py +6 -2
  68. agentpool/models/acp_agents/mcp_capable.py +124 -15
  69. agentpool/models/acp_agents/non_mcp.py +0 -23
  70. agentpool/models/agents.py +66 -66
  71. agentpool/models/agui_agents.py +1 -1
  72. agentpool/models/claude_code_agents.py +111 -17
  73. agentpool/models/file_parsing.py +0 -1
  74. agentpool/models/manifest.py +70 -50
  75. agentpool/prompts/conversion_manager.py +1 -1
  76. agentpool/prompts/prompts.py +5 -2
  77. agentpool/resource_providers/__init__.py +2 -0
  78. agentpool/resource_providers/aggregating.py +4 -2
  79. agentpool/resource_providers/base.py +13 -3
  80. agentpool/resource_providers/codemode/code_executor.py +72 -5
  81. agentpool/resource_providers/codemode/helpers.py +2 -2
  82. agentpool/resource_providers/codemode/provider.py +64 -12
  83. agentpool/resource_providers/codemode/remote_mcp_execution.py +2 -2
  84. agentpool/resource_providers/codemode/remote_provider.py +9 -12
  85. agentpool/resource_providers/filtering.py +3 -1
  86. agentpool/resource_providers/mcp_provider.py +66 -12
  87. agentpool/resource_providers/plan_provider.py +111 -18
  88. agentpool/resource_providers/pool.py +5 -3
  89. agentpool/resource_providers/resource_info.py +111 -0
  90. agentpool/resource_providers/static.py +2 -2
  91. agentpool/sessions/__init__.py +2 -0
  92. agentpool/sessions/manager.py +2 -3
  93. agentpool/sessions/models.py +9 -6
  94. agentpool/sessions/protocol.py +28 -0
  95. agentpool/sessions/session.py +11 -55
  96. agentpool/storage/manager.py +361 -54
  97. agentpool/talk/registry.py +4 -4
  98. agentpool/talk/talk.py +9 -10
  99. agentpool/testing.py +1 -1
  100. agentpool/tool_impls/__init__.py +6 -0
  101. agentpool/tool_impls/agent_cli/__init__.py +42 -0
  102. agentpool/tool_impls/agent_cli/tool.py +95 -0
  103. agentpool/tool_impls/bash/__init__.py +64 -0
  104. agentpool/tool_impls/bash/helpers.py +35 -0
  105. agentpool/tool_impls/bash/tool.py +171 -0
  106. agentpool/tool_impls/delete_path/__init__.py +70 -0
  107. agentpool/tool_impls/delete_path/tool.py +142 -0
  108. agentpool/tool_impls/download_file/__init__.py +80 -0
  109. agentpool/tool_impls/download_file/tool.py +183 -0
  110. agentpool/tool_impls/execute_code/__init__.py +55 -0
  111. agentpool/tool_impls/execute_code/tool.py +163 -0
  112. agentpool/tool_impls/grep/__init__.py +80 -0
  113. agentpool/tool_impls/grep/tool.py +200 -0
  114. agentpool/tool_impls/list_directory/__init__.py +73 -0
  115. agentpool/tool_impls/list_directory/tool.py +197 -0
  116. agentpool/tool_impls/question/__init__.py +42 -0
  117. agentpool/tool_impls/question/tool.py +127 -0
  118. agentpool/tool_impls/read/__init__.py +104 -0
  119. agentpool/tool_impls/read/tool.py +305 -0
  120. agentpool/tools/__init__.py +2 -1
  121. agentpool/tools/base.py +114 -34
  122. agentpool/tools/manager.py +57 -1
  123. agentpool/ui/base.py +2 -2
  124. agentpool/ui/mock_provider.py +2 -2
  125. agentpool/ui/stdlib_provider.py +2 -2
  126. agentpool/utils/streams.py +21 -96
  127. agentpool/vfs_registry.py +7 -2
  128. {agentpool-2.2.3.dist-info → agentpool-2.5.0.dist-info}/METADATA +16 -22
  129. {agentpool-2.2.3.dist-info → agentpool-2.5.0.dist-info}/RECORD +242 -195
  130. {agentpool-2.2.3.dist-info → agentpool-2.5.0.dist-info}/WHEEL +1 -1
  131. agentpool_cli/__main__.py +20 -0
  132. agentpool_cli/create.py +1 -1
  133. agentpool_cli/serve_acp.py +59 -1
  134. agentpool_cli/serve_opencode.py +1 -1
  135. agentpool_cli/ui.py +557 -0
  136. agentpool_commands/__init__.py +12 -5
  137. agentpool_commands/agents.py +1 -1
  138. agentpool_commands/pool.py +260 -0
  139. agentpool_commands/session.py +1 -1
  140. agentpool_commands/text_sharing/__init__.py +119 -0
  141. agentpool_commands/text_sharing/base.py +123 -0
  142. agentpool_commands/text_sharing/github_gist.py +80 -0
  143. agentpool_commands/text_sharing/opencode.py +462 -0
  144. agentpool_commands/text_sharing/paste_rs.py +59 -0
  145. agentpool_commands/text_sharing/pastebin.py +116 -0
  146. agentpool_commands/text_sharing/shittycodingagent.py +112 -0
  147. agentpool_commands/utils.py +31 -32
  148. agentpool_config/__init__.py +30 -2
  149. agentpool_config/agentpool_tools.py +498 -0
  150. agentpool_config/converters.py +1 -1
  151. agentpool_config/event_handlers.py +42 -0
  152. agentpool_config/events.py +1 -1
  153. agentpool_config/forward_targets.py +1 -4
  154. agentpool_config/jinja.py +3 -3
  155. agentpool_config/mcp_server.py +1 -5
  156. agentpool_config/nodes.py +1 -1
  157. agentpool_config/observability.py +44 -0
  158. agentpool_config/session.py +0 -3
  159. agentpool_config/storage.py +38 -39
  160. agentpool_config/task.py +3 -3
  161. agentpool_config/tools.py +11 -28
  162. agentpool_config/toolsets.py +22 -90
  163. agentpool_server/a2a_server/agent_worker.py +307 -0
  164. agentpool_server/a2a_server/server.py +23 -18
  165. agentpool_server/acp_server/acp_agent.py +125 -56
  166. agentpool_server/acp_server/commands/acp_commands.py +46 -216
  167. agentpool_server/acp_server/commands/docs_commands/fetch_repo.py +8 -7
  168. agentpool_server/acp_server/event_converter.py +651 -0
  169. agentpool_server/acp_server/input_provider.py +53 -10
  170. agentpool_server/acp_server/server.py +1 -11
  171. agentpool_server/acp_server/session.py +90 -410
  172. agentpool_server/acp_server/session_manager.py +8 -34
  173. agentpool_server/agui_server/server.py +3 -1
  174. agentpool_server/mcp_server/server.py +5 -2
  175. agentpool_server/opencode_server/ENDPOINTS.md +53 -14
  176. agentpool_server/opencode_server/OPENCODE_UI_TOOLS_COMPLETE.md +202 -0
  177. agentpool_server/opencode_server/__init__.py +0 -8
  178. agentpool_server/opencode_server/converters.py +132 -26
  179. agentpool_server/opencode_server/input_provider.py +160 -8
  180. agentpool_server/opencode_server/models/__init__.py +42 -20
  181. agentpool_server/opencode_server/models/app.py +12 -0
  182. agentpool_server/opencode_server/models/events.py +203 -29
  183. agentpool_server/opencode_server/models/mcp.py +19 -0
  184. agentpool_server/opencode_server/models/message.py +18 -1
  185. agentpool_server/opencode_server/models/parts.py +134 -1
  186. agentpool_server/opencode_server/models/question.py +56 -0
  187. agentpool_server/opencode_server/models/session.py +13 -1
  188. agentpool_server/opencode_server/routes/__init__.py +4 -0
  189. agentpool_server/opencode_server/routes/agent_routes.py +33 -2
  190. agentpool_server/opencode_server/routes/app_routes.py +66 -3
  191. agentpool_server/opencode_server/routes/config_routes.py +66 -5
  192. agentpool_server/opencode_server/routes/file_routes.py +184 -5
  193. agentpool_server/opencode_server/routes/global_routes.py +1 -1
  194. agentpool_server/opencode_server/routes/lsp_routes.py +1 -1
  195. agentpool_server/opencode_server/routes/message_routes.py +122 -66
  196. agentpool_server/opencode_server/routes/permission_routes.py +63 -0
  197. agentpool_server/opencode_server/routes/pty_routes.py +23 -22
  198. agentpool_server/opencode_server/routes/question_routes.py +128 -0
  199. agentpool_server/opencode_server/routes/session_routes.py +139 -68
  200. agentpool_server/opencode_server/routes/tui_routes.py +1 -1
  201. agentpool_server/opencode_server/server.py +47 -2
  202. agentpool_server/opencode_server/state.py +30 -0
  203. agentpool_storage/__init__.py +0 -4
  204. agentpool_storage/base.py +81 -2
  205. agentpool_storage/claude_provider/ARCHITECTURE.md +433 -0
  206. agentpool_storage/claude_provider/__init__.py +42 -0
  207. agentpool_storage/{claude_provider.py → claude_provider/provider.py} +190 -8
  208. agentpool_storage/file_provider.py +149 -15
  209. agentpool_storage/memory_provider.py +132 -12
  210. agentpool_storage/opencode_provider/ARCHITECTURE.md +386 -0
  211. agentpool_storage/opencode_provider/__init__.py +16 -0
  212. agentpool_storage/opencode_provider/helpers.py +414 -0
  213. agentpool_storage/opencode_provider/provider.py +895 -0
  214. agentpool_storage/session_store.py +20 -6
  215. agentpool_storage/sql_provider/sql_provider.py +135 -2
  216. agentpool_storage/sql_provider/utils.py +2 -12
  217. agentpool_storage/zed_provider/__init__.py +16 -0
  218. agentpool_storage/zed_provider/helpers.py +281 -0
  219. agentpool_storage/zed_provider/models.py +130 -0
  220. agentpool_storage/zed_provider/provider.py +442 -0
  221. agentpool_storage/zed_provider.py +803 -0
  222. agentpool_toolsets/__init__.py +0 -2
  223. agentpool_toolsets/builtin/__init__.py +2 -4
  224. agentpool_toolsets/builtin/code.py +4 -4
  225. agentpool_toolsets/builtin/debug.py +115 -40
  226. agentpool_toolsets/builtin/execution_environment.py +54 -165
  227. agentpool_toolsets/builtin/skills.py +0 -77
  228. agentpool_toolsets/builtin/subagent_tools.py +64 -51
  229. agentpool_toolsets/builtin/workers.py +4 -2
  230. agentpool_toolsets/composio_toolset.py +2 -2
  231. agentpool_toolsets/entry_points.py +3 -1
  232. agentpool_toolsets/fsspec_toolset/grep.py +25 -5
  233. agentpool_toolsets/fsspec_toolset/helpers.py +3 -2
  234. agentpool_toolsets/fsspec_toolset/toolset.py +350 -66
  235. agentpool_toolsets/mcp_discovery/data/mcp_servers.parquet +0 -0
  236. agentpool_toolsets/mcp_discovery/toolset.py +74 -17
  237. agentpool_toolsets/mcp_run_toolset.py +8 -11
  238. agentpool_toolsets/notifications.py +33 -33
  239. agentpool_toolsets/openapi.py +3 -1
  240. agentpool_toolsets/search_toolset.py +3 -1
  241. agentpool_config/resources.py +0 -33
  242. agentpool_server/acp_server/acp_tools.py +0 -43
  243. agentpool_server/acp_server/commands/spawn.py +0 -210
  244. agentpool_storage/opencode_provider.py +0 -730
  245. agentpool_storage/text_log_provider.py +0 -276
  246. agentpool_toolsets/builtin/chain.py +0 -288
  247. agentpool_toolsets/builtin/user_interaction.py +0 -52
  248. agentpool_toolsets/semantic_memory_toolset.py +0 -536
  249. {agentpool-2.2.3.dist-info → agentpool-2.5.0.dist-info}/entry_points.txt +0 -0
  250. {agentpool-2.2.3.dist-info → agentpool-2.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -87,20 +87,15 @@ class ACPSessionManager:
87
87
  logger.warning("Session ID already exists", session_id=session_id)
88
88
  msg = f"Session {session_id} already exists"
89
89
  raise ValueError(msg)
90
-
91
90
  # Create and persist session data via pool's SessionManager
92
91
  data = SessionData(
93
92
  session_id=session_id,
94
93
  agent_name=default_agent_name,
95
- conversation_id=f"conv_{session_id}",
94
+ conversation_id=session_id,
96
95
  cwd=cwd,
97
- metadata={
98
- "protocol": "acp",
99
- "mcp_server_count": len(mcp_servers) if mcp_servers else 0,
100
- },
96
+ metadata={"protocol": "acp", "mcp_server_count": len(mcp_servers or [])},
101
97
  )
102
98
  await self.session_manager.save(data)
103
-
104
99
  # Create the ACP-specific runtime session
105
100
  session = ACPSession(
106
101
  session_id=session_id,
@@ -115,26 +110,16 @@ class ACPSessionManager:
115
110
  manager=self,
116
111
  )
117
112
  session.register_update_callback(self._on_commands_updated)
118
-
119
113
  # Initialize async resources
120
114
  await session.initialize()
121
-
122
115
  # Initialize MCP servers if any are provided
123
116
  await session.initialize_mcp_servers()
124
-
125
117
  self._active[session_id] = session
126
118
  logger.info("Created ACP session", session_id=session_id, agent=default_agent_name)
127
119
  return session_id
128
120
 
129
121
  def get_session(self, session_id: str) -> ACPSession | None:
130
- """Get an active session by ID.
131
-
132
- Args:
133
- session_id: Session identifier
134
-
135
- Returns:
136
- ACPSession instance or None if not found
137
- """
122
+ """Get an active session by ID."""
138
123
  return self._active.get(session_id)
139
124
 
140
125
  async def resume_session(
@@ -161,7 +146,6 @@ class ACPSessionManager:
161
146
  # Check if already active
162
147
  if session_id in self._active:
163
148
  return self._active[session_id]
164
-
165
149
  # Try to load from pool's session store
166
150
  data = await self.session_manager.store.load(session_id)
167
151
  if data is None:
@@ -170,11 +154,8 @@ class ACPSessionManager:
170
154
 
171
155
  # Validate agent still exists
172
156
  if data.agent_name not in self._pool.all_agents:
173
- logger.warning(
174
- "Session agent no longer exists",
175
- session_id=session_id,
176
- agent=data.agent_name,
177
- )
157
+ msg = "Session agent no longer exists"
158
+ logger.warning(msg, session_id=session_id, agent=data.agent_name)
178
159
  return None
179
160
 
180
161
  # Reconstruct ACP session
@@ -191,10 +172,8 @@ class ACPSessionManager:
191
172
  manager=self,
192
173
  )
193
174
  session.register_update_callback(self._on_commands_updated)
194
-
195
175
  # Initialize async resources
196
176
  await session.initialize()
197
-
198
177
  self._active[session_id] = session
199
178
  logger.info("Resumed ACP session", session_id=session_id)
200
179
  return session
@@ -224,10 +203,8 @@ class ACPSessionManager:
224
203
  session_id: Session identifier
225
204
  agent_name: New agent name
226
205
  """
227
- session = self._active.get(session_id)
228
- if not session:
206
+ if not self._active.get(session_id):
229
207
  return
230
-
231
208
  # Load, update, and save session data
232
209
  data = await self.session_manager.store.load(session_id)
233
210
  if data:
@@ -267,11 +244,8 @@ class ACPSessionManager:
267
244
  await session.close()
268
245
  closed_count += 1
269
246
  except Exception:
270
- logger.exception(
271
- "Error closing session during pool swap", session=session.session_id
272
- )
273
-
274
- logger.info("Closed all sessions for pool swap", count=closed_count)
247
+ logger.exception("Error closing session", session=session.session_id)
248
+ logger.info("Closed all sessions.", count=closed_count)
275
249
  return closed_count
276
250
 
277
251
  async def __aenter__(self) -> Self:
@@ -88,7 +88,9 @@ class AGUIServer(HTTPServer):
88
88
  if pool_agent is None:
89
89
  msg = f"Agent {agent_name!r} not found"
90
90
  return JSONResponse({"error": msg}, status_code=404)
91
- agentlet = await pool_agent.get_agentlet(None, pool_agent.model_name, str)
91
+ agentlet = await pool_agent.get_agentlet(
92
+ model=pool_agent.model_name, output_type=str, input_provider=None
93
+ )
92
94
  try:
93
95
  # Use AGUIAdapter.dispatch_request() which handles the full
94
96
  # AG-UI protocol: parsing request, running agent, streaming response
@@ -5,7 +5,6 @@ from __future__ import annotations
5
5
  from collections import defaultdict
6
6
  from typing import TYPE_CHECKING, Any
7
7
 
8
- from fastmcp import FastMCP
9
8
  from fastmcp.server.middleware.caching import ResponseCachingMiddleware
10
9
  from key_value.aio.stores.disk import DiskStore
11
10
  import mcp
@@ -22,6 +21,7 @@ if TYPE_CHECKING:
22
21
  from collections.abc import Awaitable, Callable
23
22
  from contextlib import AbstractAsyncContextManager
24
23
 
24
+ from fastmcp import FastMCP
25
25
  from mcp.server.lowlevel.server import LifespanResultT
26
26
  from pydantic import AnyUrl
27
27
 
@@ -71,6 +71,8 @@ class MCPServer(BaseServer):
71
71
  instructions: Instructions for server usage
72
72
  raise_exceptions: Whether to raise exceptions during server start
73
73
  """
74
+ from fastmcp import FastMCP
75
+
74
76
  from agentpool.resource_providers.pool import PoolResourceProvider
75
77
 
76
78
  super().__init__(pool, name=name, raise_exceptions=raise_exceptions)
@@ -129,7 +131,8 @@ class MCPServer(BaseServer):
129
131
  idempotentHint=tool.hints.idempotent,
130
132
  openWorldHint=tool.hints.open_world,
131
133
  )
132
- self.fastmcp.tool(annotations=tool_annotations, task=True)(tool_handler)
134
+ # TODO: set task=True?
135
+ self.fastmcp.tool(annotations=tool_annotations)(tool_handler)
133
136
 
134
137
  self._tools_registered = True
135
138
  logger.info("Registered MCP tools", count=len(tools))
@@ -43,7 +43,7 @@ This document tracks the implementation status of OpenCode-compatible API endpoi
43
43
  | Status | Method | Path | Description |
44
44
  |--------|--------|------|-------------|
45
45
  | [x] | GET | `/config` | Get config info |
46
- | [ ] | PATCH | `/config` | Update config |
46
+ | [x] | PATCH | `/config` | Update config |
47
47
  | [~] | GET | `/config/providers` | List providers and default models |
48
48
 
49
49
  ---
@@ -90,9 +90,9 @@ This document tracks the implementation status of OpenCode-compatible API endpoi
90
90
  | Status | Method | Path | Description |
91
91
  |--------|--------|------|-------------|
92
92
  | [x] | GET | `/session/{id}/message` | List messages in session |
93
- | [~] | POST | `/session/{id}/message` | Send message (wait for response) |
93
+ | [x] | POST | `/session/{id}/message` | Send message (wait for response) |
94
94
  | [x] | GET | `/session/{id}/message/{messageID}` | Get message details |
95
- | [ ] | POST | `/session/{id}/prompt_async` | Send message async (no wait) |
95
+ | [x] | POST | `/session/{id}/prompt_async` | Send message async (no wait) |
96
96
  | [x] | POST | `/session/{id}/command` | Execute slash command (MCP prompts) |
97
97
  | [x] | POST | `/session/{id}/shell` | Run shell command |
98
98
 
@@ -140,6 +140,7 @@ This document tracks the implementation status of OpenCode-compatible API endpoi
140
140
  | [x] | GET | `/formatter` | Get formatter status (stub) |
141
141
  | [~] | GET | `/mcp` | Get MCP server status |
142
142
  | [x] | POST | `/mcp` | Add MCP server dynamically |
143
+ | [x] | GET | `/experimental/resource` | List MCP resources from connected servers |
143
144
 
144
145
  ---
145
146
 
@@ -171,12 +172,12 @@ This document tracks the implementation status of OpenCode-compatible API endpoi
171
172
 
172
173
  | Status | Method | Path | Description |
173
174
  |--------|--------|------|-------------|
174
- | [ ] | GET | `/pty` | List all PTY sessions |
175
- | [ ] | POST | `/pty` | Create a new PTY session |
176
- | [ ] | GET | `/pty/{ptyID}` | Get PTY session details |
177
- | [ ] | PATCH | `/pty/{ptyID}` | Update PTY session (resize, etc.) |
178
- | [ ] | DELETE | `/pty/{ptyID}` | Remove/kill PTY session |
179
- | [ ] | GET | `/pty/{ptyID}/connect` | Connect to PTY (WebSocket) |
175
+ | [x] | GET | `/pty` | List all PTY sessions |
176
+ | [x] | POST | `/pty` | Create a new PTY session |
177
+ | [x] | GET | `/pty/{ptyID}` | Get PTY session details |
178
+ | [x] | PATCH | `/pty/{ptyID}` | Update PTY session (resize, etc.) |
179
+ | [x] | DELETE | `/pty/{ptyID}` | Remove/kill PTY session |
180
+ | [x] | WS | `/pty/{ptyID}/connect` | Connect to PTY (WebSocket) |
180
181
 
181
182
  ### PTY SSE Event Types
182
183
 
@@ -234,7 +235,7 @@ All event types supported by the OpenCode protocol:
234
235
  | [-] | `global.disposed` | Global instance disposed (multi-project, not needed) |
235
236
  | [-] | `installation.updated` | Installation updated (auto-upgrade complete, not needed) |
236
237
  | [x] | `installation.update-available` | Update available (via `tui.toast.show` workaround) |
237
- | [ ] | `project.updated` | Project configuration updated |
238
+ | [x] | `project.updated` | Project metadata updated |
238
239
  | [-] | `server.instance.disposed` | Server instance disposed (multi-project, not needed) |
239
240
  | [x] | `lsp.updated` | LSP server status updated |
240
241
  | [~] | `lsp.client.diagnostics` | LSP client diagnostics received |
@@ -247,10 +248,10 @@ All event types supported by the OpenCode protocol:
247
248
  | [ ] | `session.diff` | Session file diff updated |
248
249
  | [x] | `session.error` | Session encountered an error |
249
250
  | [x] | `message.updated` | Message created or updated |
250
- | [ ] | `message.removed` | Message removed |
251
+ | [x] | `message.removed` | Message removed (during revert) |
251
252
  | [x] | `message.part.updated` | Message part (text, tool, etc.) updated |
252
- | [ ] | `message.part.removed` | Message part removed |
253
- | [x] | `permission.updated` | Tool permission requested (awaiting user response) |
253
+ | [x] | `message.part.removed` | Message part removed (during revert) |
254
+ | [x] | `permission.asked` | Tool permission requested (awaiting user response) |
254
255
  | [x] | `permission.replied` | Permission request resolved (user responded) |
255
256
  | [x] | `todo.updated` | Todo list item updated |
256
257
  | [ ] | `file.edited` | File was edited |
@@ -312,6 +313,44 @@ duty opencode
312
313
 
313
314
  ---
314
315
 
316
+ ## Tool Metadata Support - Complete OpenCode UI Coverage
317
+
318
+ **These are ALL 11 tools registered in OpenCode's UI that use metadata for enhanced rendering:**
319
+
320
+ | # | Tool | AgentPool | Metadata | UI Feature |
321
+ |---|------|-----------|----------|------------|
322
+ | 1 | `read` | ✅ **DONE** | `preview`, `truncated` | File preview, truncation badge |
323
+ | 2 | `list` | ✅ **DONE** | `count`, `truncated` | File count, directory tree |
324
+ | 3 | `glob` | ❌ **MISSING** | `count`, `truncated` | File count, pattern display |
325
+ | 4 | `grep` | ✅ **DONE** | `matches`, `truncated` | Match count badge |
326
+ | 5 | `webfetch` | ❌ **MISSING** | `url`, `format` | URL display |
327
+ | 6 | `task` | ❌ **MISSING** | `summary`, `sessionId` | **Sub-agent tool list** |
328
+ | 7 | `bash` | ✅ **DONE** | `output`, `exit`, `description` | Live output, exit code |
329
+ | 8 | `edit` | ✅ **DONE** | `diff`, `filediff`, `diagnostics` | **Diff viewer**, LSP errors |
330
+ | 9 | `write` | ⚠️ **PARTIAL** | `filePath`, `content`, (TODO: `diagnostics`) | Code viewer, LSP errors |
331
+ | 10 | `todowrite` | ✅ **DONE** | `todos` | **Interactive checkboxes** |
332
+ | 11 | `question` | ✅ **DONE** | `answers` | **Q&A display** |
333
+
334
+ ### Summary
335
+ - **Total:** 11 OpenCode UI tools
336
+ - **Implemented:** 6/11 (✅)
337
+ - **Partial:** 1/11 (⚠️)
338
+ - **Missing:** 4/11 (❌)
339
+
340
+ ### Missing Tools for 100% Coverage
341
+ 1. **`glob`** - File pattern matching (HIGH priority - complements grep)
342
+ 2. **`task`** - Sub-agent execution tracking (HIGH priority - delegation)
343
+ 3. **`webfetch`** - Web content fetching (LOW priority - external)
344
+ 4. **`write` diagnostics** - LSP integration (MEDIUM priority)
345
+
346
+ ### Other OpenCode Tools (Not UI-Rendered)
347
+ These exist in OpenCode but don't have special UI treatment:
348
+ - `plan`, `batch`, `multiedit`, `patch`, `lsp`, `skill`, `codesearch`, `websearch`
349
+
350
+ See [`OPENCODE_UI_TOOLS_COMPLETE.md`](file:///home/phil65/dev/oss/agentpool/OPENCODE_UI_TOOLS_COMPLETE.md) for detailed metadata specs.
351
+
352
+ ---
353
+
315
354
  ## Tool UI Rendering
316
355
 
317
356
  The OpenCode TUI has special rendering for certain tool names. Tools must use these exact names
@@ -340,7 +379,7 @@ Some tools also use `props.metadata` for additional UI data:
340
379
  | Tool | Metadata Fields | Description |
341
380
  |------|-----------------|-------------|
342
381
  | `edit` | `filediff`, `diagnostics` | Diff data and LSP diagnostics |
343
- | `write` | `diagnostics` | LSP diagnostics for the written file |
382
+ | `write` | `filePath`, `content` | File path and content for UI display (diagnostics TODO) |
344
383
  | `bash` | `command` | Fallback if `input.command` missing |
345
384
  | `task` | `summary`, `sessionId` | Child tool summary and session ID |
346
385
 
@@ -0,0 +1,202 @@
1
+ # OpenCode Tools with UI Metadata Support - Complete List
2
+
3
+ ## ALL OpenCode Tools That Get Special UI Treatment
4
+
5
+ These are **all** tools registered in OpenCode's UI (`message-part.tsx`) that use metadata for enhanced rendering:
6
+
7
+ | # | Tool | AgentPool Status | Metadata Fields | UI Feature |
8
+ |---|------|------------------|-----------------|------------|
9
+ | 1 | `read` | ✅ **DONE** | `preview`, `truncated` | Shows file preview, truncation badge |
10
+ | 2 | `list` | ✅ **DONE** | `count`, `truncated` | File count, directory tree |
11
+ | 3 | `glob` | ❌ **MISSING** | `count`, `truncated` | File count, pattern display |
12
+ | 4 | `grep` | ✅ **DONE** | `matches`, `truncated` | Match count badge |
13
+ | 5 | `webfetch` | ❌ **MISSING** | `url`, `format` | URL display, format indicator |
14
+ | 6 | `task` | ❌ **MISSING** | `summary`, `sessionId` | Sub-agent tool list, navigation |
15
+ | 7 | `bash` | ✅ **DONE** | `output`, `exit`, `description` | Live output, exit code, command |
16
+ | 8 | `edit` | ✅ **DONE** | `diff`, `filediff`, `diagnostics` | **Diff viewer**, LSP errors |
17
+ | 9 | `write` | ⚠️ **PARTIAL** | `diagnostics`, `filepath`, `exists` | Code viewer, LSP errors |
18
+ | 10 | `todowrite` | ✅ **DONE** | `todos` | **Interactive checkbox list** |
19
+ | 11 | `question` | ✅ **DONE** | `answers` | **Q&A display** |
20
+
21
+ ---
22
+
23
+ ## Summary
24
+
25
+ **Total OpenCode UI Tools:** 11
26
+ **Implemented:** 6 (✅)
27
+ **Partial:** 1 (⚠️)
28
+ **Missing:** 4 (❌)
29
+
30
+ ### ✅ Implemented (6/11)
31
+ - `read`, `list`, `grep`, `bash`, `edit`, `todowrite`, `question`
32
+
33
+ ### ⚠️ Partial (1/11)
34
+ - `write` - exists but missing diagnostics integration
35
+
36
+ ### ❌ Missing (4/11)
37
+ 1. **`glob`** - File pattern matching (like grep but for filenames)
38
+ 2. **`webfetch`** - Fetch web content
39
+ 3. **`task`** - Sub-agent execution with tool summary
40
+ 4. **`write` diagnostics** - Need LSP integration
41
+
42
+ ---
43
+
44
+ ## Detailed Metadata Specifications
45
+
46
+ ### 1. read ✅
47
+ ```typescript
48
+ metadata: {
49
+ preview: string // First 20 lines
50
+ truncated: boolean // Was content cut off?
51
+ }
52
+ ```
53
+
54
+ ### 2. list ✅
55
+ ```typescript
56
+ metadata: {
57
+ count: number // Total files/dirs
58
+ truncated: boolean // Hit max limit?
59
+ }
60
+ ```
61
+
62
+ ### 3. glob ❌ NOT IMPLEMENTED
63
+ ```typescript
64
+ metadata: {
65
+ count: number // Files matched
66
+ truncated: boolean // Results limited?
67
+ }
68
+ ```
69
+
70
+ ### 4. grep ✅
71
+ ```typescript
72
+ metadata: {
73
+ matches: number // Match count
74
+ truncated: boolean // Results limited?
75
+ }
76
+ ```
77
+
78
+ ### 5. webfetch ❌ NOT IMPLEMENTED
79
+ ```typescript
80
+ metadata: {
81
+ url: string // Target URL
82
+ format: string // "markdown" | "html" | "text"
83
+ timeout?: number // Request timeout
84
+ }
85
+ ```
86
+
87
+ ### 6. task ❌ NOT IMPLEMENTED
88
+ ```typescript
89
+ metadata: {
90
+ summary: Array<{ // Sub-agent's tool calls
91
+ id: string
92
+ tool: string
93
+ state: {
94
+ status: string
95
+ title?: string
96
+ }
97
+ }>
98
+ sessionId: string // For navigation to sub-agent session
99
+ }
100
+ ```
101
+
102
+ ### 7. bash ✅
103
+ ```typescript
104
+ metadata: {
105
+ output: string // Combined stdout+stderr
106
+ exit: number | null // Exit code
107
+ description: string // Command description
108
+ }
109
+ ```
110
+
111
+ ### 8. edit ✅
112
+ ```typescript
113
+ metadata: {
114
+ diff: string // Unified diff format
115
+ filediff: {
116
+ file: string
117
+ before: string
118
+ after: string
119
+ additions: number
120
+ deletions: number
121
+ }
122
+ diagnostics: Record<string, Diagnostic[]>
123
+ }
124
+ ```
125
+
126
+ ### 9. write ⚠️ PARTIAL
127
+ ```typescript
128
+ metadata: {
129
+ diagnostics: Record<string, Diagnostic[]> // ⚠️ Not implemented
130
+ filepath: string
131
+ exists: boolean // Did file exist before?
132
+ }
133
+ ```
134
+
135
+ ### 10. todowrite ✅
136
+ ```typescript
137
+ metadata: {
138
+ todos: Array<{
139
+ content: string
140
+ status: "completed" | "pending" | "in_progress"
141
+ }>
142
+ }
143
+ ```
144
+
145
+ ### 11. question ✅
146
+ ```typescript
147
+ metadata: {
148
+ answers: Array<Array<string>> // One array per question
149
+ }
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Implementation Priority
155
+
156
+ ### Must Have (P0) - Core Functionality
157
+ - ✅ All filesystem tools: read, list, grep
158
+ - ✅ Basic execution: bash
159
+ - ✅ File editing: edit
160
+ - ✅ Planning: todowrite
161
+ - ✅ Interaction: question
162
+
163
+ ### Should Have (P1) - Enhanced Features
164
+ - ❌ **`glob`** - File pattern search (HIGH - complements grep)
165
+ - ❌ **`task`** - Sub-agent tracking (HIGH - important for delegation)
166
+ - ⚠️ **`write` diagnostics** - LSP integration (MEDIUM)
167
+
168
+ ### Nice to Have (P2) - Optional
169
+ - ❌ **`webfetch`** - Web content (LOW - external dependency)
170
+
171
+ ---
172
+
173
+ ## What's Missing vs OpenCode
174
+
175
+ OpenCode has these additional tools that we don't implement:
176
+
177
+ | OpenCode Tool | Purpose | Why Not in AgentPool? |
178
+ |---------------|---------|----------------------|
179
+ | `plan` | Plan management | We use `get_plan`/`set_plan` instead |
180
+ | `todoread` | Read todos | Handled by `get_plan` |
181
+ | `batch` | Parallel tool execution | Generic utility, not core |
182
+ | `multiedit` | Multi-file edits | Advanced feature |
183
+ | `patch` | Apply git patches | Git-specific |
184
+ | `lsp` | LSP queries | We have LSP but not as a tool |
185
+ | `skill` | Execute skills | OpenCode-specific |
186
+ | `codesearch` | Semantic search | Advanced feature |
187
+ | `websearch` | Web search | External service |
188
+
189
+ **Note:** These are all valid tools but not part of the core UI metadata rendering system.
190
+
191
+ ---
192
+
193
+ ## Next Steps
194
+
195
+ To achieve 100% OpenCode UI compatibility:
196
+
197
+ 1. **Implement `glob` tool** - File pattern matching with metadata
198
+ 2. **Implement `task` tool** - Sub-agent execution tracking
199
+ 3. **Add diagnostics to `write`** - LSP integration
200
+ 4. **Implement `webfetch`** - Web content fetching (optional)
201
+
202
+ After these 4 implementations, we'll have **complete** OpenCode UI metadata support!
@@ -17,11 +17,3 @@ Or programmatically:
17
17
  app = create_app(working_dir="/path/to/project")
18
18
  # Use with uvicorn or other ASGI server
19
19
  """
20
-
21
- from agentpool_server.opencode_server.server import (
22
- OpenCodeServer,
23
- create_app,
24
- run_server,
25
- )
26
-
27
- __all__ = ["OpenCodeServer", "create_app", "run_server"]