opencode-swarm 7.144.4 → 7.144.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 (106) hide show
  1. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +2 -2
  2. package/dist/background/workspace-snapshot.d.ts +7 -0
  3. package/dist/cli/{capability-probe-f1paszww.js → capability-probe-976tt4ba.js} +6 -2
  4. package/dist/cli/{config-doctor-rw9zrjk6.js → config-doctor-m005xfdt.js} +2 -2
  5. package/dist/cli/{core-zjx9aqaf.js → core-6vdtfb8s.js} +4 -3
  6. package/dist/cli/{curation-policy-0wbrh11c.js → curation-policy-a511r0qz.js} +4 -4
  7. package/dist/cli/{curator-g54a7wv0.js → curator-0t87anp5.js} +33 -32
  8. package/dist/cli/{curator-drift-2jbjv03a.js → curator-drift-ckjm272w.js} +2 -2
  9. package/dist/cli/curator-llm-factory-j8tk9rxm.js +63 -0
  10. package/dist/cli/{dispatch-1y1rnv1h.js → dispatch-ndxbsk98.js} +2 -2
  11. package/dist/cli/{evidence-summary-service-fnr5y54e.js → evidence-summary-service-c22gahjc.js} +13 -12
  12. package/dist/cli/{gate-evidence-2xt1x07r.js → gate-evidence-hh8kc9wt.js} +7 -6
  13. package/dist/cli/guardrail-explain-9gjw2dsd.js +64 -0
  14. package/dist/cli/{guardrail-log-5w4b9zrw.js → guardrail-log-ejf5zjac.js} +4 -4
  15. package/dist/cli/{hive-promoter-x63ehffd.js → hive-promoter-gkbfpdtv.js} +33 -32
  16. package/dist/cli/{index-psvxq93b.js → index-1pxqkvvq.js} +2 -2
  17. package/dist/cli/{index-q67jb94n.js → index-3qdzpv91.js} +1 -1
  18. package/dist/cli/{index-9qq7c18c.js → index-58cvm3dw.js} +36 -1
  19. package/dist/cli/{index-p7cm3gtj.js → index-5wenr2vs.js} +35 -34
  20. package/dist/cli/{index-nckg4gxb.js → index-63tgh0cn.js} +15 -4
  21. package/dist/cli/{index-03pv47h2.js → index-641yjpk8.js} +6 -6
  22. package/dist/cli/{index-1csyxv0f.js → index-6z5jtf7d.js} +2 -2
  23. package/dist/cli/{index-z6v7kwpa.js → index-7e4q41nb.js} +1 -1
  24. package/dist/cli/{index-8j0va7jp.js → index-855hseq4.js} +43 -22
  25. package/dist/cli/index-9e6fdz2h.js +282 -0
  26. package/dist/cli/{index-mazgg5s2.js → index-9s8drsf9.js} +1 -1
  27. package/dist/cli/{index-cz25e8xp.js → index-a1hxejxc.js} +166 -34
  28. package/dist/cli/{index-b6e016tv.js → index-abtrcs16.js} +1 -1
  29. package/dist/cli/{index-8fwhhayc.js → index-b44qqqt2.js} +27 -18
  30. package/dist/cli/{index-k3cxyk66.js → index-cwtpqm5f.js} +1 -1
  31. package/dist/cli/{index-h98t1m88.js → index-dc04v786.js} +29 -1
  32. package/dist/cli/{index-d12jd5mn.js → index-dtbzyr3s.js} +1 -1
  33. package/dist/cli/{index-x6tp0hfr.js → index-ea09xax6.js} +5 -5
  34. package/dist/cli/{index-74hpm6sh.js → index-f36ybbsv.js} +12 -6
  35. package/dist/cli/{index-rn0eq85g.js → index-fv0s19g9.js} +1 -1
  36. package/dist/cli/{index-btmsqv7p.js → index-fv2pzwnp.js} +5 -4
  37. package/dist/cli/{index-ywn7vtxp.js → index-h1p08s3n.js} +1 -1
  38. package/dist/cli/{index-bt9aa01f.js → index-hkdgkkhb.js} +1 -1
  39. package/dist/cli/{index-y8j8ehc8.js → index-kdak6s63.js} +11 -5
  40. package/dist/cli/{index-az8etqpp.js → index-kh0jt9pg.js} +298 -1179
  41. package/dist/cli/{index-pw83zgny.js → index-mkmcz6x8.js} +3 -3
  42. package/dist/cli/{index-jabkn643.js → index-n4hwcsbd.js} +2 -2
  43. package/dist/cli/{index-2m7mavaz.js → index-rdgtfj74.js} +2 -2
  44. package/dist/cli/{index-yts89pqg.js → index-rnyt30tm.js} +4 -4
  45. package/dist/cli/{index-dty5qgk2.js → index-vdha477y.js} +1 -1
  46. package/dist/cli/{index-4w5qdbk7.js → index-wbrqvm2g.js} +6 -6
  47. package/dist/cli/{index-fqcjragy.js → index-wknz5c8q.js} +1 -1
  48. package/dist/cli/{index-zb0xcz9t.js → index-wm6f7t7w.js} +3 -3
  49. package/dist/cli/{index-q4ed1jk7.js → index-wmsehjq6.js} +1994 -1333
  50. package/dist/cli/{index-4nt52yr9.js → index-zj6t9zgx.js} +173 -25
  51. package/dist/cli/index-zy7f84cs.js +1210 -0
  52. package/dist/cli/index.d.ts +11 -1
  53. package/dist/cli/index.js +61 -39
  54. package/dist/cli/{knowledge-escalator-ypg14d5r.js → knowledge-escalator-1d79m1tr.js} +12 -11
  55. package/dist/cli/{knowledge-events-nkrym4wb.js → knowledge-events-ces29ncg.js} +10 -9
  56. package/dist/cli/{knowledge-link-e4qgqmpx.js → knowledge-link-4cg4776a.js} +3 -3
  57. package/dist/cli/{knowledge-store-vh3nhtg2.js → knowledge-store-pe8webc2.js} +4 -4
  58. package/dist/cli/{knowledge-validator-jrxvexv6.js → knowledge-validator-4yjf1f7k.js} +6 -6
  59. package/dist/cli/{pending-delegations-pw79c8ds.js → pending-delegations-9h1jmtw1.js} +3 -3
  60. package/dist/cli/{pr-subscriptions-fk628bhc.js → pr-subscriptions-8pg34pev.js} +3 -3
  61. package/dist/cli/{runner-b02sz2vx.js → runner-cqecp1na.js} +4 -4
  62. package/dist/cli/{scan-cursor-fp7w5jmc.js → scan-cursor-d6exjmqj.js} +7 -5
  63. package/dist/cli/{schema-rptwqbm4.js → schema-2esybebd.js} +3 -1
  64. package/dist/cli/{scope-persistence-0bkaxawa.js → scope-persistence-ej59x0yc.js} +7 -6
  65. package/dist/cli/{skill-generator-nh8b4gjv.js → skill-generator-yqta3yrg.js} +14 -13
  66. package/dist/cli/{workspace-snapshot-w3tg4ne5.js → workspace-snapshot-d89zm6wm.js} +5 -2
  67. package/dist/cli/{worktree-collision-ownership-hqd9ypsz.js → worktree-collision-ownership-vy0kxa98.js} +26 -19
  68. package/dist/cli/{worktree-isolation-canf3rj8.js → worktree-isolation-rwq0kke7.js} +33 -32
  69. package/dist/cli/{worktree-provisioning-owner-g24xd417.js → worktree-provisioning-owner-zzkjycp1.js} +3 -3
  70. package/dist/commands/ci-simulate.d.ts +2 -0
  71. package/dist/config/cache-paths.d.ts +57 -0
  72. package/dist/config/evidence-schema.d.ts +3 -3
  73. package/dist/config/schema.d.ts +9 -0
  74. package/dist/git/branch.d.ts +2 -0
  75. package/dist/git/pr.d.ts +2 -0
  76. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +7 -0
  77. package/dist/hooks/diff-scope.d.ts +7 -0
  78. package/dist/hooks/review-receipt-scope.d.ts +7 -0
  79. package/dist/hooks/reviewer-scope-lifecycle.d.ts +9 -0
  80. package/dist/hooks/semantic-diff-injection.d.ts +8 -0
  81. package/dist/index.js +599 -589
  82. package/dist/mutation/engine.d.ts +11 -0
  83. package/dist/review/diff-source.d.ts +2 -0
  84. package/dist/sandbox/capability-probe.d.ts +22 -0
  85. package/dist/sandbox/executor.d.ts +15 -0
  86. package/dist/sandbox/linux/bubblewrap-executor.d.ts +6 -0
  87. package/dist/sandbox/macos/sandbox-exec-executor.d.ts +41 -0
  88. package/dist/tools/checkpoint.d.ts +11 -0
  89. package/dist/tools/complexity-hotspots.d.ts +15 -0
  90. package/dist/tools/diff-summary.d.ts +12 -0
  91. package/dist/tools/dispatch-lanes.d.ts +8 -0
  92. package/dist/tools/gh-evidence.d.ts +17 -1
  93. package/dist/tools/knowledge-receipt.d.ts +1 -1
  94. package/dist/tools/pkg-audit.d.ts +13 -0
  95. package/dist/tools/prepare-pr-workflow-checkout.d.ts +1 -0
  96. package/dist/utils/bun-compat.d.ts +80 -3
  97. package/dist/utils/git-binary-missing-error.d.ts +80 -2
  98. package/dist/utils/git-executable.d.ts +179 -0
  99. package/dist/utils/gitignore-warning.d.ts +10 -0
  100. package/dist/workflow/coder-settlement.d.ts +18 -0
  101. package/dist/worktree/core.d.ts +8 -0
  102. package/dist/worktree/merge.d.ts +33 -0
  103. package/package.json +3 -2
  104. package/dist/cli/curator-llm-factory-xgb4pxmm.js +0 -62
  105. package/dist/cli/guardrail-explain-6wcgr9tz.js +0 -63
  106. package/dist/cli/index-q1exe2b3.js +0 -256
