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
@@ -14,11 +14,6 @@ from agentpool_server.acp_server.session import ACPSession # noqa: TC001
14
14
  class ListSessionsCommand(NodeCommand):
15
15
  """List all available ACP sessions.
16
16
 
17
- Shows:
18
- - Session ID and status (active/stored)
19
- - Agent name and working directory
20
- - Creation time and last activity
21
-
22
17
  Options:
23
18
  --active Show only active sessions
24
19
  --stored Show only stored sessions
@@ -71,14 +66,15 @@ class ListSessionsCommand(NodeCommand):
71
66
  output_lines = ["## 📋 ACP Sessions\n"]
72
67
 
73
68
  # Collect all sessions to paginate
74
- all_sessions: list[tuple[str, str, dict[str, str | None]]] = [] # (id, type, info)
69
+ # (id, type, info) where info includes conversation_id for message counting
70
+ all_sessions: list[tuple[str, str, dict[str, str | None]]] = []
75
71
 
76
72
  # Collect active sessions
77
73
  if active:
78
74
  active_sessions = session.manager._active
79
75
  for session_id, sess in active_sessions.items():
80
76
  session_data = await session.manager.session_manager.store.load(session_id)
81
- title = session_data.title if session_data else None
77
+ conv_id = session_data.conversation_id if session_data else None
82
78
  is_current = session_id == session.session_id
83
79
  all_sessions.append((
84
80
  session_id,
@@ -86,7 +82,7 @@ class ListSessionsCommand(NodeCommand):
86
82
  {
87
83
  "agent_name": sess.current_agent_name,
88
84
  "cwd": sess.cwd or "unknown",
89
- "title": title,
85
+ "conversation_id": conv_id,
90
86
  "is_current": "yes" if is_current else None,
91
87
  "last_active": None,
92
88
  },
@@ -111,7 +107,7 @@ class ListSessionsCommand(NodeCommand):
111
107
  {
112
108
  "agent_name": session_data.agent_name,
113
109
  "cwd": session_data.cwd or "unknown",
114
- "title": session_data.title,
110
+ "conversation_id": session_data.conversation_id,
115
111
  "is_current": None,
116
112
  "last_active": session_data.last_active.strftime(
117
113
  "%Y-%m-%d %H:%M"
@@ -121,7 +117,28 @@ class ListSessionsCommand(NodeCommand):
121
117
  except Exception as e: # noqa: BLE001
122
118
  output_lines.append(f"*Error loading stored sessions: {e}*\n")
123
119
 
124
- # Calculate pagination
120
+ # Get message counts and titles from storage
121
+ all_conv_ids = [
122
+ conv_id for _, _, info in all_sessions if (conv_id := info.get("conversation_id"))
123
+ ]
124
+ storage = session.agent_pool.storage
125
+ msg_counts = await storage.get_message_counts(all_conv_ids) if storage else {}
126
+ titles = await storage.get_conversation_titles(all_conv_ids) if storage else {}
127
+
128
+ # Add titles to session info
129
+ for _, _, info in all_sessions:
130
+ if conv_id := info.get("conversation_id"):
131
+ info["title"] = titles.get(conv_id)
132
+
133
+ # Filter out sessions with 0 messages (unless showing detail view)
134
+ if not detail:
135
+ all_sessions = [
136
+ (sid, stype, info)
137
+ for sid, stype, info in all_sessions
138
+ if msg_counts.get(info.get("conversation_id") or "", 0) > 0
139
+ ]
140
+
141
+ # Calculate pagination AFTER filtering
125
142
  total_count = len(all_sessions)
126
143
  total_pages = (total_count + per_page - 1) // per_page if total_count > 0 else 1
127
144
  page = min(page, total_pages)
@@ -159,15 +176,22 @@ class ListSessionsCommand(NodeCommand):
159
176
  output_lines.append("")
160
177
  else:
161
178
  # Compact table view (default)
162
- output_lines.append("| Title | Agent | Last Active |")
163
- output_lines.append("|-------|-------|-------------|")
179
+ # Table with multi-line session cell (title + ID using <br>)
180
+ output_lines.append("| Session | Agent | Msgs | Last Active |")
181
+ output_lines.append("|---------|-------|------|-------------|")
164
182
  for session_id, _session_type, info in page_sessions:
165
- title = info["title"] or session_id[:16]
183
+ title = info["title"] or "(untitled)"
166
184
  if info["is_current"]:
167
185
  title = f"▶️ {title}"
168
186
  agent = info["agent_name"]
187
+ conv_id = info.get("conversation_id") or ""
188
+ msg_count = msg_counts.get(conv_id, 0)
169
189
  last_active = info["last_active"] or "-"
170
- output_lines.append(f"| {title} | {agent} | {last_active} |")
190
+ # Two lines in session cell: title and ID
191
+ session_cell = f"{title} `{session_id}`"
192
+ output_lines.append(
193
+ f"| {session_cell} | {agent} | {msg_count} | {last_active} |"
194
+ )
171
195
  output_lines.append("")
172
196
 
173
197
  # Add pagination info
@@ -190,11 +214,6 @@ class ListSessionsCommand(NodeCommand):
190
214
  class LoadSessionCommand(NodeCommand):
191
215
  """Load a previous ACP session with conversation replay.
