opencode-swarm 7.200.9 → 7.200.11

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 (119) hide show
  1. package/.opencode/skills/ci-fix-monitor/SKILL.md +49 -0
  2. package/.opencode/skills/swarm-pr-review/references/lane-output-recoverability.md +11 -2
  3. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  4. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  5. package/dist/background/completion-observer.d.ts +2 -1
  6. package/dist/background/pending-delegations.d.ts +9 -1
  7. package/dist/background/pr-review-contract.d.ts +8 -0
  8. package/dist/cli/{attest-task-79gp34gf.js → attest-task-y0n69zgb.js} +78 -76
  9. package/dist/cli/{auto-checkpoint-kt9mr7ma.js → auto-checkpoint-hyaksmtg.js} +12 -12
  10. package/dist/cli/{capability-probe-dwqn2609.js → capability-probe-qjndmx6z.js} +1 -1
  11. package/dist/cli/{checkpoint-e7t1zbz2.js → checkpoint-t0p781sc.js} +23 -23
  12. package/dist/cli/{coder-settlement-rehndcey.js → coder-settlement-nh88s6es.js} +14 -13
  13. package/dist/cli/{config-doctor-hcemxnra.js → config-doctor-sf7hc0q4.js} +19 -19
  14. package/dist/cli/{core-k8mvhsty.js → core-p168fw3r.js} +6 -3
  15. package/dist/cli/{curation-policy-gy868ec3.js → curation-policy-1a23ftnv.js} +6 -6
  16. package/dist/cli/{curator-ayenbz0y.js → curator-5ayzhk7v.js} +53 -52
  17. package/dist/cli/{curator-drift-fwzrv9tw.js → curator-drift-jx9kyndc.js} +10 -10
  18. package/dist/cli/curator-llm-factory-ytfkvtxs.js +83 -0
  19. package/dist/cli/{doctor-knowledge-receipt-phase-id-jdy6651j.js → doctor-knowledge-receipt-phase-id-2gjvxndy.js} +10 -10
  20. package/dist/cli/{evidence-summary-service-4jm1hd1r.js → evidence-summary-service-972sqht5.js} +26 -25
  21. package/dist/cli/{gate-evidence-anef2bqv.js → gate-evidence-n1m842gj.js} +10 -9
  22. package/dist/cli/guardrail-explain-6yv78gmk.js +84 -0
  23. package/dist/cli/{guardrail-log-pv3bq9hj.js → guardrail-log-z5pzgkcv.js} +8 -8
  24. package/dist/cli/{guardrail-reset-k8b9yrec.js → guardrail-reset-w0nxcs6a.js} +53 -52
  25. package/dist/cli/{hive-promoter-zqscx6pb.js → hive-promoter-3q0738xg.js} +53 -52
  26. package/dist/cli/{index-4krkevgc.js → index-001tkp0j.js} +1 -1
  27. package/dist/cli/{index-zy943kpp.js → index-0an54fza.js} +18 -13
  28. package/dist/cli/{index-czsx86m5.js → index-0g0x9ets.js} +53 -52
  29. package/dist/cli/{index-rdyfrdcp.js → index-2n7a184b.js} +201 -33
  30. package/dist/cli/{index-4fr3r8k5.js → index-2vj8d8te.js} +1 -1
  31. package/dist/cli/{index-hhq5f82z.js → index-5k88v1e7.js} +81 -36
  32. package/dist/cli/{index-c2k7q723.js → index-6cppzd9c.js} +1 -1
  33. package/dist/cli/{index-yyrnkc3a.js → index-6m551cng.js} +2 -2
  34. package/dist/cli/{index-y16v2q1x.js → index-814q5t5s.js} +5 -5
  35. package/dist/cli/{index-08jd4gz2.js → index-8g9rn3rp.js} +121 -40
  36. package/dist/cli/{index-8srvdpw6.js → index-8xtdxy91.js} +2 -2
  37. package/dist/cli/{index-mn75z39t.js → index-9qy3tzt5.js} +1 -1
  38. package/dist/cli/{index-6q2s7r67.js → index-aj41bscz.js} +8 -8
  39. package/dist/cli/{index-2c4hjeea.js → index-bnbhqvsn.js} +8 -8
  40. package/dist/cli/{index-9jty56xr.js → index-bv9tqmpm.js} +5 -5
  41. package/dist/cli/{index-casbh4y7.js → index-ce6qarfq.js} +13032 -12437
  42. package/dist/cli/{index-y7c4hqcj.js → index-ck7jpn0y.js} +1 -1
  43. package/dist/cli/{index-p2dst45x.js → index-ckq78kq1.js} +1 -1
  44. package/dist/cli/{index-8mrentmw.js → index-dp6hy23p.js} +58 -53
  45. package/dist/cli/{index-4fkxdnc7.js → index-erp7fk72.js} +1 -1
  46. package/dist/cli/{index-qawbxp81.js → index-gkvk9et2.js} +17 -17
  47. package/dist/cli/{index-kxp43wbw.js → index-h1chaf63.js} +29 -29
  48. package/dist/cli/{index-4ya4krts.js → index-hhzwfyd7.js} +611 -1376
  49. package/dist/cli/{index-x3rxa3sh.js → index-jt9j02tm.js} +6 -6
  50. package/dist/cli/{index-tecp3a77.js → index-kd1n3ne2.js} +9 -9
  51. package/dist/cli/{index-ss8nfrbb.js → index-ke881z7m.js} +15 -15
  52. package/dist/cli/{index-9ws7m02r.js → index-krjamprc.js} +2 -2
  53. package/dist/cli/{index-f8nb470m.js → index-kzr3nby8.js} +4 -4
  54. package/dist/cli/{index-02vgzrpg.js → index-mq4eyhtf.js} +7 -7
  55. package/dist/cli/{index-4tpzdegx.js → index-njg8zvqe.js} +7 -7
  56. package/dist/cli/{index-hh87yny7.js → index-nnc23ddw.js} +6 -6
  57. package/dist/cli/{index-7c4gckzq.js → index-nzhfhpng.js} +5 -5
  58. package/dist/cli/{index-q8vfw61p.js → index-pjrx4jkq.js} +1 -1
  59. package/dist/cli/{index-xhxbv7mz.js → index-qdz6zysj.js} +11 -11
  60. package/dist/cli/{index-mhd6kdzr.js → index-qyj4383m.js} +1 -1
  61. package/dist/cli/index-r097ettz.js +1330 -0
  62. package/dist/cli/{index-tvdn9gr0.js → index-ra3erqpk.js} +15 -15
  63. package/dist/cli/{index-2x015vjy.js → index-rck7v4r4.js} +1 -1
  64. package/dist/cli/{index-vtpt8yns.js → index-rjsqf4hv.js} +2 -2
  65. package/dist/cli/{index-bk8r4m9j.js → index-rpvp88js.js} +2 -2
  66. package/dist/cli/{index-2k5348b6.js → index-ssp4t8g6.js} +58 -57
  67. package/dist/cli/{index-v839c9mv.js → index-tggyracy.js} +1 -1
  68. package/dist/cli/{index-hzy6n59p.js → index-ve74c3a8.js} +6 -6
  69. package/dist/cli/{index-4ph7ad0b.js → index-vx1j2t5p.js} +2 -2
  70. package/dist/cli/{index-7h22y3ew.js → index-w0afnznk.js} +2 -2
  71. package/dist/cli/{index-xh50xsgf.js → index-x8sh8v4a.js} +8 -8
  72. package/dist/cli/{index-6901y99d.js → index-xht6gprr.js} +35 -22
  73. package/dist/cli/{index-qw2wfz92.js → index-yn6jrxen.js} +18 -20
  74. package/dist/cli/{index-94s844qn.js → index-yq73sd3w.js} +4 -4
  75. package/dist/cli/index.js +57 -56
  76. package/dist/cli/{knowledge-escalator-m4b4q218.js → knowledge-escalator-2e92rdsx.js} +18 -18
  77. package/dist/cli/{knowledge-events-wwg0cc7m.js → knowledge-events-gzqwr94e.js} +15 -15
  78. package/dist/cli/{knowledge-link-13t3nfrz.js → knowledge-link-r7e2t5c1.js} +5 -5
  79. package/dist/cli/{knowledge-store-07fwtdzy.js → knowledge-store-6j8d1gm4.js} +7 -7
  80. package/dist/cli/{knowledge-validator-8492vmn3.js → knowledge-validator-wt2tcfg7.js} +9 -9
  81. package/dist/cli/{mcp-b1wyrebx.js → mcp-ky6xn6ys.js} +1 -1
  82. package/dist/cli/{model-preflight-315wr8nt.js → model-preflight-ajt55s59.js} +56 -55
  83. package/dist/cli/{pending-delegations-tpa7wpny.js → pending-delegations-wry31649.js} +14 -14
  84. package/dist/cli/{pr-subscriptions-ev2bkbrz.js → pr-subscriptions-dsdjbfr4.js} +13 -13
  85. package/dist/cli/{pr-workflow-gate-3cg64r61.js → pr-workflow-gate-0vcq1m95.js} +53 -52
  86. package/dist/cli/{runner-q1g9atrv.js → runner-s4422dq4.js} +6 -6
  87. package/dist/cli/{scan-cursor-3pfx6mbh.js → scan-cursor-1zgrg7kp.js} +8 -8
  88. package/dist/cli/{schema-km0fywpx.js → schema-q9xbwkec.js} +2 -2
  89. package/dist/cli/{scope-persistence-xctbs0aj.js → scope-persistence-4wwmytwh.js} +18 -18
  90. package/dist/cli/{server-d1mcxa8s.js → server-q8ydxk7z.js} +79 -69
  91. package/dist/cli/{skill-generator-tce30v8g.js → skill-generator-b1eqcxej.js} +20 -20
  92. package/dist/cli/{snapshot-coordination-init-t7vfaqhw.js → snapshot-coordination-init-0yva5015.js} +53 -52
  93. package/dist/cli/{speckit-checkoff-tcn1dqt0.js → speckit-checkoff-sh9w7j5b.js} +5 -5
  94. package/dist/cli/{telemetry-cr8q16wk.js → telemetry-j7zr1dht.js} +1 -1
  95. package/dist/cli/workflow-wal-file-a2c8e920.js +32 -0
  96. package/dist/cli/{workspace-snapshot-7hws89e9.js → workspace-snapshot-ksdspd74.js} +3 -3
  97. package/dist/cli/{worktree-collision-ownership-5jb0p5aa.js → worktree-collision-ownership-xr6crt8c.js} +15 -15
  98. package/dist/cli/{worktree-isolation-cxg8fgba.js → worktree-isolation-0126b5e7.js} +53 -52
  99. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +3 -0
  100. package/dist/hooks/delegation-gate.d.ts +6 -0
  101. package/dist/hooks/guardrails/audit-log.d.ts +2 -0
  102. package/dist/hooks/guardrails/cmd-delete-grammar.d.ts +47 -0
  103. package/dist/hooks/guardrails/destructive-command.d.ts +11 -3
  104. package/dist/hooks/guardrails/shell-audit-store.d.ts +2 -0
  105. package/dist/hooks/guardrails/tool-before.d.ts +16 -0
  106. package/dist/hooks/shell-write-detect.d.ts +10 -0
  107. package/dist/index.js +689 -687
  108. package/dist/memory/redaction.d.ts +13 -3
  109. package/dist/pr-review/legacy-transcript-adapter.d.ts +15 -4
  110. package/dist/sandbox/macos/sandbox-exec-executor.d.ts +24 -0
  111. package/dist/workflow/coder-settlement.d.ts +5 -0
  112. package/dist/worktree/core.d.ts +3 -0
  113. package/dist/worktree/merge.d.ts +15 -1
  114. package/dist/worktree/ownership.d.ts +3 -0
  115. package/dist/worktree/settlement-artifact-lifecycle.d.ts +32 -0
  116. package/dist/worktree/settlement-source-recovery.d.ts +12 -0
  117. package/package.json +1 -1
  118. package/dist/cli/curator-llm-factory-kja1c81k.js +0 -82
  119. package/dist/cli/guardrail-explain-agaet7r5.js +0 -83
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  withEvidenceLock
4
- } from "./index-q8vfw61p.js";
4
+ } from "./index-pjrx4jkq.js";
5
5
  import {
6
6
  atomicWriteFileAnyRoot
7
- } from "./index-mn75z39t.js";
7
+ } from "./index-9qy3tzt5.js";
8
8
 
