opencode-orchestrator 0.5.2 → 0.5.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 +10 -67
- 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 +342 -1128
- 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/git.d.ts +2 -2
- 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 +6 -10
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,8 +95,7 @@ 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
|
|
|
97
|
-
Monitor parallel tasks in terminal:
|
|
98
|
-
|
|
98
|
+
Monitor parallel tasks in the terminal:
|
|
99
99
|
```
|
|
100
100
|
[parallel] 🚀 SPAWNED task_a1b2 → builder: Implement feature X
|
|
101
101
|
[parallel] 🚀 SPAWNED task_c3d4 → inspector: Review module Y
|
|
@@ -103,63 +103,6 @@ Monitor parallel tasks in terminal:
|
|
|
103
103
|
[parallel] 🗑️ CLEANED task_c3d4 (session deleted)
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
### 🎯 Smart Batch — Centralized Validation and Retry
|
|
107
|
-
|
|
108
|
-
For processing many microtasks efficiently, use the Smart Batch approach:
|
|
109
|
-
|
|
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
|
-
```
|
|
123
|
-
|
|
124
|
-
**Smart Batch Benefits**:
|
|
125
|
-
| Benefit | Description |
|
|
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) |
|
|
131
|
-
|
|
132
|
-
**Smart Batch Tools**:
|
|
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
|
|
136
|
-
|
|
137
|
-
### 🔧 Configuration Management
|
|
138
|
-
|
|
139
|
-
Dynamic configuration for runtime tuning:
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
# View current configuration
|
|
143
|
-
show_config()
|
|
144
|
-
|
|
145
|
-
# Update concurrency limits
|
|
146
|
-
set_concurrency({ agent: "builder", limit: 10 })
|
|
147
|
-
|
|
148
|
-
# Update timeouts
|
|
149
|
-
set_timeout({ taskTtlMinutes: 45, cleanupDelayMinutes: 2 })
|
|
150
|
-
|
|
151
|
-
# Toggle debug logging
|
|
152
|
-
set_debug({ component: "parallel_agent", enable: true })
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
**Environment Variables**:
|
|
156
|
-
- `OPENCODE_TASK_TTL_MS` — Task timeout (default: 30min)
|
|
157
|
-
- `OPENCODE_CLEANUP_DELAY_MS` — Cleanup delay (default: 5min)
|
|
158
|
-
- `OPENCODE_DEFAULT_CONCURRENCY` — Default parallelism (default: 3)
|
|
159
|
-
- `OPENCODE_MAX_CONCURRENCY` — Max parallelism (default: 10)
|
|
160
|
-
- `OPENCODE_DEBUG_PARALLEL` — Enable debug logs
|
|
161
|
-
- `OPENCODE_DEBUG_BACKGROUND` — Enable debug logs
|
|
162
|
-
|
|
163
106
|
---
|
|
164
107
|
|
|
165
108
|
## Agents (5-Agent Architecture)
|
|
@@ -258,13 +201,13 @@ npm run dev:test
|
|
|
258
201
|
### Release Scripts
|
|
259
202
|
|
|
260
203
|
```bash
|
|
261
|
-
# Release patch version (0.4.
|
|
204
|
+
# Release patch version (0.4.1 → 0.4.2)
|
|
262
205
|
npm run release:patch
|
|
263
206
|
|
|
264
|
-
# Release minor version (0.4.
|
|
207
|
+
# Release minor version (0.4.1 → 0.5.0)
|
|
265
208
|
npm run release:minor
|
|
266
209
|
|
|
267
|
-
# Release major version (0.4.
|
|
210
|
+
# Release major version (0.4.1 → 1.0.0)
|
|
268
211
|
npm run release:major
|
|
269
212
|
```
|
|
270
213
|
|
|
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;
|