opencode-swarm 7.116.0 → 7.116.1

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 (40) hide show
  1. package/.opencode/skills/commit-pr/SKILL.md +60 -579
  2. package/dist/cli/{curator-drift-c0by7063.js → curator-drift-7p2ky1th.js} +2 -2
  3. package/dist/cli/{curator-llm-factory-x96dr0zf.js → curator-llm-factory-9qn52fnv.js} +13 -13
  4. package/dist/cli/{curator-7s5yw6hw.js → curator-yxmtp8py.js} +13 -13
  5. package/dist/cli/{evidence-summary-service-ef6kgtev.js → evidence-summary-service-bwt6drb3.js} +5 -5
  6. package/dist/cli/{gate-evidence-thqt0beq.js → gate-evidence-j2m4cd85.js} +3 -2
  7. package/dist/cli/{guardrail-explain-kwqfkwch.js → guardrail-explain-xvyz2eag.js} +14 -14
  8. package/dist/cli/{hive-promoter-rkkx40qv.js → hive-promoter-ykqc60w1.js} +13 -13
  9. package/dist/cli/{index-bbsaxnj5.js → index-0pfqcjp6.js} +4 -0
  10. package/dist/cli/{index-qgeeyy75.js → index-34g1mv3c.js} +1 -1
  11. package/dist/cli/{index-a6f8b0vn.js → index-5bcrp3bc.js} +1 -1
  12. package/dist/cli/{index-k5ey429j.js → index-5h7d37nf.js} +7 -7
  13. package/dist/cli/{index-me46ffm2.js → index-7kcpkm4y.js} +433 -275
  14. package/dist/cli/{index-81vzywh3.js → index-abjjn4yh.js} +1 -1
  15. package/dist/cli/{index-tvgvb5pa.js → index-efdyjgeh.js} +2 -2
  16. package/dist/cli/{index-jtqkh8jf.js → index-fsrp8wp3.js} +10 -1
  17. package/dist/cli/{index-3yh67t1h.js → index-g4p13g8t.js} +3 -3
  18. package/dist/cli/{index-wh8949ef.js → index-kzj3fp7c.js} +3 -3
  19. package/dist/cli/{index-3b8n3dbd.js → index-p9jf8gt8.js} +14 -14
  20. package/dist/cli/{index-jyetmzcn.js → index-t5f01hnz.js} +3 -3
  21. package/dist/cli/{index-8bvh0qfa.js → index-wegc6xwr.js} +3 -3
  22. package/dist/cli/{index-s385axt1.js → index-wxkf3089.js} +3 -3
  23. package/dist/cli/{index-cnrhj56z.js → index-xdsd2hma.js} +6 -6
  24. package/dist/cli/index.js +13 -13
  25. package/dist/cli/{knowledge-escalator-0bq62d34.js → knowledge-escalator-tthw6c9q.js} +6 -6
  26. package/dist/cli/{knowledge-events-cwwky393.js → knowledge-events-hrbmwxxj.js} +4 -3
  27. package/dist/cli/{knowledge-store-q8x4h82m.js → knowledge-store-5cns5sns.js} +4 -4
  28. package/dist/cli/{knowledge-validator-zr0djm02.js → knowledge-validator-xre0s774.js} +5 -5
  29. package/dist/cli/{pending-delegations-rr9x47rd.js → pending-delegations-9cn17983.js} +2 -2
  30. package/dist/cli/{pr-subscriptions-cny2jz2d.js → pr-subscriptions-8a6jwek2.js} +3 -3
  31. package/dist/cli/{skill-generator-mz267btk.js → skill-generator-22nk6c6a.js} +7 -7
  32. package/dist/commands/close.d.ts +12 -0
  33. package/dist/commands/registry.d.ts +6 -6
  34. package/dist/commands/reset-backup.d.ts +32 -0
  35. package/dist/commands/reset-session.d.ts +2 -0
  36. package/dist/commands/reset.d.ts +9 -0
  37. package/dist/evidence/task-file.d.ts +7 -0
  38. package/dist/index.js +187 -184
  39. package/dist/utils/swarm-artifact-cache.d.ts +13 -0
  40. package/package.json +1 -1
