opencode-swarm 7.110.1 → 7.110.2

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.
@@ -14,7 +14,7 @@ import {
14
14
  resolveWorktreeBaseDir,
15
15
  shortenWorktreePath,
16
16
  writeLaneProfileToDiskReal
17
- } from "./index-3yk9196e.js";
17
+ } from "./index-dm35e55e.js";
18
18
  import"./index-5e4e2hvv.js";
19
19
  import"./index-p0arc26j.js";
20
20
  import"./index-zgwm4ryv.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  createCuratorLLMDelegate
4
- } from "./index-5d0t7npd.js";
4
+ } from "./index-smk3st51.js";
5
5
  import"./index-53z1afgh.js";
6
6
  import"./index-c8s9a3zh.js";
7
7
  import"./index-xddysq89.js";
@@ -20,8 +20,8 @@ import"./index-40h0yp9e.js";
20
20
  import"./index-jt58s751.js";
21
21
  import"./index-wvrj16f0.js";
22
22
  import"./index-q1exe2b3.js";
23
- import"./index-x2q0gnt8.js";
24
- import"./index-3yk9196e.js";
23
+ import"./index-vzzt3ygr.js";
24
+ import"./index-dm35e55e.js";
25
25
  import"./index-r3j3458j.js";
26
26
  import"./index-jtqkh8jf.js";
27
27
  import"./index-5e4e2hvv.js";
@@ -12,7 +12,7 @@ import {
12
12
  runCuratorInit,
13
13
  runCuratorPhase,
14
14
  writeCuratorSummary
15
- } from "./index-5d0t7npd.js";
15
+ } from "./index-smk3st51.js";
16
16
  import"./index-53z1afgh.js";
17
17
  import"./index-c8s9a3zh.js";
18
18
  import"./index-xddysq89.js";
@@ -31,8 +31,8 @@ import"./index-40h0yp9e.js";
31
31
  import"./index-jt58s751.js";
32
32
  import"./index-wvrj16f0.js";
33
33
  import"./index-q1exe2b3.js";
34
- import"./index-x2q0gnt8.js";
35
- import"./index-3yk9196e.js";
34
+ import"./index-vzzt3ygr.js";
35
+ import"./index-dm35e55e.js";
36
36
  import"./index-r3j3458j.js";
37
37
  import"./index-jtqkh8jf.js";
38
38
  import"./index-5e4e2hvv.js";
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-1k5arp07.js";
5
- import"./index-5d0t7npd.js";
4
+ } from "./index-4k3gh2nz.js";
5
+ import"./index-smk3st51.js";
6
6
  import"./index-53z1afgh.js";
7
7
  import"./index-c8s9a3zh.js";
8
8
  import"./index-xddysq89.js";
@@ -21,8 +21,8 @@ import"./index-40h0yp9e.js";
21
21
  import"./index-jt58s751.js";
22
22
  import"./index-wvrj16f0.js";
23
23
  import"./index-q1exe2b3.js";
24
- import"./index-x2q0gnt8.js";
25
- import"./index-3yk9196e.js";
24
+ import"./index-vzzt3ygr.js";
25
+ import"./index-dm35e55e.js";
26
26
  import"./index-r3j3458j.js";
27
27
  import"./index-jtqkh8jf.js";
28
28
  import"./index-5e4e2hvv.js";
@@ -5,7 +5,7 @@ import {
5
5
  isHiveEligible,
6
6
  promoteFromSwarm,
7
7
  promoteToHive
8
- } from "./index-5d0t7npd.js";
8
+ } from "./index-smk3st51.js";
9
9
  import"./index-53z1afgh.js";
10
10
  import"./index-c8s9a3zh.js";
11
11
  import"./index-xddysq89.js";
@@ -24,8 +24,8 @@ import"./index-40h0yp9e.js";
24
24
  import"./index-jt58s751.js";
25
25
  import"./index-wvrj16f0.js";
26
26
  import"./index-q1exe2b3.js";
27
- import"./index-x2q0gnt8.js";
28
- import"./index-3yk9196e.js";
27
+ import"./index-vzzt3ygr.js";
28
+ import"./index-dm35e55e.js";
29
29
  import"./index-r3j3458j.js";
30
30
  import"./index-jtqkh8jf.js";
31
31
  import"./index-5e4e2hvv.js";
@@ -12,7 +12,7 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-5d0t7npd.js";
15
+ } from "./index-smk3st51.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
@@ -34,7 +34,7 @@ var _internals = {
34
34
  symlinkSync: fs.symlinkSync
35
35
  },
36
36
  writeScopeToDisk: async (directory, taskId, files) => {
37
- const { writeScopeToDisk: realWrite } = await import("./scope-persistence-6m5nsp1r.js");
37
+ const { writeScopeToDisk: realWrite } = await import("./scope-persistence-tgp00wtd.js");
38
38
  return realWrite(directory, taskId, files);
39
39
  },
40
40
  writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-1k5arp07.js";
4
+ } from "./index-4k3gh2nz.js";
5
5
  import {
6
6
  handleGuardrailLog
7
7
  } from "./index-5rfxzgmt.js";
@@ -80,7 +80,7 @@ import {
80
80
  handleWriteRetroCommand,
81
81
  normalizeSwarmCommandInput,
82
82
  resolveCommand
83
- } from "./index-5d0t7npd.js";
83
+ } from "./index-smk3st51.js";
84
84
  import"./index-53z1afgh.js";
85
85
  import"./index-c8s9a3zh.js";
86
86
  import"./index-xddysq89.js";
@@ -103,8 +103,8 @@ import"./index-40h0yp9e.js";
103
103
  import"./index-jt58s751.js";
104
104
  import"./index-wvrj16f0.js";
105
105
  import"./index-q1exe2b3.js";
106
- import"./index-x2q0gnt8.js";
107
- import"./index-3yk9196e.js";
106
+ import"./index-vzzt3ygr.js";
107
+ import"./index-dm35e55e.js";
108
108
  import"./index-r3j3458j.js";
109
109
  import"./index-jtqkh8jf.js";
110
110
  import"./index-5e4e2hvv.js";
@@ -174,7 +174,7 @@ import {
174
174
  } from "./index-wvrj16f0.js";
175
175
  import {
176
176
  clearAllScopes
177
- } from "./index-x2q0gnt8.js";
177
+ } from "./index-vzzt3ygr.js";
178
178
  import {
179
179
  readSwarmFileAsync,
180
180
  safeHook,
@@ -10021,11 +10021,11 @@ var _internals10 = {
10021
10021
  return KnowledgeConfigSchema2.parse({});
10022
10022
  },
10023
10023
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig) => {
10024
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-c7dzf9rt.js");
10024
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-qpgdv0fp.js");
10025
10025
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig);
10026
10026
  },
10027
10027
  checkHivePromotions: async (entries, knowledgeConfig) => {
10028
- const { checkHivePromotions } = await import("./hive-promoter-kr56vt08.js");
10028
+ const { checkHivePromotions } = await import("./hive-promoter-rs5dr4pf.js");
10029
10029
  return checkHivePromotions(entries, knowledgeConfig);
10030
10030
  },
10031
10031
  applyProposalTriage: async (directory, triage) => {
@@ -16848,8 +16848,8 @@ var _internals21 = {
16848
16848
  loadCuratorDeps: async () => {
16849
16849
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
16850
16850
  import("./schema-s48je8zt.js"),
16851
- import("./curator-c7dzf9rt.js"),
16852
- import("./curator-llm-factory-v4gxfnhd.js")
16851
+ import("./curator-qpgdv0fp.js"),
16852
+ import("./curator-llm-factory-3x89ddtd.js")
16853
16853
  ]);
16854
16854
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
16855
16855
  }
@@ -17345,7 +17345,7 @@ import { fileURLToPath } from "url";
17345
17345
  // package.json
