@cello-protocol/daemon 0.0.182 → 0.0.184

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 (137) hide show
  1. package/dist/agent-settings-keys.d.ts.map +1 -1
  2. package/dist/agent-settings-keys.js +18 -0
  3. package/dist/agent-settings-keys.js.map +1 -1
  4. package/dist/close-session-handler.d.ts.map +1 -1
  5. package/dist/close-session-handler.js +90 -16
  6. package/dist/close-session-handler.js.map +1 -1
  7. package/dist/consortium-bootstrap.d.ts.map +1 -1
  8. package/dist/consortium-bootstrap.js +117 -2
  9. package/dist/consortium-bootstrap.js.map +1 -1
  10. package/dist/content-encryption-status.d.ts +97 -0
  11. package/dist/content-encryption-status.d.ts.map +1 -0
  12. package/dist/content-encryption-status.js +122 -0
  13. package/dist/content-encryption-status.js.map +1 -0
  14. package/dist/content-park-client.d.ts +10 -0
  15. package/dist/content-park-client.d.ts.map +1 -1
  16. package/dist/content-park-client.js +84 -3
  17. package/dist/content-park-client.js.map +1 -1
  18. package/dist/content-park.d.ts.map +1 -1
  19. package/dist/content-park.js +184 -13
  20. package/dist/content-park.js.map +1 -1
  21. package/dist/daemon.d.ts.map +1 -1
  22. package/dist/daemon.js +671 -67
  23. package/dist/daemon.js.map +1 -1
  24. package/dist/document-handlers.d.ts.map +1 -1
  25. package/dist/document-handlers.js +119 -0
  26. package/dist/document-handlers.js.map +1 -1
  27. package/dist/document-layer.d.ts +0 -2
  28. package/dist/document-layer.d.ts.map +1 -1
  29. package/dist/document-layer.js.map +1 -1
  30. package/dist/frame-values.d.ts.map +1 -1
  31. package/dist/frame-values.js +14 -0
  32. package/dist/frame-values.js.map +1 -1
  33. package/dist/inclusion-proof-handlers.d.ts +43 -0
  34. package/dist/inclusion-proof-handlers.d.ts.map +1 -0
  35. package/dist/inclusion-proof-handlers.js +565 -0
  36. package/dist/inclusion-proof-handlers.js.map +1 -0
  37. package/dist/inclusion-proof.d.ts +151 -0
  38. package/dist/inclusion-proof.d.ts.map +1 -0
  39. package/dist/inclusion-proof.js +228 -0
  40. package/dist/inclusion-proof.js.map +1 -0
  41. package/dist/initiate-session-handler.d.ts.map +1 -1
  42. package/dist/initiate-session-handler.js +34 -3
  43. package/dist/initiate-session-handler.js.map +1 -1
  44. package/dist/manifest-deps.d.ts +0 -11
  45. package/dist/manifest-deps.d.ts.map +1 -1
  46. package/dist/manifest-deps.js +28 -2
  47. package/dist/manifest-deps.js.map +1 -1
  48. package/dist/manifest-validity.d.ts +2 -0
  49. package/dist/manifest-validity.d.ts.map +1 -1
  50. package/dist/manifest-validity.js +1 -1
  51. package/dist/manifest-validity.js.map +1 -1
  52. package/dist/network-directory-node.d.ts +16 -0
  53. package/dist/network-directory-node.d.ts.map +1 -1
  54. package/dist/network-directory-node.js +40 -0
  55. package/dist/network-directory-node.js.map +1 -1
  56. package/dist/notification-handlers.d.ts.map +1 -1
  57. package/dist/notification-handlers.js +71 -2
  58. package/dist/notification-handlers.js.map +1 -1
  59. package/dist/outbound-sessions.d.ts +6 -0
  60. package/dist/outbound-sessions.d.ts.map +1 -1
  61. package/dist/outbound-sessions.js +50 -7
  62. package/dist/outbound-sessions.js.map +1 -1
  63. package/dist/park-envelope.d.ts +23 -0
  64. package/dist/park-envelope.d.ts.map +1 -1
  65. package/dist/park-envelope.js +76 -0
  66. package/dist/park-envelope.js.map +1 -1
  67. package/dist/register-handler.d.ts.map +1 -1
  68. package/dist/register-handler.js +76 -0
  69. package/dist/register-handler.js.map +1 -1
  70. package/dist/relay-only.d.ts +133 -0
  71. package/dist/relay-only.d.ts.map +1 -0
  72. package/dist/relay-only.js +183 -0
  73. package/dist/relay-only.js.map +1 -0
  74. package/dist/retry-queue.d.ts +26 -1
  75. package/dist/retry-queue.d.ts.map +1 -1
  76. package/dist/retry-queue.js +18 -1
  77. package/dist/retry-queue.js.map +1 -1
  78. package/dist/seal-coordinator.d.ts +51 -1
  79. package/dist/seal-coordinator.d.ts.map +1 -1
  80. package/dist/seal-coordinator.js +248 -1
  81. package/dist/seal-coordinator.js.map +1 -1
  82. package/dist/seal-escalation.d.ts.map +1 -1
  83. package/dist/seal-escalation.js +28 -0
  84. package/dist/seal-escalation.js.map +1 -1
  85. package/dist/seal-failure-store.d.ts.map +1 -1
  86. package/dist/seal-failure-store.js +5 -1
  87. package/dist/seal-failure-store.js.map +1 -1
  88. package/dist/sealed-leaf-set.d.ts +92 -0
  89. package/dist/sealed-leaf-set.d.ts.map +1 -0
  90. package/dist/sealed-leaf-set.js +129 -0
  91. package/dist/sealed-leaf-set.js.map +1 -0
  92. package/dist/session-ceremony.d.ts +27 -1
  93. package/dist/session-ceremony.d.ts.map +1 -1
  94. package/dist/session-ceremony.js +109 -7
  95. package/dist/session-ceremony.js.map +1 -1
  96. package/dist/session-content-handlers.d.ts +12 -0
  97. package/dist/session-content-handlers.d.ts.map +1 -1
  98. package/dist/session-content-handlers.js +39 -4
  99. package/dist/session-content-handlers.js.map +1 -1
  100. package/dist/session-node-manager.d.ts +387 -4
  101. package/dist/session-node-manager.d.ts.map +1 -1
  102. package/dist/session-node-manager.js +3529 -279
  103. package/dist/session-node-manager.js.map +1 -1
  104. package/dist/session-read-handlers.d.ts.map +1 -1
  105. package/dist/session-read-handlers.js +16 -1
  106. package/dist/session-read-handlers.js.map +1 -1
  107. package/dist/session-relay-client.d.ts +163 -1
  108. package/dist/session-relay-client.d.ts.map +1 -1
  109. package/dist/session-relay-client.js +540 -6
  110. package/dist/session-relay-client.js.map +1 -1
  111. package/dist/session-salt-agreement.d.ts +58 -4
  112. package/dist/session-salt-agreement.d.ts.map +1 -1
  113. package/dist/session-salt-agreement.js +110 -3
  114. package/dist/session-salt-agreement.js.map +1 -1
  115. package/dist/signal-submission.d.ts +11 -1
  116. package/dist/signal-submission.d.ts.map +1 -1
  117. package/dist/signal-submission.js.map +1 -1
  118. package/dist/signaling-connect.d.ts +18 -1
  119. package/dist/signaling-connect.d.ts.map +1 -1
  120. package/dist/signaling-connect.js +164 -1
  121. package/dist/signaling-connect.js.map +1 -1
  122. package/dist/submission-retry.d.ts +208 -0
  123. package/dist/submission-retry.d.ts.map +1 -0
  124. package/dist/submission-retry.js +505 -0
  125. package/dist/submission-retry.js.map +1 -0
  126. package/dist/types.d.ts +33 -0
  127. package/dist/types.d.ts.map +1 -1
  128. package/dist/types.js.map +1 -1
  129. package/dist/vocabulary.d.ts +13 -3
  130. package/dist/vocabulary.d.ts.map +1 -1
  131. package/dist/vocabulary.js +14 -3
  132. package/dist/vocabulary.js.map +1 -1
  133. package/dist/wire-content-hash.d.ts +15 -3
  134. package/dist/wire-content-hash.d.ts.map +1 -1
  135. package/dist/wire-content-hash.js +15 -3
  136. package/dist/wire-content-hash.js.map +1 -1
  137. package/package.json +5 -5
