opencode-orchestrator 0.4.23 → 0.4.24
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 +146 -52
- package/dist/agents/coder.d.ts +2 -0
- package/dist/agents/definitions.d.ts +0 -0
- package/dist/agents/fixer.d.ts +2 -0
- package/dist/agents/names.d.ts +12 -0
- package/dist/agents/orchestrator.d.ts +0 -0
- package/dist/agents/planner.d.ts +2 -0
- package/dist/agents/reviewer.d.ts +2 -0
- package/dist/agents/searcher.d.ts +2 -0
- package/dist/agents/subagents/architect.d.ts +0 -0
- package/dist/agents/subagents/builder.d.ts +0 -0
- package/dist/agents/subagents/coder.d.ts +2 -0
- package/dist/agents/subagents/executor.d.ts +2 -0
- package/dist/agents/subagents/fixer.d.ts +2 -0
- package/dist/agents/subagents/inspector.d.ts +0 -0
- package/dist/agents/subagents/memory.d.ts +2 -0
- package/dist/agents/subagents/planner.d.ts +2 -0
- package/dist/agents/subagents/publisher.d.ts +2 -0
- package/dist/agents/subagents/recorder.d.ts +0 -0
- package/dist/agents/subagents/reviewer.d.ts +2 -0
- package/dist/agents/subagents/searcher.d.ts +2 -0
- package/dist/agents/subagents/strategist.d.ts +2 -0
- package/dist/agents/subagents/surgeon.d.ts +2 -0
- package/dist/agents/subagents/types.d.ts +7 -0
- package/dist/agents/subagents/visualist.d.ts +2 -0
- package/dist/agents/types.d.ts +7 -0
- package/dist/cli.d.ts +2 -0
- package/dist/core/async-agent.d.ts +2 -14
- package/dist/core/background.d.ts +0 -33
- package/dist/core/state.d.ts +0 -0
- package/dist/core/tasks.d.ts +0 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +330 -1068
- package/dist/shared/contracts/interfaces.d.ts +0 -0
- package/dist/shared/contracts/names.d.ts +0 -0
- package/dist/tasks.d.ts +29 -0
- package/dist/tools/background.d.ts +0 -2
- package/dist/tools/callAgent.d.ts +0 -0
- package/dist/tools/rust.d.ts +0 -0
- package/dist/tools/search.d.ts +0 -0
- package/dist/tools/slashCommand.d.ts +0 -0
- package/dist/utils/binary.d.ts +0 -0
- package/dist/utils/common.d.ts +0 -0
- package/dist/utils/sanity.d.ts +22 -0
- package/package.json +4 -7
package/README.md
CHANGED
|
@@ -28,16 +28,17 @@ A **5-agent autonomous architecture** designed to solve complex engineering task
|
|
|
28
28
|
|
|
29
29
|
**Core Philosophy**: Intelligence is a resource. We orchestrate that resource through **Phase-based Workflows** and **Mandatory Environment Scans** to ensure code always fits the project's infrastructure.
|
|
30
30
|
|
|
31
|
+
> 🦀 **Powered by Rust** — Background tasks and parallel searches run on native Rust binaries for maximum performance.
|
|
32
|
+
|
|
31
33
|
### Key Features
|
|
32
|
-
- **🎯 Autonomous Loop** — Commander runs relentlessly until mission is complete.
|
|
34
|
+
- **🎯 Autonomous Loop** — Commander runs relentlessly until the mission is complete.
|
|
33
35
|
- **🔍 Environment Scan** — Mandatory analysis of Infra (Docker/OS), Stack, and Domain before any code change.
|
|
34
36
|
- **🔨 Smart Implementation** — Builder matches existing codebase patterns exactly.
|
|
35
37
|
- **🛡️ Rigorous Audit** — Inspector proves success with environment-specific evidence (Builds/Tests/Logs).
|
|
36
38
|
- **💾 Persistent Context** — Recorder saves session state to disk, enabling resume at any time.
|
|
37
39
|
- **🏗️ Parallel Agents** — Delegated agent execution (`delegate_task`) with sync/async modes.
|
|
38
40
|
- **⏳ Background Tasks** — Run long commands (builds, tests) in background and check results later.
|
|
39
|
-
|
|
40
|
-
- **🎯 Smart Batch** — Centralized validation and retry for efficient parallel processing. Dynamic concurrency limits with intelligent failure handling.
|
|
41
|
+
- **🔎 mgrep** — Multi-pattern parallel search powered by Rust for blazing-fast codebase analysis.
|
|
41
42
|
|
|
42
43
|
---
|
|
43
44
|
|
|
@@ -58,8 +59,8 @@ Restart OpenCode after installation.
|
|
|
58
59
|
In OpenCode, press `Tab` to open the Agent selection menu. Select **Commander** and type your mission!
|
|
59
60
|
|
|
60
61
|
<div align="center">
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
<img src="assets/commander-screenshot.png" alt="Commander Screenshot" width="600" />
|
|
63
|
+
<p><em>Press Tab to select Commander</em></p>
|
|
63
64
|
</div>
|
|
64
65
|
|
|
65
66
|
```
|
|
@@ -94,71 +95,164 @@ Trigger parallel agent execution with prompts like:
|
|
|
94
95
|
|
|
95
96
|
Commander will automatically use `delegate_task` with `background: true` for independent tasks.
|
|
96
97
|
|
|
98
|
+
**Parallel Execution UI**
|
|
99
|
+
|
|
100
|
+
When tasks run in parallel, you'll see detailed progress in OpenCode:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
## 🚀 BACKGROUND TASK SPAWNED
|
|
104
|
+
|
|
105
|
+
**Task Details**
|
|
106
|
+
- **ID**: `task_a1b2c3d4`
|
|
107
|
+
- **Agent**: builder
|
|
108
|
+
- **Description**: Implement authentication system
|
|
109
|
+
- **Status**: ⏳ Running in background (non-blocking)
|
|
110
|
+
|
|
111
|
+
**Active Tasks**
|
|
112
|
+
- Running: 2
|
|
113
|
+
- Pending: 1
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
**Monitoring Commands**
|
|
118
|
+
|
|
119
|
+
Check progress anytime:
|
|
120
|
+
- `list_tasks()` - View all parallel tasks
|
|
121
|
+
- `get_task_result({ taskId: "task_a1b2c3d4" })` - Get latest result
|
|
122
|
+
- `cancel_task({ taskId: "task_a1b2c3d4" })` - Stop this task
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
✓ System will notify when ALL tasks complete. You can continue working!
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Terminal Logs**
|
|
130
|
+
|
|
97
131
|
Monitor parallel tasks in terminal:
|
|
98
132
|
|
|
99
133
|
```
|
|
100
|
-
[parallel] 🚀 SPAWNED
|
|
101
|
-
[parallel] 🚀 SPAWNED
|
|
102
|
-
[parallel] ✅ COMPLETED
|
|
103
|
-
[parallel] 🗑️ CLEANED
|
|
134
|
+
[parallel] 🚀 SPAWNED task_a1b2c3d4 → builder: Implement authentication
|
|
135
|
+
[parallel] 🚀 SPAWNED task_e5f6g7h8 → inspector: Review module
|
|
136
|
+
[parallel] ✅ COMPLETED task_e5f6g7h8 → inspector: Review module (45s)
|
|
137
|
+
[parallel] 🗑️ CLEANED task_e5f6g7h8 (session deleted)
|
|
104
138
|
```
|
|
105
139
|
|
|
106
|
-
|
|
140
|
+
**All Tasks Complete**
|
|
107
141
|
|
|
108
|
-
|
|
142
|
+
When all parallel tasks finish, you'll see:
|
|
109
143
|
|
|
110
|
-
```bash
|
|
111
|
-
# Use Smart Batch to process many tasks with intelligent validation
|
|
112
|
-
process_batch({
|
|
113
|
-
concurrency: "10",
|
|
114
|
-
maxRetries: "2",
|
|
115
|
-
tasks: [
|
|
116
|
-
{ id: "task1", agent: "builder", description: "Write API handler", prompt: "..." },
|
|
117
|
-
{ id: "task2", agent: "inspector", description: "Review API code", prompt: "..." },
|
|
118
|
-
{ id: "task3", agent: "architect", description: "Design database schema", prompt: "..." },
|
|
119
|
-
{ id: "task4", agent: "recorder", description: "Document API", prompt: "..." }
|
|
120
|
-
]
|
|
121
|
-
})
|
|
122
144
|
```
|
|
145
|
+
**All Parallel Tasks Complete**
|
|
123
146
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|---------|-------------|
|
|
127
|
-
| **Speed** | 50% faster (1000 tasks: 200min → 150min) |
|
|
128
|
-
| **Efficiency** | 30% fewer API calls (only retry failures) |
|
|
129
|
-
| **Quality** | Centralized validation identifies all failures at once |
|
|
130
|
-
| **Adaptive** | Dynamic concurrency (up to 10, unlimited with validation) |
|
|
147
|
+
✅ `task_a1b2c3d4` (1m 30s): Implement authentication
|
|
148
|
+
✅ `task_e5f6g7h8` (45s): Review module
|
|
131
149
|
|
|
132
|
-
|
|
133
|
-
- `process_batch()` — Execute multiple tasks with intelligent validation
|
|
134
|
-
- `export_failed_tasks()` — Export failed tasks for manual review
|
|
135
|
-
- `compare_strategies()` — Compare naive vs smart batch performance
|
|
150
|
+
---
|
|
136
151
|
|
|
137
|
-
|
|
152
|
+
**Retrieval Options**
|
|
138
153
|
|
|
139
|
-
|
|
154
|
+
Use `get_task_result({ taskId: "task_xxx" })` to retrieve full results.
|
|
140
155
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
**Task Summary**
|
|
159
|
+
|
|
160
|
+
Total Tasks: 2
|
|
161
|
+
Status: All Complete
|
|
162
|
+
Mode: Background (non-blocking)
|
|
163
|
+
```
|
|
164
|
+
"Build and test in parallel"
|
|
165
|
+
"Implement feature X while reviewing module Y"
|
|
166
|
+
"Run linting, tests, and build at the same time"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Commander will automatically use `delegate_task` with `background: true` for independent tasks.
|
|
144
170
|
|
|
145
|
-
|
|
146
|
-
set_concurrency({ agent: "builder", limit: 10 })
|
|
171
|
+
**Parallel Execution UI**
|
|
147
172
|
|
|
148
|
-
|
|
149
|
-
set_timeout({ taskTtlMinutes: 45, cleanupDelayMinutes: 2 })
|
|
173
|
+
When tasks run in parallel, you'll see detailed progress in OpenCode:
|
|
150
174
|
|
|
151
|
-
# Toggle debug logging
|
|
152
|
-
set_debug({ component: "parallel_agent", enable: true })
|
|
153
175
|
```
|
|
176
|
+
╔════════════════════════════════════════════════════════════╗
|
|
177
|
+
║ 🚀 BACKGROUND TASK SPAWNED ║
|
|
178
|
+
╠═════════════════════════════════════════════════════════════╣
|
|
179
|
+
║ Task ID: task_a1b2c3d4 ║
|
|
180
|
+
║ Agent: builder ║
|
|
181
|
+
║ Description: Implement authentication system ║
|
|
182
|
+
║ Status: ⏳ RUNNING (background) ║
|
|
183
|
+
╠═════════════════════════════════════════════════════════════╣
|
|
184
|
+
║ Running: 2 │ Pending: 1 ║
|
|
185
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
**Parallel Execution Started**
|
|
190
|
+
|
|
191
|
+
- 📌 Task ID: `task_a1b2c3d4`
|
|
192
|
+
- 🤖 Agent: builder
|
|
193
|
+
- 📝 Description: Implement authentication system
|
|
194
|
+
- ⏳ Status: Running in background (non-blocking)
|
|
195
|
+
- 🔄 Active Tasks: 2 running, 1 pending
|
|
154
196
|
|
|
155
|
-
**
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
- `
|
|
159
|
-
- `
|
|
160
|
-
- `
|
|
161
|
-
|
|
197
|
+
**Monitoring**
|
|
198
|
+
|
|
199
|
+
Check progress anytime with:
|
|
200
|
+
- `list_tasks()` - View all parallel tasks
|
|
201
|
+
- `get_task_result({ taskId: "task_a1b2c3d4" })` - Get latest result
|
|
202
|
+
- `cancel_task({ taskId: "task_a1b2c3d4" })` - Stop this task
|
|
203
|
+
|
|
204
|
+
System will notify when ALL tasks complete. You can continue working!
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Terminal Logs**
|
|
208
|
+
|
|
209
|
+
Monitor parallel tasks in terminal:
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
[parallel] 🚀 SPAWNED task_a1b2c3d4 → builder: Implement authentication
|
|
213
|
+
[parallel] 🚀 SPAWNED task_e5f6g7h8 → inspector: Review module
|
|
214
|
+
[parallel] ✅ COMPLETED task_e5f6g7h8 → inspector: Review module (45s)
|
|
215
|
+
[parallel] 🗑️ CLEANED task_e5f6g7h8 (session deleted)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**All Tasks Complete**
|
|
219
|
+
|
|
220
|
+
When all parallel tasks finish, you'll see:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
**All Parallel Tasks Complete**
|
|
224
|
+
|
|
225
|
+
✅ `task_a1b2c3d4` (1m 30s): Implement authentication
|
|
226
|
+
✅ `task_e5f6g7h8` (45s): Review module
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
**Retrieval Options**
|
|
231
|
+
|
|
232
|
+
Use `get_task_result({ taskId: "task_xxx" })` to retrieve full results.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
**Task Summary**
|
|
237
|
+
|
|
238
|
+
Total Tasks: 2
|
|
239
|
+
Status: All Complete
|
|
240
|
+
Mode: Background (non-blocking)
|
|
241
|
+
```
|
|
242
|
+
"Build and test in parallel"
|
|
243
|
+
"Implement feature X while reviewing module Y"
|
|
244
|
+
"Run linting, tests, and build at the same time"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Commander will automatically use `delegate_task` with `background: true` for independent tasks.
|
|
248
|
+
|
|
249
|
+
Monitor parallel tasks in the terminal:
|
|
250
|
+
```
|
|
251
|
+
[parallel] 🚀 SPAWNED task_a1b2 → builder: Implement feature X
|
|
252
|
+
[parallel] 🚀 SPAWNED task_c3d4 → inspector: Review module Y
|
|
253
|
+
[parallel] ✅ COMPLETED task_c3d4 → inspector: Review module Y (45s)
|
|
254
|
+
[parallel] 🗑️ CLEANED task_c3d4 (session deleted)
|
|
255
|
+
```
|
|
162
256
|
|
|
163
257
|
---
|
|
164
258
|
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const AGENT_NAMES: {
|
|
2
|
+
readonly ORCHESTRATOR: "orchestrator";
|
|
3
|
+
readonly PLANNER: "planner";
|
|
4
|
+
readonly CODER: "coder";
|
|
5
|
+
readonly REVIEWER: "reviewer";
|
|
6
|
+
readonly SEARCHER: "searcher";
|
|
7
|
+
readonly SURGEON: "surgeon";
|
|
8
|
+
readonly EXECUTOR: "executor";
|
|
9
|
+
readonly VISUALIST: "visualist";
|
|
10
|
+
readonly PUBLISHER: "publisher";
|
|
11
|
+
};
|
|
12
|
+
export type AgentName = typeof AGENT_NAMES[keyof typeof AGENT_NAMES];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/cli.d.ts
ADDED
|
@@ -70,21 +70,9 @@ export declare class ParallelAgentManager {
|
|
|
70
70
|
*/
|
|
71
71
|
getResult(taskId: string): Promise<string | null>;
|
|
72
72
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
* Set concurrency limit for agent type
|
|
74
|
+
*/
|
|
75
75
|
setConcurrencyLimit(agentType: string, limit: number): void;
|
|
76
|
-
/**
|
|
77
|
-
* Get concurrency statistics for all agent types
|
|
78
|
-
*/
|
|
79
|
-
getConcurrencyStats(): Record<string, {
|
|
80
|
-
running: number;
|
|
81
|
-
queued: number;
|
|
82
|
-
limit: number;
|
|
83
|
-
}>;
|
|
84
|
-
/**
|
|
85
|
-
* Update concurrency limit dynamically at runtime
|
|
86
|
-
*/
|
|
87
|
-
updateConcurrency(agentType: string, newLimit: number): void;
|
|
88
76
|
/**
|
|
89
77
|
* Get pending notification count
|
|
90
78
|
*/
|
|
@@ -8,7 +8,6 @@ import { ChildProcess } from "child_process";
|
|
|
8
8
|
export type TaskStatus = "pending" | "running" | "done" | "error" | "timeout";
|
|
9
9
|
export interface BackgroundTask {
|
|
10
10
|
id: string;
|
|
11
|
-
sessionID?: string;
|
|
12
11
|
command: string;
|
|
13
12
|
args: string[];
|
|
14
13
|
cwd: string;
|
|
@@ -27,45 +26,17 @@ export interface RunBackgroundOptions {
|
|
|
27
26
|
cwd?: string;
|
|
28
27
|
timeout?: number;
|
|
29
28
|
label?: string;
|
|
30
|
-
sessionID?: string;
|
|
31
29
|
}
|
|
32
30
|
declare class BackgroundTaskManager {
|
|
33
31
|
private static _instance;
|
|
34
32
|
private tasks;
|
|
35
33
|
private debugMode;
|
|
36
|
-
private storageDir;
|
|
37
|
-
private storageFile;
|
|
38
|
-
private monitoringInterval?;
|
|
39
34
|
private constructor();
|
|
40
35
|
static get instance(): BackgroundTaskManager;
|
|
41
36
|
/**
|
|
42
37
|
* Generate a unique task ID in the format job_xxxxxxxx
|
|
43
38
|
*/
|
|
44
39
|
private generateId;
|
|
45
|
-
/**
|
|
46
|
-
* Ensure storage directory exists
|
|
47
|
-
*/
|
|
48
|
-
private ensureStorageDir;
|
|
49
|
-
/**
|
|
50
|
-
* Load tasks from disk on startup
|
|
51
|
-
*/
|
|
52
|
-
private loadFromDisk;
|
|
53
|
-
/**
|
|
54
|
-
* Save tasks to disk
|
|
55
|
-
*/
|
|
56
|
-
private saveToDisk;
|
|
57
|
-
/**
|
|
58
|
-
* Start periodic monitoring of running processes
|
|
59
|
-
*/
|
|
60
|
-
private startMonitoring;
|
|
61
|
-
/**
|
|
62
|
-
* Stop monitoring
|
|
63
|
-
*/
|
|
64
|
-
private stopMonitoring;
|
|
65
|
-
/**
|
|
66
|
-
* Monitor running processes and detect zombie processes
|
|
67
|
-
*/
|
|
68
|
-
private monitorRunningProcesses;
|
|
69
40
|
/**
|
|
70
41
|
* Debug logging helper
|
|
71
42
|
*/
|
|
@@ -86,10 +57,6 @@ declare class BackgroundTaskManager {
|
|
|
86
57
|
* Get tasks by status
|
|
87
58
|
*/
|
|
88
59
|
getByStatus(status: TaskStatus): BackgroundTask[];
|
|
89
|
-
/**
|
|
90
|
-
* Clean up tasks by session ID
|
|
91
|
-
*/
|
|
92
|
-
cleanupBySession(sessionID: string): number;
|
|
93
60
|
/**
|
|
94
61
|
* Clear completed/failed tasks
|
|
95
62
|
*/
|
package/dist/core/state.d.ts
CHANGED
|
File without changes
|
package/dist/core/tasks.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -82,14 +82,12 @@ declare const OrchestratorPlugin: (input: PluginInput) => Promise<{
|
|
|
82
82
|
cwd: import("zod").ZodOptional<import("zod").ZodString>;
|
|
83
83
|
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
84
84
|
label: import("zod").ZodOptional<import("zod").ZodString>;
|
|
85
|
-
sessionID: import("zod").ZodOptional<import("zod").ZodString>;
|
|
86
85
|
};
|
|
87
86
|
execute(args: {
|
|
88
87
|
command: string;
|
|
89
88
|
cwd?: string | undefined;
|
|
90
89
|
timeout?: number | undefined;
|
|
91
90
|
label?: string | undefined;
|
|
92
|
-
sessionID?: string | undefined;
|
|
93
91
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
94
92
|
};
|
|
95
93
|
check_background: {
|
|
@@ -139,7 +137,8 @@ declare const OrchestratorPlugin: (input: PluginInput) => Promise<{
|
|
|
139
137
|
output: string;
|
|
140
138
|
metadata: any;
|
|
141
139
|
}) => Promise<void>;
|
|
142
|
-
|
|
140
|
+
"assistant.done": (assistantInput: any, assistantOutput: any) => Promise<void>;
|
|
141
|
+
handler: ({ event }: {
|
|
143
142
|
event: {
|
|
144
143
|
type: string;
|
|
145
144
|
properties?: unknown;
|