opencode-orchestrator 1.2.17 → 1.2.21
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/dist/core/agents/concurrency.d.ts +4 -1
- package/dist/core/agents/config.d.ts +1 -1
- package/dist/core/agents/manager.d.ts +1 -5
- package/dist/core/agents/session-pool.d.ts +5 -0
- package/dist/core/agents/unified-task-executor.d.ts +109 -0
- package/dist/core/sync/todo-sync-service.d.ts +7 -0
- package/dist/hooks/types.d.ts +1 -1
- package/dist/index.js +1569 -1763
- package/dist/scripts/postinstall.js +125 -29
- package/dist/shared/session/constants/events/hook-events.d.ts +9 -0
- package/dist/shared/session/constants/events/index.d.ts +5 -0
- package/dist/shared/task/constants/parallel-task.d.ts +4 -3
- package/package.json +1 -1
|
@@ -26,7 +26,10 @@ export declare class ConcurrencyController {
|
|
|
26
26
|
acquire(key: string): Promise<void>;
|
|
27
27
|
release(key: string): void;
|
|
28
28
|
/**
|
|
29
|
-
* Report success/failure
|
|
29
|
+
* Report success/failure (for metrics only - auto-scaling DISABLED)
|
|
30
|
+
*
|
|
31
|
+
* Auto-scaling has been removed for stability. Concurrency is now fixed at 5.
|
|
32
|
+
* This method is kept for backwards compatibility and metrics tracking.
|
|
30
33
|
*/
|
|
31
34
|
reportResult(key: string, success: boolean): void;
|
|
32
35
|
getQueueLength(key: string): number;
|
|
@@ -24,11 +24,7 @@ export declare class ParallelAgentManager {
|
|
|
24
24
|
private directory;
|
|
25
25
|
private concurrency;
|
|
26
26
|
private sessionPool;
|
|
27
|
-
private
|
|
28
|
-
private resumer;
|
|
29
|
-
private poller;
|
|
30
|
-
private cleaner;
|
|
31
|
-
private eventHandler;
|
|
27
|
+
private executor;
|
|
32
28
|
private constructor();
|
|
33
29
|
static getInstance(client?: OpencodeClient, directory?: string): ParallelAgentManager;
|
|
34
30
|
launch(inputs: LaunchInput | LaunchInput[]): Promise<ParallelTask | ParallelTask[]>;
|
|
@@ -23,6 +23,7 @@ export declare class SessionPool implements ISessionPool {
|
|
|
23
23
|
static getInstance(client?: OpencodeClient, directory?: string, config?: Partial<SessionPoolConfig>): SessionPool;
|
|
24
24
|
/**
|
|
25
25
|
* Acquire a session from the pool or create a new one.
|
|
26
|
+
* Sessions are validated before reuse to ensure health.
|
|
26
27
|
*/
|
|
27
28
|
acquire(agentName: string, parentSessionID: string, description: string): Promise<PooledSession>;
|
|
28
29
|
/**
|
|
@@ -52,6 +53,10 @@ export declare class SessionPool implements ISessionPool {
|
|
|
52
53
|
private getPoolKey;
|
|
53
54
|
private createSession;
|
|
54
55
|
private deleteSession;
|
|
56
|
+
/**
|
|
57
|
+
* Validate session health by checking if it exists on the server.
|
|
58
|
+
*/
|
|
59
|
+
private validateSessionHealth;
|
|
55
60
|
private startHealthCheck;
|
|
56
61
|
}
|
|
57
62
|
export declare const sessionPool: {
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Task Executor
|
|
3
|
+
*
|
|
4
|
+
* Consolidates multiple task management components into a single, cohesive executor:
|
|
5
|
+
* - TaskLauncher (launch tasks)
|
|
6
|
+
* - TaskPoller (monitor tasks)
|
|
7
|
+
* - TaskCleaner (cleanup tasks)
|
|
8
|
+
* - TaskResumer (resume tasks)
|
|
9
|
+
* - EventHandler (handle events)
|
|
10
|
+
*
|
|
11
|
+
* This reduces complexity from 5 separate components to 1 unified executor.
|
|
12
|
+
*/
|
|
13
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
14
|
+
import type { ParallelTask } from "./interfaces/parallel-task.interface.js";
|
|
15
|
+
import type { LaunchInput } from "./interfaces/launch-input.interface.js";
|
|
16
|
+
import type { ResumeInput } from "./interfaces/resume-input.interface.js";
|
|
17
|
+
import { TaskStore } from "./task-store.js";
|
|
18
|
+
import { ConcurrencyController } from "./concurrency.js";
|
|
19
|
+
import { SessionPool } from "./session-pool.js";
|
|
20
|
+
type OpencodeClient = PluginInput["client"];
|
|
21
|
+
/**
|
|
22
|
+
* Unified Task Executor
|
|
23
|
+
*
|
|
24
|
+
* Combines all task management responsibilities into one cohesive class.
|
|
25
|
+
*/
|
|
26
|
+
export declare class UnifiedTaskExecutor {
|
|
27
|
+
private client;
|
|
28
|
+
private directory;
|
|
29
|
+
private store;
|
|
30
|
+
private concurrency;
|
|
31
|
+
private sessionPool;
|
|
32
|
+
private pollInterval;
|
|
33
|
+
private isPolling;
|
|
34
|
+
private cleanupTimers;
|
|
35
|
+
constructor(client: OpencodeClient, directory: string, store: TaskStore, concurrency: ConcurrencyController, sessionPool: SessionPool);
|
|
36
|
+
/**
|
|
37
|
+
* Launch a new parallel task
|
|
38
|
+
*/
|
|
39
|
+
launch(input: LaunchInput): Promise<ParallelTask>;
|
|
40
|
+
/**
|
|
41
|
+
* Start polling for task updates
|
|
42
|
+
*/
|
|
43
|
+
private startPolling;
|
|
44
|
+
/**
|
|
45
|
+
* Stop polling
|
|
46
|
+
*/
|
|
47
|
+
private stopPolling;
|
|
48
|
+
/**
|
|
49
|
+
* Poll all running tasks
|
|
50
|
+
*/
|
|
51
|
+
private pollTasks;
|
|
52
|
+
/**
|
|
53
|
+
* Poll a single task
|
|
54
|
+
*/
|
|
55
|
+
private pollTask;
|
|
56
|
+
/**
|
|
57
|
+
* Handle task completion
|
|
58
|
+
*/
|
|
59
|
+
private handleTaskComplete;
|
|
60
|
+
/**
|
|
61
|
+
* Handle task error
|
|
62
|
+
*/
|
|
63
|
+
private handleTaskError;
|
|
64
|
+
/**
|
|
65
|
+
* Schedule cleanup for a task
|
|
66
|
+
*/
|
|
67
|
+
private scheduleCleanup;
|
|
68
|
+
/**
|
|
69
|
+
* Cleanup a task
|
|
70
|
+
*/
|
|
71
|
+
private cleanupTask;
|
|
72
|
+
/**
|
|
73
|
+
* Prune expired tasks
|
|
74
|
+
*/
|
|
75
|
+
private pruneExpiredTasks;
|
|
76
|
+
/**
|
|
77
|
+
* Notify parent if all tasks complete
|
|
78
|
+
*/
|
|
79
|
+
private notifyParentIfAllComplete;
|
|
80
|
+
/**
|
|
81
|
+
* Resume a task from disk
|
|
82
|
+
*/
|
|
83
|
+
resume(input: ResumeInput): Promise<ParallelTask | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Recover all active tasks from disk
|
|
86
|
+
*/
|
|
87
|
+
recoverAll(): Promise<number>;
|
|
88
|
+
/**
|
|
89
|
+
* Cancel a task
|
|
90
|
+
*/
|
|
91
|
+
cancel(taskId: string): Promise<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Get task by ID
|
|
94
|
+
*/
|
|
95
|
+
getTask(taskId: string): ParallelTask | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Get all tasks
|
|
98
|
+
*/
|
|
99
|
+
getAllTasks(): ParallelTask[];
|
|
100
|
+
/**
|
|
101
|
+
* Get tasks by parent
|
|
102
|
+
*/
|
|
103
|
+
getTasksByParent(parentSessionID: string): ParallelTask[];
|
|
104
|
+
/**
|
|
105
|
+
* Cleanup all resources
|
|
106
|
+
*/
|
|
107
|
+
cleanup(): void;
|
|
108
|
+
}
|
|
109
|
+
export {};
|
|
@@ -16,6 +16,9 @@ export declare class TodoSyncService {
|
|
|
16
16
|
private taskTodos;
|
|
17
17
|
private updateTimeout;
|
|
18
18
|
private watcher;
|
|
19
|
+
private pendingUpdates;
|
|
20
|
+
private batchTimer;
|
|
21
|
+
private readonly BATCH_WINDOW_MS;
|
|
19
22
|
private activeSessions;
|
|
20
23
|
constructor(client: OpencodeClient, directory: string);
|
|
21
24
|
start(): Promise<void>;
|
|
@@ -29,6 +32,10 @@ export declare class TodoSyncService {
|
|
|
29
32
|
removeTask(taskId: string): void;
|
|
30
33
|
private broadcastUpdate;
|
|
31
34
|
private scheduleUpdate;
|
|
35
|
+
/**
|
|
36
|
+
* Flush all pending updates in parallel batches
|
|
37
|
+
*/
|
|
38
|
+
private flushBatchedUpdates;
|
|
32
39
|
private sendTodosToSession;
|
|
33
40
|
stop(): void;
|
|
34
41
|
}
|
package/dist/hooks/types.d.ts
CHANGED