opencode-swarm 7.154.0 → 7.154.2

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 (75) hide show
  1. package/dist/background/completion-observer.d.ts +10 -1
  2. package/dist/background/pending-delegations.d.ts +47 -0
  3. package/dist/background/pr-subscriptions.d.ts +7 -0
  4. package/dist/cli/coder-settlement-xqs49g07.js +54 -0
  5. package/dist/cli/{config-doctor-8p9y543t.js → config-doctor-69eebk90.js} +2 -2
  6. package/dist/cli/{core-1h6x6k59.js → core-dyp14hcb.js} +2 -2
  7. package/dist/cli/{curation-policy-9r902jw4.js → curation-policy-jm9jsxtt.js} +6 -6
  8. package/dist/cli/curator-drift-h57z6tm3.js +1 -1
  9. package/dist/cli/{curator-yj00z1qz.js → curator-he8n9z9n.js} +35 -33
  10. package/dist/cli/{curator-llm-factory-ypwf3a90.js → curator-llm-factory-5tq9c4v5.js} +35 -33
  11. package/dist/cli/{evidence-summary-service-npq04240.js → evidence-summary-service-05s5y8d6.js} +13 -13
  12. package/dist/cli/{gate-evidence-4b6t0ycn.js → gate-evidence-3ptr9af3.js} +7 -7
  13. package/dist/cli/guardrail-explain-tebk344k.js +67 -0
  14. package/dist/cli/{guardrail-log-eyecsekk.js → guardrail-log-x3gz3x17.js} +5 -5
  15. package/dist/cli/{guardrail-reset-269jdwhd.js → guardrail-reset-716pdyf5.js} +35 -33
  16. package/dist/cli/{hive-promoter-5936am48.js → hive-promoter-nvwpj2t9.js} +35 -33
  17. package/dist/cli/{index-10zvxqra.js → index-07n87ctw.js} +1 -1
  18. package/dist/cli/{index-yve4e8fx.js → index-14bz2t7b.js} +1 -1
  19. package/dist/cli/{index-nkr634n6.js → index-2w6vy9a9.js} +1 -1
  20. package/dist/cli/{index-6yc06dx9.js → index-399e8aze.js} +1 -1
  21. package/dist/cli/{index-garsang6.js → index-4xqa0sgz.js} +1 -1
  22. package/dist/cli/{index-tnm9bb8b.js → index-57t97rtr.js} +1 -1
  23. package/dist/cli/{index-s70tmqn3.js → index-6qwp46k0.js} +5 -5
  24. package/dist/cli/{index-68w5jxv5.js → index-6rcx6vr6.js} +4 -4
  25. package/dist/cli/{index-wfxg3s7n.js → index-6rns7b2m.js} +96 -23
  26. package/dist/cli/{index-3mhgv8d6.js → index-7tw116n6.js} +2 -2
  27. package/dist/cli/{index-wpstzk85.js → index-8v69hfpt.js} +4 -4
  28. package/dist/cli/index-9avdncr2.js +875 -0
  29. package/dist/cli/{index-1tdsddab.js → index-bxvkn0ye.js} +2281 -2919
  30. package/dist/cli/index-ddszzne4.js +42 -0
  31. package/dist/cli/{index-4y7g04py.js → index-dm9tc6qb.js} +7 -7
  32. package/dist/cli/{index-4g00jhbs.js → index-dsqat5pg.js} +3 -3
  33. package/dist/cli/{index-snnps1vm.js → index-f6qmar4k.js} +5 -5
  34. package/dist/cli/{index-y64jrbch.js → index-fv9ddfta.js} +2 -2
  35. package/dist/cli/{index-ttqnhxxq.js → index-h1g8w4v0.js} +2 -2
  36. package/dist/cli/{index-s0a4ewkb.js → index-j6q3k628.js} +2 -2
  37. package/dist/cli/{index-c809a69b.js → index-kemxyzc0.js} +1 -1
  38. package/dist/cli/{index-pcj7jk4t.js → index-mnxtkt8s.js} +4 -4
  39. package/dist/cli/{index-hk4wa0v1.js → index-n0gqre56.js} +6 -6
  40. package/dist/cli/{index-7jnh1sgb.js → index-nh4axsxc.js} +228 -2
  41. package/dist/cli/{index-2mbs5q26.js → index-p7ey2w90.js} +7 -7
  42. package/dist/cli/{index-48m4841x.js → index-pj2nycpg.js} +1 -1
  43. package/dist/cli/{index-3db7xza0.js → index-r0dactw2.js} +1 -1
  44. package/dist/cli/{index-2kzxkx50.js → index-v2ryvr8k.js} +37 -35
  45. package/dist/cli/{index-mddgkqg9.js → index-v9585wjc.js} +2 -2
  46. package/dist/cli/{index-dwh02jmv.js → index-vhhdj49x.js} +10 -10
  47. package/dist/cli/{index-vtdwkfbv.js → index-xagq35tf.js} +1 -1
  48. package/dist/cli/{index-c6dfyzdh.js → index-xdy28ngt.js} +1 -1
  49. package/dist/cli/{index-3hdnfmhp.js → index-xq2v52tt.js} +2 -2
  50. package/dist/cli/{index-qcz4xprd.js → index-xt6jx41g.js} +4 -4
  51. package/dist/cli/{index-p4y7jefb.js → index-ynvw5kxc.js} +2 -2
  52. package/dist/cli/index.js +35 -33
  53. package/dist/cli/{knowledge-escalator-bxpzeth0.js → knowledge-escalator-s0tye368.js} +12 -12
  54. package/dist/cli/{knowledge-events-jxdpg2hj.js → knowledge-events-eyy9yf6b.js} +10 -10
  55. package/dist/cli/{knowledge-link-nwxykjya.js → knowledge-link-rb11f06y.js} +5 -5
  56. package/dist/cli/{knowledge-store-336hyzs8.js → knowledge-store-zjq5mz2d.js} +6 -6
  57. package/dist/cli/{knowledge-validator-9wkvnsv0.js → knowledge-validator-yw5qqqpd.js} +8 -8
  58. package/dist/cli/{pending-delegations-0fmj1qy6.js → pending-delegations-rdzjq3nw.js} +16 -3
  59. package/dist/cli/{pr-subscriptions-1ndwgtbw.js → pr-subscriptions-2f5fne6z.js} +4 -4
  60. package/dist/cli/{runner-06dvm53x.js → runner-yaqrj388.js} +6 -6
  61. package/dist/cli/{scan-cursor-3xxqtxwx.js → scan-cursor-8f0s883y.js} +7 -7
  62. package/dist/cli/{schema-jdx83m4m.js → schema-2xw94dh3.js} +1 -1
  63. package/dist/cli/{scope-persistence-wgxn2kba.js → scope-persistence-tap2q94x.js} +9 -9
  64. package/dist/cli/{skill-generator-vmxsc2fm.js → skill-generator-2xbfryqb.js} +14 -14
  65. package/dist/cli/{telemetry-q2km2zrz.js → telemetry-r8e8zey7.js} +1 -1
  66. package/dist/cli/{worktree-collision-ownership-gsay5210.js → worktree-collision-ownership-5gwey8ms.js} +10 -9
  67. package/dist/cli/{worktree-isolation-peb4bkg3.js → worktree-isolation-xsy14t5a.js} +35 -33
  68. package/dist/evaluation/contracts.d.ts +4 -4
  69. package/dist/evaluation/gate-ground-truth.d.ts +1 -1
  70. package/dist/index.js +523 -523
  71. package/dist/telemetry.d.ts +1 -0
  72. package/dist/utils/canonical-root.d.ts +2 -0
  73. package/dist/workflow/coder-settlement.d.ts +14 -0
  74. package/package.json +1 -1
  75. package/dist/cli/guardrail-explain-dyxbhrdj.js +0 -65
