@cello-protocol/daemon 0.0.167 → 0.0.169

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/daemon.d.ts.map +1 -1
  2. package/dist/daemon.js +115 -254
  3. package/dist/daemon.js.map +1 -1
  4. package/dist/document-amendment-store.d.ts +94 -46
  5. package/dist/document-amendment-store.d.ts.map +1 -1
  6. package/dist/document-amendment-store.js +217 -102
  7. package/dist/document-amendment-store.js.map +1 -1
  8. package/dist/document-delivery-transport.d.ts +41 -52
  9. package/dist/document-delivery-transport.d.ts.map +1 -1
  10. package/dist/document-delivery-transport.js +6 -156
  11. package/dist/document-delivery-transport.js.map +1 -1
  12. package/dist/document-frame-router.d.ts +13 -17
  13. package/dist/document-frame-router.d.ts.map +1 -1
  14. package/dist/document-frame-router.js +21 -93
  15. package/dist/document-frame-router.js.map +1 -1
  16. package/dist/document-handlers.d.ts +1 -1
  17. package/dist/document-handlers.d.ts.map +1 -1
  18. package/dist/document-handlers.js +471 -466
  19. package/dist/document-handlers.js.map +1 -1
  20. package/dist/document-handshake.d.ts +4 -1
  21. package/dist/document-handshake.d.ts.map +1 -1
  22. package/dist/document-handshake.js +3 -1
  23. package/dist/document-handshake.js.map +1 -1
  24. package/dist/document-inbound.d.ts +18 -5
  25. package/dist/document-inbound.d.ts.map +1 -1
  26. package/dist/document-inbound.js +94 -110
  27. package/dist/document-inbound.js.map +1 -1
  28. package/dist/document-layer.d.ts +28 -67
  29. package/dist/document-layer.d.ts.map +1 -1
  30. package/dist/document-layer.js +670 -565
  31. package/dist/document-layer.js.map +1 -1
  32. package/dist/document-lifecycle.d.ts +11 -157
  33. package/dist/document-lifecycle.d.ts.map +1 -1
  34. package/dist/document-lifecycle.js +26 -561
  35. package/dist/document-lifecycle.js.map +1 -1
  36. package/dist/document-publish.d.ts +13 -0
  37. package/dist/document-publish.d.ts.map +1 -1
  38. package/dist/document-publish.js +19 -11
  39. package/dist/document-publish.js.map +1 -1
  40. package/dist/document-reconcile-engine.d.ts +66 -0
  41. package/dist/document-reconcile-engine.d.ts.map +1 -0
  42. package/dist/document-reconcile-engine.js +225 -0
  43. package/dist/document-reconcile-engine.js.map +1 -0
  44. package/dist/document-reconcile-scheduler.d.ts +91 -0
  45. package/dist/document-reconcile-scheduler.d.ts.map +1 -0
  46. package/dist/document-reconcile-scheduler.js +153 -0
  47. package/dist/document-reconcile-scheduler.js.map +1 -0
  48. package/dist/document-rejection.d.ts +2 -0
  49. package/dist/document-rejection.d.ts.map +1 -1
  50. package/dist/document-rejection.js +5 -1
  51. package/dist/document-rejection.js.map +1 -1
  52. package/dist/document-store.d.ts +18 -220
  53. package/dist/document-store.d.ts.map +1 -1
  54. package/dist/document-store.js +95 -717
  55. package/dist/document-store.js.map +1 -1
  56. package/dist/initiate-session-handler.d.ts +5 -0
  57. package/dist/initiate-session-handler.d.ts.map +1 -1
  58. package/dist/initiate-session-handler.js +1 -0
  59. package/dist/initiate-session-handler.js.map +1 -1
  60. package/package.json +5 -5
  61. package/dist/delivery-sweep-bound.d.ts +0 -79
  62. package/dist/delivery-sweep-bound.d.ts.map +0 -1
  63. package/dist/delivery-sweep-bound.js +0 -109
  64. package/dist/delivery-sweep-bound.js.map +0 -1
  65. package/dist/document-ack-inbound.d.ts +0 -71
  66. package/dist/document-ack-inbound.d.ts.map +0 -1
  67. package/dist/document-ack-inbound.js +0 -210
  68. package/dist/document-ack-inbound.js.map +0 -1
  69. package/dist/document-control-notifier.d.ts +0 -107
  70. package/dist/document-control-notifier.d.ts.map +0 -1
  71. package/dist/document-control-notifier.js +0 -137
  72. package/dist/document-control-notifier.js.map +0 -1
  73. package/dist/document-delivery.d.ts +0 -229
  74. package/dist/document-delivery.d.ts.map +0 -1
  75. package/dist/document-delivery.js +0 -449
  76. package/dist/document-delivery.js.map +0 -1
  77. package/dist/document-join-store.d.ts +0 -80
  78. package/dist/document-join-store.d.ts.map +0 -1
  79. package/dist/document-join-store.js +0 -197
  80. package/dist/document-join-store.js.map +0 -1
