opencode-swarm 7.167.2 → 7.168.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 (102) 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/cli/{coder-settlement-jy9rad28.js → coder-settlement-a35acvj1.js} +12 -12
  4. package/dist/cli/{config-doctor-p66vnpy3.js → config-doctor-9csx775x.js} +3 -3
  5. package/dist/cli/{core-tw0wtntz.js → core-agk5s7dm.js} +2 -2
  6. package/dist/cli/{curation-policy-ndp27v0c.js → curation-policy-mgwv8h2k.js} +5 -5
  7. package/dist/cli/{curator-5nzde80g.js → curator-2fcagjyk.js} +38 -38
  8. package/dist/cli/{curator-drift-gb651hcw.js → curator-drift-k0zrnm09.js} +5 -5
  9. package/dist/cli/curator-llm-factory-qaxmyy46.js +71 -0
  10. package/dist/cli/{evidence-summary-service-bzpfaypy.js → evidence-summary-service-4s6cje60.js} +17 -17
  11. package/dist/cli/{gate-evidence-wa8cj8h6.js → gate-evidence-saja4dan.js} +7 -7
  12. package/dist/cli/guardrail-explain-z41q6sf0.js +72 -0
  13. package/dist/cli/{guardrail-log-7dv73e0q.js → guardrail-log-0h24spq0.js} +8 -8
  14. package/dist/cli/{guardrail-reset-1kng6y8x.js → guardrail-reset-cwbe47k5.js} +38 -38
  15. package/dist/cli/{hive-promoter-87kk2pg5.js → hive-promoter-esxtcvr1.js} +38 -38
  16. package/dist/cli/{index-3r6k6qa7.js → index-00zx94vn.js} +4 -4
  17. package/dist/cli/{index-arqv4psy.js → index-21ree67h.js} +57 -101
  18. package/dist/cli/{index-dme7wvwg.js → index-30h1pk05.js} +4 -4
  19. package/dist/cli/{index-shrf0wt3.js → index-3dywbkyr.js} +4 -4
  20. package/dist/cli/{index-vgpedapd.js → index-4r5pmtvk.js} +2 -2
  21. package/dist/cli/{index-3ws11dq0.js → index-54w1564x.js} +2 -2
  22. package/dist/cli/{index-m7cwnt9r.js → index-5zqakgp4.js} +2 -2
  23. package/dist/cli/{index-f91fhch0.js → index-64phnth4.js} +4 -4
  24. package/dist/cli/{index-09gv90d7.js → index-8f0kscpg.js} +2 -2
  25. package/dist/cli/{index-0q839sg6.js → index-8ybjqg51.js} +1 -1
  26. package/dist/cli/{index-z6we1abx.js → index-a8xbvsse.js} +2 -2
  27. package/dist/cli/{index-jhd3pmd1.js → index-an8b5gda.js} +7 -7
  28. package/dist/cli/{index-gmjg65tm.js → index-bvqqwx84.js} +2 -2
  29. package/dist/cli/{index-rrne6g2m.js → index-cyenn3pf.js} +6 -2
  30. package/dist/cli/{index-65s0vgb1.js → index-ddr97ram.js} +40 -40
  31. package/dist/cli/{index-mtepgqan.js → index-dfyv3xkd.js} +7 -7
  32. package/dist/cli/{index-2b1hd1fx.js → index-exatbqwj.js} +13 -4
  33. package/dist/cli/{index-83r0v5tn.js → index-gp9yzr1v.js} +1 -1
  34. package/dist/cli/{index-79234evf.js → index-h0e2e3h1.js} +1 -1
  35. package/dist/cli/{index-962qme08.js → index-h439y187.js} +1 -1
  36. package/dist/cli/{index-18rfc7qv.js → index-j950hqmq.js} +7 -7
  37. package/dist/cli/{index-8vbahc4c.js → index-kear8gb7.js} +11 -6
  38. package/dist/cli/{index-syedr4e3.js → index-m35hybf0.js} +1 -1
  39. package/dist/cli/{index-ce8p9t28.js → index-mr0wn36f.js} +5 -5
  40. package/dist/cli/{index-sjkg2hc4.js → index-nprngf8p.js} +6 -6
  41. package/dist/cli/{index-m3z83nhs.js → index-nsyxj57e.js} +8 -8
  42. package/dist/cli/{index-f8cc92g7.js → index-nwwk3dej.js} +1 -1
  43. package/dist/cli/{index-g409c7ke.js → index-pyf517sz.js} +2 -2
  44. package/dist/cli/{index-k73ehxa1.js → index-qhey6vc3.js} +1 -1
  45. package/dist/cli/{index-gs12223x.js → index-qwsh0h2g.js} +2 -2
  46. package/dist/cli/{index-n4fzmqz8.js → index-rdm3px0g.js} +4 -2
  47. package/dist/cli/{index-25xeyjfx.js → index-rxcgrgkc.js} +38 -38
  48. package/dist/cli/{index-ehq2vtkq.js → index-s0d5xter.js} +4 -4
  49. package/dist/cli/{index-wjet7x0a.js → index-seetnhpx.js} +1 -1
  50. package/dist/cli/{index-g5m43paw.js → index-sxt7fgcw.js} +1 -0
  51. package/dist/cli/{index-x7pm61wk.js → index-v3xc4sde.js} +9 -8
  52. package/dist/cli/{index-pdcperq5.js → index-wnzxcr0z.js} +2 -2
  53. package/dist/cli/{index-hhkm64wh.js → index-wst6n478.js} +103 -3
  54. package/dist/cli/{index-s7a9dqtb.js → index-x7k3dps5.js} +4 -3
  55. package/dist/cli/{index-y1sj2e1n.js → index-yevn4jpe.js} +2094 -1686
  56. package/dist/cli/index-yv76j77m.js +2008 -0
  57. package/dist/cli/{index-tcj8v6my.js → index-z6qreakh.js} +6 -6
  58. package/dist/cli/{index-5sjq3shs.js → index-ze520xw1.js} +8 -8
  59. package/dist/cli/index.js +38 -38
  60. package/dist/cli/{knowledge-escalator-5e4zxan5.js → knowledge-escalator-b2tf3sd1.js} +13 -13
  61. package/dist/cli/{knowledge-events-abzm5vfh.js → knowledge-events-bgs2kxe0.js} +11 -11
  62. package/dist/cli/{knowledge-link-9ga6hyd5.js → knowledge-link-dr3xnwyd.js} +4 -4
  63. package/dist/cli/{knowledge-store-q4a92eq7.js → knowledge-store-stbmb1b9.js} +5 -5
  64. package/dist/cli/{knowledge-validator-pn3m5r41.js → knowledge-validator-zykgnsag.js} +7 -7
  65. package/dist/cli/{model-preflight-mw895vgt.js → model-preflight-1ycat9jz.js} +1 -1
  66. package/dist/cli/{pending-delegations-3z0xjppd.js → pending-delegations-n5qavj20.js} +12 -12
  67. package/dist/cli/{pr-subscriptions-h7mwnp62.js → pr-subscriptions-gnvmyrng.js} +12 -12
  68. package/dist/cli/{pr-workflow-gate-fec04fa0.js → pr-workflow-gate-cf3ybrws.js} +38 -38
  69. package/dist/cli/{runner-d9833azt.js → runner-k0ycgv8x.js} +5 -5
  70. package/dist/cli/{scan-cursor-ymfvzdkz.js → scan-cursor-b3mcrx23.js} +6 -6
  71. package/dist/cli/{schema-chc4aez6.js → schema-08049cjb.js} +4 -2
  72. package/dist/cli/{scope-persistence-3xnr59y8.js → scope-persistence-a493gv51.js} +16 -16
  73. package/dist/cli/{skill-generator-3mvaghxk.js → skill-generator-2qqzkdpv.js} +15 -15
  74. package/dist/cli/{snapshot-coordination-init-arnc77r9.js → snapshot-coordination-init-8yt8p7q0.js} +38 -38
  75. package/dist/cli/{sqlite-loader-xrnf6bq8.js → sqlite-loader-amp9z7ty.js} +1 -1
  76. package/dist/cli/{telemetry-g9pppt9e.js → telemetry-2wzapf11.js} +1 -1
  77. package/dist/cli/{workspace-snapshot-hvsjtepd.js → workspace-snapshot-rkgxhj9b.js} +3 -3
  78. package/dist/cli/{worktree-collision-ownership-vj8anvb7.js → worktree-collision-ownership-xttafc4h.js} +13 -13
  79. package/dist/cli/{worktree-isolation-mt7z75hz.js → worktree-isolation-e5q5rewk.js} +38 -38
  80. package/dist/commands/reset.d.ts +10 -0
  81. package/dist/commands/rollback.d.ts +9 -0
  82. package/dist/config/schema.d.ts +29 -0
  83. package/dist/db/project-db.d.ts +8 -0
  84. package/dist/db/sqlite-loader.d.ts +2 -1
  85. package/dist/dispatch/spawn-circuit.d.ts +121 -0
  86. package/dist/dispatch/token-bucket.d.ts +46 -0
  87. package/dist/hooks/delegation-gate/dead-lane-reclaim.d.ts +61 -0
  88. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +22 -0
  89. package/dist/hooks/issue-trace.d.ts +3 -0
  90. package/dist/hooks/utils.d.ts +1 -1
  91. package/dist/index.js +657 -572
  92. package/dist/plan/ledger-sqlite.d.ts +226 -0
  93. package/dist/plan/ledger.d.ts +24 -0
  94. package/dist/plan/manager.d.ts +19 -0
  95. package/dist/retention/sweep.d.ts +2 -0
  96. package/dist/services/spec-drift-recovery.d.ts +2 -1
  97. package/dist/utils/ephemeral-session-teardown.d.ts +55 -2
  98. package/opencode-swarm.schema.json +41 -0
  99. package/package.json +1 -1
  100. package/dist/cli/curator-llm-factory-xy96x5x8.js +0 -71
  101. package/dist/cli/guardrail-explain-1ef5he6j.js +0 -72
  102. package/dist/cli/index-z7z3g5wt.js +0 -1017