@@ -3,7 +3,7 @@ import {
3
3
  atomicWriteFile,
4
4
  taskEvidencePath,
5
5
  withTaskEvidenceLock
6
- } from "./index-bbsaxnj5.js";
6
+ } from "./index-0pfqcjp6.js";
7
7
  import {
8
8
  exports_external
9
9
  } from "./index-293f68mj.js";
@@ -12,7 +12,7 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-me46ffm2.js";
15
+ } from "./index-7kcpkm4y.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
@@ -279,7 +279,7 @@ function evaluateDestructiveDecision(rawCommand, cwd, declaredScope) {
279
279
  firingRule: "destructive_block: dd with /dev/zero|null|urandom (data wipe)"
280
280
  };
281
281
  }
282
- if (/^git\s+push\b.*?(--force|-f)\b/.test(seg)) {
282
+ if (/^git\s+push\b.*?(--force(?!-with-lease)|-f)\b/.test(seg)) {
283
283
  return {
284
284
  decision: "block",
285
285
  firingRule: "destructive_block: git push --force"
@@ -115,5 +115,14 @@ async function readCachedParsedFile(filePath, namespace, readText, parse) {
115
115
  }
116
116
  return cloneCachedValue(value);
117
117
  }
118
+ function invalidateCachedArtifact(filePath) {
119
+ const resolvedPath = path.resolve(filePath);
120
+ textCache.delete(resolvedPath);
121
+ const prefix = `${resolvedPath}\x00`;
122
+ for (const key of parsedCache.keys()) {
123
+ if (key.startsWith(prefix))
124
+ parsedCache.delete(key);
125
+ }
126
+ }
118
127
 
119
- export { readCachedTextFile, readCachedParsedFile };
128
+ export { readCachedTextFile, readCachedParsedFile, invalidateCachedArtifact };
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveKnowledgeStoreDir
4
- } from "./index-qgeeyy75.js";
4
+ } from "./index-34g1mv3c.js";
5
5
  import {
6
6
  init_logger,
7
7
  warn
8
8
  } from "./index-zgwm4ryv.js";
9
9
  import {
10
10
  atomicWriteFile
11
- } from "./index-bbsaxnj5.js";
11
+ } from "./index-0pfqcjp6.js";
12
12
  import {
13
13
  require_proper_lockfile
14
14
  } from "./index-vvk2g744.js";
@@ -594,7 +594,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
594
594
  deltas.push({ id, delta });
595
595
  }
596
596
  if (deltas.length > 0) {
597
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-q8x4h82m.js");
597
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-5cns5sns.js");
598
598
  await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
599
599
  }
600
600
  return {
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- import {
3
- readCachedTextFile
4
- } from "./index-jtqkh8jf.js";
5
2
  import {
6
3
  SwarmError
7
4
  } from "./index-5e4e2hvv.js";
8
5
  import {
9
6
  warn
10
7
  } from "./index-zgwm4ryv.js";
8
+ import {
9
+ readCachedTextFile
10
+ } from "./index-fsrp8wp3.js";
11
11
  import {
12
12
  bunFile
13
13
  } from "./index-qe3v54nb.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-tvgvb5pa.js";
4
+ } from "./index-efdyjgeh.js";
5
5
  import {
6
6
  handleGuardrailLog
7
7
  } from "./index-m43zgtjn.js";
@@ -83,7 +83,7 @@ import {
83
83
  handleWriteRetroCommand,
84
84
  normalizeSwarmCommandInput,
85
85
  resolveCommand
86
- } from "./index-me46ffm2.js";
86
+ } from "./index-7kcpkm4y.js";
87
87
  import"./index-nprawcc0.js";
88
88
  import"./index-8j5d3ytd.js";
89
89
  import"./index-c8s9a3zh.js";
@@ -93,32 +93,32 @@ import {
93
93
  ORCHESTRATOR_NAME,
94
94
  stripKnownSwarmPrefix
95
95
  } from "./index-nvc0nsvg.js";
96
- import"./index-cnrhj56z.js";
96
+ import"./index-xdsd2hma.js";
97
97
  import"./index-scww5b77.js";
98
98
  import"./index-4905hd2m.js";
