opencode-orchestrator 1.2.31 → 1.2.32
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/mission/mission-controller.d.ts +53 -0
- package/dist/core/resource/resource-tracker.d.ts +61 -0
- package/dist/index.d.ts +0 -8
- package/dist/index.js +30048 -35650
- package/dist/shared/core/constants/labels.d.ts +12 -0
- package/dist/shared/core/constants/mission.d.ts +8 -0
- package/dist/shared/core/constants/os.d.ts +10 -0
- package/dist/shared/core/constants/signals.d.ts +22 -0
- package/dist/shared/prompt/constants/prompts.d.ts +7 -0
- package/dist/shared/prompt/constants/tags.d.ts +4 -0
- package/dist/shared/session/constants/message.d.ts +15 -0
- package/dist/shared/session/constants/status.d.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Native Todo interface from OpenCode SDK
|
|
4
|
+
*/
|
|
5
|
+
export interface NativeTodo {
|
|
6
|
+
id: string;
|
|
7
|
+
content: string;
|
|
8
|
+
status: 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
9
|
+
priority: 'high' | 'medium' | 'low';
|
|
10
|
+
}
|
|
11
|
+
interface MissionState {
|
|
12
|
+
id: string;
|
|
13
|
+
sessionID: string;
|
|
14
|
+
prompt: string;
|
|
15
|
+
status: 'active' | 'completed' | 'failed';
|
|
16
|
+
iteration: number;
|
|
17
|
+
maxIterations: number;
|
|
18
|
+
startedAt: string;
|
|
19
|
+
lastTodoHash?: string;
|
|
20
|
+
stagnationCount: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* MissionController
|
|
24
|
+
* Handles the main autonomous loop using OpenCode Native APIs.
|
|
25
|
+
*/
|
|
26
|
+
export declare class MissionController {
|
|
27
|
+
private state;
|
|
28
|
+
private client;
|
|
29
|
+
constructor(input: PluginInput);
|
|
30
|
+
/**
|
|
31
|
+
* Starts a new mission by creating a session and sending the commander prompt.
|
|
32
|
+
*/
|
|
33
|
+
start(prompt: string): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Fetches native Todos for the current session.
|
|
36
|
+
*/
|
|
37
|
+
getTodos(): Promise<NativeTodo[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Moves to the next iteration if needed.
|
|
40
|
+
* Called primarily when session becomes IDLE.
|
|
41
|
+
*/
|
|
42
|
+
nextIteration(): Promise<{
|
|
43
|
+
continue: boolean;
|
|
44
|
+
prompt?: string;
|
|
45
|
+
reason?: string;
|
|
46
|
+
}>;
|
|
47
|
+
buildCommanderPrompt(objective: string): string;
|
|
48
|
+
buildContinuationPrompt(pending: NativeTodo[], intervention?: string): string;
|
|
49
|
+
private buildStagnationIntervention;
|
|
50
|
+
private hashTodos;
|
|
51
|
+
getState(): MissionState | null;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare enum ResourceType {
|
|
2
|
+
SESSION = "session",
|
|
3
|
+
TIMER = "timer",
|
|
4
|
+
INTERVAL = "interval",
|
|
5
|
+
FILE_HANDLE = "file_handle",
|
|
6
|
+
MEMORY = "memory"
|
|
7
|
+
}
|
|
8
|
+
interface TrackedResource {
|
|
9
|
+
id: string;
|
|
10
|
+
type: ResourceType;
|
|
11
|
+
sessionID?: string;
|
|
12
|
+
createdAt: number;
|
|
13
|
+
metadata?: Record<string, unknown>;
|
|
14
|
+
cleanup: () => Promise<void> | void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Centralized tracker for all resources that need explicit cleanup.
|
|
18
|
+
* Ensures that resources tied to a specific session are cleaned up when the session ends.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ResourceTracker {
|
|
21
|
+
private static _instance;
|
|
22
|
+
private resources;
|
|
23
|
+
private sessionResources;
|
|
24
|
+
private constructor();
|
|
25
|
+
static getInstance(): ResourceTracker;
|
|
26
|
+
/**
|
|
27
|
+
* Start tracking a resource.
|
|
28
|
+
*/
|
|
29
|
+
track(resource: TrackedResource): void;
|
|
30
|
+
/**
|
|
31
|
+
* Release a specific resource by ID.
|
|
32
|
+
*/
|
|
33
|
+
release(id: string): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Release all resources associated with a specific sessionID.
|
|
36
|
+
*/
|
|
37
|
+
releaseAllForSession(sessionID: string): Promise<number>;
|
|
38
|
+
/**
|
|
39
|
+
* Release all resources of a specific type.
|
|
40
|
+
*/
|
|
41
|
+
releaseByType(type: ResourceType): Promise<number>;
|
|
42
|
+
/**
|
|
43
|
+
* Periodic GC for stale resources (e.g. leaked timers).
|
|
44
|
+
*/
|
|
45
|
+
cleanupStale(maxAgeMs: number): Promise<number>;
|
|
46
|
+
/**
|
|
47
|
+
* Shutdown the tracker and release all managed resources.
|
|
48
|
+
*/
|
|
49
|
+
shutdown(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Get current resource statistics.
|
|
52
|
+
*/
|
|
53
|
+
getStats(): {
|
|
54
|
+
total: number;
|
|
55
|
+
byType: Record<string, number>;
|
|
56
|
+
bySessions: number;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export declare function trackTimer(timer: NodeJS.Timeout, sessionID?: string): string;
|
|
60
|
+
export declare function trackInterval(interval: NodeJS.Timeout, sessionID?: string): string;
|
|
61
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenCode Orchestrator Plugin
|
|
3
|
-
*
|
|
4
|
-
* This is the main entry point for the 4-Agent consolidated architecture.
|
|
5
|
-
* Handlers are modularized in src/plugin-handlers/ for maintainability.
|
|
6
|
-
*
|
|
7
|
-
* The agents are: Commander, Planner, Worker, Reviewer
|
|
8
|
-
*/
|
|
9
1
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
10
2
|
declare const OrchestratorPlugin: Plugin;
|
|
11
3
|
export default OrchestratorPlugin;
|