opencode-swarm 7.140.4 → 7.140.5

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 (95) hide show
  1. package/.opencode/skills/plan/SKILL.md +40 -12
  2. package/dist/agents/architect.d.ts +2 -1
  3. package/dist/background/pending-delegations.d.ts +5 -0
  4. package/dist/cli/{config-doctor-qqe6172n.js → config-doctor-5vzpq4qa.js} +3 -3
  5. package/dist/cli/{core-52k057mf.js → core-xjzdc56e.js} +2 -2
  6. package/dist/cli/{curation-policy-9291bdat.js → curation-policy-avvb56x2.js} +6 -6
  7. package/dist/cli/{curator-04xqq68e.js → curator-5nytvg7p.js} +36 -36
  8. package/dist/cli/curator-llm-factory-rds75zhj.js +61 -0
  9. package/dist/cli/{evidence-summary-service-em58myd7.js → evidence-summary-service-zq4gyx6g.js} +14 -11
  10. package/dist/cli/gate-evidence-smn2wqft.js +51 -0
  11. package/dist/cli/guardrail-explain-an7jvam1.js +62 -0
  12. package/dist/cli/{guardrail-log-vb5zkegf.js → guardrail-log-0hnd2k9v.js} +4 -4
  13. package/dist/cli/{hive-promoter-z09khawt.js → hive-promoter-qe8pqg79.js} +36 -36
  14. package/dist/cli/{index-vrmkg8fm.js → index-01ggt2mj.js} +9 -9
  15. package/dist/cli/{index-hfwzxh3j.js → index-0r2m0vbq.js} +12 -10
  16. package/dist/cli/{index-v3xhc7kg.js → index-0rx9t9w8.js} +1 -1
  17. package/dist/cli/{index-hz0refz4.js → index-2bg901qt.js} +70 -29
  18. package/dist/cli/{index-7begd9aq.js → index-386ts4tm.js} +4 -4
  19. package/dist/cli/{index-v3x7j9ey.js → index-8rp1y4ab.js} +2 -2
  20. package/dist/cli/{index-35qep0v7.js → index-912qz4y0.js} +88 -88
  21. package/dist/cli/{index-2rb3x0fk.js → index-affh1gtg.js} +7 -7
  22. package/dist/cli/{index-c5kr20nz.js → index-c432knmy.js} +1 -1
  23. package/dist/cli/{index-v1an91bq.js → index-e0mpz2j3.js} +5 -5
  24. package/dist/cli/{index-bfhwtdsw.js → index-epvhf50h.js} +3 -3
  25. package/dist/cli/{index-s8g7jh1k.js → index-ex7r16gc.js} +2 -2
  26. package/dist/cli/{index-tj04dj06.js → index-jm4cpp4n.js} +2 -2
  27. package/dist/cli/{index-hxvkfx6t.js → index-jqsfsqbx.js} +15 -2
  28. package/dist/cli/{index-hfjvepk2.js → index-kb5q9v34.js} +3 -3
  29. package/dist/cli/{index-bn17ycxn.js → index-m9xrdjn0.js} +1 -1
  30. package/dist/cli/{index-djbhe0yh.js → index-mm2egvdt.js} +38 -38
  31. package/dist/cli/{index-pp5m7xga.js → index-nwrwy8eb.js} +70 -34
  32. package/dist/cli/index-nyjtzmsj.js +43 -0
  33. package/dist/cli/{index-4hp8nvwb.js → index-p8kk34am.js} +3 -3
  34. package/dist/cli/{index-ysa38bnr.js → index-ptn13xjn.js} +3 -3
  35. package/dist/cli/{index-1kyex7z2.js → index-qwm6vdyv.js} +32 -1
  36. package/dist/cli/{index-dtam929z.js → index-qy1nq52t.js} +1 -1
  37. package/dist/cli/{index-rrb6cz2f.js → index-s1v0wza5.js} +6 -2
  38. package/dist/cli/{index-w4etfamq.js → index-t5pytnca.js} +2 -2
  39. package/dist/cli/index-tjqzr3jc.js +623 -0
  40. package/dist/cli/{index-mrpfd1jx.js → index-vh05t3w5.js} +1 -1
  41. package/dist/cli/{index-ryq97w1x.js → index-wkt9fj06.js} +4 -4
  42. package/dist/cli/{index-wk8s1m7b.js → index-wrb0gykj.js} +217 -15
  43. package/dist/cli/{index-arza4m4j.js → index-z7h37d63.js} +2 -2
  44. package/dist/cli/{index-a1fjhx4w.js → index-z90nvqj3.js} +37836 -35986
  45. package/dist/cli/{index-b8zgtz81.js → index-zsrtt42s.js} +34 -1
  46. package/dist/cli/{index-mpytsq6k.js → index-ztgn70jz.js} +2 -2
  47. package/dist/cli/index.js +35 -35
  48. package/dist/cli/{knowledge-escalator-gdjnwszd.js → knowledge-escalator-4pfrc902.js} +12 -12
  49. package/dist/cli/{knowledge-events-581x4q7n.js → knowledge-events-3zkfnksk.js} +10 -10
  50. package/dist/cli/{knowledge-link-axx45d1h.js → knowledge-link-m9p80f4r.js} +5 -5
  51. package/dist/cli/{knowledge-store-ttg33482.js → knowledge-store-dpqgvvjt.js} +6 -6
  52. package/dist/cli/{knowledge-validator-8kywqt8b.js → knowledge-validator-2c7w87dk.js} +8 -8
  53. package/dist/cli/{pending-delegations-btwqsvz4.js → pending-delegations-cxx9tezp.js} +4 -4
  54. package/dist/cli/{pr-subscriptions-83y1cdwv.js → pr-subscriptions-2sfnb599.js} +4 -4
  55. package/dist/cli/{runner-fh3r41nw.js → runner-mky3vvht.js} +6 -6
  56. package/dist/cli/{scan-cursor-j8ytdpam.js → scan-cursor-1z60gwrw.js} +7 -7
  57. package/dist/cli/{schema-6xfqtpvn.js → schema-vpnkwvez.js} +2 -2
  58. package/dist/cli/{scope-persistence-8c72jrgp.js → scope-persistence-p9dmprry.js} +10 -5
  59. package/dist/cli/{skill-generator-n8vm1yhn.js → skill-generator-yx7ka1cj.js} +14 -14
  60. package/dist/cli/{telemetry-fb44gpba.js → telemetry-0x6kszvk.js} +1 -1
  61. package/dist/cli/{worktree-collision-ownership-f28r473k.js → worktree-collision-ownership-wm5pse49.js} +8 -8
  62. package/dist/cli/worktree-isolation-bwc6ra8e.js +102 -0
  63. package/dist/cli/worktree-provisioning-owner-sjh7te1h.js +22 -0
  64. package/dist/commands/acknowledge-spec-drift.d.ts +4 -5
  65. package/dist/config/evidence-schema.d.ts +3 -3
  66. package/dist/config/index.d.ts +2 -2
  67. package/dist/config/plan-schema.d.ts +8 -0
  68. package/dist/config/schema.d.ts +2 -2
  69. package/dist/council/council-evidence-writer.d.ts +1 -1
  70. package/dist/gate-evidence.d.ts +117 -4
  71. package/dist/hooks/delegation-gate.d.ts +21 -0
  72. package/dist/index.js +768 -743
  73. package/dist/plan/ledger.d.ts +55 -0
  74. package/dist/plan/manager.d.ts +9 -0
  75. package/dist/plan/planning-profile.d.ts +27 -0
  76. package/dist/services/spec-drift-recovery.d.ts +84 -0
  77. package/dist/session/snapshot-writer.d.ts +3 -1
  78. package/dist/state.d.ts +19 -17
  79. package/dist/summaries/schema.d.ts +2 -2
  80. package/dist/tools/convene-council.d.ts +6 -6
  81. package/dist/tools/save-plan.d.ts +8 -0
  82. package/dist/tools/submit-phase-council-verdicts.d.ts +6 -6
  83. package/dist/tools/tool-metadata.d.ts +28 -28
  84. package/dist/tools/update-task-status.d.ts +13 -0
  85. package/dist/tools/write-final-council-evidence.d.ts +6 -6
  86. package/dist/types/events.d.ts +29 -1
  87. package/dist/workflow/coder-settlement.d.ts +62 -0
  88. package/dist/workflow/task-repair.d.ts +30 -0
  89. package/dist/workflow/task-terminal.d.ts +52 -0
  90. package/package.json +1 -1
  91. package/dist/cli/curator-llm-factory-cfm8fhdw.js +0 -61
  92. package/dist/cli/gate-evidence-ezxfkb22.js +0 -32
  93. package/dist/cli/guardrail-explain-pn1bcgfz.js +0 -62
  94. package/dist/cli/index-d181x9zr.js +0 -71
  95. package/dist/cli/index-dtyeabmj.js +0 -239
