opencode-swarm 7.146.2 → 7.146.4

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 (86) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +27 -44
  2. package/.opencode/skills/swarm-pr-review/references/findings-persistence-contract.md +52 -12
  3. package/.opencode/skills/swarm-pr-review/references/lane-output-recoverability.md +6 -3
  4. package/.opencode/skills/swarm-pr-review/references/parser-dry-run.md +19 -1
  5. package/.opencode/skills/swarm-pr-review/references/verdict-settlement-contract.md +41 -0
  6. package/dist/agents/council-prompts.d.ts +3 -3
  7. package/dist/background/candidate-contract.d.ts +21 -1
  8. package/dist/background/candidate-parser.d.ts +21 -1
  9. package/dist/background/pending-delegations.d.ts +8 -1
  10. package/dist/background/pr-review-collection-receipt.d.ts +70 -0
  11. package/dist/cli/{config-doctor-vstrprja.js → config-doctor-578ebqhn.js} +2 -2
  12. package/dist/cli/{core-3wzpwe5z.js → core-2ne03a43.js} +1 -1
  13. package/dist/cli/{curation-policy-x19e8bqc.js → curation-policy-g353f457.js} +6 -6
  14. package/dist/cli/{curator-llm-factory-6bra0bfd.js → curator-llm-factory-6hgn7p6n.js} +27 -27
  15. package/dist/cli/{curator-cvy1s7wd.js → curator-w52frg17.js} +27 -27
  16. package/dist/cli/{evidence-summary-service-yhap2xph.js → evidence-summary-service-nj4p6a0d.js} +11 -11
  17. package/dist/cli/{gate-evidence-vxbyq5sb.js → gate-evidence-4vnjdh9y.js} +6 -6
  18. package/dist/cli/{guardrail-explain-h8cnwa02.js → guardrail-explain-rq01z1yz.js} +28 -28
  19. package/dist/cli/{guardrail-log-syb7tz2w.js → guardrail-log-ratb651f.js} +3 -3
  20. package/dist/cli/{hive-promoter-3tex870c.js → hive-promoter-pbm9kee1.js} +27 -27
  21. package/dist/cli/{index-yxhcy5cm.js → index-1mbdwy12.js} +55 -1
  22. package/dist/cli/{index-01ybcsa5.js → index-3neh2mxk.js} +2 -2
  23. package/dist/cli/{index-5e5a1y2r.js → index-3p4wgm0d.js} +1 -1
  24. package/dist/cli/{index-4vwn66wk.js → index-5cbbtbvf.js} +3 -3
  25. package/dist/cli/{index-z5ppkn8y.js → index-6eycwm3v.js} +6 -6
  26. package/dist/cli/{index-bghwrr59.js → index-6q35swn2.js} +1 -1
  27. package/dist/cli/{index-qbpxrw95.js → index-8py21zn6.js} +2 -2
  28. package/dist/cli/{index-tj861zhd.js → index-96zkay2e.js} +4 -4
  29. package/dist/cli/{index-y3hmyvt6.js → index-bq4mvwht.js} +2 -2
  30. package/dist/cli/{index-rfph0nhf.js → index-brb64k96.js} +1426 -635
  31. package/dist/cli/{index-p0m03xa6.js → index-df8xj9hr.js} +4 -4
  32. package/dist/cli/{index-cr90rcg3.js → index-dp5w9s5z.js} +7 -7
  33. package/dist/cli/{index-w0cj7zyd.js → index-f75qjtn5.js} +1 -1
  34. package/dist/cli/{index-vmfaafte.js → index-ffqdah8s.js} +5 -5
  35. package/dist/cli/{index-f3x2gsby.js → index-fp2d44f5.js} +1 -1
  36. package/dist/cli/{index-jv9xs6mb.js → index-g2r8nknz.js} +2 -2
  37. package/dist/cli/{index-n4k0pt5f.js → index-g335vrc7.js} +4 -4
  38. package/dist/cli/{index-z9ed68jt.js → index-gr3zfcsh.js} +18 -4
  39. package/dist/cli/{index-w5r84rd1.js → index-hcb25p12.js} +1 -1
  40. package/dist/cli/{index-ycgm9pzg.js → index-hw1yghpg.js} +7 -6
  41. package/dist/cli/{index-a1febb2k.js → index-jgwhpza8.js} +2 -2
  42. package/dist/cli/{index-cx67qa9g.js → index-kjmcp9mf.js} +1 -1
  43. package/dist/cli/{index-42nq97rb.js → index-kv2j4cnq.js} +6 -6
  44. package/dist/cli/{index-zkaz3fhw.js → index-p3k155dv.js} +2 -2
  45. package/dist/cli/{index-qyvjp0bq.js → index-q81s0m8k.js} +66 -37
  46. package/dist/cli/{index-97psh79d.js → index-rpy0bent.js} +178 -18
  47. package/dist/cli/{index-r46q6996.js → index-t798v5pq.js} +29 -29
  48. package/dist/cli/{index-e1hjd15c.js → index-tp5ytzzg.js} +1 -1
  49. package/dist/cli/{index-vj9bba5k.js → index-vdrwj7z0.js} +4 -4
  50. package/dist/cli/{index-46cypnz3.js → index-wesj94x0.js} +4 -4
  51. package/dist/cli/{index-c9jr4j2q.js → index-xsxj4vbf.js} +1 -1
  52. package/dist/cli/index.js +27 -27
  53. package/dist/cli/{knowledge-escalator-mn4sx4qd.js → knowledge-escalator-jbazxmk5.js} +11 -11
  54. package/dist/cli/{knowledge-events-x975ngy4.js → knowledge-events-jyqy3st8.js} +9 -9
  55. package/dist/cli/{knowledge-link-8pr02pza.js → knowledge-link-jkx8xjxp.js} +5 -5
  56. package/dist/cli/{knowledge-store-33p762ey.js → knowledge-store-e2defagd.js} +6 -6
  57. package/dist/cli/{knowledge-validator-q5jc0scs.js → knowledge-validator-pnmdsw2b.js} +8 -8
  58. package/dist/cli/{pending-delegations-kkrczqv7.js → pending-delegations-k2yqg1sj.js} +3 -3
  59. package/dist/cli/{pr-subscriptions-2xn238xt.js → pr-subscriptions-js5v2xr6.js} +3 -3
  60. package/dist/cli/{runner-e7z9cf5y.js → runner-q7d22d1w.js} +6 -6
  61. package/dist/cli/{scan-cursor-p7t5mb4x.js → scan-cursor-snx85enn.js} +7 -7
  62. package/dist/cli/{schema-t8bmshhj.js → schema-6rmxzg6g.js} +1 -1
  63. package/dist/cli/{scope-persistence-2kyrgsca.js → scope-persistence-23cqafkx.js} +7 -7
  64. package/dist/cli/{skill-generator-fwvmcv8m.js → skill-generator-980zjk9q.js} +13 -13
  65. package/dist/cli/{telemetry-t109dhv7.js → telemetry-xzy0qeap.js} +1 -1
  66. package/dist/cli/{worktree-collision-ownership-2jtg2my1.js → worktree-collision-ownership-xj0bsg92.js} +3 -3
  67. package/dist/cli/{worktree-isolation-87j70zg1.js → worktree-isolation-4d0nc04c.js} +27 -27
  68. package/dist/commands/close.d.ts +1 -0
  69. package/dist/commands/context-map-stats.d.ts +5 -0
  70. package/dist/config/schema.d.ts +16 -0
  71. package/dist/context-map/telemetry.d.ts +168 -26
  72. package/dist/council/council-evidence-writer.d.ts +2 -1
  73. package/dist/council/council-freshness.d.ts +49 -0
  74. package/dist/council/council-review-identity.d.ts +133 -0
  75. package/dist/council/council-round-state.d.ts +27 -3
  76. package/dist/council/disagreement-detector.d.ts +12 -2
  77. package/dist/council/general-council-types.d.ts +32 -0
  78. package/dist/council/types.d.ts +43 -7
  79. package/dist/hooks/pr-workflow-gate.d.ts +58 -5
  80. package/dist/index.js +177 -152
  81. package/dist/observability/catalog.d.ts +7 -5
  82. package/dist/telemetry.d.ts +22 -1
  83. package/dist/tools/dispatch-lanes.d.ts +30 -8
  84. package/dist/tools/phase-complete/gates/types.d.ts +7 -0
  85. package/dist/tools/write-final-council-evidence.d.ts +1 -7
  86. package/package.json +2 -1
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-zj6t9zgx.js";
8
8
  import {
9
9
  withEvidenceLock
10
- } from "./index-bghwrr59.js";
10
+ } from "./index-6q35swn2.js";
11
11
  import {
12
12
  exports_external,
13
13
  init_zod
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  // src/background/pending-delegations.ts
21
21
  init_zod();
22
- import { createHash } from "crypto";
22
+ import { createHash as createHash2 } from "crypto";
23
23
  import * as fs2 from "fs";
24
24
  import * as path2 from "path";
25
25
  import { isDeepStrictEqual } from "util";
@@ -222,6 +222,104 @@ function collectDelegationLedgerHealth(directory, options) {
222
222
  }
223
223
  };
