opencode-swarm 7.50.2 → 7.50.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/dist/cli/index.js +2 -2
- package/dist/index.js +105 -91
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -52,7 +52,7 @@ var package_default;
|
|
|
52
52
|
var init_package = __esm(() => {
|
|
53
53
|
package_default = {
|
|
54
54
|
name: "opencode-swarm",
|
|
55
|
-
version: "7.50.
|
|
55
|
+
version: "7.50.3",
|
|
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",
|
|
@@ -40477,7 +40477,7 @@ function getPluginLockFilePaths() {
|
|
|
40477
40477
|
var init_cache_paths = () => {};
|
|
40478
40478
|
|
|
40479
40479
|
// src/gate-evidence.ts
|
|
40480
|
-
import { mkdirSync as mkdirSync8, readFileSync as readFileSync7 } from "fs";
|
|
40480
|
+
import { mkdirSync as mkdirSync8, readFileSync as readFileSync7, realpathSync as realpathSync3 } from "fs";
|
|
40481
40481
|
function isValidTaskId(taskId) {
|
|
40482
40482
|
return isStrictTaskId(taskId);
|
|
40483
40483
|
}
|
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var package_default;
|
|
|
69
69
|
var init_package = __esm(() => {
|
|
70
70
|
package_default = {
|
|
71
71
|
name: "opencode-swarm",
|
|
72
|
-
version: "7.50.
|
|
72
|
+
version: "7.50.3",
|
|
73
73
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
74
74
|
main: "dist/index.js",
|
|
75
75
|
types: "dist/index.d.ts",
|
|
@@ -40402,7 +40402,7 @@ __export(exports_gate_evidence, {
|
|
|
40402
40402
|
deriveRequiredGates: () => deriveRequiredGates,
|
|
40403
40403
|
DEFAULT_REQUIRED_GATES: () => DEFAULT_REQUIRED_GATES
|
|
40404
40404
|
});
|
|
40405
|
-
import { mkdirSync as mkdirSync8, readFileSync as readFileSync5 } from "node:fs";
|
|
40405
|
+
import { mkdirSync as mkdirSync8, readFileSync as readFileSync5, realpathSync as realpathSync5 } from "node:fs";
|
|
40406
40406
|
import * as path18 from "node:path";
|
|
40407
40407
|
function isValidTaskId(taskId) {
|
|
40408
40408
|
return isStrictTaskId(taskId);
|
|
@@ -40438,7 +40438,23 @@ function expandRequiredGates(existingGates, newAgentType) {
|
|
|
40438
40438
|
return combined.sort();
|
|
40439
40439
|
}
|
|
40440
40440
|
function getEvidenceDir(directory) {
|
|
40441
|
-
|
|
40441
|
+
const swarmDir = path18.resolve(directory, ".swarm");
|
|
40442
|
+
const evidenceDir = path18.join(swarmDir, "evidence");
|
|
40443
|
+
mkdirSync8(evidenceDir, { recursive: true });
|
|
40444
|
+
let resolvedSwarmDir;
|
|
40445
|
+
let resolvedEvidenceDir;
|
|
40446
|
+
try {
|
|
40447
|
+
resolvedSwarmDir = path18.normalize(realpathSync5(swarmDir));
|
|
40448
|
+
resolvedEvidenceDir = path18.normalize(realpathSync5(evidenceDir));
|
|
40449
|
+
} catch (error49) {
|
|
40450
|
+
throw new Error(`Unable to resolve evidence directory: ${error49.message}`);
|
|
40451
|
+
}
|
|
40452
|
+
const swarmPrefix = `${resolvedSwarmDir}${path18.sep}`;
|
|
40453
|
+
const withinSwarmBoundary = process.platform === "win32" ? resolvedEvidenceDir.toLowerCase().startsWith(swarmPrefix.toLowerCase()) : resolvedEvidenceDir.startsWith(swarmPrefix);
|
|
40454
|
+
if (!withinSwarmBoundary) {
|
|
40455
|
+
throw new Error(`Evidence path escapes .swarm boundary: ${resolvedEvidenceDir}`);
|
|
40456
|
+
}
|
|
40457
|
+
return resolvedEvidenceDir;
|
|
40442
40458
|
}
|
|
40443
40459
|
function getEvidencePath(directory, taskId) {
|
|
40444
40460
|
assertValidTaskId(taskId);
|
|
@@ -40457,10 +40473,9 @@ function readExisting(evidencePath, taskId) {
|
|
|
40457
40473
|
}
|
|
40458
40474
|
async function recordGateEvidence(directory, taskId, gate, sessionId, turbo) {
|
|
40459
40475
|
assertValidTaskId(taskId);
|
|
40460
|
-
const evidenceDir = getEvidenceDir(directory);
|
|
40461
|
-
mkdirSync8(evidenceDir, { recursive: true });
|
|
40462
40476
|
await withTaskEvidenceLock(directory, taskId, gate, async () => {
|
|
40463
|
-
const
|
|
40477
|
+
const resolvedEvidenceDir = getEvidenceDir(directory);
|
|
40478
|
+
const evidencePath = path18.join(resolvedEvidenceDir, `${taskId}.json`);
|
|
40464
40479
|
let existing = null;
|
|
40465
40480
|
try {
|
|
40466
40481
|
existing = readExisting(evidencePath, taskId);
|
|
@@ -40488,10 +40503,9 @@ async function recordGateEvidence(directory, taskId, gate, sessionId, turbo) {
|
|
|
40488
40503
|
}
|
|
40489
40504
|
async function recordAgentDispatch(directory, taskId, agentType, turbo) {
|
|
40490
40505
|
assertValidTaskId(taskId);
|
|
40491
|
-
const evidenceDir = getEvidenceDir(directory);
|
|
40492
|
-
mkdirSync8(evidenceDir, { recursive: true });
|
|
40493
40506
|
await withTaskEvidenceLock(directory, taskId, agentType, async () => {
|
|
40494
|
-
const
|
|
40507
|
+
const resolvedEvidenceDir = getEvidenceDir(directory);
|
|
40508
|
+
const evidencePath = path18.join(resolvedEvidenceDir, `${taskId}.json`);
|
|
40495
40509
|
let existing = null;
|
|
40496
40510
|
try {
|
|
40497
40511
|
existing = readExisting(evidencePath, taskId);
|
|
@@ -56868,12 +56882,12 @@ async function appendRejectedLesson(directory, lesson) {
|
|
|
56868
56882
|
await appendKnowledge(filePath, lesson);
|
|
56869
56883
|
}
|
|
56870
56884
|
}
|
|
56871
|
-
function
|
|
56885
|
+
function normalize4(text) {
|
|
56872
56886
|
const s = typeof text === "string" ? text : String(text ?? "");
|
|
56873
56887
|
return s.toLowerCase().replace(/[^\w\s]/g, " ").replace(/\s+/g, " ").trim();
|
|
56874
56888
|
}
|
|
56875
56889
|
function wordBigrams(text) {
|
|
56876
|
-
const words =
|
|
56890
|
+
const words = normalize4(text).split(" ").filter(Boolean);
|
|
56877
56891
|
const bigrams = new Set;
|
|
56878
56892
|
for (let i2 = 0;i2 < words.length - 1; i2++) {
|
|
56879
56893
|
bigrams.add(`${words[i2]} ${words[i2 + 1]}`);
|
|
@@ -59936,11 +59950,11 @@ async function processRetractions(retractions, directory) {
|
|
|
59936
59950
|
const existingRetractions = await readRetractionRecords(directory);
|
|
59937
59951
|
const existingSuppressedLessons = new Set(existingRetractions.map((record3) => record3.normalized_lesson).filter((value) => typeof value === "string" && value.length > 0));
|
|
59938
59952
|
for (const retractionText of retractions) {
|
|
59939
|
-
const normalizedRetraction =
|
|
59953
|
+
const normalizedRetraction = normalize4(retractionText);
|
|
59940
59954
|
const matchedSwarmIds = [];
|
|
59941
59955
|
const matchedHiveIds = [];
|
|
59942
59956
|
for (const entry of swarmEntries) {
|
|
59943
|
-
const normalizedLesson =
|
|
59957
|
+
const normalizedLesson = normalize4(entry.lesson);
|
|
59944
59958
|
if (normalizedLesson === normalizedRetraction) {
|
|
59945
59959
|
matchedSwarmIds.push(entry.id);
|
|
59946
59960
|
await quarantineEntry(directory, entry.id, `Retracted by architect: ${retractionText}`, "architect");
|
|
@@ -59948,7 +59962,7 @@ async function processRetractions(retractions, directory) {
|
|
|
59948
59962
|
}
|
|
59949
59963
|
}
|
|
59950
59964
|
for (const entry of hiveEntries) {
|
|
59951
|
-
if (
|
|
59965
|
+
if (normalize4(entry.lesson) === normalizedRetraction) {
|
|
59952
59966
|
matchedHiveIds.push(entry.id);
|
|
59953
59967
|
}
|
|
59954
59968
|
}
|
|
@@ -68392,7 +68406,7 @@ function parseContextMd(content) {
|
|
|
68392
68406
|
for (const bullet of bullets) {
|
|
68393
68407
|
if (bullet.length < 15)
|
|
68394
68408
|
continue;
|
|
68395
|
-
const normalized =
|
|
68409
|
+
const normalized = normalize4(bullet);
|
|
68396
68410
|
if (seen.has(normalized))
|
|
68397
68411
|
continue;
|
|
68398
68412
|
seen.add(normalized);
|
|
@@ -73602,7 +73616,7 @@ async function _detectAvailableLinter(_projectDir, biomeBin, eslintBin) {
|
|
|
73602
73616
|
stderr: "pipe"
|
|
73603
73617
|
});
|
|
73604
73618
|
const biomeExit = biomeProc.exited;
|
|
73605
|
-
const timeout = new Promise((
|
|
73619
|
+
const timeout = new Promise((resolve18) => setTimeout(() => resolve18("timeout"), DETECT_TIMEOUT));
|
|
73606
73620
|
const result = await Promise.race([biomeExit, timeout]);
|
|
73607
73621
|
if (result === "timeout") {
|
|
73608
73622
|
biomeProc.kill();
|
|
@@ -73616,7 +73630,7 @@ async function _detectAvailableLinter(_projectDir, biomeBin, eslintBin) {
|
|
|
73616
73630
|
stderr: "pipe"
|
|
73617
73631
|
});
|
|
73618
73632
|
const eslintExit = eslintProc.exited;
|
|
73619
|
-
const timeout = new Promise((
|
|
73633
|
+
const timeout = new Promise((resolve18) => setTimeout(() => resolve18("timeout"), DETECT_TIMEOUT));
|
|
73620
73634
|
const result = await Promise.race([eslintExit, timeout]);
|
|
73621
73635
|
if (result === "timeout") {
|
|
73622
73636
|
eslintProc.kill();
|
|
@@ -77641,9 +77655,9 @@ async function runTests(framework, scope, files, coverage, timeout_ms, cwd) {
|
|
|
77641
77655
|
stderr: "pipe",
|
|
77642
77656
|
cwd
|
|
77643
77657
|
});
|
|
77644
|
-
const timeoutPromise = new Promise((
|
|
77658
|
+
const timeoutPromise = new Promise((resolve22) => setTimeout(() => {
|
|
77645
77659
|
proc.kill();
|
|
77646
|
-
|
|
77660
|
+
resolve22(-1);
|
|
77647
77661
|
}, timeout_ms));
|
|
77648
77662
|
const [exitCode, stdoutResult, stderrResult] = await Promise.all([
|
|
77649
77663
|
Promise.race([proc.exited, timeoutPromise]),
|
|
@@ -79190,13 +79204,13 @@ class CircuitBreaker {
|
|
|
79190
79204
|
if (this.config.callTimeoutMs <= 0) {
|
|
79191
79205
|
return fn2();
|
|
79192
79206
|
}
|
|
79193
|
-
return new Promise((
|
|
79207
|
+
return new Promise((resolve23, reject) => {
|
|
79194
79208
|
const timeout = setTimeout(() => {
|
|
79195
79209
|
reject(new Error(`Call timeout after ${this.config.callTimeoutMs}ms`));
|
|
79196
79210
|
}, this.config.callTimeoutMs);
|
|
79197
79211
|
fn2().then((result) => {
|
|
79198
79212
|
clearTimeout(timeout);
|
|
79199
|
-
|
|
79213
|
+
resolve23(result);
|
|
79200
79214
|
}).catch((error93) => {
|
|
79201
79215
|
clearTimeout(timeout);
|
|
79202
79216
|
reject(error93);
|
|
@@ -79483,7 +79497,7 @@ var init_queue = __esm(() => {
|
|
|
79483
79497
|
|
|
79484
79498
|
// src/background/worker.ts
|
|
79485
79499
|
function sleep(ms) {
|
|
79486
|
-
return new Promise((
|
|
79500
|
+
return new Promise((resolve23) => setTimeout(resolve23, ms));
|
|
79487
79501
|
}
|
|
79488
79502
|
|
|
79489
79503
|
class WorkerManager {
|
|
@@ -86843,9 +86857,9 @@ function validateFilename(filename) {
|
|
|
86843
86857
|
throw new Error("Invalid filename: contains null byte");
|
|
86844
86858
|
}
|
|
86845
86859
|
const pathSeparators = ["/", "\\", ".."];
|
|
86846
|
-
for (const
|
|
86847
|
-
if (filename.includes(
|
|
86848
|
-
throw new Error(`Invalid filename: contains path separator '${
|
|
86860
|
+
for (const sep10 of pathSeparators) {
|
|
86861
|
+
if (filename.includes(sep10)) {
|
|
86862
|
+
throw new Error(`Invalid filename: contains path separator '${sep10}'`);
|
|
86849
86863
|
}
|
|
86850
86864
|
}
|
|
86851
86865
|
if (filename.startsWith("/") || filename.startsWith("\\") || /^[a-zA-Z]:/.test(filename)) {
|
|
@@ -89263,8 +89277,8 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
89263
89277
|
var moduleRtn;
|
|
89264
89278
|
var Module = moduleArg;
|
|
89265
89279
|
var readyPromiseResolve, readyPromiseReject;
|
|
89266
|
-
var readyPromise = new Promise((
|
|
89267
|
-
readyPromiseResolve =
|
|
89280
|
+
var readyPromise = new Promise((resolve31, reject) => {
|
|
89281
|
+
readyPromiseResolve = resolve31;
|
|
89268
89282
|
readyPromiseReject = reject;
|
|
89269
89283
|
});
|
|
89270
89284
|
var ENVIRONMENT_IS_WEB = typeof window == "object";
|
|
@@ -89344,13 +89358,13 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
89344
89358
|
}
|
|
89345
89359
|
readAsync = /* @__PURE__ */ __name(async (url3) => {
|
|
89346
89360
|
if (isFileURI(url3)) {
|
|
89347
|
-
return new Promise((
|
|
89361
|
+
return new Promise((resolve31, reject) => {
|
|
89348
89362
|
var xhr = new XMLHttpRequest;
|
|
89349
89363
|
xhr.open("GET", url3, true);
|
|
89350
89364
|
xhr.responseType = "arraybuffer";
|
|
89351
89365
|
xhr.onload = () => {
|
|
89352
89366
|
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
|
|
89353
|
-
|
|
89367
|
+
resolve31(xhr.response);
|
|
89354
89368
|
return;
|
|
89355
89369
|
}
|
|
89356
89370
|
reject(xhr.status);
|
|
@@ -89570,10 +89584,10 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
89570
89584
|
__name(receiveInstantiationResult, "receiveInstantiationResult");
|
|
89571
89585
|
var info2 = getWasmImports();
|
|
89572
89586
|
if (Module["instantiateWasm"]) {
|
|
89573
|
-
return new Promise((
|
|
89587
|
+
return new Promise((resolve31, reject) => {
|
|
89574
89588
|
Module["instantiateWasm"](info2, (mod, inst) => {
|
|
89575
89589
|
receiveInstance(mod, inst);
|
|
89576
|
-
|
|
89590
|
+
resolve31(mod.exports);
|
|
89577
89591
|
});
|
|
89578
89592
|
});
|
|
89579
89593
|
}
|
|
@@ -91449,13 +91463,13 @@ async function extractDocConstraints(directory, taskFiles, taskDescription) {
|
|
|
91449
91463
|
const knowledgePath = resolveSwarmKnowledgePath(directory);
|
|
91450
91464
|
const existingEntries = await readKnowledge(knowledgePath);
|
|
91451
91465
|
const taskContext = [...taskFiles, taskDescription].join(" ");
|
|
91452
|
-
const taskBigrams = wordBigrams(
|
|
91466
|
+
const taskBigrams = wordBigrams(normalize4(taskContext));
|
|
91453
91467
|
let extractedCount = 0;
|
|
91454
91468
|
let skippedCount = 0;
|
|
91455
91469
|
const details = [];
|
|
91456
91470
|
for (const docFile of manifest.files) {
|
|
91457
91471
|
const docContext = `${docFile.path} ${docFile.title} ${docFile.summary}`;
|
|
91458
|
-
const docBigrams = wordBigrams(
|
|
91472
|
+
const docBigrams = wordBigrams(normalize4(docContext));
|
|
91459
91473
|
const score = jaccardBigram(taskBigrams, docBigrams);
|
|
91460
91474
|
if (score <= RELEVANCE_THRESHOLD) {
|
|
91461
91475
|
skippedCount++;
|
|
@@ -91686,7 +91700,7 @@ async function readMergedKnowledge(directory, config3, context, opts) {
|
|
|
91686
91700
|
const seenLessons = new Set;
|
|
91687
91701
|
const merged = [];
|
|
91688
91702
|
for (const entry of hiveEntries) {
|
|
91689
|
-
const normalized =
|
|
91703
|
+
const normalized = normalize4(entry.lesson);
|
|
91690
91704
|
seenLessons.add(normalized);
|
|
91691
91705
|
merged.push({
|
|
91692
91706
|
...entry,
|
|
@@ -91695,15 +91709,15 @@ async function readMergedKnowledge(directory, config3, context, opts) {
|
|
|
91695
91709
|
});
|
|
91696
91710
|
}
|
|
91697
91711
|
for (const entry of swarmEntries) {
|
|
91698
|
-
const normalized =
|
|
91712
|
+
const normalized = normalize4(entry.lesson);
|
|
91699
91713
|
if (seenLessons.has(normalized)) {
|
|
91700
91714
|
continue;
|
|
91701
91715
|
}
|
|
91702
91716
|
const swarmBigrams = wordBigrams(normalized);
|
|
91703
|
-
const isHiveNearDup = hiveEntries.some((hiveEntry) => jaccardBigram(swarmBigrams, wordBigrams(
|
|
91717
|
+
const isHiveNearDup = hiveEntries.some((hiveEntry) => jaccardBigram(swarmBigrams, wordBigrams(normalize4(hiveEntry.lesson))) >= JACCARD_THRESHOLD2);
|
|
91704
91718
|
if (isHiveNearDup)
|
|
91705
91719
|
continue;
|
|
91706
|
-
const isSwarmNearDup = merged.some((m) => m.tier === "swarm" && jaccardBigram(swarmBigrams, wordBigrams(
|
|
91720
|
+
const isSwarmNearDup = merged.some((m) => m.tier === "swarm" && jaccardBigram(swarmBigrams, wordBigrams(normalize4(m.lesson))) >= JACCARD_THRESHOLD2);
|
|
91707
91721
|
if (isSwarmNearDup)
|
|
91708
91722
|
continue;
|
|
91709
91723
|
seenLessons.add(normalized);
|
|
@@ -91716,7 +91730,7 @@ async function readMergedKnowledge(directory, config3, context, opts) {
|
|
|
91716
91730
|
const retractionRecords = await readRetractionRecords(directory);
|
|
91717
91731
|
const suppressedLessons = new Set(retractionRecords.map((record3) => record3.normalized_lesson).filter((value) => typeof value === "string" && value.length > 0));
|
|
91718
91732
|
const scopeFilter = config3.scope_filter ?? ["global"];
|
|
91719
|
-
const filtered = merged.filter((entry) => (opts?.skipScopeFilter || scopeFilter.some((pattern) => (entry.scope ?? "global") === pattern)) && NORMAL_RETRIEVAL_STATUSES.has(entry.status) && !suppressedLessons.has(
|
|
91733
|
+
const filtered = merged.filter((entry) => (opts?.skipScopeFilter || scopeFilter.some((pattern) => (entry.scope ?? "global") === pattern)) && NORMAL_RETRIEVAL_STATUSES.has(entry.status) && !suppressedLessons.has(normalize4(entry.lesson)));
|
|
91720
91734
|
const ranked = filtered.map((entry) => {
|
|
91721
91735
|
let categoryScore = 0;
|
|
91722
91736
|
if (context?.currentPhase) {
|
|
@@ -91960,14 +91974,14 @@ async function searchKnowledge(params) {
|
|
|
91960
91974
|
});
|
|
91961
91975
|
}
|
|
91962
91976
|
const queryText = (query ?? "").trim();
|
|
91963
|
-
const queryBigrams = queryText ? wordBigrams(
|
|
91977
|
+
const queryBigrams = queryText ? wordBigrams(normalize4(queryText)) : null;
|
|
91964
91978
|
const hasQuery = queryBigrams !== null;
|
|
91965
91979
|
const textWeight = hasQuery ? TEXT_WEIGHT : 0;
|
|
91966
91980
|
const metaWeight = hasQuery ? META_WEIGHT : 1;
|
|
91967
91981
|
const minConf = typeof config3.directive_min_confidence === "number" ? config3.directive_min_confidence : DIRECTIVE_BOOST_MIN_CONFIDENCE;
|
|
91968
91982
|
const scored = candidates.map((entry) => {
|
|
91969
91983
|
const retrievalOutcomes = effectiveRetrievalOutcomes(entry.retrieval_outcomes, counterRollups.get(entry.id));
|
|
91970
|
-
const textScore = queryBigrams ? jaccardBigram(queryBigrams, wordBigrams(
|
|
91984
|
+
const textScore = queryBigrams ? jaccardBigram(queryBigrams, wordBigrams(normalize4(entryText(entry)))) : 0;
|
|
91971
91985
|
const metaScore = entry.finalScore;
|
|
91972
91986
|
const ds = context ? scoreDirectiveAgainstContext(entry, context) : { triggerHit: false, actionHit: false, agentHit: false, score: 0 };
|
|
91973
91987
|
const confBoost = context && entry.confidence >= minConf && (ds.actionHit || ds.agentHit) ? 0.25 : 0;
|
|
@@ -92940,13 +92954,13 @@ class PlanSyncWorker {
|
|
|
92940
92954
|
} catch {}
|
|
92941
92955
|
}
|
|
92942
92956
|
withTimeout(promise3, ms, timeoutMessage) {
|
|
92943
|
-
return new Promise((
|
|
92957
|
+
return new Promise((resolve25, reject) => {
|
|
92944
92958
|
const timer = setTimeout(() => {
|
|
92945
92959
|
reject(new Error(`${timeoutMessage} (${ms}ms)`));
|
|
92946
92960
|
}, ms);
|
|
92947
92961
|
promise3.then((result) => {
|
|
92948
92962
|
clearTimeout(timer);
|
|
92949
|
-
|
|
92963
|
+
resolve25(result);
|
|
92950
92964
|
}).catch((error93) => {
|
|
92951
92965
|
clearTimeout(timer);
|
|
92952
92966
|
reject(error93);
|
|
@@ -95393,7 +95407,7 @@ import * as path85 from "node:path";
|
|
|
95393
95407
|
init_logger();
|
|
95394
95408
|
init_path_security();
|
|
95395
95409
|
import * as fsSync4 from "node:fs";
|
|
95396
|
-
import { existsSync as existsSync47, realpathSync as
|
|
95410
|
+
import { existsSync as existsSync47, realpathSync as realpathSync11 } from "node:fs";
|
|
95397
95411
|
import * as fsPromises5 from "node:fs/promises";
|
|
95398
95412
|
import * as os13 from "node:os";
|
|
95399
95413
|
import * as path81 from "node:path";
|
|
@@ -95415,8 +95429,8 @@ async function withTimeout(promise3, ms, timeoutError) {
|
|
|
95415
95429
|
}
|
|
95416
95430
|
}
|
|
95417
95431
|
function yieldToEventLoop() {
|
|
95418
|
-
return new Promise((
|
|
95419
|
-
const t = setTimeout(
|
|
95432
|
+
return new Promise((resolve25) => {
|
|
95433
|
+
const t = setTimeout(resolve25, 0);
|
|
95420
95434
|
if (typeof t.unref === "function") {
|
|
95421
95435
|
t.unref();
|
|
95422
95436
|
}
|
|
@@ -95757,8 +95771,8 @@ var symbols = createSwarmTool({
|
|
|
95757
95771
|
});
|
|
95758
95772
|
|
|
95759
95773
|
// src/tools/repo-graph/safe-realpath.ts
|
|
95760
|
-
import { realpathSync as
|
|
95761
|
-
function safeRealpathSync(targetPath, fallback, realpathResolver =
|
|
95774
|
+
import { realpathSync as realpathSync10 } from "node:fs";
|
|
95775
|
+
function safeRealpathSync(targetPath, fallback, realpathResolver = realpathSync10) {
|
|
95762
95776
|
try {
|
|
95763
95777
|
return realpathResolver(targetPath);
|
|
95764
95778
|
} catch (error93) {
|
|
@@ -96016,7 +96030,7 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
|
|
|
96016
96030
|
function isRefusedWorkspaceRoot(target) {
|
|
96017
96031
|
let resolved;
|
|
96018
96032
|
try {
|
|
96019
|
-
resolved =
|
|
96033
|
+
resolved = realpathSync11(target);
|
|
96020
96034
|
} catch {
|
|
96021
96035
|
resolved = path81.resolve(target);
|
|
96022
96036
|
}
|
|
@@ -96485,7 +96499,7 @@ async function saveGraph(workspace, graph, options) {
|
|
|
96485
96499
|
lastError = error93 instanceof Error ? error93 : new Error(String(error93));
|
|
96486
96500
|
if (lastError instanceof Error && "code" in lastError && lastError.code === "EEXIST" && retries < WINDOWS_RENAME_MAX_RETRIES2 - 1) {
|
|
96487
96501
|
retries++;
|
|
96488
|
-
await new Promise((
|
|
96502
|
+
await new Promise((resolve27) => setTimeout(resolve27, WINDOWS_RENAME_RETRY_DELAY_MS2));
|
|
96489
96503
|
continue;
|
|
96490
96504
|
}
|
|
96491
96505
|
throw lastError;
|
|
@@ -97459,26 +97473,26 @@ function pLimit(concurrency) {
|
|
|
97459
97473
|
activeCount--;
|
|
97460
97474
|
resumeNext();
|
|
97461
97475
|
};
|
|
97462
|
-
const run2 = async (function_,
|
|
97476
|
+
const run2 = async (function_, resolve29, arguments_2) => {
|
|
97463
97477
|
const result = (async () => function_(...arguments_2))();
|
|
97464
|
-
|
|
97478
|
+
resolve29(result);
|
|
97465
97479
|
try {
|
|
97466
97480
|
await result;
|
|
97467
97481
|
} catch {}
|
|
97468
97482
|
next();
|
|
97469
97483
|
};
|
|
97470
|
-
const enqueue = (function_,
|
|
97484
|
+
const enqueue = (function_, resolve29, reject, arguments_2) => {
|
|
97471
97485
|
const queueItem = { reject };
|
|
97472
97486
|
new Promise((internalResolve) => {
|
|
97473
97487
|
queueItem.run = internalResolve;
|
|
97474
97488
|
queue.enqueue(queueItem);
|
|
97475
|
-
}).then(run2.bind(undefined, function_,
|
|
97489
|
+
}).then(run2.bind(undefined, function_, resolve29, arguments_2));
|
|
97476
97490
|
if (activeCount < concurrency) {
|
|
97477
97491
|
resumeNext();
|
|
97478
97492
|
}
|
|
97479
97493
|
};
|
|
97480
|
-
const generator = (function_, ...arguments_2) => new Promise((
|
|
97481
|
-
enqueue(function_,
|
|
97494
|
+
const generator = (function_, ...arguments_2) => new Promise((resolve29, reject) => {
|
|
97495
|
+
enqueue(function_, resolve29, reject, arguments_2);
|
|
97482
97496
|
});
|
|
97483
97497
|
Object.defineProperties(generator, {
|
|
97484
97498
|
activeCount: {
|
|
@@ -99340,7 +99354,7 @@ function isGitBinaryMissing(err2) {
|
|
|
99340
99354
|
// src/hooks/semantic-diff-injection.ts
|
|
99341
99355
|
async function execGit(directory, args2, options) {
|
|
99342
99356
|
try {
|
|
99343
|
-
const stdout = await new Promise((
|
|
99357
|
+
const stdout = await new Promise((resolve32, reject) => {
|
|
99344
99358
|
const execOpts = {
|
|
99345
99359
|
encoding: "utf-8",
|
|
99346
99360
|
cwd: directory,
|
|
@@ -99353,7 +99367,7 @@ async function execGit(directory, args2, options) {
|
|
|
99353
99367
|
reject(error93);
|
|
99354
99368
|
return;
|
|
99355
99369
|
}
|
|
99356
|
-
|
|
99370
|
+
resolve32(output ?? "");
|
|
99357
99371
|
});
|
|
99358
99372
|
});
|
|
99359
99373
|
return stdout;
|
|
@@ -102556,7 +102570,7 @@ import * as path98 from "node:path";
|
|
|
102556
102570
|
import * as child_process6 from "node:child_process";
|
|
102557
102571
|
var WIN32_CMD_BINARIES = new Set(["npm", "npx", "pnpm", "yarn"]);
|
|
102558
102572
|
function spawnAsync(command, cwd, timeoutMs) {
|
|
102559
|
-
return new Promise((
|
|
102573
|
+
return new Promise((resolve34) => {
|
|
102560
102574
|
try {
|
|
102561
102575
|
const [rawCmd, ...args2] = command;
|
|
102562
102576
|
const cmd = process.platform === "win32" && WIN32_CMD_BINARIES.has(rawCmd) && !rawCmd.includes(".") ? `${rawCmd}.cmd` : rawCmd;
|
|
@@ -102603,24 +102617,24 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
102603
102617
|
try {
|
|
102604
102618
|
proc.kill();
|
|
102605
102619
|
} catch {}
|
|
102606
|
-
|
|
102620
|
+
resolve34(null);
|
|
102607
102621
|
}, timeoutMs);
|
|
102608
102622
|
proc.on("close", (code) => {
|
|
102609
102623
|
if (done)
|
|
102610
102624
|
return;
|
|
102611
102625
|
done = true;
|
|
102612
102626
|
clearTimeout(timer);
|
|
102613
|
-
|
|
102627
|
+
resolve34({ exitCode: code ?? 1, stdout, stderr });
|
|
102614
102628
|
});
|
|
102615
102629
|
proc.on("error", () => {
|
|
102616
102630
|
if (done)
|
|
102617
102631
|
return;
|
|
102618
102632
|
done = true;
|
|
102619
102633
|
clearTimeout(timer);
|
|
102620
|
-
|
|
102634
|
+
resolve34(null);
|
|
102621
102635
|
});
|
|
102622
102636
|
} catch {
|
|
102623
|
-
|
|
102637
|
+
resolve34(null);
|
|
102624
102638
|
}
|
|
102625
102639
|
});
|
|
102626
102640
|
}
|
|
@@ -106107,7 +106121,7 @@ import {
|
|
|
106107
106121
|
mkdirSync as mkdirSync27,
|
|
106108
106122
|
mkdtempSync as mkdtempSync2,
|
|
106109
106123
|
readFileSync as readFileSync39,
|
|
106110
|
-
realpathSync as
|
|
106124
|
+
realpathSync as realpathSync14,
|
|
106111
106125
|
renameSync as renameSync20,
|
|
106112
106126
|
rmdirSync,
|
|
106113
106127
|
unlinkSync as unlinkSync17,
|
|
@@ -106141,8 +106155,8 @@ function containsStrictControlChars(str) {
|
|
|
106141
106155
|
}
|
|
106142
106156
|
function isCanonicalProtectedPath(targetPath, workspace) {
|
|
106143
106157
|
try {
|
|
106144
|
-
const canonicalTarget =
|
|
106145
|
-
const canonicalWorkspace =
|
|
106158
|
+
const canonicalTarget = realpathSync14(targetPath);
|
|
106159
|
+
const canonicalWorkspace = realpathSync14(workspace);
|
|
106146
106160
|
const relative21 = path109.relative(canonicalWorkspace, canonicalTarget).replace(/\\/g, "/");
|
|
106147
106161
|
const segments = relative21.split("/").filter(Boolean);
|
|
106148
106162
|
return segments.some((seg) => seg === ".git" || seg === ".swarm");
|
|
@@ -106151,8 +106165,8 @@ function isCanonicalProtectedPath(targetPath, workspace) {
|
|
|
106151
106165
|
if (parentDir === targetPath)
|
|
106152
106166
|
return false;
|
|
106153
106167
|
try {
|
|
106154
|
-
const canonicalParent =
|
|
106155
|
-
const canonicalWorkspace =
|
|
106168
|
+
const canonicalParent = realpathSync14(parentDir);
|
|
106169
|
+
const canonicalWorkspace = realpathSync14(workspace);
|
|
106156
106170
|
const relative21 = path109.relative(canonicalWorkspace, canonicalParent).replace(/\\/g, "/");
|
|
106157
106171
|
const segments = relative21.split("/").filter(Boolean);
|
|
106158
106172
|
return segments.some((seg) => seg === ".git" || seg === ".swarm");
|
|
@@ -106163,8 +106177,8 @@ function isCanonicalProtectedPath(targetPath, workspace) {
|
|
|
106163
106177
|
}
|
|
106164
106178
|
function isCanonicalPathWithinWorkspace(targetPath, workspaceRoot) {
|
|
106165
106179
|
try {
|
|
106166
|
-
const canonicalTarget =
|
|
106167
|
-
const canonicalWorkspace =
|
|
106180
|
+
const canonicalTarget = realpathSync14(targetPath);
|
|
106181
|
+
const canonicalWorkspace = realpathSync14(workspaceRoot);
|
|
106168
106182
|
const relative21 = path109.relative(canonicalWorkspace, canonicalTarget);
|
|
106169
106183
|
if (relative21.startsWith("..") || path109.isAbsolute(relative21))
|
|
106170
106184
|
return false;
|
|
@@ -106178,8 +106192,8 @@ function isCanonicalPathWithinWorkspace(targetPath, workspaceRoot) {
|
|
|
106178
106192
|
return false;
|
|
106179
106193
|
}
|
|
106180
106194
|
try {
|
|
106181
|
-
const canonicalParent =
|
|
106182
|
-
const canonicalWorkspace =
|
|
106195
|
+
const canonicalParent = realpathSync14(parentDir);
|
|
106196
|
+
const canonicalWorkspace = realpathSync14(workspaceRoot);
|
|
106183
106197
|
const relative21 = path109.relative(canonicalWorkspace, canonicalParent);
|
|
106184
106198
|
if (relative21.startsWith("..") || path109.isAbsolute(relative21))
|
|
106185
106199
|
return false;
|
|
@@ -106457,7 +106471,7 @@ function atomicWriteFileSync(targetPath, content) {
|
|
|
106457
106471
|
const tempPrefix = `.apply-patch-${Date.now()}-${process.pid}`;
|
|
106458
106472
|
let tempPath;
|
|
106459
106473
|
try {
|
|
106460
|
-
const tempDir =
|
|
106474
|
+
const tempDir = realpathSync14(mkdtempSync2(path109.join(dir, tempPrefix)));
|
|
106461
106475
|
tempPath = path109.join(tempDir, "content");
|
|
106462
106476
|
} catch {
|
|
106463
106477
|
tempPath = path109.join(dir, `${tempPrefix}.tmp`);
|
|
@@ -110437,7 +110451,7 @@ init_create_tool();
|
|
|
110437
110451
|
init_resolve_working_directory();
|
|
110438
110452
|
async function execGit2(workingDir, args2, options) {
|
|
110439
110453
|
try {
|
|
110440
|
-
const stdout = await new Promise((
|
|
110454
|
+
const stdout = await new Promise((resolve42, reject) => {
|
|
110441
110455
|
const execOpts = {
|
|
110442
110456
|
encoding: "utf-8",
|
|
110443
110457
|
cwd: workingDir,
|
|
@@ -110450,7 +110464,7 @@ async function execGit2(workingDir, args2, options) {
|
|
|
110450
110464
|
reject(error93);
|
|
110451
110465
|
return;
|
|
110452
110466
|
}
|
|
110453
|
-
|
|
110467
|
+
resolve42(output ?? "");
|
|
110454
110468
|
});
|
|
110455
110469
|
});
|
|
110456
110470
|
return stdout;
|
|
@@ -111390,7 +111404,7 @@ init_create_tool();
|
|
|
111390
111404
|
var GITINGEST_TIMEOUT_MS = 1e4;
|
|
111391
111405
|
var GITINGEST_MAX_RESPONSE_BYTES = 5242880;
|
|
111392
111406
|
var GITINGEST_MAX_RETRIES = 2;
|
|
111393
|
-
var delay = (ms) => new Promise((
|
|
111407
|
+
var delay = (ms) => new Promise((resolve43) => setTimeout(resolve43, ms));
|
|
111394
111408
|
async function fetchGitingest(args2) {
|
|
111395
111409
|
for (let attempt = 0;attempt <= GITINGEST_MAX_RETRIES; attempt++) {
|
|
111396
111410
|
try {
|
|
@@ -112245,7 +112259,7 @@ function filterSwarmEntries(entries, filters, suppressedLessons, scopeFilter) {
|
|
|
112245
112259
|
return false;
|
|
112246
112260
|
}
|
|
112247
112261
|
}
|
|
112248
|
-
if (suppressedLessons.has(
|
|
112262
|
+
if (suppressedLessons.has(normalize4(entry.lesson))) {
|
|
112249
112263
|
return false;
|
|
112250
112264
|
}
|
|
112251
112265
|
return true;
|
|
@@ -112266,7 +112280,7 @@ function filterHiveEntries(entries, filters, suppressedLessons) {
|
|
|
112266
112280
|
if (filters.minScore !== undefined && entry.confidence < filters.minScore) {
|
|
112267
112281
|
return false;
|
|
112268
112282
|
}
|
|
112269
|
-
if (suppressedLessons.has(
|
|
112283
|
+
if (suppressedLessons.has(normalize4(entry.lesson))) {
|
|
112270
112284
|
return false;
|
|
112271
112285
|
}
|
|
112272
112286
|
return true;
|
|
@@ -117129,7 +117143,7 @@ async function runNpmAudit(directory) {
|
|
|
117129
117143
|
stderr: "pipe",
|
|
117130
117144
|
cwd: directory
|
|
117131
117145
|
});
|
|
117132
|
-
const timeoutPromise = new Promise((
|
|
117146
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117133
117147
|
const result = await Promise.race([
|
|
117134
117148
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr2]) => ({ stdout: stdout2, stderr: stderr2 })),
|
|
117135
117149
|
timeoutPromise
|
|
@@ -117249,7 +117263,7 @@ async function runPipAudit(directory) {
|
|
|
117249
117263
|
stderr: "pipe",
|
|
117250
117264
|
cwd: directory
|
|
117251
117265
|
});
|
|
117252
|
-
const timeoutPromise = new Promise((
|
|
117266
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117253
117267
|
const result = await Promise.race([
|
|
117254
117268
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr2]) => ({ stdout: stdout2, stderr: stderr2 })),
|
|
117255
117269
|
timeoutPromise
|
|
@@ -117377,7 +117391,7 @@ async function runCargoAudit(directory) {
|
|
|
117377
117391
|
stderr: "pipe",
|
|
117378
117392
|
cwd: directory
|
|
117379
117393
|
});
|
|
117380
|
-
const timeoutPromise = new Promise((
|
|
117394
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117381
117395
|
const result = await Promise.race([
|
|
117382
117396
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117383
117397
|
timeoutPromise
|
|
@@ -117501,7 +117515,7 @@ async function runGoAudit(directory) {
|
|
|
117501
117515
|
stderr: "pipe",
|
|
117502
117516
|
cwd: directory
|
|
117503
117517
|
});
|
|
117504
|
-
const timeoutPromise = new Promise((
|
|
117518
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117505
117519
|
const result = await Promise.race([
|
|
117506
117520
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117507
117521
|
timeoutPromise
|
|
@@ -117634,7 +117648,7 @@ async function runDotnetAudit(directory) {
|
|
|
117634
117648
|
stderr: "pipe",
|
|
117635
117649
|
cwd: directory
|
|
117636
117650
|
});
|
|
117637
|
-
const timeoutPromise = new Promise((
|
|
117651
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117638
117652
|
const result = await Promise.race([
|
|
117639
117653
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117640
117654
|
timeoutPromise
|
|
@@ -117750,7 +117764,7 @@ async function runBundleAudit(directory) {
|
|
|
117750
117764
|
stderr: "pipe",
|
|
117751
117765
|
cwd: directory
|
|
117752
117766
|
});
|
|
117753
|
-
const timeoutPromise = new Promise((
|
|
117767
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117754
117768
|
const result = await Promise.race([
|
|
117755
117769
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117756
117770
|
timeoutPromise
|
|
@@ -117895,7 +117909,7 @@ async function runDartAudit(directory) {
|
|
|
117895
117909
|
stderr: "pipe",
|
|
117896
117910
|
cwd: directory
|
|
117897
117911
|
});
|
|
117898
|
-
const timeoutPromise = new Promise((
|
|
117912
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117899
117913
|
const result = await Promise.race([
|
|
117900
117914
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117901
117915
|
timeoutPromise
|
|
@@ -118010,7 +118024,7 @@ async function runComposerAudit(directory) {
|
|
|
118010
118024
|
stderr: "pipe",
|
|
118011
118025
|
cwd: directory
|
|
118012
118026
|
});
|
|
118013
|
-
const timeoutPromise = new Promise((
|
|
118027
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
118014
118028
|
const result = await Promise.race([
|
|
118015
118029
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
118016
118030
|
timeoutPromise
|
|
@@ -119671,7 +119685,7 @@ function mapSemgrepSeverity(severity) {
|
|
|
119671
119685
|
}
|
|
119672
119686
|
}
|
|
119673
119687
|
async function executeWithTimeout(command, args2, options) {
|
|
119674
|
-
return new Promise((
|
|
119688
|
+
return new Promise((resolve49) => {
|
|
119675
119689
|
const child = child_process9.spawn(command, args2, {
|
|
119676
119690
|
shell: false,
|
|
119677
119691
|
cwd: options.cwd
|
|
@@ -119680,7 +119694,7 @@ async function executeWithTimeout(command, args2, options) {
|
|
|
119680
119694
|
let stderr = "";
|
|
119681
119695
|
const timeout = setTimeout(() => {
|
|
119682
119696
|
child.kill("SIGTERM");
|
|
119683
|
-
|
|
119697
|
+
resolve49({
|
|
119684
119698
|
stdout,
|
|
119685
119699
|
stderr: "Process timed out",
|
|
119686
119700
|
exitCode: 124
|
|
@@ -119694,7 +119708,7 @@ async function executeWithTimeout(command, args2, options) {
|
|
|
119694
119708
|
});
|
|
119695
119709
|
child.on("close", (code) => {
|
|
119696
119710
|
clearTimeout(timeout);
|
|
119697
|
-
|
|
119711
|
+
resolve49({
|
|
119698
119712
|
stdout,
|
|
119699
119713
|
stderr,
|
|
119700
119714
|
exitCode: code ?? 0
|
|
@@ -119702,7 +119716,7 @@ async function executeWithTimeout(command, args2, options) {
|
|
|
119702
119716
|
});
|
|
119703
119717
|
child.on("error", (err2) => {
|
|
119704
119718
|
clearTimeout(timeout);
|
|
119705
|
-
|
|
119719
|
+
resolve49({
|
|
119706
119720
|
stdout,
|
|
119707
119721
|
stderr: err2.message,
|
|
119708
119722
|
exitCode: 1
|
|
@@ -119901,7 +119915,7 @@ async function acquireLock2(lockPath) {
|
|
|
119901
119915
|
};
|
|
119902
119916
|
} catch {
|
|
119903
119917
|
if (attempt < LOCK_RETRY_DELAYS_MS.length) {
|
|
119904
|
-
await new Promise((
|
|
119918
|
+
await new Promise((resolve50) => setTimeout(resolve50, LOCK_RETRY_DELAYS_MS[attempt]));
|
|
119905
119919
|
}
|
|
119906
119920
|
}
|
|
119907
119921
|
}
|
|
@@ -123912,7 +123926,7 @@ async function ripgrepSearch(opts) {
|
|
|
123912
123926
|
stderr: "pipe",
|
|
123913
123927
|
cwd: opts.workspace
|
|
123914
123928
|
});
|
|
123915
|
-
const timeout = new Promise((
|
|
123929
|
+
const timeout = new Promise((resolve56) => setTimeout(() => resolve56("timeout"), REGEX_TIMEOUT_MS));
|
|
123916
123930
|
const exitPromise = proc.exited;
|
|
123917
123931
|
const result = await Promise.race([exitPromise, timeout]);
|
|
123918
123932
|
if (result === "timeout") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.50.
|
|
3
|
+
"version": "7.50.3",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|