@cello-protocol/daemon 0.0.181 → 0.0.183

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 (197) hide show
  1. package/dist/agent-id-migration.d.ts +9 -0
  2. package/dist/agent-id-migration.d.ts.map +1 -1
  3. package/dist/agent-id-migration.js +73 -1
  4. package/dist/agent-id-migration.js.map +1 -1
  5. package/dist/agent-selection.d.ts +73 -0
  6. package/dist/agent-selection.d.ts.map +1 -0
  7. package/dist/agent-selection.js +80 -0
  8. package/dist/agent-selection.js.map +1 -0
  9. package/dist/agent-settings-keys.d.ts.map +1 -1
  10. package/dist/agent-settings-keys.js +18 -0
  11. package/dist/agent-settings-keys.js.map +1 -1
  12. package/dist/assignment-verify.d.ts +62 -0
  13. package/dist/assignment-verify.d.ts.map +1 -0
  14. package/dist/assignment-verify.js +185 -0
  15. package/dist/assignment-verify.js.map +1 -0
  16. package/dist/backup-restore.d.ts +102 -0
  17. package/dist/backup-restore.d.ts.map +1 -0
  18. package/dist/backup-restore.js +340 -0
  19. package/dist/backup-restore.js.map +1 -0
  20. package/dist/bin/cello-daemon.js +91 -49
  21. package/dist/bin/cello-daemon.js.map +1 -1
  22. package/dist/close-commitment.d.ts +67 -0
  23. package/dist/close-commitment.d.ts.map +1 -0
  24. package/dist/close-commitment.js +78 -0
  25. package/dist/close-commitment.js.map +1 -0
  26. package/dist/close-session-handler.d.ts +20 -0
  27. package/dist/close-session-handler.d.ts.map +1 -1
  28. package/dist/close-session-handler.js +351 -58
  29. package/dist/close-session-handler.js.map +1 -1
  30. package/dist/consortium-bootstrap.d.ts +2 -0
  31. package/dist/consortium-bootstrap.d.ts.map +1 -1
  32. package/dist/consortium-bootstrap.js +182 -9
  33. package/dist/consortium-bootstrap.js.map +1 -1
  34. package/dist/content-encryption-status.d.ts +97 -0
  35. package/dist/content-encryption-status.d.ts.map +1 -0
  36. package/dist/content-encryption-status.js +122 -0
  37. package/dist/content-encryption-status.js.map +1 -0
  38. package/dist/content-park-client.d.ts +10 -0
  39. package/dist/content-park-client.d.ts.map +1 -1
  40. package/dist/content-park-client.js +84 -3
  41. package/dist/content-park-client.js.map +1 -1
  42. package/dist/content-park.d.ts.map +1 -1
  43. package/dist/content-park.js +323 -21
  44. package/dist/content-park.js.map +1 -1
  45. package/dist/daemon.d.ts +13 -1
  46. package/dist/daemon.d.ts.map +1 -1
  47. package/dist/daemon.js +1168 -141
  48. package/dist/daemon.js.map +1 -1
  49. package/dist/delivery-session-suspects.d.ts.map +1 -1
  50. package/dist/delivery-session-suspects.js +5 -0
  51. package/dist/delivery-session-suspects.js.map +1 -1
  52. package/dist/directory-auth-posture.d.ts +87 -0
  53. package/dist/directory-auth-posture.d.ts.map +1 -0
  54. package/dist/directory-auth-posture.js +134 -0
  55. package/dist/directory-auth-posture.js.map +1 -0
  56. package/dist/directory-bootstrap.d.ts +66 -3
  57. package/dist/directory-bootstrap.d.ts.map +1 -1
  58. package/dist/directory-bootstrap.js +133 -7
  59. package/dist/directory-bootstrap.js.map +1 -1
  60. package/dist/document-delivery-transport.d.ts +22 -2
  61. package/dist/document-delivery-transport.d.ts.map +1 -1
  62. package/dist/document-delivery-transport.js +11 -3
  63. package/dist/document-delivery-transport.js.map +1 -1
  64. package/dist/document-handlers.d.ts.map +1 -1
  65. package/dist/document-handlers.js +119 -0
  66. package/dist/document-handlers.js.map +1 -1
  67. package/dist/document-layer.d.ts +0 -2
  68. package/dist/document-layer.d.ts.map +1 -1
  69. package/dist/document-layer.js.map +1 -1
  70. package/dist/inbound-sessions.d.ts +31 -1
  71. package/dist/inbound-sessions.d.ts.map +1 -1
  72. package/dist/inbound-sessions.js +276 -16
  73. package/dist/inbound-sessions.js.map +1 -1
  74. package/dist/index.d.ts +2 -0
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +3 -0
  77. package/dist/index.js.map +1 -1
  78. package/dist/initiate-session-handler.d.ts.map +1 -1
  79. package/dist/initiate-session-handler.js +34 -3
  80. package/dist/initiate-session-handler.js.map +1 -1
  81. package/dist/ipc-server.d.ts +5 -1
  82. package/dist/ipc-server.d.ts.map +1 -1
  83. package/dist/ipc-server.js +19 -3
  84. package/dist/ipc-server.js.map +1 -1
  85. package/dist/manifest-deps.d.ts +0 -11
  86. package/dist/manifest-deps.d.ts.map +1 -1
  87. package/dist/manifest-deps.js +28 -2
  88. package/dist/manifest-deps.js.map +1 -1
  89. package/dist/manifest-validity.d.ts +153 -0
  90. package/dist/manifest-validity.d.ts.map +1 -0
  91. package/dist/manifest-validity.js +268 -0
  92. package/dist/manifest-validity.js.map +1 -0
  93. package/dist/notification-handlers.d.ts.map +1 -1
  94. package/dist/notification-handlers.js +15 -0
  95. package/dist/notification-handlers.js.map +1 -1
  96. package/dist/outbound-sessions.d.ts +31 -0
  97. package/dist/outbound-sessions.d.ts.map +1 -1
  98. package/dist/outbound-sessions.js +217 -17
  99. package/dist/outbound-sessions.js.map +1 -1
  100. package/dist/park-envelope.d.ts +95 -1
  101. package/dist/park-envelope.d.ts.map +1 -1
  102. package/dist/park-envelope.js +195 -4
  103. package/dist/park-envelope.js.map +1 -1
  104. package/dist/refusal-reasons.d.ts +72 -0
  105. package/dist/refusal-reasons.d.ts.map +1 -0
  106. package/dist/refusal-reasons.js +69 -0
  107. package/dist/refusal-reasons.js.map +1 -0
  108. package/dist/register-handler.d.ts.map +1 -1
  109. package/dist/register-handler.js +76 -0
  110. package/dist/register-handler.js.map +1 -1
  111. package/dist/registration-manager.d.ts.map +1 -1
  112. package/dist/registration-manager.js +20 -1
  113. package/dist/registration-manager.js.map +1 -1
  114. package/dist/relay-only.d.ts +133 -0
  115. package/dist/relay-only.d.ts.map +1 -0
  116. package/dist/relay-only.js +183 -0
  117. package/dist/relay-only.js.map +1 -0
  118. package/dist/restart-seal-resolver.d.ts.map +1 -1
  119. package/dist/restart-seal-resolver.js +6 -0
  120. package/dist/restart-seal-resolver.js.map +1 -1
  121. package/dist/retry-queue.d.ts +49 -2
  122. package/dist/retry-queue.d.ts.map +1 -1
  123. package/dist/retry-queue.js +55 -10
  124. package/dist/retry-queue.js.map +1 -1
  125. package/dist/roster-freshness.d.ts +169 -0
  126. package/dist/roster-freshness.d.ts.map +1 -0
  127. package/dist/roster-freshness.js +249 -0
  128. package/dist/roster-freshness.js.map +1 -0
  129. package/dist/seal-certificate-pull.d.ts +17 -1
  130. package/dist/seal-certificate-pull.d.ts.map +1 -1
  131. package/dist/seal-certificate-pull.js +37 -3
  132. package/dist/seal-certificate-pull.js.map +1 -1
  133. package/dist/seal-coordinator.d.ts +17 -1
  134. package/dist/seal-coordinator.d.ts.map +1 -1
  135. package/dist/seal-coordinator.js +71 -0
  136. package/dist/seal-coordinator.js.map +1 -1
  137. package/dist/seal-failure-store.d.ts +104 -0
  138. package/dist/seal-failure-store.d.ts.map +1 -0
  139. package/dist/seal-failure-store.js +126 -0
  140. package/dist/seal-failure-store.js.map +1 -0
  141. package/dist/seal-flows.d.ts.map +1 -1
  142. package/dist/seal-flows.js +35 -6
  143. package/dist/seal-flows.js.map +1 -1
  144. package/dist/seal-upgrade.d.ts +20 -5
  145. package/dist/seal-upgrade.d.ts.map +1 -1
  146. package/dist/seal-upgrade.js +28 -5
  147. package/dist/seal-upgrade.js.map +1 -1
  148. package/dist/session-assignment-parser.d.ts +41 -5
  149. package/dist/session-assignment-parser.d.ts.map +1 -1
  150. package/dist/session-assignment-parser.js +77 -14
  151. package/dist/session-assignment-parser.js.map +1 -1
  152. package/dist/session-ceremony.d.ts +35 -0
  153. package/dist/session-ceremony.d.ts.map +1 -1
  154. package/dist/session-ceremony.js +97 -0
  155. package/dist/session-ceremony.js.map +1 -1
  156. package/dist/session-connection-gater.d.ts +46 -7
  157. package/dist/session-connection-gater.d.ts.map +1 -1
  158. package/dist/session-connection-gater.js +163 -12
  159. package/dist/session-connection-gater.js.map +1 -1
  160. package/dist/session-content-handlers.d.ts +12 -0
  161. package/dist/session-content-handlers.d.ts.map +1 -1
  162. package/dist/session-content-handlers.js +149 -8
  163. package/dist/session-content-handlers.js.map +1 -1
  164. package/dist/session-node-manager.d.ts +653 -40
  165. package/dist/session-node-manager.d.ts.map +1 -1
  166. package/dist/session-node-manager.js +5938 -374
  167. package/dist/session-node-manager.js.map +1 -1
  168. package/dist/session-read-handlers.d.ts +27 -0
  169. package/dist/session-read-handlers.d.ts.map +1 -1
  170. package/dist/session-read-handlers.js +127 -6
  171. package/dist/session-read-handlers.js.map +1 -1
  172. package/dist/session-relay-client.d.ts +177 -2
  173. package/dist/session-relay-client.d.ts.map +1 -1
  174. package/dist/session-relay-client.js +564 -16
  175. package/dist/session-relay-client.js.map +1 -1
  176. package/dist/session-salt-agreement.d.ts +338 -0
  177. package/dist/session-salt-agreement.d.ts.map +1 -0
  178. package/dist/session-salt-agreement.js +478 -0
  179. package/dist/session-salt-agreement.js.map +1 -0
  180. package/dist/signal-submission.d.ts.map +1 -1
  181. package/dist/signal-submission.js +10 -1
  182. package/dist/signal-submission.js.map +1 -1
  183. package/dist/signaling-connect.d.ts +18 -1
  184. package/dist/signaling-connect.d.ts.map +1 -1
  185. package/dist/signaling-connect.js +206 -6
  186. package/dist/signaling-connect.js.map +1 -1
  187. package/dist/types.d.ts +75 -0
  188. package/dist/types.d.ts.map +1 -1
  189. package/dist/types.js.map +1 -1
  190. package/dist/vocabulary.d.ts.map +1 -1
  191. package/dist/vocabulary.js +10 -0
  192. package/dist/vocabulary.js.map +1 -1
  193. package/dist/wire-content-hash.d.ts +68 -0
  194. package/dist/wire-content-hash.d.ts.map +1 -1
  195. package/dist/wire-content-hash.js +83 -0
  196. package/dist/wire-content-hash.js.map +1 -1
  197. package/package.json +5 -5
