opencode-swarm 7.168.0 → 7.169.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.
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +11 -11
- package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
- package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
- package/dist/cli/{coder-settlement-a35acvj1.js → coder-settlement-fd6ba876.js} +12 -12
- package/dist/cli/{config-doctor-9csx775x.js → config-doctor-zeppqwwx.js} +2 -2
- package/dist/cli/{core-agk5s7dm.js → core-fj1afc31.js} +5 -2
- package/dist/cli/{curation-policy-mgwv8h2k.js → curation-policy-k74qz9ms.js} +5 -5
- package/dist/cli/{curator-drift-k0zrnm09.js → curator-drift-3ssjr0nx.js} +5 -5
- package/dist/cli/{curator-2fcagjyk.js → curator-emftndv0.js} +39 -38
- package/dist/cli/curator-llm-factory-4t773tmz.js +72 -0
- package/dist/cli/{dispatch-8ks9dyk5.js → dispatch-hwwj3qrb.js} +2 -2
- package/dist/cli/{evidence-summary-service-4s6cje60.js → evidence-summary-service-51b69jc3.js} +16 -16
- package/dist/cli/{gate-evidence-saja4dan.js → gate-evidence-53s161wb.js} +7 -7
- package/dist/cli/guardrail-explain-mhx8gt8q.js +73 -0
- package/dist/cli/{guardrail-log-0h24spq0.js → guardrail-log-xg6hrdsq.js} +8 -8
- package/dist/cli/{guardrail-reset-cwbe47k5.js → guardrail-reset-fgv5kt5x.js} +39 -38
- package/dist/cli/{hive-promoter-esxtcvr1.js → hive-promoter-41zygtgx.js} +39 -38
- package/dist/cli/index-0hgmsyfp.js +92 -0
- package/dist/cli/{index-nsyxj57e.js → index-0vgs5r39.js} +8 -8
- package/dist/cli/{index-54w1564x.js → index-1cbjemgh.js} +2 -2
- package/dist/cli/{index-p612v1mv.js → index-2s7dvzff.js} +200 -51
- package/dist/cli/{index-3dywbkyr.js → index-2znfa537.js} +4 -4
- package/dist/cli/{index-seetnhpx.js → index-3bfzpzsb.js} +1 -1
- package/dist/cli/{index-yevn4jpe.js → index-3zcds757.js} +3101 -1918
- package/dist/cli/{index-d5qf7hvh.js → index-5400m33a.js} +1 -1
- package/dist/cli/{index-mr0wn36f.js → index-55fkkjec.js} +5 -5
- package/dist/cli/{index-qwsh0h2g.js → index-5qt9yf5w.js} +4 -4
- package/dist/cli/{index-30h1pk05.js → index-5reh1bjz.js} +3 -3
- package/dist/cli/{index-j950hqmq.js → index-76ng6vmq.js} +7 -7
- package/dist/cli/{index-qhey6vc3.js → index-7h01bkm6.js} +2 -2
- package/dist/cli/{index-yv76j77m.js → index-83m0y4cj.js} +6 -6
- package/dist/cli/{index-ddr97ram.js → index-8x9keek6.js} +41 -40
- package/dist/cli/{index-8ybjqg51.js → index-9ttqbhvw.js} +1 -1
- package/dist/cli/{index-kear8gb7.js → index-b3pmzbh1.js} +2 -2
- package/dist/cli/{index-h439y187.js → index-bernkwgf.js} +1 -1
- package/dist/cli/{index-m35hybf0.js → index-bm5xrfnx.js} +1 -1
- package/dist/cli/{index-pyf517sz.js → index-br3mvbsa.js} +2 -2
- package/dist/cli/{index-4r5pmtvk.js → index-bx1wgn3a.js} +4 -4
- package/dist/cli/{index-64phnth4.js → index-c7kr7tnk.js} +4 -4
- package/dist/cli/{index-nwwk3dej.js → index-cgpwjctj.js} +1 -1
- package/dist/cli/{index-s0d5xter.js → index-dd48vt27.js} +3 -3
- package/dist/cli/{index-wst6n478.js → index-dvbf6fpn.js} +1 -1
- package/dist/cli/{index-rxcgrgkc.js → index-e4dxf5cr.js} +39 -38
- package/dist/cli/{index-cyenn3pf.js → index-egkc2bpv.js} +36 -1
- package/dist/cli/{index-h0e2e3h1.js → index-exf0j569.js} +1 -1
- package/dist/cli/{index-a8xbvsse.js → index-fgp96k3r.js} +2 -2
- package/dist/cli/{index-5zqakgp4.js → index-fhh02gwx.js} +3 -3
- package/dist/cli/{index-dfyv3xkd.js → index-gfbggp8k.js} +9 -9
- package/dist/cli/{index-nprngf8p.js → index-ksybszed.js} +7 -7
- package/dist/cli/{index-v3xc4sde.js → index-nbdmdyke.js} +2 -1
- package/dist/cli/{index-z6qreakh.js → index-nprdr0sm.js} +6 -4
- package/dist/cli/{index-wnzxcr0z.js → index-nwv3e3kc.js} +2 -2
- package/dist/cli/{index-bvqqwx84.js → index-nyn01yrz.js} +2 -2
- package/dist/cli/{index-an8b5gda.js → index-p6xsgk4r.js} +7 -7
- package/dist/cli/{index-x7k3dps5.js → index-s96dpjsk.js} +2 -2
- package/dist/cli/{index-ze520xw1.js → index-sb1s03y9.js} +8 -8
- package/dist/cli/{index-00zx94vn.js → index-sxcfszbe.js} +5 -5
- package/dist/cli/{index-8f0kscpg.js → index-wwr67xc0.js} +197 -35
- package/dist/cli/{index-gp9yzr1v.js → index-xnpjwc4h.js} +1 -1
- package/dist/cli/{index-exatbqwj.js → index-yj24ny5k.js} +26 -4
- package/dist/cli/{index-21ree67h.js → index-zapc8vj4.js} +14 -14
- package/dist/cli/index.js +39 -38
- package/dist/cli/{knowledge-escalator-b2tf3sd1.js → knowledge-escalator-07s44av0.js} +13 -13
- package/dist/cli/{knowledge-events-bgs2kxe0.js → knowledge-events-j2n1569p.js} +11 -11
- package/dist/cli/{knowledge-link-dr3xnwyd.js → knowledge-link-rkxfrmhm.js} +4 -4
- package/dist/cli/{knowledge-store-stbmb1b9.js → knowledge-store-85metj89.js} +5 -5
- package/dist/cli/{knowledge-validator-zykgnsag.js → knowledge-validator-63k1xzcc.js} +7 -7
- package/dist/cli/{pending-delegations-n5qavj20.js → pending-delegations-dckmjymn.js} +12 -12
- package/dist/cli/{pr-subscriptions-gnvmyrng.js → pr-subscriptions-pyh73me6.js} +12 -12
- package/dist/cli/{pr-workflow-gate-cf3ybrws.js → pr-workflow-gate-k1r4rjw4.js} +39 -38
- package/dist/cli/{runner-k0ycgv8x.js → runner-1dwrgyyr.js} +6 -6
- package/dist/cli/{scan-cursor-b3mcrx23.js → scan-cursor-k6egg4n0.js} +6 -6
- package/dist/cli/{schema-08049cjb.js → schema-vdrtpggt.js} +5 -1
- package/dist/cli/{scope-persistence-a493gv51.js → scope-persistence-h1mmww19.js} +14 -14
- package/dist/cli/{skill-generator-2qqzkdpv.js → skill-generator-pmn6gmvk.js} +15 -15
- package/dist/cli/{snapshot-coordination-init-8yt8p7q0.js → snapshot-coordination-init-rspykgd0.js} +39 -38
- package/dist/cli/{telemetry-2wzapf11.js → telemetry-fdtaemnv.js} +1 -1
- package/dist/cli/{workspace-snapshot-rkgxhj9b.js → workspace-snapshot-hkz2wt1c.js} +4 -4
- package/dist/cli/{worktree-collision-ownership-xttafc4h.js → worktree-collision-ownership-x84dzzzc.js} +18 -104
- package/dist/cli/{worktree-isolation-e5q5rewk.js → worktree-isolation-nw9pakkx.js} +39 -38
- package/dist/commands/destructive-purge.d.ts +85 -0
- package/dist/commands/registry.d.ts +2 -2
- package/dist/commands/reset-session.d.ts +5 -1
- package/dist/config/constants.d.ts +4 -1
- package/dist/config/lane-context.d.ts +19 -0
- package/dist/config/schema.d.ts +77 -0
- package/dist/evaluation/index.d.ts +1 -0
- package/dist/evaluation/retrieval-quality.d.ts +116 -0
- package/dist/failures/invocation-failure.d.ts +23 -4
- package/dist/hooks/init-orphan-recovery.d.ts +7 -0
- package/dist/hooks/pr-workflow-gate.d.ts +8 -2
- package/dist/index.js +596 -590
- package/dist/memory/embeddings/reranker.d.ts +13 -2
- package/dist/memory/evaluation.d.ts +99 -0
- package/dist/memory/heldout-evaluation-corpus.d.ts +51 -0
- package/dist/memory/index.d.ts +5 -2
- package/dist/memory/sqlite-provider.d.ts +35 -1
- package/dist/memory/types.d.ts +14 -0
- package/dist/observability/otel-mapping.d.ts +5 -5
- package/dist/observability/otlp-exporter.d.ts +80 -0
- package/dist/parallel/lane-owners.d.ts +76 -0
- package/dist/tools/repo-graph/query.d.ts +6 -1
- package/dist/tools/repo-graph/types.d.ts +13 -4
- package/dist/utils/bun-compat.d.ts +20 -0
- package/dist/utils/gitignore-warning.d.ts +5 -2
- package/dist/worktree/base-migration.d.ts +55 -0
- package/dist/worktree/core.d.ts +15 -6
- package/dist/worktree/ownership.d.ts +66 -0
- package/opencode-swarm.schema.json +97 -0
- package/package.json +4 -2
- package/tests/fixtures/memory-recall-heldout/manifest.json +311 -0
- package/tests/fixtures/memory-recall-heldout/sources/bash.sh +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/c.c +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/cpp.cpp +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/csharp.cs +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/css.css +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/dart.dart +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/go.go +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/ini.ini +2 -0
- package/tests/fixtures/memory-recall-heldout/sources/java.java +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/javascript.js +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/kotlin.kt +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/php.php +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/powershell.ps1 +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/python.py +2 -0
- package/tests/fixtures/memory-recall-heldout/sources/regex.regex +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/ruby.rb +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/rust.rs +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/swift.swift +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/tsx.tsx +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/typescript.ts +3 -0
- package/dist/cli/curator-llm-factory-qaxmyy46.js +0 -71
- package/dist/cli/guardrail-explain-z41q6sf0.js +0 -72
|
@@ -7,65 +7,66 @@ import {
|
|
|
7
7
|
isHiveEligible,
|
|
8
8
|
promoteFromSwarm,
|
|
9
9
|
promoteToHive
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
16
|
-
import"./index-
|
|
17
|
-
import"./index-
|
|
10
|
+
} from "./index-3zcds757.js";
|
|
11
|
+
import"./index-5400m33a.js";
|
|
12
|
+
import"./index-7h01bkm6.js";
|
|
13
|
+
import"./index-5reh1bjz.js";
|
|
14
|
+
import"./index-cgpwjctj.js";
|
|
15
|
+
import"./index-egkc2bpv.js";
|
|
16
|
+
import"./index-zapc8vj4.js";
|
|
17
|
+
import"./index-xnpjwc4h.js";
|
|
18
18
|
import"./index-txdagbh7.js";
|
|
19
19
|
import"./index-9br68j86.js";
|
|
20
20
|
import"./index-cw912re7.js";
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
23
|
-
import"./index-
|
|
21
|
+
import"./index-c7kr7tnk.js";
|
|
22
|
+
import"./index-55fkkjec.js";
|
|
23
|
+
import"./index-nwv3e3kc.js";
|
|
24
24
|
import"./index-fyfbpz4f.js";
|
|
25
|
-
import"./index-
|
|
25
|
+
import"./index-gfbggp8k.js";
|
|
26
|
+
import"./index-0hgmsyfp.js";
|
|
26
27
|
import"./index-zsrtt42s.js";
|
|
27
|
-
import"./index-
|
|
28
|
-
import"./index-
|
|
29
|
-
import"./index-
|
|
28
|
+
import"./index-sb1s03y9.js";
|
|
29
|
+
import"./index-fhh02gwx.js";
|
|
30
|
+
import"./index-nyn01yrz.js";
|
|
30
31
|
import"./index-b43rt5ph.js";
|
|
31
32
|
import"./index-q7sjgr1y.js";
|
|
32
|
-
import"./index-
|
|
33
|
-
import"./index-
|
|
34
|
-
import"./index-
|
|
35
|
-
import"./index-
|
|
36
|
-
import"./index-
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
39
|
-
import"./index-
|
|
33
|
+
import"./index-sxcfszbe.js";
|
|
34
|
+
import"./index-wwr67xc0.js";
|
|
35
|
+
import"./index-ksybszed.js";
|
|
36
|
+
import"./index-0vgs5r39.js";
|
|
37
|
+
import"./index-b3pmzbh1.js";
|
|
38
|
+
import"./index-2s7dvzff.js";
|
|
39
|
+
import"./index-2znfa537.js";
|
|
40
|
+
import"./index-bm5xrfnx.js";
|
|
40
41
|
import"./index-rtry5xyf.js";
|
|
41
|
-
import"./index-
|
|
42
|
+
import"./index-s96dpjsk.js";
|
|
42
43
|
import"./index-3qf1vxtb.js";
|
|
43
44
|
import"./index-n832052r.js";
|
|
44
|
-
import"./index-
|
|
45
|
-
import"./index-
|
|
46
|
-
import"./index-
|
|
47
|
-
import"./index-
|
|
48
|
-
import"./index-
|
|
49
|
-
import"./index-
|
|
45
|
+
import"./index-p6xsgk4r.js";
|
|
46
|
+
import"./index-83m0y4cj.js";
|
|
47
|
+
import"./index-fgp96k3r.js";
|
|
48
|
+
import"./index-br3mvbsa.js";
|
|
49
|
+
import"./index-bernkwgf.js";
|
|
50
|
+
import"./index-dvbf6fpn.js";
|
|
50
51
|
import"./index-rdm3px0g.js";
|
|
51
52
|
import"./index-ry16d01s.js";
|
|
52
|
-
import"./index-
|
|
53
|
+
import"./index-5qt9yf5w.js";
|
|
53
54
|
import {
|
|
54
55
|
resolveHiveKnowledgePath
|
|
55
|
-
} from "./index-
|
|
56
|
+
} from "./index-76ng6vmq.js";
|
|
56
57
|
import"./index-vzm6zre7.js";
|
|
57
58
|
import"./index-ae75rja9.js";
|
|
58
|
-
import"./index-
|
|
59
|
-
import"./index-
|
|
59
|
+
import"./index-9ttqbhvw.js";
|
|
60
|
+
import"./index-bx1wgn3a.js";
|
|
60
61
|
import"./index-7g4c7s5r.js";
|
|
61
|
-
import"./index-
|
|
62
|
-
import"./index-
|
|
62
|
+
import"./index-nprdr0sm.js";
|
|
63
|
+
import"./index-nbdmdyke.js";
|
|
63
64
|
import"./index-1xnse449.js";
|
|
64
65
|
import"./index-ee6ydtfe.js";
|
|
65
|
-
import"./index-
|
|
66
|
+
import"./index-3bfzpzsb.js";
|
|
66
67
|
import"./index-0mhftbpp.js";
|
|
67
68
|
import"./index-a1w58b47.js";
|
|
68
|
-
import"./index-
|
|
69
|
+
import"./index-yj24ny5k.js";
|
|
69
70
|
import"./index-sxt7fgcw.js";
|
|
70
71
|
import"./index-bk5tah7q.js";
|
|
71
72
|
import"./index-bpmtbmy9.js";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
bunSpawn
|
|
4
|
+
} from "./index-2s7dvzff.js";
|
|
5
|
+
import {
|
|
6
|
+
init_git_executable,
|
|
7
|
+
resolveGitExecutable
|
|
8
|
+
} from "./index-0mhftbpp.js";
|
|
9
|
+
|
|
10
|
+
// src/hooks/delegation-gate/worktree-ownership-tag.ts
|
|
11
|
+
import * as fs from "fs";
|
|
12
|
+
import * as path from "path";
|
|
13
|
+
init_git_executable();
|
|
14
|
+
var OWNERSHIP_TAG_SCAN_TIMEOUT_MS = 2000;
|
|
15
|
+
var MAX_OWNERSHIP_TAGS = 512;
|
|
16
|
+
function decodeTagPart(value) {
|
|
17
|
+
if (!value || !/^[A-Za-z0-9_-]+$/.test(value))
|
|
18
|
+
return null;
|
|
19
|
+
const decoded = Buffer.from(value, "base64url").toString("utf8");
|
|
20
|
+
return decoded && Buffer.from(decoded, "utf8").toString("base64url") === value ? decoded : null;
|
|
21
|
+
}
|
|
22
|
+
async function scanBackgroundWorktreeOwnershipTagsForRecovery(directory) {
|
|
23
|
+
try {
|
|
24
|
+
fs.statSync(path.join(directory, ".git"));
|
|
25
|
+
} catch (error) {
|
|
26
|
+
if (error.code === "ENOENT") {
|
|
27
|
+
return { status: "ok", owners: [] };
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
status: "uncertain",
|
|
31
|
+
reason: `Git metadata could not be inspected: ${error instanceof Error ? error.message : String(error)}`
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
let proc;
|
|
35
|
+
try {
|
|
36
|
+
proc = bunSpawn([
|
|
37
|
+
resolveGitExecutable(),
|
|
38
|
+
"-C",
|
|
39
|
+
directory,
|
|
40
|
+
"for-each-ref",
|
|
41
|
+
`--count=${MAX_OWNERSHIP_TAGS + 1}`,
|
|
42
|
+
"--format=%(refname:strip=2)%00%(objectname)",
|
|
43
|
+
"refs/tags/swarm-preserved-owner/"
|
|
44
|
+
], {
|
|
45
|
+
stdin: "ignore",
|
|
46
|
+
stdout: "pipe",
|
|
47
|
+
stderr: "ignore",
|
|
48
|
+
timeout: OWNERSHIP_TAG_SCAN_TIMEOUT_MS
|
|
49
|
+
});
|
|
50
|
+
const exitCode = await proc.exited;
|
|
51
|
+
if (exitCode !== 0) {
|
|
52
|
+
return {
|
|
53
|
+
status: "uncertain",
|
|
54
|
+
reason: `ownership tag scan exited ${exitCode}`
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const lines = (await proc.stdout.text()).split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
58
|
+
if (lines.length > MAX_OWNERSHIP_TAGS) {
|
|
59
|
+
return {
|
|
60
|
+
status: "uncertain",
|
|
61
|
+
reason: `ownership tag scan exceeded the ${MAX_OWNERSHIP_TAGS}-tag safety bound`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const owners = [];
|
|
65
|
+
for (const line of lines) {
|
|
66
|
+
const [tag, ref, ...extra] = line.split("\x00");
|
|
67
|
+
const segments = tag?.split("/") ?? [];
|
|
68
|
+
const sessionId = decodeTagPart(segments[1] ?? "");
|
|
69
|
+
const laneId = decodeTagPart(segments[2] ?? "");
|
|
70
|
+
const callDigest = segments[3];
|
|
71
|
+
if (extra.length > 0 || segments.length !== 4 || segments[0] !== "swarm-preserved-owner" || !sessionId || !laneId || !callDigest || !/^[0-9a-f]{12}$/.test(callDigest) || !ref || !/^[0-9a-f]{40,64}$/i.test(ref)) {
|
|
72
|
+
return {
|
|
73
|
+
status: "uncertain",
|
|
74
|
+
reason: `malformed background ownership tag entry "${tag ?? ""}"`
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
owners.push({ sessionId, laneId, callDigest, ref });
|
|
78
|
+
}
|
|
79
|
+
return { status: "ok", owners };
|
|
80
|
+
} catch (error) {
|
|
81
|
+
return {
|
|
82
|
+
status: "uncertain",
|
|
83
|
+
reason: `ownership tag scan failed: ${error instanceof Error ? error.message : String(error)}`
|
|
84
|
+
};
|
|
85
|
+
} finally {
|
|
86
|
+
try {
|
|
87
|
+
proc?.kill();
|
|
88
|
+
} catch {}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { scanBackgroundWorktreeOwnershipTagsForRecovery };
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
validateSwarmPath
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-b3pmzbh1.js";
|
|
5
5
|
import {
|
|
6
6
|
observeReceiptTransition
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-5qt9yf5w.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveHiveEventsPath
|
|
10
10
|
} from "./index-ae75rja9.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveKnowledgeStoreDir
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-9ttqbhvw.js";
|
|
14
14
|
import {
|
|
15
15
|
assertProjectRoot,
|
|
16
16
|
atomicWriteFile
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-bx1wgn3a.js";
|
|
18
18
|
import {
|
|
19
19
|
require_proper_lockfile
|
|
20
20
|
} from "./index-7g4c7s5r.js";
|
|
21
21
|
import {
|
|
22
22
|
emit
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-nprdr0sm.js";
|
|
24
24
|
import {
|
|
25
25
|
canonicalRootKey
|
|
26
26
|
} from "./index-1xnse449.js";
|
|
27
27
|
import {
|
|
28
28
|
loadPluginConfigWithMeta
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-3bfzpzsb.js";
|
|
30
30
|
import {
|
|
31
31
|
KnowledgeConfigSchema,
|
|
32
32
|
init_schema
|
|
33
|
-
} from "./index-
|
|
33
|
+
} from "./index-yj24ny5k.js";
|
|
34
34
|
import {
|
|
35
35
|
init_logger,
|
|
36
36
|
warn
|
|
@@ -2813,7 +2813,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
|
|
|
2813
2813
|
}
|
|
2814
2814
|
let bumps = 0;
|
|
2815
2815
|
if (deltas.length > 0) {
|
|
2816
|
-
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-
|
|
2816
|
+
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-85metj89.js");
|
|
2817
2817
|
bumps = await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
|
|
2818
2818
|
}
|
|
2819
2819
|
return {
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
detectWindowsWrites,
|
|
15
15
|
getSharedClassifierGuardrailBlock,
|
|
16
16
|
resolveWriteTargets
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-3zcds757.js";
|
|
18
18
|
import {
|
|
19
19
|
checkFileAuthority,
|
|
20
20
|
classifyFile,
|
|
21
21
|
isInDeclaredScope,
|
|
22
22
|
redactPath,
|
|
23
23
|
redactShellCommand
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-5reh1bjz.js";
|
|
25
25
|
|
|
26
26
|
// src/services/guardrail-explain-service.ts
|
|
27
27
|
import path from "path";
|
|
@@ -137,6 +137,20 @@ function bunHash(input) {
|
|
|
137
137
|
}
|
|
138
138
|
return hash;
|
|
139
139
|
}
|
|
140
|
+
var DEFAULT_BUN_SPAWN_MAX_BUFFER_BYTES = 5 * 1024 * 1024;
|
|
141
|
+
|
|
142
|
+
class BunCompatOutputLimitError extends Error {
|
|
143
|
+
limit;
|
|
144
|
+
captured;
|
|
145
|
+
total;
|
|
146
|
+
constructor(limit, captured, total) {
|
|
147
|
+
super(`Subprocess output exceeded the ${limit}-byte buffer limit after capturing ${captured} bytes (${total} bytes observed)`);
|
|
148
|
+
this.name = "BunCompatOutputLimitError";
|
|
149
|
+
this.limit = limit;
|
|
150
|
+
this.captured = captured;
|
|
151
|
+
this.total = total;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
140
154
|
async function killProcessTreeImpl(pid, signal, directKill, wasDetached) {
|
|
141
155
|
if (typeof pid !== "number" || pid <= 0) {
|
|
142
156
|
directKill(signal);
|
|
@@ -267,32 +281,95 @@ function wrapSpawnFailure(error, cwd, executable) {
|
|
|
267
281
|
return err;
|
|
268
282
|
return describeSpawnCwdFailure(cwd, executable, err) ?? err;
|
|
269
283
|
}
|
|
270
|
-
function
|
|
284
|
+
function normalizedMaxBuffer(value) {
|
|
285
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : DEFAULT_BUN_SPAWN_MAX_BUFFER_BYTES;
|
|
286
|
+
}
|
|
287
|
+
function createOutputOverflowController(limit, requestKill) {
|
|
288
|
+
let error;
|
|
289
|
+
let killRequested = false;
|
|
290
|
+
let resolveCompleted;
|
|
291
|
+
const completed = new Promise((resolve) => {
|
|
292
|
+
resolveCompleted = resolve;
|
|
293
|
+
});
|
|
294
|
+
return {
|
|
295
|
+
get error() {
|
|
296
|
+
return error;
|
|
297
|
+
},
|
|
298
|
+
completed,
|
|
299
|
+
overflow(captured, total) {
|
|
300
|
+
if (error)
|
|
301
|
+
return;
|
|
302
|
+
error = new BunCompatOutputLimitError(limit, captured, total);
|
|
303
|
+
if (killRequested)
|
|
304
|
+
return;
|
|
305
|
+
killRequested = true;
|
|
306
|
+
try {
|
|
307
|
+
requestKill();
|
|
308
|
+
} catch {}
|
|
309
|
+
},
|
|
310
|
+
complete() {
|
|
311
|
+
resolveCompleted();
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function streamFromNode(pipe, limit, controller) {
|
|
316
|
+
if (!pipe)
|
|
317
|
+
return staticStream("");
|
|
318
|
+
let mode;
|
|
271
319
|
let collected;
|
|
272
|
-
let readerClaimed = false;
|
|
273
320
|
const collect = () => {
|
|
274
|
-
if (
|
|
321
|
+
if (mode === "reader") {
|
|
275
322
|
return Promise.reject(new TypeError("Subprocess output is already consumed by a reader"));
|
|
276
323
|
}
|
|
277
|
-
|
|
324
|
+
mode = "buffered";
|
|
325
|
+
if (collected)
|
|
326
|
+
return collected;
|
|
327
|
+
collected = new Promise((resolve) => {
|
|
278
328
|
if (!pipe) {
|
|
279
329
|
resolve(Buffer.alloc(0));
|
|
280
330
|
return;
|
|
281
331
|
}
|
|
282
332
|
const chunks = [];
|
|
333
|
+
let captured = 0;
|
|
334
|
+
let total = 0;
|
|
335
|
+
let finished = false;
|
|
336
|
+
const finish = () => {
|
|
337
|
+
if (finished)
|
|
338
|
+
return;
|
|
339
|
+
finished = true;
|
|
340
|
+
resolve(Buffer.concat(chunks));
|
|
341
|
+
};
|
|
283
342
|
pipe.on("data", (chunk) => {
|
|
284
|
-
|
|
343
|
+
const bytes = typeof chunk === "string" ? Buffer.from(chunk) : chunk;
|
|
344
|
+
total += bytes.byteLength;
|
|
345
|
+
if (controller?.error || limit === undefined)
|
|
346
|
+
return;
|
|
347
|
+
const remaining = limit - captured;
|
|
348
|
+
if (remaining > 0) {
|
|
349
|
+
const retained = Buffer.from(bytes.subarray(0, remaining));
|
|
350
|
+
chunks.push(retained);
|
|
351
|
+
captured += retained.byteLength;
|
|
352
|
+
}
|
|
353
|
+
if (bytes.byteLength > remaining) {
|
|
354
|
+
controller?.overflow(captured, total);
|
|
355
|
+
}
|
|
285
356
|
});
|
|
286
|
-
pipe.on("end",
|
|
287
|
-
pipe.on("
|
|
357
|
+
pipe.on("end", finish);
|
|
358
|
+
pipe.on("close", finish);
|
|
359
|
+
pipe.on("error", finish);
|
|
360
|
+
}).then(async (bytes) => {
|
|
361
|
+
await controller?.completed;
|
|
362
|
+
if (controller?.error)
|
|
363
|
+
throw controller.error;
|
|
364
|
+
return bytes;
|
|
288
365
|
});
|
|
289
366
|
return collected;
|
|
290
367
|
};
|
|
291
368
|
const toWebReadable = () => {
|
|
292
369
|
if (!pipe) {
|
|
293
370
|
return new ReadableStream({
|
|
294
|
-
start(
|
|
295
|
-
|
|
371
|
+
start(controller2) {
|
|
372
|
+
controller2.close();
|
|
296
373
|
}
|
|
297
374
|
});
|
|
298
375
|
}
|
|
@@ -301,12 +378,12 @@ function streamFromNode(pipe) {
|
|
|
301
378
|
return r.toWeb();
|
|
302
379
|
}
|
|
303
380
|
return new ReadableStream({
|
|
304
|
-
start(
|
|
381
|
+
start(controller2) {
|
|
305
382
|
pipe.on("data", (chunk) => {
|
|
306
|
-
|
|
383
|
+
controller2.enqueue(typeof chunk === "string" ? new TextEncoder().encode(chunk) : new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength));
|
|
307
384
|
});
|
|
308
|
-
pipe.on("end", () =>
|
|
309
|
-
pipe.on("error", (err) =>
|
|
385
|
+
pipe.on("end", () => controller2.close());
|
|
386
|
+
pipe.on("error", (err) => controller2.error(err));
|
|
310
387
|
},
|
|
311
388
|
cancel() {
|
|
312
389
|
const destroyable = pipe;
|
|
@@ -318,7 +395,7 @@ function streamFromNode(pipe) {
|
|
|
318
395
|
}
|
|
319
396
|
});
|
|
320
397
|
};
|
|
321
|
-
|
|
398
|
+
const result = {
|
|
322
399
|
async text() {
|
|
323
400
|
return (await collect()).toString("utf-8");
|
|
324
401
|
},
|
|
@@ -327,18 +404,27 @@ function streamFromNode(pipe) {
|
|
|
327
404
|
return new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
|
|
328
405
|
},
|
|
329
406
|
getReader() {
|
|
330
|
-
if (
|
|
407
|
+
if (mode !== undefined) {
|
|
331
408
|
throw new TypeError("Subprocess output is already consumed");
|
|
332
409
|
}
|
|
333
|
-
|
|
410
|
+
mode = "reader";
|
|
334
411
|
return toWebReadable().getReader();
|
|
335
412
|
}
|
|
336
413
|
};
|
|
414
|
+
if (pipe && controller && limit !== undefined) {
|
|
415
|
+
queueMicrotask(() => {
|
|
416
|
+
if (mode === undefined)
|
|
417
|
+
collect().catch(() => {
|
|
418
|
+
return;
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
return result;
|
|
337
423
|
}
|
|
338
424
|
function mapStdio(v) {
|
|
339
425
|
return v ?? "pipe";
|
|
340
426
|
}
|
|
341
|
-
function streamFromBun(stream) {
|
|
427
|
+
function streamFromBun(stream, limit, controller) {
|
|
342
428
|
if (!stream || typeof stream !== "object") {
|
|
343
429
|
const empty = {
|
|
344
430
|
async text() {
|
|
@@ -349,8 +435,8 @@ function streamFromBun(stream) {
|
|
|
349
435
|
},
|
|
350
436
|
getReader() {
|
|
351
437
|
return new ReadableStream({
|
|
352
|
-
start(
|
|
353
|
-
|
|
438
|
+
start(controller2) {
|
|
439
|
+
controller2.close();
|
|
354
440
|
}
|
|
355
441
|
}).getReader();
|
|
356
442
|
}
|
|
@@ -358,36 +444,82 @@ function streamFromBun(stream) {
|
|
|
358
444
|
return empty;
|
|
359
445
|
}
|
|
360
446
|
const candidate = stream;
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const chunks = [];
|
|
367
|
-
for (;; ) {
|
|
368
|
-
const { done, value } = await reader.read();
|
|
369
|
-
if (done)
|
|
370
|
-
break;
|
|
371
|
-
if (value)
|
|
372
|
-
chunks.push(value);
|
|
373
|
-
}
|
|
374
|
-
const total = chunks.reduce((acc, c) => acc + c.byteLength, 0);
|
|
375
|
-
const out = new Uint8Array(total);
|
|
376
|
-
let off = 0;
|
|
377
|
-
for (const c of chunks) {
|
|
378
|
-
out.set(c, off);
|
|
379
|
-
off += c.byteLength;
|
|
447
|
+
let mode;
|
|
448
|
+
let collected;
|
|
449
|
+
const collect = () => {
|
|
450
|
+
if (mode === "reader") {
|
|
451
|
+
return Promise.reject(new TypeError("Subprocess output is already consumed by a reader"));
|
|
380
452
|
}
|
|
381
|
-
|
|
453
|
+
mode = "buffered";
|
|
454
|
+
collected ??= (async () => {
|
|
455
|
+
if (typeof candidate.getReader !== "function")
|
|
456
|
+
return new Uint8Array(0);
|
|
457
|
+
const reader = candidate.getReader();
|
|
458
|
+
const chunks = [];
|
|
459
|
+
let captured = 0;
|
|
460
|
+
let total = 0;
|
|
461
|
+
try {
|
|
462
|
+
for (;; ) {
|
|
463
|
+
const { done, value } = await reader.read();
|
|
464
|
+
if (done)
|
|
465
|
+
break;
|
|
466
|
+
if (!value)
|
|
467
|
+
continue;
|
|
468
|
+
total += value.byteLength;
|
|
469
|
+
if (controller?.error || limit === undefined)
|
|
470
|
+
continue;
|
|
471
|
+
const remaining = limit - captured;
|
|
472
|
+
if (remaining > 0) {
|
|
473
|
+
const retained = value.slice(0, remaining);
|
|
474
|
+
chunks.push(retained);
|
|
475
|
+
captured += retained.byteLength;
|
|
476
|
+
}
|
|
477
|
+
if (value.byteLength > remaining) {
|
|
478
|
+
controller?.overflow(captured, total);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
} finally {
|
|
482
|
+
reader.releaseLock();
|
|
483
|
+
}
|
|
484
|
+
await controller?.completed;
|
|
485
|
+
if (controller?.error)
|
|
486
|
+
throw controller.error;
|
|
487
|
+
const out = new Uint8Array(captured);
|
|
488
|
+
let offset = 0;
|
|
489
|
+
for (const chunk of chunks) {
|
|
490
|
+
out.set(chunk, offset);
|
|
491
|
+
offset += chunk.byteLength;
|
|
492
|
+
}
|
|
493
|
+
return out;
|
|
494
|
+
})();
|
|
495
|
+
return collected;
|
|
382
496
|
};
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
497
|
+
const result = {
|
|
498
|
+
async text() {
|
|
499
|
+
return new TextDecoder().decode(await collect());
|
|
500
|
+
},
|
|
501
|
+
bytes: collect,
|
|
502
|
+
getReader() {
|
|
503
|
+
if (mode !== undefined) {
|
|
504
|
+
throw new TypeError("Subprocess output is already consumed");
|
|
505
|
+
}
|
|
506
|
+
mode = "reader";
|
|
507
|
+
return typeof candidate.getReader === "function" ? candidate.getReader() : new ReadableStream({
|
|
508
|
+
start(streamController) {
|
|
509
|
+
streamController.close();
|
|
510
|
+
}
|
|
511
|
+
}).getReader();
|
|
388
512
|
}
|
|
389
|
-
}
|
|
390
|
-
|
|
513
|
+
};
|
|
514
|
+
if (typeof candidate.getReader === "function" && controller && limit !== undefined) {
|
|
515
|
+
queueMicrotask(() => {
|
|
516
|
+
if (mode === undefined)
|
|
517
|
+
collect().catch(() => {
|
|
518
|
+
return;
|
|
519
|
+
});
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
return result;
|
|
391
523
|
}
|
|
392
524
|
function mergeEnvForChild(baseEnv, envOverrides) {
|
|
393
525
|
const hasExplicitBaseEnv = baseEnv !== undefined;
|
|
@@ -448,11 +580,13 @@ function spawnCreationFailure(error) {
|
|
|
448
580
|
};
|
|
449
581
|
}
|
|
450
582
|
function bunSpawn(cmd, options) {
|
|
583
|
+
const maxBuffer = normalizedMaxBuffer(options?.maxBuffer);
|
|
451
584
|
const bun = getBun();
|
|
452
585
|
if (bun?.spawn) {
|
|
453
586
|
const mergedEnv2 = mergeEnvForChild(options?.env, options?.envOverrides);
|
|
454
587
|
const spawnOpts = { ...options };
|
|
455
588
|
delete spawnOpts.killProcessTree;
|
|
589
|
+
delete spawnOpts.maxBuffer;
|
|
456
590
|
if (mergedEnv2 !== undefined)
|
|
457
591
|
spawnOpts.env = mergedEnv2;
|
|
458
592
|
if (options?.timeout && options.timeout > 0 && options.killProcessTree !== true) {
|
|
@@ -472,6 +606,11 @@ function bunSpawn(cmd, options) {
|
|
|
472
606
|
const proc2 = spawned;
|
|
473
607
|
const killBunTree = createProcessTreeKiller(proc2.pid, (sig) => proc2.kill(sig), true);
|
|
474
608
|
const killBunProcess = (sig) => options?.killProcessTree ? killBunTree(sig) : Promise.resolve(proc2.kill(sig));
|
|
609
|
+
const outputController2 = createOutputOverflowController(maxBuffer, () => {
|
|
610
|
+
killBunProcess("SIGKILL").catch(() => {
|
|
611
|
+
return;
|
|
612
|
+
});
|
|
613
|
+
});
|
|
475
614
|
let timeoutHandle2;
|
|
476
615
|
if (options?.killProcessTree === true && options.timeout && options.timeout > 0) {
|
|
477
616
|
timeoutHandle2 = setTimeout(() => {
|
|
@@ -487,10 +626,11 @@ function bunSpawn(cmd, options) {
|
|
|
487
626
|
const exited2 = proc2.exited.finally(() => {
|
|
488
627
|
if (timeoutHandle2 !== undefined)
|
|
489
628
|
clearTimeout(timeoutHandle2);
|
|
629
|
+
outputController2.complete();
|
|
490
630
|
});
|
|
491
631
|
return {
|
|
492
|
-
stdout: streamFromBun(proc2.stdout),
|
|
493
|
-
stderr: streamFromBun(proc2.stderr),
|
|
632
|
+
stdout: streamFromBun(proc2.stdout, maxBuffer, outputController2),
|
|
633
|
+
stderr: streamFromBun(proc2.stderr, maxBuffer, outputController2),
|
|
494
634
|
exited: exited2,
|
|
495
635
|
get exitCode() {
|
|
496
636
|
return proc2.exitCode;
|
|
@@ -533,6 +673,11 @@ function bunSpawn(cmd, options) {
|
|
|
533
673
|
proc.kill(signal);
|
|
534
674
|
return Promise.resolve();
|
|
535
675
|
};
|
|
676
|
+
const outputController = createOutputOverflowController(maxBuffer, () => {
|
|
677
|
+
killChild("SIGKILL").catch(() => {
|
|
678
|
+
return;
|
|
679
|
+
});
|
|
680
|
+
});
|
|
536
681
|
let timeoutHandle;
|
|
537
682
|
let observedSignal = null;
|
|
538
683
|
let observedSpawnError = null;
|
|
@@ -560,10 +705,11 @@ function bunSpawn(cmd, options) {
|
|
|
560
705
|
}).finally(() => {
|
|
561
706
|
if (timeoutHandle !== undefined)
|
|
562
707
|
clearTimeout(timeoutHandle);
|
|
708
|
+
outputController.complete();
|
|
563
709
|
});
|
|
564
710
|
return {
|
|
565
|
-
stdout: streamFromNode(proc.stdout),
|
|
566
|
-
stderr: streamFromNode(proc.stderr),
|
|
711
|
+
stdout: streamFromNode(proc.stdout, maxBuffer, outputController),
|
|
712
|
+
stderr: streamFromNode(proc.stderr, maxBuffer, outputController),
|
|
567
713
|
exited,
|
|
568
714
|
get exitCode() {
|
|
569
715
|
return observedSpawnError ? null : proc.exitCode;
|
|
@@ -596,7 +742,10 @@ function bunSpawnSync(cmd, options) {
|
|
|
596
742
|
const bun = getBun();
|
|
597
743
|
if (bun?.spawnSync) {
|
|
598
744
|
const mergedEnv2 = mergeEnvForChild(options?.env, options?.envOverrides);
|
|
599
|
-
const spawnOpts =
|
|
745
|
+
const spawnOpts = { ...options };
|
|
746
|
+
delete spawnOpts.maxBuffer;
|
|
747
|
+
if (mergedEnv2 !== undefined)
|
|
748
|
+
spawnOpts.env = mergedEnv2;
|
|
600
749
|
try {
|
|
601
750
|
return bun.spawnSync(cmd, spawnOpts);
|
|
602
751
|
} catch (error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
authorizeCuration
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-bm5xrfnx.js";
|
|
5
5
|
import {
|
|
6
6
|
findNearDuplicate,
|
|
7
7
|
inferTags,
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
resolveSwarmKnowledgePath,
|
|
10
10
|
resolveSwarmRejectedPath,
|
|
11
11
|
transactKnowledge
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-76ng6vmq.js";
|
|
13
13
|
import {
|
|
14
14
|
resolveKnowledgeStoreDir
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-9ttqbhvw.js";
|
|
16
16
|
import {
|
|
17
17
|
atomicWriteFile
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-bx1wgn3a.js";
|
|
19
19
|
import {
|
|
20
20
|
require_proper_lockfile
|
|
21
21
|
} from "./index-7g4c7s5r.js";
|