@@ -2,14 +2,18 @@
2
2
  import {
3
3
  autoCommitDirty,
4
4
  cleanUntrackedFiles
5
- } from "./index-8j0va7jp.js";
5
+ } from "./index-855hseq4.js";
6
6
  import {
7
7
  isPathWithinDeclaredScope,
8
8
  unsafePathTextReason
9
9
  } from "./index-556ja8an.js";
10
10
  import {
11
11
  validateSwarmPath
12
- } from "./index-rn0eq85g.js";
12
+ } from "./index-fv0s19g9.js";
13
+ import {
14
+ init_git_executable,
15
+ resolveGitExecutable
16
+ } from "./index-9e6fdz2h.js";
13
17
  import {
14
18
  advisoryWarn,
15
19
  init_warning_buffer
@@ -18,7 +22,7 @@ import {
18
22
  atomicWriteFile,
19
23
  taskEvidencePath,
20
24
  withTaskEvidenceLock
21
- } from "./index-mazgg5s2.js";
25
+ } from "./index-9s8drsf9.js";
22
26
  import {
23
27
  telemetry
24
28
  } from "./index-1jsmmx7y.js";
@@ -27,8 +31,9 @@ import {
27
31
  init_zod
28
32
  } from "./index-bpmtbmy9.js";
