agent-embassy 3.0.0 → 4.0.0
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.
- package/CHANGELOG.md +42 -0
- package/CONTRIBUTING.md +92 -200
- package/README.md +159 -138
- package/SECURITY.md +191 -335
- package/dist/src/gateway/broker-check.d.ts +26 -0
- package/dist/src/gateway/broker-check.js +89 -0
- package/dist/src/gateway/broker-check.js.map +1 -0
- package/dist/src/gateway/broker-control.d.ts +72 -0
- package/dist/src/gateway/broker-control.js +164 -0
- package/dist/src/gateway/broker-control.js.map +1 -0
- package/dist/src/gateway/broker.d.ts +117 -0
- package/dist/src/gateway/broker.js +186 -0
- package/dist/src/gateway/broker.js.map +1 -0
- package/dist/src/gateway/claude-peer.d.ts +1 -124
- package/dist/src/gateway/claude-peer.js +62 -1053
- package/dist/src/gateway/claude-peer.js.map +1 -1
- package/dist/src/gateway/codex-stateless-transport.d.ts +0 -12
- package/dist/src/gateway/codex-stateless-transport.js +8 -142
- package/dist/src/gateway/codex-stateless-transport.js.map +1 -1
- package/dist/src/gateway/config.d.ts +2 -6
- package/dist/src/gateway/config.js +17 -27
- package/dist/src/gateway/config.js.map +1 -1
- package/dist/src/gateway/coordinator.d.ts +57 -0
- package/dist/src/gateway/coordinator.js +217 -0
- package/dist/src/gateway/coordinator.js.map +1 -0
- package/dist/src/gateway/core-cli.d.ts +15 -0
- package/dist/src/gateway/core-cli.js +282 -0
- package/dist/src/gateway/core-cli.js.map +1 -0
- package/dist/src/gateway/core-service-command.d.ts +16 -0
- package/dist/src/gateway/core-service-command.js +71 -0
- package/dist/src/gateway/core-service-command.js.map +1 -0
- package/dist/src/gateway/endpoint-directory.d.ts +33 -0
- package/dist/src/gateway/endpoint-directory.js +223 -0
- package/dist/src/gateway/endpoint-directory.js.map +1 -0
- package/dist/src/gateway/federation.d.ts +89 -0
- package/dist/src/gateway/federation.js +632 -0
- package/dist/src/gateway/federation.js.map +1 -0
- package/dist/src/gateway/ledger-codec.d.ts +3 -0
- package/dist/src/gateway/ledger-codec.js +159 -0
- package/dist/src/gateway/ledger-codec.js.map +1 -0
- package/dist/src/gateway/ledger.d.ts +138 -0
- package/dist/src/gateway/ledger.js +319 -0
- package/dist/src/gateway/ledger.js.map +1 -0
- package/dist/src/gateway/local-control.d.ts +23 -0
- package/dist/src/gateway/local-control.js +489 -0
- package/dist/src/gateway/local-control.js.map +1 -0
- package/dist/src/gateway/native-destinations.d.ts +34 -0
- package/dist/src/gateway/native-destinations.js +272 -0
- package/dist/src/gateway/native-destinations.js.map +1 -0
- package/dist/src/gateway/owned-state.d.ts +57 -0
- package/dist/src/gateway/owned-state.js +398 -0
- package/dist/src/gateway/owned-state.js.map +1 -0
- package/dist/src/gateway/provenance-envelope.d.ts +3 -3
- package/dist/src/gateway/provenance-envelope.js +3 -23
- package/dist/src/gateway/provenance-envelope.js.map +1 -1
- package/dist/src/gateway/runtime.d.ts +41 -0
- package/dist/src/gateway/runtime.js +175 -0
- package/dist/src/gateway/runtime.js.map +1 -0
- package/docs/CONFIGURATION.md +178 -266
- package/docs/DELIVERY.md +133 -82
- package/docs/GATEWAY-ARCHITECTURE.md +276 -943
- package/package.json +5 -5
- package/skills/embassy-peer/SKILL.md +38 -194
- package/skills/embassy-peer/agents/openai.yaml +2 -2
- package/dist/src/gateway/claude-helper-client.d.ts +0 -2
- package/dist/src/gateway/claude-helper-client.js +0 -2
- package/dist/src/gateway/claude-helper-client.js.map +0 -1
- package/dist/src/gateway/claude-helper-protocol.d.ts +0 -117
- package/dist/src/gateway/claude-helper-protocol.js +0 -122
- package/dist/src/gateway/claude-helper-protocol.js.map +0 -1
- package/dist/src/gateway/claude-helper-supervisor.d.ts +0 -87
- package/dist/src/gateway/claude-helper-supervisor.js +0 -347
- package/dist/src/gateway/claude-helper-supervisor.js.map +0 -1
- package/dist/src/gateway/claude-helper.d.ts +0 -1
- package/dist/src/gateway/claude-helper.js +0 -252
- package/dist/src/gateway/claude-helper.js.map +0 -1
- package/dist/src/gateway/cli.d.ts +0 -57
- package/dist/src/gateway/cli.js +0 -1503
- package/dist/src/gateway/cli.js.map +0 -1
- package/dist/src/gateway/codex-socket-holder.d.ts +0 -26
- package/dist/src/gateway/codex-socket-holder.js +0 -76
- package/dist/src/gateway/codex-socket-holder.js.map +0 -1
- package/dist/src/gateway/control.d.ts +0 -261
- package/dist/src/gateway/control.js +0 -903
- package/dist/src/gateway/control.js.map +0 -1
- package/dist/src/gateway/peer-client.d.ts +0 -58
- package/dist/src/gateway/peer-client.js +0 -217
- package/dist/src/gateway/peer-client.js.map +0 -1
- package/dist/src/gateway/peer-mailbox.d.ts +0 -78
- package/dist/src/gateway/peer-mailbox.js +0 -168
- package/dist/src/gateway/peer-mailbox.js.map +0 -1
- package/dist/src/gateway/peer-protocol.d.ts +0 -105
- package/dist/src/gateway/peer-protocol.js +0 -70
- package/dist/src/gateway/peer-protocol.js.map +0 -1
- package/dist/src/gateway/peer-stdio.d.ts +0 -23
- package/dist/src/gateway/peer-stdio.js +0 -100
- package/dist/src/gateway/peer-stdio.js.map +0 -1
- package/dist/src/gateway/providers.d.ts +0 -163
- package/dist/src/gateway/providers.js +0 -972
- package/dist/src/gateway/providers.js.map +0 -1
- package/dist/src/gateway/server.d.ts +0 -47
- package/dist/src/gateway/server.js +0 -219
- package/dist/src/gateway/server.js.map +0 -1
- package/dist/src/gateway/service.d.ts +0 -373
- package/dist/src/gateway/service.js +0 -2274
- package/dist/src/gateway/service.js.map +0 -1
- package/dist/src/gateway/status-view.d.ts +0 -167
- package/dist/src/gateway/status-view.js +0 -488
- package/dist/src/gateway/status-view.js.map +0 -1
- package/dist/src/gateway/store.d.ts +0 -185
- package/dist/src/gateway/store.js +0 -2359
- package/dist/src/gateway/store.js.map +0 -1
- package/dist/src/gateway/types.d.ts +0 -528
- package/dist/src/gateway/types.js +0 -341
- package/dist/src/gateway/types.js.map +0 -1
package/docs/DELIVERY.md
CHANGED
|
@@ -1,86 +1,137 @@
|
|
|
1
1
|
# Delivery semantics
|
|
2
2
|
|
|
3
|
-
Embassy
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
3
|
+
Embassy gives a sender a durable broker receipt. It does not claim that a model
|
|
4
|
+
understood or acted on the message.
|
|
5
|
+
|
|
6
|
+
## Identity and admission
|
|
7
|
+
|
|
8
|
+
An endpoint is identified by the tuple `(opaque endpoint ID, host, provider)`.
|
|
9
|
+
Its `name@host` alias is a lookup index and display label. A send by name
|
|
10
|
+
resolves once, before admission. Every later transition and reply uses the
|
|
11
|
+
endpoint tuple; a rename or replacement cannot retarget old work.
|
|
12
|
+
|
|
13
|
+
Codex callers must already be registered. A Claude caller is derived from its
|
|
14
|
+
inherited native socket and recorded under the exact discovered session UUID.
|
|
15
|
+
The caller never supplies `--from`. A remote source is supplied by the trusted
|
|
16
|
+
SSH peer. Its claimed host must be in `nodes.json`, and the message's source
|
|
17
|
+
host must match that claim. The destination does not wait for a catalog poll
|
|
18
|
+
before accepting first contact.
|
|
19
|
+
|
|
20
|
+
Admission validates the body, deadline, route capacity, byte capacity, rate
|
|
21
|
+
limit, and exact local endpoint identities in one state transaction. It returns
|
|
22
|
+
a private delivery token and a conversation reference. A repeated federated
|
|
23
|
+
message ID is idempotent only when every identity and message field matches;
|
|
24
|
+
two deliberate sends with equal bodies remain two messages.
|
|
25
|
+
|
|
26
|
+
## One wake, several messages
|
|
27
|
+
|
|
28
|
+
For one exact destination and delivery class, the coordinator freezes the
|
|
29
|
+
oldest bounded FIFO prefix into one native wake. Each enclosed message keeps a
|
|
30
|
+
separate provenance envelope, conversation, deadline, and terminal result. A
|
|
31
|
+
busy endpoint therefore catches up in one wake instead of requiring one agent
|
|
32
|
+
turn per queued message.
|
|
33
|
+
|
|
34
|
+
The batch is bounded by message count, raw queue bytes, framed wake bytes, and
|
|
35
|
+
the adapter's operation limit. A message that expires or cannot fit reports its
|
|
36
|
+
own result; it does not erase or silently merge another message.
|
|
37
|
+
|
|
38
|
+
## Durable phases
|
|
39
|
+
|
|
40
|
+
Each delivery has exactly one of these phases:
|
|
41
|
+
|
|
42
|
+
1. `queued` — durably admitted, no operation owns it.
|
|
43
|
+
2. `reserved` — a specific attempt owns a fixed batch, but no write is
|
|
44
|
+
authorized.
|
|
45
|
+
3. `armed` — the exact prepared bytes and identities were revalidated and the
|
|
46
|
+
provider may be written.
|
|
47
|
+
4. `accepted` — the provider accepted the operation; Embassy continues to
|
|
48
|
+
track its lifetime.
|
|
49
|
+
5. `terminal` — `delivered`, `failed`, `cancelled`, `expired`, `ambiguous`, or
|
|
50
|
+
`unconfirmed` with a safe code.
|
|
51
|
+
|
|
52
|
+
Only an adapter's positive proof that it wrote nothing may return reserved or
|
|
53
|
+
armed work to `queued`. Loss before authorization may retry within the deadline
|
|
54
|
+
and attempt budget. Loss after an armed write is `ambiguous`; loss after
|
|
55
|
+
provider acceptance is the adapter's recorded `ambiguous` or `unconfirmed`
|
|
56
|
+
outcome. Neither is replayed.
|
|
57
|
+
|
|
58
|
+
On broker restart, queued work remains eligible, reserved work returns to the
|
|
59
|
+
queue, armed work becomes `ambiguous`, and accepted work becomes its stored
|
|
60
|
+
uncertain outcome. A terminal result is first-wins, including late or duplicate
|
|
61
|
+
provider callbacks.
|
|
62
|
+
|
|
63
|
+
## Native adapters
|
|
64
|
+
|
|
65
|
+
### Claude destination
|
|
66
|
+
|
|
67
|
+
The broker discovers the exact compatible live session, verifies its private
|
|
68
|
+
socket and workspace boundary, composes the complete bounded provenance batch,
|
|
69
|
+
then revalidates the same endpoint immediately before the peer-protocol write.
|
|
70
|
+
The receiving Claude session wakes through its native socket.
|
|
71
|
+
|
|
72
|
+
### Codex destination
|
|
73
|
+
|
|
74
|
+
The broker creates a fresh bounded App Server operation, resumes the exact
|
|
75
|
+
registered task without retaining returned history, prepares the input, then
|
|
76
|
+
revalidates the registration and operation immediately before the write. The
|
|
77
|
+
accepted operation remains attached until its terminal lifetime event so an
|
|
78
|
+
active-turn STEER has a valid target.
|
|
79
|
+
|
|
80
|
+
An exact leading `STEER:` is special only from Claude to Codex. It is delivered
|
|
81
|
+
through that exact accepted operation's `turn/steer` capability at the next
|
|
82
|
+
safe tool-call boundary. It never invokes `turn/interrupt` or injects during a
|
|
83
|
+
generation. A cleanly unavailable boundary returns the message to the ordinary
|
|
84
|
+
bounded queue. At most three queued STEER messages target one route.
|
|
85
|
+
|
|
86
|
+
### SSH destination
|
|
87
|
+
|
|
88
|
+
The source gateway resolves the exact endpoint at its owner, prepares one
|
|
89
|
+
bounded handoff, and writes it once through the authenticated SSH peer. The
|
|
90
|
+
destination checks the configured claimed host and source consistency, persists its queue,
|
|
91
|
+
then returns acceptance. A proven pre-enqueue refusal is
|
|
92
|
+
reported precisely; process loss, malformed response, or failure after the
|
|
93
|
+
commit boundary is uncertain and never retried automatically.
|
|
94
|
+
|
|
95
|
+
## Provenance and replies
|
|
96
|
+
|
|
97
|
+
Every native wake contains one `<cross-session-message>` envelope per message.
|
|
98
|
+
Reserved tag prefixes in user text are neutralized before framing. Public
|
|
99
|
+
metadata contains aliases, providers, and a conversation reference, never a
|
|
100
|
+
native session/task ID or socket path.
|
|
101
|
+
|
|
102
|
+
The enclosed reply hint is:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
embassy send --conversation <reference>
|
|
84
106
|
```
|
|
85
107
|
|
|
86
|
-
|
|
108
|
+
The caller is inferred again. The ledger accepts the reply only from one exact
|
|
109
|
+
participant and targets the other exact participant. A reference can survive a
|
|
110
|
+
broker restart while its bounded retained row and both endpoint identities are
|
|
111
|
+
still valid. Retirement, replacement, retention expiry, eviction, or state
|
|
112
|
+
reset makes it unavailable. Conversation references are intentionally not
|
|
113
|
+
stable across a reset.
|
|
114
|
+
|
|
115
|
+
## Receipts and retirement
|
|
116
|
+
|
|
117
|
+
`embassy delivery-status --token <token>` is a one-shot read.
|
|
118
|
+
`embassy wait-delivery --token <token>` polls the private broker control socket
|
|
119
|
+
until that delivery becomes terminal or its bounded wait ends. Delivery tokens
|
|
120
|
+
are opaque capabilities and must not be put in logs or provider messages.
|
|
121
|
+
Both status and delivery-status report the actual nonterminal phase: queued,
|
|
122
|
+
reserved, armed, or accepted. A missing/evicted receipt returns `found:false`;
|
|
123
|
+
wait-delivery exits 3 for that lookup failure, not the terminal-delivery-failure
|
|
124
|
+
exit 6. Receipt retention is bounded and never promises indefinite lookup.
|
|
125
|
+
The default receipt bounds are 500 terminal rows and 24 hours. The 1 MiB
|
|
126
|
+
retained-body budget removes old bodies, not their receipt/outcome or reply
|
|
127
|
+
identity; a hash retains exact duplicate-message checking after body removal.
|
|
128
|
+
Retirement evidence has a separate 500-row bound and the same time window.
|
|
129
|
+
|
|
130
|
+
`embassy retire --alias <local-name>` removes the resolved local endpoint in
|
|
131
|
+
one transaction. Incident queued/reserved work becomes `cancelled`; armed work
|
|
132
|
+
becomes `ambiguous`; accepted work becomes `unconfirmed`. Recent retirement
|
|
133
|
+
evidence remains bounded. Remote routes are read-only and must be retired on
|
|
134
|
+
their owner. No pending message is moved to another identity.
|
|
135
|
+
For a colliding name, use `embassy retire --endpoint <public-id>` with the
|
|
136
|
+
opaque ID from status. It removes only that exact local row; `--alias` and
|
|
137
|
+
`--endpoint` are mutually exclusive. This also works after both sessions exit.
|