224
224
  }
225
+
226
+ // src/background/pr-review-collection-receipt.ts
227
+ init_zod();
228
+ import { createHash } from "crypto";
229
+ var PR_REVIEW_COLLECTION_RECEIPT_PREFIX = "[PR_REVIEW_COLLECTION_RECEIPT_V1] ";
230
+ var PR_REVIEW_COLLECTION_RECEIPT_SHED_PREFIX = "[PR_REVIEW_COLLECTION_RECEIPT_SHED_V1] ";
231
+ var MAX_PR_REVIEW_COLLECTION_RECEIPT_CHARS = 64 * 1024;
232
+ var MAX_PR_REVIEW_COLLECTION_RECEIPT_ITEM_IDS = 1e4;
233
+ var PrReviewCollectionReceiptPayloadSchema = exports_external.object({
234
+ schemaVersion: exports_external.literal(1),
235
+ parentSessionId: exports_external.string().min(1).max(256),
236
+ batchId: exports_external.string().min(1).max(120),
237
+ laneId: exports_external.string().min(1).max(120),
238
+ mode: exports_external.enum(["swarm-pr-review:reviewer", "swarm-pr-review:critic"]),
239
+ workflowLane: exports_external.string().min(1).max(120),
240
+ outputDigest: exports_external.string().regex(/^[a-f0-9]{64}$/),
241
+ disposition: exports_external.enum(["accepted", "rejected"]),
242
+ reviewItemIds: exports_external.array(exports_external.string().min(1).max(160)).min(1).max(MAX_PR_REVIEW_COLLECTION_RECEIPT_ITEM_IDS)
243
+ }).strict().superRefine((payload, context) => {
244
+ if (new Set(payload.reviewItemIds).size !== payload.reviewItemIds.length) {
245
+ context.addIssue({
246
+ code: exports_external.ZodIssueCode.custom,
247
+ message: "review item IDs must be unique"
248
+ });
249
+ }
250
+ });
251
+ var PrReviewCollectionReceiptShedMarkerSchema = exports_external.object({
252
+ schemaVersion: exports_external.literal(1),
253
+ parentSessionId: exports_external.string().min(1).max(256),
254
+ batchId: exports_external.string().min(1).max(120),
255
+ laneId: exports_external.string().min(1).max(120),
256
+ mode: exports_external.enum(["swarm-pr-review:reviewer", "swarm-pr-review:critic"]),
257
+ workflowLane: exports_external.string().min(1).max(120),
258
+ outputDigest: exports_external.string().regex(/^[a-f0-9]{64}$/),
259
+ disposition: exports_external.enum(["accepted", "rejected"]),
260
+ reviewItemCount: exports_external.number().int().positive().max(MAX_PR_REVIEW_COLLECTION_RECEIPT_ITEM_IDS),
261
+ reviewItemDigest: exports_external.string().regex(/^[a-f0-9]{64}$/)
262
+ }).strict();
263
+ function reviewItemDigest(reviewItemIds) {
264
+ return createHash("sha256").update(JSON.stringify(reviewItemIds)).digest("hex");
265
+ }
266
+ function encodePrReviewCollectionReceiptShedMarker(payload) {
267
+ const marker = {
268
+ schemaVersion: 1,
269
+ parentSessionId: payload.parentSessionId,
270
+ batchId: payload.batchId,
271
+ laneId: payload.laneId,
272
+ mode: payload.mode,
273
+ workflowLane: payload.workflowLane,
274
+ outputDigest: payload.outputDigest,
275
+ disposition: payload.disposition,
276
+ reviewItemCount: payload.reviewItemIds.length,
277
+ reviewItemDigest: reviewItemDigest(payload.reviewItemIds)
278
+ };
279
+ return `${PR_REVIEW_COLLECTION_RECEIPT_SHED_PREFIX}${JSON.stringify(marker)}`;
280
+ }
281
+ function parsePrReviewCollectionReceiptShedMarker(binding, result) {
282
+ if (!result.text)
283
+ return null;
284
+ const lines = result.text.split(/\r?\n/);
285
+ const markerLines = lines.filter((line) => line.startsWith(PR_REVIEW_COLLECTION_RECEIPT_SHED_PREFIX));
286
+ const finalLine = lines.at(-1);
287
+ if (markerLines.length !== 1 || !finalLine?.startsWith(PR_REVIEW_COLLECTION_RECEIPT_SHED_PREFIX) || finalLine.length > MAX_PR_REVIEW_COLLECTION_RECEIPT_CHARS) {
288
+ return null;
289
+ }
290
+ let decoded;
291
+ try {
292
+ decoded = JSON.parse(finalLine.slice(PR_REVIEW_COLLECTION_RECEIPT_SHED_PREFIX.length));
293
+ } catch {
294
+ return null;
295
+ }
296
+ const parsed = PrReviewCollectionReceiptShedMarkerSchema.safeParse(decoded);
297
+ if (!parsed.success)
298
+ return null;
299
+ const marker = parsed.data;
300
+ return marker.parentSessionId === binding.parentSessionId && marker.batchId === (binding.batchId ?? binding.callID) && marker.laneId === (binding.laneId ?? binding.correlationId) && marker.mode === binding.mode && marker.workflowLane === binding.workflowLane && marker.outputDigest === result.digest ? marker : null;
301
+ }
302
+ function parsePrReviewCollectionReceiptFooter(binding, result) {
303
+ if (!result.text)
304
+ return null;
305
+ const lines = result.text.split(/\r?\n/);
306
+ const receiptLines = lines.filter((line) => line.startsWith(PR_REVIEW_COLLECTION_RECEIPT_PREFIX));
307
+ const finalLine = lines.at(-1);
308
+ if (receiptLines.length !== 1 || !finalLine?.startsWith(PR_REVIEW_COLLECTION_RECEIPT_PREFIX) || finalLine.length > MAX_PR_REVIEW_COLLECTION_RECEIPT_CHARS) {
309
+ return null;
310
+ }
311
+ let decoded;
312
+ try {
313
+ decoded = JSON.parse(finalLine.slice(PR_REVIEW_COLLECTION_RECEIPT_PREFIX.length));
314
+ } catch {
315
+ return null;
316
+ }
317
+ const parsed = PrReviewCollectionReceiptPayloadSchema.safeParse(decoded);
318
+ if (!parsed.success)
319
+ return null;
320
+ const payload = parsed.data;
321
+ return payload.parentSessionId === binding.parentSessionId && payload.batchId === (binding.batchId ?? binding.callID) && payload.laneId === (binding.laneId ?? binding.correlationId) && payload.mode === binding.mode && payload.workflowLane === binding.workflowLane && payload.outputDigest === result.digest ? payload : null;
322
+ }
225
323
  // src/background/pending-delegations.ts