@@ -3,60 +3,62 @@ import {
3
3
  getAgentSession,
4
4
  getBlockingActionCircuit,
5
5
  resetActionCircuitExternally
6
- } from "./index-1tdsddab.js";
7
- import"./index-3hdnfmhp.js";
8
- import"./index-10zvxqra.js";
9
- import"./index-dwh02jmv.js";
6
+ } from "./index-bxvkn0ye.js";
7
+ import"./index-399e8aze.js";
8
+ import"./index-xq2v52tt.js";
9
+ import"./index-07n87ctw.js";
10
+ import"./index-vhhdj49x.js";
11
+ import"./index-fv9ddfta.js";
10
12
  import"./index-134d35c1.js";
11
13
  import"./index-nj6rmyeh.js";
12
- import"./index-6yc06dx9.js";
13
- import"./index-y64jrbch.js";
14
14
  import"./index-y8552snf.js";
15
- import"./index-mddgkqg9.js";
15
+ import"./index-f6qmar4k.js";
16
+ import"./index-v9585wjc.js";
16
17
  import"./index-70ha9e09.js";
17
18
  import"./index-c8s9a3zh.js";
18
19
  import"./index-9ss2m4rs.js";
19
- import"./index-vnn7qq8c.js";
20
- import"./index-wfxg3s7n.js";
21
- import"./index-68w5jxv5.js";
22
- import"./index-snnps1vm.js";
23
- import"./index-qcz4xprd.js";
24
- import"./index-yve4e8fx.js";
25
- import"./index-rtry5xyf.js";
26
- import"./index-garsang6.js";
20
+ import"./index-6rns7b2m.js";
27
21
  import"./index-zsrtt42s.js";