192
216
 
193
- This command will:
194
- 1. Look up the session by ID
195
- 2. Replay the conversation history via ACP notifications
196
- 3. Restore the session context (agent, working directory)
197
-
198
217
  Options:
199
218
  --preview Show session info without loading
200
219
  --no-replay Load session without replaying conversation
@@ -253,8 +272,14 @@ class LoadSessionCommand(NodeCommand):
253
272
  f"## 📋 Session Preview: `{session_id}`\n",
254
273
  ]
255
274
 
256
- if session_data.title:
257
- preview_lines.append(f"**Title:** {session_data.title}")
275
+ # Fetch title from storage
276
+ title = (
277
+ await storage.get_conversation_title(session_data.conversation_id)
278
+ if storage
279
+ else None
280
+ )
281
+ if title:
282
+ preview_lines.append(f"**Title:** {title}")
258
283
 
259
284
  preview_lines.extend([
260
285
  f"**Agent:** `{session_data.agent_name}`",
@@ -328,11 +353,6 @@ class LoadSessionCommand(NodeCommand):
328
353
  class SaveSessionCommand(NodeCommand):
329
354
  """Save the current ACP session to persistent storage.
330
355
 
331
- This will save:
332
- - Current agent configuration
333
- - Working directory
334
- - Session metadata
335
-
336
356
  Note: Conversation history is automatically saved if storage is enabled.
337
357
 
338
358
  Options:
@@ -466,96 +486,9 @@ class DeleteSessionCommand(NodeCommand):
466
486
  await ctx.output.print(f"❌ **Error deleting session:** {e}")
467
487
 
468
488
 
469
- class ListPoolsCommand(NodeCommand):
470
- """List available agent pool configurations.
471
-
472
- Shows:
473
- - Stored configurations from ConfigStore (name -> path mapping)
474
- - Currently active pool configuration
475
- - Available agents in the current pool
476
-
477
- Examples:
478
- /list-pools
479
- """
480
-
481
- name = "list-pools"
482
- category = "acp"
483
-
484
- async def execute_command(
485
- self,
486
- ctx: CommandContext[NodeContext[ACPSession]],
487
- ) -> None:
488
- """List available pool configurations.
489
-
490
- Args:
491
- ctx: Command context with ACP session
492
- """
493
- from agentpool_cli import agent_store
494
-
495
- session = ctx.context.data
496
- if not session:
497
- raise RuntimeError("Session not available in command context")
498
-
499
- try:
500
- output_lines = ["## 🏊 Agent Pool Configurations\n"]
501
-
502
- # Show current pool info
503
- output_lines.append("### 📍 Current Pool")
504
- current_config = (
505
- session.acp_agent.server.config_path if session.acp_agent.server else None
506
- )
507
- if current_config:
508
- output_lines.append(f"**Config:** `{current_config}`")
509
- else:
510
- output_lines.append("**Config:** *(default/built-in)*")
511
-
512
- # Show agents in current pool
513
- agent_names = list(session.agent_pool.all_agents.keys())
514
- output_lines.append(f"**Agents:** {', '.join(f'`{n}`' for n in agent_names)}")
515
- output_lines.append(f"**Active agent:** `{session.current_agent_name}`")
516
- output_lines.append("")
517
-
518
- # Show stored configurations
519
- output_lines.append("### 💾 Stored Configurations")
520
- stored_configs = agent_store.list_configs()
521
- active_config = agent_store.get_active()
522
-
523
- if not stored_configs:
524
- output_lines.append("*No stored configurations*")
525
- output_lines.append("")
526
- output_lines.append("Use `agentpool add <name> <path>` to add configurations.")
527
- else:
528
- # Build markdown table
529
- output_lines.append("| Name | Path |")
530
- output_lines.append("|------|------|")
531
- for name, path in stored_configs:
532
- is_active = active_config and active_config.name == name
533
- is_current = current_config and path == current_config
534
- markers = []
535
- if is_active:
536
- markers.append("default")
537
- if is_current:
538
- markers.append("current")
539
- name_col = f"{name} ({', '.join(markers)})" if markers else name
540
- output_lines.append(f"| {name_col} | `{path}` |")
541
-
542
- output_lines.append("")
543
- output_lines.append("*Use `/set-pool <name>` or `/set-pool <path>` to switch pools.*")
544
-
545
- await ctx.output.print("\n".join(output_lines))
546
-
547
- except Exception as e: # noqa: BLE001
548
- await ctx.output.print(f"❌ **Error listing pools:** {e}")
549
-
550
-
551
489
  class SetPoolCommand(NodeCommand):
552
490
  """Switch to a different agent pool configuration.
553
491
 
554
- This command will:
555
- 1. Close all active sessions
556
- 2. Load the new pool configuration
557
- 3. Initialize the new pool with all agents
558
-
559
492
  The configuration can be specified as:
560
493
  - A stored config name (from `agentpool add`)
561
494
  - A direct path to a configuration file
@@ -645,107 +578,6 @@ class SetPoolCommand(NodeCommand):
645
578
  await ctx.output.print(f"❌ **Error switching pool:** {e}")
646
579
 
647
580
 
648
- class CompactCommand(NodeCommand):
649
- """Compact the conversation history to reduce context size.
650
-
651
- Uses the configured compaction pipeline from the agent pool manifest,
652
- or falls back to a default summarizing pipeline.
653
-
654
- This will:
655
- - Apply configured compaction steps (filter, truncate, summarize)
656
- - Reduce the message history while preserving important context
657
- - Report the reduction in message count
658
-
659
- Options:
660
- --preset <name> Use a specific preset (minimal, balanced, summarizing)
661
-
662
- Examples:
663
- /compact
664
- /compact --preset=minimal
665
- """
666
-
667
- name = "compact"
668
- category = "acp"
669
-
670
- async def execute_command(
671
- self,
672
- ctx: CommandContext[NodeContext[ACPSession]],
673
- *,
674
- preset: str | None = None,
675
- ) -> None:
676
- """Compact the conversation history.
677
-
678
- Args:
679
- ctx: Command context with ACP session
680
- preset: Optional preset name (minimal, balanced, summarizing)
681
- """
682
- session = ctx.context.data
683
- if not session:
684
- raise RuntimeError("Session not available in command context")
685
-
686
- agent = session.agent
687
-
688
- # Check if there's any history to compact
689
- if not agent.conversation.get_history():
690
- await ctx.output.print("📭 **No message history to compact**")
691
- return
692
-
693
- try:
694
- # Get compaction pipeline
695
- from agentpool.messaging.compaction import (
696
- balanced_context,
697
- minimal_context,
698
- summarizing_context,
699
- )
700
-
701
- pipeline = None
702
-
703
- # Check for preset override
704
- if preset:
705
- match preset.lower():
706
- case "minimal":
707
- pipeline = minimal_context()
708
- case "balanced":
709
- pipeline = balanced_context()
710
- case "summarizing":
711
- pipeline = summarizing_context()
712
- case _:
713
- await ctx.output.print(
714
- f"⚠️ **Unknown preset:** `{preset}`\n"
715
- "Available: minimal, balanced, summarizing"
716
- )
717
- return
718
-
719
- # Fall back to pool's configured pipeline
720
- if pipeline is None:
721
- pipeline = session.agent_pool.compaction_pipeline
722
-
723
- # Fall back to default summarizing pipeline
724
- if pipeline is None:
725
- pipeline = summarizing_context()
726
-
727
- await ctx.output.print("🔄 **Compacting conversation history...**")
728
-
729
- # Apply the pipeline using shared helper
730
- from agentpool.messaging.compaction import compact_conversation
731
-
732
- original_count, compacted_count = await compact_conversation(
733
- pipeline, agent.conversation
734
- )
735
- reduction = original_count - compacted_count
736
-
737
- await ctx.output.print(
738
- f"✅ **Compaction complete**\n"
739
- f"- Messages: {original_count} → {compacted_count} ({reduction} removed)\n"
740
- f"- Reduction: {reduction / original_count * 100:.1f}%"
741
- if original_count > 0
742
- else "✅ **Compaction complete** (no messages)"
743
- )
744
-
745
- except Exception as e: # noqa: BLE001
746
- await ctx.output.print(f"❌ **Error compacting history:** {e}")
747
-
748
-
749
581
  def get_acp_commands() -> list[type[NodeCommand]]:
750
582
  """Get all ACP-specific slash commands."""
751
583
  return [
@@ -753,7 +585,5 @@ def get_acp_commands() -> list[type[NodeCommand]]:
753
585
  LoadSessionCommand,
754
586
  SaveSessionCommand,
755
587
  DeleteSessionCommand,
756
- ListPoolsCommand,
757
588
  SetPoolCommand,
758
- CompactCommand,
759
589
  ]
@@ -75,12 +75,14 @@ class FetchRepoCommand(NodeCommand):
75
75
  if path:
76
76
  base_url += f"/{path}"
77
77
 
78
- # Build parameters
79
- params = {}
78
+ # Build headers with Bearer token
79
+ headers = {"accept": "text/markdown"}
80
80
  api_key = os.getenv("UITHUB_API_KEY")
81
81
  if api_key:
82
- params["apiKey"] = api_key
82
+ headers["Authorization"] = f"Bearer {api_key}"
83
83
 
84
+ # Build parameters
85
+ params = {}
84
86
  if include_dirs:
85
87
  params["dir"] = ",".join(include_dirs)
86
88
  if disable_genignore:
@@ -120,16 +122,15 @@ class FetchRepoCommand(NodeCommand):
120
122
  response = await client.get(
121
123
  base_url,
122
124
  params=params,
123
- headers={"accept": "text/markdown"},
125
+ headers=headers,
124
126
  timeout=30.0,
125
127
  )
126
128
  response.raise_for_status()
127
129
  content = response.text
128
130
 
129
131
  # Stage the content for use in agent context
130
- staged_part = UserPromptPart(
131
- content=f"Repository contents from {display_path}:\n\n{content}"
132
- )
132
+ part_content = f"Repository contents from {display_path}:\n\n{content}"
133
+ staged_part = UserPromptPart(content=part_content)
133
134
  session.staged_content.add([staged_part])
134
135
  # Send successful result - wrap in code block for proper display
135
136
  staged_count = len(session.staged_content)