226
324
  var BACKGROUND_DELEGATIONS_FILE = "background-delegations.jsonl";
227
325
  var BACKGROUND_DELEGATION_FALLBACK_DIR = "background-delegation-fallback";
@@ -237,6 +335,7 @@ var MAX_RECOVERY_FALLBACK_BYTES = 1024 * 1024;
237
335
  var DELEGATION_COMPACTION_LOW_WATER_BYTES = 256 * 1024;
238
336
  var DELEGATION_COMPACTION_HIGH_WATER_BYTES = 1024 * 1024;
239
337
  var MAX_CHECKPOINT_BYTES = 2 * 1024 * 1024;
338
+ var CHECKPOINT_SELECTION_RESERVE_BYTES = 64 * 1024;
240
339
  var MAX_CHECKPOINT_RECORDS = 2048;
241
340
  var TOMBSTONE_MIN_AGE_MS = 72 * 60 * 60 * 1000;
242
341
  var STORE_LOCK_AGENT = "background";
@@ -254,7 +353,8 @@ var WorkflowLaneRecoverySchema = exports_external.object({
254
353
  "parser-normalization",
255
354
  "parser-row-recovery",
256
355
  "truncated-preview-durable-artifact",
257
- "transcript-incomplete-terminal-candidate"
356
+ "transcript-incomplete-terminal-candidate",
357
+ "clean-attestation-salvaged"
258
358
  ]),
259
359
  reason: exports_external.string()
260
360
  }).strict();
@@ -653,7 +753,7 @@ function readDelegationCheckpoint(directory) {
653
753
  return { kind: "ok", checkpoint: parsed.data, bytes };
654
754
  }
