opencode-swarm 6.22.13 → 6.22.15
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 +10 -0
- package/dist/config/schema.d.ts +8 -0
- package/dist/index.js +63 -39
- package/dist/services/run-memory.d.ts +1 -1
- package/dist/tools/declare-scope.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -17078,6 +17078,16 @@ var GuardrailsConfigSchema = exports_external.object({
|
|
|
17078
17078
|
max_consecutive_errors: exports_external.number().min(2).max(20).default(5),
|
|
17079
17079
|
warning_threshold: exports_external.number().min(0.1).max(0.9).default(0.75),
|
|
17080
17080
|
idle_timeout_minutes: exports_external.number().min(5).max(240).default(60),
|
|
17081
|
+
qa_gates: exports_external.object({
|
|
17082
|
+
required_tools: exports_external.array(exports_external.string().min(1)).default([
|
|
17083
|
+
"diff",
|
|
17084
|
+
"syntax_check",
|
|
17085
|
+
"placeholder_scan",
|
|
17086
|
+
"lint",
|
|
17087
|
+
"pre_check_batch"
|
|
17088
|
+
]),
|
|
17089
|
+
require_reviewer_test_engineer: exports_external.boolean().default(true)
|
|
17090
|
+
}).optional(),
|
|
17081
17091
|
profiles: exports_external.record(exports_external.string(), GuardrailsProfileSchema).optional()
|
|
17082
17092
|
});
|
|
17083
17093
|
var ToolFilterConfigSchema = exports_external.object({
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -310,6 +310,10 @@ export declare const GuardrailsConfigSchema: z.ZodObject<{
|
|
|
310
310
|
max_consecutive_errors: z.ZodDefault<z.ZodNumber>;
|
|
311
311
|
warning_threshold: z.ZodDefault<z.ZodNumber>;
|
|
312
312
|
idle_timeout_minutes: z.ZodDefault<z.ZodNumber>;
|
|
313
|
+
qa_gates: z.ZodOptional<z.ZodObject<{
|
|
314
|
+
required_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
315
|
+
require_reviewer_test_engineer: z.ZodDefault<z.ZodBoolean>;
|
|
316
|
+
}, z.core.$strip>>;
|
|
313
317
|
profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
314
318
|
max_tool_calls: z.ZodOptional<z.ZodNumber>;
|
|
315
319
|
max_duration_minutes: z.ZodOptional<z.ZodNumber>;
|
|
@@ -541,6 +545,10 @@ export declare const PluginConfigSchema: z.ZodObject<{
|
|
|
541
545
|
max_consecutive_errors: z.ZodDefault<z.ZodNumber>;
|
|
542
546
|
warning_threshold: z.ZodDefault<z.ZodNumber>;
|
|
543
547
|
idle_timeout_minutes: z.ZodDefault<z.ZodNumber>;
|
|
548
|
+
qa_gates: z.ZodOptional<z.ZodObject<{
|
|
549
|
+
required_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
550
|
+
require_reviewer_test_engineer: z.ZodDefault<z.ZodBoolean>;
|
|
551
|
+
}, z.core.$strip>>;
|
|
544
552
|
profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
545
553
|
max_tool_calls: z.ZodOptional<z.ZodNumber>;
|
|
546
554
|
max_duration_minutes: z.ZodOptional<z.ZodNumber>;
|
package/dist/index.js
CHANGED
|
@@ -14791,6 +14791,16 @@ var init_schema = __esm(() => {
|
|
|
14791
14791
|
max_consecutive_errors: exports_external.number().min(2).max(20).default(5),
|
|
14792
14792
|
warning_threshold: exports_external.number().min(0.1).max(0.9).default(0.75),
|
|
14793
14793
|
idle_timeout_minutes: exports_external.number().min(5).max(240).default(60),
|
|
14794
|
+
qa_gates: exports_external.object({
|
|
14795
|
+
required_tools: exports_external.array(exports_external.string().min(1)).default([
|
|
14796
|
+
"diff",
|
|
14797
|
+
"syntax_check",
|
|
14798
|
+
"placeholder_scan",
|
|
14799
|
+
"lint",
|
|
14800
|
+
"pre_check_batch"
|
|
14801
|
+
]),
|
|
14802
|
+
require_reviewer_test_engineer: exports_external.boolean().default(true)
|
|
14803
|
+
}).optional(),
|
|
14794
14804
|
profiles: exports_external.record(exports_external.string(), GuardrailsProfileSchema).optional()
|
|
14795
14805
|
});
|
|
14796
14806
|
ToolFilterConfigSchema = exports_external.object({
|
|
@@ -39065,8 +39075,8 @@ BATCHING DETECTION \u2014 you are batching if your coder delegation contains ANY
|
|
|
39065
39075
|
|
|
39066
39076
|
WHY: Each coder task goes through the FULL QA gate (Stage A + Stage B).
|
|
39067
39077
|
If you batch 3 tasks into 1 coder call, the QA gate runs once on the combined diff.
|
|
39068
|
-
The reviewer cannot distinguish which changes belong to which requirement.
|
|
39069
|
-
The test_engineer cannot write targeted tests for each behavior.
|
|
39078
|
+
The {{AGENT_PREFIX}}reviewer cannot distinguish which changes belong to which requirement.
|
|
39079
|
+
The {{AGENT_PREFIX}}test_engineer cannot write targeted tests for each behavior.
|
|
39070
39080
|
A failure in one part blocks the entire batch, wasting all the work.
|
|
39071
39081
|
|
|
39072
39082
|
SPLIT RULE: If your delegation draft has "and" in the TASK line, split it.
|
|
@@ -39083,7 +39093,7 @@ Two small delegations with two QA gates > one large delegation with one QA gate.
|
|
|
39083
39093
|
\u2717 "I'll do the simple parts, coder does the hard parts" \u2192 ALL parts go to coder. You are not a coder.
|
|
39084
39094
|
FAILURE COUNTING \u2014 increment the counter when:
|
|
39085
39095
|
- Coder submits code that fails any tool gate or pre_check_batch (gates_passed === false)
|
|
39086
|
-
- Coder submits code REJECTED by reviewer after being given the rejection reason
|
|
39096
|
+
- Coder submits code REJECTED by {{AGENT_PREFIX}}reviewer after being given the rejection reason
|
|
39087
39097
|
- Print "Coder attempt [N/{{QA_RETRY_LIMIT}}] on task [X.Y]" at every retry
|
|
39088
39098
|
- Reaching {{QA_RETRY_LIMIT}}: escalate to user with full failure history before writing code yourself
|
|
39089
39099
|
If you catch yourself reaching for a code editing tool: STOP. Delegate to {{AGENT_PREFIX}}coder.
|
|
@@ -39134,7 +39144,7 @@ Two small delegations with two QA gates > one large delegation with one QA gate.
|
|
|
39134
39144
|
LOW: do NOT consume directly. Either re-delegate to SME with specific query, OR flag to user as UNVERIFIED.
|
|
39135
39145
|
Never silently consume LOW-confidence result as verified.
|
|
39136
39146
|
7. **TIERED QA GATE** \u2014 Execute AFTER every coder task. Pipeline determined by change tier:
|
|
39137
|
-
NOTE: These gates are enforced by runtime hooks. If you skip the reviewer delegation,
|
|
39147
|
+
NOTE: These gates are enforced by runtime hooks. If you skip the {{AGENT_PREFIX}}reviewer delegation,
|
|
39138
39148
|
the next coder delegation will be BLOCKED by the plugin. This is not a suggestion \u2014
|
|
39139
39149
|
it is a hard enforcement mechanism.
|
|
39140
39150
|
|
|
@@ -39149,23 +39159,23 @@ TIER 0 \u2014 METADATA
|
|
|
39149
39159
|
|
|
39150
39160
|
TIER 1 \u2014 DOCUMENTATION
|
|
39151
39161
|
Match: *.md outside .swarm/, comments-only, prompt text, README, CHANGELOG
|
|
39152
|
-
Pipeline: Stage A. Stage B = reviewer\xD71 (gen). No security/test_engineer/adversarial.
|
|
39153
|
-
Rationale: Non-executable; reviewer validates.
|
|
39162
|
+
Pipeline: Stage A. Stage B = {{AGENT_PREFIX}}reviewer\xD71 (gen). No security/{{AGENT_PREFIX}}test_engineer/adversarial.
|
|
39163
|
+
Rationale: Non-executable; {{AGENT_PREFIX}}reviewer validates.
|
|
39154
39164
|
|
|
39155
39165
|
TIER 2 \u2014 STANDARD CODE
|
|
39156
39166
|
Match: src/ files not Tier 3, test files, config, package.json
|
|
39157
|
-
Pipeline: Full Stage A. Stage B = reviewer\xD71 + test_engineer\xD71 (verification).
|
|
39167
|
+
Pipeline: Full Stage A. Stage B = {{AGENT_PREFIX}}reviewer\xD71 + {{AGENT_PREFIX}}test_engineer\xD71 (verification).
|
|
39158
39168
|
Rationale: Default for executables; review catches regressions.
|
|
39159
39169
|
|
|
39160
39170
|
TIER 3 \u2014 CRITICAL
|
|
39161
39171
|
Match: architect*.ts, delegation*.ts, guardrails*.ts, adversarial*.ts, sanitiz*.ts, auth*, permission*, crypto*, secret*, security files
|
|
39162
|
-
Pipeline: Full Stage A. Stage B = reviewer\xD72 + test_engineer\xD72.
|
|
39172
|
+
Pipeline: Full Stage A. Stage B = {{AGENT_PREFIX}}reviewer\xD72 + {{AGENT_PREFIX}}test_engineer\xD72.
|
|
39163
39173
|
Rationale: Security paths need adversarial review.
|
|
39164
39174
|
|
|
39165
39175
|
CLASSIFICATION RULES:
|
|
39166
39176
|
- Multi-tier \u2192 use HIGHEST tier.
|
|
39167
39177
|
- Format: "Classification: TIER {N} \u2014 {label}"
|
|
39168
|
-
-
|
|
39178
|
+
- {{AGENT_PREFIX}}reviewer flags risk \u2192 escalate. Run delta, not current tier. Tier 3 is ceiling.
|
|
39169
39179
|
- Do NOT downgrade after entering pipeline.
|
|
39170
39180
|
- Misclassification = GATE_DELEGATION_BYPASS.
|
|
39171
39181
|
|
|
@@ -39185,8 +39195,8 @@ A task is complete ONLY when BOTH stages pass.
|
|
|
39185
39195
|
|
|
39186
39196
|
6f. **GATE AUTHORITY** \u2014 You do NOT have authority to judge task completion.
|
|
39187
39197
|
Task completion is determined EXCLUSIVELY by gate agent output:
|
|
39188
|
-
- reviewer returns APPROVED
|
|
39189
|
-
- test_engineer returns PASS
|
|
39198
|
+
- {{AGENT_PREFIX}}reviewer returns APPROVED
|
|
39199
|
+
- {{AGENT_PREFIX}}test_engineer returns PASS
|
|
39190
39200
|
- pre_check_batch returns gates_passed: true
|
|
39191
39201
|
|
|
39192
39202
|
Your role is to DELEGATE to gate agents and RECORD their verdicts.
|
|
@@ -39231,7 +39241,7 @@ You may NOT write to plan.md/plan.json to change task completion status or phase
|
|
|
39231
39241
|
"I'll just mark it done directly" is a bypass \u2014 equivalent to GATE_DELEGATION_BYPASS.
|
|
39232
39242
|
|
|
39233
39243
|
6i. **DELEGATION DISCIPLINE**
|
|
39234
|
-
When delegating to gate agents (reviewer, test_engineer, critic), your message MUST contain ONLY:
|
|
39244
|
+
When delegating to gate agents ({{AGENT_PREFIX}}reviewer, {{AGENT_PREFIX}}test_engineer, {{AGENT_PREFIX}}critic), your message MUST contain ONLY:
|
|
39235
39245
|
- What to review/test/analyze
|
|
39236
39246
|
- Acceptance criteria
|
|
39237
39247
|
- Technical context (files changed, requirements)
|
|
@@ -39249,13 +39259,13 @@ Delegation is a handoff, not a negotiation. State facts, let agents decide.
|
|
|
39249
39259
|
<!-- BEHAVIORAL_GUIDANCE_START -->
|
|
39250
39260
|
PARTIAL GATE RATIONALIZATIONS \u2014 automated gates \u2260 agent review. Running SOME gates is NOT compliance:
|
|
39251
39261
|
\u2717 "I ran pre_check_batch so the code is verified" \u2192 pre_check_batch does NOT replace {{AGENT_PREFIX}}reviewer or {{AGENT_PREFIX}}test_engineer
|
|
39252
|
-
\u2717 "syntax_check passed, good enough" \u2192 syntax_check catches syntax.
|
|
39262
|
+
\u2717 "syntax_check passed, good enough" \u2192 syntax_check catches syntax. {{AGENT_PREFIX}}reviewer catches logic. {{AGENT_PREFIX}}test_engineer catches behavior. All three are required.
|
|
39253
39263
|
\u2717 "The mechanical gates passed, skip the agent gates" \u2192 automated tools miss logic errors, security flaws, and edge cases that agent review catches
|
|
39254
39264
|
\u2717 "It's Phase 6+, the codebase is stable now" \u2192 complacency after successful phases is the #1 predictor of shipped bugs. Phase 6 needs MORE review, not less.
|
|
39255
39265
|
\u2717 "I'll just run the fast gates" \u2192 speed of a gate does not determine whether it is required
|
|
39256
39266
|
\u2717 "5 phases passed clean, this one will be fine" \u2192 past success does not predict future correctness
|
|
39257
39267
|
|
|
39258
|
-
Running syntax_check + pre_check_batch without reviewer + test_engineer is a PARTIAL GATE VIOLATION.
|
|
39268
|
+
Running syntax_check + pre_check_batch without {{AGENT_PREFIX}}reviewer + {{AGENT_PREFIX}}test_engineer is a PARTIAL GATE VIOLATION.
|
|
39259
39269
|
It is the same severity as skipping all gates. The QA gate is ALL steps or NONE.
|
|
39260
39270
|
<!-- BEHAVIORAL_GUIDANCE_END -->
|
|
39261
39271
|
|
|
@@ -39695,8 +39705,8 @@ All other gates: failure \u2192 return to coder. No self-fixes. No workarounds.
|
|
|
39695
39705
|
- sast_scan (static security analysis)
|
|
39696
39706
|
- quality_budget (maintainability metrics)
|
|
39697
39707
|
\u2192 Returns { gates_passed, lint, secretscan, sast_scan, quality_budget, total_duration_ms }
|
|
39698
|
-
\u2192 If gates_passed === false: read individual tool results, identify which tool(s) failed, return structured rejection to
|
|
39699
|
-
\u2192 If gates_passed === true: proceed to
|
|
39708
|
+
\u2192 If gates_passed === false: read individual tool results, identify which tool(s) failed, return structured rejection to {{AGENT_PREFIX}}coder with specific tool failures. Do NOT call {{AGENT_PREFIX}}reviewer.
|
|
39709
|
+
\u2192 If gates_passed === true: proceed to {{AGENT_PREFIX}}reviewer.
|
|
39700
39710
|
\u2192 REQUIRED: Print "pre_check_batch: [PASS \u2014 all gates passed | FAIL \u2014 [gate]: [details]]"
|
|
39701
39711
|
|
|
39702
39712
|
\u26A0\uFE0F pre_check_batch SCOPE BOUNDARY:
|
|
@@ -39712,7 +39722,7 @@ pre_check_batch does NOT run and does NOT replace:
|
|
|
39712
39722
|
gates_passed: true means "automated static checks passed."
|
|
39713
39723
|
It does NOT mean "code is reviewed." It does NOT mean "code is tested."
|
|
39714
39724
|
After pre_check_batch passes, you MUST STILL delegate to {{AGENT_PREFIX}}reviewer.
|
|
39715
|
-
Treating pre_check_batch as a substitute for reviewer is a PROCESS VIOLATION.
|
|
39725
|
+
Treating pre_check_batch as a substitute for {{AGENT_PREFIX}}reviewer is a PROCESS VIOLATION.
|
|
39716
39726
|
|
|
39717
39727
|
5j. {{AGENT_PREFIX}}reviewer - General review. REJECTED (< {{QA_RETRY_LIMIT}}) \u2192 coder retry. REJECTED ({{QA_RETRY_LIMIT}}) \u2192 escalate.
|
|
39718
39728
|
\u2192 REQUIRED: Print "reviewer: [APPROVED | REJECTED \u2014 reason]"
|
|
@@ -39722,7 +39732,7 @@ Treating pre_check_batch as a substitute for reviewer is a PROCESS VIOLATION.
|
|
|
39722
39732
|
5l. {{AGENT_PREFIX}}test_engineer - Verification tests. FAIL \u2192 coder retry from 5g.
|
|
39723
39733
|
\u2192 REQUIRED: Print "testengineer-verification: [PASS N/N | FAIL \u2014 details]"
|
|
39724
39734
|
{{ADVERSARIAL_TEST_STEP}}
|
|
39725
|
-
5n. COVERAGE CHECK: If test_engineer reports coverage < 70% \u2192 delegate {{AGENT_PREFIX}}test_engineer for an additional test pass targeting uncovered paths. This is a soft guideline; use judgment for trivial tasks.
|
|
39735
|
+
5n. COVERAGE CHECK: If {{AGENT_PREFIX}}test_engineer reports coverage < 70% \u2192 delegate {{AGENT_PREFIX}}test_engineer for an additional test pass targeting uncovered paths. This is a soft guideline; use judgment for trivial tasks.
|
|
39726
39736
|
|
|
39727
39737
|
PRE-COMMIT RULE \u2014 Before ANY commit or push:
|
|
39728
39738
|
You MUST answer YES to ALL of the following:
|
|
@@ -39816,9 +39826,9 @@ CATASTROPHIC VIOLATION CHECK \u2014 ask yourself at EVERY phase boundary (MODE:
|
|
|
39816
39826
|
"Have I delegated to {{AGENT_PREFIX}}reviewer at least once this phase?"
|
|
39817
39827
|
If the answer is NO: you have a catastrophic process violation.
|
|
39818
39828
|
STOP. Do not proceed to the next phase. Inform the user:
|
|
39819
|
-
"\u26D4 PROCESS VIOLATION: Phase [N] completed with zero reviewer delegations.
|
|
39829
|
+
"\u26D4 PROCESS VIOLATION: Phase [N] completed with zero {{AGENT_PREFIX}}reviewer delegations.
|
|
39820
39830
|
All code changes in this phase are unreviewed. Recommend retrospective review before proceeding."
|
|
39821
|
-
This is not optional. Zero reviewer calls in a phase is always a violation.
|
|
39831
|
+
This is not optional. Zero {{AGENT_PREFIX}}reviewer calls in a phase is always a violation.
|
|
39822
39832
|
There is no project where code ships without review.
|
|
39823
39833
|
|
|
39824
39834
|
### Blockers
|
|
@@ -39863,8 +39873,8 @@ When writing output consumed by other agents, prefix with:
|
|
|
39863
39873
|
[FOR: agent1, agent2] \u2014 relevant to specific agents
|
|
39864
39874
|
[FOR: ALL] \u2014 relevant to all agents
|
|
39865
39875
|
Examples:
|
|
39866
|
-
[FOR: reviewer, test_engineer] "Added validation \u2014 needs safety check"
|
|
39867
|
-
[FOR: architect] "Research: Tree-sitter supports TypeScript AST"
|
|
39876
|
+
[FOR: {{AGENT_PREFIX}}reviewer, {{AGENT_PREFIX}}test_engineer] "Added validation \u2014 needs safety check"
|
|
39877
|
+
[FOR: {{AGENT_PREFIX}}architect] "Research: Tree-sitter supports TypeScript AST"
|
|
39868
39878
|
[FOR: ALL] "Breaking change: StateManager renamed"
|
|
39869
39879
|
This tag is informational in v6.19; v6.20 will use for context filtering.
|
|
39870
39880
|
`;
|
|
@@ -47997,6 +48007,14 @@ function createGuardrailsHooks(directoryOrConfig, config3) {
|
|
|
47997
48007
|
};
|
|
47998
48008
|
}
|
|
47999
48009
|
const cfg = guardrailsConfig;
|
|
48010
|
+
const requiredQaGates = cfg.qa_gates?.required_tools ?? [
|
|
48011
|
+
"diff",
|
|
48012
|
+
"syntax_check",
|
|
48013
|
+
"placeholder_scan",
|
|
48014
|
+
"lint",
|
|
48015
|
+
"pre_check_batch"
|
|
48016
|
+
];
|
|
48017
|
+
const requireReviewerAndTestEngineer = cfg.qa_gates?.require_reviewer_test_engineer ?? true;
|
|
48000
48018
|
return {
|
|
48001
48019
|
toolBefore: async (input, output) => {
|
|
48002
48020
|
const currentSession = swarmState.agentSessions.get(input.sessionID);
|
|
@@ -48416,18 +48434,11 @@ function createGuardrailsHooks(directoryOrConfig, config3) {
|
|
|
48416
48434
|
const taskId = getCurrentTaskId(sessionId);
|
|
48417
48435
|
if (!session.partialGateWarningsIssuedForTask.has(taskId)) {
|
|
48418
48436
|
const gates = session.gateLog.get(taskId);
|
|
48419
|
-
const REQUIRED_GATES = [
|
|
48420
|
-
"diff",
|
|
48421
|
-
"syntax_check",
|
|
48422
|
-
"placeholder_scan",
|
|
48423
|
-
"lint",
|
|
48424
|
-
"pre_check_batch"
|
|
48425
|
-
];
|
|
48426
48437
|
const missingGates = [];
|
|
48427
48438
|
if (!gates) {
|
|
48428
|
-
missingGates.push(...
|
|
48439
|
+
missingGates.push(...requiredQaGates);
|
|
48429
48440
|
} else {
|
|
48430
|
-
for (const gate of
|
|
48441
|
+
for (const gate of requiredQaGates) {
|
|
48431
48442
|
if (!gates.has(gate)) {
|
|
48432
48443
|
missingGates.push(gate);
|
|
48433
48444
|
}
|
|
@@ -48442,7 +48453,8 @@ function createGuardrailsHooks(directoryOrConfig, config3) {
|
|
|
48442
48453
|
}
|
|
48443
48454
|
} catch {}
|
|
48444
48455
|
const hasReviewerDelegation = (session.reviewerCallCount.get(currentPhaseForCheck) ?? 0) > 0;
|
|
48445
|
-
|
|
48456
|
+
const missingQaDelegation = requireReviewerAndTestEngineer && !hasReviewerDelegation;
|
|
48457
|
+
if (missingGates.length > 0 || missingQaDelegation) {
|
|
48446
48458
|
const currentSystemMsgs = messages.filter((msg) => msg.info?.role === "system");
|
|
48447
48459
|
let targetSysMsgForGate = currentSystemMsgs[0];
|
|
48448
48460
|
if (!targetSysMsgForGate) {
|
|
@@ -48456,7 +48468,7 @@ function createGuardrailsHooks(directoryOrConfig, config3) {
|
|
|
48456
48468
|
const sysTextPart = (targetSysMsgForGate.parts ?? []).find((part) => part.type === "text" && typeof part.text === "string");
|
|
48457
48469
|
if (sysTextPart && !sysTextPart.text.includes("PARTIAL GATE VIOLATION")) {
|
|
48458
48470
|
const missing = [...missingGates];
|
|
48459
|
-
if (
|
|
48471
|
+
if (missingQaDelegation) {
|
|
48460
48472
|
missing.push("reviewer/test_engineer (no delegations this phase)");
|
|
48461
48473
|
}
|
|
48462
48474
|
session.partialGateWarningsIssuedForTask.add(taskId);
|
|
@@ -48496,7 +48508,7 @@ function createGuardrailsHooks(directoryOrConfig, config3) {
|
|
|
48496
48508
|
}
|
|
48497
48509
|
}
|
|
48498
48510
|
}
|
|
48499
|
-
if (isArchitectSessionForGates && session && session.catastrophicPhaseWarnings) {
|
|
48511
|
+
if (isArchitectSessionForGates && session && session.catastrophicPhaseWarnings && requireReviewerAndTestEngineer) {
|
|
48500
48512
|
try {
|
|
48501
48513
|
const plan = await loadPlan(directory);
|
|
48502
48514
|
if (plan?.phases) {
|
|
@@ -49814,6 +49826,14 @@ function rankCandidates(candidates, config3) {
|
|
|
49814
49826
|
|
|
49815
49827
|
// src/hooks/system-enhancer.ts
|
|
49816
49828
|
init_utils2();
|
|
49829
|
+
function extractAgentPrefix(fullAgentName) {
|
|
49830
|
+
if (!fullAgentName)
|
|
49831
|
+
return "";
|
|
49832
|
+
const baseName = stripKnownSwarmPrefix(fullAgentName);
|
|
49833
|
+
if (baseName.length >= fullAgentName.length)
|
|
49834
|
+
return "";
|
|
49835
|
+
return fullAgentName.substring(0, fullAgentName.length - baseName.length);
|
|
49836
|
+
}
|
|
49817
49837
|
function estimateContentType(text) {
|
|
49818
49838
|
if (text.includes("```") || text.includes("function ") || text.includes("const ")) {
|
|
49819
49839
|
return "code";
|
|
@@ -50153,10 +50173,12 @@ ${handoffBlock}`);
|
|
|
50153
50173
|
const activeAgent_hf1 = swarmState.activeAgent.get(_input.sessionID ?? "");
|
|
50154
50174
|
const baseRole = activeAgent_hf1 ? stripKnownSwarmPrefix(activeAgent_hf1) : null;
|
|
50155
50175
|
if (baseRole === "coder" || baseRole === "test_engineer") {
|
|
50156
|
-
|
|
50176
|
+
const hf1Prefix = extractAgentPrefix(activeAgent_hf1);
|
|
50177
|
+
tryInject(`[SWARM CONFIG] You must NOT run build, test, lint, or type-check commands (npm run build, bun test, npx tsc, eslint, etc.). Make ONLY the code changes specified in your task. Verification is handled by the ${hf1Prefix}reviewer agent \u2014 do not self-verify. If your task explicitly asks you to run a specific command, that is the only exception.`);
|
|
50157
50178
|
}
|
|
50158
50179
|
if (baseRole === "architect" || baseRole === null) {
|
|
50159
|
-
|
|
50180
|
+
const hf1Prefix = extractAgentPrefix(activeAgent_hf1);
|
|
50181
|
+
tryInject(`[SWARM CONFIG] You must NEVER run the full test suite or batch test files. If you need to verify changes, run ONLY the specific test files for code YOU modified in this session \u2014 one file at a time, strictly serial. Do not run tests from directories or files unrelated to your changes. Do not run bun test without an explicit file path. When possible, delegate test execution to the ${hf1Prefix}test_engineer agent instead of running tests yourself.`);
|
|
50160
50182
|
}
|
|
50161
50183
|
if (config3.adversarial_detection?.enabled !== false) {
|
|
50162
50184
|
const activeAgent_adv = swarmState.activeAgent.get(_input.sessionID ?? "");
|
|
@@ -50185,7 +50207,8 @@ ${handoffBlock}`);
|
|
|
50185
50207
|
const isArchitectForPreflight = !activeAgent_preflight || stripKnownSwarmPrefix(activeAgent_preflight) === "architect";
|
|
50186
50208
|
if (isArchitectForPreflight) {
|
|
50187
50209
|
if (config3.pipeline?.parallel_precheck !== false) {
|
|
50188
|
-
|
|
50210
|
+
const preflightPrefix = extractAgentPrefix(activeAgent_preflight);
|
|
50211
|
+
tryInject(`[SWARM HINT] Parallel pre-check enabled: call pre_check_batch(files, directory) after lint --fix and build_check to run lint:check + secretscan + sast_scan + quality_budget concurrently (max 4 parallel). Check gates_passed before calling ${preflightPrefix}reviewer.`);
|
|
50189
50212
|
} else {
|
|
50190
50213
|
tryInject("[SWARM HINT] Parallel pre-check disabled: run lint:check \u2192 secretscan \u2192 sast_scan \u2192 quality_budget sequentially.");
|
|
50191
50214
|
}
|
|
@@ -50533,7 +50556,8 @@ ${handoffBlock}`;
|
|
|
50533
50556
|
const activeAgent_preflight_b = swarmState.activeAgent.get(sessionId_preflight_b ?? "");
|
|
50534
50557
|
const isArchitectForPreflight_b = !activeAgent_preflight_b || stripKnownSwarmPrefix(activeAgent_preflight_b) === "architect";
|
|
50535
50558
|
if (isArchitectForPreflight_b) {
|
|
50536
|
-
const
|
|
50559
|
+
const preflightPrefix_b = extractAgentPrefix(activeAgent_preflight_b);
|
|
50560
|
+
const hintText_b = config3.pipeline?.parallel_precheck !== false ? `[SWARM HINT] Parallel pre-check enabled: call pre_check_batch(files, directory) after lint --fix and build_check to run lint:check + secretscan + sast_scan + quality_budget concurrently (max 4 parallel). Check gates_passed before calling ${preflightPrefix_b}reviewer.` : "[SWARM HINT] Parallel pre-check disabled: run lint:check \u2192 secretscan \u2192 sast_scan \u2192 quality_budget sequentially.";
|
|
50537
50561
|
candidates.push({
|
|
50538
50562
|
id: `candidate-${idCounter++}`,
|
|
50539
50563
|
kind: "phase",
|
|
@@ -53114,7 +53138,7 @@ async function executeDeclareScope(args2, fallbackDir) {
|
|
|
53114
53138
|
};
|
|
53115
53139
|
}
|
|
53116
53140
|
var declare_scope = createSwarmTool({
|
|
53117
|
-
description: "Declare the file scope for the next coder delegation. " + "Sets the list of files the coder is permitted to modify for a specific task. " + "Must be called before delegating to
|
|
53141
|
+
description: "Declare the file scope for the next coder delegation. " + "Sets the list of files the coder is permitted to modify for a specific task. " + "Must be called before delegating to coder to enable scope containment checking.",
|
|
53118
53142
|
args: {
|
|
53119
53143
|
taskId: tool.schema.string().min(1).regex(/^\d+\.\d+(\.\d+)*$/, "Task ID must be in N.M or N.M.P format").describe('Task ID for which scope is being declared, e.g. "1.1", "1.2.3"'),
|
|
53120
53144
|
files: tool.schema.array(tool.schema.string().min(1).max(4096)).min(1).describe("Array of file paths the coder is permitted to modify"),
|
|
@@ -14,7 +14,7 @@ export interface RunMemoryEntry {
|
|
|
14
14
|
taskId: string;
|
|
15
15
|
/** SHA256 hash of taskId + sorted file targets, first 8 chars */
|
|
16
16
|
taskFingerprint: string;
|
|
17
|
-
/** Which agent executed the task (e.g. "
|
|
17
|
+
/** Which agent executed the task (e.g. "coder") */
|
|
18
18
|
agent: string;
|
|
19
19
|
/** Outcome of the task execution */
|
|
20
20
|
outcome: 'pass' | 'fail' | 'retry' | 'skip';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Declare scope tool for setting the file scope for coder delegations.
|
|
3
3
|
* Implements FR-010: Declare coder scope before delegation.
|
|
4
|
-
* This tool must be called before delegating to
|
|
4
|
+
* This tool must be called before delegating to coder to enable scope containment checking.
|
|
5
5
|
*/
|
|
6
6
|
import { type ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
7
7
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "6.22.
|
|
3
|
+
"version": "6.22.15",
|
|
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",
|