opencode-swarm 7.168.1 → 7.170.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 (146) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +11 -11
  2. package/README.md +1 -0
  3. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  4. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  5. package/dist/ci/evaluate.d.ts +100 -0
  6. package/dist/ci/index.d.ts +13 -0
  7. package/dist/ci/quality-checks.d.ts +58 -0
  8. package/dist/ci/report.d.ts +21 -0
  9. package/dist/ci/runtime.d.ts +81 -0
  10. package/dist/cli/{capability-probe-faqefhah.js → capability-probe-pdwwz8gs.js} +1 -1
  11. package/dist/cli/{coder-settlement-54a3d97g.js → coder-settlement-65zx1bet.js} +12 -12
  12. package/dist/cli/{config-doctor-vzp6b3ng.js → config-doctor-c30rss1c.js} +2 -2
  13. package/dist/cli/{core-yynse50x.js → core-8wkbr1tr.js} +5 -2
  14. package/dist/cli/{curation-policy-mgwv8h2k.js → curation-policy-k74qz9ms.js} +5 -5
  15. package/dist/cli/{curator-drift-k0zrnm09.js → curator-drift-3ssjr0nx.js} +5 -5
  16. package/dist/cli/curator-llm-factory-jkjqasfs.js +72 -0
  17. package/dist/cli/{curator-agdhhzqt.js → curator-pckzk1q4.js} +40 -39
  18. package/dist/cli/{dispatch-8ks9dyk5.js → dispatch-hwwj3qrb.js} +2 -2
  19. package/dist/cli/{evidence-summary-service-6mmcekr7.js → evidence-summary-service-4ydcapke.js} +17 -17
  20. package/dist/cli/{gate-evidence-xqvkqhrk.js → gate-evidence-xwqfky3m.js} +7 -7
  21. package/dist/cli/guardrail-explain-fe2veh2s.js +73 -0
  22. package/dist/cli/{guardrail-log-5wa5c77w.js → guardrail-log-z38j69bx.js} +8 -8
  23. package/dist/cli/{guardrail-reset-dh78tbcf.js → guardrail-reset-mmnzt4mz.js} +40 -39
  24. package/dist/cli/hive-promoter-68hrw1y1.js +87 -0
  25. package/dist/cli/{index-gmpmgtzn.js → index-06rbdzqn.js} +5 -5
  26. package/dist/cli/index-0hgmsyfp.js +92 -0
  27. package/dist/cli/{index-f1fps3w9.js → index-0xprxg95.js} +7 -7
  28. package/dist/cli/{index-p612v1mv.js → index-2s7dvzff.js} +200 -51
  29. package/dist/cli/{index-qthc56c4.js → index-31sqcdsd.js} +4 -4
  30. package/dist/cli/{index-y85aptep.js → index-3axdtaf0.js} +7 -7
  31. package/dist/cli/{index-9b2105n0.js → index-3eh2n3dx.js} +2 -2
  32. package/dist/cli/{index-w1dfkp1q.js → index-3p3y55xg.js} +15 -15
  33. package/dist/cli/{index-apy1qfj0.js → index-4wc5gfgm.js} +26 -4
  34. package/dist/cli/{index-d5qf7hvh.js → index-5400m33a.js} +1 -1
  35. package/dist/cli/{index-qkwtth00.js → index-59fcfpkh.js} +197 -35
  36. package/dist/cli/{index-j0bxxz9d.js → index-5bbem0ey.js} +8 -8
  37. package/dist/cli/{index-qwsh0h2g.js → index-5qt9yf5w.js} +4 -4
  38. package/dist/cli/{index-q1r1cfww.js → index-76qm2c2y.js} +37 -26
  39. package/dist/cli/{index-qhey6vc3.js → index-7h01bkm6.js} +2 -2
  40. package/dist/cli/{index-6df6wbvj.js → index-8w1mrvbd.js} +8 -8
  41. package/dist/cli/{index-8ybjqg51.js → index-9ttqbhvw.js} +1 -1
  42. package/dist/cli/{index-xhb4gryr.js → index-9xk97bcf.js} +4 -4
  43. package/dist/cli/{index-kear8gb7.js → index-b3pmzbh1.js} +2 -2
  44. package/dist/cli/{index-h439y187.js → index-bernkwgf.js} +1 -1
  45. package/dist/cli/{index-m35hybf0.js → index-bm5xrfnx.js} +1 -1
  46. package/dist/cli/{index-pyf517sz.js → index-br3mvbsa.js} +2 -2
  47. package/dist/cli/{index-4r5pmtvk.js → index-bx1wgn3a.js} +4 -4
  48. package/dist/cli/{index-nwwk3dej.js → index-cgpwjctj.js} +1 -1
  49. package/dist/cli/{index-wst6n478.js → index-dvbf6fpn.js} +1 -1
  50. package/dist/cli/{index-a8xbvsse.js → index-fgp96k3r.js} +2 -2
  51. package/dist/cli/{index-5zqakgp4.js → index-fhh02gwx.js} +3 -3
  52. package/dist/cli/{index-dfyv3xkd.js → index-gfbggp8k.js} +9 -9
  53. package/dist/cli/{index-kkmezerc.js → index-j144fgk8.js} +4831 -2776
  54. package/dist/cli/{index-xkf3672y.js → index-mjn6aqqk.js} +2 -2
  55. package/dist/cli/{index-3jmb4ppa.js → index-n0d5hrs4.js} +2 -2
  56. package/dist/cli/{index-v3xc4sde.js → index-nbdmdyke.js} +2 -1
  57. package/dist/cli/{index-z6qreakh.js → index-nprdr0sm.js} +6 -4
  58. package/dist/cli/{index-bvqqwx84.js → index-nyn01yrz.js} +2 -2
  59. package/dist/cli/{index-q8091q8b.js → index-p6fj7qz7.js} +3 -3
  60. package/dist/cli/{index-gh9ybrrs.js → index-pw00xcj0.js} +7 -7
  61. package/dist/cli/{index-bw9x8d8n.js → index-r1z8nrb6.js} +5 -5
  62. package/dist/cli/{index-2xbww1x0.js → index-ssx8087p.js} +7 -7
  63. package/dist/cli/{index-4kv1ew3q.js → index-t73888m0.js} +1 -1
  64. package/dist/cli/{index-91ww9hyr.js → index-td6xrw55.js} +1 -1
  65. package/dist/cli/{index-gp9yzr1v.js → index-xnpjwc4h.js} +1 -1
  66. package/dist/cli/{index-yt9n9zt3.js → index-xztkjj3c.js} +48 -41
  67. package/dist/cli/{index-5g6rhkn7.js → index-ye43mdfm.js} +36 -1
  68. package/dist/cli/{index-w3x1dmrf.js → index-z5vas8c3.js} +40 -39
  69. package/dist/cli/{index-chebm5h5.js → index-zw3hkzch.js} +3 -3
  70. package/dist/cli/index.js +45 -39
  71. package/dist/cli/{knowledge-escalator-135dz4eh.js → knowledge-escalator-pz2faktx.js} +13 -13
  72. package/dist/cli/{knowledge-events-27gwv47q.js → knowledge-events-s6s8qedx.js} +11 -11
  73. package/dist/cli/{knowledge-link-dr3xnwyd.js → knowledge-link-rkxfrmhm.js} +4 -4
  74. package/dist/cli/{knowledge-store-80m44bfw.js → knowledge-store-dgv3xw3h.js} +5 -5
  75. package/dist/cli/{knowledge-validator-crsfb2cc.js → knowledge-validator-22qppdyv.js} +7 -7
  76. package/dist/cli/{pending-delegations-gwgjzzkz.js → pending-delegations-4r21nf9d.js} +12 -12
  77. package/dist/cli/{pr-subscriptions-g633nhz4.js → pr-subscriptions-d52xy3zd.js} +12 -12
  78. package/dist/cli/{pr-workflow-gate-4dc5nt2e.js → pr-workflow-gate-0de81kzw.js} +40 -39
  79. package/dist/cli/{runner-k0ycgv8x.js → runner-1dwrgyyr.js} +6 -6
  80. package/dist/cli/{scan-cursor-avxjsm4w.js → scan-cursor-ahbbejab.js} +6 -6
  81. package/dist/cli/{schema-3ja77k4y.js → schema-17h2hcw9.js} +5 -1
  82. package/dist/cli/{scope-persistence-f540tc50.js → scope-persistence-gcn3zm5e.js} +14 -14
  83. package/dist/cli/{skill-generator-kcqqpg1g.js → skill-generator-hkqr5qs7.js} +15 -15
  84. package/dist/cli/{snapshot-coordination-init-e4s8bn4p.js → snapshot-coordination-init-ms36zxv6.js} +40 -39
  85. package/dist/cli/{telemetry-2wzapf11.js → telemetry-fdtaemnv.js} +1 -1
  86. package/dist/cli/{workspace-snapshot-rkgxhj9b.js → workspace-snapshot-hkz2wt1c.js} +4 -4
  87. package/dist/cli/{worktree-collision-ownership-rk9gz638.js → worktree-collision-ownership-7v7gg511.js} +18 -104
  88. package/dist/cli/{worktree-isolation-1bdzfgky.js → worktree-isolation-nanamt25.js} +40 -39
  89. package/dist/commands/ci.d.ts +40 -0
  90. package/dist/commands/destructive-purge.d.ts +85 -0
  91. package/dist/commands/index.d.ts +1 -0
  92. package/dist/commands/registry.d.ts +10 -2
  93. package/dist/commands/reset-session.d.ts +5 -1
  94. package/dist/config/constants.d.ts +4 -1
  95. package/dist/config/lane-context.d.ts +19 -0
  96. package/dist/config/schema.d.ts +77 -0
  97. package/dist/evaluation/index.d.ts +1 -0
  98. package/dist/evaluation/retrieval-quality.d.ts +116 -0
  99. package/dist/failures/invocation-failure.d.ts +23 -4
  100. package/dist/hooks/gate-denial-tracker.d.ts +18 -14
  101. package/dist/hooks/init-orphan-recovery.d.ts +7 -0
  102. package/dist/hooks/pr-workflow-gate.d.ts +8 -2
  103. package/dist/index.js +616 -608
  104. package/dist/memory/embeddings/reranker.d.ts +13 -2
  105. package/dist/memory/evaluation.d.ts +99 -0
  106. package/dist/memory/heldout-evaluation-corpus.d.ts +51 -0
  107. package/dist/memory/index.d.ts +5 -2
  108. package/dist/memory/sqlite-provider.d.ts +35 -1
  109. package/dist/memory/types.d.ts +14 -0
  110. package/dist/observability/otel-mapping.d.ts +5 -5
  111. package/dist/observability/otlp-exporter.d.ts +80 -0
  112. package/dist/parallel/lane-owners.d.ts +76 -0
  113. package/dist/sandbox/macos/sandbox-exec-executor.d.ts +48 -11
  114. package/dist/tools/repo-graph/query.d.ts +6 -1
  115. package/dist/tools/repo-graph/types.d.ts +13 -4
  116. package/dist/utils/bun-compat.d.ts +20 -0
  117. package/dist/utils/gitignore-warning.d.ts +5 -2
  118. package/dist/worktree/base-migration.d.ts +55 -0
  119. package/dist/worktree/core.d.ts +15 -6
  120. package/dist/worktree/ownership.d.ts +66 -0
  121. package/opencode-swarm.schema.json +97 -0
  122. package/package.json +4 -2
  123. package/tests/fixtures/memory-recall-heldout/manifest.json +311 -0
  124. package/tests/fixtures/memory-recall-heldout/sources/bash.sh +1 -0
  125. package/tests/fixtures/memory-recall-heldout/sources/c.c +1 -0
  126. package/tests/fixtures/memory-recall-heldout/sources/cpp.cpp +1 -0
  127. package/tests/fixtures/memory-recall-heldout/sources/csharp.cs +1 -0
  128. package/tests/fixtures/memory-recall-heldout/sources/css.css +3 -0
  129. package/tests/fixtures/memory-recall-heldout/sources/dart.dart +1 -0
  130. package/tests/fixtures/memory-recall-heldout/sources/go.go +3 -0
  131. package/tests/fixtures/memory-recall-heldout/sources/ini.ini +2 -0
  132. package/tests/fixtures/memory-recall-heldout/sources/java.java +1 -0
  133. package/tests/fixtures/memory-recall-heldout/sources/javascript.js +3 -0
  134. package/tests/fixtures/memory-recall-heldout/sources/kotlin.kt +1 -0
  135. package/tests/fixtures/memory-recall-heldout/sources/php.php +1 -0
  136. package/tests/fixtures/memory-recall-heldout/sources/powershell.ps1 +1 -0
  137. package/tests/fixtures/memory-recall-heldout/sources/python.py +2 -0
  138. package/tests/fixtures/memory-recall-heldout/sources/regex.regex +1 -0
  139. package/tests/fixtures/memory-recall-heldout/sources/ruby.rb +3 -0
  140. package/tests/fixtures/memory-recall-heldout/sources/rust.rs +1 -0
  141. package/tests/fixtures/memory-recall-heldout/sources/swift.swift +1 -0
  142. package/tests/fixtures/memory-recall-heldout/sources/tsx.tsx +3 -0
  143. package/tests/fixtures/memory-recall-heldout/sources/typescript.ts +3 -0
  144. package/dist/cli/curator-llm-factory-ygxd6hfx.js +0 -71
  145. package/dist/cli/guardrail-explain-vjtjhgzs.js +0 -72
  146. package/dist/cli/hive-promoter-3czsx7c6.js +0 -86
