agentpool 2.1.9__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.
- acp/__init__.py +13 -4
- acp/acp_requests.py +20 -77
- acp/agent/connection.py +8 -0
- acp/agent/implementations/debug_server/debug_server.py +6 -2
- acp/agent/protocol.py +6 -0
- acp/bridge/README.md +15 -2
- acp/bridge/__init__.py +3 -2
- acp/bridge/__main__.py +60 -19
- acp/bridge/ws_server.py +173 -0
- acp/bridge/ws_server_cli.py +89 -0
- acp/client/connection.py +38 -29
- acp/client/implementations/default_client.py +3 -2
- acp/client/implementations/headless_client.py +2 -2
- acp/connection.py +2 -2
- acp/notifications.py +20 -50
- acp/schema/__init__.py +2 -0
- acp/schema/agent_responses.py +21 -0
- acp/schema/client_requests.py +3 -3
- acp/schema/session_state.py +63 -29
- acp/stdio.py +39 -9
- acp/task/supervisor.py +2 -2
- acp/transports.py +362 -2
- acp/utils.py +17 -4
- agentpool/__init__.py +6 -1
- agentpool/agents/__init__.py +2 -0
- agentpool/agents/acp_agent/acp_agent.py +407 -277
- agentpool/agents/acp_agent/acp_converters.py +196 -38
- agentpool/agents/acp_agent/client_handler.py +191 -26
- agentpool/agents/acp_agent/session_state.py +17 -6
- agentpool/agents/agent.py +607 -572
- agentpool/agents/agui_agent/__init__.py +0 -2
- agentpool/agents/agui_agent/agui_agent.py +176 -110
- agentpool/agents/agui_agent/agui_converters.py +0 -131
- agentpool/agents/agui_agent/helpers.py +3 -4
- agentpool/agents/base_agent.py +632 -17
- agentpool/agents/claude_code_agent/FORKING.md +191 -0
- agentpool/agents/claude_code_agent/__init__.py +13 -1
- agentpool/agents/claude_code_agent/claude_code_agent.py +1058 -291
- agentpool/agents/claude_code_agent/converters.py +74 -143
- agentpool/agents/claude_code_agent/history.py +474 -0
- agentpool/agents/claude_code_agent/models.py +77 -0
- agentpool/agents/claude_code_agent/static_info.py +100 -0
- agentpool/agents/claude_code_agent/usage.py +242 -0
- agentpool/agents/context.py +40 -0
- agentpool/agents/events/__init__.py +24 -0
- agentpool/agents/events/builtin_handlers.py +67 -1
- agentpool/agents/events/event_emitter.py +32 -2
- agentpool/agents/events/events.py +104 -3
- agentpool/agents/events/infer_info.py +145 -0
- agentpool/agents/events/processors.py +254 -0
- agentpool/agents/interactions.py +41 -6
- agentpool/agents/modes.py +67 -0
- agentpool/agents/slashed_agent.py +5 -4
- agentpool/agents/tool_call_accumulator.py +213 -0
- agentpool/agents/tool_wrapping.py +18 -6
- agentpool/common_types.py +56 -21
- agentpool/config_resources/__init__.py +38 -1
- agentpool/config_resources/acp_assistant.yml +2 -2
- agentpool/config_resources/agents.yml +3 -0
- agentpool/config_resources/agents_template.yml +1 -0
- agentpool/config_resources/claude_code_agent.yml +10 -6
- agentpool/config_resources/external_acp_agents.yml +2 -1
- agentpool/delegation/base_team.py +4 -30
- agentpool/delegation/pool.py +136 -289
- agentpool/delegation/team.py +58 -57
- agentpool/delegation/teamrun.py +51 -55
- agentpool/diagnostics/__init__.py +53 -0
- agentpool/diagnostics/lsp_manager.py +1593 -0
- agentpool/diagnostics/lsp_proxy.py +41 -0
- agentpool/diagnostics/lsp_proxy_script.py +229 -0
- agentpool/diagnostics/models.py +398 -0
- agentpool/functional/run.py +10 -4
- agentpool/mcp_server/__init__.py +0 -2
- agentpool/mcp_server/client.py +76 -32
- agentpool/mcp_server/conversions.py +54 -13
- agentpool/mcp_server/manager.py +34 -54
- agentpool/mcp_server/registries/official_registry_client.py +35 -1
- agentpool/mcp_server/tool_bridge.py +186 -139
- agentpool/messaging/__init__.py +0 -2
- agentpool/messaging/compaction.py +72 -197
- agentpool/messaging/connection_manager.py +11 -10
- agentpool/messaging/event_manager.py +5 -5
- agentpool/messaging/message_container.py +6 -30
- agentpool/messaging/message_history.py +99 -8
- agentpool/messaging/messagenode.py +52 -14
- agentpool/messaging/messages.py +54 -35
- agentpool/messaging/processing.py +12 -22
- agentpool/models/__init__.py +1 -1
- agentpool/models/acp_agents/base.py +6 -24
- agentpool/models/acp_agents/mcp_capable.py +126 -157
- agentpool/models/acp_agents/non_mcp.py +129 -95
- agentpool/models/agents.py +98 -76
- agentpool/models/agui_agents.py +1 -1
- agentpool/models/claude_code_agents.py +144 -19
- agentpool/models/file_parsing.py +0 -1
- agentpool/models/manifest.py +113 -50
- agentpool/prompts/conversion_manager.py +1 -1
- agentpool/prompts/prompts.py +5 -2
- agentpool/repomap.py +1 -1
- agentpool/resource_providers/__init__.py +11 -1
- agentpool/resource_providers/aggregating.py +56 -5
- agentpool/resource_providers/base.py +70 -4
- agentpool/resource_providers/codemode/code_executor.py +72 -5
- agentpool/resource_providers/codemode/helpers.py +2 -2
- agentpool/resource_providers/codemode/provider.py +64 -12
- agentpool/resource_providers/codemode/remote_mcp_execution.py +2 -2
- agentpool/resource_providers/codemode/remote_provider.py +9 -12
- agentpool/resource_providers/filtering.py +3 -1
- agentpool/resource_providers/mcp_provider.py +89 -12
- agentpool/resource_providers/plan_provider.py +228 -46
- agentpool/resource_providers/pool.py +7 -3
- agentpool/resource_providers/resource_info.py +111 -0
- agentpool/resource_providers/static.py +4 -2
- agentpool/sessions/__init__.py +4 -1
- agentpool/sessions/manager.py +33 -5
- agentpool/sessions/models.py +59 -6
- agentpool/sessions/protocol.py +28 -0
- agentpool/sessions/session.py +11 -55
- agentpool/skills/registry.py +13 -8
- agentpool/storage/manager.py +572 -49
- agentpool/talk/registry.py +4 -4
- agentpool/talk/talk.py +9 -10
- agentpool/testing.py +538 -20
- agentpool/tool_impls/__init__.py +6 -0
- agentpool/tool_impls/agent_cli/__init__.py +42 -0
- agentpool/tool_impls/agent_cli/tool.py +95 -0
- agentpool/tool_impls/bash/__init__.py +64 -0
- agentpool/tool_impls/bash/helpers.py +35 -0
- agentpool/tool_impls/bash/tool.py +171 -0
- agentpool/tool_impls/delete_path/__init__.py +70 -0
- agentpool/tool_impls/delete_path/tool.py +142 -0
- agentpool/tool_impls/download_file/__init__.py +80 -0
- agentpool/tool_impls/download_file/tool.py +183 -0
- agentpool/tool_impls/execute_code/__init__.py +55 -0
- agentpool/tool_impls/execute_code/tool.py +163 -0
- agentpool/tool_impls/grep/__init__.py +80 -0
- agentpool/tool_impls/grep/tool.py +200 -0
- agentpool/tool_impls/list_directory/__init__.py +73 -0
- agentpool/tool_impls/list_directory/tool.py +197 -0
- agentpool/tool_impls/question/__init__.py +42 -0
- agentpool/tool_impls/question/tool.py +127 -0
- agentpool/tool_impls/read/__init__.py +104 -0
- agentpool/tool_impls/read/tool.py +305 -0
- agentpool/tools/__init__.py +2 -1
- agentpool/tools/base.py +114 -34
- agentpool/tools/manager.py +57 -1
- agentpool/ui/base.py +2 -2
- agentpool/ui/mock_provider.py +2 -2
- agentpool/ui/stdlib_provider.py +2 -2
- agentpool/utils/file_watcher.py +269 -0
- agentpool/utils/identifiers.py +121 -0
- agentpool/utils/pydantic_ai_helpers.py +46 -0
- agentpool/utils/streams.py +616 -2
- agentpool/utils/subprocess_utils.py +155 -0
- agentpool/utils/token_breakdown.py +461 -0
- agentpool/vfs_registry.py +7 -2
- {agentpool-2.1.9.dist-info → agentpool-2.5.0.dist-info}/METADATA +41 -27
- agentpool-2.5.0.dist-info/RECORD +579 -0
- {agentpool-2.1.9.dist-info → agentpool-2.5.0.dist-info}/WHEEL +1 -1
- agentpool_cli/__main__.py +24 -0
- agentpool_cli/create.py +1 -1
- agentpool_cli/serve_acp.py +100 -21
- agentpool_cli/serve_agui.py +87 -0
- agentpool_cli/serve_opencode.py +119 -0
- agentpool_cli/ui.py +557 -0
- agentpool_commands/__init__.py +42 -5
- agentpool_commands/agents.py +75 -2
- agentpool_commands/history.py +62 -0
- agentpool_commands/mcp.py +176 -0
- agentpool_commands/models.py +56 -3
- agentpool_commands/pool.py +260 -0
- agentpool_commands/session.py +1 -1
- agentpool_commands/text_sharing/__init__.py +119 -0
- agentpool_commands/text_sharing/base.py +123 -0
- agentpool_commands/text_sharing/github_gist.py +80 -0
- agentpool_commands/text_sharing/opencode.py +462 -0
- agentpool_commands/text_sharing/paste_rs.py +59 -0
- agentpool_commands/text_sharing/pastebin.py +116 -0
- agentpool_commands/text_sharing/shittycodingagent.py +112 -0
- agentpool_commands/tools.py +57 -0
- agentpool_commands/utils.py +80 -30
- agentpool_config/__init__.py +30 -2
- agentpool_config/agentpool_tools.py +498 -0
- agentpool_config/builtin_tools.py +77 -22
- agentpool_config/commands.py +24 -1
- agentpool_config/compaction.py +258 -0
- agentpool_config/converters.py +1 -1
- agentpool_config/event_handlers.py +42 -0
- agentpool_config/events.py +1 -1
- agentpool_config/forward_targets.py +1 -4
- agentpool_config/jinja.py +3 -3
- agentpool_config/mcp_server.py +132 -6
- agentpool_config/nodes.py +1 -1
- agentpool_config/observability.py +44 -0
- agentpool_config/session.py +0 -3
- agentpool_config/storage.py +82 -38
- agentpool_config/task.py +3 -3
- agentpool_config/tools.py +11 -22
- agentpool_config/toolsets.py +109 -233
- agentpool_server/a2a_server/agent_worker.py +307 -0
- agentpool_server/a2a_server/server.py +23 -18
- agentpool_server/acp_server/acp_agent.py +234 -181
- agentpool_server/acp_server/commands/acp_commands.py +151 -156
- agentpool_server/acp_server/commands/docs_commands/fetch_repo.py +18 -17
- agentpool_server/acp_server/event_converter.py +651 -0
- agentpool_server/acp_server/input_provider.py +53 -10
- agentpool_server/acp_server/server.py +24 -90
- agentpool_server/acp_server/session.py +173 -331
- agentpool_server/acp_server/session_manager.py +8 -34
- agentpool_server/agui_server/server.py +3 -1
- agentpool_server/mcp_server/server.py +5 -2
- agentpool_server/opencode_server/.rules +95 -0
- agentpool_server/opencode_server/ENDPOINTS.md +401 -0
- agentpool_server/opencode_server/OPENCODE_UI_TOOLS_COMPLETE.md +202 -0
- agentpool_server/opencode_server/__init__.py +19 -0
- agentpool_server/opencode_server/command_validation.py +172 -0
- agentpool_server/opencode_server/converters.py +975 -0
- agentpool_server/opencode_server/dependencies.py +24 -0
- agentpool_server/opencode_server/input_provider.py +421 -0
- agentpool_server/opencode_server/models/__init__.py +250 -0
- agentpool_server/opencode_server/models/agent.py +53 -0
- agentpool_server/opencode_server/models/app.py +72 -0
- agentpool_server/opencode_server/models/base.py +26 -0
- agentpool_server/opencode_server/models/common.py +23 -0
- agentpool_server/opencode_server/models/config.py +37 -0
- agentpool_server/opencode_server/models/events.py +821 -0
- agentpool_server/opencode_server/models/file.py +88 -0
- agentpool_server/opencode_server/models/mcp.py +44 -0
- agentpool_server/opencode_server/models/message.py +179 -0
- agentpool_server/opencode_server/models/parts.py +323 -0
- agentpool_server/opencode_server/models/provider.py +81 -0
- agentpool_server/opencode_server/models/pty.py +43 -0
- agentpool_server/opencode_server/models/question.py +56 -0
- agentpool_server/opencode_server/models/session.py +111 -0
- agentpool_server/opencode_server/routes/__init__.py +29 -0
- agentpool_server/opencode_server/routes/agent_routes.py +473 -0
- agentpool_server/opencode_server/routes/app_routes.py +202 -0
- agentpool_server/opencode_server/routes/config_routes.py +302 -0
- agentpool_server/opencode_server/routes/file_routes.py +571 -0
- agentpool_server/opencode_server/routes/global_routes.py +94 -0
- agentpool_server/opencode_server/routes/lsp_routes.py +319 -0
- agentpool_server/opencode_server/routes/message_routes.py +761 -0
- agentpool_server/opencode_server/routes/permission_routes.py +63 -0
- agentpool_server/opencode_server/routes/pty_routes.py +300 -0
- agentpool_server/opencode_server/routes/question_routes.py +128 -0
- agentpool_server/opencode_server/routes/session_routes.py +1276 -0
- agentpool_server/opencode_server/routes/tui_routes.py +139 -0
- agentpool_server/opencode_server/server.py +475 -0
- agentpool_server/opencode_server/state.py +151 -0
- agentpool_server/opencode_server/time_utils.py +8 -0
- agentpool_storage/__init__.py +12 -0
- agentpool_storage/base.py +184 -2
- agentpool_storage/claude_provider/ARCHITECTURE.md +433 -0
- agentpool_storage/claude_provider/__init__.py +42 -0
- agentpool_storage/claude_provider/provider.py +1089 -0
- agentpool_storage/file_provider.py +278 -15
- agentpool_storage/memory_provider.py +193 -12
- agentpool_storage/models.py +3 -0
- agentpool_storage/opencode_provider/ARCHITECTURE.md +386 -0
- agentpool_storage/opencode_provider/__init__.py +16 -0
- agentpool_storage/opencode_provider/helpers.py +414 -0
- agentpool_storage/opencode_provider/provider.py +895 -0
- agentpool_storage/project_store.py +325 -0
- agentpool_storage/session_store.py +26 -6
- agentpool_storage/sql_provider/__init__.py +4 -2
- agentpool_storage/sql_provider/models.py +48 -0
- agentpool_storage/sql_provider/sql_provider.py +269 -3
- agentpool_storage/sql_provider/utils.py +12 -13
- agentpool_storage/zed_provider/__init__.py +16 -0
- agentpool_storage/zed_provider/helpers.py +281 -0
- agentpool_storage/zed_provider/models.py +130 -0
- agentpool_storage/zed_provider/provider.py +442 -0
- agentpool_storage/zed_provider.py +803 -0
- agentpool_toolsets/__init__.py +0 -2
- agentpool_toolsets/builtin/__init__.py +2 -12
- agentpool_toolsets/builtin/code.py +96 -57
- agentpool_toolsets/builtin/debug.py +118 -48
- agentpool_toolsets/builtin/execution_environment.py +115 -230
- agentpool_toolsets/builtin/file_edit/file_edit.py +115 -7
- agentpool_toolsets/builtin/skills.py +9 -4
- agentpool_toolsets/builtin/subagent_tools.py +64 -51
- agentpool_toolsets/builtin/workers.py +4 -2
- agentpool_toolsets/composio_toolset.py +2 -2
- agentpool_toolsets/entry_points.py +3 -1
- agentpool_toolsets/fsspec_toolset/__init__.py +13 -1
- agentpool_toolsets/fsspec_toolset/diagnostics.py +860 -73
- agentpool_toolsets/fsspec_toolset/grep.py +99 -7
- agentpool_toolsets/fsspec_toolset/helpers.py +3 -2
- agentpool_toolsets/fsspec_toolset/image_utils.py +161 -0
- agentpool_toolsets/fsspec_toolset/toolset.py +500 -95
- agentpool_toolsets/mcp_discovery/__init__.py +5 -0
- agentpool_toolsets/mcp_discovery/data/mcp_servers.parquet +0 -0
- agentpool_toolsets/mcp_discovery/toolset.py +511 -0
- agentpool_toolsets/mcp_run_toolset.py +87 -12
- agentpool_toolsets/notifications.py +33 -33
- agentpool_toolsets/openapi.py +3 -1
- agentpool_toolsets/search_toolset.py +3 -1
- agentpool-2.1.9.dist-info/RECORD +0 -474
- agentpool_config/resources.py +0 -33
- agentpool_server/acp_server/acp_tools.py +0 -43
- agentpool_server/acp_server/commands/spawn.py +0 -210
- agentpool_storage/text_log_provider.py +0 -275
- agentpool_toolsets/builtin/agent_management.py +0 -239
- agentpool_toolsets/builtin/chain.py +0 -288
- agentpool_toolsets/builtin/history.py +0 -36
- agentpool_toolsets/builtin/integration.py +0 -85
- agentpool_toolsets/builtin/tool_management.py +0 -90
- agentpool_toolsets/builtin/user_interaction.py +0 -52
- agentpool_toolsets/semantic_memory_toolset.py +0 -536
- {agentpool-2.1.9.dist-info → agentpool-2.5.0.dist-info}/entry_points.txt +0 -0
- {agentpool-2.1.9.dist-info → agentpool-2.5.0.dist-info}/licenses/LICENSE +0 -0
acp/stdio.py
CHANGED
|
@@ -87,10 +87,20 @@ async def spawn_stdio_connection(
|
|
|
87
87
|
env: Mapping[str, str] | None = None,
|
|
88
88
|
cwd: str | Path | None = None,
|
|
89
89
|
observers: list[StreamObserver] | None = None,
|
|
90
|
-
|
|
90
|
+
log_stderr: bool = False,
|
|
91
91
|
) -> AsyncIterator[tuple[Connection, Process]]:
|
|
92
|
-
"""Spawn a subprocess and bind its stdio to a low-level Connection.
|
|
93
|
-
|
|
92
|
+
"""Spawn a subprocess and bind its stdio to a low-level Connection.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
handler: Method handler for the connection.
|
|
96
|
+
command: The command to execute.
|
|
97
|
+
*args: Arguments for the command.
|
|
98
|
+
env: Environment variables for the subprocess.
|
|
99
|
+
cwd: Working directory for the subprocess.
|
|
100
|
+
observers: Optional stream observers.
|
|
101
|
+
log_stderr: If True, log stderr output from the subprocess.
|
|
102
|
+
"""
|
|
103
|
+
async with spawn_stdio_transport(command, *args, env=env, cwd=cwd, log_stderr=log_stderr) as (
|
|
94
104
|
reader,
|
|
95
105
|
writer,
|
|
96
106
|
process,
|
|
@@ -109,16 +119,26 @@ async def spawn_agent_process(
|
|
|
109
119
|
*args: str,
|
|
110
120
|
env: Mapping[str, str] | None = None,
|
|
111
121
|
cwd: str | Path | None = None,
|
|
112
|
-
|
|
122
|
+
log_stderr: bool = False,
|
|
113
123
|
**connection_kwargs: Any,
|
|
114
124
|
) -> AsyncIterator[tuple[ClientSideConnection, Process]]:
|
|
115
|
-
"""Spawn an ACP agent subprocess and return a ClientSideConnection to it.
|
|
125
|
+
"""Spawn an ACP agent subprocess and return a ClientSideConnection to it.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
to_client: Factory function that creates a Client from an Agent.
|
|
129
|
+
command: The command to execute.
|
|
130
|
+
*args: Arguments for the command.
|
|
131
|
+
env: Environment variables for the subprocess.
|
|
132
|
+
cwd: Working directory for the subprocess.
|
|
133
|
+
log_stderr: If True, log stderr output from the subprocess.
|
|
134
|
+
**connection_kwargs: Additional arguments for ClientSideConnection.
|
|
135
|
+
"""
|
|
116
136
|
async with spawn_stdio_transport(
|
|
117
137
|
command,
|
|
118
138
|
*args,
|
|
119
139
|
env=env,
|
|
120
140
|
cwd=cwd,
|
|
121
|
-
|
|
141
|
+
log_stderr=log_stderr,
|
|
122
142
|
) as (reader, writer, process):
|
|
123
143
|
conn = ClientSideConnection(to_client, writer, reader, **connection_kwargs)
|
|
124
144
|
try:
|
|
@@ -134,16 +154,26 @@ async def spawn_client_process(
|
|
|
134
154
|
*args: str,
|
|
135
155
|
env: Mapping[str, str] | None = None,
|
|
136
156
|
cwd: str | Path | None = None,
|
|
137
|
-
|
|
157
|
+
log_stderr: bool = False,
|
|
138
158
|
**connection_kwargs: Any,
|
|
139
159
|
) -> AsyncIterator[tuple[AgentSideConnection, Process]]:
|
|
140
|
-
"""Spawn an ACP client subprocess and return an AgentSideConnection to it.
|
|
160
|
+
"""Spawn an ACP client subprocess and return an AgentSideConnection to it.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
to_agent: Factory function that creates an Agent from an AgentSideConnection.
|
|
164
|
+
command: The command to execute.
|
|
165
|
+
*args: Arguments for the command.
|
|
166
|
+
env: Environment variables for the subprocess.
|
|
167
|
+
cwd: Working directory for the subprocess.
|
|
168
|
+
log_stderr: If True, log stderr output from the subprocess.
|
|
169
|
+
**connection_kwargs: Additional arguments for AgentSideConnection.
|
|
170
|
+
"""
|
|
141
171
|
async with spawn_stdio_transport(
|
|
142
172
|
command,
|
|
143
173
|
*args,
|
|
144
174
|
env=env,
|
|
145
175
|
cwd=cwd,
|
|
146
|
-
|
|
176
|
+
log_stderr=log_stderr,
|
|
147
177
|
) as (reader, writer, process):
|
|
148
178
|
conn = AgentSideConnection(to_agent, writer, reader, **connection_kwargs)
|
|
149
179
|
try:
|
acp/task/supervisor.py
CHANGED
|
@@ -7,7 +7,7 @@ from collections.abc import Callable
|
|
|
7
7
|
from contextlib import suppress
|
|
8
8
|
from typing import TYPE_CHECKING, Any
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
import structlog
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
if TYPE_CHECKING:
|
|
@@ -16,7 +16,7 @@ if TYPE_CHECKING:
|
|
|
16
16
|
|
|
17
17
|
__all__ = ["TaskSupervisor"]
|
|
18
18
|
|
|
19
|
-
logger =
|
|
19
|
+
logger = structlog.get_logger(__name__)
|
|
20
20
|
ErrorHandler = Callable[[asyncio.Task[Any], BaseException], None]
|
|
21
21
|
|
|
22
22
|
|
acp/transports.py
CHANGED
|
@@ -1,19 +1,331 @@
|
|
|
1
|
+
"""Transport abstractions for ACP agents.
|
|
2
|
+
|
|
3
|
+
This module provides transport configuration classes and utilities for running
|
|
4
|
+
ACP agents over different transports (stdio, WebSocket, etc.).
|
|
5
|
+
"""
|
|
6
|
+
|
|
1
7
|
from __future__ import annotations
|
|
2
8
|
|
|
9
|
+
import asyncio
|
|
3
10
|
import contextlib
|
|
4
11
|
from contextlib import asynccontextmanager
|
|
12
|
+
from dataclasses import dataclass
|
|
13
|
+
import logging
|
|
5
14
|
import os
|
|
6
15
|
import subprocess
|
|
7
|
-
from typing import TYPE_CHECKING
|
|
16
|
+
from typing import TYPE_CHECKING, Any, Literal
|
|
8
17
|
|
|
9
18
|
import anyio
|
|
10
19
|
|
|
11
20
|
|
|
12
21
|
if TYPE_CHECKING:
|
|
13
|
-
from collections.abc import AsyncIterator, Mapping
|
|
22
|
+
from collections.abc import AsyncIterator, Callable, Mapping
|
|
14
23
|
from pathlib import Path
|
|
15
24
|
|
|
16
25
|
from anyio.abc import ByteReceiveStream, ByteSendStream, Process
|
|
26
|
+
from websockets.asyncio.server import ServerConnection
|
|
27
|
+
|
|
28
|
+
from acp.agent.connection import AgentSideConnection
|
|
29
|
+
from acp.agent.protocol import Agent
|
|
30
|
+
|
|
31
|
+
logger = logging.getLogger(__name__)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# =============================================================================
|
|
35
|
+
# Transport Configuration Classes
|
|
36
|
+
# =============================================================================
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass
|
|
40
|
+
class StdioTransport:
|
|
41
|
+
"""Configuration for stdio transport.
|
|
42
|
+
|
|
43
|
+
This is the default transport for ACP agents, communicating over
|
|
44
|
+
stdin/stdout streams.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass
|
|
49
|
+
class WebSocketTransport:
|
|
50
|
+
"""Configuration for WebSocket server transport.
|
|
51
|
+
|
|
52
|
+
Runs an ACP agent as a WebSocket server that accepts client connections.
|
|
53
|
+
Each client connection gets its own agent instance.
|
|
54
|
+
|
|
55
|
+
Attributes:
|
|
56
|
+
host: Host to bind the WebSocket server to.
|
|
57
|
+
port: Port for the WebSocket server.
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
host: str = "localhost"
|
|
61
|
+
port: int = 8765
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass
|
|
65
|
+
class StreamTransport:
|
|
66
|
+
"""Configuration for custom stream transport.
|
|
67
|
+
|
|
68
|
+
Allows passing pre-created streams for the agent to use.
|
|
69
|
+
|
|
70
|
+
Attributes:
|
|
71
|
+
reader: Stream to read incoming messages from.
|
|
72
|
+
writer: Stream to write outgoing messages to.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
reader: ByteReceiveStream
|
|
76
|
+
writer: ByteSendStream
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# Type alias for all supported transports
|
|
80
|
+
Transport = StdioTransport | WebSocketTransport | StreamTransport | Literal["stdio", "websocket"]
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# =============================================================================
|
|
84
|
+
# Transport Runner
|
|
85
|
+
# =============================================================================
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
async def serve(
|
|
89
|
+
agent: Agent | Callable[[AgentSideConnection], Agent],
|
|
90
|
+
transport: Transport = "stdio",
|
|
91
|
+
*,
|
|
92
|
+
shutdown_event: asyncio.Event | None = None,
|
|
93
|
+
debug_file: str | None = None,
|
|
94
|
+
**kwargs: Any,
|
|
95
|
+
) -> None:
|
|
96
|
+
"""Run an ACP agent with the specified transport.
|
|
97
|
+
|
|
98
|
+
This is the main entry point for running ACP agents. It handles transport
|
|
99
|
+
setup and lifecycle management automatically.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
agent: An Agent implementation or a factory callable that takes
|
|
103
|
+
an AgentSideConnection and returns an Agent.
|
|
104
|
+
transport: Transport configuration. Can be:
|
|
105
|
+
- "stdio" or StdioTransport(): Use stdin/stdout
|
|
106
|
+
- "websocket" or WebSocketTransport(...): Run WebSocket server
|
|
107
|
+
- StreamTransport(...): Use custom streams
|
|
108
|
+
shutdown_event: Optional event to signal shutdown. If not provided,
|
|
109
|
+
runs until cancelled.
|
|
110
|
+
debug_file: Optional file path for debug message logging.
|
|
111
|
+
**kwargs: Additional keyword arguments passed to AgentSideConnection.
|
|
112
|
+
|
|
113
|
+
Example:
|
|
114
|
+
```python
|
|
115
|
+
# Stdio (default)
|
|
116
|
+
await serve(MyAgent())
|
|
117
|
+
|
|
118
|
+
# WebSocket server
|
|
119
|
+
await serve(MyAgent(), WebSocketTransport(host="0.0.0.0", port=9000))
|
|
120
|
+
|
|
121
|
+
# With shutdown control
|
|
122
|
+
shutdown = asyncio.Event()
|
|
123
|
+
task = asyncio.create_task(serve(MyAgent(), shutdown_event=shutdown))
|
|
124
|
+
# ... later ...
|
|
125
|
+
shutdown.set()
|
|
126
|
+
await task
|
|
127
|
+
```
|
|
128
|
+
"""
|
|
129
|
+
# Normalize string shortcuts to config objects
|
|
130
|
+
match transport:
|
|
131
|
+
case "stdio":
|
|
132
|
+
transport = StdioTransport()
|
|
133
|
+
case "websocket":
|
|
134
|
+
transport = WebSocketTransport()
|
|
135
|
+
|
|
136
|
+
# Dispatch to appropriate runner
|
|
137
|
+
match transport:
|
|
138
|
+
case StdioTransport():
|
|
139
|
+
await _serve_stdio(agent, shutdown_event, debug_file, **kwargs)
|
|
140
|
+
case WebSocketTransport(host=host, port=port):
|
|
141
|
+
await _serve_websocket(agent, host, port, shutdown_event, debug_file, **kwargs)
|
|
142
|
+
case StreamTransport(reader=reader, writer=writer):
|
|
143
|
+
await _serve_streams(agent, reader, writer, shutdown_event, debug_file, **kwargs)
|
|
144
|
+
case _:
|
|
145
|
+
msg = f"Unsupported transport: {transport}"
|
|
146
|
+
raise ValueError(msg)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
async def _serve_stdio(
|
|
150
|
+
agent: Agent | Callable[[AgentSideConnection], Agent],
|
|
151
|
+
shutdown_event: asyncio.Event | None,
|
|
152
|
+
debug_file: str | None,
|
|
153
|
+
**kwargs: Any,
|
|
154
|
+
) -> None:
|
|
155
|
+
"""Run agent over stdio."""
|
|
156
|
+
from acp.agent.connection import AgentSideConnection
|
|
157
|
+
from acp.stdio import stdio_streams
|
|
158
|
+
|
|
159
|
+
agent_factory = _ensure_factory(agent)
|
|
160
|
+
reader, writer = await stdio_streams()
|
|
161
|
+
|
|
162
|
+
conn = AgentSideConnection(agent_factory, writer, reader, debug_file=debug_file, **kwargs)
|
|
163
|
+
try:
|
|
164
|
+
if shutdown_event:
|
|
165
|
+
await shutdown_event.wait()
|
|
166
|
+
else:
|
|
167
|
+
await asyncio.Event().wait() # Wait forever
|
|
168
|
+
except asyncio.CancelledError:
|
|
169
|
+
pass
|
|
170
|
+
finally:
|
|
171
|
+
await conn.close()
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
async def _serve_streams(
|
|
175
|
+
agent: Agent | Callable[[AgentSideConnection], Agent],
|
|
176
|
+
reader: ByteReceiveStream,
|
|
177
|
+
writer: ByteSendStream,
|
|
178
|
+
shutdown_event: asyncio.Event | None,
|
|
179
|
+
debug_file: str | None,
|
|
180
|
+
**kwargs: Any,
|
|
181
|
+
) -> None:
|
|
182
|
+
"""Run agent over custom streams."""
|
|
183
|
+
from acp.agent.connection import AgentSideConnection
|
|
184
|
+
|
|
185
|
+
agent_factory = _ensure_factory(agent)
|
|
186
|
+
conn = AgentSideConnection(agent_factory, writer, reader, debug_file=debug_file, **kwargs)
|
|
187
|
+
try:
|
|
188
|
+
if shutdown_event:
|
|
189
|
+
await shutdown_event.wait()
|
|
190
|
+
else:
|
|
191
|
+
await asyncio.Event().wait()
|
|
192
|
+
except asyncio.CancelledError:
|
|
193
|
+
pass
|
|
194
|
+
finally:
|
|
195
|
+
await conn.close()
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
async def _serve_websocket(
|
|
199
|
+
agent: Agent | Callable[[AgentSideConnection], Agent],
|
|
200
|
+
host: str,
|
|
201
|
+
port: int,
|
|
202
|
+
shutdown_event: asyncio.Event | None,
|
|
203
|
+
debug_file: str | None,
|
|
204
|
+
**kwargs: Any,
|
|
205
|
+
) -> None:
|
|
206
|
+
"""Run agent as WebSocket server."""
|
|
207
|
+
import websockets
|
|
208
|
+
|
|
209
|
+
from acp.agent.connection import AgentSideConnection
|
|
210
|
+
|
|
211
|
+
agent_factory = _ensure_factory(agent)
|
|
212
|
+
shutdown = shutdown_event or asyncio.Event()
|
|
213
|
+
connections: list[AgentSideConnection] = []
|
|
214
|
+
|
|
215
|
+
async def handle_client(websocket: ServerConnection) -> None:
|
|
216
|
+
"""Handle a single WebSocket client connection."""
|
|
217
|
+
logger.info("WebSocket client connected")
|
|
218
|
+
|
|
219
|
+
# Create stream adapters for WebSocket
|
|
220
|
+
ws_reader = _WebSocketReadStream(websocket)
|
|
221
|
+
ws_writer = _WebSocketWriteStream(websocket)
|
|
222
|
+
|
|
223
|
+
conn = AgentSideConnection(
|
|
224
|
+
agent_factory, ws_writer, ws_reader, debug_file=debug_file, **kwargs
|
|
225
|
+
)
|
|
226
|
+
connections.append(conn)
|
|
227
|
+
|
|
228
|
+
try:
|
|
229
|
+
# Keep connection alive until client disconnects or shutdown
|
|
230
|
+
client_done = asyncio.Event()
|
|
231
|
+
|
|
232
|
+
async def monitor_websocket() -> None:
|
|
233
|
+
try:
|
|
234
|
+
async for _ in websocket:
|
|
235
|
+
pass # Messages handled by ws_reader
|
|
236
|
+
except websockets.exceptions.ConnectionClosed:
|
|
237
|
+
pass
|
|
238
|
+
finally:
|
|
239
|
+
client_done.set()
|
|
240
|
+
|
|
241
|
+
monitor_task = asyncio.create_task(monitor_websocket())
|
|
242
|
+
_done, _ = await asyncio.wait(
|
|
243
|
+
[asyncio.create_task(client_done.wait()), asyncio.create_task(shutdown.wait())],
|
|
244
|
+
return_when=asyncio.FIRST_COMPLETED,
|
|
245
|
+
)
|
|
246
|
+
monitor_task.cancel()
|
|
247
|
+
with contextlib.suppress(asyncio.CancelledError):
|
|
248
|
+
await monitor_task
|
|
249
|
+
except websockets.exceptions.ConnectionClosed:
|
|
250
|
+
logger.info("WebSocket client disconnected")
|
|
251
|
+
finally:
|
|
252
|
+
connections.remove(conn)
|
|
253
|
+
await conn.close()
|
|
254
|
+
|
|
255
|
+
logger.info("Starting WebSocket server on ws://%s:%d", host, port)
|
|
256
|
+
async with websockets.serve(handle_client, host, port):
|
|
257
|
+
logger.info("WebSocket server running on ws://%s:%d", host, port)
|
|
258
|
+
await shutdown.wait()
|
|
259
|
+
|
|
260
|
+
# Clean up remaining connections
|
|
261
|
+
for conn in connections:
|
|
262
|
+
await conn.close()
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class _WebSocketReadStream(anyio.abc.ByteReceiveStream):
|
|
266
|
+
"""Adapter to read from WebSocket as a ByteReceiveStream."""
|
|
267
|
+
|
|
268
|
+
def __init__(self, websocket: Any) -> None:
|
|
269
|
+
self._websocket = websocket
|
|
270
|
+
self._buffer = b""
|
|
271
|
+
|
|
272
|
+
async def receive(self, max_bytes: int = 65536) -> bytes:
|
|
273
|
+
# If we have buffered data, return it
|
|
274
|
+
if self._buffer:
|
|
275
|
+
data = self._buffer[:max_bytes]
|
|
276
|
+
self._buffer = self._buffer[max_bytes:]
|
|
277
|
+
return data
|
|
278
|
+
|
|
279
|
+
# Read from WebSocket
|
|
280
|
+
try:
|
|
281
|
+
message = await self._websocket.recv()
|
|
282
|
+
if isinstance(message, str):
|
|
283
|
+
message = message.encode()
|
|
284
|
+
# Add newline for JSON-RPC line protocol
|
|
285
|
+
if not message.endswith(b"\n"):
|
|
286
|
+
message += b"\n"
|
|
287
|
+
self._buffer = message[max_bytes:]
|
|
288
|
+
return message[:max_bytes] # type: ignore[no-any-return]
|
|
289
|
+
except Exception as e:
|
|
290
|
+
raise anyio.EndOfStream from e
|
|
291
|
+
|
|
292
|
+
async def aclose(self) -> None:
|
|
293
|
+
pass
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class _WebSocketWriteStream(anyio.abc.ByteSendStream):
|
|
297
|
+
"""Adapter to write to WebSocket as a ByteSendStream."""
|
|
298
|
+
|
|
299
|
+
def __init__(self, websocket: Any) -> None:
|
|
300
|
+
self._websocket = websocket
|
|
301
|
+
|
|
302
|
+
async def send(self, item: bytes) -> None:
|
|
303
|
+
# WebSocket sends complete messages, strip newline if present
|
|
304
|
+
message = item.decode().strip()
|
|
305
|
+
if message:
|
|
306
|
+
await self._websocket.send(message)
|
|
307
|
+
|
|
308
|
+
async def aclose(self) -> None:
|
|
309
|
+
pass
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def _ensure_factory(
|
|
313
|
+
agent: Agent | Callable[[AgentSideConnection], Agent],
|
|
314
|
+
) -> Callable[[AgentSideConnection], Agent]:
|
|
315
|
+
"""Ensure agent is wrapped in a factory function."""
|
|
316
|
+
if callable(agent) and not hasattr(agent, "initialize"):
|
|
317
|
+
return agent # Already a factory
|
|
318
|
+
|
|
319
|
+
# Wrap instance in factory
|
|
320
|
+
def factory(connection: AgentSideConnection) -> Agent:
|
|
321
|
+
return agent # type: ignore[return-value]
|
|
322
|
+
|
|
323
|
+
return factory
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
# =============================================================================
|
|
327
|
+
# Subprocess Transport Utilities (for spawning agents)
|
|
328
|
+
# =============================================================================
|
|
17
329
|
|
|
18
330
|
|
|
19
331
|
DEFAULT_INHERITED_ENV_VARS = (
|
|
@@ -50,6 +362,32 @@ def default_environment() -> dict[str, str]:
|
|
|
50
362
|
return env
|
|
51
363
|
|
|
52
364
|
|
|
365
|
+
async def _drain_stderr_to_log(
|
|
366
|
+
process: Process,
|
|
367
|
+
command: str,
|
|
368
|
+
log_level: int = logging.WARNING,
|
|
369
|
+
) -> None:
|
|
370
|
+
"""Read stderr from a process and log each line.
|
|
371
|
+
|
|
372
|
+
Args:
|
|
373
|
+
process: The subprocess to read stderr from.
|
|
374
|
+
command: Command name for log messages.
|
|
375
|
+
log_level: Log level for stderr output (default WARNING).
|
|
376
|
+
"""
|
|
377
|
+
if process.stderr is None:
|
|
378
|
+
return
|
|
379
|
+
|
|
380
|
+
try:
|
|
381
|
+
async for line_bytes in process.stderr:
|
|
382
|
+
line = line_bytes.decode(errors="replace").rstrip()
|
|
383
|
+
if line:
|
|
384
|
+
logger.log(log_level, "[%s stderr] %s", command, line)
|
|
385
|
+
except anyio.EndOfStream:
|
|
386
|
+
pass
|
|
387
|
+
except Exception: # noqa: BLE001
|
|
388
|
+
logger.debug("Error reading stderr from %s", command, exc_info=True)
|
|
389
|
+
|
|
390
|
+
|
|
53
391
|
@asynccontextmanager
|
|
54
392
|
async def spawn_stdio_transport(
|
|
55
393
|
command: str,
|
|
@@ -58,11 +396,23 @@ async def spawn_stdio_transport(
|
|
|
58
396
|
cwd: str | Path | None = None,
|
|
59
397
|
stderr: int | None = subprocess.PIPE,
|
|
60
398
|
shutdown_timeout: float = 2.0,
|
|
399
|
+
log_stderr: bool = False,
|
|
400
|
+
stderr_log_level: int = logging.WARNING,
|
|
61
401
|
) -> AsyncIterator[tuple[ByteReceiveStream, ByteSendStream, Process]]:
|
|
62
402
|
"""Launch a subprocess and expose its stdio streams as anyio streams.
|
|
63
403
|
|
|
64
404
|
This mirrors the defensive shutdown behaviour used by the MCP Python SDK:
|
|
65
405
|
close stdin first, wait for graceful exit, then escalate to terminate/kill.
|
|
406
|
+
|
|
407
|
+
Args:
|
|
408
|
+
command: The command to execute.
|
|
409
|
+
*args: Arguments for the command.
|
|
410
|
+
env: Environment variables (merged with defaults).
|
|
411
|
+
cwd: Working directory for the subprocess.
|
|
412
|
+
stderr: How to handle stderr (default: subprocess.PIPE).
|
|
413
|
+
shutdown_timeout: Timeout for graceful shutdown.
|
|
414
|
+
log_stderr: If True, read stderr in background and log each line.
|
|
415
|
+
stderr_log_level: Log level for stderr output (default WARNING).
|
|
66
416
|
"""
|
|
67
417
|
merged_env = default_environment()
|
|
68
418
|
if env:
|
|
@@ -83,9 +433,19 @@ async def spawn_stdio_transport(
|
|
|
83
433
|
msg = "spawn_stdio_transport requires stdout/stdin pipes"
|
|
84
434
|
raise RuntimeError(msg)
|
|
85
435
|
|
|
436
|
+
stderr_task: asyncio.Task[None] | None = None
|
|
437
|
+
if log_stderr and process.stderr is not None:
|
|
438
|
+
stderr_task = asyncio.create_task(_drain_stderr_to_log(process, command, stderr_log_level))
|
|
439
|
+
|
|
86
440
|
try:
|
|
87
441
|
yield process.stdout, process.stdin, process
|
|
88
442
|
finally:
|
|
443
|
+
# Cancel stderr logging task
|
|
444
|
+
if stderr_task is not None:
|
|
445
|
+
stderr_task.cancel()
|
|
446
|
+
with contextlib.suppress(asyncio.CancelledError):
|
|
447
|
+
await stderr_task
|
|
448
|
+
|
|
89
449
|
# Attempt graceful stdin shutdown first
|
|
90
450
|
if process.stdin is not None:
|
|
91
451
|
with contextlib.suppress(Exception):
|
acp/utils.py
CHANGED
|
@@ -6,6 +6,7 @@ import base64
|
|
|
6
6
|
from typing import TYPE_CHECKING, Any
|
|
7
7
|
|
|
8
8
|
from pydantic_ai import BinaryContent, FileUrl, ToolReturn
|
|
9
|
+
import structlog
|
|
9
10
|
|
|
10
11
|
from acp.schema import (
|
|
11
12
|
AudioContentBlock,
|
|
@@ -16,7 +17,6 @@ from acp.schema import (
|
|
|
16
17
|
ResourceContentBlock,
|
|
17
18
|
TextContentBlock,
|
|
18
19
|
)
|
|
19
|
-
from agentpool.log import get_logger
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
if TYPE_CHECKING:
|
|
@@ -27,7 +27,7 @@ if TYPE_CHECKING:
|
|
|
27
27
|
from acp.schema import ContentBlock, ToolCallKind
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
logger = get_logger(__name__)
|
|
30
|
+
logger = structlog.get_logger(__name__)
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
DEFAULT_PERMISSION_OPTIONS = [
|
|
@@ -122,8 +122,16 @@ def generate_tool_title(tool_name: str, tool_input: dict[str, Any]) -> str: # n
|
|
|
122
122
|
"""
|
|
123
123
|
name_lower = tool_name.lower()
|
|
124
124
|
|
|
125
|
+
# Exact matches for common tool names (OpenCode compatibility)
|
|
126
|
+
if name_lower == "read" and (path := tool_input.get("path") or tool_input.get("file_path")):
|
|
127
|
+
return f"Reading: {path}"
|
|
128
|
+
if name_lower in ("write", "edit") and (
|
|
129
|
+
path := tool_input.get("path") or tool_input.get("file_path")
|
|
130
|
+
):
|
|
131
|
+
return f"Editing: {path}"
|
|
132
|
+
|
|
125
133
|
# Command/script execution - show the command
|
|
126
|
-
if any(k in name_lower for k in ["command", "execute", "run", "shell", "script"]) and (
|
|
134
|
+
if any(k in name_lower for k in ["command", "execute", "run", "shell", "script", "bash"]) and (
|
|
127
135
|
cmd := tool_input.get("command")
|
|
128
136
|
):
|
|
129
137
|
# Truncate long commands
|
|
@@ -217,6 +225,11 @@ def infer_tool_kind(tool_name: str) -> ToolCallKind: # noqa: PLR0911
|
|
|
217
225
|
Tool kind string for ACP protocol
|
|
218
226
|
"""
|
|
219
227
|
name_lower = tool_name.lower()
|
|
228
|
+
|
|
229
|
+
# Exact matches for common tool names (OpenCode compatibility)
|
|
230
|
+
if name_lower in ("read", "write", "edit"):
|
|
231
|
+
return "read" if name_lower == "read" else "edit"
|
|
232
|
+
|
|
220
233
|
if any(i in name_lower for i in ["read", "load", "get"]) and any(
|
|
221
234
|
i in name_lower for i in ["file", "path", "content"]
|
|
222
235
|
):
|
|
@@ -231,7 +244,7 @@ def infer_tool_kind(tool_name: str) -> ToolCallKind: # noqa: PLR0911
|
|
|
231
244
|
return "move"
|
|
232
245
|
if any(i in name_lower for i in ["search", "find", "query", "lookup"]):
|
|
233
246
|
return "search"
|
|
234
|
-
if any(i in name_lower for i in ["execute", "run", "exec", "command", "shell"]):
|
|
247
|
+
if any(i in name_lower for i in ["execute", "run", "exec", "command", "shell", "bash"]):
|
|
235
248
|
return "execute"
|
|
236
249
|
if any(i in name_lower for i in ["think", "plan", "reason", "analyze"]):
|
|
237
250
|
return "think"
|
agentpool/__init__.py
CHANGED
|
@@ -7,13 +7,14 @@ Extended ACP / AGUI integration.
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
from importlib.metadata import version
|
|
10
|
+
from upathtools import register_http_filesystems
|
|
10
11
|
|
|
11
12
|
from agentpool.models.agents import NativeAgentConfig
|
|
12
13
|
from agentpool.models.manifest import AgentsManifest
|
|
13
14
|
|
|
14
15
|
# Builtin toolsets imports removed to avoid circular dependency
|
|
15
16
|
# Import them directly from agentpool_toolsets.builtin when needed
|
|
16
|
-
from agentpool.agents import Agent, AgentContext
|
|
17
|
+
from agentpool.agents import Agent, AgentContext, ClaudeCodeAgent, ACPAgent, AGUIAgent
|
|
17
18
|
from agentpool.delegation import AgentPool, Team, TeamRun, BaseTeam
|
|
18
19
|
from dotenv import load_dotenv
|
|
19
20
|
from agentpool.messaging.messages import ChatMessage
|
|
@@ -38,8 +39,11 @@ __license__ = "MIT"
|
|
|
38
39
|
__url__ = "https://github.com/phil65/agentpool"
|
|
39
40
|
|
|
40
41
|
load_dotenv()
|
|
42
|
+
register_http_filesystems()
|
|
41
43
|
|
|
42
44
|
__all__ = [
|
|
45
|
+
"ACPAgent",
|
|
46
|
+
"AGUIAgent",
|
|
43
47
|
"Agent",
|
|
44
48
|
"AgentContext",
|
|
45
49
|
"AgentPool",
|
|
@@ -49,6 +53,7 @@ __all__ = [
|
|
|
49
53
|
"BinaryContent",
|
|
50
54
|
"BinaryImage",
|
|
51
55
|
"ChatMessage",
|
|
56
|
+
"ClaudeCodeAgent",
|
|
52
57
|
"DocumentUrl",
|
|
53
58
|
"ImageUrl",
|
|
54
59
|
"MessageNode",
|
agentpool/agents/__init__.py
CHANGED
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from agentpool.agents.agent import Agent
|
|
6
6
|
from agentpool.agents.agui_agent import AGUIAgent
|
|
7
|
+
from agentpool.agents.acp_agent import ACPAgent
|
|
7
8
|
from agentpool.agents.claude_code_agent import ClaudeCodeAgent
|
|
8
9
|
from agentpool.agents.events import (
|
|
9
10
|
detailed_print_handler,
|
|
@@ -17,6 +18,7 @@ from agentpool.agents.sys_prompts import SystemPrompts
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
__all__ = [
|
|
21
|
+
"ACPAgent",
|
|
20
22
|
"AGUIAgent",
|
|
21
23
|
"Agent",
|
|
22
24
|
"AgentContext",
|