@@ -59,6 +59,17 @@ async function safeStop(node) {
59
59
  /* best-effort teardown */
60
60
  }
61
61
  }
62
+ /** A directory node the daemon can dial, resolved from bootstrap config or a manifest. */
63
+ /**
64
+ * DOD-M15-STEP6-REPLAY-1 — how far out of date a directory identity proof may be.
65
+ *
66
+ * ±5 minutes: wide enough for ordinary clock skew between an operator's machine and a directory
67
+ * node without requiring either to be time-synced, narrow enough that a captured proof stops being
68
+ * useful in minutes rather than never. An UNPARSEABLE timestamp is treated as out of window — the
69
+ * NaN-comparison lesson from the manifest gate, where `new Date("nonsense") <= x` is false and a
70
+ * garbage value sailed through a check that looked like it covered it.
71
+ */
72
+ const IDENTITY_PROOF_MAX_SKEW_MS = 5 * 60_000;
62
73
  /**
63
74
  * Parse signaling_auth_ok's optional `relay_endpoints` field. Per-entry strict:
64
75
  * a malformed entry is dropped (auth must never fail on a bad hint), a valid one
@@ -92,6 +103,20 @@ function parseRelayEndpoints(raw) {
92
103
  * transport SignalingManager catches the throw and schedules a reconnect.
93
104
  */