@@ -12,12 +12,8 @@
12
12
  * because opening is the expensive half — a directory negotiation, a dial, and a seal — and a
13
13
  * backlog of pending envelopes for one peer would otherwise pay it per envelope. It is also the
14
14
  * behaviour an operator expects when they are mid-conversation about the document: the change lands
15
- * in the same sealed record as the discussion, without anyone passing a session hint.
16
- *
17
- * An explicit `sessionHint` overrides the choice but NOT the validation — a hint naming a session
18
- * that is not active with this peer is refused rather than silently replaced by the daemon's own
19
- * pick, because the one reason to pass a hint is to control which sealed record the change lands
20
- * in, and quietly choosing a different one defeats exactly that.
15
+ * in the same sealed record as the discussion. (SYNC-D10: the explicit session hint is deleted —
16
+ * the daemon's reuse-most-recent choice is the whole rule.)
21
17
  *
22
18
  * ── WHAT AN ACK IS HERE, AND WHAT IT IS NOT ───────────────────────────────────────────────────
23
19
  *
@@ -33,8 +29,6 @@
33
29
  * permanent-redelivery shape this milestone has already fixed once. The worker records the envelope
34
30
  * as delivered, leaves it unacked, and asks again on the capped backoff.
35
31
  */
36
- import type { DocumentDeliveryTransport } from "./document-delivery.js";
37
- import type { DocumentEnvelopeRow } from "./document-store.js";
38
32
  import { DiscoveryUnavailableError } from "./document-reachability.js";
39
33
  import type { DiscoveryOutcome } from "./cross-node-negotiation.js";
40
34
  import type { Logger } from "./types.js";
@@ -86,52 +80,8 @@ export interface DocumentTransportDeps {
86
80
  reason: string;
87
81
  error: string;
88
82
  }>;
89
- /** Encode a document envelope row onto the wire, and its content hash. */
90
- encodeEnvelope(envelope: DocumentEnvelopeRow): {
91
- bytes: Uint8Array;
92
- hash: Uint8Array;
93
- };
94
- /**
95
- * Wait for the peer to ANSWER this envelope, bounded. Resolves true if the ack landed.
96
- *
97
- * The seal below tears the session down, and the teardown drops any content still held for
98
- * ordering — so an ack that arrives correctly and is held for a gap is DELETED rather than
99
- * applied. Measured on a live daemon: the ack was sent, logged `session.content.held`, and the
100
- * session was destroyed three seconds later with it still buffered. The sender then re-sent the
101
- * envelope every tick until the unacked ceiling retired it.
102
- *
103
- * Waiting here is deliberately indifferent to WHY the answer is slow — held for ordering, a slow
104
- * relay, a busy peer. The rule is simply that we do not tear down the channel an answer is due
105
- * on until it has arrived or we have given up on it.
106
- */
107
- /** Waits for THE DIALED HOLDER'S answer — any other holder's ack must not resolve it (H1). */
108
- awaitAck(envelopeHash: string, expectedAckerAgentId: string, timeoutMs: number): Promise<{
109
- admitted: boolean;
110
- } | null>;
111
- /**
112
- * Try to fill this session's ordering gaps, so anything HELD can be released.
113
- *
114
- * Without it the grace above cannot help in the very case it was written for. An ack whose
115
- * canonical sequence lands ahead of our tree is HELD, and held content is not routed to the
116
- * document layer at all — it waits for `#releaseHeld`, which only runs when the missing
117
- * in-between sequence arrives. So the ack sits in a buffer, nothing settles, the grace expires in
118
- * full, and the seal then discards it. The wait alone converted a fast silent failure into a slow
119
- * one.
120
- *
121
- * A no-op when the session has no gap, so the ordinary delivery pays nothing.
122
- */
123
- drainHeld(sessionId: string, correlationId: string): Promise<void>;
124
83
  logger: Logger;
125
84
  }