28
- import"./index-wpstzk85.js";
29
- import"./index-nkr634n6.js";
30
- import"./index-7jnh1sgb.js";
31
- import"./index-s70tmqn3.js";
32
- import"./index-4g00jhbs.js";
33
- import"./index-c6dfyzdh.js";
22
+ import"./index-9avdncr2.js";
23
+ import"./index-4xqa0sgz.js";
24
+ import"./index-6rcx6vr6.js";
25
+ import"./index-xt6jx41g.js";
26
+ import"./index-14bz2t7b.js";
27
+ import"./index-rtry5xyf.js";
28
+ import"./index-8v69hfpt.js";
29
+ import"./index-2w6vy9a9.js";
30
+ import"./index-nh4axsxc.js";
31
+ import"./index-ddszzne4.js";
32
+ import"./index-vnn7qq8c.js";
33
+ import"./index-6qwp46k0.js";
34
+ import"./index-dsqat5pg.js";
35
+ import"./index-xdy28ngt.js";
34
36
  import"./index-556ja8an.js";
37
+ import"./index-4fwbbad3.js";
35
38
  import"./index-b43rt5ph.js";
36
39
  import"./index-q7sjgr1y.js";
37
- import"./index-4fwbbad3.js";
38
- import"./index-hk4wa0v1.js";
39
- import"./index-2mbs5q26.js";
40
- import"./index-p4y7jefb.js";
40
+ import"./index-n0gqre56.js";
41
+ import"./index-p7ey2w90.js";
42
+ import"./index-ynvw5kxc.js";
41
43
  import"./index-gprxjmm7.js";
42
44
  import"./index-n832052r.js";
43
45
  import"./index-4cgee5vh.js";
44
46
  import"./index-z6xqpmqg.js";
45
47
  import"./index-r3mvsbtq.js";
46
- import"./index-4y7g04py.js";
47
- import"./index-tnm9bb8b.js";
48
+ import"./index-dm9tc6qb.js";
49
+ import"./index-57t97rtr.js";
48
50
  import"./index-myt57pht.js";
51
+ import"./index-zjygnfay.js";
49
52
  import"./index-9e6fdz2h.js";
50
53
  import"./index-4rhhvd1a.js";
51
- import"./index-zjygnfay.js";
52
54
  import"./index-ae75rja9.js";
53
- import"./index-3db7xza0.js";
54
- import"./index-s0a4ewkb.js";
55
+ import"./index-r0dactw2.js";
56
+ import"./index-j6q3k628.js";
55
57
  import"./index-bk5tah7q.js";
56
- import"./index-c809a69b.js";
57
- import"./index-vtdwkfbv.js";
58
+ import"./index-kemxyzc0.js";
59
+ import"./index-xagq35tf.js";
58
60
  import"./index-ed5ykebp.js";
59
- import"./index-ttqnhxxq.js";
61
+ import"./index-h1g8w4v0.js";
60
62
  import"./index-7g4c7s5r.js";
61
63
  import"./index-bpmtbmy9.js";
62
64
  import"./index-zgwm4ryv.js";
@@ -7,62 +7,64 @@ import {
7
7
  isHiveEligible,
8
8
  promoteFromSwarm,
9
9
  promoteToHive
10
- } from "./index-1tdsddab.js";
11
- import"./index-3hdnfmhp.js";
12
- import"./index-10zvxqra.js";
13
- import"./index-dwh02jmv.js";
10
+ } from "./index-bxvkn0ye.js";
11
+ import"./index-399e8aze.js";
12
+ import"./index-xq2v52tt.js";
13
+ import"./index-07n87ctw.js";
14
+ import"./index-vhhdj49x.js";
15
+ import"./index-fv9ddfta.js";
14
16
  import"./index-134d35c1.js";
15
17
  import"./index-nj6rmyeh.js";
16
- import"./index-6yc06dx9.js";
17
- import"./index-y64jrbch.js";
18
18
  import"./index-y8552snf.js";
19
- import"./index-mddgkqg9.js";
19
+ import"./index-f6qmar4k.js";
20
+ import"./index-v9585wjc.js";
20
21
  import"./index-70ha9e09.js";
21
22
  import"./index-c8s9a3zh.js";
22
23
  import"./index-9ss2m4rs.js";
23
- import"./index-vnn7qq8c.js";
24
- import"./index-wfxg3s7n.js";
25
- import"./index-68w5jxv5.js";
26
- import"./index-snnps1vm.js";
27
- import"./index-qcz4xprd.js";
28
- import"./index-yve4e8fx.js";
29
- import"./index-rtry5xyf.js";
30
- import"./index-garsang6.js";
24
+ import"./index-6rns7b2m.js";
31
25
  import"./index-zsrtt42s.js";
