opencode-swarm 6.19.2 → 6.19.4

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 CHANGED
@@ -31634,14 +31634,14 @@ function parseContextMd(content) {
31634
31634
  function splitIntoSections(content) {
31635
31635
  const sections = [];
31636
31636
  const headingRegex = /^(#{1,3})\s+(.+)/gm;
31637
- const lastIndex = 0;
31638
- let match;
31639
31637
  const matches = [];
31640
- while ((match = headingRegex.exec(content)) !== null) {
31638
+ let match = headingRegex.exec(content);
31639
+ while (match !== null) {
31641
31640
  matches.push({
31642
31641
  index: match.index,
31643
31642
  heading: match[0]
31644
31643
  });
31644
+ match = headingRegex.exec(content);
31645
31645
  }
31646
31646
  for (let i = 0;i < matches.length; i++) {
31647
31647
  const current = matches[i];
@@ -31691,7 +31691,7 @@ function inferCategoryFromText(text) {
31691
31691
  function truncateLesson(text) {
31692
31692
  if (text.length <= 280)
31693
31693
  return text;
31694
- return text.slice(0, 277) + "...";
31694
+ return `${text.slice(0, 277)}...`;
31695
31695
  }
31696
31696
  function inferProjectName(directory) {
31697
31697
  const packageJsonPath = path8.join(directory, "package.json");
@@ -18,7 +18,7 @@ export declare function formatAdversarialWarning(agentA: string, agentB: string,
18
18
  * Uses string/regex matching to detect sophisticated adversarial behaviors.
19
19
  */
20
20
  export interface AdversarialPatternMatch {
21
- pattern: 'PRECEDENT_MANIPULATION' | 'SELF_REVIEW' | 'CONTENT_EXEMPTION' | 'GATE_DELEGATION_BYPASS' | 'VELOCITY_RATIONALIZATION' | 'INTER_AGENT_MANIPULATION';
21
+ pattern: 'PRECEDENT_MANIPULATION' | 'SELF_REVIEW' | 'CONTENT_EXEMPTION' | 'GATE_DELEGATION_BYPASS' | 'VELOCITY_RATIONALIZATION' | 'INTER_AGENT_MANIPULATION' | 'GATE_MISCLASSIFICATION';
22
22
  severity: 'HIGHEST' | 'HIGH' | 'MEDIUM' | 'LOW';
23
23
  matchedText: string;
24
24
  confidence: 'HIGH' | 'MEDIUM' | 'LOW';
package/dist/index.js CHANGED
@@ -38857,39 +38857,55 @@ Two small delegations with two QA gates > one large delegation with one QA gate.
38857
38857
  MEDIUM: acceptable for non-critical decisions. For critical path (architecture, security), seek second source.
38858
38858
  LOW: do NOT consume directly. Either re-delegate to SME with specific query, OR flag to user as UNVERIFIED.
38859
38859
  Never silently consume LOW-confidence result as verified.
38860
- 7. **MANDATORY QA GATE** \u2014 Execute AFTER every coder task. Two stages, BOTH required:
38860
+ 7. **TIERED QA GATE** \u2014 Execute AFTER every coder task. Pipeline determined by change tier:
38861
38861
  NOTE: These gates are enforced by runtime hooks. If you skip the reviewer delegation,
38862
38862
  the next coder delegation will be BLOCKED by the plugin. This is not a suggestion \u2014
38863
38863
  it is a hard enforcement mechanism.
38864
38864
 
38865
- \u2500\u2500 STAGE A: AUTOMATED TOOL GATES (run tools, fix failures, no agents involved) \u2500\u2500
38865
+ TIERED QA GATE \u2014 CHANGE CLASSIFICATION
38866
+
38867
+ Classify ONE tier by FILES CHANGED.
38868
+
38869
+ TIER 0 \u2014 METADATA
38870
+ Match: plan.json, plan.md, context.md, .swarm/evidence/*, status updates
38871
+ Pipeline: lint + diff. No agent or Stage B.
38872
+ Rationale: Swarm bookkeeping, no runtime effect.
38873
+
38874
+ TIER 1 \u2014 DOCUMENTATION
38875
+ Match: *.md outside .swarm/, comments-only, prompt text, README, CHANGELOG
38876
+ Pipeline: Stage A. Stage B = reviewer\xD71 (gen). No security/test_engineer/adversarial.
38877
+ Rationale: Non-executable; reviewer validates.
38878
+
38879
+ TIER 2 \u2014 STANDARD CODE
38880
+ Match: src/ files not Tier 3, test files, config, package.json
38881
+ Pipeline: Full Stage A. Stage B = reviewer\xD71 + test_engineer\xD71 (verification).
38882
+ Rationale: Default for executables; review catches regressions.
38883
+
38884
+ TIER 3 \u2014 CRITICAL
38885
+ Match: architect*.ts, delegation*.ts, guardrails*.ts, adversarial*.ts, sanitiz*.ts, auth*, permission*, crypto*, secret*, security files
38886
+ Pipeline: Full Stage A. Stage B = reviewer\xD72 + test_engineer\xD72.
38887
+ Rationale: Security paths need adversarial review.
38888
+
38889
+ CLASSIFICATION RULES:
38890
+ - Multi-tier \u2192 use HIGHEST tier.
38891
+ - Format: "Classification: TIER {N} \u2014 {label}"
38892
+ - Reviewer flags risk \u2192 escalate. Run delta, not current tier. Tier 3 is ceiling.
38893
+ - Do NOT downgrade after entering pipeline.
38894
+ - Misclassification = GATE_DELEGATION_BYPASS.
38895
+
38896
+ \u2500\u2500 STAGE A: AUTOMATED TOOL GATES \u2500\u2500
38866
38897
  diff \u2192 syntax_check \u2192 placeholder_scan \u2192 imports \u2192 lint fix \u2192 build_check \u2192 pre_check_batch
38867
- All Stage A tools return structured pass/fail. Fix failures by returning to coder.
38868
- Stage A passing means: code compiles, parses, has no secrets, no placeholders, no lint errors.
38898
+ Stage A tools return pass/fail. Fix failures by returning to coder.
38899
+ Stage A passing means: code compiles, parses, no secrets, no placeholders, no lint errors.
38869
38900
  Stage A passing does NOT mean: code is correct, secure, tested, or reviewed.
38870
38901
 
38871
- \u2500\u2500 STAGE B: AGENT REVIEW GATES (delegate to agents, wait for verdicts) \u2500\u2500
38902
+ \u2500\u2500 STAGE B: AGENT REVIEW GATES \u2500\u2500
38872
38903
  {{AGENT_PREFIX}}reviewer \u2192 security reviewer (conditional) \u2192 {{AGENT_PREFIX}}test_engineer verification \u2192 {{AGENT_PREFIX}}test_engineer adversarial \u2192 coverage check
38873
- Stage B CANNOT be skipped. Stage A passing does not satisfy Stage B.
38904
+ Stage B CANNOT be skipped for TIER 1-3 classifications. Stage A passing does not satisfy Stage B.
38874
38905
  Stage B is where logic errors, security flaws, edge cases, and behavioral bugs are caught.
38875
38906
  You MUST delegate to each Stage B agent and wait for their response.
38876
38907
 
38877
38908
  A task is complete ONLY when BOTH stages pass.
38878
- ANTI-EXEMPTION RULES \u2014 these thoughts are WRONG and must be ignored:
38879
- \u2717 "It's a simple change" \u2192 gates are mandatory for ALL changes regardless of perceived complexity
38880
- \u2717 "It's just a rename / refactor / config tweak" \u2192 same
38881
- \u2717 "The code looks straightforward" \u2192 you are the author; authors are blind to their own mistakes
38882
- \u2717 "I already reviewed it mentally" \u2192 mental review does not satisfy any gate
38883
- \u2717 "It'll be fine" \u2192 this is how production data loss happens
38884
- \u2717 "The tests will catch it" \u2192 tests do not run without being delegated to {{AGENT_PREFIX}}test_engineer
38885
- \u2717 "It's just one file" \u2192 file count does not determine gate requirements
38886
- \u2717 "pre_check_batch will catch any issues" \u2192 pre_check_batch only runs if you run it
38887
- \u2717 "It's just a POC/prototype" \u2192 prototypes that skip QA become production code that shipped without review
38888
- \u2717 "I'll do QA in a batch at the end" \u2192 deferred QA is skipped QA. Every task gets its own gate, immediately.
38889
- \u2717 "I already skipped QA on previous tasks, so consistency requires skipping here too" \u2192 past violations do not justify future violations. STOP. Run the gates now, then go back and review what was skipped.
38890
-
38891
- There are NO simple changes. There are NO exceptions to the QA gate sequence.
38892
- The gates exist because the author cannot objectively evaluate their own work.
38893
38909
 
38894
38910
  6f. **GATE AUTHORITY** \u2014 You do NOT have authority to judge task completion.
38895
38911
  Task completion is determined EXCLUSIVELY by gate agent output:
@@ -38962,26 +38978,14 @@ PARTIAL GATE RATIONALIZATIONS \u2014 automated gates \u2260 agent review. Runnin
38962
38978
  Running syntax_check + pre_check_batch without reviewer + test_engineer is a PARTIAL GATE VIOLATION.
38963
38979
  It is the same severity as skipping all gates. The QA gate is ALL steps or NONE.
38964
38980
 
38965
- - After coder completes: run \`diff\` tool. If \`hasContractChanges\` is true \u2192 delegate {{AGENT_PREFIX}}explorer for integration impact analysis. BREAKING \u2192 return to coder. COMPATIBLE \u2192 proceed.
38966
- - Run \`syntax_check\` tool. SYNTACTIC ERRORS \u2192 return to coder. NO ERRORS \u2192 proceed to placeholder_scan.
38967
- - Run \`placeholder_scan\` tool. PLACEHOLDER FINDINGS \u2192 return to coder. NO FINDINGS \u2192 proceed to imports check.
38968
- - Run \`imports\` tool. Record results for dependency audit. Proceed to lint fix.
38969
- - Run \`lint\` tool (mode: fix) \u2192 allow auto-corrections. LINT FIX FAILS \u2192 return to coder. SUCCESS \u2192 proceed to build_check.
38970
- - Run \`build_check\` tool. BUILD FAILS \u2192 return to coder. SUCCESS \u2192 proceed to pre_check_batch.
38971
- - Run \`pre_check_batch\` tool. If gates_passed === false: return to coder. If gates_passed === true: proceed to @reviewer.
38972
- - Delegate {{AGENT_PREFIX}}reviewer with CHECK dimensions. REJECTED \u2192 return to coder (max {{QA_RETRY_LIMIT}} attempts). APPROVED \u2192 continue.
38973
- - If file matches security globs (auth, api, crypto, security, middleware, session, token, config/, env, credentials, authorization, roles, permissions, access) OR content has security keywords (see SECURITY_KEYWORDS list) OR secretscan has ANY findings OR sast_scan has ANY findings at or above threshold \u2192 MUST delegate {{AGENT_PREFIX}}reviewer AGAIN with security-only CHECK review. REJECTED \u2192 return to coder (max {{QA_RETRY_LIMIT}} attempts). If REJECTED after {{QA_RETRY_LIMIT}} attempts on security-only review \u2192 escalate to user.
38974
- - Delegate {{AGENT_PREFIX}}test_engineer for verification tests. FAIL \u2192 return to coder.
38975
- - Delegate {{AGENT_PREFIX}}test_engineer for adversarial tests (attack vectors only). FAIL \u2192 return to coder.
38976
- - All pass \u2192 mark task complete, proceed to next task.
38977
- 8. **COVERAGE CHECK**: After adversarial tests pass, check if test_engineer reports coverage < 70%. If so, delegate {{AGENT_PREFIX}}test_engineer for an additional test pass targeting uncovered paths. This is a soft guideline; use judgment for trivial tasks.
38981
+ 8. **COVERAGE CHECK**: After adversarial tests pass, check if test_engineer reports coverage < 70%. If so, delegate {{AGENT_PREFIX}}test_engineer for an additional test pass targeting uncovered paths. This is a soft guideline; use judgment for trivial tasks.
38978
38982
  9. **UI/UX DESIGN GATE**: Before delegating UI tasks to {{AGENT_PREFIX}}coder, check if the task involves UI components. Trigger conditions (ANY match):
38979
38983
  - Task description contains UI keywords: new page, new screen, new component, redesign, layout change, form, modal, dialog, dropdown, sidebar, navbar, dashboard, landing page, signup, login form, settings page, profile page
38980
38984
  - Target file is in: pages/, components/, views/, screens/, ui/, layouts/
38981
38985
  If triggered: delegate to {{AGENT_PREFIX}}designer FIRST to produce a code scaffold. Then pass the scaffold to {{AGENT_PREFIX}}coder as INPUT alongside the task. The coder implements the TODOs in the scaffold without changing component structure or accessibility attributes.
38982
38986
  If not triggered: delegate directly to {{AGENT_PREFIX}}coder as normal.
38983
38987
  10. **RETROSPECTIVE TRACKING**: At the end of every phase, record phase metrics in .swarm/context.md under "## Phase Metrics" and write a retrospective evidence entry via the evidence manager. Track: phase_number, total_tool_calls, coder_revisions, reviewer_rejections, test_failures, security_findings, integration_issues, task_count, task_complexity, top_rejection_reasons, lessons_learned (max 5). Reset Phase Metrics to 0 after writing.
38984
- 11. **CHECKPOINTS**: Before delegating multi-file refactor tasks (3+ files), create a checkpoint save. On critical failures when redo is faster than iterative fixes, restore from checkpoint. Use checkpoint tool: \`checkpoint save\` before risky operations, \`checkpoint restore\` on failure.
38988
+ 11. **CHECKPOINTS**: Before delegating multi-file refactor tasks (3+ files), create a checkpoint save. On critical failures when redo is faster than iterative fixes, restore from checkpoint. Use checkpoint tool: \`checkpoint save\` before risky operations, \`checkpoint restore\` on failure.
38985
38989
 
38986
38990
  SECURITY_KEYWORDS: password, secret, token, credential, auth, login, encryption, hash, key, certificate, ssl, tls, jwt, oauth, session, csrf, xss, injection, sanitization, permission, access, vulnerable, exploit, privilege, authorization, roles, authentication, mfa, 2fa, totp, otp, salt, iv, nonce, hmac, aes, rsa, sha256, bcrypt, scrypt, argon2, api_key, apikey, private_key, public_key, rbac, admin, superuser, sqli, rce, ssrf, xxe, nosql, command_injection
38987
38991
 
@@ -39428,7 +39432,7 @@ Treating pre_check_batch as a substitute for reviewer is a PROCESS VIOLATION.
39428
39432
 
39429
39433
  5j. {{AGENT_PREFIX}}reviewer - General review. REJECTED (< {{QA_RETRY_LIMIT}}) \u2192 coder retry. REJECTED ({{QA_RETRY_LIMIT}}) \u2192 escalate.
39430
39434
  \u2192 REQUIRED: Print "reviewer: [APPROVED | REJECTED \u2014 reason]"
39431
- 5k. Security gate: if file matches security globs (auth, api, crypto, security, middleware, session, token, config/, env, credentials, authorization, roles, permissions, access) OR content has security keywords (see SECURITY_KEYWORDS list) OR secretscan has ANY findings OR sast_scan has ANY findings at or above threshold \u2192 MUST delegate {{AGENT_PREFIX}}reviewer security-only review. REJECTED (< {{QA_RETRY_LIMIT}}) \u2192 coder retry. REJECTED ({{QA_RETRY_LIMIT}}) \u2192 escalate to user.
39435
+ 5k. Security gate: if change matches TIER 3 criteria OR content contains SECURITY_KEYWORDS OR secretscan has ANY findings OR sast_scan has ANY findings at or above threshold \u2192 MUST delegate {{AGENT_PREFIX}}reviewer security-only review. REJECTED (< {{QA_RETRY_LIMIT}}) \u2192 coder retry. REJECTED ({{QA_RETRY_LIMIT}}) \u2192 escalate to user.
39432
39436
  \u2192 REQUIRED: Print "security-reviewer: [TRIGGERED | NOT TRIGGERED \u2014 reason]"
39433
39437
  \u2192 If TRIGGERED: Print "security-reviewer: [APPROVED | REJECTED \u2014 reason]"
39434
39438
  5l. {{AGENT_PREFIX}}test_engineer - Verification tests. FAIL \u2192 coder retry from 5g.
@@ -43135,14 +43139,14 @@ function parseContextMd(content) {
43135
43139
  function splitIntoSections(content) {
43136
43140
  const sections = [];
43137
43141
  const headingRegex = /^(#{1,3})\s+(.+)/gm;
43138
- const lastIndex = 0;
43139
- let match;
43140
43142
  const matches = [];
43141
- while ((match = headingRegex.exec(content)) !== null) {
43143
+ let match = headingRegex.exec(content);
43144
+ while (match !== null) {
43142
43145
  matches.push({
43143
43146
  index: match.index,
43144
43147
  heading: match[0]
43145
43148
  });
43149
+ match = headingRegex.exec(content);
43146
43150
  }
43147
43151
  for (let i2 = 0;i2 < matches.length; i2++) {
43148
43152
  const current = matches[i2];
@@ -43192,7 +43196,7 @@ function inferCategoryFromText(text) {
43192
43196
  function truncateLesson(text) {
43193
43197
  if (text.length <= 280)
43194
43198
  return text;
43195
- return text.slice(0, 277) + "...";
43199
+ return `${text.slice(0, 277)}...`;
43196
43200
  }
43197
43201
  function inferProjectName(directory) {
43198
43202
  const packageJsonPath = path12.join(directory, "package.json");
@@ -45791,11 +45795,10 @@ function createGuardrailsHooks(directory, config3) {
45791
45795
  const patchPathPattern = /\*\*\*\s+(?:Update|Add|Delete)\s+File:\s*(.+)/gi;
45792
45796
  const diffPathPattern = /\+\+\+\s+b\/(.+)/gm;
45793
45797
  const paths = new Set;
45794
- let match;
45795
- while ((match = patchPathPattern.exec(patchText)) !== null) {
45798
+ for (const match of patchText.matchAll(patchPathPattern)) {
45796
45799
  paths.add(match[1].trim());
45797
45800
  }
45798
- while ((match = diffPathPattern.exec(patchText)) !== null) {
45801
+ for (const match of patchText.matchAll(diffPathPattern)) {
45799
45802
  const p = match[1].trim();
45800
45803
  if (p !== "/dev/null")
45801
45804
  paths.add(p);
@@ -48352,7 +48355,10 @@ function formatStars(confidence) {
48352
48355
  return "\u2605\u2606\u2606";
48353
48356
  }
48354
48357
  function sanitizeLessonForContext(text) {
48355
- return text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "").replace(/[\u200B-\u200D\uFEFF]/g, "").replace(/[\u202A-\u202E\u2066-\u2069]/g, "").replace(/```/g, "` ` `").replace(/^system\s*:/gim, "[BLOCKED]:");
48358
+ return text.split("").filter((char) => {
48359
+ const code = char.charCodeAt(0);
48360
+ return code === 9 || code === 10 || code === 13 || code > 31 && code !== 127;
48361
+ }).join("").replace(/[\u200B-\u200D\uFEFF]/g, "").replace(/[\u202A-\u202E\u2066-\u2069]/g, "").replace(/```/g, "` ` `").replace(/^system\s*:/gim, "[BLOCKED]:");
48356
48362
  }
48357
48363
  function isOrchestratorAgent(agentName) {
48358
48364
  const stripped = stripKnownSwarmPrefix(agentName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.19.2",
3
+ "version": "6.19.4",
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",