@@ -22,66 +22,66 @@ import {
22
22
  resolveFallbackModel,
23
23
  resolvePrimaryAgentNames,
24
24
  stripSwarmPrefix
25
- } from "./index-y1sj2e1n.js";
25
+ } from "./index-yevn4jpe.js";
26
26
  import"./index-d5qf7hvh.js";
27
- import"./index-k73ehxa1.js";
28
- import"./index-dme7wvwg.js";
29
- import"./index-f8cc92g7.js";
30
- import"./index-rrne6g2m.js";
31
- import"./index-arqv4psy.js";
32
- import"./index-83r0v5tn.js";
27
+ import"./index-qhey6vc3.js";
28
+ import"./index-30h1pk05.js";
29
+ import"./index-nwwk3dej.js";
30
+ import"./index-cyenn3pf.js";
31
+ import"./index-21ree67h.js";
32
+ import"./index-gp9yzr1v.js";
33
33
  import"./index-txdagbh7.js";
34
34
  import"./index-9br68j86.js";
35
35
  import"./index-cw912re7.js";
36
- import"./index-f91fhch0.js";
37
- import"./index-ce8p9t28.js";
38
- import"./index-pdcperq5.js";
36
+ import"./index-64phnth4.js";
37
+ import"./index-mr0wn36f.js";
38
+ import"./index-wnzxcr0z.js";
39
39
  import {
40
40
  createExplorerAgent
41
41
  } from "./index-fyfbpz4f.js";