@@ -1,7 +1,16 @@
1
1
  // @bun
2
+ import {
3
+ validateSwarmPath
4
+ } from "./index-b3pmzbh1.js";
2
5
  import {
3
6
  bunSpawn
4
- } from "./index-p612v1mv.js";
7
+ } from "./index-2s7dvzff.js";
8
+ import {
9
+ atomicWriteSwarmFileSync
10
+ } from "./index-nbdmdyke.js";
11
+ import {
12
+ canonicalRootKeyFresh
13
+ } from "./index-1xnse449.js";
5
14
  import {
6
15
  init_git_executable,
7
16
  resolveGitExecutable
@@ -15,6 +24,7 @@ import {
15
24
  init_constants
16
25
  } from "./index-sxt7fgcw.js";
17
26
  import {
27
+ init_logger,
18
28
  log
19
29
  } from "./index-zgwm4ryv.js";
20
30
  import {
@@ -23,7 +33,7 @@ import {
23
33
 
24
34
  // src/worktree/core.ts
25
35
  init_constants();
26
- import * as fs from "fs";
36
+ import * as fs2 from "fs";
27
37
  import * as fsPromises from "fs/promises";
28
38
  import * as os from "os";
29
39
  import * as path from "path";
@@ -68,10 +78,152 @@ function matchSwarmLaneBranch(branch) {
68
78
  return;
69
79
  }
70
80
 
81
+ // src/parallel/lane-owners.ts
82
+ import * as fs from "fs";
83
+ init_logger();
84
+ var LIVE_LANE_OWNERS_PATH = "live-lane-owners.json";
85
+ var MAX_LIVE_LANE_OWNERS = 256;
86
+ var MAX_LIVE_LANE_OWNERS_BYTES = 128 * 1024;
87
+ var LIVE_LANE_OWNER_CLAIM_WINDOW_MS = 24 * 60 * 60 * 1000;
88
+ var _internals = {
89
+ readFileSync: fs.readFileSync,
90
+ rmSync: fs.rmSync.bind(fs),
91
+ statSync: fs.statSync,
92
+ atomicWriteSwarmFileSync,
93
+ now: () => Date.now(),
94
+ kill: (pid, signal) => {
95
+ process.kill(pid, signal);
96
+ return true;
97
+ },
98
+ process: { pid: process.pid }
99
+ };
100
+ function storePath(directory) {
101
+ return validateSwarmPath(directory, LIVE_LANE_OWNERS_PATH);
102
+ }
103
+ function isLiveLaneOwnerEntry(value) {
104
+ if (!value || typeof value !== "object" || Array.isArray(value))
105
+ return false;
106
+ const c = value;
107
+ return typeof c.lanePath === "string" && c.lanePath.length > 0 && typeof c.branchName === "string" && typeof c.sessionId === "string" && typeof c.taskId === "string" && typeof c.ownerPid === "number" && Number.isInteger(c.ownerPid) && c.ownerPid > 0 && typeof c.startedAt === "number" && Number.isFinite(c.startedAt);
108
+ }
109
+ function readStore(directory) {
110
+ try {
111
+ const raw = _internals.readFileSync(storePath(directory), "utf-8");
112
+ if (raw.length > MAX_LIVE_LANE_OWNERS_BYTES) {
113
+ return { schemaVersion: 1, entries: [] };
114
+ }
115
+ const parsed = JSON.parse(raw);
116
+ if (!parsed || parsed.schemaVersion !== 1 || !Array.isArray(parsed.entries)) {
117
+ return { schemaVersion: 1, entries: [] };
118
+ }
119
+ return {
120
+ schemaVersion: 1,
121
+ entries: parsed.entries.filter(isLiveLaneOwnerEntry)
122
+ };
123
+ } catch {
124
+ return { schemaVersion: 1, entries: [] };
125
+ }
126
+ }
127
+ function writeStore(directory, store) {
128
+ let entries = store.entries.slice(-MAX_LIVE_LANE_OWNERS);
129
+ for (;; ) {
130
+ const serialized = JSON.stringify({ schemaVersion: 1, entries }, null, 2);
131
+ if (serialized.length <= MAX_LIVE_LANE_OWNERS_BYTES || entries.length === 0) {
132
+ if (entries.length < store.entries.length) {
133
+ log(`[lane-owners] store bound dropped ${store.entries.length - entries.length} oldest entries (caps: ${MAX_LIVE_LANE_OWNERS} entries / ${MAX_LIVE_LANE_OWNERS_BYTES} bytes)`);
134
+ }
135
+ if (entries.length === 0) {
136
+ try {
137
+ _internals.rmSync(storePath(directory), { force: true });
138
+ } catch {}
139
+ return;
140
+ }
141
+ _internals.atomicWriteSwarmFileSync(storePath(directory), serialized);
142
+ return;
143
+ }
144
+ entries = entries.slice(1);
145
+ }
146
+ }
147
+ function recordLiveLaneOwner(directory, entry) {
148
+ try {
149
+ const store = readStore(directory);
150
+ const filtered = store.entries.filter((e) => e.lanePath !== entry.lanePath && canonicalRootKeyFresh(e.lanePath) !== canonicalRootKeyFresh(entry.lanePath));
151
+ filtered.push({
152
+ ...entry,
153
+ ownerPid: _internals.process.pid,
154
+ startedAt: _internals.now()
155
+ });
156
+ writeStore(directory, { schemaVersion: 1, entries: filtered });
157
+ } catch (error) {
158
+ log(`[lane-owners] could not record live lane owner ${entry.lanePath}: ${error instanceof Error ? error.message : String(error)}`);
159
+ }
160
+ }
161
+ function clearLiveLaneOwner(directory, lanePath) {
162
+ try {
163
+ const store = readStore(directory);
164
+ const canonical = canonicalRootKeyFresh(lanePath);
165
+ const filtered = store.entries.filter((e) => e.lanePath !== lanePath && canonicalRootKeyFresh(e.lanePath) !== canonical);
166
+ if (filtered.length === store.entries.length)
167
+ return;
168
+ writeStore(directory, { schemaVersion: 1, entries: filtered });
169
+ } catch (error) {
170
+ log(`[lane-owners] could not clear live lane owner ${lanePath}: ${error instanceof Error ? error.message : String(error)}`);
171
+ }
172
+ }
173
+ function pidAlive(pid) {
174
+ try {
175
+ _internals.kill(pid, 0);
176
+ return true;
177
+ } catch (error) {
178
+ const code = error.code;
179
+ return code === "EPERM";
180
+ }
181
+ }
182
+ function pathExists(target) {
183
+ try {
184
+ _internals.statSync(target);
185
+ return true;
186
+ } catch {
187
+ return false;
188
+ }
189
+ }
190
+ function listLiveLaneOwners(directory) {
191
+ const store = readStore(directory);
192
+ const now = _internals.now();
193
+ const live = [];
194
+ const reaped = [];
195
+ const kept = [];
196
+ for (const entry of store.entries) {
197
+ if (!pathExists(entry.lanePath)) {
198
+ reaped.push(entry);
199
+ continue;
200
+ }
201
+ if (now - entry.startedAt > LIVE_LANE_OWNER_CLAIM_WINDOW_MS) {
202
+ reaped.push(entry);
203
+ continue;
204
+ }
205
+ if (!pidAlive(entry.ownerPid)) {
206
+ kept.push(entry);
207
+ continue;
208
+ }
209
+ live.push(entry);
210
+ kept.push(entry);
211
+ }
212
+ if (reaped.length > 0) {
213
+ try {
214
+ writeStore(directory, { schemaVersion: 1, entries: kept });
215
+ } catch (error) {
216
+ log(`[lane-owners] could not persist reap: ${error instanceof Error ? error.message : String(error)}`);
217
+ }
218
+ }
219
+ return { live, reaped };
220
+ }
221
+
71
222
  // src/worktree/core.ts
72
223
  init_warning_buffer();
73
224
  init_git_executable();
74
- var _internals = {
225
+ var _internals2 = {
226
+ clearLiveLaneOwner,
75
227
  bunSpawn,
76
228
  resolveGitExecutable,
77
229
  platform: process.platform,
@@ -86,13 +238,13 @@ var _internals = {
86
238
  return value === "" ? undefined : value;
87
239
  },
88
240
  fs: {
89
- existsSync: fs.existsSync,
241
+ existsSync: fs2.existsSync,
90
242
  cp: fsPromises.cp,
91
- cpSync: fs.cpSync,
92
- symlinkSync: fs.symlinkSync
243
+ cpSync: fs2.cpSync,
244
+ symlinkSync: fs2.symlinkSync
93
245
  },
94
246
  writeScopeToDisk: async (directory, taskId, files) => {
95
- const { writeScopeToDisk: realWrite } = await import("./scope-persistence-f540tc50.js");
247
+ const { writeScopeToDisk: realWrite } = await import("./scope-persistence-gcn3zm5e.js");
96
248
  return realWrite(directory, taskId, files);
97
249
  },
98
250
  writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
@@ -122,16 +274,16 @@ async function writeLaneProfileToDiskReal(worktreePath, laneIndex, envOverrides)
122
274
  if (lines.length === 0)
123
275
  return;
124
276
  const lanesDir = path.join(worktreePath, ".swarm", "lanes");
125
- await fs.promises.mkdir(lanesDir, { recursive: true });
277
+ await fs2.promises.mkdir(lanesDir, { recursive: true });
126
278
  const envPath = path.join(lanesDir, `${laneIndex}.env`);
127
- await fs.promises.writeFile(envPath, `${lines.join(`
279
+ await fs2.promises.writeFile(envPath, `${lines.join(`
128
280
  `)}
129
281
  `, "utf-8");
130
282
  }
131
283
  async function removeLaneProfileFromDiskReal(worktreePath, laneIndex) {
132
284
  const envPath = path.join(worktreePath, ".swarm", "lanes", `${laneIndex}.env`);
133
285
  try {
134
- await fs.promises.unlink(envPath);
286
+ await fs2.promises.unlink(envPath);
135
287
  } catch (err) {
136
288
  if (err.code !== "ENOENT") {
137
289
  log(`[worktree] Failed to remove lane profile ${envPath}: ${err.message}`);
@@ -145,7 +297,7 @@ var GIT_SPAWN_FAILURE_EXIT_CODE = 1;
145
297
  async function runGit(args, cwd, timeoutMs = WORKTREE_TIMEOUT_MS) {
146
298
  let proc;
147
299
  try {
148
- proc = _internals.bunSpawn([_internals.resolveGitExecutable(), ...args], {
300
+ proc = _internals2.bunSpawn([_internals2.resolveGitExecutable(), ...args], {
149
301
  cwd,
150
302
  timeout: timeoutMs,
151
303
  stdin: "ignore",
@@ -165,6 +317,12 @@ async function runGit(args, cwd, timeoutMs = WORKTREE_TIMEOUT_MS) {
165
317
  const stdout = await proc.stdout.text();
166
318
  const stderr = await proc.stderr.text();
167
319
  return { exitCode, stdout, stderr };
320
+ } catch {
321
+ return {
322
+ exitCode: GIT_SPAWN_FAILURE_EXIT_CODE,
323
+ stdout: "",
324
+ stderr: `git ${args[0] ?? "command"} output could not be read in ${cwd}`
325
+ };
168
326
  } finally {
169
327
  try {
170
328
  proc.kill();
@@ -172,19 +330,19 @@ async function runGit(args, cwd, timeoutMs = WORKTREE_TIMEOUT_MS) {
172
330
  }
173
331
  }
174
332
  async function checkPathBudget(worktreeRoot, directory) {
175
- if (_internals.platform !== "win32") {
333
+ if (_internals2.platform !== "win32") {
176
334
  return { ok: true };
177
335
  }
178
336
  let longPaths;
179
337
  try {
180
- longPaths = await _internals.getCoreLongPaths(directory);
338
+ longPaths = await _internals2.getCoreLongPaths(directory);
181
339
  } catch {}
182
340
  if (longPaths === "true") {
183
341
  return { ok: true };
184
342
  }
185
343
  let proc;
186
344
  try {
187
- proc = _internals.bunSpawn([_internals.resolveGitExecutable(), "ls-files"], {
345
+ proc = _internals2.bunSpawn([_internals2.resolveGitExecutable(), "ls-files"], {
188
346
  cwd: directory,
189
347
  timeout: WORKTREE_TIMEOUT_MS,
190
348
  stdin: "ignore",
@@ -217,6 +375,8 @@ async function checkPathBudget(worktreeRoot, directory) {
217
375
  };
218
376
  }
219
377
  return { ok: true };
378
+ } catch {
379
+ return { ok: true };
220
380
  } finally {
221
381
  try {
222
382
  proc.kill();
@@ -224,9 +384,9 @@ async function checkPathBudget(worktreeRoot, directory) {
224
384
  }
225
385
  }
226
386
  function shortenWorktreePath(_directory, sessionId, laneId) {
227
- let tmp = _internals.osTmpdir();
387
+ let tmp = _internals2.osTmpdir();
228
388
  try {
229
- tmp = fs.realpathSync(tmp);
389
+ tmp = fs2.realpathSync(tmp);
230
390
  } catch {}
231
391
  return path.join(tmp, "swwt", sessionId, laneId);
232
392
  }
@@ -234,13 +394,13 @@ function makeWorktreeBranchName(sessionId, id, options) {
234
394
  return buildSwarmBranchName(sessionId, id, options.purpose, options.branchStyle === "legacy-lane" && options.purpose === "lane");
235
395
  }
236
396
  function resolveWorktreeBaseDir(directory, worktreeDir) {
237
- return worktreeDir ? path.resolve(directory, worktreeDir) : path.resolve(path.dirname(directory), SWARM_WORKTREE_DIR_NAME);
397
+ return worktreeDir ? path.resolve(directory, worktreeDir) : path.resolve(directory, SWARM_WORKTREE_DIR_NAME);
238
398
  }
239
399
  function isPathUnderSwarmWorktreeBase(targetPath, directory, worktreeDirOverrides = []) {
240
400
  const caseInsensitive = process.platform === "win32";
241
401
  let realTarget;
242
402
  try {
243
- realTarget = fs.realpathSync(path.resolve(directory, targetPath));
403
+ realTarget = fs2.realpathSync(path.resolve(directory, targetPath));
244
404
  } catch {
245
405
  return false;
246
406
  }
@@ -252,7 +412,7 @@ function isPathUnderSwarmWorktreeBase(targetPath, directory, worktreeDirOverride
252
412
  return bases.some((base) => {
253
413
  let realBase;
254
414
  try {
255
- realBase = fs.realpathSync(base);
415
+ realBase = fs2.realpathSync(base);
256
416
  } catch {
257
417
  realBase = path.resolve(base);
258
418
  }
@@ -290,7 +450,7 @@ async function provisionWorktree(directory, id, sessionId, options) {
290
450
  const normalizeGitPath = (p) => {
291
451
  const lexical = p.replace(/\\/g, "/").replace(/\/+$/, "");
292
452
  try {
293
- return fs.realpathSync(p).replace(/\\/g, "/").replace(/\/+$/, "");
453
+ return fs2.realpathSync(p).replace(/\\/g, "/").replace(/\/+$/, "");
294
454
  } catch {
295
455
  return lexical;
296
456
  }
@@ -417,16 +577,16 @@ async function provisionWorktree(directory, id, sessionId, options) {
417
577
  if (strategy !== "skip") {
418
578
  const hostDepDir = path.join(directory, "node_modules");
419
579
  const laneDepDir = path.join(worktreePath, "node_modules");
420
- if (_internals.fs.existsSync(hostDepDir)) {
580
+ if (_internals2.fs.existsSync(hostDepDir)) {
421
581
  try {
422
582
  if (strategy === "copy") {
423
- await _internals.fs.cp(hostDepDir, laneDepDir, {
583
+ await _internals2.fs.cp(hostDepDir, laneDepDir, {
424
584
  recursive: true,
425
585
  force: true
426
586
  });
427
587
  } else if (strategy === "link") {
428
- const isWindows = _internals.platform === "win32";
429
- _internals.fs.symlinkSync(hostDepDir, laneDepDir, isWindows ? "junction" : "dir");
588
+ const isWindows = _internals2.platform === "win32";
589
+ _internals2.fs.symlinkSync(hostDepDir, laneDepDir, isWindows ? "junction" : "dir");
430
590
  }
431
591
  } catch (e) {
432
592
  log(`[swarm] deps_strategy '${strategy}' preparation failed for ${id}: ${e instanceof Error ? e.message : String(e)}`);
@@ -439,12 +599,12 @@ async function provisionWorktree(directory, id, sessionId, options) {
439
599
  }
440
600
  if (options.scope?.taskId && Array.isArray(options.scope.files)) {
441
601
  try {
442
- await _internals.writeScopeToDisk(worktreePath, options.scope.taskId, options.scope.files);
602
+ await _internals2.writeScopeToDisk(worktreePath, options.scope.taskId, options.scope.files);
443
603
  } catch {}
444
604
  }
445
605
  if (options.laneProfile) {
446
606
  try {
447
- await _internals.writeLaneProfileToDisk(worktreePath, options.laneProfile.laneIndex, options.laneProfile.envOverrides);
607
+ await _internals2.writeLaneProfileToDisk(worktreePath, options.laneProfile.laneIndex, options.laneProfile.envOverrides);
448
608
  } catch {}
449
609
  }
450
610
  return {
@@ -456,14 +616,15 @@ async function provisionWorktree(directory, id, sessionId, options) {
456
616
  };
457
617
  }
458
618
  async function removeWorktree(worktreePath, projectRoot, options) {
459
- const isWindows = _internals.platform === "win32";
619
+ const isWindows = _internals2.platform === "win32";
460
620
  const MAX_RETRIES = 4;
461
621
  const RETRY_DELAY_MS = 2000;
462
622
  let lastError = "";
463
623
  for (let attempt = 0;attempt < MAX_RETRIES; attempt++) {
464
624
  const result = await runGit(["worktree", "remove", worktreePath], projectRoot);
465
625
  if (result.exitCode === 0) {
466
- if (fs.existsSync(worktreePath)) {
626
+ _internals2.clearLiveLaneOwner(projectRoot, worktreePath);
627
+ if (fs2.existsSync(worktreePath)) {
467
628
  const trusted = isPathUnderSwarmWorktreeBase(worktreePath, projectRoot, options?.worktreeDir ? [options.worktreeDir] : []);
468
629
  if (!trusted) {
469
630
  return {
@@ -471,13 +632,13 @@ async function removeWorktree(worktreePath, projectRoot, options) {
471
632
  };
472
633
  }
473
634
  try {
474
- fs.rmSync(worktreePath, { recursive: true, force: true });
635
+ fs2.rmSync(worktreePath, { recursive: true, force: true });
475
636
  } catch (error) {
476
637
  return {
477
638
  error: `git removed the worktree registration but residual directory cleanup failed: ${error instanceof Error ? error.message : String(error)}`
478
639
  };
479
640
  }
480
- if (fs.existsSync(worktreePath)) {
641
+ if (fs2.existsSync(worktreePath)) {
481
642
  return {
482
643
  error: "git removed the worktree registration but the residual directory still exists after cleanup"
483
644
  };
@@ -487,21 +648,22 @@ async function removeWorktree(worktreePath, projectRoot, options) {
487
648
  }
488
649
  lastError = result.stderr.trim() || result.stdout.trim();
489
650
  if (isWindows && (lastError.includes("EBUSY") || lastError.includes("EPERM")) && attempt < MAX_RETRIES - 1) {
490
- await _internals.sleep(RETRY_DELAY_MS);
651
+ await _internals2.sleep(RETRY_DELAY_MS);
491
652
  continue;
492
653
  }
493
654
  if (options?.force && isPathUnderSwarmWorktreeBase(worktreePath, projectRoot, options.worktreeDir ? [options.worktreeDir] : [])) {
494
655
  const forced = await runGit(["worktree", "remove", "--force", worktreePath], projectRoot);
495
656
  if (forced.exitCode === 0) {
496
- if (fs.existsSync(worktreePath)) {
657
+ _internals2.clearLiveLaneOwner(projectRoot, worktreePath);
658
+ if (fs2.existsSync(worktreePath)) {
497
659
  try {
498
- fs.rmSync(worktreePath, { recursive: true, force: true });
660
+ fs2.rmSync(worktreePath, { recursive: true, force: true });
499
661
  } catch (error) {
500
662
  return {
501
663
  error: `git force-removed the worktree registration but residual directory cleanup failed: ${error instanceof Error ? error.message : String(error)}`
502
664
  };
503
665
  }
504
- if (fs.existsSync(worktreePath)) {
666
+ if (fs2.existsSync(worktreePath)) {
505
667
  return {
506
668
  error: "git force-removed the worktree registration but the residual directory still exists after cleanup"
507
669
  };
@@ -626,4 +788,4 @@ async function assertCleanWorkingTree(directory) {
626
788
  return { clean: true };
627
789
  }
628
790
 
629
- export { _internals, writeLaneProfileToDiskReal, removeLaneProfileFromDiskReal, checkPathBudget, shortenWorktreePath, makeWorktreeBranchName, resolveWorktreeBaseDir, isPathUnderSwarmWorktreeBase, provisionWorktree, removeWorktree, isCleanWorktree, autoCommitDirty, cleanUntrackedFiles, assertCleanWorkingTree };
791
+ export { recordLiveLaneOwner, listLiveLaneOwners, _internals2 as _internals, writeLaneProfileToDiskReal, removeLaneProfileFromDiskReal, checkPathBudget, shortenWorktreePath, makeWorktreeBranchName, resolveWorktreeBaseDir, isPathUnderSwarmWorktreeBase, provisionWorktree, removeWorktree, isCleanWorktree, autoCommitDirty, cleanUntrackedFiles, assertCleanWorkingTree };
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  captureWorkspaceSnapshotAsync,
4
4
  changedFilesSinceSnapshotAsync
5
- } from "./index-5zqakgp4.js";
5
+ } from "./index-fhh02gwx.js";
6
6
  import {
7
7
  removeWorktreeProvisioningOwner
8
- } from "./index-bvqqwx84.js";
8
+ } from "./index-nyn01yrz.js";
9
9
  import {
10
10
  SOURCE_WORKTREE_GONE_STAGE,
11
11
  ensureTaskGateRequirementsReceiptForSettledTransition,
@@ -14,16 +14,16 @@ import {
14
14
  reconcileLandedMerge,
15
15
  withTaskEvidenceTransaction,
16
16
  writeWorkflowWalFile
17
- } from "./index-gmpmgtzn.js";
17
+ } from "./index-06rbdzqn.js";
18
18
  import {
19
19
  validateSwarmPath
20
- } from "./index-kear8gb7.js";
20
+ } from "./index-b3pmzbh1.js";
21
21
  import {
22
22
  appendCoreEventSync
23
- } from "./index-a8xbvsse.js";
23
+ } from "./index-fgp96k3r.js";
24
24
  import {
25
25
  tryAcquireLock
26
- } from "./index-4r5pmtvk.js";
26
+ } from "./index-bx1wgn3a.js";
27
27
  import {
28
28
  canonicalRootKeyFresh
29
29
  } from "./index-1xnse449.js";
@@ -489,7 +489,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
489
489
  awaitingMergeByCallID,
490
490
  cleanupStandardWorktreeForCallId,
491
491
  standardWorktreeByCallID
492
- } = await import("./worktree-isolation-1bdzfgky.js");
492
+ } = await import("./worktree-isolation-nanamt25.js");
493
493
  standardWorktreeByCallID.delete(descriptor.callID);
494
494
  if (hasResidue)
495
495
  awaitingMergeByCallID.set(descriptor.callID, {
@@ -613,7 +613,7 @@ async function recoverCoderSettlement(directory, taskId) {
613
613
  awaitingMergeByCallID,
614
614
  finishStandardWorktreeDispatch,
615
615
  standardWorktreeByCallID
616
- } = await import("./worktree-isolation-1bdzfgky.js");
616
+ } = await import("./worktree-isolation-nanamt25.js");
617
617
  const descriptor = wal.worktree;
618
618
  const reconstructedDispatch = {
619
619
  callID: descriptor.callID,
@@ -1,12 +1,12 @@
1
1
  // @bun
2
- import {
3
- atomicWriteSwarmFile
4
- } from "./index-v3xc4sde.js";
5
2
  import {
6
3
  pseudonymousRef,
7
4
  resolveLineageSalt,
8
5
  telemetry
9
- } from "./index-z6qreakh.js";
6
+ } from "./index-nprdr0sm.js";
7
+ import {
8
+ atomicWriteSwarmFile
9
+ } from "./index-nbdmdyke.js";
10
10
  import {
11
11
  canonicalRootKeyFresh
12
12
  } from "./index-1xnse449.js";
@@ -47,9 +47,7 @@ function buildProbeProfile(tempDir) {
47
47
  return `(version 1)
48
48
  (allow default)
49
49
  (deny file-write*)
50
- (allow file-write* (subpath "${sbplEscapePath(tempDir)}"))
51
- (setenv SWARM_SANDBOX_PROBE "1")
52
- (unsetenv SWARM_SANDBOX_PROBE)`;
50
+ (allow file-write* (subpath "${sbplEscapePath(tempDir)}"))`;
53
51
  }
54
52
  function probeSandboxExec() {
55
53
  try {
@@ -96,6 +94,32 @@ function resetProbeMemo() {
96
94
  function shellEscape(s) {
97
95
  return s.replace(/'/g, "'\\''");
98
96
  }
97
+ function buildEnvOverridePrefix(envOverrides) {
98
+ if (!envOverrides) {
99
+ return "";
100
+ }
101
+ const unsetKeys = [];
102
+ const exportLines = [];
103
+ for (const [key, value] of Object.entries(envOverrides)) {
104
+ if (!isValidEnvKey(key)) {
105
+ continue;
106
+ }
107
+ if (value === null) {
108
+ unsetKeys.push(key);
109
+ } else {
110
+ exportLines.push(`export ${key}='${shellEscape(value)}'`);
111
+ }
112
+ }
113
+ const parts = [];
114
+ if (unsetKeys.length > 0) {
115
+ parts.push(`unset ${unsetKeys.join(" ")}`);
116
+ }
117
+ parts.push(...exportLines);
118
+ if (parts.length === 0) {
119
+ return "";
120
+ }
121
+ return `${parts.join("; ")}; `;
122
+ }
99
123
  function sbplEscapePath(path2) {
100
124
  const withoutControlChars = path2.split("").filter((ch) => {
101
125
  const cp = ch.codePointAt(0);
@@ -103,27 +127,13 @@ function sbplEscapePath(path2) {
103
127
  }).join("");
104
128
  return withoutControlChars.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
105
129
  }
106
- function buildSandboxProfile(scopePaths, tempDir, envOverrides) {
130
+ function buildSandboxProfile(scopePaths, tempDir) {
107
131
  const rwPaths = [...scopePaths];
108
132
  if (tempDir) {
109
133
  rwPaths.push(tempDir);
110
134
  }
111
135
  const rwAllowLines = rwPaths.map((p) => `(allow file-write* (subpath "${sbplEscapePath(p)}"))`).join(`
112
136
  `);
113
- const envLines = [];
114
- if (envOverrides) {
115
- for (const [key, value] of Object.entries(envOverrides)) {
116
- if (!isValidEnvKey(key)) {
117
- continue;
118
- }
119
- if (value === null) {
120
- envLines.push(`(unsetenv ${key})`);
121
- } else {
122
- const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
123
- envLines.push(`(setenv ${key} "${escaped}")`);
124
- }
125
- }
126
- }
127
137
  const profile = `(version 1)
128
138
  (allow default)
129
139
  (allow file-read* (subpath "/usr"))
@@ -132,9 +142,7 @@ function buildSandboxProfile(scopePaths, tempDir, envOverrides) {
132
142
  (allow file-read* (subpath "/lib"))
133
143
  (allow file-read* (subpath "/lib64"))
134
144
  (deny file-write*)
135
- ${rwAllowLines}
136
- ${envLines.join(`
137
- `)}`;
145
+ ${rwAllowLines}`;
138
146
  return profile;
139
147
  }
140
148
 
@@ -186,7 +194,7 @@ class MacOSSandboxExecutor {
186
194
  }
187
195
  const temp = tempDir ?? this._tempDir ?? os.tmpdir();
188
196
  const allScopes = [...this._scopePaths, ...scopePaths];
189
- const profile = buildSandboxProfile(allScopes, temp, envOverrides);
197
+ const profile = buildSandboxProfile(allScopes, temp);
190
198
  let profilePath;
191
199
  try {
192
200
  const profileDir = mkdtempSync(path.join(os.tmpdir(), "sandbox-"));
@@ -198,7 +206,8 @@ class MacOSSandboxExecutor {
198
206
  throw new SandboxError("Sandbox not available", "SANDBOX_UNAVAILABLE");
199
207
  }
200
208
  const binary = _internals.resolveSandboxExecBinary();
201
- const escapedCommand = shellEscape(command);
209
+ const envPrefix = buildEnvOverridePrefix(envOverrides);
210
+ const escapedCommand = shellEscape(`${envPrefix}${command}`);
202
211
  const escapedProfilePath = shellEscape(profilePath);
203
212
  return `${binary} -f '${escapedProfilePath}' bash -c '${escapedCommand}'`;
204
213
  }
@@ -208,6 +217,7 @@ class MacOSSandboxExecutor {
208
217
  DYLD_LIBRARY_PATH: null,
209
218
  DYLD_FRAMEWORK_PATH: null,
210
219
  DYLD_ROOT_PATH: null,
220
+ DYLD_FORCE_FLAT_NAMESPACE: null,
211
221
  PATH: "/usr/bin:/bin:/usr/sbin:/sbin"
212
222
  };
213
223
  }
@@ -223,6 +233,7 @@ var init_sandbox_exec_executor = __esm(() => {
223
233
  resetProbeMemo,
224
234
  buildSandboxProfile,
225
235
  buildProbeProfile,
236
+ buildEnvOverridePrefix,
226
237
  resolveSandboxExecBinary,
227
238
  resolveProbeTargetBinary,
228
239
  exists: existsSync,
@@ -1036,7 +1047,7 @@ async function _createExecutor() {
1036
1047
  return null;
1037
1048
  }
1038
1049
  async function _createLinuxExecutor() {
1039
- const { SandboxCapabilityProbe: SandboxCapabilityProbe2, isBubblewrapAvailable } = await import("./capability-probe-faqefhah.js");
1050
+ const { SandboxCapabilityProbe: SandboxCapabilityProbe2, isBubblewrapAvailable } = await import("./capability-probe-pdwwz8gs.js");
1040
1051
  await new SandboxCapabilityProbe2().detect();
1041
1052
  if (!isBubblewrapAvailable()) {
1042
1053
  return null;
@@ -1056,7 +1067,7 @@ async function _createMacOSExecutor() {
1056
1067
  }
1057
1068
  return null;
1058
1069
  }
1059
- const { SandboxCapabilityProbe: SandboxCapabilityProbe2, isSandboxExecAvailable } = await import("./capability-probe-faqefhah.js");
1070
+ const { SandboxCapabilityProbe: SandboxCapabilityProbe2, isSandboxExecAvailable } = await import("./capability-probe-pdwwz8gs.js");
1060
1071
  await new SandboxCapabilityProbe2().detect();
1061
1072
  if (!isSandboxExecAvailable()) {
1062
1073
  return null;
@@ -1069,7 +1080,7 @@ async function _createMacOSExecutor() {
1069
1080
  }
1070
1081
  }
1071
1082
  async function _createWindowsExecutor() {
1072
- const { SandboxCapabilityProbe: SandboxCapabilityProbe2, isWindowsSandboxAvailable } = await import("./capability-probe-faqefhah.js");
1083
+ const { SandboxCapabilityProbe: SandboxCapabilityProbe2, isWindowsSandboxAvailable } = await import("./capability-probe-pdwwz8gs.js");
1073
1084
  await new SandboxCapabilityProbe2().detect();
1074
1085
  if (!isWindowsSandboxAvailable()) {
1075
1086
  return null;
@@ -9,7 +9,7 @@ import {
9
9
  readEvaluationRun,
10
10
  saveEvaluationRun,
11
11
  saveTaskSetSnapshot
12
- } from "./index-gp9yzr1v.js";
12
+ } from "./index-xnpjwc4h.js";
13
13
  import {
14
14
  canonicalHash,
15
15
  computeCandidateInputContentHash,
@@ -20,7 +20,7 @@ import {
20
20
  } from "./index-txdagbh7.js";
21
21
  import {
22
22
  bunSpawn
23
- } from "./index-p612v1mv.js";
23
+ } from "./index-2s7dvzff.js";
24
24
  import {
25
25
  exports_external,
26
26
  init_zod