17346
17346
  var package_default = {
17347
17347
  name: "opencode-swarm",
17348
- version: "7.110.1",
17348
+ version: "7.110.2",
17349
17349
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
17350
17350
  main: "dist/index.js",
17351
17351
  types: "dist/index.d.ts",
@@ -32070,7 +32070,7 @@ function buildDetailedHelp(commandName, entry) {
32070
32070
  async function handleHelpCommand(ctx) {
32071
32071
  const targetCommand = ctx.args.join(" ");
32072
32072
  if (!targetCommand) {
32073
- const { buildHelpText } = await import("./index-r3ck99jh.js");
32073
+ const { buildHelpText } = await import("./index-rm8b4959.js");
32074
32074
  return buildHelpText();
32075
32075
  }
32076
32076
  const tokens = targetCommand.split(/\s+/);
@@ -32079,7 +32079,7 @@ async function handleHelpCommand(ctx) {
32079
32079
  return _internals46.buildDetailedHelp(resolved.key, resolved.entry);
32080
32080
  }
32081
32081
  const similar = _internals46.findSimilarCommands(targetCommand);
32082
- const { buildHelpText: fullHelp } = await import("./index-r3ck99jh.js");
32082
+ const { buildHelpText: fullHelp } = await import("./index-rm8b4959.js");
32083
32083
  if (similar.length > 0) {
32084
32084
  return `Command '/swarm ${targetCommand}' not found.
32085
32085
 
@@ -32212,7 +32212,7 @@ var COMMAND_REGISTRY = {
32212
32212
  },
32213
32213
  "guardrail explain": {
32214
32214
  handler: async (ctx) => {
32215
- const { handleGuardrailExplain } = await import("./guardrail-explain-qc02w4yb.js");
32215
+ const { handleGuardrailExplain } = await import("./guardrail-explain-jdwp6h9c.js");
32216
32216
  return handleGuardrailExplain(ctx.directory, ctx.args);
32217
32217
  },
32218
32218
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -180,7 +180,7 @@ function readScopeFromDisk(directory, taskId) {
180
180
  if (typeof parsed.declaredAt !== "number" || parsed.declaredAt > now) {
181
181
  return null;
182
182
  }
183
- if (typeof parsed.expiresAt !== "number" || now > parsed.expiresAt) {
183
+ if (typeof parsed.expiresAt !== "number" || now >= parsed.expiresAt) {
184
184
  return null;
185
185
  }
186
186
  if (!Array.isArray(parsed.files))
package/dist/cli/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-5d0t7npd.js";
10
+ } from "./index-smk3st51.js";
11
11
  import"./index-53z1afgh.js";
12
12
  import"./index-c8s9a3zh.js";
13
13
  import"./index-xddysq89.js";
@@ -28,8 +28,8 @@ import"./index-40h0yp9e.js";
28
28
  import"./index-jt58s751.js";
29
29
  import"./index-wvrj16f0.js";
30
30
  import"./index-q1exe2b3.js";
31
- import"./index-x2q0gnt8.js";
32
- import"./index-3yk9196e.js";
31
+ import"./index-vzzt3ygr.js";
32
+ import"./index-dm35e55e.js";
33
33
  import"./index-r3j3458j.js";
34
34
  import"./index-jtqkh8jf.js";
35
35
  import"./index-5e4e2hvv.js";
@@ -6,7 +6,7 @@ import {
6
6
  readScopeFromDisk,
7
7
  resolveScopeWithFallbacks,
8
8
  writeScopeToDisk
9
- } from "./index-x2q0gnt8.js";
9
+ } from "./index-vzzt3ygr.js";
10
10
  import"./index-vvk2g744.js";
11
11
  import"./index-7xgqky26.js";
12
12
  import"./index-a76rekgs.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{createRequire}from"node:module";var __create=Object.create;var{getPrototypeOf:__getProtoOf,defineProperty:__defProp,getOwnPropertyNames:__getOwnPropNames,getOwnPropertyDescriptor:__getOwnPropDesc}=Object,__hasOwnProp=Object.prototype.hasOwnProperty;function __accessProp(key){return this[key]}var __toESMCache_node,__toESMCache_esm,__toESM=(mod,isNodeMode,target)=>{var canCache=mod!=null&&typeof mod==="object";if(canCache){var cache=isNodeMode?__toESMCache_node??=new WeakMap:__toESMCache_esm??=new WeakMap,cached=cache.get(mod);if(cached)return cached}target=mod!=null?__create(__getProtoOf(mod)):{};let to=isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target;for(let key of __getOwnPropNames(mod))if(!__hasOwnProp.call(to,key))__defProp(to,key,{get:__accessProp.bind(mod,key),enumerable:!0});if(canCache)cache.set(mod,to);return to},__toCommonJS=(from)=>{var entry=(__moduleCache??=new WeakMap).get(from),desc;if(entry)return entry;if(entry=__defProp({},"__esModule",{value:!0}),from&&typeof from==="object"||typeof from==="function"){for(var key of __getOwnPropNames(from))if(!__hasOwnProp.call(entry,key))__defProp(entry,key,{get:__accessProp.bind(from,key),enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return __moduleCache.set(from,entry),entry},__moduleCache,__commonJS=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports);var __returnValue=(v)=>v;function __exportSetter(name,newValue){this[name]=__returnValue.bind(null,newValue)}var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0,configurable:!0,set:__exportSetter.bind(all,name)})};var __esm=(fn2,res)=>()=>(fn2&&(res=fn2(fn2=0)),res);var __require=createRequire(import.meta.url);var package_default;var init_package=__esm(()=>{package_default={name:"opencode-swarm",version:"7.110.1",description:"Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./package.json":"./package.json"},bin:{"opencode-swarm":"./dist/cli/index.js"},type:"module",engines:{bun:">=1.3.13"},license:"MIT",repository:{type:"git",url:"https://github.com/ZaxbyHub/opencode-swarm.git"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["opencode","opencode-plugin","ai","agents","orchestration","swarm","multi-agent","llm"],files:["dist","dist/lang/grammars",".opencode/skills/brainstorm",".opencode/skills/specify",".opencode/skills/clarify-spec",".opencode/skills/resume",".opencode/skills/clarify",".opencode/skills/discover",".opencode/skills/consult",".opencode/skills/pre-phase-briefing",".opencode/skills/council",".opencode/skills/deep-dive",".opencode/skills/deep-research",".opencode/skills/codebase-review-swarm",".opencode/skills/swarm-implement",".opencode/skills/design-docs",".opencode/skills/swarm-pr-review",".opencode/skills/swarm",".opencode/skills/swarm-pr-feedback",".opencode/skills/swarm-pr-subscribe",".opencode/skills/swarm-ci-monitor",".opencode/skills/issue-ingest",".opencode/skills/plan",".opencode/skills/critic-gate",".opencode/skills/execute",".opencode/skills/phase-wrap",".opencode/skills/loop",".opencode/skills/writing-tests",".opencode/skills/running-tests",".opencode/skills/engineering-conventions",".opencode/skills/commit-pr",".opencode/skills/worktree-retry-cleanup",".opencode/skills/skill-edit-validation",".opencode/skills/merge-queue-readiness",".opencode/skills/gate-attribution",".opencode/skills/ci-failure-batching","tests/fixtures/memory-recall","README.md","LICENSE"],scripts:{clean:`bun -e "require('fs').rmSync('dist',{recursive:true,force:true})"`,build:"bun run clean && bun run scripts/copy-grammars.ts && bun build src/index.ts --outdir dist --target node --format esm --external web-tree-sitter --minify-whitespace --minify-syntax && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external bash-parser --splitting && bun run scripts/copy-grammars.ts --to-dist && tsc --emitDeclarationOnly",typecheck:"tsc --noEmit",test:"bun test",lint:"biome lint .","drift:check":"bun run scripts/drift-check.ts",format:"biome format . --write",check:"biome check --write .",dev:"bun run build && opencode","package:smoke":"node scripts/package-smoke.mjs",prepare:"bun run build","repro:704":"node scripts/repro-704.mjs","repro:1144":"bun scripts/repro-1144.mjs"},dependencies:{"@opencode-ai/plugin":"^1.1.53","@opencode-ai/sdk":"^1.1.53","@vscode/tree-sitter-wasm":"^0.3.0","bash-parser":"^0.5.0","p-limit":"^7.3.0",picomatch:"^4.0.4","proper-lockfile":"^4.1.2","quick-lru":"^7.3.0","web-tree-sitter":"^0.25.0",zod:"^4.1.8"},devDependencies:{"@biomejs/biome":"2.3.14","@types/picomatch":"^4.0.3","bun-types":"1.3.8","js-yaml":"^4.1.1",typescript:"^5.7.3"}}});var QA_AGENTS,PIPELINE_AGENTS,ORCHESTRATOR_NAME="architect",ALL_SUBAGENT_NAMES,ALL_AGENT_NAMES;var init_agent_names=__esm(()=>{QA_AGENTS=["reviewer","critic","critic_oversight"],PIPELINE_AGENTS=["explorer","coder","test_engineer"],ALL_SUBAGENT_NAMES=["sme","researcher","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","curator_init","curator_phase","curator_postmortem","curator_consolidation","council_generalist","council_skeptic","council_domain_expert","skill_improver","spec_writer",...QA_AGENTS,...PIPELINE_AGENTS],ALL_AGENT_NAMES=["architect",...ALL_SUBAGENT_NAMES]});var TOOL_METADATA,TOOL_NAMES,TOOL_NAME_SET,TOOL_DESCRIPTIONS,AGENT_TOOL_MAP;var init_tool_metadata=__esm(()=>{init_agent_names();TOOL_METADATA={diff:{description:"structured git diff with contract change detection",agents:["architect","reviewer","critic_oversight","coder","test_engineer"]},diff_summary:{description:"filter classified AST changes by category, risk level, or file for reviewer drill-down",agents:["architect","reviewer","critic_oversight"]},syntax_check:{description:"check syntax of source files using tree-sitter parsers across multiple languages, returning per-file errors",agents:["architect","coder","test_engineer"]},placeholder_scan:{description:"todo and FIXME comment detection",agents:["architect","reviewer"]},imports:{description:"find all consumers that import from a given file — use before refactoring shared modules to avoid breaking unseen dependents",agents:["architect","sme","researcher","docs","docs_design","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","reviewer","critic","coder","test_engineer"]},lint:{description:"run project linter in check or fix mode; supports biome, eslint, ruff, clippy, and more, returns structured results",agents:["architect","reviewer","coder"]},secretscan:{description:"scan for secrets (API keys, tokens, passwords) via regex and entropy; returns redacted previews, excludes common dirs",agents:["architect","reviewer","critic_oversight"]},sast_scan:{description:"static analysis security scan",agents:["architect","reviewer","critic_oversight"]},build_check:{description:"discover and run build, typecheck, and test commands for various project ecosystems in the working directory",agents:["architect","coder","test_engineer"]},pre_check_batch:{description:"parallel verification: lint:check + secretscan + sast_scan + quality_budget",agents:["architect","reviewer"]},quality_budget:{description:"code quality budget check",agents:["architect"]},symbols:{description:"extract exported symbols (functions, classes, interfaces, types) from source files; supports TypeScript, JavaScript, and Python",agents:["architect","sme","researcher","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","spec_writer","reviewer","critic","coder","test_engineer"]},complexity_hotspots:{description:"git churn × complexity risk map",agents:["architect","sme","researcher","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","reviewer","critic","critic_oversight","explorer","test_engineer"]},schema_drift:{description:"OpenAPI spec vs route drift",agents:["architect","sme","researcher","docs","explorer"]},todo_extract:{description:"structured TODO/FIXME extraction",agents:["architect","researcher","docs","explorer"]},evidence_check:{description:"verify task evidence completeness",agents:["architect","critic_oversight"]},check_gate_status:{description:"check the gate status of a specific task",agents:["architect","critic_oversight"]},completion_verify:{description:"verify completed tasks have required evidence",agents:["architect","critic_oversight"]},submit_council_verdicts:{description:"submit pre-collected council member verdicts for synthesis (architect MUST dispatch critic/reviewer/sme/test_engineer/explorer as Agent tasks first; this tool synthesizes only, it does not contact members)",agents:[]},submit_phase_council_verdicts:{description:"submit pre-collected phase-level council member verdicts for holistic phase synthesis (architect MUST dispatch all 5 council members with phase-scoped context first; this tool synthesizes only, it does not contact members)",agents:[]},declare_council_criteria:{description:"pre-declare acceptance criteria for a task before the coder starts work; criteria are read back during council evaluation",agents:[]},sbom_generate:{description:"SBOM generation for dependency inventory",agents:["architect"]},checkpoint:{description:"create named git checkpoints for save, restore, and delete — use before risky operations to enable rollback",agents:["architect"]},pkg_audit:{description:"dependency vulnerability scan — npm/pip/cargo",agents:["architect","critic_hallucination_verifier","reviewer","critic_oversight","test_engineer"]},parse_lane_candidates:{description:"Parse [CANDIDATE] rows from a dispatch_lanes or collect_lane_results artifact (by output_ref), produce structured records with provenance, optionally persist to a per-batch sidecar JSONL. Pure-parser variant exists as internal module.",agents:["architect"]},test_runner:{description:"auto-detect and run tests",agents:["architect","reviewer","test_engineer"]},test_impact:{description:"identify test files impacted by changed source files via import analysis",agents:["architect","reviewer","critic_oversight","test_engineer"]},mutation_test:{description:"executes pre-generated mutation patches against tests, evaluates kill rate against quality gate thresholds",agents:["architect","test_engineer"]},generate_mutants:{description:"generate LLM-based mutation testing patches for source files; returns MutationPatch[] for direct consumption by the mutation_test tool",agents:["architect"]},detect_domains:{description:"detect which SME domains are relevant for a given text",agents:["architect","sme","docs","docs_design","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic","critic_oversight","explorer"]},git_blame:{description:"per-line git blame metadata: sha, author, date, summary for each line in a file",agents:["reviewer","explorer","architect"]},gitingest:{description:"fetch a GitHub repository full content via gitingest.com",agents:["architect","docs","explorer"]},retrieve_summary:{description:"retrieve the full content of a stored tool output summary",agents:["architect","sme","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","spec_writer","reviewer","critic","coder","test_engineer"]},retrieve_lane_output:{description:"retrieve paged full dispatch lane output by output_ref; use before consuming truncated lane previews or routing candidates from lane results",agents:["architect"]},extract_code_blocks:{description:"extract code blocks from text content and save them to files",agents:["architect","sme","docs","docs_design","designer","spec_writer","reviewer","explorer","coder","test_engineer"]},phase_complete:{description:"mark a phase as complete and track dispatched agents",agents:["architect"]},save_plan:{description:"save a structured implementation plan",agents:["architect"]},update_task_status:{description:"mark tasks complete, track phase progress",agents:["architect"]},lint_spec:{description:"validate .swarm/spec.md format and required fields",agents:["architect","spec_writer"]},write_retro:{description:"document phase retrospectives via phase_complete workflow, capture lessons learned",agents:["architect"]},write_drift_evidence:{description:"write drift verification evidence for a completed phase",agents:["architect"]},write_hallucination_evidence:{description:"write hallucination verification evidence for a completed phase",agents:["architect"]},write_mutation_evidence:{description:"write mutation gate evidence for a completed phase; normalizes PASS/WARN/FAIL/SKIP verdicts and writes .swarm/evidence/{phase}/mutation-gate.json",agents:["architect"]},declare_scope:{description:"declare file scope for next coder delegation",agents:["architect"]},knowledge_query:{description:"query swarm or hive knowledge with optional filters",agents:["architect","skill_improver","spec_writer"]},doc_scan:{description:"scan project documentation files and build an index manifest",agents:["architect","docs_design","skill_improver","spec_writer","explorer"]},doc_extract:{description:"extract actionable constraints from project documentation",agents:["architect","docs_design","skill_improver","spec_writer"]},curator_analyze:{description:"run curator phase analysis and optionally apply knowledge recommendations",agents:["architect"]},knowledge_add:{description:"store a new lesson in the knowledge base",agents:["architect","coder"]},knowledge_recall:{description:"search the knowledge base for relevant past decisions",agents:["architect","sme","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","curator_init","curator_phase","skill_improver","spec_writer","reviewer","critic","critic_oversight","explorer","coder","test_engineer"]},knowledge_remove:{description:"delete an outdated swarm knowledge entry by ID (swarm tier only)",agents:["architect"]},co_change_analyzer:{description:"detect hidden couplings by analyzing git history",agents:["architect"]},context_status:{description:"report current context-window headroom for the active session — returns tokens-used, model-limit, usage-percent, threshold-state (none/warn/critical), model name, and provider. Pure read-only: no state mutation, no warning injection. Works whether context_budget.enabled is true or false.",agents:["architect"]},search:{description:"Workspace-scoped ripgrep-style text search with structured JSON output. Supports literal and regex modes, glob filtering, and result limits. NOTE: This is text search, not structural AST search — use symbols and imports tools for structural queries.",agents:["architect","sme","docs","docs_design","designer","critic_hallucination_verifier","skill_improver","spec_writer","reviewer","critic_oversight","explorer","coder","test_engineer","researcher"]},ast_grep:{description:"Read-only structural AST search using ast-grep patterns with optional language and glob filters. Use for syntax-aware code pattern searches; does not rewrite files.",agents:["architect","sme","docs","docs_design","critic_hallucination_verifier","spec_writer","explorer","coder","test_engineer","researcher"]},actionlint_scan:{description:"Run actionlint against GitHub Actions workflow YAML files with structured findings. Resolves actionlint lazily and does not modify files.",agents:["architect","test_engineer"]},osv_scan:{description:"Run OSV-Scanner against a workspace path and return structured dependency vulnerability findings. Resolves osv-scanner lazily and does not modify files.",agents:["architect","test_engineer"]},gh_evidence:{description:"Fetch bounded GitHub pull request or issue metadata through gh for review and CI evidence. Resolves gh lazily and is read-only.",agents:["architect","researcher"]},batch_symbols:{description:"Batched symbol extraction across multiple files. Returns per-file symbol summaries with isolated error handling.",agents:["architect","critic_hallucination_verifier","reviewer","critic_oversight","explorer"]},suggest_patch:{description:"Reviewer-safe structured patch suggestion tool. Produces context-anchored patch artifacts without file modification. Returns structured diagnostics on context mismatch.",agents:["architect","reviewer"]},req_coverage:{description:"query requirement coverage status for tracked functional requirements",agents:["critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","spec_writer","critic","critic_oversight"]},get_approved_plan:{description:"retrieve the last critic-approved immutable plan snapshot for baseline drift comparison",agents:["critic_drift_verifier","critic","critic_oversight"]},repo_map:{description:"query the repo code graph: importers, dependencies, blast radius, localization, ontology facts, package boundaries, and heuristic preflight packets before refactoring; ontology findings are advisory, not formal proofs",agents:["architect","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","reviewer","critic","critic_oversight","explorer","coder"]},get_qa_gate_profile:{description:"retrieve the QA gate profile for the current plan: gates (reviewer, test_engineer, sme_enabled, critic_pre_plan, sast_enabled, council_mode, hallucination_guard, mutation_test, phase_council, drift_check, final_council), lock state, and profile hash. Read-only.",agents:["architect"]},set_qa_gates:{description:"configure the QA gate profile for the current plan. Architect-only. Ratchet-tighter only — rejected once the profile is locked after critic approval. Supports: reviewer, test_engineer, sme_enabled, critic_pre_plan, sast_enabled, council_mode, hallucination_guard, mutation_test, phase_council, drift_check, final_council.",agents:["architect"]},web_search:{description:"External web search (Tavily or Brave) for architect-driven council research, SME domain research, researcher auto-research, and skill-improver research. Returns titled results with snippets, URLs, normalized query metadata, temporal intent, freshness, and removed stale years. Config-gated on council.general.enabled in the resolved config: global ~/.config/opencode/opencode-swarm.json, then project .opencode/opencode-swarm.json overrides. Requires a search API key. Used by the architect in MODE: COUNCIL to gather a RESEARCH CONTEXT before dispatching council agents, by SME for opt-in external skill/source evaluation, and by the researcher agent for multi-source auto-research.",agents:["sme","researcher","skill_improver"]},web_fetch:{description:"Fetch the readable text of a single http(s) URL (architect-only). Returns decoded page text, document title, final URL after redirects, and an evidence reference. Reads primary sources that web_search only surfaces as snippets. Config-gated on council.general.enabled. Blocks private/loopback/link-local/metadata addresses (re-validated and re-pinned across redirects); enforces timeout and body size cap.",agents:[]},convene_general_council:{description:"Synthesize responses from a multi-model General Council. Accepts parallel member responses (Round 1, optionally Round 2), detects disagreements, and returns consensus points, persisting disagreements, and a structured synthesis. Architect-only. Config-gated on council.general.enabled in the resolved config: global ~/.config/opencode/opencode-swarm.json, then project .opencode/opencode-swarm.json overrides.",agents:[]},write_final_council_evidence:{description:"Persist project-scoped final council evidence to .swarm/evidence/final-council.json. PREREQUISITE: dispatch critic, reviewer, sme, test_engineer, and explorer as project-scoped Agent tasks and collect their CouncilMemberVerdict JSON — this tool synthesizes only. Rejects on insufficient quorum or CONCERNS with unresolved requiredFixes; normalizes verdicts to approved/concerns/rejected. Architect-only.",agents:[]},skill_generate:{description:"compile knowledge entries into a structured SKILL.md draft",agents:["skill_improver"]},skill_list:{description:"list generated skill files and their status",agents:["skill_improver"]},skill_apply:{description:"activate a draft skill proposal",agents:[]},skill_inspect:{description:"inspect the content and source entries of a skill file",agents:["skill_improver"]},run_stale_reconciliation:{description:"reconcile skills against the knowledge store: mark skills stale when source knowledge is archived or deleted, or clear stale markers",agents:["architect"]},skill_regenerate:{description:"regenerate an active skill by re-clustering its source knowledge entries and updating the SKILL.md in place",agents:[]},skill_retire:{description:"retire a generated skill by adding a retired.marker file; retired skills are excluded from scoring and injection",agents:[]},skill_improve:{description:"run the skill_improver agent to review and refine skills",agents:["skill_improver"]},spec_write:{description:"author or update .swarm/spec.md for the current project",agents:["spec_writer"]},knowledge_receipt:{description:"file a receipt for retrieved knowledge (applied/ignored/contradicted + new lessons), recorded as immutable knowledge events",agents:["architect","sme","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","curator_init","curator_phase","skill_improver","spec_writer","reviewer","critic","coder","test_engineer"]},knowledge_archive:{description:"archive (default), quarantine, or purge a swarm or hive knowledge entry by ID with an immutable audit tombstone; purge requires an admin flag",agents:["architect"]},swarm_memory_recall:{description:"recall scoped Swarm memory for the current repository as untrusted background",agents:[]},swarm_memory_propose:{description:"create a pending Swarm memory proposal; does not write durable memory directly",agents:[]},swarm_command:{description:"run supported /swarm commands through the canonical command registry",agents:["architect","sme","researcher","docs","docs_design","designer","reviewer","critic","explorer","coder","test_engineer"]},dispatch_lanes:{description:"dispatch read-only exploration/review lanes concurrently and BLOCK until all finish; prefer dispatch_lanes_async for non-blocking dispatch, use this only when promptAsync is unavailable",agents:["architect"]},dispatch_lanes_async:{description:"launch read-only advisory lanes non-blockingly and return a batch id plus lane session handles immediately so you can keep working; launch_timeout_ms is only a promptAsync acceptance budget, not a lane runtime timeout; poll incrementally with collect_lane_results (wait omitted or false) while doing independent investigation, or join with wait: true when you need all results",agents:["architect"]},collect_lane_results:{description:"collect or poll results for a dispatch_lanes_async batch; supports both non-blocking polling (wait omitted or false) and blocking join (wait: true). Non-blocking polls include pending lane identities by default and process settled lanes incrementally while continuing independent work; busy/retry lanes are not timed out just because they run for a long time. Does not advance workflow gates.",agents:["architect"]},summarize_work:{description:"emit a short structured summary of completed work (key decisions, assumptions, risks, constraints) at task completion; rolls up per phase for architecture-supervisor review. Advisory, never blocks.",agents:["architect","sme","researcher","docs","docs_design","designer","explorer","coder","test_engineer"]},write_architecture_supervisor_evidence:{description:"persist the architecture supervisor verdict for a phase (architect MUST dispatch critic_architecture_supervisor first and collect its JSON verdict; this tool persists only, it does not contact the supervisor)",agents:["architect"]},lean_turbo_plan_lanes:{description:"partition phase tasks into parallel lanes based on file-scope conflicts for Lean Turbo execution",agents:[]},lean_turbo_acquire_locks:{description:"acquire file locks for all files in a lane (all-or-nothing) before lane execution",agents:[]},lean_turbo_runner_status:{description:"read Lean Turbo run state from .swarm/turbo-state.json",agents:[]},lean_turbo_review:{description:"dispatch a read-only reviewer agent to evaluate a completed Lean Turbo phase",agents:[]},lean_turbo_run_phase:{description:"Execute a phase using Lean Turbo parallel lane execution. Plans lanes, acquires file locks, and dispatches coder agents concurrently. Use when Lean Turbo is active and you want to execute all tasks in a phase in parallel lanes.",agents:[]},lean_turbo_status:{description:"returns Lean Turbo configuration and active status for the current session",agents:[]},swarm_apply_patch:{description:"Apply a unified diff patch to workspace files with exact context matching, atomic writes, and path validation. Use standard unified diff format only — does NOT support *** Begin Patch / *** Update File payloads (use native apply_patch for those).",agents:["coder","test_engineer"]},external_skill_discover:{description:"Discover external skill candidates from configured sources. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_list:{description:"List external skill candidates in the quarantine store. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_inspect:{description:"Inspect a specific external skill candidate by ID. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_promote:{description:"Promote a validated external skill candidate to an active generated skill. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_reject:{description:"Reject an external skill candidate after evaluation. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_delete:{description:"Delete an external skill candidate from the quarantine store. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_revoke:{description:"Revoke a previously promoted external skill. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},epic_decide_phase:{description:"Compute the Epic Mode verdict for a phase WITHOUT dispatching coders. Runs preflight + calibration + the three gates (p-threshold, hot-module, greenfield), persists the decision, and returns the verdict so the architect can dispatch waves via the visible Task tool (promote) or fall back to per-task serial (demote). Pair with `epic_plan_waves` to get the wave plan when promoted. Use when /swarm epic is on for the session.",agents:["architect"]},epic_plan_waves:{description:"Partition a phase's pending tasks into ordered concurrent waves for Epic Mode dispatch. A wave is a set of tasks with mutually disjoint declared scopes and all dependencies satisfied by prior waves. Returns `{ waves: [{ waveId, taskIds, files }, ...], serializedTasks, degradedTasks }`. "+'For each wave in order, the architect dispatches one `Task(subagent_type="coder", ...)` per `taskId` — all in one assistant message — so the wave runs concurrently and each coder appears as a visible subagent. '+"Wait for the wave to finish before dispatching the next. Pair with `epic_decide_phase` (called first; this tool is only relevant on a `promote` verdict). "+"Preflight reject reasons: `no-plan`, `no-phase`, `phase-empty`, `phase-already-complete`, `scopes-missing` (call `declare_scope` for `missingScopes`), `git-failed` (transient — retry), `planner-error`.",agents:["architect"]},epic_record_divergence:{description:"After every `update_task_status(completed)`, record the task's declared-vs-actual divergence to .swarm/epic/divergence.jsonl. Feeds Epic Mode's self-calibration loop (Capability D). Best-effort: never blocks.",agents:["architect"]}},TOOL_NAMES=Object.keys(TOOL_METADATA),TOOL_NAME_SET=new Set(TOOL_NAMES),TOOL_DESCRIPTIONS=Object.fromEntries(Object.entries(TOOL_METADATA).map(([name,meta])=>[name,meta.description])),AGENT_TOOL_MAP=(()=>{let map=Object.fromEntries(ALL_AGENT_NAMES.map((agent)=>[agent,[]]));for(let[name,meta]of Object.entries(TOOL_METADATA))for(let agent of meta.agents)map[agent].push(name);return map})()});function deepMergeInternal(base,override,depth){if(depth>=10)throw Error("deepMerge exceeded maximum depth of 10");let result={...base};for(let key of Object.keys(override)){let baseVal=base[key],overrideVal=override[key];if(typeof baseVal==="object"&&baseVal!==null&&typeof overrideVal==="object"&&overrideVal!==null&&!Array.isArray(baseVal)&&!Array.isArray(overrideVal))result[key]=deepMergeInternal(baseVal,overrideVal,depth+1);else result[key]=overrideVal}return result}function deepMerge(base,override){if(!base)return override;if(!override)return base;return deepMergeInternal(base,override,0)}function freezeSet(items){let set=new Set(items),proxy=new Proxy(set,{get(target,prop){if(prop==="add"||prop==="delete"||prop==="clear")return()=>{throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")};if(prop==="forEach")return(callback,thisArg)=>{let wrapped=(v,k)=>callback.call(thisArg??void 0,v,k,proxy);return set.forEach(wrapped)};let value=Reflect.get(target,prop);return typeof value==="function"?value.bind(target):value},set(){throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")},deleteProperty(){throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")},defineProperty(){throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")},setPrototypeOf(){throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")}});return proxy}function isQAAgent(name){return QA_AGENTS.includes(name)}function isSubagent(name){return ALL_SUBAGENT_NAMES.includes(name)}function isLowCapabilityModel(modelId){let lower=(modelId||"").toLowerCase();return LOW_CAPABILITY_MODELS.some((substr)=>lower.includes(substr))}var OPENCODE_NATIVE_AGENTS,CLAUDE_CODE_NATIVE_COMMANDS,MEMORY_AGENT_TOOL_MAP,EXTERNAL_SKILL_TOOL_NAMES,EXTERNAL_SKILL_AGENT_TOOL_MAP,COUNCIL_TOOL_NAMES,COUNCIL_AGENT_TOOL_MAP,GENERAL_COUNCIL_TOOL_NAMES,GENERAL_COUNCIL_AGENT_TOOL_MAP,TURBO_TOOL_NAMES,TURBO_AGENT_TOOL_MAP,SKILL_TOOL_NAMES,SKILL_AGENT_TOOL_MAP,WRITE_TOOL_NAMES,DEFAULT_MODELS,DEFAULT_SCORING_CONFIG,LOW_CAPABILITY_MODELS,TURBO_MODE_BANNER=`## \uD83D\uDE80 TURBO MODE ACTIVE
1
+ import{createRequire}from"node:module";var __create=Object.create;var{getPrototypeOf:__getProtoOf,defineProperty:__defProp,getOwnPropertyNames:__getOwnPropNames,getOwnPropertyDescriptor:__getOwnPropDesc}=Object,__hasOwnProp=Object.prototype.hasOwnProperty;function __accessProp(key){return this[key]}var __toESMCache_node,__toESMCache_esm,__toESM=(mod,isNodeMode,target)=>{var canCache=mod!=null&&typeof mod==="object";if(canCache){var cache=isNodeMode?__toESMCache_node??=new WeakMap:__toESMCache_esm??=new WeakMap,cached=cache.get(mod);if(cached)return cached}target=mod!=null?__create(__getProtoOf(mod)):{};let to=isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target;for(let key of __getOwnPropNames(mod))if(!__hasOwnProp.call(to,key))__defProp(to,key,{get:__accessProp.bind(mod,key),enumerable:!0});if(canCache)cache.set(mod,to);return to},__toCommonJS=(from)=>{var entry=(__moduleCache??=new WeakMap).get(from),desc;if(entry)return entry;if(entry=__defProp({},"__esModule",{value:!0}),from&&typeof from==="object"||typeof from==="function"){for(var key of __getOwnPropNames(from))if(!__hasOwnProp.call(entry,key))__defProp(entry,key,{get:__accessProp.bind(from,key),enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return __moduleCache.set(from,entry),entry},__moduleCache,__commonJS=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports);var __returnValue=(v)=>v;function __exportSetter(name,newValue){this[name]=__returnValue.bind(null,newValue)}var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0,configurable:!0,set:__exportSetter.bind(all,name)})};var __esm=(fn2,res)=>()=>(fn2&&(res=fn2(fn2=0)),res);var __require=createRequire(import.meta.url);var package_default;var init_package=__esm(()=>{package_default={name:"opencode-swarm",version:"7.110.2",description:"Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./package.json":"./package.json"},bin:{"opencode-swarm":"./dist/cli/index.js"},type:"module",engines:{bun:">=1.3.13"},license:"MIT",repository:{type:"git",url:"https://github.com/ZaxbyHub/opencode-swarm.git"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["opencode","opencode-plugin","ai","agents","orchestration","swarm","multi-agent","llm"],files:["dist","dist/lang/grammars",".opencode/skills/brainstorm",".opencode/skills/specify",".opencode/skills/clarify-spec",".opencode/skills/resume",".opencode/skills/clarify",".opencode/skills/discover",".opencode/skills/consult",".opencode/skills/pre-phase-briefing",".opencode/skills/council",".opencode/skills/deep-dive",".opencode/skills/deep-research",".opencode/skills/codebase-review-swarm",".opencode/skills/swarm-implement",".opencode/skills/design-docs",".opencode/skills/swarm-pr-review",".opencode/skills/swarm",".opencode/skills/swarm-pr-feedback",".opencode/skills/swarm-pr-subscribe",".opencode/skills/swarm-ci-monitor",".opencode/skills/issue-ingest",".opencode/skills/plan",".opencode/skills/critic-gate",".opencode/skills/execute",".opencode/skills/phase-wrap",".opencode/skills/loop",".opencode/skills/writing-tests",".opencode/skills/running-tests",".opencode/skills/engineering-conventions",".opencode/skills/commit-pr",".opencode/skills/worktree-retry-cleanup",".opencode/skills/skill-edit-validation",".opencode/skills/merge-queue-readiness",".opencode/skills/gate-attribution",".opencode/skills/ci-failure-batching","tests/fixtures/memory-recall","README.md","LICENSE"],scripts:{clean:`bun -e "require('fs').rmSync('dist',{recursive:true,force:true})"`,build:"bun run clean && bun run scripts/copy-grammars.ts && bun build src/index.ts --outdir dist --target node --format esm --external web-tree-sitter --minify-whitespace --minify-syntax && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external bash-parser --splitting && bun run scripts/copy-grammars.ts --to-dist && tsc --emitDeclarationOnly",typecheck:"tsc --noEmit",test:"bun test",lint:"biome lint .","drift:check":"bun run scripts/drift-check.ts",format:"biome format . --write",check:"biome check --write .",dev:"bun run build && opencode","package:smoke":"node scripts/package-smoke.mjs",prepare:"bun run build","repro:704":"node scripts/repro-704.mjs","repro:1144":"bun scripts/repro-1144.mjs"},dependencies:{"@opencode-ai/plugin":"^1.1.53","@opencode-ai/sdk":"^1.1.53","@vscode/tree-sitter-wasm":"^0.3.0","bash-parser":"^0.5.0","p-limit":"^7.3.0",picomatch:"^4.0.4","proper-lockfile":"^4.1.2","quick-lru":"^7.3.0","web-tree-sitter":"^0.25.0",zod:"^4.1.8"},devDependencies:{"@biomejs/biome":"2.3.14","@types/picomatch":"^4.0.3","bun-types":"1.3.8","js-yaml":"^4.1.1",typescript:"^5.7.3"}}});var QA_AGENTS,PIPELINE_AGENTS,ORCHESTRATOR_NAME="architect",ALL_SUBAGENT_NAMES,ALL_AGENT_NAMES;var init_agent_names=__esm(()=>{QA_AGENTS=["reviewer","critic","critic_oversight"],PIPELINE_AGENTS=["explorer","coder","test_engineer"],ALL_SUBAGENT_NAMES=["sme","researcher","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","curator_init","curator_phase","curator_postmortem","curator_consolidation","council_generalist","council_skeptic","council_domain_expert","skill_improver","spec_writer",...QA_AGENTS,...PIPELINE_AGENTS],ALL_AGENT_NAMES=["architect",...ALL_SUBAGENT_NAMES]});var TOOL_METADATA,TOOL_NAMES,TOOL_NAME_SET,TOOL_DESCRIPTIONS,AGENT_TOOL_MAP;var init_tool_metadata=__esm(()=>{init_agent_names();TOOL_METADATA={diff:{description:"structured git diff with contract change detection",agents:["architect","reviewer","critic_oversight","coder","test_engineer"]},diff_summary:{description:"filter classified AST changes by category, risk level, or file for reviewer drill-down",agents:["architect","reviewer","critic_oversight"]},syntax_check:{description:"check syntax of source files using tree-sitter parsers across multiple languages, returning per-file errors",agents:["architect","coder","test_engineer"]},placeholder_scan:{description:"todo and FIXME comment detection",agents:["architect","reviewer"]},imports:{description:"find all consumers that import from a given file — use before refactoring shared modules to avoid breaking unseen dependents",agents:["architect","sme","researcher","docs","docs_design","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","reviewer","critic","coder","test_engineer"]},lint:{description:"run project linter in check or fix mode; supports biome, eslint, ruff, clippy, and more, returns structured results",agents:["architect","reviewer","coder"]},secretscan:{description:"scan for secrets (API keys, tokens, passwords) via regex and entropy; returns redacted previews, excludes common dirs",agents:["architect","reviewer","critic_oversight"]},sast_scan:{description:"static analysis security scan",agents:["architect","reviewer","critic_oversight"]},build_check:{description:"discover and run build, typecheck, and test commands for various project ecosystems in the working directory",agents:["architect","coder","test_engineer"]},pre_check_batch:{description:"parallel verification: lint:check + secretscan + sast_scan + quality_budget",agents:["architect","reviewer"]},quality_budget:{description:"code quality budget check",agents:["architect"]},symbols:{description:"extract exported symbols (functions, classes, interfaces, types) from source files; supports TypeScript, JavaScript, and Python",agents:["architect","sme","researcher","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","spec_writer","reviewer","critic","coder","test_engineer"]},complexity_hotspots:{description:"git churn × complexity risk map",agents:["architect","sme","researcher","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","reviewer","critic","critic_oversight","explorer","test_engineer"]},schema_drift:{description:"OpenAPI spec vs route drift",agents:["architect","sme","researcher","docs","explorer"]},todo_extract:{description:"structured TODO/FIXME extraction",agents:["architect","researcher","docs","explorer"]},evidence_check:{description:"verify task evidence completeness",agents:["architect","critic_oversight"]},check_gate_status:{description:"check the gate status of a specific task",agents:["architect","critic_oversight"]},completion_verify:{description:"verify completed tasks have required evidence",agents:["architect","critic_oversight"]},submit_council_verdicts:{description:"submit pre-collected council member verdicts for synthesis (architect MUST dispatch critic/reviewer/sme/test_engineer/explorer as Agent tasks first; this tool synthesizes only, it does not contact members)",agents:[]},submit_phase_council_verdicts:{description:"submit pre-collected phase-level council member verdicts for holistic phase synthesis (architect MUST dispatch all 5 council members with phase-scoped context first; this tool synthesizes only, it does not contact members)",agents:[]},declare_council_criteria:{description:"pre-declare acceptance criteria for a task before the coder starts work; criteria are read back during council evaluation",agents:[]},sbom_generate:{description:"SBOM generation for dependency inventory",agents:["architect"]},checkpoint:{description:"create named git checkpoints for save, restore, and delete — use before risky operations to enable rollback",agents:["architect"]},pkg_audit:{description:"dependency vulnerability scan — npm/pip/cargo",agents:["architect","critic_hallucination_verifier","reviewer","critic_oversight","test_engineer"]},parse_lane_candidates:{description:"Parse [CANDIDATE] rows from a dispatch_lanes or collect_lane_results artifact (by output_ref), produce structured records with provenance, optionally persist to a per-batch sidecar JSONL. Pure-parser variant exists as internal module.",agents:["architect"]},test_runner:{description:"auto-detect and run tests",agents:["architect","reviewer","test_engineer"]},test_impact:{description:"identify test files impacted by changed source files via import analysis",agents:["architect","reviewer","critic_oversight","test_engineer"]},mutation_test:{description:"executes pre-generated mutation patches against tests, evaluates kill rate against quality gate thresholds",agents:["architect","test_engineer"]},generate_mutants:{description:"generate LLM-based mutation testing patches for source files; returns MutationPatch[] for direct consumption by the mutation_test tool",agents:["architect"]},detect_domains:{description:"detect which SME domains are relevant for a given text",agents:["architect","sme","docs","docs_design","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic","critic_oversight","explorer"]},git_blame:{description:"per-line git blame metadata: sha, author, date, summary for each line in a file",agents:["reviewer","explorer","architect"]},gitingest:{description:"fetch a GitHub repository full content via gitingest.com",agents:["architect","docs","explorer"]},retrieve_summary:{description:"retrieve the full content of a stored tool output summary",agents:["architect","sme","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","spec_writer","reviewer","critic","coder","test_engineer"]},retrieve_lane_output:{description:"retrieve paged full dispatch lane output by output_ref; use before consuming truncated lane previews or routing candidates from lane results",agents:["architect"]},extract_code_blocks:{description:"extract code blocks from text content and save them to files",agents:["architect","sme","docs","docs_design","designer","spec_writer","reviewer","explorer","coder","test_engineer"]},phase_complete:{description:"mark a phase as complete and track dispatched agents",agents:["architect"]},save_plan:{description:"save a structured implementation plan",agents:["architect"]},update_task_status:{description:"mark tasks complete, track phase progress",agents:["architect"]},lint_spec:{description:"validate .swarm/spec.md format and required fields",agents:["architect","spec_writer"]},write_retro:{description:"document phase retrospectives via phase_complete workflow, capture lessons learned",agents:["architect"]},write_drift_evidence:{description:"write drift verification evidence for a completed phase",agents:["architect"]},write_hallucination_evidence:{description:"write hallucination verification evidence for a completed phase",agents:["architect"]},write_mutation_evidence:{description:"write mutation gate evidence for a completed phase; normalizes PASS/WARN/FAIL/SKIP verdicts and writes .swarm/evidence/{phase}/mutation-gate.json",agents:["architect"]},declare_scope:{description:"declare file scope for next coder delegation",agents:["architect"]},knowledge_query:{description:"query swarm or hive knowledge with optional filters",agents:["architect","skill_improver","spec_writer"]},doc_scan:{description:"scan project documentation files and build an index manifest",agents:["architect","docs_design","skill_improver","spec_writer","explorer"]},doc_extract:{description:"extract actionable constraints from project documentation",agents:["architect","docs_design","skill_improver","spec_writer"]},curator_analyze:{description:"run curator phase analysis and optionally apply knowledge recommendations",agents:["architect"]},knowledge_add:{description:"store a new lesson in the knowledge base",agents:["architect","coder"]},knowledge_recall:{description:"search the knowledge base for relevant past decisions",agents:["architect","sme","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","curator_init","curator_phase","skill_improver","spec_writer","reviewer","critic","critic_oversight","explorer","coder","test_engineer"]},knowledge_remove:{description:"delete an outdated swarm knowledge entry by ID (swarm tier only)",agents:["architect"]},co_change_analyzer:{description:"detect hidden couplings by analyzing git history",agents:["architect"]},context_status:{description:"report current context-window headroom for the active session — returns tokens-used, model-limit, usage-percent, threshold-state (none/warn/critical), model name, and provider. Pure read-only: no state mutation, no warning injection. Works whether context_budget.enabled is true or false.",agents:["architect"]},search:{description:"Workspace-scoped ripgrep-style text search with structured JSON output. Supports literal and regex modes, glob filtering, and result limits. NOTE: This is text search, not structural AST search — use symbols and imports tools for structural queries.",agents:["architect","sme","docs","docs_design","designer","critic_hallucination_verifier","skill_improver","spec_writer","reviewer","critic_oversight","explorer","coder","test_engineer","researcher"]},ast_grep:{description:"Read-only structural AST search using ast-grep patterns with optional language and glob filters. Use for syntax-aware code pattern searches; does not rewrite files.",agents:["architect","sme","docs","docs_design","critic_hallucination_verifier","spec_writer","explorer","coder","test_engineer","researcher"]},actionlint_scan:{description:"Run actionlint against GitHub Actions workflow YAML files with structured findings. Resolves actionlint lazily and does not modify files.",agents:["architect","test_engineer"]},osv_scan:{description:"Run OSV-Scanner against a workspace path and return structured dependency vulnerability findings. Resolves osv-scanner lazily and does not modify files.",agents:["architect","test_engineer"]},gh_evidence:{description:"Fetch bounded GitHub pull request or issue metadata through gh for review and CI evidence. Resolves gh lazily and is read-only.",agents:["architect","researcher"]},batch_symbols:{description:"Batched symbol extraction across multiple files. Returns per-file symbol summaries with isolated error handling.",agents:["architect","critic_hallucination_verifier","reviewer","critic_oversight","explorer"]},suggest_patch:{description:"Reviewer-safe structured patch suggestion tool. Produces context-anchored patch artifacts without file modification. Returns structured diagnostics on context mismatch.",agents:["architect","reviewer"]},req_coverage:{description:"query requirement coverage status for tracked functional requirements",agents:["critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","spec_writer","critic","critic_oversight"]},get_approved_plan:{description:"retrieve the last critic-approved immutable plan snapshot for baseline drift comparison",agents:["critic_drift_verifier","critic","critic_oversight"]},repo_map:{description:"query the repo code graph: importers, dependencies, blast radius, localization, ontology facts, package boundaries, and heuristic preflight packets before refactoring; ontology findings are advisory, not formal proofs",agents:["architect","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","reviewer","critic","critic_oversight","explorer","coder"]},get_qa_gate_profile:{description:"retrieve the QA gate profile for the current plan: gates (reviewer, test_engineer, sme_enabled, critic_pre_plan, sast_enabled, council_mode, hallucination_guard, mutation_test, phase_council, drift_check, final_council), lock state, and profile hash. Read-only.",agents:["architect"]},set_qa_gates:{description:"configure the QA gate profile for the current plan. Architect-only. Ratchet-tighter only — rejected once the profile is locked after critic approval. Supports: reviewer, test_engineer, sme_enabled, critic_pre_plan, sast_enabled, council_mode, hallucination_guard, mutation_test, phase_council, drift_check, final_council.",agents:["architect"]},web_search:{description:"External web search (Tavily or Brave) for architect-driven council research, SME domain research, researcher auto-research, and skill-improver research. Returns titled results with snippets, URLs, normalized query metadata, temporal intent, freshness, and removed stale years. Config-gated on council.general.enabled in the resolved config: global ~/.config/opencode/opencode-swarm.json, then project .opencode/opencode-swarm.json overrides. Requires a search API key. Used by the architect in MODE: COUNCIL to gather a RESEARCH CONTEXT before dispatching council agents, by SME for opt-in external skill/source evaluation, and by the researcher agent for multi-source auto-research.",agents:["sme","researcher","skill_improver"]},web_fetch:{description:"Fetch the readable text of a single http(s) URL (architect-only). Returns decoded page text, document title, final URL after redirects, and an evidence reference. Reads primary sources that web_search only surfaces as snippets. Config-gated on council.general.enabled. Blocks private/loopback/link-local/metadata addresses (re-validated and re-pinned across redirects); enforces timeout and body size cap.",agents:[]},convene_general_council:{description:"Synthesize responses from a multi-model General Council. Accepts parallel member responses (Round 1, optionally Round 2), detects disagreements, and returns consensus points, persisting disagreements, and a structured synthesis. Architect-only. Config-gated on council.general.enabled in the resolved config: global ~/.config/opencode/opencode-swarm.json, then project .opencode/opencode-swarm.json overrides.",agents:[]},write_final_council_evidence:{description:"Persist project-scoped final council evidence to .swarm/evidence/final-council.json. PREREQUISITE: dispatch critic, reviewer, sme, test_engineer, and explorer as project-scoped Agent tasks and collect their CouncilMemberVerdict JSON — this tool synthesizes only. Rejects on insufficient quorum or CONCERNS with unresolved requiredFixes; normalizes verdicts to approved/concerns/rejected. Architect-only.",agents:[]},skill_generate:{description:"compile knowledge entries into a structured SKILL.md draft",agents:["skill_improver"]},skill_list:{description:"list generated skill files and their status",agents:["skill_improver"]},skill_apply:{description:"activate a draft skill proposal",agents:[]},skill_inspect:{description:"inspect the content and source entries of a skill file",agents:["skill_improver"]},run_stale_reconciliation:{description:"reconcile skills against the knowledge store: mark skills stale when source knowledge is archived or deleted, or clear stale markers",agents:["architect"]},skill_regenerate:{description:"regenerate an active skill by re-clustering its source knowledge entries and updating the SKILL.md in place",agents:[]},skill_retire:{description:"retire a generated skill by adding a retired.marker file; retired skills are excluded from scoring and injection",agents:[]},skill_improve:{description:"run the skill_improver agent to review and refine skills",agents:["skill_improver"]},spec_write:{description:"author or update .swarm/spec.md for the current project",agents:["spec_writer"]},knowledge_receipt:{description:"file a receipt for retrieved knowledge (applied/ignored/contradicted + new lessons), recorded as immutable knowledge events",agents:["architect","sme","docs","docs_design","designer","critic_sounding_board","critic_drift_verifier","critic_hallucination_verifier","critic_architecture_supervisor","curator_init","curator_phase","skill_improver","spec_writer","reviewer","critic","coder","test_engineer"]},knowledge_archive:{description:"archive (default), quarantine, or purge a swarm or hive knowledge entry by ID with an immutable audit tombstone; purge requires an admin flag",agents:["architect"]},swarm_memory_recall:{description:"recall scoped Swarm memory for the current repository as untrusted background",agents:[]},swarm_memory_propose:{description:"create a pending Swarm memory proposal; does not write durable memory directly",agents:[]},swarm_command:{description:"run supported /swarm commands through the canonical command registry",agents:["architect","sme","researcher","docs","docs_design","designer","reviewer","critic","explorer","coder","test_engineer"]},dispatch_lanes:{description:"dispatch read-only exploration/review lanes concurrently and BLOCK until all finish; prefer dispatch_lanes_async for non-blocking dispatch, use this only when promptAsync is unavailable",agents:["architect"]},dispatch_lanes_async:{description:"launch read-only advisory lanes non-blockingly and return a batch id plus lane session handles immediately so you can keep working; launch_timeout_ms is only a promptAsync acceptance budget, not a lane runtime timeout; poll incrementally with collect_lane_results (wait omitted or false) while doing independent investigation, or join with wait: true when you need all results",agents:["architect"]},collect_lane_results:{description:"collect or poll results for a dispatch_lanes_async batch; supports both non-blocking polling (wait omitted or false) and blocking join (wait: true). Non-blocking polls include pending lane identities by default and process settled lanes incrementally while continuing independent work; busy/retry lanes are not timed out just because they run for a long time. Does not advance workflow gates.",agents:["architect"]},summarize_work:{description:"emit a short structured summary of completed work (key decisions, assumptions, risks, constraints) at task completion; rolls up per phase for architecture-supervisor review. Advisory, never blocks.",agents:["architect","sme","researcher","docs","docs_design","designer","explorer","coder","test_engineer"]},write_architecture_supervisor_evidence:{description:"persist the architecture supervisor verdict for a phase (architect MUST dispatch critic_architecture_supervisor first and collect its JSON verdict; this tool persists only, it does not contact the supervisor)",agents:["architect"]},lean_turbo_plan_lanes:{description:"partition phase tasks into parallel lanes based on file-scope conflicts for Lean Turbo execution",agents:[]},lean_turbo_acquire_locks:{description:"acquire file locks for all files in a lane (all-or-nothing) before lane execution",agents:[]},lean_turbo_runner_status:{description:"read Lean Turbo run state from .swarm/turbo-state.json",agents:[]},lean_turbo_review:{description:"dispatch a read-only reviewer agent to evaluate a completed Lean Turbo phase",agents:[]},lean_turbo_run_phase:{description:"Execute a phase using Lean Turbo parallel lane execution. Plans lanes, acquires file locks, and dispatches coder agents concurrently. Use when Lean Turbo is active and you want to execute all tasks in a phase in parallel lanes.",agents:[]},lean_turbo_status:{description:"returns Lean Turbo configuration and active status for the current session",agents:[]},swarm_apply_patch:{description:"Apply a unified diff patch to workspace files with exact context matching, atomic writes, and path validation. Use standard unified diff format only — does NOT support *** Begin Patch / *** Update File payloads (use native apply_patch for those).",agents:["coder","test_engineer"]},external_skill_discover:{description:"Discover external skill candidates from configured sources. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_list:{description:"List external skill candidates in the quarantine store. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_inspect:{description:"Inspect a specific external skill candidate by ID. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_promote:{description:"Promote a validated external skill candidate to an active generated skill. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_reject:{description:"Reject an external skill candidate after evaluation. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_delete:{description:"Delete an external skill candidate from the quarantine store. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},external_skill_revoke:{description:"Revoke a previously promoted external skill. Returns a disabled message when external_skills.curation_enabled is false.",agents:[]},epic_decide_phase:{description:"Compute the Epic Mode verdict for a phase WITHOUT dispatching coders. Runs preflight + calibration + the three gates (p-threshold, hot-module, greenfield), persists the decision, and returns the verdict so the architect can dispatch waves via the visible Task tool (promote) or fall back to per-task serial (demote). Pair with `epic_plan_waves` to get the wave plan when promoted. Use when /swarm epic is on for the session.",agents:["architect"]},epic_plan_waves:{description:"Partition a phase's pending tasks into ordered concurrent waves for Epic Mode dispatch. A wave is a set of tasks with mutually disjoint declared scopes and all dependencies satisfied by prior waves. Returns `{ waves: [{ waveId, taskIds, files }, ...], serializedTasks, degradedTasks }`. "+'For each wave in order, the architect dispatches one `Task(subagent_type="coder", ...)` per `taskId` — all in one assistant message — so the wave runs concurrently and each coder appears as a visible subagent. '+"Wait for the wave to finish before dispatching the next. Pair with `epic_decide_phase` (called first; this tool is only relevant on a `promote` verdict). "+"Preflight reject reasons: `no-plan`, `no-phase`, `phase-empty`, `phase-already-complete`, `scopes-missing` (call `declare_scope` for `missingScopes`), `git-failed` (transient — retry), `planner-error`.",agents:["architect"]},epic_record_divergence:{description:"After every `update_task_status(completed)`, record the task's declared-vs-actual divergence to .swarm/epic/divergence.jsonl. Feeds Epic Mode's self-calibration loop (Capability D). Best-effort: never blocks.",agents:["architect"]}},TOOL_NAMES=Object.keys(TOOL_METADATA),TOOL_NAME_SET=new Set(TOOL_NAMES),TOOL_DESCRIPTIONS=Object.fromEntries(Object.entries(TOOL_METADATA).map(([name,meta])=>[name,meta.description])),AGENT_TOOL_MAP=(()=>{let map=Object.fromEntries(ALL_AGENT_NAMES.map((agent)=>[agent,[]]));for(let[name,meta]of Object.entries(TOOL_METADATA))for(let agent of meta.agents)map[agent].push(name);return map})()});function deepMergeInternal(base,override,depth){if(depth>=10)throw Error("deepMerge exceeded maximum depth of 10");let result={...base};for(let key of Object.keys(override)){let baseVal=base[key],overrideVal=override[key];if(typeof baseVal==="object"&&baseVal!==null&&typeof overrideVal==="object"&&overrideVal!==null&&!Array.isArray(baseVal)&&!Array.isArray(overrideVal))result[key]=deepMergeInternal(baseVal,overrideVal,depth+1);else result[key]=overrideVal}return result}function deepMerge(base,override){if(!base)return override;if(!override)return base;return deepMergeInternal(base,override,0)}function freezeSet(items){let set=new Set(items),proxy=new Proxy(set,{get(target,prop){if(prop==="add"||prop==="delete"||prop==="clear")return()=>{throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")};if(prop==="forEach")return(callback,thisArg)=>{let wrapped=(v,k)=>callback.call(thisArg??void 0,v,k,proxy);return set.forEach(wrapped)};let value=Reflect.get(target,prop);return typeof value==="function"?value.bind(target):value},set(){throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")},deleteProperty(){throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")},defineProperty(){throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")},setPrototypeOf(){throw TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly")}});return proxy}function isQAAgent(name){return QA_AGENTS.includes(name)}function isSubagent(name){return ALL_SUBAGENT_NAMES.includes(name)}function isLowCapabilityModel(modelId){let lower=(modelId||"").toLowerCase();return LOW_CAPABILITY_MODELS.some((substr)=>lower.includes(substr))}var OPENCODE_NATIVE_AGENTS,CLAUDE_CODE_NATIVE_COMMANDS,MEMORY_AGENT_TOOL_MAP,EXTERNAL_SKILL_TOOL_NAMES,EXTERNAL_SKILL_AGENT_TOOL_MAP,COUNCIL_TOOL_NAMES,COUNCIL_AGENT_TOOL_MAP,GENERAL_COUNCIL_TOOL_NAMES,GENERAL_COUNCIL_AGENT_TOOL_MAP,TURBO_TOOL_NAMES,TURBO_AGENT_TOOL_MAP,SKILL_TOOL_NAMES,SKILL_AGENT_TOOL_MAP,WRITE_TOOL_NAMES,DEFAULT_MODELS,DEFAULT_SCORING_CONFIG,LOW_CAPABILITY_MODELS,TURBO_MODE_BANNER=`## \uD83D\uDE80 TURBO MODE ACTIVE
2
2
 
3
3
  **Speed optimization enabled for this session.**
4
4
 
@@ -295,7 +295,7 @@ ${warnings.map((w)=>` - ${w}`).join(`
295
295
  BEGIN
296
296
  SELECT RAISE(ABORT, 'qa_gate_profile row is locked and cannot be modified after critic approval');
297
297
  END`}],_projectDbs=new Map});import{createHash as createHash5}from"node:crypto";function rowToProfile(row){let parsed={};try{let maybeGates=JSON.parse(row.gates);if(maybeGates&&typeof maybeGates==="object"&&!Array.isArray(maybeGates))parsed=maybeGates}catch{parsed={}}let raw=parsed;if(raw.council_mode===!0&&raw.phase_council===void 0)parsed.phase_council=!0,parsed.council_mode=!1;let knownKeys=new Set(Object.keys(DEFAULT_QA_GATES)),filteredParsed={};for(let key of Object.keys(parsed))if(knownKeys.has(key))filteredParsed[key]=parsed[key];let gates={...DEFAULT_QA_GATES,...filteredParsed};return{id:row.id,plan_id:row.plan_id,created_at:row.created_at,project_type:row.project_type,gates,locked_at:row.locked_at,locked_by_snapshot_seq:row.locked_by_snapshot_seq}}function getProfile(directory,planId){if(!projectDbExists(directory))return null;let row=getProjectDb(directory).query("SELECT * FROM qa_gate_profile WHERE plan_id = ?").get(planId);return row?rowToProfile(row):null}function hasAnyProfileWithEnabledGate(directory,gate){if(!projectDbExists(directory))return!1;let rows=getProjectDb(directory).query("SELECT gates FROM qa_gate_profile").all();for(let row of rows)try{if(JSON.parse(row.gates)?.[gate]===!0)return!0}catch{}return!1}function getOrCreateProfile(directory,planId,projectType){let existing=_internals15.getProfile(directory,planId);if(existing)return existing;let db=getProjectDb(directory),gatesJson=JSON.stringify(DEFAULT_QA_GATES),insert=db.transaction(()=>{db.run("INSERT INTO qa_gate_profile (plan_id, project_type, gates) VALUES (?, ?, ?)",[planId,projectType??null,gatesJson])});try{insert()}catch(err){if(!(err instanceof Error?err.message:String(err)).toLowerCase().includes("unique"))throw err}let after=_internals15.getProfile(directory,planId);if(!after)throw Error(`Failed to create or load QA gate profile for plan_id=${planId}`);return after}function setGates(directory,planId,gates){let current=_internals15.getProfile(directory,planId);if(!current)throw Error(`No QA gate profile found for plan_id=${planId} — call getOrCreateProfile first`);if(current.locked_at!==null)throw Error("Cannot modify gates: QA gate profile is locked after critic approval");let merged={...current.gates};for(let key of Object.keys(gates)){let incoming=gates[key];if(incoming===void 0)continue;if(incoming===!1&&current.gates[key]===!0)throw Error(`Cannot disable gate '${key}': sessions can only ratchet tighter`);if(incoming===!0)merged[key]=!0}getProjectDb(directory).run("UPDATE qa_gate_profile SET gates = ? WHERE plan_id = ?",[JSON.stringify(merged),planId]);let updated=_internals15.getProfile(directory,planId);if(!updated)throw Error(`Failed to re-read QA gate profile after update for plan_id=${planId}`);return updated}function lockProfile(directory,planId,snapshotSeq){let current=_internals15.getProfile(directory,planId);if(!current)throw Error(`No QA gate profile found for plan_id=${planId} — cannot lock`);if(current.locked_at!==null)return current;getProjectDb(directory).run("UPDATE qa_gate_profile SET locked_at = datetime('now'), locked_by_snapshot_seq = ? WHERE plan_id = ?",[snapshotSeq,planId]);let locked=_internals15.getProfile(directory,planId);if(!locked)throw Error(`Failed to re-read locked QA gate profile for plan_id=${planId}`);return locked}function computeProfileHash(profile){let payload=JSON.stringify({plan_id:profile.plan_id,gates:profile.gates});return createHash5("sha256").update(payload).digest("hex")}function getEffectiveGates(profile,sessionOverrides){let merged={...profile.gates};for(let key of Object.keys(sessionOverrides))if(sessionOverrides[key]===!0)merged[key]=!0;return merged}var _internals15,DEFAULT_QA_GATES;var init_qa_gate_profile=__esm(()=>{init_project_db();_internals15={getProfile,getOrCreateProfile,setGates,getEffectiveGates,computeProfileHash,hasAnyProfileWithEnabledGate},DEFAULT_QA_GATES={reviewer:!0,test_engineer:!0,council_mode:!1,sme_enabled:!0,critic_pre_plan:!0,hallucination_guard:!1,sast_enabled:!0,mutation_test:!1,phase_council:!1,drift_check:!0,final_council:!1}});function detectHostOS(){switch(process.platform){case"win32":return"windows";case"darwin":return"macos";case"linux":return"linux";default:return"unknown"}}function detectShellFamily(){if(process.env.PSModulePath)return"powershell";if((process.env.ComSpec??"").toLowerCase().includes("cmd.exe"))return"cmd";let shell=process.env.SHELL??"";if(shell.includes("bash"))return"bash";if(shell.includes("zsh"))return"zsh";if(shell.includes("/sh"))return"sh";return"unknown"}function detectExecutionMode(hostOS){if(process.env.WSL_DISTRO_NAME)return"wsl";if(hostOS==="linux"){if(["DOCKER_CONTAINER","KUBERNETES_SERVICE_HOST","CONTAINER"].some((k)=>process.env[k]))return"docker"}return"native"}function deriveOperatingMode(hostOS,_executionMode){if(hostOS==="linux")return"linux";if(hostOS==="macos")return"macos-native";if(hostOS==="windows")return"windows-native";return"unknown"}function buildCommandPolicy(profile){if(profile.isWindowsNative)return{preferredShell:"powershell",avoidPosixExamples:!0,preferNodeApis:!0,preferToolingOverShell:!0,pathExampleStyle:"windows",examples:{listDir:"Get-ChildItem -Force",removeFile:"Remove-Item file.tmp",setEnv:'$env:DEBUG = "1"',printEnv:"$env:PATH",searchText:'Get-ChildItem -Recurse src | Select-String "foo"'}};return{preferredShell:profile.shellFamily==="unknown"?"bash":profile.shellFamily,avoidPosixExamples:!1,preferNodeApis:!0,preferToolingOverShell:!0,pathExampleStyle:"posix",examples:{listDir:"ls -la",removeFile:"rm file.tmp",setEnv:"export DEBUG=1",printEnv:"echo $PATH",searchText:'grep -R "foo" src/'}}}function detectEnvironmentProfile(){let hostOS=detectHostOS(),shellFamily=detectShellFamily(),executionMode=detectExecutionMode(hostOS),operatingMode=deriveOperatingMode(hostOS,executionMode),isWindowsNative=hostOS==="windows"&&executionMode==="native",isWindowsDocker=!1;return{hostOS,shellFamily,executionMode,operatingMode,isWindowsNative,isWindowsDocker:!1,isWSL:executionMode==="wsl",pathStyle:hostOS==="windows"?"windows":"posix",shellCommandPreference:isWindowsNative?"powershell-native":"posix-native",evidence:{processPlatform:process.platform,comspec:process.env.ComSpec,psModulePath:process.env.PSModulePath,termProgram:process.env.TERM_PROGRAM,shell:process.env.SHELL,wslDistroName:process.env.WSL_DISTRO_NAME,containerMarkers:["DOCKER_CONTAINER","KUBERNETES_SERVICE_HOST","CONTAINER"].filter((k)=>!!process.env[k])}}}function deriveCommandPolicy(profile){return buildCommandPolicy(profile)}async function computeComplexity(directory,changedFiles){let functionCount=0,astChangeCount=0,maxFileComplexity=0;for(let file2 of changedFiles){if(!/\.(ts|js|tsx|jsx|py|go|rs)$/.test(file2))continue;try{let fs14=await import("node:fs"),filePath=(await import("node:path")).join(directory,file2);if(!fs14.existsSync(filePath))continue;let content=fs14.readFileSync(filePath,"utf-8"),fileFunctionCount=content.match(/\b(function|def|func|fn)\s+\w+/g)?.length||0;functionCount+=fileFunctionCount;let lines=content.split(`
298
- `).length,estimatedChanges=Math.min(lines/10,50);astChangeCount+=estimatedChanges;let fileComplexity=fileFunctionCount+lines/100;maxFileComplexity=Math.max(maxFileComplexity,fileComplexity)}catch{}}return{fileCount:changedFiles.length,functionCount,astChangeCount:Math.round(astChangeCount),maxFileComplexity:Math.round(maxFileComplexity*10)/10}}function routeReview(metrics){if(metrics.fileCount>=5||metrics.functionCount>=10||metrics.astChangeCount>=30||metrics.maxFileComplexity>=15)return{reviewerCount:2,testEngineerCount:2,depth:"double",reason:`High complexity: ${metrics.fileCount} files, ${metrics.functionCount} functions, complexity score ${metrics.maxFileComplexity}`};return{reviewerCount:1,testEngineerCount:1,depth:"single",reason:`Standard complexity: ${metrics.fileCount} files, ${metrics.functionCount} functions`}}async function routeReviewForChanges(directory,changedFiles){let metrics=await computeComplexity(directory,changedFiles);return routeReview(metrics)}function shouldParallelizeReview(routing){return routing.depth==="double"}var exports_scope_persistence={};__export(exports_scope_persistence,{writeScopeToDisk:()=>writeScopeToDisk,resolveScopeWithFallbacks:()=>resolveScopeWithFallbacks,readScopeFromDisk:()=>readScopeFromDisk,readPlanScope:()=>readPlanScope,clearScopeForTask:()=>clearScopeForTask,clearAllScopes:()=>clearAllScopes});import*as fs14 from"node:fs";import*as path21 from"node:path";function getScopesDir(directory){return path21.join(directory,SCOPES_DIR)}function isSafeTaskId(taskId){if(typeof taskId!=="string")return!1;if(!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(taskId))return!1;let head=taskId.replace(/\.+$/,"").split(".")[0].toUpperCase();if(WINDOWS_RESERVED.has(head))return!1;return!0}function isScopesDirSafe(directory,scopesDir){try{let resolvedWorkspace=fs14.realpathSync(directory),resolvedScopes=fs14.realpathSync(scopesDir),rel=path21.relative(resolvedWorkspace,resolvedScopes);return rel.length>0&&!rel.startsWith("..")&&!path21.isAbsolute(rel)}catch{return!1}}function getScopeFilePath(directory,taskId){if(!isSafeTaskId(taskId))throw Error(`Invalid taskId for scope persistence: ${taskId}`);return path21.join(getScopesDir(directory),`scope-${taskId}.json`)}async function writeScopeToDisk(directory,taskId,files,ttlMs=DEFAULT_TTL_MS){if(!isSafeTaskId(taskId))return;if(!Array.isArray(files)||files.length===0)return;if(files.length>MAX_FILES_PER_SCOPE)return;let scopesDir=getScopesDir(directory),scopePath=getScopeFilePath(directory,taskId);try{fs14.mkdirSync(scopesDir,{recursive:!0})}catch{return}if(!isScopesDirSafe(directory,scopesDir))return;let now=Date.now(),payload={version:SCOPE_SCHEMA_VERSION,taskId,declaredAt:now,expiresAt:now+ttlMs,files:[...files]},content=JSON.stringify(payload,null,2);try{let flags=fs14.constants.O_WRONLY|fs14.constants.O_CREAT,nofollow=fs14.constants.O_NOFOLLOW??0,fd=fs14.openSync(scopePath,flags|nofollow);fs14.closeSync(fd)}catch{return}let release;try{release=await import_proper_lockfile2.default.lock(scopePath,{stale:LOCK_STALE_MS,retries:{retries:3,minTimeout:50,maxTimeout:200},realpath:!1}),await atomicWrite(scopePath,content)}catch{}finally{if(release)try{await release()}catch{}}}async function atomicWrite(targetPath,content){let tempPath=`${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random()*1e9)}`;try{await bunWrite(tempPath,content),fs14.renameSync(tempPath,targetPath)}finally{try{fs14.unlinkSync(tempPath)}catch{}}}function readScopeFromDisk(directory,taskId){if(!isSafeTaskId(taskId))return null;let scopesDir=getScopesDir(directory);if(!isScopesDirSafe(directory,scopesDir))return null;let scopePath=getScopeFilePath(directory,taskId),nofollow=fs14.constants.O_NOFOLLOW??0,fd;try{fd=fs14.openSync(scopePath,fs14.constants.O_RDONLY|nofollow)}catch{return null}let raw;try{let stat5=fs14.fstatSync(fd);if(!stat5.isFile())return null;if(stat5.size>MAX_SCOPE_BYTES)return null;let buf=Buffer.alloc(stat5.size);fs14.readSync(fd,buf,0,stat5.size,0),raw=buf.toString("utf-8")}catch{return null}finally{try{fs14.closeSync(fd)}catch{}}if(!raw.trim())return null;let parsed;try{parsed=JSON.parse(raw)}catch{return null}if(parsed.version!==SCOPE_SCHEMA_VERSION)return null;if(parsed.taskId!==taskId)return null;let now=Date.now();if(typeof parsed.declaredAt!=="number"||parsed.declaredAt>now)return null;if(typeof parsed.expiresAt!=="number"||now>parsed.expiresAt)return null;if(!Array.isArray(parsed.files))return null;if(parsed.files.length>MAX_FILES_PER_SCOPE)return null;let files=parsed.files.filter((f)=>typeof f==="string");return files.length>0?files:null}function readPlanScope(directory,taskId){if(!isSafeTaskId(taskId))return null;try{let planPath=path21.join(directory,".swarm","plan.json"),stat5=fs14.statSync(planPath);if(!stat5.isFile())return null;if(stat5.size>MAX_PLAN_BYTES)return null;let raw=fs14.readFileSync(planPath,"utf-8"),plan=JSON.parse(raw);for(let phase of plan.phases??[])for(let task of phase.tasks??[]){if(task.id!==taskId)continue;let ft=task.files_touched;if(Array.isArray(ft)&&ft.length>0){if(ft.length>MAX_FILES_PER_SCOPE)return null;return ft.filter((f)=>typeof f==="string")}if(typeof ft==="string"&&ft.length>0)return[ft];return null}return null}catch{return null}}function clearScopeForTask(directory,taskId){if(!isSafeTaskId(taskId))return;try{fs14.unlinkSync(getScopeFilePath(directory,taskId))}catch{}}function clearAllScopes(directory){try{fs14.rmSync(getScopesDir(directory),{recursive:!0,force:!0})}catch{}}function resolveScopeWithFallbacks(input){let{directory,taskId,inMemoryScope,pendingMapScope}=input;if(inMemoryScope&&inMemoryScope.length>0)return inMemoryScope;if(taskId){let disk=readScopeFromDisk(directory,taskId);if(disk&&disk.length>0)return disk;let plan=readPlanScope(directory,taskId);if(plan&&plan.length>0)return plan}if(pendingMapScope&&pendingMapScope.length>0)return pendingMapScope;return null}var import_proper_lockfile2,SCOPE_SCHEMA_VERSION=1,DEFAULT_TTL_MS=86400000,LOCK_STALE_MS=30000,SCOPES_DIR=".swarm/scopes",MAX_FILES_PER_SCOPE=1e4,MAX_PLAN_BYTES=10485760,MAX_SCOPE_BYTES=2097152,WINDOWS_RESERVED;var init_scope_persistence=__esm(()=>{init_bun_compat();import_proper_lockfile2=__toESM(require_proper_lockfile(),1),WINDOWS_RESERVED=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"])});var exports_core3={};__export(exports_core3,{writeLaneProfileToDiskReal:()=>writeLaneProfileToDiskReal,shortenWorktreePath:()=>shortenWorktreePath,resolveWorktreeBaseDir:()=>resolveWorktreeBaseDir,removeWorktree:()=>removeWorktree,removeLaneProfileFromDiskReal:()=>removeLaneProfileFromDiskReal,provisionWorktree:()=>provisionWorktree,makeWorktreeBranchName:()=>makeWorktreeBranchName,isPathUnderSwarmWorktreeBase:()=>isPathUnderSwarmWorktreeBase,isCleanWorktree:()=>isCleanWorktree,cleanUntrackedFiles:()=>cleanUntrackedFiles,checkPathBudget:()=>checkPathBudget,autoCommitDirty:()=>autoCommitDirty,assertCleanWorkingTree:()=>assertCleanWorkingTree,_internals:()=>_internals16});import*as fs15 from"node:fs";import*as fsPromises5 from"node:fs/promises";import*as os9 from"node:os";import*as path22 from"node:path";async function writeLaneProfileToDiskReal(worktreePath,laneIndex,envOverrides){let lines=[];for(let[key,value]of Object.entries(envOverrides)){if(value===null)continue;if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key))continue;if(value.includes(`
298
+ `).length,estimatedChanges=Math.min(lines/10,50);astChangeCount+=estimatedChanges;let fileComplexity=fileFunctionCount+lines/100;maxFileComplexity=Math.max(maxFileComplexity,fileComplexity)}catch{}}return{fileCount:changedFiles.length,functionCount,astChangeCount:Math.round(astChangeCount),maxFileComplexity:Math.round(maxFileComplexity*10)/10}}function routeReview(metrics){if(metrics.fileCount>=5||metrics.functionCount>=10||metrics.astChangeCount>=30||metrics.maxFileComplexity>=15)return{reviewerCount:2,testEngineerCount:2,depth:"double",reason:`High complexity: ${metrics.fileCount} files, ${metrics.functionCount} functions, complexity score ${metrics.maxFileComplexity}`};return{reviewerCount:1,testEngineerCount:1,depth:"single",reason:`Standard complexity: ${metrics.fileCount} files, ${metrics.functionCount} functions`}}async function routeReviewForChanges(directory,changedFiles){let metrics=await computeComplexity(directory,changedFiles);return routeReview(metrics)}function shouldParallelizeReview(routing){return routing.depth==="double"}var exports_scope_persistence={};__export(exports_scope_persistence,{writeScopeToDisk:()=>writeScopeToDisk,resolveScopeWithFallbacks:()=>resolveScopeWithFallbacks,readScopeFromDisk:()=>readScopeFromDisk,readPlanScope:()=>readPlanScope,clearScopeForTask:()=>clearScopeForTask,clearAllScopes:()=>clearAllScopes});import*as fs14 from"node:fs";import*as path21 from"node:path";function getScopesDir(directory){return path21.join(directory,SCOPES_DIR)}function isSafeTaskId(taskId){if(typeof taskId!=="string")return!1;if(!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(taskId))return!1;let head=taskId.replace(/\.+$/,"").split(".")[0].toUpperCase();if(WINDOWS_RESERVED.has(head))return!1;return!0}function isScopesDirSafe(directory,scopesDir){try{let resolvedWorkspace=fs14.realpathSync(directory),resolvedScopes=fs14.realpathSync(scopesDir),rel=path21.relative(resolvedWorkspace,resolvedScopes);return rel.length>0&&!rel.startsWith("..")&&!path21.isAbsolute(rel)}catch{return!1}}function getScopeFilePath(directory,taskId){if(!isSafeTaskId(taskId))throw Error(`Invalid taskId for scope persistence: ${taskId}`);return path21.join(getScopesDir(directory),`scope-${taskId}.json`)}async function writeScopeToDisk(directory,taskId,files,ttlMs=DEFAULT_TTL_MS){if(!isSafeTaskId(taskId))return;if(!Array.isArray(files)||files.length===0)return;if(files.length>MAX_FILES_PER_SCOPE)return;let scopesDir=getScopesDir(directory),scopePath=getScopeFilePath(directory,taskId);try{fs14.mkdirSync(scopesDir,{recursive:!0})}catch{return}if(!isScopesDirSafe(directory,scopesDir))return;let now=Date.now(),payload={version:SCOPE_SCHEMA_VERSION,taskId,declaredAt:now,expiresAt:now+ttlMs,files:[...files]},content=JSON.stringify(payload,null,2);try{let flags=fs14.constants.O_WRONLY|fs14.constants.O_CREAT,nofollow=fs14.constants.O_NOFOLLOW??0,fd=fs14.openSync(scopePath,flags|nofollow);fs14.closeSync(fd)}catch{return}let release;try{release=await import_proper_lockfile2.default.lock(scopePath,{stale:LOCK_STALE_MS,retries:{retries:3,minTimeout:50,maxTimeout:200},realpath:!1}),await atomicWrite(scopePath,content)}catch{}finally{if(release)try{await release()}catch{}}}async function atomicWrite(targetPath,content){let tempPath=`${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random()*1e9)}`;try{await bunWrite(tempPath,content),fs14.renameSync(tempPath,targetPath)}finally{try{fs14.unlinkSync(tempPath)}catch{}}}function readScopeFromDisk(directory,taskId){if(!isSafeTaskId(taskId))return null;let scopesDir=getScopesDir(directory);if(!isScopesDirSafe(directory,scopesDir))return null;let scopePath=getScopeFilePath(directory,taskId),nofollow=fs14.constants.O_NOFOLLOW??0,fd;try{fd=fs14.openSync(scopePath,fs14.constants.O_RDONLY|nofollow)}catch{return null}let raw;try{let stat5=fs14.fstatSync(fd);if(!stat5.isFile())return null;if(stat5.size>MAX_SCOPE_BYTES)return null;let buf=Buffer.alloc(stat5.size);fs14.readSync(fd,buf,0,stat5.size,0),raw=buf.toString("utf-8")}catch{return null}finally{try{fs14.closeSync(fd)}catch{}}if(!raw.trim())return null;let parsed;try{parsed=JSON.parse(raw)}catch{return null}if(parsed.version!==SCOPE_SCHEMA_VERSION)return null;if(parsed.taskId!==taskId)return null;let now=Date.now();if(typeof parsed.declaredAt!=="number"||parsed.declaredAt>now)return null;if(typeof parsed.expiresAt!=="number"||now>=parsed.expiresAt)return null;if(!Array.isArray(parsed.files))return null;if(parsed.files.length>MAX_FILES_PER_SCOPE)return null;let files=parsed.files.filter((f)=>typeof f==="string");return files.length>0?files:null}function readPlanScope(directory,taskId){if(!isSafeTaskId(taskId))return null;try{let planPath=path21.join(directory,".swarm","plan.json"),stat5=fs14.statSync(planPath);if(!stat5.isFile())return null;if(stat5.size>MAX_PLAN_BYTES)return null;let raw=fs14.readFileSync(planPath,"utf-8"),plan=JSON.parse(raw);for(let phase of plan.phases??[])for(let task of phase.tasks??[]){if(task.id!==taskId)continue;let ft=task.files_touched;if(Array.isArray(ft)&&ft.length>0){if(ft.length>MAX_FILES_PER_SCOPE)return null;return ft.filter((f)=>typeof f==="string")}if(typeof ft==="string"&&ft.length>0)return[ft];return null}return null}catch{return null}}function clearScopeForTask(directory,taskId){if(!isSafeTaskId(taskId))return;try{fs14.unlinkSync(getScopeFilePath(directory,taskId))}catch{}}function clearAllScopes(directory){try{fs14.rmSync(getScopesDir(directory),{recursive:!0,force:!0})}catch{}}function resolveScopeWithFallbacks(input){let{directory,taskId,inMemoryScope,pendingMapScope}=input;if(inMemoryScope&&inMemoryScope.length>0)return inMemoryScope;if(taskId){let disk=readScopeFromDisk(directory,taskId);if(disk&&disk.length>0)return disk;let plan=readPlanScope(directory,taskId);if(plan&&plan.length>0)return plan}if(pendingMapScope&&pendingMapScope.length>0)return pendingMapScope;return null}var import_proper_lockfile2,SCOPE_SCHEMA_VERSION=1,DEFAULT_TTL_MS=86400000,LOCK_STALE_MS=30000,SCOPES_DIR=".swarm/scopes",MAX_FILES_PER_SCOPE=1e4,MAX_PLAN_BYTES=10485760,MAX_SCOPE_BYTES=2097152,WINDOWS_RESERVED;var init_scope_persistence=__esm(()=>{init_bun_compat();import_proper_lockfile2=__toESM(require_proper_lockfile(),1),WINDOWS_RESERVED=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"])});var exports_core3={};__export(exports_core3,{writeLaneProfileToDiskReal:()=>writeLaneProfileToDiskReal,shortenWorktreePath:()=>shortenWorktreePath,resolveWorktreeBaseDir:()=>resolveWorktreeBaseDir,removeWorktree:()=>removeWorktree,removeLaneProfileFromDiskReal:()=>removeLaneProfileFromDiskReal,provisionWorktree:()=>provisionWorktree,makeWorktreeBranchName:()=>makeWorktreeBranchName,isPathUnderSwarmWorktreeBase:()=>isPathUnderSwarmWorktreeBase,isCleanWorktree:()=>isCleanWorktree,cleanUntrackedFiles:()=>cleanUntrackedFiles,checkPathBudget:()=>checkPathBudget,autoCommitDirty:()=>autoCommitDirty,assertCleanWorkingTree:()=>assertCleanWorkingTree,_internals:()=>_internals16});import*as fs15 from"node:fs";import*as fsPromises5 from"node:fs/promises";import*as os9 from"node:os";import*as path22 from"node:path";async function writeLaneProfileToDiskReal(worktreePath,laneIndex,envOverrides){let lines=[];for(let[key,value]of Object.entries(envOverrides)){if(value===null)continue;if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key))continue;if(value.includes(`
299
299
  `)||value.includes("\r")){log("writeLaneProfileToDisk: skipping env var with newline in value",{key});continue}lines.push(`${key}=${value}`)}if(lines.length===0)return;let lanesDir=path22.join(worktreePath,".swarm","lanes");await fs15.promises.mkdir(lanesDir,{recursive:!0});let envPath=path22.join(lanesDir,`${laneIndex}.env`);await fs15.promises.writeFile(envPath,`${lines.join(`
300
300
  `)}
301
301
  `,"utf-8")}async function removeLaneProfileFromDiskReal(worktreePath,laneIndex){let envPath=path22.join(worktreePath,".swarm","lanes",`${laneIndex}.env`);try{await fs15.promises.unlink(envPath)}catch(err){if(err.code!=="ENOENT")console.warn(`[worktree] Failed to remove lane profile ${envPath}: ${err.message}`)}}async function runGit(args2,cwd,timeoutMs=WORKTREE_TIMEOUT_MS){let proc=_internals16.bunSpawn(["git",...args2],{cwd,timeout:timeoutMs,stdin:"ignore",stdout:"pipe",stderr:"pipe",env:{...process.env,LC_ALL:"C"}});try{let exitCode=await proc.exited,stdout=await proc.stdout.text(),stderr=await proc.stderr.text();return{exitCode,stdout,stderr}}finally{try{proc.kill()}catch{}}}async function checkPathBudget(worktreeRoot,directory){if(_internals16.platform!=="win32")return{ok:!0};let longPaths;try{longPaths=await _internals16.getCoreLongPaths(directory)}catch{}if(longPaths==="true")return{ok:!0};let proc=_internals16.bunSpawn(["git","ls-files"],{cwd:directory,timeout:WORKTREE_TIMEOUT_MS,stdin:"ignore",stdout:"pipe",stderr:"ignore",env:{...process.env,LC_ALL:"C"}});try{let exitCode=await proc.exited,stdout=await proc.stdout.text();if(exitCode!==0||stdout.trim().length===0)return{ok:!0};let files=stdout.split(/\r?\n/),longest=0;for(let file2 of files)if(file2.length>longest)longest=file2.length;let totalPathLength=worktreeRoot.length+1+longest;if(totalPathLength>=WIN_PATH_BUDGET)return{ok:!1,error:`Total path budget exceeded: worktree root "${worktreeRoot}" (${worktreeRoot.length} chars) + longest file "${files.find((f)=>f.length===longest)}" (${longest} chars) = ${totalPathLength} chars (budget: ${WIN_PATH_BUDGET})`,suggestion:"Set config.worktree_dir to a shorter absolute path, or let the auto-shorten feature relocate the worktree to the system temp directory."};return{ok:!0}}finally{try{proc.kill()}catch{}}}function shortenWorktreePath(_directory,sessionId,laneId){let tmp=_internals16.osTmpdir();try{tmp=fs15.realpathSync(tmp)}catch{}return path22.join(tmp,"swwt",sessionId,laneId)}function makeWorktreeBranchName(sessionId,id,options){if(options.branchStyle==="legacy-lane"&&options.purpose==="lane")return`swarm-lane/${sessionId}/${id}`;return`swarm/${options.purpose}/${sessionId}/${id}`}function resolveWorktreeBaseDir(directory,worktreeDir){return worktreeDir?path22.resolve(directory,worktreeDir):path22.resolve(path22.dirname(directory),".swarm-worktrees")}function isPathUnderSwarmWorktreeBase(targetPath,directory,worktreeDirOverrides=[]){let caseInsensitive=process.platform==="win32",realTarget;try{realTarget=fs15.realpathSync(path22.resolve(directory,targetPath))}catch{return!1}let bases=[resolveWorktreeBaseDir(directory),...worktreeDirOverrides.map((d)=>resolveWorktreeBaseDir(directory,d))],cmpTarget=caseInsensitive?realTarget.toLowerCase():realTarget;return bases.some((base)=>{let realBase;try{realBase=fs15.realpathSync(base)}catch{realBase=path22.resolve(base)}let cmpBase=caseInsensitive?realBase.toLowerCase():realBase;if(cmpTarget===cmpBase)return!0;let rel=path22.relative(cmpBase,cmpTarget);return rel.length>0&&!rel.startsWith("..")&&!path22.isAbsolute(rel)})}async function provisionWorktree(directory,id,sessionId,options){let branchName=makeWorktreeBranchName(sessionId,id,options),worktreePath=path22.resolve(resolveWorktreeBaseDir(directory,options.worktreeDir),sessionId,id),budgetResult=await checkPathBudget(worktreePath,directory);if(budgetResult.ok===!1)if(options.worktreeDir)console.warn(`[swarm] Path budget warning: ${budgetResult.error} ${budgetResult.suggestion}`);else{let shortPath=shortenWorktreePath(directory,sessionId,id);if((await checkPathBudget(shortPath,directory)).ok===!1)return{error:budgetResult.error};worktreePath=shortPath}if((await runGit(["show-ref","--verify","--quiet",`refs/heads/${branchName}`],directory)).exitCode===0){let listResult=await runGit(["worktree","list","--porcelain"],directory),normalizeGitPath=(p)=>{let lexical=p.replace(/\\/g,"/").replace(/\/+$/,"");try{return fs15.realpathSync(p).replace(/\\/g,"/").replace(/\/+$/,"")}catch{return lexical}},expectedPath=normalizeGitPath(worktreePath),entries=[],current={path:"",branch:void 0};if(listResult.exitCode!==0){let raw=listResult.stderr.trim()||listResult.stdout.trim();return{error:`worktree enumeration failed: ${raw.length>500?`${raw.slice(0,500)}... (truncated)`:raw}`}}for(let rawLine of listResult.stdout.split(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.110.1",
3
+ "version": "7.110.2",
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",