@@ -1,67 +1,67 @@
1
1
  // @bun
2
2
  import {
3
- _internals1 as _internals,
3
+ _internals2 as _internals,
4
4
  checkHivePromotions,
5
5
  countDistinctProjects,
6
6
  createHivePromoterHook,
7
7
  isHiveEligible,
8
8
  promoteFromSwarm,
9
9
  promoteToHive
10
- } from "./index-a1fjhx4w.js";
11
- import"./index-41hkt36g.js";
12
- import"./index-c5kr20nz.js";
13
- import"./index-ysa38bnr.js";
14
- import"./index-arza4m4j.js";
15
- import"./index-hz0refz4.js";
16
- import"./index-w4etfamq.js";
17
- import"./index-y8552snf.js";
10
+ } from "./index-z90nvqj3.js";
18
11
  import"./index-4905hd2m.js";
19
- import"./index-134d35c1.js";
20
- import"./index-hfjvepk2.js";
21
- import"./index-v1an91bq.js";
22
- import"./index-mpytsq6k.js";
23
- import"./index-v2xrer41.js";
12
+ import"./index-41hkt36g.js";
13
+ import"./index-c432knmy.js";
14
+ import"./index-ptn13xjn.js";
24
15
  import"./index-c8s9a3zh.js";
16
+ import"./index-z7h37d63.js";
17
+ import"./index-2bg901qt.js";
18
+ import"./index-134d35c1.js";
19
+ import"./index-t5pytnca.js";
20
+ import"./index-y8552snf.js";
25
21
  import"./index-9ss2m4rs.js";
