opencode-swarm 7.139.2 → 7.139.3
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.
- package/.opencode/skills/phase-wrap/SKILL.md +2 -2
- package/dist/background/stage-b-gates.d.ts +5 -1
- package/dist/background/task-envelope.d.ts +4 -4
- package/dist/cli/{config-doctor-hrb61yqe.js → config-doctor-75qky762.js} +3 -3
- package/dist/cli/{core-g2dfh9fq.js → core-nn8ffy5h.js} +3 -3
- package/dist/cli/{curation-policy-4tp0mbcb.js → curation-policy-f46tf3dw.js} +5 -5
- package/dist/cli/{curator-drift-vfh07mqy.js → curator-drift-r52hjskk.js} +2 -2
- package/dist/cli/{curator-llm-factory-hvw13hmr.js → curator-llm-factory-1r9vz0g2.js} +28 -28
- package/dist/cli/{curator-vpcs1p1v.js → curator-m6mk2v1n.js} +28 -28
- package/dist/cli/{dispatch-b1fge4xk.js → dispatch-nbv0hezh.js} +2 -2
- package/dist/cli/{evidence-summary-service-kzxr71yd.js → evidence-summary-service-sxcq5nrt.js} +6 -6
- package/dist/cli/{gate-evidence-z2b1ymnw.js → gate-evidence-1982qswy.js} +3 -3
- package/dist/cli/{guardrail-explain-k62h3c92.js → guardrail-explain-y2wg00dp.js} +29 -29
- package/dist/cli/{guardrail-log-2ftew0p3.js → guardrail-log-320grggj.js} +5 -5
- package/dist/cli/{hive-promoter-mpf0cfkk.js → hive-promoter-v4w7cjvk.js} +28 -28
- package/dist/cli/{index-3eddtgxt.js → index-05mms0va.js} +1 -1
- package/dist/cli/{index-y64jv2pe.js → index-0mzz46we.js} +2 -2
- package/dist/cli/{index-ffpmqx30.js → index-1jbj7vzv.js} +4 -4
- package/dist/cli/{index-y47dwge1.js → index-1yd38ajy.js} +2 -2
- package/dist/cli/{index-gvhvz176.js → index-2eet124q.js} +1 -1
- package/dist/cli/{index-0wp67gqj.js → index-4fr94329.js} +11 -6
- package/dist/cli/{index-y111zefa.js → index-4nt52yr9.js} +80 -31
- package/dist/cli/{index-3jcyn8g6.js → index-4wjk296r.js} +1 -1
- package/dist/cli/{index-se8xc78k.js → index-5hyq2mw6.js} +30 -30
- package/dist/cli/{index-5zyk8qgv.js → index-5syvwd8g.js} +1 -1
- package/dist/cli/{index-ktagrqxw.js → index-6axm8q3s.js} +3 -3
- package/dist/cli/{index-668dpw5e.js → index-6mvbjqbt.js} +1 -1
- package/dist/cli/{index-wsdnttf4.js → index-74hpm6sh.js} +1 -1
- package/dist/cli/{index-wrt6m5ze.js → index-ajwmn8gp.js} +289 -73
- package/dist/cli/{index-6w1re1qn.js → index-ba5e5e3n.js} +2 -2
- package/dist/cli/{index-8gftfvpp.js → index-bcwx1335.js} +1 -1
- package/dist/cli/{index-a12906mj.js → index-gen82t10.js} +3 -3
- package/dist/cli/{index-s608d3hw.js → index-hckq2r5m.js} +1 -1
- package/dist/cli/{index-e9tx99ds.js → index-hwnpd4tw.js} +3 -3
- package/dist/cli/{index-3radty3f.js → index-jqn332jx.js} +2 -2
- package/dist/cli/{index-x9q4bbhd.js → index-k87hs2ff.js} +1 -1
- package/dist/cli/{index-8p9pasnp.js → index-kyz7259r.js} +2 -2
- package/dist/cli/{index-prmb5qfp.js → index-mv0czd9c.js} +2 -2
- package/dist/cli/{index-6c5f309q.js → index-mzck763x.js} +2 -2
- package/dist/cli/{index-a7nh382r.js → index-tkg6rapy.js} +1344 -682
- package/dist/cli/{index-yr6x707c.js → index-v7g8dnyh.js} +3 -3
- package/dist/cli/{index-w71cq27a.js → index-xeyr62x0.js} +5 -5
- package/dist/cli/{index-vm4xw9z3.js → index-xsxrhakg.js} +1 -1
- package/dist/cli/{index-5w7ekpy3.js → index-xzzcfwwm.js} +1 -1
- package/dist/cli/{index-q11t5erh.js → index-yawwwhmc.js} +2 -2
- package/dist/cli/{index-q7ezzgwq.js → index-yh0q21nj.js} +1 -1
- package/dist/cli/{index-cyw81ngh.js → index-z6qe8wft.js} +6 -6
- package/dist/cli/index.js +28 -28
- package/dist/cli/{knowledge-escalator-n9pmx4qr.js → knowledge-escalator-kkjsjtza.js} +6 -6
- package/dist/cli/{knowledge-events-raevm18w.js → knowledge-events-jbw9j94n.js} +4 -4
- package/dist/cli/{knowledge-link-3tq8w6gs.js → knowledge-link-f6akgbdn.js} +3 -3
- package/dist/cli/{knowledge-store-bcfqz8fr.js → knowledge-store-m7vnz62z.js} +4 -4
- package/dist/cli/{knowledge-validator-jxqj96cx.js → knowledge-validator-rqj7kech.js} +7 -7
- package/dist/cli/{pending-delegations-tmyf18p4.js → pending-delegations-14544jpr.js} +3 -3
- package/dist/cli/{pr-subscriptions-hhx6yk24.js → pr-subscriptions-qdwfm1a8.js} +3 -3
- package/dist/cli/{runner-w30gazew.js → runner-mzb3e2s6.js} +4 -4
- package/dist/cli/{scan-cursor-ah5swtyh.js → scan-cursor-8e6ryhjq.js} +5 -5
- package/dist/cli/{schema-f7jgrtxj.js → schema-g7rs20c6.js} +2 -2
- package/dist/cli/{scope-persistence-3f0d4fwv.js → scope-persistence-wy65zyha.js} +2 -2
- package/dist/cli/{skill-generator-hp7as46c.js → skill-generator-2rv6ftre.js} +8 -8
- package/dist/cli/{task-envelope-qn0qtnh0.js → task-envelope-jp2fdsvn.js} +11 -8
- package/dist/cli/{workspace-snapshot-h5rzw37b.js → workspace-snapshot-w3tg4ne5.js} +2 -2
- package/dist/cli/{worktree-collision-ownership-vexb0b6r.js → worktree-collision-ownership-24s0t62z.js} +4 -4
- package/dist/commands/approve-plan-critic.d.ts +2 -2
- package/dist/commands/registry.d.ts +1 -1
- package/dist/config/agent-model.d.ts +35 -0
- package/dist/db/qa-gate-profile.d.ts +11 -3
- package/dist/evidence/manager.d.ts +1 -1
- package/dist/evidence/phase-participation.d.ts +44 -0
- package/dist/hooks/compaction-customizer.d.ts +30 -2
- package/dist/hooks/context-budget.d.ts +1 -1
- package/dist/hooks/delegation-gate.d.ts +3 -3
- package/dist/hooks/guardrails/index.d.ts +5 -1
- package/dist/hooks/guardrails/messages-transform.d.ts +2 -0
- package/dist/hooks/guardrails/pre-check-result.d.ts +20 -0
- package/dist/index.js +420 -415
- package/dist/sast/semgrep.d.ts +15 -32
- package/dist/services/compaction-service.d.ts +3 -1
- package/dist/session/snapshot-writer.d.ts +1 -0
- package/dist/state.d.ts +70 -19
- package/dist/tools/context-status.d.ts +4 -1
- package/dist/tools/lint.d.ts +48 -22
- package/dist/tools/pre-check-batch.d.ts +37 -13
- package/dist/tools/quality-budget.d.ts +3 -2
- package/dist/tools/sast-baseline.d.ts +1 -0
- package/dist/tools/sast-scan.d.ts +4 -1
- package/dist/tools/secretscan.d.ts +2 -2
- package/dist/tools/set-qa-gates.d.ts +5 -4
- package/dist/utils/bun-compat.d.ts +20 -0
- package/dist/utils/external-tool-runner.d.ts +10 -0
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
readEvaluationRun,
|
|
10
10
|
saveEvaluationRun,
|
|
11
11
|
saveTaskSetSnapshot
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-hckq2r5m.js";
|
|
13
13
|
import {
|
|
14
14
|
canonicalHash,
|
|
15
15
|
computeCandidateInputContentHash,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./index-bpmtbmy9.js";
|
|
25
25
|
import {
|
|
26
26
|
bunSpawn
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-4nt52yr9.js";
|
|
28
28
|
|
|
29
29
|
// src/evaluation/runner.ts
|
|
30
30
|
import * as fs3 from "fs";
|
|
@@ -193,6 +193,17 @@ init_zod();
|
|
|
193
193
|
import * as fs from "fs";
|
|
194
194
|
import * as path from "path";
|
|
195
195
|
var DEFAULT_WINDOWS_EXTENSIONS = [".exe", ".cmd", ".bat"];
|
|
196
|
+
var TERMINATION_GRACE_MS = 20;
|
|
197
|
+
var TERMINATION_FORCE_MS = 20;
|
|
198
|
+
var TERMINATION_CONFIRM_MS = 20;
|
|
199
|
+
var TREE_TERMINATION_CONFIRM_MS = 5100;
|
|
200
|
+
var TERMINATION_FALLBACK_BUFFER_MS = 1;
|
|
201
|
+
var STREAM_DRAIN_MS = 50;
|
|
202
|
+
var STREAM_CANCEL_MS = 50;
|
|
203
|
+
var MAX_TIMEOUT_MS = 2147483647;
|
|
204
|
+
var TERMINATION_WINDOWS_MS = TERMINATION_GRACE_MS + TERMINATION_FORCE_MS + TERMINATION_CONFIRM_MS + TREE_TERMINATION_CONFIRM_MS + TERMINATION_FALLBACK_BUFFER_MS;
|
|
205
|
+
var MAX_RUNNER_TIMEOUT_MS = MAX_TIMEOUT_MS - TERMINATION_WINDOWS_MS;
|
|
206
|
+
var UNCONFIRMED_TERMINATION_MESSAGE = "external tool process termination could not be confirmed";
|
|
196
207
|
function isExecutableFile(candidate) {
|
|
197
208
|
try {
|
|
198
209
|
const stats = fs.statSync(candidate);
|
|
@@ -222,9 +233,35 @@ function resolveExecutableFromPath(names, envPath = process.env.PATH ?? "", plat
|
|
|
222
233
|
}
|
|
223
234
|
return null;
|
|
224
235
|
}
|
|
225
|
-
|
|
236
|
+
function clampTimeoutMs(timeoutMs) {
|
|
237
|
+
if (!Number.isFinite(timeoutMs)) {
|
|
238
|
+
return MAX_RUNNER_TIMEOUT_MS;
|
|
239
|
+
}
|
|
240
|
+
return Math.min(Math.max(1, Math.floor(timeoutMs)), MAX_RUNNER_TIMEOUT_MS);
|
|
241
|
+
}
|
|
242
|
+
function addTimeoutMs(baseMs, deltaMs) {
|
|
243
|
+
if (baseMs >= MAX_TIMEOUT_MS) {
|
|
244
|
+
return MAX_TIMEOUT_MS;
|
|
245
|
+
}
|
|
246
|
+
return Math.min(MAX_TIMEOUT_MS, baseMs + deltaMs);
|
|
247
|
+
}
|
|
248
|
+
function computeSpawnTimeoutMs(timeoutMs) {
|
|
249
|
+
let total = clampTimeoutMs(timeoutMs);
|
|
250
|
+
for (const windowMs of [
|
|
251
|
+
TERMINATION_GRACE_MS,
|
|
252
|
+
TERMINATION_FORCE_MS,
|
|
253
|
+
TERMINATION_CONFIRM_MS,
|
|
254
|
+
TREE_TERMINATION_CONFIRM_MS,
|
|
255
|
+
TERMINATION_FALLBACK_BUFFER_MS
|
|
256
|
+
]) {
|
|
257
|
+
total = addTimeoutMs(total, windowMs);
|
|
258
|
+
}
|
|
259
|
+
return total;
|
|
260
|
+
}
|
|
261
|
+
function startBoundedStreamRead(stream, maxBytes, onLimitExceeded) {
|
|
226
262
|
const reader = stream.getReader();
|
|
227
263
|
let lockReleased = false;
|
|
264
|
+
let cancelPromise;
|
|
228
265
|
const releaseLock = () => {
|
|
229
266
|
if (lockReleased)
|
|
230
267
|
return;
|
|
@@ -233,53 +270,66 @@ async function readBoundedStream(stream, maxBytes) {
|
|
|
233
270
|
reader.releaseLock();
|
|
234
271
|
} catch {}
|
|
235
272
|
};
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
273
|
+
const cancel = async () => {
|
|
274
|
+
cancelPromise ??= (async () => {
|
|
275
|
+
try {
|
|
276
|
+
await reader.cancel();
|
|
277
|
+
} catch {} finally {
|
|
278
|
+
releaseLock();
|
|
279
|
+
}
|
|
280
|
+
})();
|
|
281
|
+
return cancelPromise;
|
|
242
282
|
};
|
|
243
283
|
if (maxBytes <= 0) {
|
|
244
|
-
|
|
245
|
-
return {
|
|
284
|
+
onLimitExceeded?.();
|
|
285
|
+
return {
|
|
286
|
+
cancel,
|
|
287
|
+
promise: (async () => {
|
|
288
|
+
await cancel();
|
|
289
|
+
return { text: "", truncated: true };
|
|
290
|
+
})()
|
|
291
|
+
};
|
|
246
292
|
}
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
if (
|
|
260
|
-
|
|
261
|
-
|
|
293
|
+
const promise = (async () => {
|
|
294
|
+
const chunks = [];
|
|
295
|
+
let total = 0;
|
|
296
|
+
let truncated = false;
|
|
297
|
+
try {
|
|
298
|
+
for (;; ) {
|
|
299
|
+
const { done, value } = await reader.read();
|
|
300
|
+
if (done)
|
|
301
|
+
break;
|
|
302
|
+
if (!value)
|
|
303
|
+
continue;
|
|
304
|
+
const remaining = maxBytes - total;
|
|
305
|
+
if (value.byteLength > remaining) {
|
|
306
|
+
if (remaining > 0) {
|
|
307
|
+
chunks.push(value.slice(0, remaining));
|
|
308
|
+
total += remaining;
|
|
309
|
+
}
|
|
310
|
+
truncated = true;
|
|
311
|
+
onLimitExceeded?.();
|
|
312
|
+
cancel();
|
|
313
|
+
break;
|
|
262
314
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
break;
|
|
315
|
+
chunks.push(value);
|
|
316
|
+
total += value.byteLength;
|
|
266
317
|
}
|
|
267
|
-
|
|
268
|
-
|
|
318
|
+
} finally {
|
|
319
|
+
releaseLock();
|
|
269
320
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
};
|
|
321
|
+
const out = new Uint8Array(total);
|
|
322
|
+
let offset = 0;
|
|
323
|
+
for (const chunk of chunks) {
|
|
324
|
+
out.set(chunk, offset);
|
|
325
|
+
offset += chunk.byteLength;
|
|
326
|
+
}
|
|
327
|
+
return {
|
|
328
|
+
text: new TextDecoder().decode(out),
|
|
329
|
+
truncated
|
|
330
|
+
};
|
|
331
|
+
})();
|
|
332
|
+
return { promise, cancel };
|
|
283
333
|
}
|
|
284
334
|
function timeoutKillSignal(platform) {
|
|
285
335
|
return platform === "win32" ? "SIGTERM" : "SIGKILL";
|
|
@@ -289,6 +339,71 @@ function killProcess(proc) {
|
|
|
289
339
|
proc?.kill(timeoutKillSignal(_internals.platform()));
|
|
290
340
|
} catch {}
|
|
291
341
|
}
|
|
342
|
+
function requestTermination(proc, signal) {
|
|
343
|
+
try {
|
|
344
|
+
if (proc?.killTree) {
|
|
345
|
+
return proc.killTree(signal).then(() => true, () => false);
|
|
346
|
+
} else {
|
|
347
|
+
proc?.kill(signal);
|
|
348
|
+
return Promise.resolve(proc !== undefined);
|
|
349
|
+
}
|
|
350
|
+
} catch {
|
|
351
|
+
return Promise.resolve(false);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
async function waitForExitWithin(exitPromise, waitMs) {
|
|
355
|
+
if (waitMs <= 0) {
|
|
356
|
+
return Promise.resolve(null);
|
|
357
|
+
}
|
|
358
|
+
let timeoutHandle;
|
|
359
|
+
try {
|
|
360
|
+
return await Promise.race([
|
|
361
|
+
exitPromise,
|
|
362
|
+
new Promise((resolve) => {
|
|
363
|
+
timeoutHandle = _internals.setTimeout(() => resolve(null), waitMs);
|
|
364
|
+
})
|
|
365
|
+
]);
|
|
366
|
+
} finally {
|
|
367
|
+
if (timeoutHandle !== undefined) {
|
|
368
|
+
_internals.clearTimeout(timeoutHandle);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
async function waitForValueWithin(promise, waitMs) {
|
|
373
|
+
let timeoutHandle;
|
|
374
|
+
try {
|
|
375
|
+
return await Promise.race([
|
|
376
|
+
promise.then((value) => ({ completed: true, value })),
|
|
377
|
+
new Promise((resolve) => {
|
|
378
|
+
timeoutHandle = _internals.setTimeout(() => resolve({ completed: false }), waitMs);
|
|
379
|
+
})
|
|
380
|
+
]);
|
|
381
|
+
} finally {
|
|
382
|
+
if (timeoutHandle !== undefined) {
|
|
383
|
+
_internals.clearTimeout(timeoutHandle);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
async function collectBoundedStreams(stdoutRead, stderrRead, proc, treeAlreadyConfirmed = false) {
|
|
388
|
+
const reads = Promise.all([stdoutRead.promise, stderrRead.promise]);
|
|
389
|
+
let collected = await waitForValueWithin(reads, STREAM_DRAIN_MS);
|
|
390
|
+
if (!collected.completed) {
|
|
391
|
+
const treeTermination = waitForValueWithin(requestTermination(proc, "SIGKILL"), TREE_TERMINATION_CONFIRM_MS);
|
|
392
|
+
Promise.allSettled([stdoutRead.cancel(), stderrRead.cancel()]);
|
|
393
|
+
collected = await waitForValueWithin(reads, STREAM_CANCEL_MS);
|
|
394
|
+
const terminationResult = await treeTermination;
|
|
395
|
+
if (!treeAlreadyConfirmed && (!terminationResult.completed || !terminationResult.value)) {
|
|
396
|
+
return { kind: "unconfirmed-termination" };
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (!collected.completed)
|
|
400
|
+
return { kind: "cleanup-failed" };
|
|
401
|
+
return {
|
|
402
|
+
kind: "collected",
|
|
403
|
+
stdout: collected.value[0],
|
|
404
|
+
stderr: collected.value[1]
|
|
405
|
+
};
|
|
406
|
+
}
|
|
292
407
|
async function runExternalTool(options) {
|
|
293
408
|
if (!path.isAbsolute(options.cwd)) {
|
|
294
409
|
return {
|
|
@@ -315,8 +430,11 @@ async function runExternalTool(options) {
|
|
|
315
430
|
let proc;
|
|
316
431
|
let timeoutHandle;
|
|
317
432
|
let abortListener;
|
|
433
|
+
let overflowTreeTermination;
|
|
318
434
|
let exitSettled = false;
|
|
319
435
|
let settledExitCode = null;
|
|
436
|
+
const runnerTimeoutMs = clampTimeoutMs(options.timeoutMs);
|
|
437
|
+
const spawnTimeoutMs = computeSpawnTimeoutMs(runnerTimeoutMs);
|
|
320
438
|
try {
|
|
321
439
|
proc = _internals.bunSpawn([options.executable, ...options.args], {
|
|
322
440
|
cwd: options.cwd,
|
|
@@ -324,15 +442,18 @@ async function runExternalTool(options) {
|
|
|
324
442
|
stdin: "ignore",
|
|
325
443
|
stdout: "pipe",
|
|
326
444
|
stderr: "pipe",
|
|
327
|
-
timeout:
|
|
445
|
+
timeout: spawnTimeoutMs,
|
|
446
|
+
killProcessTree: true,
|
|
447
|
+
windowsVerbatimArguments: options.windowsVerbatimArguments
|
|
328
448
|
});
|
|
329
449
|
const exitPromise = proc.exited.then((exitCode) => {
|
|
330
450
|
exitSettled = true;
|
|
331
451
|
settledExitCode = exitCode;
|
|
332
|
-
return
|
|
452
|
+
return exitCode;
|
|
333
453
|
});
|
|
454
|
+
const exitRacePromise = exitPromise.then((exitCode) => ({ kind: "exit", exitCode }));
|
|
334
455
|
const timeout = new Promise((resolve) => {
|
|
335
|
-
timeoutHandle = setTimeout(() => {
|
|
456
|
+
timeoutHandle = _internals.setTimeout(() => {
|
|
336
457
|
if (exitSettled) {
|
|
337
458
|
resolve({
|
|
338
459
|
kind: "exit",
|
|
@@ -340,9 +461,8 @@ async function runExternalTool(options) {
|
|
|
340
461
|
});
|
|
341
462
|
return;
|
|
342
463
|
}
|
|
343
|
-
killProcess(proc);
|
|
344
464
|
resolve({ kind: "timeout" });
|
|
345
|
-
},
|
|
465
|
+
}, runnerTimeoutMs);
|
|
346
466
|
});
|
|
347
467
|
const cancelled = new Promise((resolve) => {
|
|
348
468
|
if (!options.abortSignal)
|
|
@@ -352,7 +472,6 @@ async function runExternalTool(options) {
|
|
|
352
472
|
if (handled)
|
|
353
473
|
return;
|
|
354
474
|
handled = true;
|
|
355
|
-
killProcess(proc);
|
|
356
475
|
resolve({ kind: "cancelled" });
|
|
357
476
|
};
|
|
358
477
|
options.abortSignal.addEventListener("abort", abortListener, {
|
|
@@ -361,31 +480,126 @@ async function runExternalTool(options) {
|
|
|
361
480
|
if (options.abortSignal.aborted)
|
|
362
481
|
abortListener();
|
|
363
482
|
});
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
483
|
+
const terminateOnOverflow = () => {
|
|
484
|
+
overflowTreeTermination ??= requestTermination(proc, "SIGKILL");
|
|
485
|
+
};
|
|
486
|
+
const stdoutRead = startBoundedStreamRead(proc.stdout, options.maxStdoutBytes, terminateOnOverflow);
|
|
487
|
+
const stderrRead = startBoundedStreamRead(proc.stderr, options.maxStderrBytes, terminateOnOverflow);
|
|
488
|
+
const exitResult = await Promise.race([
|
|
489
|
+
exitRacePromise,
|
|
490
|
+
timeout,
|
|
491
|
+
cancelled
|
|
492
|
+
]);
|
|
493
|
+
if (exitResult.kind === "timeout" || exitResult.kind === "cancelled") {
|
|
494
|
+
const gracefulTreeTermination = requestTermination(proc, "SIGTERM");
|
|
495
|
+
let confirmedExitCode = await waitForExitWithin(exitPromise, TERMINATION_GRACE_MS);
|
|
496
|
+
if (!overflowTreeTermination) {
|
|
497
|
+
overflowTreeTermination = requestTermination(proc, "SIGKILL");
|
|
498
|
+
}
|
|
499
|
+
const forcedTreeTermination = overflowTreeTermination;
|
|
500
|
+
const treeTerminationResult = waitForValueWithin(Promise.all([gracefulTreeTermination, forcedTreeTermination]), TREE_TERMINATION_CONFIRM_MS);
|
|
501
|
+
if (confirmedExitCode === null) {
|
|
502
|
+
confirmedExitCode = await waitForExitWithin(exitPromise, TERMINATION_FORCE_MS);
|
|
503
|
+
}
|
|
504
|
+
if (confirmedExitCode === null) {
|
|
505
|
+
confirmedExitCode = await waitForExitWithin(exitPromise, TERMINATION_CONFIRM_MS);
|
|
506
|
+
}
|
|
507
|
+
const treeTermination = await treeTerminationResult;
|
|
508
|
+
const treeTerminationConfirmed = treeTermination.completed && treeTermination.value.some(Boolean);
|
|
509
|
+
Promise.allSettled([stdoutRead.cancel(), stderrRead.cancel()]);
|
|
510
|
+
const streams2 = await collectBoundedStreams(stdoutRead, stderrRead, proc, treeTerminationConfirmed);
|
|
511
|
+
if (streams2.kind !== "collected") {
|
|
512
|
+
return {
|
|
513
|
+
status: "spawn-error",
|
|
514
|
+
exitCode: confirmedExitCode ?? proc.exitCode,
|
|
515
|
+
stdout: "",
|
|
516
|
+
stderr: "",
|
|
517
|
+
stdoutTruncated: true,
|
|
518
|
+
stderrTruncated: true,
|
|
519
|
+
message: streams2.kind === "unconfirmed-termination" ? UNCONFIRMED_TERMINATION_MESSAGE : "external tool output cleanup did not complete"
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
const { stdout: stdout2, stderr: stderr2 } = streams2;
|
|
523
|
+
if (confirmedExitCode === null || !treeTerminationConfirmed) {
|
|
524
|
+
return {
|
|
525
|
+
status: "spawn-error",
|
|
526
|
+
exitCode: proc.exitCode,
|
|
527
|
+
stdout: stdout2.text,
|
|
528
|
+
stderr: stderr2.text,
|
|
529
|
+
stdoutTruncated: stdout2.truncated,
|
|
530
|
+
stderrTruncated: stderr2.truncated,
|
|
531
|
+
message: UNCONFIRMED_TERMINATION_MESSAGE
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
if (exitResult.kind === "timeout") {
|
|
535
|
+
return {
|
|
536
|
+
status: "timeout",
|
|
537
|
+
exitCode: confirmedExitCode,
|
|
538
|
+
stdout: stdout2.text,
|
|
539
|
+
stderr: stderr2.text,
|
|
540
|
+
stdoutTruncated: stdout2.truncated,
|
|
541
|
+
stderrTruncated: stderr2.truncated
|
|
542
|
+
};
|
|
543
|
+
}
|
|
368
544
|
return {
|
|
369
|
-
status: "
|
|
370
|
-
exitCode:
|
|
545
|
+
status: "cancelled",
|
|
546
|
+
exitCode: confirmedExitCode,
|
|
547
|
+
stdout: stdout2.text,
|
|
548
|
+
stderr: stderr2.text,
|
|
549
|
+
stdoutTruncated: stdout2.truncated,
|
|
550
|
+
stderrTruncated: stderr2.truncated,
|
|
551
|
+
message: "external tool execution cancelled"
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
const streams = await collectBoundedStreams(stdoutRead, stderrRead, proc);
|
|
555
|
+
if (streams.kind !== "collected") {
|
|
556
|
+
return {
|
|
557
|
+
status: "spawn-error",
|
|
558
|
+
exitCode: exitResult.exitCode,
|
|
371
559
|
stdout: "",
|
|
372
560
|
stderr: "",
|
|
373
|
-
stdoutTruncated:
|
|
374
|
-
stderrTruncated:
|
|
561
|
+
stdoutTruncated: true,
|
|
562
|
+
stderrTruncated: true,
|
|
563
|
+
message: streams.kind === "unconfirmed-termination" ? UNCONFIRMED_TERMINATION_MESSAGE : "external tool output cleanup did not complete"
|
|
375
564
|
};
|
|
376
565
|
}
|
|
377
|
-
|
|
566
|
+
const { stdout, stderr } = streams;
|
|
567
|
+
if (overflowTreeTermination) {
|
|
568
|
+
const overflowTermination = await waitForValueWithin(overflowTreeTermination, TREE_TERMINATION_CONFIRM_MS);
|
|
569
|
+
if (!overflowTermination.completed || !overflowTermination.value) {
|
|
570
|
+
return {
|
|
571
|
+
status: "spawn-error",
|
|
572
|
+
exitCode: exitResult.exitCode,
|
|
573
|
+
stdout: stdout.text,
|
|
574
|
+
stderr: stderr.text,
|
|
575
|
+
stdoutTruncated: stdout.truncated,
|
|
576
|
+
stderrTruncated: stderr.truncated,
|
|
577
|
+
message: UNCONFIRMED_TERMINATION_MESSAGE
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (proc.spawnError) {
|
|
378
582
|
return {
|
|
379
|
-
status: "
|
|
583
|
+
status: "spawn-error",
|
|
380
584
|
exitCode: proc.exitCode,
|
|
381
|
-
stdout:
|
|
382
|
-
stderr:
|
|
383
|
-
stdoutTruncated:
|
|
384
|
-
stderrTruncated:
|
|
385
|
-
message:
|
|
585
|
+
stdout: stdout.text,
|
|
586
|
+
stderr: stderr.text,
|
|
587
|
+
stdoutTruncated: stdout.truncated,
|
|
588
|
+
stderrTruncated: stderr.truncated,
|
|
589
|
+
message: proc.spawnError.message
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
if (proc.signalCode) {
|
|
593
|
+
return {
|
|
594
|
+
status: "spawn-error",
|
|
595
|
+
exitCode: exitResult.exitCode,
|
|
596
|
+
stdout: stdout.text,
|
|
597
|
+
stderr: stderr.text,
|
|
598
|
+
stdoutTruncated: stdout.truncated,
|
|
599
|
+
stderrTruncated: stderr.truncated,
|
|
600
|
+
message: `external tool terminated by signal ${proc.signalCode}`
|
|
386
601
|
};
|
|
387
602
|
}
|
|
388
|
-
const [stdout, stderr] = await Promise.all([stdoutPromise, stderrPromise]);
|
|
389
603
|
return {
|
|
390
604
|
status: "completed",
|
|
391
605
|
exitCode: exitResult.exitCode,
|
|
@@ -406,20 +620,22 @@ async function runExternalTool(options) {
|
|
|
406
620
|
};
|
|
407
621
|
} finally {
|
|
408
622
|
if (timeoutHandle !== undefined)
|
|
409
|
-
clearTimeout(timeoutHandle);
|
|
623
|
+
_internals.clearTimeout(timeoutHandle);
|
|
410
624
|
if (abortListener && options.abortSignal) {
|
|
411
625
|
options.abortSignal.removeEventListener("abort", abortListener);
|
|
412
626
|
}
|
|
413
|
-
if (
|
|
414
|
-
|
|
415
|
-
proc.kill();
|
|
416
|
-
} catch {}
|
|
417
|
-
}
|
|
627
|
+
if (!exitSettled)
|
|
628
|
+
killProcess(proc);
|
|
418
629
|
}
|
|
419
630
|
}
|
|
420
631
|
var _internals = {
|
|
421
632
|
bunSpawn,
|
|
422
|
-
platform: () => process.platform
|
|
633
|
+
platform: () => process.platform,
|
|
634
|
+
now: () => Date.now(),
|
|
635
|
+
setTimeout,
|
|
636
|
+
clearTimeout,
|
|
637
|
+
clampTimeoutMs,
|
|
638
|
+
computeSpawnTimeoutMs
|
|
423
639
|
};
|
|
424
640
|
|
|
425
641
|
// src/evaluation/disposable-worktree.ts
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
readKnowledge,
|
|
4
4
|
transactKnowledge
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-z6qe8wft.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveKnowledgeStoreDir
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-6mvbjqbt.js";
|
|
9
9
|
import {
|
|
10
10
|
init_knowledge_types,
|
|
11
11
|
isActiveStatus
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
SWARM_WORKTREE_DIR_NAME,
|
|
8
8
|
init_constants
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-4wjk296r.js";
|
|
10
10
|
import {
|
|
11
11
|
bunSpawn
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-4nt52yr9.js";
|
|
13
13
|
import {
|
|
14
14
|
log
|
|
15
15
|
} from "./index-zgwm4ryv.js";
|
|
@@ -86,7 +86,7 @@ var _internals = {
|
|
|
86
86
|
symlinkSync: fs.symlinkSync
|
|
87
87
|
},
|
|
88
88
|
writeScopeToDisk: async (directory, taskId, files) => {
|
|
89
|
-
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-
|
|
89
|
+
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-wy65zyha.js");
|
|
90
90
|
return realWrite(directory, taskId, files);
|
|
91
91
|
},
|
|
92
92
|
writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./index-ae75rja9.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveKnowledgeStoreDir
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-6mvbjqbt.js";
|
|
8
8
|
import {
|
|
9
9
|
atomicWriteFile
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-2eet124q.js";
|
|
11
11
|
import {
|
|
12
12
|
require_proper_lockfile
|
|
13
13
|
} from "./index-7g4c7s5r.js";
|
|
@@ -628,7 +628,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
|
|
|
628
628
|
deltas.push({ id, delta });
|
|
629
629
|
}
|
|
630
630
|
if (deltas.length > 0) {
|
|
631
|
-
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-
|
|
631
|
+
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-m7vnz62z.js");
|
|
632
632
|
await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
|
|
633
633
|
}
|
|
634
634
|
return {
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "./index-rtry5xyf.js";
|
|
5
5
|
import {
|
|
6
6
|
readKnowledgeEvents
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-hwnpd4tw.js";
|
|
8
8
|
import {
|
|
9
9
|
isLinked,
|
|
10
10
|
readLinkPointer,
|
|
11
11
|
resolveKnowledgeStoreDir,
|
|
12
12
|
resolveLinkDir
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-6mvbjqbt.js";
|
|
14
14
|
|
|
15
15
|
// src/knowledge/curation-policy.ts
|
|
16
16
|
import { appendFile, mkdir as mkdir2, readFile as readFile2 } from "fs/promises";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ALL_AGENT_NAMES,
|
|
8
8
|
SUMMARIZER_EXEMPT_TOOL_NAMES,
|
|
9
9
|
init_constants
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-4wjk296r.js";
|
|
11
11
|
import {
|
|
12
12
|
exports_external,
|
|
13
13
|
init_zod
|
|
@@ -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.139.
|
|
24
|
+
version: "7.139.3",
|
|
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",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
validateSwarmPath
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-k87hs2ff.js";
|
|
5
5
|
import {
|
|
6
6
|
withEvidenceLock
|
|
7
7
|
} from "./index-5j6chvj8.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./index-bpmtbmy9.js";
|
|
12
12
|
import {
|
|
13
13
|
bunWrite
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-4nt52yr9.js";
|
|
15
15
|
import {
|
|
16
16
|
init_logger,
|
|
17
17
|
warn
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
detectPosixWrites,
|
|
13
13
|
detectWindowsWrites,
|
|
14
14
|
resolveWriteTargets
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-tkg6rapy.js";
|
|
16
16
|
import {
|
|
17
17
|
checkFileAuthority,
|
|
18
18
|
classifyFile,
|
|
19
19
|
isInDeclaredScope,
|
|
20
20
|
redactPath,
|
|
21
21
|
redactShellCommand
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-0mzz46we.js";
|
|
23
23
|
|
|
24
24
|
// src/services/guardrail-explain-service.ts
|
|
25
25
|
import path from "path";
|