99
- import"./index-a6f8b0vn.js";
100
- import"./index-s385axt1.js";
101
- import"./index-jyetmzcn.js";
102
- import"./index-8bvh0qfa.js";
103
- import"./index-3yh67t1h.js";
104
- import"./index-k5ey429j.js";
99
+ import"./index-5bcrp3bc.js";
100
+ import"./index-wxkf3089.js";
101
+ import"./index-t5f01hnz.js";
102
+ import"./index-wegc6xwr.js";
103
+ import"./index-g4p13g8t.js";
104
+ import"./index-5h7d37nf.js";
105
105
  import"./index-bfwt3abw.js";
106
- import"./index-qgeeyy75.js";
106
+ import"./index-34g1mv3c.js";
107
107
  import"./index-vxv732ex.js";
108
108
  import"./index-8fwhhayc.js";
109
109
  import"./index-q1exe2b3.js";
110
110
  import"./index-n6fa2hhk.js";
111
111
  import"./index-rdwfqhp7.js";
112
- import"./index-wh8949ef.js";
113
- import"./index-jtqkh8jf.js";
112
+ import"./index-kzj3fp7c.js";
114
113
  import"./index-5e4e2hvv.js";
115
114
  import"./index-p0arc26j.js";
116
115
  import"./index-zgwm4ryv.js";
117
116
  import"./index-dqh3zhhc.js";
118
- import"./index-81vzywh3.js";
119
- import"./index-bbsaxnj5.js";
117
+ import"./index-abjjn4yh.js";
118
+ import"./index-0pfqcjp6.js";
120
119
  import"./index-293f68mj.js";
121
120
  import"./index-42cx6g2h.js";
121
+ import"./index-fsrp8wp3.js";
122
122
  import"./index-q2rrv0cy.js";
123
123
  import"./index-vvk2g744.js";
124
124
  import"./index-qe3v54nb.js";
@@ -6,17 +6,17 @@ import {
6
6
  resolveSwarmKnowledgePath,
7
7
  resolveSwarmRejectedPath,
8
8
  transactKnowledge
9
- } from "./index-k5ey429j.js";
9
+ } from "./index-5h7d37nf.js";
10
10
  import {
11
11
  resolveKnowledgeStoreDir
12
- } from "./index-qgeeyy75.js";
12
+ } from "./index-34g1mv3c.js";
13
13
  import {
14
14
  init_logger,
15
15
  warn
16
16
  } from "./index-zgwm4ryv.js";
17
17
  import {
18
18
  atomicWriteFile
19
- } from "./index-bbsaxnj5.js";
19
+ } from "./index-0pfqcjp6.js";
20
20
  import {
21
21
  require_proper_lockfile
22
22
  } from "./index-vvk2g744.js";
@@ -4,7 +4,7 @@ import {
4
4
  countEntryViolationsInWindow,
5
5
  readKnowledgeEvents,
6
6
  recordKnowledgeEvent
7
- } from "./index-3yh67t1h.js";
7
+ } from "./index-g4p13g8t.js";
8
8
  import {
9
9
  jaccardBigram,
10
10
  readKnowledge,
@@ -12,7 +12,7 @@ import {
12
12
  resolveSwarmKnowledgePath,
13
13
  transactKnowledge,
14
14
  wordBigrams
15
- } from "./index-k5ey429j.js";
15
+ } from "./index-5h7d37nf.js";
16
16
  import {
17
17
  isActiveStatus
18
18
  } from "./index-bfwt3abw.js";
@@ -188,7 +188,7 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
188
188
  alreadyInactive: true
189
189
  };
190
190
  }
191
- const { quarantineEntry } = await import("./knowledge-validator-zr0djm02.js");
191
+ const { quarantineEntry } = await import("./knowledge-validator-xre0s774.js");
192
192
  await quarantineEntry(directory, entryId, `repeat_contradiction: ${count} contradicted events in ${windowDays}d`, "auto");
193
193
  return { quarantined: true, entryId, contradictionsInWindow: count };
