opencode-swarm 7.99.1 → 7.99.3

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.
@@ -61,6 +61,14 @@ If `council.general.enabled` is true in the resolved opencode-swarm config AND a
61
61
  - Exit when reviewer signs off (or user explicitly accepts remaining disagreements).
62
62
 
63
63
  **Phase 6: QA GATE SELECTION, PARALLEL CODERS, AND COMMIT FREQUENCY (architect, dialogue only).**
64
+ Auto-loop exception: when BRAINSTORM is running inside MODE: LOOP with
65
+ `autonomy=auto`, do not ask this preference question. Write the balanced-speed
66
+ default `## Pending QA Gate Selection` instead (reviewer, test_engineer,
67
+ sme_enabled, critic_pre_plan, sast_enabled, drift_check ON; council_mode,
68
+ hallucination_guard, mutation_test, phase_council, final_council OFF). Do not
69
+ write `## Pending Parallelization Config` here because task scopes are not known
70
+ until PLAN; MODE: PLAN will choose safe parallelism automatically. Keep commit
71
+ frequency at phase-level only.
64
72
  Now ask the user which QA gates to enable for this plan, how many parallel coders to use, and the commit frequency -- do not select on their behalf. Present all three items together as one unified exchange.
65
73
 
66
74
  Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder count, and commit frequency as a single user-facing section. Offer the user a one-shot choice: accept defaults, or customize. The eleven gates are:
@@ -77,7 +85,7 @@ Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder
77
85
  - final_council (default: OFF) -- when enabled, after all phases complete the architect dispatches the full 5-member council (critic, reviewer, sme, test_engineer, explorer) -- NOT the General Council -- at project scope, collects `CouncilMemberVerdict` objects, and calls `write_final_council_evidence`. This does not require `council.general.enabled`.
78
86
 
79
87
  Additionally, present these two sub-items as part of the same exchange:
80
- - Parallel coders (default: 1, range: 1-4) -- how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files -- safe and faster, but only for tasks whose file scopes do NOT overlap. The per-task file scopes that determine a safe parallel count are not known until the plan is finalized, so default to 1 (serial) here; the precise recommendation is made at plan time once the tasks and their scopes exist.
88
+ - Parallel coders (default: 1, range: 1-6) -- how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files -- safe and faster, but only for tasks whose file scopes do NOT overlap. The per-task file scopes that determine a safe parallel count are not known until the plan is finalized, so default to 1 (serial) here; the precise recommendation is made at plan time once the tasks and their scopes exist.
81
89
  - Commit frequency (default: phase-level only) -- optional per-task checkpoint commit after each task completion.
82
90
  - auto_proceed (boolean, default: false) -- when true, auto-advance to the next phase without asking "Ready for Phase N+1?"; runtime toggle via /swarm auto-proceed on|off.
83
91
 
@@ -117,6 +125,8 @@ GATE SELECTION IS MANDATORY — these thoughts are WRONG and must be ignored:
117
125
  → WRONG: the architect does not configure gates. The user configures gates. Always ask.
118
126
 
119
127
  MANDATORY PAUSE: Do NOT write the spec summary (step 7). Do NOT suggest next steps.
128
+ Exception: MODE: LOOP with `autonomy=auto` uses the balanced-speed defaults
129
+ above and does not pause for this preference exchange.
120
130
  You are BLOCKED until ALL THREE of these conditions are met:
121
131
  (1) The unified gate/coders/commit selection section has been presented to the user in a single message
122
132
  (2) The user has responded (accept defaults OR customized list for all three items)
@@ -43,11 +43,11 @@ Parse the `[MODE: LOOP ...]` header to extract:
43
43
  - `objective`: the goal text after the header (the WHAT to achieve). Empty only
44
44
  when `resume=true`.
45
45
  - `max_cycles`: integer 1..5 (default 3) — hard cap on outer improvement cycles.
46
- - `autonomy`: `checkpoint` (default) or `auto`.
47
- - `checkpoint`: pause at each phase gate and wait for explicit user approval
48
- before continuing.
46
+ - `autonomy`: `auto` (default) or `checkpoint`.
49
47
  - `auto`: proceed across gates without prompting, but still enforce every
50
48
  hard stop condition and the mandatory review/critic gates.
49
+ - `checkpoint`: pause at each phase gate and wait for explicit user approval
50
+ before continuing.
51
51
  - `depth`: `standard` (default) or `exhaustive` (wider exploration in
52
52
  BRAINSTORM and PLAN: more candidate approaches, deeper localization).