@@ -30,6 +30,7 @@ import { decode as cborDecode } from "cbor-x";
30
30
  import { encodeCbor } from "@cello-protocol/protocol-types";
31
31
  import { verify, sealToRecipient } from "@cello-protocol/crypto";
32
32
  import { buildParkContentTbs } from "@cello-protocol/protocol-types";
33
+ import { CONTENT_HASH_ALGS, isKnownContentHashAlg } from "./wire-content-hash.js";
33
34
  /**
34
35
  * Compare an identity key (raw bytes) against a stored hex pubkey — on BYTES, never on the hex
35
36
  * strings.
@@ -61,20 +62,130 @@ export function pubkeyMatchesHex(pubkey, storedHex) {
61
62
  }
62
63
  /** Current envelope version. v1 (unsigned) is decodable but NEVER acceptable — see authenticate(). */
63
64
  export const PARK_ENVELOPE_VERSION = 2;
65
+ /**
66
+ * v3 — a v2 envelope plus the CONTENT-HASH ALGORITHM (`DOD-M15-SEALWIRE-1` part B2a).
67
+ *
68
+ * ⚠️ EMITTED ONLY WHEN THE ALGORITHM IS NOT THE DEFAULT, and that is the whole compatibility story.
69
+ * Every envelope this build produces today is still v2, because nothing salts — so no current peer
70
+ * sees a version it cannot read.
71
+ *
72
+ * 🚨 AND THE GATE IS A PUBLISHING FACT, NOT A STRUCTURAL ONE — review B2a F6 corrected this. The
73
+ * header used to claim *"a salted envelope can only be addressed to a peer that completed the salt
74
+ * agreement, and a build able to do that necessarily contains this decoder."* **False as stated:**
75
+ * the salt agreement landed several commits before this decoder, so any build cut from that interval
76
+ * has the agreement and not the decoder. On such a peer a v3 envelope matches no decode branch,
77
+ * falls through to the bare-content v1 shape, and `authenticateParkedEntry` refuses it as
78
+ * `unsigned_envelope` — the ATTACKER shape — the entry is never confirm-deleted, and it re-pulls
79
+ * forever. Exactly the failure this unit exists to prevent.
80
+ *
81
+ * What is true, and checkable: **no published build has the salt agreement without this decoder** —
82
+ * nothing in that interval is tagged. Part B2b must therefore gate salting on a real peer-capability
83
+ * signal rather than inferring capability from "they completed the salt agreement".
84
+ *
85
+ * Why the algorithm is NOT in the signed statement: `parkSig` covers `(session_id, recipient_pubkey,
86
+ * content_hash)` — the HASH, not the name of the function that produced it. Adding the name would
87
+ * change `buildParkContentTbs`, a cross-repo type, for no security gain. An attacker who flips the
88
+ * name cannot make altered content verify, because the recomputed hash must still equal the SIGNED
89
+ * one; a flip can only turn an acceptance into a REFUSAL. `dod-m15-park-envelope-alg.test.ts` pins
90
+ * that, because "only a refusal" is a claim rather than a hope.
91
+ */
92
+ export const PARK_ENVELOPE_VERSION_ALG = 3;
93
+ /**
94
+ * The versions that carry a sender signature and may therefore be authenticated.
95
+ *
96
+ * A SET, not a single constant, and the difference is mail loss. `authenticateParkedEntry` refused
97
+ * anything whose version was not the one `PARK_ENVELOPE_VERSION` names — so bumping that constant to
98
+ * 3 would have turned every v2 envelope sitting in every relay mailbox into `unsigned_envelope`:
99
+ * store-and-forward mail destroyed, and reported as an attack.
100
+ */
101
+ const SIGNED_ENVELOPE_VERSIONS = new Set([PARK_ENVELOPE_VERSION, PARK_ENVELOPE_VERSION_ALG]);
102
+ /**
103
+ * Why this build refused to SEAL an entry — the producer side, distinct from `ParkAuthFailure`,
104
+ * which is why it refused to ACCEPT one.
105
+ */
106
+ export const PARK_ENVELOPE_REASONS = {
107
+ /** The entry names a content-hash algorithm this build cannot itself reproduce. */
108
+ ALG_UNREADABLE: "park_envelope_alg_unreadable",
109
+ };
110
+ /**
111
+ * The relay's park-refusal codes.
112
+ *
113
+ * ⚠️ RE-EXPORTED FROM `@cello-protocol/protocol-types`, NOT declared here. They used to be a private
114
+ * copy that happened to agree with the relay's strings — verified by hand once, which is not a
115
+ * guard. A rename on the relay side would have left this copy silently unmatched, falling through to
116
+ * the generic "the relay link is down" wording: the exact defect this family of work removed,
117
+ * reintroduced by a change nobody would think of as a protocol change.
118
+ */
119
+ import { RELAY_PARK_REFUSALS } from "@cello-protocol/protocol-types";
120
+ export { RELAY_PARK_REFUSALS };
121
+ /**
122
+ * A REFUSAL TO SEAL, carrying a code the caller can branch on — `DOD-M15-SEALWIRE-1` B2b-2
123
+ * constraint 6, inherited from B2a's review.
124
+ *
125
+ * ⚠️ THE PROSE WAS NEVER THE PROBLEM; WHERE IT LANDED WAS. This threw a bare `Error` with a clear
126
+ * paragraph, and `#parkContent`'s catch put `err.message` into `cause` — a field its own callers
127
+ * document as the MACHINE-READABLE half, added (M12-P13) so that nobody would have to substring-match
128
+ * English to decide what to do. A paragraph there is unbranchable, so this fault fell into the
129
+ * generic relay branch and inherited its guidance: *"the relay refused the hand-off, so the message
130
+ * is queued and will be re-sent automatically when the relay link is back."*
131
+ *
132
+ * Both halves of that are false here. The relay was never asked, and every re-park throws in exactly
133
+ * the same place, so the message sits in the queue while its sender waits for a recovery that cannot
134
+ * happen. Splitting the code from the prose is what lets the caller say something true instead.
135
+ */
136
+ export class ParkEnvelopeError extends Error {
137
+ reason;
138
+ /** The offending value alone, so a caller can log it without re-parsing the sentence. */
139
+ detail;
140
+ constructor(reason, detail, message) {
141
+ super(message);
142
+ this.name = "ParkEnvelopeError";
143
+ this.reason = reason;
144
+ this.detail = detail;
145
+ }
146
+ }
64
147
  /**
65
148
  * SEC-1: encode a SIGNED park envelope. `senderPubkey` and `parkSig` are REQUIRED — the type system
66
149
  * is the enforcement point, so no call site can construct an unsigned envelope by omission (the
67
150
  * exact drift that made this a downgrade attack: verification existed, but was opt-in).
68
151
  */
