deft-subspace-acp 0.1.0a1__tar.gz
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.
- deft_subspace_acp-0.1.0a1/.gitignore +16 -0
- deft_subspace_acp-0.1.0a1/LICENSE +21 -0
- deft_subspace_acp-0.1.0a1/PKG-INFO +54 -0
- deft_subspace_acp-0.1.0a1/README.md +23 -0
- deft_subspace_acp-0.1.0a1/pyproject.toml +41 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/__init__.py +535 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/_conveniences.py +206 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/_mcp_connector.py +305 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/_model_agent.py +236 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/_start.py +637 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/_util.py +17 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/agent.py +1421 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/agents.py +495 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/auth.py +79 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/background.py +118 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/capabilities.py +128 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/catalog.py +433 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/client.py +1565 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/config.py +148 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/content.py +65 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/elicitation.py +147 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/endpoint.py +404 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/extensions.py +122 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/handlers.py +209 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/install.py +244 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/lazy.py +64 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/mcp.py +352 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/mcp_caller.py +263 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/mcp_connections.py +146 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/model.py +448 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/modes.py +81 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/node.py +444 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/open.py +128 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/permissions.py +112 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/policies.py +148 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/projection.py +395 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/py.typed +0 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/registry.py +163 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/registry_snapshot.json +1659 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/schemas.py +91 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/sync.py +52 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/telemetry.py +417 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/terminal_ui.py +252 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/terminals.py +321 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/tools.py +109 -0
- deft_subspace_acp-0.1.0a1/src/deft_subspace/acp/turn.py +371 -0
- deft_subspace_acp-0.1.0a1/tests/conftest.py +5 -0
- deft_subspace_acp-0.1.0a1/tests/fixtures/echo_agent.py +20 -0
- deft_subspace_acp-0.1.0a1/tests/fixtures/login_agent.py +104 -0
- deft_subspace_acp-0.1.0a1/tests/fixtures/mcp_http_server.py +32 -0
- deft_subspace_acp-0.1.0a1/tests/fixtures/mcp_stdio_server.py +24 -0
- deft_subspace_acp-0.1.0a1/tests/fixtures/sdk_agent.py +84 -0
- deft_subspace_acp-0.1.0a1/tests/fixtures/sdk_agent_v2.py +72 -0
- deft_subspace_acp-0.1.0a1/tests/fixtures/stdio_agent.py +22 -0
- deft_subspace_acp-0.1.0a1/tests/link.py +22 -0
- deft_subspace_acp-0.1.0a1/tests/test_agent.py +1537 -0
- deft_subspace_acp-0.1.0a1/tests/test_agents.py +393 -0
- deft_subspace_acp-0.1.0a1/tests/test_api.py +51 -0
- deft_subspace_acp-0.1.0a1/tests/test_client.py +318 -0
- deft_subspace_acp-0.1.0a1/tests/test_client_turns.py +309 -0
- deft_subspace_acp-0.1.0a1/tests/test_conveniences.py +170 -0
- deft_subspace_acp-0.1.0a1/tests/test_install.py +207 -0
- deft_subspace_acp-0.1.0a1/tests/test_interop_sdk.py +128 -0
- deft_subspace_acp-0.1.0a1/tests/test_model_agent_and_mcp.py +314 -0
- deft_subspace_acp-0.1.0a1/tests/test_node.py +164 -0
- deft_subspace_acp-0.1.0a1/tests/test_projection.py +247 -0
- deft_subspace_acp-0.1.0a1/tests/test_start.py +335 -0
- deft_subspace_acp-0.1.0a1/tests/test_telemetry.py +147 -0
- deft_subspace_acp-0.1.0a1/tests/test_terminal_ui.py +122 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Deft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: deft-subspace-acp
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: ACP for apps: one model over protocol v1 and v2, turns you can await, cancellation that works, permissions that fail closed. Types come from the official agent-client-protocol SDK.
|
|
5
|
+
Project-URL: Homepage, https://github.com/deftai/subspace/tree/main/python
|
|
6
|
+
Project-URL: Source, https://github.com/deftai/subspace
|
|
7
|
+
Project-URL: Issues, https://github.com/deftai/subspace/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/deftai/subspace/blob/main/python/CHANGELOG.md
|
|
9
|
+
Author: Deft
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: acp,agent-client-protocol,agents,asyncio,llm,mcp
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Framework :: AsyncIO
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: agent-client-protocol<2,>=1.0
|
|
25
|
+
Requires-Dist: deft-subspace-kernel==0.1.0a1
|
|
26
|
+
Provides-Extra: mcp
|
|
27
|
+
Requires-Dist: mcp<3,>=2.3; extra == 'mcp'
|
|
28
|
+
Provides-Extra: otel
|
|
29
|
+
Requires-Dist: opentelemetry-api>=1.27; extra == 'otel'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# deft-subspace-acp
|
|
33
|
+
|
|
34
|
+
[Agent Client Protocol](https://agentclientprotocol.com) (ACP) for Python apps, for both clients and agents. Part of [Deft Subspace](https://github.com/deftai/subspace/tree/main/python).
|
|
35
|
+
|
|
36
|
+
- **One model for v1 and v2.** The client asks for v2 and accepts v1, and your code sees the same events either way.
|
|
37
|
+
- **Turns you can await:** `async for event in turn`, and `await turn` for the result.
|
|
38
|
+
- **Cancellation that works**, and **permissions that fail closed.**
|
|
39
|
+
- **Tested against real agents:** Grok Build, the Claude and Codex ACP adapters, and agents built with the official SDK.
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import asyncio
|
|
43
|
+
from deft_subspace.acp import run
|
|
44
|
+
|
|
45
|
+
async def main():
|
|
46
|
+
result = await run("claude", "What does this repo do?", permissions="reject")
|
|
47
|
+
print(result.text)
|
|
48
|
+
|
|
49
|
+
asyncio.run(main())
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Extras: `otel` (OpenTelemetry spans) and `mcp` (MCP servers over http and sse).
|
|
53
|
+
|
|
54
|
+
See the [README](https://github.com/deftai/subspace/tree/main/python) for clients, agents, and how this differs from the TypeScript packages. MIT licensed.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# deft-subspace-acp
|
|
2
|
+
|
|
3
|
+
[Agent Client Protocol](https://agentclientprotocol.com) (ACP) for Python apps, for both clients and agents. Part of [Deft Subspace](https://github.com/deftai/subspace/tree/main/python).
|
|
4
|
+
|
|
5
|
+
- **One model for v1 and v2.** The client asks for v2 and accepts v1, and your code sees the same events either way.
|
|
6
|
+
- **Turns you can await:** `async for event in turn`, and `await turn` for the result.
|
|
7
|
+
- **Cancellation that works**, and **permissions that fail closed.**
|
|
8
|
+
- **Tested against real agents:** Grok Build, the Claude and Codex ACP adapters, and agents built with the official SDK.
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
import asyncio
|
|
12
|
+
from deft_subspace.acp import run
|
|
13
|
+
|
|
14
|
+
async def main():
|
|
15
|
+
result = await run("claude", "What does this repo do?", permissions="reject")
|
|
16
|
+
print(result.text)
|
|
17
|
+
|
|
18
|
+
asyncio.run(main())
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Extras: `otel` (OpenTelemetry spans) and `mcp` (MCP servers over http and sse).
|
|
22
|
+
|
|
23
|
+
See the [README](https://github.com/deftai/subspace/tree/main/python) for clients, agents, and how this differs from the TypeScript packages. MIT licensed.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "deft-subspace-acp"
|
|
3
|
+
version = "0.1.0a1"
|
|
4
|
+
description = "ACP for apps: one model over protocol v1 and v2, turns you can await, cancellation that works, permissions that fail closed. Types come from the official agent-client-protocol SDK."
|
|
5
|
+
keywords = ["agent-client-protocol", "acp", "agents", "llm", "asyncio", "mcp"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Deft" }]
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Framework :: AsyncIO",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Typing :: Typed",
|
|
22
|
+
]
|
|
23
|
+
# The kernel is released with acp, at the same version.
|
|
24
|
+
dependencies = ["deft-subspace-kernel==0.1.0a1", "agent-client-protocol>=1.0,<2"]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/deftai/subspace/tree/main/python"
|
|
28
|
+
Source = "https://github.com/deftai/subspace"
|
|
29
|
+
Issues = "https://github.com/deftai/subspace/issues"
|
|
30
|
+
Changelog = "https://github.com/deftai/subspace/blob/main/python/CHANGELOG.md"
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
otel = ["opentelemetry-api>=1.27"]
|
|
34
|
+
mcp = ["mcp>=2.3,<3"]
|
|
35
|
+
|
|
36
|
+
[build-system]
|
|
37
|
+
requires = ["hatchling>=1.25"]
|
|
38
|
+
build-backend = "hatchling.build"
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
packages = ["src/deft_subspace"]
|
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
"""ACP for apps: one model over protocol v1 and v2, turns you can await, cancellation that works,
|
|
2
|
+
permissions that fail closed. Both sides: `AcpClient` (and `start()`) for clients, `serve_agent`
|
|
3
|
+
(and `serve_stdio()`) for agents.
|
|
4
|
+
|
|
5
|
+
from deft_subspace.acp import start
|
|
6
|
+
|
|
7
|
+
agent = await start("claude", on_permission=lambda r, _s: "allow" if r.tool_call and r.tool_call.kind == "read" else "reject")
|
|
8
|
+
try:
|
|
9
|
+
await agent.run("What does this repo do?", on_message=lambda delta, info, _e: print(info.separator + delta, end=""))
|
|
10
|
+
finally:
|
|
11
|
+
await agent.close()
|
|
12
|
+
|
|
13
|
+
Where to start (everything is imported from `deft_subspace.acp`):
|
|
14
|
+
|
|
15
|
+
- Run an agent: `start()`, `run()`, `StartedAgent`; blocking: `deft_subspace.acp.sync.run()`.
|
|
16
|
+
- Client: `AcpClient`, `Session`, `Turn`, `TurnResult`, `TurnHandlers`; events: `TurnEvent`,
|
|
17
|
+
`MessageEvent`, `ToolCallEvent`, `PermissionEvent`.
|
|
18
|
+
- Permissions: `allow`, `reject`, `read_only`, `allow_inside`, `first_of`, `PermissionRequest`.
|
|
19
|
+
- Agents: `serve_stdio()`, `serve_agent()`, `AgentTurn`, `tool()`, `model_agent()`.
|
|
20
|
+
- Agent names: `list_agents()`, `load_catalog()`.
|
|
21
|
+
- MCP: `mcp_connector()`, `StdioMcpServer`, `HttpMcpServer`.
|
|
22
|
+
- Errors: every exception class is a `deft_subspace.kernel.SubspaceError`.
|
|
23
|
+
|
|
24
|
+
The official SDK's pydantic schemas are `v1` and `v2` (loaded on first use).
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from typing import TYPE_CHECKING, Any
|
|
28
|
+
|
|
29
|
+
from ._conveniences import (
|
|
30
|
+
JsonAnswerError,
|
|
31
|
+
SessionConveniences,
|
|
32
|
+
conveniences,
|
|
33
|
+
find_json,
|
|
34
|
+
)
|
|
35
|
+
from ._mcp_connector import (
|
|
36
|
+
mcp_connector,
|
|
37
|
+
)
|
|
38
|
+
from ._model_agent import (
|
|
39
|
+
ConversationSetup,
|
|
40
|
+
ModelAdapter,
|
|
41
|
+
ModelConversation,
|
|
42
|
+
ModelInput,
|
|
43
|
+
ModelPromptInput,
|
|
44
|
+
ModelReply,
|
|
45
|
+
ModelStream,
|
|
46
|
+
ModelTool,
|
|
47
|
+
ModelToolCall,
|
|
48
|
+
ToolResult,
|
|
49
|
+
ToolResultsInput,
|
|
50
|
+
model_agent,
|
|
51
|
+
)
|
|
52
|
+
from ._start import (
|
|
53
|
+
AgentCommand,
|
|
54
|
+
StartedAgent,
|
|
55
|
+
agent_by_name,
|
|
56
|
+
run,
|
|
57
|
+
serve_stdio,
|
|
58
|
+
start,
|
|
59
|
+
)
|
|
60
|
+
from .agent import (
|
|
61
|
+
AgentTurn,
|
|
62
|
+
ElicitAnswer,
|
|
63
|
+
LoadSessionRequest,
|
|
64
|
+
NewSessionRequest,
|
|
65
|
+
PermissionAnswer,
|
|
66
|
+
PermissionDenied,
|
|
67
|
+
ReplayWriter,
|
|
68
|
+
TerminalDisplay,
|
|
69
|
+
TerminalHandle,
|
|
70
|
+
ToolCallHandle,
|
|
71
|
+
serve_agent,
|
|
72
|
+
)
|
|
73
|
+
from .agents import (
|
|
74
|
+
BUILTIN_AGENTS,
|
|
75
|
+
AgentCatalog,
|
|
76
|
+
AgentDefinition,
|
|
77
|
+
CatalogLayer,
|
|
78
|
+
Quirk,
|
|
79
|
+
ResolvedAgent,
|
|
80
|
+
builtin_catalog,
|
|
81
|
+
list_agents,
|
|
82
|
+
resolve_agent,
|
|
83
|
+
)
|
|
84
|
+
from .auth import (
|
|
85
|
+
AuthMethod,
|
|
86
|
+
)
|
|
87
|
+
from .capabilities import (
|
|
88
|
+
AgentSupport,
|
|
89
|
+
CapabilityError,
|
|
90
|
+
ClientSupport,
|
|
91
|
+
agent_support,
|
|
92
|
+
client_support,
|
|
93
|
+
)
|
|
94
|
+
from .catalog import (
|
|
95
|
+
AgentFileError,
|
|
96
|
+
agent_files,
|
|
97
|
+
load_catalog,
|
|
98
|
+
load_catalog_async,
|
|
99
|
+
load_registry,
|
|
100
|
+
parse_agent_file,
|
|
101
|
+
parse_agent_table,
|
|
102
|
+
refresh_registry,
|
|
103
|
+
registry_cache_path,
|
|
104
|
+
)
|
|
105
|
+
from .client import (
|
|
106
|
+
AcpClient,
|
|
107
|
+
AgentInfo,
|
|
108
|
+
ElicitationRequest,
|
|
109
|
+
FileHandlers,
|
|
110
|
+
Session,
|
|
111
|
+
SessionInfo,
|
|
112
|
+
SessionSummary,
|
|
113
|
+
TerminalHandlers,
|
|
114
|
+
Timeouts,
|
|
115
|
+
prompt_blocks,
|
|
116
|
+
)
|
|
117
|
+
from .config import (
|
|
118
|
+
BooleanConfigOption,
|
|
119
|
+
ConfigChoice,
|
|
120
|
+
OtherConfigOption,
|
|
121
|
+
SelectConfigOption,
|
|
122
|
+
config_options_from,
|
|
123
|
+
)
|
|
124
|
+
from .content import (
|
|
125
|
+
file,
|
|
126
|
+
image,
|
|
127
|
+
)
|
|
128
|
+
from .elicitation import (
|
|
129
|
+
validate_elicitation,
|
|
130
|
+
)
|
|
131
|
+
from .endpoint import (
|
|
132
|
+
AgentEndpoint,
|
|
133
|
+
AgentLayer,
|
|
134
|
+
CallContext,
|
|
135
|
+
EndpointCall,
|
|
136
|
+
EndpointClient,
|
|
137
|
+
EndpointContext,
|
|
138
|
+
StateKey,
|
|
139
|
+
agent_endpoint,
|
|
140
|
+
state_key,
|
|
141
|
+
)
|
|
142
|
+
from .extensions import (
|
|
143
|
+
ExtensionHandler,
|
|
144
|
+
ExtensionNotification,
|
|
145
|
+
ExtensionRequest,
|
|
146
|
+
extension_notification,
|
|
147
|
+
extension_request,
|
|
148
|
+
handle,
|
|
149
|
+
)
|
|
150
|
+
from .handlers import (
|
|
151
|
+
TextEndInfo,
|
|
152
|
+
TextInfo,
|
|
153
|
+
ToolCallInfo,
|
|
154
|
+
TurnHandlers,
|
|
155
|
+
)
|
|
156
|
+
from .install import (
|
|
157
|
+
Installed,
|
|
158
|
+
InstallError,
|
|
159
|
+
binaries_path,
|
|
160
|
+
install_agent,
|
|
161
|
+
installed_binaries,
|
|
162
|
+
)
|
|
163
|
+
from .mcp import (
|
|
164
|
+
MCP_PROTOCOL_VERSION,
|
|
165
|
+
AcpMcpServer,
|
|
166
|
+
HttpMcpServer,
|
|
167
|
+
McpBindingError,
|
|
168
|
+
McpOperationContext,
|
|
169
|
+
McpRegistration,
|
|
170
|
+
SseMcpServer,
|
|
171
|
+
StdioMcpServer,
|
|
172
|
+
mcp_servers_param,
|
|
173
|
+
parse_mcp_servers,
|
|
174
|
+
)
|
|
175
|
+
from .mcp_caller import (
|
|
176
|
+
McpCaller,
|
|
177
|
+
McpCallOptions,
|
|
178
|
+
McpError,
|
|
179
|
+
McpServerClient,
|
|
180
|
+
server_client,
|
|
181
|
+
)
|
|
182
|
+
from .mcp_connections import (
|
|
183
|
+
McpConnectContext,
|
|
184
|
+
McpConnection,
|
|
185
|
+
McpConnector,
|
|
186
|
+
)
|
|
187
|
+
from .model import (
|
|
188
|
+
BackgroundItem,
|
|
189
|
+
ContentBlock,
|
|
190
|
+
ExhaustedEvent,
|
|
191
|
+
Exhaustion,
|
|
192
|
+
MessageEndEvent,
|
|
193
|
+
MessageEvent,
|
|
194
|
+
OtherWork,
|
|
195
|
+
PermissionCommand,
|
|
196
|
+
PermissionEvent,
|
|
197
|
+
PermissionOption,
|
|
198
|
+
PermissionOutcome,
|
|
199
|
+
PermissionRequest,
|
|
200
|
+
PlanEntry,
|
|
201
|
+
PlanEvent,
|
|
202
|
+
ProtocolVersion,
|
|
203
|
+
SessionInfoEvent,
|
|
204
|
+
StateEvent,
|
|
205
|
+
StopReason,
|
|
206
|
+
SubagentWork,
|
|
207
|
+
TerminalEvent,
|
|
208
|
+
TerminalWork,
|
|
209
|
+
ThoughtEndEvent,
|
|
210
|
+
ThoughtEvent,
|
|
211
|
+
ToolCall,
|
|
212
|
+
ToolCallContent,
|
|
213
|
+
ToolCallEvent,
|
|
214
|
+
ToolCallStatus,
|
|
215
|
+
ToolCallWork,
|
|
216
|
+
TurnEnd,
|
|
217
|
+
TurnEvent,
|
|
218
|
+
TurnLimits,
|
|
219
|
+
TurnResult,
|
|
220
|
+
UpdateEvent,
|
|
221
|
+
UsageEvent,
|
|
222
|
+
UserMessageEndEvent,
|
|
223
|
+
UserMessageEvent,
|
|
224
|
+
turn_end,
|
|
225
|
+
)
|
|
226
|
+
from .modes import (
|
|
227
|
+
SessionMode,
|
|
228
|
+
SessionModes,
|
|
229
|
+
modes_from,
|
|
230
|
+
)
|
|
231
|
+
from .node import (
|
|
232
|
+
ConnectedAgent,
|
|
233
|
+
WorkspaceFiles,
|
|
234
|
+
WorkspaceTerminals,
|
|
235
|
+
connect_agent,
|
|
236
|
+
inside_workspace,
|
|
237
|
+
workspace_files,
|
|
238
|
+
workspace_terminals,
|
|
239
|
+
)
|
|
240
|
+
from .open import (
|
|
241
|
+
ConnectedSession,
|
|
242
|
+
OpenedSession,
|
|
243
|
+
connect_session,
|
|
244
|
+
open_session,
|
|
245
|
+
)
|
|
246
|
+
from .permissions import (
|
|
247
|
+
OptionId,
|
|
248
|
+
PermissionDecision,
|
|
249
|
+
PermissionHandler,
|
|
250
|
+
PermissionPolicy,
|
|
251
|
+
decide,
|
|
252
|
+
resolve_decision,
|
|
253
|
+
)
|
|
254
|
+
from .policies import (
|
|
255
|
+
READ_KINDS,
|
|
256
|
+
PermissionRule,
|
|
257
|
+
allow,
|
|
258
|
+
allow_inside,
|
|
259
|
+
first_of,
|
|
260
|
+
inside,
|
|
261
|
+
read_only,
|
|
262
|
+
reject,
|
|
263
|
+
request_command,
|
|
264
|
+
request_paths,
|
|
265
|
+
)
|
|
266
|
+
from .projection import (
|
|
267
|
+
TurnProjection,
|
|
268
|
+
)
|
|
269
|
+
from .registry import (
|
|
270
|
+
REGISTRY_URL,
|
|
271
|
+
Registry,
|
|
272
|
+
RegistryAgent,
|
|
273
|
+
registry_target,
|
|
274
|
+
trim_registry,
|
|
275
|
+
)
|
|
276
|
+
from .telemetry import (
|
|
277
|
+
OtelTap,
|
|
278
|
+
otel_tap,
|
|
279
|
+
spans_from_trace,
|
|
280
|
+
)
|
|
281
|
+
from .terminal_ui import (
|
|
282
|
+
ask_in_terminal,
|
|
283
|
+
terminal,
|
|
284
|
+
)
|
|
285
|
+
from .terminals import (
|
|
286
|
+
TerminalExit,
|
|
287
|
+
Terminals,
|
|
288
|
+
TerminalSize,
|
|
289
|
+
TerminalState,
|
|
290
|
+
terminal_text,
|
|
291
|
+
)
|
|
292
|
+
from .tools import (
|
|
293
|
+
ToolContext,
|
|
294
|
+
ToolDefinition,
|
|
295
|
+
ToolSet,
|
|
296
|
+
check_tool_input,
|
|
297
|
+
tool,
|
|
298
|
+
tool_input_schema,
|
|
299
|
+
tool_output_text,
|
|
300
|
+
)
|
|
301
|
+
from .turn import (
|
|
302
|
+
Turn,
|
|
303
|
+
TurnHistory,
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
if TYPE_CHECKING:
|
|
307
|
+
from acp import schema as v1
|
|
308
|
+
from acp.experimental.v2 import schema as v2
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
if not TYPE_CHECKING:
|
|
312
|
+
# Hidden from type checkers, which see `v1` and `v2` above: a module `__getattr__` makes them
|
|
313
|
+
# accept any name imported from the package, typos included.
|
|
314
|
+
def __getattr__(name: str) -> Any:
|
|
315
|
+
if name in ("v1", "v2"):
|
|
316
|
+
from . import model
|
|
317
|
+
|
|
318
|
+
return getattr(model, name)
|
|
319
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
__all__ = [
|
|
323
|
+
"ConversationSetup",
|
|
324
|
+
"ModelInput",
|
|
325
|
+
"ModelPromptInput",
|
|
326
|
+
"ToolResultsInput",
|
|
327
|
+
"AcpClient",
|
|
328
|
+
"AcpMcpServer",
|
|
329
|
+
"AgentCatalog",
|
|
330
|
+
"AgentCommand",
|
|
331
|
+
"AgentDefinition",
|
|
332
|
+
"AgentEndpoint",
|
|
333
|
+
"AgentFileError",
|
|
334
|
+
"AgentInfo",
|
|
335
|
+
"AgentLayer",
|
|
336
|
+
"AgentSupport",
|
|
337
|
+
"AgentTurn",
|
|
338
|
+
"AuthMethod",
|
|
339
|
+
"BUILTIN_AGENTS",
|
|
340
|
+
"BackgroundItem",
|
|
341
|
+
"BooleanConfigOption",
|
|
342
|
+
"CallContext",
|
|
343
|
+
"CapabilityError",
|
|
344
|
+
"CatalogLayer",
|
|
345
|
+
"ClientSupport",
|
|
346
|
+
"ConfigChoice",
|
|
347
|
+
"ConnectedAgent",
|
|
348
|
+
"ConnectedSession",
|
|
349
|
+
"ContentBlock",
|
|
350
|
+
"ElicitAnswer",
|
|
351
|
+
"ElicitationRequest",
|
|
352
|
+
"EndpointCall",
|
|
353
|
+
"EndpointClient",
|
|
354
|
+
"EndpointContext",
|
|
355
|
+
"ExhaustedEvent",
|
|
356
|
+
"Exhaustion",
|
|
357
|
+
"ExtensionHandler",
|
|
358
|
+
"ExtensionNotification",
|
|
359
|
+
"ExtensionRequest",
|
|
360
|
+
"FileHandlers",
|
|
361
|
+
"HttpMcpServer",
|
|
362
|
+
"InstallError",
|
|
363
|
+
"Installed",
|
|
364
|
+
"JsonAnswerError",
|
|
365
|
+
"LoadSessionRequest",
|
|
366
|
+
"MCP_PROTOCOL_VERSION",
|
|
367
|
+
"McpBindingError",
|
|
368
|
+
"McpCallOptions",
|
|
369
|
+
"McpCaller",
|
|
370
|
+
"McpConnectContext",
|
|
371
|
+
"McpConnection",
|
|
372
|
+
"McpConnector",
|
|
373
|
+
"McpError",
|
|
374
|
+
"McpOperationContext",
|
|
375
|
+
"McpRegistration",
|
|
376
|
+
"McpServerClient",
|
|
377
|
+
"MessageEndEvent",
|
|
378
|
+
"MessageEvent",
|
|
379
|
+
"ModelAdapter",
|
|
380
|
+
"ModelConversation",
|
|
381
|
+
"ModelReply",
|
|
382
|
+
"ModelStream",
|
|
383
|
+
"ModelTool",
|
|
384
|
+
"ModelToolCall",
|
|
385
|
+
"NewSessionRequest",
|
|
386
|
+
"OpenedSession",
|
|
387
|
+
"OptionId",
|
|
388
|
+
"OtelTap",
|
|
389
|
+
"OtherConfigOption",
|
|
390
|
+
"OtherWork",
|
|
391
|
+
"PermissionAnswer",
|
|
392
|
+
"PermissionCommand",
|
|
393
|
+
"PermissionDecision",
|
|
394
|
+
"PermissionDenied",
|
|
395
|
+
"PermissionEvent",
|
|
396
|
+
"PermissionHandler",
|
|
397
|
+
"PermissionOption",
|
|
398
|
+
"PermissionOutcome",
|
|
399
|
+
"PermissionPolicy",
|
|
400
|
+
"PermissionRequest",
|
|
401
|
+
"PermissionRule",
|
|
402
|
+
"PlanEntry",
|
|
403
|
+
"PlanEvent",
|
|
404
|
+
"ProtocolVersion",
|
|
405
|
+
"Quirk",
|
|
406
|
+
"READ_KINDS",
|
|
407
|
+
"REGISTRY_URL",
|
|
408
|
+
"Registry",
|
|
409
|
+
"RegistryAgent",
|
|
410
|
+
"ReplayWriter",
|
|
411
|
+
"ResolvedAgent",
|
|
412
|
+
"SelectConfigOption",
|
|
413
|
+
"Session",
|
|
414
|
+
"SessionConveniences",
|
|
415
|
+
"SessionInfo",
|
|
416
|
+
"SessionInfoEvent",
|
|
417
|
+
"SessionMode",
|
|
418
|
+
"SessionModes",
|
|
419
|
+
"SessionSummary",
|
|
420
|
+
"SseMcpServer",
|
|
421
|
+
"StartedAgent",
|
|
422
|
+
"StateEvent",
|
|
423
|
+
"StateKey",
|
|
424
|
+
"StdioMcpServer",
|
|
425
|
+
"StopReason",
|
|
426
|
+
"SubagentWork",
|
|
427
|
+
"TerminalDisplay",
|
|
428
|
+
"TerminalEvent",
|
|
429
|
+
"TerminalExit",
|
|
430
|
+
"TerminalHandle",
|
|
431
|
+
"TerminalHandlers",
|
|
432
|
+
"TerminalSize",
|
|
433
|
+
"TerminalState",
|
|
434
|
+
"TerminalWork",
|
|
435
|
+
"Terminals",
|
|
436
|
+
"TextEndInfo",
|
|
437
|
+
"TextInfo",
|
|
438
|
+
"ThoughtEndEvent",
|
|
439
|
+
"ThoughtEvent",
|
|
440
|
+
"Timeouts",
|
|
441
|
+
"ToolCall",
|
|
442
|
+
"ToolCallContent",
|
|
443
|
+
"ToolCallEvent",
|
|
444
|
+
"ToolCallHandle",
|
|
445
|
+
"ToolCallInfo",
|
|
446
|
+
"ToolCallStatus",
|
|
447
|
+
"ToolCallWork",
|
|
448
|
+
"ToolContext",
|
|
449
|
+
"ToolDefinition",
|
|
450
|
+
"ToolResult",
|
|
451
|
+
"ToolSet",
|
|
452
|
+
"Turn",
|
|
453
|
+
"TurnHistory",
|
|
454
|
+
"TurnEnd",
|
|
455
|
+
"TurnEvent",
|
|
456
|
+
"TurnHandlers",
|
|
457
|
+
"TurnLimits",
|
|
458
|
+
"TurnProjection",
|
|
459
|
+
"TurnResult",
|
|
460
|
+
"UpdateEvent",
|
|
461
|
+
"UsageEvent",
|
|
462
|
+
"UserMessageEndEvent",
|
|
463
|
+
"UserMessageEvent",
|
|
464
|
+
"WorkspaceFiles",
|
|
465
|
+
"WorkspaceTerminals",
|
|
466
|
+
"agent_by_name",
|
|
467
|
+
"agent_endpoint",
|
|
468
|
+
"agent_files",
|
|
469
|
+
"agent_support",
|
|
470
|
+
"allow",
|
|
471
|
+
"allow_inside",
|
|
472
|
+
"ask_in_terminal",
|
|
473
|
+
"binaries_path",
|
|
474
|
+
"builtin_catalog",
|
|
475
|
+
"check_tool_input",
|
|
476
|
+
"client_support",
|
|
477
|
+
"config_options_from",
|
|
478
|
+
"connect_agent",
|
|
479
|
+
"connect_session",
|
|
480
|
+
"conveniences",
|
|
481
|
+
"decide",
|
|
482
|
+
"extension_notification",
|
|
483
|
+
"extension_request",
|
|
484
|
+
"file",
|
|
485
|
+
"find_json",
|
|
486
|
+
"first_of",
|
|
487
|
+
"handle",
|
|
488
|
+
"image",
|
|
489
|
+
"inside",
|
|
490
|
+
"inside_workspace",
|
|
491
|
+
"install_agent",
|
|
492
|
+
"installed_binaries",
|
|
493
|
+
"list_agents",
|
|
494
|
+
"load_catalog",
|
|
495
|
+
"load_catalog_async",
|
|
496
|
+
"load_registry",
|
|
497
|
+
"mcp_connector",
|
|
498
|
+
"mcp_servers_param",
|
|
499
|
+
"model_agent",
|
|
500
|
+
"modes_from",
|
|
501
|
+
"open_session",
|
|
502
|
+
"otel_tap",
|
|
503
|
+
"parse_agent_file",
|
|
504
|
+
"parse_agent_table",
|
|
505
|
+
"parse_mcp_servers",
|
|
506
|
+
"prompt_blocks",
|
|
507
|
+
"read_only",
|
|
508
|
+
"refresh_registry",
|
|
509
|
+
"registry_cache_path",
|
|
510
|
+
"registry_target",
|
|
511
|
+
"reject",
|
|
512
|
+
"request_command",
|
|
513
|
+
"request_paths",
|
|
514
|
+
"resolve_agent",
|
|
515
|
+
"resolve_decision",
|
|
516
|
+
"run",
|
|
517
|
+
"serve_agent",
|
|
518
|
+
"serve_stdio",
|
|
519
|
+
"server_client",
|
|
520
|
+
"spans_from_trace",
|
|
521
|
+
"start",
|
|
522
|
+
"state_key",
|
|
523
|
+
"terminal",
|
|
524
|
+
"terminal_text",
|
|
525
|
+
"tool",
|
|
526
|
+
"tool_input_schema",
|
|
527
|
+
"tool_output_text",
|
|
528
|
+
"trim_registry",
|
|
529
|
+
"turn_end",
|
|
530
|
+
"v1",
|
|
531
|
+
"v2",
|
|
532
|
+
"validate_elicitation",
|
|
533
|
+
"workspace_files",
|
|
534
|
+
"workspace_terminals",
|
|
535
|
+
]
|