opencode-orchestrator 0.5.4 → 0.5.6
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 +21 -23
- package/dist/agents/definitions.d.ts +1 -1
- package/dist/agents/orchestrator.d.ts +1 -1
- package/dist/agents/subagents/architect.d.ts +1 -1
- package/dist/agents/subagents/builder.d.ts +1 -1
- package/dist/agents/subagents/inspector.d.ts +1 -1
- package/dist/agents/subagents/recorder.d.ts +1 -1
- package/dist/core/agents/concurrency.d.ts +36 -0
- package/dist/core/agents/config.d.ts +9 -0
- package/dist/core/agents/format.d.ts +9 -0
- package/dist/core/agents/index.d.ts +7 -0
- package/dist/core/agents/interfaces/index.d.ts +5 -0
- package/dist/core/agents/interfaces/launch-input.d.ts +9 -0
- package/dist/core/agents/interfaces/parallel-task.d.ts +26 -0
- package/dist/core/agents/logger.d.ts +4 -0
- package/dist/core/agents/manager.d.ts +76 -0
- package/dist/core/agents/task-store.d.ts +28 -0
- package/dist/core/agents/types/index.d.ts +4 -0
- package/dist/core/agents/types/parallel-task-status.d.ts +4 -0
- package/dist/core/commands/index.d.ts +6 -0
- package/dist/core/commands/interfaces/background-task.d.ts +20 -0
- package/dist/core/commands/interfaces/index.d.ts +5 -0
- package/dist/core/commands/interfaces/run-background-options.d.ts +9 -0
- package/dist/core/commands/manager.d.ts +27 -0
- package/dist/core/commands/types/background-task-status.d.ts +4 -0
- package/dist/core/commands/types/index.d.ts +4 -0
- package/dist/core/orchestrator/index.d.ts +7 -0
- package/dist/core/orchestrator/interfaces/index.d.ts +5 -0
- package/dist/core/{state.d.ts → orchestrator/interfaces/session-state.d.ts} +4 -7
- package/dist/core/orchestrator/interfaces/task.d.ts +17 -0
- package/dist/core/orchestrator/state.d.ts +10 -0
- package/dist/core/{tasks.d.ts → orchestrator/task-graph.d.ts} +2 -14
- package/dist/core/orchestrator/types/index.d.ts +5 -0
- package/dist/core/orchestrator/types/task-status.d.ts +4 -0
- package/dist/core/orchestrator/types/task-type.d.ts +4 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +588 -714
- package/dist/shared/{contracts/names.d.ts → agent.d.ts} +12 -0
- package/dist/shared/constants.d.ts +56 -0
- package/dist/tools/background-cmd/check.d.ts +14 -0
- package/dist/tools/background-cmd/index.d.ts +7 -0
- package/dist/tools/background-cmd/kill.d.ts +12 -0
- package/dist/tools/background-cmd/list.d.ts +17 -0
- package/dist/tools/background-cmd/run.d.ts +18 -0
- package/dist/tools/callAgent.d.ts +0 -0
- package/dist/tools/parallel/cancel-task.d.ts +13 -0
- package/dist/tools/parallel/delegate-task.d.ts +21 -0
- package/dist/tools/parallel/get-task-result.d.ts +13 -0
- package/dist/tools/parallel/index.d.ts +7 -0
- package/dist/tools/parallel/list-tasks.d.ts +13 -0
- package/dist/tools/rust.d.ts +0 -0
- package/dist/tools/search.d.ts +2 -9
- 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/package.json +17 -7
- 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/coder.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/frontend-designer.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/constants/agent.d.ts +0 -8
- package/dist/constants/index.d.ts +0 -7
- package/dist/constants/prompts.d.ts +0 -10
- package/dist/constants/task.d.ts +0 -12
- package/dist/constants/time.d.ts +0 -34
- package/dist/context/enforcer.d.ts +0 -47
- package/dist/core/async-agent.d.ts +0 -100
- package/dist/core/background.d.ts +0 -78
- package/dist/core/batch-processor.d.ts +0 -62
- package/dist/core/config.d.ts +0 -55
- package/dist/core/session-manager.d.ts +0 -39
- package/dist/parallel/optimizer.d.ts +0 -47
- package/dist/profiler/execution.d.ts +0 -40
- package/dist/prompts/shared.d.ts +0 -2
- package/dist/shared/contracts/interfaces.d.ts +0 -7
- package/dist/tasks.d.ts +0 -29
- package/dist/tools/async-agent.d.ts +0 -70
- package/dist/tools/background.d.ts +0 -55
- package/dist/tools/batch.d.ts +0 -53
- package/dist/tools/config.d.ts +0 -60
- package/dist/tools/git.d.ts +0 -48
- package/dist/utils/formatting.d.ts +0 -13
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/task.d.ts +0 -8
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parallel Agent Manager - Session-based async agent execution
|
|
3
|
-
*
|
|
4
|
-
* Key safety features:
|
|
5
|
-
* - Concurrency control per agent type (queue-based)
|
|
6
|
-
* - Batched notifications (notify when ALL complete)
|
|
7
|
-
* - Automatic memory cleanup (5 min after completion)
|
|
8
|
-
* - TTL enforcement (30 min timeout)
|
|
9
|
-
* - Output validation before completion
|
|
10
|
-
* - Process-safe polling (unref)
|
|
11
|
-
*/
|
|
12
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
13
|
-
type OpencodeClient = PluginInput["client"];
|
|
14
|
-
export interface ParallelTask {
|
|
15
|
-
id: string;
|
|
16
|
-
sessionID: string;
|
|
17
|
-
parentSessionID: string;
|
|
18
|
-
description: string;
|
|
19
|
-
agent: string;
|
|
20
|
-
status: "pending" | "running" | "completed" | "error" | "timeout";
|
|
21
|
-
startedAt: Date;
|
|
22
|
-
completedAt?: Date;
|
|
23
|
-
error?: string;
|
|
24
|
-
result?: string;
|
|
25
|
-
concurrencyKey?: string;
|
|
26
|
-
}
|
|
27
|
-
interface LaunchInput {
|
|
28
|
-
description: string;
|
|
29
|
-
prompt: string;
|
|
30
|
-
agent: string;
|
|
31
|
-
parentSessionID: string;
|
|
32
|
-
}
|
|
33
|
-
export declare class ParallelAgentManager {
|
|
34
|
-
private static _instance;
|
|
35
|
-
private tasks;
|
|
36
|
-
private pendingByParent;
|
|
37
|
-
private notifications;
|
|
38
|
-
private client;
|
|
39
|
-
private directory;
|
|
40
|
-
private concurrency;
|
|
41
|
-
private pollingInterval?;
|
|
42
|
-
private constructor();
|
|
43
|
-
static getInstance(client?: OpencodeClient, directory?: string): ParallelAgentManager;
|
|
44
|
-
/**
|
|
45
|
-
* Launch an agent in a new session (async, non-blocking)
|
|
46
|
-
*/
|
|
47
|
-
launch(input: LaunchInput): Promise<ParallelTask>;
|
|
48
|
-
/**
|
|
49
|
-
* Get task by ID
|
|
50
|
-
*/
|
|
51
|
-
getTask(id: string): ParallelTask | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Get all running tasks
|
|
54
|
-
*/
|
|
55
|
-
getRunningTasks(): ParallelTask[];
|
|
56
|
-
/**
|
|
57
|
-
* Get all tasks
|
|
58
|
-
*/
|
|
59
|
-
getAllTasks(): ParallelTask[];
|
|
60
|
-
/**
|
|
61
|
-
* Get tasks by parent session
|
|
62
|
-
*/
|
|
63
|
-
getTasksByParent(parentSessionID: string): ParallelTask[];
|
|
64
|
-
/**
|
|
65
|
-
* Cancel a running task
|
|
66
|
-
*/
|
|
67
|
-
cancelTask(taskId: string): Promise<boolean>;
|
|
68
|
-
/**
|
|
69
|
-
* Get result from completed task
|
|
70
|
-
*/
|
|
71
|
-
getResult(taskId: string): Promise<string | null>;
|
|
72
|
-
/**
|
|
73
|
-
* Set concurrency limit for agent type
|
|
74
|
-
*/
|
|
75
|
-
setConcurrencyLimit(agentType: string, limit: number): void;
|
|
76
|
-
/**
|
|
77
|
-
* Get pending notification count
|
|
78
|
-
*/
|
|
79
|
-
getPendingCount(parentSessionID: string): number;
|
|
80
|
-
/**
|
|
81
|
-
* Cleanup all state
|
|
82
|
-
*/
|
|
83
|
-
cleanup(): void;
|
|
84
|
-
private trackPending;
|
|
85
|
-
private untrackPending;
|
|
86
|
-
private handleTaskError;
|
|
87
|
-
private startPolling;
|
|
88
|
-
private stopPolling;
|
|
89
|
-
private pollRunningTasks;
|
|
90
|
-
private validateSessionHasOutput;
|
|
91
|
-
private pruneExpiredTasks;
|
|
92
|
-
private scheduleCleanup;
|
|
93
|
-
private queueNotification;
|
|
94
|
-
private notifyParentIfAllComplete;
|
|
95
|
-
formatDuration(start: Date, end?: Date): string;
|
|
96
|
-
}
|
|
97
|
-
export declare const parallelAgentManager: {
|
|
98
|
-
getInstance: typeof ParallelAgentManager.getInstance;
|
|
99
|
-
};
|
|
100
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Background Task Manager for OpenCode Orchestrator
|
|
3
|
-
*
|
|
4
|
-
* Enables running commands in the background and checking their status later.
|
|
5
|
-
* This allows the AI to continue working while long-running tasks execute.
|
|
6
|
-
*/
|
|
7
|
-
import { ChildProcess } from "child_process";
|
|
8
|
-
export type TaskStatus = "pending" | "running" | "done" | "error" | "timeout";
|
|
9
|
-
export interface BackgroundTask {
|
|
10
|
-
id: string;
|
|
11
|
-
command: string;
|
|
12
|
-
args: string[];
|
|
13
|
-
cwd: string;
|
|
14
|
-
label?: string;
|
|
15
|
-
status: TaskStatus;
|
|
16
|
-
output: string;
|
|
17
|
-
errorOutput: string;
|
|
18
|
-
exitCode: number | null;
|
|
19
|
-
startTime: number;
|
|
20
|
-
endTime?: number;
|
|
21
|
-
timeout: number;
|
|
22
|
-
process?: ChildProcess;
|
|
23
|
-
}
|
|
24
|
-
export interface RunBackgroundOptions {
|
|
25
|
-
command: string;
|
|
26
|
-
cwd?: string;
|
|
27
|
-
timeout?: number;
|
|
28
|
-
label?: string;
|
|
29
|
-
}
|
|
30
|
-
declare class BackgroundTaskManager {
|
|
31
|
-
private static _instance;
|
|
32
|
-
private tasks;
|
|
33
|
-
private debugMode;
|
|
34
|
-
private constructor();
|
|
35
|
-
static get instance(): BackgroundTaskManager;
|
|
36
|
-
/**
|
|
37
|
-
* Generate a unique task ID in the format job_xxxxxxxx
|
|
38
|
-
*/
|
|
39
|
-
private generateId;
|
|
40
|
-
/**
|
|
41
|
-
* Debug logging helper
|
|
42
|
-
*/
|
|
43
|
-
private debug;
|
|
44
|
-
/**
|
|
45
|
-
* Run a command in the background
|
|
46
|
-
*/
|
|
47
|
-
run(options: RunBackgroundOptions): BackgroundTask;
|
|
48
|
-
/**
|
|
49
|
-
* Get task by ID
|
|
50
|
-
*/
|
|
51
|
-
get(taskId: string): BackgroundTask | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Get all tasks
|
|
54
|
-
*/
|
|
55
|
-
getAll(): BackgroundTask[];
|
|
56
|
-
/**
|
|
57
|
-
* Get tasks by status
|
|
58
|
-
*/
|
|
59
|
-
getByStatus(status: TaskStatus): BackgroundTask[];
|
|
60
|
-
/**
|
|
61
|
-
* Clear completed/failed tasks
|
|
62
|
-
*/
|
|
63
|
-
clearCompleted(): number;
|
|
64
|
-
/**
|
|
65
|
-
* Kill a running task
|
|
66
|
-
*/
|
|
67
|
-
kill(taskId: string): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Format duration for display
|
|
70
|
-
*/
|
|
71
|
-
formatDuration(task: BackgroundTask): string;
|
|
72
|
-
/**
|
|
73
|
-
* Get status emoji
|
|
74
|
-
*/
|
|
75
|
-
getStatusEmoji(status: TaskStatus): string;
|
|
76
|
-
}
|
|
77
|
-
export declare const backgroundTaskManager: BackgroundTaskManager;
|
|
78
|
-
export {};
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/core/config.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,39 +0,0 @@
|
|
|
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;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auto-Parallel Optimizer
|
|
3
|
-
*
|
|
4
|
-
* Optimizes task parallelization by analyzing dependencies and conflicts.
|
|
5
|
-
* Maximizes parallel execution while preventing conflicts.
|
|
6
|
-
*/
|
|
7
|
-
import type { Task } from "../core/tasks.js";
|
|
8
|
-
export interface OptimizationResult {
|
|
9
|
-
tasks: Task[];
|
|
10
|
-
groups: Map<number, string[]>;
|
|
11
|
-
efficiency: number;
|
|
12
|
-
optimizationNotes: string[];
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Auto-Parallel Optimizer analyzes tasks and creates optimal parallel groups
|
|
16
|
-
*/
|
|
17
|
-
export declare class ParallelOptimizer {
|
|
18
|
-
/**
|
|
19
|
-
* Optimize tasks for parallel execution
|
|
20
|
-
*/
|
|
21
|
-
optimize(tasks: Task[]): OptimizationResult;
|
|
22
|
-
/**
|
|
23
|
-
* Check if task dependencies are satisfied
|
|
24
|
-
*/
|
|
25
|
-
private areDependenciesSatisfied;
|
|
26
|
-
/**
|
|
27
|
-
* Format optimization result for display
|
|
28
|
-
*/
|
|
29
|
-
formatResult(result: OptimizationResult): string;
|
|
30
|
-
/**
|
|
31
|
-
* Get conflict analysis
|
|
32
|
-
*/
|
|
33
|
-
analyzeConflicts(tasks: Task[]): Map<string, string[]>;
|
|
34
|
-
/**
|
|
35
|
-
* Suggest task reordering for better parallelism
|
|
36
|
-
*/
|
|
37
|
-
suggestReordering(tasks: Task[]): Task[];
|
|
38
|
-
/**
|
|
39
|
-
* Calculate parallelization potential
|
|
40
|
-
*/
|
|
41
|
-
calculateParallelizationPotential(tasks: Task[]): {
|
|
42
|
-
current: number;
|
|
43
|
-
optimal: number;
|
|
44
|
-
improvement: number;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
export declare const parallelOptimizer: ParallelOptimizer;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execution Profiler
|
|
3
|
-
*
|
|
4
|
-
* Tracks and analyzes agent performance metrics.
|
|
5
|
-
* Provides data-driven optimization insights.
|
|
6
|
-
*/
|
|
7
|
-
export interface Metric {
|
|
8
|
-
operation: string;
|
|
9
|
-
duration: number;
|
|
10
|
-
timestamp: number;
|
|
11
|
-
agent: string;
|
|
12
|
-
success: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface PerformanceMetrics {
|
|
15
|
-
agent: string;
|
|
16
|
-
operations: Metric[];
|
|
17
|
-
averageDuration: number;
|
|
18
|
-
medianDuration: number;
|
|
19
|
-
totalDuration: number;
|
|
20
|
-
operationCount: number;
|
|
21
|
-
successRate: number;
|
|
22
|
-
}
|
|
23
|
-
export interface Analysis {
|
|
24
|
-
performance: Record<string, PerformanceMetrics>;
|
|
25
|
-
outliers: Metric[];
|
|
26
|
-
suggestions: string[];
|
|
27
|
-
bottlenecks: string[];
|
|
28
|
-
}
|
|
29
|
-
export declare class ExecutionProfiler {
|
|
30
|
-
private metrics;
|
|
31
|
-
record(agent: string, operation: string, duration: number, success?: boolean): void;
|
|
32
|
-
getMetrics(agent: string): Metric[];
|
|
33
|
-
analyze(agent: string): PerformanceMetrics;
|
|
34
|
-
analyzeAll(): Analysis;
|
|
35
|
-
formatAnalysis(analysis: Analysis): string;
|
|
36
|
-
clear(): void;
|
|
37
|
-
toJSON(): string;
|
|
38
|
-
static fromJSON(json: string): ExecutionProfiler;
|
|
39
|
-
}
|
|
40
|
-
export declare const executionProfiler: ExecutionProfiler;
|
package/dist/prompts/shared.d.ts
DELETED
package/dist/tasks.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task management for DAG-based orchestration
|
|
3
|
-
*/
|
|
4
|
-
export type TaskStatus = "pending" | "running" | "completed" | "failed";
|
|
5
|
-
export interface Task {
|
|
6
|
-
id: string;
|
|
7
|
-
description: string;
|
|
8
|
-
action: string;
|
|
9
|
-
file: string;
|
|
10
|
-
dependencies: string[];
|
|
11
|
-
status: TaskStatus;
|
|
12
|
-
result?: string;
|
|
13
|
-
retryCount: number;
|
|
14
|
-
complexity: number;
|
|
15
|
-
type: "infrastructure" | "logic" | "integration";
|
|
16
|
-
}
|
|
17
|
-
export declare class TaskGraph {
|
|
18
|
-
private tasks;
|
|
19
|
-
constructor(tasks?: Task[]);
|
|
20
|
-
addTask(task: Task): void;
|
|
21
|
-
getTask(id: string): Task | undefined;
|
|
22
|
-
updateTask(id: string, updates: Partial<Task>): void;
|
|
23
|
-
getReadyTasks(): Task[];
|
|
24
|
-
isCompleted(): boolean;
|
|
25
|
-
hasFailed(): boolean;
|
|
26
|
-
getTaskSummary(): string;
|
|
27
|
-
toJSON(): string;
|
|
28
|
-
static fromJSON(json: string): TaskGraph;
|
|
29
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Delegation Tools
|
|
3
|
-
*
|
|
4
|
-
* Tools for delegating work to agents:
|
|
5
|
-
* - delegate_task: Delegate work to an agent (sync or background)
|
|
6
|
-
* - get_task_result: Retrieve completed task result
|
|
7
|
-
* - list_tasks: View all parallel tasks
|
|
8
|
-
* - cancel_task: Stop a running task
|
|
9
|
-
*/
|
|
10
|
-
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
11
|
-
import { ParallelAgentManager } from "../core/async-agent.js";
|
|
12
|
-
export { ParallelAgentManager as AsyncAgentManager } from "../core/async-agent.js";
|
|
13
|
-
/**
|
|
14
|
-
* delegate_task - Delegate work to an agent (sync or background)
|
|
15
|
-
*/
|
|
16
|
-
export declare const createDelegateTaskTool: (manager: ParallelAgentManager, client: unknown) => {
|
|
17
|
-
description: string;
|
|
18
|
-
args: {
|
|
19
|
-
agent: import("zod").ZodString;
|
|
20
|
-
description: import("zod").ZodString;
|
|
21
|
-
prompt: import("zod").ZodString;
|
|
22
|
-
background: import("zod").ZodBoolean;
|
|
23
|
-
};
|
|
24
|
-
execute(args: {
|
|
25
|
-
agent: string;
|
|
26
|
-
description: string;
|
|
27
|
-
prompt: string;
|
|
28
|
-
background: boolean;
|
|
29
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* get_task_result - Get result from a completed background task
|
|
33
|
-
*/
|
|
34
|
-
export declare const createGetTaskResultTool: (manager: ParallelAgentManager) => {
|
|
35
|
-
description: string;
|
|
36
|
-
args: {
|
|
37
|
-
taskId: import("zod").ZodString;
|
|
38
|
-
};
|
|
39
|
-
execute(args: {
|
|
40
|
-
taskId: string;
|
|
41
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* list_tasks - List all background tasks
|
|
45
|
-
*/
|
|
46
|
-
export declare const createListTasksTool: (manager: ParallelAgentManager) => {
|
|
47
|
-
description: string;
|
|
48
|
-
args: {
|
|
49
|
-
status: import("zod").ZodOptional<import("zod").ZodString>;
|
|
50
|
-
};
|
|
51
|
-
execute(args: {
|
|
52
|
-
status?: string | undefined;
|
|
53
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* cancel_task - Cancel a running background task
|
|
57
|
-
*/
|
|
58
|
-
export declare const createCancelTaskTool: (manager: ParallelAgentManager) => {
|
|
59
|
-
description: string;
|
|
60
|
-
args: {
|
|
61
|
-
taskId: import("zod").ZodString;
|
|
62
|
-
};
|
|
63
|
-
execute(args: {
|
|
64
|
-
taskId: string;
|
|
65
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Factory function to create all task delegation tools
|
|
69
|
-
*/
|
|
70
|
-
export declare function createAsyncAgentTools(manager: ParallelAgentManager, client?: unknown): Record<string, ToolDefinition>;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Background Task Tools for OpenCode Orchestrator
|
|
3
|
-
*
|
|
4
|
-
* These tools allow the AI to run commands in the background and check their results later.
|
|
5
|
-
* This is useful for long-running builds, tests, or other operations.
|
|
6
|
-
*/
|
|
7
|
-
export declare const runBackgroundTool: {
|
|
8
|
-
description: string;
|
|
9
|
-
args: {
|
|
10
|
-
command: import("zod").ZodString;
|
|
11
|
-
cwd: import("zod").ZodOptional<import("zod").ZodString>;
|
|
12
|
-
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
13
|
-
label: import("zod").ZodOptional<import("zod").ZodString>;
|
|
14
|
-
};
|
|
15
|
-
execute(args: {
|
|
16
|
-
command: string;
|
|
17
|
-
cwd?: string | undefined;
|
|
18
|
-
timeout?: number | undefined;
|
|
19
|
-
label?: string | undefined;
|
|
20
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
21
|
-
};
|
|
22
|
-
export declare const checkBackgroundTool: {
|
|
23
|
-
description: string;
|
|
24
|
-
args: {
|
|
25
|
-
taskId: import("zod").ZodString;
|
|
26
|
-
tailLines: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
27
|
-
};
|
|
28
|
-
execute(args: {
|
|
29
|
-
taskId: string;
|
|
30
|
-
tailLines?: number | undefined;
|
|
31
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
32
|
-
};
|
|
33
|
-
export declare const listBackgroundTool: {
|
|
34
|
-
description: string;
|
|
35
|
-
args: {
|
|
36
|
-
status: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
37
|
-
running: "running";
|
|
38
|
-
done: "done";
|
|
39
|
-
error: "error";
|
|
40
|
-
all: "all";
|
|
41
|
-
}>>;
|
|
42
|
-
};
|
|
43
|
-
execute(args: {
|
|
44
|
-
status?: "running" | "done" | "error" | "all" | undefined;
|
|
45
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
46
|
-
};
|
|
47
|
-
export declare const killBackgroundTool: {
|
|
48
|
-
description: string;
|
|
49
|
-
args: {
|
|
50
|
-
taskId: import("zod").ZodString;
|
|
51
|
-
};
|
|
52
|
-
execute(args: {
|
|
53
|
-
taskId: string;
|
|
54
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
55
|
-
};
|
package/dist/tools/batch.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Smart Batch Tool - Centralized validation and retry
|
|
3
|
-
*
|
|
4
|
-
* Execute many tasks with intelligent batching, validation, and retry.
|
|
5
|
-
*/
|
|
6
|
-
import { tool } from "@opencode-ai/plugin";
|
|
7
|
-
import { ParallelAgentManager } from "../core/async-agent.js";
|
|
8
|
-
/**
|
|
9
|
-
* process_batch - Execute multiple tasks with smart validation
|
|
10
|
-
*/
|
|
11
|
-
export declare const createProcessBatchTool: (parallelAgentManager: ParallelAgentManager, client: unknown) => {
|
|
12
|
-
description: string;
|
|
13
|
-
args: {
|
|
14
|
-
concurrency: import("zod").ZodString;
|
|
15
|
-
maxRetries: import("zod").ZodOptional<import("zod").ZodString>;
|
|
16
|
-
validateAfterEach: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
17
|
-
tasks: import("zod").ZodString;
|
|
18
|
-
};
|
|
19
|
-
execute(args: {
|
|
20
|
-
concurrency: string;
|
|
21
|
-
tasks: string;
|
|
22
|
-
maxRetries?: string | undefined;
|
|
23
|
-
validateAfterEach?: boolean | undefined;
|
|
24
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* export_failed_tasks - Export failed tasks for manual review
|
|
28
|
-
*/
|
|
29
|
-
export declare const createExportFailedTasksTool: (parallelAgentManager: ParallelAgentManager) => {
|
|
30
|
-
description: string;
|
|
31
|
-
args: {};
|
|
32
|
-
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* compare_strategies - Compare performance of different strategies
|
|
36
|
-
*/
|
|
37
|
-
export declare const createCompareStrategiesTool: (parallelAgentManager: ParallelAgentManager) => {
|
|
38
|
-
description: string;
|
|
39
|
-
args: {
|
|
40
|
-
taskCount: import("zod").ZodString;
|
|
41
|
-
concurrency1: import("zod").ZodOptional<import("zod").ZodString>;
|
|
42
|
-
concurrency2: import("zod").ZodOptional<import("zod").ZodString>;
|
|
43
|
-
};
|
|
44
|
-
execute(args: {
|
|
45
|
-
taskCount: string;
|
|
46
|
-
concurrency1?: string | undefined;
|
|
47
|
-
concurrency2?: string | undefined;
|
|
48
|
-
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Factory to create all batch tools
|
|
52
|
-
*/
|
|
53
|
-
export declare function createBatchTools(parallelAgentManager: ParallelAgentManager, client?: unknown): Record<string, ReturnType<typeof tool>>;
|