opencode-orchestrator 0.4.14 → 0.4.17
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 +61 -3
- package/dist/agents/definitions.d.ts +0 -0
- package/dist/agents/orchestrator.d.ts +0 -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 → frontend-designer.d.ts} +1 -1
- package/dist/agents/subagents/inspector.d.ts +0 -0
- package/dist/agents/subagents/recorder.d.ts +0 -0
- package/dist/constants/agent.d.ts +8 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/prompts.d.ts +10 -0
- package/dist/constants/task.d.ts +12 -0
- package/dist/constants/time.d.ts +34 -0
- package/dist/context/enforcer.d.ts +47 -0
- package/dist/core/async-agent.d.ts +14 -2
- package/dist/core/batch-processor.d.ts +62 -0
- package/dist/core/config.d.ts +55 -0
- package/dist/core/session-manager.d.ts +39 -0
- package/dist/core/state.d.ts +0 -0
- package/dist/core/tasks.d.ts +1 -0
- package/dist/index.d.ts +20 -2
- package/dist/index.js +1497 -164
- package/dist/parallel/optimizer.d.ts +47 -0
- package/dist/profiler/execution.d.ts +40 -0
- package/dist/prompts/shared.d.ts +2 -0
- package/dist/shared/contracts/interfaces.d.ts +0 -0
- package/dist/shared/contracts/names.d.ts +0 -0
- package/dist/tools/background.d.ts +2 -2
- package/dist/tools/batch.d.ts +53 -0
- package/dist/tools/callAgent.d.ts +0 -0
- package/dist/tools/config.d.ts +60 -0
- package/dist/tools/git.d.ts +48 -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/formatting.d.ts +13 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/sanity.d.ts +0 -22
- package/dist/utils/task.d.ts +8 -0
- package/package.json +1 -1
- package/dist/agents/coder.d.ts +0 -2
- package/dist/agents/fixer.d.ts +0 -2
- package/dist/agents/names.d.ts +0 -12
- package/dist/agents/planner.d.ts +0 -2
- package/dist/agents/reviewer.d.ts +0 -2
- package/dist/agents/searcher.d.ts +0 -2
- package/dist/agents/subagents/executor.d.ts +0 -2
- package/dist/agents/subagents/fixer.d.ts +0 -2
- package/dist/agents/subagents/memory.d.ts +0 -2
- package/dist/agents/subagents/planner.d.ts +0 -2
- package/dist/agents/subagents/publisher.d.ts +0 -2
- package/dist/agents/subagents/reviewer.d.ts +0 -2
- package/dist/agents/subagents/searcher.d.ts +0 -2
- package/dist/agents/subagents/strategist.d.ts +0 -2
- package/dist/agents/subagents/surgeon.d.ts +0 -2
- package/dist/agents/subagents/types.d.ts +0 -7
- package/dist/agents/subagents/visualist.d.ts +0 -2
- package/dist/agents/types.d.ts +0 -7
- package/dist/cli.d.ts +0 -2
- package/dist/tasks.d.ts +0 -29
package/README.md
CHANGED
|
@@ -36,7 +36,8 @@ A **5-agent autonomous architecture** designed to solve complex engineering task
|
|
|
36
36
|
- **💾 Persistent Context** — Recorder saves session state to disk, enabling resume at any time.
|
|
37
37
|
- **🏗️ Parallel Agents** — Delegated agent execution (`delegate_task`) with sync/async modes.
|
|
38
38
|
- **⏳ Background Tasks** — Run long commands (builds, tests) in background and check results later.
|
|
39
|
-
- **🔎 mgrep** — Multi-pattern parallel search for fast codebase analysis.
|
|
39
|
+
- **🔎 mgrep** — Multi-pattern parallel search for fast codebase analysis.
|
|
40
|
+
- **🎯 Smart Batch** — Centralized validation and retry for efficient parallel processing. Dynamic concurrency limits with intelligent failure handling.
|
|
40
41
|
|
|
41
42
|
---
|
|
42
43
|
|
|
@@ -57,8 +58,8 @@ Restart OpenCode after installation.
|
|
|
57
58
|
In OpenCode, press `Tab` to open the Agent selection menu. Select **Commander** and type your mission!
|
|
58
59
|
|
|
59
60
|
<div align="center">
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
<img src="assets/commander-screenshot.png" alt="Commander Screenshot" width="600" />
|
|
62
|
+
<p><em>Press Tab to select Commander</em></p>
|
|
62
63
|
</div>
|
|
63
64
|
|
|
64
65
|
```
|
|
@@ -102,6 +103,63 @@ Monitor parallel tasks in terminal:
|
|
|
102
103
|
[parallel] 🗑️ CLEANED task_c3d4 (session deleted)
|
|
103
104
|
```
|
|
104
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
|
+
|
|
105
163
|
---
|
|
106
164
|
|
|
107
165
|
## Agents (5-Agent Architecture)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AgentDefinition } from "../../shared/contracts/interfaces.js";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const frontendDesigner: AgentDefinition;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt-related constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const REASONING_CONSTRAINTS = "\n<constraints>\n1. Reasoning MUST be in English for maximum stability\n2. If reasoning collapses into gibberish, stop and output: \"ERROR: REASONING_COLLAPSE\"\n3. Never suppress type errors with 'as any', '@ts-ignore', '@ts-expect-error'\n4. Never leave code in broken state\n5. Always verify with evidence before claiming completion\n</constraints>\n";
|
|
5
|
+
export declare const LANGUAGE_RULE = "\n<language_rule>\nTHINK and REASON in English for maximum model stability.\n\nFINAL RESPONSE LANGUAGE:\n- Detect user's language from their request\n- Respond in SAME language\n- Korean \u2192 Korean, English \u2192 English, Japanese \u2192 Japanese, Chinese \u2192 Chinese\n- Default to English if unclear\n</language_rule>\n";
|
|
6
|
+
export declare const TASK_COMPLETION_CHECK = "\n<completion_criteria>\nA task is COMPLETE when:\n1. \u2705 All planned work done\n2. \u2705 lsp_diagnostics clean on changed files\n3. \u2705 Build passes (if applicable)\n4. \u2705 Tests pass (if applicable)\n5. \u2705 User's original request fully addressed\n</completion_criteria>\n";
|
|
7
|
+
export declare const OUTPUT_FORMAT = "\n<output_format>\nReport completion with:\n- What was done (concise)\n- Evidence of success (build/test/audit results)\n- Files changed (with line numbers)\n</output_format>\n";
|
|
8
|
+
export declare const ANTI_PATTERNS = "\n<anti_patterns>\n\u274C Delegate without environment/codebase context\n\u274C Leave code broken or with LSP errors\n\u274C Make random changes without understanding root cause\n\u274C Use 'as any', '@ts-ignore', or '@ts-expect-error'\n\u274C Suppress errors instead of fixing them\n</anti_patterns>\n";
|
|
9
|
+
export declare const WORKFLOW = "\n<workflow>\n1. THINK - Reason about the task\n2. ACT - Execute the work\n3. OBSERVE - Check the result\n4. ADJUST - Fix if needed\n5. VERIFY - Prove success with evidence\n</workflow>\n";
|
|
10
|
+
export declare const BASE_PROMPT = "\n\n<constraints>\n1. Reasoning MUST be in English for maximum stability\n2. If reasoning collapses into gibberish, stop and output: \"ERROR: REASONING_COLLAPSE\"\n3. Never suppress type errors with 'as any', '@ts-ignore', '@ts-expect-error'\n4. Never leave code in broken state\n5. Always verify with evidence before claiming completion\n</constraints>\n\n\n\n<language_rule>\nTHINK and REASON in English for maximum model stability.\n\nFINAL RESPONSE LANGUAGE:\n- Detect user's language from their request\n- Respond in SAME language\n- Korean \u2192 Korean, English \u2192 English, Japanese \u2192 Japanese, Chinese \u2192 Chinese\n- Default to English if unclear\n</language_rule>\n\n\n\n<anti_patterns>\n\u274C Delegate without environment/codebase context\n\u274C Leave code broken or with LSP errors\n\u274C Make random changes without understanding root cause\n\u274C Use 'as any', '@ts-ignore', or '@ts-expect-error'\n\u274C Suppress errors instead of fixing them\n</anti_patterns>\n\n\n\n<workflow>\n1. THINK - Reason about the task\n2. ACT - Execute the work\n3. OBSERVE - Check the result\n4. ADJUST - Fix if needed\n5. VERIFY - Prove success with evidence\n</workflow>\n\n";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task status constants and mappings
|
|
3
|
+
*/
|
|
4
|
+
export type TaskStatus = "pending" | "running" | "completed" | "done" | "error" | "timeout";
|
|
5
|
+
export type ParallelTaskStatus = "pending" | "running" | "completed" | "error" | "timeout";
|
|
6
|
+
export declare const STATUS_EMOJI: Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Get emoji for task status
|
|
9
|
+
*/
|
|
10
|
+
export declare function getStatusEmoji(status: TaskStatus | ParallelTaskStatus | string): string;
|
|
11
|
+
export declare const TASK_ID_PREFIX = "task_";
|
|
12
|
+
export declare const JOB_ID_PREFIX = "job_";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-related constants
|
|
3
|
+
* Centralized to prevent duplication across the codebase
|
|
4
|
+
*/
|
|
5
|
+
/** Maximum time a task can run before timeout (30 minutes) */
|
|
6
|
+
export declare const TASK_TTL_MS: number;
|
|
7
|
+
/** Default background task timeout (5 minutes) */
|
|
8
|
+
export declare const BACKGROUND_TASK_TIMEOUT_MS: number;
|
|
9
|
+
/** Maximum sync task poll time (10 minutes) */
|
|
10
|
+
export declare const SYNC_TASK_MAX_POLL_MS: number;
|
|
11
|
+
/** Poll interval for parallel agent tasks (2 seconds) */
|
|
12
|
+
export declare const PARALLEL_POLL_INTERVAL_MS = 2000;
|
|
13
|
+
/** Poll interval for background task monitoring (5 seconds) */
|
|
14
|
+
export declare const BACKGROUND_MONITOR_INTERVAL_MS = 5000;
|
|
15
|
+
/** Poll interval for sync task completion (500ms) */
|
|
16
|
+
export declare const SYNC_POLL_INTERVAL_MS = 500;
|
|
17
|
+
/** Minimum time task must run before considered stable (5 seconds) */
|
|
18
|
+
export declare const MIN_STABILITY_MS: number;
|
|
19
|
+
/** Number of stable polls required to confirm completion (for sync mode) */
|
|
20
|
+
export declare const STABILITY_POLLS_REQUIRED = 3;
|
|
21
|
+
/** Delay before cleaning up completed tasks (5 minutes) */
|
|
22
|
+
export declare const CLEANUP_DELAY_MS: number;
|
|
23
|
+
/** Delay before retry after failure (500ms) */
|
|
24
|
+
export declare const RETRY_DELAY_MS = 500;
|
|
25
|
+
/** Default maximum parallel tasks per agent type */
|
|
26
|
+
export declare const DEFAULT_CONCURRENCY = 3;
|
|
27
|
+
/** Maximum parallel tasks per agent type (hard limit) */
|
|
28
|
+
export declare const MAX_CONCURRENCY = 10;
|
|
29
|
+
/** Default maximum steps for auto-continuation */
|
|
30
|
+
export declare const DEFAULT_MAX_STEPS = 500;
|
|
31
|
+
/** Maximum steps for /task command */
|
|
32
|
+
export declare const TASK_COMMAND_MAX_STEPS = 1000;
|
|
33
|
+
/** Maximum task retry attempts */
|
|
34
|
+
export declare const MAX_TASK_RETRIES = 3;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Enforcer
|
|
3
|
+
*
|
|
4
|
+
* Validates context before agent delegation to prevent errors.
|
|
5
|
+
* Ensures agents have necessary information to complete tasks.
|
|
6
|
+
*/
|
|
7
|
+
export interface ValidationResult {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
errors: string[];
|
|
10
|
+
warnings: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface ContextRequirement {
|
|
13
|
+
agent: string;
|
|
14
|
+
required: string[];
|
|
15
|
+
optional: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Context Enforcer validates agent delegation context
|
|
19
|
+
*/
|
|
20
|
+
export declare class ContextEnforcer {
|
|
21
|
+
private requirements;
|
|
22
|
+
/**
|
|
23
|
+
* Validate context for agent delegation
|
|
24
|
+
*/
|
|
25
|
+
validate(agent: string, context: string): ValidationResult;
|
|
26
|
+
/**
|
|
27
|
+
* Get requirements for an agent
|
|
28
|
+
*/
|
|
29
|
+
getRequirements(agent: string): ContextRequirement | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Add or update requirements for an agent
|
|
32
|
+
*/
|
|
33
|
+
setRequirements(agent: string, requirements: ContextRequirement): void;
|
|
34
|
+
/**
|
|
35
|
+
* Format validation result as user-friendly message
|
|
36
|
+
*/
|
|
37
|
+
formatValidation(result: ValidationResult): string;
|
|
38
|
+
/**
|
|
39
|
+
* Check if context has minimal required information
|
|
40
|
+
*/
|
|
41
|
+
hasMinimumContext(agent: string, context: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Suggest missing context based on agent type
|
|
44
|
+
*/
|
|
45
|
+
suggestContext(agent: string, context: string): string[];
|
|
46
|
+
}
|
|
47
|
+
export declare const contextEnforcer: ContextEnforcer;
|
|
@@ -70,9 +70,21 @@ 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;
|
|
76
88
|
/**
|
|
77
89
|
* Get pending notification count
|
|
78
90
|
*/
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart Batch Processor - Centralized validation and retry
|
|
3
|
+
*
|
|
4
|
+
* Strategy: Execute all tasks → Centralized validation → Retry only failures
|
|
5
|
+
* This is more efficient than naive parallelism because:
|
|
6
|
+
* 1. Failed tasks are batch-identified and retried
|
|
7
|
+
* 2. No redundant work on already-successful tasks
|
|
8
|
+
* 3. Validation happens once, not per-task
|
|
9
|
+
*/
|
|
10
|
+
import type { ParallelAgentManager } from "./async-agent.js";
|
|
11
|
+
export interface BatchTask {
|
|
12
|
+
id: string;
|
|
13
|
+
description: string;
|
|
14
|
+
agent: string;
|
|
15
|
+
prompt: string;
|
|
16
|
+
status: 'pending' | 'success' | 'failed' | 'retrying';
|
|
17
|
+
attempts: number;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface BatchResult {
|
|
21
|
+
total: number;
|
|
22
|
+
success: number;
|
|
23
|
+
failed: number;
|
|
24
|
+
retried: number;
|
|
25
|
+
duration: number;
|
|
26
|
+
tasks: BatchTask[];
|
|
27
|
+
}
|
|
28
|
+
export interface BatchProcessorOptions {
|
|
29
|
+
concurrency: number;
|
|
30
|
+
maxRetries: number;
|
|
31
|
+
validateAfterEach?: boolean;
|
|
32
|
+
continueOnError?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare class SmartBatchProcessor {
|
|
35
|
+
private parallelAgentManager;
|
|
36
|
+
private tasks;
|
|
37
|
+
constructor(parallelAgentManager: ParallelAgentManager);
|
|
38
|
+
/**
|
|
39
|
+
* Process a batch of tasks with smart validation
|
|
40
|
+
*/
|
|
41
|
+
processBatch(tasks: BatchTask[], options?: BatchProcessorOptions): Promise<BatchResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Execute a phase with concurrency control
|
|
44
|
+
*/
|
|
45
|
+
private executePhase;
|
|
46
|
+
/**
|
|
47
|
+
* Execute a single task
|
|
48
|
+
*/
|
|
49
|
+
private executeTask;
|
|
50
|
+
/**
|
|
51
|
+
* Build result summary
|
|
52
|
+
*/
|
|
53
|
+
private buildResult;
|
|
54
|
+
/**
|
|
55
|
+
* Export failed tasks for manual review
|
|
56
|
+
*/
|
|
57
|
+
exportFailedTasks(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Clear all tasks
|
|
60
|
+
*/
|
|
61
|
+
clear(): void;
|
|
62
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Orchestrator Configuration
|
|
3
|
+
*
|
|
4
|
+
* Dynamic configuration with environment variable support and validation.
|
|
5
|
+
* Priority: Environment Variables > Config File > Defaults
|
|
6
|
+
*/
|
|
7
|
+
export interface ParallelAgentConfig {
|
|
8
|
+
taskTtlMs: number;
|
|
9
|
+
cleanupDelayMs: number;
|
|
10
|
+
minStabilityMs: number;
|
|
11
|
+
pollIntervalMs: number;
|
|
12
|
+
defaultConcurrency: number;
|
|
13
|
+
maxConcurrency: number;
|
|
14
|
+
enableDebug: boolean;
|
|
15
|
+
enableDetailedLogs: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface BackgroundTaskConfig {
|
|
18
|
+
monitorIntervalMs: number;
|
|
19
|
+
storageDir: string;
|
|
20
|
+
defaultTimeoutMs: number;
|
|
21
|
+
maxCompletedTasksToKeep: number;
|
|
22
|
+
enableDebug: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface SessionConfig {
|
|
25
|
+
defaultMaxSteps: number;
|
|
26
|
+
taskCommandMaxSteps: number;
|
|
27
|
+
}
|
|
28
|
+
declare class ConfigManager {
|
|
29
|
+
private static _instance;
|
|
30
|
+
private parallelAgentConfig;
|
|
31
|
+
private backgroundTaskConfig;
|
|
32
|
+
private sessionConfig;
|
|
33
|
+
private constructor();
|
|
34
|
+
static getInstance(): ConfigManager;
|
|
35
|
+
private loadParallelAgentConfig;
|
|
36
|
+
getParallelAgentConfig(): Readonly<ParallelAgentConfig>;
|
|
37
|
+
private loadBackgroundTaskConfig;
|
|
38
|
+
getBackgroundTaskConfig(): Readonly<BackgroundTaskConfig>;
|
|
39
|
+
private loadSessionConfig;
|
|
40
|
+
getSessionConfig(): Readonly<SessionConfig>;
|
|
41
|
+
/**
|
|
42
|
+
* Update configuration at runtime
|
|
43
|
+
* Useful for adaptive behavior or user preferences
|
|
44
|
+
*/
|
|
45
|
+
updateParallelAgentConfig(updates: Partial<ParallelAgentConfig>): void;
|
|
46
|
+
updateBackgroundTaskConfig(updates: Partial<BackgroundTaskConfig>): void;
|
|
47
|
+
updateSessionConfig(updates: Partial<SessionConfig>): void;
|
|
48
|
+
private validateParallelAgentConfig;
|
|
49
|
+
private validateBackgroundTaskConfig;
|
|
50
|
+
private validateSessionConfig;
|
|
51
|
+
private parseEnvInt;
|
|
52
|
+
exportConfigs(): void;
|
|
53
|
+
}
|
|
54
|
+
export declare const configManager: ConfigManager;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface SessionEvents {
|
|
2
|
+
created: (sessionID: string) => void;
|
|
3
|
+
activated: (sessionID: string) => void;
|
|
4
|
+
deactivated: (sessionID: string, reason?: string) => void;
|
|
5
|
+
step: (sessionID: string, step: number) => void;
|
|
6
|
+
completed: (sessionID: string, result: any) => void;
|
|
7
|
+
error: (sessionID: string, error: Error) => void;
|
|
8
|
+
disposed: (sessionID: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface SessionState {
|
|
11
|
+
active: boolean;
|
|
12
|
+
step: number;
|
|
13
|
+
maxSteps: number;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
startTime: number;
|
|
16
|
+
lastStepTime: number;
|
|
17
|
+
eventQueue: Map<string, any[]>;
|
|
18
|
+
}
|
|
19
|
+
export interface SessionOptions {
|
|
20
|
+
maxSteps?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class SessionManager {
|
|
23
|
+
private sessions;
|
|
24
|
+
private events;
|
|
25
|
+
on(event: keyof SessionEvents, handler: SessionEvents[keyof SessionEvents]): void;
|
|
26
|
+
emit(event: keyof SessionEvents, sessionID: string, data?: any): void;
|
|
27
|
+
create(sessionID: string, options?: SessionOptions): SessionState;
|
|
28
|
+
activate(sessionID: string): void;
|
|
29
|
+
deactivate(sessionID: string, reason?: string): void;
|
|
30
|
+
step(sessionID: string): void;
|
|
31
|
+
complete(sessionID: string, result: any): void;
|
|
32
|
+
error(sessionID: string, error: Error): void;
|
|
33
|
+
dispose(sessionID: string): void;
|
|
34
|
+
get(sessionID: string): SessionState | undefined;
|
|
35
|
+
isActive(sessionID: string): boolean;
|
|
36
|
+
getAll(): SessionState[];
|
|
37
|
+
cleanupInactive(maxAgeMs: number): number;
|
|
38
|
+
}
|
|
39
|
+
export declare const sessionManager: SessionManager;
|
package/dist/core/state.d.ts
CHANGED
|
File without changes
|
package/dist/core/tasks.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,24 @@
|
|
|
13
13
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
14
14
|
declare const OrchestratorPlugin: (input: PluginInput) => Promise<{
|
|
15
15
|
tool: {
|
|
16
|
+
git_branch: {
|
|
17
|
+
description: string;
|
|
18
|
+
args: {
|
|
19
|
+
action: import("zod").ZodEnum<{
|
|
20
|
+
status: "status";
|
|
21
|
+
diff: "diff";
|
|
22
|
+
current: "current";
|
|
23
|
+
list: "list";
|
|
24
|
+
recent: "recent";
|
|
25
|
+
all: "all";
|
|
26
|
+
}>;
|
|
27
|
+
baseBranch: import("zod").ZodOptional<import("zod").ZodString>;
|
|
28
|
+
};
|
|
29
|
+
execute(args: {
|
|
30
|
+
action: "status" | "diff" | "current" | "list" | "recent" | "all";
|
|
31
|
+
baseBranch?: string | undefined;
|
|
32
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
33
|
+
};
|
|
16
34
|
call_agent: {
|
|
17
35
|
description: string;
|
|
18
36
|
args: {
|
|
@@ -108,13 +126,13 @@ declare const OrchestratorPlugin: (input: PluginInput) => Promise<{
|
|
|
108
126
|
args: {
|
|
109
127
|
status: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
110
128
|
running: "running";
|
|
129
|
+
all: "all";
|
|
111
130
|
done: "done";
|
|
112
131
|
error: "error";
|
|
113
|
-
all: "all";
|
|
114
132
|
}>>;
|
|
115
133
|
};
|
|
116
134
|
execute(args: {
|
|
117
|
-
status?: "running" | "
|
|
135
|
+
status?: "running" | "all" | "done" | "error" | undefined;
|
|
118
136
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
119
137
|
};
|
|
120
138
|
kill_background: {
|