9
9
  // src/evidence/task-file.ts
10
10
  import * as path from "path";
@@ -1,13 +1,13 @@
1
1
  // @bun
2
+ import {
3
+ OUTCOME_BLOCK_THRESHOLD,
4
+ init_knowledge_types
5
+ } from "./index-bk5tah7q.js";
2
6
  import {
3
7
  ALL_AGENT_NAMES,
4
8
  SUMMARIZER_EXEMPT_TOOL_NAMES,
5
9
  init_constants
6
10
  } from "./index-xfzkq1k4.js";
7
- import {
8
- OUTCOME_BLOCK_THRESHOLD,
9
- init_knowledge_types
10
- } from "./index-bk5tah7q.js";
11
11
  import {
12
12
  exports_external,
13
13
  init_zod
@@ -21,7 +21,7 @@ var package_default;
21
21
  var init_package = __esm(() => {
22
22
  package_default = {
23
23
  name: "opencode-swarm",
24
- version: "7.200.9",
24
+ version: "7.200.11",
25
25
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
26
26
  main: "dist/index.js",
27
27
  types: "dist/index.d.ts",
@@ -1,26 +1,35 @@
1
1
  // @bun
2
+ import {
3
+ ensureTaskGateRequirementsReceiptForSettledTransition,
4
+ getTaskWorkflowSnapshot,
5
+ withTaskEvidenceTransaction
6
+ } from "./index-r097ettz.js";
2
7
  import {
3
8
  captureWorkspaceSnapshotAsync,
4
9
  changedFilesSinceSnapshotAsync
5
- } from "./index-bk8r4m9j.js";
10
+ } from "./index-rpvp88js.js";
6
11
  import {
7
12
  removeWorktreeProvisioningOwner
8
- } from "./index-7h22y3ew.js";
13
+ } from "./index-w0afnznk.js";
14
+ import {
15
+ appendCoreEventSync
16
+ } from "./index-rjsqf4hv.js";
9
17
  import {
10
18
  SOURCE_WORKTREE_GONE_STAGE,
11
- ensureTaskGateRequirementsReceiptForSettledTransition,
12
- getTaskWorkflowSnapshot,
19
+ preserveSettlementSource,
20
+ probeSettlementSource,
13
21
  readWorkflowWalFile,
14
22
  reconcileLandedMerge,
15
- withTaskEvidenceTransaction,
23
+ releaseSettlementSource,
24
+ validateSettlementLane,
16
25
  writeWorkflowWalFile
17
- } from "./index-4ya4krts.js";
26
+ } from "./index-hhzwfyd7.js";
18
27
  import {
19
- validateSwarmPath
20
- } from "./index-4krkevgc.js";
28
+ withSettlementArtifactLifecycle
29
+ } from "./index-2n7a184b.js";
21
30
  import {
22
- appendCoreEventSync
23
- } from "./index-vtpt8yns.js";
31
+ validateSwarmPath
32
+ } from "./index-001tkp0j.js";
24
33
  import {
25
34
  init_path_identity,
26
35
  isPathWithinDeclaredScope
@@ -288,31 +297,44 @@ async function beginCoderSettlement(options) {
288
297
  return;
289
298
  }
290
299
  }
