opencode-swarm 7.75.0 → 7.76.1
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/dist/cli/index.js +78 -49
- package/dist/hooks/abort-utils.d.ts +8 -0
- package/dist/hooks/repo-graph-injection.d.ts +1 -1
- package/dist/index.js +2472 -2274
- package/dist/tools/repo-graph/builder.d.ts +4 -0
- package/dist/tools/repo-graph/ontology.d.ts +10 -0
- package/dist/tools/repo-graph/query.d.ts +21 -0
- package/dist/tools/repo-graph/storage.d.ts +7 -0
- package/dist/tools/repo-graph/types.d.ts +102 -1
- package/dist/tools/repo-graph/validation.d.ts +1 -1
- package/dist/tools/repo-graph.d.ts +5 -2
- package/dist/turbo/lean/integration.d.ts +1 -1
- package/dist/turbo/lean/reviewer.d.ts +1 -1
- package/dist/turbo/lean/runner.d.ts +4 -0
- package/dist/utils/path-security.d.ts +2 -2
- package/package.json +8 -1
package/dist/cli/index.js
CHANGED
|
@@ -52,10 +52,17 @@ var package_default;
|
|
|
52
52
|
var init_package = __esm(() => {
|
|
53
53
|
package_default = {
|
|
54
54
|
name: "opencode-swarm",
|
|
55
|
-
version: "7.
|
|
55
|
+
version: "7.76.1",
|
|
56
56
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
57
57
|
main: "dist/index.js",
|
|
58
58
|
types: "dist/index.d.ts",
|
|
59
|
+
exports: {
|
|
60
|
+
".": {
|
|
61
|
+
types: "./dist/index.d.ts",
|
|
62
|
+
default: "./dist/index.js"
|
|
63
|
+
},
|
|
64
|
+
"./package.json": "./package.json"
|
|
65
|
+
},
|
|
59
66
|
bin: {
|
|
60
67
|
"opencode-swarm": "./dist/cli/index.js"
|
|
61
68
|
},
|
|
@@ -17493,7 +17500,7 @@ var init_tool_metadata = __esm(() => {
|
|
|
17493
17500
|
agents: ["critic_drift_verifier", "critic", "critic_oversight"]
|
|
17494
17501
|
},
|
|
17495
17502
|
repo_map: {
|
|
17496
|
-
description: "query the repo code graph: importers, dependencies, blast radius,
|
|
17503
|
+
description: "query the repo code graph: importers, dependencies, blast radius, localization, ontology facts, package boundaries, and heuristic preflight packets before refactoring; ontology findings are advisory, not formal proofs",
|
|
17497
17504
|
agents: [
|
|
17498
17505
|
"architect",
|
|
17499
17506
|
"critic_sounding_board",
|
|
@@ -37409,6 +37416,14 @@ var init_branch = __esm(() => {
|
|
|
37409
37416
|
};
|
|
37410
37417
|
});
|
|
37411
37418
|
|
|
37419
|
+
// src/hooks/abort-utils.ts
|
|
37420
|
+
function isAbortError(err) {
|
|
37421
|
+
if (typeof err !== "object" || err === null)
|
|
37422
|
+
return false;
|
|
37423
|
+
const name = err.name;
|
|
37424
|
+
return name === "AbortError" || name === "TimeoutError";
|
|
37425
|
+
}
|
|
37426
|
+
|
|
37412
37427
|
// src/hooks/curator-llm-factory.ts
|
|
37413
37428
|
function resolveCuratorAgentName(mode, sessionId) {
|
|
37414
37429
|
const suffixMap = {
|
|
@@ -37477,13 +37492,19 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
|
|
|
37477
37492
|
}
|
|
37478
37493
|
};
|
|
37479
37494
|
if (signal?.aborted) {
|
|
37480
|
-
cleanup();
|
|
37481
37495
|
throw new Error("CURATOR_LLM_TIMEOUT");
|
|
37482
37496
|
}
|
|
37483
|
-
signal
|
|
37497
|
+
const sdkOpts = signal ? { signal } : {};
|
|
37484
37498
|
try {
|
|
37485
37499
|
const createResult = await client.session.create({
|
|
37486
|
-
|
|
37500
|
+
...sessionId ? {
|
|
37501
|
+
body: {
|
|
37502
|
+
parentID: sessionId,
|
|
37503
|
+
title: `curator_${mode} background`
|
|
37504
|
+
}
|
|
37505
|
+
} : {},
|
|
37506
|
+
query: { directory },
|
|
37507
|
+
...sdkOpts
|
|
37487
37508
|
});
|
|
37488
37509
|
if (!createResult.data) {
|
|
37489
37510
|
throw new Error(`Failed to create curator session: ${JSON.stringify(createResult.error)}`);
|
|
@@ -37493,30 +37514,27 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
|
|
|
37493
37514
|
throw new Error("CURATOR_LLM_TIMEOUT");
|
|
37494
37515
|
}
|
|
37495
37516
|
const agentName = resolveCuratorAgentName(mode, sessionId);
|
|
37496
|
-
|
|
37497
|
-
|
|
37498
|
-
|
|
37499
|
-
|
|
37500
|
-
|
|
37501
|
-
|
|
37502
|
-
|
|
37503
|
-
|
|
37504
|
-
|
|
37505
|
-
});
|
|
37506
|
-
} catch (promptErr) {
|
|
37507
|
-
if (signal?.aborted) {
|
|
37508
|
-
throw new Error("CURATOR_LLM_TIMEOUT");
|
|
37509
|
-
}
|
|
37510
|
-
throw promptErr;
|
|
37511
|
-
}
|
|
37517
|
+
const promptResult = await client.session.prompt({
|
|
37518
|
+
path: { id: ephemeralSessionId },
|
|
37519
|
+
body: {
|
|
37520
|
+
agent: agentName,
|
|
37521
|
+
tools: { write: false, edit: false, patch: false },
|
|
37522
|
+
parts: [{ type: "text", text: userInput }]
|
|
37523
|
+
},
|
|
37524
|
+
...sdkOpts
|
|
37525
|
+
});
|
|
37512
37526
|
if (!promptResult.data) {
|
|
37513
37527
|
throw new Error(`Curator LLM prompt failed: ${JSON.stringify(promptResult.error)}`);
|
|
37514
37528
|
}
|
|
37515
37529
|
const textParts = promptResult.data.parts.filter((p) => p.type === "text");
|
|
37516
37530
|
return textParts.map((p) => p.text).join(`
|
|
37517
37531
|
`);
|
|
37532
|
+
} catch (err) {
|
|
37533
|
+
if (isAbortError(err)) {
|
|
37534
|
+
throw new Error("CURATOR_LLM_TIMEOUT");
|
|
37535
|
+
}
|
|
37536
|
+
throw err;
|
|
37518
37537
|
} finally {
|
|
37519
|
-
signal?.removeEventListener("abort", cleanup);
|
|
37520
37538
|
cleanup();
|
|
37521
37539
|
}
|
|
37522
37540
|
};
|
|
@@ -42992,13 +43010,16 @@ function createSkillImproverLLMDelegate(directory, sessionId) {
|
|
|
42992
43010
|
}
|
|
42993
43011
|
};
|
|
42994
43012
|
if (signal?.aborted) {
|
|
42995
|
-
cleanup();
|
|
42996
43013
|
throw new Error("SKILL_IMPROVER_LLM_TIMEOUT");
|
|
42997
43014
|
}
|
|
42998
|
-
signal
|
|
43015
|
+
const sdkOpts = signal ? { signal } : {};
|
|
42999
43016
|
try {
|
|
43000
43017
|
const createResult = await client.session.create({
|
|
43001
|
-
|
|
43018
|
+
...sessionId ? {
|
|
43019
|
+
body: { parentID: sessionId, title: "skill_improver background" }
|
|
43020
|
+
} : {},
|
|
43021
|
+
query: { directory },
|
|
43022
|
+
...sdkOpts
|
|
43002
43023
|
});
|
|
43003
43024
|
if (!createResult.data) {
|
|
43004
43025
|
throw new Error(`Failed to create skill_improver session: ${JSON.stringify(createResult.error)}`);
|
|
@@ -43007,34 +43028,31 @@ function createSkillImproverLLMDelegate(directory, sessionId) {
|
|
|
43007
43028
|
if (signal?.aborted)
|
|
43008
43029
|
throw new Error("SKILL_IMPROVER_LLM_TIMEOUT");
|
|
43009
43030
|
const agentName = resolveSkillImproverAgentName(sessionId);
|
|
43010
|
-
|
|
43011
|
-
try {
|
|
43012
|
-
const prelude = systemPrompt ? `${systemPrompt}
|
|
43031
|
+
const prelude = systemPrompt ? `${systemPrompt}
|
|
43013
43032
|
|
|
43014
43033
|
---
|
|
43015
43034
|
|
|
43016
43035
|
${userInput}` : userInput;
|
|
43017
|
-
|
|
43018
|
-
|
|
43019
|
-
|
|
43020
|
-
|
|
43021
|
-
|
|
43022
|
-
|
|
43023
|
-
|
|
43024
|
-
|
|
43025
|
-
}
|
|
43026
|
-
if (signal?.aborted)
|
|
43027
|
-
throw new Error("SKILL_IMPROVER_LLM_TIMEOUT");
|
|
43028
|
-
throw err;
|
|
43029
|
-
}
|
|
43036
|
+
const promptResult = await client.session.prompt({
|
|
43037
|
+
path: { id: ephemeralSessionId },
|
|
43038
|
+
body: {
|
|
43039
|
+
agent: agentName,
|
|
43040
|
+
tools: { write: false, edit: false, patch: false },
|
|
43041
|
+
parts: [{ type: "text", text: prelude }]
|
|
43042
|
+
},
|
|
43043
|
+
...sdkOpts
|
|
43044
|
+
});
|
|
43030
43045
|
if (!promptResult.data) {
|
|
43031
43046
|
throw new Error(`skill_improver LLM prompt failed: ${JSON.stringify(promptResult.error)}`);
|
|
43032
43047
|
}
|
|
43033
43048
|
const textParts = promptResult.data.parts.filter((p) => p.type === "text");
|
|
43034
43049
|
return textParts.map((p) => p.text).join(`
|
|
43035
43050
|
`);
|
|
43051
|
+
} catch (err) {
|
|
43052
|
+
if (isAbortError(err))
|
|
43053
|
+
throw new Error("SKILL_IMPROVER_LLM_TIMEOUT");
|
|
43054
|
+
throw err;
|
|
43036
43055
|
} finally {
|
|
43037
|
-
signal?.removeEventListener("abort", cleanup);
|
|
43038
43056
|
cleanup();
|
|
43039
43057
|
}
|
|
43040
43058
|
};
|
|
@@ -43566,7 +43584,7 @@ ${inv.staleActiveSkills.slice(0, 10).map((s) => `- ${s.slug} | ${s.reasons.join(
|
|
|
43566
43584
|
`) || "(none)"}
|
|
43567
43585
|
`;
|
|
43568
43586
|
}
|
|
43569
|
-
function
|
|
43587
|
+
function isAbortError2(err) {
|
|
43570
43588
|
return err instanceof Error && (err.name === "AbortError" || err.message === "skill_improver_aborted");
|
|
43571
43589
|
}
|
|
43572
43590
|
function throwIfAborted(signal) {
|
|
@@ -43714,7 +43732,7 @@ async function runSkillImprover(req) {
|
|
|
43714
43732
|
inventory = await gatherInventory(req.directory);
|
|
43715
43733
|
throwIfAborted(req.signal);
|
|
43716
43734
|
} catch (err) {
|
|
43717
|
-
if (
|
|
43735
|
+
if (isAbortError2(err)) {
|
|
43718
43736
|
return await abortResult();
|
|
43719
43737
|
}
|
|
43720
43738
|
await releaseQuota(req.directory, {
|
|
@@ -43746,7 +43764,7 @@ async function runSkillImprover(req) {
|
|
|
43746
43764
|
}
|
|
43747
43765
|
source = "llm";
|
|
43748
43766
|
} catch (err) {
|
|
43749
|
-
if (
|
|
43767
|
+
if (isAbortError2(err)) {
|
|
43750
43768
|
return await abortResult();
|
|
43751
43769
|
}
|
|
43752
43770
|
return {
|
|
@@ -43763,7 +43781,7 @@ async function runSkillImprover(req) {
|
|
|
43763
43781
|
try {
|
|
43764
43782
|
throwIfAborted(req.signal);
|
|
43765
43783
|
} catch (err) {
|
|
43766
|
-
if (
|
|
43784
|
+
if (isAbortError2(err)) {
|
|
43767
43785
|
return await abortResult();
|
|
43768
43786
|
}
|
|
43769
43787
|
throw err;
|
|
@@ -43776,7 +43794,7 @@ async function runSkillImprover(req) {
|
|
|
43776
43794
|
try {
|
|
43777
43795
|
throwIfAborted(req.signal);
|
|
43778
43796
|
} catch (err) {
|
|
43779
|
-
if (
|
|
43797
|
+
if (isAbortError2(err)) {
|
|
43780
43798
|
return await abortResult();
|
|
43781
43799
|
}
|
|
43782
43800
|
throw err;
|
|
@@ -43797,7 +43815,7 @@ async function runSkillImprover(req) {
|
|
|
43797
43815
|
try {
|
|
43798
43816
|
throwIfAborted(req.signal);
|
|
43799
43817
|
} catch (err) {
|
|
43800
|
-
if (
|
|
43818
|
+
if (isAbortError2(err)) {
|
|
43801
43819
|
return await abortResult();
|
|
43802
43820
|
}
|
|
43803
43821
|
throw err;
|
|
@@ -57465,7 +57483,18 @@ function containsPathTraversal(str) {
|
|
|
57465
57483
|
return false;
|
|
57466
57484
|
}
|
|
57467
57485
|
function containsControlChars(str) {
|
|
57468
|
-
|
|
57486
|
+
for (const ch of str) {
|
|
57487
|
+
const code = ch.codePointAt(0);
|
|
57488
|
+
if (code === undefined)
|
|
57489
|
+
continue;
|
|
57490
|
+
if (code <= 31 || code >= 127 && code <= 159)
|
|
57491
|
+
return true;
|
|
57492
|
+
if (code >= 8234 && code <= 8238)
|
|
57493
|
+
return true;
|
|
57494
|
+
if (code >= 8294 && code <= 8297)
|
|
57495
|
+
return true;
|
|
57496
|
+
}
|
|
57497
|
+
return false;
|
|
57469
57498
|
}
|
|
57470
57499
|
var init_path_security = () => {};
|
|
57471
57500
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True only for genuine cancellation errors (a native `AbortError` /
|
|
3
|
+
* `TimeoutError` raised when a forwarded `AbortSignal` fires). Used to map
|
|
4
|
+
* cancellation — and only cancellation — onto timeout sentinels, so a real
|
|
5
|
+
* failure that merely coincides with an aborted signal still surfaces as
|
|
6
|
+
* itself rather than being misclassified as a timeout.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isAbortError(err: unknown): boolean;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* avoid re-reading the JSON on every system prompt construction. The
|
|
16
16
|
* cache is bypassed if the file's mtime advances.
|
|
17
17
|
*/
|
|
18
|
-
import { type RepoGraph } from '../graph';
|
|
18
|
+
import { type RepoGraph } from '../tools/repo-graph';
|
|
19
19
|
/**
|
|
20
20
|
* Load the repo graph for `directory`, using a per-directory cache that
|
|
21
21
|
* invalidates on file mtime change. Returns null if no graph exists.
|