42
- import"./index-mtepgqan.js";
42
+ import"./index-dfyv3xkd.js";
43
43
  import"./index-zsrtt42s.js";
44
- import"./index-5sjq3shs.js";
45
- import"./index-m7cwnt9r.js";
46
- import"./index-gmjg65tm.js";
44
+ import"./index-ze520xw1.js";
45
+ import"./index-5zqakgp4.js";
46
+ import"./index-bvqqwx84.js";
47
47
  import"./index-b43rt5ph.js";
48
48
  import"./index-q7sjgr1y.js";
49
- import"./index-3r6k6qa7.js";
50
- import"./index-09gv90d7.js";
51
- import"./index-sjkg2hc4.js";
52
- import"./index-m3z83nhs.js";
53
- import"./index-8vbahc4c.js";
49
+ import"./index-00zx94vn.js";
50
+ import"./index-8f0kscpg.js";
51
+ import"./index-nprngf8p.js";
52
+ import"./index-nsyxj57e.js";
53
+ import"./index-kear8gb7.js";
54
54
  import"./index-p612v1mv.js";
55
- import"./index-shrf0wt3.js";
56
- import"./index-syedr4e3.js";
55
+ import"./index-3dywbkyr.js";
56
+ import"./index-m35hybf0.js";
57
57
  import"./index-rtry5xyf.js";