94
105
  export function createSignalingConnect(deps) {
106
+ /**
107
+ * DOD-M15-DIRAUTH-1 — directory peers already told about a skipped identity check.
108
+ *
109
+ * Mirrors `consortium-bootstrap`'s `lapsedMembershipReportedFor` idiom: the fact is about a PEER,
110
+ * not about a connection, so reporting it per connection says the same true thing ~48 times an
111
+ * hour forever. Keyed on the peer this daemon DIALLED — never on the peer's own claim about
112
+ * itself, which on this path is precisely the thing that was not verified.
113
+ *
114
+ * ⚠️ SCOPED TO THE FACTORY, not the module. A module-level set is shared by every daemon wiring in
115
+ * the process and never resets, which makes the suppression outlive the thing it describes and
116
+ * makes test order load-bearing — my first version did exactly that and a later test silently lost
117
+ * its warning to an earlier one.
118
+ */
119
+ const authSkipReportedFor = new Set();
95
120
  return async function connect() {
96
121
  const endpoint = await deps.getDirectoryEndpoint();
97
122
  if (!endpoint) {
@@ -218,6 +243,52 @@ export function createSignalingConnect(deps) {
218
243
  // Runs only when a challengeVerifier is configured. M6 ran without one.
219
244
  let directoryNodeId = typeof ackFrame["nodeId"] === "string" ? ackFrame["nodeId"] : endpoint.peerId;
220
245
  const verifier = deps.challengeVerifier;
246
+ if (!verifier) {
247
+ /**
248
+ * DOD-M15-DIRAUTH-1 — **A DISARMED CHECK MUST NOT LOOK LIKE A HEALTHY ONE.**
249
+ *
250
+ * With no verifier configured, step 6 does not run at all: this daemon takes the
251
+ * directory's word for which directory it is. Until now the only trace of that was
252
+ * `verified: false` — a boolean field inside the **info** line at the bottom of a successful
253
+ * connect. Every other connect logged the same event at the same level, so the disarmed
254
+ * state and the enforced state were distinguishable only by reading one field of one line,
255
+ * which nothing alerts on and no operator reads.
256
+ *
257
+ * ⚠️ THIS IS NOT THE FIX AND MUST NOT BE MISTAKEN FOR ONE — this entry's own conclusion is
258
+ * that **a log is not a control**, and a WARN is still a log. What it buys is that the
259
+ * absence has a name and a level of its own, so "authentication is off" can be seen without
260
+ * knowing to look for it. The control is `CELLO_REQUIRE_DIRECTORY_AUTH`, which refuses at
261
+ * startup; this is what tells an operator who has not set it what they are running.
262
+ */
263
+ /**
264
+ * ⚠️ ONCE PER DIRECTORY, NOT ONCE PER CONNECT — review F3, and the number is the argument.
265
+ * The signaling stream turns over roughly every 70 seconds and reconnects forever, so a
266
+ * per-connect WARN is ~48 an hour PER AGENT, indefinitely, and the daemon's stdout logger
267
+ * has no level filtering. Three agents is ~3,400 identical lines a day. **A signal that
268
+ * fires on the normal case is not a signal** — this repo's own rule — and it would bury the
269
+ * public-directory case this exists to raise.
270
+ *
271
+ * ⚠️ AND THE FIELD IS NAMED FOR WHAT IT IS — review F4. On this path `directoryNodeId` is
272
+ * `ackFrame["nodeId"]`: a string the REMOTE sent about itself, with nothing checked. Printing
273
+ * it under that name inside a line whose whole subject is *"we did not check which directory
274
+ * this is"* presents the peer's own answer as the answer. `dialedPeerId` sits beside it as
275
+ * the thing this daemon actually chose.
276
+ */
277
+ const claimedNodeId = typeof ackFrame["nodeId"] === "string" ? ackFrame["nodeId"] : null;
278
+ if (!authSkipReportedFor.has(endpoint.peerId)) {
279
+ authSkipReportedFor.add(endpoint.peerId);
280
+ deps.logger.warn("directory.auth.skipped", {
281
+ dialedPeerId: endpoint.peerId,
282
+ claimedNodeId,
283
+ agentPubkey: identity.pubkeyHex,
284
+ impact: "no directory identity verifier is configured, so this connection did NOT check which " +
285
+ "directory it reached — the peer's claim of its own identity was accepted as given. " +
286
+ "Set CELLO_CONSORTIUM_ROOT_KEYS (with CELLO_CONSORTIUM_THRESHOLD) to enable " +
287
+ "verification, or CELLO_REQUIRE_DIRECTORY_AUTH=1 to refuse at startup instead of " +
288
+ "connecting unverified. Reported ONCE per directory peer, not per reconnect.",
289
+ });
290
+ }
291
+ }
221
292
  if (verifier) {
222
293
  const nodeId = ackFrame["nodeId"];
223
294
  const signature = ackFrame["signature"];
@@ -237,8 +308,55 @@ export function createSignalingConnect(deps) {
237
308
  deps.logger.error("directory.auth.challenge.failed", { directoryNodeId: nodeId, reason: result.reason });
238
309
  throw new Error(`directory_challenge_failed: ${result.reason}`);
239
310
  }
311
+ /**
312
+ * DOD-M15-STEP6-REPLAY-1 — A VALID SIGNATURE IS NOT A FRESH ONE.
313
+ *
314
+ * The TBS covers `nodeId ‖ agent pubkey ‖ nonce ‖ timestamp`, and until this check the
315
+ * client verified the signature over that tuple and looked at **neither** the timestamp nor
316
+ * the nonce. So **any party that once obtained a valid tuple for this agent could replay it
317
+ * indefinitely.**
318
+ *
319
+ * ─── WHY THE NONCE CANNOT CARRY THE FRESHNESS, WHICH IS THE PART THAT SURPRISED ME ──────
320
+ *
321
+ * The obvious answer is "check the nonce is the one we just sent". **We did not send it.**
322
+ * The nonce here is `challengeFrame["nonce"]` — the DIRECTORY's own, from step 1-2. The
323
+ * client contributes no fresh value to this exchange at all, so it holds nothing of its own
324
+ * to bind against. A replaying party simply replays the captured nonce in step 2 and the
325
+ * captured ack in step 5, and both halves agree.
326
+ *
327
+ * **That leaves the timestamp as the only freshness anchor**, and it is a real one: it is
328
+ * inside the signed bytes, so a replayer cannot move it without invalidating the signature
329
+ * they are replaying.
330
+ *
331
+ * ─── AFTER the signature, deliberately ─────────────────────────────────────────────────
332
+ *
333
+ * A stale proof and a forged one are different facts and must not collapse into one
334
+ * message. Checking freshness only once the signature verifies means `identity_proof_stale`
335
+ * always describes a GENUINE proof that is too old — never a forgery — which is what makes
336
+ * it diagnostic rather than another exit-point label.
337
+ *
338
+ * **The window, and what it does NOT fix.** ±5 minutes tolerates ordinary client/directory
339
+ * clock skew without a time-sync dependency. It BOUNDS replay to that window; it does not
340
+ * eliminate it, because with no client-chosen nonce there is nothing to make a proof
341
+ * single-use. Closing the remainder needs either a client contribution in the challenge or a
342
+ * seen-nonce cache — both wire or state changes, and neither is this line.
343
+ */
344
+ const proofMs = Date.parse(timestamp);
345
+ const skewMs = Number.isFinite(proofMs) ? Math.abs(Date.now() - proofMs) : Number.NaN;
346
+ if (!Number.isFinite(skewMs) || skewMs > IDENTITY_PROOF_MAX_SKEW_MS) {
347
+ deps.logger.error("directory.auth.challenge.failed", {
348
+ directoryNodeId: nodeId,
349
+ reason: "identity_proof_stale",
350
+ timestamp,
351
+ skewMs: Number.isFinite(skewMs) ? Math.round(skewMs) : null,
352
+ maxSkewMs: IDENTITY_PROOF_MAX_SKEW_MS,
353
+ detail: "the directory's identity proof carries a valid signature over a timestamp outside the " +
354
+ "freshness window — either a replayed proof, or a clock that is badly out on one side.",
355
+ });
356
+ throw new Error("directory_challenge_failed: identity_proof_stale");
357
+ }
240
358
  directoryNodeId = nodeId;
241
- deps.logger.info("directory.auth.challenge.verified", { directoryNodeId });
359
+ deps.logger.info("directory.auth.challenge.verified", { directoryNodeId, skewMs: Math.round(skewMs) });
242
360
  }
243
361
  // DOD-NAT-REACHABILITY-1 (Phase 2): the directory's relay pool rides
244
362
  // signaling_auth_ok so the standing receiver can reserve BEFORE any
@@ -254,6 +372,51 @@ export function createSignalingConnect(deps) {
254
372
  deps.onRelayEndpoints(endpoints);
255
373
  }
256
374
  }
375
+ /**
376
+ * DOD-M15-RELAYSLOTS-1: the online token rides the same frame as the relay pool above, for
377
+ * the same reason — a standing receiver needs both before any session exists: WHERE to ask
378
+ * for a reservation slot, and the credential that lets it keep one.
379
+ *
380
+ * A field of the wrong type is dropped rather than failing the handshake, exactly as a
381
+ * malformed relay endpoint is. The consequence is bounded and visible (this agent gets no
382
+ * slot on any relay, and the relay names the reason when it refuses), whereas failing the
383
+ * handshake would also cost session offers, which arrive on this same stream.
384
+ */
385
+ if (deps.onOnlineToken) {
386
+ const raw = ackFrame["online_token"];
387
+ const token = raw instanceof Uint8Array ? raw : Buffer.isBuffer(raw) ? new Uint8Array(raw) : undefined;
388
+ if (token && token.length > 0) {
389
+ deps.logger.info("directory.online_token.received", { directoryNodeId, bytes: token.length });
390
+ deps.onOnlineToken(token);
391
+ }
392
+ else {
393
+ /**
394
+ * Review M1: the directory names WHICH absence, so this is no longer one label for three
395
+ * different problems. `not_registered_here` in particular is a payload fact, and reporting
396
+ * it as a generic "no token" sent the operator to check a directory connection that is
397
+ * working perfectly.
398
+ */
399
+ const raw = ackFrame["online_token_absent_reason"];
400
+ const absentReason = raw === "not_registered_here" || raw === "issue_failed" ? raw : undefined;
401
+ deps.onOnlineTokenAbsent?.(absentReason);
402
+ deps.logger.warn("directory.online_token.absent", {
403
+ directoryNodeId,
404
+ agentPubkey: identity.pubkeyHex,
405
+ reason: absentReason ?? "unstated",
406
+ impact: absentReason === "not_registered_here"
407
+ ? "this directory holds no agent profile for this key, so it issued no online token " +
408
+ "and no relay will grant this agent a reservation. The directory connection is FINE " +
409
+ "— either this agent registered against a different sovereign node and its profile " +
410
+ "has not replicated here yet, or it is not registered at all."
411
+ : absentReason === "issue_failed"
412
+ ? "this directory could not issue an online token — its own lookup or signing failed. " +
413
+ "That is a fault on the directory, not on this agent or on any relay."
414
+ : "this directory issued no online token, so no relay will let this agent hold a " +
415
+ "circuit reservation and it will be reachable only over a direct connection. It " +
416
+ "stated no reason, which means it predates the token.",
417
+ });
418
+ }
419
+ }
257
420
  // ── Step 7: announce our peer info so the directory can broker sessions ──
258
421
  const peerInfo = encodeCbor({
259
422
  type: "peer_info_announce",
@@ -1 +1 @@
1
- {"version":3,"file":"signaling-connect.js","sourceRoot":"","sources":["../src/signaling-connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EACL,UAAU,EACV,aAAa,GAKd,MAAM,2BAA2B,CAAC;AAInC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AACvD,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B,SAAS,IAAI,CAAC,CAAU;IACtB,IAAI,CAAC,YAAY,UAAU;QAAE,OAAO,CAAC,CAAC;IACtC,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,UA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going away.
3
+ *
4
+ * An operator mints a trust signal, the one directory node this daemon holds a signaling stream to
5
+ * is down or restarting, and the command fails and it is over: nothing queues the submission,
6
+ * nothing retries it, and the operator has to notice and run it again. The consortium has three
7
+ * nodes, and surviving one of them being unavailable is the entire reason there are three.
8
+ *
9
+ * THIS IS THE RETRY, NOT THE ROUTING, AND THAT DISTINCTION IS RULED. `sendSealedSubmission` says so
10
+ * in its own header: the daemon holds ONE signaling stream, registration already works this way
11
+ * (the client sends to the connected node and the DIRECTORY fans out), and inventing a client-side
12
+ * multi-node write here would duplicate the SignalingManager's reconnect. So the failover mechanism
13
+ * is that existing reconnect — this module never chooses a node, never holds an endpoint, and never
14
+ * learns which node answered. It waits to be told the stream is up again and sends the same bytes.
15
+ *
16
+ * WHY A RETRY IS SAFE, and it is the load-bearing fact for the whole design: `submission_id` is
17
+ * sha256 of the SIGNED PLAINTEXT body, so the same submission produces the same id however many
18
+ * times it is sent. A node stores it once (`ON CONFLICT DO NOTHING` on the id) and the portal mints
19
+ * once (`processed_submissions`, checked before the mint path). Nothing here may ever re-COMPOSE a
20
+ * submission: the sealed bytes are captured at compose time and re-sent verbatim, because a re-seal
21
+ * is randomised and a re-compose could pick up a different `issued_at` — which changes the id, and
22
+ * a changed id is a second endorsement rather than a retry.
23
+ *
24
+ * SERIAL AND STAGGERED, on the `RestartSealResolver`'s pattern, and one of its lessons is carried
25
+ * over wholesale: a refusal that is a precondition OF OURS is not a verdict on the submission, so it
26
+ * must not spend the attempt budget. There the population was `standing_receiver_unavailable` on a
27
+ * fresh boot; here it is a signaling stream that is reconnecting. Production turns that stream over
28
+ * roughly every 70 seconds, so charging each reconnect an attempt would burn a five-attempt budget
29
+ * in six minutes and give up on a submission whose only problem was that the network moved.
30
+ *
31
+ * IN MEMORY, FOR THE LIFE OF THE PROCESS, and stated rather than implied. The queue holds sealed
32
+ * ciphertext, and persisting it would mean a new table, a client-side migration, and a blob at rest
33
+ * whose retention outlives the intake key it is sealed to. A daemon restart therefore loses the
34
+ * pending retries — the operator sees them disappear from `cello_attestations_issued` rather than
35
+ * seeing a lie, they are NAMED in the log on the way out (`retry.dropped_on_shutdown`), and
36
+ * re-submitting is safe by the same content-derived id.
37
+ *
38
+ * THE INTAKE KEY IS CHECKED BY THE CALLER, not assumed here. An earlier version of this paragraph
39
+ * asserted that the retry window "is far shorter than any manifest validity window, so a queued
40
+ * blob cannot outlive the intake key it was sealed to" — which is only true when the manifest has
41
+ * more than a window left at compose time. The enqueue site in `daemon.ts` holds the manifest and
42
+ * refuses to hold a submission whose intake key would expire inside the window; see
43
+ * `DEFAULT_RETRY_WINDOW_MS` below for what goes wrong when nothing checks.
44
+ */
45
+ import type { SubmissionOp } from "@cello-protocol/protocol-types";
46
+ import type { SendSubmissionResult, SubmissionSendFailure } from "./signal-submission.js";
47
+ import type { Logger } from "./types.js";
48
+ export declare function isRetryableSendFailure(reason: SubmissionSendFailure): boolean;
49
+ /**
50
+ * Why a retry stopped. FOUR names, because they lead to four different operator actions and this is
51
+ * the field a machine consumer branches on.
52
+ *
53
+ * `refused_by_node` and `agent_unloaded` exist because of review H3: a refusal arriving on retry
54
+ * attempt 1 used to be stamped `attempts_exhausted` with `attempts: 0` printed beside it. The
55
+ * node's own words survived in `guidance`, but EVERY machine-readable field said transport — so an
56
+ * operator grepping the log for exhaustion found a quota refusal, and one grepping for refusals
57
+ * found it filed under a transport give-up. The work order's recorded trap is exactly this: *"the
58
+ * operator must be able to tell 'the network is flaky, hold on' from 'the directory said no.'"*
59
+ */
60
+ export type SubmissionGiveUpReason =
61
+ /** Failures that REACHED a node and got no usable answer, until the budget ran out. */
62
+ "attempts_exhausted"
63
+ /** Only ever local preconditions — the stream never came back inside the window. */
64
+ | "retry_window_elapsed"
65
+ /** A node decoded it, evaluated it, and said no. Nothing about waiting changes that. */
66
+ | "refused_by_node"
67
+ /** This daemon can no longer sign as the submitting agent, so nobody can send these bytes. */
68
+ | "agent_unloaded";
69
+ /** One submission this daemon composed, sealed, and has not yet handed to a directory node. */
70
+ export interface PendingSubmission {
71
+ agentName: string;
72
+ /** The STABLE key. `agentName` is a display label and is reusable after a retire; the surface
73
+ * that lists these is scoped by id. */
74
+ agentId: string;
75
+ /** Content-derived. Never recomputed here — see the header. */
76
+ submissionId: string;
77
+ intakeKeyId: string;
78
+ /** The sealed blob, re-sent verbatim. */
79
+ ciphertext: Uint8Array;
80
+ op: SubmissionOp;
81
+ subject: string;
82
+ }
83
+ export type SubmissionDelivery = {
84
+ state: "retrying";
85
+ attempts: number;
86
+ lastReason: SubmissionSendFailure;
87
+ nextAttemptAt: number;
88
+ guidance: string;
89
+ } | {
90
+ state: "gave_up";
91
+ attempts: number;
92
+ lastReason: SubmissionSendFailure;
93
+ gaveUpBecause: SubmissionGiveUpReason;
94
+ guidance: string;
95
+ };
96
+ export interface PendingSubmissionView {
97
+ submissionId: string;
98
+ op: SubmissionOp;
99
+ subject: string;
100
+ intakeKeyId: string;
101
+ delivery: SubmissionDelivery;
102
+ }
103
+ export interface ScheduledTask {
104
+ cancel: () => void;
105
+ }
106
+ export interface SubmissionRetryQueueDeps {
107
+ logger: Logger;
108
+ /**
109
+ * Re-send THESE bytes on whatever stream the agent's SignalingManager currently holds. The queue
110
+ * does not know or care which node that is — that is the point of the ruling in the header.
111
+ */
112
+ send: (item: PendingSubmission) => Promise<SendSubmissionResult>;
113
+ /**
114
+ * A retry landed. The caller writes the same local record a first-pass send writes, or a later
115
+ * withdrawal has no handle to name. Called on the retry path only; the first-pass send records
116
+ * its own.
117
+ */
118
+ onAccepted: (item: PendingSubmission, stored: boolean) => void;
119
+ now?: () => number;
120
+ schedule?: (fn: () => void, ms: number) => ScheduledTask;
121
+ /** Gap between two attempts, so a queue of submissions is not a burst of frames. */
122
+ staggerMs?: number;
123
+ /** Ceiling on attempts that reached a node. */
124
+ maxAttempts?: number;
125
+ /** Wall-clock ceiling for a submission whose failures were all local preconditions. */
126
+ retryWindowMs?: number;
127
+ /**
128
+ * Gap before re-trying a LOCAL PRECONDITION failure. Injectable because it and `baseBackoffMs`
129
+ * were the only two intervals a test could not vary — which is why the live wiring test's green
130
+ * depended on a real reconnect ladder racing a real 5-second timer.
131
+ */
132
+ localPreconditionRetryMs?: number;
133
+ /** First non-local backoff; doubles from here. */
134
+ baseBackoffMs?: number;
135
+ /** Ceiling on pending submissions held at once, across all agents. */
136
+ queueCap?: number;
137
+ }
138
+ /**
139
+ * One hour. Chosen against the intake key, not against patience: the queued blob is sealed to the
140
+ * intake key the manifest published at compose time, and a manifest window is measured in weeks.
141
+ *
142
+ * THIS COMMENT USED TO ASSERT THAT AN HOUR "CANNOT OUTLIVE THE KEY", AND THAT WAS AN UNCHECKED
143
+ * CLAIM (review M4). It holds only when the manifest has more than an hour left at compose time.
144
+ * `composeSealedSubmission` refuses an already-expired manifest, but nothing stopped a submission
145
+ * composed one minute before expiry from being held and re-sent for the next fifty-nine — and the
146
+ * portal's rotated-key retention does not cover it either, because that rule keeps a retired key
147
+ * "until no undrained row references it" (M10B-D11) and a HELD submission has no row at any node.
148
+ * The result is exactly the state the expiry gate exists to prevent: a blob the portal cannot open
149
+ * and cannot attribute, arriving as poison with no reply possible — while the operator has been
150
+ * told it is held and needs nothing from them.
151
+ *
152
+ * So the CALLER checks rather than this comment asserting. See the enqueue site in `daemon.ts`,
153
+ * which has the manifest in hand and refuses to hold a submission whose intake key would expire
154
+ * inside this window.
155
+ */
156
+ export declare const DEFAULT_RETRY_WINDOW_MS: number;
157
+ /**
158
+ * The retry queue. One per daemon; keyed by (agentId, submissionId) because two agents on one
159
+ * daemon can each submit about the same subject and the rows are per-agent facts.
160
+ */
161
+ export declare class SubmissionRetryQueue {
162
+ #private;
163
+ constructor(deps: SubmissionRetryQueueDeps);
164
+ /**
165
+ * Take ownership of a submission whose send failed for a retryable reason.
166
+ *
167
+ * Returns `false` when the queue is full, and the caller then reports the plain failure — an
168
+ * operator who is told "the daemon has it" about a submission the daemon dropped is worse off
169
+ * than one who is told it failed, because only the second knows to act.
170
+ */
171
+ enqueue(item: PendingSubmission, lastReason: SubmissionSendFailure): boolean;
172
+ /**
173
+ * The agent's directory signaling stream reached 'connected' — the first connect and every
174
+ * reconnect after a drop. THIS IS THE FAILOVER. Which node it landed on is not this module's
175
+ * business and is deliberately not read.
176
+ */
177
+ onSignalingConnected(agentName: string): void;
178
+ /**
179
+ * What this agent still has in flight, and what was given up on. Read by `wallet_list_issued`,
180
+ * which is the surface behind `cello_attestations_issued` — the verb whose whole question is
181
+ * "what happened to what I sent?".
182
+ */
183
+ list(agentId: string): PendingSubmissionView[];
184
+ /**
185
+ * A submission finally landed by some other route — the operator re-issued it, and the
186
+ * first-pass send succeeded. Drop any give-up recorded for it (review L9).
187
+ *
188
+ * The id is content-derived, so re-issuing the SAME words about the SAME subject produces the
189
+ * SAME id: this is precisely the "I wrote it again and it worked" case. Without it the operator
190
+ * sees the old failure and the new accepted row side by side for the life of the daemon, with no
191
+ * way to dismiss the one that is no longer true.
192
+ */
193
+ clearGaveUp(agentId: string, submissionId: string): void;
194
+ /**
195
+ * Stop, and start nothing further.
196
+ *
197
+ * EVERY DROPPED SUBMISSION IS NAMED (review H2). The queue is in memory by design, but the
198
+ * operator was told in as many words "you do NOT need to run this again" — and before this, a
199
+ * restart left no durable trace anywhere naming what had been lost. A comment in the composition
200
+ * root asserting "in memory by design" is not a record; these lines are.
201
+ *
202
+ * The SUBJECT is logged and the body is not: the subject is a pubkey or a signal hash, and the
203
+ * body is the operator's own words about a third party, which this whole path exists to keep out
204
+ * of the clear on disk.
205
+ */
206
+ stop(): void;
207
+ }
208
+ //# sourceMappingURL=submission-retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submission-retry.d.ts","sourceRoot":"","sources":["../src/submission-retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,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