69
152
  export function encodeParkEnvelope(args) {
70
- return encodeCbor([
71
- PARK_ENVELOPE_VERSION,
153
+ const base = [
72
154
  args.content,
73
155
  args.structure1Cbor ?? null,
74
156
  args.structure2Cbor ?? null,
75
157
  args.senderPubkey,
76
158
  args.parkSig,
77
- ]);
159
+ ];
160
+ /**
161
+ * The DEFAULT algorithm stays on v2 even when named explicitly. A caller that starts passing the
162
+ * algorithm through would otherwise push every envelope to a version older peers cannot read,
163
+ * without anyone having decided to.
164
+ *
165
+ * ABSENT is `undefined`/`null` ONLY, never "falsy" — review B2a F4. `!args.contentHashAlg` also
166
+ * caught the EMPTY STRING, which is the collapse `resolveContentHashAlg` documents as forbidden
167
+ * and which this file's own `contentHashAlg` doc cites B1 for. A caller whose variable is `""`
168
+ * would have emitted a v2 envelope labelled sha256-by-absence, and the recipient would report a
169
+ * tamper on a message nobody touched.
170
+ */
171
+ const alg = args.contentHashAlg;
172
+ if (alg === undefined || alg === null || alg === CONTENT_HASH_ALGS.SHA256) {
173
+ return encodeCbor([PARK_ENVELOPE_VERSION, ...base]);
174
+ }
175
+ /**
176
+ * REFUSE TO EMIT A NAME WE CANNOT READ OURSELVES — the producer-side mirror of what
177
+ * `contentHashFor` already does, and it costs nothing to have.
178
+ *
179
+ * Without it a caller can seal an envelope every peer refuses — including this build — with no
180
+ * signal at the sender at all: the message parks, is pulled, is refused, is kept, and repeats.
181
+ * A throw here is a developer error at the moment it is made, rather than a silent mail loop.
182
+ */
183
+ if (!isKnownContentHashAlg(alg)) {
184
+ throw new ParkEnvelopeError(PARK_ENVELOPE_REASONS.ALG_UNREADABLE, alg, `PARK ENVELOPE: refusing to seal an entry naming content-hash algorithm "${alg}", which this ` +
185
+ "build cannot itself reproduce. The recipient would refuse it and keep re-pulling it forever, " +
186
+ "and nothing at the sender would say why.");
187
+ }
188
+ return encodeCbor([PARK_ENVELOPE_VERSION_ALG, ...base, alg]);
78
189
  }
