agentconnect-cli 0.1.0a3__tar.gz → 0.1.0a5__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.
Files changed (75) hide show
  1. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/PKG-INFO +14 -14
  2. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/README.md +9 -9
  3. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/pyproject.toml +7 -7
  4. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/pyproject.toml.orig +7 -7
  5. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/__init__.py +1 -1
  6. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/a2a_adapter/adapter.py +145 -24
  7. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/a2a_adapter/cards.py +3 -1
  8. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/a2a_adapter/facade.py +33 -4
  9. agentconnect_cli-0.1.0a5/src/agentconnect/a2a_adapter/seen.py +83 -0
  10. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/adapter.py +38 -2
  11. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/adapters.py +34 -2
  12. agentconnect_cli-0.1.0a5/src/agentconnect/apiclient.py +114 -0
  13. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/callback.py +61 -14
  14. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/cli.py +1313 -40
  15. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/cli_json.py +132 -4
  16. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/cli_support.py +56 -3
  17. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/clock.py +8 -0
  18. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/config.py +340 -47
  19. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/deliveries.py +25 -2
  20. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/directory_client.py +23 -5
  21. agentconnect_cli-0.1.0a5/src/agentconnect/entry.py +55 -0
  22. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/failpoints.py +8 -3
  23. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/isolation.py +195 -11
  24. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/keystore.py +39 -4
  25. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/limits.py +100 -27
  26. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/mcp/backend.py +15 -0
  27. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/mcp/server.py +10 -8
  28. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/mcp/session.py +19 -1
  29. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/mcp/tools.py +38 -4
  30. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/payloads.py +17 -0
  31. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/policy.py +20 -1
  32. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/relay.py +55 -4
  33. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/agent.py +41 -10
  34. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/api.py +727 -53
  35. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/engine.py +2213 -269
  36. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/errors.py +2 -0
  37. agentconnect_cli-0.1.0a5/src/agentconnect/runtime/evaluation.py +198 -0
  38. agentconnect_cli-0.1.0a5/src/agentconnect/runtime/freshness.py +585 -0
  39. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/groups.py +263 -14
  40. agentconnect_cli-0.1.0a5/src/agentconnect/runtime/introductions.py +477 -0
  41. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/knocks.py +587 -41
  42. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/listing.py +40 -4
  43. agentconnect_cli-0.1.0a5/src/agentconnect/runtime/owner_domains.py +259 -0
  44. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/runtime.py +2 -0
  45. agentconnect_cli-0.1.0a5/src/agentconnect/runtime/succession.py +439 -0
  46. agentconnect_cli-0.1.0a5/src/agentconnect/runtime/tier.py +85 -0
  47. agentconnect_cli-0.1.0a5/src/agentconnect/runtime/trust.py +1665 -0
  48. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/schemas.py +22 -4
  49. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/sse.py +38 -2
  50. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/store.py +1401 -75
  51. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/tokens.py +2 -0
  52. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/webhook.py +11 -0
  53. agentconnect_cli-0.1.0a3/src/agentconnect/a2a_adapter/seen.py +0 -49
  54. agentconnect_cli-0.1.0a3/src/agentconnect/apiclient.py +0 -61
  55. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/a2a_adapter/__init__.py +0 -0
  56. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/a2a_adapter/convert.py +0 -0
  57. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/a2a_adapter/serve.py +0 -0
  58. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/api_tls.py +0 -0
  59. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/backoff.py +0 -0
  60. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/daemon/__init__.py +0 -0
  61. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/identity.py +0 -0
  62. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/log.py +0 -0
  63. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/mcp/__init__.py +0 -0
  64. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/ownerfile.py +0 -0
  65. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/provision.py +0 -0
  66. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/py.typed +0 -0
  67. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/__init__.py +0 -0
  68. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/floor.py +0 -0
  69. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/ledger.py +0 -0
  70. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/registry.py +0 -0
  71. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/runtime/sas.py +0 -0
  72. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/sas_emoji.py +0 -0
  73. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/shapes.py +0 -0
  74. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/sockets.py +0 -0
  75. {agentconnect_cli-0.1.0a3 → agentconnect_cli-0.1.0a5}/src/agentconnect/tasks.py +0 -0
@@ -1,17 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentconnect-cli
3
- Version: 0.1.0a3
3
+ Version: 0.1.0a5
4
4
  Summary: AgentConnect daemon (agentconnectd) and CLI
5
5
  License-Expression: Apache-2.0
