@cello-protocol/daemon 0.0.214 → 0.0.216

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 (93) hide show
  1. package/dist/attendance-wiring.d.ts +0 -2
  2. package/dist/attendance-wiring.d.ts.map +1 -1
  3. package/dist/attendance-wiring.js +2 -6
  4. package/dist/attendance-wiring.js.map +1 -1
  5. package/dist/boot-connection-state.d.ts +0 -2
  6. package/dist/boot-connection-state.d.ts.map +1 -1
  7. package/dist/boot-connection-state.js +5 -46
  8. package/dist/boot-connection-state.js.map +1 -1
  9. package/dist/close-session-handler.d.ts.map +1 -1
  10. package/dist/close-session-handler.js +34 -9
  11. package/dist/close-session-handler.js.map +1 -1
  12. package/dist/co-attendance.d.ts +8 -72
  13. package/dist/co-attendance.d.ts.map +1 -1
  14. package/dist/co-attendance.js +8 -116
  15. package/dist/co-attendance.js.map +1 -1
  16. package/dist/daemon.js +2 -7
  17. package/dist/daemon.js.map +1 -1
  18. package/dist/disconnect-cleanup.d.ts +0 -1
  19. package/dist/disconnect-cleanup.d.ts.map +1 -1
  20. package/dist/disconnect-cleanup.js +1 -9
  21. package/dist/disconnect-cleanup.js.map +1 -1
  22. package/dist/frame-values.d.ts.map +1 -1
  23. package/dist/frame-values.js +4 -7
  24. package/dist/frame-values.js.map +1 -1
  25. package/dist/reply-lag.d.ts +11 -0
  26. package/dist/reply-lag.d.ts.map +1 -0
  27. package/dist/reply-lag.js +46 -0
  28. package/dist/reply-lag.js.map +1 -0
  29. package/dist/resume-last-seen.d.ts +15 -0
  30. package/dist/resume-last-seen.d.ts.map +1 -0
  31. package/dist/resume-last-seen.js +44 -0
  32. package/dist/resume-last-seen.js.map +1 -0
  33. package/dist/seal-coordinator.js +2 -2
  34. package/dist/seal-coordinator.js.map +1 -1
  35. package/dist/seal-legibility-tbs.d.ts.map +1 -1
  36. package/dist/seal-legibility-tbs.js +2 -3
  37. package/dist/seal-legibility-tbs.js.map +1 -1
  38. package/dist/sealed-conversation.d.ts +36 -0
  39. package/dist/sealed-conversation.d.ts.map +1 -0
  40. package/dist/sealed-conversation.js +142 -0
  41. package/dist/sealed-conversation.js.map +1 -0
  42. package/dist/session-content-handlers.d.ts +0 -17
  43. package/dist/session-content-handlers.d.ts.map +1 -1
  44. package/dist/session-content-handlers.js +122 -288
  45. package/dist/session-content-handlers.js.map +1 -1
  46. package/dist/session-content-ingest.d.ts.map +1 -1
  47. package/dist/session-content-ingest.js +9 -3
  48. package/dist/session-content-ingest.js.map +1 -1
  49. package/dist/session-content-send.js +1 -1
  50. package/dist/session-content-send.js.map +1 -1
  51. package/dist/session-delivery-acks.d.ts +15 -41
  52. package/dist/session-delivery-acks.d.ts.map +1 -1
  53. package/dist/session-delivery-acks.js +26 -131
  54. package/dist/session-delivery-acks.js.map +1 -1
  55. package/dist/session-notify.js +1 -1
  56. package/dist/session-notify.js.map +1 -1
  57. package/dist/session-queries.d.ts +1 -1
  58. package/dist/session-queries.js +1 -1
  59. package/dist/session-read-handlers.d.ts.map +1 -1
  60. package/dist/session-read-handlers.js +58 -96
  61. package/dist/session-read-handlers.js.map +1 -1
  62. package/dist/session-records.d.ts +4 -0
  63. package/dist/session-records.d.ts.map +1 -1
  64. package/dist/session-records.js +34 -1
  65. package/dist/session-records.js.map +1 -1
  66. package/dist/session-relay-client.d.ts +2 -0
  67. package/dist/session-relay-client.d.ts.map +1 -1
  68. package/dist/session-relay-client.js +15 -14
  69. package/dist/session-relay-client.js.map +1 -1
  70. package/dist/session-relay.d.ts.map +1 -1
  71. package/dist/session-relay.js +3 -2
  72. package/dist/session-relay.js.map +1 -1
  73. package/dist/session-schema.d.ts.map +1 -1
  74. package/dist/session-schema.js +31 -0
  75. package/dist/session-schema.js.map +1 -1
  76. package/dist/session-seal-leaf-store.d.ts +10 -0
  77. package/dist/session-seal-leaf-store.d.ts.map +1 -1
  78. package/dist/session-seal-leaf-store.js +18 -0
  79. package/dist/session-seal-leaf-store.js.map +1 -1
  80. package/dist/session-seal.d.ts.map +1 -1
  81. package/dist/session-seal.js +46 -11
  82. package/dist/session-seal.js.map +1 -1
  83. package/dist/session-terminal-refusal.d.ts +3 -0
  84. package/dist/session-terminal-refusal.d.ts.map +1 -1
  85. package/dist/session-terminal-refusal.js +21 -0
  86. package/dist/session-terminal-refusal.js.map +1 -1
  87. package/dist/telegram-doorbell.js +1 -1
  88. package/dist/telegram-doorbell.js.map +1 -1
  89. package/dist/withheld-content.d.ts +13 -0
  90. package/dist/withheld-content.d.ts.map +1 -0
  91. package/dist/withheld-content.js +46 -0
  92. package/dist/withheld-content.js.map +1 -0
  93. package/package.json +5 -5