79
190
  /**
80
191
  * SEC-1 — THE ONLY PRODUCER. Sign the entry as the sending agent, wrap it in a v2 envelope, and seal
@@ -97,6 +208,7 @@ export async function sealParkEnvelope(args) {
97
208
  structure2Cbor: args.structure2Cbor,
98
209
  senderPubkey,
99
210
  parkSig,
211
+ contentHashAlg: args.contentHashAlg,
100
212
  });
101
213
  // The signature rides INSIDE the seal — the relay (the adversary) never sees it, so it can neither
102
214
  // strip nor forge it. INV-3 is untouched: the relay still holds only ciphertext.
@@ -110,6 +222,20 @@ export async function sealParkEnvelope(args) {
110
222
  export function decodeParkEnvelope(plaintext) {
111
223
  try {
112
224
  const arr = cborDecode(plaintext);
225
+ // v3 first: a v2 envelope plus the content-hash algorithm as a 7th element.
226
+ if (Array.isArray(arr) && arr.length === 7 && arr[0] === PARK_ENVELOPE_VERSION_ALG && arr[1] instanceof Uint8Array) {
227
+ return {
228
+ version: PARK_ENVELOPE_VERSION_ALG,
229
+ content: arr[1],
230
+ structure1Cbor: arr[2] instanceof Uint8Array ? arr[2] : undefined,
231
+ structure2Cbor: arr[3] instanceof Uint8Array ? arr[3] : undefined,
232
+ senderPubkey: arr[4] instanceof Uint8Array ? arr[4] : undefined,
233
+ parkSig: arr[5] instanceof Uint8Array ? arr[5] : undefined,
234
+ // A non-string here stays ABSENT rather than being coerced. `resolveContentHashAlg` refuses
235
+ // a name it cannot read; it must never be handed a `"42"` that looks like one.
236
+ contentHashAlg: typeof arr[6] === "string" ? arr[6] : undefined,
237
+ };
238
+ }
113
239
  if (Array.isArray(arr) && arr.length === 6 && arr[0] === PARK_ENVELOPE_VERSION && arr[1] instanceof Uint8Array) {
114
240
  return {
115
241
  version: PARK_ENVELOPE_VERSION,
@@ -148,7 +274,7 @@ export function authenticateParkedEntry(args) {
148
274
  const { env, sessionIdHex, recipientPubkey, contentHash, counterpartyPubkeyHex } = args;
149
275
  // 1. Unsigned (v1 envelope, or raw bare content) — the shape an attacker sends, and the shape the
150
276
  // pre-SEC-1 daemon ingested without a single check. Refused outright.
151
- if (env.version !== PARK_ENVELOPE_VERSION || !env.senderPubkey || !env.parkSig) {
277
+ if (!SIGNED_ENVELOPE_VERSIONS.has(env.version) || !env.senderPubkey || !env.parkSig) {
152
278
  return { ok: false, reason: "unsigned_envelope" };
153
279
  }
154
280
  // 2. Fail closed when there is no counterparty to bind the signer to.
@@ -170,4 +296,69 @@ export function authenticateParkedEntry(args) {
170
296
  }
171
297
  return { ok: true };
172
298
  }
299
+ /**
300
+ * The operator-facing guidance for a refused park hand-off — **a pure function, deliberately.**
301
+ *
302
+ * ⚠️ It was an inline ternary inside `sendContent`, which meant the only way to assert any branch of
303
+ * it was to stand up a two-connection fixture and drive a real send. That is why the branch that was
304
+ * WRONG for a throttling relay survived: nothing cheap could reach it. A guidance string is a
305
+ * decision about what a person does next, and it deserves to be testable on its own.
306
+ *
307
+ * `durable` distinguishes "queued and will retry" from "not queued — it is lost", which is the one
308
+ * distinction that changes whether the reader must act right now.
309
+ */
310
+ export function parkRefusalGuidance(cause, durable, retryAfterMs) {
311
+ if (cause === PARK_ENVELOPE_REASONS.ALG_UNREADABLE) {
312
+ return ("This message names a content-hash algorithm your build cannot produce, so it could not be " +
313
+ "sealed for hand-off. The relay is NOT involved and this will not clear on its own — the " +
314
+ "message is safely stored but every retry fails the same way. Upgrade to a build that knows " +
315
+ "the algorithm, or start a new session with this counterparty. Re-sending on this build " +
316
+ "changes nothing.");
317
+ }
318
+ /**
319
+ * ⚠️ DIAGNOSIS AND ACTION ARE COMPOSED, NOT WRITTEN TOGETHER — and this shape is the fix for a
320
+ * defect review found in the first version.
321
+ *
322
+ * That version returned a complete paragraph per cause and **never consulted `durable`**, so all
323
+ * three new branches ended "The message is queued and re-sent automatically. Do not re-send it."
324
+ * `durable` is OBSERVED, not assumed: it is false when the durable enqueue was refused as a
325
+ * duplicate, or when the retry hook is unwired. In that case the daemon logs at ERROR that the
326
+ * content is *not* separately retained while the operator was simultaneously told it was queued
327
+ * and instructed not to re-send. **Nothing held the message.** That is precisely the lie this
328
+ * family of work exists to kill, reintroduced one layer up.
329
+ *
330
+ * Splitting them makes the mistake unavailable: the action half is produced in exactly one place
331
+ * and cannot be reached without reading the flag.
332
+ */
333
+ const diagnosis = cause === RELAY_PARK_REFUSALS.RATE_LIMITED
334
+ ? `The relay is healthy and deliberately rate-limiting this agent's hand-offs, so it refused this one. NOTHING IS WRONG with the link or the counterparty, and the limit clears on its own${describeRetryWindow(retryAfterMs)}.`
335
+ : cause === RELAY_PARK_REFUSALS.RECIPIENT_FULL
336
+ ? "The relay is holding as much undelivered content for THIS counterparty as it will, so it refused the hand-off. That is about their mailbox, not your connection, and another relay would refuse it too. It clears when they come online and collect it, or when older entries expire."
337
+ : cause === RELAY_PARK_REFUSALS.STORE_FULL
338
+ ? "The relay's parked-content store is full, so it refused the hand-off. The link is fine. If this persists the relay operator needs to know — it means the store is under sustained pressure."
339
+ : null;
340
+ if (diagnosis !== null) {
341
+ return durable
342
+ ? `${diagnosis} The message is queued and re-sent automatically. Do not re-send it: an identical re-send is not separately queued.`
343
+ : `${diagnosis} ⚠️ BUT THIS MESSAGE WAS NOT QUEUED — it is lost. Send it again.`;
344
+ }
345
+ return durable
346
+ ? "Direct delivery failed and the relay refused the hand-off, so the message is queued and will be re-sent automatically when the relay link is back. Do not re-send it: an identical re-send is not separately queued."
347
+ : "Direct delivery failed and the message could NOT be queued for retry — it is lost. Send it again.";
348
+ }
349
+ /**
350
+ * Render the relay's own retry delay, or say nothing at all.
351
+ *
352
+ * ⚠️ SAYS NOTHING WHEN THE RELAY DID NOT SAY — review MEDIUM-6. The first version of the guidance
353
+ * asserted the limit clears *"in about a minute"*, which is a hardcoded guess about the relay's
354
+ * CONFIGURABLE window: a relay run at ten minutes makes that a wrong promise, and a wrong number is
355
+ * worse than no number because the reader plans around it. When the relay tells us, we quote it;
356
+ * when it does not, the sentence simply ends.
357
+ */
358
+ function describeRetryWindow(retryAfterMs) {
359
+ if (retryAfterMs === undefined || !Number.isFinite(retryAfterMs) || retryAfterMs <= 0)
360
+ return "";
361
+ const seconds = Math.ceil(retryAfterMs / 1000);
362
+ return seconds < 90 ? ` in about ${String(seconds)} seconds` : ` in about ${String(Math.ceil(seconds / 60))} minutes`;
363
+ }
173
364
  //# sourceMappingURL=park-envelope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"park-envelope.js","sourceRoot":"","sources":["../src/park-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,eAAe,EAAoB,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAkB,EAAE,SAA6B;IAChF,IAAI,CAAC,S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 @@