126
- /**
127
- * How long a session WE opened stays up waiting for the peer's answer.
128
- *
129
- * Sized against the observed round trip, not guessed: on a live cross-region session the ack was
130
- * on the wire ~375ms after the frame landed, and the seal ceremony itself takes ~3s. Ten seconds
131
- * covers a slow relay and a park-and-recover round without keeping an autonomous session alive
132
- * long enough to be mistaken for a conversation.
133
- */
134
- export declare const DELIVERY_ACK_GRACE_MS = 10000;
135
85
  /**
136
86
  * Everything this transport sends is document-domain traffic, so 0x04 is the default rather than
137
87
  * something each call site remembers. A refusal overrides it with 0x05 — the two are distinguished
@@ -145,6 +95,45 @@ export declare const DELIVERY_ACK_GRACE_MS = 10000;
145
95
  * this path submitted every document leaf as a MESSAGE.
146
96
  */
147
97
  export declare const DOCUMENT_LEAF_KIND = 4;
98
+ /**
99
+ * The document frame carrier (SYNC-P4: D1/D2/D4 deleted — this used to live in the delivery
100
+ * worker's module). Two capabilities survive: a reachability probe, and putting already-encoded
101
+ * bytes on a session the transport opens or reuses then seals. There is no `deliver` and no ack
102
+ * wait — content confirmation is the peer's position at the next reconcile exchange.
103
+ */
104
+ export interface DocumentDeliveryTransport {
105
+ /**
106
+ * Is the peer reachable right now? `discovery_lookup` today. Returns false rather than throwing
107
+ * for an ordinary "not online"; a throw means the LOOKUP failed, which is a different fact and
108
+ * must not be recorded as the peer being away.
109
+ */
110
+ isPeerReachable(peerAgentId: string, correlationId: string): Promise<{
111
+ reachable: boolean;
112
+ unknownAgent: boolean;
113
+ }>;
114
+ /**
115
+ * Send already-encoded bytes to a peer over the open-or-reuse-then-seal path. `documentId` is
116
+ * for the log line only. `parked: true` means the relay took it because the peer had no live
117
+ * counterparty — it is NOT with them yet, and only the next exchange proves anything landed.
118
+ */
119
+ sendBytes(input: {
120
+ peerAgentId: string;
121
+ documentId: string;
122
+ bytes: Uint8Array;
123
+ correlationId: string;
124
+ /** The witnessed leaf DOMAIN. Defaults to the document kind (0x04); a refusal passes 0x05. */
125
+ leafKind?: number;
126
+ }): Promise<{
127
+ ok: true;
128
+ sessionId: string;
129
+ sessionOpened: boolean;
130
+ parked?: boolean;
131
+ } | {
132
+ ok: false;
133
+ reason: string;
134
+ detail?: string;
135
+ }>;
136
+ }
148
137
  export declare function createDocumentDeliveryTransport(deps: DocumentTransportDeps): DocumentDeliveryTransport;
149
138
  export { DiscoveryUnavailableError };