26
- import"./index-bn17ycxn.js";
27
- import"./index-ryq97w1x.js";
28
- import"./index-556ja8an.js";
29
- import"./index-wk8s1m7b.js";
30
- import"./index-1kyex7z2.js";
31
- import"./index-b8zgtz81.js";
32
- import"./index-v3x7j9ey.js";
33
- import"./index-rrb6cz2f.js";
34
22
  import"./index-74hpm6sh.js";
35
- import"./index-dtyeabmj.js";
23
+ import"./index-kb5q9v34.js";
24
+ import"./index-e0mpz2j3.js";
25
+ import"./index-ztgn70jz.js";
26
+ import"./index-v2xrer41.js";
27
+ import"./index-m9xrdjn0.js";
28
+ import"./index-wkt9fj06.js";
29
+ import"./index-556ja8an.js";
30
+ import"./index-wrb0gykj.js";
31
+ import"./index-zsrtt42s.js";
32
+ import"./index-8rp1y4ab.js";
33
+ import"./index-qwm6vdyv.js";
34
+ import"./index-tjqzr3jc.js";
35
+ import"./index-s1v0wza5.js";
36
36
  import"./index-8fwhhayc.js";
37
37
  import"./index-q1exe2b3.js";
38
- import"./index-2rb3x0fk.js";
38
+ import"./index-affh1gtg.js";
39
39
  import"./index-k46me75h.js";
40
40
  import"./index-ee3x66a5.js";