194
194
  } catch {
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  ALLOWED_SKILL_PATH_PREFIXES,
4
4
  validateSkillPath
5
- } from "./index-jyetmzcn.js";
5
+ } from "./index-t5f01hnz.js";
6
6
  import {
7
7
  effectiveRetrievalOutcomes,
8
8
  readKnowledgeCounterRollups
9
- } from "./index-3yh67t1h.js";
9
+ } from "./index-g4p13g8t.js";
10
10
  import {
11
11
  computeOutcomeSignal,
12
12
  readKnowledge,
13
13
  resolveHiveKnowledgePath,
14
14
  resolveSwarmKnowledgePath,
15
15
  transactKnowledge
16
- } from "./index-k5ey429j.js";
16
+ } from "./index-5h7d37nf.js";
17
17
  import {
18
18
  isActiveStatus
19
19
  } from "./index-bfwt3abw.js";
@@ -12,10 +12,7 @@ import {
12
12
  import {
13
13
  readSwarmFileAsync,
14
14
  validateSwarmPath
15
- } from "./index-wh8949ef.js";
16
- import {
17
- readCachedParsedFile
18
- } from "./index-jtqkh8jf.js";
15
+ } from "./index-kzj3fp7c.js";
19
16
  import {
20
17
  criticalWarn,
21
18
  error,
@@ -27,10 +24,10 @@ import {
27
24
  readTaskEvidence,
28
25
  readTaskEvidenceRaw,
29
26
  sanitizeTaskId
30
- } from "./index-81vzywh3.js";
27
+ } from "./index-abjjn4yh.js";
31
28
  import {
32
29
  atomicWriteFile
33
- } from "./index-bbsaxnj5.js";
30
+ } from "./index-0pfqcjp6.js";
34
31
  import {
35
32
  ZodError,
36
33
  exports_external
@@ -38,6 +35,9 @@ import {
38
35
  import {
39
36
  withEvidenceLock
40
37
  } from "./index-42cx6g2h.js";
38
+ import {
39
+ readCachedParsedFile
40
+ } from "./index-fsrp8wp3.js";
41
41
  import {
42
42
  emit
43
43
  } from "./index-q2rrv0cy.js";
package/dist/cli/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-me46ffm2.js";
10
+ } from "./index-7kcpkm4y.js";
11
11
  import"./index-nprawcc0.js";
12
12
  import"./index-8j5d3ytd.js";
13
13
  import"./index-c8s9a3zh.js";
@@ -15,32 +15,32 @@ import"./index-m7hc7nn7.js";
15
15
  import {
16
16
  DEFAULT_AGENT_CONFIGS
17
17
  } from "./index-nvc0nsvg.js";
18
- import"./index-cnrhj56z.js";
18
+ import"./index-xdsd2hma.js";
19
19
  import"./index-scww5b77.js";
20
20
  import"./index-4905hd2m.js";
21
- import"./index-a6f8b0vn.js";
22
- import"./index-s385axt1.js";
23
- import"./index-jyetmzcn.js";
24
- import"./index-8bvh0qfa.js";
25
- import"./index-3yh67t1h.js";
26
- import"./index-k5ey429j.js";
21
+ import"./index-5bcrp3bc.js";
22
+ import"./index-wxkf3089.js";
23
+ import"./index-t5f01hnz.js";
24
+ import"./index-wegc6xwr.js";
25
+ import"./index-g4p13g8t.js";
26
+ import"./index-5h7d37nf.js";
27
27
  import"./index-bfwt3abw.js";
28
- import"./index-qgeeyy75.js";
28
+ import"./index-34g1mv3c.js";
29
29
  import"./index-vxv732ex.js";
30
30
  import"./index-8fwhhayc.js";
31
31
  import"./index-q1exe2b3.js";
32
32
  import"./index-n6fa2hhk.js";
33
33
  import"./index-rdwfqhp7.js";
34
- import"./index-wh8949ef.js";
35
- import"./index-jtqkh8jf.js";
34
+ import"./index-kzj3fp7c.js";
36
35
  import"./index-5e4e2hvv.js";
37
36
  import"./index-p0arc26j.js";
38
37
  import"./index-zgwm4ryv.js";
39
38
  import"./index-dqh3zhhc.js";
40
- import"./index-81vzywh3.js";
41
- import"./index-bbsaxnj5.js";
39
+ import"./index-abjjn4yh.js";
40
+ import"./index-0pfqcjp6.js";
42
41
  import"./index-293f68mj.js";
43
42
  import"./index-42cx6g2h.js";
43
+ import"./index-fsrp8wp3.js";
44
44
  import"./index-q2rrv0cy.js";
45
45
  import"./index-vvk2g744.js";
46
46
  import"./index-qe3v54nb.js";
@@ -8,15 +8,15 @@ import {
8
8
  maybeEscalateOnViolation,
9
9
  maybeQuarantineOnContradiction,
10
10
  readRecentEscalations
11
- } from "./index-8bvh0qfa.js";
12
- import"./index-3yh67t1h.js";
13
- import"./index-k5ey429j.js";
11
+ } from "./index-wegc6xwr.js";
12
+ import"./index-g4p13g8t.js";
13
+ import"./index-5h7d37nf.js";
14
14
  import"./index-bfwt3abw.js";