53
53
  - `resume`: `true` | `false`. When true, resume the existing run from durable
@@ -100,6 +100,15 @@ IMPROVE**. Do not skip or collapse phases. Each phase has an entry gate
100
100
  (precondition) and an exit gate (positive evidence required before the next
101
101
  phase begins). In `checkpoint` autonomy, pause at each gate for user approval.
102
102
 
103
+ When `autonomy=auto`, use the balanced-speed defaults instead of asking the user
104
+ for execution preferences: reviewer ON, test_engineer ON, sme_enabled ON,
105
+ critic_pre_plan ON, sast_enabled ON, drift_check ON, and council_mode,
106
+ hallucination_guard, mutation_test, phase_council, final_council OFF. Keep
107
+ commit frequency at phase-level only. During PLAN, choose the largest safe
108
+ parallel coder count from dependency-ready, file-disjoint task groups, clamped to
109
+ the configured limit (currently 6); if scopes overlap or are unknown, use 1.
110
+ This does not weaken QA; it removes only the preference prompt.
111
+
103
112
  On cycle 2+, BRAINSTORM is replaced by a lightweight **refinement** step: feed
104
113
  the prior cycle's captured improvements and residual findings into PLAN
105
114
  directly (skip full discovery dialogue) — the objective is already framed.
@@ -281,7 +290,7 @@ A minimal, append-friendly shape — extend as needed but keep these fields:
281
290
 
282
291
  ## Autonomy Quick Reference
283
292
 
284
- | Behavior | `checkpoint` (default) | `auto` |
293
+ | Behavior | `auto` (default) | `checkpoint` |
285
294
  | --- | --- | --- |
286
295
  | Pause at phase gates | Yes — wait for user approval | No |
287
296
  | Confirm before next cycle | Yes | No |
@@ -203,6 +203,13 @@ save_plan({
203
203
  })
204
204
 
205
205
  **POST-SAVE_PLAN: APPLY QA GATE SELECTION.**
206
+ Auto-loop exception: when this PLAN step is running inside MODE: LOOP with
207
+ `autonomy=auto`, do not ask the gate/parallelism/commit-frequency question. Use
208
+ the balanced-speed defaults from the loop skill, call `set_qa_gates` with those
209
+ values after `save_plan`, keep phase-level commits, and set a locked
210
+ `execution_profile` automatically when the plan has dependency-ready,
211
+ file-disjoint tasks. Choose the largest safe count, clamped to the configured
212
+ limit (currently 6); use serial execution when scopes overlap or are unknown.
206
213
  After `save_plan` succeeds, read `.swarm/context.md`:
207
214
  - If a `## Pending QA Gate Selection` section exists: parse the gate values, call `set_qa_gates` with those flags, confirm with the user ("QA gates applied: <list>"), then remove the section from context.md.
208
215
  - If a `## Pending Parallelization Config` section also exists: parse the values and call `save_plan` again with `execution_profile` set to `{ parallelization_enabled: <parsed>, max_concurrent_tasks: <parsed>, council_parallel: false, locked: true }`. Then remove the section from context.md. If the plan already had `execution_profile.locked: true`, skip this step — the profile is already locked and immutable.
@@ -220,7 +227,7 @@ After `save_plan` succeeds, read `.swarm/context.md`:
220
227
  - drift_check (default: ON) - mandatory per-phase drift verification at PHASE-WRAP
221
228
  - final_council (default: OFF) - when enabled, after all phases complete the architect dispatches the full 5-member council (critic, reviewer, sme, test_engineer, explorer) -- NOT the General Council -- at project scope, collects `CouncilMemberVerdict` objects, and calls `write_final_council_evidence`. This does not require `council.general.enabled`.
222
229
  Additionally, present these two sub-items as part of the same exchange:
223
- - Parallel coders (default: 1, range: 1-4) - how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files - safe and faster, but only for tasks whose file scopes do NOT overlap. Inspect the plan and recommend a count equal to the number of dependency-ready, file-disjoint task groups (clamped 1-4); recommend 1 (serial) when scopes overlap or are unknown. State your recommendation and reasoning when you ask.
230
+ - Parallel coders (default: 1, range: 1-6) - how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files - safe and faster, but only for tasks whose declared file scopes do NOT overlap. Inspect the plan and recommend a count equal to the number of dependency-ready, file-disjoint task groups (clamped 1-6); recommend 1 (serial) when scopes overlap or are unknown. State your recommendation and reasoning when you ask.
224
231
  - Commit frequency (default: phase-level only) - optional per-task checkpoint commit after each task completion.