1
+ /**
2
+ * Refusal reason codes shared between the site that RECORDS a refusal and the site that EXPLAINS it.
3
+ *
4
+ * DOD-M15-OFFER-SIGNED-1 review N8. These strings were duplicated literals across
5
+ * `inbound-sessions.ts` (which calls `recordRefusal`) and `notification-handlers.ts` (which looks
6
+ * the reason up to attach guidance), with nothing binding them. Rename or mistype either side and
7
+ * the lookup silently misses: the operator gets a bare reason code again, which is exactly the
8
+ * defect the guidance was added to fix — reintroduced by a typo, with every test still green.
9
+ *
10
+ * A shared constant makes that a compile error instead. `REFUSAL_REASONS` is the single source; the
11
+ * guidance table below is keyed by its values, so a reason without guidance cannot be added silently.
12
+ */
13
+ export declare const REFUSAL_REASONS: {
14
+ /** The session_offer and the session_assignment named different dialers for one session. */
15
+ readonly OFFER_ASSIGNMENT_DIALER_MISMATCH: "offer_assignment_dialer_mismatch";
16
+ /** The directory named a different threshold group key for an already-known counterparty. */
17
+ readonly COUNTERPARTY_PRIMARY_KEY_CHANGED: "counterparty_primary_key_changed";
18
+ /** The inbound assignment failed verification (signature, signer, or shape). */
19
+ readonly INBOUND_ASSIGNMENT_INVALID: "inbound_assignment_invalid";
20
+ };
21
+ export type RefusalReason = (typeof REFUSAL_REASONS)[keyof typeof REFUSAL_REASONS];
22
+ /**
23
+ * The CAPACITY refusals — bounds, not security findings.
24
+ *
25
+ * These deliberately carry no guidance: their codes say what happened, and the cap path already
26
+ * sends the sender their own numbers over the wire. They are declared here anyway so that
27
+ * `recordRefusal` can take a CLOSED union.
28
+ *
29
+ * ⚠️ BYTE-IDENTICAL BY DESIGN. A BLOCKED sender and an over-cap UNKNOWN one must be
30
+ * indistinguishable, or the refusal tells someone they are blocked. Do not add a reason that
31
+ * separates them.
32
+ */
33
+ export declare const CAPACITY_REASONS: {
34
+ readonly ABUSE_BOUND_SESSIONS_PER_SENDER: "abuse_bound_sessions_per_sender";
35
+ readonly ABUSE_BOUND_UNKNOWN_SESSIONS_GLOBAL: "abuse_bound_unknown_sessions_global";
36
+ };
37
+ export type CapacityReason = (typeof CAPACITY_REASONS)[keyof typeof CAPACITY_REASONS];
38
+ /**
39
+ * Every reason a session may be refused with — the CLOSED set.
40
+ *
41
+ * ─── Why this is a union and not `string` ──────────────────────────────────────────────────────
42
+ *
43
+ * `recordRefusal` used to take `reason: string`, because capacity bounds legitimately pass their own
44
+ * codes. A review measured what that permitted: **add a new security refusal recording a free-form
45
+ * `"assignment_epoch_replayed"` and the entire gate stays green** — the guard fires, the operator
46
+ * gets a bare code with no guidance, and nothing notices, because every test enumerates
47
+ * `REFUSAL_REASONS` and the new code was never in it.
48
+ *
49
+ * That is the guard-nobody-hears pattern in its FORWARD direction: not the four occurrences already
50
+ * fixed, but the next one. A test cannot see a code that does not exist yet. A type can.
51
+ *
52
+ * So the set is closed. Adding a refusal now means adding a member here, and a security member
53
+ * without guidance fails to compile against `REFUSAL_GUIDANCE`'s total map. `DOD-M15-GUARD-HEARD-1`.
54
+ */
55
+ export type AnyRefusalReason = RefusalReason | CapacityReason;
56
+ /**
57
+ * What the operator should DO, per reason.
58
+ *
59
+ * A bare reason code is not an affordance. These are the SECURITY refusals from the inbound
60
+ * assignment path — the ones where the operator needs to know something was refused on purpose,
61
+ * what it means, and (for the identity change) that the next step happens OUTSIDE CELLO.
62
+ *
63
+ * Typed as a total map over `RefusalReason`, so adding a reason without guidance fails to compile.
64
+ *
65
+ * ⚠️ THE READER IS THE RESPONDER'S OPERATOR, and every verb here must be one THEY can perform.
66
+ * Two of these said "Retry" — which is the INITIATOR's move. The person reading this did not start
67
+ * the session and has nothing to retry; telling them to is an affordance that resolves to nothing,
68
+ * which is worse than no advice because they will try to follow it. The retry advice belongs in the
69
+ * `session_refused` frame, which goes to the side that can act on it.
70
+ */
71
+ export declare const REFUSAL_GUIDANCE: Record<RefusalReason, string>;
72
+ //# sourceMappingURL=refusal-reasons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refusal-reasons.d.ts","sourceRoot":"","sources":["../src/refusal-reasons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,eAAe;IAC1B,4FAA4F;;IAE5F,6FAA6F;;IAE7F,gFAAgF;;CAExE,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEnF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,cAAc,CAAC;AAE9D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAoB1D,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Refusal reason codes shared between the site that RECORDS a refusal and the site that EXPLAINS it.
3
+ *
4
+ * DOD-M15-OFFER-SIGNED-1 review N8. These strings were duplicated literals across
5
+ * `inbound-sessions.ts` (which calls `recordRefusal`) and `notification-handlers.ts` (which looks
6
+ * the reason up to attach guidance), with nothing binding them. Rename or mistype either side and
7
+ * the lookup silently misses: the operator gets a bare reason code again, which is exactly the
8
+ * defect the guidance was added to fix — reintroduced by a typo, with every test still green.
9
+ *
10
+ * A shared constant makes that a compile error instead. `REFUSAL_REASONS` is the single source; the
11
+ * guidance table below is keyed by its values, so a reason without guidance cannot be added silently.
12
+ */
13
+ export const REFUSAL_REASONS = {
14
+ /** The session_offer and the session_assignment named different dialers for one session. */
15
+ OFFER_ASSIGNMENT_DIALER_MISMATCH: "offer_assignment_dialer_mismatch",
16
+ /** The directory named a different threshold group key for an already-known counterparty. */
17
+ COUNTERPARTY_PRIMARY_KEY_CHANGED: "counterparty_primary_key_changed",
18
+ /** The inbound assignment failed verification (signature, signer, or shape). */
19
+ INBOUND_ASSIGNMENT_INVALID: "inbound_assignment_invalid",
20
+ };
21
+ /**
22
+ * The CAPACITY refusals — bounds, not security findings.
23
+ *
24
+ * These deliberately carry no guidance: their codes say what happened, and the cap path already
25
+ * sends the sender their own numbers over the wire. They are declared here anyway so that
26
+ * `recordRefusal` can take a CLOSED union.
27
+ *
28
+ * ⚠️ BYTE-IDENTICAL BY DESIGN. A BLOCKED sender and an over-cap UNKNOWN one must be
29
+ * indistinguishable, or the refusal tells someone they are blocked. Do not add a reason that
30
+ * separates them.
31
+ */
32
+ export const CAPACITY_REASONS = {
33
+ ABUSE_BOUND_SESSIONS_PER_SENDER: "abuse_bound_sessions_per_sender",
34
+ ABUSE_BOUND_UNKNOWN_SESSIONS_GLOBAL: "abuse_bound_unknown_sessions_global",
35
+ };
36
+ /**
37
+ * What the operator should DO, per reason.
38
+ *
39
+ * A bare reason code is not an affordance. These are the SECURITY refusals from the inbound
40
+ * assignment path — the ones where the operator needs to know something was refused on purpose,
41
+ * what it means, and (for the identity change) that the next step happens OUTSIDE CELLO.
42
+ *
43
+ * Typed as a total map over `RefusalReason`, so adding a reason without guidance fails to compile.
44
+ *
45
+ * ⚠️ THE READER IS THE RESPONDER'S OPERATOR, and every verb here must be one THEY can perform.
46
+ * Two of these said "Retry" — which is the INITIATOR's move. The person reading this did not start
47
+ * the session and has nothing to retry; telling them to is an affordance that resolves to nothing,
48
+ * which is worse than no advice because they will try to follow it. The retry advice belongs in the
49
+ * `session_refused` frame, which goes to the side that can act on it.
50
+ */
51
+ export const REFUSAL_GUIDANCE = {
52
+ [REFUSAL_REASONS.COUNTERPARTY_PRIMARY_KEY_CHANGED]: "REFUSED ON PURPOSE. The directory named a different signing identity for a contact you have " +
53
+ "completed sessions with before. Either they genuinely re-registered — confirm that with them " +
54
+ "OUT OF BAND (a channel that is not this one), then run cello_contact_remove for them, which " +
55
+ "clears the pinned identity so the next session re-pins — or a directory is substituting an " +
56
+ "identity. Do not accept a session from them until you know which.",
57
+ [REFUSAL_REASONS.OFFER_ASSIGNMENT_DIALER_MISMATCH]: "REFUSED ON PURPOSE. The directory's session offer named one dialer and the session assignment " +
58
+ "named another, so the two frames for one session disagree. A stale or replayed offer produces " +
59
+ "this too, so one occurrence is not proof of a hostile directory. Nothing was accepted, and " +
60
+ "nothing is wrong on your side — the other party has been told to start a new session. If the " +
61
+ "SAME counterparty keeps failing this way, stop treating it as noise: confirm out of band that " +
62
+ "they are the one dialling you, and until they answer, do not accept a session from them.",
63
+ [REFUSAL_REASONS.INBOUND_ASSIGNMENT_INVALID]: "REFUSED ON PURPOSE. The session assignment did not verify, so this agent would have been " +
64
+ "opening its receiver to a peer named by a document it could not check. Nothing was accepted. " +
65
+ "There is nothing for you to retry — the other party holds the session and has been told to " +
66
+ "start a new one. If it repeats for the SAME counterparty, do not accept anything from them " +
67
+ "until you have confirmed out of band that they still control the identity you know them by.",
68
+ };
69
+ //# sourceMappingURL=refusal-reasons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refusal-reasons.js","sourceRoot":"","sources":["../src/refusal-reasons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,4FAA4F;IAC5F,gCAAgC,EAAE,kCAAkC;IACpE,6FAA6F;IAC7F,gCAAgC,EAAE,kCAAkC;IACpE,gFAAgF;IAChF,0BAA0B,EAAE,4BAA4B;CAChD,CAAC;AAIX;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,+BAA+B,EAAE,iCAAiC;IAClE,mCAAmC,EAAE,qCAAqC;CAClE,CAAC;AAuBX;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkC;IAC7D,CAAC,eAAe,CAAC,gCAAgC,CAAC,EAChD,8FAA8F;QAC9F,+FAA+F;QAC/F,8FAA8F;QAC9F,6FAA6F;QAC7F,mEAAmE;IACrE,CAAC,eAAe,CAAC,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
18
18
  import { DaemonRegistrationContext } from "./registration-context.js";