15
- import"./index-qgeeyy75.js";
16
- import"./index-jtqkh8jf.js";
15
+ import"./index-34g1mv3c.js";
17
16
  import"./index-zgwm4ryv.js";
18
- import"./index-bbsaxnj5.js";
17
+ import"./index-0pfqcjp6.js";
19
18
  import"./index-42cx6g2h.js";
19
+ import"./index-fsrp8wp3.js";
20
20
  import"./index-q2rrv0cy.js";
21
21
  import"./index-vvk2g744.js";
22
22
  import"./index-qe3v54nb.js";
@@ -25,11 +25,12 @@ import {
25
25
  resolveKnowledgeCounterBaselinePath,
26
26
  resolveKnowledgeEventsPath,
27
27
  resolveLegacyApplicationLogPath
28
- } from "./index-3yh67t1h.js";
29
- import"./index-qgeeyy75.js";
28
+ } from "./index-g4p13g8t.js";
29
+ import"./index-34g1mv3c.js";
30
30
  import"./index-zgwm4ryv.js";
31
- import"./index-bbsaxnj5.js";
31
+ import"./index-0pfqcjp6.js";
32
32
  import"./index-42cx6g2h.js";
33
+ import"./index-fsrp8wp3.js";
33
34
  import"./index-q2rrv0cy.js";
34
35
  import"./index-vvk2g744.js";
35
36
  import"./index-qe3v54nb.js";
@@ -34,13 +34,13 @@ import {
34
34
  transactFile,
35
35
  transactKnowledge,
36
36
  wordBigrams
37
- } from "./index-k5ey429j.js";
37
+ } from "./index-5h7d37nf.js";
38
38
  import"./index-bfwt3abw.js";
39
- import"./index-qgeeyy75.js";
40
- import"./index-jtqkh8jf.js";
39
+ import"./index-34g1mv3c.js";
41
40
  import"./index-zgwm4ryv.js";
42
- import"./index-bbsaxnj5.js";
41
+ import"./index-0pfqcjp6.js";
43
42
  import"./index-42cx6g2h.js";
43
+ import"./index-fsrp8wp3.js";
44
44
  import"./index-q2rrv0cy.js";
45
45
  import"./index-vvk2g744.js";
46
46
  import"./index-qe3v54nb.js";
@@ -23,14 +23,14 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-jyetmzcn.js";
27
- import"./index-k5ey429j.js";
26
+ } from "./index-t5f01hnz.js";
27
+ import"./index-5h7d37nf.js";
28
28
  import"./index-bfwt3abw.js";
29
- import"./index-qgeeyy75.js";
30
- import"./index-jtqkh8jf.js";
29
+ import"./index-34g1mv3c.js";
31
30
  import"./index-zgwm4ryv.js";
32
- import"./index-bbsaxnj5.js";
31
+ import"./index-0pfqcjp6.js";
33
32
  import"./index-42cx6g2h.js";
33
+ import"./index-fsrp8wp3.js";
34
34
  import"./index-q2rrv0cy.js";
35
35
  import"./index-vvk2g744.js";
36
36
  import"./index-qe3v54nb.js";
@@ -1,8 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-wh8949ef.js";
5
- import"./index-jtqkh8jf.js";
4
+ } from "./index-kzj3fp7c.js";
6
5
  import"./index-5e4e2hvv.js";
7
6
  import"./index-p0arc26j.js";