29
33
  import {
30
- bunSpawn
31
- } from "./index-4nt52yr9.js";
34
+ bunSpawn,
35
+ classifySpawnFailure
36
+ } from "./index-zj6t9zgx.js";
32
37
  import {
33
38
  log
34
39
  } from "./index-zgwm4ryv.js";
@@ -148,33 +153,99 @@ function recoveryReadErrored(directory) {
148
153
  return readRecoveryRecords(directory).errored;
149
154
  }
150
155
 
156
+ // src/utils/git-binary-missing-error.ts
157
+ class GitUnavailableError extends Error {
158
+ }
159
+
160
+ class GitBinaryMissingError extends GitUnavailableError {
161
+ name = "GitBinaryMissingError";
162
+ constructor(message = "git binary is not available", options) {
163
+ super(message, options);
164
+ }
165
+ }
166
+
167
+ class GitSpawnCwdError extends GitUnavailableError {
168
+ name = "GitSpawnCwdError";
169
+ cwd;
170
+ fault;
171
+ constructor(cwd, fault, options) {
172
+ super(fault === "missing" ? `git could not start: working directory no longer exists: ${cwd}` : `git could not start: working directory could not be inspected (permission denied): ${cwd}`, options);
173
+ this.cwd = cwd;
174
+ this.fault = fault;
175
+ }
176
+ }
177
+ function isGitBinaryMissing(err, cwd) {
178
+ return classifySpawnFailure(err, cwd) === "binary-missing";
179
+ }
180
+ function isSpawnCwdMissing(err, cwd) {
181
+ return classifySpawnFailure(err, cwd) === "cwd-missing";
182
+ }
183
+ function isSpawnCwdUnreadable(err, cwd) {
184
+ return classifySpawnFailure(err, cwd) === "cwd-unreadable";
185
+ }
186
+
151
187
  // src/worktree/merge.ts
188
+ init_git_executable();
152
189
  var _internals = {
153
190
  bunSpawn,
154
191
  platform: process.platform,
155
192
  sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
156
193
  cleanupOrphanedBranches,
157
194
  startupOrphanRecovery,
158
- extractSessionId
195
+ extractSessionId,
196
+ resolveGitExecutable
159
197
  };
160
198
  var MERGE_TIMEOUT_MS = 30000;
199
+ var GIT_SPAWN_FAILURE_EXIT_CODE = 1;
200
+ var SOURCE_WORKTREE_GONE_STAGE = "source-worktree-gone";
201
+ var SOURCE_WORKTREE_UNCERTAIN_STAGE = "source-worktree-uncertain";
202
+ function gitSpawnFailureResult(error, cwd, args) {
203
+ const operation = args[0] ?? "command";
204
+ let kind;
205
+ let message;
206
+ if (isSpawnCwdMissing(error, cwd)) {
207
+ kind = "cwd-missing";
208
+ message = `git ${operation} could not start: working directory no longer exists: ${cwd}`;
209
+ } else if (isSpawnCwdUnreadable(error, cwd)) {
210
+ kind = "cwd-unreadable";
211
+ message = `git ${operation} could not start: working directory could not be inspected: ${cwd}`;
212
+ } else {
213
+ kind = "spawn-failed";
214
+ message = `git ${operation} could not start in ${cwd}: ${error instanceof Error ? error.message : String(error)}`;
215
+ }
216
+ return {
217
+ exitCode: GIT_SPAWN_FAILURE_EXIT_CODE,
218
+ stdout: "",
219
+ stderr: message,
220
+ spawnFailure: { kind, cwd, message }
221
+ };
222
+ }
161
223
  async function runGit(args, cwd, timeoutMs = MERGE_TIMEOUT_MS) {
162
- const proc = _internals.bunSpawn(["git", ...args], {
163
- cwd,
164
- timeout: timeoutMs,
165
- stdin: "ignore",
166
- stdout: "pipe",
167
- stderr: "pipe",
168
- env: { ...process.env, LC_ALL: "C" }
169
- });
224
+ let proc;
170
225
  try {
226
+ proc = _internals.bunSpawn([_internals.resolveGitExecutable(), ...args], {
227
+ cwd,
228
+ timeout: timeoutMs,
229
+ stdin: "ignore",
230
+ stdout: "pipe",
231
+ stderr: "pipe",
232
+ env: { ...process.env, LC_ALL: "C" }
233
+ });
234
+ if (proc.spawnError) {
235
+ return gitSpawnFailureResult(proc.spawnError, cwd, args);
236
+ }
171
237
  const exitCode = await proc.exited;
238
+ if (proc.spawnError) {
239
+ return gitSpawnFailureResult(proc.spawnError, cwd, args);
240
+ }
172
241
  const stdout = await proc.stdout.text();
173
242
  const stderr = await proc.stderr.text();
174
243
  return { exitCode, stdout, stderr };
244
+ } catch (error) {
245
+ return gitSpawnFailureResult(error, cwd, args);
175
246
  } finally {
176
247
  try {
177
- proc.kill();
248
+ proc?.kill();
178
249
  } catch {}
179
250
  }
180
251
  }
