agentconnect-cli 0.1.0a5__tar.gz → 0.1.0a6__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.
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/PKG-INFO +11 -11
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/README.md +9 -9
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/pyproject.toml +2 -2
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/pyproject.toml.orig +2 -2
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/__init__.py +1 -1
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/cli.py +7 -3
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/engine.py +142 -25
- agentconnect_cli-0.1.0a6/src/agentconnect/runtime/forkwatch.py +133 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/groups.py +8 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/store.py +6 -1
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/__init__.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/adapter.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/cards.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/convert.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/facade.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/seen.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/serve.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/adapter.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/adapters.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/api_tls.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/apiclient.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/backoff.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/callback.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/cli_json.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/cli_support.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/clock.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/config.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/daemon/__init__.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/deliveries.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/directory_client.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/entry.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/failpoints.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/identity.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/isolation.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/keystore.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/limits.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/log.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/mcp/__init__.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/mcp/backend.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/mcp/server.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/mcp/session.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/mcp/tools.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/ownerfile.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/payloads.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/policy.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/provision.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/py.typed +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/relay.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/__init__.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/agent.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/api.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/errors.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/evaluation.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/floor.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/freshness.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/introductions.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/knocks.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/ledger.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/listing.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/owner_domains.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/registry.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/runtime.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/sas.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/succession.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/tier.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/trust.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/sas_emoji.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/schemas.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/shapes.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/sockets.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/sse.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/tasks.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/tokens.py +0 -0
- {agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/webhook.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentconnect-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a6
|
|
4
4
|
Summary: AgentConnect daemon (agentconnectd) and CLI
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Requires-Dist: a2a-sdk[http-server,signing]>=1.3.1
|
|
7
|
-
Requires-Dist: agentconnect-core==0.1.
|
|
7
|
+
Requires-Dist: agentconnect-core==0.1.0a6
|
|
8
8
|
Requires-Dist: cryptography>=50.0.2
|
|
9
9
|
Requires-Dist: httpx>=0.29.0
|
|
10
10
|
Requires-Dist: keyring>=25.7.0
|
|
@@ -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.
|
|
25
|
-
[SPEC.md](https://github.com/mbocevski/agent-connect/blob/v0.1.
|
|
24
|
+
`agentconnect`. See the repository [README](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/README.md) and
|
|
25
|
+
[SPEC.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
35
|
+
Python SDK's embedded mode (`AgentConnect.embedded`, [docs/sdk.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
40
|
+
[docs/cli.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
49
|
+
([docs/isolation.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
67
|
+
[docs/config.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
74
|
+
[docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
102
|
+
The webhook adapter ([docs/adapters/webhook.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/docs/adapters/webhook.md)) and the SSE adapter (`GET /v0/events`, [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
105
|
+
adapter sees it ([docs/safety.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
6
|
-
[SPEC.md](https://github.com/mbocevski/agent-connect/blob/v0.1.
|
|
5
|
+
`agentconnect`. See the repository [README](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/README.md) and
|
|
6
|
+
[SPEC.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
16
|
+
Python SDK's embedded mode (`AgentConnect.embedded`, [docs/sdk.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
21
|
+
[docs/cli.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
30
|
+
([docs/isolation.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
48
|
+
[docs/config.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
55
|
+
[docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
83
|
+
The webhook adapter ([docs/adapters/webhook.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/docs/adapters/webhook.md)) and the SSE adapter (`GET /v0/events`, [docs/api.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/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.
|
|
86
|
+
adapter sees it ([docs/safety.md](https://github.com/mbocevski/agent-connect/blob/v0.1.0a6/docs/safety.md)).
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "agentconnect-cli"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.0a6"
|
|
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
9
|
"a2a-sdk[http-server,signing]>=1.3.1",
|
|
10
|
-
"agentconnect-core==0.1.
|
|
10
|
+
"agentconnect-core==0.1.0a6",
|
|
11
11
|
"cryptography>=50.0.2",
|
|
12
12
|
"httpx>=0.29.0",
|
|
13
13
|
"keyring>=25.7.0",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "agentconnect-cli"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.0a6"
|
|
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
9
|
"a2a-sdk[http-server,signing]>=1.3.1",
|
|
10
|
-
"agentconnect-core==0.1.
|
|
10
|
+
"agentconnect-core==0.1.0a6",
|
|
11
11
|
"cryptography>=50.0.2",
|
|
12
12
|
"httpx>=0.29.0",
|
|
13
13
|
"keyring>=25.7.0",
|
|
@@ -579,8 +579,8 @@ def _queued(status: str, event: str) -> str:
|
|
|
579
579
|
cls=IdArgsCommand,
|
|
580
580
|
help="Change a group's policy (a commit; give only what changes): who may invite and "
|
|
581
581
|
"remove, the size limit, the floor, the loop guard and freshness. Turning "
|
|
582
|
-
"--require-verified on "
|
|
583
|
-
f"
|
|
582
|
+
"--require-verified on with no other change (--freshness included) uses the agent "
|
|
583
|
+
f"token instead, since it only tightens the gate. {HUMAN_ONLY_HELP}",
|
|
584
584
|
)
|
|
585
585
|
def group_policy( # noqa: PLR0912, PLR0913, PLR0917
|
|
586
586
|
group: str,
|
|
@@ -656,7 +656,11 @@ def group_policy( # noqa: PLR0912, PLR0913, PLR0917
|
|
|
656
656
|
_say(f"Warning: {QUORUM_ONE_WARNING}", as_json=as_json)
|
|
657
657
|
if not _confirm("Set a quorum of 1?", yes=yes, as_json=as_json):
|
|
658
658
|
raise CliError("declined", "policy not changed", EXIT_REFUSED)
|
|
659
|
-
|
|
659
|
+
# Only turning require_verified on, alone, may use the agent token:
|
|
660
|
+
# freshness, which is added below once the anchor can be resolved,
|
|
661
|
+
# is the human's change like any other.
|
|
662
|
+
agent_only = fields == {"require_verified": True} and freshness is None
|
|
663
|
+
api = connect(config, human=not agent_only)
|
|
660
664
|
gid = resolve_group(api, group)
|
|
661
665
|
if freshness is not None:
|
|
662
666
|
fields["freshness"] = _freshness(freshness, api)
|
|
@@ -127,6 +127,7 @@ from agentconnect.relay import (
|
|
|
127
127
|
unb64,
|
|
128
128
|
)
|
|
129
129
|
from agentconnect.runtime import ledger as replay
|
|
130
|
+
from agentconnect.runtime.forkwatch import ForkWatch
|
|
130
131
|
from agentconnect.runtime.freshness import FreshnessService
|
|
131
132
|
from agentconnect.runtime.registry import AdapterRegistry
|
|
132
133
|
from agentconnect.runtime.sas import (
|
|
@@ -204,6 +205,12 @@ DAY_SECS = 86_400
|
|
|
204
205
|
MAX_FAILED_TRACKED = 10_000
|
|
205
206
|
TRANSFER_TIMEOUT_SECS = 10.0 # owner hand-over before a SAS-mismatch exit
|
|
206
207
|
REBUILD_WAIT_SECS = 60.0
|
|
208
|
+
#: How many refusals as out of date in a row, with no winning commit coming
|
|
209
|
+
#: (each after :data:`REBUILD_WAIT_SECS` connected and drained), mark a group
|
|
210
|
+
#: out of sync (SPEC 8.3). A conforming relay delivers the winner before it
|
|
211
|
+
#: refuses, so one miss can be a slow disk or a reconnect; three mean no
|
|
212
|
+
#: member will ever send it.
|
|
213
|
+
NO_WINNER_LIMIT = 3
|
|
207
214
|
MAX_COMMIT_ATTEMPTS = 8
|
|
208
215
|
# An own commit the relay accepted is merged only after every frame the relay
|
|
209
216
|
# delivered before that answer has been handled (ADR-004, "Changes after
|
|
@@ -807,11 +814,21 @@ def _envelope_problem(env: dict[str, Any]) -> str | None: # noqa: PLR0911, PLR0
|
|
|
807
814
|
return None
|
|
808
815
|
|
|
809
816
|
|
|
817
|
+
def no_winner_key(group_id: str) -> str:
|
|
818
|
+
"""Where a group's count of epoch refusals with no winning commit is kept
|
|
819
|
+
(``Store.GROUP_KEYS``)."""
|
|
820
|
+
return f"no-winner/{group_id}"
|
|
821
|
+
|
|
822
|
+
|
|
810
823
|
def _header_mismatch(env: dict[str, Any], group_id: bytes, head: dict[str, Any]) -> str | None:
|
|
811
824
|
"""How a group envelope disagrees with its MLS header (SPEC 7.1), or
|
|
812
825
|
None. ``head`` is ``agentconnect_core.peek_header`` of its ``ct``."""
|
|
813
826
|
if head["group_id"] != group_id:
|
|
814
827
|
return "group_mismatch"
|
|
828
|
+
if head["content_type"] != env["kind"]:
|
|
829
|
+
# The relay queues by kind (a handshake message may use its reserve,
|
|
830
|
+
# SPEC 8.3) and can't see the content, so they must agree.
|
|
831
|
+
return "kind_mismatch"
|
|
815
832
|
if head["epoch"] != env["epoch"]:
|
|
816
833
|
return "epoch_mismatch"
|
|
817
834
|
return None
|
|
@@ -1188,6 +1205,7 @@ class Engine:
|
|
|
1188
1205
|
self.sas = SasService(self)
|
|
1189
1206
|
# Beacons and whether each group is fresh (SPEC 9.5, ADR-009).
|
|
1190
1207
|
self.freshness = FreshnessService(self)
|
|
1208
|
+
self.forks = ForkWatch(self)
|
|
1191
1209
|
# The inviter's JoinRequest replay ledger (SPEC 6.2, "Replays").
|
|
1192
1210
|
self._join_capacity = ac.DEFAULT_LEDGER_CAPACITY
|
|
1193
1211
|
self._join_ledger = self._load_join_ledger()
|
|
@@ -1386,6 +1404,11 @@ class Engine:
|
|
|
1386
1404
|
|
|
1387
1405
|
await asyncio.wait_for(loop(), within)
|
|
1388
1406
|
|
|
1407
|
+
def drained(self) -> bool:
|
|
1408
|
+
"""Connected, with the reconnect's drain handled: what arrives now
|
|
1409
|
+
arrives when the relay sends it."""
|
|
1410
|
+
return self.link.connected and self._caught_up == self.link.connections
|
|
1411
|
+
|
|
1389
1412
|
def caught_up(self) -> bool:
|
|
1390
1413
|
"""Whether this runtime's view is as current as the relay can make
|
|
1391
1414
|
it: connected, the reconnect drain handled with no frame given up
|
|
@@ -2483,7 +2506,21 @@ class Engine:
|
|
|
2483
2506
|
self.groups.wake()
|
|
2484
2507
|
elif t == "queue_overflow":
|
|
2485
2508
|
group_id = str(frame.get("group_id", ""))
|
|
2486
|
-
|
|
2509
|
+
group = self.store.group(group_id)
|
|
2510
|
+
if group is not None and frame.get("lost") == "application":
|
|
2511
|
+
# SPEC 8.3: only application messages were dropped; every
|
|
2512
|
+
# commit is still queued, so this member stays in step. Told
|
|
2513
|
+
# once per group and epoch. Should the relay have lied, a
|
|
2514
|
+
# message from an epoch it never reached marks it out of sync
|
|
2515
|
+
# (epoch_ahead).
|
|
2516
|
+
await self.emit(
|
|
2517
|
+
group_id,
|
|
2518
|
+
"application_gap",
|
|
2519
|
+
cause=f"application_gap/{group_id}/{group.epoch}",
|
|
2520
|
+
msg_id=frame.get("msg_id"),
|
|
2521
|
+
epoch=frame.get("epoch"),
|
|
2522
|
+
)
|
|
2523
|
+
elif group is not None:
|
|
2487
2524
|
await self.mark_out_of_sync(
|
|
2488
2525
|
group_id, "queue_overflow", msg_id=frame.get("msg_id"), epoch=frame.get("epoch")
|
|
2489
2526
|
)
|
|
@@ -3111,28 +3148,24 @@ class Engine:
|
|
|
3111
3148
|
except Exception as e:
|
|
3112
3149
|
LOG.warning("loop_guard_failed", group=log.hid(group.group_id), error=type(e).__name__)
|
|
3113
3150
|
|
|
3114
|
-
async def
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
return
|
|
3122
|
-
try:
|
|
3123
|
-
# SPEC 7.1: compare the envelope with the unprotected MLS header
|
|
3124
|
-
# first. Peeking uses no key, so a dropped message consumes none.
|
|
3125
|
-
head = ac.peek_header(ct)
|
|
3126
|
-
except (ac.AgentConnectError, ac.CoreError) as e:
|
|
3127
|
-
await self._rejected(group_id, env, e)
|
|
3128
|
-
return
|
|
3151
|
+
async def _dropped_before_core(
|
|
3152
|
+
self, group: GroupRow, env: dict[str, Any], gid: bytes, head: dict[str, Any]
|
|
3153
|
+
) -> bool:
|
|
3154
|
+
"""SPEC 7.1: the checks of a group message against its unprotected
|
|
3155
|
+
MLS header, before any MLS processing. Whether it was dropped (acked,
|
|
3156
|
+
reported, with no inbox row)."""
|
|
3157
|
+
group_id, msg_id = group.group_id, str(env["msg_id"])
|
|
3129
3158
|
mismatch = _header_mismatch(env, gid, head)
|
|
3130
|
-
if mismatch is not None and
|
|
3159
|
+
if mismatch is not None and (
|
|
3160
|
+
mismatch == "kind_mismatch" or head["content_type"] != "commit"
|
|
3161
|
+
):
|
|
3131
3162
|
# An application message or a proposal is dropped unprocessed,
|
|
3132
3163
|
# with no inbox row: its sender is unchecked, and the key may be
|
|
3133
|
-
# another message's (SPEC 7.1).
|
|
3134
|
-
#
|
|
3135
|
-
#
|
|
3164
|
+
# another message's (SPEC 7.1). So is a commit whose envelope
|
|
3165
|
+
# names another kind: every member drops it, so nobody merges
|
|
3166
|
+
# it. Otherwise a commit is still processed (dropping an
|
|
3167
|
+
# authenticated commit would fork us); its epoch mismatch is
|
|
3168
|
+
# flagged in _after_commit.
|
|
3136
3169
|
await self._ack(msg_id)
|
|
3137
3170
|
await self.emit(
|
|
3138
3171
|
group_id,
|
|
@@ -3140,7 +3173,9 @@ class Engine:
|
|
|
3140
3173
|
cause=f"header_mismatch/{group_id}/{mismatch}/{group.epoch}",
|
|
3141
3174
|
reason=mismatch,
|
|
3142
3175
|
)
|
|
3143
|
-
|
|
3176
|
+
if mismatch == "kind_mismatch":
|
|
3177
|
+
await self._labelled_commit_moved_the_relay(env, gid)
|
|
3178
|
+
return True
|
|
3144
3179
|
if mismatch == "group_mismatch":
|
|
3145
3180
|
# A commit of another group: flagged here, rejected by the core.
|
|
3146
3181
|
await self.emit(
|
|
@@ -3149,6 +3184,17 @@ class Engine:
|
|
|
3149
3184
|
cause=f"header_mismatch/{group_id}/{mismatch}/{group.epoch}",
|
|
3150
3185
|
reason=mismatch,
|
|
3151
3186
|
)
|
|
3187
|
+
if head["content_type"] != "commit" and int(head["epoch"]) > group.epoch:
|
|
3188
|
+
# SPEC 7.1: sealed in an epoch after ours, so this member missed
|
|
3189
|
+
# the commit that started it (the relay delivers in order),
|
|
3190
|
+
# whatever a queue_overflow marker said (SPEC 8.3). Not
|
|
3191
|
+
# processed; no inbox row. A commit from ahead is refused by the
|
|
3192
|
+
# core, which marks it (commit_rejected).
|
|
3193
|
+
await self._ack(msg_id)
|
|
3194
|
+
await self.mark_out_of_sync(
|
|
3195
|
+
group_id, "epoch_ahead", cause=f"out_of_sync/{group_id}/epoch_ahead/{group.epoch}"
|
|
3196
|
+
)
|
|
3197
|
+
return True
|
|
3152
3198
|
if env["kind"] == "proposal" and int(env["epoch"]) != self._core_epoch(gid):
|
|
3153
3199
|
# SPEC 7.1: a proposal is only valid in the current epoch, so an
|
|
3154
3200
|
# envelope epoch that differs is dropped, unprocessed and with no
|
|
@@ -3161,6 +3207,37 @@ class Engine:
|
|
|
3161
3207
|
cause=f"proposal_epoch/{group_id}/{group.epoch}",
|
|
3162
3208
|
reason="epoch_mismatch",
|
|
3163
3209
|
)
|
|
3210
|
+
return True
|
|
3211
|
+
return False
|
|
3212
|
+
|
|
3213
|
+
async def _labelled_commit_moved_the_relay(self, env: dict[str, Any], gid: bytes) -> None:
|
|
3214
|
+
"""A dropped ``commit`` envelope at our epoch whose content is no
|
|
3215
|
+
commit: the relay accepted it as one and moved on, and no member can
|
|
3216
|
+
merge it, so nobody can follow (SPEC 7.1). One for an earlier epoch
|
|
3217
|
+
is only the alert: a copy of old traffic pushes nobody out."""
|
|
3218
|
+
if env["kind"] != "commit" or int(env["epoch"]) != self._core_epoch(gid):
|
|
3219
|
+
return
|
|
3220
|
+
group_id = str(env["group_id"])
|
|
3221
|
+
await self.mark_out_of_sync(
|
|
3222
|
+
group_id, "kind_mismatch", cause=f"out_of_sync/{group_id}/kind_mismatch/{env['epoch']}"
|
|
3223
|
+
)
|
|
3224
|
+
|
|
3225
|
+
async def _on_group_message(self, group: GroupRow, env: dict[str, Any]) -> None:
|
|
3226
|
+
group_id, sender, msg_id = group.group_id, str(env["sender"]), str(env["msg_id"])
|
|
3227
|
+
gid = unb64(group_id)
|
|
3228
|
+
try:
|
|
3229
|
+
ct = unb64(str(env["ct"]))
|
|
3230
|
+
except ValueError:
|
|
3231
|
+
await self._malformed(env, "ct")
|
|
3232
|
+
return
|
|
3233
|
+
try:
|
|
3234
|
+
# SPEC 7.1: compare the envelope with the unprotected MLS header
|
|
3235
|
+
# first. Peeking uses no key, so a dropped message consumes none.
|
|
3236
|
+
head = ac.peek_header(ct)
|
|
3237
|
+
except (ac.AgentConnectError, ac.CoreError) as e:
|
|
3238
|
+
await self._rejected(group_id, env, e)
|
|
3239
|
+
return
|
|
3240
|
+
if await self._dropped_before_core(group, env, gid, head):
|
|
3164
3241
|
return
|
|
3165
3242
|
self.failpoints.hit("receive.before_core")
|
|
3166
3243
|
try:
|
|
@@ -3275,6 +3352,18 @@ class Engine:
|
|
|
3275
3352
|
self.sas.on_message(group, event, ceremony)
|
|
3276
3353
|
return True
|
|
3277
3354
|
|
|
3355
|
+
async def _count_message(self, group: GroupRow, event: dict[str, Any]) -> None:
|
|
3356
|
+
"""An authenticated application message, whatever the policy decides
|
|
3357
|
+
for it later: it counts toward the key update cadence and shows
|
|
3358
|
+
which epoch its sender is in (:mod:`agentconnect.runtime.forkwatch`)."""
|
|
3359
|
+
self.store.bump_messages(group.group_id)
|
|
3360
|
+
await self.forks.heard(
|
|
3361
|
+
group,
|
|
3362
|
+
str(event["sender"]["mailbox_id"]),
|
|
3363
|
+
int(event["epoch"]),
|
|
3364
|
+
replayed=bool(event.get("replayed")),
|
|
3365
|
+
)
|
|
3366
|
+
|
|
3278
3367
|
async def _effects( # noqa: PLR0912
|
|
3279
3368
|
self, group: GroupRow, env: dict[str, Any], event: dict[str, Any], *, from_relay: bool
|
|
3280
3369
|
) -> str:
|
|
@@ -3289,7 +3378,7 @@ class Engine:
|
|
|
3289
3378
|
self.store.record_inbox(sender, msg_id, group_id, "dropped", now)
|
|
3290
3379
|
await self.emit(group_id, "relay_misbehaviour", reason="epoch_mismatch")
|
|
3291
3380
|
return "dropped"
|
|
3292
|
-
self.
|
|
3381
|
+
await self._count_message(group, event)
|
|
3293
3382
|
if self._daemon_only(group, event):
|
|
3294
3383
|
self.store.record_inbox(sender, msg_id, group_id, "done", now)
|
|
3295
3384
|
return "done"
|
|
@@ -5744,7 +5833,7 @@ class Engine:
|
|
|
5744
5833
|
self._refused_for_now(row.seq, group.group_id, e.code)
|
|
5745
5834
|
break
|
|
5746
5835
|
if not merged:
|
|
5747
|
-
ended = await self._discard_refused(row, group, payload, e
|
|
5836
|
+
ended = await self._discard_refused(row, group, payload, e)
|
|
5748
5837
|
if ended is None:
|
|
5749
5838
|
continue # built again
|
|
5750
5839
|
return ended
|
|
@@ -5772,12 +5861,12 @@ class Engine:
|
|
|
5772
5861
|
return "failed"
|
|
5773
5862
|
|
|
5774
5863
|
async def _discard_refused(
|
|
5775
|
-
self, row: OutboxRow, group: GroupRow, payload: dict[str, Any],
|
|
5864
|
+
self, row: OutboxRow, group: GroupRow, payload: dict[str, Any], refusal: RelayError
|
|
5776
5865
|
) -> str | None:
|
|
5777
5866
|
"""The relay refused the row's commit for good: discard it (SPEC 8.3).
|
|
5778
5867
|
``None`` after an epoch conflict, once the commit may be built again;
|
|
5779
5868
|
else the row's result."""
|
|
5780
|
-
intent, env = payload["intent"], payload["env"]
|
|
5869
|
+
intent, env, code = payload["intent"], payload["env"], refusal.code
|
|
5781
5870
|
with contextlib.suppress(ac.AgentConnectError):
|
|
5782
5871
|
self.client.discard_pending_commit(unb64(group.group_id))
|
|
5783
5872
|
built_epoch = int(env["epoch"])
|
|
@@ -5794,6 +5883,8 @@ class Engine:
|
|
|
5794
5883
|
# In the row: every lane waits, usually only until the winning commit
|
|
5795
5884
|
# (already on its way) is processed.
|
|
5796
5885
|
await self._await_epoch(group.group_id, built_epoch)
|
|
5886
|
+
if (refusal.current_epoch or 0) > built_epoch:
|
|
5887
|
+
await self._count_missing_winner(group.group_id, built_epoch)
|
|
5797
5888
|
current = self.store.outbox_row(row.seq)
|
|
5798
5889
|
if current is None or current.state != "queued":
|
|
5799
5890
|
# Failed from outside meanwhile (a removal the human abandoned,
|
|
@@ -5802,6 +5893,32 @@ class Engine:
|
|
|
5802
5893
|
return "failed" if current is None else current.state
|
|
5803
5894
|
return None
|
|
5804
5895
|
|
|
5896
|
+
async def _count_missing_winner(self, group_id: str, built_epoch: int) -> None:
|
|
5897
|
+
"""After the wait for the commit that won ``built_epoch``: if none
|
|
5898
|
+
came although this member is connected and drained, count it, across
|
|
5899
|
+
commits and restarts, until the group's epoch moves. At
|
|
5900
|
+
:data:`NO_WINNER_LIMIT` the group is out of sync (SPEC 8.3): the
|
|
5901
|
+
relay's epoch has passed every commit this member can get."""
|
|
5902
|
+
group = self.store.group(group_id)
|
|
5903
|
+
if (
|
|
5904
|
+
group is None
|
|
5905
|
+
or group.status != "active"
|
|
5906
|
+
or group.out_of_sync
|
|
5907
|
+
or group.epoch > built_epoch
|
|
5908
|
+
or not self.drained()
|
|
5909
|
+
):
|
|
5910
|
+
return
|
|
5911
|
+
missed = int(self.store.kv_get(no_winner_key(group_id)) or "0") + 1
|
|
5912
|
+
LOG.warning("no_winning_commit", group=log.hid(group_id), count=missed)
|
|
5913
|
+
with self.store.tx():
|
|
5914
|
+
self.store.kv_set(no_winner_key(group_id), str(missed))
|
|
5915
|
+
if missed >= NO_WINNER_LIMIT:
|
|
5916
|
+
await self.mark_out_of_sync(
|
|
5917
|
+
group_id,
|
|
5918
|
+
"no_winning_commit",
|
|
5919
|
+
cause=f"out_of_sync/{group_id}/no_winning_commit/{built_epoch}",
|
|
5920
|
+
)
|
|
5921
|
+
|
|
5805
5922
|
def _own_commit_landed(self, env: dict[str, Any]) -> bool:
|
|
5806
5923
|
"""Whether the core merged this own commit: its confirmation was
|
|
5807
5924
|
recorded, the epoch it is in was started by these exact bytes, or
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"""Noticing a commit the group never followed (SPEC 8.3).
|
|
2
|
+
|
|
3
|
+
A relay can make a commit look accepted to its sender alone (a forged
|
|
4
|
+
``accepted``, the fan-out withheld): the sender moves to the next epoch by
|
|
5
|
+
itself and the others go on in the old one. After an own commit merges into
|
|
6
|
+
epoch ``E+1``, this watches the instances that were members in ``E`` and
|
|
7
|
+
still are (the *survivors*; one the commit added is none, since with a forged
|
|
8
|
+
``accepted`` on an Add the joiner is welcomed into ``E+1``):
|
|
9
|
+
|
|
10
|
+
- anything a survivor sealed in ``E+1`` or later (a message, a proposal)
|
|
11
|
+
shows that one followed: it is watched no more, and the others still are,
|
|
12
|
+
since a relay can pass the commit to some and not to the rest;
|
|
13
|
+
- two messages one survivor sealed in ``E``, handled at least
|
|
14
|
+
:data:`GRACE_SECS` after the merge and then at least that long after the
|
|
15
|
+
first, raise ``relay_misbehaviour`` (``commit_not_fanned_out``) naming its
|
|
16
|
+
member, once per group and epoch: the humans compare short codes (SAS). A
|
|
17
|
+
relay that only delayed traffic looks the same, so the codes decide.
|
|
18
|
+
|
|
19
|
+
Both times are this instance's own clock when it handles the message. One
|
|
20
|
+
late message isn't enough: a member that did follow can still deliver a
|
|
21
|
+
message it sealed before, sent again byte for byte. Nothing handled in the
|
|
22
|
+
drain of a reconnect, or replayed from the journal, counts: after a restart
|
|
23
|
+
everything that waited would look late at once.
|
|
24
|
+
|
|
25
|
+
It needs the others to say something. A further commit of the group ends the
|
|
26
|
+
watch: the core keeps one past epoch's secrets, so what the others still seal
|
|
27
|
+
in ``E`` can't be read, or told from what the relay made up, any more. Interval
|
|
28
|
+
freshness (SPEC 9.5) still catches a member that moved on alone twice.
|
|
29
|
+
|
|
30
|
+
The state is one ``kv`` entry per group, written in the transaction of the
|
|
31
|
+
message or commit that changes it.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
from __future__ import annotations
|
|
35
|
+
|
|
36
|
+
import json
|
|
37
|
+
from typing import TYPE_CHECKING, Any
|
|
38
|
+
|
|
39
|
+
if TYPE_CHECKING:
|
|
40
|
+
from agentconnect.runtime.engine import Engine
|
|
41
|
+
from agentconnect.store import GroupRow
|
|
42
|
+
|
|
43
|
+
#: How long after the own commit, and then between the two late messages.
|
|
44
|
+
GRACE_SECS = 60
|
|
45
|
+
REASON = "commit_not_fanned_out"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def key(group_id: str) -> str:
|
|
49
|
+
"""Where a group's watch is kept (``Store.GROUP_KEYS``)."""
|
|
50
|
+
return f"fork-watch/{group_id}"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class ForkWatch:
|
|
54
|
+
def __init__(self, engine: Engine) -> None:
|
|
55
|
+
self._engine = engine
|
|
56
|
+
|
|
57
|
+
def others(self, group_id: str) -> set[str]:
|
|
58
|
+
"""The mailboxes of the group's other instances, as recorded now."""
|
|
59
|
+
e = self._engine
|
|
60
|
+
mailboxes = {
|
|
61
|
+
str(i.get("mailbox_id", "")) for m in e.store.members(group_id) for i in m.instances
|
|
62
|
+
}
|
|
63
|
+
return mailboxes - {e.mailbox, ""}
|
|
64
|
+
|
|
65
|
+
def after_commit(self, group_id: str, epoch: int, own: bool, before: set[str]) -> None:
|
|
66
|
+
"""A commit moved the group to ``epoch``; ``before`` is
|
|
67
|
+
:meth:`others` as it was. An own commit starts a watch over the
|
|
68
|
+
survivors; any commit, merged on top, ends the one before it."""
|
|
69
|
+
survivors = sorted(before & self.others(group_id)) if own else []
|
|
70
|
+
if not survivors:
|
|
71
|
+
self._engine.store.kv_delete(key(group_id))
|
|
72
|
+
return
|
|
73
|
+
self._save(
|
|
74
|
+
group_id,
|
|
75
|
+
{
|
|
76
|
+
"epoch": epoch,
|
|
77
|
+
# Mailbox -> when its first late message was handled.
|
|
78
|
+
"survivors": dict.fromkeys(survivors),
|
|
79
|
+
"since": self._engine.now(),
|
|
80
|
+
"alerted": False,
|
|
81
|
+
},
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
async def heard(
|
|
85
|
+
self, group: GroupRow, mailbox: str, epoch: int, *, replayed: bool = False
|
|
86
|
+
) -> None:
|
|
87
|
+
"""An authenticated message or proposal from the instance at
|
|
88
|
+
``mailbox``, sealed in ``epoch`` (inside its journal entry's
|
|
89
|
+
transaction)."""
|
|
90
|
+
e = self._engine
|
|
91
|
+
raw = e.store.kv_get(key(group.group_id))
|
|
92
|
+
if raw is None:
|
|
93
|
+
return
|
|
94
|
+
state = json.loads(raw)
|
|
95
|
+
survivors = state["survivors"]
|
|
96
|
+
if mailbox not in survivors:
|
|
97
|
+
return
|
|
98
|
+
if epoch >= state["epoch"]:
|
|
99
|
+
del survivors[mailbox] # it followed
|
|
100
|
+
if survivors:
|
|
101
|
+
self._save(group.group_id, state)
|
|
102
|
+
else:
|
|
103
|
+
e.store.kv_delete(key(group.group_id))
|
|
104
|
+
return
|
|
105
|
+
now = e.now()
|
|
106
|
+
late = not (state["alerted"] or replayed or not e.drained())
|
|
107
|
+
if not late or now < state["since"] + GRACE_SECS:
|
|
108
|
+
return
|
|
109
|
+
first = survivors[mailbox]
|
|
110
|
+
if first is None:
|
|
111
|
+
survivors[mailbox] = now
|
|
112
|
+
self._save(group.group_id, state)
|
|
113
|
+
elif now >= first + GRACE_SECS:
|
|
114
|
+
self._save(group.group_id, {**state, "alerted": True})
|
|
115
|
+
await e.emit(
|
|
116
|
+
group.group_id,
|
|
117
|
+
"relay_misbehaviour",
|
|
118
|
+
cause=f"{REASON}/{group.group_id}/{state['epoch']}",
|
|
119
|
+
reason=REASON,
|
|
120
|
+
epoch=state["epoch"],
|
|
121
|
+
identity=self._identity(group.group_id, mailbox),
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
def _identity(self, group_id: str, mailbox: str) -> str:
|
|
125
|
+
"""The member the instance at ``mailbox`` belongs to: the one to
|
|
126
|
+
compare short codes with."""
|
|
127
|
+
for member in self._engine.store.members(group_id):
|
|
128
|
+
if any(i.get("mailbox_id") == mailbox for i in member.instances):
|
|
129
|
+
return member.identity
|
|
130
|
+
return ""
|
|
131
|
+
|
|
132
|
+
def _save(self, group_id: str, state: dict[str, Any]) -> None:
|
|
133
|
+
self._engine.store.kv_set(key(group_id), json.dumps(state, sort_keys=True))
|
|
@@ -77,6 +77,7 @@ from agentconnect.runtime.engine import (
|
|
|
77
77
|
ac_identity_key,
|
|
78
78
|
canonical,
|
|
79
79
|
new_msg_id,
|
|
80
|
+
no_winner_key,
|
|
80
81
|
)
|
|
81
82
|
from agentconnect.store import GroupRow, MemberRow, OutboxRow
|
|
82
83
|
from agentconnect.tasks import cancel_and_wait
|
|
@@ -413,6 +414,7 @@ class GroupService:
|
|
|
413
414
|
e.store.update_group(group_id, policy=policy, epoch=epoch)
|
|
414
415
|
if before is not None and before.epoch != epoch:
|
|
415
416
|
e.freshness.entered_epoch(group_id, epoch)
|
|
417
|
+
e.store.kv_delete(no_winner_key(group_id)) # a winner came
|
|
416
418
|
self.member_gone(group_id, gone)
|
|
417
419
|
|
|
418
420
|
def member_gone(self, group_id: str, identities: set[str]) -> None:
|
|
@@ -771,7 +773,9 @@ class GroupService:
|
|
|
771
773
|
e = self._engine
|
|
772
774
|
gid = unb64(group_id)
|
|
773
775
|
ending = self._ending(group_id)
|
|
776
|
+
before = e.forks.others(group_id)
|
|
774
777
|
self.refresh(group_id)
|
|
778
|
+
e.forks.after_commit(group_id, int(summary["epoch"]), own, before)
|
|
775
779
|
if env is not None:
|
|
776
780
|
# Shapes were checked before processing (_envelope_problem).
|
|
777
781
|
hinted = env.get("routing") or {}
|
|
@@ -1121,6 +1125,10 @@ class GroupService:
|
|
|
1121
1125
|
"""Another member proposed its own removal (inside the journal
|
|
1122
1126
|
entry's transaction)."""
|
|
1123
1127
|
e = self._engine
|
|
1128
|
+
group = e.store.group(group_id)
|
|
1129
|
+
if group is not None:
|
|
1130
|
+
# A proposal is only processed in the current epoch (SPEC 7.1).
|
|
1131
|
+
await e.forks.heard(group, str(member["mailbox_id"]), group.epoch)
|
|
1124
1132
|
await e.emit(
|
|
1125
1133
|
group_id,
|
|
1126
1134
|
"member_leaving",
|
|
@@ -1616,6 +1616,8 @@ class Store:
|
|
|
1616
1616
|
"leaving_since",
|
|
1617
1617
|
"leave_blocked",
|
|
1618
1618
|
"leave_seen",
|
|
1619
|
+
"fork-watch",
|
|
1620
|
+
"no-winner",
|
|
1619
1621
|
"own-commit-confirmed",
|
|
1620
1622
|
)
|
|
1621
1623
|
#: Kept while the group's row stays, for a rejoin's check (SPEC 9.1).
|
|
@@ -1631,7 +1633,8 @@ class Store:
|
|
|
1631
1633
|
|
|
1632
1634
|
def delete_group_data(self, group_id: str) -> None:
|
|
1633
1635
|
"""Forget a group's members, cards, safety settings, held messages,
|
|
1634
|
-
join approvals and per-group keys
|
|
1636
|
+
succession votes, join approvals and per-group keys
|
|
1637
|
+
(:data:`GROUP_KEYS`); its held
|
|
1635
1638
|
inbox rows are dropped. Audit rows, transcript entries and the ended
|
|
1636
1639
|
connections rules made stay until their retention ends (the human's
|
|
1637
1640
|
``approvals list``), and so do the approvals those connections name;
|
|
@@ -1657,6 +1660,8 @@ class Store:
|
|
|
1657
1660
|
"sas_answered",
|
|
1658
1661
|
"sas_sent",
|
|
1659
1662
|
"sas_warnings",
|
|
1663
|
+
# Signed votes naming the voter and both owners.
|
|
1664
|
+
"succession_votes",
|
|
1660
1665
|
):
|
|
1661
1666
|
db.execute(f"DELETE FROM {table} WHERE group_id = ?", (group_id,)) # noqa: S608
|
|
1662
1667
|
db.execute(
|
{agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/__init__.py
RENAMED
|
File without changes
|
{agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/adapter.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/convert.py
RENAMED
|
File without changes
|
{agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/a2a_adapter/facade.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/evaluation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/introductions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/owner_domains.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentconnect_cli-0.1.0a5 → agentconnect_cli-0.1.0a6}/src/agentconnect/runtime/succession.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|