291
- await transaction.transition({
292
- type: "dispatch_attempted",
293
- agentType: "coder",
294
- expectedGeneration: options.expectedGeneration,
295
- transitionId: options.transitionId
296
- });
297
- await writeWal(filePath, {
298
- version: 1,
299
- state: "DISPATCHED",
300
- taskId: options.taskId,
301
- transitionId: options.transitionId,
302
- actor: options.actor,
303
- processId: process.pid,
304
- runtimeId,
305
- expectedGeneration: options.expectedGeneration,
306
- context: options.context,
307
- ...options.worktree ? { worktree: options.worktree } : {},
308
- recordedAt: new Date().toISOString()
309
- });
310
- ownsActiveDispatch = true;
311
- await appendSettlementEvent(options.directory, "dispatched", {
312
- taskId: options.taskId,
313
- transitionId: options.transitionId,
314
- actor: options.actor
315
- });
300
+ const publish = async () => {
301
+ if (options.worktree) {
302
+ if (canonicalRootKeyFresh(options.context.baseline.directory) !== canonicalRootKeyFresh(options.worktree.worktreePath) || options.context.baseline.gitHead === null) {
303
+ throw new Error("CODER_SETTLEMENT_DISPATCH_ARTIFACT_CHANGED");
304
+ }
305
+ await _internals.validateSettlementLane(options.worktree.worktreePath, options.worktree.branchName, options.context.baseline.gitHead);
306
+ }
307
+ await transaction.transition({
308
+ type: "dispatch_attempted",
309
+ agentType: "coder",
310
+ expectedGeneration: options.expectedGeneration,
311
+ transitionId: options.transitionId
312
+ });
313
+ await writeWal(filePath, {
314
+ version: 1,
315
+ state: "DISPATCHED",
316
+ taskId: options.taskId,
317
+ transitionId: options.transitionId,
318
+ actor: options.actor,
319
+ processId: process.pid,
320
+ runtimeId,
321
+ expectedGeneration: options.expectedGeneration,
322
+ context: options.context,
323
+ ...options.worktree ? { worktree: options.worktree } : {},
324
+ recordedAt: new Date().toISOString()
325
+ });
326
+ ownsActiveDispatch = true;
327
+ await appendSettlementEvent(options.directory, "dispatched", {
328
+ taskId: options.taskId,
329
+ transitionId: options.transitionId,
330
+ actor: options.actor
331
+ });
332
+ };
333
+ if (options.worktree) {
334
+ await _internals.withSettlementArtifactLifecycle(options.directory, publish);
335
+ } else {
336
+ await publish();
337
+ }
316
338
  }));