41
- import"./index-7begd9aq.js";
42
- import"./index-dtam929z.js";
41
+ import"./index-386ts4tm.js";
42
+ import"./index-qy1nq52t.js";
43
43
  import"./index-rtry5xyf.js";
44
44
  import {
45
45
  resolveHiveKnowledgePath
46
- } from "./index-vrmkg8fm.js";
46
+ } from "./index-01ggt2mj.js";
47
47
  import"./index-ae75rja9.js";
48
- import"./index-mrpfd1jx.js";
49
- import"./index-4hp8nvwb.js";
50
- import"./index-ed5ykebp.js";
51
- import"./index-35qep0v7.js";
48
+ import"./index-vh05t3w5.js";
49
+ import"./index-p8kk34am.js";
50
+ import"./index-912qz4y0.js";
52
51
  import"./index-7g4c7s5r.js";
52
+ import"./index-ed5ykebp.js";
53
53
  import"./index-4nt52yr9.js";
54
- import"./index-pp5m7xga.js";
54
+ import"./index-nyjtzmsj.js";
55
55
  import"./index-gprxjmm7.js";
56
56
  import"./index-n832052r.js";
57
- import"./index-d181x9zr.js";
57
+ import"./index-nwrwy8eb.js";
58
58
  import"./index-4rhhvd1a.js";
59
59
  import"./index-zgwm4ryv.js";
60
- import"./index-tj04dj06.js";
61
- import"./index-hxvkfx6t.js";
60
+ import"./index-jm4cpp4n.js";
61
+ import"./index-jqsfsqbx.js";
62
62
  import"./index-zjygnfay.js";
63
63
  import"./index-bk5tah7q.js";
64
- import"./index-bfhwtdsw.js";
64
+ import"./index-epvhf50h.js";
65
65
  import"./index-bpmtbmy9.js";
66
66
  import"./index-a76rekgs.js";
67
67
  export {
@@ -6,16 +6,16 @@ import {
6
6
  } from "./index-ae75rja9.js";
7
7
  import {
8
8
  resolveKnowledgeStoreDir
9
- } from "./index-mrpfd1jx.js";
9
+ } from "./index-vh05t3w5.js";
10
10
  import {
11
11
  atomicWriteFile
12
- } from "./index-4hp8nvwb.js";
13
- import {
14
- readCachedParsedFile
15
- } from "./index-ed5ykebp.js";
12
+ } from "./index-p8kk34am.js";
16
13
  import {
17
14
  require_proper_lockfile
18
15
  } from "./index-7g4c7s5r.js";
16
+ import {
17
+ readCachedParsedFile
18
+ } from "./index-ed5ykebp.js";
19
19
  import {
20
20
  init_logger,
21
21
  log
@@ -709,7 +709,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
709
709
  const {
710
710
  readAuthoritativeKnowledgeCounterRollups,
711
711
  effectiveRetrievalOutcomes
712
- } = await import("./knowledge-events-581x4q7n.js");
712
+ } = await import("./knowledge-events-3zkfnksk.js");
713
713
  const rollups = await readAuthoritativeKnowledgeCounterRollups(directory);
714
714
  const flagIds = new Set;
715
715
  for (const e of atFloor) {
@@ -776,11 +776,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
776
776
  });
777
777
  }
