opencode-swarm 6.31.2 → 6.31.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -110
- package/dist/cli/index.js +19 -17
- package/dist/index.js +20 -18
- package/dist/plan/manager.d.ts +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,42 @@
|
|
|
1
1
|
# OpenCode Swarm
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Your AI writes the code. Swarm makes sure it actually works.**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[](https://www.npmjs.com/package/opencode-swarm)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://github.com/zaxbysauce/opencode-swarm)
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
[Website](https://swarmai.site/) · [Getting Started](docs/getting-started.md) · [Configuration](docs/configuration.md) · [Architecture](docs/architecture.md)
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
</div>
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
---
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
OpenCode Swarm is a plugin for [OpenCode](https://opencode.ai) that turns a single AI coding session into an **architect-led team of 9 specialized agents**. One agent writes the code. A different agent reviews it. Another writes and runs tests. Another checks security. **Nothing ships until every required gate passes.**
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
npm install -g opencode-swarm
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
### Why Swarm?
|
|
24
|
+
|
|
25
|
+
Most AI coding tools let one model write code and ask that same model whether the code is good. That misses too much. Swarm separates planning, implementation, review, testing, and documentation into specialized internal roles — and enforces gated execution so agents never mutate the codebase in parallel.
|
|
26
|
+
|
|
27
|
+
### Key Features
|
|
28
|
+
|
|
29
|
+
- 🏗️ **9 specialized agents** — architect, coder, reviewer, test engineer, critic, explorer, SME, docs, designer
|
|
30
|
+
- 🔒 **Gated pipeline** — code never ships without reviewer + test engineer approval
|
|
31
|
+
- 🔁 **Resumable sessions** — all state saved to `.swarm/`; pick up any project any day
|
|
32
|
+
- 🌐 **11 languages** — TypeScript, Python, Go, Rust, Java, Kotlin, C#, C/C++, Swift, Dart, Ruby
|
|
33
|
+
- 🛡️ **Built-in security** — SAST, secrets scanning, dependency audit per task
|
|
34
|
+
- 🆓 **Free tier** — works with OpenCode Zen's free model roster
|
|
35
|
+
- ⚙️ **Fully configurable** — override any agent's model, disable agents, tune guardrails
|
|
36
|
+
|
|
37
|
+
> **You select a Swarm architect once in the OpenCode GUI.** The architect coordinates all other agents automatically — you never manually switch between internal roles. If you use the default OpenCode `Build` / `Plan` modes, the plugin is bypassed entirely.
|
|
38
|
+
|
|
39
|
+
---
|
|
22
40
|
|
|
23
41
|
## What Actually Happens
|
|
24
42
|
|
|
@@ -59,92 +77,57 @@ All project state lives in `.swarm/`:
|
|
|
59
77
|
└── drift-report-phase-N.json # Plan-vs-reality drift reports
|
|
60
78
|
```
|
|
61
79
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Why This Exists
|
|
67
|
-
|
|
68
|
-
Most AI coding tools let one model write code and then ask that same model whether the code is good. That misses too much.
|
|
69
|
-
|
|
70
|
-
Swarm separates planning, implementation, review, testing, and documentation into specialized internal roles, and it enforces gated execution instead of letting multiple agents mutate the codebase in parallel.
|
|
80
|
+
Swarm is resumable by design. If `.swarm/` already exists, the architect goes straight into **RESUME** → **EXECUTE** instead of repeating discovery.
|
|
71
81
|
|
|
72
82
|
---
|
|
73
83
|
|
|
74
84
|
## Quick Start
|
|
75
85
|
|
|
76
|
-
|
|
86
|
+
> **Prerequisites:** [OpenCode](https://opencode.ai) installed and working. An API key for at least one LLM provider (or use the free OpenCode Zen tier — no key required).
|
|
87
|
+
|
|
88
|
+
### Step 1 — Install
|
|
77
89
|
|
|
78
90
|
```bash
|
|
79
91
|
npm install -g opencode-swarm
|
|
80
92
|
```
|
|
81
93
|
|
|
82
|
-
### 2
|
|
94
|
+
### Step 2 — Open your project in OpenCode
|
|
83
95
|
|
|
84
96
|
```bash
|
|
97
|
+
cd /your/project
|
|
85
98
|
opencode
|
|
86
99
|
```
|
|
87
100
|
|
|
88
|
-
### 3
|
|
101
|
+
### Step 3 — Select a Swarm architect and describe your goal
|
|
89
102
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
```text
|
|
93
|
-
/swarm diagnose
|
|
94
|
-
/swarm agents
|
|
95
|
-
/swarm config
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
What they tell you:
|
|
99
|
-
|
|
100
|
-
* `/swarm diagnose` verifies Swarm health and setup
|
|
101
|
-
* `/swarm agents` shows the registered internal agents and model assignments
|
|
102
|
-
* `/swarm config` shows the resolved configuration currently in effect
|
|
103
|
-
|
|
104
|
-
### 4. Select a Swarm architect and start
|
|
105
|
-
|
|
106
|
-
1. **Choose a Swarm architect** in the OpenCode GUI (the exact name depends on your configuration — you can define multiple architects with different model assignments)
|
|
107
|
-
2. Then describe what you want to build.
|
|
103
|
+
1. In the OpenCode GUI, open the **agent/mode dropdown** and select a **Swarm architect** (e.g., `architect`).
|
|
104
|
+
2. Type what you want to build:
|
|
108
105
|
|
|
109
106
|
```text
|
|
110
107
|
Build a REST API with user registration, login, and JWT auth.
|
|
111
108
|
```
|
|
112
109
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
### 5. Understand first run vs later runs
|
|
110
|
+
That's it. The architect coordinates all other agents automatically.
|
|
116
111
|
|
|
117
|
-
|
|
112
|
+
> **First time?** Run `/swarm diagnose` to verify Swarm is healthy, `/swarm agents` to see registered agents, and `/swarm config` to see the resolved configuration.
|
|
118
113
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Use these commands any time:
|
|
114
|
+
### Step 4 — Monitor progress
|
|
122
115
|
|
|
123
116
|
```text
|
|
124
|
-
/swarm status
|
|
125
|
-
/swarm plan
|
|
126
|
-
/swarm
|
|
117
|
+
/swarm status # Current phase and task
|
|
118
|
+
/swarm plan # Full project plan
|
|
119
|
+
/swarm evidence # Review and test results per task
|
|
127
120
|
```
|
|
128
121
|
|
|
129
|
-
###
|
|
130
|
-
|
|
131
|
-
If you want a completely fresh Swarm run for the current project:
|
|
122
|
+
### Step 5 — Start over if needed
|
|
132
123
|
|
|
133
124
|
```text
|
|
134
125
|
/swarm reset --confirm
|
|
135
126
|
```
|
|
136
127
|
|
|
137
|
-
|
|
128
|
+
### Step 6 — Configure models (optional)
|
|
138
129
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
By default, Swarm works with its default model setup. If you want to override agent models, create:
|
|
142
|
-
|
|
143
|
-
```text
|
|
144
|
-
.opencode/opencode-swarm.json
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Example:
|
|
130
|
+
Swarm works with its defaults out of the box. To override models, create `.opencode/opencode-swarm.json`:
|
|
148
131
|
|
|
149
132
|
```json
|
|
150
133
|
{
|
|
@@ -155,17 +138,17 @@ Example:
|
|
|
155
138
|
}
|
|
156
139
|
```
|
|
157
140
|
|
|
158
|
-
You only need to specify the agents you want to override.
|
|
141
|
+
You only need to specify the agents you want to override. The `architect` inherits the model currently selected in the OpenCode UI unless you set it explicitly.
|
|
142
|
+
|
|
143
|
+
See the [full configuration reference](#configuration-reference) and the [free-tier model setup](#free-tier-opencode-zen-models) for more options.
|
|
159
144
|
|
|
160
|
-
|
|
145
|
+
---
|
|
161
146
|
|
|
162
147
|
## Common First-Run Questions
|
|
163
148
|
|
|
164
149
|
### "Do I need to select a Swarm architect?"
|
|
165
150
|
|
|
166
|
-
**Yes.** You must explicitly choose a Swarm architect agent in the OpenCode GUI before starting your session.
|
|
167
|
-
|
|
168
|
-
If you use the default OpenCode `Build` / `Plan` options without selecting a Swarm architect, the plugin is bypassed entirely.
|
|
151
|
+
**Yes.** You must explicitly choose a Swarm architect agent in the OpenCode GUI before starting your session. If you use the default OpenCode `Build` / `Plan` options, the plugin is bypassed entirely.
|
|
169
152
|
|
|
170
153
|
### "Why did the second run start coding immediately?"
|
|
171
154
|
|
|
@@ -195,7 +178,7 @@ Run:
|
|
|
195
178
|
|
|
196
179
|
Swarm works with any LLM provider supported by OpenCode. Different agents benefit from different models — the architect needs strong reasoning, the coder needs strong code generation, and the reviewer benefits from a model different from the coder (to catch blind spots).
|
|
197
180
|
|
|
198
|
-
### Free Tier
|
|
181
|
+
### Free Tier — OpenCode Zen Models {#free-tier-opencode-zen-models}
|
|
199
182
|
|
|
200
183
|
OpenCode Zen provides free models via the `opencode/` provider prefix. These are excellent starting points and require no API key:
|
|
201
184
|
|
|
@@ -644,7 +627,7 @@ Optional enhancement: Semgrep (if on PATH).
|
|
|
644
627
|
</details>
|
|
645
628
|
|
|
646
629
|
<details>
|
|
647
|
-
<summary><strong>Full Configuration Reference</strong></summary>
|
|
630
|
+
<summary id="configuration-reference"><strong>Full Configuration Reference</strong></summary>
|
|
648
631
|
|
|
649
632
|
Config file location: `~/.config/opencode/opencode-swarm.json` (global) or `.opencode/opencode-swarm.json` (project). Project config merges over global.
|
|
650
633
|
|
|
@@ -939,34 +922,54 @@ The following tools can be assigned to agents via overrides:
|
|
|
939
922
|
|
|
940
923
|
---
|
|
941
924
|
|
|
942
|
-
|
|
925
|
+
<details>
|
|
926
|
+
<summary><strong>Recent Changes (v6.12 – v6.31)</strong></summary>
|
|
943
927
|
|
|
944
|
-
|
|
928
|
+
> For the complete version history, see [CHANGELOG.md](CHANGELOG.md) or [docs/releases/](docs/releases/).
|
|
945
929
|
|
|
946
|
-
|
|
930
|
+
### v6.31.0 — process.cwd() Cleanup + Watchdog + Knowledge Tools
|
|
947
931
|
|
|
948
|
-
- **
|
|
949
|
-
-
|
|
932
|
+
- **process.cwd() cleanup**: All 14 source files now use plugin-injected `directory` parameter. Five tools migrated to `createSwarmTool` wrapper.
|
|
933
|
+
- **`curator_analyze` tool**: Architect can now explicitly trigger phase analysis and apply curator recommendations.
|
|
934
|
+
- **Watchdog system**: `scope_guard` (blocks out-of-scope writes), `delegation_ledger` (tracks per-session tool calls), and loop-detector escalation.
|
|
935
|
+
- **Self-correcting workflow**: `self_review` advisory hook after task transitions; `checkStaleImports` heuristic for unused import detection.
|
|
936
|
+
- **Knowledge memory tools**: `knowledge_recall`, `knowledge_add`, `knowledge_remove` — any agent can now directly access the persistent knowledge base.
|
|
950
937
|
|
|
951
|
-
### v6.
|
|
938
|
+
### v6.30.1 — Bug Fixes
|
|
952
939
|
|
|
953
|
-
|
|
940
|
+
- **Package manager detection**: `incremental_verify` now detects bun/npm/pnpm/yarn from lockfiles instead of always using `bun`.
|
|
941
|
+
- **spawnAsync OOM fix**: 512KB output cap prevents infinite-output commands from OOM-crashing.
|
|
942
|
+
- **Windows spawn fix**: `npx.cmd`, `npm.cmd`, `pnpm.cmd`, `yarn.cmd` resolved correctly on Windows.
|
|
943
|
+
- **Curator config fix**: `applyCuratorKnowledgeUpdates` now receives fully-populated `KnowledgeConfig`.
|
|
944
|
+
- **Rehydration race guard**: Concurrent `loadSnapshot` calls no longer silently drop workflow state.
|
|
954
945
|
|
|
955
|
-
|
|
956
|
-
- **Slop-detector hardening**: Enhanced detection of AI-generated placeholder code with multi-language heuristics (comments like `// TODO`, `// FIXME`, `// HACK`, language-specific patterns for Go/Rust/C#/Python). Advisory warnings injected into coder context when slop patterns detected.
|
|
957
|
-
- **CODEBASE REALITY CHECK**: Architect dispatches Explorer before planning to verify current state of referenced items. Produces a CODEBASE REALITY REPORT with statuses: NOT STARTED, PARTIALLY DONE, ALREADY COMPLETE, or ASSUMPTION INCORRECT. Skipped for greenfield projects.
|
|
958
|
-
- **Evidence schema fix**: Evidence bundles now correctly validate against schema; invalid entries are filtered.
|
|
959
|
-
- **Curator/docs alignment**: Curator health check in `/swarm diagnose` reports curator.enabled status and validates curator-summary.json.
|
|
946
|
+
### v6.29.4 — Cross-Task Regression Sweep
|
|
960
947
|
|
|
961
|
-
|
|
948
|
+
- **Regression sweep**: Architect dispatches `scope:"graph"` test runs after each task to catch cross-task regressions (found 15 in RAGAPPv2 retrospective).
|
|
949
|
+
- **Curator data pipeline**: Curator outputs now visible to the architect via advisory injection.
|
|
950
|
+
- **Full-suite opt-in**: Explicit flag unlocks full `bun test` execution when needed.
|
|
962
951
|
|
|
963
|
-
|
|
952
|
+
### v6.29.3 — Curator Visibility + Documentation Refresh
|
|
953
|
+
|
|
954
|
+
- **Curator status in diagnose**: `/swarm diagnose` now reports whether Curator is enabled/disabled and validates `curator-summary.json`.
|
|
955
|
+
- **README and config docs refreshed**: Updated `.swarm/` directory tree, Curator configuration options, and drift report artifacts.
|
|
956
|
+
|
|
957
|
+
### v6.29.2 — Multi-Language Incremental Verify + Slop-Detector Hardening
|
|
958
|
+
|
|
959
|
+
- **Multi-language incremental_verify**: Post-coder typecheck supports TypeScript/JavaScript, Go, Rust, and C#.
|
|
960
|
+
- **Slop-detector hardening**: Multi-language heuristics for placeholder code detection across Go/Rust/C#/Python.
|
|
961
|
+
- **CODEBASE REALITY CHECK**: Explorer verifies referenced items before planning (NOT STARTED / PARTIALLY DONE / ALREADY COMPLETE / ASSUMPTION INCORRECT).
|
|
962
|
+
- **Evidence schema fix**: Evidence bundles now correctly validate against schema.
|
|
963
|
+
|
|
964
|
+
### v6.29.1 — Advisory Hook Message Injection
|
|
964
965
|
|
|
965
|
-
- **Advisory hook message injection**: Enhanced message formatting for self-coding detection, partial gate tracking, batch detection, and scope violation warnings.
|
|
966
|
+
- **Advisory hook message injection**: Enhanced message formatting for self-coding detection, partial gate tracking, batch detection, and scope violation warnings.
|
|
966
967
|
|
|
967
|
-
### v6.
|
|
968
|
+
### v6.26 through v6.28 — Session Durability + Turbo Mode
|
|
968
969
|
|
|
969
|
-
|
|
970
|
+
- **Turbo Mode**: Accelerated task delegation for faster pipeline execution.
|
|
971
|
+
- **Session durability**: Directory-based evidence writes, task ID recovery from `plan.json` for cold/resumed sessions.
|
|
972
|
+
- **Gate recovery fix** (v6.26.1): `update_task_status(completed)` no longer blocks pure-verification tasks without a prior coder delegation.
|
|
970
973
|
|
|
971
974
|
### v6.22 — Curator Background Analysis + Session State Persistence
|
|
972
975
|
|
|
@@ -1068,33 +1071,16 @@ This release adds runtime detection hooks to catch and warn about architect work
|
|
|
1068
1071
|
|
|
1069
1072
|
These hooks are advisory (warnings only) and help maintain workflow discipline during long sessions.
|
|
1070
1073
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
## v6.19 Features
|
|
1074
|
-
|
|
1075
|
-
### Critic Sounding Board
|
|
1076
|
-
Before escalating to the user, the Architect consults the critic in SOUNDING_BOARD mode. The critic returns one of four verdicts: UNNECESSARY, REPHRASE, APPROVED, or RESOLVE.
|
|
1077
|
-
|
|
1078
|
-
### Escalation Discipline
|
|
1079
|
-
Three-tier escalation hierarchy ensures systematic problem resolution:
|
|
1080
|
-
1. **Tier 1**: Self-resolve using existing context
|
|
1081
|
-
2. **Tier 2**: Critic consultation via sounding board
|
|
1082
|
-
3. **Tier 3**: User escalation (requires critic APPROVED)
|
|
1074
|
+
### v6.19 — Critic Sounding Board + Complexity-Scaled Review
|
|
1083
1075
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1076
|
+
- **Critic sounding board**: Before escalating to the user, the Architect consults the critic in SOUNDING_BOARD mode. Returns: UNNECESSARY, REPHRASE, APPROVED, or RESOLVE.
|
|
1077
|
+
- **Escalation discipline**: Three-tier hierarchy — self-resolve → critic consult → user escalation (requires critic APPROVED).
|
|
1078
|
+
- **Retry circuit breaker**: After 3 coder rejections, the Architect simplifies the approach instead of adding more logic.
|
|
1079
|
+
- **Intent reconstruction**: Reviewer reconstructs developer intent from task specs and diffs before evaluating changes.
|
|
1080
|
+
- **Complexity-scaled review**: TRIVIAL → Tier 1 only; MODERATE → Tiers 1–2; COMPLEX → all three tiers.
|
|
1081
|
+
- **`meta.summary` convention**: Agents include one-line summaries in state events for downstream agent consumption.
|
|
1086
1082
|
|
|
1087
|
-
|
|
1088
|
-
The mega-reviewer reconstructs developer intent from task specs and diffs before evaluating changes.
|
|
1089
|
-
|
|
1090
|
-
### Complexity-Scaled Review
|
|
1091
|
-
Changes classified as TRIVIAL, MODERATE, or COMPLEX receive appropriate review depth:
|
|
1092
|
-
- TRIVIAL → Tier 1 only
|
|
1093
|
-
- MODERATE → Tiers 1-2
|
|
1094
|
-
- COMPLEX → All three tiers
|
|
1095
|
-
|
|
1096
|
-
### meta.summary Convention
|
|
1097
|
-
Agents include one-line summaries in state events for downstream consumption by other agents.
|
|
1083
|
+
</details>
|
|
1098
1084
|
|
|
1099
1085
|
---
|
|
1100
1086
|
|
package/dist/cli/index.js
CHANGED
|
@@ -16237,32 +16237,34 @@ async function loadPlan(directory) {
|
|
|
16237
16237
|
}
|
|
16238
16238
|
return null;
|
|
16239
16239
|
}
|
|
16240
|
-
async function savePlan(directory, plan) {
|
|
16240
|
+
async function savePlan(directory, plan, options) {
|
|
16241
16241
|
if (directory === null || directory === undefined || typeof directory !== "string" || directory.trim().length === 0) {
|
|
16242
16242
|
throw new Error(`Invalid directory: directory must be a non-empty string`);
|
|
16243
16243
|
}
|
|
16244
16244
|
const validated = PlanSchema.parse(plan);
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
for (const
|
|
16251
|
-
if (task.status === "completed")
|
|
16252
|
-
completedTaskIds.add(task.id);
|
|
16253
|
-
}
|
|
16254
|
-
}
|
|
16255
|
-
if (completedTaskIds.size > 0) {
|
|
16256
|
-
for (const phase of validated.phases) {
|
|
16245
|
+
if (options?.preserveCompletedStatuses !== false) {
|
|
16246
|
+
try {
|
|
16247
|
+
const currentPlan = await loadPlanJsonOnly(directory);
|
|
16248
|
+
if (currentPlan) {
|
|
16249
|
+
const completedTaskIds = new Set;
|
|
16250
|
+
for (const phase of currentPlan.phases) {
|
|
16257
16251
|
for (const task of phase.tasks) {
|
|
16258
|
-
if (
|
|
16259
|
-
task.
|
|
16252
|
+
if (task.status === "completed")
|
|
16253
|
+
completedTaskIds.add(task.id);
|
|
16254
|
+
}
|
|
16255
|
+
}
|
|
16256
|
+
if (completedTaskIds.size > 0) {
|
|
16257
|
+
for (const phase of validated.phases) {
|
|
16258
|
+
for (const task of phase.tasks) {
|
|
16259
|
+
if (completedTaskIds.has(task.id) && task.status !== "completed") {
|
|
16260
|
+
task.status = "completed";
|
|
16261
|
+
}
|
|
16260
16262
|
}
|
|
16261
16263
|
}
|
|
16262
16264
|
}
|
|
16263
16265
|
}
|
|
16264
|
-
}
|
|
16265
|
-
}
|
|
16266
|
+
} catch {}
|
|
16267
|
+
}
|
|
16266
16268
|
for (const phase of validated.phases) {
|
|
16267
16269
|
const tasks = phase.tasks;
|
|
16268
16270
|
if (tasks.length > 0 && tasks.every((t) => t.status === "completed")) {
|
package/dist/index.js
CHANGED
|
@@ -15790,32 +15790,34 @@ async function loadPlan(directory) {
|
|
|
15790
15790
|
}
|
|
15791
15791
|
return null;
|
|
15792
15792
|
}
|
|
15793
|
-
async function savePlan(directory, plan) {
|
|
15793
|
+
async function savePlan(directory, plan, options) {
|
|
15794
15794
|
if (directory === null || directory === undefined || typeof directory !== "string" || directory.trim().length === 0) {
|
|
15795
15795
|
throw new Error(`Invalid directory: directory must be a non-empty string`);
|
|
15796
15796
|
}
|
|
15797
15797
|
const validated = PlanSchema.parse(plan);
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
for (const
|
|
15804
|
-
if (task.status === "completed")
|
|
15805
|
-
completedTaskIds.add(task.id);
|
|
15806
|
-
}
|
|
15807
|
-
}
|
|
15808
|
-
if (completedTaskIds.size > 0) {
|
|
15809
|
-
for (const phase of validated.phases) {
|
|
15798
|
+
if (options?.preserveCompletedStatuses !== false) {
|
|
15799
|
+
try {
|
|
15800
|
+
const currentPlan = await loadPlanJsonOnly(directory);
|
|
15801
|
+
if (currentPlan) {
|
|
15802
|
+
const completedTaskIds = new Set;
|
|
15803
|
+
for (const phase of currentPlan.phases) {
|
|
15810
15804
|
for (const task of phase.tasks) {
|
|
15811
|
-
if (
|
|
15812
|
-
task.
|
|
15805
|
+
if (task.status === "completed")
|
|
15806
|
+
completedTaskIds.add(task.id);
|
|
15807
|
+
}
|
|
15808
|
+
}
|
|
15809
|
+
if (completedTaskIds.size > 0) {
|
|
15810
|
+
for (const phase of validated.phases) {
|
|
15811
|
+
for (const task of phase.tasks) {
|
|
15812
|
+
if (completedTaskIds.has(task.id) && task.status !== "completed") {
|
|
15813
|
+
task.status = "completed";
|
|
15814
|
+
}
|
|
15813
15815
|
}
|
|
15814
15816
|
}
|
|
15815
15817
|
}
|
|
15816
15818
|
}
|
|
15817
|
-
}
|
|
15818
|
-
}
|
|
15819
|
+
} catch {}
|
|
15820
|
+
}
|
|
15819
15821
|
for (const phase of validated.phases) {
|
|
15820
15822
|
const tasks = phase.tasks;
|
|
15821
15823
|
if (tasks.length > 0 && tasks.every((t) => t.status === "completed")) {
|
|
@@ -15901,7 +15903,7 @@ async function updateTaskStatus(directory, taskId, status) {
|
|
|
15901
15903
|
throw new Error(`Task not found: ${taskId}`);
|
|
15902
15904
|
}
|
|
15903
15905
|
const updatedPlan = { ...plan, phases: updatedPhases };
|
|
15904
|
-
await savePlan(directory, updatedPlan);
|
|
15906
|
+
await savePlan(directory, updatedPlan, { preserveCompletedStatuses: false });
|
|
15905
15907
|
return updatedPlan;
|
|
15906
15908
|
}
|
|
15907
15909
|
function derivePlanMarkdown(plan) {
|
package/dist/plan/manager.d.ts
CHANGED
|
@@ -23,7 +23,9 @@ export declare function loadPlan(directory: string): Promise<Plan | null>;
|
|
|
23
23
|
* Validate against PlanSchema (throw on invalid), write to .swarm/plan.json via atomic temp+rename pattern,
|
|
24
24
|
* then derive and write .swarm/plan.md
|
|
25
25
|
*/
|
|
26
|
-
export declare function savePlan(directory: string, plan: Plan
|
|
26
|
+
export declare function savePlan(directory: string, plan: Plan, options?: {
|
|
27
|
+
preserveCompletedStatuses?: boolean;
|
|
28
|
+
}): Promise<void>;
|
|
27
29
|
/**
|
|
28
30
|
* Load plan → find task by ID → update status → save → return updated plan.
|
|
29
31
|
* Throw if plan not found or task not found.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "6.31.
|
|
3
|
+
"version": "6.31.4",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|