opencode-swarm 7.135.1 → 7.135.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/critic-gate/SKILL.md +10 -0
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +24 -21
- package/.opencode/skills/swarm-pr-review/SKILL.md +55 -42
- package/dist/agents/explorer.d.ts +1 -1
- package/dist/agents/index.d.ts +12 -0
- package/dist/background/candidate-contract.d.ts +113 -0
- package/dist/background/candidate-parser.d.ts +8 -29
- package/dist/background/pr-review-trigger-contract.d.ts +197 -0
- package/dist/background/workspace-snapshot.d.ts +26 -0
- package/dist/cli/{config-doctor-6398t3a6.js → config-doctor-4nznqeca.js} +3 -2
- package/dist/cli/{core-9876t6cs.js → core-4z1s2ak1.js} +3 -2
- package/dist/cli/{curation-policy-f7qz4tez.js → curation-policy-81m14519.js} +5 -5
- package/dist/cli/{curator-drift-9q6f85bm.js → curator-drift-jpap6hv4.js} +2 -2
- package/dist/cli/{curator-fjhyezyx.js → curator-e0z5gcww.js} +28 -27
- package/dist/cli/curator-llm-factory-fem13y9n.js +57 -0
- package/dist/cli/{dispatch-gxbeb2ps.js → dispatch-b1fge4xk.js} +2 -2
- package/dist/cli/{evidence-summary-service-0cczdmjv.js → evidence-summary-service-w006jnpg.js} +6 -6
- package/dist/cli/{explorer-jp0nen03.js → explorer-15gqzxh8.js} +1 -1
- package/dist/cli/{gate-evidence-8zrwdj69.js → gate-evidence-aenyz6vt.js} +4 -4
- package/dist/cli/guardrail-explain-wgaj23hd.js +58 -0
- package/dist/cli/{guardrail-log-bd45kw0x.js → guardrail-log-04p1z1vt.js} +5 -4
- package/dist/cli/{hive-promoter-f2yh22m1.js → hive-promoter-k345z42k.js} +28 -27
- package/dist/cli/{index-wdkkf3xg.js → index-168phrs7.js} +12 -10
- package/dist/cli/{index-xhpmagdm.js → index-30pg2rs3.js} +2 -2
- package/dist/cli/{index-bjrkg4tc.js → index-36v55ryg.js} +2 -2
- package/dist/cli/index-3jcyn8g6.js +1219 -0
- package/dist/cli/{index-7an2qn0s.js → index-45t7w06b.js} +2 -2
- package/dist/cli/{index-2ghkk9ve.js → index-4qzeef9h.js} +1 -1
- package/dist/cli/{index-4pdrmemy.js → index-5436jxnw.js} +2 -2
- package/dist/cli/{index-5vp9gka3.js → index-a01r818w.js} +5 -3
- package/dist/cli/{index-nbnqf4fj.js → index-bcmrg4t4.js} +1 -1
- package/dist/cli/{index-fwkqq9mq.js → index-c9ddxv4k.js} +57 -8
- package/dist/cli/{index-ens0gt38.js → index-cggqh2dz.js} +7 -7
- package/dist/cli/{index-vxv732ex.js → index-dg1njnms.js} +7 -4
- package/dist/cli/{index-aky90eqz.js → index-dwargd10.js} +11596 -10043
- package/dist/cli/{index-yhba8swx.js → index-dzyjb33e.js} +1 -1
- package/dist/cli/{index-xg9repnx.js → index-ey29aap6.js} +1 -1
- package/dist/cli/{index-5wx8wdxg.js → index-f52jt0am.js} +5 -5
- package/dist/cli/{index-2nqsr1dx.js → index-gxxxmajn.js} +4 -4
- package/dist/cli/{index-jtshf1pd.js → index-kb7qy7an.js} +4 -2
- package/dist/cli/{index-b7p0mp2q.js → index-mrtms113.js} +4 -4
- package/dist/cli/{index-dzaarxhg.js → index-p5kr35wh.js} +8 -1210
- package/dist/cli/{index-j89zmcpx.js → index-p9ngg568.js} +6 -6
- package/dist/cli/{index-g1drmgxe.js → index-rv7s2k9y.js} +3 -3
- package/dist/cli/{index-z085b4ka.js → index-tcn457d5.js} +1 -1
- package/dist/cli/{index-fpkb3mw1.js → index-vg3yx648.js} +1 -1
- package/dist/cli/{index-13xxjfhn.js → index-vm4xw9z3.js} +1 -1
- package/dist/cli/{index-jxchddjk.js → index-wygxzvtf.js} +6 -4
- package/dist/cli/{index-b4z7s917.js → index-x20cgr2q.js} +1 -1
- package/dist/cli/{index-qe3v54nb.js → index-y111zefa.js} +64 -23
- package/dist/cli/{index-w80r3axq.js → index-y47crdg9.js} +34 -32
- package/dist/cli/{index-3nasn371.js → index-y6a7gjtj.js} +126 -42
- package/dist/cli/{index-247b1c1m.js → index-yf30m841.js} +3 -3
- package/dist/cli/index.js +31 -29
- package/dist/cli/{knowledge-escalator-4tp3yy7e.js → knowledge-escalator-42ecv7m3.js} +6 -6
- package/dist/cli/{knowledge-events-7854gb3p.js → knowledge-events-zhna7v3g.js} +4 -4
- package/dist/cli/{knowledge-link-etrfntkd.js → knowledge-link-mm1w967j.js} +3 -3
- package/dist/cli/{knowledge-store-cxnr6v01.js → knowledge-store-56jcfc5k.js} +4 -4
- package/dist/cli/{knowledge-validator-3n5t55qy.js → knowledge-validator-8zk0pnb6.js} +7 -7
- package/dist/cli/{pending-delegations-4z3tkkct.js → pending-delegations-qajsxct0.js} +4 -4
- package/dist/cli/{pr-subscriptions-29j794kd.js → pr-subscriptions-qhr41epq.js} +4 -4
- package/dist/cli/{scan-cursor-0cexjh3b.js → scan-cursor-h3ndxd41.js} +5 -5
- package/dist/cli/{schema-rs5a7ywx.js → schema-r6wmd7zp.js} +2 -1
- package/dist/cli/{scope-persistence-1vsnkmm4.js → scope-persistence-h2fpgxww.js} +3 -3
- package/dist/cli/{skill-generator-n0h9n0zd.js → skill-generator-12cftsx4.js} +8 -8
- package/dist/cli/{workspace-snapshot-9h5za0s6.js → workspace-snapshot-jmyamqnv.js} +6 -1
- package/dist/cli/{worktree-collision-ownership-dtwr0xj4.js → worktree-collision-ownership-13btcj9g.js} +5 -5
- package/dist/commands/approve-plan-critic.d.ts +21 -0
- package/dist/commands/registry.d.ts +9 -1
- package/dist/config/cache-paths.d.ts +48 -0
- package/dist/config/constants.d.ts +18 -0
- package/dist/config/host-path.d.ts +95 -0
- package/dist/config/lane-context.d.ts +117 -0
- package/dist/config/lane-permissions.d.ts +277 -0
- package/dist/config/schema.d.ts +10 -0
- package/dist/config/swarm-branch.d.ts +130 -0
- package/dist/hooks/delegation-gate.d.ts +42 -1
- package/dist/hooks/pr-workflow-gate.d.ts +30 -4
- package/dist/hooks/repo-graph-builder.d.ts +18 -0
- package/dist/hooks/skill-propagation-gate.d.ts +10 -0
- package/dist/index.js +459 -443
- package/dist/memory/schema.d.ts +4 -4
- package/dist/tools/approve-plan-critic.d.ts +5 -0
- package/dist/tools/convene-council.d.ts +3 -3
- package/dist/tools/dispatch-lanes.d.ts +65 -7
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/manifest.d.ts +1 -0
- package/dist/tools/repo-graph/builder.d.ts +20 -2
- package/dist/tools/repo-graph/incremental.d.ts +18 -1
- package/dist/tools/repo-graph/ontology.d.ts +8 -0
- package/dist/tools/repo-graph/types.d.ts +62 -1
- package/dist/tools/repo-graph.d.ts +1 -1
- package/dist/tools/submit-phase-council-verdicts.d.ts +3 -3
- package/dist/tools/tool-metadata.d.ts +4 -0
- package/dist/tools/write-final-council-evidence.d.ts +3 -3
- package/dist/tools/write-pr-review-trigger-eval.d.ts +34 -63
- package/package.json +1 -1
- package/dist/cli/curator-llm-factory-wr3zmy2c.js +0 -56
- package/dist/cli/guardrail-explain-g1s89b3e.js +0 -57
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./index-ae75rja9.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveKnowledgeStoreDir
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-dzyjb33e.js";
|
|
10
10
|
import {
|
|
11
11
|
atomicWriteFile
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-ey29aap6.js";
|
|
13
13
|
import {
|
|
14
14
|
init_knowledge_types,
|
|
15
15
|
isActiveStatus
|
|
@@ -702,7 +702,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
702
702
|
const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
|
|
703
703
|
if (atFloor.length === 0 && recovered.length === 0)
|
|
704
704
|
return;
|
|
705
|
-
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-
|
|
705
|
+
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-zhna7v3g.js");
|
|
706
706
|
const rollups = await readKnowledgeCounterRollups(directory);
|
|
707
707
|
const flagIds = new Set;
|
|
708
708
|
for (const e of atFloor) {
|
|
@@ -769,11 +769,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
if (action === "quarantine" && toQuarantine.length > 0) {
|
|
772
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
773
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
772
|
+
const { quarantineEntry } = await import("./knowledge-validator-8zk0pnb6.js");
|
|
773
|
+
const { KnowledgeConfigSchema } = await import("./schema-r6wmd7zp.js");
|
|
774
774
|
let config;
|
|
775
775
|
try {
|
|
776
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
776
|
+
const { loadPluginConfigWithMeta } = await import("./index-168phrs7.js");
|
|
777
777
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
778
778
|
config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
779
779
|
} catch {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./index-ae75rja9.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveKnowledgeStoreDir
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-dzyjb33e.js";
|
|
8
8
|
import {
|
|
9
9
|
atomicWriteFile
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-ey29aap6.js";
|
|
11
11
|
import {
|
|
12
12
|
require_proper_lockfile
|
|
13
13
|
} from "./index-7g4c7s5r.js";
|
|
@@ -608,7 +608,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
|
|
|
608
608
|
deltas.push({ id, delta });
|
|
609
609
|
}
|
|
610
610
|
if (deltas.length > 0) {
|
|
611
|
-
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-
|
|
611
|
+
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-56jcfc5k.js");
|
|
612
612
|
await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
|
|
613
613
|
}
|
|
614
614
|
return {
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
DEFAULT_WORKTREE_ISOLATION_CONFIG,
|
|
4
3
|
ExternalSkillsConfigSchema,
|
|
5
4
|
GATE_CONFIG_KNOWN_SECTION_KEYS,
|
|
6
5
|
GateConfigSchema,
|
|
7
6
|
PluginConfigSchema,
|
|
8
|
-
init_constants,
|
|
9
7
|
init_schema,
|
|
10
8
|
resolveExternalSkillsConfig
|
|
11
|
-
} from "./index-
|
|
9
|
+
} from "./index-p5kr35wh.js";
|
|
12
10
|
import {
|
|
13
11
|
advisoryWarn,
|
|
14
12
|
init_warning_buffer
|
|
15
13
|
} from "./index-4rhhvd1a.js";
|
|
14
|
+
import {
|
|
15
|
+
DEFAULT_WORKTREE_ISOLATION_CONFIG,
|
|
16
|
+
init_constants
|
|
17
|
+
} from "./index-3jcyn8g6.js";
|
|
16
18
|
import {
|
|
17
19
|
MAX_MERGE_DEPTH,
|
|
18
20
|
deepMerge,
|
|
@@ -715,4 +717,4 @@ function resolveWorktreeIsolationConfig(config) {
|
|
|
715
717
|
// src/config/index.ts
|
|
716
718
|
var _internals = { loadPluginConfigWithMeta };
|
|
717
719
|
|
|
718
|
-
export { loadPluginConfig, loadPluginConfigWithMeta, getSafeDefaultConfigLoadResult, loadPluginConfigWithMetaAsync, loadAgentPrompt, exports_loader, init_loader,
|
|
720
|
+
export { resolveWorktreeIsolationConfig, loadPluginConfig, loadPluginConfigWithMeta, getSafeDefaultConfigLoadResult, loadPluginConfigWithMetaAsync, loadAgentPrompt, exports_loader, init_loader, _internals };
|
|
@@ -131,10 +131,16 @@ function killProcessTreeImpl(pid, signal, directKill, wasDetached) {
|
|
|
131
131
|
}
|
|
132
132
|
if (process.platform === "win32") {
|
|
133
133
|
try {
|
|
134
|
-
nodeSpawnSync("taskkill", ["/PID", String(pid), "/T", "/F"]
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
const result = nodeSpawnSync("taskkill", ["/PID", String(pid), "/T", "/F"], {
|
|
135
|
+
cwd: process.cwd(),
|
|
136
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
137
|
+
timeout: 5000,
|
|
138
|
+
windowsHide: true
|
|
139
|
+
});
|
|
140
|
+
if (!result.error && result.status === 0)
|
|
141
|
+
return;
|
|
142
|
+
} catch {}
|
|
143
|
+
directKill();
|
|
138
144
|
return;
|
|
139
145
|
}
|
|
140
146
|
if (wasDetached) {
|
|
@@ -146,18 +152,26 @@ function killProcessTreeImpl(pid, signal, directKill, wasDetached) {
|
|
|
146
152
|
directKill();
|
|
147
153
|
}
|
|
148
154
|
function streamFromNode(pipe) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
155
|
+
let collected;
|
|
156
|
+
let readerClaimed = false;
|
|
157
|
+
const collect = () => {
|
|
158
|
+
if (readerClaimed) {
|
|
159
|
+
return Promise.reject(new TypeError("Subprocess output is already consumed by a reader"));
|
|
153
160
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
161
|
+
collected ??= new Promise((resolve) => {
|
|
162
|
+
if (!pipe) {
|
|
163
|
+
resolve(Buffer.alloc(0));
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const chunks = [];
|
|
167
|
+
pipe.on("data", (chunk) => {
|
|
168
|
+
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
169
|
+
});
|
|
170
|
+
pipe.on("end", () => resolve(Buffer.concat(chunks)));
|
|
171
|
+
pipe.on("error", () => resolve(Buffer.concat(chunks)));
|
|
157
172
|
});
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
173
|
+
return collected;
|
|
174
|
+
};
|
|
161
175
|
const toWebReadable = () => {
|
|
162
176
|
if (!pipe) {
|
|
163
177
|
return new ReadableStream({
|
|
@@ -190,13 +204,17 @@ function streamFromNode(pipe) {
|
|
|
190
204
|
};
|
|
191
205
|
return {
|
|
192
206
|
async text() {
|
|
193
|
-
return (await
|
|
207
|
+
return (await collect()).toString("utf-8");
|
|
194
208
|
},
|
|
195
209
|
async bytes() {
|
|
196
|
-
const b = await
|
|
210
|
+
const b = await collect();
|
|
197
211
|
return new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
|
|
198
212
|
},
|
|
199
213
|
getReader() {
|
|
214
|
+
if (readerClaimed || collected) {
|
|
215
|
+
throw new TypeError("Subprocess output is already consumed");
|
|
216
|
+
}
|
|
217
|
+
readerClaimed = true;
|
|
200
218
|
return toWebReadable().getReader();
|
|
201
219
|
}
|
|
202
220
|
};
|
|
@@ -282,25 +300,48 @@ function bunSpawn(cmd, options) {
|
|
|
282
300
|
if (bun?.spawn) {
|
|
283
301
|
const mergedEnv2 = mergeEnvForChild(options?.env, options?.envOverrides);
|
|
284
302
|
const spawnOpts = { ...options };
|
|
303
|
+
delete spawnOpts.killProcessTree;
|
|
285
304
|
if (mergedEnv2 !== undefined)
|
|
286
305
|
spawnOpts.env = mergedEnv2;
|
|
287
|
-
if (options?.timeout && options.timeout > 0) {
|
|
306
|
+
if (options?.timeout && options.timeout > 0 && options.killProcessTree !== true) {
|
|
288
307
|
spawnOpts.killSignal = "SIGKILL";
|
|
289
308
|
}
|
|
309
|
+
if (options?.killProcessTree === true) {
|
|
310
|
+
delete spawnOpts.timeout;
|
|
311
|
+
delete spawnOpts.killSignal;
|
|
312
|
+
spawnOpts.detached = true;
|
|
313
|
+
}
|
|
290
314
|
const proc2 = bun.spawn(cmd, spawnOpts);
|
|
315
|
+
const killBunProcess = (sig) => {
|
|
316
|
+
if (options?.killProcessTree) {
|
|
317
|
+
killProcessTreeImpl(proc2.pid, sig, () => proc2.kill(sig), true);
|
|
318
|
+
} else {
|
|
319
|
+
proc2.kill(sig);
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
let timeoutHandle2;
|
|
323
|
+
if (options?.killProcessTree === true && options.timeout && options.timeout > 0) {
|
|
324
|
+
timeoutHandle2 = setTimeout(() => {
|
|
325
|
+
try {
|
|
326
|
+
killBunProcess("SIGKILL");
|
|
327
|
+
} catch {}
|
|
328
|
+
}, options.timeout);
|
|
329
|
+
if (typeof timeoutHandle2.unref === "function")
|
|
330
|
+
timeoutHandle2.unref();
|
|
331
|
+
}
|
|
332
|
+
const exited2 = proc2.exited.finally(() => {
|
|
333
|
+
if (timeoutHandle2 !== undefined)
|
|
334
|
+
clearTimeout(timeoutHandle2);
|
|
335
|
+
});
|
|
291
336
|
return {
|
|
292
337
|
stdout: streamFromBun(proc2.stdout),
|
|
293
338
|
stderr: streamFromBun(proc2.stderr),
|
|
294
|
-
exited:
|
|
339
|
+
exited: exited2,
|
|
295
340
|
get exitCode() {
|
|
296
341
|
return proc2.exitCode;
|
|
297
342
|
},
|
|
298
343
|
kill(sig) {
|
|
299
|
-
|
|
300
|
-
killProcessTreeImpl(proc2.pid, sig, () => proc2.kill(sig), false);
|
|
301
|
-
} else {
|
|
302
|
-
proc2.kill(sig);
|
|
303
|
-
}
|
|
344
|
+
killBunProcess(sig);
|
|
304
345
|
}
|
|
305
346
|
};
|
|
306
347
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-5436jxnw.js";
|
|
5
5
|
import {
|
|
6
6
|
handleGuardrailLog
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-bcmrg4t4.js";
|
|
8
8
|
import {
|
|
9
9
|
COMMAND_REGISTRY,
|
|
10
10
|
SWARM_COMMAND_TOOL_ALLOWLIST,
|
|
@@ -84,61 +84,63 @@ import {
|
|
|
84
84
|
handleWriteRetroCommand,
|
|
85
85
|
normalizeSwarmCommandInput,
|
|
86
86
|
resolveCommand
|
|
87
|
-
} from "./index-
|
|
88
|
-
import"./index-
|
|
89
|
-
import"./index-
|
|
90
|
-
import"./index-
|
|
91
|
-
import"./index-
|
|
87
|
+
} from "./index-dwargd10.js";
|
|
88
|
+
import"./index-vm4xw9z3.js";
|
|
89
|
+
import"./index-kb7qy7an.js";
|
|
90
|
+
import"./index-a01r818w.js";
|
|
91
|
+
import"./index-cggqh2dz.js";
|
|
92
92
|
import"./index-4905hd2m.js";
|
|
93
93
|
import"./index-134d35c1.js";
|
|
94
|
-
import"./index-
|
|
95
|
-
import"./index-
|
|
96
|
-
import"./index-
|
|
97
|
-
import"./index-
|
|
94
|
+
import"./index-yf30m841.js";
|
|
95
|
+
import"./index-f52jt0am.js";
|
|
96
|
+
import"./index-36v55ryg.js";
|
|
97
|
+
import"./index-dg1njnms.js";
|
|
98
98
|
import"./index-c8s9a3zh.js";
|
|
99
99
|
import"./index-9ss2m4rs.js";
|
|
100
|
-
import"./index-
|
|
101
|
-
import"./index-
|
|
102
|
-
import"./index-
|
|
103
|
-
import"./index-
|
|
100
|
+
import"./index-y6a7gjtj.js";
|
|
101
|
+
import"./index-mrtms113.js";
|
|
102
|
+
import"./index-gxxxmajn.js";
|
|
103
|
+
import"./index-30pg2rs3.js";
|
|
104
104
|
import"./index-rtry5xyf.js";
|
|
105
|
-
import"./index-
|
|
106
|
-
import"./index-
|
|
105
|
+
import"./index-p9ngg568.js";
|
|
106
|
+
import"./index-rv7s2k9y.js";
|
|
107
107
|
import"./index-ae75rja9.js";
|
|
108
|
-
import"./index-
|
|
109
|
-
import"./index-
|
|
110
|
-
import"./index-
|
|
108
|
+
import"./index-dzyjb33e.js";
|
|
109
|
+
import"./index-ey29aap6.js";
|
|
110
|
+
import"./index-wygxzvtf.js";
|
|
111
111
|
import"./index-k5jrywpr.js";
|
|
112
112
|
import"./index-n832052r.js";
|
|
113
113
|
import {
|
|
114
|
-
AGENT_TOOL_MAP,
|
|
115
|
-
ORCHESTRATOR_NAME,
|
|
116
|
-
init_constants,
|
|
117
114
|
init_schema,
|
|
118
115
|
stripKnownSwarmPrefix
|
|
119
|
-
} from "./index-
|
|
116
|
+
} from "./index-p5kr35wh.js";
|
|
120
117
|
import"./index-bk5tah7q.js";
|
|
121
118
|
import"./index-8fwhhayc.js";
|
|
122
119
|
import"./index-q1exe2b3.js";
|
|
123
|
-
import"./index-
|
|
120
|
+
import"./index-tcn457d5.js";
|
|
121
|
+
import"./index-vg3yx648.js";
|
|
124
122
|
import"./index-wxyxf0bd.js";
|
|
125
123
|
import"./index-1kz6da87.js";
|
|
126
|
-
import"./index-
|
|
124
|
+
import"./index-x20cgr2q.js";
|
|
127
125
|
import"./index-b8zgtz81.js";
|
|
128
|
-
import"./index-
|
|
126
|
+
import"./index-c9ddxv4k.js";
|
|
129
127
|
import"./index-4rhhvd1a.js";
|
|
130
|
-
import
|
|
131
|
-
|
|
128
|
+
import {
|
|
129
|
+
AGENT_TOOL_MAP,
|
|
130
|
+
ORCHESTRATOR_NAME,
|
|
131
|
+
init_constants
|
|
132
|
+
} from "./index-3jcyn8g6.js";
|
|
133
|
+
import"./index-45t7w06b.js";
|
|
134
|
+
import"./index-4qzeef9h.js";
|
|
132
135
|
import"./index-fsrp8wp3.js";
|
|
133
136
|
import"./index-09b9zncg.js";
|
|
134
137
|
import"./index-7g4c7s5r.js";
|
|
135
|
-
import"./index-7a2hm51h.js";
|
|
136
138
|
import"./index-bpmtbmy9.js";
|
|
139
|
+
import"./index-7a2hm51h.js";
|
|
137
140
|
import"./index-z6xqpmqg.js";
|
|
138
141
|
import"./index-zjygnfay.js";
|
|
139
|
-
import"./index-
|
|
142
|
+
import"./index-y111zefa.js";
|
|
140
143
|
import"./index-zgwm4ryv.js";
|
|
141
|
-
import"./index-3nasn371.js";
|
|
142
144
|
import"./index-a76rekgs.js";
|
|
143
145
|
|
|
144
146
|
// src/commands/index.ts
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
bunSpawn
|
|
4
|
+
} from "./index-y111zefa.js";
|
|
5
|
+
|
|
2
6
|
// src/background/workspace-snapshot.ts
|
|
3
7
|
import * as child_process from "child_process";
|
|
4
8
|
import { createHash } from "crypto";
|
|
@@ -10,6 +14,43 @@ var REVISION_MAX_FILES = 5000;
|
|
|
10
14
|
var REVISION_MAX_TOTAL_BYTES = 64 * 1024 * 1024;
|
|
11
15
|
var REVISION_READ_CHUNK_BYTES = 64 * 1024;
|
|
12
16
|
var REVISION_YIELD_EVERY_CHUNKS = 16;
|
|
17
|
+
async function readBoundedGitOutput(stream, maxBytes, onOverflow) {
|
|
18
|
+
const reader = stream.getReader();
|
|
19
|
+
const chunks = [];
|
|
20
|
+
let totalBytes = 0;
|
|
21
|
+
try {
|
|
22
|
+
for (;; ) {
|
|
23
|
+
const { done, value } = await reader.read();
|
|
24
|
+
if (done)
|
|
25
|
+
break;
|
|
26
|
+
if (!value)
|
|
27
|
+
continue;
|
|
28
|
+
const remaining = maxBytes - totalBytes;
|
|
29
|
+
if (value.byteLength > remaining) {
|
|
30
|
+
if (remaining > 0)
|
|
31
|
+
chunks.push(value.slice(0, remaining));
|
|
32
|
+
onOverflow();
|
|
33
|
+
return { text: "", truncated: true };
|
|
34
|
+
}
|
|
35
|
+
chunks.push(value);
|
|
36
|
+
totalBytes += value.byteLength;
|
|
37
|
+
}
|
|
38
|
+
const joined = new Uint8Array(totalBytes);
|
|
39
|
+
let offset = 0;
|
|
40
|
+
for (const chunk of chunks) {
|
|
41
|
+
joined.set(chunk, offset);
|
|
42
|
+
offset += chunk.byteLength;
|
|
43
|
+
}
|
|
44
|
+
return { text: new TextDecoder().decode(joined), truncated: false };
|
|
45
|
+
} finally {
|
|
46
|
+
try {
|
|
47
|
+
await reader.cancel();
|
|
48
|
+
} catch {}
|
|
49
|
+
try {
|
|
50
|
+
reader.releaseLock();
|
|
51
|
+
} catch {}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
13
54
|
function runGit(directory, args, timeoutMs = GIT_SNAPSHOT_TIMEOUT_MS) {
|
|
14
55
|
const result = _internals.spawnSync("git", ["-C", directory, ...args], {
|
|
15
56
|
cwd: directory,
|
|
@@ -22,51 +63,55 @@ function runGit(directory, args, timeoutMs = GIT_SNAPSHOT_TIMEOUT_MS) {
|
|
|
22
63
|
return null;
|
|
23
64
|
return typeof result.stdout === "string" ? result.stdout.trimEnd() : null;
|
|
24
65
|
}
|
|
25
|
-
async function runGitAsync(directory, args, timeoutMs =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
66
|
+
async function runGitAsync(directory, args, timeoutMs = _internals.gitTimeoutMs) {
|
|
67
|
+
let proc;
|
|
68
|
+
let timeout;
|
|
69
|
+
try {
|
|
70
|
+
const options = {
|
|
71
|
+
cwd: directory,
|
|
72
|
+
stdin: "ignore",
|
|
73
|
+
stdout: "pipe",
|
|
74
|
+
stderr: "pipe",
|
|
75
|
+
timeout: timeoutMs,
|
|
76
|
+
killProcessTree: true
|
|
77
|
+
};
|
|
78
|
+
proc = _internals.bunSpawn(["git", "-C", directory, ...args], options);
|
|
79
|
+
let overflowed = false;
|
|
80
|
+
const stopOverflow = () => {
|
|
81
|
+
overflowed = true;
|
|
38
82
|
try {
|
|
39
|
-
|
|
83
|
+
proc?.kill("SIGKILL");
|
|
40
84
|
} catch {}
|
|
41
|
-
resolve2(value);
|
|
42
85
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
86
|
+
const completed = Promise.all([
|
|
87
|
+
proc.exited,
|
|
88
|
+
readBoundedGitOutput(proc.stdout, GIT_SNAPSHOT_MAX_BUFFER, stopOverflow),
|
|
89
|
+
readBoundedGitOutput(proc.stderr, GIT_SNAPSHOT_MAX_BUFFER, stopOverflow)
|
|
90
|
+
]);
|
|
91
|
+
const result = await Promise.race([
|
|
92
|
+
completed.then(([exitCode, stdout, stderr]) => ({
|
|
93
|
+
kind: "completed",
|
|
94
|
+
exitCode,
|
|
95
|
+
stdout,
|
|
96
|
+
stderr
|
|
97
|
+
})),
|
|
98
|
+
new Promise((resolve2) => {
|
|
99
|
+
timeout = setTimeout(() => resolve2({ kind: "timeout" }), timeoutMs);
|
|
100
|
+
})
|
|
101
|
+
]);
|
|
102
|
+
if (result.kind === "timeout" || overflowed || result.exitCode !== 0 || result.stdout.truncated || result.stderr.truncated) {
|
|
103
|
+
return null;
|
|
52
104
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (stderrBytes > GIT_SNAPSHOT_MAX_BUFFER) {
|
|
64
|
-
finish(null);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
child.once("error", () => finish(null));
|
|
68
|
-
child.once("close", (code) => finish(code === 0 ? stdout.trimEnd() : null));
|
|
69
|
-
});
|
|
105
|
+
return result.stdout.text.trimEnd();
|
|
106
|
+
} catch {
|
|
107
|
+
return null;
|
|
108
|
+
} finally {
|
|
109
|
+
if (timeout)
|
|
110
|
+
clearTimeout(timeout);
|
|
111
|
+
try {
|
|
112
|
+
proc?.kill("SIGKILL");
|
|
113
|
+
} catch {}
|
|
114
|
+
}
|
|
70
115
|
}
|
|
71
116
|
function readGitTextAtRevision(directory, revision, relativePath) {
|
|
72
117
|
if (!isSafeGitRevisionToken(revision) || !/^\.?(?:[A-Za-z0-9][A-Za-z0-9._-]*\/)*[A-Za-z0-9][A-Za-z0-9._-]*$/.test(relativePath) || relativePath.split("/").includes("..")) {
|
|
@@ -447,6 +492,43 @@ async function resolveRemoteRefsContainingHeadAsync(directory, headSha) {
|
|
|
447
492
|
return null;
|
|
448
493
|
return output.split(/\r?\n/).map((line) => line.trim().split("\t")).filter(([ref, objectName]) => ref?.startsWith("refs/remotes/") && !ref.endsWith("/HEAD") && objectName?.toLowerCase() === headSha.toLowerCase()).map(([ref]) => ref);
|
|
449
494
|
}
|
|
495
|
+
async function resolvePrFeedbackTrackingCandidatesAsync(directory, headSha) {
|
|
496
|
+
const [localOutput, remoteRefs] = await Promise.all([
|
|
497
|
+
runGitAsync(directory, [
|
|
498
|
+
"for-each-ref",
|
|
499
|
+
"--format=%(refname)%09%(objectname)%09%(upstream)",
|
|
500
|
+
"refs/heads"
|
|
501
|
+
]),
|
|
502
|
+
resolveRemoteRefsContainingHeadAsync(directory, headSha)
|
|
503
|
+
]);
|
|
504
|
+
if (localOutput === null || remoteRefs === null)
|
|
505
|
+
return null;
|
|
506
|
+
const exactRemoteRefs = new Set(remoteRefs);
|
|
507
|
+
const local = localOutput.split(/\r?\n/).map((line) => line.trim().split("\t")).flatMap(([ref, objectName, upstream, ...extras]) => {
|
|
508
|
+
if (extras.length > 0 || !ref?.startsWith("refs/heads/") || objectName?.toLowerCase() !== headSha.toLowerCase() || !upstream?.startsWith("refs/remotes/") || !exactRemoteRefs.has(upstream)) {
|
|
509
|
+
return [];
|
|
510
|
+
}
|
|
511
|
+
return [
|
|
512
|
+
{
|
|
513
|
+
kind: "local",
|
|
514
|
+
branchName: ref.slice("refs/heads/".length),
|
|
515
|
+
remoteTrackingRef: upstream
|
|
516
|
+
}
|
|
517
|
+
];
|
|
518
|
+
});
|
|
519
|
+
return {
|
|
520
|
+
local,
|
|
521
|
+
remote: remoteRefs.map((remoteTrackingRef) => ({
|
|
522
|
+
kind: "remote",
|
|
523
|
+
remoteTrackingRef
|
|
524
|
+
}))
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
async function switchPrFeedbackTrackingCandidateAsync(directory, candidate) {
|
|
528
|
+
const args = candidate.kind === "local" ? ["switch", "--no-guess", "--", candidate.branchName] : ["switch", "--track", "--", candidate.remoteTrackingRef];
|
|
529
|
+
const output = await runGitAsync(directory, args);
|
|
530
|
+
return output !== null;
|
|
531
|
+
}
|
|
450
532
|
function resolvePrWorkflowRevisionDigest(directory, baseHeadSha) {
|
|
451
533
|
const projectRoot = path.resolve(directory);
|
|
452
534
|
const baseHead = runGit(projectRoot, [
|
|
@@ -821,8 +903,10 @@ function digest(text) {
|
|
|
821
903
|
}
|
|
822
904
|
var _internals = {
|
|
823
905
|
spawnSync: child_process.spawnSync,
|
|
906
|
+
bunSpawn,
|
|
907
|
+
gitTimeoutMs: GIT_SNAPSHOT_TIMEOUT_MS,
|
|
824
908
|
yieldControl: () => new Promise((resolve2) => setImmediate(resolve2)),
|
|
825
909
|
parsePorcelainV2Snapshot
|
|
826
910
|
};
|
|
827
911
|
|
|
828
|
-
export { readGitTextAtRevision, resolveCurrentGitHead, resolveCurrentGitHeadAsync, resolveExactMergeBase, resolveExactMergeBaseAsync, resolvePrReviewDiffStats, resolvePrReviewDiffStatsAsync, resolveCurrentUpstreamRemoteRef, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamPushTargetAsync, resolveExactRemoteBranchHead, resolveExactRemoteBranchHeadAsync, resolveGitControlStateDigest, resolveGitControlStateDigestAsync, resolveIsWorkingTreeClean, resolveIsWorkingTreeCleanAsync, resolveCommitCountSince, resolveCommitCountSinceAsync, resolveIsExactSingleChildCommit, resolveIsExactSingleChildCommitAsync, resolveRemoteRefsContainingHead, resolveRemoteRefsContainingHeadAsync, resolvePrWorkflowRevisionDigest, resolvePrWorkflowRevisionDigestAsync, parsePorcelainPaths, parsePorcelainV2Snapshot, captureWorkspaceSnapshot, changedFilesSinceSnapshot, workspaceSnapshotMatches, compareWorkspaceSnapshot, compareWorkspaceSnapshots, digest, _internals };
|
|
912
|
+
export { readGitTextAtRevision, resolveCurrentGitHead, resolveCurrentGitHeadAsync, resolveExactMergeBase, resolveExactMergeBaseAsync, resolvePrReviewDiffStats, resolvePrReviewDiffStatsAsync, resolveCurrentUpstreamRemoteRef, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamPushTargetAsync, resolveExactRemoteBranchHead, resolveExactRemoteBranchHeadAsync, resolveGitControlStateDigest, resolveGitControlStateDigestAsync, resolveIsWorkingTreeClean, resolveIsWorkingTreeCleanAsync, resolveCommitCountSince, resolveCommitCountSinceAsync, resolveIsExactSingleChildCommit, resolveIsExactSingleChildCommitAsync, resolveRemoteRefsContainingHead, resolveRemoteRefsContainingHeadAsync, resolvePrFeedbackTrackingCandidatesAsync, switchPrFeedbackTrackingCandidateAsync, resolvePrWorkflowRevisionDigest, resolvePrWorkflowRevisionDigestAsync, parsePorcelainPaths, parsePorcelainV2Snapshot, captureWorkspaceSnapshot, changedFilesSinceSnapshot, workspaceSnapshotMatches, compareWorkspaceSnapshot, compareWorkspaceSnapshots, digest, _internals };
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ALLOWED_SKILL_PATH_PREFIXES,
|
|
4
4
|
validateSkillPath
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-gxxxmajn.js";
|
|
6
6
|
import {
|
|
7
7
|
computeOutcomeSignal,
|
|
8
8
|
readKnowledge,
|
|
9
9
|
resolveHiveKnowledgePath,
|
|
10
10
|
resolveSwarmKnowledgePath,
|
|
11
11
|
transactKnowledge
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-p9ngg568.js";
|
|
13
13
|
import {
|
|
14
14
|
effectiveRetrievalOutcomes,
|
|
15
15
|
readKnowledgeCounterRollups
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-rv7s2k9y.js";
|
|
17
17
|
import {
|
|
18
18
|
init_knowledge_types,
|
|
19
19
|
isActiveStatus
|