opencode-swarm 7.26.2 → 7.27.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 +37 -1
- package/dist/index.js +90 -4
- package/dist/test-impact/failure-classifier.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var package_default;
|
|
|
34
34
|
var init_package = __esm(() => {
|
|
35
35
|
package_default = {
|
|
36
36
|
name: "opencode-swarm",
|
|
37
|
-
version: "7.
|
|
37
|
+
version: "7.27.1",
|
|
38
38
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
39
39
|
main: "dist/index.js",
|
|
40
40
|
types: "dist/index.d.ts",
|
|
@@ -47117,10 +47117,31 @@ function stringHash(str) {
|
|
|
47117
47117
|
h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
47118
47118
|
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(16);
|
|
47119
47119
|
}
|
|
47120
|
+
function isInfrastructureFailure(currentResult) {
|
|
47121
|
+
const errorMessage = currentResult.errorMessage || "";
|
|
47122
|
+
const stackPrefix = currentResult.stackPrefix || "";
|
|
47123
|
+
if (/\bassertionerror\b/i.test(errorMessage)) {
|
|
47124
|
+
return false;
|
|
47125
|
+
}
|
|
47126
|
+
const combinedText = `${errorMessage}
|
|
47127
|
+
${stackPrefix}`;
|
|
47128
|
+
return INFRASTRUCTURE_FAILURE_PATTERNS.some((pattern) => pattern.test(combinedText));
|
|
47129
|
+
}
|
|
47120
47130
|
function classifyFailure(currentResult, history) {
|
|
47121
47131
|
const normalizedFile = currentResult.testFile.toLowerCase();
|
|
47122
47132
|
const normalizedName = currentResult.testName.toLowerCase();
|
|
47123
47133
|
const testHistory = history.filter((r) => r.testFile.toLowerCase() === normalizedFile && r.testName.toLowerCase() === normalizedName).sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
|
|
47134
|
+
if (isInfrastructureFailure(currentResult)) {
|
|
47135
|
+
return {
|
|
47136
|
+
testFile: currentResult.testFile,
|
|
47137
|
+
testName: currentResult.testName,
|
|
47138
|
+
classification: "infrastructure_failure",
|
|
47139
|
+
errorMessage: currentResult.errorMessage,
|
|
47140
|
+
stackPrefix: currentResult.stackPrefix,
|
|
47141
|
+
durationMs: currentResult.durationMs,
|
|
47142
|
+
confidence: computeConfidence2(testHistory.length)
|
|
47143
|
+
};
|
|
47144
|
+
}
|
|
47124
47145
|
const lastThree = testHistory.slice(0, 3);
|
|
47125
47146
|
const lastTen = testHistory.slice(0, 10);
|
|
47126
47147
|
const normalizedTestFile = currentResult.testFile.toLowerCase();
|
|
@@ -47220,6 +47241,20 @@ function classifyAndCluster(testResults, history) {
|
|
|
47220
47241
|
const clusters = clusterFailures(classified);
|
|
47221
47242
|
return { classified, clusters };
|
|
47222
47243
|
}
|
|
47244
|
+
var MAX_INFRA_CONTEXT_CHARS = 80, INFRASTRUCTURE_FAILURE_PATTERNS;
|
|
47245
|
+
var init_failure_classifier = __esm(() => {
|
|
47246
|
+
INFRASTRUCTURE_FAILURE_PATTERNS = [
|
|
47247
|
+
/\boutofmemoryerror\b/i,
|
|
47248
|
+
/(?:^|\n|\bcommand failed:\s*)\s*killed(?:\s*(?:[-:]\s*)?(?:out of memory|oom|by signal|signal|sigkill).*)?\s*(?:\n|$)/i,
|
|
47249
|
+
/(?:^|\n)\s*etimedout\b/i,
|
|
47250
|
+
new RegExp(`\\b(?:connect|connection|request|socket|network)\\b[^\\n]{0,${MAX_INFRA_CONTEXT_CHARS}}\\betimedout\\b`, "i"),
|
|
47251
|
+
/(?:^|\n)\s*econnrefused\b/i,
|
|
47252
|
+
new RegExp(`\\b(?:connect|connection|socket)\\b[^\\n]{0,${MAX_INFRA_CONTEXT_CHARS}}\\beconnrefused\\b`, "i"),
|
|
47253
|
+
/(?:^|\n)\s*enotfound\b/i,
|
|
47254
|
+
new RegExp(`\\b(?:getaddrinfo|dns|lookup)\\b[^\\n]{0,${MAX_INFRA_CONTEXT_CHARS}}\\benotfound\\b`, "i"),
|
|
47255
|
+
/\bexit(?:ed)?(?:\s+with)?(?:\s+code)?\s*[:=]?\s*137\b/i
|
|
47256
|
+
];
|
|
47257
|
+
});
|
|
47223
47258
|
|
|
47224
47259
|
// src/test-impact/flaky-detector.ts
|
|
47225
47260
|
function detectFlakyTests(allHistory) {
|
|
@@ -48964,6 +48999,7 @@ var init_test_runner = __esm(() => {
|
|
|
48964
48999
|
init_zod();
|
|
48965
49000
|
init_discovery();
|
|
48966
49001
|
init_analyzer();
|
|
49002
|
+
init_failure_classifier();
|
|
48967
49003
|
init_history_store();
|
|
48968
49004
|
init_bun_compat();
|
|
48969
49005
|
init_path_security();
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var package_default;
|
|
|
33
33
|
var init_package = __esm(() => {
|
|
34
34
|
package_default = {
|
|
35
35
|
name: "opencode-swarm",
|
|
36
|
-
version: "7.
|
|
36
|
+
version: "7.27.1",
|
|
37
37
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
38
38
|
main: "dist/index.js",
|
|
39
39
|
types: "dist/index.d.ts",
|
|
@@ -28054,14 +28054,60 @@ function getEvidencePath(directory, taskId) {
|
|
|
28054
28054
|
assertValidTaskId(taskId);
|
|
28055
28055
|
return path12.join(getEvidenceDir(directory), `${taskId}.json`);
|
|
28056
28056
|
}
|
|
28057
|
+
function parseTaskEvidence(raw) {
|
|
28058
|
+
const parsed = JSON.parse(raw);
|
|
28059
|
+
const normalized = normalizeLegacyTaskEvidence(parsed);
|
|
28060
|
+
return TaskEvidenceSchema.parse(normalized);
|
|
28061
|
+
}
|
|
28057
28062
|
function readExisting(evidencePath) {
|
|
28058
28063
|
try {
|
|
28059
28064
|
const raw = readFileSync5(evidencePath, "utf-8");
|
|
28060
|
-
return
|
|
28065
|
+
return parseTaskEvidence(raw);
|
|
28061
28066
|
} catch {
|
|
28062
28067
|
return null;
|
|
28063
28068
|
}
|
|
28064
28069
|
}
|
|
28070
|
+
function normalizeLegacyTaskEvidence(parsed) {
|
|
28071
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
28072
|
+
return parsed;
|
|
28073
|
+
}
|
|
28074
|
+
const record2 = parsed;
|
|
28075
|
+
if (record2.gates === null || typeof record2.gates !== "object" || Array.isArray(record2.gates)) {
|
|
28076
|
+
return parsed;
|
|
28077
|
+
}
|
|
28078
|
+
const normalizedGates = {};
|
|
28079
|
+
for (const [gateName, gateValue] of Object.entries(record2.gates)) {
|
|
28080
|
+
if (gateValue !== null && typeof gateValue === "object" && !Array.isArray(gateValue)) {
|
|
28081
|
+
const gateRecord = gateValue;
|
|
28082
|
+
normalizedGates[gateName] = {
|
|
28083
|
+
...gateRecord,
|
|
28084
|
+
sessionId: typeof gateRecord.sessionId === "string" ? gateRecord.sessionId : LEGACY_GATE_SESSION_ID,
|
|
28085
|
+
timestamp: typeof gateRecord.timestamp === "string" ? gateRecord.timestamp : LEGACY_GATE_TIMESTAMP,
|
|
28086
|
+
agent: typeof gateRecord.agent === "string" ? gateRecord.agent : gateName
|
|
28087
|
+
};
|
|
28088
|
+
continue;
|
|
28089
|
+
}
|
|
28090
|
+
if (typeof gateValue === "string") {
|
|
28091
|
+
normalizedGates[gateName] = {
|
|
28092
|
+
sessionId: LEGACY_GATE_SESSION_ID,
|
|
28093
|
+
timestamp: LEGACY_GATE_TIMESTAMP,
|
|
28094
|
+
agent: gateName,
|
|
28095
|
+
verdict: gateValue
|
|
28096
|
+
};
|
|
28097
|
+
continue;
|
|
28098
|
+
}
|
|
28099
|
+
normalizedGates[gateName] = {
|
|
28100
|
+
sessionId: LEGACY_GATE_SESSION_ID,
|
|
28101
|
+
timestamp: LEGACY_GATE_TIMESTAMP,
|
|
28102
|
+
agent: gateName
|
|
28103
|
+
};
|
|
28104
|
+
}
|
|
28105
|
+
return {
|
|
28106
|
+
...record2,
|
|
28107
|
+
taskId: typeof record2.taskId === "string" ? record2.taskId : typeof record2.task_id === "string" ? record2.task_id : "",
|
|
28108
|
+
gates: normalizedGates
|
|
28109
|
+
};
|
|
28110
|
+
}
|
|
28065
28111
|
async function atomicWrite2(targetPath, content) {
|
|
28066
28112
|
const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
28067
28113
|
try {
|
|
@@ -28130,7 +28176,7 @@ function readTaskEvidenceRaw(directory, taskId) {
|
|
|
28130
28176
|
const evidencePath = getEvidencePath(directory, taskId);
|
|
28131
28177
|
try {
|
|
28132
28178
|
const raw = readFileSync5(evidencePath, "utf-8");
|
|
28133
|
-
return
|
|
28179
|
+
return parseTaskEvidence(raw);
|
|
28134
28180
|
} catch (error49) {
|
|
28135
28181
|
if (error49.code === "ENOENT")
|
|
28136
28182
|
return null;
|
|
@@ -28145,7 +28191,7 @@ async function hasPassedAllGates(directory, taskId) {
|
|
|
28145
28191
|
return false;
|
|
28146
28192
|
return evidence.required_gates.every((gate) => evidence.gates[gate] != null);
|
|
28147
28193
|
}
|
|
28148
|
-
var GateEvidenceSchema, TaskEvidenceSchema, DEFAULT_REQUIRED_GATES;
|
|
28194
|
+
var GateEvidenceSchema, TaskEvidenceSchema, DEFAULT_REQUIRED_GATES, LEGACY_GATE_SESSION_ID = "legacy-manual", LEGACY_GATE_TIMESTAMP = "1970-01-01T00:00:00.000Z";
|
|
28149
28195
|
var init_gate_evidence = __esm(() => {
|
|
28150
28196
|
init_zod();
|
|
28151
28197
|
init_lock();
|
|
@@ -57509,10 +57555,31 @@ function stringHash(str) {
|
|
|
57509
57555
|
h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
57510
57556
|
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(16);
|
|
57511
57557
|
}
|
|
57558
|
+
function isInfrastructureFailure(currentResult) {
|
|
57559
|
+
const errorMessage = currentResult.errorMessage || "";
|
|
57560
|
+
const stackPrefix = currentResult.stackPrefix || "";
|
|
57561
|
+
if (/\bassertionerror\b/i.test(errorMessage)) {
|
|
57562
|
+
return false;
|
|
57563
|
+
}
|
|
57564
|
+
const combinedText = `${errorMessage}
|
|
57565
|
+
${stackPrefix}`;
|
|
57566
|
+
return INFRASTRUCTURE_FAILURE_PATTERNS.some((pattern) => pattern.test(combinedText));
|
|
57567
|
+
}
|
|
57512
57568
|
function classifyFailure(currentResult, history) {
|
|
57513
57569
|
const normalizedFile = currentResult.testFile.toLowerCase();
|
|
57514
57570
|
const normalizedName = currentResult.testName.toLowerCase();
|
|
57515
57571
|
const testHistory = history.filter((r) => r.testFile.toLowerCase() === normalizedFile && r.testName.toLowerCase() === normalizedName).sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
|
|
57572
|
+
if (isInfrastructureFailure(currentResult)) {
|
|
57573
|
+
return {
|
|
57574
|
+
testFile: currentResult.testFile,
|
|
57575
|
+
testName: currentResult.testName,
|
|
57576
|
+
classification: "infrastructure_failure",
|
|
57577
|
+
errorMessage: currentResult.errorMessage,
|
|
57578
|
+
stackPrefix: currentResult.stackPrefix,
|
|
57579
|
+
durationMs: currentResult.durationMs,
|
|
57580
|
+
confidence: computeConfidence2(testHistory.length)
|
|
57581
|
+
};
|
|
57582
|
+
}
|
|
57516
57583
|
const lastThree = testHistory.slice(0, 3);
|
|
57517
57584
|
const lastTen = testHistory.slice(0, 10);
|
|
57518
57585
|
const normalizedTestFile = currentResult.testFile.toLowerCase();
|
|
@@ -57612,6 +57679,20 @@ function classifyAndCluster(testResults, history) {
|
|
|
57612
57679
|
const clusters = clusterFailures(classified);
|
|
57613
57680
|
return { classified, clusters };
|
|
57614
57681
|
}
|
|
57682
|
+
var MAX_INFRA_CONTEXT_CHARS = 80, INFRASTRUCTURE_FAILURE_PATTERNS;
|
|
57683
|
+
var init_failure_classifier = __esm(() => {
|
|
57684
|
+
INFRASTRUCTURE_FAILURE_PATTERNS = [
|
|
57685
|
+
/\boutofmemoryerror\b/i,
|
|
57686
|
+
/(?:^|\n|\bcommand failed:\s*)\s*killed(?:\s*(?:[-:]\s*)?(?:out of memory|oom|by signal|signal|sigkill).*)?\s*(?:\n|$)/i,
|
|
57687
|
+
/(?:^|\n)\s*etimedout\b/i,
|
|
57688
|
+
new RegExp(`\\b(?:connect|connection|request|socket|network)\\b[^\\n]{0,${MAX_INFRA_CONTEXT_CHARS}}\\betimedout\\b`, "i"),
|
|
57689
|
+
/(?:^|\n)\s*econnrefused\b/i,
|
|
57690
|
+
new RegExp(`\\b(?:connect|connection|socket)\\b[^\\n]{0,${MAX_INFRA_CONTEXT_CHARS}}\\beconnrefused\\b`, "i"),
|
|
57691
|
+
/(?:^|\n)\s*enotfound\b/i,
|
|
57692
|
+
new RegExp(`\\b(?:getaddrinfo|dns|lookup)\\b[^\\n]{0,${MAX_INFRA_CONTEXT_CHARS}}\\benotfound\\b`, "i"),
|
|
57693
|
+
/\bexit(?:ed)?(?:\s+with)?(?:\s+code)?\s*[:=]?\s*137\b/i
|
|
57694
|
+
];
|
|
57695
|
+
});
|
|
57615
57696
|
|
|
57616
57697
|
// src/test-impact/flaky-detector.ts
|
|
57617
57698
|
function detectFlakyTests(allHistory) {
|
|
@@ -59356,6 +59437,7 @@ var init_test_runner = __esm(() => {
|
|
|
59356
59437
|
init_zod();
|
|
59357
59438
|
init_discovery();
|
|
59358
59439
|
init_analyzer();
|
|
59440
|
+
init_failure_classifier();
|
|
59359
59441
|
init_history_store();
|
|
59360
59442
|
init_bun_compat();
|
|
59361
59443
|
init_path_security();
|
|
@@ -102057,6 +102139,10 @@ var suggestPatch = createSwarmTool({
|
|
|
102057
102139
|
}, null, 2);
|
|
102058
102140
|
}
|
|
102059
102141
|
});
|
|
102142
|
+
|
|
102143
|
+
// src/tools/index.ts
|
|
102144
|
+
init_failure_classifier();
|
|
102145
|
+
|
|
102060
102146
|
// src/tools/generate-mutants.ts
|
|
102061
102147
|
init_zod();
|
|
102062
102148
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TestRunRecord } from './history-store.js';
|
|
2
|
-
export type FailureClassification = 'new_regression' | 'pre_existing' | 'flaky' | 'unknown';
|
|
2
|
+
export type FailureClassification = 'new_regression' | 'pre_existing' | 'flaky' | 'infrastructure_failure' | 'unknown';
|
|
3
3
|
export interface ClassifiedFailure {
|
|
4
4
|
testFile: string;
|
|
5
5
|
testName: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.27.1",
|
|
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",
|