@@ -82,6 +82,21 @@ export declare function storeDeliveryAck(db: DaemonDatabase, logger: Logger, a:
82
82
  signature: Uint8Array;
83
83
  correlationId?: string;
84
84
  }): boolean;
85
+ /**
86
+ * Keep a copy of the acknowledgement THIS side signed for a message it received, so the seal
87
+ * answer can show it. Without it the only copy left with the sender, and a received message read
88
+ * as unacknowledged from this side forever. A write failure is logged and not fatal: the
89
+ * acknowledgement still goes out.
90
+ */
91
+ export declare function storeGivenDeliveryAck(db: DaemonDatabase, logger: Logger, a: {
92
+ agentId: string;
93
+ agentName: string;
94
+ sessionId: string;
95
+ contentHashHex: string;
96
+ signerPubkeyHex: string;
97
+ signature: Uint8Array;
98
+ correlationId?: string;
99
+ }): void;
85
100
  /**
86
101
  * DOD-M15-DELIVERYACK-1 rule 2, at the database — did this side put these exact bytes on the wire in
87
102
  * this session?
@@ -151,45 +166,4 @@ export declare function acceptParkedDeliveryAck(a: {
151
166
  ok: false;
152
167
  reason: string;
153
168
  };
154
- /**
155
- * DOD-M15-DELIVERYACK-1 — the three facts, per message this side SENT, each standing alone.
156
- *
157
- * ⚠️ READ THE ASYMMETRY BEFORE USING THIS. Each fact is present or absent on its own and a
158
- * missing one is reported as missing and NOTHING MORE. There is deliberately no combined status,
159
- * no derived verdict, and no count — a message can be delivered, read and acted on with no
160
- * acknowledgement recorded here, because the acknowledgement can be lost exactly as the message
161
- * can. Anything that renders absence as fault is a defect, not a display choice.
162
- *
163
- * ordered — the RELAY assigned it a position. Read from `relay_ack_receipts`, which holds
164
- * the relay's own countersignature, scoped to THIS agent's pubkey so a loopback
165
- * session's two ends never read each other's.
166
- * delivered — the RELAY handed the bytes over. **This side holds no such evidence for any
167
- * message today, on either path**: the relay answers the RECIPIENT on pickup and
168
- * never tells the depositor. It is reported absent with that reason named rather
169
- * than fabricated from "our own send succeeded", which would be this machine
170
- * asserting a relay fact about itself. `069-ORDERPROOF` plus a pickup notice to
171
- * the depositor is what fills it.
172
- * acknowledged — the RECIPIENT's own signature, from `delivery_acks`.
173
- */
174
- export declare function readDeliveryFacts(db: DaemonDatabase, logger: Logger, agentId: string, sessionId: string): Array<{
175
- seq: number | null;
176
- content_hash: string;
177
- ordered: {
178
- asserted_by: "relay";
179
- relay_id: string;
180
- relay_timestamp: number;
181
- signature: string;
182
- } | null;
183
- delivered: {
184
- asserted_by: "relay";
185
- held: false;
186
- why_absent: string;
187
- };
188
- acknowledged: {
189
- asserted_by: "recipient";
190
- signer_pubkey: string;
191
- signature: string;
192
- recorded_at: number;
193
- } | null;
194
- }>;
195
169
  //# sourceMappingURL=session-delivery-acks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-delivery-acks.d.ts","sourceRoot":"","sources":["../src/session-delivery-acks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAyD,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGnH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAkCzC;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,6BAA6B,EAClC,SAAS,EAAE,MAAM,EACjB,SAAS,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EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,UAAU,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACA,IAAI,CAiBN;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,cAAc,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,GACrB,OAAO,CAYT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE;IACzC,EAAE,EAAE,cAAc,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,cAAc,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,GAAG,EAAE,iBAAiB,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA6F/C"}