225
232
  The user answers all three (gates, parallel coders, commit frequency) in one exchange. Wait for the user's response.
226
233
  If the user says parallel coders > 1, write a `## Pending Parallelization Config` section to `.swarm/context.md` alongside the gate selection:
@@ -32,7 +32,7 @@ Activates when: user asks to "specify", "define requirements", "write a spec", o
32
32
  - **Important:** If research is ongoing, monitor the timeout configured in `.swarm/config.json` under `research_needed_timeout_ms` (default: 300000ms / 5 minutes). If research does not complete before the timeout expires, automatically reclassify the item to `user_decision` with a note that research was incomplete, then surface it to the user. This prevents the clarification funnel from stalling while waiting for external research.
33
33
  5. Write the spec to `.swarm/spec.md`.
34
34
  5b. **QA GATE SELECTION, PARALLEL CODERS, COMMIT FREQUENCY, AND AUTO_PROCEED (dialogue only).**
35
- Ask the user which QA gates to enable for this plan, how many parallel coders to use, the commit frequency, and auto_proceed -- do not select on their behalf. Present all four items together as one unified exchange.
35
+ Ask the user which QA gates to enable for this plan, how many parallel coders to use, the commit frequency, and auto_proceed -- do not select on their behalf. Present all four items together as one unified exchange. Exception: when SPECIFY is running inside MODE: LOOP with `autonomy=auto`, write the balanced-speed default `## Pending QA Gate Selection` instead (reviewer, test_engineer, sme_enabled, critic_pre_plan, sast_enabled, drift_check ON; council_mode, hallucination_guard, mutation_test, phase_council, final_council OFF), keep phase-level commits, and let MODE: PLAN choose safe parallelism after task scopes exist.
36
36
 
37
37
  Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder count, commit frequency, and auto_proceed as a single user-facing section. Offer the user a one-shot choice: accept defaults, or customize. The eleven gates are:
38
38
  - reviewer (default: ON) -- code review of coder output
@@ -48,7 +48,7 @@ Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder
48
48
  - final_council (default: OFF) -- when enabled, after all phases complete the architect dispatches the full 5-member council (critic, reviewer, sme, test_engineer, explorer) -- NOT the General Council -- at project scope, collects `CouncilMemberVerdict` objects, and calls `write_final_council_evidence`. This does not require `council.general.enabled`.
49
49
 
50
50
  Additionally, present these three sub-items as part of the same exchange:
51
- - Parallel coders (default: 1, range: 1-4) -- how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files -- safe and faster, but only for tasks whose file scopes do NOT overlap. The per-task file scopes that determine a safe parallel count are not known until the plan is finalized, so default to 1 (serial) here; the precise recommendation is made at plan time once the tasks and their scopes exist.
51
+ - Parallel coders (default: 1, range: 1-6) -- how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files -- safe and faster, but only for tasks whose file scopes do NOT overlap. The per-task file scopes that determine a safe parallel count are not known until the plan is finalized, so default to 1 (serial) here; the precise recommendation is made at plan time once the tasks and their scopes exist.
52
52
  - Commit frequency (default: phase-level only) -- optional per-task checkpoint commit after each task completion.
53
53
  - auto_proceed (boolean, default: false) -- when true, auto-advance to the next phase without asking "Ready for Phase N+1?"; runtime toggle via /swarm auto-proceed on|off.
54
54
 
@@ -88,6 +88,8 @@ GATE SELECTION IS MANDATORY — these thoughts are WRONG and must be ignored:
88
88
  → WRONG: the architect does not configure gates. The user configures gates. Always ask.
89
89
 
90
90
  MANDATORY PAUSE: Do NOT write the spec summary (step 7). Do NOT suggest next steps.
91
+ Exception: MODE: LOOP with `autonomy=auto` uses the balanced-speed defaults
92
+ above and does not pause for this preference exchange.
91
93
  You are BLOCKED until ALL THREE of these conditions are met:
92
94
  (1) The unified gate/coders/commit/auto_proceed selection section has been presented to the user in a single message
93
95
  (2) The user has responded (accept defaults OR customized list for all four items)
@@ -6,10 +6,10 @@ import {
6
6
  loadPlanJsonOnly,
7
7
  mergeDurableGateEntriesFromEvidence,
8
8
  readDurableGateEvidence
9
- } from "./index-qcr60fgm.js";
9
+ } from "./index-6wgwybzj.js";
10
10
  import"./index-r8f89sm9.js";
11
11
  import"./index-9b7qp18e.js";