655
755
  function sha256Hex(data) {
656
- return createHash("sha256").update(data).digest("hex");
756
+ return createHash2("sha256").update(data).digest("hex");
657
757
  }
658
758
  function checkpointPayloadChecksum(checkpoint) {
659
759
  return sha256Hex(JSON.stringify([
@@ -960,21 +1060,63 @@ function buildClosedSummary(record) {
960
1060
  delete summary.prompt;
961
1061
  delete summary.taskChangeContext;
962
1062
  if (summary.result) {
963
- summary.result = stripResultBody(summary.result);
1063
+ summary.result = stripResultBody(record, summary.result);
964
1064
  }
965
1065
  if (summary.terminalResult) {
966
1066
  summary.terminalResult = {
967
1067
  ...summary.terminalResult,
968
- result: stripResultBody(summary.terminalResult.result)
1068
+ result: dropResultBody(summary.terminalResult.result)
969
1069
  };
970
1070
  }
971
1071
  const parsed = RecordSchema.safeParse(summary);
972
1072
  return parsed.success ? parsed.data : null;
973
1073
  }
974
- function stripResultBody(result) {
1074
+ function stripResultBody(record, result) {
975
1075
  const { text: _text, error: _error, ...rest } = result;
1076
+ const receipt = parsePrReviewCollectionReceiptFooter(record, result);
1077
+ const shedMarker = receipt ? null : parsePrReviewCollectionReceiptShedMarker(record, result);
1078
+ const receiptText = receipt ? `${PR_REVIEW_COLLECTION_RECEIPT_PREFIX}${JSON.stringify(receipt)}` : shedMarker ? `${PR_REVIEW_COLLECTION_RECEIPT_SHED_PREFIX}${JSON.stringify(shedMarker)}` : undefined;
1079
+ return receiptText ? { ...rest, text: receiptText, outputPreviewChars: receiptText.length } : rest;
1080
+ }
1081
+ function dropResultBody(result) {
1082
+ const {
1083
+ text: _text,
1084
+ error: _error,
1085
+ outputPreviewChars: _preview,
1086
+ ...rest
1087
+ } = result;
976
1088
  return rest;
977
1089
  }
1090
+ function dropRetainedPrReviewReceipt(record) {
1091
+ const compact = (result) => {
1092
+ const payload = parsePrReviewCollectionReceiptFooter(record, result);
1093
+ if (!payload) {
1094
+ const marker2 = parsePrReviewCollectionReceiptShedMarker(record, result);
1095
+ if (!marker2)
1096
+ return dropResultBody(result);
1097
+ const markerText = `${PR_REVIEW_COLLECTION_RECEIPT_SHED_PREFIX}${JSON.stringify(marker2)}`;
1098
+ const { text: _text2, error: _error2, ...rest2 } = result;
1099
+ return {
1100
+ ...rest2,
1101
+ text: markerText,
1102
+ outputPreviewChars: markerText.length
1103
+ };
1104
+ }
1105
+ const marker = encodePrReviewCollectionReceiptShedMarker(payload);
1106
+ const { text: _text, error: _error, ...rest } = result;
1107
+ return { ...rest, text: marker, outputPreviewChars: marker.length };
1108
+ };
1109
+ return {
1110
+ ...record,
1111
+ ...record.result ? { result: compact(record.result) } : {},
1112
+ ...record.terminalResult ? {
1113
+ terminalResult: {
1114
+ ...record.terminalResult,
1115
+ result: dropResultBody(record.terminalResult.result)
1116
+ }
1117
+ } : {}
1118
+ };
1119
+ }
978
1120
  function emptyAudit() {
979
1121
  return {
980
1122
  dispatchCount: 0,
@@ -1126,12 +1268,21 @@ function compactDelegationsLocked(directory, options) {
1126
1268
  payloadChecksum: "0".repeat(64)
1127
1269
  }), "utf-8");
1128
1270
  let used = baseOverhead;
1271
+ const selectionBudget = MAX_CHECKPOINT_BYTES - CHECKPOINT_SELECTION_RESERVE_BYTES;
1129
1272
  const keptClosed = [];
1130
1273
  let evicted = 0;
1131
1274
  for (const entry of closedCandidates) {
1132
- const cost = Buffer.byteLength(JSON.stringify(entry), "utf-8") + 1;
1133
- if (used + cost > MAX_CHECKPOINT_BYTES) {
1275
+ let retainedEntry = entry;
1276
+ let cost = Buffer.byteLength(JSON.stringify(retainedEntry), "utf-8") + 1;
1277
+ if (used + cost > selectionBudget) {
1134
1278
  if (now - entry.updatedAt < TOMBSTONE_MIN_AGE_MS) {
1279
+ retainedEntry = dropRetainedPrReviewReceipt(entry);
1280
+ cost = Buffer.byteLength(JSON.stringify(retainedEntry), "utf-8") + 1;
1281
+ if (used + cost <= selectionBudget) {
1282
+ used += cost;
1283
+ keptClosed.push(retainedEntry);
1284
+ continue;
1285
+ }
1135
1286
  recordLedgerUncertainty(directory, "checkpoint byte budget would evict a young closed summary; compaction skipped", "compaction");
1136
1287
  return {
1137
1288
  status: "skipped",
@@ -1142,7 +1293,7 @@ function compactDelegationsLocked(directory, options) {
1142
1293
  continue;
1143
1294
  }
1144
1295
  used += cost;
1145
- keptClosed.push(entry);
1296
+ keptClosed.push(retainedEntry);
1146
1297
  }
1147
1298
  const sequence = Math.max(load.manifest?.sequence ?? 0, load.checkpoint?.sequence ?? 0, 0) + 1;
1148
1299
  let healthLateTerminals = 0;
@@ -1155,7 +1306,7 @@ function compactDelegationsLocked(directory, options) {
1155
1306
  const previousClosedIds = new Set((load.checkpoint?.closed ?? []).map((entry) => entry.correlationId));
1156
1307
  const newlySummarized = keptClosed.filter((entry) => !previousClosedIds.has(entry.correlationId)).length;
1157
1308
  const audit = mergeCheckpointAudit(load.checkpoint?.audit ?? null, load.checkpoint, folded, healthLateTerminals, retiredLineCount, newlySummarized + evicted, now);
1158
- const checkpoint = {
1309
+ const checkpointCandidate = {
1159
1310
  schemaVersion: 1,
1160
1311
  sequence,
1161
1312
  writerId: WRITER_ID,
@@ -1166,8 +1317,17 @@ function compactDelegationsLocked(directory, options) {
1166
1317
  records: live,
1167
1318
  closed: keptClosed,
1168
1319
  audit,
1169
- payloadChecksum: ""
1320
+ payloadChecksum: "0".repeat(64)
1170
1321
  };
1322
+ const normalizedCheckpoint = CheckpointSchema.safeParse(checkpointCandidate);
1323
+ if (!normalizedCheckpoint.success) {
1324
+ recordLedgerUncertainty(directory, "generated checkpoint failed schema normalization; compaction skipped", "compaction");
1325
+ return {
1326
+ status: "skipped",
1327
+ reason: "generated checkpoint failed schema normalization"
1328
+ };
1329
+ }
1330
+ const checkpoint = normalizedCheckpoint.data;
1171
1331
  checkpoint.payloadChecksum = checkpointPayloadChecksum(checkpoint);
1172
1332
  const checkpointJson = `${JSON.stringify(checkpoint)}
1173
1333
  `;
@@ -1409,7 +1569,7 @@ function buildPromptSnapshot(text, maxChars) {
1409
1569
  text: bounded,
1410
1570
  chars: text.length,
1411
1571
  truncated,
1412
- digest: createHash("sha256").update(text).digest("hex")
1572
+ digest: createHash2("sha256").update(text).digest("hex")
1413
1573
  };
1414
1574
  }
1415
1575
  async function appendDelegationTransition(directory, correlationId, transition) {
@@ -1455,7 +1615,7 @@ function buildBackgroundCompletionEventId(input) {
1455
1615
  input.status,
1456
1616
  input.resultDigest
1457
1617
  ]);
1458
- return `bgc1:${createHash("sha256").update(canonical).digest("hex")}`;
1618
+ return `bgc1:${createHash2("sha256").update(canonical).digest("hex")}`;
1459
1619
  }
1460
1620
  function sameJson(left, right) {
1461
1621
  return JSON.stringify(left) === JSON.stringify(right);
@@ -1775,7 +1935,7 @@ async function claimDelegationIngestion(directory, correlationId, options) {
1775
1935
  }
1776
1936
  const disposition = current.status === "ingestion_error" || current.ingestion?.state === "claimed" ? "retry" : "claimed";
1777
1937
  const attempt = (current.ingestion?.attempt ?? 0) + 1;
1778
- const claimToken = createHash("sha256").update(JSON.stringify([correlationId, options.claimantId, attempt, now])).digest("hex");
1938
+ const claimToken = createHash2("sha256").update(JSON.stringify([correlationId, options.claimantId, attempt, now])).digest("hex");
1779
1939
  const next = {
1780
1940
  ...current,
1781
1941
  schemaVersion: 3,
@@ -2078,7 +2238,7 @@ async function sweepStaleDelegations(directory, timeoutMs, options = {}) {
2078
2238
  }
2079
2239
  }
2080
2240
  function fallbackRelativePath(correlationId) {
2081
- const digest = createHash("sha256").update(correlationId).digest("hex");
2241
+ const digest = createHash2("sha256").update(correlationId).digest("hex");
2082
2242
  return path2.join(BACKGROUND_DELEGATION_FALLBACK_DIR, `${digest}.json`);
2083
2243
  }
2084
2244
  function fallbackPath(directory, correlationId) {
@@ -2336,7 +2496,7 @@ function reservationStorePath(directory) {
2336
2496
  }
2337
2497
  function buildBackgroundCoderReservationId(input) {
2338
2498
  const ownerIdentity = input.planTaskId === null ? ["call", input.parentSessionId, input.callID] : ["task", input.parentSessionId, input.planTaskId];
2339
- return `bgcr1:${createHash("sha256").update(JSON.stringify(ownerIdentity)).digest("hex")}`;
2499
+ return `bgcr1:${createHash2("sha256").update(JSON.stringify(ownerIdentity)).digest("hex")}`;
2340
2500
  }
2341
2501
  function scanBackgroundCoderReservationsForAdmission(directory) {
2342
2502
  let absolutePath;
@@ -2664,4 +2824,4 @@ async function releaseBackgroundCoderReservation(directory, input) {
2664
2824
  }
2665
2825
  }
2666
2826
 
2667
- export { MAX_RECOVERY_LEDGER_BYTES, collectDelegationLedgerHealth, BACKGROUND_DELEGATIONS_FILE, BACKGROUND_DELEGATION_FALLBACK_DIR, BACKGROUND_CODER_RESERVATIONS_FILE, BACKGROUND_DELEGATIONS_CHECKPOINT_FILE, BACKGROUND_DELEGATIONS_MANIFEST_FILE, MAX_LIVE_BACKGROUND_FALLBACKS, MAX_LIVE_BACKGROUND_CODER_RESERVATIONS, MAX_BACKGROUND_OBSERVED_FILES, MAX_BACKGROUND_ADVISORY_CHARS, DELEGATION_COMPACTION_LOW_WATER_BYTES, DELEGATION_COMPACTION_HIGH_WATER_BYTES, MAX_CHECKPOINT_BYTES, MAX_CHECKPOINT_RECORDS, TOMBSTONE_MIN_AGE_MS, BACKGROUND_INGESTION_LEASE_MS, DEFAULT_STALE_DELEGATION_TIMEOUT_MS, DEFAULT_SWEEPABLE_DELEGATION_STATUSES, _checkpointInternals, isUnsettledWorktreeOwner, compactBackgroundDelegations, readDelegations, scanDelegationsForRecovery, findByCorrelationId, recordPendingDelegationDetailed, recordPendingDelegation, buildPromptSnapshot, appendDelegationTransition, buildBackgroundCompletionEventId, claimTerminalResult, claimCoderSettlement, normalizeBackgroundObservedFiles, updateCoderSettlement, claimDelegationIngestion, recordDelegationIngestionResult, putPendingBackgroundAdvisory, preparePendingBackgroundAdvisories, acknowledgeObservedBackgroundAdvisories, releasePreparedBackgroundAdvisories, findByBatchId, findOpenAsyncLaneBatches, sweepStaleDelegations, readDelegationFallback, listDelegationFallbacks, scanDelegationFallbacksForRecovery, writeDelegationFallback, removeDelegationFallback, findDelegationForCompletion, promoteDelegationFallback, buildBackgroundCoderReservationId, scanBackgroundCoderReservationsForAdmission, reserveBackgroundCoderSlot, bindBackgroundCoderReservation, releaseBackgroundCoderReservation };
2827
+ export { MAX_RECOVERY_LEDGER_BYTES, collectDelegationLedgerHealth, MAX_PR_REVIEW_COLLECTION_RECEIPT_ITEM_IDS, BACKGROUND_DELEGATIONS_FILE, BACKGROUND_DELEGATION_FALLBACK_DIR, BACKGROUND_CODER_RESERVATIONS_FILE, BACKGROUND_DELEGATIONS_CHECKPOINT_FILE, BACKGROUND_DELEGATIONS_MANIFEST_FILE, MAX_LIVE_BACKGROUND_FALLBACKS, MAX_LIVE_BACKGROUND_CODER_RESERVATIONS, MAX_BACKGROUND_OBSERVED_FILES, MAX_BACKGROUND_ADVISORY_CHARS, DELEGATION_COMPACTION_LOW_WATER_BYTES, DELEGATION_COMPACTION_HIGH_WATER_BYTES, MAX_CHECKPOINT_BYTES, MAX_CHECKPOINT_RECORDS, TOMBSTONE_MIN_AGE_MS, BACKGROUND_INGESTION_LEASE_MS, DEFAULT_STALE_DELEGATION_TIMEOUT_MS, DEFAULT_SWEEPABLE_DELEGATION_STATUSES, _checkpointInternals, isUnsettledWorktreeOwner, compactBackgroundDelegations, readDelegations, scanDelegationsForRecovery, findByCorrelationId, recordPendingDelegationDetailed, recordPendingDelegation, buildPromptSnapshot, appendDelegationTransition, buildBackgroundCompletionEventId, claimTerminalResult, claimCoderSettlement, normalizeBackgroundObservedFiles, updateCoderSettlement, claimDelegationIngestion, recordDelegationIngestionResult, putPendingBackgroundAdvisory, preparePendingBackgroundAdvisories, acknowledgeObservedBackgroundAdvisories, releasePreparedBackgroundAdvisories, findByBatchId, findOpenAsyncLaneBatches, sweepStaleDelegations, readDelegationFallback, listDelegationFallbacks, scanDelegationFallbacksForRecovery, writeDelegationFallback, removeDelegationFallback, findDelegationForCompletion, promoteDelegationFallback, buildBackgroundCoderReservationId, scanBackgroundCoderReservationsForAdmission, reserveBackgroundCoderSlot, bindBackgroundCoderReservation, releaseBackgroundCoderReservation };
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-a1febb2k.js";
4
+ } from "./index-jgwhpza8.js";
5
5
  import {
6
6
  handleGuardrailLog
7
- } from "./index-f3x2gsby.js";
7
+ } from "./index-fp2d44f5.js";
8
8
  import {
9
9
  COMMAND_REGISTRY,
10
10
  SWARM_COMMAND_TOOL_ALLOWLIST,
@@ -85,48 +85,48 @@ import {
85
85
  handleWriteRetroCommand,
86
86
  normalizeSwarmCommandInput,
87
87
  resolveCommand
88
- } from "./index-rfph0nhf.js";
89
- import"./index-w5r84rd1.js";
90
- import"./index-c9jr4j2q.js";
91
- import"./index-yxhcy5cm.js";
92
- import"./index-z5ppkn8y.js";
93
- import"./index-zkaz3fhw.js";
88
+ } from "./index-brb64k96.js";
89
+ import"./index-hcb25p12.js";
90
+ import"./index-xsxj4vbf.js";
91
+ import"./index-1mbdwy12.js";
92
+ import"./index-6eycwm3v.js";
93
+ import"./index-p3k155dv.js";
94
94
  import"./index-134d35c1.js";
95
95
  import"./index-abtrcs16.js";
96
96
  import"./index-y8552snf.js";
97
- import"./index-vmfaafte.js";
98
- import"./index-jv9xs6mb.js";
97
+ import"./index-ffqdah8s.js";
98
+ import"./index-g2r8nknz.js";
99
99
  import"./index-70ha9e09.js";
100
100
  import"./index-c8s9a3zh.js";
101
101
  import"./index-9ss2m4rs.js";
102
102
  import"./index-z9yhhk6q.js";
103
- import"./index-5e5a1y2r.js";
104
- import"./index-vj9bba5k.js";
105
- import"./index-n4k0pt5f.js";
106
- import"./index-e1hjd15c.js";
103
+ import"./index-3p4wgm0d.js";
104
+ import"./index-vdrwj7z0.js";
105
+ import"./index-g335vrc7.js";
106
+ import"./index-tp5ytzzg.js";
107
107
  import"./index-rtry5xyf.js";
108
108
  import"./index-zsrtt42s.js";
109
- import"./index-97psh79d.js";
109
+ import"./index-rpy0bent.js";
110
110
  import"./index-e1pxav9g.js";
111
- import"./index-tj861zhd.js";
112
- import"./index-cx67qa9g.js";
113
- import"./index-46cypnz3.js";
114
- import"./index-p0m03xa6.js";
111
+ import"./index-96zkay2e.js";
112
+ import"./index-kjmcp9mf.js";
113
+ import"./index-wesj94x0.js";
114
+ import"./index-df8xj9hr.js";
115
115
  import"./index-556ja8an.js";
116
116
  import"./index-7sy3aa9m.js";
117
117
  import"./index-wx8zdh4a.js";
118
118
  import"./index-3g0xk6tk.js";
119
119
  import"./index-85gkedsf.js";
120
- import"./index-42nq97rb.js";
121
- import"./index-cr90rcg3.js";
122
- import"./index-y3hmyvt6.js";
120
+ import"./index-kv2j4cnq.js";
121
+ import"./index-dp5w9s5z.js";
122
+ import"./index-bq4mvwht.js";
123
123
  import"./index-gprxjmm7.js";
124
124
  import"./index-n832052r.js";
125
- import"./index-01ybcsa5.js";
125
+ import"./index-3neh2mxk.js";
126
126
  import {
127
127
  init_schema,
128
128
  stripKnownSwarmPrefix
129
- } from "./index-z9ed68jt.js";
129
+ } from "./index-gr3zfcsh.js";
130
130
  import {
131
131
  AGENT_TOOL_MAP,
132
132
  ORCHESTRATOR_NAME,
@@ -139,12 +139,12 @@ import"./index-z6xqpmqg.js";
139
139
  import"./index-zj6t9zgx.js";
140
140
  import"./index-zjygnfay.js";
141
141
  import"./index-ae75rja9.js";
142
- import"./index-w0cj7zyd.js";
143
- import"./index-qbpxrw95.js";
142
+ import"./index-f75qjtn5.js";
143
+ import"./index-8py21zn6.js";
144
144
  import"./index-bk5tah7q.js";
145
- import"./index-ycgm9pzg.js";
146
- import"./index-bghwrr59.js";
147
- import"./index-qyvjp0bq.js";
145
+ import"./index-hw1yghpg.js";
146
+ import"./index-6q35swn2.js";
147
+ import"./index-q81s0m8k.js";
148
148
  import"./index-7g4c7s5r.js";
149
149
  import"./index-bpmtbmy9.js";
150
150
  import"./index-ed5ykebp.js";
@@ -7,7 +7,7 @@ import {
7
7
  readLinkPointer,
8
8
  resolveKnowledgeStoreDir,
9
9
  resolveLinkDir
10
- } from "./index-w0cj7zyd.js";
10
+ } from "./index-f75qjtn5.js";
11
11
 
12
12
  // src/knowledge/curation-policy.ts
13
13
  import { appendFile, mkdir as mkdir2, readFile as readFile2 } from "fs/promises";
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  ALLOWED_SKILL_PATH_PREFIXES,
4
4
  validateSkillPath
5
- } from "./index-n4k0pt5f.js";
5
+ } from "./index-g335vrc7.js";
6
6
  import {
7
7
  computeOutcomeSignal,
8
8
  readKnowledge,
9
9
  resolveHiveKnowledgePath,
10
10
  resolveSwarmKnowledgePath,
11
11
  transactKnowledge
12
- } from "./index-42nq97rb.js";
12
+ } from "./index-kv2j4cnq.js";
13
13
  import {
14
14
  effectiveRetrievalOutcomes,
15
15
  readAuthoritativeKnowledgeCounterRollups
16
- } from "./index-cr90rcg3.js";
16
+ } from "./index-dp5w9s5z.js";
17
17
  import {
18
18
  advisoryWarn,
19
19
  init_warning_buffer
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  atomicWriteFileAnyRoot,
27
27
  atomicWriteSwarmFile
28
- } from "./index-ycgm9pzg.js";
28
+ } from "./index-hw1yghpg.js";
29
29
  import {
30
30
  init_logger,
31
31
  log,
@@ -2,23 +2,23 @@
2
2
  import {
3
3
  computePlanStructureHash,
4
4
  derivePlanId
5
- } from "./index-p0m03xa6.js";
5
+ } from "./index-df8xj9hr.js";
6
6
  import {
7
7
  unsafePathTextReason
8
8
  } from "./index-556ja8an.js";
9
9
  import {
10
10
  PlanSchema
11
- } from "./index-01ybcsa5.js";
11
+ } from "./index-3neh2mxk.js";
12
12
  import {
13
13
  validateSwarmPath
14
14
  } from "./index-w8pgjr75.js";
15
15
  import {
16
16
  atomicWriteSwarmFile,
17
17
  atomicWriteSwarmFileSync
18
- } from "./index-ycgm9pzg.js";
18
+ } from "./index-hw1yghpg.js";
19
19
  import {
20
20
  assertProjectRoot
21
- } from "./index-bghwrr59.js";
21
+ } from "./index-6q35swn2.js";
22
22
  import {
23
23
  require_proper_lockfile
24
24
  } from "./index-7g4c7s5r.js";
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  init_schema,
13
13
  stripKnownSwarmPrefix
14
- } from "./index-z9ed68jt.js";
14
+ } from "./index-gr3zfcsh.js";
15
15
  import {
16
16
  init_constants
17
17
  } from "./index-cpg98bh1.js";