@@ -148,6 +148,9 @@ export async function sendDeliveryAck(ctx, agentName, sessionId, contentHash, co
148
148
  // this log claimed the ACK went out while the sender's TTF fired and parked, and the abort in
149
149
  // the catch below (the thing that frees the stream slot) became unreachable.
150
150
  await stream.close();
151
+ // Our own copy, kept only once it went out, so the seal answer never shows an acknowledgement
152
+ // the sender does not hold. The parked route keeps its copy when the mailbox accepts it.
153
+ ctx.records.recordGivenDeliveryAck(agentName, sessionId, Buffer.from(contentHash).toString("hex"), ackSig, correlationId);
151
154
  // AFTER the close, because that is when it is true. The receiver-side counterpart to the
152
155
  // sender's content.delivery.acked: B has acknowledged this content `persisted`, so the sender
153
156
  // stops retrying/parking. Emitted for BOTH a normally delivered message AND a terminal-screen
@@ -219,6 +222,7 @@ why) {
219
222
  const slotHex = Buffer.from(parkedDeliveryAckMailboxHash(sessionId, contentHash)).toString("hex");
220
223
  const attempt = await ctx.park.parkOutOfBand(agentName, sessionId, slotHex, payload);
221
224
  if (attempt.outcome === "parked") {
225
+ ctx.records.recordGivenDeliveryAck(agentName, sessionId, hashHex, ackSig, correlationId);
222
226
  ctx.logger.info("content.delivery.ack.parked", {
223
227
  agentName, sessionId, contentHash: hashHex, correlationId, why,
224
228
  impact: "the sender could not be reached directly, so the acknowledgement is waiting in the " +
@@ -401,6 +405,28 @@ export function storeDeliveryAck(db, logger, a) {
401
405
  return false;
402
406
  }
403
407
  }
408
+ /**
409
+ * Keep a copy of the acknowledgement THIS side signed for a message it received, so the seal
410
+ * answer can show it. Without it the only copy left with the sender, and a received message read
411
+ * as unacknowledged from this side forever. A write failure is logged and not fatal: the
412
+ * acknowledgement still goes out.
413
+ */
414
+ export function storeGivenDeliveryAck(db, logger, a) {
415
+ try {
416
+ db.prepare(`INSERT OR IGNORE INTO delivery_acks_given
417
+ (agent_id, session_id, content_hash_hex, signer_pubkey, signature, recorded_at)
418
+ VALUES (?, ?, ?, ?, ?, ?)`).run(a.agentId, a.sessionId, a.contentHashHex, a.signerPubkeyHex, Buffer.from(a.signature), Date.now());
419
+ }
420
+ catch (err) {
421
+ logger.error("content.delivery.ack.given.record.failed", {
422
+ agentName: a.agentName, sessionId: a.sessionId, contentHash: a.contentHashHex, correlationId: a.correlationId,
423
+ reason: extractErrorMessage(err),
424
+ impact: "the acknowledgement was signed and sent, but this side kept no copy, so its seal answer " +
425
+ "will show this received message without a delivery signature",
426
+ guidance: "This is a LOCAL storage fault. Check free disk space and that the agent's database is writable.",
427
+ });
428
+ }
429
+ }
404
430
  /**
405
431
  * DOD-M15-DELIVERYACK-1 rule 2, at the database — did this side put these exact bytes on the wire in
406
432
  * this session?
@@ -540,135 +566,4 @@ export function acceptParkedDeliveryAck(a) {
540
566
  }
541
567
  return { ok: true };
542
568
  }
543
- /**
544
- * DOD-M15-DELIVERYACK-1 — the three facts, per message this side SENT, each standing alone.
545
- *
546
- * ⚠️ READ THE ASYMMETRY BEFORE USING THIS. Each fact is present or absent on its own and a
547
- * missing one is reported as missing and NOTHING MORE. There is deliberately no combined status,
548
- * no derived verdict, and no count — a message can be delivered, read and acted on with no
549
- * acknowledgement recorded here, because the acknowledgement can be lost exactly as the message
550
- * can. Anything that renders absence as fault is a defect, not a display choice.
551
- *
552
- * ordered — the RELAY assigned it a position. Read from `relay_ack_receipts`, which holds
553
- * the relay's own countersignature, scoped to THIS agent's pubkey so a loopback
554
- * session's two ends never read each other's.
555
- * delivered — the RELAY handed the bytes over. **This side holds no such evidence for any
556
- * message today, on either path**: the relay answers the RECIPIENT on pickup and
557
- * never tells the depositor. It is reported absent with that reason named rather
558
- * than fabricated from "our own send succeeded", which would be this machine
559
- * asserting a relay fact about itself. `069-ORDERPROOF` plus a pickup notice to
560
- * the depositor is what fills it.
561
- * acknowledged — the RECIPIENT's own signature, from `delivery_acks`.
562
- */
563
- export function readDeliveryFacts(db, logger, agentId, sessionId) {
564
- /**
565
- * ⚠️ AN EMPTY PUBKEY HERE WOULD BLANK EVERY `ordered` FACT IN THE RECEIPT, and silently.
566
- *
567
- * The relay receipts are scoped by this agent's own key, so `?? ""` would match no rows and every
568
- * message would report `ordered: null` — indistinguishable from a relay that never countersigned
569
- * anything. The caller has already resolved the agent id, so the row must exist; an empty value
570
- * is a LOCAL fault and it says so rather than answering with a plausible emptiness.
571
- */
572
- const agentPubkey = db.prepare("SELECT k_local_pubkey FROM agents WHERE agent_id = ?").get(agentId)?.k_local_pubkey ?? "";
573
- if (!agentPubkey) {
574
- logger.error("session.delivery.facts.agent_pubkey_missing", {
575
- agentId,
576
- sessionId,
577
- impact: "this receipt will report every message as NOT ordered by the relay, although the relay " +
578
- "may well have ordered them — the relay's records are keyed by this agent's own public " +
579
- "key and this machine could not find it. Read the absence of `ordered` here as unknown, " +
580
- "not as a fact about the relay",
581
- guidance: "This is a LOCAL fault: the agent row exists but carries no identity key. Check " +
582
- "cello_status for this agent and restart it; nothing about the conversation is affected.",
583
- });
584
- }
585
- /**
586
- * ⚠️ THE ROW KEY IS THE CONTENT HASH, NOT THE SEQUENCE, AND IT HAD TO BE.
587
- *
588
- * The first version drove this list from `transcript WHERE direction = 'sent'` and joined out
589
- * to the leaf for its hash. That reports nothing at all for a message whose leaf never landed —
590
- * which is exactly the message a reader most needs to see, because a send that never got a
591
- * position is one of the blameless ways a message goes missing. Keying on the hash means every
592
- * message this side has ANY evidence about appears, and each of the three facts is then
593
- * independently present or absent on it. `seq` joins in when this side holds a leaf and is null
594
- * when it does not; a null there is the ordinary shape, not a fault.
595
- */
596
- const seqByHash = new Map();
597
- for (const l of db
598
- .prepare(`SELECT l.leaf_index AS seq, l.leaf_hash_hex AS hash_hex
599
- FROM session_tree_leaves l
600
- JOIN transcript t
601
- ON t.agent_id = l.agent_id AND t.session_id = l.session_id AND t.sequence = l.leaf_index
602
- WHERE l.agent_id = ? AND l.session_id = ? AND t.direction = 'sent'`)
603
- .all(agentId, sessionId)) {
604
- seqByHash.set(l.hash_hex, l.seq);
605
- }
606
- const receipts = new Map();
607
- /**
608
- * `relay_ack_receipts` is created by `RelayReceiptStore`'s constructor, not by the session
609
- * schema, so on a daemon that has never opened a relay-witnessed session the table is simply
610
- * absent. That is not a degraded read and nothing is substituted for it: no table means no
611
- * relay ever countersigned a position here, which is the same fact as an empty table. The
612
- * existence check is explicit rather than a swallowed `catch`, so a genuine SQL fault still
613
- * throws instead of arriving as "nothing was ordered".
614
- */
615
- const relayTablePresent = db
616
- .prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'relay_ack_receipts'")
617
- .get() !== undefined;
618
- if (relayTablePresent) {
619
- for (const r of db
620
- .prepare(`SELECT hash_hex, relay_id, relay_timestamp, signature_hex
621
- FROM relay_ack_receipts WHERE agent_pubkey = ? AND session_id = ?`)
622
- .all(agentPubkey, sessionId)) {
623
- receipts.set(r.hash_hex, r);
624
- }
625
- }
626
- const acks = new Map();
627
- for (const a of db
628
- .prepare(`SELECT content_hash_hex, signer_pubkey, signature, recorded_at
629
- FROM delivery_acks WHERE agent_id = ? AND session_id = ?`)
630
- .all(agentId, sessionId)) {
631
- acks.set(a.content_hash_hex, a);
632
- }
633
- const hashes = [...new Set([...seqByHash.keys(), ...receipts.keys(), ...acks.keys()])];
634
- hashes.sort((x, y) => (seqByHash.get(x) ?? Number.MAX_SAFE_INTEGER) - (seqByHash.get(y) ?? Number.MAX_SAFE_INTEGER));
635
- return hashes.map((hash) => {
636
- const receipt = receipts.get(hash);
637
- const ack = acks.get(hash);
638
- return {
639
- seq: seqByHash.get(hash) ?? null,
640
- content_hash: hash,
641
- ordered: receipt
642
- ? {
643
- asserted_by: "relay",
644
- relay_id: receipt.relay_id,
645
- relay_timestamp: receipt.relay_timestamp,
646
- signature: receipt.signature_hex,
647
- }
648
- : null,
649
- /**
650
- * PRESENT IN SHAPE, ABSENT IN FACT — and it names who would assert it, exactly as the other
651
- * two do. A reader mapping over this array can then tell "nobody holds this" from "the relay
652
- * said no", which a bare `null` cannot. It is not inference: `held: false` is a statement
653
- * about what THIS side has, never about the counterparty.
654
- */
655
- delivered: {
656
- asserted_by: "relay",
657
- held: false,
658
- why_absent: "a relay tells the RECIPIENT when it hands content over and never tells the sender, so " +
659
- "this side holds no relay-asserted delivery evidence for any message. It is left absent " +
660
- "rather than filled in from this machine's own send having succeeded, which would be " +
661
- "this machine asserting a relay's fact about itself",
662
- },
663
- acknowledged: ack
664
- ? {
665
- asserted_by: "recipient",
666
- signer_pubkey: ack.signer_pubkey,
667
- signature: Buffer.from(ack.signature).toString("hex"),
668
- recorded_at: ack.recorded_at,
669
- }
670
- : null,
671
- };
672
- });
673
- }
674
569
  //# sourceMappingURL=session-delivery-acks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-delivery-acks.js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MAAM,EAAE;QAC7C,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,cAAc,EAAE,OAAO;QACvB,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAClE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM;QACvB,aAAa,EAAE,CAAC,CAAC,aAAa;KAC/B,CAAC,CAAC;IACH,IAAI,KAAK,EAAE,CAAC;QACV,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,uCAAuC,EAAE;YACrD,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO;YACpE,aAAa,EAAE,CAAC,CAAC,aAAa;YAC9B,MAAM,EACJ,qFAAqF;gBACrF,kFAAkF;SACrF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
@@ -93,7 +93,7 @@ export function createSessionNotify(deps) {
93
93
  getNotificationDispatcher().dispatchSessionStateChanged(agentName, sessionId, state, counterpartyPubkey, who);
94
94
  void sendTelegramDoorbell(agentName, sessionId, "state_change", `Session ${state}`);
95
95
  // Reviewer HIGH fix (a60d68ed): telegramRungUnread had NO cleanup at all — a session that
96
- // rings once and is never read via cello_receive/since_seq (e.g. the operator only ever uses
96
+ // rings once and is never read via cello_receive (e.g. the operator only ever uses
97
97
  // cello_get_transcript, which does not advance the read watermark) left a permanent entry for
98
98
  // the life of the daemon process. Every state change is a natural point to drop it — the
99
99
  // worst case if the session is still genuinely active is one possible extra ring later, far
@@ -1 +1 @@
1
- {"version":3,"file":"session-notify.js","sourceRoot":"","sources":["../src/session-notify.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,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CAAC,6CAA6C,EAAE;wBACzD,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,GAAG,CAAC;qBAC5C,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;QACH,CAAC;QACD,yBAAyB,EAAE,CAAC,2BAA2B,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAC;QAC9G,KAAK,oBAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,KAAK,EAAE,CAAC,CAAC;QACpF,0FAA0F;QAC1F,mFAAmF;QACnF,8FAA8F;QAC9F,yFAAyF;QACzF,4FAA4F;QAC5F,2FAA2F;QAC3F,mCAAmC;QACnC,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACxC,qFAAqF;QACrF,2FAA2F;QAC3F,sFAAsF;QACtF,0FAA0F;QAC1F,sFAAsF;QACtF,0FAA0F;QAC1F,gDAAgD;QAChD,IAAI,KAAK,KAAK,SAAS,IAAI,kBAAkB,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC;YAC5F,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,uCAAuC,EAAE,CAAC;AAClI,CAAC"}
@@ -299,7 +299,7 @@ export declare class SessionQueries {
299
299
  * Returns the sealed root and the parsed legibility object (JSON-safe, hex pubkeys), or
300
300
  * null if the session is unknown or not yet sealed. This is the cert-read surface a
301
301
  * reader (operator, agent, arbitrator) — possibly in a DIFFERENT process than the one
302
- * that built the certificate — uses to determine receipt-not-assent, per-party frontiers,
302
+ * that built the certificate — uses to determine per-party frontiers,
303
303
  * attestation modes, and whether the final message was answered.
304
304
  */
305
305
  getSealCertificate(agentName: string, sessionId: string): {
@@ -551,7 +551,7 @@ export class SessionQueries {
551
551
  * Returns the sealed root and the parsed legibility object (JSON-safe, hex pubkeys), or
552
552
  * null if the session is unknown or not yet sealed. This is the cert-read surface a
553
553
  * reader (operator, agent, arbitrator) — possibly in a DIFFERENT process than the one
554
- * that built the certificate — uses to determine receipt-not-assent, per-party frontiers,
554
+ * that built the certificate — uses to determine per-party frontiers,
555
555
  * attestation modes, and whether the final message was answered.
556
556
  */
557
557
  getSealCertificate(agentName, sessionId) {
@@ -1 +1 @@
1
- {"version":3,"file":"session-read-handlers.d.ts","sourceRoot":"","sources":["../src/session-read-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAwD,MAAM,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAW/E,MAAM,WAAW,eAAe;IAC9B,uGAAuG;IACvG,kBAAkB,EAAE,qBAAqB,CAAC;IAC1C,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,YAAY,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9C,YAAY,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,CAAC;IAC9D,mBAAmB,EAAE,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,aA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KAAK,OAAO,CAAC;IAC7D;;;;;OAKG;IACH;;;;OAIG;IACH,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;IAClF,6EAA6E;IAC7E,iBAAiB,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACzG,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACzG;;;;;OAKG;IACH,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,wBAAwB,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,CACpB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACpE;AAmDD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CA6pBvE"}
@@ -4,73 +4,56 @@ import { renderFrontierMismatch } from "./frontier-mismatch.js";
4
4
  import { describeSealFailed } from "./seal-failure-store.js";
5
5
  import { contentEncryptionGuidanceFor } from "./content-encryption-status.js";
6
6
  import { frameQuarantinedPayload } from "./quarantine-framing.js";
7
- import { readDeliveryFacts } from "./session-delivery-acks.js";
7
+ import { readSealedConversation } from "./sealed-conversation.js";
8
8
  /**
9
9
  * DOD-M15-AWAYSCOPE-1: one budget for ALL the attendance probes a list fires, not one each. Set by
10
10
  * what a person will sit through at a terminal, not by what a slow relay might need.
11
11
  */
12
12
  const ATTENDANCE_PROBE_BUDGET_MS = 1_500;
13
13
  /**
14
- * DOD-M15-DELIVERYACK-1 THREE FACTS PER SENT MESSAGE, AND NOT ONE WORD OF INFERENCE.
14
+ * The seal answer: the conversation the seal covers, one line per leaf, in the relay's numbering.
15
15
  *
16
- * A receipt that cannot distinguish *"they did not answer"* from *"it never reached them"* is not
17
- * evidence, which is why these are three SEPARATE facts rather than a status: **ordered** (the relay
18
- * assigned it a position), **delivered** (the relay handed the bytes over) and **acknowledged** (the
19
- * recipient's own signature). Each is present or absent on its own.
16
+ * Each leaf carries the two signatures that prove it `relay_ack` (the relay numbered it) and, on
17
+ * messages, `delivery_ack` (the recipient's machine received it). A null signature is an absence
18
+ * of evidence and nothing more: an acknowledgement can be lost with a connection.
20
19
  *
21
- * 🚨 A MISSING FACT IS REPORTED AS MISSING AND NOTHING MORE. There is no combined status here, no
22
- * derived verdict, no count of absences, and no wording that reads as fault because there are
23
- * many blameless reasons a fact is absent: the relay parked the content and never delivered it, the
24
- * recipient's daemon died between ordering and pull, their per-recipient queue hit its bound and
25
- * dropped the oldest frame, the screener refused it, or it was quarantined on arrival. `note` says
26
- * so in the payload rather than in prose a caller may never surface.
27
- *
28
- * 🚨 AND THIS IS NOT ASSENT. An acknowledgement says a machine received bytes, signed on ingest,
29
- * before any human read them. `legibility.implies_assent` stays the literal `false` and this
30
- * section adds nothing to it.
31
- *
32
- * ⚠️ IT IS NOT PART OF THE DIRECTORY-SIGNED `legibility`, DELIBERATELY. The legibility object's
33
- * canonical bytes are folded into the FROST-signed seal, and the directory never sees an
34
- * acknowledgement — putting these there would have the directory signing a per-message claim
35
- * supplied by one of the two parties, which proves nothing about it. `asserted_by` names who stands
36
- * behind each fact instead, and the acknowledgement carries the signature itself so a reader can
37
- * check it against the counterparty's key rather than taking this daemon's word.
20
+ * The answer states what the seal attests and stays silent on what it does not. It never says the
21
+ * conversation is or is not an agreement: seals may later be offered as evidence of one.
38
22
  */
39
- function deliverySection(sessionNodeManager, logger, agentName, sessionId) {
40
- // Read through the manager's own public boundary accessors — the stable agent id and the database
41
- // handle rather than a new delegator. The facts are a pure read over three tables; routing them
42
- // through the manager would add surface to a file whose size ratchet exists to stop exactly that.
43
- const messages = readDeliveryFacts(sessionNodeManager.getDb(), logger, sessionNodeManager.resolveAgentId(agentName), sessionId);
23
+ function sealedAnswer(sessionNodeManager, logger, resolveWho, agentName, sessionId, sealedRoot) {
24
+ const db = sessionNodeManager.getDb();
25
+ const agentId = sessionNodeManager.resolveAgentId(agentName);
26
+ const agentPubkey = db.prepare("SELECT k_local_pubkey FROM agents WHERE agent_id = ?").get(agentId)?.k_local_pubkey;
27
+ if (!agentPubkey) {
28
+ // The agent was resolved a step earlier, so a row with no key is a corrupt local database. An
29
+ // empty key would match no relay record and read as a conversation with nothing numbered.
30
+ throw new Error(`agent_pubkey_unresolved: agent '${agentName}' has no identity key in this database`);
31
+ }
32
+ const texts = new Map();
33
+ for (const m of sessionNodeManager.readTranscript(agentName, sessionId).messages)
34
+ texts.set(m.sequence, m.text);
35
+ const conversation = readSealedConversation(db, logger, {
36
+ agentId, agentPubkey, sessionId, sealedRoot, texts,
37
+ nameFor: (pk) => (pk === agentPubkey ? agentName : resolveWho(agentName, pk, sessionId).who),
38
+ });
44
39
  return {
45
- delivery: {
46
- messages,
47
- note: "Three independent facts per message you SENT. `ordered` is the relay's countersigned " +
48
- "position. `delivered` is the relay confirming it handed the bytes over — this side holds " +
49
- "no such evidence for any message today, because a relay answers the recipient on pickup " +
50
- "and never tells the depositor, so it reads null throughout. `acknowledged` is the " +
51
- "recipient's own signature over this session id and this content hash, which you can check " +
52
- "against their public key. A null is an ABSENCE OF EVIDENCE, never a finding: a message " +
53
- "with no acknowledgement may well have been delivered and read, and the acknowledgement " +
54
- "lost with the connection. Nothing here implies agreement to anything.\n\n" +
55
- "`acknowledged` is NOT `legibility.final_message.answered` and neither can stand in for the " +
56
- "other. `answered` says the other party AUTHORED something after your last message. " +
57
- "`acknowledged` says their MACHINE took delivery of it, signed before any human read it. " +
58
- "The combination that carries the most meaning is the one they cannot express separately: " +
59
- "answered false AND acknowledged present — it reached them and they did not reply. Neither " +
60
- "is agreement.",
61
- },
40
+ session_id: sessionId,
41
+ sealed: true,
42
+ sealed_root: sealedRoot,
43
+ root_matches_my_transcript: conversation.root_matches_my_transcript,
44
+ ...(conversation.root_mismatch_reason ? { root_mismatch_reason: conversation.root_mismatch_reason } : {}),
45
+ leaves: conversation.leaves,
46
+ closed_by: conversation.closed_by,
47
+ note: SEAL_NOTE,
62
48
  };
63
49
  }
50
+ /** Settled wording (2026-09-14). Neutral on agreement: seals may later back commercial agreements. */
51
+ const SEAL_NOTE = "Attests that this conversation took place between these two agents, in this order, unaltered.";
64
52
  export function registerSessionReadHandlers(deps) {
65
53
  const { handlers, logger, sessionNodeManager, loadedAgents, getConnState, resolveCurrentAgent, NO_CURRENT_AGENT_RESPONSE, resolveWho, safeCursorAdvance, safeWatermarkAdvance, attendanceCount, reapDeadHalfOpenSessions, frontierMismatches, isSealing, getSealFailure, } = deps;
66
- // ─── M7-SESSION-004 (AC-005/AC-006): read the sealed certificate's legibility ───
67
- // The cert-read surface: returns the receipt-not-assent certificate for a sealed session —
68
- // per-party content frontiers, attestation modes, and whether the final message was answered.
54
+ // ─── The sealed-receipt read surface ───
69
55
  // Reads the PERSISTED record, so it works after a daemon restart and from a DIFFERENT process
70
- // than the one that built the certificate (an arbitrator reading the receiving side). The
71
- // legibility states, as a first-class machine-readable property, that a signature attests
72
- // receipt — never assent (implies_assent: false); a malicious unanswered tail reads as
73
- // delivered-but-unanswered (final_message.answered: false), never agreed.
56
+ // than the one that built the certificate (an arbitrator reading the receiving side).
74
57
  handlers.set("cello_get_sealed_receipt", async (params, connectionId) => {
75
58
  // cello-mcp forwards this as { session_id } (snake_case, matching the other session tools).
76
59
  const sessionId = params?.["session_id"];
@@ -92,46 +75,16 @@ export function registerSessionReadHandlers(deps) {
92
75
  // hold the id, so the name is free context. It is display only: nothing in the certificate,
93
76
  // the sealed root, or the legibility object is derived from it.
94
77
  const sessionName = sessionNodeManager.getSessionRecord(agentName, sessionId)?.session_name ?? null;
95
- // DOD-FIRSTMSG-WITNESS-1 AC8: say HOW MUCH the certificate covers.
96
- //
97
- // §7a's defect was a certificate issued over a record short one message — the conversation's
98
- // opening message, dropped because its relay submit was rejected and never retried. It was
99
- // invisible precisely because the receipt reported no size: seal RATE was unaffected (75% vs
100
- // 72%), so every surface said "sealed" while the notarized record was incomplete. Rate was
101
- // never the measure; coverage is, and coverage was not reported anywhere.
102
- //
103
- // Both counts, because they answer different questions. `leaf_count` is the whole sealed tree
104
- // (content AND the control leaves the seal itself appends). `content_leaf_count` is the
105
- // messages, and it is the one comparable to a transcript length — conflating them would make
106
- // the check drift by the number of ctrl leaves and read as a defect when nothing is wrong.
107
- const tree = sessionNodeManager.getSessionTree(agentName, sessionId);
108
- const leaves = tree.leaves();
78
+ // DOD-FIRSTMSG-WITNESS-1 AC8: say HOW MUCH the certificate covers — a certificate once sealed a
79
+ // record short its opening message and every surface still said "sealed". The leaves list is
80
+ // the coverage now, and a message the relay never numbered is listed, unnumbered.
81
+ // `root_matches_my_transcript` is this side's own check, recomputed from the relay's numbered
82
+ // leaves and tied to the local transcript never copied from the certificate, which both
83
+ // sides read identically and so could not show a certificate over the wrong leaf set.
109
84
  return {
110
85
  ok: true,
111
- session_id: sessionId,
86
+ ...sealedAnswer(sessionNodeManager, logger, resolveWho, agentName, sessionId, cert.sealed_root),
112
87
  session_name: sessionName,
113
- sealed_root: cert.sealed_root,
114
- /**
115
- * DOD-M15-SEALWIRE-1 bullet 8: THIS SIDE'S OWN ROOT, computed from its own leaves — never
116
- * copied from the certificate.
117
- *
118
- * `sealed_root` above is the CERTIFICATE's root. Every spine journey asserted that both
119
- * parties' `sealed_root` matched, and that assertion is hollow: both sides read the same
120
- * field out of the same certificate, so it stays green **even if the directory certified a
121
- * root over a completely different leaf set than the one either party actually holds**. It
122
- * proves the two clients received identical bytes, which was never the question.
123
- *
124
- * The question is whether the certificate covers THIS party's conversation. Only a root
125
- * derived locally can answer that, and until now nothing exposed one — so no test could
126
- * make the assertion, which is why ten of them made the weaker one instead.
127
- *
128
- * Read-only and derived: `rootHex()` recomputes from the stored leaves.
129
- */
130
- local_tree_root: tree.rootHex(),
131
- leaf_count: leaves.length,
132
- content_leaf_count: leaves.filter((l) => l.kind === "msg").length,
133
- legibility: cert.legibility,
134
- ...deliverySection(sessionNodeManager, logger, agentName, sessionId),
135
88
  };
136
89
  }
137
90
  // M8C-INBOX-1 (F4): the single `sealed_receipt_not_found` conflated four distinct causes, so a
@@ -162,20 +115,14 @@ export function registerSessionReadHandlers(deps) {
162
115
  const recovered = sessionNodeManager.getSealCertificate(agentName, sessionId);
163
116
  if (recovered) {
164
117
  const recoveredName = sessionNodeManager.getSessionRecord(agentName, sessionId)?.session_name ?? null;
165
- const recoveredLeaves = sessionNodeManager.getSessionTree(agentName, sessionId).leaves();
166
118
  logger.info("seal.certificate.recovered_on_read", {
167
119
  agentName, sessionId,
168
120
  impact: "the seal existed and this side had never been told; the receipt is now local",
169
121
  });
170
122
  return {
171
123
  ok: true,
172
- session_id: sessionId,
124
+ ...sealedAnswer(sessionNodeManager, logger, resolveWho, agentName, sessionId, recovered.sealed_root),
173
125
  session_name: recoveredName,
174
- sealed_root: recovered.sealed_root,
175
- leaf_count: recoveredLeaves.length,
176
- content_leaf_count: recoveredLeaves.filter((l) => l.kind === "msg").length,
177
- legibility: recovered.legibility,
178
- ...deliverySection(sessionNodeManager, logger, agentName, sessionId),
179
126
  verified: pulled.verified === true,
180
127
  ...(pulled.verified === true
181
128
  ? {}
@@ -264,6 +211,21 @@ export function registerSessionReadHandlers(deps) {
264
211
  guidance: "No session with this id belongs to the current agent. Run cello_sessions to see the full ids of this agent's sessions.",
265
212
  };
266
213
  });
214
+ // The stored seal certificate, as the directory signed it — per-side frontiers, attestation modes,
215
+ // whether the last message was answered. The seal ANSWER no longer carries it, so journeys and
216
+ // auditors read it here. IPC only, deliberately not a tool: an operator reads the conversation.
217
+ handlers.set("seal_certificate", async (params, connectionId) => {
218
+ const sessionId = params?.["session_id"];
219
+ if (typeof sessionId !== "string" || !sessionId)
220
+ return { ok: false, reason: "missing_session_id" };
221
+ const agentName = resolveCurrentAgent(getConnState(connectionId), params?.agent);
222
+ if (!agentName)
223
+ return NO_CURRENT_AGENT_RESPONSE;
224
+ const cert = sessionNodeManager.getSealCertificate(agentName, sessionId);
225
+ return cert
226
+ ? { ok: true, session_id: sessionId, sealed_root: cert.sealed_root, legibility: cert.legibility }
227
+ : { ok: false, reason: "not_sealed" };
228
+ });
267
229
  // DOD-LOG-1 (PERSIST-LOG-001): read the durable, decrypted conversation transcript for a session —
268
230
  // the readable sent+received messages in canonical-sequence order, recovered AFTER a daemon restart
269
231
  // (not just the opaque hash chain). The plaintext is decrypted from the encrypted-at-rest store here,