317
339
  if (ownsActiveDispatch) {
318
340
  const key = dispatchKey(options.directory, options.taskId, options.transitionId);
@@ -512,7 +534,7 @@ async function cleanupRecoveredWorktree(directory, descriptor, options) {
512
534
  awaitingMergeByCallID,
513
535
  cleanupStandardWorktreeForCallId,
514
536
  standardWorktreeByCallID
515
- } = await import("./worktree-isolation-cxg8fgba.js");
537
+ } = await import("./worktree-isolation-0126b5e7.js");
516
538
  standardWorktreeByCallID.delete(descriptor.callID);
517
539
  if (hasResidue)
518
540
  awaitingMergeByCallID.set(descriptor.callID, {
@@ -540,6 +562,41 @@ async function cleanupRecoveredWorktree(directory, descriptor, options) {
540
562
  throw new Error("CODER_SETTLEMENT_OWNER_CLEANUP_FAILED");
541
563
  }
542
564
  }
565
+ var HISTORICAL_ORPHAN_ADVISORY_COOLDOWN_MS = 600000;
566
+ var MAX_HISTORICAL_ORPHAN_ADVISORIES = 256;
567
+ var historicalOrphanAdvisoryAt = new Map;
568
+ function shouldEmitHistoricalOrphanAdvisory(key) {
569
+ const now = Date.now();
570
+ const last = historicalOrphanAdvisoryAt.get(key);
571
+ if (last !== undefined && now - last >= 0 && now - last < HISTORICAL_ORPHAN_ADVISORY_COOLDOWN_MS)
572
+ return false;
573
+ historicalOrphanAdvisoryAt.delete(key);
574
+ historicalOrphanAdvisoryAt.set(key, now);
575
+ while (historicalOrphanAdvisoryAt.size > MAX_HISTORICAL_ORPHAN_ADVISORIES) {
576
+ const oldest = historicalOrphanAdvisoryAt.keys().next().value;
577
+ if (oldest === undefined)
578
+ break;
579
+ historicalOrphanAdvisoryAt.delete(oldest);
580
+ }
581
+ return true;
582
+ }
583
+ async function preserveHistoricalSelfHealedSource(directory, wal) {
584
+ if (wal.state !== "ABORTED" || !wal.abortReason?.startsWith("CODER_SETTLEMENT_SELF_HEALED_MISSING_WORKTREE") || !wal.mergeProvenance || await probeSettlementSource(directory, wal.mergeProvenance.sourceHead) !== "present")
585
+ return "none";
586
+ const source = wal.mergeProvenance.sourceHead;
587
+ const backup = await preserveSettlementSource(directory, source);
588
+ const landed = await reconcileLandedMerge(directory, wal.mergeProvenance);
589
+ if (landed.landed && landed.method !== "worktree-match") {
590
+ await releaseSettlementSource(directory, source);
591
+ return "none";
592
+ }
593
+ if (shouldEmitHistoricalOrphanAdvisory(`${canonicalRootKeyFresh(directory)}\x00${wal.taskId}\x00${source}`)) {
594
+ const message = `RECOVERABLE_ORPHAN_COMMIT: historical aborted task ${wal.taskId} source ${source} is retained at ${backup}; apply it explicitly after reviewing the current task generation. The settlement remains ABORTED. This report is advisory: task status, dispatch and close are not blocked by it.`;
595
+ criticalWarn(message);
596
+ advisoryWarn(message);
597
+ }
598
+ return "orphan";
599
+ }
543
600
  async function completeCoderSettlementCleanup(directory, taskId, transitionId) {
544
601
  await withSettlementLock(directory, taskId, "coder-cleanup", async () => {
545
602
  const filePath = walPath(directory, taskId);
@@ -552,6 +609,8 @@ async function completeCoderSettlementCleanup(directory, taskId, transitionId) {
552
609
  if (wal.state !== "COMMITTED" && wal.state !== "ABORTED") {
553
610
  throw new Error("CODER_SETTLEMENT_NOT_COMMITTED");
554
611
  }
612
+ if (await preserveHistoricalSelfHealedSource(directory, wal) === "orphan")
613
+ return;
555
614
  if (!wal.worktree || wal.cleanupComplete === true)
556
615
  return;
557
616
  await cleanupRecoveredWorktree(directory, wal.worktree);
@@ -563,6 +622,14 @@ async function selfHealMissingLaneWorktree(directory, filePath, taskId, transiti
563
622
  return false;
564
623
  if (_internals.branchExists(directory, descriptor.branchName))
565
624
  return false;
625
+ const currentWal = await readWal(filePath, taskId);
626
+ if (currentWal?.mergeProvenance) {
627
+ const source = currentWal.mergeProvenance.sourceHead;
628
+ if (await probeSettlementSource(directory, source) === "present") {
629
+ const backup = await preserveSettlementSource(directory, source);
630
+ throw new Error(`RECOVERABLE_ORPHAN_COMMIT: task ${taskId} source ${source} is retained at ${backup}; settlement remains pending.`);
631
+ }
632
+ }
566
633
  const reason = `CODER_SETTLEMENT_SELF_HEALED_MISSING_WORKTREE: ${detail}`;
567
634
  const aborted = await abortDispatchedWalUnderLock(directory, taskId, transitionId, reason);
568
635
  if (aborted.outcome === "not-dispatched")
@@ -588,8 +655,10 @@ async function recoverCoderSettlement(directory, taskId) {
588
655
  if (existingWal === null)
589
656
  return null;
590
657
  let wal = existingWal;
591
- if (wal.state === "ABORTED")
658
+ if (wal.state === "ABORTED") {
659
+ await preserveHistoricalSelfHealedSource(directory, wal);
592
660
  return null;
661
+ }
593
662
  if (wal.state === "COMMITTED") {
594
663
  if (wal.worktree && wal.cleanupComplete !== true) {
595
664
  await cleanupRecoveredWorktree(directory, wal.worktree);
@@ -604,6 +673,9 @@ async function recoverCoderSettlement(directory, taskId) {
604
673
  if (wal.state === "DISPATCHED") {
605
674
  if (wal.worktree) {
606
675
  const worktree = wal.worktree;
676
+ const sourceState = wal.mergeProvenance ? await probeSettlementSource(directory, wal.mergeProvenance.sourceHead) : undefined;
677
+ if (sourceState === "absent" && await selfHealMissingLaneWorktree(directory, filePath, taskId, wal.transitionId, worktree, "the recorded source object, lane branch and checkout are absent"))
678
+ return null;
607
679
  const observed2 = wal.observedFiles ?? await scopedObservedFiles(worktree.worktreePath, wal.context);
608
680
  if (observed2 === null) {
609
681
  throw new Error(`CODER_SETTLEMENT_RECOVERY_UNCERTAIN: transition ${wal.transitionId} for isolated task ${taskId} could not attribute worktree changes to the declared scope (${filePath}, state ${wal.state}). Run /swarm recover ${taskId} (or /swarm reset-session), then retry; do not remove the WAL by hand.`);
@@ -611,10 +683,15 @@ async function recoverCoderSettlement(directory, taskId) {
611
683
  const unattributedEmptyScopeMutation2 = hasUnattributedEmptyScopeMutation(wal.context.declaredFiles, observed2);
612
684
  const accepted = observed2.length > 0 || unattributedEmptyScopeMutation2;
613
685
  const settlementFailed = wal.settlementFailed === true || unattributedEmptyScopeMutation2;
614
- if (wal.mergeProvenance) {
686
+ if (wal.mergeProvenance && sourceState !== "absent") {
615
687
  const landed = await reconcileLandedMerge(directory, wal.mergeProvenance);
616
688
  if (landed.landed) {
617
689
  const landedUnstaged = landed.method === "worktree-match";
690
+ if (landedUnstaged) {
691
+ await preserveSettlementSource(directory, wal.mergeProvenance.sourceHead);
692
+ } else {
693
+ await releaseSettlementSource(directory, wal.mergeProvenance.sourceHead);
694
+ }
618
695
  wal = {
619
696
  ...wal,
620
697
  state: "PREPARED",
@@ -640,6 +717,7 @@ async function recoverCoderSettlement(directory, taskId) {
640
717
  });
641
718
  return committed2;
642
719
  }
720
+ await preserveSettlementSource(directory, wal.mergeProvenance.sourceHead);
643
721
  if (landed.error) {
644
722
  throw new Error(`CODER_SETTLEMENT_RECOVERY_UNCERTAIN: transition ${wal.transitionId} for task ${taskId} could not reconcile the landed merge (${filePath}, state ${wal.state}): ${landed.error}. Run /swarm recover ${taskId} (or /swarm reset-session), then retry; do not remove the WAL by hand.`);
645
723
  }
@@ -648,7 +726,7 @@ async function recoverCoderSettlement(directory, taskId) {
648
726
  awaitingMergeByCallID,
649
727
  finishStandardWorktreeDispatch,
650
728
  standardWorktreeByCallID
651
- } = await import("./worktree-isolation-cxg8fgba.js");
729
+ } = await import("./worktree-isolation-0126b5e7.js");
652
730
  const descriptor = wal.worktree;
653
731
  const reconstructedDispatch = {
654
732
  callID: descriptor.callID,
@@ -927,9 +1005,12 @@ async function recoverStaleCoderSettlements(directory, options) {
927
1005
  }
928
1006
  var _internals = {
929
1007
  liveDispatches,
1008
+ withSettlementArtifactLifecycle,
1009
+ validateSettlementLane,
930
1010
  removeWorktreeProvisioningOwner,
931
1011
  branchExists: probeBranchExists,
932
- recoverCoderSettlement
1012
+ recoverCoderSettlement,
1013
+ historicalOrphanAdvisoryAt
933
1014
  };
934
1015
 
935
1016
  export { hasUnattributedEmptyScopeMutation, beginCoderSettlement, settleCoderDispatch, abortCoderSettlement, transferCoderSettlementToBackground, abortCoderSettlementIfDoomed, recordCoderMergeProvenance, completeCoderSettlementCleanup, recoverCoderSettlement, releaseCoderDispatchOwnership, assertNoUnsettledCoderDispatch, listCoderSettlementWalStates, recoverStaleCoderSettlements, _internals };
@@ -3,13 +3,13 @@ import {
3
3
  pseudonymousRef,
4
4
  resolveLineageSalt,
5
5
  telemetry
6
- } from "./index-c2k7q723.js";
6
+ } from "./index-6cppzd9c.js";
7
7
  import {
8
8
  canonicalRootKeyFresh
9
9
  } from "./index-te9hq2f4.js";
10
10
  import {
11
11
  atomicWriteSwarmFile
12
- } from "./index-mn75z39t.js";
12
+ } from "./index-9qy3tzt5.js";
13
13
 
14
14
  // src/health/learning-health.ts
15
15
  import { promises as fs } from "fs";
@@ -285,7 +285,7 @@ var SWARM_TEMP_GRAMMARS = [
285
285
  "src/tools/spec-write.ts:98",
286
286
  "src/sdd/effective-spec.ts:1509",
287
287
  "src/background/lane-output-store.ts:353",
288
- "src/background/pending-delegations.ts:1533",
288
+ "src/background/pending-delegations.ts:writeDurableFileSync",
289
289
  "src/background/delegation-health.ts:391",
290
290
  "src/tools/submit-phase-council-verdicts.ts:458",
291
291
  "src/summaries/store.ts (pre-#2035; migrated-to=src/summaries/store.ts:writeRawSidecar)",
@@ -5,29 +5,33 @@ import {
5
5
  import {
6
6
  effectiveRetrievalOutcomes,
7
7
  readAuthoritativeKnowledgeCounterRollups
8
- } from "./index-f8nb470m.js";
8
+ } from "./index-kzr3nby8.js";
9
9
  import {
10
10
  ALLOWED_SKILL_PATH_PREFIXES,
11
11
  validateSkillPath
12
- } from "./index-94s844qn.js";
12
+ } from "./index-yq73sd3w.js";
13
13
  import {
14
14
  computeOutcomeSignal,
15
15
  readKnowledge,
16
16
  resolveHiveKnowledgePath,
17
17
  resolveSwarmKnowledgePath,
18
18
  transactKnowledge
19
- } from "./index-xhxbv7mz.js";
19
+ } from "./index-qdz6zysj.js";
20
20
  import {
21
21
  appendCappedJsonl,
22
22
  resolveRetentionCap
23
23
  } from "./index-vzm6zre7.js";
24
+ import {
25
+ init_knowledge_types,
26
+ isActiveStatus
27
+ } from "./index-bk5tah7q.js";
24
28
  import {
25
29
  canonicalRootKeyFresh
26
30
  } from "./index-te9hq2f4.js";
27
31
  import {
28
32
  atomicWriteFileAnyRoot,
29
33
  atomicWriteSwarmFile
30
- } from "./index-mn75z39t.js";
34
+ } from "./index-9qy3tzt5.js";
31
35
  import {
32
36
  advisoryWarn,
33
37
  init_warning_buffer
@@ -37,10 +41,6 @@ import {
37
41
  log,
38
42
  warn
39
43
  } from "./index-zgwm4ryv.js";
40
- import {
41
- init_knowledge_types,
42
- isActiveStatus
43
- } from "./index-bk5tah7q.js";
44
44
  import {
45
45
  __require
46
46
  } from "./index-a76rekgs.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  computePlanStructureHash
4
- } from "./index-tvdn9gr0.js";
4
+ } from "./index-ra3erqpk.js";
5
5
  import {
6
6
  deleteCoordinationState,
7
7
  importCoordinationOnce,
@@ -9,20 +9,23 @@ import {
9
9
  transitionCoordinationState,
10
10
  transitionCoordinationStateWithinTransaction,
11
11
  withCoordinationTransaction
12
- } from "./index-2x015vjy.js";
12
+ } from "./index-rck7v4r4.js";
13
13
  import {
14
14
  getProjectDb
15
- } from "./index-y7c4hqcj.js";
15
+ } from "./index-ck7jpn0y.js";
16
16
  import {
17
17
  canonicalExistingFilesystemPath,
18
18
  legacyCanonicalExistingFilesystemPath
19
19
  } from "./index-ry16d01s.js";
20
20
  import {
21
21
  appendCoreEventSync
22
- } from "./index-vtpt8yns.js";
22
+ } from "./index-rjsqf4hv.js";
23
23
  import {
24
24
  derivePlanId
25
25
  } from "./index-7pmbnjvj.js";
26
+ import {
27
+ PlanSchema
28
+ } from "./index-3t46mez1.js";
26
29
  import {
27
30
  init_path_identity,
28
31
  unsafePathTextReason
@@ -36,10 +39,7 @@ import {
36
39
  import {
37
40
  atomicWriteSwarmFile,
38
41
  atomicWriteSwarmFileSync
39
- } from "./index-mn75z39t.js";
40
- import {
41
- PlanSchema
42
- } from "./index-3t46mez1.js";
42
+ } from "./index-9qy3tzt5.js";
43
43
  import {
44
44
  __toESM
45
45
  } from "./index-a76rekgs.js";
@@ -1,10 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  readEffectiveSpecSync
4
- } from "./index-hh87yny7.js";
5
- import {
6
- readSwarmFileAsync
7
- } from "./index-4krkevgc.js";
4
+ } from "./index-nnc23ddw.js";
8
5
  import {
9
6
  DURABILITY_CLASSES,
10
7
  DbWriteError,
@@ -13,7 +10,10 @@ import {
13
10
  classifyDbWriteError,
14
11
  getProjectDb,
15
12
  projectDbExists
16
- } from "./index-y7c4hqcj.js";
13
+ } from "./index-ck7jpn0y.js";
14
+ import {
15
+ readSwarmFileAsync
16
+ } from "./index-001tkp0j.js";
17
17
  import {
18
18
  _internals,
19
19
  canonicalRootKeyFresh