opencode-orchestrator 0.6.27 → 0.6.50
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 +77 -54
- package/dist/agents/consolidated/planner.d.ts +8 -0
- package/dist/agents/consolidated/reviewer.d.ts +8 -0
- package/dist/agents/consolidated/worker.d.ts +8 -0
- package/dist/agents/definitions.d.ts +9 -0
- package/dist/core/agents/manager/task-cleaner.d.ts +11 -1
- package/dist/core/agents/manager.d.ts +2 -0
- package/dist/core/loop/todo-continuation.d.ts +34 -0
- package/dist/core/notification/presets.d.ts +1 -0
- package/dist/core/notification/task-toast-manager.d.ts +131 -0
- package/dist/core/notification/toast.d.ts +1 -0
- package/dist/core/recovery/session-recovery.d.ts +30 -0
- package/dist/core/task/parser.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1354 -505
- package/dist/shared/agent.d.ts +9 -6
- package/dist/shared/error-patterns.d.ts +38 -0
- package/dist/tools/callAgent.d.ts +4 -5
- package/dist/tools/parallel/delegate-task.d.ts +5 -0
- package/dist/tools/search.d.ts +2 -2
- package/dist/tools/web/webfetch.d.ts +1 -1
- package/dist/utils/sanity.d.ts +2 -2
- package/package.json +1 -1
- package/dist/agents/subagents/architect.d.ts +0 -2
- package/dist/agents/subagents/builder.d.ts +0 -2
- package/dist/agents/subagents/inspector.d.ts +0 -2
- package/dist/agents/subagents/librarian.d.ts +0 -2
- package/dist/agents/subagents/recorder.d.ts +0 -2
- package/dist/agents/subagents/researcher.d.ts +0 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](LICENSE)
|
|
10
10
|
[](https://www.npmjs.com/package/opencode-orchestrator)
|
|
11
|
-
[]()
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -18,74 +18,76 @@ Multi-agent system that autonomously executes complex tasks. Commander delegates
|
|
|
18
18
|
|
|
19
19
|
| Capability | Detail |
|
|
20
20
|
|------------|--------|
|
|
21
|
-
| **Agents** |
|
|
22
|
-
| **Parallel Sessions** | Up to 50 concurrent |
|
|
21
|
+
| **Agents** | 4 consolidated (Commander, Planner, Worker, Reviewer) |
|
|
22
|
+
| **Parallel Sessions** | Up to 50 concurrent Worker Sessions |
|
|
23
23
|
| **Context Management** | `.opencode/` with adaptive summarization |
|
|
24
24
|
| **Memory Safety** | Auto GC, disk archiving |
|
|
25
|
-
| **Error Handling** | Pattern-based auto recovery |
|
|
25
|
+
| **Error Handling** | Pattern-based auto recovery + session recovery |
|
|
26
|
+
| **Todo Continuation** | Auto-continues when todos remain |
|
|
27
|
+
| **Smart Notifications** | TaskToastManager with consolidated views |
|
|
26
28
|
|
|
27
29
|
---
|
|
28
30
|
|
|
29
|
-
## 🏛️
|
|
31
|
+
## 🏛️ Master Session Architecture
|
|
30
32
|
|
|
31
33
|
```
|
|
32
34
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
33
35
|
│ 👤 USER REQUEST │
|
|
34
|
-
│
|
|
36
|
+
│ "/task Build a REST API" │
|
|
35
37
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
36
38
|
│
|
|
37
39
|
▼
|
|
38
40
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
39
|
-
│
|
|
41
|
+
│ 🎯 MASTER SESSION (Commander Agent) │
|
|
42
|
+
│ │
|
|
43
|
+
│ ┌───────────────────────────────────────────────────────────────────────┐ │
|
|
44
|
+
│ │ 1️⃣ THINK → Analyze request, assess complexity (L1/L2/L3) │ │
|
|
45
|
+
│ │ 2️⃣ PLAN → Create .opencode/todo.md via Planner │ │
|
|
46
|
+
│ │ 3️⃣ DELEGATE → Spawn Worker Sessions via delegate_task │ │
|
|
47
|
+
│ │ 4️⃣ MONITOR → Watch .opencode/ for progress, handle completions │ │
|
|
48
|
+
│ └───────────────────────────────────────────────────────────────────────┘ │
|
|
40
49
|
│ │
|
|
41
50
|
│ ┌─────────────────┐ ┌─────────────────────────────────────────────────┐ │
|
|
42
|
-
│ │ Session State │ │
|
|
43
|
-
│ │ Map<id,state> │ │ 🎯 Commander
|
|
44
|
-
│ └─────────────────┘ │
|
|
45
|
-
│
|
|
46
|
-
│ ┌─────────────────┐
|
|
47
|
-
│ │ Plugin Hooks │
|
|
48
|
-
│ │
|
|
49
|
-
│ │ chat.message │
|
|
50
|
-
│ │ tool.execute │
|
|
51
|
-
│ └─────────────────┘ │
|
|
52
|
-
│ │ delegate_task get_task_result list_tasks │ │
|
|
53
|
-
│ │ webfetch websearch codesearch │ │
|
|
54
|
-
│ │ run_background grep_search mgrep │ │
|
|
51
|
+
│ │ Session State │ │ 4 CONSOLIDATED AGENTS │ │
|
|
52
|
+
│ │ Map<id,state> │ │ 🎯 Commander 📋 Planner │ │
|
|
53
|
+
│ └─────────────────┘ │ 🔨 Worker ✅ Reviewer │ │
|
|
54
|
+
│ └─────────────────────────────────────────────────┘ │
|
|
55
|
+
│ ┌─────────────────┐
|
|
56
|
+
│ │ Plugin Hooks │ │
|
|
57
|
+
│ │ event │ ┌─────────────────────────────────────────────────┐ │
|
|
58
|
+
│ │ chat.message │ │ 🔄 SessionRecovery (auto error handling) │ │
|
|
59
|
+
│ │ tool.execute │ │ 📋 TodoContinuation (auto-resume on idle) │ │
|
|
60
|
+
│ └─────────────────┘ │ 📣 TaskToastManager (consolidated notifications)│ │
|
|
55
61
|
│ └─────────────────────────────────────────────────┘ │
|
|
56
62
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
57
63
|
│
|
|
58
|
-
|
|
59
|
-
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
60
|
-
│ ⚙️ PARALLEL AGENT MANAGER │
|
|
61
|
-
│ │
|
|
62
|
-
│ ┌──────────────┐ ┌──────────────┐ ┌─────────────────────────────────┐ │
|
|
63
|
-
│ │ TaskLauncher │ │ TaskPoller │ │ ConcurrencyController │ │
|
|
64
|
-
│ │ launch() │ │ poll() │ │ MAX=50, PER_AGENT=10 │ │
|
|
65
|
-
│ └──────────────┘ └──────────────┘ └─────────────────────────────────┘ │
|
|
66
|
-
│ │
|
|
67
|
-
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
68
|
-
│ │ TaskStore (MAX: 1000 tasks) │ │
|
|
69
|
-
│ │ pending → running → completed/error → archived (disk) │ │
|
|
70
|
-
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
71
|
-
└─────────────────────────────────────────────────────────────────────────────┘
|
|
64
|
+
delegate_task (async)
|
|
72
65
|
│
|
|
66
|
+
┌─────────────────────────┼─────────────────────────┐
|
|
67
|
+
▼ ▼ ▼
|
|
68
|
+
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
|
|
69
|
+
│ ⚡ Worker Session 1 │ │ ⚡ Worker Session 2 │ │ ⚡ Worker Session N │
|
|
70
|
+
│ Agent: Planner │ │ Agent: Worker │ │ Agent: Reviewer │
|
|
71
|
+
│ │ │ │ │ │
|
|
72
|
+
│ • Independent exec │ │ • Independent exec │ │ • Independent exec │
|
|
73
|
+
│ • Read/Write │ │ • Read/Write │ │ • Read/Write │
|
|
74
|
+
│ .opencode/ │ │ .opencode/ │ │ .opencode/ │
|
|
75
|
+
│ • Notify parent │ │ • Notify parent │ │ • Notify parent │
|
|
76
|
+
│ on complete │ │ on complete │ │ on complete │
|
|
77
|
+
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
|
|
78
|
+
│ │ │
|
|
79
|
+
└─────────────────────────┼─────────────────────────┘
|
|
73
80
|
▼
|
|
74
81
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
75
|
-
│
|
|
82
|
+
│ 📁 SHARED CONTEXT (.opencode/) │
|
|
76
83
|
│ │
|
|
77
|
-
│
|
|
78
|
-
│
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
▼
|
|
82
|
-
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
83
|
-
│ 📁 SMART CONTEXT (.opencode/) │
|
|
84
|
+
│ .opencode/todo.md ← Master TODO (Planner creates, Reviewer updates) │
|
|
85
|
+
│ .opencode/context.md ← Adaptive context (shrinks as progress increases) │
|
|
86
|
+
│ .opencode/docs/ ← Cached docs (Planner/Worker save, auto-expire) │
|
|
87
|
+
│ .opencode/archive/ ← Old context for reference │
|
|
84
88
|
│ │
|
|
85
|
-
│
|
|
86
|
-
│
|
|
87
|
-
│ .opencode/docs/ - Cached documentation (auto-cleanup) │
|
|
88
|
-
│ .opencode/archive/ - Old context for reference │
|
|
89
|
+
│ ⚡ All sessions read/write this shared workspace │
|
|
90
|
+
│ 📊 Progress is tracked via todo.md checkboxes │
|
|
89
91
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
90
92
|
```
|
|
91
93
|
|
|
@@ -158,12 +160,9 @@ What's the difference between useState and useReducer?
|
|
|
158
160
|
| Agent | Role | Responsibility |
|
|
159
161
|
| :--------------- | :----------- | :--------------------------------- |
|
|
160
162
|
| **Commander** 🎯 | Orchestrator | Autonomous mission control |
|
|
161
|
-
| **
|
|
162
|
-
| **
|
|
163
|
-
| **
|
|
164
|
-
| **Recorder** 💾 | Context | Progress tracking |
|
|
165
|
-
| **Librarian** 📚 | Research | Documentation & API research |
|
|
166
|
-
| **Researcher** 🔬 | Investigation | Pre-task research & analysis |
|
|
163
|
+
| **Planner** 📋 | Planner + Research | Task decomposition, research, caching docs |
|
|
164
|
+
| **Worker** 🔨 | Developer + Docs | Full-stack implementation, documentation |
|
|
165
|
+
| **Reviewer** ✅ | Quality + Context | Verification, TODO updates, context management |
|
|
167
166
|
|
|
168
167
|
---
|
|
169
168
|
|
|
@@ -195,19 +194,43 @@ What's the difference between useState and useReducer?
|
|
|
195
194
|
| Event History | 100 | Ring buffer |
|
|
196
195
|
| Session TTL | 60 min | Auto cleanup |
|
|
197
196
|
| Poll Interval | 1 second | Fast completion detection |
|
|
197
|
+
| Max Poll Count | 600 | Hard limit prevents infinite loops |
|
|
198
|
+
| Sync Timeout | 5 min | Safe delegate_task timeout |
|
|
199
|
+
| Recovery Attempts | 3 | Auto session error recovery |
|
|
198
200
|
|
|
199
201
|
---
|
|
200
202
|
|
|
201
203
|
## 🧪 Test Coverage
|
|
202
204
|
|
|
203
205
|
```
|
|
204
|
-
Test Files:
|
|
205
|
-
Tests:
|
|
206
|
+
Test Files: 19 passed
|
|
207
|
+
Tests: 216 passed
|
|
206
208
|
Duration: ~4.3s
|
|
207
209
|
```
|
|
208
210
|
|
|
209
211
|
---
|
|
210
212
|
|
|
213
|
+
## 🔄 Reliability Features
|
|
214
|
+
|
|
215
|
+
### Session Recovery
|
|
216
|
+
Automatic recovery from common errors:
|
|
217
|
+
- `tool_result_missing` - Tool crash recovery
|
|
218
|
+
- `thinking_block_order` - Thinking block issues
|
|
219
|
+
- `rate_limit` - API rate limiting with backoff
|
|
220
|
+
- Max 3 recovery attempts per session
|
|
221
|
+
|
|
222
|
+
### Todo Continuation
|
|
223
|
+
- Monitors `session.idle` events
|
|
224
|
+
- 2-second countdown before auto-continuation
|
|
225
|
+
- Cancels on user interaction
|
|
226
|
+
- Skips if background tasks running
|
|
227
|
+
|
|
228
|
+
### noReply Optimization
|
|
229
|
+
- Individual task completion: `noReply: true` (saves tokens)
|
|
230
|
+
- All tasks complete: `noReply: false` (AI processes results)
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
211
234
|
## Uninstall
|
|
212
235
|
|
|
213
236
|
```bash
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planner Agent - Strategic Planning + Research
|
|
3
|
+
*
|
|
4
|
+
* Combines: Architect + Researcher
|
|
5
|
+
* Role: Plan tasks, research technologies, prepare documentation
|
|
6
|
+
*/
|
|
7
|
+
import { AgentDefinition } from "../../shared/agent.js";
|
|
8
|
+
export declare const planner: AgentDefinition;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reviewer Agent - Verification + Context Management
|
|
3
|
+
*
|
|
4
|
+
* Combines: Inspector + Recorder
|
|
5
|
+
* Role: Verify implementations, track progress, manage context
|
|
6
|
+
*/
|
|
7
|
+
import { AgentDefinition } from "../../shared/agent.js";
|
|
8
|
+
export declare const reviewer: AgentDefinition;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker Agent - Implementation + Documentation
|
|
3
|
+
*
|
|
4
|
+
* Combines: Builder + Librarian
|
|
5
|
+
* Role: Write code, create files, fetch and cache documentation
|
|
6
|
+
*/
|
|
7
|
+
import { AgentDefinition } from "../../shared/agent.js";
|
|
8
|
+
export declare const worker: AgentDefinition;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Definitions Registry
|
|
3
|
+
*
|
|
4
|
+
* Consolidated agent architecture (v2):
|
|
5
|
+
* - Commander: Master orchestrator
|
|
6
|
+
* - Planner: Planning + Research
|
|
7
|
+
* - Worker: Implementation + Documentation
|
|
8
|
+
* - Reviewer: Verification + Context Management
|
|
9
|
+
*/
|
|
1
10
|
import { AgentDefinition } from "../shared/agent.js";
|
|
2
11
|
export declare const AGENTS: Record<string, AgentDefinition>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Task Cleaner - Handles cleanup and
|
|
2
|
+
* Task Cleaner - Handles cleanup, expiration, and notifications for tasks
|
|
3
|
+
*
|
|
4
|
+
* noReply Strategy:
|
|
5
|
+
* - Individual task completion: noReply=true (save tokens)
|
|
6
|
+
* - All tasks complete: noReply=false (let AI process results)
|
|
3
7
|
*/
|
|
4
8
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
5
9
|
import { TaskStore } from "../task-store.js";
|
|
@@ -12,6 +16,12 @@ export declare class TaskCleaner {
|
|
|
12
16
|
constructor(client: OpencodeClient, store: TaskStore, concurrency: ConcurrencyController);
|
|
13
17
|
pruneExpiredTasks(): void;
|
|
14
18
|
scheduleCleanup(taskId: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Notify parent session when task(s) complete.
|
|
21
|
+
* Uses noReply strategy:
|
|
22
|
+
* - Individual completion: noReply=true (silent notification, save tokens)
|
|
23
|
+
* - All complete: noReply=false (AI should process and report results)
|
|
24
|
+
*/
|
|
15
25
|
notifyParentIfAllComplete(parentSessionID: string): Promise<void>;
|
|
16
26
|
}
|
|
17
27
|
export {};
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* This is the main facade that composes the specialized components.
|
|
10
10
|
*/
|
|
11
11
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
12
|
+
import { ConcurrencyController } from "./concurrency.js";
|
|
12
13
|
import { formatDuration } from "./format.js";
|
|
13
14
|
import type { ParallelTask } from "./interfaces/parallel-task.interface.js";
|
|
14
15
|
import type { LaunchInput } from "./interfaces/launch-input.interface.js";
|
|
@@ -39,6 +40,7 @@ export declare class ParallelAgentManager {
|
|
|
39
40
|
getResult(taskId: string): Promise<string | null>;
|
|
40
41
|
setConcurrencyLimit(agentType: string, limit: number): void;
|
|
41
42
|
getPendingCount(parentSessionID: string): number;
|
|
43
|
+
getConcurrency(): ConcurrencyController;
|
|
42
44
|
cleanup(): void;
|
|
43
45
|
formatDuration: typeof formatDuration;
|
|
44
46
|
handleEvent(event: {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Todo Continuation Handler
|
|
3
|
+
*
|
|
4
|
+
* Monitors session.idle events and automatically continues execution
|
|
5
|
+
* if there are incomplete todos remaining.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Countdown toast before resuming (gives user chance to cancel)
|
|
9
|
+
* - Skips if background tasks are running
|
|
10
|
+
* - Respects abort/cancel from user
|
|
11
|
+
*/
|
|
12
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
13
|
+
type OpencodeClient = PluginInput["client"];
|
|
14
|
+
/**
|
|
15
|
+
* Handle session.idle event - start countdown if todos remain
|
|
16
|
+
*/
|
|
17
|
+
export declare function handleSessionIdle(client: OpencodeClient, sessionID: string, mainSessionID?: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Handle user message - cancel countdown (user is interacting)
|
|
20
|
+
*/
|
|
21
|
+
export declare function handleUserMessage(sessionID: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Handle abort/cancel - prevent automatic continuation
|
|
24
|
+
*/
|
|
25
|
+
export declare function handleAbort(sessionID: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Clean up session state
|
|
28
|
+
*/
|
|
29
|
+
export declare function cleanupSession(sessionID: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Check if there's a pending continuation countdown
|
|
32
|
+
*/
|
|
33
|
+
export declare function hasPendingContinuation(sessionID: string): boolean;
|
|
34
|
+
export {};
|
|
@@ -20,4 +20,5 @@ export declare const presets: {
|
|
|
20
20
|
warningRateLimited: () => import("./types.js").ToastMessage;
|
|
21
21
|
errorRecovery: (action: string) => import("./types.js").ToastMessage;
|
|
22
22
|
warningMaxDepth: (depth: number) => import("./types.js").ToastMessage;
|
|
23
|
+
warningMaxRetries: () => import("./types.js").ToastMessage;
|
|
23
24
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Toast Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages toast notifications for parallel/background tasks.
|
|
5
|
+
* Provides consolidated view of running and queued tasks.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Real-time task status display
|
|
9
|
+
* - Concurrency info (e.g., "2/5 slots")
|
|
10
|
+
* - New task highlighting
|
|
11
|
+
* - Completion summaries
|
|
12
|
+
*/
|
|
13
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
14
|
+
import type { ConcurrencyController } from "../agents/concurrency.js";
|
|
15
|
+
type OpencodeClient = PluginInput["client"];
|
|
16
|
+
export type TaskStatus = "running" | "queued" | "completed" | "error" | "cancelled";
|
|
17
|
+
export interface TrackedTask {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
agent: string;
|
|
21
|
+
status: TaskStatus;
|
|
22
|
+
startedAt: Date;
|
|
23
|
+
isBackground: boolean;
|
|
24
|
+
parentSessionID?: string;
|
|
25
|
+
sessionID?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface TaskCompletionInfo {
|
|
28
|
+
id: string;
|
|
29
|
+
description: string;
|
|
30
|
+
duration: string;
|
|
31
|
+
status: TaskStatus;
|
|
32
|
+
error?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare class TaskToastManager {
|
|
35
|
+
private tasks;
|
|
36
|
+
private client;
|
|
37
|
+
private concurrency;
|
|
38
|
+
/**
|
|
39
|
+
* Initialize the manager with OpenCode client
|
|
40
|
+
*/
|
|
41
|
+
init(client: OpencodeClient, concurrency?: ConcurrencyController): void;
|
|
42
|
+
/**
|
|
43
|
+
* Set concurrency controller (can be set after init)
|
|
44
|
+
*/
|
|
45
|
+
setConcurrencyController(concurrency: ConcurrencyController): void;
|
|
46
|
+
/**
|
|
47
|
+
* Add a new task and show consolidated toast
|
|
48
|
+
*/
|
|
49
|
+
addTask(task: {
|
|
50
|
+
id: string;
|
|
51
|
+
description: string;
|
|
52
|
+
agent: string;
|
|
53
|
+
isBackground: boolean;
|
|
54
|
+
parentSessionID?: string;
|
|
55
|
+
sessionID?: string;
|
|
56
|
+
status?: TaskStatus;
|
|
57
|
+
}): void;
|
|
58
|
+
/**
|
|
59
|
+
* Update task status
|
|
60
|
+
*/
|
|
61
|
+
updateTask(id: string, status: TaskStatus): void;
|
|
62
|
+
/**
|
|
63
|
+
* Remove a task
|
|
64
|
+
*/
|
|
65
|
+
removeTask(id: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Get all running tasks (newest first)
|
|
68
|
+
*/
|
|
69
|
+
getRunningTasks(): TrackedTask[];
|
|
70
|
+
/**
|
|
71
|
+
* Get all queued tasks (oldest first - FIFO)
|
|
72
|
+
*/
|
|
73
|
+
getQueuedTasks(): TrackedTask[];
|
|
74
|
+
/**
|
|
75
|
+
* Get tasks by parent session
|
|
76
|
+
*/
|
|
77
|
+
getTasksByParent(parentSessionID: string): TrackedTask[];
|
|
78
|
+
/**
|
|
79
|
+
* Format duration since task started
|
|
80
|
+
*/
|
|
81
|
+
private formatDuration;
|
|
82
|
+
/**
|
|
83
|
+
* Get concurrency info string (e.g., " [2/5]")
|
|
84
|
+
*/
|
|
85
|
+
private getConcurrencyInfo;
|
|
86
|
+
/**
|
|
87
|
+
* Build consolidated task list message
|
|
88
|
+
*/
|
|
89
|
+
private buildTaskListMessage;
|
|
90
|
+
/**
|
|
91
|
+
* Show consolidated toast with all running/queued tasks
|
|
92
|
+
*/
|
|
93
|
+
private showTaskListToast;
|
|
94
|
+
/**
|
|
95
|
+
* Show task completion toast
|
|
96
|
+
*/
|
|
97
|
+
showCompletionToast(info: TaskCompletionInfo): void;
|
|
98
|
+
/**
|
|
99
|
+
* Show all-tasks-complete summary toast
|
|
100
|
+
*/
|
|
101
|
+
showAllCompleteToast(parentSessionID: string, completedTasks: TaskCompletionInfo[]): void;
|
|
102
|
+
/**
|
|
103
|
+
* Show progress toast (for long-running tasks)
|
|
104
|
+
*/
|
|
105
|
+
showProgressToast(taskId: string, progress: {
|
|
106
|
+
current: number;
|
|
107
|
+
total: number;
|
|
108
|
+
message?: string;
|
|
109
|
+
}): void;
|
|
110
|
+
/**
|
|
111
|
+
* Clear all tracked tasks
|
|
112
|
+
*/
|
|
113
|
+
clear(): void;
|
|
114
|
+
/**
|
|
115
|
+
* Get task count stats
|
|
116
|
+
*/
|
|
117
|
+
getStats(): {
|
|
118
|
+
running: number;
|
|
119
|
+
queued: number;
|
|
120
|
+
total: number;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get the global TaskToastManager instance
|
|
125
|
+
*/
|
|
126
|
+
export declare function getTaskToastManager(): TaskToastManager | null;
|
|
127
|
+
/**
|
|
128
|
+
* Initialize the global TaskToastManager
|
|
129
|
+
*/
|
|
130
|
+
export declare function initTaskToastManager(client: OpencodeClient, concurrency?: ConcurrencyController): TaskToastManager;
|
|
131
|
+
export {};
|
|
@@ -6,3 +6,4 @@
|
|
|
6
6
|
export type { ToastVariant, ToastMessage, ToastOptions } from "./types.js";
|
|
7
7
|
export { show, dismiss, getActive, getHistory, clear, onToast, initToastClient } from "./toast-core.js";
|
|
8
8
|
export { presets } from "./presets.js";
|
|
9
|
+
export { TaskToastManager, getTaskToastManager, initTaskToastManager, type TrackedTask, type TaskStatus, type TaskCompletionInfo, } from "./task-toast-manager.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Recovery Event Handler
|
|
3
|
+
*
|
|
4
|
+
* Integrates with the OpenCode event system to automatically recover from session errors.
|
|
5
|
+
*
|
|
6
|
+
* Supported error types:
|
|
7
|
+
* - tool_result_missing: Tool crashed, inject error message
|
|
8
|
+
* - thinking_block_order: Thinking block ordering issue
|
|
9
|
+
* - rate_limit: API rate limiting
|
|
10
|
+
* - context_overflow: Token limit exceeded
|
|
11
|
+
*/
|
|
12
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
13
|
+
type OpencodeClient = PluginInput["client"];
|
|
14
|
+
/**
|
|
15
|
+
* Handle session error event and attempt recovery
|
|
16
|
+
*/
|
|
17
|
+
export declare function handleSessionError(client: OpencodeClient, sessionID: string, error: unknown, properties?: Record<string, unknown>): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Mark that recovery is complete for a session
|
|
20
|
+
*/
|
|
21
|
+
export declare function markRecoveryComplete(sessionID: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Clean up session recovery state
|
|
24
|
+
*/
|
|
25
|
+
export declare function cleanupSessionRecovery(sessionID: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Check if session is currently recovering
|
|
28
|
+
*/
|
|
29
|
+
export declare function isSessionRecovering(sessionID: string): boolean;
|
|
30
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Task Parser - Parse hierarchy from
|
|
2
|
+
* Task Parser - Parse hierarchy from Planner output
|
|
3
3
|
*/
|
|
4
4
|
import type { TaskHierarchy } from "./interfaces.js";
|
|
5
5
|
/**
|
|
6
|
-
* Parse task hierarchy from text (
|
|
6
|
+
* Parse task hierarchy from text (Planner output)
|
|
7
7
|
*/
|
|
8
8
|
export declare function parseFromText(sessionId: string, text: string): TaskHierarchy;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenCode Orchestrator Plugin
|
|
3
3
|
*
|
|
4
|
-
* This is the main entry point for the
|
|
5
|
-
* We've optimized it for
|
|
4
|
+
* This is the main entry point for the 4-Agent consolidated architecture.
|
|
5
|
+
* We've optimized it for better efficiency by using:
|
|
6
6
|
* - XML-structured prompts with clear boundaries
|
|
7
7
|
* - Explicit reasoning patterns (THINK -> ACT -> OBSERVE -> ADJUST)
|
|
8
8
|
* - Evidence-based completion requirements
|
|
9
9
|
* - Autonomous execution loop that keeps going until done
|
|
10
10
|
*
|
|
11
|
-
* The agents are: Commander,
|
|
11
|
+
* The agents are: Commander, Planner, Worker, Reviewer
|
|
12
12
|
*/
|
|
13
13
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
14
14
|
declare const OrchestratorPlugin: Plugin;
|