opencode-orchestrator 1.2.14 → 1.2.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/dist/core/agents/config.d.ts +2 -1
- package/dist/core/agents/manager/task-poller.d.ts +4 -2
- package/dist/core/loop/continuation-lock.d.ts +57 -0
- package/dist/core/loop/verification.d.ts +5 -0
- package/dist/core/session/session-health.d.ts +93 -0
- package/dist/index.js +463 -144
- package/dist/shared/constants/system-messages.d.ts +1 -1
- package/dist/shared/loop/constants/mission-control.d.ts +2 -2
- package/dist/shared/task/constants/parallel-task.d.ts +3 -3
- package/package.json +1 -1
|
@@ -14,12 +14,14 @@ export declare class TaskPoller {
|
|
|
14
14
|
private scheduleCleanup;
|
|
15
15
|
private pruneExpiredTasks;
|
|
16
16
|
private onTaskComplete?;
|
|
17
|
-
private
|
|
17
|
+
private onTaskError?;
|
|
18
|
+
private pollTimeout?;
|
|
18
19
|
private messageCache;
|
|
19
|
-
constructor(client: OpencodeClient, store: TaskStore, concurrency: ConcurrencyController, notifyParentIfAllComplete: (parentSessionID: string) => Promise<void>, scheduleCleanup: (taskId: string) => void, pruneExpiredTasks: () => void, onTaskComplete?: ((task: ParallelTask) => void | Promise<void>) | undefined);
|
|
20
|
+
constructor(client: OpencodeClient, store: TaskStore, concurrency: ConcurrencyController, notifyParentIfAllComplete: (parentSessionID: string) => Promise<void>, scheduleCleanup: (taskId: string) => void, pruneExpiredTasks: () => void, onTaskComplete?: ((task: ParallelTask) => void | Promise<void>) | undefined, onTaskError?: ((taskId: string, error: unknown) => void) | undefined);
|
|
20
21
|
start(): void;
|
|
21
22
|
stop(): void;
|
|
22
23
|
isRunning(): boolean;
|
|
24
|
+
private scheduleNextPoll;
|
|
23
25
|
poll(): Promise<void>;
|
|
24
26
|
validateSessionHasOutput(sessionID: string, task?: ParallelTask): Promise<boolean>;
|
|
25
27
|
completeTask(task: ParallelTask): Promise<void>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Continuation Lock - Ensures single execution of continuation logic
|
|
3
|
+
*
|
|
4
|
+
* Prevents simultaneous execution of Mission Loop and Todo Continuation systems.
|
|
5
|
+
* This resolves infinite loading issues caused by duplicate prompt injections.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* if (!tryAcquireContinuationLock(sessionID)) {
|
|
9
|
+
* return; // Another system is already processing
|
|
10
|
+
* }
|
|
11
|
+
* try {
|
|
12
|
+
* // continuation logic
|
|
13
|
+
* } finally {
|
|
14
|
+
* releaseContinuationLock(sessionID);
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
interface ContinuationLockState {
|
|
18
|
+
acquired: boolean;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
source?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Try to acquire the continuation lock
|
|
24
|
+
*
|
|
25
|
+
* @param sessionID - Session ID
|
|
26
|
+
* @param source - Source requesting the lock (for debugging)
|
|
27
|
+
* @returns true if acquired, false otherwise
|
|
28
|
+
*/
|
|
29
|
+
export declare function tryAcquireContinuationLock(sessionID: string, source?: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Release the continuation lock
|
|
32
|
+
*
|
|
33
|
+
* @param sessionID - Session ID
|
|
34
|
+
*/
|
|
35
|
+
export declare function releaseContinuationLock(sessionID: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Check if the lock is currently active
|
|
38
|
+
*
|
|
39
|
+
* @param sessionID - Session ID
|
|
40
|
+
* @returns true if lock is held
|
|
41
|
+
*/
|
|
42
|
+
export declare function hasContinuationLock(sessionID: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Cleanup lock when session is cleaned up
|
|
45
|
+
*
|
|
46
|
+
* @param sessionID - Session ID
|
|
47
|
+
*/
|
|
48
|
+
export declare function cleanupContinuationLock(sessionID: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Clear all locks (for testing)
|
|
51
|
+
*/
|
|
52
|
+
export declare function clearAllLocks(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Get lock status (for debugging)
|
|
55
|
+
*/
|
|
56
|
+
export declare function getLockStatus(sessionID: string): ContinuationLockState | undefined;
|
|
57
|
+
export {};
|
|
@@ -11,11 +11,16 @@ export type { ChecklistItem, ChecklistCategory, ChecklistVerificationResult, Ver
|
|
|
11
11
|
export declare const CHECKLIST_FILE: ".opencode/verification-checklist.md";
|
|
12
12
|
export declare function parseChecklist(content: string): ChecklistItem[];
|
|
13
13
|
export declare function readChecklist(directory: string): ChecklistItem[];
|
|
14
|
+
export declare function readChecklistAsync(directory: string): Promise<ChecklistItem[]>;
|
|
15
|
+
export declare function clearVerificationCache(): void;
|
|
14
16
|
export declare function verifyChecklist(directory: string): ChecklistVerificationResult;
|
|
17
|
+
export declare function verifyChecklistAsync(directory: string): Promise<ChecklistVerificationResult>;
|
|
15
18
|
export declare function hasValidChecklist(directory: string): boolean;
|
|
16
19
|
export declare function getChecklistSummary(directory: string): string;
|
|
17
20
|
export declare function buildChecklistFailurePrompt(result: ChecklistVerificationResult): string;
|
|
18
21
|
export declare function getChecklistCreationInstructions(): string;
|
|
22
|
+
export declare function verifyMissionCompletionSync(directory: string): VerificationResult;
|
|
23
|
+
export declare function verifyMissionCompletionAsync(directory: string): Promise<VerificationResult>;
|
|
19
24
|
export declare function verifyMissionCompletion(directory: string): VerificationResult;
|
|
20
25
|
export declare function buildVerificationFailurePrompt(result: VerificationResult): string;
|
|
21
26
|
export declare function buildTodoIncompletePrompt(result: VerificationResult): string;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Health Monitor
|
|
3
|
+
*
|
|
4
|
+
* Periodically checks session health and detects stale sessions.
|
|
5
|
+
* Early detection of infinite loading states improves system stability.
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
8
|
+
type OpencodeClient = PluginInput["client"];
|
|
9
|
+
interface SessionHealthState {
|
|
10
|
+
sessionID: string;
|
|
11
|
+
lastActiveTime: number;
|
|
12
|
+
lastResponseTime: number;
|
|
13
|
+
isStale: boolean;
|
|
14
|
+
activityCount: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Record session activity
|
|
18
|
+
*
|
|
19
|
+
* Call this when an activity occurs in the session.
|
|
20
|
+
* (e.g., sending prompt, tool execution)
|
|
21
|
+
*
|
|
22
|
+
* @param sessionID - Session ID
|
|
23
|
+
*/
|
|
24
|
+
export declare function recordSessionActivity(sessionID: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Record session response receipt
|
|
27
|
+
*
|
|
28
|
+
* Call this when a response is received from the session.
|
|
29
|
+
* (e.g., assistant message received)
|
|
30
|
+
*
|
|
31
|
+
* @param sessionID - Session ID
|
|
32
|
+
*/
|
|
33
|
+
export declare function recordSessionResponse(sessionID: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Check if session is stale
|
|
36
|
+
*
|
|
37
|
+
* @param sessionID - Session ID
|
|
38
|
+
* @returns true if stale
|
|
39
|
+
*/
|
|
40
|
+
export declare function isSessionStale(sessionID: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Get session response age
|
|
43
|
+
*
|
|
44
|
+
* @param sessionID - Session ID
|
|
45
|
+
* @returns Time elapsed since last response (ms), or -1 if session not found
|
|
46
|
+
*/
|
|
47
|
+
export declare function getSessionResponseAge(sessionID: string): number;
|
|
48
|
+
/**
|
|
49
|
+
* Get all stale session IDs
|
|
50
|
+
*
|
|
51
|
+
* @returns Array of stale session IDs
|
|
52
|
+
*/
|
|
53
|
+
export declare function getStaleSessions(): string[];
|
|
54
|
+
/**
|
|
55
|
+
* Start health check monitor
|
|
56
|
+
*
|
|
57
|
+
* @param opencodeClient - OpenCode Client
|
|
58
|
+
*/
|
|
59
|
+
export declare function startHealthCheck(opencodeClient: OpencodeClient): void;
|
|
60
|
+
/**
|
|
61
|
+
* Stop health check monitor
|
|
62
|
+
*/
|
|
63
|
+
export declare function stopHealthCheck(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Perform actual health check (Exported for testing)
|
|
66
|
+
*/
|
|
67
|
+
export declare function performHealthCheck(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Cleanup session health state
|
|
70
|
+
*
|
|
71
|
+
* @param sessionID - Session ID
|
|
72
|
+
*/
|
|
73
|
+
export declare function cleanupSessionHealth(sessionID: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Clear all session health info (for testing)
|
|
76
|
+
*/
|
|
77
|
+
export declare function clearAllSessionHealth(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Get session health info (for debugging)
|
|
80
|
+
*
|
|
81
|
+
* @param sessionID - Session ID
|
|
82
|
+
*/
|
|
83
|
+
export declare function getSessionHealth(sessionID: string): SessionHealthState | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Get overall health stats (for debugging)
|
|
86
|
+
*/
|
|
87
|
+
export declare function getHealthStats(): {
|
|
88
|
+
total: number;
|
|
89
|
+
stale: number;
|
|
90
|
+
healthy: number;
|
|
91
|
+
avgResponseAge: number;
|
|
92
|
+
};
|
|
93
|
+
export {};
|