32
- import"./index-wpstzk85.js";
33
- import"./index-nkr634n6.js";
34
- import"./index-7jnh1sgb.js";
35
- import"./index-s70tmqn3.js";
36
- import"./index-4g00jhbs.js";
37
- import"./index-c6dfyzdh.js";
26
+ import"./index-9avdncr2.js";
27
+ import"./index-4xqa0sgz.js";
28
+ import"./index-6rcx6vr6.js";
29
+ import"./index-xt6jx41g.js";
30
+ import"./index-14bz2t7b.js";
31
+ import"./index-rtry5xyf.js";
32
+ import"./index-8v69hfpt.js";
33
+ import"./index-2w6vy9a9.js";
34
+ import"./index-nh4axsxc.js";
35
+ import"./index-ddszzne4.js";
36
+ import"./index-vnn7qq8c.js";
37
+ import"./index-6qwp46k0.js";
38
+ import"./index-dsqat5pg.js";
39
+ import"./index-xdy28ngt.js";
38
40
  import"./index-556ja8an.js";
41
+ import"./index-4fwbbad3.js";
39
42
  import"./index-b43rt5ph.js";
40
43
  import"./index-q7sjgr1y.js";
41
- import"./index-4fwbbad3.js";
42
44
  import {
43
45
  resolveHiveKnowledgePath
44
- } from "./index-hk4wa0v1.js";
45
- import"./index-2mbs5q26.js";
46
- import"./index-p4y7jefb.js";
46
+ } from "./index-n0gqre56.js";
47
+ import"./index-p7ey2w90.js";
48
+ import"./index-ynvw5kxc.js";
47
49
  import"./index-gprxjmm7.js";
48
50
  import"./index-n832052r.js";
49
51
  import"./index-4cgee5vh.js";
50
52
  import"./index-z6xqpmqg.js";
51
53
  import"./index-r3mvsbtq.js";
52
- import"./index-4y7g04py.js";
53
- import"./index-tnm9bb8b.js";
54
+ import"./index-dm9tc6qb.js";
55
+ import"./index-57t97rtr.js";
54
56
  import"./index-myt57pht.js";
57
+ import"./index-zjygnfay.js";
55
58
  import"./index-9e6fdz2h.js";
56
59
  import"./index-4rhhvd1a.js";
57
- import"./index-zjygnfay.js";
58
60
  import"./index-ae75rja9.js";
59
- import"./index-3db7xza0.js";
60
- import"./index-s0a4ewkb.js";
61
+ import"./index-r0dactw2.js";
62
+ import"./index-j6q3k628.js";
61
63
  import"./index-bk5tah7q.js";
62
- import"./index-c809a69b.js";
63
- import"./index-vtdwkfbv.js";
64
+ import"./index-kemxyzc0.js";
65
+ import"./index-xagq35tf.js";
64
66
  import"./index-ed5ykebp.js";
65
- import"./index-ttqnhxxq.js";
67
+ import"./index-h1g8w4v0.js";
66
68
  import"./index-7g4c7s5r.js";
67
69
  import"./index-bpmtbmy9.js";
68
70
  import"./index-zgwm4ryv.js";
@@ -6,7 +6,7 @@ import {
6
6
  PluginConfigSchema,
7
7
  init_schema,
8
8
  stripKnownSwarmPrefix
9
- } from "./index-tnm9bb8b.js";
9
+ } from "./index-57t97rtr.js";
10
10
  import {
11
11
  ALL_AGENT_NAMES,
12
12
  init_constants
@@ -7,7 +7,7 @@ import {
7
7
  readLinkPointer,
8
8
  resolveKnowledgeStoreDir,
9
9
  resolveLinkDir
10
- } from "./index-3db7xza0.js";
10
+ } from "./index-r0dactw2.js";
11
11
 
12
12
  // src/knowledge/curation-policy.ts
13
13
  import { appendFile, mkdir as mkdir2, readFile as readFile2 } from "fs/promises";
@@ -92,7 +92,7 @@ var _internals = {
92
92
  symlinkSync: fs.symlinkSync
93
93
  },
94
94
  writeScopeToDisk: async (directory, taskId, files) => {
95
- const { writeScopeToDisk: realWrite } = await import("./scope-persistence-wgxn2kba.js");
95
+ const { writeScopeToDisk: realWrite } = await import("./scope-persistence-tap2q94x.js");
96
96
  return realWrite(directory, taskId, files);
97
97
  },
98
98
  writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
