@adhdev/mesh-shared 1.0.60-rc.44 → 1.0.60-rc.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -405,6 +405,7 @@ __export(index_exports, {
405
405
  renderMissionBriefBlock: () => renderMissionBriefBlock,
406
406
  renderWorkerProtocolFooter: () => renderWorkerProtocolFooter,
407
407
  sanitizeModelIdentifier: () => sanitizeModelIdentifier,
408
+ sanitizeRefusalCode: () => sanitizeRefusalCode,
408
409
  scoreGitStatusCandidate: () => scoreGitStatusCandidate,
409
410
  scoreGitUpstreamFreshness: () => scoreGitUpstreamFreshness,
410
411
  sessionIdsEquivalent: () => sessionIdsEquivalent,
@@ -2078,6 +2079,12 @@ var RECLAIMING_SEND_REFUSALS = ["session_exited", "no_target", "unsupported_inpu
2078
2079
  var DELIVERY_OUTCOMES = ["delivered", "queued"];
2079
2080
  var DELIVERY_VIAS = ["local", "p2p"];
2080
2081
  var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout"];
2082
+ function sanitizeRefusalCode(value) {
2083
+ if (typeof value !== "string") return void 0;
2084
+ const normalized = value.trim().toLowerCase().replace(/[^a-z_]/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
2085
+ if (!normalized) return void 0;
2086
+ return normalized.slice(0, 64);
2087
+ }
2081
2088
  var CONSUME_PROFILES = ["default", "native_source"];
2082
2089
  var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
2083
2090
  var SUSPENSION_MODALS = ["approval", "choice"];
@@ -2113,7 +2120,13 @@ var HOLD_REASONS = [
2113
2120
  // the structured report is the primary evidence (design §F2), so the idle edge
2114
2121
  // only opens this hold (R9r) — a report commits (R17), a new busy edge cancels
2115
2122
  // it as a false idle (R12r), expiry commits weak (R13r).
2116
- "await_report"
2123
+ "await_report",
2124
+ // A worker report recorded while the session is still generating (R17g):
2125
+ // the report is the verdict, the idle edge is only awaited as corroboration
2126
+ // — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
2127
+ // a session whose FSM never shows the idle edge again does not wait for
2128
+ // liveness / hard_ceiling.
2129
+ "await_end"
2117
2130
  ];
2118
2131
  var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
2119
2132
  var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
@@ -2199,7 +2212,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2199
2212
  },
2200
2213
  delivered: { messageId: id, outcome: en(DELIVERY_OUTCOMES), via: en(DELIVERY_VIAS) },
2201
2214
  delivery_refused: { messageId: id, reason: en(SEND_REFUSAL_REASONS) },
2202
- dispatch_failed: { workerAbsent: bool, reason: en(DISPATCH_FAILURE_REASONS) },
2215
+ dispatch_failed: { workerAbsent: bool, reason: en(DISPATCH_FAILURE_REASONS), refusalCode: idOpt },
2203
2216
  duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
2204
2217
  session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
2205
2218
  turn_started: { retro: bool },
@@ -2231,7 +2244,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2231
2244
  session_error: { reason: en(SESSION_ERROR_REASONS) },
2232
2245
  worker_report: {
2233
2246
  outcome: en(WORKER_REPORT_OUTCOMES),
2234
- summary: { t: "summary_ref" },
2247
+ summary: { t: "summary_ref", optional: true },
2235
2248
  hasHandoffNotes: bool,
2236
2249
  branchState: enOpt(WORKER_BRANCH_STATES),
2237
2250
  touchedFileCount: intOpt
@@ -3911,6 +3924,7 @@ function touchedFilesOutsideOwnership(touched, owned) {
3911
3924
  renderMissionBriefBlock,
3912
3925
  renderWorkerProtocolFooter,
3913
3926
  sanitizeModelIdentifier,
3927
+ sanitizeRefusalCode,
3914
3928
  scoreGitStatusCandidate,
3915
3929
  scoreGitUpstreamFreshness,
3916
3930
  sessionIdsEquivalent,