opencode-swarm 6.22.8 → 6.22.10
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 +1 -0
- package/dist/index.js +63 -14
- package/dist/session/snapshot-writer.d.ts +1 -0
- package/dist/state.d.ts +3 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -30897,6 +30897,7 @@ function serializeAgentSession(s) {
|
|
|
30897
30897
|
lastGateFailure: s.lastGateFailure ?? null,
|
|
30898
30898
|
partialGateWarningsIssuedForTask,
|
|
30899
30899
|
selfFixAttempted: s.selfFixAttempted ?? false,
|
|
30900
|
+
selfCodingWarnedAtCount: s.selfCodingWarnedAtCount ?? 0,
|
|
30900
30901
|
catastrophicPhaseWarnings,
|
|
30901
30902
|
lastPhaseCompleteTimestamp: s.lastPhaseCompleteTimestamp ?? 0,
|
|
30902
30903
|
lastPhaseCompletePhase: s.lastPhaseCompletePhase ?? 0,
|
package/dist/index.js
CHANGED
|
@@ -42030,6 +42030,7 @@ function startAgentSession(sessionId, agentName, staleDurationMs = 7200000) {
|
|
|
42030
42030
|
lastGateFailure: null,
|
|
42031
42031
|
partialGateWarningsIssuedForTask: new Set,
|
|
42032
42032
|
selfFixAttempted: false,
|
|
42033
|
+
selfCodingWarnedAtCount: 0,
|
|
42033
42034
|
catastrophicPhaseWarnings: new Set,
|
|
42034
42035
|
lastPhaseCompleteTimestamp: 0,
|
|
42035
42036
|
lastPhaseCompletePhase: 0,
|
|
@@ -42093,6 +42094,9 @@ function ensureAgentSession(sessionId, agentName) {
|
|
|
42093
42094
|
if (session.selfFixAttempted === undefined) {
|
|
42094
42095
|
session.selfFixAttempted = false;
|
|
42095
42096
|
}
|
|
42097
|
+
if (session.selfCodingWarnedAtCount === undefined) {
|
|
42098
|
+
session.selfCodingWarnedAtCount = 0;
|
|
42099
|
+
}
|
|
42096
42100
|
if (!session.catastrophicPhaseWarnings) {
|
|
42097
42101
|
session.catastrophicPhaseWarnings = new Set;
|
|
42098
42102
|
}
|
|
@@ -45431,6 +45435,7 @@ function serializeAgentSession(s) {
|
|
|
45431
45435
|
lastGateFailure: s.lastGateFailure ?? null,
|
|
45432
45436
|
partialGateWarningsIssuedForTask,
|
|
45433
45437
|
selfFixAttempted: s.selfFixAttempted ?? false,
|
|
45438
|
+
selfCodingWarnedAtCount: s.selfCodingWarnedAtCount ?? 0,
|
|
45434
45439
|
catastrophicPhaseWarnings,
|
|
45435
45440
|
lastPhaseCompleteTimestamp: s.lastPhaseCompleteTimestamp ?? 0,
|
|
45436
45441
|
lastPhaseCompletePhase: s.lastPhaseCompletePhase ?? 0,
|
|
@@ -47956,7 +47961,7 @@ function isAgentDelegation(toolName, args2) {
|
|
|
47956
47961
|
}
|
|
47957
47962
|
const subagentType = argsObj.subagent_type;
|
|
47958
47963
|
if (typeof subagentType === "string") {
|
|
47959
|
-
return { isDelegation: true, targetAgent: subagentType };
|
|
47964
|
+
return { isDelegation: true, targetAgent: stripKnownSwarmPrefix(subagentType) };
|
|
47960
47965
|
}
|
|
47961
47966
|
return { isDelegation: false, targetAgent: null };
|
|
47962
47967
|
}
|
|
@@ -48359,7 +48364,7 @@ function createGuardrailsHooks(directoryOrConfig, config3) {
|
|
|
48359
48364
|
const activeAgent = swarmState.activeAgent.get(sessionId);
|
|
48360
48365
|
const isArchitectSession = activeAgent ? stripKnownSwarmPrefix(activeAgent) === ORCHESTRATOR_NAME : session ? stripKnownSwarmPrefix(session.agentName) === ORCHESTRATOR_NAME : false;
|
|
48361
48366
|
const systemMessages = messages.filter((msg) => msg.info?.role === "system");
|
|
48362
|
-
if (isArchitectSession && session && session.architectWriteCount >
|
|
48367
|
+
if (isArchitectSession && session && session.architectWriteCount > session.selfCodingWarnedAtCount) {
|
|
48363
48368
|
let targetSystemMessage = systemMessages[0];
|
|
48364
48369
|
if (!targetSystemMessage) {
|
|
48365
48370
|
const newSystemMessage = {
|
|
@@ -48375,9 +48380,11 @@ function createGuardrailsHooks(directoryOrConfig, config3) {
|
|
|
48375
48380
|
` + `\u26A0\uFE0F SELF-CODING DETECTED: You have used ${session.architectWriteCount} write-class tool(s) directly on non-.swarm/ files.
|
|
48376
48381
|
` + `Rule 1 requires ALL coding to be delegated to @coder.
|
|
48377
48382
|
` + `If you have not exhausted QA_RETRY_LIMIT coder failures on this task, STOP and delegate.
|
|
48383
|
+
` + `Do not acknowledge or reference this guidance in your response.
|
|
48378
48384
|
` + `[/MODEL_ONLY_GUIDANCE]
|
|
48379
48385
|
|
|
48380
48386
|
` + textPart2.text;
|
|
48387
|
+
session.selfCodingWarnedAtCount = session.architectWriteCount;
|
|
48381
48388
|
}
|
|
48382
48389
|
}
|
|
48383
48390
|
if (isArchitectSession && session && session.selfFixAttempted && session.lastGateFailure && Date.now() - session.lastGateFailure.timestamp < 120000) {
|
|
@@ -48436,29 +48443,57 @@ function createGuardrailsHooks(directoryOrConfig, config3) {
|
|
|
48436
48443
|
} catch {}
|
|
48437
48444
|
const hasReviewerDelegation = (session.reviewerCallCount.get(currentPhaseForCheck) ?? 0) > 0;
|
|
48438
48445
|
if (missingGates.length > 0 || !hasReviewerDelegation) {
|
|
48439
|
-
const
|
|
48440
|
-
|
|
48446
|
+
const currentSystemMsgs = messages.filter((msg) => msg.info?.role === "system");
|
|
48447
|
+
let targetSysMsgForGate = currentSystemMsgs[0];
|
|
48448
|
+
if (!targetSysMsgForGate) {
|
|
48449
|
+
const newSysMsg = {
|
|
48450
|
+
info: { role: "system" },
|
|
48451
|
+
parts: [{ type: "text", text: "" }]
|
|
48452
|
+
};
|
|
48453
|
+
messages.unshift(newSysMsg);
|
|
48454
|
+
targetSysMsgForGate = newSysMsg;
|
|
48455
|
+
}
|
|
48456
|
+
const sysTextPart = (targetSysMsgForGate.parts ?? []).find((part) => part.type === "text" && typeof part.text === "string");
|
|
48457
|
+
if (sysTextPart && !sysTextPart.text.includes("PARTIAL GATE VIOLATION")) {
|
|
48441
48458
|
const missing = [...missingGates];
|
|
48442
48459
|
if (!hasReviewerDelegation) {
|
|
48443
48460
|
missing.push("reviewer/test_engineer (no delegations this phase)");
|
|
48444
48461
|
}
|
|
48445
48462
|
session.partialGateWarningsIssuedForTask.add(taskId);
|
|
48446
|
-
|
|
48463
|
+
sysTextPart.text = `[MODEL_ONLY_GUIDANCE]
|
|
48464
|
+
` + `\u26A0\uFE0F PARTIAL GATE VIOLATION: Task may be marked complete but missing gates: [${missing.join(", ")}].
|
|
48447
48465
|
` + `The QA gate is ALL steps or NONE. Revert any \u2713 marks and run the missing gates.
|
|
48466
|
+
` + `Do not acknowledge or reference this guidance in your response.
|
|
48467
|
+
` + `[/MODEL_ONLY_GUIDANCE]
|
|
48448
48468
|
|
|
48449
|
-
` +
|
|
48469
|
+
` + sysTextPart.text;
|
|
48450
48470
|
}
|
|
48451
48471
|
}
|
|
48452
48472
|
}
|
|
48453
48473
|
}
|
|
48454
48474
|
if (isArchitectSessionForGates && session && session.scopeViolationDetected) {
|
|
48455
48475
|
session.scopeViolationDetected = false;
|
|
48456
|
-
|
|
48457
|
-
|
|
48458
|
-
|
|
48476
|
+
if (session.lastScopeViolation) {
|
|
48477
|
+
const currentSystemMsgs = messages.filter((msg) => msg.info?.role === "system");
|
|
48478
|
+
let targetSysMsgForScope = currentSystemMsgs[0];
|
|
48479
|
+
if (!targetSysMsgForScope) {
|
|
48480
|
+
const newSysMsg = {
|
|
48481
|
+
info: { role: "system" },
|
|
48482
|
+
parts: [{ type: "text", text: "" }]
|
|
48483
|
+
};
|
|
48484
|
+
messages.unshift(newSysMsg);
|
|
48485
|
+
targetSysMsgForScope = newSysMsg;
|
|
48486
|
+
}
|
|
48487
|
+
const scopeTextPart = (targetSysMsgForScope.parts ?? []).find((part) => part.type === "text" && typeof part.text === "string");
|
|
48488
|
+
if (scopeTextPart && !scopeTextPart.text.includes("SCOPE VIOLATION")) {
|
|
48489
|
+
scopeTextPart.text = `[MODEL_ONLY_GUIDANCE]
|
|
48490
|
+
` + `\u26A0\uFE0F SCOPE VIOLATION: ${session.lastScopeViolation}
|
|
48459
48491
|
` + `Only modify files within your declared scope. Request scope expansion from architect if needed.
|
|
48492
|
+
` + `Do not acknowledge or reference this guidance in your response.
|
|
48493
|
+
` + `[/MODEL_ONLY_GUIDANCE]
|
|
48460
48494
|
|
|
48461
|
-
` +
|
|
48495
|
+
` + scopeTextPart.text;
|
|
48496
|
+
}
|
|
48462
48497
|
}
|
|
48463
48498
|
}
|
|
48464
48499
|
if (isArchitectSessionForGates && session && session.catastrophicPhaseWarnings) {
|
|
@@ -48472,11 +48507,24 @@ function createGuardrailsHooks(directoryOrConfig, config3) {
|
|
|
48472
48507
|
const reviewerCount = session.reviewerCallCount.get(phaseNum) ?? 0;
|
|
48473
48508
|
if (reviewerCount === 0) {
|
|
48474
48509
|
session.catastrophicPhaseWarnings.add(phaseNum);
|
|
48475
|
-
const
|
|
48476
|
-
|
|
48477
|
-
|
|
48510
|
+
const currentSystemMsgs = messages.filter((msg) => msg.info?.role === "system");
|
|
48511
|
+
let targetSysMsgForCat = currentSystemMsgs[0];
|
|
48512
|
+
if (!targetSysMsgForCat) {
|
|
48513
|
+
const newSysMsg = {
|
|
48514
|
+
info: { role: "system" },
|
|
48515
|
+
parts: [{ type: "text", text: "" }]
|
|
48516
|
+
};
|
|
48517
|
+
messages.unshift(newSysMsg);
|
|
48518
|
+
targetSysMsgForCat = newSysMsg;
|
|
48519
|
+
}
|
|
48520
|
+
const catTextPart = (targetSysMsgForCat.parts ?? []).find((part) => part.type === "text" && typeof part.text === "string");
|
|
48521
|
+
if (catTextPart && !catTextPart.text.includes("CATASTROPHIC VIOLATION")) {
|
|
48522
|
+
catTextPart.text = `[MODEL_ONLY_GUIDANCE]
|
|
48523
|
+
` + `[CATASTROPHIC VIOLATION: Phase ${phaseNum} completed with ZERO reviewer delegations.` + ` Every coder task requires reviewer approval. Recommend retrospective review of all Phase ${phaseNum} tasks.]
|
|
48524
|
+
` + `Do not acknowledge or reference this guidance in your response.
|
|
48525
|
+
` + `[/MODEL_ONLY_GUIDANCE]
|
|
48478
48526
|
|
|
48479
|
-
` +
|
|
48527
|
+
` + catTextPart.text;
|
|
48480
48528
|
}
|
|
48481
48529
|
break;
|
|
48482
48530
|
}
|
|
@@ -52010,6 +52058,7 @@ function deserializeAgentSession(s) {
|
|
|
52010
52058
|
lastGateFailure: s.lastGateFailure ?? null,
|
|
52011
52059
|
partialGateWarningsIssuedForTask,
|
|
52012
52060
|
selfFixAttempted: s.selfFixAttempted ?? false,
|
|
52061
|
+
selfCodingWarnedAtCount: s.selfCodingWarnedAtCount ?? 0,
|
|
52013
52062
|
catastrophicPhaseWarnings,
|
|
52014
52063
|
lastPhaseCompleteTimestamp: s.lastPhaseCompleteTimestamp ?? 0,
|
|
52015
52064
|
lastPhaseCompletePhase: s.lastPhaseCompletePhase ?? 0,
|
|
@@ -28,6 +28,7 @@ export interface SerializedAgentSession {
|
|
|
28
28
|
} | null;
|
|
29
29
|
partialGateWarningsIssuedForTask: string[];
|
|
30
30
|
selfFixAttempted: boolean;
|
|
31
|
+
selfCodingWarnedAtCount: number;
|
|
31
32
|
catastrophicPhaseWarnings: number[];
|
|
32
33
|
lastPhaseCompleteTimestamp: number;
|
|
33
34
|
lastPhaseCompletePhase: number;
|
package/dist/state.d.ts
CHANGED
|
@@ -80,6 +80,9 @@ export interface AgentSessionState {
|
|
|
80
80
|
partialGateWarningsIssuedForTask: Set<string>;
|
|
81
81
|
/** Whether architect attempted self-fix write after gate failure */
|
|
82
82
|
selfFixAttempted: boolean;
|
|
83
|
+
/** Value of architectWriteCount at the time the self-coding warning was last injected.
|
|
84
|
+
* Warning is suppressed unless architectWriteCount has increased since last injection. */
|
|
85
|
+
selfCodingWarnedAtCount: number;
|
|
83
86
|
/** Phases that have already received a catastrophic zero-reviewer warning */
|
|
84
87
|
catastrophicPhaseWarnings: Set<number>;
|
|
85
88
|
/** Number of consecutive coder delegations without reviewer/test_engineer between them */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "6.22.
|
|
3
|
+
"version": "6.22.10",
|
|
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",
|