opencode-orchestrator 0.8.15 → 0.8.18
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 +90 -423
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,449 +12,140 @@
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## ⚡ Quick Start
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| Capability | Detail |
|
|
20
|
-
|------------|--------|
|
|
21
|
-
| **Agents** | 4 consolidated (Commander, Planner, Worker, Reviewer) |
|
|
22
|
-
| **Parallel Sessions** | Up to 50 concurrent Worker Sessions |
|
|
23
|
-
| **Context Management** | `.opencode/` with adaptive summarization |
|
|
24
|
-
| **Memory Safety** | Auto GC, disk archiving |
|
|
25
|
-
| **Error Handling** | Pattern-based auto recovery + session recovery |
|
|
26
|
-
| **Todo Continuation** | Auto-continues when todos remain |
|
|
27
|
-
| **Smart Notifications** | TaskToastManager with consolidated views |
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## 🏛️ Architecture Overview
|
|
32
|
-
|
|
33
|
-
### 🚀 User Flow: Real Scenario
|
|
34
|
-
|
|
35
|
-
> **Example:** `/task "Build a REST API with user authentication"`
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
┌─────────────────────────────────────────────────────────────────────────────────┐
|
|
39
|
-
│ 👤 USER: /task "Build a REST API with user authentication" │
|
|
40
|
-
└─────────────────────────────────────────────────────────────────────────────────┘
|
|
41
|
-
│
|
|
42
|
-
▼
|
|
43
|
-
┌─────────────────────────────────────────────────────────────────────────────────┐
|
|
44
|
-
│ 🎯 COMMANDER (Master Session) │
|
|
45
|
-
│ │
|
|
46
|
-
│ "I'll break this into parallel tasks and delegate to specialized agents" │
|
|
47
|
-
│ │
|
|
48
|
-
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
|
|
49
|
-
│ │ 📋 Creates TODO.md: │ │
|
|
50
|
-
│ │ - [ ] Research: Express.js + JWT best practices │ │
|
|
51
|
-
│ │ - [ ] Setup: Project structure + dependencies │ │
|
|
52
|
-
│ │ - [ ] Implement: User model + auth routes │ │
|
|
53
|
-
│ │ - [ ] Test: API endpoints verification │ │
|
|
54
|
-
│ └─────────────────────────────────────────────────────────────────────────┘ │
|
|
55
|
-
└─────────────────────────────────────────────────────────────────────────────────┘
|
|
56
|
-
│
|
|
57
|
-
┌────────────────────────┼────────────────────────┐
|
|
58
|
-
│ │ │
|
|
59
|
-
▼ ▼ ▼
|
|
60
|
-
|
|
61
|
-
╔═══════════════════╗ ╔═══════════════════╗ ╔═══════════════════╗
|
|
62
|
-
║ 🔍 PLANNER ║ ║ 🔨 WORKER #1 ║ ║ 🔨 WORKER #2 ║
|
|
63
|
-
║ Session: ses_001 ║ ║ Session: ses_002 ║ ║ Session: ses_003 ║
|
|
64
|
-
╠═══════════════════╣ ╠═══════════════════╣ ╠═══════════════════╣
|
|
65
|
-
║ Research Express ║ ║ Create src/ ║ ║ Write auth.ts ║
|
|
66
|
-
║ + JWT docs ║ ║ Setup package.json║ ║ + user.model.ts ║
|
|
67
|
-
║ ║ ║ ║ ║ ║
|
|
68
|
-
║ 📥 websearch() ║ ║ 📥 write files ║ ║ 📥 write files ║
|
|
69
|
-
║ ⏳ cache_docs() ║ ║ ⏳ run_background ║ ║ ║
|
|
70
|
-
╚═══════════════════╝ ║ → npm install ║ ╚═══════════════════╝
|
|
71
|
-
│ ╚═══════════════════╝ │
|
|
72
|
-
│ │ │
|
|
73
|
-
│ ⚡ ALL RUN IN PARALLEL (async: true) │
|
|
74
|
-
│ ⏱️ Commander monitors, doesn't wait │
|
|
75
|
-
└────────────────────────┼──────────────────────┘
|
|
76
|
-
▼
|
|
77
|
-
┌─────────────────────────────────────────────────────────────────────────────────┐
|
|
78
|
-
│ 🔄 BACKGROUND PROCESSES │
|
|
79
|
-
│ │
|
|
80
|
-
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
|
|
81
|
-
│ │ npm install │ │ npm run build │ │ npm test │ │
|
|
82
|
-
│ │ (bg_cmd_001) │ │ (bg_cmd_002) │ │ (bg_cmd_003) │ │
|
|
83
|
-
│ │ ⏳ running... │ │ ⏳ running... │ │ ⏳ pending... │ │
|
|
84
|
-
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
|
|
85
|
-
│ │
|
|
86
|
-
│ • Check with: check_background / list_background │
|
|
87
|
-
│ • Non-blocking: Commander continues other work │
|
|
88
|
-
└─────────────────────────────────────────────────────────────────────────────────┘
|
|
89
|
-
│
|
|
90
|
-
▼
|
|
91
|
-
┌─────────────────────────────────────────────────────────────────────────────────┐
|
|
92
|
-
│ 📊 ASYNC RESULT COLLECTION │
|
|
93
|
-
│ │
|
|
94
|
-
│ get_task_result("ses_001") ──▶ ✅ Planner done: "Found JWT patterns..." │
|
|
95
|
-
│ get_task_result("ses_002") ──▶ ✅ Worker #1 done: "Project setup complete" │
|
|
96
|
-
│ get_task_result("ses_003") ──▶ ⏳ Still running... │
|
|
97
|
-
│ │
|
|
98
|
-
│ Commander: "Worker #2 still working, I'll delegate review task meanwhile" │
|
|
99
|
-
└─────────────────────────────────────────────────────────────────────────────────┘
|
|
100
|
-
│
|
|
101
|
-
▼
|
|
102
|
-
╔═══════════════════╗
|
|
103
|
-
║ ✅ REVIEWER ║
|
|
104
|
-
║ Session: ses_004 ║
|
|
105
|
-
╠═══════════════════╣
|
|
106
|
-
║ Verify endpoints ║
|
|
107
|
-
║ Update TODO.md: ║
|
|
108
|
-
║ - [x] Research ✓ ║
|
|
109
|
-
║ - [x] Setup ✓ ║
|
|
110
|
-
║ - [x] Implement ✓║
|
|
111
|
-
║ - [x] Test ✓ ║
|
|
112
|
-
╚═══════════════════╝
|
|
113
|
-
│
|
|
114
|
-
▼
|
|
115
|
-
┌─────────────────────────────────────────────────────────────────────────────────┐
|
|
116
|
-
│ 🎖️ MISSION COMPLETE │
|
|
117
|
-
│ │
|
|
118
|
-
│ Commander: "All TODOs checked. Mission complete." │
|
|
119
|
-
│ │
|
|
120
|
-
│ Output: <mission_seal>SEALED</mission_seal> │
|
|
121
|
-
│ │
|
|
122
|
-
│ ✅ Session cleanup → Resources freed → Ready for next mission │
|
|
123
|
-
└─────────────────────────────────────────────────────────────────────────────────┘
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
**Key Concepts Visualized:**
|
|
127
|
-
|
|
128
|
-
| Concept | How It Works |
|
|
129
|
-
|---------|--------------|
|
|
130
|
-
| **Session** | Each agent runs in isolated session (ses_001, ses_002...) |
|
|
131
|
-
| **Parallel Agents** | Multiple Workers execute simultaneously, not sequentially |
|
|
132
|
-
| **Background Commands** | Long-running commands (npm install) don't block agents |
|
|
133
|
-
| **Async Collection** | Commander polls results, continues work while waiting |
|
|
134
|
-
| **Auto-Continue** | If TODOs remain, loop continues until all `[x]` checked |
|
|
135
|
-
|
|
136
|
-
### 📊 Project Architecture
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
┌─────────────────────────────────────────────────────────────────────────────────┐
|
|
140
|
-
│ OpenCode Orchestrator Plugin │
|
|
141
|
-
│ src/index.ts │
|
|
142
|
-
└─────────────────────────────────────────────────────────────────────────────────┘
|
|
143
|
-
│
|
|
144
|
-
┌───────────────────────────┼───────────────────────────┐
|
|
145
|
-
▼ ▼ ▼
|
|
146
|
-
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────────────┐
|
|
147
|
-
│ Plugin Hooks │ │ Core Systems │ │ Tools │
|
|
148
|
-
│ plugin-handlers/ │ │ src/core/ │ │ src/tools/ │
|
|
149
|
-
├─────────────────────┤ ├─────────────────────┤ ├─────────────────────────────┤
|
|
150
|
-
│ • chat.message │ │ • agents/ │ │ • parallel/ │
|
|
151
|
-
│ • event │ │ ParallelManager │ │ delegate_task │
|
|
152
|
-
│ • tool.execute │ │ TaskStore │ │ get_task_result │
|
|
153
|
-
│ • assistant.done │ │ Concurrency │ │ • web/ │
|
|
154
|
-
└─────────────────────┘ │ • loop/ │ │ webfetch, websearch │
|
|
155
|
-
│ MissionSeal │ │ • background-cmd/ │
|
|
156
|
-
│ TodoContinuation │ │ run_background │
|
|
157
|
-
│ • recovery/ │ │ • search │
|
|
158
|
-
│ SessionRecovery │ │ grep, glob, mgrep │
|
|
159
|
-
│ • notification/ │ └─────────────────────────────┘
|
|
160
|
-
│ Toast, Manager │
|
|
161
|
-
│ • session/ │
|
|
162
|
-
│ SharedContext │
|
|
163
|
-
│ • cache/ │
|
|
164
|
-
│ DocumentCache │
|
|
165
|
-
└─────────────────────┘
|
|
166
|
-
│
|
|
167
|
-
┌───────────────────────────┼───────────────────────────┐
|
|
168
|
-
▼ ▼ ▼
|
|
169
|
-
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
|
|
170
|
-
│ 🎯 Commander │ │ 📋 Planner │ │ 🔨 Worker │
|
|
171
|
-
│ Orchestrator │ │ Research+Plan │ │ Implementation │
|
|
172
|
-
├─────────────────────┤ ├─────────────────────┤ ├─────────────────────┤
|
|
173
|
-
│ • Mission control │ │ • Task decompose │ │ • Code writing │
|
|
174
|
-
│ • Parallel delegate │ │ • Doc research │ │ • File operations │
|
|
175
|
-
│ • TODO monitoring │ │ • TODO creation │ │ • Command execution │
|
|
176
|
-
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
|
|
177
|
-
│ │ │
|
|
178
|
-
│ │ │
|
|
179
|
-
│ ┌────────┴────────┐ │
|
|
180
|
-
│ ▼ │ │
|
|
181
|
-
│ ┌─────────────────────┐ │ │
|
|
182
|
-
│ │ ✅ Reviewer │ │ │
|
|
183
|
-
│ │ Quality+Context │ │ │
|
|
184
|
-
│ ├─────────────────────┤ │ │
|
|
185
|
-
│ │ • Verification │ │ │
|
|
186
|
-
│ │ • TODO updates │ │ │
|
|
187
|
-
│ │ • Context manage │ │ │
|
|
188
|
-
│ └─────────────────────┘ │ │
|
|
189
|
-
│ │ │ │
|
|
190
|
-
└──────────────────┼─────────────────┴──────────────────┘
|
|
191
|
-
▼
|
|
192
|
-
┌─────────────────────────────────────────────────────────────────────────────────┐
|
|
193
|
-
│ 📁 Shared Workspace (.opencode/) │
|
|
194
|
-
├─────────────────────────────────────────────────────────────────────────────────┤
|
|
195
|
-
│ todo.md │ Hierarchical task list (Epic → Task → Subtask) │
|
|
196
|
-
│ context.md │ Adaptive context (shrinks with progress) │
|
|
197
|
-
│ loop-state.json │ Mission loop iteration state │
|
|
198
|
-
│ docs/ │ Cached documentation (auto-expire) │
|
|
199
|
-
│ archive/ │ Old context snapshots │
|
|
200
|
-
└─────────────────────────────────────────────────────────────────────────────────┘
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
### 📂 Directory Structure
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
src/
|
|
208
|
-
├── index.ts # Plugin main entry point
|
|
209
|
-
├── agents/
|
|
210
|
-
│ ├── commander.ts # Commander agent definition
|
|
211
|
-
│ ├── definitions.ts # Agent exports
|
|
212
|
-
│ ├── prompts/ # Prompt fragments (commander/, planner/, worker/, reviewer/)
|
|
213
|
-
│ └── subagents/ # Subagent definitions (planner.ts, worker.ts, reviewer.ts)
|
|
214
|
-
├── core/
|
|
215
|
-
│ ├── agents/ # ParallelAgentManager, TaskStore, ConcurrencyController
|
|
216
|
-
│ ├── cache/ # DocumentCache
|
|
217
|
-
│ ├── loop/ # MissionSeal, TodoContinuation, TodoEnforcer
|
|
218
|
-
│ ├── notification/ # Toast, TaskToastManager
|
|
219
|
-
│ ├── recovery/ # SessionRecovery, ErrorPatterns
|
|
220
|
-
│ ├── session/ # SharedContext
|
|
221
|
-
│ └── task/ # TaskScheduler, TaskParser
|
|
222
|
-
├── plugin-handlers/
|
|
223
|
-
│ ├── chat-message-handler.ts # /task detection, mission start
|
|
224
|
-
│ ├── event-handler.ts # session.idle, session.error handling
|
|
225
|
-
│ ├── tool-execute-handler.ts # Tool completion tracking
|
|
226
|
-
│ └── assistant-done-handler.ts # Response completion
|
|
227
|
-
├── shared/
|
|
228
|
-
│ ├── constants/ # PATHS, TOOL_NAMES, MISSION_SEAL, etc.
|
|
229
|
-
│ ├── agent/ # Agent definitions, names
|
|
230
|
-
│ └── errors/ # Error types
|
|
231
|
-
├── tools/
|
|
232
|
-
│ ├── parallel/ # delegate_task, get_task_result, list_tasks, cancel_task
|
|
233
|
-
│ ├── web/ # webfetch, websearch, codesearch, cache_docs
|
|
234
|
-
│ ├── background-cmd/ # run_background, check_background, list_background
|
|
235
|
-
│ └── search.ts # grep_search, glob_search, mgrep
|
|
236
|
-
└── utils/ # Utility functions
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g opencode-orchestrator
|
|
237
19
|
```
|
|
238
20
|
|
|
239
|
-
|
|
240
|
-
## Installation
|
|
21
|
+
Restart OpenCode after installation. Then:
|
|
241
22
|
|
|
242
23
|
```bash
|
|
243
|
-
|
|
24
|
+
/task "Build a REST API with authentication"
|
|
244
25
|
```
|
|
245
26
|
|
|
246
|
-
|
|
27
|
+
That's it! The Commander takes over and works until the mission is complete.
|
|
247
28
|
|
|
248
29
|
---
|
|
249
30
|
|
|
250
|
-
##
|
|
31
|
+
## 🎯 What is This?
|
|
251
32
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
| Mode | Trigger | Behavior |
|
|
255
|
-
|------|---------|----------|
|
|
256
|
-
| **Commander Mode** 🎯 | `/task "mission"` | Full autonomous execution until sealed |
|
|
257
|
-
| **Chat Mode** 💬 | Regular conversation | Simple Q&A, no autonomous behavior |
|
|
33
|
+
A multi-agent system that **autonomously executes complex tasks** from start to finish. Just describe your mission — the Commander handles everything else.
|
|
258
34
|
|
|
259
35
|
---
|
|
260
36
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
Use `/task` when you need the AI to **complete a mission autonomously**:
|
|
264
|
-
|
|
265
|
-
```bash
|
|
266
|
-
/task "Fix the login bug in the docker-compose environment"
|
|
267
|
-
/task "Add dark mode support to the entire app"
|
|
268
|
-
/task "Refactor the API to use TypeScript"
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
**What Commander Mode Does:**
|
|
272
|
-
- ♾️ **Runs until sealed** — Loops until agent outputs `<mission_seal>SEALED</mission_seal>`
|
|
273
|
-
- 🧠 **Anti-Hallucination** — Researches docs before coding
|
|
274
|
-
- ⚡ **Parallel Execution** — Up to 50 concurrent Worker Sessions
|
|
275
|
-
- 🔄 **Auto-Recovery** — Handles errors automatically with pattern matching
|
|
276
|
-
- 📊 **Progress Tracking** — Monitors TODO completion and shows progress
|
|
277
|
-
|
|
278
|
-
**Concurrency Limits (per agent type):**
|
|
279
|
-
| Agent | Max Concurrent | Purpose |
|
|
280
|
-
|--------|---------------|-----------|
|
|
281
|
-
| Commander | 1 | Single orchestrator per mission |
|
|
282
|
-
| Planner | 3 | Research and TODO planning |
|
|
283
|
-
| Worker | 10 | Implementation tasks |
|
|
284
|
-
| Reviewer | 5 | Verification and testing |
|
|
285
|
-
|
|
286
|
-
**🎖️ Mission Seal Loop:**
|
|
287
|
-
```
|
|
288
|
-
/task "mission" → Agent works → Idle? → Seal found?
|
|
289
|
-
↑ │
|
|
290
|
-
│ No │ Yes
|
|
291
|
-
└──────────────┴──→ ✅ Complete
|
|
292
|
-
```
|
|
37
|
+
## ✨ Key Features
|
|
293
38
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
**
|
|
300
|
-
-
|
|
301
|
-
-
|
|
302
|
-
|
|
303
|
-
<div align="center">
|
|
304
|
-
<img src="assets/tui_image.png" alt="Commander TUI" width="600" />
|
|
305
|
-
<p><sub><b>/task "mission"</b> triggers full Commander mode with Mission Seal loop</sub></p>
|
|
306
|
-
</div>
|
|
39
|
+
| Feature | Description |
|
|
40
|
+
|---------|-------------|
|
|
41
|
+
| 🤖 **4 Specialized Agents** | Commander → Planner → Worker → Reviewer, each with distinct roles |
|
|
42
|
+
| ⚡ **Parallel Execution** | Up to 50 concurrent sessions — no waiting, maximum throughput |
|
|
43
|
+
| 🔄 **Background Tasks** | Long-running commands (npm install, tests) run non-blocking |
|
|
44
|
+
| 📋 **TODO-Driven Completion** | Auto-continues until every TODO is checked — never stops halfway |
|
|
45
|
+
| 🛡️ **Auto-Recovery** | Handles errors, rate limits, and session crashes automatically |
|
|
46
|
+
| 💾 **Memory Safety** | Auto GC, disk archiving, 60-min TTL — no memory leaks |
|
|
47
|
+
| 🔔 **Smart Notifications** | Consolidated task toasts with progress tracking |
|
|
307
48
|
|
|
308
49
|
---
|
|
309
50
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
Just type normally without `/task` for simple questions:
|
|
51
|
+
## 🚀 How It Works
|
|
313
52
|
|
|
314
53
|
```
|
|
315
|
-
|
|
316
|
-
|
|
54
|
+
👤 You: /task "Build a REST API with authentication"
|
|
55
|
+
│
|
|
56
|
+
▼
|
|
57
|
+
┌───────────────────────────────┐
|
|
58
|
+
│ 🎯 COMMANDER │ ← Master Session
|
|
59
|
+
│ Creates TODO, delegates │
|
|
60
|
+
└───────────────────────────────┘
|
|
61
|
+
│
|
|
62
|
+
┌──────────────────────┼──────────────────────┐
|
|
63
|
+
▼ ▼ ▼
|
|
64
|
+
┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
65
|
+
│ PLANNER │ │ WORKER │ │ WORKER │
|
|
66
|
+
│ ses_001 │ │ ses_002 │ │ ses_003 │ ⚡ PARALLEL
|
|
67
|
+
└─────────┘ └─────────┘ └─────────┘ SESSIONS
|
|
68
|
+
│ │ │
|
|
69
|
+
│ ┌─────────────────┴─────────────────┐ │
|
|
70
|
+
│ │ 🔄 Background: npm install, test │ │ ⏳ NON-BLOCKING
|
|
71
|
+
│ └───────────────────────────────────┘ │
|
|
72
|
+
└──────────────────────┼──────────────────────┘
|
|
73
|
+
▼
|
|
74
|
+
┌───────────────────────────────┐
|
|
75
|
+
│ ✅ REVIEWER │
|
|
76
|
+
│ Verifies, updates TODOs │
|
|
77
|
+
└───────────────────────────────┘
|
|
78
|
+
│
|
|
79
|
+
┌─────────┴─────────┐
|
|
80
|
+
│ TODOs remain? │
|
|
81
|
+
└─────────┬─────────┘
|
|
82
|
+
Yes ↓ ↓ No
|
|
83
|
+
♻️ LOOP 🎖️ SEALED
|
|
84
|
+
BACK (done!)
|
|
317
85
|
```
|
|
318
86
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
---
|
|
322
|
-
|
|
323
|
-
> **💡 Pro Tip:** Use `/task` for anything that requires multiple steps, file changes, or verification. Use Chat Mode for quick questions.
|
|
87
|
+
**♾️ Runs until complete** — Keeps looping until ALL TODOs are checked, then seals the mission.
|
|
324
88
|
|
|
325
89
|
---
|
|
326
90
|
|
|
327
|
-
##
|
|
91
|
+
## 🎮 Usage
|
|
328
92
|
|
|
329
|
-
|
|
93
|
+
| Mode | Trigger | What Happens |
|
|
94
|
+
|------|---------|--------------|
|
|
95
|
+
| **Commander Mode** 🎯 | `/task "mission"` | Full autonomous execution |
|
|
96
|
+
| **Chat Mode** 💬 | Just type normally | Simple Q&A, no automation |
|
|
330
97
|
|
|
98
|
+
**Example Commands:**
|
|
99
|
+
```bash
|
|
100
|
+
/task "Fix the login bug in docker-compose"
|
|
101
|
+
/task "Add dark mode to the entire app"
|
|
102
|
+
/task "Refactor the API to TypeScript"
|
|
331
103
|
```
|
|
332
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
333
|
-
│ MISSION LOOP LIFECYCLE │
|
|
334
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
335
|
-
|
|
336
|
-
1️⃣ User sends "/task 'mission'"
|
|
337
|
-
↓
|
|
338
|
-
2️⃣ chat.message handler detects /task
|
|
339
|
-
↓
|
|
340
|
-
3️⃣ Create session + startMissionLoop()
|
|
341
|
-
↓
|
|
342
|
-
Write .opencode/loop-state.json:
|
|
343
|
-
{
|
|
344
|
-
"active": true,
|
|
345
|
-
"sessionID": "ses_abc",
|
|
346
|
-
"iteration": 1,
|
|
347
|
-
"maxIterations": 20
|
|
348
|
-
}
|
|
349
|
-
↓
|
|
350
|
-
4️⃣ Commander receives prompt → delegates work
|
|
351
|
-
↓
|
|
352
|
-
5️⃣ Worker sessions execute → results collected
|
|
353
|
-
↓
|
|
354
|
-
6️⃣ session.idle event triggers
|
|
355
|
-
↓
|
|
356
|
-
Check for <mission_seal>SEALED</mission_seal>
|
|
357
|
-
├─ Seal found? → Clear loop state → Complete ✅
|
|
358
|
-
└─ Not found? → Increment iteration → Continue loop
|
|
359
|
-
↓
|
|
360
|
-
Show countdown toast (3 seconds)
|
|
361
|
-
↓
|
|
362
|
-
Inject continuation prompt
|
|
363
|
-
↓
|
|
364
|
-
[Loop back to step 4]
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
**Key Loop Components:**
|
|
368
|
-
|
|
369
|
-
| Component | File | Purpose |
|
|
370
|
-
|-----------|-------|---------|
|
|
371
|
-
| Loop State | `src/core/loop/mission-seal.ts` | State management (.opencode/loop-state.json) |
|
|
372
|
-
| Seal Detection | `src/core/loop/mission-seal-handler.ts` | Detect `<mission_seal>` in responses |
|
|
373
|
-
| Continuation | `src/core/loop/mission-seal-handler.ts` | Inject prompts to continue work |
|
|
374
|
-
| Countdown | `src/core/loop/mission-seal-handler.ts` | 3-second countdown toast |
|
|
375
|
-
| Idle Handler | `src/plugin-handlers/assistant-done-handler.ts` | Monitor session.idle events |
|
|
376
104
|
|
|
377
|
-
**
|
|
378
|
-
- No fixed iteration limits - loop continues until sealed
|
|
379
|
-
- Resilient to network delays
|
|
380
|
-
- Can be interrupted by user at any time
|
|
381
|
-
- Efficient polling (500ms interval with backoff)
|
|
105
|
+
**Stop anytime:** `/stop` or `/cancel`
|
|
382
106
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
| Agent | Role | Responsibility |
|
|
388
|
-
| :--------------- | :----------- | :--------------------------------- |
|
|
389
|
-
| **Commander** 🎯 | Orchestrator | Autonomous mission control |
|
|
390
|
-
| **Planner** 📋 | Planner + Research | Task decomposition, research, caching docs |
|
|
391
|
-
| **Worker** 🔨 | Developer + Docs | Full-stack implementation, documentation |
|
|
392
|
-
| **Reviewer** ✅ | Quality + Context | Verification, TODO updates, context management |
|
|
393
|
-
|
|
394
|
-
---
|
|
107
|
+
<div align="center">
|
|
108
|
+
<p><strong>TUI</strong></p>
|
|
109
|
+
<img src="assets/tui_image.png" alt="Commander TUI" width="600" />
|
|
110
|
+
</div>
|
|
395
111
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
| Tool | Description |
|
|
399
|
-
|------|-------------|
|
|
400
|
-
| `delegate_task` | Delegate work to subagent (async/sync) |
|
|
401
|
-
| `get_task_result` | Get result from delegated task |
|
|
402
|
-
| `list_tasks` | List all running/completed tasks |
|
|
403
|
-
| `cancel_task` | Cancel a running task |
|
|
404
|
-
| `webfetch` | Fetch URL content as Markdown |
|
|
405
|
-
| `websearch` | Search web (SearXNG → Brave → DuckDuckGo) |
|
|
406
|
-
| `codesearch` | Search open source code patterns |
|
|
407
|
-
| `cache_docs` | Manage cached documentation |
|
|
408
|
-
| `run_background` | Run command in background |
|
|
409
|
-
| `check_background` / `list_background` | Monitor background jobs |
|
|
410
|
-
| `grep_search` / `glob_search` / `mgrep` | Fast file search |
|
|
112
|
+
<br />
|
|
411
113
|
|
|
114
|
+
<div align="center">
|
|
115
|
+
<p><strong>Window</strong></p>
|
|
116
|
+
<img src="assets/window_image.png" alt="Commander Window" width="600" />
|
|
117
|
+
</div>
|
|
412
118
|
---
|
|
413
119
|
|
|
414
|
-
##
|
|
120
|
+
## 🤖 The 4 Agents
|
|
415
121
|
|
|
416
|
-
|
|
|
417
|
-
|
|
418
|
-
|
|
|
419
|
-
|
|
|
420
|
-
|
|
|
421
|
-
|
|
|
422
|
-
| Session TTL | 60 min | Auto cleanup |
|
|
423
|
-
| Poll Interval | 500ms | Fast completion detection |
|
|
424
|
-
| Max Poll Count | 600 | Hard limit prevents infinite loops |
|
|
425
|
-
| Sync Timeout | 5 min | Safe delegate_task timeout |
|
|
426
|
-
| Recovery Attempts | 3 | Auto session error recovery |
|
|
122
|
+
| Agent | Role | Key Actions |
|
|
123
|
+
|-------|------|-------------|
|
|
124
|
+
| **Commander** 🎯 | Orchestrator | Delegates tasks, monitors progress, seals mission |
|
|
125
|
+
| **Planner** 📋 | Research + Plan | Web search, doc caching, TODO creation |
|
|
126
|
+
| **Worker** 🔨 | Implementation | Code writing, file ops, background commands |
|
|
127
|
+
| **Reviewer** ✅ | Quality Control | Verification, TODO updates, context management |
|
|
427
128
|
|
|
428
129
|
---
|
|
429
130
|
|
|
430
|
-
##
|
|
131
|
+
## 📊 Resource Limits
|
|
431
132
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
133
|
+
| Resource | Limit |
|
|
134
|
+
|----------|-------|
|
|
135
|
+
| Parallel Sessions | 50 |
|
|
136
|
+
| Tasks in Memory | 1,000 (auto GC) |
|
|
137
|
+
| Session TTL | 60 min |
|
|
138
|
+
| Recovery Attempts | 3 per session |
|
|
139
|
+
| Max Iterations | 20 per mission |
|
|
437
140
|
|
|
438
141
|
---
|
|
439
142
|
|
|
440
|
-
##
|
|
143
|
+
## 📚 Documentation
|
|
441
144
|
|
|
442
|
-
|
|
443
|
-
Automatic recovery from common errors:
|
|
444
|
-
- `tool_result_missing` - Tool crash recovery
|
|
445
|
-
- `thinking_block_order` - Thinking block issues
|
|
446
|
-
- `rate_limit` - API rate limiting with backoff
|
|
447
|
-
- Max 3 recovery attempts per session
|
|
145
|
+
For detailed architecture, directory structure, and internals:
|
|
448
146
|
|
|
449
|
-
|
|
450
|
-
-
|
|
451
|
-
- 3-second countdown toast before auto-continuation
|
|
452
|
-
- Cancels on user interaction
|
|
453
|
-
- Skips if background tasks running or session is recovering
|
|
454
|
-
|
|
455
|
-
### noReply Optimization
|
|
456
|
-
- Individual task completion: `noReply: true` (saves tokens)
|
|
457
|
-
- All tasks complete: `noReply: false` (AI processes results)
|
|
147
|
+
- **[System Architecture](docs/SYSTEM_ARCHITECTURE.md)** — Complete technical documentation
|
|
148
|
+
- [Release Notes](docs/releases/) — Version history
|
|
458
149
|
|
|
459
150
|
---
|
|
460
151
|
|
|
@@ -466,30 +157,6 @@ npm uninstall -g opencode-orchestrator
|
|
|
466
157
|
|
|
467
158
|
---
|
|
468
159
|
|
|
469
|
-
## 🔧 Debugging
|
|
470
|
-
|
|
471
|
-
**Log file location:**
|
|
472
|
-
```bash
|
|
473
|
-
# Find log path (macOS uses /var/folders/...)
|
|
474
|
-
npm run log
|
|
475
|
-
# or:
|
|
476
|
-
tail -f "$(node -e 'console.log(require("os").tmpdir())')/opencode-orchestrator.log"
|
|
477
|
-
|
|
478
|
-
# Windows
|
|
479
|
-
# C:\Users\<username>\AppData\Local\Temp\opencode-orchestrator.log
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
---
|
|
483
|
-
|
|
484
|
-
## Documentation
|
|
485
|
-
|
|
486
|
-
- **[System Architecture](docs/SYSTEM_ARCHITECTURE.md)** — Detailed technical docs
|
|
487
|
-
- **[Architecture and Flow](docs/ARCHITECTURE_AND_FLOW.md)** — Complete architecture guide with scenarios
|
|
488
|
-
- **[Improvement Suggestions](docs/IMPROVEMENT_SUGGESTIONS.md)** — Project improvement recommendations
|
|
489
|
-
- [Release Notes](docs/releases/) — Version history
|
|
490
|
-
|
|
491
|
-
---
|
|
492
|
-
|
|
493
160
|
## License
|
|
494
161
|
|
|
495
162
|
MIT License. [LICENSE](LICENSE)
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "opencode-orchestrator",
|
|
3
3
|
"displayName": "OpenCode Orchestrator",
|
|
4
4
|
"description": "Distributed Cognitive Architecture for OpenCode. Turns simple prompts into specialized multi-agent workflows (Planner, Coder, Reviewer).",
|
|
5
|
-
"version": "0.8.
|
|
5
|
+
"version": "0.8.18",
|
|
6
6
|
"author": "agnusdei1207",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|