778
778
  if (action === "quarantine" && toQuarantine.length > 0) {
779
- const { quarantineEntry } = await import("./knowledge-validator-8kywqt8b.js");
780
- const { KnowledgeConfigSchema } = await import("./schema-6xfqtpvn.js");
779
+ const { quarantineEntry } = await import("./knowledge-validator-2c7w87dk.js");
780
+ const { KnowledgeConfigSchema } = await import("./schema-vpnkwvez.js");
781
781
  let config;
782
782
  try {
783
- const { loadPluginConfigWithMeta } = await import("./index-hfwzxh3j.js");
783
+ const { loadPluginConfigWithMeta } = await import("./index-0r2m0vbq.js");
784
784
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
785
785
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
786
786
  } catch {
@@ -1,13 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  _internals,
4
- getSafeDefaultConfigLoadResult,
5
- loadAgentPrompt,
6
- loadPluginConfig,
7
- loadPluginConfigWithMeta,
8
- loadPluginConfigWithMetaAsync,
9
4
  resolveWorktreeIsolationConfig
10
- } from "./index-pp5m7xga.js";
5
+ } from "./index-nyjtzmsj.js";
11
6
  import {
12
7
  ApprovalEvidenceSchema,
13
8
  BaseEvidenceSchema,
@@ -34,14 +29,20 @@ import {
34
29
  validateSpecContent
35
30
  } from "./index-n832052r.js";
36
31
  import {
32
+ ExecutionProfileSchema,
37
33
  MigrationStatusSchema,
38
34
  PhaseSchema,
39
35
  PhaseStatusSchema,
40
36
  PlanSchema,
41
37
  TaskSchema,
42
38
  TaskSizeSchema,
43
- TaskStatusSchema
44
- } from "./index-d181x9zr.js";
39
+ TaskStatusSchema,
40
+ getSafeDefaultConfigLoadResult,
41
+ loadAgentPrompt,
42
+ loadPluginConfig,
43
+ loadPluginConfigWithMeta,
44
+ loadPluginConfigWithMetaAsync
45
+ } from "./index-nwrwy8eb.js";
45
46
  import"./index-4rhhvd1a.js";
46
47
  import"./index-zgwm4ryv.js";
47
48
  import {
@@ -65,7 +66,7 @@ import {
65
66
  TurboConfigSchema,
66
67
  WorktreeIsolationConfigSchema,
67
68
  resolveAutoReviewConfig
68
- } from "./index-tj04dj06.js";
69
+ } from "./index-jm4cpp4n.js";
69
70
  import {
70
71
  ALL_AGENT_NAMES,
71
72
  ALL_SUBAGENT_NAMES,
@@ -75,7 +76,7 @@ import {
75
76
  QA_AGENTS,
76
77
  isQAAgent,
77
78
  isSubagent
78
- } from "./index-hxvkfx6t.js";
79
+ } from "./index-jqsfsqbx.js";
79
80
  import"./index-zjygnfay.js";
80
81
  import"./index-bk5tah7q.js";
81
82
  import"./index-bpmtbmy9.js";
@@ -123,6 +124,7 @@ export {
123
124
  MigrationStatusSchema,
124
125
  MemoryConfigSchema,
125
126
  LeanTurboConfigSchema,
127
+ ExecutionProfileSchema,
126
128
  EvidenceVerdictSchema,
127
129
  EvidenceTypeSchema,
128
130
  EvidenceSchema,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  redactPath,
4
4
  redactShellCommand
5
- } from "./index-ysa38bnr.js";
5
+ } from "./index-ptn13xjn.js";
6
6
 
7
7
  // src/services/guardrail-log-service.ts
8
8
  import * as fs from "fs/promises";
@@ -1,12 +1,12 @@
1
1
  // @bun
2
+ import {
3
+ loadDatabaseCtor
4
+ } from "./index-134d35c1.js";
2
5
  import {
3
6
  EvaluationRunV1Schema,
4
7
  GateAuditResultV1Schema,
5
8
  getProtectedEvaluationRunIds
6
- } from "./index-w4etfamq.js";
7
- import {
8
- loadDatabaseCtor
9
- } from "./index-134d35c1.js";
9
+ } from "./index-t5pytnca.js";
10
10
  import {
11
11
  readEffectiveSpecSync
12
12
  } from "./index-9ss2m4rs.js";