8
7
  import {
@@ -15,6 +14,7 @@ import {
15
14
  import {
16
15
  withEvidenceLock
17
16
  } from "./index-42cx6g2h.js";
17
+ import"./index-fsrp8wp3.js";
18
18
  import"./index-q2rrv0cy.js";
19
19
  import"./index-vvk2g744.js";
20
20
  import"./index-qe3v54nb.js";
@@ -9,14 +9,14 @@ import {
9
9
  sweepStale,
10
10
  unsubscribe,
11
11
  updateSnapshot
12
- } from "./index-a6f8b0vn.js";
13
- import"./index-wh8949ef.js";
14
- import"./index-jtqkh8jf.js";
12
+ } from "./index-5bcrp3bc.js";
13
+ import"./index-kzj3fp7c.js";
15
14
  import"./index-5e4e2hvv.js";
16
15
  import"./index-p0arc26j.js";
17
16
  import"./index-zgwm4ryv.js";
18
17
  import"./index-293f68mj.js";
19
18
  import"./index-42cx6g2h.js";
19
+ import"./index-fsrp8wp3.js";
20
20
  import"./index-q2rrv0cy.js";
21
21
  import"./index-vvk2g744.js";
22
22
  import"./index-qe3v54nb.js";
@@ -33,16 +33,16 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-s385axt1.js";
37
- import"./index-jyetmzcn.js";
38
- import"./index-3yh67t1h.js";
39
- import"./index-k5ey429j.js";
36
+ } from "./index-wxkf3089.js";
37
+ import"./index-t5f01hnz.js";
38
+ import"./index-g4p13g8t.js";
39
+ import"./index-5h7d37nf.js";
40
40
  import"./index-bfwt3abw.js";
41
- import"./index-qgeeyy75.js";
42
- import"./index-jtqkh8jf.js";
41
+ import"./index-34g1mv3c.js";
43
42
  import"./index-zgwm4ryv.js";
44
- import"./index-bbsaxnj5.js";
43
+ import"./index-0pfqcjp6.js";
45
44
  import"./index-42cx6g2h.js";
45
+ import"./index-fsrp8wp3.js";
46
46
  import"./index-q2rrv0cy.js";
47
47
  import"./index-vvk2g744.js";
48
48
  import"./index-qe3v54nb.js";
@@ -156,6 +156,17 @@ export declare function runCleanStage(ctx: CloseStageContext): Promise<CleanStag
156
156
  * the close summary. All warnings are pushed into ctx.warnings.
157
157
  */
158
158
  export declare function runAlignStage(ctx: CloseStageContext): Promise<GitAlignResult>;