package/dist/cli/index.js CHANGED
@@ -11,48 +11,48 @@ import {
11
11
  readCachePackageVersion,
12
12
  resolveCommand,
13
13
  safeRealpathSync
14
- } from "./index-rfph0nhf.js";
15
- import"./index-w5r84rd1.js";
16
- import"./index-c9jr4j2q.js";
17
- import"./index-yxhcy5cm.js";
18
- import"./index-z5ppkn8y.js";
19
- import"./index-zkaz3fhw.js";
14
+ } from "./index-brb64k96.js";
15
+ import"./index-hcb25p12.js";
16
+ import"./index-xsxj4vbf.js";
17
+ import"./index-1mbdwy12.js";
18
+ import"./index-6eycwm3v.js";
19
+ import"./index-p3k155dv.js";
20
20
  import"./index-134d35c1.js";
21
21
  import"./index-abtrcs16.js";
22
22
  import"./index-y8552snf.js";
23
- import"./index-vmfaafte.js";
24
- import"./index-jv9xs6mb.js";
23
+ import"./index-ffqdah8s.js";
24
+ import"./index-g2r8nknz.js";
25
25
  import"./index-70ha9e09.js";
26
26
  import"./index-c8s9a3zh.js";
27
27
  import"./index-9ss2m4rs.js";