6
- Requires-Dist: a2a-sdk[http-server,signing]>=1.2.3
7
- Requires-Dist: agentconnect-core==0.1.0a3
6
+ Requires-Dist: a2a-sdk[http-server,signing]>=1.3.1
7
+ Requires-Dist: agentconnect-core==0.1.0a5
8
8
  Requires-Dist: cryptography>=50.0.2
9
- Requires-Dist: httpx>=0.28.1
9
+ Requires-Dist: httpx>=0.29.0
10
10
  Requires-Dist: keyring>=25.7.0
11
11
  Requires-Dist: mcp>=2.3.0
12
12
  Requires-Dist: pyjwt[crypto]>=2.15.1
13
13
  Requires-Dist: structlog>=26.1.0
14
- Requires-Dist: typer>=0.27.3
14
+ Requires-Dist: typer>=0.28.0
15
15
  Requires-Dist: uvicorn>=0.54.0
16
16
  Requires-Dist: websockets>=17.3
17
17
  Requires-Python: >=3.12
@@ -21,8 +21,8 @@ Description-Content-Type: text/markdown
21
21
 
22
22
  The AgentConnect daemon (`agentconnectd`) and CLI (`agentconnect`). The
23
23
  distribution is `agentconnect-cli`; the command and the import package are
24
- `agentconnect`. See the repository [README](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/README.md) and
25
- [SPEC.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/SPEC.md).
24
+ `agentconnect`. See the repository [README](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/README.md) and
25
+ [SPEC.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/SPEC.md).
26
26
 
27
27
  ```sh
28
28
  agentconnect daemon run [--config PATH] [--tcp-port N] # foreground, JSON logs on stderr
@@ -32,12 +32,12 @@ agentconnect status [--json] # reads the local API
32
32
  Everything protocol-related is in the runtime, `agentconnect.runtime`
33
33
  (`Runtime`, with its engine, local API, adapters and agent-scope
34
34
  `AgentApi`). `agentconnectd` (`agentconnect.daemon`) is one host of it; the
35
- Python SDK's embedded mode (`AgentConnect.embedded`, [docs/sdk.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/sdk.md))
35
+ Python SDK's embedded mode (`AgentConnect.embedded`, [docs/sdk.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/sdk.md))
36
36
  is the other. Both run the same checks, and both serve the local API below.
37
37
 
38
38
  The invite lifecycle (`group`, `invite`, `accept`, `groups`, `approvals`,
39
39
  `verify`, `leave`, `send`, `events`) is documented in
40
- [docs/cli.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/cli.md), with the `--json` schemas and exit codes.
40
+ [docs/cli.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/cli.md), with the `--json` schemas and exit codes.
41
41
  `approvals approve`, `approvals reject` and `verify` use the human token:
42
42
  **never give an agent the human token or let it run those commands for the
43
43
  human.**
@@ -46,7 +46,7 @@ Don't give agents shell or file access to the data directory either: an
46
46
  agent that can read it can approve joins and mark codes verified as you,
47
47
  because the human token is a file there. Agents that need a shell can run
48
48
  as another OS user, with the daemon under a user of its own
49
- ([docs/isolation.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/isolation.md)).
49
+ ([docs/isolation.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/isolation.md)).
50
50
 
51
51
  ## What the daemon holds
52
52
 
@@ -64,14 +64,14 @@ as another OS user, with the daemon under a user of its own
64
64
 
65
65
  The data directory (`~/.local/share/agentconnect`) is 0700 and every file in
66
66
  it 0600. Configuration is `~/.config/agentconnect/config.toml`; see
67
- [docs/config.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/config.md) for the keys and the `AC_*` overrides.
67
+ [docs/config.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/config.md) for the keys and the `AC_*` overrides.
68
68
 
69
69
  ## Local control API
70
70
 
71
71
  JSON over HTTP/1.1 on a Unix socket in the data directory, or on
72
72
  `https://127.0.0.1:<port>` (TLS with a certificate the clients pin). Every
73
73
  request needs `Authorization: Bearer <token>`.
74
- [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/api.md) describes the transport, tokens, errors and
74
+ [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/api.md) describes the transport, tokens, errors and
75
75
  every route with its request and response shapes.
76
76
 
77
77
  Two tokens live in the data directory: `api-token` (agent scope) and
@@ -99,7 +99,7 @@ repeat a message or an event. Every delivery has a stable `msg_id` and every
99
99
  event a stable `event_id`; deduplicate by them. Nothing is lost: an event is