@@ -275,10 +346,10 @@ async function reconcileLandedMerge(primaryDir, provenance) {
275
346
  return trailerSearch.stdout.trim() ? { landed: true, method: "cherry-pick-trailer" } : { landed: false };
276
347
  }
277
348
  async function postMergeCleanup(directory, branchName) {
278
- const deleteResult = await runGit(["branch", "-D", branchName], directory);
279
- const deleteOk = deleteResult.exitCode === 0;
280
349
  const pruneResult = await runGit(["worktree", "prune"], directory);
281
350
  const pruneOk = pruneResult.exitCode === 0;
351
+ const deleteResult = await runGit(["branch", "-D", branchName], directory);
352
+ const deleteOk = deleteResult.exitCode === 0;
282
353
  if (deleteOk && pruneOk) {
283
354
  return { cleaned: true };
284
355
  }
@@ -300,12 +371,46 @@ async function pruneStaleWorktreeMetadata(directory) {
300
371
  error: result.stderr.trim() || result.stdout.trim() || `git worktree prune exited ${result.exitCode}`
301
372
  };
302
373
  }
374
+ async function readLaneBranchHead(branchName, primaryDir) {
375
+ return runGit(["rev-parse", "--verify", "--quiet", `refs/heads/${branchName}`], primaryDir);
376
+ }
377
+ async function captureLaneSourceHead(worktreePath, branchName, primaryDir, knownMissing) {
378
+ if (!knownMissing) {
379
+ const fromWorktree = await runGit(["rev-parse", "HEAD"], worktreePath);
380
+ if (fromWorktree.spawnFailure?.kind !== "cwd-missing") {
381
+ return { result: fromWorktree, sourceWorktreeMissing: false };
382
+ }
383
+ }
384
+ return {
385
+ result: await readLaneBranchHead(branchName, primaryDir),
386
+ sourceWorktreeMissing: true
387
+ };
388
+ }
389
+ async function handleSourceWorktreeGone(branchHead, worktreePath, branchName, primaryDir, provenance) {
390
+ const branchResolved = branchHead.spawnFailure === undefined && branchHead.exitCode === 0 && branchHead.stdout.trim().length > 0;
391
+ if (!branchResolved) {
392
+ const definitelyAbsent = branchHead.spawnFailure === undefined && branchHead.exitCode === 1;
393
+ return {
394
+ failed: true,
395
+ stage: definitelyAbsent ? SOURCE_WORKTREE_GONE_STAGE : SOURCE_WORKTREE_UNCERTAIN_STAGE,
396
+ message: definitelyAbsent ? `Lane worktree "${worktreePath}" is gone and branch "${branchName}" no longer exists; nothing is recoverable` : `Lane worktree "${worktreePath}" is gone and branch "${branchName}" existence could not be determined: ${branchHead.stderr.trim() || `git exited ${branchHead.exitCode}`}`,
397
+ ...provenance ? { provenance } : {}
398
+ };
399
+ }
400
+ const prune = await runGit(["worktree", "prune"], primaryDir);
401
+ if (prune.exitCode !== 0) {
402
+ log(`[worktree] attemptMergeBackFromDirty: worktree prune failed for "${worktreePath}": ${prune.stderr.trim() || prune.stdout.trim()}`);
403
+ }
404
+ advisoryWarn(`STALE_LANE_WORKTREE_DETECTED: lane worktree "${worktreePath}" no longer exists. ` + `Its stale git registration was pruned, and the merge-back for branch "${branchName}" ` + `is being taken from "${primaryDir}" instead. Any uncommitted work in that worktree is ` + "unrecoverable; every commit on the branch is preserved.");
405
+ return null;
406
+ }
303
407
  async function attemptMergeBackFromDirty(worktreePath, branchName, primaryDir, strategy, options = {}) {
304
408
  let autoCommitted = false;
305
409
  let cleaned = false;
306
410
  let autoCommitFailed = false;
307
411
  let cleanFailed = false;
308
412
  let provenance = options.resume;
413
+ let sourceWorktreeMissing = false;
309
414
  if (provenance) {
310
415
  if (provenance.branchName !== branchName || provenance.strategy !== strategy || options.operationId !== undefined && provenance.operationId !== options.operationId) {
311
416
  return {
@@ -334,7 +439,14 @@ async function attemptMergeBackFromDirty(worktreePath, branchName, primaryDir, s
334
439
  provenance
335
440
  };
336
441
  }
337
- const sourceHead = await runGit(["rev-parse", "HEAD"], worktreePath);
442
+ const source = await captureLaneSourceHead(worktreePath, branchName, primaryDir, false);
443
+ if (source.sourceWorktreeMissing) {
444
+ const unrecoverable = await handleSourceWorktreeGone(source.result, worktreePath, branchName, primaryDir, provenance);
445
+ if (unrecoverable)
446
+ return unrecoverable;
447
+ sourceWorktreeMissing = true;
448
+ }
449
+ const sourceHead = source.result;
338
450
  const targetHead = await runGit(["rev-parse", "HEAD"], primaryDir);
339
451
  if (sourceHead.exitCode !== 0 || targetHead.exitCode !== 0 || sourceHead.stdout.trim() !== provenance.sourceHead || targetHead.stdout.trim() !== provenance.targetHeadBefore) {
340
452
  return {
@@ -345,7 +457,7 @@ async function attemptMergeBackFromDirty(worktreePath, branchName, primaryDir, s
345
457
  };
346
458
  }
347
459
  }
348
- if (!provenance) {
460
+ if (!provenance && !sourceWorktreeMissing) {
349
461
  const commitResult = await autoCommitDirty(worktreePath);
350
462
  if (commitResult.committed) {
351
463
  autoCommitted = true;
@@ -354,20 +466,33 @@ async function attemptMergeBackFromDirty(worktreePath, branchName, primaryDir, s
354
466
  log(`[worktree] attemptMergeBackFromDirty: auto-commit failed for worktree "${worktreePath}" branch "${branchName}": ${commitResult.reason}`);
355
467
  }
356
468
  }
357
- const cleanResult = await cleanUntrackedFiles(worktreePath);
358
- if (cleanResult.cleaned) {
359
- cleaned = true;
360
- } else {
361
- cleanFailed = true;
362
- log(`[worktree] attemptMergeBackFromDirty: clean untracked failed for worktree "${worktreePath}" branch "${branchName}": ${cleanResult.error}`);
469
+ if (!sourceWorktreeMissing) {
470
+ const cleanResult = await cleanUntrackedFiles(worktreePath);
471
+ if (cleanResult.cleaned) {
472
+ cleaned = true;
473
+ } else {
474
+ cleanFailed = true;
475
+ log(`[worktree] attemptMergeBackFromDirty: clean untracked failed for worktree "${worktreePath}" branch "${branchName}": ${cleanResult.error}`);
476
+ }
363
477
  }
364
478
  if (autoCommitFailed && cleanFailed) {
365
- return {
366
- failed: true,
367
- stage: "cleanup",
368
- message: "Auto-commit and clean both failed; abandoning worktree",
369
- ...provenance ? { provenance } : {}
370
- };
479
+ const probe = await runGit(["rev-parse", "--git-dir"], worktreePath);
480
+ if (probe.spawnFailure?.kind === "cwd-missing") {
481
+ const unrecoverable = await handleSourceWorktreeGone(await readLaneBranchHead(branchName, primaryDir), worktreePath, branchName, primaryDir, provenance);
482
+ if (unrecoverable)
483
+ return unrecoverable;
484
+ sourceWorktreeMissing = true;
485
+ autoCommitFailed = false;
486
+ cleanFailed = false;
487
+ cleaned = false;
488
+ } else {
489
+ return {
490
+ failed: true,
491
+ stage: "cleanup",
492
+ message: "Auto-commit and clean both failed; abandoning worktree",
493
+ ...provenance ? { provenance } : {}
494
+ };
495
+ }
371
496
  }
372
497
  if (!provenance && (options.operationId || options.onBeforeMerge)) {
373
498
  if (!options.operationId) {
@@ -377,7 +502,14 @@ async function attemptMergeBackFromDirty(worktreePath, branchName, primaryDir, s
377
502
  message: "A pre-merge callback requires a stable operationId"
378
503
  };
379
504
  }
380
- const sourceHead = await runGit(["rev-parse", "HEAD"], worktreePath);
505
+ const source = await captureLaneSourceHead(worktreePath, branchName, primaryDir, sourceWorktreeMissing);
506
+ if (source.sourceWorktreeMissing && !sourceWorktreeMissing) {
507
+ const unrecoverable = await handleSourceWorktreeGone(source.result, worktreePath, branchName, primaryDir, provenance);
508
+ if (unrecoverable)
509
+ return unrecoverable;
510
+ sourceWorktreeMissing = true;
511
+ }
512
+ const sourceHead = source.result;
381
513
  const targetHead = await runGit(["rev-parse", "HEAD"], primaryDir);
382
514
  if (sourceHead.exitCode !== 0 || targetHead.exitCode !== 0 || !sourceHead.stdout.trim() || !targetHead.stdout.trim()) {
383
515
  return {
@@ -484,6 +616,7 @@ async function cleanupOrphanedBranches(directory, activeSessionIds = [], options
484
616
  };
485
617
  }
486
618
  const branches = await listLaneBranches(directory);
619
+ await runGit(["worktree", "prune"], directory);
487
620
  for (const branch of branches) {
488
621
  const sessionId = extractSessionId(branch);
489
622
  if (sessionId !== null && activeSessionIds.includes(sessionId)) {
@@ -504,7 +637,6 @@ async function cleanupOrphanedBranches(directory, activeSessionIds = [], options
504
637
  });
505
638
  }
506
639
  }
507
- await runGit(["worktree", "prune"], directory);
508
640
  return {
509
641
  removed,
510
642
  skipped,
@@ -1369,4 +1501,4 @@ function compareTaskWorkflowStateRank(left, right) {
1369
1501
  return WORKFLOW_STATE_RANK[left] - WORKFLOW_STATE_RANK[right];
1370
1502
  }
1371
1503
 
1372
- export { sanitizeTaskId, listRecoveryRecords, _internals, getMergeStrategy, reconcileLandedMerge, postMergeCleanup, pruneStaleWorktreeMetadata, attemptMergeBackFromDirty, cleanupOrphanedBranches, startupOrphanRecovery, readWorkflowWalFile, writeWorkflowWalFile, TASK_WORKFLOW_SCHEMA_MARKER, assertTaskEvidenceWriteAllowed, parseTaskEvidence, DEFAULT_REQUIRED_GATES, isValidTaskId, getTaskWorkflowSnapshot, reduceTaskWorkflowSnapshot, deriveRequiredGates, expandRequiredGates, transitionTaskWorkflowEvidence, withTaskEvidenceTransaction, recordGateEvidence, recordAgentDispatch, readTaskEvidence, readTaskEvidenceRaw, hasPassedAllGates, compareTaskWorkflowStateRank };
1504
+ export { sanitizeTaskId, listRecoveryRecords, GitBinaryMissingError, GitSpawnCwdError, isGitBinaryMissing, isSpawnCwdMissing, isSpawnCwdUnreadable, _internals, SOURCE_WORKTREE_GONE_STAGE, SOURCE_WORKTREE_UNCERTAIN_STAGE, getMergeStrategy, reconcileLandedMerge, postMergeCleanup, pruneStaleWorktreeMetadata, attemptMergeBackFromDirty, cleanupOrphanedBranches, startupOrphanRecovery, readWorkflowWalFile, writeWorkflowWalFile, TASK_WORKFLOW_SCHEMA_MARKER, assertTaskEvidenceWriteAllowed, parseTaskEvidence, DEFAULT_REQUIRED_GATES, isValidTaskId, getTaskWorkflowSnapshot, reduceTaskWorkflowSnapshot, deriveRequiredGates, expandRequiredGates, transitionTaskWorkflowEvidence, withTaskEvidenceTransaction, recordGateEvidence, recordAgentDispatch, readTaskEvidence, readTaskEvidenceRaw, hasPassedAllGates, compareTaskWorkflowStateRank };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-z6xqpmqg.js";
5
5
  import {
6
6
  bunSpawnSync
7
- } from "./index-4nt52yr9.js";
7
+ } from "./index-zj6t9zgx.js";
8
8
  import {
9
9
  warn
10
10
  } from "./index-zgwm4ryv.js";
@@ -1,8 +1,12 @@
1
1
  // @bun
2
2
  import {
3
+ _internals,
4
+ _internals1 as _internals2,
3
5
  exports_runner_client,
4
- init_runner_client
5
- } from "./index-q1exe2b3.js";
6
+ init_bubblewrap_executor,
7
+ init_runner_client,
8
+ init_sandbox_exec_executor
9
+ } from "./index-zy7f84cs.js";
6
10
  import {
7
11
  __esm,
8
12
  __toCommonJS
@@ -11,6 +15,9 @@ import {
11
15
  // src/sandbox/capability-probe.ts
12
16
  import { execFile, spawnSync } from "child_process";
13
17
  import * as os from "os";
18
+ function _resetCapabilityCache() {
19
+ _cached = undefined;
20
+ }
14
21
  function withProbeTimeout(cmd, args, ms) {
15
22
  return new Promise((resolve, reject) => {
16
23
  const controller = new AbortController;
@@ -50,7 +57,8 @@ function withProbeTimeout(cmd, args, ms) {
50
57
  }
51
58
  async function probeLinux() {
52
59
  try {
53
- const output = await withProbeTimeout("bwrap", ["--version"], 2000);
60
+ const binary = _internals.resolveBwrapBinary();
61
+ const output = await _internals3.withProbeTimeout(binary, ["--version"], 2000);
54
62
  if (output.length > 0) {
55
63
  return {
56
64
  status: "enabled",
@@ -85,20 +93,15 @@ async function probeLinux() {
85
93
  }
86
94
  async function probeMacOS() {
87
95
  try {
88
- const output = await withProbeTimeout("sandbox-exec", ["--version"], 2000);
89
- if (output.length > 0) {
90
- return {
91
- status: "enabled",
92
- strength: "strong",
93
- mechanism: "sandbox-exec",
94
- platform: "darwin"
95
- };
96
- }
96
+ const binary = _internals2.resolveSandboxExecBinary();
97
+ const target = _internals2.resolveProbeTargetBinary();
98
+ const profile = _internals2.buildProbeProfile(os.tmpdir());
99
+ await _internals3.withProbeTimeout(binary, ["-p", profile, target], 2000);
97
100
  return {
98
- status: "disabled",
101
+ status: "enabled",
102
+ strength: "strong",
99
103
  mechanism: "sandbox-exec",
100
- platform: "darwin",
101
- error: "binary returned empty version"
104
+ platform: "darwin"
102
105
  };
103
106
  } catch (err) {
104
107
  const msg = err instanceof Error ? err.message : String(err);
@@ -204,7 +207,13 @@ class SandboxCapabilityProbe {
204
207
  return _cached;
205
208
  }
206
209
  }
207
- var _cached;
208
- var init_capability_probe = () => {};
210
+ var _cached, _internals3;
211
+ var init_capability_probe = __esm(() => {
212
+ init_bubblewrap_executor();
213
+ init_sandbox_exec_executor();
214
+ _internals3 = {
215
+ withProbeTimeout
216
+ };
217
+ });
209
218
 
210
- export { isBubblewrapAvailable, isSandboxExecAvailable, isWindowsSandboxAvailable, SandboxCapabilityProbe, init_capability_probe };
219
+ export { _resetCapabilityCache, _internals3 as _internals, isBubblewrapAvailable, isSandboxExecAvailable, isWindowsSandboxAvailable, SandboxCapabilityProbe, init_capability_probe };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-rn0eq85g.js";
4
+ } from "./index-fv0s19g9.js";
5
5
 
6
6
  // src/hooks/delegation-gate/worktree-provisioning-owner.ts
7
7
  import { createHash, randomBytes } from "crypto";
@@ -6,7 +6,7 @@ import {
6
6
  PluginConfigSchema,
7
7
  init_schema,
8
8
  stripKnownSwarmPrefix
9
- } from "./index-y8j8ehc8.js";
9
+ } from "./index-kdak6s63.js";
10
10
  import {
11
11
  ALL_AGENT_NAMES,
12
12
  init_constants
@@ -944,6 +944,34 @@ function validateConfigKey(path2, value) {
944
944
  emitObjectTypeMismatch("design_docs", value, findings);
945
945
  break;
946
946
  }
947
+ case "git": {
948
+ emitObjectTypeMismatch("git", value, findings);
949
+ break;
950
+ }
951
+ case "git.binary": {
952
+ if (value !== undefined && typeof value !== "string") {
953
+ findings.push({
954
+ id: "invalid-git-binary-type",
955
+ title: "Invalid git.binary type",
956
+ description: `"git.binary" must be a string, got ${typeof value}`,
957
+ severity: "error",
958
+ path: "git.binary",
959
+ currentValue: value,
960
+ autoFixable: false
961
+ });
962
+ } else if (typeof value === "string" && value.trim() === "") {
963
+ findings.push({
964
+ id: "empty-git-binary",
965
+ title: "Empty git.binary",
966
+ description: '"git.binary" is blank, so no git executable is named. Remove the key to fall back to the default `git` lookup, or set it to a real git executable path.',
967
+ severity: "error",
968
+ path: "git.binary",
969
+ currentValue: value,
970
+ autoFixable: false
971
+ });
972
+ }
973
+ break;
974
+ }
947
975
  case "ui_review": {
948
976
  emitObjectTypeMismatch("ui_review", value, findings);
949
977
  break;
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  init_schema,
13
13
  stripKnownSwarmPrefix
14
- } from "./index-y8j8ehc8.js";
14
+ } from "./index-kdak6s63.js";
15
15
  import {
16
16
  init_constants
17
17
  } from "./index-v3y3qg48.js";
@@ -6,12 +6,12 @@ import {
6
6
  resolveSwarmKnowledgePath,
7
7
  transactKnowledge,
8
8
  wordBigrams
9
- } from "./index-03pv47h2.js";
9
+ } from "./index-641yjpk8.js";
10
10
  import {
11
11
  queryHistoricalOutcomes,
12
12
  readKnowledgeEvents,
13
13
  recordKnowledgeEvent
14
- } from "./index-4w5qdbk7.js";
14
+ } from "./index-wbrqvm2g.js";
15
15
  import {
16
16
  init_knowledge_types,
17
17
  isActiveStatus
@@ -224,11 +224,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
224
224
  alreadyInactive: true
225
225
  };
226
226
  }
227
- const { quarantineEntry } = await import("./knowledge-validator-jrxvexv6.js");
227
+ const { quarantineEntry } = await import("./knowledge-validator-4yjf1f7k.js");
228
228
  let policyConfig;
229
229
  try {
230
- const { KnowledgeConfigSchema } = await import("./schema-rptwqbm4.js");
231
- const { loadPluginConfigWithMeta } = await import("./index-btmsqv7p.js");
230
+ const { KnowledgeConfigSchema } = await import("./schema-2esybebd.js");
231
+ const { loadPluginConfigWithMeta } = await import("./index-fv2pzwnp.js");
232
232
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
233
233
  policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
234
234
  } catch {
@@ -1,13 +1,18 @@
1
1
  // @bun
2
+ import {
3
+ init_git_executable,
4
+ resolveGitExecutable
5
+ } from "./index-9e6fdz2h.js";
2
6
  import {
3
7
  bunSpawn
4
- } from "./index-4nt52yr9.js";
8
+ } from "./index-zj6t9zgx.js";
5
9
 
6
10
  // src/background/workspace-snapshot.ts
7
11
  import * as child_process from "child_process";
8
12
  import { createHash } from "crypto";
9
13
  import * as fs from "fs";
10
14
  import * as path from "path";
15
+ init_git_executable();
11
16
  var GIT_SNAPSHOT_TIMEOUT_MS = 3000;
12
17
  var GIT_SNAPSHOT_MAX_BUFFER = 32 * 1024 * 1024;
13
18
  var REVISION_MAX_FILES = 50000;
@@ -53,7 +58,7 @@ async function readBoundedGitOutput(stream, maxBytes, onOverflow) {
53
58
  }
54
59
  }
55
60
  function runGit(directory, args, timeoutMs = GIT_SNAPSHOT_TIMEOUT_MS) {
56
- const result = _internals.spawnSync("git", ["-C", directory, ...args], {
61
+ const result = _internals.spawnSync(_internals.resolveGitExecutable(), ["-C", directory, ...args], {
57
62
  cwd: directory,
58
63
  encoding: "utf-8",
59
64
  timeout: timeoutMs,
@@ -76,7 +81,7 @@ async function runGitAsync(directory, args, timeoutMs = _internals.gitTimeoutMs)
76
81
  timeout: timeoutMs,
77
82
  killProcessTree: true
78
83
  };
79
- proc = _internals.bunSpawn(["git", "-C", directory, ...args], options);
84
+ proc = _internals.bunSpawn([_internals.resolveGitExecutable(), "-C", directory, ...args], options);
80
85
  let overflowed = false;
81
86
  const stopOverflow = () => {
82
87
  overflowed = true;
@@ -115,7 +120,7 @@ async function runGitAsync(directory, args, timeoutMs = _internals.gitTimeoutMs)
115
120
  }
116
121
  }
117
122
  function runGitDetailed(directory, args, timeoutMs) {
118
- const result = _internals.spawnSync("git", ["-C", directory, ...args], {
123
+ const result = _internals.spawnSync(_internals.resolveGitExecutable(), ["-C", directory, ...args], {
119
124
  cwd: directory,
120
125
  encoding: "utf-8",
121
126
  timeout: timeoutMs,
@@ -143,7 +148,7 @@ async function runGitAsyncDetailed(directory, args, timeoutMs) {
143
148
  stderr: "pipe",
144
149
  killProcessTree: true
145
150
  };
146
- proc = _internals.bunSpawn(["git", "-C", directory, ...args], options);
151
+ proc = _internals.bunSpawn([_internals.resolveGitExecutable(), "-C", directory, ...args], options);
147
152
  let overflowed = false;
148
153
  const stopOverflow = () => {
149
154
  overflowed = true;
@@ -190,7 +195,7 @@ function readGitTextAtRevision(directory, revision, relativePath) {
190
195
  if (!isSafeGitRevisionToken(revision) || !/^\.?(?:[A-Za-z0-9][A-Za-z0-9._-]*\/)*[A-Za-z0-9][A-Za-z0-9._-]*$/.test(relativePath) || relativePath.split("/").includes("..")) {
191
196
  return null;
192
197
  }
193
- const result = _internals.spawnSync("git", ["-C", directory, "show", `${revision}:${relativePath}`], {
198
+ const result = _internals.spawnSync(_internals.resolveGitExecutable(), ["-C", directory, "show", `${revision}:${relativePath}`], {
194
199
  cwd: directory,
195
200
  encoding: "utf-8",
196
201
  timeout: GIT_SNAPSHOT_TIMEOUT_MS,
@@ -1046,6 +1051,7 @@ function digest(text) {
1046
1051
  var _internals = {
1047
1052
  spawnSync: child_process.spawnSync,
1048
1053
  bunSpawn,
1054
+ resolveGitExecutable,
1049
1055
  gitTimeoutMs: GIT_SNAPSHOT_TIMEOUT_MS,
1050
1056
  yieldControl: () => new Promise((resolve2) => setImmediate(resolve2)),
1051
1057
  parsePorcelainV2Snapshot,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-ed5ykebp.js";
8
8
  import {
9
9
  bunFile
10
- } from "./index-4nt52yr9.js";
10
+ } from "./index-zj6t9zgx.js";
11
11
  import {
12
12
  warn
13
13
  } from "./index-zgwm4ryv.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  _internals,
4
4
  resolveWorktreeIsolationConfig
5
- } from "./index-psvxq93b.js";
5
+ } from "./index-1pxqkvvq.js";
6
6
  import {
7
7
  ApprovalEvidenceSchema,
8
8
  BaseEvidenceSchema,
@@ -42,7 +42,7 @@ import {
42
42
  loadPluginConfig,
43
43
  loadPluginConfigWithMeta,
44
44
  loadPluginConfigWithMetaAsync
45
- } from "./index-9qq7c18c.js";
45
+ } from "./index-58cvm3dw.js";
46
46
  import {
47
47
  AUTO_REVIEW_V8_BURN_IN_DECISION,
48
48
  AgentOverrideConfigSchema,
@@ -64,8 +64,7 @@ import {
64
64
  TurboConfigSchema,
65
65
  WorktreeIsolationConfigSchema,
66
66
  resolveAutoReviewConfig
67
- } from "./index-y8j8ehc8.js";
68
- import"./index-4rhhvd1a.js";
67
+ } from "./index-kdak6s63.js";
69
68
  import {
70
69
  ALL_AGENT_NAMES,
71
70
  ALL_SUBAGENT_NAMES,
@@ -76,6 +75,8 @@ import {
76
75
  isQAAgent,
77
76
  isSubagent
78
77
  } from "./index-v3y3qg48.js";
78
+ import"./index-9e6fdz2h.js";
79
+ import"./index-4rhhvd1a.js";
79
80
  import"./index-zjygnfay.js";
80
81
  import"./index-bk5tah7q.js";
81
82
  import"./index-bpmtbmy9.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  atomicWriteFile
4
- } from "./index-mazgg5s2.js";
4
+ } from "./index-9s8drsf9.js";
5
5
  import {
6
6
  init_logger,
7
7
  warn
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-rn0eq85g.js";
4
+ } from "./index-fv0s19g9.js";
5
5
  import {
6
6
  withEvidenceLock
7
7
  } from "./index-f9vvg5xb.js";