28
28
  import"./index-z9yhhk6q.js";
29
- import"./index-5e5a1y2r.js";
30
- import"./index-vj9bba5k.js";
31
- import"./index-n4k0pt5f.js";
32
- import"./index-e1hjd15c.js";
29
+ import"./index-3p4wgm0d.js";
30
+ import"./index-vdrwj7z0.js";
31
+ import"./index-g335vrc7.js";
32
+ import"./index-tp5ytzzg.js";
33
33
  import"./index-rtry5xyf.js";
34
34
  import"./index-zsrtt42s.js";
35
- import"./index-97psh79d.js";
35
+ import"./index-rpy0bent.js";
36
36
  import"./index-e1pxav9g.js";
37
- import"./index-tj861zhd.js";
38
- import"./index-cx67qa9g.js";
39
- import"./index-46cypnz3.js";
40
- import"./index-p0m03xa6.js";
37
+ import"./index-96zkay2e.js";
38
+ import"./index-kjmcp9mf.js";
39
+ import"./index-wesj94x0.js";
40
+ import"./index-df8xj9hr.js";
41
41
  import"./index-556ja8an.js";
42
42
  import"./index-7sy3aa9m.js";
43
43
  import"./index-wx8zdh4a.js";
44
44
  import"./index-3g0xk6tk.js";