100
100
  recorded before the adapter hears of it and sent again on restart until
101
101
  `on_event` returns (ADR-004).
102
- The webhook adapter ([docs/adapters/webhook.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/adapters/webhook.md)) and the SSE adapter (`GET /v0/events`, [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/api.md#event-stream)) serve headless agents.
102
+ The webhook adapter ([docs/adapters/webhook.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/adapters/webhook.md)) and the SSE adapter (`GET /v0/events`, [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/api.md#event-stream)) serve headless agents.
103
103
  `CallbackAdapter` (`agentconnect.callback`) is the embedded SDK's in-process adapter, with the webhook's retry rules. `RecordingAdapter` is the in-memory adapter used by tests. Every message in
104
104
  and out goes through the safety policy (`agentconnect.policy`) before any
105
- adapter sees it ([docs/safety.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/safety.md)).
105
+ adapter sees it ([docs/safety.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/safety.md)).
@@ -2,8 +2,8 @@
2
2
 
3
3
  The AgentConnect daemon (`agentconnectd`) and CLI (`agentconnect`). The
4
4
  distribution is `agentconnect-cli`; the command and the import package are
5
- `agentconnect`. See the repository [README](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/README.md) and
6
- [SPEC.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/SPEC.md).
5
+ `agentconnect`. See the repository [README](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/README.md) and
6
+ [SPEC.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/SPEC.md).
7
7
 
8
8
  ```sh
9
9
  agentconnect daemon run [--config PATH] [--tcp-port N] # foreground, JSON logs on stderr
@@ -13,12 +13,12 @@ agentconnect status [--json] # reads the local API
13
13
  Everything protocol-related is in the runtime, `agentconnect.runtime`
14
14
  (`Runtime`, with its engine, local API, adapters and agent-scope
15
15
  `AgentApi`). `agentconnectd` (`agentconnect.daemon`) is one host of it; the
16
- Python SDK's embedded mode (`AgentConnect.embedded`, [docs/sdk.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/sdk.md))
16
+ Python SDK's embedded mode (`AgentConnect.embedded`, [docs/sdk.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/sdk.md))
17
17
  is the other. Both run the same checks, and both serve the local API below.
18
18
 
19
19
  The invite lifecycle (`group`, `invite`, `accept`, `groups`, `approvals`,
20
20
  `verify`, `leave`, `send`, `events`) is documented in
21
- [docs/cli.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/cli.md), with the `--json` schemas and exit codes.
21
+ [docs/cli.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/cli.md), with the `--json` schemas and exit codes.
22
22
  `approvals approve`, `approvals reject` and `verify` use the human token:
23
23
  **never give an agent the human token or let it run those commands for the
24
24
  human.**
@@ -27,7 +27,7 @@ Don't give agents shell or file access to the data directory either: an
27
27
  agent that can read it can approve joins and mark codes verified as you,
28
28
  because the human token is a file there. Agents that need a shell can run
29
29
  as another OS user, with the daemon under a user of its own
30
- ([docs/isolation.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/isolation.md)).
30
+ ([docs/isolation.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/isolation.md)).
31
31
 
32
32
  ## What the daemon holds
33
33
 
@@ -45,14 +45,14 @@ as another OS user, with the daemon under a user of its own
45
45
 
46
46
  The data directory (`~/.local/share/agentconnect`) is 0700 and every file in
47
47
  it 0600. Configuration is `~/.config/agentconnect/config.toml`; see
48
- [docs/config.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/config.md) for the keys and the `AC_*` overrides.
48
+ [docs/config.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/config.md) for the keys and the `AC_*` overrides.
49
49
 
50
50
  ## Local control API
51
51
 
52
52
  JSON over HTTP/1.1 on a Unix socket in the data directory, or on
53
53
  `https://127.0.0.1:<port>` (TLS with a certificate the clients pin). Every
54
54
  request needs `Authorization: Bearer <token>`.
55
- [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/api.md) describes the transport, tokens, errors and
55
+ [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/api.md) describes the transport, tokens, errors and
56
56
  every route with its request and response shapes.
57
57
 
58
58
  Two tokens live in the data directory: `api-token` (agent scope) and
@@ -80,7 +80,7 @@ repeat a message or an event. Every delivery has a stable `msg_id` and every
80
80
  event a stable `event_id`; deduplicate by them. Nothing is lost: an event is
81
81
  recorded before the adapter hears of it and sent again on restart until
82
82
  `on_event` returns (ADR-004).
83
- The webhook adapter ([docs/adapters/webhook.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/adapters/webhook.md)) and the SSE adapter (`GET /v0/events`, [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/api.md#event-stream)) serve headless agents.
83
+ The webhook adapter ([docs/adapters/webhook.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/adapters/webhook.md)) and the SSE adapter (`GET /v0/events`, [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/api.md#event-stream)) serve headless agents.
84
84
  `CallbackAdapter` (`agentconnect.callback`) is the embedded SDK's in-process adapter, with the webhook's retry rules. `RecordingAdapter` is the in-memory adapter used by tests. Every message in
85
85
  and out goes through the safety policy (`agentconnect.policy`) before any
86
- adapter sees it ([docs/safety.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a3/docs/safety.md)).
86
+ adapter sees it ([docs/safety.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a5/docs/safety.md)).
@@ -1,26 +1,26 @@
1
1
  [project]
2
2
  name = "agentconnect-cli"
3
- version = "0.1.0a3"
3
+ version = "0.1.0a5"
4
4
  description = "AgentConnect daemon (agentconnectd) and CLI"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
7
7
  requires-python = ">=3.12"
8
8
  dependencies = [
9
- "a2a-sdk[http-server,signing]>=1.2.3",
10
- "agentconnect-core==0.1.0a3",
9
+ "a2a-sdk[http-server,signing]>=1.3.1",
10
+ "agentconnect-core==0.1.0a5",
11
11
  "cryptography>=50.0.2",
12
- "httpx>=0.28.1",
12
+ "httpx>=0.29.0",
13
13
  "keyring>=25.7.0",
14
14
  "mcp>=2.3.0",
15
15
  "pyjwt[crypto]>=2.15.1",
16
16
  "structlog>=26.1.0",
17
- "typer>=0.27.3",
17
+ "typer>=0.28.0",
18
18
  "uvicorn>=0.54.0",
19
19
  "websockets>=17.3",
20
20
  ]
21
21
 
22
22
  [project.scripts]
23
- agentconnect = "agentconnect.cli:app"
23
+ agentconnect = "agentconnect.entry:main"
24
24
 
25
25
  [tool.uv.sources.agentconnect-core]
26
26
  workspace = true
@@ -29,5 +29,5 @@ workspace = true
29
29
  module-name = "agentconnect"
30
30
 
31
31
  [build-system]
32
- requires = ["uv_build>=0.13.5,<0.14"]
32
+ requires = ["uv_build>=0.13.10,<0.14"]
33
33
  build-backend = "uv_build"
@@ -1,26 +1,26 @@
1
1
  [project]
2
2
  name = "agentconnect-cli"
3
- version = "0.1.0a3"
3
+ version = "0.1.0a5"
4
4
  description = "AgentConnect daemon (agentconnectd) and CLI"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
7
7
  requires-python = ">=3.12"
8
8
  dependencies = [
9
- "a2a-sdk[http-server,signing]>=1.2.3",
10
- "agentconnect-core==0.1.0a3",
9
+ "a2a-sdk[http-server,signing]>=1.3.1",
10
+ "agentconnect-core==0.1.0a5",
11
11
  "cryptography>=50.0.2",
12
- "httpx>=0.28.1",
12
+ "httpx>=0.29.0",
13
13
  "keyring>=25.7.0",
14
14
  "mcp>=2.3.0",
15
15
  "pyjwt[crypto]>=2.15.1",
16
16
  "structlog>=26.1.0",
17
- "typer>=0.27.3",
17
+ "typer>=0.28.0",
18
18
  "uvicorn>=0.54.0",
19
19
  "websockets>=17.3",
20
20
  ]
21
21
 
22
22
  [project.scripts]
23
- agentconnect = "agentconnect.cli:app"
23
+ agentconnect = "agentconnect.entry:main"
24
24
 
25
25
  [tool.uv.sources]
26
26
  agentconnect-core = { workspace = true }
@@ -30,5 +30,5 @@ agentconnect-core = { workspace = true }
30
30
  module-name = "agentconnect"
31
31
 
32
32
  [build-system]
33
- requires = ["uv_build>=0.13.5,<0.14"]
33
+ requires = ["uv_build>=0.13.10,<0.14"]
34
34
  build-backend = "uv_build"
@@ -1,3 +1,3 @@
1
1
  """AgentConnect daemon and CLI."""
2
2
 
3
- __version__ = "0.1.0a3"
3
+ __version__ = "0.1.0a5"
@@ -40,7 +40,7 @@ import json
40
40
  import logging
41
41
  import secrets
42
42
  from collections import OrderedDict, deque
43
- from collections.abc import AsyncIterator, Coroutine, Mapping
43
+ from collections.abc import AsyncIterator, Callable, Collection, Coroutine, Mapping
44
44
  from dataclasses import dataclass, field
45
45
  from pathlib import Path
46
46
  from typing import TYPE_CHECKING, Any
@@ -74,7 +74,7 @@ from agentconnect.adapter import (
74
74
  Sender,
75
75
  )
76
76
  from agentconnect.clock import Clock, unix_seconds
77
- from agentconnect.isolation import facade_uids, receiver_uids, resolve_gid
77
+ from agentconnect.isolation import facade_uids, receiver_uids, resolve_gid, restricted_receiver_uids
78
78
  from agentconnect.sockets import PeerMismatchError, receiver_async_transport
79
79
  from agentconnect.tasks import cancel_and_wait
80
80
 
@@ -84,6 +84,8 @@ if TYPE_CHECKING:
84
84
 
85
85
  LOG = log.get("a2a")
86
86
  FACADE_TOKEN_FILE = "a2a-facade-token" # noqa: S105 - a file name
87
+ # Where older daemons kept the seen set, in plain SQLite: moved into the
88
+ # encrypted database and deleted on first use.
87
89
  SEEN_FILE = "a2a-seen.db"
88
90
  MAX_CONTEXT_ENTRY = 64 * 1024 # bytes of JSON; bigger context entries are summarised
89
91
  MAX_TASKS = 1024 # local agent tasks kept in memory (a cache of the database's)
@@ -91,6 +93,30 @@ TASKS_PER_PEER = 64 # tasks kept per requesting instance in the database
91
93
  CARD_TIMEOUT = 5.0
92
94
 
93
95
 
96
+ def _connection_dropped(e: BaseException) -> bool:
97
+ """Whether a call failed because its connection went away under it
98
+ (read, write or protocol error), not because the agent couldn't be
99
+ reached or answered with an error."""
100
+ return isinstance(e.__cause__, (httpx.ReadError, httpx.WriteError, httpx.RemoteProtocolError))
101
+
102
+
103
+ def _failure(e: BaseException) -> dict[str, Any]:
104
+ """What a failed call to the local agent says about itself, for the
105
+ log: the error's class, the class of the network or HTTP error under it,
106
+ and the HTTP status if there was one. Never a URL or a body."""
107
+ cause = e.__cause__
108
+ return {
109
+ "error": type(e).__name__,
110
+ "cause": None if cause is None else type(cause).__name__,
111
+ "status": cause.response.status_code if isinstance(cause, httpx.HTTPStatusError) else None,
112
+ }
113
+
114
+
115
+ #: The restricted agent's base URL: its socket carries plain HTTP, so this
116
+ #: gives only the Host header and the paths.
117
+ RESTRICTED_URL = "http://localhost"
118
+
119
+
94
120
  @dataclass(frozen=True)
95
121
  class A2AOptions:
96
122
  """The adapter's configuration (``[a2a]`` in config.toml)."""
@@ -135,6 +161,21 @@ class A2AOptions:
135
161
  data_dir=config.data_dir,
136
162
  )
137
163
 
164
+ @staticmethod
165
+ def restricted_from_config(config: Config) -> A2AOptions:
166
+ """The restricted tier's agent: on its socket, served by a restricted
167
+ user, with no facade, token or other setting of the main agent's.
168
+ The socket carries plain HTTP; the URL gives only Host and paths."""
169
+ return A2AOptions(
170
+ local_agent_url=RESTRICTED_URL,
171
+ local_agent_socket=config.a2a_restricted_socket,
172
+ receiver_uids=restricted_receiver_uids(config),
173
+ card_keys=cards.load_jwks(config.a2a_card_keys_file),
174
+ context_messages=config.a2a_context_messages,
175
+ frame_text=config.a2a_frame_text,
176
+ reply_timeout=float(config.a2a_reply_timeout),
177
+ )
178
+
138
179
 
139
180
  @dataclass(frozen=True)
140
181
  class TaskRef:
@@ -163,8 +204,12 @@ def message_id(d: Delivery) -> str:
163
204
  class A2AAdapter:
164
205
  """See the module docstring."""
165
206
 
166
- def __init__(self, options: A2AOptions, name: str = "a2a") -> None:
207
+ # The restricted tier's agent (ADR-007 Decision 6): its groups only.
208
+ restricted = False
209
+
210
+ def __init__(self, options: A2AOptions, name: str = "a2a", *, restricted: bool = False) -> None:
167
211
  self.name = name
212
+ self.restricted = restricted
168
213
  self.options = options
169
214
  self._seen_store: Seen | None = None
170
215
  self._send: OutboundSend | None = None
@@ -176,7 +221,8 @@ class A2AAdapter:
176
221
  self._groups: dict[str, GroupView] = {}
177
222
  self._cards: dict[str, dict[str, tuple[AgentCard, str]]] = {}
178
223
  self._peers: dict[str, set[str]] = {}
179
- self._context: dict[str, deque[dict[str, Any]]] = {}
224
+ # Per group: (the sending instance, the entry the agent gets).
225
+ self._context: dict[str, deque[tuple[str, dict[str, Any]]]] = {}
180
226
  self._tasks: OrderedDict[str, TaskRef] = OrderedDict()
181
227
  # The daemon's encrypted store, where the task map outlives a restart,
182
228
  # and the runtime's clock for its entries.
@@ -185,11 +231,17 @@ class A2AAdapter:
185
231
  self._running: set[asyncio.Task[None]] = set()
186
232
  self.facade: Facade | None = None
187
233
  self.facade_token: str | None = None
234
+ self._deliverable: Callable[[Delivery], bool] | None = None
188
235
 
189
236
  def bind_store(self, store: Store) -> None:
190
237
  """The daemon's database: the local agent's tasks are kept there,
191
- so a follow-up or a cancel after a restart still finds its task."""
238
+ so a follow-up or a cancel after a restart still finds its task, and
239
+ so is the seen set. An older daemon's plain seen file is taken over
240
+ here, at start, rather than inside the first delivery."""
192
241
  self._store = store
242
+ data_dir = self.options.data_dir
243
+ legacy = None if data_dir is None else data_dir / SEEN_FILE
244
+ self._seen_store = Seen(store, legacy)
193
245
 
194
246
  def bind_clock(self, clock: Clock) -> None:
195
247
  """The runtime's clock, which stamps the task map's entries."""
@@ -197,10 +249,12 @@ class A2AAdapter:
197
249
 
198
250
  def _task(self, task_id: str) -> TaskRef | None:
199
251
  """One of the local agent's tasks, in memory or, after a restart,
200
- in the daemon's database."""
252
+ in the daemon's database. None for an id with a NUL (``_task_key``)."""
253
+ if "\0" in task_id:
254
+ return None
201
255
  ref = self._tasks.get(task_id)
202
256
  if ref is None and self._store is not None:
203
- row = self._store.a2a_task(task_id)
257
+ row = self._store.a2a_task(self._task_key(task_id))
204
258
  ref = None if row is None else TaskRef(*row)
205
259
  return ref
206
260
 
@@ -212,14 +266,24 @@ class A2AAdapter:
212
266
  d.group_id, request, d.sender.identity, d.sender.instance_id
213
267
  )
214
268
 
269
+ def _task_key(self, task_id: str) -> str:
270
+ """The task map's key: the restricted agent's apart, so a task id it
271
+ picks can't replace or find the main agent's task of that id. The
272
+ prefix is in-band, so a task id with a NUL is never kept or found:
273
+ otherwise the main agent could name the restricted agent's key."""
274
+ return f"restricted\0{task_id}" if self.restricted else task_id
275
+
215
276
  def _keep_task(self, task_id: str, ref: TaskRef) -> None:
277
+ if "\0" in task_id:
278
+ LOG.warning("a2a_task_id_refused", group=log.hid(ref.group_id))
279
+ return
216
280
  self._tasks[task_id] = ref
217
281
  self._tasks.move_to_end(task_id)
218
282
  while len(self._tasks) > MAX_TASKS:
219
283
  self._tasks.popitem(last=False)
220
284
  if self._store is not None and self._clock is not None:
221
285
  self._store.a2a_task_put(
222
- task_id,
286
+ self._task_key(task_id),
223
287
  group_id=ref.group_id,
224
288
  requester=ref.requester,
225
289
  instance=ref.instance,
@@ -230,10 +294,10 @@ class A2AAdapter:
230
294
 
231
295
  @property
232
296
  def _seen(self) -> Seen:
233
- # Opened on first use: the daemon creates the data directory.
297
+ # In the daemon's encrypted database once it is bound (bind_store);
298
+ # in memory without it (unit use).
234
299
  if self._seen_store is None:
235
- data_dir = self.options.data_dir
236
- self._seen_store = Seen(None if data_dir is None else data_dir / SEEN_FILE)
300
+ self._seen_store = Seen(self._store)
237
301
  return self._seen_store
238
302
 
239
303
  # -- Adapter protocol ----------------------------------------------------
@@ -377,18 +441,24 @@ class A2AAdapter:
377
441
  entry = self._cards.get(group_id, {}).get(identity)
378
442
  return None if entry is None else entry[1]
379
443
 
380
- async def send_to_group(
444
+ async def send_to_group( # noqa: PLR0913 - keyword-only options
381
445
  self,
382
446
  group_id: str,
383
447
  body: dict[str, Any],
384
448
  to: list[str],
449
+ *,
385
450
  kind: str = "a2a.message",
386
451
  instance: str | None = None,
452
+ addressee: list[str] | None = None,
387
453
  ) -> str:
388
454
  if self._send is None:
389
455
  msg = "the adapter has not been started"
390
456
  raise RuntimeError(msg)
391
- return await self._send(group_id, body, to=to, kind=kind, instance=instance)
457
+ if addressee is None:
458
+ return await self._send(group_id, body, to=to, kind=kind, instance=instance)
459
+ return await self._send(
460
+ group_id, body, to=to, kind=kind, instance=instance, addressee=addressee
461
+ )
392
462
 
393
463
  # -- inbound -------------------------------------------------------------
394
464
 
@@ -430,7 +500,33 @@ class A2AAdapter:
430
500
  if len(json.dumps(entry)) > MAX_CONTEXT_ENTRY:
431
501
  entry = {k: v for k, v in entry.items() if k != "parts"} | {"omitted": "too_large"}
432
502
  limit = max(self.options.context_messages, 0)
433
- self._context.setdefault(d.group_id, deque(maxlen=limit)).append(entry)
503
+ context = self._context.setdefault(d.group_id, deque(maxlen=limit))
504
+ context.append((d.sender.instance_id, entry))
505
+
506
+ def withdraw(
507
+ self, group_id: str, identity: str, instances: Collection[str] | None = None
508
+ ) -> list[dict[str, Any]]:
509
+ """Forget ``identity``'s messages (only its ``instances``', when
510
+ given) kept as context for the next message to the local agent in
511
+ ``group_id`` (:class:`~agentconnect.adapter.Withdraws`)."""
512
+ context = self._context.get(group_id)
513
+ if context is None:
514
+ return []
515
+
516
+ def theirs(item: tuple[str, dict[str, Any]]) -> bool:
517
+ instance, entry = item
518
+ return bool(entry["sender"] == identity) and (
519
+ instances is None or instance in instances
520
+ )
521
+
522
+ gone = [item[1] for item in context if theirs(item)]
523
+ kept = [item for item in context if not theirs(item)]
524
+ context.clear()
525
+ context.extend(kept)
526
+ return [
527
+ {"msg_id": str(e["msg_id"]), "kind": "a2a.message", "size": len(json.dumps(e))}
528
+ for e in gone
529
+ ]
434
530
 
435
531
  def _local_message(self, d: Delivery) -> Message:
436
532
  peer = convert.parse_message(d.body)
@@ -454,6 +550,8 @@ class A2AAdapter:
454
550
  "instance_id": d.sender.instance_id,
455
551
  "display_name": d.sender.display_name,
456
552
  "verified": d.sender.verified,
553
+ "trust": d.sender.trust,
554
+ "anchor": d.sender.anchor,
457
555
  },
458
556
  "to": list(d.to),
459
557
  "addressed_to_me": d.addressed_to_me,
@@ -465,7 +563,7 @@ class A2AAdapter:
465
563
  }
466
564
  context = self._context.get(d.group_id)
467
565
  if context is not None and len(context) > 0:
468
- meta["context_messages"] = list(context)
566
+ meta["context_messages"] = [entry for _, entry in context]
469
567
  peer_meta = convert.to_json(peer).get("metadata")
470
568
  if peer_meta:
471
569
  meta["peer_metadata"] = peer_meta
@@ -477,25 +575,35 @@ class A2AAdapter:
477
575
  async def _ensure_client(self) -> bool:
478
576
  return self._client is not None or await self._load_card()
479
577
 
578
+ def bind_deliverable(self, check: Callable[[Delivery], bool]) -> None:
579
+ """Called by the runtime at start: whether a delivery may still go to
580
+ the local agent. The first call waits for the agent's card; a
581
+ delivery dropped meanwhile (its sender's connection ended) is
582
+ checked again before it is sent."""
583
+ self._deliverable = check
584
+
480
585
  async def _trigger(self, group: GroupView, d: Delivery) -> DeliveryResult:
481
586
  if not await self._ensure_client() or self._client is None or self._plain is None:
482
587
  return DeliveryResult.RETRY # the local agent is unreachable for now
588
+ if self._deliverable is not None and not self._deliverable(d):
589
+ return DeliveryResult.ACK # dropped meanwhile: the local agent never sees it
483
590
  request = SendMessageRequest(message=self._local_message(d))
484
591
  try:
485
592
  try:
486
- stream = aiter(self._client.send_message(request))
487
- first = await anext(stream, None)
488
- except UnsupportedOperationError:
489
- # The agent refused streaming: fall back to SendMessage.
490
- stream = aiter(self._plain.send_message(request))
491
- first = await anext(stream, None)
593
+ first, stream = await self._send_local(self._client, self._plain, request)
594
+ except A2AClientError as e:
595
+ if not _connection_dropped(e):
596
+ raise
597
+ # The connection failed under the request: the agent closed
598
+ # a pooled keep-alive connection as the request went out on
599
+ # it (uvicorn closes one idle for 5 s). Send it once more,
600
+ # on a new connection, as a RETRY would later.
601
+ first, stream = await self._send_local(self._client, self._plain, request)
492
602
  except A2AClientError as e:
493
603
  refused = _refusal(e)
494
604
  if refused is not None:
495
605
  LOG.warning("a2a_receiver_refused", reason=str(refused))
496
- LOG.warning(
497
- "a2a_local_unreachable", group=log.hid(group.group_id), error=type(e).__name__
498
- )
606
+ LOG.warning("a2a_local_unreachable", group=log.hid(group.group_id), **_failure(e))
499
607
  return DeliveryResult.RETRY
500
608
  except A2AError as e:
501
609
  # A protocol error is the agent's answer, not a transient failure:
@@ -508,6 +616,19 @@ class A2AAdapter:
508
616
  self._spawn(self._forward(d, first, stream))
509
617
  return DeliveryResult.ACK
510
618
 
619
+ @staticmethod
620
+ async def _send_local(
621
+ client: Client, plain: Client, request: SendMessageRequest
622
+ ) -> tuple[StreamResponse | None, AsyncIterator[StreamResponse]]:
623
+ """Send to the local agent; its first response and the rest."""
624
+ try:
625
+ stream = aiter(client.send_message(request))
626
+ return await anext(stream, None), stream
627
+ except UnsupportedOperationError:
628
+ # The agent refused streaming: fall back to SendMessage.
629
+ stream = aiter(plain.send_message(request))
630
+ return await anext(stream, None), stream
631
+
511
632
  def _spawn(self, work: Coroutine[Any, Any, None]) -> None:
512
633
  task = asyncio.get_running_loop().create_task(work)
513
634
  self._running.add(task)
@@ -33,6 +33,8 @@ from jwt import PyJWK
33
33
  from jwt.exceptions import PyJWKError, PyJWTError
34
34
  from jwt.utils import base64url_decode
35
35
 
36
+ from agentconnect.limits import MAX_PAYLOAD_DEPTH, loads
37
+
36
38
  # Asymmetric only: a symmetric (HS*) key in a JWKS would let anyone holding
37
39
  # it forge cards, and accepting HS* invites algorithm confusion.
38
40
  ALGORITHMS = ["ES256", "ES384", "ES512", "RS256", "RS384", "RS512", "PS256", "PS384", "EdDSA"]
@@ -61,7 +63,7 @@ def _kids(card: AgentCard) -> list[str | None]:
61
63
  kids: list[str | None] = []
62
64
  for sig in card.signatures:
63
65
  try:
64
- header = json.loads(base64url_decode(sig.protected.encode("ascii")))
66
+ header = loads(base64url_decode(sig.protected.encode("ascii")), MAX_PAYLOAD_DEPTH)
65
67
  except (ValueError, UnicodeError):
66
68
  kids.append(None)
67
69
  continue