@@ -9,7 +9,7 @@ import {
9
9
  readEvaluationRun,
10
10
  saveEvaluationRun,
11
11
  saveTaskSetSnapshot
12
- } from "./index-y64jrbch.js";
12
+ } from "./index-fv9ddfta.js";
13
13
  import {
14
14
  canonicalHash,
15
15
  computeCandidateInputContentHash,
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-4cgee5vh.js";
5
5
  import {
6
6
  atomicWriteSwarmFileSync
7
- } from "./index-c809a69b.js";
7
+ } from "./index-kemxyzc0.js";
8
8
 
9
9
  // src/hooks/delegation-gate/worktree-provisioning-owner.ts
10
10
  import { createHash } from "crypto";
@@ -21,7 +21,7 @@ var package_default;
21
21
  var init_package = __esm(() => {
22
22
  package_default = {
23
23
  name: "opencode-swarm",
24
- version: "7.154.0",
24
+ version: "7.154.2",
25
25
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
26
26
  main: "dist/index.js",
27
27
  types: "dist/index.d.ts",
@@ -2,23 +2,23 @@
2
2
  import {
3
3
  computePlanStructureHash,
4
4
  derivePlanId
5
- } from "./index-4g00jhbs.js";
5
+ } from "./index-dsqat5pg.js";
6
6
  import {
7
7
  appendCoreEventSync
8
- } from "./index-c6dfyzdh.js";
8
+ } from "./index-xdy28ngt.js";
9
9
  import {
10
10
  unsafePathTextReason
11
11
  } from "./index-556ja8an.js";
12
12
  import {
13
13
  PlanSchema
14
- } from "./index-4y7g04py.js";
14
+ } from "./index-dm9tc6qb.js";
15
15
  import {
16
16
  atomicWriteSwarmFile,
17
17
  atomicWriteSwarmFileSync
18
- } from "./index-c809a69b.js";
18
+ } from "./index-kemxyzc0.js";
19
19
  import {
20
20
  assertProjectRoot
21
- } from "./index-vtdwkfbv.js";
21
+ } from "./index-xagq35tf.js";
22
22
  import {
23
23
  require_proper_lockfile
24
24
  } from "./index-7g4c7s5r.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ALLOWED_SKILL_PATH_PREFIXES,
4
4
  validateSkillPath
5
- } from "./index-qcz4xprd.js";
5
+ } from "./index-xt6jx41g.js";
6
6
  import {
7
7
  withTimeoutSignal
8
8
  } from "./index-q7sjgr1y.js";