45
45
  import"./index-85gkedsf.js";
46
- import"./index-42nq97rb.js";
47
- import"./index-cr90rcg3.js";
48
- import"./index-y3hmyvt6.js";
46
+ import"./index-kv2j4cnq.js";
47
+ import"./index-dp5w9s5z.js";
48
+ import"./index-bq4mvwht.js";
49
49
  import"./index-gprxjmm7.js";
50
50
  import"./index-n832052r.js";
51
- import"./index-01ybcsa5.js";
51
+ import"./index-3neh2mxk.js";
52
52
  import {
53
53
  init_package,
54
54
  package_default
55
- } from "./index-z9ed68jt.js";
55
+ } from "./index-gr3zfcsh.js";
56
56
  import {
57
57
  DEFAULT_AGENT_CONFIGS,
58
58
  init_constants
@@ -64,12 +64,12 @@ import"./index-z6xqpmqg.js";
64
64
  import"./index-zj6t9zgx.js";
65
65
  import"./index-zjygnfay.js";
66
66
  import"./index-ae75rja9.js";
67
- import"./index-w0cj7zyd.js";
68
- import"./index-qbpxrw95.js";
67
+ import"./index-f75qjtn5.js";
68
+ import"./index-8py21zn6.js";
69
69
  import"./index-bk5tah7q.js";
70
- import"./index-ycgm9pzg.js";
71
- import"./index-bghwrr59.js";
72
- import"./index-qyvjp0bq.js";
70
+ import"./index-hw1yghpg.js";
71
+ import"./index-6q35swn2.js";
72
+ import"./index-q81s0m8k.js";
73
73
  import"./index-7g4c7s5r.js";
74
74
  import"./index-bpmtbmy9.js";
75
75
  import"./index-ed5ykebp.js";
@@ -9,14 +9,14 @@ import {
9
9
  maybeEscalateOnViolation,
10
10
  maybeQuarantineOnContradiction,
11
11
  readRecentEscalations
12
- } from "./index-vmfaafte.js";
13
- import"./index-42nq97rb.js";
14
- import"./index-cr90rcg3.js";
15
- import"./index-y3hmyvt6.js";
12
+ } from "./index-ffqdah8s.js";
13
+ import"./index-kv2j4cnq.js";
14
+ import"./index-dp5w9s5z.js";
15
+ import"./index-bq4mvwht.js";
16
16
  import"./index-gprxjmm7.js";
