opencode-swarm 6.86.9 → 6.86.11
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 +6 -9
- package/dist/index.js +82 -54
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -18580,7 +18580,7 @@ import * as path33 from "path";
|
|
|
18580
18580
|
// package.json
|
|
18581
18581
|
var package_default = {
|
|
18582
18582
|
name: "opencode-swarm",
|
|
18583
|
-
version: "6.86.
|
|
18583
|
+
version: "6.86.11",
|
|
18584
18584
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
18585
18585
|
main: "dist/index.js",
|
|
18586
18586
|
types: "dist/index.d.ts",
|
|
@@ -19091,13 +19091,6 @@ var AgentOverrideConfigSchema = exports_external.object({
|
|
|
19091
19091
|
temperature: exports_external.number().min(0).max(2).optional(),
|
|
19092
19092
|
disabled: exports_external.boolean().optional(),
|
|
19093
19093
|
fallback_models: exports_external.array(exports_external.string()).max(3).optional()
|
|
19094
|
-
}).refine((data) => {
|
|
19095
|
-
if (data.model && !data.fallback_models) {
|
|
19096
|
-
console.warn(`[opencode-swarm] WARNING: Agent configured with custom model "${data.model}" but no fallback_models. This means if the custom model fails, there is no fallback protection. Consider adding fallback_models for reliability.`);
|
|
19097
|
-
}
|
|
19098
|
-
return true;
|
|
19099
|
-
}, {
|
|
19100
|
-
message: "Agent configuration warning: Custom model without fallback protection"
|
|
19101
19094
|
});
|
|
19102
19095
|
var SwarmConfigSchema = exports_external.object({
|
|
19103
19096
|
name: exports_external.string().optional(),
|
|
@@ -20170,6 +20163,7 @@ function getEffectiveGates(profile, sessionOverrides) {
|
|
|
20170
20163
|
|
|
20171
20164
|
// src/hooks/delegation-gate.ts
|
|
20172
20165
|
init_telemetry();
|
|
20166
|
+
init_logger();
|
|
20173
20167
|
|
|
20174
20168
|
// node_modules/quick-lru/index.js
|
|
20175
20169
|
class QuickLRU extends Map {
|
|
@@ -20533,6 +20527,7 @@ function clearAllScopes(directory) {
|
|
|
20533
20527
|
// src/hooks/guardrails.ts
|
|
20534
20528
|
init_telemetry();
|
|
20535
20529
|
init_utils();
|
|
20530
|
+
init_logger();
|
|
20536
20531
|
|
|
20537
20532
|
// src/hooks/conflict-resolution.ts
|
|
20538
20533
|
init_telemetry();
|
|
@@ -35625,6 +35620,7 @@ function getGlobalEventBus() {
|
|
|
35625
35620
|
|
|
35626
35621
|
// src/hooks/curator.ts
|
|
35627
35622
|
init_manager();
|
|
35623
|
+
init_logger();
|
|
35628
35624
|
init_utils2();
|
|
35629
35625
|
|
|
35630
35626
|
// src/hooks/hive-promoter.ts
|
|
@@ -39485,6 +39481,7 @@ async function handleHistoryCommand(directory, _args) {
|
|
|
39485
39481
|
return formatHistoryMarkdown(historyData);
|
|
39486
39482
|
}
|
|
39487
39483
|
// src/hooks/knowledge-migrator.ts
|
|
39484
|
+
init_logger();
|
|
39488
39485
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
39489
39486
|
import { existsSync as existsSync13, readFileSync as readFileSync10 } from "fs";
|
|
39490
39487
|
import { mkdir as mkdir3, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -39582,7 +39579,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
39582
39579
|
await rewriteKnowledge(knowledgePath, existing);
|
|
39583
39580
|
}
|
|
39584
39581
|
await writeSentinel(sentinelPath, migrated, dropped);
|
|
39585
|
-
|
|
39582
|
+
log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
|
|
39586
39583
|
return {
|
|
39587
39584
|
migrated: true,
|
|
39588
39585
|
entriesMigrated: migrated,
|
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: "6.86.
|
|
36
|
+
version: "6.86.11",
|
|
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",
|
|
@@ -14798,13 +14798,6 @@ var init_schema = __esm(() => {
|
|
|
14798
14798
|
temperature: exports_external.number().min(0).max(2).optional(),
|
|
14799
14799
|
disabled: exports_external.boolean().optional(),
|
|
14800
14800
|
fallback_models: exports_external.array(exports_external.string()).max(3).optional()
|
|
14801
|
-
}).refine((data) => {
|
|
14802
|
-
if (data.model && !data.fallback_models) {
|
|
14803
|
-
console.warn(`[opencode-swarm] WARNING: Agent configured with custom model "${data.model}" but no fallback_models. This means if the custom model fails, there is no fallback protection. Consider adding fallback_models for reliability.`);
|
|
14804
|
-
}
|
|
14805
|
-
return true;
|
|
14806
|
-
}, {
|
|
14807
|
-
message: "Agent configuration warning: Custom model without fallback protection"
|
|
14808
14801
|
});
|
|
14809
14802
|
SwarmConfigSchema = exports_external.object({
|
|
14810
14803
|
name: exports_external.string().optional(),
|
|
@@ -23300,7 +23293,7 @@ function redactShellCommand(cmd) {
|
|
|
23300
23293
|
function createGuardrailsHooks(directory, directoryOrConfig, config2, authorityConfig) {
|
|
23301
23294
|
let guardrailsConfig;
|
|
23302
23295
|
if (directory && typeof directory === "object" && "enabled" in directory) {
|
|
23303
|
-
|
|
23296
|
+
warn("[guardrails] Legacy call without directory, falling back to process.cwd()");
|
|
23304
23297
|
guardrailsConfig = directory;
|
|
23305
23298
|
} else if (directoryOrConfig && typeof directoryOrConfig === "object" && "enabled" in directoryOrConfig) {
|
|
23306
23299
|
guardrailsConfig = directoryOrConfig;
|
|
@@ -23311,7 +23304,7 @@ function createGuardrailsHooks(directory, directoryOrConfig, config2, authorityC
|
|
|
23311
23304
|
if (typeof directory === "string")
|
|
23312
23305
|
return directory;
|
|
23313
23306
|
const cwd = process.cwd();
|
|
23314
|
-
|
|
23307
|
+
warn(`[guardrails] effectiveDirectory resolved to process.cwd() "${cwd}" — ` + "pass an explicit directory string to createGuardrailsHooks to avoid .swarm artifacts in wrong locations");
|
|
23315
23308
|
return cwd;
|
|
23316
23309
|
})();
|
|
23317
23310
|
if (guardrailsConfig?.enabled === false) {
|
|
@@ -24719,6 +24712,7 @@ var init_guardrails = __esm(() => {
|
|
|
24719
24712
|
init_state();
|
|
24720
24713
|
init_telemetry();
|
|
24721
24714
|
init_utils();
|
|
24715
|
+
init_logger();
|
|
24722
24716
|
init_conflict_resolution();
|
|
24723
24717
|
init_delegation_gate();
|
|
24724
24718
|
init_loop_detector();
|
|
@@ -25064,7 +25058,7 @@ async function getEvidenceTaskId(session, directory) {
|
|
|
25064
25058
|
}
|
|
25065
25059
|
} catch (err2) {
|
|
25066
25060
|
if (process.env.DEBUG_SWARM && err2 instanceof Error) {
|
|
25067
|
-
|
|
25061
|
+
warn(`[delegation-gate] getEvidenceTaskId error: ${err2.message} (code=${err2.code ?? "none"})`);
|
|
25068
25062
|
}
|
|
25069
25063
|
return null;
|
|
25070
25064
|
}
|
|
@@ -25121,7 +25115,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25121
25115
|
const hasCurrentSessionCoderDelegation = delegationChains.some((d) => stripKnownSwarmPrefix(d.to) === "coder" && d.timestamp > freshnessThreshold);
|
|
25122
25116
|
if (!hasCurrentSessionCoderDelegation) {
|
|
25123
25117
|
session.taskWorkflowStates.set(taskId, "idle");
|
|
25124
|
-
|
|
25118
|
+
warn(`[delegation-gate] Reset stale coder_delegated state for task ${taskId} — ` + `no coder delegation found in current session.`);
|
|
25125
25119
|
continue;
|
|
25126
25120
|
}
|
|
25127
25121
|
const turbo = hasActiveTurboMode(input.sessionID);
|
|
@@ -25162,7 +25156,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25162
25156
|
try {
|
|
25163
25157
|
await advanceTaskStateAndPersist(session, taskId, "complete", directory, config2.council);
|
|
25164
25158
|
} catch (err2) {
|
|
25165
|
-
|
|
25159
|
+
warn(`[delegation-gate] toolAfter submit_council_verdicts: could not advance ${taskId} → complete: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25166
25160
|
}
|
|
25167
25161
|
}
|
|
25168
25162
|
}
|
|
@@ -25205,7 +25199,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25205
25199
|
}
|
|
25206
25200
|
advanceTaskState(session, taskId, "tests_run");
|
|
25207
25201
|
} catch (err2) {
|
|
25208
|
-
|
|
25202
|
+
warn(`[delegation-gate] toolAfter stage-b-parallel: could not advance ${taskId} (${eligibleState}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25209
25203
|
}
|
|
25210
25204
|
}
|
|
25211
25205
|
}
|
|
@@ -25232,7 +25226,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25232
25226
|
}
|
|
25233
25227
|
advanceTaskState(otherSession, seedTaskId, "tests_run");
|
|
25234
25228
|
} catch (err2) {
|
|
25235
|
-
|
|
25229
|
+
warn(`[delegation-gate] toolAfter cross-session stage-b-parallel: could not advance ${seedTaskId} (${seedEligibleState}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25236
25230
|
}
|
|
25237
25231
|
}
|
|
25238
25232
|
}
|
|
@@ -25245,7 +25239,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25245
25239
|
try {
|
|
25246
25240
|
advanceTaskState(session, taskId, "reviewer_run");
|
|
25247
25241
|
} catch (err2) {
|
|
25248
|
-
|
|
25242
|
+
warn(`[delegation-gate] toolAfter: could not advance ${taskId} (${state}) → reviewer_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25249
25243
|
}
|
|
25250
25244
|
}
|
|
25251
25245
|
}
|
|
@@ -25256,7 +25250,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25256
25250
|
try {
|
|
25257
25251
|
advanceTaskState(session, taskId, "tests_run");
|
|
25258
25252
|
} catch (err2) {
|
|
25259
|
-
|
|
25253
|
+
warn(`[delegation-gate] toolAfter: could not advance ${taskId} (${state}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25260
25254
|
}
|
|
25261
25255
|
}
|
|
25262
25256
|
}
|
|
@@ -25280,7 +25274,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25280
25274
|
try {
|
|
25281
25275
|
advanceTaskState(otherSession, taskId, "reviewer_run");
|
|
25282
25276
|
} catch (err2) {
|
|
25283
|
-
|
|
25277
|
+
warn(`[delegation-gate] toolAfter cross-session: could not advance ${taskId} (${state}) → reviewer_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25284
25278
|
}
|
|
25285
25279
|
}
|
|
25286
25280
|
}
|
|
@@ -25298,7 +25292,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25298
25292
|
try {
|
|
25299
25293
|
advanceTaskState(otherSession, taskId, "tests_run");
|
|
25300
25294
|
} catch (err2) {
|
|
25301
|
-
|
|
25295
|
+
warn(`[delegation-gate] toolAfter cross-session: could not advance ${taskId} (${state}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25302
25296
|
}
|
|
25303
25297
|
}
|
|
25304
25298
|
}
|
|
@@ -25370,7 +25364,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25370
25364
|
try {
|
|
25371
25365
|
advanceTaskState(session, taskId, "reviewer_run");
|
|
25372
25366
|
} catch (err2) {
|
|
25373
|
-
|
|
25367
|
+
warn(`[delegation-gate] fallback: could not advance ${taskId} (${state}) → reviewer_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25374
25368
|
}
|
|
25375
25369
|
}
|
|
25376
25370
|
}
|
|
@@ -25381,7 +25375,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25381
25375
|
try {
|
|
25382
25376
|
advanceTaskState(session, taskId, "tests_run");
|
|
25383
25377
|
} catch (err2) {
|
|
25384
|
-
|
|
25378
|
+
warn(`[delegation-gate] fallback: could not advance ${taskId} (${state}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25385
25379
|
}
|
|
25386
25380
|
}
|
|
25387
25381
|
}
|
|
@@ -25401,7 +25395,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25401
25395
|
try {
|
|
25402
25396
|
advanceTaskState(otherSession, taskId, "reviewer_run");
|
|
25403
25397
|
} catch (err2) {
|
|
25404
|
-
|
|
25398
|
+
warn(`[delegation-gate] fallback cross-session: could not advance ${taskId} (${state}) → reviewer_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25405
25399
|
}
|
|
25406
25400
|
}
|
|
25407
25401
|
}
|
|
@@ -25422,7 +25416,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25422
25416
|
try {
|
|
25423
25417
|
advanceTaskState(otherSession, taskId, "tests_run");
|
|
25424
25418
|
} catch (err2) {
|
|
25425
|
-
|
|
25419
|
+
warn(`[delegation-gate] fallback cross-session: could not advance ${taskId} (${state}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25426
25420
|
}
|
|
25427
25421
|
}
|
|
25428
25422
|
}
|
|
@@ -25549,7 +25543,7 @@ ${trimComment}${after}`;
|
|
|
25549
25543
|
try {
|
|
25550
25544
|
await advanceTaskStateAndPersist(session, currentTaskId, "coder_delegated", directory);
|
|
25551
25545
|
} catch (err2) {
|
|
25552
|
-
|
|
25546
|
+
warn(`[delegation-gate] state machine warn: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25553
25547
|
}
|
|
25554
25548
|
}
|
|
25555
25549
|
if (sessionID && !isCoderDelegation && currentTaskId) {
|
|
@@ -25677,6 +25671,7 @@ var init_delegation_gate = __esm(() => {
|
|
|
25677
25671
|
init_schema();
|
|
25678
25672
|
init_state();
|
|
25679
25673
|
init_telemetry();
|
|
25674
|
+
init_logger();
|
|
25680
25675
|
init_guardrails();
|
|
25681
25676
|
init_normalize_tool_name();
|
|
25682
25677
|
init_utils2();
|
|
@@ -42601,7 +42596,7 @@ async function readCuratorSummary(directory) {
|
|
|
42601
42596
|
try {
|
|
42602
42597
|
const parsed = JSON.parse(content);
|
|
42603
42598
|
if (parsed.schema_version !== 1) {
|
|
42604
|
-
|
|
42599
|
+
warn(`Curator summary has unsupported schema version: ${parsed.schema_version}. Expected 1.`);
|
|
42605
42600
|
return null;
|
|
42606
42601
|
}
|
|
42607
42602
|
return parsed;
|
|
@@ -42838,7 +42833,7 @@ ${llmOutput.trim()}`;
|
|
|
42838
42833
|
enhanced: true
|
|
42839
42834
|
});
|
|
42840
42835
|
} catch (err2) {
|
|
42841
|
-
|
|
42836
|
+
warn(`[curator] LLM delegation failed during CURATOR_INIT, using data-only mode: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
42842
42837
|
getGlobalEventBus().publish("curator.init.llm_fallback", {
|
|
42843
42838
|
error: String(err2)
|
|
42844
42839
|
});
|
|
@@ -42962,7 +42957,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config3, _kno
|
|
|
42962
42957
|
recommendations: knowledgeRecommendations.length
|
|
42963
42958
|
});
|
|
42964
42959
|
} catch (err2) {
|
|
42965
|
-
|
|
42960
|
+
warn(`[curator] LLM delegation failed during CURATOR_PHASE ${phase}, using data-only mode: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
42966
42961
|
getGlobalEventBus().publish("curator.phase.llm_fallback", {
|
|
42967
42962
|
phase,
|
|
42968
42963
|
error: String(err2)
|
|
@@ -43123,7 +43118,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
43123
43118
|
if (rec.entry_id !== undefined && !appliedIds.has(rec.entry_id)) {
|
|
43124
43119
|
const found = entries.some((e) => e.id === rec.entry_id);
|
|
43125
43120
|
if (!found) {
|
|
43126
|
-
|
|
43121
|
+
warn(`[curator] applyCuratorKnowledgeUpdates: entry_id '${rec.entry_id}' not found — skipping`);
|
|
43127
43122
|
}
|
|
43128
43123
|
skipped++;
|
|
43129
43124
|
}
|
|
@@ -43191,6 +43186,7 @@ var DEFAULT_CURATOR_LLM_TIMEOUT_MS = 300000;
|
|
|
43191
43186
|
var init_curator = __esm(() => {
|
|
43192
43187
|
init_event_bus();
|
|
43193
43188
|
init_manager();
|
|
43189
|
+
init_logger();
|
|
43194
43190
|
init_knowledge_store();
|
|
43195
43191
|
init_knowledge_validator();
|
|
43196
43192
|
init_utils2();
|
|
@@ -48264,7 +48260,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
48264
48260
|
await rewriteKnowledge(knowledgePath, existing);
|
|
48265
48261
|
}
|
|
48266
48262
|
await writeSentinel(sentinelPath, migrated, dropped);
|
|
48267
|
-
|
|
48263
|
+
log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
|
|
48268
48264
|
return {
|
|
48269
48265
|
migrated: true,
|
|
48270
48266
|
entriesMigrated: migrated,
|
|
@@ -48394,6 +48390,7 @@ async function writeSentinel(sentinelPath, migrated, dropped) {
|
|
|
48394
48390
|
await writeFile5(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
|
|
48395
48391
|
}
|
|
48396
48392
|
var init_knowledge_migrator = __esm(() => {
|
|
48393
|
+
init_logger();
|
|
48397
48394
|
init_knowledge_store();
|
|
48398
48395
|
init_knowledge_validator();
|
|
48399
48396
|
});
|
|
@@ -59201,7 +59198,7 @@ function createPreflightIntegration(config3) {
|
|
|
59201
59198
|
statusArtifact = new AutomationStatusArtifact(swarmDir);
|
|
59202
59199
|
}
|
|
59203
59200
|
const preflightHandler = async (request) => {
|
|
59204
|
-
|
|
59201
|
+
log("[PreflightIntegration] Handling preflight request", {
|
|
59205
59202
|
requestId: request.id,
|
|
59206
59203
|
phase: request.currentPhase,
|
|
59207
59204
|
source: request.source
|
|
@@ -59210,13 +59207,13 @@ function createPreflightIntegration(config3) {
|
|
|
59210
59207
|
if (statusArtifact) {
|
|
59211
59208
|
const state = report.overall === "pass" ? "success" : "failure";
|
|
59212
59209
|
statusArtifact.recordOutcome(state, request.currentPhase, report.message);
|
|
59213
|
-
|
|
59210
|
+
log("[PreflightIntegration] Status artifact updated", {
|
|
59214
59211
|
state,
|
|
59215
59212
|
phase: request.currentPhase,
|
|
59216
59213
|
message: report.message
|
|
59217
59214
|
});
|
|
59218
59215
|
}
|
|
59219
|
-
|
|
59216
|
+
log("[PreflightIntegration] Preflight complete", {
|
|
59220
59217
|
requestId: request.id,
|
|
59221
59218
|
overall: report.overall,
|
|
59222
59219
|
message: report.message,
|
|
@@ -59239,6 +59236,7 @@ var init_preflight_integration = __esm(() => {
|
|
|
59239
59236
|
init_status_artifact();
|
|
59240
59237
|
init_trigger();
|
|
59241
59238
|
init_preflight_service();
|
|
59239
|
+
init_logger();
|
|
59242
59240
|
});
|
|
59243
59241
|
|
|
59244
59242
|
// node_modules/web-tree-sitter/tree-sitter.js
|
|
@@ -63143,12 +63141,12 @@ async function readPriorDriftReports(directory) {
|
|
|
63143
63141
|
try {
|
|
63144
63142
|
const report = JSON.parse(content);
|
|
63145
63143
|
if (typeof report.phase !== "number" || typeof report.alignment !== "string" || typeof report.timestamp !== "string" || typeof report.drift_score !== "number" || typeof report.schema_version !== "number" || !Array.isArray(report.compounding_effects)) {
|
|
63146
|
-
|
|
63144
|
+
warn(`[curator-drift] Skipping corrupt drift report: ${filename}`);
|
|
63147
63145
|
continue;
|
|
63148
63146
|
}
|
|
63149
63147
|
reports.push(report);
|
|
63150
63148
|
} catch {
|
|
63151
|
-
|
|
63149
|
+
warn(`[curator-drift] Skipping unreadable drift report: ${filename}`);
|
|
63152
63150
|
}
|
|
63153
63151
|
}
|
|
63154
63152
|
reports.sort((a, b) => a.phase - b.phase);
|
|
@@ -63285,6 +63283,7 @@ function buildDriftInjectionText(report, maxChars) {
|
|
|
63285
63283
|
var DRIFT_REPORT_PREFIX = "drift-report-phase-";
|
|
63286
63284
|
var init_curator_drift = __esm(() => {
|
|
63287
63285
|
init_event_bus();
|
|
63286
|
+
init_logger();
|
|
63288
63287
|
init_utils2();
|
|
63289
63288
|
});
|
|
63290
63289
|
|
|
@@ -64511,6 +64510,7 @@ init_schema();
|
|
|
64511
64510
|
init_file_locks();
|
|
64512
64511
|
init_state();
|
|
64513
64512
|
init_telemetry();
|
|
64513
|
+
init_logger();
|
|
64514
64514
|
init_utils2();
|
|
64515
64515
|
import * as fs33 from "node:fs";
|
|
64516
64516
|
var END_OF_SENTENCE_QUESTION_PATTERN = /\?\s*$/;
|
|
@@ -64622,7 +64622,7 @@ function parseCriticResponse(rawResponse) {
|
|
|
64622
64622
|
if (validVerdicts.includes(normalized)) {
|
|
64623
64623
|
res.verdict = normalized;
|
|
64624
64624
|
} else {
|
|
64625
|
-
|
|
64625
|
+
warn(`[full-auto-intercept] Unknown verdict '${value}' — defaulting to NEEDS_REVISION`);
|
|
64626
64626
|
res.verdict = "NEEDS_REVISION";
|
|
64627
64627
|
}
|
|
64628
64628
|
break;
|
|
@@ -64699,23 +64699,23 @@ async function writeAutoOversightEvent(directory, architectOutput, criticVerdict
|
|
|
64699
64699
|
try {
|
|
64700
64700
|
lockResult = await tryAcquireLock(dir, eventsFilePath, "auto-oversight", lockTaskId);
|
|
64701
64701
|
} catch (error93) {
|
|
64702
|
-
|
|
64702
|
+
warn(`[full-auto-intercept] Warning: failed to acquire lock for auto_oversight event: ${error93 instanceof Error ? error93.message : String(error93)}`);
|
|
64703
64703
|
}
|
|
64704
64704
|
if (!lockResult?.acquired) {
|
|
64705
|
-
|
|
64705
|
+
warn(`[full-auto-intercept] Warning: could not acquire lock for events.jsonl write — proceeding without lock`);
|
|
64706
64706
|
}
|
|
64707
64707
|
try {
|
|
64708
64708
|
const eventsPath = validateSwarmPath(dir, "events.jsonl");
|
|
64709
64709
|
fs33.appendFileSync(eventsPath, `${JSON.stringify(event)}
|
|
64710
64710
|
`, "utf-8");
|
|
64711
64711
|
} catch (writeError) {
|
|
64712
|
-
|
|
64712
|
+
error48(`[full-auto-intercept] Warning: failed to write auto_oversight event: ${writeError instanceof Error ? writeError.message : String(writeError)}`);
|
|
64713
64713
|
} finally {
|
|
64714
64714
|
if (lockResult?.acquired && lockResult.lock._release) {
|
|
64715
64715
|
try {
|
|
64716
64716
|
await lockResult.lock._release();
|
|
64717
64717
|
} catch (releaseError) {
|
|
64718
|
-
|
|
64718
|
+
error48(`[full-auto-intercept] Lock release failed:`, releaseError);
|
|
64719
64719
|
}
|
|
64720
64720
|
}
|
|
64721
64721
|
}
|
|
@@ -64821,7 +64821,7 @@ Critic reasoning: ${criticResult.reasoning}`
|
|
|
64821
64821
|
async function dispatchCriticAndWriteEvent(directory, architectOutput, criticContext, criticModel, escalationType, interactionCount, deadlockCount, oversightAgentName) {
|
|
64822
64822
|
const client = swarmState.opencodeClient;
|
|
64823
64823
|
if (!client) {
|
|
64824
|
-
|
|
64824
|
+
warn("[full-auto-intercept] No opencodeClient — critic dispatch skipped (fallback to PENDING)");
|
|
64825
64825
|
const result = {
|
|
64826
64826
|
verdict: "PENDING",
|
|
64827
64827
|
reasoning: "No opencodeClient available — critic dispatch not possible",
|
|
@@ -64834,7 +64834,7 @@ async function dispatchCriticAndWriteEvent(directory, architectOutput, criticCon
|
|
|
64834
64834
|
return result;
|
|
64835
64835
|
}
|
|
64836
64836
|
const oversightAgent = createCriticAutonomousOversightAgent(criticModel, criticContext);
|
|
64837
|
-
|
|
64837
|
+
log(`[full-auto-intercept] Dispatching critic: ${oversightAgent.name} using model ${criticModel}`);
|
|
64838
64838
|
let ephemeralSessionId;
|
|
64839
64839
|
const cleanup = () => {
|
|
64840
64840
|
if (ephemeralSessionId) {
|
|
@@ -64852,7 +64852,7 @@ async function dispatchCriticAndWriteEvent(directory, architectOutput, criticCon
|
|
|
64852
64852
|
throw new Error(`Failed to create critic session: ${JSON.stringify(createResult.error)}`);
|
|
64853
64853
|
}
|
|
64854
64854
|
ephemeralSessionId = createResult.data.id;
|
|
64855
|
-
|
|
64855
|
+
log(`[full-auto-intercept] Created ephemeral session: ${ephemeralSessionId}`);
|
|
64856
64856
|
const promptResult = await client.session.prompt({
|
|
64857
64857
|
path: { id: ephemeralSessionId },
|
|
64858
64858
|
body: {
|
|
@@ -64867,9 +64867,9 @@ async function dispatchCriticAndWriteEvent(directory, architectOutput, criticCon
|
|
|
64867
64867
|
const textParts = promptResult.data.parts.filter((p) => p.type === "text");
|
|
64868
64868
|
criticResponse = textParts.map((p) => p.text).join(`
|
|
64869
64869
|
`);
|
|
64870
|
-
|
|
64870
|
+
log(`[full-auto-intercept] Critic response received (${criticResponse.length} chars)`);
|
|
64871
64871
|
if (!criticResponse.trim()) {
|
|
64872
|
-
|
|
64872
|
+
warn("[full-auto-intercept] Critic returned empty response — using fallback verdict");
|
|
64873
64873
|
criticResponse = `VERDICT: NEEDS_REVISION
|
|
64874
64874
|
REASONING: Critic returned empty response
|
|
64875
64875
|
EVIDENCE_CHECKED: none
|
|
@@ -64882,9 +64882,9 @@ ESCALATION_NEEDED: NO`;
|
|
|
64882
64882
|
let parsed;
|
|
64883
64883
|
try {
|
|
64884
64884
|
parsed = parseCriticResponse(criticResponse);
|
|
64885
|
-
|
|
64885
|
+
log(`[full-auto-intercept] Critic verdict: ${parsed.verdict} | escalation: ${parsed.escalationNeeded}`);
|
|
64886
64886
|
} catch (parseError) {
|
|
64887
|
-
|
|
64887
|
+
error48(`[full-auto-intercept] Failed to parse critic response: ${parseError instanceof Error ? parseError.message : String(parseError)}`);
|
|
64888
64888
|
parsed = {
|
|
64889
64889
|
verdict: "NEEDS_REVISION",
|
|
64890
64890
|
reasoning: "Critic response parsing failed — defaulting to NEEDS_REVISION",
|
|
@@ -64897,7 +64897,7 @@ ESCALATION_NEEDED: NO`;
|
|
|
64897
64897
|
try {
|
|
64898
64898
|
await writeAutoOversightEvent(directory, architectOutput, parsed.verdict, parsed.reasoning, parsed.evidenceChecked, interactionCount, deadlockCount, escalationType);
|
|
64899
64899
|
} catch (writeError) {
|
|
64900
|
-
|
|
64900
|
+
error48(`[full-auto-intercept] Failed to write auto_oversight event: ${writeError instanceof Error ? writeError.message : String(writeError)}`);
|
|
64901
64901
|
}
|
|
64902
64902
|
return parsed;
|
|
64903
64903
|
}
|
|
@@ -64966,7 +64966,7 @@ function createFullAutoInterceptHook(config3, directory) {
|
|
|
64966
64966
|
const lastQuestionHash = session.fullAutoLastQuestionHash;
|
|
64967
64967
|
if (lastQuestionHash === questionHash) {
|
|
64968
64968
|
session.fullAutoDeadlockCount = (session.fullAutoDeadlockCount ?? 0) + 1;
|
|
64969
|
-
|
|
64969
|
+
warn(`[full-auto-intercept] Potential deadlock detected (count: ${session.fullAutoDeadlockCount}/${deadlockThreshold}) — identical question repeated`);
|
|
64970
64970
|
if (session.fullAutoDeadlockCount >= deadlockThreshold) {
|
|
64971
64971
|
const escalated = await handleEscalation(directory, "deadlock", sessionID, architectText, session.fullAutoInteractionCount ?? 0, session.fullAutoDeadlockCount, escalationMode);
|
|
64972
64972
|
if (escalated)
|
|
@@ -64978,14 +64978,14 @@ function createFullAutoInterceptHook(config3, directory) {
|
|
|
64978
64978
|
session.fullAutoLastQuestionHash = questionHash;
|
|
64979
64979
|
}
|
|
64980
64980
|
}
|
|
64981
|
-
|
|
64981
|
+
log(`[full-auto-intercept] Escalation detected (${escalationType}) — triggering autonomous oversight`);
|
|
64982
64982
|
const criticContext = buildCriticContext(architectText, escalationType);
|
|
64983
64983
|
const criticModel = fullAutoConfig.critic_model ?? "claude-sonnet-4-20250514";
|
|
64984
64984
|
const oversightAgent = createCriticAutonomousOversightAgent(criticModel, criticContext);
|
|
64985
64985
|
const architectAgent = architectMessage.info?.agent;
|
|
64986
64986
|
const resolvedOversightAgentName = resolveOversightAgentName(architectAgent);
|
|
64987
64987
|
const dispatchAgentName = resolvedOversightAgentName && resolvedOversightAgentName.length > 0 ? resolvedOversightAgentName : "critic_oversight";
|
|
64988
|
-
|
|
64988
|
+
log(`[full-auto-intercept] Created autonomous oversight agent: ${oversightAgent.name} using model ${criticModel} (dispatch as: ${dispatchAgentName})`);
|
|
64989
64989
|
const criticResult = await dispatchCriticAndWriteEvent(directory, architectText, criticContext, criticModel, escalationType, session?.fullAutoInteractionCount ?? 0, session?.fullAutoDeadlockCount ?? 0, dispatchAgentName);
|
|
64990
64990
|
injectVerdictIntoMessages(messages, lastArchitectMessageIndex, criticResult, escalationType, dispatchAgentName);
|
|
64991
64991
|
};
|
|
@@ -65058,19 +65058,19 @@ This escalation requires human intervention. The swarm has been paused.
|
|
|
65058
65058
|
Please review the architect's output above and provide guidance.
|
|
65059
65059
|
`;
|
|
65060
65060
|
fs33.writeFileSync(reportPath, reportContent, "utf-8");
|
|
65061
|
-
|
|
65061
|
+
log(`[full-auto-intercept] Escalation report written to: ${reportPath}`);
|
|
65062
65062
|
} catch (error93) {
|
|
65063
|
-
|
|
65063
|
+
error48(`[full-auto-intercept] Failed to write escalation report:`, error93 instanceof Error ? error93.message : String(error93));
|
|
65064
65064
|
}
|
|
65065
65065
|
}
|
|
65066
65066
|
async function handleEscalation(directory, reason, sessionID, architectOutput, interactionCount, deadlockCount, escalationMode, phase) {
|
|
65067
65067
|
telemetry.autoOversightEscalation(sessionID ?? "unknown", reason, interactionCount, deadlockCount, phase);
|
|
65068
65068
|
await writeEscalationReport(directory, reason, architectOutput, interactionCount, deadlockCount, phase);
|
|
65069
65069
|
if (escalationMode === "terminate") {
|
|
65070
|
-
|
|
65070
|
+
error48(`[full-auto-intercept] ESCALATION (terminate mode) — reason: ${reason}, session: ${sessionID}`);
|
|
65071
65071
|
process.exit(1);
|
|
65072
65072
|
}
|
|
65073
|
-
|
|
65073
|
+
warn(`[full-auto-intercept] ESCALATION (pause mode) — reason: ${reason}, session: ${sessionID}`);
|
|
65074
65074
|
return true;
|
|
65075
65075
|
}
|
|
65076
65076
|
|
|
@@ -88769,6 +88769,34 @@ async function initializeOpenCodeSwarm(ctx) {
|
|
|
88769
88769
|
}
|
|
88770
88770
|
}
|
|
88771
88771
|
}
|
|
88772
|
+
{
|
|
88773
|
+
const noFallback = [];
|
|
88774
|
+
const hasNoFallback = (cfg) => cfg.model && (!cfg.fallback_models || cfg.fallback_models.length === 0);
|
|
88775
|
+
if (config3.agents) {
|
|
88776
|
+
for (const [name2, cfg] of Object.entries(config3.agents)) {
|
|
88777
|
+
if (hasNoFallback(cfg))
|
|
88778
|
+
noFallback.push(`${name2}(${cfg.model})`);
|
|
88779
|
+
}
|
|
88780
|
+
}
|
|
88781
|
+
if (config3.swarms) {
|
|
88782
|
+
for (const [swarmId, swarm] of Object.entries(config3.swarms)) {
|
|
88783
|
+
if (swarm.agents) {
|
|
88784
|
+
for (const [name2, cfg] of Object.entries(swarm.agents)) {
|
|
88785
|
+
if (hasNoFallback(cfg))
|
|
88786
|
+
noFallback.push(`${swarmId}/${name2}(${cfg.model})`);
|
|
88787
|
+
}
|
|
88788
|
+
}
|
|
88789
|
+
}
|
|
88790
|
+
}
|
|
88791
|
+
if (noFallback.length > 0) {
|
|
88792
|
+
const msg = `[opencode-swarm] WARNING: ${noFallback.length} agent(s) use a custom model without fallback_models: ` + noFallback.join(", ") + '. Add "fallback_models": ["model-a"] to each agent config for reliability.';
|
|
88793
|
+
if (!config3.quiet) {
|
|
88794
|
+
console.warn(msg);
|
|
88795
|
+
} else {
|
|
88796
|
+
addDeferredWarning(msg);
|
|
88797
|
+
}
|
|
88798
|
+
}
|
|
88799
|
+
}
|
|
88772
88800
|
swarmState.fullAutoEnabledInConfig = config3.full_auto?.enabled === true;
|
|
88773
88801
|
swarmState.opencodeClient = ctx.client;
|
|
88774
88802
|
await loadSnapshot(ctx.directory);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "6.86.
|
|
3
|
+
"version": "6.86.11",
|
|
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",
|