@@ -12,11 +12,11 @@ import {
12
12
  resolveHiveKnowledgePath,
13
13
  resolveSwarmKnowledgePath,
14
14
  transactKnowledge
15
- } from "./index-hk4wa0v1.js";
15
+ } from "./index-n0gqre56.js";
16
16
  import {
17
17
  effectiveRetrievalOutcomes,
18
18
  readAuthoritativeKnowledgeCounterRollups
19
- } from "./index-2mbs5q26.js";
19
+ } from "./index-p7ey2w90.js";
20
20
  import {
21
21
  advisoryWarn,
22
22
  init_warning_buffer
@@ -28,7 +28,7 @@ import {
28
28
  import {
29
29
  atomicWriteFileAnyRoot,
30
30
  atomicWriteSwarmFile
31
- } from "./index-c809a69b.js";
31
+ } from "./index-kemxyzc0.js";
32
32
  import {
33
33
  init_logger,
34
34
  log,
@@ -4,13 +4,13 @@ import {
4
4
  } from "./index-4cgee5vh.js";
5
5
  import {
6
6
  atomicWriteSwarmFileSync
7
- } from "./index-c809a69b.js";
7
+ } from "./index-kemxyzc0.js";
8
8
  import {
9
9
  withEvidenceLock
10
- } from "./index-vtdwkfbv.js";
10
+ } from "./index-xagq35tf.js";
11
11
  import {
12
12
  telemetry
13
- } from "./index-ttqnhxxq.js";
13
+ } from "./index-h1g8w4v0.js";
14
14
  import {
15
15
  exports_external,
16
16
  init_zod
@@ -175,7 +175,13 @@ function foldLegacyRegion(filePath, startByte, maxBytes) {
175
175
  try {
176
176
  fd = fs.openSync(filePath, "r");
177
177
  } catch {
178
- return { folded, nextByte: startByte, eof: true, corruptLines };
178
+ return {
179
+ folded,
180
+ nextByte: startByte,
181
+ eof: true,
182
+ aborted: true,
183
+ corruptLines
184
+ };
179
185
  }
180
186
  const processLineBytes = (line) => {
181
187
  if (line.length === 0)
@@ -206,7 +212,13 @@ function foldLegacyRegion(filePath, startByte, maxBytes) {
206
212
  try {
207
213
  const size = fs.fstatSync(fd).size;
208
214
  if (startByte >= size) {
209
- return { folded, nextByte: startByte, eof: true, corruptLines };
215
+ return {
216
+ folded,
217
+ nextByte: startByte,
218
+ eof: true,
219
+ aborted: false,
220
+ corruptLines
221
+ };
210
222
  }
211
223
  const chunk = Buffer.alloc(PR_SUBSCRIPTION_LIMITS.readChunkBytes);
212
224
  let pending = [];
@@ -223,7 +235,13 @@ function foldLegacyRegion(filePath, startByte, maxBytes) {
223
235
  pending = [];
224
236
  pendingLen = 0;
225
237
  oversize = false;
226
- return { folded, nextByte: consumedTo, eof: true, corruptLines };
238
+ return {
239
+ folded,
240
+ nextByte: consumedTo,
241
+ eof: true,
242
+ aborted: false,
243
+ corruptLines
244
+ };
227
245
  };
228
246
  while (true) {
229
247
  const want = Math.min(chunk.length, size - pos);
@@ -263,12 +281,24 @@ function foldLegacyRegion(filePath, startByte, maxBytes) {
263
281
  }
264
282
  if (consumedTo - startByte >= maxBytes && pendingLen === 0 && !oversize) {
265
283
  const eof = consumedTo >= size;
266
- return { folded, nextByte: consumedTo, eof, corruptLines };
284
+ return {
285
+ folded,
286
+ nextByte: consumedTo,
287
+ eof,
288
+ aborted: false,
289
+ corruptLines
290
+ };
267
291
  }
268
292
  }
269
293
  } catch (err) {
270
294
  log(`[pr-monitor] foldLegacyRegion failed: ${err instanceof Error ? err.message : String(err)}`);
271
- return { folded, nextByte: consumedTo, eof: true, corruptLines };
295
+ return {
296
+ folded,
297
+ nextByte: consumedTo,
298
+ eof: true,
299
+ aborted: true,
300
+ corruptLines
301
+ };
272
302
  } finally {
273
303
  try {
274
304
  fs.closeSync(fd);
@@ -379,11 +409,12 @@ function writeCheckpointFile(directory, checkpoint) {
379
409
  }
380
410
  const content = `${JSON.stringify(checkpoint)}
381
411
  `;
382
- if (content.length > PR_SUBSCRIPTION_LIMITS.checkpointHardReadBytes) {
383
- throw new Error(`PR subscription store over checkpoint capacity: ${content.length} bytes > ${PR_SUBSCRIPTION_LIMITS.checkpointHardReadBytes}. The folded state exceeds the bounded checkpoint \u2014 archive or split .swarm/pr-monitor/subscriptions.jsonl (subscriptions can be re-created with /swarm pr subscribe), then remove it.`);
412
+ const contentBytes = Buffer.byteLength(content, "utf-8");
413
+ if (contentBytes > PR_SUBSCRIPTION_LIMITS.checkpointHardReadBytes) {
414
+ throw new Error(`PR subscription store over checkpoint capacity: ${contentBytes} bytes > ${PR_SUBSCRIPTION_LIMITS.checkpointHardReadBytes}. The folded state exceeds the bounded checkpoint \u2014 archive or split .swarm/pr-monitor/subscriptions.jsonl (subscriptions can be re-created with /swarm pr subscribe), then remove it.`);
384
415
  }
385
- if (content.length > PR_SUBSCRIPTION_LIMITS.maxCheckpointBytes) {
386
- log(`[pr-monitor] checkpoint pressure: ${content.length}/${PR_SUBSCRIPTION_LIMITS.maxCheckpointBytes} bytes`);
416
+ if (contentBytes > PR_SUBSCRIPTION_LIMITS.maxCheckpointBytes) {
417
+ log(`[pr-monitor] checkpoint pressure: ${contentBytes}/${PR_SUBSCRIPTION_LIMITS.maxCheckpointBytes} bytes`);
387
418
  }
388
419
  ensureSwarmDir(directory);
389
420
  atomicWriteSwarmFileSync(checkpointPath(directory), content);
@@ -393,7 +424,7 @@ function quarantineCheckpoint(directory, slot) {
393
424
  const to = slot === "foreign" ? foreignSlotPath(directory) : corruptSlotPath(directory);
394
425
  try {
395
426
  try {
396
- fs.unlinkSync(to);
427
+ fs.renameSync(to, `${to}.prev`);
397
428
  } catch {}
398
429
  renameWithRetry(from, to);
399
430
  return true;
@@ -550,6 +581,10 @@ function maybeArchiveLegacy(directory, checkpoint) {
550
581
  log(`[pr-monitor] legacy archive deferred: ${err instanceof Error ? err.message : String(err)}`);
551
582
  return null;
552
583
  }
584
+ try {
585
+ const now = Date.now() / 1000;
586
+ fs.utimesSync(legacyArchivePath(directory), now, now);
587
+ } catch {}
553
588
  migration.archived = true;
554
589
  return { kind: "archive" };
555
590
  }
@@ -570,8 +605,9 @@ function emitHealthTelemetry(trigger, checkpoint) {
570
605
  compactions: checkpoint.maintenance.compactions,
571
606
  corrupt_count: checkpoint.maintenance.corruptLegacyRecords,
572
607
  dropped_audit_count: checkpoint.maintenance.droppedAuditTransitions,
573
- checkpoint_bytes: JSON.stringify(checkpoint).length,
574
- limit_bytes: PR_SUBSCRIPTION_LIMITS.maxCheckpointBytes
608
+ checkpoint_bytes: Buffer.byteLength(JSON.stringify(checkpoint), "utf-8"),
609
+ limit_bytes: PR_SUBSCRIPTION_LIMITS.maxCheckpointBytes,
610
+ recovery_resets: checkpoint.maintenance.resets
575
611
  });
576
612
  }
577
613
  var legacyOverLimitWarned = new Map;
@@ -607,7 +643,8 @@ function overlayLegacy(directory, checkpoint) {
607
643
  usedLegacy: false,
608
644
  absorbed: 0,
609
645
  corruptLines: 0,
610
- overLimit: false
646
+ overLimit: false,
647
+ aborted: false
611
648
  };
612
649
  }
613
650
  if (stat.size > PR_SUBSCRIPTION_LIMITS.legacySourceMaxBytes) {
@@ -617,7 +654,8 @@ function overlayLegacy(directory, checkpoint) {
617
654
  usedLegacy: false,
618
655
  absorbed: 0,
619
656
  corruptLines: 0,
620
- overLimit: true
657
+ overLimit: true,
658
+ aborted: false
621
659
  };
622
660
  }
623
661
  const migration = checkpoint.migration;
@@ -632,7 +670,8 @@ function overlayLegacy(directory, checkpoint) {
632
670
  usedLegacy: true,
633
671
  absorbed: absorbed2,
634
672
  corruptLines: fold2.corruptLines,
635
- overLimit: false
673
+ overLimit: false,
674
+ aborted: fold2.aborted
636
675
  };
637
676
  }
638
677
  if (stat.size === migration.sourceBytes && stat.mtimeMs === migration.sourceMtimeMs) {
@@ -641,7 +680,8 @@ function overlayLegacy(directory, checkpoint) {
641
680
  usedLegacy: false,
642
681
  absorbed: 0,
643
682
  corruptLines: 0,
644
- overLimit: false
683
+ overLimit: false,
684
+ aborted: false
645
685
  };
646
686
  }
647
687
  const fold = foldLegacyRegion(legacy, 0, Number.MAX_SAFE_INTEGER);
@@ -651,7 +691,8 @@ function overlayLegacy(directory, checkpoint) {
651
691
  usedLegacy: true,
652
692
  absorbed,
653
693
  corruptLines: fold.corruptLines,
654
- overLimit: false
694
+ overLimit: false,
695
+ aborted: fold.aborted
655
696
  };
656
697
  }
657
698
  async function loadViewForRead(directory) {
@@ -690,10 +731,19 @@ async function loadViewForRead(directory) {
690
731
  const fold = foldLegacyRegion(legacyPath, 0, Number.MAX_SAFE_INTEGER);
691
732
  const view = {};
692
733
  mergeFoldedRecords(view, fold.folded);
693
- await bootstrapCheckpointFromLegacy(directory, view, fold);
734
+ if (!fold.aborted) {
735
+ await bootstrapCheckpointFromLegacy(directory, view, fold);
736
+ }
694
737
  return { view, recoverySource: "legacy-log" };
695
738
  }
739
+ var bootstrapAttempted = new Map;
696
740
  async function bootstrapCheckpointFromLegacy(directory, foldedView, fold) {
741
+ if (bootstrapAttempted.has(directory))
742
+ return;
743
+ if (bootstrapAttempted.size >= 32) {
744
+ bootstrapAttempted.delete(bootstrapAttempted.keys().next().value);
745
+ }
746
+ bootstrapAttempted.set(directory, true);
697
747
  try {
698
748
  await withEvidenceLock(directory, PR_SUBSCRIPTIONS_FILE, STORE_LOCK_AGENT, STORE_LOCK_TASK, async () => {
699
749
  if (readCheckpoint(directory).kind !== "absent")
@@ -734,17 +784,20 @@ function loadViewForWrite(directory) {
734
784
  if (read.kind === "ok" && sameProjectRoot(read.value.rootPath, directory)) {
735
785
  checkpoint = cloneCheckpoint(read.value);
736
786
  } else if (read.kind === "ok") {
787
+ const displaced = Object.keys(read.value.records).length;
737
788
  quarantineCheckpoint(directory, "foreign");
738
789
  checkpoint = freshCheckpoint(directory);
739
- checkpoint.maintenance.resets += 1;
790
+ checkpoint.maintenance.resets += read.value.maintenance.resets + 1;
740
791
  audit.push({ kind: "foreign-rebind" });
741
792
  dirty = true;
793
+ log(`[pr-monitor] foreign checkpoint quarantined (${displaced} displaced records, recorded root ${read.value.rootPath}); store rebound to ${directory}`);
742
794
  } else if (read.kind === "invalid") {
743
795
  quarantineCheckpoint(directory, "corrupt");
744
796
  checkpoint = freshCheckpoint(directory);
745
797
  checkpoint.maintenance.resets += 1;
746
798
  audit.push({ kind: "corrupt-quarantine" });
747
799
  dirty = true;
800
+ log(`[pr-monitor] corrupt checkpoint quarantined; store rebound to ${directory}`);
748
801
  } else {
749
802
  checkpoint = freshCheckpoint(directory);
750
803
  }
@@ -783,6 +836,26 @@ function loadViewForWrite(directory) {
783
836
  checkpoint.maintenance.corruptLegacyRecords += fold.corruptLines;
784
837
  corruptTotal += fold.corruptLines;
785
838
  cursor = fold.nextByte;
839
+ if (fold.aborted) {
840
+ const progress = cloneCheckpoint(checkpoint);
841
+ progress.records = { ...view };
842
+ progress.migration = {
843
+ scannedBytes: cursor,
844
+ sourceBytes: legacySize,
845
+ sourceMtimeMs: legacyMtime,
846
+ corruptLines: corruptTotal,
847
+ done: false,
848
+ archived: false,
849
+ startedAt
850
+ };
851
+ progress.updatedAt = Date.now();
852
+ progress.sequence += 1;
853
+ writeCheckpointFile(directory, progress);
854
+ checkpoint.sequence = progress.sequence;
855
+ log(`[pr-monitor] legacy scan aborted by an I/O error after ${cursor} bytes \u2014 migration stays incomplete and will retry`);
856
+ dirty = true;
857
+ return { checkpoint, view, audit, dirty };
858
+ }
786
859
  const compactEvent = compactTerminalRecords(view, checkpoint);
787
860
  if (compactEvent)
788
861
  audit.push(compactEvent);
@@ -830,7 +903,7 @@ function loadViewForWrite(directory) {
830
903
  }
831
904
  const overlaid = overlayLegacy(directory, checkpoint);
832
905
  view = overlaid.view;
833
- if (overlaid.usedLegacy) {
906
+ if (overlaid.usedLegacy && !overlaid.aborted) {
834
907
  migration.sourceBytes = legacySize;
835
908
  migration.sourceMtimeMs = legacyMtime;
836
909
  migration.scannedBytes = legacySize;
@@ -14,14 +14,14 @@ import {
14
14
  detectWindowsWrites,
15
15
  getSharedClassifierGuardrailBlock,
16
16
  resolveWriteTargets
17
- } from "./index-1tdsddab.js";
17
+ } from "./index-bxvkn0ye.js";
18
18
  import {
19
19
  checkFileAuthority,
20
20
  classifyFile,
21
21
  isInDeclaredScope,
22
22
  redactPath,
23
23
  redactShellCommand
24
- } from "./index-3hdnfmhp.js";
24
+ } from "./index-xq2v52tt.js";
25
25
 
26
26
  // src/services/guardrail-explain-service.ts
27
27
  import path from "path";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  autoCommitDirty,
4
4
  cleanUntrackedFiles
5
- } from "./index-nkr634n6.js";
5
+ } from "./index-2w6vy9a9.js";
6
6
  import {
7
7
  isPathWithinDeclaredScope,
8
8
  unsafePathTextReason
@@ -26,13 +26,13 @@ import {
26
26
  atomicWriteFile,
27
27
  taskEvidencePath,
28
28
  withTaskEvidenceLock
29
- } from "./index-s0a4ewkb.js";
29
+ } from "./index-j6q3k628.js";
30
30
  import {
31
31
  assertProjectRoot
32
- } from "./index-vtdwkfbv.js";
32
+ } from "./index-xagq35tf.js";
33
33
  import {
34
34
  telemetry
35
- } from "./index-ttqnhxxq.js";
35
+ } from "./index-h1g8w4v0.js";
36
36
  import {
37
37
  exports_external,
38
38
  init_zod