150
139
  //# sourceMappingURL=document-delivery-transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-delivery-transport.d.ts","sourceRoot":"","sources":["../src/document-delivery-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAA6B,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,KAAK,E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12,8 @@
12
12
  * because opening is the expensive half — a directory negotiation, a dial, and a seal — and a
13
13
  * backlog of pending envelopes for one peer would otherwise pay it per envelope. It is also the
14
14
  * behaviour an operator expects when they are mid-conversation about the document: the change lands
15
- * in the same sealed record as the discussion, without anyone passing a session hint.
16
- *
17
- * An explicit `sessionHint` overrides the choice but NOT the validation — a hint naming a session
18
- * that is not active with this peer is refused rather than silently replaced by the daemon's own
19
- * pick, because the one reason to pass a hint is to control which sealed record the change lands
20
- * in, and quietly choosing a different one defeats exactly that.
15
+ * in the same sealed record as the discussion. (SYNC-D10: the explicit session hint is deleted —
16
+ * the daemon's reuse-most-recent choice is the whole rule.)
21
17
  *
22
18
  * ── WHAT AN ACK IS HERE, AND WHAT IT IS NOT ───────────────────────────────────────────────────
23
19
  *
@@ -37,15 +33,6 @@ import { wireContentHash } from "./wire-content-hash.js";
37
33
  import { reachabilityFromDiscovery, DiscoveryUnavailableError } from "./document-reachability.js";
38
34
  import { LEAF_KIND_DOC } from "./session-relay-client.js";
39
35
  import { createSessionSuspects, TERMINAL_ISH_REFUSALS } from "./delivery-session-suspects.js";
40
- /**
41
- * How long a session WE opened stays up waiting for the peer's answer.
42
- *
43
- * Sized against the observed round trip, not guessed: on a live cross-region session the ack was
44
- * on the wire ~375ms after the frame landed, and the seal ceremony itself takes ~3s. Ten seconds
45
- * covers a slow relay and a park-and-recover round without keeping an autonomous session alive
46
- * long enough to be mistaken for a conversation.
47
- */
48
- export const DELIVERY_ACK_GRACE_MS = 10_000;
49
36
  /**
50
37
  * Everything this transport sends is document-domain traffic, so 0x04 is the default rather than
51
38
  * something each call site remembers. A refusal overrides it with 0x05 — the two are distinguished
@@ -85,40 +72,14 @@ export function createDocumentDeliveryTransport(deps) {
85
72
  suspects.noteSuccess(sessionId);
86
73
  }
87
74
  /**
88
- * Acquire a session with the peer — the hint, then the most recent active one, then a fresh dial.
75
+ * Acquire a session with the peer — the most recent active one, else a fresh dial (SYNC-D10).
89
76
  *
90
77
  * ONE implementation for every document frame kind. A proposal that opened its own session by a
91
78
  * separate code path would drift on which session gets reused and on whether a session this
92
79
  * daemon opened is sealed, and both are unrecoverable after the fact.
93
80
  */
94
- async function acquireSession(peerAgentId, sessionHint, correlationId) {
81
+ async function acquireSession(peerAgentId, correlationId) {
95
82
  const active = deps.activeSessionsWith(deps.agentName, peerAgentId);
96
- if (sessionHint !== undefined) {
97
- if (!active.includes(sessionHint)) {
98
- // Refused, not replaced. The only reason to pass a hint is to control which sealed record
99
- // the change lands in; quietly substituting the daemon's own pick would defeat exactly
100
- // that, and it would do so silently.
101
- return {
102
- ok: false,
103
- reason: "document_session_hint_invalid",
104
- detail: `session ${sessionHint.slice(0, 16)}… is not an active session with ${peerAgentId}, ` +
105
- `so the change cannot be placed in that record`,
106
- };
107
- }
108
- if (suspects.isSuspect(sessionHint)) {
109
- // HONOURED, NOT SUBSTITUTED — the only reason to pass a hint is to control which sealed
110
- // record the change lands in, and quietly picking another session would defeat exactly
111
- // that. But a caller aiming at a session whose record is gone should be told.
112
- deps.logger.warn("document.delivery.session.hint_suspect", {
113
- peerAgentId,
114
- sessionId: sessionHint,
115
- correlationId,
116
- impact: "this session has answered terminally more than once — the change is being placed in " +
117
- "it as asked, and its record may no longer be growing",
118
- });
119
- }
120
- return { ok: true, sessionId: sessionHint, sessionOpened: false };
121
- }
122
83
  // Most recent LAST — activeSessionsWith is ordered oldest-first by the daemon's adapter.
123
84
  //
124
85
  // DOD-MP-SESSION-RETIRE-1 — a session that has answered terminally more than once is skipped
@@ -160,8 +121,8 @@ export function createDocumentDeliveryTransport(deps) {
160
121
  return reachabilityFromDiscovery(outcome);
161
122
  },
162
123
  async sendBytes(input) {
163
- const { peerAgentId, documentId, bytes, sessionHint, correlationId } = input;
164
- const session = await acquireSession(peerAgentId, sessionHint, correlationId);
124
+ const { peerAgentId, documentId, bytes, correlationId } = input;
125
+ const session = await acquireSession(peerAgentId, correlationId);
165
126
  if (!session.ok)
166
127
  return session;
167
128
  // THE WIRE HASH, domain-separated. This was `sha256(bytes)`, and the receiver recomputes
@@ -222,117 +183,6 @@ export function createDocumentDeliveryTransport(deps) {
222
183
  parked: sent.delivered === false,
223
184
  };
224
185
  },
225
- async deliver(input) {
226
- const { peerAgentId, documentId, envelope, sessionHint, correlationId } = input;
227
- const session = await acquireSession(peerAgentId, sessionHint, correlationId);
228
- if (!session.ok)
229
- return session;
230
- const { sessionId, sessionOpened } = session;
231
- const { bytes, hash } = deps.encodeEnvelope(envelope);
232
- const sent = await deps.sendContent(deps.agentName, sessionId, bytes, hash, correlationId, DOCUMENT_LEAF_KIND);
233
- // DOD-MP-SESSION-RETIRE-1 — same accounting on the envelope path. Both paths acquire through
234
- // `acquireSession`, so a session judged on one is skipped by the other; splitting the record
235
- // would let a session that keeps refusing envelopes still be picked for the next frame.
236
- noteSendOutcome(sessionId, sent);
237
- if (sent.ok)
238
- deps.appendLeaf(deps.agentName, sessionId, hash, correlationId);
239
- if (!sent.ok) {
240
- // SEAL WHAT WE OPENED, on the failure path too. This branch walked away from a session it
241
- // had just dialled — a live node the operator never started, with no sealed record, which
242
- // is precisely what the rule twenty lines below says the seal exists to prevent. A failed
243
- // send is when it is most likely to happen, not least.
244
- if (sessionOpened)
245
- await deps.sealSession(deps.agentName, sessionId, correlationId);
246
- return { ok: false, reason: sent.reason, detail: sent.error };
247
- }
248
- deps.logger.info("document.delivery.sent", {
249
- documentId,
250
- sessionId,
251
- sessionOpened,
252
- parked: sent.delivered === false,
253
- correlationId,
254
- });
255
- // SEAL what we opened. §16.4: the autonomous session still happens because it carries
256
- // signing, encryption and the seal — the ceremony goes to zero, the seal does not. A session
257
- // this adapter opened and walked away from is a live node the operator never started, and
258
- // the sealed record the design exists to produce is never produced. A session we REUSED is
259
- // not ours to close: its owner decides when that conversation ends.
260
- // PARKED CONTENT CANNOT BE ACKED, so waiting for one is spending the pass budget on a
261
- // certainty. `delivered: false` means the peer was offline and the relay took the frame; the
262
- // ack comes whenever they next come online, which is not within any grace. Waiting here also
263
- // fired `ack_grace_expired` on a designed, benign state — a warning on the normal case.
264
- const answerPossible = sent.delivered !== false;
265
- // The peer's ANSWER, when one arrives inside the grace. Reported back as `admitted` so the
266
- // worker records a settled delivery instead of an in-flight one.
267
- let settlement = null;
268
- if (sessionOpened && answerPossible && input.ackGraceMs > 0) {
269
- // WAIT FOR THE ANSWER BEFORE TEARING DOWN THE CHANNEL IT COMES BACK ON.
270
- //
271
- // The seal destroys the session, and the teardown drops content still held for ordering.
272
- // Sealing straight after the send therefore raced the peer's ack and, on a real network,
273
- // lost: 90 re-sends of one envelope against a ceiling of 5.
274
- //
275
- // A REUSED session is untouched by this — it is not ours to close, so its owner keeps it
276
- // alive and the ack has all the time it needs. That asymmetry is exactly why every spine
277
- // enforcer passed: they open a conversation first, so the worker always reused one.
278
- // The SMALLER of this envelope's share and the standard grace. The caller spends a budget
279
- // across the whole sweep pass; see DELIVERY_ACK_GRACE_BUDGET_MS.
280
- const graceMs = Math.min(DELIVERY_ACK_GRACE_MS, input.ackGraceMs);
281
- // UNSTICK BEFORE WAITING. If the ack is already sitting in the hold buffer, no amount of
282
- // waiting produces it — the release is driven by the missing sequence arriving, not by
283
- // time. Ordering-complete sessions return immediately.
284
- // CONTAINED. A drain failure must not fail a delivery whose content has already left — the
285
- // same contract the ack itself has. Uncontained, a relay hiccup during the drain would
286
- // surface as `document_delivery_threw` and re-send content the peer already holds.
287
- await deps.drainHeld(sessionId, correlationId).catch((err) => {
288
- deps.logger.warn("document.delivery.drain_threw", {
289
- documentId,
290
- sessionId,
291
- correlationId,
292
- reason: err instanceof Error ? err.message : String(err),
293
- });
294
- });
295
- settlement = await deps.awaitAck(envelope.envelopeHash, input.peerAgentId, graceMs);
296
- if (!settlement) {
297
- // NOT a failure of the send — the content left and the peer may still answer later. Said
298
- // out loud because a seal that discards a held ack is otherwise invisible, and this is
299
- // the only moment anything knows it is about to happen.
300
- deps.logger.warn("document.delivery.ack_grace_expired", {
301
- documentId,
302
- envelopeHash: envelope.envelopeHash,
303
- sessionId,
304
- graceMs,
305
- correlationId,
306
- });
307
- }
308
- }
309
- // SEAL WHAT WE OPENED — unconditionally, whether or not we waited. The wait is about giving
310
- // an answer time to arrive; the seal is about never leaving an autonomous session running.
311
- // Making the seal conditional on the wait would trade one defect for a worse one.
312
- if (sessionOpened) {
313
- await deps.sealSession(deps.agentName, sessionId, correlationId);
314
- }
315
- // SENT, NOT ACKED — `admitted: null`. The content left (or was parked for an offline peer),
316
- // which is a transport fact; the DoD's ack is the peer's daemon confirming admission, and
317
- // that answer comes from the inbound document handler, which is its own line.
318
- //
319
- // Neither of the two-valued answers is available honestly. `true` would mark the envelope
320
- // acknowledged in the log while the peer may never have applied it — and the log being right
321
- // about what the peer holds is the entire reason pending is derived from it. `false` would
322
- // count a send that WORKED as a failure and re-send content already in flight, which is the
323
- // permanent-redelivery shape this milestone already fixed once.
324
- // THE ANSWER IF WE HAVE IT. `null` still means "left, unanswered" — the honest third state —
325
- // but an ack that landed inside the grace is no longer thrown away as if it had not.
326
- return {
327
- ok: true,
328
- sessionId,
329
- sessionOpened,
330
- admitted: settlement ? settlement.admitted : null,
331
- // PARKED, reported rather than inferred. The worker cannot tell it from an ordinary
332
- // awaiting-answer send otherwise, and the two need different retry schedules.
333
- parked: sent.delivered === false,
334
- };
335
- },
336
186
  };
337
187
  }
338
188
  export { DiscoveryUnavailableError };
@@ -1 +1 @@
1
- {"version":3,"file":"document-delivery-transport.js","sourceRoot":"","sources":["../src/document-delivery-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAElG,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;A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Aa,CAAC,CAAC;gBACpG,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;YAChE,CAAC;YACD,6EAA6E;YAC7E,EAAE;YACF,8FAA8F;YAC9F,6FAA6F;YAC7F,6FAA6F;YAC7F,8FAA8F;YAC9F,8DAA8D;YAC9D,EAAE;YACF,2FAA2F;YAC3F,yFAAyF;YACzF,0FAA0F;YAC1F,SAAS;YACT,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;YACxE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE;gBACtC,UAAU;gBACV,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,MAAM,EAAE,IAAI,CAAC,SAAS,KAAK,KAAK;gBAChC,aAAa;aACd,CAAC,CAAC;YACH,IAAI,OAAO,CAAC,aAAa;gBAAE,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;YACpG,8FAA8F;YAC9F,6FAA6F;YAC7F,8FAA8F;YAC9F,8FAA8F;YAC9F,wCAAwC;YACxC,OAAO;gBACL,EAAE,EAAE,IAAI;gBACR,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,MAAM,EAAE,IAAI,CAAC,SAAS,KAAK,KAAK;aACjC,CAAC;QACJ,CAAC;KAEF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -67,7 +67,6 @@
67
67
  * The guard must never again be described as what makes hostile input safe. It was, and it was not.
68
68
  */
69
69
  import type { DocumentInbound } from "./document-inbound.js";
70
- import type { DocumentAckInbound } from "./document-ack-inbound.js";
71
70
  import type { Logger } from "./types.js";
72
71
  /**
73
72
  * What the session layer should do with the frame.
@@ -76,7 +75,7 @@ import type { Logger } from "./types.js";
76
75
  * message and fires the doorbell exactly as before. Nothing about the conversation path changes.
77
76
  */
78
77
  /** Every document frame kind that can arrive on the session channel. */
79
- export type DocumentFrameKind = "update" | "ack" | "proposal" | "rejection" | "proposal_ack" | "control" | "join_offer" | "join_answer" | "amendment";
78
+ export type DocumentFrameKind = "update" | "proposal" | "rejection" | "proposal_ack" | "amendment" | "reconcile";
80
79
  export type FrameRouting = {
81
80
  consumed: false;
82
81
  } | {
@@ -101,7 +100,6 @@ export type FrameClassification = {
101
100
  };
102
101
  export interface DocumentFrameRouterDeps {
103
102
  inbound: DocumentInbound;
104
- ackInbound: DocumentAckInbound;
105
103
  /**
106
104
  * Record an arriving PROPOSAL. Without this a proposal frame is not document traffic as far as
107
105
  * the router is concerned, so it falls through to the conversation path and lands in the
@@ -121,14 +119,10 @@ export interface DocumentFrameRouterDeps {
121
119
  * conversation path and the operator keeps publishing into a document that will never answer,
122
120
  * with nothing on their screen explaining why.
123
121
  */
124
- recordControl(ownerAgentId: string, wire: Uint8Array, nowMs: number): void;
125
122
  /**
126
123
  * M14B / DOD-MP-JOIN-1 — an admin's offer to a third party. Validated (the invitee REPLAYS the
127
124
  * carried bytes) and recorded — pending or refused-with-reason, never dropped.
128
125
  */
129
- recordJoinOffer(ownerAgentId: string, wire: Uint8Array, nowMs: number): void;
130
- /** The invitee's signed answer to an offer we authored. Settle-once. */
131
- recordJoinAnswer(ownerAgentId: string, wire: Uint8Array, nowMs: number): void;
132
126
  /**
133
127
  * An amendment reaching an EXISTING holder — validated against our own chain
134
128
  * (validate-before-append) and appended, so our derived participant set does not silently
@@ -136,6 +130,16 @@ export interface DocumentFrameRouterDeps {
136
130
  * gate makes a missed one loud.
137
131
  */
138
132
  recordAmendment(ownerAgentId: string, wire: Uint8Array, nowMs: number): void;
133
+ /**
134
+ * SYNC-P3 — answer (or absorb) a reconcile exchange. Needs the SESSION's authenticated sender:
135
+ * the frame is unsigned by design, and entitlement (R17/R18) is a question about who is
136
+ * ASKING, which only the transport identity can answer. Everything the frame carries is still
137
+ * individually signed and verified on apply.
138
+ */
139
+ handleReconcile(ownerAgentId: string, wire: Uint8Array, senderAgentId: string, nowMs: number, correlationId: string): Promise<{
140
+ ok: boolean;
141
+ reason?: string;
142
+ }>;
139
143
  /**
140
144
  * Tell the sender what happened to their envelope — admitted or refused, both of which SETTLE it.
141
145
  *
@@ -163,14 +167,6 @@ export interface DocumentFrameRouterDeps {
163
167
  noticeInboundUpdate(ownerAgentId: string, inResponseTo: Uint8Array): void;
164
168
  /** Put an already-signed frame on the wire to whoever authored `wire` — the rejection, today. */
165
169
  sendFrameToPeer(ownerAgentId: string, inResponseTo: Uint8Array, bytes: Uint8Array): Promise<void>;
166
- sendAck(ownerAgentId: string,
167
- /** The envelope as it arrived — the document id and the party to answer are both inside it. */
168
- wire: Uint8Array, outcome: {
169
- envelopeHash: string;
170
- admitted: boolean;
171
- rejectionReason?: string;
172
- correlationId: string;
173
- }): Promise<void>;
174
170
  /**
175
171
  * Map the daemon's AGENT NAME — the only identifier the session content path carries — to the
176
172
  * stable owner key every document row is scoped by (M14-D5: our own K_local pubkey hex).
@@ -209,9 +205,9 @@ export declare class DocumentFrameRouter {
209
205
  * a per-document queue — see `#handle` — so the caller never waits and frames for one document
210
206
  * never overtake each other.
211
207
  */
212
- routeSync(agentName: string, content: Uint8Array, nowMs: number, correlationId: string): FrameClassification;
208
+ routeSync(agentName: string, content: Uint8Array, nowMs: number, correlationId: string, senderAgentId?: string): FrameClassification;
213
209
  /** Classify and handle, awaiting the outcome. The path a caller takes when it wants the verdict. */
214
- route(ownerAgentId: string, content: Uint8Array, nowMs: number, correlationId: string): Promise<FrameRouting>;
210
+ route(ownerAgentId: string, content: Uint8Array, nowMs: number, correlationId: string, senderAgentId?: string): Promise<FrameRouting>;
215
211
  }
216
212
  /**
217
213
  * The largest field count a document frame can declare. The update envelope has 10 fields and the
@@ -1 +1 @@
1
- {"version":3,"file":"document-frame-router.d.ts","sourceRoot":"","sources":["../src/document-frame-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAcH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;GAKG;AACH,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,KAAK,GACL,UAAU,GACV,WAAW,GACX,cAAc,GACd,SAAS,GACT,YAAY,GACZ,aAAa,GACb,WAAW,CAAC;AAEhB,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,EAAE,KAAK,CAAA;CAAE,GACnB;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,EAAE,KAAK,CAAA;CAAE,GACnB;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAEhD,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,kBAAkB,CAAC;IAC/B;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5E,wEAAwE;IACxE,eAAe,CAAC,YAAY,EA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