159
+ /**
160
+ * Builds the `/swarm finalize --dry-run` report. Purely READ-ONLY: inspects the
161
+ * plan and the filesystem and describes what a real finalize WOULD do, without
162
+ * acquiring the finalize lock, creating an archive bundle, deleting any file,
163
+ * running git, or tearing down session state. (#1692)
164
+ *
165
+ * The archive-first guard means the clean stage only removes files it first
166
+ * archived successfully; this report approximates that by listing existing
167
+ * clean-set members as "would remove" and notes the approximation.
168
+ */
169
+ export declare function runFinalizeDryRun(directory: string, swarmDir: string, planData: PlanData, planExists: boolean): Promise<string>;
159
170
  /**
160
171
  * Handles /swarm close command - performs full terminal session finalization:
161
172
  * 0. Guarantee: mark all incomplete phases/tasks as closed
@@ -198,6 +209,7 @@ export declare const _internals: {
198
209
  runArchiveEvidenceRetention: typeof runArchiveEvidenceRetention;
199
210
  runCleanStage: typeof runCleanStage;
200
211
  runAlignStage: typeof runAlignStage;
212
+ runFinalizeDryRun: typeof runFinalizeDryRun;
201
213
  archiveEvidence: typeof archiveEvidence;
202
214
  closePlanTerminalState: typeof closePlanTerminalState;
203
215
  endAgentSession: typeof endAgentSession;
@@ -381,16 +381,16 @@ export declare const COMMAND_REGISTRY: {
381
381
  readonly finalize: {
382
382
  readonly handler: (ctx: CommandContext) => Promise<string>;
383
383
  readonly description: "Use /swarm finalize to finalize the swarm project and archive evidence";
384
- readonly details: "Idempotent 4-stage terminal finalization: (1) finalize writes retrospectives for in-progress phases, (2) archive creates timestamped bundle of swarm artifacts and evidence, (3) clean removes active-state files for a clean slate, (4) align performs aggressive git reset --hard to the default remote branch, discarding uncommitted changes and gitignored build artifacts (user-created untracked files are preserved); falls back to a cautious reset that preserves uncommitted changes when the aggressive path cannot proceed. WARNING: alignment discards local changes and gitignored files. Resets agent sessions and delegation chains. Reads .swarm/close-lessons.md for explicit lessons and runs curation. Use --skill-review to run the quota-bounded skill_improver in proposal mode.";
385
- readonly args: "--prune-branches, --skill-review";
384
+ readonly details: "Idempotent 4-stage terminal finalization: (1) finalize writes retrospectives for in-progress phases, (2) archive creates timestamped bundle of swarm artifacts and evidence, (3) clean removes active-state files for a clean slate, (4) align performs aggressive git reset --hard to the default remote branch, discarding uncommitted changes and gitignored build artifacts (user-created untracked files are preserved); falls back to a cautious reset that preserves uncommitted changes when the aggressive path cannot proceed. WARNING: alignment discards local changes and gitignored files. Resets agent sessions and delegation chains. Reads .swarm/close-lessons.md for explicit lessons and runs curation. Use --skill-review to run the quota-bounded skill_improver in proposal mode. Use --dry-run to preview what finalize would archive, clean, and align without taking the lock or changing anything.";
385
+ readonly args: "--prune-branches, --skill-review, --dry-run";
386
386
  readonly category: "core";
387
387
  readonly toolPolicy: "none";
388
388
  };
389
389
  readonly close: {
390
390
  readonly handler: (ctx: CommandContext) => Promise<string>;
391
391
  readonly description: "Use /swarm close (deprecated alias) to finalize and archive swarm state";
392
- readonly details: "Deprecated alias for /swarm finalize. Preserved for backward compatibility.";
393
- readonly args: "--prune-branches, --skill-review";
392
+ readonly details: "Deprecated alias for /swarm finalize. Preserved for backward compatibility. Supports the same flags, including --dry-run.";
393
+ readonly args: "--prune-branches, --skill-review, --dry-run";
394
394
  readonly category: "core";
395
395
  readonly aliasOf: "finalize";
396
396
  readonly deprecated: true;
@@ -698,7 +698,7 @@ export declare const COMMAND_REGISTRY: {
698
698
  readonly reset: {
699
699
  readonly handler: (ctx: CommandContext) => Promise<string>;
700
700
  readonly description: "Clear swarm state files [--confirm]";
701
- readonly details: "DELETES plan.md, context.md, and summaries/ directory from .swarm/. Stops background automation and clears in-memory queues. SAFETY: requires --confirm flag — without it, displays a warning and tips to export first.";
701
+ readonly details: "DELETES plan.md, context.md, and summaries/ directory from .swarm/. Stops background automation and clears in-memory queues. SAFETY: requires --confirm flag — without it, displays a warning and tips to export first. Before deleting, auto-backs up the state it removes to .swarm/reset-backups/<timestamp>/ (newest 5 kept) so it can be restored by copying the files back.";
702
702
  readonly args: "--confirm (required)";
703
703
  readonly category: "utility";
704
704
  readonly clashesWithNativeCcCommand: "/reset";
@@ -707,7 +707,7 @@ export declare const COMMAND_REGISTRY: {
707
707
  readonly 'reset-session': {
708
708
  readonly handler: (ctx: CommandContext) => Promise<string>;
709
709
  readonly description: "Clear session state while preserving plan, evidence, and knowledge";
710
- readonly details: "Deletes only .swarm/session/state.json and any other session files. Clears in-memory agent sessions and delegation chains. Preserves plan, evidence, and knowledge for cross-session continuity.";
710
+ readonly details: "Deletes only .swarm/session/state.json and any other session files. Clears in-memory agent sessions and delegation chains. Preserves plan, evidence, and knowledge for cross-session continuity. Before deleting, auto-backs up the session files it removes to .swarm/reset-backups/<timestamp>/ (newest 5 kept).";
711
711
  readonly args: "";
712
712
  readonly category: "utility";
713
713
  readonly toolPolicy: "restricted";
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Result of an auto-backup taken before a destructive /swarm reset or
3
+ * /swarm reset-session. Fail-open by contract: any per-entry failure is
4
+ * recorded as a warning and never thrown.
5
+ */
6
+ export interface ResetBackupResult {
7
+ /** Absolute path of the backup directory, or null if nothing was backed up. */
8
+ backupDir: string | null;
9
+ /** Relative names actually copied into the backup. */
10
+ copied: string[];
11
+ /** Non-fatal warnings (source unreadable, prune failure, etc.). */
12
+ warnings: string[];
13
+ }
14
+ /** How many backup directories to retain under .swarm/reset-backups/. */
15
+ export declare const RESET_BACKUP_RETENTION = 5;
16
+ /**
17
+ * Copy the swarm-state entries a reset is about to delete into a durable,
18
+ * timestamped directory under `.swarm/reset-backups/` BEFORE deletion, so the
19
+ * user can recover by copying the files back. The backup directory is not part
20
+ * of any reset deletion set, so it survives the reset.
21
+ *
22
+ * This deliberately does NOT use the git checkpoint tool: that tool excludes
23
+ * `.swarm/` (`git add ... :!.swarm/`) — i.e. it excludes exactly the state a
24
+ * reset destroys — and would commit unrelated working-tree changes to the
25
+ * user's branch. A direct file copy of the deleted state is the faithful,
26
+ * non-surprising backup. (#1692)
27
+ *
28
+ * @param directory project root (contains `.swarm/`)
29
+ * @param kind backup label prefix ('reset' | 'reset-session')
30
+ * @param relEntries entries relative to `.swarm/` to back up (files or dirs)
31
+ */
32
+ export declare function backupSwarmStateBeforeReset(directory: string, kind: 'reset' | 'reset-session', relEntries: string[]): ResetBackupResult;
@@ -1,4 +1,5 @@
1
1
  import { type OrphanCleanupResult } from '../worktree/merge';