17
17
  import"./index-n832052r.js";
18
- import"./index-01ybcsa5.js";
19
- import"./index-z9ed68jt.js";
18
+ import"./index-3neh2mxk.js";
19
+ import"./index-gr3zfcsh.js";
20
20
  import"./index-cpg98bh1.js";
21
21
  import"./index-9e6fdz2h.js";
22
22
  import"./index-4rhhvd1a.js";
@@ -25,12 +25,12 @@ import"./index-z6xqpmqg.js";
25
25
  import"./index-zj6t9zgx.js";
26
26
  import"./index-zjygnfay.js";
27
27
  import"./index-ae75rja9.js";
28
- import"./index-w0cj7zyd.js";
29
- import"./index-qbpxrw95.js";
28
+ import"./index-f75qjtn5.js";
29
+ import"./index-8py21zn6.js";
30
30
  import"./index-bk5tah7q.js";
31
- import"./index-ycgm9pzg.js";
32
- import"./index-bghwrr59.js";
33
- import"./index-qyvjp0bq.js";
31
+ import"./index-hw1yghpg.js";
32
+ import"./index-6q35swn2.js";
33
+ import"./index-q81s0m8k.js";
34
34
  import"./index-7g4c7s5r.js";
35
35
  import"./index-bpmtbmy9.js";
36
36
  import"./index-ed5ykebp.js";