58
- import"./index-s7a9dqtb.js";
58
+ import"./index-x7k3dps5.js";
59
59
  import"./index-3qf1vxtb.js";
60
60
  import"./index-n832052r.js";
61
- import"./index-jhd3pmd1.js";
62
- import"./index-z7z3g5wt.js";
63
- import"./index-z6we1abx.js";
64
- import"./index-g409c7ke.js";
65
- import"./index-962qme08.js";
66
- import"./index-hhkm64wh.js";
67
- import"./index-n4fzmqz8.js";
61
+ import"./index-an8b5gda.js";
62
+ import"./index-yv76j77m.js";
63
+ import"./index-a8xbvsse.js";
64
+ import"./index-pyf517sz.js";
65
+ import"./index-h439y187.js";
66
+ import"./index-wst6n478.js";
67
+ import"./index-rdm3px0g.js";
68
68
  import"./index-ry16d01s.js";
69
- import"./index-gs12223x.js";
70
- import"./index-18rfc7qv.js";
69
+ import"./index-qwsh0h2g.js";
70
+ import"./index-j950hqmq.js";
71
71
  import"./index-vzm6zre7.js";
72
72
  import"./index-ae75rja9.js";
73
- import"./index-0q839sg6.js";
74
- import"./index-vgpedapd.js";
73
+ import"./index-8ybjqg51.js";
74
+ import"./index-4r5pmtvk.js";
75
75
  import"./index-7g4c7s5r.js";
76
- import"./index-x7pm61wk.js";
77
- import"./index-tcj8v6my.js";
76
+ import"./index-v3xc4sde.js";
77
+ import"./index-z6qreakh.js";
78
78
  import"./index-1xnse449.js";
79
79
  import"./index-ee6ydtfe.js";
80
- import"./index-wjet7x0a.js";
80
+ import"./index-seetnhpx.js";
81
81
  import"./index-0mhftbpp.js";
82
82
  import"./index-a1w58b47.js";
83
- import"./index-2b1hd1fx.js";
84
- import"./index-g5m43paw.js";
83
+ import"./index-exatbqwj.js";
84
+ import"./index-sxt7fgcw.js";
85
85
  import"./index-bk5tah7q.js";
86
86
  import"./index-bpmtbmy9.js";
87
87
  import"./index-zpsr8rpc.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  _internals,
4
4
  resolveWorktreeIsolationConfig
5
- } from "./index-s7a9dqtb.js";
5
+ } from "./index-x7k3dps5.js";
6
6
  import {
7
7
  ApprovalEvidenceSchema,
8
8
  BaseEvidenceSchema,
@@ -44,7 +44,7 @@ import {
44
44
  loadPluginConfigWithMeta,
45
45
  loadPluginConfigWithMetaAsync,
46
46
  resetConfigAdvisoryDedup
47
- } from "./index-wjet7x0a.js";
47
+ } from "./index-seetnhpx.js";
48
48
  import"./index-0mhftbpp.js";
49
49
  import"./index-a1w58b47.js";
50
50
  import {
@@ -70,7 +70,7 @@ import {
70
70
  TurboConfigSchema,
71
71
  WorktreeIsolationConfigSchema,
72
72
  resolveAutoReviewConfig
73
- } from "./index-2b1hd1fx.js";
73
+ } from "./index-exatbqwj.js";
74
74
  import {
75
75
  ALL_AGENT_NAMES,
76
76
  ALL_SUBAGENT_NAMES,
@@ -80,7 +80,7 @@ import {
80
80
  QA_AGENTS,
81
81
  isQAAgent,
82
82
  isSubagent
83
- } from "./index-g5m43paw.js";
83
+ } from "./index-sxt7fgcw.js";
84
84
  import"./index-bk5tah7q.js";
85
85
  import"./index-bpmtbmy9.js";
86
86
  import"./index-zpsr8rpc.js";