19
19
  import { RegistrationManager } from "./registration-manager.js";
20
20
  import { validatorNodes } from "@cello-protocol/protocol-types";
21
+ import { classifyManifestValidity } from "./manifest-validity.js";
21
22
  export function registerRegisterHandler(deps) {
22
23
  const { handlers, logger, keyProviders, getPersistence, getAgentSignaling, waitForSignalingConnected, dropAgentSignaling, startAgentInternal, directoryEndpointResolver, loadedAgents, registrationGuidance, manifestProvider, } = deps;
23
24
  // Single-flight guard (M1): the directory's registration reply frames (dkg_ready /
@@ -107,6 +108,81 @@ export function registerRegisterHandler(deps) {
107
108
  // load-bearing: an empty roster (consortium configured but unreachable) must REFUSE in
108
109
  // registration-manager, NOT downgrade to single-node (code-reviewer B1 / fallback-finder).
109
110
  const currentManifest = manifestProvider?.getCurrentManifest();
111
+ /**
112
+ * DOD-M15-EXPIRY-CONSUMER-POLICY-1 — this consumer PROCEEDS on a lapsed manifest, and that is
113
+ * now a decision rather than an omission. Written down because the split looked accidental:
114
+ * `signal-submission` REFUSES on expiry while this, the higher-stakes consumer, did not even
115
+ * look.
116
+ *
117
+ * **Why it proceeds.** Startup already fails closed on an expired manifest, so a lapsed one
118
+ * exists only inside a LONG-RUNNING daemon. Refusing here sends the operator to the one remedy
119
+ * `signal-submission`'s own guidance warns against — *"a restart without a REPLACEMENT does not
120
+ * reload anything: the daemon refuses to come back and every agent goes offline."* So refusing
121
+ * would brick a running operator to close a window that needs a roster CHANGE to be
122
+ * exploitable at all: the risk is dealing a share to a validator removed since the manifest
123
+ * lapsed, not expiry itself.
124
+ *
125
+ * **Why `signal-submission` is different, and why "make them consistent" would be wrong.** It
126
+ * uses the manifest's PORTAL INTAKE KEY, and a rotated key means a message the portal cannot
127
+ * open and cannot attribute — unattributable poison, its own word, with no error anywhere.
128
+ * Different field, different failure, different answer.
129
+ *
130
+ * **What was actually missing was not the gate — it was the RECORD.** `cello_status` already
131
+ * reports an expired manifest, so the STATE was visible; nothing said a FROST share had been
132
+ * dealt against one. That is what this event is.
133
+ */
134
+ const manifestValidity = classifyManifestValidity(currentManifest ?? null, Date.now());
135
+ /**
136
+ * ⚠️ NOT ONLY `expired` — review F7. `unreadable_window` (a window field that does not parse)
137
+ * and `not_yet_valid` (a wrong clock, or a manifest rotated in early) both reached the DKG
138
+ * with no event at all. `unreadable_window` matters more than it looks: since the startup gate
139
+ * was hardened it cannot start a daemon, but a manifest POLLED IN after startup can still put
140
+ * a running daemon into it.
141
+ */
142
+ const lapsed = manifestValidity.state === "expired"
143
+ || manifestValidity.state === "unreadable_window"
144
+ || manifestValidity.state === "not_yet_valid";
145
+ if (lapsed) {
146
+ logger.warn("registration.manifest.lapsed", {
147
+ agent: name,
148
+ state: manifestValidity.state,
149
+ window: manifestValidity.state === "expired" ? manifestValidity.expires : manifestValidity.notBefore,
150
+ validators: currentManifest ? validatorNodes(currentManifest.nodes).length : 0,
151
+ /**
152
+ * ⚠️ THIS USED TO SAY "a share MAY BE DEALT to a node that is no longer authorized", and
153
+ * that over-claimed in the very case it named. Review traced the path: a validator removed
154
+ * since the lapse is either unreachable — dropped at the dial layer by the peerId
155
+ * cross-check against the signed manifest — or reachable but absent from the DIRECTORY's
156
+ * current manifest, in which case the roster/participants counts disagree and registration
157
+ * REFUSES with `dkg_below_threshold`. **Dealing a share to a de-authorized node is not
158
+ * reachable through this path.** The event was about to be emitted alongside a FAILED
159
+ * registration while telling the operator a share may have gone somewhere.
160
+ *
161
+ * What it says now is what is actually true, and it is still worth saying: this event is
162
+ * emitted immediately before that refusal, so it is the line that explains an otherwise
163
+ * bare `dkg_below_threshold` — which names an exit point and not a cause.
164
+ */
165
+ /**
166
+ * ⚠️ ONE CAUSE OF A MULTI-CAUSE EXIT — pass 2, and the previous wording inverted the
167
+ * redundancy invariant in prose. `dkg_below_threshold` comes from a single comparison
168
+ * (`roster.length !== participants`) whose own comment names TWO causes: a node we reported
169
+ * is now unreachable, OR a manifest version skew. **An unreachable node is the routine
170
+ * one** — under the sovereign-node design a node being down is the expected steady state,
171
+ * not the exception. Saying "THIS is the cause" and "replace the trust anchor rather than
172
+ * retrying" told the operator to replace a threshold-signed anchor in the case where the
173
+ * correct move is to retry.
174
+ */
175
+ impact: "the consortium roster this registration works from came from a manifest whose validity " +
176
+ "window is not currently open. This is ONE possible cause of a subsequent " +
177
+ "dkg_below_threshold — a directory node being momentarily unreachable is the more common " +
178
+ "one, and is expected rather than exceptional.",
179
+ guidance: "Registration was NOT blocked here — blocking it would strand a running daemon, since a " +
180
+ "restart without a replacement manifest does not come back. If it then fails with " +
181
+ "dkg_below_threshold: RETRY FIRST, because an unreachable node is the usual cause. " +
182
+ "Replace the trust anchor only if cello_status shows the manifest window is the " +
183
+ "discrepancy.",
184
+ });
185
+ }
110
186
  const consortiumRoster = currentManifest
111
187
  ? await manifestNodesToEndpoints(validatorNodes(currentManifest.nodes), { logger })
112
188
  : null;
@@ -1 +1 @@
1
- {"version":3,"file":"register-handler.js","sourceRoot":"","sources":["../src/register-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAiBhE,MAAM,UAAU,uBAAuB,CAAC,IAAyB;IAC/D,MAAM,EACJ,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAC9C,iBAAiB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,kBAAkB,EACpF,yBAAyB,EAAE,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,GAChF,GAAG,IAAI,CAAC;IAET,mFAAmF;IACnF,gGAAgG;IAChG,gGAAgG;IAChG,8FAA8F;IAC9F,uFAAuF;IACvF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-death window) — null-check before FROST DKG opens streams on it.
178
178
  const dkgNode = this.#ctx.getNode();
179
179
  if (!dkgNode) {
180
- return { error: "directory_unreachable" };
180
+ /**
181
+ * NAMES THE LOCAL STATE, not the network. This returned `directory_unreachable` — a network
182
+ * verdict for a purely local lifecycle fact, and the comment two lines above already says so:
183
+ * the daemon's own node reference is briefly null while a stream dies and is rebuilt. The
184
+ * directory may be perfectly reachable.
185
+ *
186
+ * Found by the `DOD-M15-SURFACE-1` review as `[pre-existing]`; fixed under the standing rule
187
+ * that an error naming the wrong subsystem gets corrected when it is found. It is also the
188
+ * exact shape M15 is closing elsewhere — one string sending an investigation at the network
189
+ * when the cause is local — so leaving it while fixing its siblings would be inconsistent.
190
+ */
191
+ this.#ctx.logger.warn("registration.dkg.node_unavailable", {
192
+ impact: "the daemon's own transport node was momentarily absent while a signaling stream was rebuilt; registration was not attempted and nothing about the directory's reachability was established",
193
+ });
194
+ // `detail` is the shape this return type carries — the affordance rides there rather than in
195
+ // a `guidance` key the caller would drop on the floor.
196
+ return {
197
+ error: "transport_node_unavailable",
198
+ detail: "The daemon's transport node was briefly unavailable while its directory connection was rebuilding. This is local and usually clears within seconds; it says nothing about whether the directory is reachable. Retry registration, and if it repeats check the directory connection state with cello status.",
199
+ };
181
200
  }
182
201
  // DOD-DKG-1: build the directory-node set the DKG fans across. With a verified consortium
183
202
  // manifest the client resolved the full N-node roster (getConsortiumEndpoints) and the DKG