2
+ import { type ResetBackupResult } from './reset-backup';
2
3
  /**
3
4
  * _internals DI seam for testing reset-session without spawning real git processes.
4
5
  * Production code calls `_internals.cleanupOrphanedBranches(...)` so tests can
@@ -7,6 +8,7 @@ import { type OrphanCleanupResult } from '../worktree/merge';
7
8
  */
8
9
  export declare const _internals: {
9
10
  cleanupOrphanedBranches: (directory: string, activeSessionIds: string[]) => Promise<OrphanCleanupResult>;
11
+ backupSwarmStateBeforeReset: (directory: string, kind: 'reset' | 'reset-session', relEntries: string[]) => ResetBackupResult;
10
12
  };
11
13
  /**
12
14
  * Handles the /swarm reset-session command.
@@ -1,3 +1,12 @@
1
+ import { type ResetBackupResult } from './reset-backup';
2
+ /**
3
+ * _internals DI seam so tests can stub the pre-deletion backup without touching
4
+ * the real filesystem-copy helper. Mutations are file-scoped and restorable in
5
+ * afterEach.
6
+ */
7
+ export declare const _internals: {
8
+ backupSwarmStateBeforeReset: (directory: string, kind: 'reset' | 'reset-session', relEntries: string[]) => ResetBackupResult;
9
+ };
1
10
  /**
2
11
  * Handles the /swarm reset command.
3
12
  * Clears all swarm state files from .swarm/ and project root.
@@ -39,6 +39,13 @@ export declare const _internals: {
39
39
  * Atomic write: write to a unique temp file, then rename over the target.
40
40
  * The rename is atomic on POSIX and Windows, so readers never observe a torn
41
41
  * file. The temp file is cleaned up in `finally` (no-op once renamed away).
42
+ *
43
+ * Invalidates any swarm-artifact-cache entry for `targetPath` after a
44
+ * successful rename: the cache's stat-based staleness check can collide on a
45
+ * same-size rewrite that lands within one filesystem timestamp tick (issue
46
+ * #1729), which would otherwise let a read immediately following this write
47
+ * (e.g. a second locked transaction in the same logical operation) observe
48
+ * the pre-write content instead of what was just committed.
42
49
  */
43
50
  export declare function atomicWriteFile(targetPath: string, content: string): Promise<void>;
44
51
  /**