@@ -14,7 +14,7 @@ import {
14
14
  PluginConfigSchema,
15
15
  init_schema,
16
16
  resolveExternalSkillsConfig
17
- } from "./index-2b1hd1fx.js";
17
+ } from "./index-exatbqwj.js";
18
18
  import {
19
19
  exports_external,
20
20
  init_zod
@@ -1350,6 +1350,7 @@ var init_constants = __esm(() => {
1350
1350
  lane_permissions: "scoped_allow",
1351
1351
  serialization_release_after_dispatches: 5,
1352
1352
  serialization_release_after_ms: 60000,
1353
+ session_create_timeout_ms: 30000,
1353
1354
  runtime_isolation: {
1354
1355
  enabled: false,
1355
1356
  port_stride: 1
@@ -229,9 +229,9 @@ var SWARM_TEMP_GRAMMARS = [
229
229
  "src/evidence/task-file.ts (pre-#2035; migrated-to=src/evidence/task-file.ts:atomicWriteFile)",
230
230
  "src/scope/scope-persistence.ts (pre-#2035; migrated-to=src/scope/scope-persistence.ts:atomicWrite)",
231
231
  "src/scope/scope-persistence.ts (pre-#2035; migrated-to=src/scope/scope-persistence.ts:atomicWriteSync)",
232
- "src/plan/manager.ts:630",
233
- "src/plan/manager.ts:1786",
234
- "src/plan/manager.ts:1832",
232
+ "src/plan/manager.ts:651",
233
+ "src/plan/manager.ts:1715",
234
+ "src/plan/manager.ts:1761",
235
235
  "src/review/evidence.ts:175",
236
236
  "src/turbo/lean/evidence.ts:182",
237
237
  "src/summaries/manager.ts:123",
@@ -247,7 +247,7 @@ var SWARM_TEMP_GRAMMARS = [
247
247
  "src/evidence/phase-participation.ts (pre-#2035; migrated-to=src/evidence/phase-participation.ts:atomicWriteBytes)",
248
248
  "src/turbo/lean/integration.ts:428",
249
249
  "src/turbo/lean/reviewer.ts:403",
250
- "src/plan/ledger.ts:746",
250
+ "src/plan/ledger.ts:1077",
251
251
  "src/services/synonym-map.ts:389",
252
252
  "src/services/skill-optimizer/store.ts:340",
253
253
  "src/services/skill-optimizer/store.ts:503",
@@ -267,7 +267,8 @@ var SWARM_TEMP_GRAMMARS = [
267
267
  producers: [
268
268
  "src/turbo/lean/state.ts:129",
269
269
  "src/turbo/lean/recovery.ts:175",
270
- "src/hooks/delegation-gate/worktree-merge-status.ts:110"
270
+ "src/hooks/delegation-gate/worktree-merge-status.ts:110",
271
+ "src/plan/ledger.ts:606"
271
272
  ]
272
273
  },
273
274
  {
@@ -360,7 +361,7 @@ var SWARM_TEMP_GRAMMARS = [
360
361
  token: "instance",
361
362
  quarantineEligible: true,
362
363
  parsesTarget: true,
363
- producers: ["src/plan/manager.ts:1972", "src/plan/manager.ts:2161"],
364
+ producers: ["src/plan/manager.ts:1901", "src/plan/manager.ts:2090"],
364
365
  note: "plan-durability (invariant 5) fd-write paths; grammars registered, writers unchanged in this PR"
365
366
  },
366
367
  {
@@ -426,8 +427,8 @@ var SWARM_TEMP_GRAMMARS = [
426
427
  "src/hooks/skill-usage-log.ts:1675",
427
428
  "src/hooks/skill-usage-pending.ts:817",
428
429
  "src/parallel/file-locks.ts:113",
429
- "src/plan/ledger.ts:1344",
430
- "src/plan/ledger.ts:1345"
430
+ "src/plan/ledger.ts:578",
431
+ "src/plan/ledger.ts:1756"
431
432
  ],
432
433
  note: "constant-name temps: reported when stale, never auto-quarantined. file-locks meta sidecars live under the scanner-skipped .swarm/locks/ subtree; the ledger reconcile temp embeds instance tokens but its .tmp-suffix shape maps here (conservatively report-only)"
433
434
  }
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  readKnowledge,
4
4
  transactKnowledge
5
- } from "./index-18rfc7qv.js";
5
+ } from "./index-j950hqmq.js";
6
6
  import {
7
7
  resolveKnowledgeStoreDir
8
- } from "./index-0q839sg6.js";
8
+ } from "./index-8ybjqg51.js";
9
9
  import {
10
10
  init_git_executable,
11
11
  resolveGitExecutableAsync
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  loadDatabaseCtor
4
- } from "./index-n4fzmqz8.js";
4
+ } from "./index-rdm3px0g.js";
5
5
  import {
6
6
  canonicalExistingFilesystemPath
7
7
  } from "./index-ry16d01s.js";
8
8
  import {
9
9
  atomicWriteSwarmFileSync
10
- } from "./index-x7pm61wk.js";
10
+ } from "./index-v3xc4sde.js";
11
11
  import {
12
12
  canonicalRootKeyFresh,
13
13
  lexicalRootAliasKey
@@ -16,6 +16,7 @@ import {
16
16
  // src/db/project-db.ts
17
17
  import { existsSync, mkdirSync, unlinkSync } from "fs";
18
18
  import { join, resolve } from "path";
19
+ import { pathToFileURL } from "url";
19
20
 
20
21
  // src/db/db-errors.ts
21
22
  class ProjectDbError extends Error {
@@ -405,6 +406,82 @@ var MIGRATIONS = [
405
406
  lines_seen INTEGER NOT NULL CHECK(lines_seen >= 0),
406
407
  imported_at TEXT NOT NULL
407
408
  )`
409
+ },
410
+ {
411
+ version: 33,
412
+ name: "create_plan_ledger_event",
413
+ sql: `CREATE TABLE IF NOT EXISTS plan_ledger_event (
414
+ seq INTEGER PRIMARY KEY CHECK(seq >= 1),
415
+ canonical_event BLOB NOT NULL CHECK(length(canonical_event) > 0),
416
+ event_hash TEXT NOT NULL UNIQUE,
417
+ root_event_hash TEXT,
418
+ plan_epoch TEXT,
419
+ timestamp TEXT NOT NULL,
420
+ plan_id TEXT NOT NULL,
421
+ event_type TEXT NOT NULL,
422
+ task_id TEXT,
423
+ phase_id INTEGER,
424
+ from_status TEXT,
425
+ to_status TEXT,
426
+ source TEXT NOT NULL,
427
+ plan_hash_before TEXT NOT NULL,
428
+ plan_hash_after TEXT NOT NULL,
429
+ schema_version TEXT NOT NULL,
430
+ payload_hash TEXT,
431
+ payload_json TEXT,
432
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
433
+ )`
434
+ },
435
+ {
436
+ version: 34,
437
+ name: "create_plan_ledger_state",
438
+ sql: `CREATE TABLE IF NOT EXISTS plan_ledger_state (
439
+ id INTEGER PRIMARY KEY CHECK(id = 1),
440
+ authority_mode TEXT NOT NULL CHECK(authority_mode IN ('file_shadow', 'sqlite')),
441
+ shadow_started_version TEXT,
442
+ parity_status TEXT NOT NULL CHECK(parity_status IN ('pending', 'clean', 'diverged', 'failed')),
443
+ file_replay_hash TEXT,
444
+ sqlite_replay_hash TEXT,
445
+ terminal_projection_hash TEXT NOT NULL DEFAULT '',
446
+ last_seq INTEGER NOT NULL DEFAULT 0 CHECK(last_seq >= 0),
447
+ last_event_hash TEXT,
448
+ root_event_hash TEXT,
449
+ plan_id TEXT,
450
+ plan_epoch TEXT,
451
+ terminal_plan_hash TEXT,
452
+ terminal_projection BLOB,
453
+ terminal_projection_json TEXT,
454
+ terminal_metadata TEXT,
455
+ updated_at TEXT NOT NULL DEFAULT (datetime('now'))
456
+ )`
457
+ },
458
+ {
459
+ version: 35,
460
+ name: "create_plan_ledger_import",
461
+ sql: `CREATE TABLE IF NOT EXISTS plan_ledger_import (
462
+ source TEXT PRIMARY KEY,
463
+ source_hash TEXT NOT NULL,
464
+ archive_path TEXT,
465
+ archive_hash TEXT,
466
+ archive_size INTEGER,
467
+ archive_created_at TEXT,
468
+ mode TEXT NOT NULL,
469
+ version TEXT,
470
+ row_count INTEGER NOT NULL DEFAULT 0 CHECK(row_count >= 0),
471
+ imported_at TEXT NOT NULL DEFAULT (datetime('now'))
472
+ )`
473
+ },
474
+ {
475
+ version: 36,
476
+ name: "create_plan_ledger_event_indexes",
477
+ sql: `CREATE INDEX IF NOT EXISTS idx_plan_ledger_event_plan
478
+ ON plan_ledger_event(plan_id, seq)`
479
+ },
480
+ {
481
+ version: 37,
482
+ name: "create_plan_ledger_import_hash_index",
483
+ sql: `CREATE INDEX IF NOT EXISTS idx_plan_ledger_import_hash
484
+ ON plan_ledger_import(source_hash)`
408
485
  }
409
486
  ];
410
487
  var _projectDbs = new Map;
@@ -555,6 +632,26 @@ function projectDbPath(directory) {
555
632
  function projectDbExists(directory) {
556
633
  return existsSync(projectDbPath(directory));
557
634
  }
635
+ function withProjectDbReadOnly(directory, read) {
636
+ const cached = _projectDbs.get(canonicalRootKeyFresh(directory));
637
+ if (cached)
638
+ return read(cached.db);
639
+ const dbFile = projectDbPath(directory);
640
+ if (!existsSync(dbFile))
641
+ return null;
642
+ const Db = loadDatabaseCtor();
643
+ const walPresent = existsSync(`${dbFile}-wal`);
644
+ const db = walPresent ? new Db(dbFile, { readonly: true }) : (() => {
645
+ const immutableUrl = pathToFileURL(dbFile);
646
+ immutableUrl.searchParams.set("immutable", "1");
647
+ return new Db(immutableUrl.href, 1 | 64);
648
+ })();
649
+ try {
650
+ return read(db);
651
+ } finally {
652
+ db.close();
653
+ }
654
+ }
558
655
  function checkpointWalBestEffort(db) {
559
656
  try {
560
657
  const row = db.query("PRAGMA wal_checkpoint(TRUNCATE)").get();
@@ -677,6 +774,9 @@ var DURABILITY_CLASSES = {
677
774
  coordination_state: "full",
678
775
  coordination_lease: "full",
679
776
  coordination_import: "full",
777
+ plan_ledger_event: "full",
778
+ plan_ledger_state: "full",
779
+ plan_ledger_import: "full",
680
780
  insight_candidate: "normal",
681
781
  phase_report: "normal",
682
782
  project_constraints: "normal",
@@ -746,4 +846,4 @@ function withImmediateTransaction(db, cls, fn, hooks = {}) {
746
846
  }
747
847
  }
748
848
 
749
- export { DURABILITY_CLASSES, batchDurabilityClass, applySynchronousForClass, withDurabilityClass, withImmediateTransaction, DbWriteError, classifyDbWriteError, projectDbPath, projectDbExists, getProjectDb, closeProjectDb, closeAllProjectDbs };
849
+ export { DURABILITY_CLASSES, batchDurabilityClass, applySynchronousForClass, withDurabilityClass, withImmediateTransaction, DbWriteError, classifyDbWriteError, projectDbPath, projectDbExists, withProjectDbReadOnly, getProjectDb, closeProjectDb, closeAllProjectDbs };
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  init_loader,
4
4
  loadPluginConfigWithMeta
5
- } from "./index-wjet7x0a.js";
5
+ } from "./index-seetnhpx.js";
6
6
  import {
7
7
  init_schema
8
- } from "./index-2b1hd1fx.js";
8
+ } from "./index-exatbqwj.js";
9
9
  import {
10
10
  DEFAULT_WORKTREE_ISOLATION_CONFIG,
11
11
  init_constants
12
- } from "./index-g5m43paw.js";
12
+ } from "./index-sxt7fgcw.js";
13
13
 
14
14
  // src/config/index.ts
15
15
  init_constants();
@@ -31,6 +31,7 @@ function resolveWorktreeIsolationConfig(config) {
31
31
  merge_strategy: lean.merge_strategy ?? "merge",
32
32
  worktree_dir: lean.worktree_dir,
33
33
  deps_strategy: lean.deps_strategy ?? "skip",
34
+ session_create_timeout_ms: DEFAULT_WORKTREE_ISOLATION_CONFIG.session_create_timeout_ms,
34
35
  runtime_isolation: lean.runtime_isolation ?? DEFAULT_WORKTREE_ISOLATION_CONFIG.runtime_isolation
35
36
  };
36
37
  }