@@ -21,21 +21,24 @@ import {
21
21
  initLedger,
22
22
  ledgerExists,
23
23
  loadLastApprovedPlan,
24
+ normalizeExecutionProfileForHash,
24
25
  readLedgerEvents,
26
+ readLedgerEventsWithIntegrity,
27
+ replaceTruncatedLedgerWithRecoveryRoot,
25
28
  replayFromLedger,
26
29
  replayFromLedgerWithStatus,
27
30
  takeSnapshotEvent,
28
31
  takeSnapshotWithRetry
29
- } from "./index-wk8s1m7b.js";
32
+ } from "./index-wrb0gykj.js";
30
33
  import {
31
34
  getWorktreeMergeFailure
32
- } from "./index-b8zgtz81.js";
35
+ } from "./index-zsrtt42s.js";
33
36
  import {
34
37
  isValidTaskId,
35
38
  readTaskEvidence,
36
39
  readTaskEvidenceRaw,
37
40
  sanitizeTaskId
38
- } from "./index-dtyeabmj.js";
41
+ } from "./index-tjqzr3jc.js";
39
42
  import {
40
43
  _internals,
41
44
  buildDefaultPolicy,
@@ -47,15 +50,15 @@ import {
47
50
  readSwarmFileAsync,
48
51
  validateSwarmPath
49
52
  } from "./index-k46me75h.js";
50
- import {
51
- invalidateCachedArtifact,
52
- readCachedParsedFile
53
- } from "./index-ed5ykebp.js";
54
53
  import {
55
54
  assertProjectRoot,
56
55
  tryAcquireLock,
57
56
  withEvidenceLock
58
- } from "./index-35qep0v7.js";
57
+ } from "./index-912qz4y0.js";
58
+ import {
59
+ invalidateCachedArtifact,
60
+ readCachedParsedFile
61
+ } from "./index-ed5ykebp.js";
59
62
  import {
60
63
  bunHash,
61
64
  bunWrite,
@@ -68,7 +71,7 @@ import {
68
71
  } from "./index-gprxjmm7.js";
69
72
  import {
70
73
  PlanSchema
71
- } from "./index-d181x9zr.js";
74
+ } from "./index-nwrwy8eb.js";
72
75
  import {
73
76
  criticalWarn,
74
77
  error,
@@ -77,7 +80,7 @@ import {
77
80
  } from "./index-zgwm4ryv.js";
78
81
  import {
79
82
  emit
80
- } from "./index-bfhwtdsw.js";
83
+ } from "./index-epvhf50h.js";
81
84
  import {
82
85
  ZodError,
83
86
  init_zod
@@ -993,8 +996,8 @@ import * as path8 from "path";
993
996
  import { createHash } from "crypto";
994
997
 
995
998
  // src/db/project-db.ts
996
- import { existsSync, mkdirSync } from "fs";
997
- import { join, resolve } from "path";
999
+ import { existsSync, mkdirSync as mkdirSync2 } from "fs";
1000
+ import { join as join3, resolve } from "path";
998
1001
  var MIGRATIONS = [
999
1002
  {
1000
1003
  version: 1,
@@ -1148,7 +1151,7 @@ function runProjectMigrations(db) {
1148
1151
  }
1149
1152
  }
1150
1153
  function projectDbPath(directory) {
1151
- return join(resolve(directory), ".swarm", "swarm.db");
1154
+ return join3(resolve(directory), ".swarm", "swarm.db");
1152
1155
  }
1153
1156
  function projectDbExists(directory) {
1154
1157
  return existsSync(projectDbPath(directory));
@@ -1158,10 +1161,10 @@ function getProjectDb(directory) {
1158
1161
  const existing = _projectDbs.get(key);
1159
1162
  if (existing)
1160
1163
  return existing;
1161
- const swarmDir = join(key, ".swarm");
1162
- mkdirSync(swarmDir, { recursive: true });
1164
+ const swarmDir = join3(key, ".swarm");
1165
+ mkdirSync2(swarmDir, { recursive: true });
1163
1166
  const Db = loadDatabaseCtor();
1164
- const db = new Db(join(swarmDir, "swarm.db"));
1167
+ const db = new Db(join3(swarmDir, "swarm.db"));
1165
1168
  db.run("PRAGMA journal_mode = WAL;");
1166
1169
  db.run("PRAGMA synchronous = NORMAL;");
1167
1170
  db.run("PRAGMA busy_timeout = 5000;");
@@ -2957,14 +2960,7 @@ function computePlanContentHash(plan) {
2957
2960
  swarm: plan.swarm,
2958
2961
  current_phase: plan.current_phase,
2959
2962
  migration_status: plan.migration_status,
2960
- execution_profile: plan.execution_profile ? {
2961
- parallelization_enabled: plan.execution_profile.parallelization_enabled,
2962
- max_concurrent_tasks: plan.execution_profile.max_concurrent_tasks,
2963
- council_parallel: plan.execution_profile.council_parallel,
2964
- locked: plan.execution_profile.locked,
2965
- auto_proceed: plan.execution_profile.auto_proceed,
2966
- commit_after_each_completed_task: plan.execution_profile.commit_after_each_completed_task === true ? true : undefined
2967
- } : undefined,
2963
+ execution_profile: normalizeExecutionProfileForHash(plan.execution_profile),
2968
2964
  phases: plan.phases.map((phase) => ({
2969
2965
  id: phase.id,
2970
2966
  name: phase.name,
@@ -3314,6 +3310,10 @@ async function savePlan(directory, plan, options) {
3314
3310
  }
3315
3311
  }
3316
3312
  const validated = PlanSchema.parse(plan);
3313
+ const requestedForStaleProjectionReconcile = options?.staleProjectionReconcile !== undefined ? PlanSchema.parse(plan) : null;
3314
+ if (requestedForStaleProjectionReconcile) {
3315
+ derivePhaseStatusesInPlace(requestedForStaleProjectionReconcile);
3316
+ }
3317
3317
  if (options?.preserveCompletedStatuses !== false) {
3318
3318
  try {
3319
3319
  const currentPlan2 = await _internals9.loadPlanJsonOnly(directory);
@@ -3425,6 +3425,43 @@ async function savePlan(directory, plan, options) {
3425
3425
  } catch {}
3426
3426
  }
3427
3427
  }
3428
+ if (options?.staleProjectionReconcile) {
3429
+ if (!currentPlan) {
3430
+ throw new Error("RECONCILE_LEDGER_PROJECTION_MISMATCH: no current plan.json projection exists.");
3431
+ }
3432
+ const comparableCurrent = PlanSchema.parse(currentPlan);
3433
+ derivePhaseStatusesInPlace(comparableCurrent);
3434
+ if (JSON.stringify(comparableCurrent) !== JSON.stringify(requestedForStaleProjectionReconcile)) {
3435
+ throw new Error("RECONCILE_LEDGER_PROJECTION_MISMATCH: manager rejected content that is not the exact unchanged plan.json projection.");
3436
+ }
3437
+ const events = await readLedgerEvents(directory);
3438
+ const tail = events[events.length - 1];
3439
+ const expected = options.staleProjectionReconcile;
3440
+ if (!tail || tail.seq !== expected.expectedSeq || tail.plan_hash_after !== expected.expectedLedgerHash || events[0]?.plan_id !== planId) {
3441
+ throw new PlanConcurrentModificationError("RECONCILE_LEDGER_PROJECTION_STALE: the ledger identity or tail changed before the recovery snapshot could be appended.");
3442
+ }
3443
+ try {
3444
+ const integrity = await readLedgerEventsWithIntegrity(directory);
3445
+ if (integrity.truncated) {
3446
+ await replaceTruncatedLedgerWithRecoveryRoot(directory, validated, {
3447
+ seq: expected.expectedSeq,
3448
+ ledgerHash: expected.expectedLedgerHash
3449
+ });
3450
+ } else {
3451
+ await takeSnapshotEvent(directory, validated, {
3452
+ planHashAfter: computePlanHash(validated),
3453
+ source: "save_plan_stale_projection_reconcile",
3454
+ expectedSeq: expected.expectedSeq,
3455
+ expectedLedgerHash: expected.expectedLedgerHash
3456
+ });
3457
+ }
3458
+ } catch (error2) {
3459
+ if (error2 instanceof LedgerStaleWriterError) {
3460
+ throw new PlanConcurrentModificationError(`RECONCILE_LEDGER_PROJECTION_STALE: ${error2.message}`);
3461
+ }
3462
+ throw error2;
3463
+ }
3464
+ }
3428
3465
  const currentHash = computeCurrentPlanHash(directory);
3429
3466
  const hashAfter = computePlanHash(validated);
3430
3467
  if (currentPlan) {
@@ -3837,6 +3874,10 @@ Phase: ${currentPhase} [${phaseStatus}] | Updated: ${now}
3837
3874
  `;
3838
3875
  markdown += `- Commit After Each Completed Task: ${profile.commit_after_each_completed_task ? "yes" : "no"}
3839
3876
  `;
3877
+ if (profile.planning_profile) {
3878
+ markdown += `- Planning Profile: ${profile.planning_profile}
3879
+ `;
3880
+ }
3840
3881
  }
3841
3882
  const sortedPhases = [...plan.phases].sort((a, b) => a.id - b.id);
3842
3883
  for (const phase of sortedPhases) {
@@ -4967,4 +5008,4 @@ function mergeDurableGateEntriesFromEvidence(taskId, entries, evidence) {
4967
5008
  return merged;
4968
5009
  }
4969
5010
 
4970
- export { projectDbExists, getProjectDb, closeProjectDb, buildTaskCompletionDescriptor, ensureTaskCheckpointReceipt, updateTaskCheckpointReceipt, getExecutor, init_executor, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, getGitRepositoryStatus, isGitRepo, getDefaultBaseBranch, detectDefaultRemoteBranch, resetToRemoteBranch, resetToMainAfterMerge, containsPathTraversal, containsControlChars, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, normalizePath, pathsConflict, isGlobalFile, isProtectedPath, readTaskScopes, computeSpecHash, loadPlanJsonOnly, loadPlan, savePlan, closePlanTerminalState, derivePlanMarkdown, isValidEvidenceType, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
5011
+ export { projectDbExists, getProjectDb, closeProjectDb, buildTaskCompletionDescriptor, ensureTaskCheckpointReceipt, updateTaskCheckpointReceipt, isValidEnvKey, getExecutor, init_executor, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, getGitRepositoryStatus, isGitRepo, getDefaultBaseBranch, detectDefaultRemoteBranch, resetToRemoteBranch, resetToMainAfterMerge, containsPathTraversal, containsControlChars, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, normalizePath, pathsConflict, isGlobalFile, isProtectedPath, readTaskScopes, loadPlanJsonOnly, loadPlan, savePlan, closePlanTerminalState, derivePlanMarkdown, isValidEvidenceType, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  authorizeCuration
4
- } from "./index-dtam929z.js";
4
+ } from "./index-qy1nq52t.js";
5
5
  import {
6
6
  findNearDuplicate,
7
7
  inferTags,
@@ -9,13 +9,13 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-vrmkg8fm.js";
12
+ } from "./index-01ggt2mj.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
- } from "./index-mrpfd1jx.js";
15
+ } from "./index-vh05t3w5.js";
16
16
  import {
17
17
  atomicWriteFile
18
- } from "./index-4hp8nvwb.js";
18
+ } from "./index-p8kk34am.js";
19
19
  import {
20
20
  require_proper_lockfile
21
21
  } from "./index-7g4c7s5r.js";
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  SWARM_WORKTREE_DIR_NAME,
14
14
  init_constants
15
- } from "./index-hxvkfx6t.js";
15
+ } from "./index-jqsfsqbx.js";
16
16
  import {
17
17
  __require
18
18
  } from "./index-a76rekgs.js";
@@ -86,7 +86,7 @@ var _internals = {
86
86
  symlinkSync: fs.symlinkSync
87
87
  },
88
88
  writeScopeToDisk: async (directory, taskId, files) => {
89
- const { writeScopeToDisk: realWrite } = await import("./scope-persistence-8c72jrgp.js");
89
+ const { writeScopeToDisk: realWrite } = await import("./scope-persistence-p9dmprry.js");
90
90
  return realWrite(directory, taskId, files);
91
91
  },
92
92
  writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {