opencode-swarm 7.172.4 → 7.173.0

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 (90) hide show
  1. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  2. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  3. package/dist/background/pending-delegations.d.ts +2 -0
  4. package/dist/cli/{coder-settlement-mjqefsjv.js → coder-settlement-f60aqxyv.js} +10 -10
  5. package/dist/cli/{config-doctor-3nxrxzqg.js → config-doctor-nvw2fwrn.js} +2 -2
  6. package/dist/cli/{core-bebtf39m.js → core-z68xfzar.js} +3 -3
  7. package/dist/cli/{curation-policy-yep7t261.js → curation-policy-tx4kb30e.js} +4 -4
  8. package/dist/cli/{curator-tbzt37gq.js → curator-93a3pyvv.js} +35 -35
  9. package/dist/cli/{curator-drift-z8p6kwqg.js → curator-drift-047n8fjw.js} +4 -4
  10. package/dist/cli/curator-llm-factory-xkhzrdkk.js +72 -0
  11. package/dist/cli/{evidence-summary-service-b8wvay0a.js → evidence-summary-service-s22vfx64.js} +14 -14
  12. package/dist/cli/{gate-evidence-7kqzd4b6.js → gate-evidence-kz044xwh.js} +5 -5
  13. package/dist/cli/guardrail-explain-5nyr0vnx.js +73 -0
  14. package/dist/cli/{guardrail-log-cpb01m4a.js → guardrail-log-sh9ecphn.js} +6 -6
  15. package/dist/cli/{guardrail-reset-226tvhv4.js → guardrail-reset-m56x3djm.js} +35 -35
  16. package/dist/cli/{hive-promoter-nz5dk7cz.js → hive-promoter-1hfyd1gn.js} +35 -35
  17. package/dist/cli/{index-j7zrvqnf.js → index-0dfhahxm.js} +2 -2
  18. package/dist/cli/{index-1t4v24tw.js → index-0y9fqm5d.js} +1 -1
  19. package/dist/cli/{index-kt8yn94y.js → index-10vr7289.js} +1 -1
  20. package/dist/cli/{index-36143n94.js → index-1pnw3jkr.js} +7 -6
  21. package/dist/cli/{index-2qv69ydg.js → index-1r2avghn.js} +3 -3
  22. package/dist/cli/{index-bwnf1e4d.js → index-3312a4k1.js} +37 -37
  23. package/dist/cli/{index-bbhgnn4j.js → index-3n16qq3z.js} +7 -7
  24. package/dist/cli/{index-yxegcfy5.js → index-43dmpa9w.js} +1 -1
  25. package/dist/cli/{index-gqkfha6x.js → index-579nzg03.js} +1 -1
  26. package/dist/cli/{index-rxakec16.js → index-7gkdxs00.js} +6 -6
  27. package/dist/cli/{index-5qfqwbvg.js → index-8xkr8p2b.js} +7 -7
  28. package/dist/cli/{index-zpksgw8w.js → index-915wxcgs.js} +4 -4
  29. package/dist/cli/{index-8p30wyx0.js → index-bsnpv4xd.js} +1 -1
  30. package/dist/cli/{index-d9g9stnf.js → index-btxf9k1r.js} +10 -10
  31. package/dist/cli/{index-jg2s11sg.js → index-dktpzjy9.js} +1 -1
  32. package/dist/cli/{index-1c1n8aax.js → index-e8tscab8.js} +120 -6
  33. package/dist/cli/{index-68bp6sak.js → index-ejrqyrsr.js} +2 -2
  34. package/dist/cli/{index-2n16srdc.js → index-evf5r7bk.js} +1 -1
  35. package/dist/cli/{index-szezqd2a.js → index-fb5rj8sk.js} +7 -7
  36. package/dist/cli/{index-y6bqbe76.js → index-fnx0jzf7.js} +1 -1
  37. package/dist/cli/{index-16rwxf4m.js → index-fxac6j9v.js} +35 -35
  38. package/dist/cli/{index-5tjd3cne.js → index-gd40ehzt.js} +5 -5
  39. package/dist/cli/{index-9h6zhnk0.js → index-hhws1xkc.js} +1 -1
  40. package/dist/cli/{index-01mjyjdt.js → index-kdyvk541.js} +1 -1
  41. package/dist/cli/{index-1c119trs.js → index-m08ee28a.js} +47 -23
  42. package/dist/cli/{index-efbdfkw9.js → index-m51cmzxt.js} +1 -1
  43. package/dist/cli/{index-2negdnww.js → index-mq2y8qpg.js} +5 -5
  44. package/dist/cli/{index-kerhh5q4.js → index-mt8pbzda.js} +1 -1
  45. package/dist/cli/{index-a1187fx5.js → index-ndvgkxpf.js} +2 -2
  46. package/dist/cli/{index-fn7ny88p.js → index-njdy6w9x.js} +1975 -1828
  47. package/dist/cli/{index-y1qc2cpp.js → index-nrsnman7.js} +3 -3
  48. package/dist/cli/{index-her1kqcr.js → index-nztmfgvw.js} +4 -4
  49. package/dist/cli/{index-d21qcjr6.js → index-pserzhck.js} +1 -1
  50. package/dist/cli/{index-zfzbn9a7.js → index-sftt3gdv.js} +2 -2
  51. package/dist/cli/{index-3rkjybes.js → index-tztqvzf5.js} +2 -2
  52. package/dist/cli/{index-j8z3t7dv.js → index-wr4m11x4.js} +1 -1
  53. package/dist/cli/{index-ksjpc8s8.js → index-yzwb6ja4.js} +1 -1
  54. package/dist/cli/{index-pkgshf8r.js → index-z1k5dvn0.js} +2 -2
  55. package/dist/cli/{index-qzptb0gf.js → index-z35ynvj4.js} +1 -1
  56. package/dist/cli/{index-b395nw9b.js → index-za1kvsa0.js} +2 -2
  57. package/dist/cli/index.js +36 -36
  58. package/dist/cli/{knowledge-escalator-qjvkjkhw.js → knowledge-escalator-zeackj4h.js} +11 -11
  59. package/dist/cli/{knowledge-events-ctn3yfqx.js → knowledge-events-nfcgfhq2.js} +9 -9
  60. package/dist/cli/{knowledge-link-3qypq7bm.js → knowledge-link-f7bhq7cx.js} +3 -3
  61. package/dist/cli/{knowledge-store-7js414b2.js → knowledge-store-jptt6kp5.js} +4 -4
  62. package/dist/cli/{knowledge-validator-f5xhqqxr.js → knowledge-validator-e7nten5a.js} +6 -6
  63. package/dist/cli/{mcp-wzvpxtqf.js → mcp-14kyj73d.js} +1 -1
  64. package/dist/cli/{pending-delegations-avmzmj7x.js → pending-delegations-4jget283.js} +10 -10
  65. package/dist/cli/{pr-subscriptions-k33rz8ea.js → pr-subscriptions-qe0j6xyr.js} +10 -10
  66. package/dist/cli/{pr-workflow-gate-x91jrfaz.js → pr-workflow-gate-2m91qcm6.js} +35 -35
  67. package/dist/cli/{runner-2qypr9b5.js → runner-58k70bnr.js} +4 -4
  68. package/dist/cli/{scan-cursor-kmp98vk2.js → scan-cursor-myzgmzj6.js} +5 -5
  69. package/dist/cli/{schema-n50qbvmt.js → schema-gws3yx52.js} +1 -1
  70. package/dist/cli/{scope-persistence-nrj3q5sk.js → scope-persistence-fh1d8vs0.js} +13 -13
  71. package/dist/cli/{server-zs1r7z1g.js → server-v0wfd3rk.js} +35 -35
  72. package/dist/cli/{skill-generator-7f0jayyp.js → skill-generator-935cmd3p.js} +13 -13
  73. package/dist/cli/{snapshot-coordination-init-6tz602wz.js → snapshot-coordination-init-ad8n0977.js} +35 -35
  74. package/dist/cli/{workspace-snapshot-e63mg204.js → workspace-snapshot-62be4368.js} +3 -3
  75. package/dist/cli/{worktree-collision-ownership-hqk8gc0f.js → worktree-collision-ownership-txzvv5jv.js} +11 -11
  76. package/dist/cli/{worktree-isolation-8yh97cgh.js → worktree-isolation-tv749n96.js} +35 -35
  77. package/dist/commands/close/orchestrator.d.ts +34 -0
  78. package/dist/commands/destructive-purge.d.ts +15 -0
  79. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +18 -3
  80. package/dist/hooks/guardrails/index.d.ts +2 -0
  81. package/dist/hooks/guardrails/stage-a-route.d.ts +45 -0
  82. package/dist/hooks/guardrails/tool-before.d.ts +10 -0
  83. package/dist/index.js +251 -246
  84. package/dist/turbo/lean/merge-back.d.ts +1 -1
  85. package/dist/workflow/coder-settlement.d.ts +2 -0
  86. package/dist/worktree/merge.d.ts +36 -9
  87. package/dist/worktree/types.d.ts +8 -1
  88. package/package.json +1 -1
  89. package/dist/cli/curator-llm-factory-pchm0j1e.js +0 -72
  90. package/dist/cli/guardrail-explain-dmyf8vc9.js +0 -73
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  autoCommitDirty,
4
4
  cleanUntrackedFiles
5
- } from "./index-y1qc2cpp.js";
5
+ } from "./index-nrsnman7.js";
6
6
  import {
7
7
  validateSwarmPath
8
- } from "./index-2n16srdc.js";
8
+ } from "./index-evf5r7bk.js";
9
9
  import {
10
10
  bunSpawn,
11
11
  classifySpawnFailure
@@ -15,7 +15,7 @@ import {
15
15
  atomicWriteFile,
16
16
  taskEvidencePath,
17
17
  withTaskEvidenceLock
18
- } from "./index-01mjyjdt.js";
18
+ } from "./index-kdyvk541.js";
19
19
  import {
20
20
  telemetry
21
21
  } from "./index-jmn35na4.js";
@@ -476,6 +476,62 @@ function parseConflictFiles(output) {
476
476
  return files;
477
477
  }
478
478
  var GIT_OBJECT_ID_PATTERN = /^[0-9a-f]{40}$|^[0-9a-f]{64}$/;
479
+ async function matchesSourceHeadWorkingTree(primaryDir, sourceHead) {
480
+ const mergeBase = await runGit(["merge-base", "HEAD", sourceHead], primaryDir);
481
+ if (mergeBase.exitCode !== 0) {
482
+ return {
483
+ landed: false,
484
+ error: mergeBase.stderr.trim() || `git merge-base exited ${mergeBase.exitCode}`
485
+ };
486
+ }
487
+ const incoming = await runGit([
488
+ "diff",
489
+ "--name-status",
490
+ "--no-renames",
491
+ mergeBase.stdout.trim(),
492
+ sourceHead,
493
+ "--"
494
+ ], primaryDir);
495
+ if (incoming.exitCode !== 0) {
496
+ return {
497
+ landed: false,
498
+ error: incoming.stderr.trim() || incoming.stdout.trim() || `git diff exited ${incoming.exitCode}`
499
+ };
500
+ }
501
+ for (const line of incoming.stdout.split(`
502
+ `)) {
503
+ if (!line)
504
+ continue;
505
+ const tabIndex = line.indexOf("\t");
506
+ if (tabIndex < 0)
507
+ continue;
508
+ const status = line.slice(0, tabIndex);
509
+ const filePath = line.slice(tabIndex + 1);
510
+ if (filePath.startsWith('"'))
511
+ return { landed: false };
512
+ if (status === "A") {
513
+ const worktreePath = path3.join(primaryDir, filePath);
514
+ if (!fs3.existsSync(worktreePath))
515
+ return { landed: false };
516
+ const expected = await runGit(["rev-parse", `${sourceHead}:${filePath}`], primaryDir);
517
+ const actual = await runGit(["hash-object", "--", filePath], primaryDir);
518
+ if (expected.exitCode !== 0 || actual.exitCode !== 0) {
519
+ return {
520
+ landed: false,
521
+ error: expected.stderr.trim() || actual.stderr.trim() || `git content probe exited ${expected.exitCode}/${actual.exitCode}`
522
+ };
523
+ }
524
+ if (actual.stdout.trim() !== expected.stdout.trim()) {
525
+ return { landed: false };
526
+ }
527
+ continue;
528
+ }
529
+ const diff = await runGit(["diff", "--quiet", sourceHead, "--", filePath], primaryDir);
530
+ if (diff.exitCode !== 0)
531
+ return { landed: false };
532
+ }
533
+ return { landed: true, method: "worktree-match" };
534
+ }
479
535
  function abortArgsForStrategy(strategy) {
480
536
  return strategy === "rebase" ? ["rebase", "--abort"] : strategy === "cherry-pick" ? ["cherry-pick", "--abort"] : ["merge", "--abort"];
481
537
  }
@@ -764,6 +820,58 @@ async function mergeLaneBranch(primaryDir, branchName, strategy) {
764
820
  case "merge":
765
821
  result = await runGit(["merge", "--no-edit", branchName], primaryDir);
766
822
  break;
823
+ case "squash-unstaged": {
824
+ const mergeBaseResult = await runGit(["merge-base", "HEAD", branchName], primaryDir);
825
+ const mergeBase = mergeBaseResult.stdout.trim();
826
+ if (mergeBaseResult.exitCode !== 0 || !GIT_OBJECT_ID_PATTERN.test(mergeBase)) {
827
+ return {
828
+ error: `Unable to determine merge base for squash-unstaged landing of ${branchName}`
829
+ };
830
+ }
831
+ const incomingResult = await runGit([
832
+ "diff",
833
+ "--name-status",
834
+ "-z",
835
+ "--find-renames",
836
+ `${mergeBase}..${branchName}`
837
+ ], primaryDir);
838
+ if (incomingResult.exitCode !== 0) {
839
+ return {
840
+ error: `Unable to enumerate incoming paths for squash-unstaged landing of ${branchName}`
841
+ };
842
+ }
843
+ const parsedIncoming = parseIncomingPaths(incomingResult.stdout, currentPathCasePolicy());
844
+ if ("error" in parsedIncoming || parsedIncoming.paths.size === 0) {
845
+ return {
846
+ error: `No parsable incoming paths for squash-unstaged landing of ${branchName}`
847
+ };
848
+ }
849
+ const incomingPaths = [...parsedIncoming.paths.values()];
850
+ const squashResult = await runGit(["merge", "--squash", "--no-commit", branchName], primaryDir);
851
+ if (squashResult.exitCode !== 0) {
852
+ const combined = `${squashResult.stderr}
853
+ ${squashResult.stdout}`;
854
+ const restore = await runGit(["checkout", "-q", "HEAD", "--", ...incomingPaths], primaryDir);
855
+ if (/CONFLICT/i.test(combined)) {
856
+ return {
857
+ conflict: true,
858
+ files: parseConflictFiles(combined),
859
+ message: squashResult.stderr.trim() || squashResult.stdout.trim() || "squash merge reported a conflict"
860
+ };
861
+ }
862
+ if (restore.exitCode !== 0) {
863
+ advisoryWarn(`[worktree] mergeLaneBranch: squash merge failed and targeted restore also failed for ${branchName}: ${restore.stderr.trim() || restore.stdout.trim()}`);
864
+ }
865
+ return {
866
+ error: squashResult.stderr.trim() || squashResult.stdout.trim() || "squash merge failed"
867
+ };
868
+ }
869
+ const resetResult = await runGit(["reset", "-q", "HEAD", "--", ...incomingPaths], primaryDir);
870
+ if (resetResult.exitCode !== 0) {
871
+ advisoryWarn(`[worktree] mergeLaneBranch: targeted unstage failed for ${branchName} (${resetResult.stderr.trim() || resetResult.stdout.trim()}); lane changes remain staged`);
872
+ }
873
+ return { merged: true, strategy };
874
+ }
767
875
  case "rebase":
768
876
  result = await runGit(["rebase", branchName], primaryDir);
769
877
  break;
@@ -911,6 +1019,9 @@ async function reconcileLandedMerge(primaryDir, provenance) {
911
1019
  return { landed: true, method: "ancestry" };
912
1020
  }
913
1021
  if (ancestry.exitCode === 1) {
1022
+ if (provenance.strategy === "merge") {
1023
+ return matchesSourceHeadWorkingTree(primaryDir, provenance.sourceHead);
1024
+ }
914
1025
  return { landed: false };
915
1026
  }
916
1027
  return {
@@ -1024,7 +1135,7 @@ async function attemptMergeBackFromDirty(worktreePath, branchName, primaryDir, s
1024
1135
  if (reconciliation.landed) {
1025
1136
  return {
1026
1137
  merged: true,
1027
- strategy,
1138
+ strategy: reconciliation.method === "worktree-match" ? "squash-unstaged" : strategy,
1028
1139
  autoCommitted: false,
1029
1140
  cleaned: false,
1030
1141
  reconciled: true,
@@ -1140,6 +1251,8 @@ async function attemptMergeBackFromDirty(worktreePath, branchName, primaryDir, s
1140
1251
  cleaned,
1141
1252
  message: `Primary checkout has overlapping dirty paths with incoming lane changes: ${finalOverlapSnapshot.snapshot.overlapPaths.join(", ")}`,
1142
1253
  conflictFiles: finalOverlapSnapshot.snapshot.overlapPaths,
1254
+ code: "SETTLEMENT_OVERLAP_BLOCKED",
1255
+ recoveryHint: `ACTION: commit or stash your local changes to the overlapping paths (or run /swarm recover for the preserved lane), then re-dispatch the lane. Overlapping paths: ${finalOverlapSnapshot.snapshot.overlapPaths.join(", ")}`,
1143
1256
  ...provenance ? { provenance } : {}
1144
1257
  };
1145
1258
  }
@@ -1151,11 +1264,12 @@ async function attemptMergeBackFromDirty(worktreePath, branchName, primaryDir, s
1151
1264
  ...provenance ? { provenance } : {}
1152
1265
  };
1153
1266
  }
1154
- const mergeResult = await mergeLaneBranch(primaryDir, branchName, strategy);
1267
+ const landingStrategy = strategy === "merge" && !options.commitLanding ? "squash-unstaged" : strategy;
1268
+ const mergeResult = await mergeLaneBranch(primaryDir, branchName, landingStrategy);
1155
1269
  if ("merged" in mergeResult && mergeResult.merged) {
1156
1270
  return {
1157
1271
  merged: true,
1158
- strategy,
1272
+ strategy: landingStrategy,
1159
1273
  autoCommitted,
1160
1274
  cleaned,
1161
1275
  ...provenance ? { reconciled: false, provenance } : {}
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  observeStoreHealth
4
- } from "./index-yxegcfy5.js";
4
+ } from "./index-43dmpa9w.js";
5
5
  import {
6
6
  telemetry
7
7
  } from "./index-jmn35na4.js";
8
8
  import {
9
9
  init_schema,
10
10
  stripKnownSwarmPrefix
11
- } from "./index-d21qcjr6.js";
11
+ } from "./index-pserzhck.js";
12
12
  import {
13
13
  init_constants
14
14
  } from "./index-5frh43fj.js";
@@ -7,7 +7,7 @@ import {
7
7
  readCachedTextFile,
8
8
  wasObservedToExist,
9
9
  wasRecentlyWrittenByThisProcess
10
- } from "./index-8p30wyx0.js";
10
+ } from "./index-bsnpv4xd.js";
11
11
  import {
12
12
  SwarmError
13
13
  } from "./index-c1ggtmpm.js";
@@ -11,16 +11,16 @@ import {
11
11
  } from "./index-ae75rja9.js";
12
12
  import {
13
13
  resolveKnowledgeStoreDir
14
- } from "./index-ksjpc8s8.js";
14
+ } from "./index-yzwb6ja4.js";
15
15
  import {
16
16
  atomicWriteFile
17
- } from "./index-01mjyjdt.js";
17
+ } from "./index-kdyvk541.js";
18
18
  import {
19
19
  require_proper_lockfile
20
20
  } from "./index-7g4c7s5r.js";
21
21
  import {
22
22
  readCachedParsedFile
23
- } from "./index-8p30wyx0.js";
23
+ } from "./index-bsnpv4xd.js";
24
24
  import {
25
25
  init_knowledge_types,
26
26
  isActiveStatus
@@ -739,7 +739,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
739
739
  const {
740
740
  readAuthoritativeKnowledgeCounterRollups,
741
741
  effectiveRetrievalOutcomes
742
- } = await import("./knowledge-events-ctn3yfqx.js");
742
+ } = await import("./knowledge-events-nfcgfhq2.js");
743
743
  const rollups = await readAuthoritativeKnowledgeCounterRollups(directory);
744
744
  const flagIds = new Set;
745
745
  for (const e of atFloor) {
@@ -806,11 +806,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
806
806
  });
807
807
  }
808
808
  if (action === "quarantine" && toQuarantine.length > 0) {
809
- const { quarantineEntry } = await import("./knowledge-validator-f5xhqqxr.js");
810
- const { KnowledgeConfigSchema } = await import("./schema-n50qbvmt.js");
809
+ const { quarantineEntry } = await import("./knowledge-validator-e7nten5a.js");
810
+ const { KnowledgeConfigSchema } = await import("./schema-gws3yx52.js");
811
811
  let config;
812
812
  try {
813
- const { loadPluginConfigWithMeta } = await import("./index-2qv69ydg.js");
813
+ const { loadPluginConfigWithMeta } = await import("./index-1r2avghn.js");
814
814
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
815
815
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
816
816
  } catch {
@@ -4,7 +4,7 @@ import {
4
4
  getProjectDb,
5
5
  projectDbExists,
6
6
  withImmediateTransaction
7
- } from "./index-jg2s11sg.js";
7
+ } from "./index-dktpzjy9.js";
8
8
 
9
9
  // src/db/coordination-store.ts
10
10
  import { createHash } from "crypto";
@@ -22,66 +22,66 @@ import {
22
22
  resolveFallbackModel,
23
23
  resolvePrimaryAgentNames,
24
24
  stripSwarmPrefix
25
- } from "./index-fn7ny88p.js";
25
+ } from "./index-njdy6w9x.js";
26
26
  import"./index-hnvmj9wx.js";
27
- import"./index-9h6zhnk0.js";
28
- import"./index-68bp6sak.js";
29
- import"./index-j8z3t7dv.js";
30
- import"./index-1t4v24tw.js";
31
- import"./index-d9g9stnf.js";
32
- import"./index-qzptb0gf.js";
27
+ import"./index-hhws1xkc.js";
28
+ import"./index-ejrqyrsr.js";
29
+ import"./index-wr4m11x4.js";
30
+ import"./index-0y9fqm5d.js";
31
+ import"./index-btxf9k1r.js";
32
+ import"./index-z35ynvj4.js";
33
33
  import"./index-txdagbh7.js";
34
34
  import"./index-z2deqhpp.js";
35
35
  import"./index-fpbcxykc.js";
36
- import"./index-zpksgw8w.js";
37
- import"./index-2negdnww.js";
38
- import"./index-zfzbn9a7.js";
36
+ import"./index-915wxcgs.js";
37
+ import"./index-mq2y8qpg.js";
38
+ import"./index-sftt3gdv.js";
39
39
  import {
40
40
  createExplorerAgent
41
41
  } from "./index-fyfbpz4f.js";
42
- import"./index-rxakec16.js";
42
+ import"./index-7gkdxs00.js";
43
43
  import"./index-0hgmsyfp.js";
44
44
  import"./index-zsrtt42s.js";
45
- import"./index-1c119trs.js";
46
- import"./index-a1187fx5.js";
47
- import"./index-j7zrvqnf.js";
45
+ import"./index-m08ee28a.js";
46
+ import"./index-ndvgkxpf.js";
47
+ import"./index-0dfhahxm.js";
48
48
  import"./index-pt7h91zc.js";
49
49
  import"./index-q7sjgr1y.js";
50
- import"./index-1c1n8aax.js";
51
- import"./index-y1qc2cpp.js";
52
- import"./index-36143n94.js";
53
- import"./index-5qfqwbvg.js";
54
- import"./index-2n16srdc.js";
50
+ import"./index-e8tscab8.js";
51
+ import"./index-nrsnman7.js";
52
+ import"./index-1pnw3jkr.js";
53
+ import"./index-8xkr8p2b.js";
54
+ import"./index-evf5r7bk.js";
55
55
  import"./index-2s7dvzff.js";
56
- import"./index-her1kqcr.js";
57
- import"./index-efbdfkw9.js";
56
+ import"./index-nztmfgvw.js";
57
+ import"./index-m51cmzxt.js";
58
58
  import"./index-rtry5xyf.js";
59
- import"./index-3rkjybes.js";
59
+ import"./index-tztqvzf5.js";
60
60
  import"./index-frcemc0b.js";
61
61
  import"./index-wrt875kh.js";
62
- import"./index-bbhgnn4j.js";
63
- import"./index-5tjd3cne.js";
64
- import"./index-kerhh5q4.js";
65
- import"./index-b395nw9b.js";
66
- import"./index-y6bqbe76.js";
67
- import"./index-jg2s11sg.js";
62
+ import"./index-3n16qq3z.js";
63
+ import"./index-gd40ehzt.js";
64
+ import"./index-mt8pbzda.js";
65
+ import"./index-za1kvsa0.js";
66
+ import"./index-fnx0jzf7.js";
67
+ import"./index-dktpzjy9.js";
68
68
  import"./index-rdm3px0g.js";
69
69
  import"./index-ry16d01s.js";
70
- import"./index-yxegcfy5.js";
71
- import"./index-szezqd2a.js";
70
+ import"./index-43dmpa9w.js";
71
+ import"./index-fb5rj8sk.js";
72
72
  import"./index-vzm6zre7.js";
73
73
  import"./index-ae75rja9.js";
74
- import"./index-ksjpc8s8.js";
75
- import"./index-01mjyjdt.js";
74
+ import"./index-yzwb6ja4.js";
75
+ import"./index-kdyvk541.js";
76
76
  import"./index-7g4c7s5r.js";
77
77
  import"./index-jmn35na4.js";
78
- import"./index-8p30wyx0.js";
78
+ import"./index-bsnpv4xd.js";
79
79
  import"./index-1xnse449.js";
80
80
  import"./index-c1ggtmpm.js";
81
- import"./index-gqkfha6x.js";
81
+ import"./index-579nzg03.js";
82
82
  import"./index-0mhftbpp.js";
83
83
  import"./index-a1w58b47.js";
84
- import"./index-d21qcjr6.js";
84
+ import"./index-pserzhck.js";
85
85
  import"./index-5frh43fj.js";
86
86
  import"./index-bk5tah7q.js";
87
87
  import"./index-gknz3bv1.js";
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  derivePlanId,
4
4
  derivePlanIdentityHash
5
- } from "./index-y6bqbe76.js";
5
+ } from "./index-fnx0jzf7.js";
6
6
  import {
7
7
  getProjectDb,
8
8
  projectDbExists,
9
9
  withImmediateTransaction,
10
10
  withProjectDbReadOnly
11
- } from "./index-jg2s11sg.js";
11
+ } from "./index-dktpzjy9.js";
12
12
  import {
13
13
  assertProjectRoot,
14
14
  withEvidenceLock
15
- } from "./index-01mjyjdt.js";
15
+ } from "./index-kdyvk541.js";
16
16
  import {
17
17
  emit
18
18
  } from "./index-jmn35na4.js";
@@ -22,11 +22,11 @@ import {
22
22
  TaskStatusSchema,
23
23
  init_loader,
24
24
  loadPluginConfig
25
- } from "./index-gqkfha6x.js";
25
+ } from "./index-579nzg03.js";
26
26
  import {
27
27
  init_package,
28
28
  package_default
29
- } from "./index-d21qcjr6.js";
29
+ } from "./index-pserzhck.js";
30
30
  import {
31
31
  criticalWarn,
32
32
  init_logger,
@@ -9,7 +9,7 @@ import {
9
9
  readEvaluationRun,
10
10
  saveEvaluationRun,
11
11
  saveTaskSetSnapshot
12
- } from "./index-qzptb0gf.js";
12
+ } from "./index-z35ynvj4.js";
13
13
  import {
14
14
  canonicalHash,
15
15
  computeCandidateInputContentHash,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-jmn35na4.js";
8
8
  import {
9
9
  atomicWriteFileAnyRoot
10
- } from "./index-8p30wyx0.js";
10
+ } from "./index-bsnpv4xd.js";
11
11
  import {
12
12
  init_logger,
13
13
  warn
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  captureWorkspaceSnapshotAsync,
4
4
  changedFilesSinceSnapshotAsync
5
- } from "./index-a1187fx5.js";
5
+ } from "./index-ndvgkxpf.js";
6
6
  import {
7
7
  removeWorktreeProvisioningOwner
8
- } from "./index-j7zrvqnf.js";
8
+ } from "./index-0dfhahxm.js";
9
9
  import {
10
10
  SOURCE_WORKTREE_GONE_STAGE,
11
11
  ensureTaskGateRequirementsReceiptForSettledTransition,
@@ -14,16 +14,16 @@ import {
14
14
  reconcileLandedMerge,
15
15
  withTaskEvidenceTransaction,
16
16
  writeWorkflowWalFile
17
- } from "./index-1c1n8aax.js";
17
+ } from "./index-e8tscab8.js";
18
18
  import {
19
19
  validateSwarmPath
20
- } from "./index-2n16srdc.js";
20
+ } from "./index-evf5r7bk.js";
21
21
  import {
22
22
  appendCoreEventSync
23
- } from "./index-kerhh5q4.js";
23
+ } from "./index-mt8pbzda.js";
24
24
  import {
25
25
  tryAcquireLock
26
- } from "./index-01mjyjdt.js";
26
+ } from "./index-kdyvk541.js";
27
27
  import {
28
28
  canonicalRootKeyFresh
29
29
  } from "./index-1xnse449.js";
@@ -191,7 +191,12 @@ function settlementTransitionEvent(wal) {
191
191
  transitionId: wal.transitionId
192
192
  };
193
193
  }
194
- async function commitPrepared(directory, wal) {
194
+ function withLandedUnstaged(worktree, landedUnstaged) {
195
+ if (worktree === undefined || landedUnstaged === undefined)
196
+ return worktree;
197
+ return { ...worktree, landedUnstaged };
198
+ }
199
+ async function commitPrepared(directory, wal, options) {
195
200
  return withTaskEvidenceTransaction(directory, wal.taskId, wal.actor, async (transaction) => {
196
201
  let lockedWal = await readWal(walPath(directory, wal.taskId), wal.taskId);
197
202
  if (lockedWal === null)
@@ -211,7 +216,8 @@ async function commitPrepared(directory, wal) {
211
216
  lockedWal = {
212
217
  ...lockedWal,
213
218
  state: "COMMITTED",
214
- cleanupComplete: lockedWal.worktree === undefined
219
+ cleanupComplete: lockedWal.worktree === undefined,
220
+ worktree: withLandedUnstaged(lockedWal.worktree, options?.landedUnstaged)
215
221
  };
216
222
  await writeWal(walPath(directory, wal.taskId), lockedWal);
217
223
  await appendSettlementEvent(directory, "settled", lockedWal, {
@@ -231,7 +237,8 @@ async function commitPrepared(directory, wal) {
231
237
  lockedWal = {
232
238
  ...lockedWal,
233
239
  state: "COMMITTED",
234
- cleanupComplete: lockedWal.worktree === undefined
240
+ cleanupComplete: lockedWal.worktree === undefined,
241
+ worktree: withLandedUnstaged(lockedWal.worktree, options?.landedUnstaged)
235
242
  };
236
243
  await writeWal(walPath(directory, wal.taskId), lockedWal);
237
244
  await appendSettlementEvent(directory, "settled", lockedWal);
@@ -320,7 +327,9 @@ async function settleCoderDispatch(options) {
320
327
  if (wal.accepted !== options.accepted || wal.testEngineerExempt !== options.testEngineerExempt || wal.settlementFailed !== (options.settlementFailed === true)) {
321
328
  throw new Error("CODER_SETTLEMENT_IDEMPOTENCY_CONFLICT");
322
329
  }
323
- return commitPrepared(options.directory, wal);
330
+ return commitPrepared(options.directory, wal, {
331
+ landedUnstaged: options.landedUnstaged
332
+ });
324
333
  }
325
334
  if (wal.state === "ABORTED") {
326
335
  throw new Error("CODER_SETTLEMENT_IDEMPOTENCY_CONFLICT");
@@ -339,7 +348,9 @@ async function settleCoderDispatch(options) {
339
348
  await writeWal(filePath, prepared);
340
349
  liveDispatches.delete(dispatchKey(options.directory, options.taskId, options.transitionId));
341
350
  try {
342
- return await commitPrepared(options.directory, prepared);
351
+ return await commitPrepared(options.directory, prepared, {
352
+ landedUnstaged: options.landedUnstaged
353
+ });
343
354
  } finally {
344
355
  const finalWal = await readWal(filePath, options.taskId);
345
356
  if (finalWal !== null && finalWal.state === "COMMITTED") {
@@ -482,14 +493,15 @@ function probeBranchExists(directory, branchName) {
482
493
  return false;
483
494
  throw new Error(`CODER_SETTLEMENT_CLEANUP_UNCERTAIN: git show-ref exited with status ${String(result.status)}`);
484
495
  }
485
- async function cleanupRecoveredWorktree(directory, descriptor) {
496
+ async function cleanupRecoveredWorktree(directory, descriptor, options) {
497
+ const retainBranch = options?.retainBranch ?? descriptor.landedUnstaged === true;
486
498
  const branchExists = () => _internals.branchExists(directory, descriptor.branchName);
487
499
  const hasResidue = existsSync(descriptor.worktreePath) || branchExists();
488
500
  const {
489
501
  awaitingMergeByCallID,
490
502
  cleanupStandardWorktreeForCallId,
491
503
  standardWorktreeByCallID
492
- } = await import("./worktree-isolation-8yh97cgh.js");
504
+ } = await import("./worktree-isolation-tv749n96.js");
493
505
  standardWorktreeByCallID.delete(descriptor.callID);
494
506
  if (hasResidue)
495
507
  awaitingMergeByCallID.set(descriptor.callID, {
@@ -503,9 +515,9 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
503
515
  queuedAt: Date.now()
504
516
  });
505
517
  if (hasResidue) {
506
- await cleanupStandardWorktreeForCallId(descriptor.callID, "success", directory, descriptor.worktreeDir ?? undefined);
518
+ await cleanupStandardWorktreeForCallId(descriptor.callID, "success", directory, descriptor.worktreeDir ?? undefined, retainBranch ? { retainBranch: true } : undefined);
507
519
  }
508
- if (existsSync(descriptor.worktreePath) || branchExists()) {
520
+ if (existsSync(descriptor.worktreePath) || branchExists() && !retainBranch) {
509
521
  throw new Error("CODER_SETTLEMENT_WORKTREE_CLEANUP_UNVERIFIED");
510
522
  }
511
523
  const provisioningOwner = descriptor.provisioningOwner ?? (descriptor.reservationId !== undefined && descriptor.generation !== undefined ? {
@@ -588,6 +600,7 @@ async function recoverCoderSettlement(directory, taskId) {
588
600
  if (wal.mergeProvenance) {
589
601
  const landed = await reconcileLandedMerge(directory, wal.mergeProvenance);
590
602
  if (landed.landed) {
603
+ const landedUnstaged = landed.method === "worktree-match";
591
604
  wal = {
592
605
  ...wal,
593
606
  state: "PREPARED",
@@ -596,11 +609,18 @@ async function recoverCoderSettlement(directory, taskId) {
596
609
  testEngineerExempt: isMarkdownOnlyTaskChange(wal.context.declaredFiles, observed2)
597
610
  };
598
611
  await writeWal(filePath, wal);
599
- const committed2 = await commitPrepared(directory, wal);
600
- await cleanupRecoveredWorktree(directory, worktree);
612
+ const committed2 = await commitPrepared(directory, wal, {
613
+ landedUnstaged
614
+ });
615
+ await cleanupRecoveredWorktree(directory, worktree, {
616
+ retainBranch: landedUnstaged
617
+ });
618
+ const reconciledWal = await readWal(filePath, taskId);
619
+ if (reconciledWal === null) {
620
+ throw new Error("CODER_SETTLEMENT_WAL_MISSING");
621
+ }
601
622
  await writeWal(filePath, {
602
- ...wal,
603
- state: "COMMITTED",
623
+ ...reconciledWal,
604
624
  cleanupComplete: true
605
625
  });
606
626
  return committed2;
@@ -613,7 +633,7 @@ async function recoverCoderSettlement(directory, taskId) {
613
633
  awaitingMergeByCallID,
614
634
  finishStandardWorktreeDispatch,
615
635
  standardWorktreeByCallID
616
- } = await import("./worktree-isolation-8yh97cgh.js");
636
+ } = await import("./worktree-isolation-tv749n96.js");
617
637
  const descriptor = wal.worktree;
618
638
  const reconstructedDispatch = {
619
639
  callID: descriptor.callID,
@@ -654,7 +674,7 @@ async function recoverCoderSettlement(directory, taskId) {
654
674
  };
655
675
  await writeWal(filePath, wal);
656
676
  },
657
- onMerged: async () => {
677
+ onMerged: async (mergedResult) => {
658
678
  wal = {
659
679
  ...wal,
660
680
  state: "PREPARED",
@@ -662,7 +682,9 @@ async function recoverCoderSettlement(directory, taskId) {
662
682
  testEngineerExempt: isMarkdownOnlyTaskChange(wal.context.declaredFiles, observed2)
663
683
  };
664
684
  await writeWal(filePath, wal);
665
- recovered = await commitPrepared(directory, wal);
685
+ recovered = await commitPrepared(directory, wal, {
686
+ landedUnstaged: mergedResult.strategy === "squash-unstaged"
687
+ });
666
688
  }
667
689
  });
668
690
  if (mergeResult.outcome !== "merged" || recovered === null) {
@@ -671,7 +693,9 @@ async function recoverCoderSettlement(directory, taskId) {
671
693
  }
672
694
  throw new Error(`CODER_SETTLEMENT_MERGE_RECOVERY_REQUIRED: transition ${wal.transitionId} for task ${taskId} worktree merge-back did not reach merged (${filePath}, state ${wal.state}, outcome ${mergeResult.outcome}${mergeResult.outcome === "failed" && mergeResult.message ? `: ${mergeResult.message}` : ""}). Run /swarm recover ${taskId} (or /swarm reset-session), then retry; do not remove the WAL by hand.`);
673
695
  }
674
- await cleanupRecoveredWorktree(directory, descriptor);
696
+ await cleanupRecoveredWorktree(directory, descriptor, {
697
+ retainBranch: mergeResult.strategy === "squash-unstaged"
698
+ });
675
699
  const committedWal = await readWal(filePath, taskId);
676
700
  if (committedWal === null) {
677
701
  throw new Error("CODER_SETTLEMENT_WAL_MISSING");
@@ -11,7 +11,7 @@ import {
11
11
  readLinkPointer,
12
12
  resolveKnowledgeStoreDir,
13
13
  resolveLinkDir
14
- } from "./index-ksjpc8s8.js";
14
+ } from "./index-yzwb6ja4.js";
15
15
 
16
16
  // src/knowledge/curation-policy.ts
17
17
  import { readFile as readFile2 } from "fs/promises";
@@ -3,7 +3,7 @@ import {
3
3
  queryHistoricalOutcomes,
4
4
  readKnowledgeEvents,
5
5
  recordKnowledgeEvent
6
- } from "./index-5qfqwbvg.js";
6
+ } from "./index-8xkr8p2b.js";
7
7
  import {
8
8
  jaccardBigram,
9
9
  readKnowledge,
@@ -11,7 +11,7 @@ import {
11
11
  resolveSwarmKnowledgePath,
12
12
  transactKnowledge,
13
13
  wordBigrams
14
- } from "./index-szezqd2a.js";
14
+ } from "./index-fb5rj8sk.js";
15
15
  import {
16
16
  init_knowledge_types,
17
17
  isActiveStatus
@@ -224,11 +224,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
224
224
  alreadyInactive: true
225
225
  };
226
226
  }
227
- const { quarantineEntry } = await import("./knowledge-validator-f5xhqqxr.js");
227
+ const { quarantineEntry } = await import("./knowledge-validator-e7nten5a.js");
228
228
  let policyConfig;
229
229
  try {
230
- const { KnowledgeConfigSchema } = await import("./schema-n50qbvmt.js");
231
- const { loadPluginConfigWithMeta } = await import("./index-2qv69ydg.js");
230
+ const { KnowledgeConfigSchema } = await import("./schema-gws3yx52.js");
231
+ const { loadPluginConfigWithMeta } = await import("./index-1r2avghn.js");
232
232
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
233
233
  policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
234
234
  } catch {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  observeStoreHealth
4
- } from "./index-yxegcfy5.js";
4
+ } from "./index-43dmpa9w.js";
5
5
  import {
6
6
  telemetry
7
7
  } from "./index-jmn35na4.js";