opencode-swarm 7.50.1 → 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 +82 -39
- package/dist/index.js +185 -128
- 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
|
}
|
|
@@ -52594,47 +52594,90 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
52594
52594
|
if (!fs19.existsSync(historyDir)) {
|
|
52595
52595
|
fs19.mkdirSync(historyDir, { recursive: true });
|
|
52596
52596
|
}
|
|
52597
|
-
|
|
52598
|
-
|
|
52599
|
-
|
|
52600
|
-
|
|
52601
|
-
|
|
52602
|
-
|
|
52603
|
-
|
|
52604
|
-
|
|
52605
|
-
|
|
52606
|
-
|
|
52607
|
-
|
|
52608
|
-
|
|
52609
|
-
const
|
|
52610
|
-
|
|
52611
|
-
recordsByTest.
|
|
52612
|
-
|
|
52613
|
-
|
|
52614
|
-
|
|
52615
|
-
|
|
52616
|
-
|
|
52617
|
-
|
|
52618
|
-
|
|
52619
|
-
|
|
52620
|
-
|
|
52621
|
-
|
|
52622
|
-
|
|
52623
|
-
|
|
52624
|
-
|
|
52597
|
+
withHistoryWriteLock(historyPath, () => {
|
|
52598
|
+
const existingRecords = readAllRecords(historyPath);
|
|
52599
|
+
const sanitizedRecords = records.map((record3) => ({
|
|
52600
|
+
...record3,
|
|
52601
|
+
timestamp: record3.timestamp || new Date().toISOString(),
|
|
52602
|
+
durationMs: Math.max(0, record3.durationMs),
|
|
52603
|
+
errorMessage: sanitizeErrorMessage(record3.errorMessage),
|
|
52604
|
+
stackPrefix: sanitizeStackPrefix(record3.stackPrefix),
|
|
52605
|
+
changedFiles: sanitizeChangedFiles(record3.changedFiles || [])
|
|
52606
|
+
}));
|
|
52607
|
+
existingRecords.push(...sanitizedRecords);
|
|
52608
|
+
const recordsByTest = new Map;
|
|
52609
|
+
for (const rec of existingRecords) {
|
|
52610
|
+
const normalizedKey = `${rec.testFile.toLowerCase()}|${rec.testName.toLowerCase()}`;
|
|
52611
|
+
if (!recordsByTest.has(normalizedKey)) {
|
|
52612
|
+
recordsByTest.set(normalizedKey, []);
|
|
52613
|
+
}
|
|
52614
|
+
recordsByTest.get(normalizedKey).push(rec);
|
|
52615
|
+
}
|
|
52616
|
+
const prunedRecords = [];
|
|
52617
|
+
for (const [, recs] of recordsByTest) {
|
|
52618
|
+
recs.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
52619
|
+
const toKeep = recs.slice(-MAX_HISTORY_PER_TEST);
|
|
52620
|
+
prunedRecords.push(...toKeep);
|
|
52621
|
+
}
|
|
52622
|
+
prunedRecords.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
52623
|
+
try {
|
|
52624
|
+
const lines = prunedRecords.map((rec) => JSON.stringify(rec));
|
|
52625
|
+
const content = `${lines.join(`
|
|
52625
52626
|
`)}
|
|
52626
52627
|
`;
|
|
52627
|
-
const tempPath = `${historyPath}.tmp`;
|
|
52628
|
-
fs19.writeFileSync(tempPath, content, "utf-8");
|
|
52629
|
-
fs19.renameSync(tempPath, historyPath);
|
|
52630
|
-
} catch (err) {
|
|
52631
|
-
try {
|
|
52632
52628
|
const tempPath = `${historyPath}.tmp`;
|
|
52633
|
-
|
|
52634
|
-
|
|
52629
|
+
fs19.writeFileSync(tempPath, content, "utf-8");
|
|
52630
|
+
fs19.renameSync(tempPath, historyPath);
|
|
52631
|
+
} catch (err) {
|
|
52632
|
+
try {
|
|
52633
|
+
const tempPath = `${historyPath}.tmp`;
|
|
52634
|
+
if (fs19.existsSync(tempPath)) {
|
|
52635
|
+
fs19.unlinkSync(tempPath);
|
|
52636
|
+
}
|
|
52637
|
+
} catch {}
|
|
52638
|
+
throw new Error(`Failed to write test history: ${err instanceof Error ? err.message : String(err)}`);
|
|
52639
|
+
}
|
|
52640
|
+
});
|
|
52641
|
+
}
|
|
52642
|
+
function withHistoryWriteLock(historyPath, fn) {
|
|
52643
|
+
const lockPath = `${historyPath}.write-lock`;
|
|
52644
|
+
const deadline = Date.now() + HISTORY_WRITE_LOCK_TIMEOUT_MS;
|
|
52645
|
+
while (true) {
|
|
52646
|
+
try {
|
|
52647
|
+
fs19.mkdirSync(lockPath);
|
|
52648
|
+
break;
|
|
52649
|
+
} catch (error93) {
|
|
52650
|
+
const code = error93 instanceof Error && "code" in error93 ? error93.code : undefined;
|
|
52651
|
+
if (code !== "EEXIST") {
|
|
52652
|
+
throw new Error(`Failed to acquire test history lock: ${error93 instanceof Error ? error93.message : String(error93)}`);
|
|
52653
|
+
}
|
|
52654
|
+
if (Date.now() >= deadline) {
|
|
52655
|
+
throw new Error(`Timed out waiting for test history lock: ${historyPath}`);
|
|
52656
|
+
}
|
|
52657
|
+
try {
|
|
52658
|
+
const lockStat = fs19.statSync(lockPath);
|
|
52659
|
+
if (Date.now() - lockStat.mtimeMs >= HISTORY_WRITE_LOCK_STALE_MS) {
|
|
52660
|
+
fs19.rmSync(lockPath, { recursive: true, force: true });
|
|
52661
|
+
continue;
|
|
52662
|
+
}
|
|
52663
|
+
} catch {}
|
|
52664
|
+
const remainingMs = Math.max(0, deadline - Date.now());
|
|
52665
|
+
const sleepMs = Math.min(HISTORY_WRITE_LOCK_BACKOFF_MS, remainingMs);
|
|
52666
|
+
if (sleepMs > 0) {
|
|
52667
|
+
sleepSync(sleepMs);
|
|
52635
52668
|
}
|
|
52669
|
+
}
|
|
52670
|
+
}
|
|
52671
|
+
try {
|
|
52672
|
+
return fn();
|
|
52673
|
+
} finally {
|
|
52674
|
+
try {
|
|
52675
|
+
fs19.rmSync(lockPath, { recursive: true, force: true });
|
|
52636
52676
|
} catch {}
|
|
52637
|
-
|
|
52677
|
+
}
|
|
52678
|
+
function sleepSync(ms) {
|
|
52679
|
+
const until = Date.now() + ms;
|
|
52680
|
+
while (Date.now() < until) {}
|
|
52638
52681
|
}
|
|
52639
52682
|
}
|
|
52640
52683
|
function readAllRecords(historyPath) {
|
|
@@ -52670,7 +52713,7 @@ function getAllHistory(workingDir) {
|
|
|
52670
52713
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
52671
52714
|
return records;
|
|
52672
52715
|
}
|
|
52673
|
-
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, DANGEROUS_PROPERTY_NAMES, _internals26;
|
|
52716
|
+
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES, _internals26;
|
|
52674
52717
|
var init_history_store = __esm(() => {
|
|
52675
52718
|
init_manager2();
|
|
52676
52719
|
DANGEROUS_PROPERTY_NAMES = new Set([
|
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();
|
|
@@ -75964,47 +75978,90 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
75964
75978
|
if (!fs29.existsSync(historyDir)) {
|
|
75965
75979
|
fs29.mkdirSync(historyDir, { recursive: true });
|
|
75966
75980
|
}
|
|
75967
|
-
|
|
75968
|
-
|
|
75969
|
-
|
|
75970
|
-
|
|
75971
|
-
|
|
75972
|
-
|
|
75973
|
-
|
|
75974
|
-
|
|
75975
|
-
|
|
75976
|
-
|
|
75977
|
-
|
|
75978
|
-
|
|
75979
|
-
const
|
|
75980
|
-
|
|
75981
|
-
recordsByTest.
|
|
75982
|
-
|
|
75983
|
-
|
|
75984
|
-
|
|
75985
|
-
|
|
75986
|
-
|
|
75987
|
-
|
|
75988
|
-
|
|
75989
|
-
|
|
75990
|
-
|
|
75991
|
-
|
|
75992
|
-
|
|
75993
|
-
|
|
75994
|
-
|
|
75981
|
+
withHistoryWriteLock(historyPath, () => {
|
|
75982
|
+
const existingRecords = readAllRecords(historyPath);
|
|
75983
|
+
const sanitizedRecords = records.map((record3) => ({
|
|
75984
|
+
...record3,
|
|
75985
|
+
timestamp: record3.timestamp || new Date().toISOString(),
|
|
75986
|
+
durationMs: Math.max(0, record3.durationMs),
|
|
75987
|
+
errorMessage: sanitizeErrorMessage(record3.errorMessage),
|
|
75988
|
+
stackPrefix: sanitizeStackPrefix(record3.stackPrefix),
|
|
75989
|
+
changedFiles: sanitizeChangedFiles(record3.changedFiles || [])
|
|
75990
|
+
}));
|
|
75991
|
+
existingRecords.push(...sanitizedRecords);
|
|
75992
|
+
const recordsByTest = new Map;
|
|
75993
|
+
for (const rec of existingRecords) {
|
|
75994
|
+
const normalizedKey = `${rec.testFile.toLowerCase()}|${rec.testName.toLowerCase()}`;
|
|
75995
|
+
if (!recordsByTest.has(normalizedKey)) {
|
|
75996
|
+
recordsByTest.set(normalizedKey, []);
|
|
75997
|
+
}
|
|
75998
|
+
recordsByTest.get(normalizedKey).push(rec);
|
|
75999
|
+
}
|
|
76000
|
+
const prunedRecords = [];
|
|
76001
|
+
for (const [, recs] of recordsByTest) {
|
|
76002
|
+
recs.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
76003
|
+
const toKeep = recs.slice(-MAX_HISTORY_PER_TEST);
|
|
76004
|
+
prunedRecords.push(...toKeep);
|
|
76005
|
+
}
|
|
76006
|
+
prunedRecords.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
76007
|
+
try {
|
|
76008
|
+
const lines = prunedRecords.map((rec) => JSON.stringify(rec));
|
|
76009
|
+
const content = `${lines.join(`
|
|
75995
76010
|
`)}
|
|
75996
76011
|
`;
|
|
75997
|
-
const tempPath = `${historyPath}.tmp`;
|
|
75998
|
-
fs29.writeFileSync(tempPath, content, "utf-8");
|
|
75999
|
-
fs29.renameSync(tempPath, historyPath);
|
|
76000
|
-
} catch (err2) {
|
|
76001
|
-
try {
|
|
76002
76012
|
const tempPath = `${historyPath}.tmp`;
|
|
76003
|
-
|
|
76004
|
-
|
|
76013
|
+
fs29.writeFileSync(tempPath, content, "utf-8");
|
|
76014
|
+
fs29.renameSync(tempPath, historyPath);
|
|
76015
|
+
} catch (err2) {
|
|
76016
|
+
try {
|
|
76017
|
+
const tempPath = `${historyPath}.tmp`;
|
|
76018
|
+
if (fs29.existsSync(tempPath)) {
|
|
76019
|
+
fs29.unlinkSync(tempPath);
|
|
76020
|
+
}
|
|
76021
|
+
} catch {}
|
|
76022
|
+
throw new Error(`Failed to write test history: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
76023
|
+
}
|
|
76024
|
+
});
|
|
76025
|
+
}
|
|
76026
|
+
function withHistoryWriteLock(historyPath, fn2) {
|
|
76027
|
+
const lockPath = `${historyPath}.write-lock`;
|
|
76028
|
+
const deadline = Date.now() + HISTORY_WRITE_LOCK_TIMEOUT_MS;
|
|
76029
|
+
while (true) {
|
|
76030
|
+
try {
|
|
76031
|
+
fs29.mkdirSync(lockPath);
|
|
76032
|
+
break;
|
|
76033
|
+
} catch (error93) {
|
|
76034
|
+
const code = error93 instanceof Error && "code" in error93 ? error93.code : undefined;
|
|
76035
|
+
if (code !== "EEXIST") {
|
|
76036
|
+
throw new Error(`Failed to acquire test history lock: ${error93 instanceof Error ? error93.message : String(error93)}`);
|
|
76037
|
+
}
|
|
76038
|
+
if (Date.now() >= deadline) {
|
|
76039
|
+
throw new Error(`Timed out waiting for test history lock: ${historyPath}`);
|
|
76005
76040
|
}
|
|
76041
|
+
try {
|
|
76042
|
+
const lockStat = fs29.statSync(lockPath);
|
|
76043
|
+
if (Date.now() - lockStat.mtimeMs >= HISTORY_WRITE_LOCK_STALE_MS) {
|
|
76044
|
+
fs29.rmSync(lockPath, { recursive: true, force: true });
|
|
76045
|
+
continue;
|
|
76046
|
+
}
|
|
76047
|
+
} catch {}
|
|
76048
|
+
const remainingMs = Math.max(0, deadline - Date.now());
|
|
76049
|
+
const sleepMs = Math.min(HISTORY_WRITE_LOCK_BACKOFF_MS, remainingMs);
|
|
76050
|
+
if (sleepMs > 0) {
|
|
76051
|
+
sleepSync(sleepMs);
|
|
76052
|
+
}
|
|
76053
|
+
}
|
|
76054
|
+
}
|
|
76055
|
+
try {
|
|
76056
|
+
return fn2();
|
|
76057
|
+
} finally {
|
|
76058
|
+
try {
|
|
76059
|
+
fs29.rmSync(lockPath, { recursive: true, force: true });
|
|
76006
76060
|
} catch {}
|
|
76007
|
-
|
|
76061
|
+
}
|
|
76062
|
+
function sleepSync(ms) {
|
|
76063
|
+
const until = Date.now() + ms;
|
|
76064
|
+
while (Date.now() < until) {}
|
|
76008
76065
|
}
|
|
76009
76066
|
}
|
|
76010
76067
|
function readAllRecords(historyPath) {
|
|
@@ -76040,7 +76097,7 @@ function getAllHistory(workingDir) {
|
|
|
76040
76097
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
76041
76098
|
return records;
|
|
76042
76099
|
}
|
|
76043
|
-
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, DANGEROUS_PROPERTY_NAMES, _internals36;
|
|
76100
|
+
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES, _internals36;
|
|
76044
76101
|
var init_history_store = __esm(() => {
|
|
76045
76102
|
init_manager2();
|
|
76046
76103
|
DANGEROUS_PROPERTY_NAMES = new Set([
|
|
@@ -77598,9 +77655,9 @@ async function runTests(framework, scope, files, coverage, timeout_ms, cwd) {
|
|
|
77598
77655
|
stderr: "pipe",
|
|
77599
77656
|
cwd
|
|
77600
77657
|
});
|
|
77601
|
-
const timeoutPromise = new Promise((
|
|
77658
|
+
const timeoutPromise = new Promise((resolve22) => setTimeout(() => {
|
|
77602
77659
|
proc.kill();
|
|
77603
|
-
|
|
77660
|
+
resolve22(-1);
|
|
77604
77661
|
}, timeout_ms));
|
|
77605
77662
|
const [exitCode, stdoutResult, stderrResult] = await Promise.all([
|
|
77606
77663
|
Promise.race([proc.exited, timeoutPromise]),
|
|
@@ -79147,13 +79204,13 @@ class CircuitBreaker {
|
|
|
79147
79204
|
if (this.config.callTimeoutMs <= 0) {
|
|
79148
79205
|
return fn2();
|
|
79149
79206
|
}
|
|
79150
|
-
return new Promise((
|
|
79207
|
+
return new Promise((resolve23, reject) => {
|
|
79151
79208
|
const timeout = setTimeout(() => {
|
|
79152
79209
|
reject(new Error(`Call timeout after ${this.config.callTimeoutMs}ms`));
|
|
79153
79210
|
}, this.config.callTimeoutMs);
|
|
79154
79211
|
fn2().then((result) => {
|
|
79155
79212
|
clearTimeout(timeout);
|
|
79156
|
-
|
|
79213
|
+
resolve23(result);
|
|
79157
79214
|
}).catch((error93) => {
|
|
79158
79215
|
clearTimeout(timeout);
|
|
79159
79216
|
reject(error93);
|
|
@@ -79440,7 +79497,7 @@ var init_queue = __esm(() => {
|
|
|
79440
79497
|
|
|
79441
79498
|
// src/background/worker.ts
|
|
79442
79499
|
function sleep(ms) {
|
|
79443
|
-
return new Promise((
|
|
79500
|
+
return new Promise((resolve23) => setTimeout(resolve23, ms));
|
|
79444
79501
|
}
|
|
79445
79502
|
|
|
79446
79503
|
class WorkerManager {
|
|
@@ -86800,9 +86857,9 @@ function validateFilename(filename) {
|
|
|
86800
86857
|
throw new Error("Invalid filename: contains null byte");
|
|
86801
86858
|
}
|
|
86802
86859
|
const pathSeparators = ["/", "\\", ".."];
|
|
86803
|
-
for (const
|
|
86804
|
-
if (filename.includes(
|
|
86805
|
-
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}'`);
|
|
86806
86863
|
}
|
|
86807
86864
|
}
|
|
86808
86865
|
if (filename.startsWith("/") || filename.startsWith("\\") || /^[a-zA-Z]:/.test(filename)) {
|
|
@@ -89220,8 +89277,8 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
89220
89277
|
var moduleRtn;
|
|
89221
89278
|
var Module = moduleArg;
|
|
89222
89279
|
var readyPromiseResolve, readyPromiseReject;
|
|
89223
|
-
var readyPromise = new Promise((
|
|
89224
|
-
readyPromiseResolve =
|
|
89280
|
+
var readyPromise = new Promise((resolve31, reject) => {
|
|
89281
|
+
readyPromiseResolve = resolve31;
|
|
89225
89282
|
readyPromiseReject = reject;
|
|
89226
89283
|
});
|
|
89227
89284
|
var ENVIRONMENT_IS_WEB = typeof window == "object";
|
|
@@ -89301,13 +89358,13 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
89301
89358
|
}
|
|
89302
89359
|
readAsync = /* @__PURE__ */ __name(async (url3) => {
|
|
89303
89360
|
if (isFileURI(url3)) {
|
|
89304
|
-
return new Promise((
|
|
89361
|
+
return new Promise((resolve31, reject) => {
|
|
89305
89362
|
var xhr = new XMLHttpRequest;
|
|
89306
89363
|
xhr.open("GET", url3, true);
|
|
89307
89364
|
xhr.responseType = "arraybuffer";
|
|
89308
89365
|
xhr.onload = () => {
|
|
89309
89366
|
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
|
|
89310
|
-
|
|
89367
|
+
resolve31(xhr.response);
|
|
89311
89368
|
return;
|
|
89312
89369
|
}
|
|
89313
89370
|
reject(xhr.status);
|
|
@@ -89527,10 +89584,10 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
89527
89584
|
__name(receiveInstantiationResult, "receiveInstantiationResult");
|
|
89528
89585
|
var info2 = getWasmImports();
|
|
89529
89586
|
if (Module["instantiateWasm"]) {
|
|
89530
|
-
return new Promise((
|
|
89587
|
+
return new Promise((resolve31, reject) => {
|
|
89531
89588
|
Module["instantiateWasm"](info2, (mod, inst) => {
|
|
89532
89589
|
receiveInstance(mod, inst);
|
|
89533
|
-
|
|
89590
|
+
resolve31(mod.exports);
|
|
89534
89591
|
});
|
|
89535
89592
|
});
|
|
89536
89593
|
}
|
|
@@ -91406,13 +91463,13 @@ async function extractDocConstraints(directory, taskFiles, taskDescription) {
|
|
|
91406
91463
|
const knowledgePath = resolveSwarmKnowledgePath(directory);
|
|
91407
91464
|
const existingEntries = await readKnowledge(knowledgePath);
|
|
91408
91465
|
const taskContext = [...taskFiles, taskDescription].join(" ");
|
|
91409
|
-
const taskBigrams = wordBigrams(
|
|
91466
|
+
const taskBigrams = wordBigrams(normalize4(taskContext));
|
|
91410
91467
|
let extractedCount = 0;
|
|
91411
91468
|
let skippedCount = 0;
|
|
91412
91469
|
const details = [];
|
|
91413
91470
|
for (const docFile of manifest.files) {
|
|
91414
91471
|
const docContext = `${docFile.path} ${docFile.title} ${docFile.summary}`;
|
|
91415
|
-
const docBigrams = wordBigrams(
|
|
91472
|
+
const docBigrams = wordBigrams(normalize4(docContext));
|
|
91416
91473
|
const score = jaccardBigram(taskBigrams, docBigrams);
|
|
91417
91474
|
if (score <= RELEVANCE_THRESHOLD) {
|
|
91418
91475
|
skippedCount++;
|
|
@@ -91643,7 +91700,7 @@ async function readMergedKnowledge(directory, config3, context, opts) {
|
|
|
91643
91700
|
const seenLessons = new Set;
|
|
91644
91701
|
const merged = [];
|
|
91645
91702
|
for (const entry of hiveEntries) {
|
|
91646
|
-
const normalized =
|
|
91703
|
+
const normalized = normalize4(entry.lesson);
|
|
91647
91704
|
seenLessons.add(normalized);
|
|
91648
91705
|
merged.push({
|
|
91649
91706
|
...entry,
|
|
@@ -91652,15 +91709,15 @@ async function readMergedKnowledge(directory, config3, context, opts) {
|
|
|
91652
91709
|
});
|
|
91653
91710
|
}
|
|
91654
91711
|
for (const entry of swarmEntries) {
|
|
91655
|
-
const normalized =
|
|
91712
|
+
const normalized = normalize4(entry.lesson);
|
|
91656
91713
|
if (seenLessons.has(normalized)) {
|
|
91657
91714
|
continue;
|
|
91658
91715
|
}
|
|
91659
91716
|
const swarmBigrams = wordBigrams(normalized);
|
|
91660
|
-
const isHiveNearDup = hiveEntries.some((hiveEntry) => jaccardBigram(swarmBigrams, wordBigrams(
|
|
91717
|
+
const isHiveNearDup = hiveEntries.some((hiveEntry) => jaccardBigram(swarmBigrams, wordBigrams(normalize4(hiveEntry.lesson))) >= JACCARD_THRESHOLD2);
|
|
91661
91718
|
if (isHiveNearDup)
|
|
91662
91719
|
continue;
|
|
91663
|
-
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);
|
|
91664
91721
|
if (isSwarmNearDup)
|
|
91665
91722
|
continue;
|
|
91666
91723
|
seenLessons.add(normalized);
|
|
@@ -91673,7 +91730,7 @@ async function readMergedKnowledge(directory, config3, context, opts) {
|
|
|
91673
91730
|
const retractionRecords = await readRetractionRecords(directory);
|
|
91674
91731
|
const suppressedLessons = new Set(retractionRecords.map((record3) => record3.normalized_lesson).filter((value) => typeof value === "string" && value.length > 0));
|
|
91675
91732
|
const scopeFilter = config3.scope_filter ?? ["global"];
|
|
91676
|
-
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)));
|
|
91677
91734
|
const ranked = filtered.map((entry) => {
|
|
91678
91735
|
let categoryScore = 0;
|
|
91679
91736
|
if (context?.currentPhase) {
|
|
@@ -91917,14 +91974,14 @@ async function searchKnowledge(params) {
|
|
|
91917
91974
|
});
|
|
91918
91975
|
}
|
|
91919
91976
|
const queryText = (query ?? "").trim();
|
|
91920
|
-
const queryBigrams = queryText ? wordBigrams(
|
|
91977
|
+
const queryBigrams = queryText ? wordBigrams(normalize4(queryText)) : null;
|
|
91921
91978
|
const hasQuery = queryBigrams !== null;
|
|
91922
91979
|
const textWeight = hasQuery ? TEXT_WEIGHT : 0;
|
|
91923
91980
|
const metaWeight = hasQuery ? META_WEIGHT : 1;
|
|
91924
91981
|
const minConf = typeof config3.directive_min_confidence === "number" ? config3.directive_min_confidence : DIRECTIVE_BOOST_MIN_CONFIDENCE;
|
|
91925
91982
|
const scored = candidates.map((entry) => {
|
|
91926
91983
|
const retrievalOutcomes = effectiveRetrievalOutcomes(entry.retrieval_outcomes, counterRollups.get(entry.id));
|
|
91927
|
-
const textScore = queryBigrams ? jaccardBigram(queryBigrams, wordBigrams(
|
|
91984
|
+
const textScore = queryBigrams ? jaccardBigram(queryBigrams, wordBigrams(normalize4(entryText(entry)))) : 0;
|
|
91928
91985
|
const metaScore = entry.finalScore;
|
|
91929
91986
|
const ds = context ? scoreDirectiveAgainstContext(entry, context) : { triggerHit: false, actionHit: false, agentHit: false, score: 0 };
|
|
91930
91987
|
const confBoost = context && entry.confidence >= minConf && (ds.actionHit || ds.agentHit) ? 0.25 : 0;
|
|
@@ -92897,13 +92954,13 @@ class PlanSyncWorker {
|
|
|
92897
92954
|
} catch {}
|
|
92898
92955
|
}
|
|
92899
92956
|
withTimeout(promise3, ms, timeoutMessage) {
|
|
92900
|
-
return new Promise((
|
|
92957
|
+
return new Promise((resolve25, reject) => {
|
|
92901
92958
|
const timer = setTimeout(() => {
|
|
92902
92959
|
reject(new Error(`${timeoutMessage} (${ms}ms)`));
|
|
92903
92960
|
}, ms);
|
|
92904
92961
|
promise3.then((result) => {
|
|
92905
92962
|
clearTimeout(timer);
|
|
92906
|
-
|
|
92963
|
+
resolve25(result);
|
|
92907
92964
|
}).catch((error93) => {
|
|
92908
92965
|
clearTimeout(timer);
|
|
92909
92966
|
reject(error93);
|
|
@@ -95350,7 +95407,7 @@ import * as path85 from "node:path";
|
|
|
95350
95407
|
init_logger();
|
|
95351
95408
|
init_path_security();
|
|
95352
95409
|
import * as fsSync4 from "node:fs";
|
|
95353
|
-
import { existsSync as existsSync47, realpathSync as
|
|
95410
|
+
import { existsSync as existsSync47, realpathSync as realpathSync11 } from "node:fs";
|
|
95354
95411
|
import * as fsPromises5 from "node:fs/promises";
|
|
95355
95412
|
import * as os13 from "node:os";
|
|
95356
95413
|
import * as path81 from "node:path";
|
|
@@ -95372,8 +95429,8 @@ async function withTimeout(promise3, ms, timeoutError) {
|
|
|
95372
95429
|
}
|
|
95373
95430
|
}
|
|
95374
95431
|
function yieldToEventLoop() {
|
|
95375
|
-
return new Promise((
|
|
95376
|
-
const t = setTimeout(
|
|
95432
|
+
return new Promise((resolve25) => {
|
|
95433
|
+
const t = setTimeout(resolve25, 0);
|
|
95377
95434
|
if (typeof t.unref === "function") {
|
|
95378
95435
|
t.unref();
|
|
95379
95436
|
}
|
|
@@ -95714,8 +95771,8 @@ var symbols = createSwarmTool({
|
|
|
95714
95771
|
});
|
|
95715
95772
|
|
|
95716
95773
|
// src/tools/repo-graph/safe-realpath.ts
|
|
95717
|
-
import { realpathSync as
|
|
95718
|
-
function safeRealpathSync(targetPath, fallback, realpathResolver =
|
|
95774
|
+
import { realpathSync as realpathSync10 } from "node:fs";
|
|
95775
|
+
function safeRealpathSync(targetPath, fallback, realpathResolver = realpathSync10) {
|
|
95719
95776
|
try {
|
|
95720
95777
|
return realpathResolver(targetPath);
|
|
95721
95778
|
} catch (error93) {
|
|
@@ -95973,7 +96030,7 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
|
|
|
95973
96030
|
function isRefusedWorkspaceRoot(target) {
|
|
95974
96031
|
let resolved;
|
|
95975
96032
|
try {
|
|
95976
|
-
resolved =
|
|
96033
|
+
resolved = realpathSync11(target);
|
|
95977
96034
|
} catch {
|
|
95978
96035
|
resolved = path81.resolve(target);
|
|
95979
96036
|
}
|
|
@@ -96442,7 +96499,7 @@ async function saveGraph(workspace, graph, options) {
|
|
|
96442
96499
|
lastError = error93 instanceof Error ? error93 : new Error(String(error93));
|
|
96443
96500
|
if (lastError instanceof Error && "code" in lastError && lastError.code === "EEXIST" && retries < WINDOWS_RENAME_MAX_RETRIES2 - 1) {
|
|
96444
96501
|
retries++;
|
|
96445
|
-
await new Promise((
|
|
96502
|
+
await new Promise((resolve27) => setTimeout(resolve27, WINDOWS_RENAME_RETRY_DELAY_MS2));
|
|
96446
96503
|
continue;
|
|
96447
96504
|
}
|
|
96448
96505
|
throw lastError;
|
|
@@ -97416,26 +97473,26 @@ function pLimit(concurrency) {
|
|
|
97416
97473
|
activeCount--;
|
|
97417
97474
|
resumeNext();
|
|
97418
97475
|
};
|
|
97419
|
-
const run2 = async (function_,
|
|
97476
|
+
const run2 = async (function_, resolve29, arguments_2) => {
|
|
97420
97477
|
const result = (async () => function_(...arguments_2))();
|
|
97421
|
-
|
|
97478
|
+
resolve29(result);
|
|
97422
97479
|
try {
|
|
97423
97480
|
await result;
|
|
97424
97481
|
} catch {}
|
|
97425
97482
|
next();
|
|
97426
97483
|
};
|
|
97427
|
-
const enqueue = (function_,
|
|
97484
|
+
const enqueue = (function_, resolve29, reject, arguments_2) => {
|
|
97428
97485
|
const queueItem = { reject };
|
|
97429
97486
|
new Promise((internalResolve) => {
|
|
97430
97487
|
queueItem.run = internalResolve;
|
|
97431
97488
|
queue.enqueue(queueItem);
|
|
97432
|
-
}).then(run2.bind(undefined, function_,
|
|
97489
|
+
}).then(run2.bind(undefined, function_, resolve29, arguments_2));
|
|
97433
97490
|
if (activeCount < concurrency) {
|
|
97434
97491
|
resumeNext();
|
|
97435
97492
|
}
|
|
97436
97493
|
};
|
|
97437
|
-
const generator = (function_, ...arguments_2) => new Promise((
|
|
97438
|
-
enqueue(function_,
|
|
97494
|
+
const generator = (function_, ...arguments_2) => new Promise((resolve29, reject) => {
|
|
97495
|
+
enqueue(function_, resolve29, reject, arguments_2);
|
|
97439
97496
|
});
|
|
97440
97497
|
Object.defineProperties(generator, {
|
|
97441
97498
|
activeCount: {
|
|
@@ -99297,7 +99354,7 @@ function isGitBinaryMissing(err2) {
|
|
|
99297
99354
|
// src/hooks/semantic-diff-injection.ts
|
|
99298
99355
|
async function execGit(directory, args2, options) {
|
|
99299
99356
|
try {
|
|
99300
|
-
const stdout = await new Promise((
|
|
99357
|
+
const stdout = await new Promise((resolve32, reject) => {
|
|
99301
99358
|
const execOpts = {
|
|
99302
99359
|
encoding: "utf-8",
|
|
99303
99360
|
cwd: directory,
|
|
@@ -99310,7 +99367,7 @@ async function execGit(directory, args2, options) {
|
|
|
99310
99367
|
reject(error93);
|
|
99311
99368
|
return;
|
|
99312
99369
|
}
|
|
99313
|
-
|
|
99370
|
+
resolve32(output ?? "");
|
|
99314
99371
|
});
|
|
99315
99372
|
});
|
|
99316
99373
|
return stdout;
|
|
@@ -102513,7 +102570,7 @@ import * as path98 from "node:path";
|
|
|
102513
102570
|
import * as child_process6 from "node:child_process";
|
|
102514
102571
|
var WIN32_CMD_BINARIES = new Set(["npm", "npx", "pnpm", "yarn"]);
|
|
102515
102572
|
function spawnAsync(command, cwd, timeoutMs) {
|
|
102516
|
-
return new Promise((
|
|
102573
|
+
return new Promise((resolve34) => {
|
|
102517
102574
|
try {
|
|
102518
102575
|
const [rawCmd, ...args2] = command;
|
|
102519
102576
|
const cmd = process.platform === "win32" && WIN32_CMD_BINARIES.has(rawCmd) && !rawCmd.includes(".") ? `${rawCmd}.cmd` : rawCmd;
|
|
@@ -102560,24 +102617,24 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
102560
102617
|
try {
|
|
102561
102618
|
proc.kill();
|
|
102562
102619
|
} catch {}
|
|
102563
|
-
|
|
102620
|
+
resolve34(null);
|
|
102564
102621
|
}, timeoutMs);
|
|
102565
102622
|
proc.on("close", (code) => {
|
|
102566
102623
|
if (done)
|
|
102567
102624
|
return;
|
|
102568
102625
|
done = true;
|
|
102569
102626
|
clearTimeout(timer);
|
|
102570
|
-
|
|
102627
|
+
resolve34({ exitCode: code ?? 1, stdout, stderr });
|
|
102571
102628
|
});
|
|
102572
102629
|
proc.on("error", () => {
|
|
102573
102630
|
if (done)
|
|
102574
102631
|
return;
|
|
102575
102632
|
done = true;
|
|
102576
102633
|
clearTimeout(timer);
|
|
102577
|
-
|
|
102634
|
+
resolve34(null);
|
|
102578
102635
|
});
|
|
102579
102636
|
} catch {
|
|
102580
|
-
|
|
102637
|
+
resolve34(null);
|
|
102581
102638
|
}
|
|
102582
102639
|
});
|
|
102583
102640
|
}
|
|
@@ -106064,7 +106121,7 @@ import {
|
|
|
106064
106121
|
mkdirSync as mkdirSync27,
|
|
106065
106122
|
mkdtempSync as mkdtempSync2,
|
|
106066
106123
|
readFileSync as readFileSync39,
|
|
106067
|
-
realpathSync as
|
|
106124
|
+
realpathSync as realpathSync14,
|
|
106068
106125
|
renameSync as renameSync20,
|
|
106069
106126
|
rmdirSync,
|
|
106070
106127
|
unlinkSync as unlinkSync17,
|
|
@@ -106098,8 +106155,8 @@ function containsStrictControlChars(str) {
|
|
|
106098
106155
|
}
|
|
106099
106156
|
function isCanonicalProtectedPath(targetPath, workspace) {
|
|
106100
106157
|
try {
|
|
106101
|
-
const canonicalTarget =
|
|
106102
|
-
const canonicalWorkspace =
|
|
106158
|
+
const canonicalTarget = realpathSync14(targetPath);
|
|
106159
|
+
const canonicalWorkspace = realpathSync14(workspace);
|
|
106103
106160
|
const relative21 = path109.relative(canonicalWorkspace, canonicalTarget).replace(/\\/g, "/");
|
|
106104
106161
|
const segments = relative21.split("/").filter(Boolean);
|
|
106105
106162
|
return segments.some((seg) => seg === ".git" || seg === ".swarm");
|
|
@@ -106108,8 +106165,8 @@ function isCanonicalProtectedPath(targetPath, workspace) {
|
|
|
106108
106165
|
if (parentDir === targetPath)
|
|
106109
106166
|
return false;
|
|
106110
106167
|
try {
|
|
106111
|
-
const canonicalParent =
|
|
106112
|
-
const canonicalWorkspace =
|
|
106168
|
+
const canonicalParent = realpathSync14(parentDir);
|
|
106169
|
+
const canonicalWorkspace = realpathSync14(workspace);
|
|
106113
106170
|
const relative21 = path109.relative(canonicalWorkspace, canonicalParent).replace(/\\/g, "/");
|
|
106114
106171
|
const segments = relative21.split("/").filter(Boolean);
|
|
106115
106172
|
return segments.some((seg) => seg === ".git" || seg === ".swarm");
|
|
@@ -106120,8 +106177,8 @@ function isCanonicalProtectedPath(targetPath, workspace) {
|
|
|
106120
106177
|
}
|
|
106121
106178
|
function isCanonicalPathWithinWorkspace(targetPath, workspaceRoot) {
|
|
106122
106179
|
try {
|
|
106123
|
-
const canonicalTarget =
|
|
106124
|
-
const canonicalWorkspace =
|
|
106180
|
+
const canonicalTarget = realpathSync14(targetPath);
|
|
106181
|
+
const canonicalWorkspace = realpathSync14(workspaceRoot);
|
|
106125
106182
|
const relative21 = path109.relative(canonicalWorkspace, canonicalTarget);
|
|
106126
106183
|
if (relative21.startsWith("..") || path109.isAbsolute(relative21))
|
|
106127
106184
|
return false;
|
|
@@ -106135,8 +106192,8 @@ function isCanonicalPathWithinWorkspace(targetPath, workspaceRoot) {
|
|
|
106135
106192
|
return false;
|
|
106136
106193
|
}
|
|
106137
106194
|
try {
|
|
106138
|
-
const canonicalParent =
|
|
106139
|
-
const canonicalWorkspace =
|
|
106195
|
+
const canonicalParent = realpathSync14(parentDir);
|
|
106196
|
+
const canonicalWorkspace = realpathSync14(workspaceRoot);
|
|
106140
106197
|
const relative21 = path109.relative(canonicalWorkspace, canonicalParent);
|
|
106141
106198
|
if (relative21.startsWith("..") || path109.isAbsolute(relative21))
|
|
106142
106199
|
return false;
|
|
@@ -106414,7 +106471,7 @@ function atomicWriteFileSync(targetPath, content) {
|
|
|
106414
106471
|
const tempPrefix = `.apply-patch-${Date.now()}-${process.pid}`;
|
|
106415
106472
|
let tempPath;
|
|
106416
106473
|
try {
|
|
106417
|
-
const tempDir =
|
|
106474
|
+
const tempDir = realpathSync14(mkdtempSync2(path109.join(dir, tempPrefix)));
|
|
106418
106475
|
tempPath = path109.join(tempDir, "content");
|
|
106419
106476
|
} catch {
|
|
106420
106477
|
tempPath = path109.join(dir, `${tempPrefix}.tmp`);
|
|
@@ -110394,7 +110451,7 @@ init_create_tool();
|
|
|
110394
110451
|
init_resolve_working_directory();
|
|
110395
110452
|
async function execGit2(workingDir, args2, options) {
|
|
110396
110453
|
try {
|
|
110397
|
-
const stdout = await new Promise((
|
|
110454
|
+
const stdout = await new Promise((resolve42, reject) => {
|
|
110398
110455
|
const execOpts = {
|
|
110399
110456
|
encoding: "utf-8",
|
|
110400
110457
|
cwd: workingDir,
|
|
@@ -110407,7 +110464,7 @@ async function execGit2(workingDir, args2, options) {
|
|
|
110407
110464
|
reject(error93);
|
|
110408
110465
|
return;
|
|
110409
110466
|
}
|
|
110410
|
-
|
|
110467
|
+
resolve42(output ?? "");
|
|
110411
110468
|
});
|
|
110412
110469
|
});
|
|
110413
110470
|
return stdout;
|
|
@@ -111347,7 +111404,7 @@ init_create_tool();
|
|
|
111347
111404
|
var GITINGEST_TIMEOUT_MS = 1e4;
|
|
111348
111405
|
var GITINGEST_MAX_RESPONSE_BYTES = 5242880;
|
|
111349
111406
|
var GITINGEST_MAX_RETRIES = 2;
|
|
111350
|
-
var delay = (ms) => new Promise((
|
|
111407
|
+
var delay = (ms) => new Promise((resolve43) => setTimeout(resolve43, ms));
|
|
111351
111408
|
async function fetchGitingest(args2) {
|
|
111352
111409
|
for (let attempt = 0;attempt <= GITINGEST_MAX_RETRIES; attempt++) {
|
|
111353
111410
|
try {
|
|
@@ -112202,7 +112259,7 @@ function filterSwarmEntries(entries, filters, suppressedLessons, scopeFilter) {
|
|
|
112202
112259
|
return false;
|
|
112203
112260
|
}
|
|
112204
112261
|
}
|
|
112205
|
-
if (suppressedLessons.has(
|
|
112262
|
+
if (suppressedLessons.has(normalize4(entry.lesson))) {
|
|
112206
112263
|
return false;
|
|
112207
112264
|
}
|
|
112208
112265
|
return true;
|
|
@@ -112223,7 +112280,7 @@ function filterHiveEntries(entries, filters, suppressedLessons) {
|
|
|
112223
112280
|
if (filters.minScore !== undefined && entry.confidence < filters.minScore) {
|
|
112224
112281
|
return false;
|
|
112225
112282
|
}
|
|
112226
|
-
if (suppressedLessons.has(
|
|
112283
|
+
if (suppressedLessons.has(normalize4(entry.lesson))) {
|
|
112227
112284
|
return false;
|
|
112228
112285
|
}
|
|
112229
112286
|
return true;
|
|
@@ -117086,7 +117143,7 @@ async function runNpmAudit(directory) {
|
|
|
117086
117143
|
stderr: "pipe",
|
|
117087
117144
|
cwd: directory
|
|
117088
117145
|
});
|
|
117089
|
-
const timeoutPromise = new Promise((
|
|
117146
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117090
117147
|
const result = await Promise.race([
|
|
117091
117148
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr2]) => ({ stdout: stdout2, stderr: stderr2 })),
|
|
117092
117149
|
timeoutPromise
|
|
@@ -117206,7 +117263,7 @@ async function runPipAudit(directory) {
|
|
|
117206
117263
|
stderr: "pipe",
|
|
117207
117264
|
cwd: directory
|
|
117208
117265
|
});
|
|
117209
|
-
const timeoutPromise = new Promise((
|
|
117266
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117210
117267
|
const result = await Promise.race([
|
|
117211
117268
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr2]) => ({ stdout: stdout2, stderr: stderr2 })),
|
|
117212
117269
|
timeoutPromise
|
|
@@ -117334,7 +117391,7 @@ async function runCargoAudit(directory) {
|
|
|
117334
117391
|
stderr: "pipe",
|
|
117335
117392
|
cwd: directory
|
|
117336
117393
|
});
|
|
117337
|
-
const timeoutPromise = new Promise((
|
|
117394
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117338
117395
|
const result = await Promise.race([
|
|
117339
117396
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117340
117397
|
timeoutPromise
|
|
@@ -117458,7 +117515,7 @@ async function runGoAudit(directory) {
|
|
|
117458
117515
|
stderr: "pipe",
|
|
117459
117516
|
cwd: directory
|
|
117460
117517
|
});
|
|
117461
|
-
const timeoutPromise = new Promise((
|
|
117518
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117462
117519
|
const result = await Promise.race([
|
|
117463
117520
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117464
117521
|
timeoutPromise
|
|
@@ -117591,7 +117648,7 @@ async function runDotnetAudit(directory) {
|
|
|
117591
117648
|
stderr: "pipe",
|
|
117592
117649
|
cwd: directory
|
|
117593
117650
|
});
|
|
117594
|
-
const timeoutPromise = new Promise((
|
|
117651
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117595
117652
|
const result = await Promise.race([
|
|
117596
117653
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117597
117654
|
timeoutPromise
|
|
@@ -117707,7 +117764,7 @@ async function runBundleAudit(directory) {
|
|
|
117707
117764
|
stderr: "pipe",
|
|
117708
117765
|
cwd: directory
|
|
117709
117766
|
});
|
|
117710
|
-
const timeoutPromise = new Promise((
|
|
117767
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117711
117768
|
const result = await Promise.race([
|
|
117712
117769
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117713
117770
|
timeoutPromise
|
|
@@ -117852,7 +117909,7 @@ async function runDartAudit(directory) {
|
|
|
117852
117909
|
stderr: "pipe",
|
|
117853
117910
|
cwd: directory
|
|
117854
117911
|
});
|
|
117855
|
-
const timeoutPromise = new Promise((
|
|
117912
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117856
117913
|
const result = await Promise.race([
|
|
117857
117914
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117858
117915
|
timeoutPromise
|
|
@@ -117967,7 +118024,7 @@ async function runComposerAudit(directory) {
|
|
|
117967
118024
|
stderr: "pipe",
|
|
117968
118025
|
cwd: directory
|
|
117969
118026
|
});
|
|
117970
|
-
const timeoutPromise = new Promise((
|
|
118027
|
+
const timeoutPromise = new Promise((resolve47) => setTimeout(() => resolve47("timeout"), AUDIT_TIMEOUT_MS));
|
|
117971
118028
|
const result = await Promise.race([
|
|
117972
118029
|
Promise.all([proc.stdout.text(), proc.stderr.text()]).then(([stdout2, stderr]) => ({ stdout: stdout2, stderr })),
|
|
117973
118030
|
timeoutPromise
|
|
@@ -119628,7 +119685,7 @@ function mapSemgrepSeverity(severity) {
|
|
|
119628
119685
|
}
|
|
119629
119686
|
}
|
|
119630
119687
|
async function executeWithTimeout(command, args2, options) {
|
|
119631
|
-
return new Promise((
|
|
119688
|
+
return new Promise((resolve49) => {
|
|
119632
119689
|
const child = child_process9.spawn(command, args2, {
|
|
119633
119690
|
shell: false,
|
|
119634
119691
|
cwd: options.cwd
|
|
@@ -119637,7 +119694,7 @@ async function executeWithTimeout(command, args2, options) {
|
|
|
119637
119694
|
let stderr = "";
|
|
119638
119695
|
const timeout = setTimeout(() => {
|
|
119639
119696
|
child.kill("SIGTERM");
|
|
119640
|
-
|
|
119697
|
+
resolve49({
|
|
119641
119698
|
stdout,
|
|
119642
119699
|
stderr: "Process timed out",
|
|
119643
119700
|
exitCode: 124
|
|
@@ -119651,7 +119708,7 @@ async function executeWithTimeout(command, args2, options) {
|
|
|
119651
119708
|
});
|
|
119652
119709
|
child.on("close", (code) => {
|
|
119653
119710
|
clearTimeout(timeout);
|
|
119654
|
-
|
|
119711
|
+
resolve49({
|
|
119655
119712
|
stdout,
|
|
119656
119713
|
stderr,
|
|
119657
119714
|
exitCode: code ?? 0
|
|
@@ -119659,7 +119716,7 @@ async function executeWithTimeout(command, args2, options) {
|
|
|
119659
119716
|
});
|
|
119660
119717
|
child.on("error", (err2) => {
|
|
119661
119718
|
clearTimeout(timeout);
|
|
119662
|
-
|
|
119719
|
+
resolve49({
|
|
119663
119720
|
stdout,
|
|
119664
119721
|
stderr: err2.message,
|
|
119665
119722
|
exitCode: 1
|
|
@@ -119858,7 +119915,7 @@ async function acquireLock2(lockPath) {
|
|
|
119858
119915
|
};
|
|
119859
119916
|
} catch {
|
|
119860
119917
|
if (attempt < LOCK_RETRY_DELAYS_MS.length) {
|
|
119861
|
-
await new Promise((
|
|
119918
|
+
await new Promise((resolve50) => setTimeout(resolve50, LOCK_RETRY_DELAYS_MS[attempt]));
|
|
119862
119919
|
}
|
|
119863
119920
|
}
|
|
119864
119921
|
}
|
|
@@ -123869,7 +123926,7 @@ async function ripgrepSearch(opts) {
|
|
|
123869
123926
|
stderr: "pipe",
|
|
123870
123927
|
cwd: opts.workspace
|
|
123871
123928
|
});
|
|
123872
|
-
const timeout = new Promise((
|
|
123929
|
+
const timeout = new Promise((resolve56) => setTimeout(() => resolve56("timeout"), REGEX_TIMEOUT_MS));
|
|
123873
123930
|
const exitPromise = proc.exited;
|
|
123874
123931
|
const result = await Promise.race([exitPromise, timeout]);
|
|
123875
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",
|