12
- import"./index-we94wkty.js";
12
+ import"./index-94qwbx11.js";
13
13
  import"./index-jtqkh8jf.js";
14
14
  import"./index-5e4e2hvv.js";
15
15
  import"./index-p0arc26j.js";
@@ -1,21 +1,21 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-sy329dh4.js";
5
- import"./index-brpm7xs3.js";
4
+ } from "./index-nytjghhx.js";
5
+ import"./index-fhve3nj7.js";
6
6
  import"./index-xsswhy6k.js";
7
7
  import"./index-ydgy7vg5.js";
8
8
  import"./index-vwyjkzgs.js";
9
9
  import"./index-f7nma02k.js";
10
10
  import"./index-svf2zjxs.js";
11
11
  import"./index-7hnwnw5g.js";
12
- import"./index-qcr60fgm.js";
12
+ import"./index-6wgwybzj.js";
13
13
  import"./index-adz3nk9b.js";
14
14
  import"./index-v4fcn4tr.js";
15
15
  import"./index-r8f89sm9.js";
16
16
  import"./index-9b7qp18e.js";
17
- import"./index-5fxjagjt.js";
18
- import"./index-we94wkty.js";
17
+ import"./index-s3esnz7m.js";
18
+ import"./index-94qwbx11.js";
19
19
  import"./index-jtqkh8jf.js";
20
20
  import"./index-5e4e2hvv.js";
21
21
  import"./index-p0arc26j.js";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  readSwarmFileAsync,
10
10
  validateSwarmPath
11
- } from "./index-we94wkty.js";
11
+ } from "./index-94qwbx11.js";
12
12
  import {
13
13
  readCachedParsedFile
14
14
  } from "./index-jtqkh8jf.js";
@@ -13,6 +13,7 @@ import {
13
13
  } from "./index-b9v501fr.js";
14
14
 
15
15
  // src/hooks/utils.ts
16
+ import * as fs from "fs";
16
17
  import * as path from "path";
17
18
  var _internals = {
18
19
  safeHook,
@@ -71,8 +72,55 @@ function validateSwarmPath(directory, filename) {
71
72
  throw new Error("Invalid filename: path escapes .swarm directory");
72
73
  }
73
74
  }
75
+ let realBaseDir;
76
+ try {
77
+ if (fs.lstatSync(baseDir).isSymbolicLink()) {
78
+ throw new Error("Invalid filename: path escapes .swarm directory");
79
+ }
80
+ realBaseDir = fs.realpathSync(baseDir);
81
+ } catch (error) {
82
+ if (error instanceof Error && error.message === "Invalid filename: path escapes .swarm directory") {
83
+ throw error;
84
+ }
85
+ if (error.code === "ENOENT") {
86
+ return resolved;
87
+ }
88
+ throw new Error("Invalid filename: failed to resolve .swarm directory");
89
+ }
90
+ let existingPath = resolved;
91
+ while (!fs.existsSync(existingPath)) {
92
+ const parent = path.dirname(existingPath);
93
+ if (parent === existingPath || !isPathWithin(parent, baseDir)) {
94
+ existingPath = baseDir;
95
+ break;
96
+ }
97
+ existingPath = parent;
98
+ }
99
+ let realExistingPath;
100
+ try {
101
+ realExistingPath = fs.realpathSync(existingPath);
102
+ } catch (error) {
103
+ if (error.code === "ENOENT") {
104
+ realExistingPath = realBaseDir;
105
+ } else {
106
+ throw new Error("Invalid filename: failed to resolve path");
107
+ }
108
+ }
109
+ if (!isPathWithin(realExistingPath, realBaseDir)) {
110
+ throw new Error("Invalid filename: path escapes .swarm directory");
111
+ }
74
112
  return resolved;
75
113
  }
114
+ function isPathWithin(candidate, base) {
115
+ const normalizedCandidate = path.normalize(candidate);
116
+ const normalizedBase = path.normalize(base);
117
+ if (process.platform === "win32") {
118
+ const candidateLower = normalizedCandidate.toLowerCase();
119
+ const baseLower = normalizedBase.toLowerCase();
120
+ return candidateLower === baseLower || candidateLower.startsWith(`${baseLower}${path.sep}`);
121
+ }
122
+ return normalizedCandidate === normalizedBase || normalizedCandidate.startsWith(`${normalizedBase}${path.sep}`);
123
+ }
76
124
  async function readSwarmFileAsync(directory, filename, cache) {
77
125
  if (cache !== undefined) {
78
126
  const key = `${directory}::${filename}`;