@ours.network/tg-connector 0.1.0 → 0.1.1
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/README.md +2 -2
- package/dist/connector.js +1 -1
- package/package.json +1 -1
- package/dist/mufl_code/core/CLUSTER_API.md +0 -640
- package/dist/mufl_code/core/CLUSTER_CONTRACT.md +0 -121
- package/dist/mufl_code/core/CLUSTER_INTRODUCTION_PLAN.md +0 -200
- package/dist/mufl_code/core/CONFIGURATION_DESIGN.md +0 -35
- package/dist/mufl_code/core/CONFIGURATION_PLAN.md +0 -394
- package/dist/mufl_code/core/DEVELOPMENT.md +0 -168
- package/dist/mufl_code/core/EPHEMERAL_INVITE_PLAN.md +0 -465
- package/dist/mufl_code/core/GROUP_CHAT_DESIGN.md +0 -520
- package/dist/mufl_code/core/LICENSE +0 -98
- package/dist/mufl_code/core/README.md +0 -76
- package/dist/mufl_code/core/a2a_capabilities.mm +0 -350
- package/dist/mufl_code/core/a2a_cluster.mm +0 -601
- package/dist/mufl_code/core/a2a_control.mm +0 -89
- package/dist/mufl_code/core/a2a_messaging.mm +0 -2103
- package/dist/mufl_code/core/a2a_monitoring.mm +0 -94
- package/dist/mufl_code/core/a2a_protocol.mm +0 -231
- package/dist/mufl_code/core/config.mufl +0 -26
- package/dist/mufl_code/core/release-notes/2.0.md +0 -268
- package/dist/mufl_code/core/release-notes/2.1.md +0 -92
- package/dist/mufl_code/core/release-notes/2.2.md +0 -94
- package/dist/mufl_code/core/release-notes/3.0.md +0 -162
- package/dist/mufl_code/core/release-notes/3.1.md +0 -43
- package/dist/mufl_code/core/release-notes/README.md +0 -32
- package/dist/mufl_code/core/tests/README.md +0 -66
- package/dist/mufl_code/core/tests/run.sh +0 -67
- package/dist/mufl_code/core/tests/test.mjs +0 -467
- package/dist/mufl_code/core/tests/test_actor.mu +0 -287
- package/dist/mufl_code/core/version.mm +0 -24
|
@@ -1,640 +0,0 @@
|
|
|
1
|
-
# CLUSTER_API.md — control-protocol-over-MUFL contract
|
|
2
|
-
|
|
3
|
-
**Status: `FROZEN v1`** (critic PASS on dd44ae6, Coordinator-frozen 2026-06-19) ·
|
|
4
|
-
core `a2a_*` libraries · base core version **2.6** · branch
|
|
5
|
-
`feat/control-protocol-mufl` (off `feat/core-cluster-capability`).
|
|
6
|
-
|
|
7
|
-
> **FROZEN — single source of truth.** WS-B/C/D/E build against THIS. Changes
|
|
8
|
-
> require a Coordinator-routed re-freeze. Implementation tracks this contract;
|
|
9
|
-
> any impl-discovered necessity that contradicts it is raised to the Coordinator,
|
|
10
|
-
> not silently diverged.
|
|
11
|
-
|
|
12
|
-
> **v0.3 closes critic re-review RR-1…RR-9** (built on cb01be2). RR-1 callback
|
|
13
|
-
> forgery (origin::user, critic-verified); RR-2 `$pending_handle` threads
|
|
14
|
-
> `(sender,$req_id)`; RR-3 host-truth create dedup + complete/atomic enumerate +
|
|
15
|
-
> sync-reconcile-on-timeout + honest drift bound; RR-4 enumerate carries
|
|
16
|
-
> `$caps`+`$bio`; RR-5 legacy responder + `absent⇒1`; RR-6 deny-all/explicit-allow
|
|
17
|
-
> + god-mode caveat; RR-7 invite brotli dropped (raw-bin + generic base64); RR-8
|
|
18
|
-
> monitoring delivery already in-packet (WS-B deletes the drain); RR-9 authz gate
|
|
19
|
-
> moved INTO dispatch (non-bypassable, fail-fast). Pre-critic v0.2.1 hardening
|
|
20
|
-
> (host-callback unforgeable, fail-closed, layering split) retained.
|
|
21
|
-
|
|
22
|
-
Single source of truth (TEAM-PROTOCOL §37) for the control-protocol-to-MUFL
|
|
23
|
-
initiative. WS-B/C/D/E build against the **FROZEN** version — not against
|
|
24
|
-
TypeScript.
|
|
25
|
-
|
|
26
|
-
> **DRAFT — not frozen.** v0.2 closes critic R8 (R8-1…R8-7) and answers WS-C's 5
|
|
27
|
-
> wire questions. WS-B/C/D do **not** implement until the Coordinator broadcasts
|
|
28
|
-
> `CONTRACT FROZEN v<n>` after critic clears it. Remaining opens: §13.
|
|
29
|
-
|
|
30
|
-
**Changelog v0.1→v0.2:** added the single pre-dispatch **authz chokepoint** (§3,
|
|
31
|
-
R8-1) + normative per-verb auth class; carved `get_manifest` as the sole pre-auth
|
|
32
|
-
no-leak path (§6.1, R8-2); added `host_enumerate_children` + **reconcile** (§9,
|
|
33
|
-
R8-3) and the upgrade **backfill** (§10, R8-5); rewrote **idempotency** on
|
|
34
|
-
`(sender_id,$req_id)` + operation-keys + retention + timeout-rollback (§8, R8-4);
|
|
35
|
-
added manifest **`$protocol_version`** + negotiated cutover (§11, R8-6); honest
|
|
36
|
-
**host-primitive enumeration** — it is 3 packet hooks + 1 OOB step, not "two"
|
|
37
|
-
(§9, R8-7); added WS-C **wire answers** (§12).
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## 1. Model
|
|
42
|
-
|
|
43
|
-
One opaque transport already exists — `a2a_control::send_control($contact,$payload)`
|
|
44
|
-
outbound, inbound `a2a_control::control_message` (the `on_control_received` seam).
|
|
45
|
-
We stop hand-parsing `$payload` per app. Every command becomes a **capability
|
|
46
|
-
envelope** that the seam **authorizes once** (§3) then routes via
|
|
47
|
-
`a2a_capabilities::dispatch` to a core handler keyed by capability id. Control
|
|
48
|
-
plane and peer app speak the **same** envelope; TypeScript only moves bytes.
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
control plane ──send_control(payload=request_envelope)──▶ node packet
|
|
52
|
-
node: control_message
|
|
53
|
-
→ adapt payload → control_envelope_t
|
|
54
|
-
→ [AUTHZ CHOKEPOINT §3] ── deny ──▶ response($ok=false, err=unauthorized) (NO dispatch)
|
|
55
|
-
└─ allow ─▶ a2a_capabilities::dispatch → handlers[$cap](ctx) → [actions…]
|
|
56
|
-
(+ async host hooks for create/remove, §7/§9)
|
|
57
|
-
node ──send_control(payload=response_envelope)──▶ control plane (correlated by (sender,$req_id))
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## 2. Envelopes
|
|
61
|
-
|
|
62
|
-
**Request — `control_envelope_t`** (EXISTS, a2a_capabilities.mm:131):
|
|
63
|
-
```
|
|
64
|
-
metadef control_envelope_t: ($cap -> str, $verb -> str, $args -> str, $req_id -> str).
|
|
65
|
-
```
|
|
66
|
-
| field | type | meaning |
|
|
67
|
-
|---|---|---|
|
|
68
|
-
| `$cap` | str | `core.cluster` \| `core.monitoring` \| `core.connect` \| `core.configuration` |
|
|
69
|
-
| `$verb` | str | verb within the cap (§5–§6) |
|
|
70
|
-
| `$args` | str | **opaque JSON object**, schema per verb. `"{}"` when none. |
|
|
71
|
-
| `$req_id` | str | caller-chosen correlation id. Uniqueness scoped per sender (§8). `""` = fire-and-forget (no response shipped, no dedup marker). |
|
|
72
|
-
|
|
73
|
-
**Response — `response_envelope_t`** (NEW, in a2a_capabilities.mm):
|
|
74
|
-
```
|
|
75
|
-
metadef response_envelope_t: ($req_id -> str, $ok -> bool, $result -> any, $err -> any).
|
|
76
|
-
```
|
|
77
|
-
| field | type | meaning |
|
|
78
|
-
|---|---|---|
|
|
79
|
-
| `$req_id` | str | echoes the request `$req_id` |
|
|
80
|
-
| `$ok` | bool | TRUE on success |
|
|
81
|
-
| `$result` | any | **native** value per verb (record/array/string); present iff `$ok` |
|
|
82
|
-
| `$err` | any | **native** `($code,$message)`; present iff not `$ok` |
|
|
83
|
-
|
|
84
|
-
> **Refinement R1 of FROZEN v1 — impl-discovered 2026-06-19, blessed by Coordinator.**
|
|
85
|
-
> `$result`/`$err` are **native MUFL values, NOT pre-stringified JSON**, because
|
|
86
|
-
> **MUFL has no JSON encoder** — the frozen "build a JSON-string `$result` in-MUFL"
|
|
87
|
-
> was literally impossible. **Delivery:** a handler (sync) or async callback trn
|
|
88
|
-
> **returns the `response_envelope` as transaction `return_data`**; the **daemon
|
|
89
|
-
> marshals it** (AdaptValue→`JSON.stringify`) and ships via the existing generic
|
|
90
|
-
> `sendControl`. **Core emits NO send action for responses.** This marshalling is
|
|
91
|
-
> generic envelope transport — identical for every verb, never verb logic — so DoD
|
|
92
|
-
> §10 holds and the browser wire shape is unchanged (still a JSON response with the
|
|
93
|
-
> same fields). **Response target routing (must need no verb knowledge):** SYNC →
|
|
94
|
-
> `ctx.$sender_id` (the seam trn's return_data goes back to the caller); ASYNC →
|
|
95
|
-
> the sender resolved from the pending-req by `$pending_handle` (RR-2), to which the
|
|
96
|
-
> daemon ships the callback trn's return_data. The daemon never inspects the verb to
|
|
97
|
-
> route or marshal — the proof it stays generic.
|
|
98
|
-
|
|
99
|
-
Control plane resolves the pending promise by `(sender,$req_id)`. Handlers are
|
|
100
|
-
**idempotent by `(sender,$req_id)`** (§8).
|
|
101
|
-
|
|
102
|
-
**Binary-in-JSON encoding — ONE uniform rule [NORMATIVE] (preempts RR-7 concern).**
|
|
103
|
-
`$args` and `$result` are always JSON **strings**; this invariant never bends. A
|
|
104
|
-
binary value that must appear *inside* one of those JSON objects is carried as a
|
|
105
|
-
**base64url string**, applied **identically to every binary field of every verb** —
|
|
106
|
-
a single, verb-agnostic transport encoding, never per-verb logic. `core.cluster.contact`'s
|
|
107
|
-
`$result.invite` (the raw uncompressed invite `bin`, §9 RR-7) is simply *the one
|
|
108
|
-
current instance* of this rule, not a special case — so it does not break the
|
|
109
|
-
"`$result` is opaque JSON str" invariant and introduces no verb-specific TS (DoD
|
|
110
|
-
§10). Any future binary-bearing result uses the same rule. (Because MUFL itself has
|
|
111
|
-
no base64 — grep-clean — the encode/decode sits at the generic transport boundary,
|
|
112
|
-
but it is the same code path for all bins, so it is provably generic, not
|
|
113
|
-
verb-specific.)
|
|
114
|
-
|
|
115
|
-
**Dispatch ctx** (EXISTS, a2a_capabilities.mm:196) handed to each handler:
|
|
116
|
-
```
|
|
117
|
-
ctx = ($sender_id: global_id, $sender_name: str, $app_id: str,
|
|
118
|
-
$verb: str, $args: str, $req_id: str, $date: time)
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## 3. Authorization — ONE pre-dispatch chokepoint (R8-1, R8-2) [NORMATIVE]
|
|
122
|
-
|
|
123
|
-
`dispatch()` performs **no** authorization. A "switch+compose" handler would
|
|
124
|
-
therefore expose every mutator to any contact. So authorization is decided
|
|
125
|
-
**once, before dispatch, in the `control_message`/`on_control_received` seam** —
|
|
126
|
-
mirroring today's single TS chokepoint (`proxyCid === senderCid`,
|
|
127
|
-
index.ts:798-802). This is a **core-provided** gate, not per-app code.
|
|
128
|
-
|
|
129
|
-
**New core fns — split by the library layering** (this is load-bearing, see note):
|
|
130
|
-
```
|
|
131
|
-
// PURE policy table — no state. Home: a2a_capabilities (the lowest layer).
|
|
132
|
-
fn a2a_capabilities::control_auth_class (_:($cap -> str, $verb -> str)) -> str // "public" | "controller" | "bootstrap"
|
|
133
|
-
|
|
134
|
-
// STATEFUL gate — reads the bound control proxy. Home: a2a_messaging.
|
|
135
|
-
fn a2a_messaging::authorize_control (_:($sender_id -> global_id, $cap -> str, $verb -> str)) -> bool
|
|
136
|
-
```
|
|
137
|
-
**Layering note (corrects v0.2 first draft):** `a2a_capabilities` is loaded *by*
|
|
138
|
-
`a2a_messaging`, not vice-versa, and the bound-proxy identity (`monitoring_proxy`,
|
|
139
|
-
a `proxy_binding_t`) is `hidden` inside `a2a_messaging` — readable only there. So
|
|
140
|
-
the stateful `authorize_control` **must** live in `a2a_messaging` (which already
|
|
141
|
-
owns the identical check at index-side parity, a2a_messaging.mm:228 config gate
|
|
142
|
-
and :249 CP gate); `a2a_capabilities` holds only the pure `control_auth_class`
|
|
143
|
-
policy table. The seam calls `a2a_messaging::authorize_control` once; on FALSE it
|
|
144
|
-
emits an `unauthorized` response and **does not** dispatch. Handlers MAY add finer
|
|
145
|
-
checks (e.g. introduce consent, §6.3) but **cannot widen** access.
|
|
146
|
-
|
|
147
|
-
**Auth classes**
|
|
148
|
-
- **`public`** — no auth. Read-only, side-effect-free, **no member data**. The
|
|
149
|
-
ONLY public surface is `get_manifest` (§6.1) — needed *before* bind, or
|
|
150
|
-
bootstrap deadlocks (R8-2).
|
|
151
|
-
- **`controller`** — `$sender_id` is the node's **bound control proxy**
|
|
152
|
-
(`$sender_id == a2a_messaging` bound `monitoring_proxy.$proxy_cid`). All cluster
|
|
153
|
-
mutators + `list`/`contact`/`introduce` + `monitoring.disable`.
|
|
154
|
-
- **`bootstrap`** — `core.monitoring.bind` ONLY. The sender is **not yet** the
|
|
155
|
-
controller; authorization is **possession of the 6-digit code** (verified by
|
|
156
|
-
`verify_proxy_code`). On success the sender *becomes* the controller.
|
|
157
|
-
|
|
158
|
-
**Fail-closed — deny-all / explicit-allow [NORMATIVE] (RR-6).** Authorization is an
|
|
159
|
-
**explicit allow-list**, not a permissive default:
|
|
160
|
-
- `control_auth_class` returns one of `public`/`bootstrap`/`controller` ONLY for
|
|
161
|
-
the `(cap,verb)` pairs explicitly enumerated in the table above; for **anything
|
|
162
|
-
else it returns `"deny"`**, and the chokepoint rejects `"deny"` with
|
|
163
|
-
`unauthorized` **before** dispatch. A new verb must be *consciously classified*
|
|
164
|
-
in the table to become reachable — it can never silently inherit access. (This
|
|
165
|
-
is stricter than v0.2's `unknown→controller`.)
|
|
166
|
-
- `on_unknown` (an authorized controller hitting an unimplemented *cap*) **MUST be
|
|
167
|
-
side-effect-free** and emit `$ok=false`/`unknown_verb` — no state change, no
|
|
168
|
-
action but the error reply. Never fail-open.
|
|
169
|
-
- A known cap's handler **MUST** default its verb switch to `$ok=false`/`unknown_verb`
|
|
170
|
-
— an unrecognized verb never falls through to a permissive branch.
|
|
171
|
-
|
|
172
|
-
**Scope caveat [NORMATIVE-VISIBLE] (RR-6).** This single chokepoint faithfully
|
|
173
|
-
reinstates the **single-credential `controller` = god-mode** model: one bound-proxy
|
|
174
|
-
credential authorizes every mutator incl. destructive `remove`. Tiered authz
|
|
175
|
-
(observe < manage < create < destroy) remains **roadmap**, not enforced here. Kept
|
|
176
|
-
visible so it is a conscious, documented limitation, not an accident.
|
|
177
|
-
|
|
178
|
-
**Non-bypassable BY CONSTRUCTION — the gate lives INSIDE dispatch (RR-9)
|
|
179
|
-
[NORMATIVE].** A per-app seam gate is a footgun: a new app could wire `dispatch`
|
|
180
|
-
and *forget* the gate → silent bypass, nothing fails-fast. So the gate is moved
|
|
181
|
-
**into `dispatch` itself**, fail-fast like `init`'s declared-vs-implemented check:
|
|
182
|
-
- `init` gains an injected **`$authorizer -> (any -> bool)`** hook — the app wires
|
|
183
|
-
it to `a2a_messaging::authorize_control` (the stateful gate; lives there per the
|
|
184
|
-
layering note). `a2a_capabilities` calls it through the hook, so no reverse
|
|
185
|
-
dependency.
|
|
186
|
-
- **`dispatch`, before routing**, computes `class = control_auth_class($cap,$verb)`:
|
|
187
|
-
- `"deny"` → return `unauthorized` (never routes);
|
|
188
|
-
- `"controller"` → **`abort` if `authorizer` is unset** (fail-fast: an app that
|
|
189
|
-
forgot to wire it cannot serve a single mutator) then call it; on FALSE →
|
|
190
|
-
`unauthorized`;
|
|
191
|
-
- `"public"`/`"bootstrap"` → route (bootstrap's own check — `verify_proxy_code` —
|
|
192
|
-
runs inside the `bind` handler).
|
|
193
|
-
This makes "every mutator passes the chokepoint" true **by construction**, not by
|
|
194
|
-
convention — a missing gate is a hard abort, exactly like a missing handler. (WS-E
|
|
195
|
-
still adds a conformance test as defense-in-depth, but it is no longer the only
|
|
196
|
-
backstop.)
|
|
197
|
-
|
|
198
|
-
**MUFL wiring note for `init` (saves WS-B/C/D compile time).**
|
|
199
|
-
- `$authorizer -> a2a_messaging::authorize_control` works DIRECTLY — `authorize_control`
|
|
200
|
-
takes `any` (not a typed arg record) so it is assignable to the `(any -> bool)`
|
|
201
|
-
field. (A typed-arg fn is NOT assignable there under function-arg contravariance;
|
|
202
|
-
no wrapper needed because the fn already takes `any`.)
|
|
203
|
-
- `$handlers` and `$supported` literals infer **closed/fixed** types
|
|
204
|
-
(`<"core.cluster",…> ->> …`, `[0->,1->,2->]`) that don't match `init`'s OPEN
|
|
205
|
-
`(str ->> …)` / `(int ->> str)`. Build them as explicitly-typed locals first:
|
|
206
|
-
```
|
|
207
|
-
h is (str ->> (any -> transaction::action::type[])) = (,).
|
|
208
|
-
h (a2a_capabilities::cap_cluster) -> a2a_cluster::cluster_handler.
|
|
209
|
-
h (a2a_capabilities::cap_monitoring) -> a2a_cluster::monitoring_handler.
|
|
210
|
-
h (a2a_capabilities::cap_connect) -> a2a_cluster::connect_handler.
|
|
211
|
-
s is str[] = [a2a_capabilities::cap_cluster, a2a_capabilities::cap_monitoring, a2a_capabilities::cap_connect].
|
|
212
|
-
```
|
|
213
|
-
then pass `h`/`s` to `init`.
|
|
214
|
-
|
|
215
|
-
**Normative per-verb auth class** (the authoritative table; §5/§6 repeat it per row):
|
|
216
|
-
|
|
217
|
-
| cap.verb | class |
|
|
218
|
-
|---|---|
|
|
219
|
-
| `get_manifest` (trn, §6.1) | **public** |
|
|
220
|
-
| `core.monitoring.bind` | **bootstrap** |
|
|
221
|
-
| `core.cluster.*` (list/create/set_bio/remove/set_monitoring/contact/introduce) | **controller** |
|
|
222
|
-
| `core.monitoring.disable` | **controller** |
|
|
223
|
-
| `core.connect.introduce` | **controller** (+ handler-side verified-connect gate, §6.3) |
|
|
224
|
-
| `core.configuration.*` | **controller** |
|
|
225
|
-
|
|
226
|
-
## 4. `member_t` registry
|
|
227
|
-
|
|
228
|
-
Root-packet registry, the control-plane projection of the hosted child set
|
|
229
|
-
(kept honest by §9 reconcile — it is NOT an unbacked source of truth):
|
|
230
|
-
```
|
|
231
|
-
metadef member_t: ($cid -> global_id, $role_id -> str, $name -> str,
|
|
232
|
-
$bio -> str, $monitoring -> str, $caps -> str[]).
|
|
233
|
-
cluster_members is (global_id ->> member_t). // keyed by child cid
|
|
234
|
-
```
|
|
235
|
-
`$monitoring` ∈ `"off" | "pending" | "on"`. JSON member:
|
|
236
|
-
`{"cid":str,"role_id":str,"name":str,"bio":str,"monitoring":"off|pending|on","caps":[str]}`.
|
|
237
|
-
|
|
238
|
-
## 5. `core.cluster` verbs
|
|
239
|
-
|
|
240
|
-
| verb | class | sync? | `$args` JSON | `$result` JSON | composes / notes |
|
|
241
|
-
|---|---|---|---|---|---|
|
|
242
|
-
| `list` | controller | sync | `{}` | `{"members":[member,…]}` | reads `cluster_members` (post-reconcile, §9). Empty ⇒ caller is not a managing root. |
|
|
243
|
-
| `create` | controller | **async** | `{"name":str,"bio":str}` | `{"cid":str,"role_id":str,"name":str,"bio":str,"monitoring":"off","caps":[…]}` | **op-key = name** (§8). Emits `host_provision_child` + persists pending-req; completed by `register_provisioned_child` (§7). |
|
|
244
|
-
| `set_bio` | controller | sync | `{"cid":str,"bio":str}` | `{"cid":str,"bio":str}` | registry-only in v1 (§13-Q3): updates `cluster_members[cid].bio`. |
|
|
245
|
-
| `remove` | controller | **async** | `{"cid":str}` | `{"cid":str,"removed":true}` | **op-key = cid** (§8). Emits `host_destroy_child` + pending-req; completed by `confirm_child_destroyed` (§7). Destructive (full teardown). |
|
|
246
|
-
| `set_monitoring` | controller | **async** (C5) | `{"cid":str,"enabled":bool}` | `{"cid":str,"monitoring":"on\|off"}` | REAL per-child monitoring (§9): host-binds/clears the child's `monitoring_proxy` to the root's ceremony-pinned CP via `host_set_child_monitoring` → `confirm_child_monitoring`. CP derived from `bound_cp_cid`, never `$args`. |
|
|
247
|
-
| `contact` | controller | **async** (R2) | `{"cid":str}` | `{"invite":str}` | the controller must become a **direct contact of the CHILD**, so the invite must carry the CHILD's identity — only the child's packet can sign it. The root handler validates the cid is a real hosted child, persists a pending-req, and emits **`host_mint_child_invite`** (4th host primitive, §9); the daemon runs `generate_invite` IN the child packet and calls back `register_child_invite`. `$invite` = base64url of the raw child invite bin (shape unchanged → WS-C unaffected). |
|
|
248
|
-
| `introduce` | controller | sync | `{"peer_a":str,"peer_b":str}` \| `{"joiner":str,"members":[str,…]}` | `{"ok":true}` | composes `a2a_messaging::introduce` / `introduce_to_group`. Cluster-scoped child↔contact. |
|
|
249
|
-
|
|
250
|
-
## 6. `core.monitoring` / `core.connect` / `get_manifest`
|
|
251
|
-
|
|
252
|
-
### 6.1 `get_manifest` — the ONLY pre-auth discovery path (R8-2) [NORMATIVE]
|
|
253
|
-
Stays the existing `a2a_capabilities::get_manifest` **`trn readonly`**, auth class
|
|
254
|
-
**public**. Returns the `app_manifest_t` ONLY — caps, verbs, name,
|
|
255
|
-
`$monitoring_status`, and **`$protocol_version`** (§11). It **MUST NOT** return
|
|
256
|
-
`cluster_members` or any member data (member enumeration requires
|
|
257
|
-
`core.cluster.list`, which is `controller`). This is what lets a not-yet-bound
|
|
258
|
-
client discover envelope support without deadlock, without leaking the roster.
|
|
259
|
-
|
|
260
|
-
### 6.2 `core.monitoring`
|
|
261
|
-
| verb | class | `$args` | `$result` | notes |
|
|
262
|
-
|---|---|---|---|---|
|
|
263
|
-
| `bind` | bootstrap | `{"code":str}` | `{"manifest":{…},"members":[member,…],"config":{…}}` | the 6-digit ceremony verify step → `verify_proxy_code($code, sender=ctx.$sender_id)`. Code generated host-side OOB (§9). **One-shot** manifest+members+config (WS-C Q3, §12). On success sender becomes controller. |
|
|
264
|
-
| `disable` | controller | `{}` | `{"ok":true}` | `disable_monitoring`. |
|
|
265
|
-
|
|
266
|
-
### 6.3 `core.connect`
|
|
267
|
-
| verb | class | `$args` | `$result` | notes |
|
|
268
|
-
|---|---|---|---|---|
|
|
269
|
-
| `introduce` | controller + verified-gate | `{"peer_a":str,"peer_b":str,"force":bool}` | `{"ok":true}` | generic peer↔peer. The **verified-connect gate** is preserved (R7 #3 / WS-C §3): block with `$err.code="unverified_connect"` unless `force=true` (§12 Q2). No second ungated introduce path. |
|
|
270
|
-
|
|
271
|
-
## 7. Host-primitive hooks (async create/remove)
|
|
272
|
-
|
|
273
|
-
**Pending-handle threads the sender dimension (RR-2) [NORMATIVE].** The host
|
|
274
|
-
round-trip would otherwise drop `$sender_id` (host actions carried `$req_id` only,
|
|
275
|
-
contradicting §8's `(sender,$req_id)` key). Fix: the handler mints a **host-unique
|
|
276
|
-
`$pending_handle`** per async op and threads it through; the pending-req is keyed
|
|
277
|
-
by `$pending_handle` and stores the full `(sender_id, $req_id, verb, op_key, args,
|
|
278
|
-
date)`. The handle — not the client-chosen `$req_id` — is what the callback echoes,
|
|
279
|
-
so the correct sender's pending-req is recovered unambiguously across proxy handoffs
|
|
280
|
-
or `$req_id` reuse.
|
|
281
|
-
|
|
282
|
-
**Notify-actions emitted by core handlers** (daemon host executor consumes):
|
|
283
|
-
```
|
|
284
|
-
host_provision_child : ($event -> $host_provision_child, $name -> str, $bio -> str, $pending_handle -> str)
|
|
285
|
-
host_destroy_child : ($event -> $host_destroy_child, $cid -> global_id, $pending_handle -> str)
|
|
286
|
-
host_enumerate_children : ($event -> $host_enumerate_children, $pending_handle -> str) // §9
|
|
287
|
-
```
|
|
288
|
-
**Callback trns (daemon → core, after the host op):**
|
|
289
|
-
```
|
|
290
|
-
register_provisioned_child _:($pending_handle -> str, $child_ad -> bin)
|
|
291
|
-
// MUST match an outstanding host_provision_child pending-req by $pending_handle
|
|
292
|
-
// (else ABORT). Delegate + register the new AD into cluster_members, resolve the
|
|
293
|
-
// pending-req's (sender,$req_id), emit the `create` response to that sender.
|
|
294
|
-
confirm_child_destroyed _:($pending_handle -> str, $cid -> global_id)
|
|
295
|
-
// MUST match an outstanding host_destroy_child pending-req (else ABORT). Drop
|
|
296
|
-
// cluster_members[cid], resolve the pending-req, emit the `remove` response.
|
|
297
|
-
reconcile _:($pending_handle -> str, $children -> child_rec[]) // §9; $pending_handle="" for timer/boot runs
|
|
298
|
-
```
|
|
299
|
-
Daemon maps `host_provision_child`→`provisionIdentity`→`register_provisioned_child`,
|
|
300
|
-
`host_destroy_child`→`deleteIdentityCompletely`→`confirm_child_destroyed`,
|
|
301
|
-
`host_enumerate_children`→enumerate→`reconcile`. **`$child_ad` is passed NATIVE**
|
|
302
|
-
(a parsed `t_address_document` record, not a `bin` blob) — consistent with R1, no
|
|
303
|
-
in-MUFL deserialization.
|
|
304
|
-
|
|
305
|
-
**Async response routing [NORMATIVE] (R1 routing).** A host callback runs at
|
|
306
|
-
`origin::user`, so its `ctx.$sender_id` is the **daemon/self** — replying there
|
|
307
|
-
would misroute. The callback therefore returns a routing wrapper as its
|
|
308
|
-
`return_data`: **`($target -> <stored controller cid>, $response -> response_envelope)`**,
|
|
309
|
-
where `$target` is the sender stored in the pending-req (resolved by
|
|
310
|
-
`$pending_handle`, RR-2). The daemon ships `$response` to `$target`. **Routing is
|
|
311
|
-
always by stored sender, never by `ctx.$sender_id` and never by verb.** (Sync
|
|
312
|
-
verbs differ: the seam trn's `return_data` is the bare `response_envelope`, shipped
|
|
313
|
-
to its own `ctx.$sender_id`.)
|
|
314
|
-
|
|
315
|
-
**HOST-ONLY, MATCH-REQUIRED gate (UNFORGEABLE) [NORMATIVE] (RR-1).**
|
|
316
|
-
`register_provisioned_child`, `confirm_child_destroyed`, and `reconcile` are **host
|
|
317
|
-
callbacks, never control verbs**. THREE independent guarantees stop a forged
|
|
318
|
-
"child registered/destroyed" from poisoning `cluster_members`:
|
|
319
|
-
1. **Not in any `$handlers` map** — `dispatch` cannot reach them. A remote contact
|
|
320
|
-
can only deliver a control envelope (→ `control_message` → `origin::external` →
|
|
321
|
-
dispatch → handlers); these trns are not on that path.
|
|
322
|
-
2. **Origin gate** — each MUST open with
|
|
323
|
-
`current_transaction_info::validate_origin_or_abort(transaction::envelope::origin::user,)`.
|
|
324
|
-
*Origin determination (RR-1, corrected):* `origin::self` **does not exist** in
|
|
325
|
-
ours-mufl-core or adapt-toolkit/transactions (grep-clean); every host-fired
|
|
326
|
-
daemon-invoked trn — `manage_root` (a2a_messaging.mm:790), `set_proxy_pending`,
|
|
327
|
-
`generate_invite`, `introduce`, … — gates on **`origin::user`**, which is the
|
|
328
|
-
origin the daemon's callback invocation actually carries. `origin::external`
|
|
329
|
-
(remote peers) **cannot** claim `user`. *(The R8-RR1 `origin::self`/`:830`
|
|
330
|
-
citation was a misread — `:830` is inside `handle_enroll_delegated_node`, which
|
|
331
|
-
is `origin::external`. Confirmed with critic.)*
|
|
332
|
-
3. **Pending-match (correctness/idempotency guard — NOT the forgery fix)** — the
|
|
333
|
-
callback MUST correspond to an **outstanding pending-req** (looked up by
|
|
334
|
-
`$pending_handle`) that actually emitted the matching `host_*` action; **no
|
|
335
|
-
match ⇒ ABORT**, and the pending-req is **consumed atomically on first
|
|
336
|
-
callback**. *Threat-model attribution (critic-confirmed):* guarantees #1+#2
|
|
337
|
-
(`origin::user`) **alone** close the remote-forgery threat — every inbound peer
|
|
338
|
-
message, **including the browser control-proxy's control envelopes**, is
|
|
339
|
-
`origin::external` (a2a_control.mm:64), so no remote party can ever invoke a
|
|
340
|
-
user-origin callback; the only entity that can is the local daemon (a
|
|
341
|
-
compromised daemon is total-loss regardless). The pending-match instead
|
|
342
|
-
guarantees **correctness against the legit daemon**: a duplicate/stale/re-fired
|
|
343
|
-
callback with no live pending-req must no-op, else a second `register`
|
|
344
|
-
double-inserts and a second `confirm` mis-drops (ties to RR-3 idempotency). It
|
|
345
|
-
is also belt-and-suspenders if origin were ever mis-stamped, but `origin::user`
|
|
346
|
-
is THE forgery fix.
|
|
347
|
-
|
|
348
|
-
## 8. Async correlation & idempotency (R8-4) [NORMATIVE]
|
|
349
|
-
|
|
350
|
-
- **Two indices, by purpose (RR-2/RR-3):**
|
|
351
|
-
- **Correlation** — pending-reqs are keyed by the **host-unique `$pending_handle`**
|
|
352
|
-
(§7) and store the full `(sender_id, $req_id, verb, op_key, args, date)`. The
|
|
353
|
-
handle threads `(sender,$req_id)` through the host round-trip that the raw
|
|
354
|
-
actions would otherwise drop, so the right sender's response is shipped
|
|
355
|
-
unambiguously across proxy handoffs / `$req_id` reuse.
|
|
356
|
-
- **Operation dedup** — a SEPARATE **GLOBAL (not per-sender)** index keyed by the
|
|
357
|
-
op-key (`create`→`$name`, `remove`→`$cid`). Global is required: across a proxy
|
|
358
|
-
handoff a *new* controller must not re-create a `$name` the *old* controller is
|
|
359
|
-
mid-provisioning (the member doesn't exist yet, so a per-sender check would
|
|
360
|
-
miss it — RR-3).
|
|
361
|
-
- **Operation-level idempotency consults HOST TRUTH, not just the registry (RR-3):**
|
|
362
|
-
- `create` **op-key = `$name`** (global). Before emitting `host_provision_child`,
|
|
363
|
-
short-circuit if the name exists as **(a)** a member, **(b)** a global pending
|
|
364
|
-
create, **(c)** a completed-create marker, **OR (d) a HOST packet** (per the
|
|
365
|
-
last reconcile / a read-through `host_enumerate_children`). (d) is the RR-3
|
|
366
|
-
fix: between spawn and registry-add the name exists as a *packet* but not a
|
|
367
|
-
*member*; checking only (a)-(c) lets a retry spawn a **duplicate packet**.
|
|
368
|
-
- `remove` **op-key = `$cid`** (global). If `cid` is already absent from both the
|
|
369
|
-
registry and host truth (or a remove is pending/completed), return idempotent
|
|
370
|
-
`{"cid":…,"removed":true}`; do NOT re-emit `host_destroy_child`. (Requires
|
|
371
|
-
`host_destroy_child`/`deleteIdentityCompletely` to be **idempotent on an
|
|
372
|
-
already-absent packet** — RR-6 — so a retry after a lost `confirm` is safe.)
|
|
373
|
-
- **Completed-req retention** — keep a `completed_reqs` marker
|
|
374
|
-
(`(global_id,str) ->> response_envelope_t`, keyed `(sender,$req_id)`) for
|
|
375
|
-
**`completed_req_retention` (600 s)**, distinct from the pending TTL. A duplicate
|
|
376
|
-
`(sender,$req_id)` within the window re-ships the stored response, no new work.
|
|
377
|
-
- **Pending TTL = `pending_req_ttl` (120 s) ⇒ SYNCHRONOUS reconcile then settle
|
|
378
|
-
(RR-3).** When a pending-req ages out, the sweep **reconciles first**
|
|
379
|
-
(`host_enumerate_children` ⨝ registry) and only then settles: if the orphan
|
|
380
|
-
packet is found it is **adopted** and the op reported success; if genuinely
|
|
381
|
-
absent the op is **rolled back** and an `$ok=false`/`timeout` response shipped.
|
|
382
|
-
Reconciling synchronously *before* emitting the failure closes the
|
|
383
|
-
"timeout-then-retry-duplicates" window — the client never sees a failure for a
|
|
384
|
-
child that actually exists, so it won't retry-and-duplicate.
|
|
385
|
-
|
|
386
|
-
## 9. Host truth & reconciliation (R8-3, R8-7) [NORMATIVE]
|
|
387
|
-
|
|
388
|
-
The registry is a **projection that MUST be provably non-divergent** from the
|
|
389
|
-
hosted packet set. Two mechanisms:
|
|
390
|
-
|
|
391
|
-
**(a) The `create` VERB funnel.** A `core.cluster.create` lands in `cluster_members`
|
|
392
|
-
via `register_provisioned_child` — which **requires a matching `create` pending-req**
|
|
393
|
-
(by `$pending_handle`, §7) and **aborts otherwise**. So funnel (a) covers ONLY the
|
|
394
|
-
create verb (the only path that has a pending-req). **Out-of-band / CLI `create_identity`
|
|
395
|
-
has NO pending-req**, so it MUST NOT go through `register_provisioned_child` (it would
|
|
396
|
-
abort) — it is caught by funnel (b)/reconcile instead. (This is why non-divergence
|
|
397
|
-
rests on (b), not (a): any provisioning that isn't a `create` verb — CLI, crash mid-
|
|
398
|
-
workflow — is reconciled from host truth.)
|
|
399
|
-
|
|
400
|
-
**(b) `host_enumerate_children` + `reconcile`.** Third packet host-primitive
|
|
401
|
-
(payload corrected per RR-4 to carry `$caps` + `$bio`):
|
|
402
|
-
```
|
|
403
|
-
host_enumerate_children : ($event -> $host_enumerate_children, $pending_handle -> str)
|
|
404
|
-
// daemon replies via:
|
|
405
|
-
reconcile _:($pending_handle -> str, $children -> child_rec[]) // $pending_handle="" for timer/boot
|
|
406
|
-
// child_rec = ($cid -> global_id, $role_id -> str, $name -> str,
|
|
407
|
-
// $bio -> str, $caps -> str[], $child_ad -> bin)
|
|
408
|
-
```
|
|
409
|
-
`reconcile` joins host truth ⨝ `cluster_members`:
|
|
410
|
-
- host child **not** in registry → **add** (backfills out-of-band/CLI children;
|
|
411
|
-
the R6-2 ghost-child fix — the registry can no longer permanently under-count).
|
|
412
|
-
- registry member **not** in host set → **drop** (clears dead members from a lost
|
|
413
|
-
`confirm_child_destroyed`).
|
|
414
|
-
|
|
415
|
-
**`$caps` (and `$bio`) are MANDATORY in `child_rec` (RR-4).** A backfilled member
|
|
416
|
-
with `caps=[]` reads `connectKnown=true, connect=false` at the introduce
|
|
417
|
-
verified-gate (§6.3) → every introduce **HARD-BLOCKS** until a later re-sync. So
|
|
418
|
-
the enumerate payload MUST carry the child's real caps + bio, not just identity.
|
|
419
|
-
|
|
420
|
-
**Completeness + atomicity (RR-3) [NORMATIVE].** `host_enumerate_children` MUST
|
|
421
|
-
return the **complete, authoritative** packet set **including half-provisioned**
|
|
422
|
-
packets, and `provisionIdentity` MUST make a packet **enumerable BEFORE**
|
|
423
|
-
`host_provision_child` is acknowledged. Without this an orphan that is
|
|
424
|
-
un-enumerable at reconcile time is adopted by *no* future reconcile → a permanent
|
|
425
|
-
ghost. With it, every orphan is eventually adopted.
|
|
426
|
-
|
|
427
|
-
**Drift is BOUNDED, not eliminated — stated honestly (RR-3).** Non-divergence is
|
|
428
|
-
*not* "by construction"; it is bounded by `reconcile_interval` (300 s) + every
|
|
429
|
-
`bind`, with two strong-read exceptions that close the dangerous gaps: (i)
|
|
430
|
-
`create` idempotency reads host truth before provisioning (§8(d)); (ii) the 120 s
|
|
431
|
-
timeout sweep reconciles synchronously before settling (§8). An out-of-band create
|
|
432
|
-
that slips funnel (a) is invisible to `list` for ≤300 s — a *bounded* under-count,
|
|
433
|
-
not a permanent one.
|
|
434
|
-
|
|
435
|
-
**Host-primitive surface — the honest count (R8-7 / RR-7 / R2 / C5).** It is **5
|
|
436
|
-
cross-packet host primitives + 1 OOB operator step**:
|
|
437
|
-
1. `host_provision_child` — spawn a packet, enumerable-before-ack (TS).
|
|
438
|
-
2. `host_destroy_child` — tear down a packet; **idempotent on an absent packet** (TS, RR-6).
|
|
439
|
-
3. `host_enumerate_children` — complete packet set incl half-provisioned (TS).
|
|
440
|
-
4. `host_mint_child_invite` — run `generate_invite` **IN the child's packet** (R2):
|
|
441
|
-
minting a child's invite is irreducibly cross-packet (only the child can sign
|
|
442
|
-
its own AD), so a root-handler compose could only ever mint the ROOT's invite
|
|
443
|
-
(confused deputy). The daemon calls back `register_child_invite`. MUST reject an
|
|
444
|
-
unknown/nonexistent cid cleanly.
|
|
445
|
-
5. `host_set_child_monitoring` — bind/clear the CHILD's `monitoring_proxy` (C5,
|
|
446
|
-
§below). The daemon calls back `confirm_child_monitoring`.
|
|
447
|
-
6. **bind code** — the 6-digit code is **generated host-side** (MUFL has no RNG)
|
|
448
|
-
and entered **out-of-band by the operator**; *verification* is in-packet
|
|
449
|
-
(`verify_proxy_code`).
|
|
450
|
-
|
|
451
|
-
> **Count stays 5** (not 6): `host_set_child_monitoring`'s executor invokes the
|
|
452
|
-
> CORE child-side trns `host_register_monitoring_cp` + `set_proxy_pending` +
|
|
453
|
-
> `verify_proxy_code` (enable) / `host_clear_child_monitoring` (disable) — these are
|
|
454
|
-
> **core transactions the daemon merely sequences**, NOT things the app implements,
|
|
455
|
-
> so they are not additional host primitives. The host-implemented surface a new app
|
|
456
|
-
> writes is exactly the 5 above + the OOB code.
|
|
457
|
-
|
|
458
|
-
**Per-child monitoring — single-gate, host-mediated (C5) [NORMATIVE].** SECURITY-MODEL.md
|
|
459
|
-
**CUT** the root-signed grant / CP-signed MA; monitoring authority is the node's own
|
|
460
|
-
6-digit ceremony binding (the single trust anchor). So per-child monitoring is NOT a
|
|
461
|
-
signed grant — it host-propagates the root's ceremony:
|
|
462
|
-
- **ENABLE (two host steps, ordered):** a child connects to its ROOT, not the CP, so
|
|
463
|
-
it can't resolve/forward to the CP yet. **(1) CP-contact injection** — the handler
|
|
464
|
-
carries the CP's **verified** AD (`peer_ads[cp]`) in the notify; the daemon host-runs
|
|
465
|
-
`host_register_monitoring_cp(cp_ad)` IN the child's packet, which **re-verifies** the
|
|
466
|
-
AD (`process_address_document` — self-sig + proof-of-possession, rejects a forgery)
|
|
467
|
-
and stores it as a contact. **The injected AD IS the ceremony-pinned CP, not an
|
|
468
|
-
arbitrary root peer:** the handler computes `cp_cid = bound_cp_cid` and injects
|
|
469
|
-
`cp_ad = peer_ads[cp_cid]` (keyed by that exact cid), and step 2 binds the child to
|
|
470
|
-
the SAME `cp_cid` — injected contact, verified AD, and ceremony target are one CP by
|
|
471
|
-
construction; never from `$args` or any other peer. This is **host-mediated, not a
|
|
472
|
-
network introduce**: the
|
|
473
|
-
child's introduction-acceptance gate (`require_cluster_cp_or_abort`) only accepts a
|
|
474
|
-
relay from the child's OWN CP, so a ROOT-relayed introduce is **rejected** (the root
|
|
475
|
-
isn't the child's CP) and a network introduce would race step 2. **(2) ceremony** —
|
|
476
|
-
the daemon host-runs the REAL ceremony (`set_proxy_pending` + `verify_proxy_code`)
|
|
477
|
-
IN the child's packet, binding the child's `monitoring_proxy` to that CP. The CP is
|
|
478
|
-
**derived from the root's OWN ceremony-pinned `monitoring_proxy`** (`bound_cp_cid`) —
|
|
479
|
-
**NEVER** a `set_monitoring` `$args` parameter (load-bearing: a child can only ever
|
|
480
|
-
be bound to the root's ceremonied CP). The child's `idpk_CP` is pinned by genuine
|
|
481
|
-
ceremony machinery, so "pinned-at-ceremony" stays literally true for children.
|
|
482
|
-
**Consent:** the child is given ONLY the cluster CP as a contact (the minimum
|
|
483
|
-
monitoring requires), controller-gated via `set_monitoring(on)`, CP AD verified.
|
|
484
|
-
- **DISABLE:** `host_clear_child_monitoring` clears the child's `monitoring_proxy`
|
|
485
|
-
→ `monitor_copy_actions` returns `[]` → forwarding genuinely stops (criterion **e**:
|
|
486
|
-
real revocation, NOT a registry-flag-only no-op). It is **CP-authorized** (only via
|
|
487
|
-
the controller-gated `set_monitoring(off)`) and merely **host-mediated** to the
|
|
488
|
-
child; the child's app packet has **no user-origin path**, so it can **never
|
|
489
|
-
self-clear** — the model's no-self-escape property holds. This is the cluster analog
|
|
490
|
-
of the standalone CP-authenticated `disable_monitoring`. **Full teardown (RR9-C12):**
|
|
491
|
-
disable ALSO drops the injected CP contact (`peer_ads[cp]` + `contacts[cp]`), so the
|
|
492
|
-
child↔CP relationship does not outlive the monitoring it was established for; re-enable
|
|
493
|
-
cheaply re-injects it.
|
|
494
|
-
- **NO FREE HOST PATH [load-bearing invariant]:** `host_set_child_monitoring` (enable
|
|
495
|
-
AND disable) is emitted ONLY from the controller-gated `_h_set_monitoring` — never
|
|
496
|
-
any other core path; and the daemon executor runs ONLY in response to that notify
|
|
497
|
-
(no standalone daemon/CLI set/clear-child-monitoring command). So a local host can
|
|
498
|
-
neither bind nor clear a child's monitoring without the ceremony-pinned CP
|
|
499
|
-
authorizing it via `set_monitoring`.
|
|
500
|
-
- **(f) CP-REBIND [daemon obligation]:** on a cluster-CP rebind, the daemon MUST
|
|
501
|
-
re-point (re-run enable) or clear the currently-monitored children, so no child
|
|
502
|
-
keeps forwarding to a stale/old CP.
|
|
503
|
-
- **(i) child-visible NOTICE:** a CONSCIOUS DEFERRED CARRY — mcp-host children are
|
|
504
|
-
non-human-facing, so surfacing a per-child monitoring notice is a consuming-app/UI
|
|
505
|
-
obligation, not implemented here. Stated, not silently dropped (R6-3 / CLUSTER_CONTRACT.md).
|
|
506
|
-
|
|
507
|
-
**`contact` invite packing — DECISION (RR-7) [NORMATIVE].** Today
|
|
508
|
-
`packInvite = generate_invite (in-packet) → brotli → base64url`; **brotli is not
|
|
509
|
-
in MUFL**, so v0.2's "packed in-packet, no TS" was false. Resolution: **drop
|
|
510
|
-
brotli.** `generate_invite` already returns the raw `_write` blob (`bin`); the
|
|
511
|
-
`contact` `$result` carries that **raw invite `bin`**, and any base64/base64url
|
|
512
|
-
string-ification is a **generic, verb-agnostic transport encoding** (identical for
|
|
513
|
-
any `bin` payload), NOT verb-specific logic — so DoD §10 holds with **no 4th host
|
|
514
|
-
primitive**. *(MUFL base64 is also absent — grep-clean in mufl_stdlib+meta — so the
|
|
515
|
-
string encoding sits at the transport boundary, but it is generic, not per-verb.)*
|
|
516
|
-
**Wire-format change:** invites become **uncompressed** (larger, but ephemeral —
|
|
517
|
-
acceptable) and the **redeemer** drops its brotli-decompress step (core
|
|
518
|
-
`add_contact` is unchanged — it already `_read_or_abort`s the raw `bin`). WS-B/WS-C
|
|
519
|
-
must update the pack/redeem path accordingly.
|
|
520
|
-
|
|
521
|
-
**Monitoring forced-forward — fully in-packet (RR-8) [NORMATIVE].** Generation
|
|
522
|
-
*and delivery* are in-packet: `monitor_copy_actions` already **emits a
|
|
523
|
-
`send_encrypted_tx` action** to the bound proxy directly (a2a_messaging.mm:214,
|
|
524
|
-
same mechanism as the response envelope), so the TS `forwardMonitoring` drain
|
|
525
|
-
(idx:683) is **redundant** — **WS-B deletes it** (this also removes that drain's
|
|
526
|
-
`AdaptValue` churn). No host primitive.
|
|
527
|
-
|
|
528
|
-
**RR-8b — unbound = no copy, by DESIGN (ruled, not accidental).** When unbound,
|
|
529
|
-
copy-generation is **skipped** (`monitor_copy_actions` returns `[]`), so there is
|
|
530
|
-
no pre-bind backlog — and that is the **intended** semantics, NOT a regression to
|
|
531
|
-
fix with a buffer. Monitoring is a **consented** act that begins at `bind`; a
|
|
532
|
-
capped pre-bind buffer would deliver activity generated *before any control plane
|
|
533
|
-
bound* — pre-consent history — to whoever binds next, which is a **privacy
|
|
534
|
-
regression**. Capturing strictly **from bind forward** is the correct model. (If a
|
|
535
|
-
future requirement ever needs pre-bind capture it must be an explicit, consented
|
|
536
|
-
opt-in, not a silent buffer.)
|
|
537
|
-
|
|
538
|
-
## 10. Upgrade backfill (R8-5) [NORMATIVE]
|
|
539
|
-
|
|
540
|
-
`cluster_members` is **new** state (absent today). On the core-version bump an
|
|
541
|
-
existing root carries children as delegated roles + enrolled `peer_ads`, with an
|
|
542
|
-
**empty** registry → every child would vanish from the control plane. Fix: a
|
|
543
|
-
**one-time backfill** = the §9 `reconcile` run once at first boot on the new
|
|
544
|
-
version (seeded from `host_enumerate_children` ⨝ existing `peer_ads`/delegated
|
|
545
|
-
roles). Build once (§9), use for both reconcile and migration. Because the §9
|
|
546
|
-
`child_rec` now carries `$caps` + `$bio` (RR-4), backfilled members are introduce-
|
|
547
|
-
capable and bio-populated immediately — no hard-block window. `§7.4`'s "unchanged
|
|
548
|
-
shapes" is corrected: this registry needs an explicit backfill.
|
|
549
|
-
|
|
550
|
-
## 11. Cutover & version negotiation (R8-6) [NORMATIVE]
|
|
551
|
-
|
|
552
|
-
The control plane is a **browser packet** (cached, independently deployed) — a
|
|
553
|
-
hard wire-incompatible cutover is fragile. Mitigation:
|
|
554
|
-
- **`app_manifest_t` gains `$protocol_version: int`** (`1` = legacy JSON path,
|
|
555
|
-
`2` = envelope path). It MUST be readable by **both** paths during the
|
|
556
|
-
transition: the legacy TS `get_manifest` relay also surfaces `$protocol_version`,
|
|
557
|
-
and the new `get_manifest` trn returns it. So a stale browser learns the daemon
|
|
558
|
-
speaks envelopes **without already speaking them** (resolves the chicken-and-egg).
|
|
559
|
-
- Client negotiates: read `$protocol_version`; `>=2` ⇒ envelope path, else JSON.
|
|
560
|
-
This negotiation is **mandatory**, replacing the v0.1 "optional feature-flag."
|
|
561
|
-
- Cutover ships the daemon packet + control-plane packet together per environment;
|
|
562
|
-
`$protocol_version` makes a version-skew a **clean, diagnosable** mismatch
|
|
563
|
-
instead of silent total failure.
|
|
564
|
-
- **Old-browser → new-daemon (the silent-failure direction R8-6/RR-5 actually
|
|
565
|
-
cares about) [NORMATIVE].** `$protocol_version` only helps a *new* client detect
|
|
566
|
-
an *old* daemon. A **cached old browser** (predating the version check, still
|
|
567
|
-
sending v1 JSON) hitting a **new daemon** that has *deleted* `handleControlRequest`
|
|
568
|
-
(WS-B.2) would fail **silently**. Fix: the new daemon MUST keep a **minimal
|
|
569
|
-
legacy responder** that answers any v1/JSON control request with a structured
|
|
570
|
-
**`{"v":1,"t":"res","error":{"code":"protocol_upgraded","message":…}}`** the old
|
|
571
|
-
UI surfaces as a refresh/cache-bust prompt (or a forced cache-bust on deploy).
|
|
572
|
-
This is a WS-B obligation; the contract fixes the error shape so WS-C's legacy
|
|
573
|
-
build can recognize it.
|
|
574
|
-
- **`absent $protocol_version ⇒ assume 1 (JSON)` [NORMATIVE].** A truly
|
|
575
|
-
pre-transition daemon cannot surface the field, so its absence MUST be read as
|
|
576
|
-
protocol 1, never as "unknown/fail."
|
|
577
|
-
|
|
578
|
-
## 12. WS-C wire answers (messenger/PREP-WS-C.md §4)
|
|
579
|
-
|
|
580
|
-
1. **On-wire envelope shape + the `$`-key convention [NORMATIVE].** MUFL record
|
|
581
|
-
fields are `$`-prefixed (`$cap`/`$verb`/`$args`/`$req_id`), but the **JS/JSON wire
|
|
582
|
-
keys carry NO `$`** — the SDK bridges: `object_to_adapt_value({cap})` → MUFL
|
|
583
|
-
`$cap` (adds `$`), and `GetKeys`/`Reduce("cap")` strips it. So **both directions
|
|
584
|
-
use NO-`$` keys** on the wire:
|
|
585
|
-
- **REQUEST** (browser → daemon): `{ "cap":…, "verb":…, "args":{…}, "req_id":… }`.
|
|
586
|
-
Per **R1**, `args` is a **native nested object** (NOT a stringified JSON) — the
|
|
587
|
-
daemon `object_to_adapt_value`s the whole envelope (incl. nested `args`) into the
|
|
588
|
-
MUFL `control_envelope_t` so `dispatch` reads `env $cap` / `env $args` natively.
|
|
589
|
-
- **RESPONSE** (daemon → browser): the marshaller walks the response via `GetKeys`
|
|
590
|
-
(which returns stripped keys), emitting `{ "req_id":…, "ok":…, "result":…, "err":… }`
|
|
591
|
-
and nested no-`$` keys (`cid`, `name`, `members`, `monitoring`, `invite`, `code`,
|
|
592
|
-
`message`, …). WS-C parses exactly those.
|
|
593
|
-
(Earlier drafts showed `$`-prefixed wire keys and a stringified `$args` — both
|
|
594
|
-
superseded: no-`$` keys, native `args`, per R1 + the SDK bridge.)
|
|
595
|
-
2. **Error channel.** `$ok=false`, `$err={"code":…,"message":…}`. Typed errors
|
|
596
|
-
the UI keys off come back in `$err.code` — specifically **`unverified_connect`**
|
|
597
|
-
for the introduce gate. Force-retry: resend the same verb with
|
|
598
|
-
`$args.force=true` (§6.3). The UI's existing force path maps 1:1.
|
|
599
|
-
3. **`bind` one-shot.** YES — `core.monitoring.bind` `$result` =
|
|
600
|
-
`{"manifest":{…},"members":[…],"config":{…}}` in one response (preserves
|
|
601
|
-
ControlClient 262-277 behavior).
|
|
602
|
-
4. **`introduce` / `disableMonitoring`.** Both **move into the envelope**
|
|
603
|
-
(`core.connect.introduce`, `core.monitoring.disable`). introduce stays behind
|
|
604
|
-
the SAME client-side verified-connect gate (§6.3) before `sendEnvelope` — no
|
|
605
|
-
second ungated path. (The browser may still use `host.introduce` as the
|
|
606
|
-
transport beneath `sendEnvelope`; semantically it is the envelope verb.)
|
|
607
|
-
5. **`managed_roots` / `manageRoot`.** Confirmed **out of WS-C envelope scope** —
|
|
608
|
-
cluster-enrollment / `manage_root` is host-level (`::actor::list_managed_roots`),
|
|
609
|
-
not a control-envelope verb. WS-C does not wrap it.
|
|
610
|
-
|
|
611
|
-
## 13. OPEN QUESTIONS
|
|
612
|
-
|
|
613
|
-
**ACCEPTED by Coordinator** (folded in): Q1 response helper → a2a_capabilities; Q2
|
|
614
|
-
list controller-gated; Q3 set_bio registry-only v1; Q4 set_monitoring frozen,
|
|
615
|
-
composition later; Q5 ttl=120s; Q6 keep both introduce verbs; **Q7** retention
|
|
616
|
-
600 s; **Q8** reconcile_interval 300 s; **Q9 RESOLVED (RR-4): `child_rec` carries
|
|
617
|
-
`$cid,$role_id,$name,$bio,$caps,$child_ad`** — caps are mandatory (else backfilled
|
|
618
|
-
members hard-block at introduce).
|
|
619
|
-
|
|
620
|
-
**Critic R8/RR closure status** (all folded into v0.3):
|
|
621
|
-
- RR-1 (callback forgery) — `origin::user` + not-a-control-verb; critic-verified
|
|
622
|
-
CLOSED (§7).
|
|
623
|
-
- RR-2 (sender dimension) — host-unique `$pending_handle` threads `(sender,$req_id)`
|
|
624
|
-
(§7/§8).
|
|
625
|
-
- RR-3 (drift/dup) — host-truth create dedup (§8(d)) + global pending-by-name +
|
|
626
|
-
complete/atomic enumerate + sync-reconcile-on-timeout (§8/§9); drift bound stated
|
|
627
|
-
honestly.
|
|
628
|
-
- RR-4 (caps) — Q9 resolved above.
|
|
629
|
-
- RR-5 (old-browser→new-daemon) — legacy responder + `protocol_upgraded` +
|
|
630
|
-
`absent⇒1` (§11).
|
|
631
|
-
- RR-6 (deny-all) — explicit allow-list + god-mode caveat + remove-idempotency (§3/§8).
|
|
632
|
-
- RR-7 (invite packing) — brotli dropped; raw-bin + generic transport base64;
|
|
633
|
-
**DECISION needs critic sign-off** + WS-B/C pack/redeem update (§9).
|
|
634
|
-
- RR-8 (monitoring delivery) — already in-packet (a2a_messaging.mm:214); WS-B
|
|
635
|
-
deletes the drain (§9).
|
|
636
|
-
- RR-9 (non-bypassable gate) — moved INTO dispatch via injected `$authorizer` +
|
|
637
|
-
fail-fast; **feasibility confirmed** (no reverse dep; mirrors init's check) (§3).
|
|
638
|
-
|
|
639
|
-
All of §3–§12 is **stable for freeze** pending critic's RR-7 sign-off. WS-B/C/D
|
|
640
|
-
can map against it now (passive).
|