opencode-orchestrator 1.2.21 → 1.2.23
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 +41 -91
- package/dist/core/agents/adaptive-concurrency.d.ts +57 -0
- package/dist/core/agents/index.d.ts +3 -2
- package/dist/core/agents/interfaces/session-pool.interface.d.ts +7 -0
- package/dist/core/agents/manager.d.ts +8 -36
- package/dist/core/agents/session-pool.d.ts +5 -0
- package/dist/core/agents/unified-task-executor.d.ts +10 -92
- 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 +6533 -27677
- package/dist/shared/constants/system-messages.d.ts +3 -3
- package/dist/shared/core/constants/index.d.ts +4 -0
- package/dist/shared/core/constants/labels.d.ts +12 -0
- package/dist/shared/core/constants/mission.d.ts +8 -0
- package/dist/shared/{os/constants/platform.d.ts → core/constants/os.d.ts} +4 -3
- package/dist/shared/core/constants/signals.d.ts +22 -0
- package/dist/shared/index.d.ts +6 -8
- package/dist/shared/prompt/constants/prompts.d.ts +7 -0
- package/dist/shared/prompt/constants/tags.d.ts +4 -0
- package/dist/shared/prompt/index.d.ts +1 -0
- package/dist/shared/session/constants/index.d.ts +2 -0
- package/dist/shared/session/constants/message.d.ts +15 -0
- package/dist/shared/session/constants/status.d.ts +9 -0
- package/dist/shared/session/index.d.ts +1 -0
- package/dist/tools/parallel/list-agents.d.ts +1 -1
- package/dist/utils/common.d.ts +3 -5
- package/package.json +3 -3
- package/dist/core/agents/agent-registry.d.ts +0 -28
- package/dist/core/agents/concurrency.d.ts +0 -41
- package/dist/core/agents/config.d.ts +0 -10
- package/dist/core/agents/consts/index.d.ts +0 -4
- package/dist/core/agents/manager/event-handler.d.ts +0 -35
- package/dist/core/agents/manager/index.d.ts +0 -10
- package/dist/core/agents/manager/task-cleaner.d.ts +0 -29
- package/dist/core/agents/manager/task-launcher.d.ts +0 -35
- package/dist/core/agents/manager/task-poller.d.ts +0 -30
- package/dist/core/agents/manager/task-resumer.d.ts +0 -18
- package/dist/core/agents/persistence/task-wal.d.ts +0 -26
- package/dist/core/agents/task-store.d.ts +0 -54
- package/dist/core/cleanup/cleanup-scheduler.d.ts +0 -11
- package/dist/core/context/context-window-monitor.d.ts +0 -66
- package/dist/core/context/index.d.ts +0 -6
- package/dist/core/loop/continuation-lock.d.ts +0 -57
- package/dist/core/loop/formatters.d.ts +0 -17
- package/dist/core/loop/interfaces/index.d.ts +0 -5
- package/dist/core/loop/interfaces/todo-stats.d.ts +0 -11
- package/dist/core/loop/interfaces/todo.d.ts +0 -13
- package/dist/core/loop/interfaces.d.ts +0 -7
- package/dist/core/loop/mission-loop-handler.d.ts +0 -25
- package/dist/core/loop/mission-loop.d.ts +0 -48
- package/dist/core/loop/parser.d.ts +0 -8
- package/dist/core/loop/stats.d.ts +0 -24
- package/dist/core/loop/todo-continuation.d.ts +0 -39
- package/dist/core/loop/todo-enforcer.d.ts +0 -9
- package/dist/core/loop/todo-manager.d.ts +0 -22
- package/dist/core/loop/types/index.d.ts +0 -5
- package/dist/core/loop/types/todo-priority.d.ts +0 -4
- package/dist/core/loop/types/todo-status.d.ts +0 -4
- package/dist/core/loop/verification.d.ts +0 -27
- package/dist/core/memory/interfaces.d.ts +0 -33
- package/dist/core/memory/memory-manager.d.ts +0 -40
- package/dist/core/metrics/collector.d.ts +0 -27
- package/dist/core/notification/os-notify/index.d.ts +0 -7
- package/dist/core/notification/os-notify/notifier.d.ts +0 -7
- package/dist/core/notification/os-notify/platform-resolver.d.ts +0 -7
- package/dist/core/notification/os-notify/platform.d.ts +0 -7
- package/dist/core/notification/os-notify/sound-player.d.ts +0 -7
- package/dist/core/notification/os-notify/todo-checker.d.ts +0 -5
- package/dist/core/notification/task-toast-manager.d.ts +0 -127
- package/dist/core/notification/toast-core.d.ts +0 -36
- package/dist/core/notification/toast.d.ts +0 -9
- package/dist/core/orchestrator/index.d.ts +0 -6
- package/dist/core/orchestrator/interfaces/index.d.ts +0 -4
- package/dist/core/orchestrator/interfaces/session-state.d.ts +0 -11
- package/dist/core/orchestrator/session-manager.d.ts +0 -31
- package/dist/core/orchestrator/state.d.ts +0 -10
- package/dist/core/orchestrator/types/index.d.ts +0 -4
- package/dist/core/orchestrator/types/task-status.d.ts +0 -5
- package/dist/core/plugins/interfaces.d.ts +0 -30
- package/dist/core/plugins/plugin-manager.d.ts +0 -21
- package/dist/core/progress/calculator.d.ts +0 -11
- package/dist/core/progress/formatters.d.ts +0 -20
- package/dist/core/progress/interfaces/index.d.ts +0 -8
- package/dist/core/progress/interfaces/progress-snapshot.d.ts +0 -15
- package/dist/core/progress/interfaces/snapshot-input.d.ts +0 -13
- package/dist/core/progress/interfaces/step-progress.d.ts +0 -7
- package/dist/core/progress/interfaces/task-progress.d.ts +0 -10
- package/dist/core/progress/interfaces/todo-progress.d.ts +0 -9
- package/dist/core/progress/interfaces.d.ts +0 -6
- package/dist/core/progress/progress-notifier.d.ts +0 -14
- package/dist/core/progress/state-broadcaster.d.ts +0 -29
- package/dist/core/progress/store.d.ts +0 -28
- package/dist/core/progress/tracker.d.ts +0 -11
- package/dist/core/queue/async-queue.d.ts +0 -46
- package/dist/core/queue/async-utils.d.ts +0 -20
- package/dist/core/queue/index.d.ts +0 -8
- package/dist/core/queue/work-pool.d.ts +0 -19
- package/dist/core/recovery/auto-recovery.d.ts +0 -9
- package/dist/core/recovery/constants.d.ts +0 -9
- package/dist/core/recovery/handler.d.ts +0 -27
- package/dist/core/recovery/interfaces/error-context.d.ts +0 -11
- package/dist/core/recovery/interfaces/error-pattern.d.ts +0 -10
- package/dist/core/recovery/interfaces/index.d.ts +0 -8
- package/dist/core/recovery/interfaces/recovery-action.d.ts +0 -25
- package/dist/core/recovery/interfaces/recovery-record.d.ts +0 -10
- package/dist/core/recovery/interfaces/recovery-stats.d.ts +0 -9
- package/dist/core/recovery/interfaces.d.ts +0 -6
- package/dist/core/recovery/patterns.d.ts +0 -8
- package/dist/core/recovery/retry.d.ts +0 -59
- package/dist/core/recovery/session-recovery.d.ts +0 -30
- package/dist/core/session/interfaces/context-stats.d.ts +0 -9
- package/dist/core/session/interfaces/index.d.ts +0 -8
- package/dist/core/session/interfaces/shared-context.d.ts +0 -15
- package/dist/core/session/interfaces/shared-decision.d.ts +0 -10
- package/dist/core/session/interfaces/shared-document.d.ts +0 -9
- package/dist/core/session/interfaces/shared-finding.d.ts +0 -10
- package/dist/core/session/interfaces.d.ts +0 -6
- package/dist/core/session/session-health.d.ts +0 -93
- package/dist/core/session/shared-context.d.ts +0 -8
- package/dist/core/session/store.d.ts +0 -44
- package/dist/core/session/summary.d.ts +0 -7
- package/dist/core/sync/todo-parser.d.ts +0 -5
- package/dist/core/sync/todo-sync-service.d.ts +0 -42
- package/dist/core/task/interfaces/index.d.ts +0 -8
- package/dist/core/task/interfaces/task-hierarchy.d.ts +0 -9
- package/dist/core/task/interfaces/task-input.d.ts +0 -11
- package/dist/core/task/interfaces/task-node.d.ts +0 -20
- package/dist/core/task/interfaces/task-progress.d.ts +0 -11
- package/dist/core/task/interfaces.d.ts +0 -6
- package/dist/core/task/parser.d.ts +0 -8
- package/dist/core/task/scheduler.d.ts +0 -12
- package/dist/core/task/store.d.ts +0 -32
- package/dist/core/task/summary.d.ts +0 -7
- package/dist/core/task/task-decomposer.d.ts +0 -10
- package/dist/core/todo/todo-manager.d.ts +0 -36
- package/dist/hooks/compatibility/external-plugin.d.ts +0 -10
- package/dist/hooks/constants.d.ts +0 -27
- package/dist/hooks/custom/agent-ui.d.ts +0 -20
- package/dist/hooks/custom/memory-gate.d.ts +0 -21
- package/dist/hooks/custom/metrics.d.ts +0 -14
- package/dist/hooks/custom/resource-control.d.ts +0 -13
- package/dist/hooks/custom/secret-scanner.d.ts +0 -19
- package/dist/hooks/custom/strict-role-guard.d.ts +0 -21
- package/dist/hooks/custom/user-activity.d.ts +0 -11
- package/dist/hooks/features/mission-loop.d.ts +0 -18
- package/dist/hooks/features/sanity-check.d.ts +0 -15
- package/dist/hooks/index.d.ts +0 -5
- package/dist/hooks/registry.d.ts +0 -37
- package/dist/hooks/types.d.ts +0 -72
- package/dist/plugin-handlers/assistant-done-handler.d.ts +0 -12
- package/dist/plugin-handlers/chat-message-handler.d.ts +0 -30
- package/dist/plugin-handlers/config-handler.d.ts +0 -9
- package/dist/plugin-handlers/event-handler.d.ts +0 -18
- package/dist/plugin-handlers/index.d.ts +0 -9
- package/dist/plugin-handlers/interfaces/assistant-done-context.d.ts +0 -12
- package/dist/plugin-handlers/interfaces/chat-message-context.d.ts +0 -12
- package/dist/plugin-handlers/interfaces/event-handler-context.d.ts +0 -14
- package/dist/plugin-handlers/interfaces/index.d.ts +0 -12
- package/dist/plugin-handlers/interfaces/orchestrator-state.d.ts +0 -14
- package/dist/plugin-handlers/interfaces/session-compacting.d.ts +0 -19
- package/dist/plugin-handlers/interfaces/session-state.d.ts +0 -15
- package/dist/plugin-handlers/interfaces/system-transform.d.ts +0 -17
- package/dist/plugin-handlers/interfaces/tool-execute-context.d.ts +0 -8
- package/dist/plugin-handlers/interfaces/tool-hook.d.ts +0 -14
- package/dist/plugin-handlers/session-compacting-handler.d.ts +0 -14
- package/dist/plugin-handlers/system-transform-handler.d.ts +0 -14
- package/dist/plugin-handlers/tool-execute-handler.d.ts +0 -14
- package/dist/plugin-handlers/tool-execute-pre-handler.d.ts +0 -8
- package/dist/shared/errors/constants/error-patterns.d.ts +0 -13
- package/dist/shared/errors/constants/error-type.d.ts +0 -13
- package/dist/shared/errors/constants/index.d.ts +0 -5
- package/dist/shared/errors/detection.d.ts +0 -5
- package/dist/shared/errors/index.d.ts +0 -7
- package/dist/shared/errors/retry.d.ts +0 -7
- package/dist/shared/errors/types/error-pattern-type.d.ts +0 -5
- package/dist/shared/errors/types/index.d.ts +0 -4
- package/dist/shared/loop/constants/index.d.ts +0 -7
- package/dist/shared/loop/constants/labels.d.ts +0 -33
- package/dist/shared/loop/constants/loop.d.ts +0 -17
- package/dist/shared/loop/constants/mission-control.d.ts +0 -20
- package/dist/shared/loop/constants/todo-status.d.ts +0 -9
- package/dist/shared/loop/index.d.ts +0 -6
- package/dist/shared/loop/interfaces/index.d.ts +0 -6
- package/dist/shared/loop/interfaces/mission-loop.d.ts +0 -29
- package/dist/shared/loop/interfaces/todo-stats.d.ts +0 -11
- package/dist/shared/loop/interfaces/todo.d.ts +0 -13
- package/dist/shared/loop/types/index.d.ts +0 -5
- package/dist/shared/loop/types/todo-priority.d.ts +0 -4
- package/dist/shared/loop/types/todo-status.d.ts +0 -4
- package/dist/shared/message/constants/index.d.ts +0 -8
- package/dist/shared/message/constants/message-roles.d.ts +0 -23
- package/dist/shared/message/constants/part-types.d.ts +0 -13
- package/dist/shared/message/constants/plugin-hooks.d.ts +0 -15
- package/dist/shared/message/constants/prompts.d.ts +0 -8
- package/dist/shared/message/constants/slash-commands.d.ts +0 -21
- package/dist/shared/message/index.d.ts +0 -4
- package/dist/shared/notification/constants/index.d.ts +0 -3
- package/dist/shared/notification/constants/toast-duration.d.ts +0 -19
- package/dist/shared/notification/constants/toast-variants.d.ts +0 -10
- package/dist/shared/notification/constants/tui.const.d.ts +0 -24
- package/dist/shared/notification/index.d.ts +0 -7
- package/dist/shared/notification/interfaces/index.d.ts +0 -6
- package/dist/shared/notification/interfaces/task-toast.interface.d.ts +0 -18
- package/dist/shared/notification/interfaces/toast-message.d.ts +0 -13
- package/dist/shared/notification/interfaces/toast-options.d.ts +0 -10
- package/dist/shared/notification/os-notify/constants/index.d.ts +0 -6
- package/dist/shared/notification/os-notify/constants/notification-command-keys.d.ts +0 -11
- package/dist/shared/notification/os-notify/constants/notification-commands.d.ts +0 -11
- package/dist/shared/notification/os-notify/constants/notification-defaults.d.ts +0 -5
- package/dist/shared/notification/os-notify/index.d.ts +0 -6
- package/dist/shared/notification/os-notify/interfaces/index.d.ts +0 -5
- package/dist/shared/notification/os-notify/interfaces/notification-config.d.ts +0 -15
- package/dist/shared/notification/os-notify/interfaces/notification-state.d.ts +0 -13
- package/dist/shared/notification/os-notify/types/index.d.ts +0 -4
- package/dist/shared/notification/os-notify/types/notification-commands.d.ts +0 -5
- package/dist/shared/notification/presets/index.d.ts +0 -9
- package/dist/shared/notification/presets/mission.d.ts +0 -5
- package/dist/shared/notification/presets/parallel.d.ts +0 -6
- package/dist/shared/notification/presets/session.d.ts +0 -6
- package/dist/shared/notification/presets/task-lifecycle.d.ts +0 -7
- package/dist/shared/notification/presets/tools.d.ts +0 -6
- package/dist/shared/notification/presets/warnings.d.ts +0 -7
- package/dist/shared/notification/types/index.d.ts +0 -4
- package/dist/shared/notification/types/toast-variant.d.ts +0 -4
- package/dist/shared/os/constants/index.d.ts +0 -4
- package/dist/shared/os/index.d.ts +0 -5
- package/dist/shared/os/types/index.d.ts +0 -4
- package/dist/shared/os/types/platform.d.ts +0 -5
- package/dist/shared/recovery/constants/history.d.ts +0 -11
- package/dist/shared/recovery/constants/index.d.ts +0 -6
- package/dist/shared/recovery/constants/recovery-level.d.ts +0 -15
- package/dist/shared/recovery/constants/recovery.d.ts +0 -13
- package/dist/shared/recovery/index.d.ts +0 -6
- package/dist/shared/recovery/interfaces/error-context.d.ts +0 -11
- package/dist/shared/recovery/interfaces/index.d.ts +0 -5
- package/dist/shared/recovery/interfaces/recovery-record.d.ts +0 -10
- package/dist/shared/recovery/types/index.d.ts +0 -4
- package/dist/shared/recovery/types/recovery-action.d.ts +0 -4
- package/dist/shared/verification/constants/categories.d.ts +0 -95
- package/dist/shared/verification/constants/checklist.d.ts +0 -16
- package/dist/shared/verification/constants/index.d.ts +0 -7
- package/dist/shared/verification/constants/patterns.d.ts +0 -19
- package/dist/shared/verification/constants/signals.d.ts +0 -10
- package/dist/shared/verification/index.d.ts +0 -8
- package/dist/shared/verification/interfaces/checklist-item.d.ts +0 -21
- package/dist/shared/verification/interfaces/checklist-verification-result.d.ts +0 -24
- package/dist/shared/verification/interfaces/index.d.ts +0 -7
- package/dist/shared/verification/interfaces/verification-checklist.d.ts +0 -19
- package/dist/shared/verification/interfaces/verification-result.d.ts +0 -29
- package/dist/shared/verification/types/checklist-category.d.ts +0 -18
- package/dist/shared/verification/types/index.d.ts +0 -4
- package/dist/tools/parallel/show-metrics.d.ts +0 -10
- package/dist/tools/parallel/update-todo.d.ts +0 -7
- package/dist/utils/compatibility/claude.d.ts +0 -9
- package/dist/utils/formatting/elapsed-time.d.ts +0 -4
- package/dist/utils/formatting/index.d.ts +0 -5
- package/dist/utils/formatting/timestamp.d.ts +0 -4
- package/dist/utils/parsing/index.d.ts +0 -4
- package/dist/utils/parsing/slash-command.d.ts +0 -7
- package/dist/utils/sanity/checker.d.ts +0 -8
- package/dist/utils/sanity/constants/escalation-prompt.d.ts +0 -4
- package/dist/utils/sanity/constants/index.d.ts +0 -6
- package/dist/utils/sanity/constants/recovery-prompt.d.ts +0 -4
- package/dist/utils/sanity/constants/severity.d.ts +0 -8
- package/dist/utils/sanity/index.d.ts +0 -7
- package/dist/utils/sanity/interfaces/index.d.ts +0 -4
- package/dist/utils/sanity/interfaces/sanity-result.d.ts +0 -9
- package/dist/utils/sanity/types/index.d.ts +0 -4
- package/dist/utils/sanity/types/severity.d.ts +0 -5
- /package/dist/{core/agents/consts/task-status.const.d.ts → shared/task/constants/task-status.d.ts} +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Recovery Event Handler
|
|
3
|
-
*
|
|
4
|
-
* Integrates with the OpenCode event system to automatically recover from session errors.
|
|
5
|
-
*
|
|
6
|
-
* Supported error types:
|
|
7
|
-
* - tool_result_missing: Tool crashed, inject error message
|
|
8
|
-
* - thinking_block_order: Thinking block ordering issue
|
|
9
|
-
* - rate_limit: API rate limiting
|
|
10
|
-
* - context_overflow: Token limit exceeded
|
|
11
|
-
*/
|
|
12
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
13
|
-
type OpencodeClient = PluginInput["client"];
|
|
14
|
-
/**
|
|
15
|
-
* Handle session error event and attempt recovery
|
|
16
|
-
*/
|
|
17
|
-
export declare function handleSessionError(client: OpencodeClient, sessionID: string, error: unknown, properties?: Record<string, unknown>): Promise<boolean>;
|
|
18
|
-
/**
|
|
19
|
-
* Mark that recovery is complete for a session
|
|
20
|
-
*/
|
|
21
|
-
export declare function markRecoveryComplete(sessionID: string): void;
|
|
22
|
-
/**
|
|
23
|
-
* Clean up session recovery state
|
|
24
|
-
*/
|
|
25
|
-
export declare function cleanupSessionRecovery(sessionID: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Check if session is currently recovering
|
|
28
|
-
*/
|
|
29
|
-
export declare function isSessionRecovering(sessionID: string): boolean;
|
|
30
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Interfaces - Index
|
|
3
|
-
*/
|
|
4
|
-
export type { SharedDocument } from "./shared-document.js";
|
|
5
|
-
export type { SharedFinding } from "./shared-finding.js";
|
|
6
|
-
export type { SharedDecision } from "./shared-decision.js";
|
|
7
|
-
export type { SharedContext } from "./shared-context.js";
|
|
8
|
-
export type { ContextStats } from "./context-stats.js";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Context Interface
|
|
3
|
-
*/
|
|
4
|
-
import type { SharedDocument } from "./shared-document.js";
|
|
5
|
-
import type { SharedFinding } from "./shared-finding.js";
|
|
6
|
-
import type { SharedDecision } from "./shared-decision.js";
|
|
7
|
-
export interface SharedContext {
|
|
8
|
-
sessionId: string;
|
|
9
|
-
parentId?: string;
|
|
10
|
-
documents: Map<string, SharedDocument>;
|
|
11
|
-
findings: SharedFinding[];
|
|
12
|
-
decisions: Map<string, SharedDecision>;
|
|
13
|
-
createdAt: Date;
|
|
14
|
-
updatedAt: Date;
|
|
15
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Shared Context
|
|
3
|
-
*
|
|
4
|
-
* Enables context sharing between parent and child sessions
|
|
5
|
-
*/
|
|
6
|
-
export type { SharedDocument, SharedFinding, SharedDecision, SharedContext, ContextStats, } from "./interfaces.js";
|
|
7
|
-
export { create, get, getMerged, addDocument, addFinding, addDecision, getChildren, clear, clearAll, getStats, } from "./store.js";
|
|
8
|
-
export { getSummary } from "./summary.js";
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context Store - Session context data management
|
|
3
|
-
*/
|
|
4
|
-
import type { SharedContext, SharedDocument, SharedFinding, SharedDecision, ContextStats } from "./interfaces.js";
|
|
5
|
-
/**
|
|
6
|
-
* Create a new shared context for a session
|
|
7
|
-
*/
|
|
8
|
-
export declare function create(sessionId: string, parentId?: string): SharedContext;
|
|
9
|
-
/**
|
|
10
|
-
* Get shared context for a session
|
|
11
|
-
*/
|
|
12
|
-
export declare function get(sessionId: string): SharedContext | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* Get merged context (includes parent context)
|
|
15
|
-
*/
|
|
16
|
-
export declare function getMerged(sessionId: string): SharedContext | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Add a document to the shared context
|
|
19
|
-
*/
|
|
20
|
-
export declare function addDocument(sessionId: string, doc: SharedDocument): void;
|
|
21
|
-
/**
|
|
22
|
-
* Add a finding to the shared context
|
|
23
|
-
*/
|
|
24
|
-
export declare function addFinding(sessionId: string, finding: Omit<SharedFinding, "id" | "timestamp">): void;
|
|
25
|
-
/**
|
|
26
|
-
* Record a decision
|
|
27
|
-
*/
|
|
28
|
-
export declare function addDecision(sessionId: string, decision: Omit<SharedDecision, "id" | "decidedAt">): void;
|
|
29
|
-
/**
|
|
30
|
-
* Get all child session IDs
|
|
31
|
-
*/
|
|
32
|
-
export declare function getChildren(parentId: string): string[];
|
|
33
|
-
/**
|
|
34
|
-
* Clear context for a session
|
|
35
|
-
*/
|
|
36
|
-
export declare function clear(sessionId: string): void;
|
|
37
|
-
/**
|
|
38
|
-
* Clear all contexts
|
|
39
|
-
*/
|
|
40
|
-
export declare function clearAll(): void;
|
|
41
|
-
/**
|
|
42
|
-
* Get stats
|
|
43
|
-
*/
|
|
44
|
-
export declare function getStats(): ContextStats;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
type OpencodeClient = PluginInput["client"];
|
|
3
|
-
interface TrackedTaskTodo {
|
|
4
|
-
id: string;
|
|
5
|
-
description: string;
|
|
6
|
-
status: string;
|
|
7
|
-
agent: string;
|
|
8
|
-
isBackground: boolean;
|
|
9
|
-
parentSessionID?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare class TodoSyncService {
|
|
12
|
-
private client;
|
|
13
|
-
private directory;
|
|
14
|
-
private todoPath;
|
|
15
|
-
private fileTodos;
|
|
16
|
-
private taskTodos;
|
|
17
|
-
private updateTimeout;
|
|
18
|
-
private watcher;
|
|
19
|
-
private pendingUpdates;
|
|
20
|
-
private batchTimer;
|
|
21
|
-
private readonly BATCH_WINDOW_MS;
|
|
22
|
-
private activeSessions;
|
|
23
|
-
constructor(client: OpencodeClient, directory: string);
|
|
24
|
-
start(): Promise<void>;
|
|
25
|
-
registerSession(sessionID: string): void;
|
|
26
|
-
unregisterSession(sessionID: string): void;
|
|
27
|
-
private reloadFileTodos;
|
|
28
|
-
/**
|
|
29
|
-
* Called by TaskToastManager when tasks change
|
|
30
|
-
*/
|
|
31
|
-
updateTaskStatus(task: TrackedTaskTodo): void;
|
|
32
|
-
removeTask(taskId: string): void;
|
|
33
|
-
private broadcastUpdate;
|
|
34
|
-
private scheduleUpdate;
|
|
35
|
-
/**
|
|
36
|
-
* Flush all pending updates in parallel batches
|
|
37
|
-
*/
|
|
38
|
-
private flushBatchedUpdates;
|
|
39
|
-
private sendTodosToSession;
|
|
40
|
-
stop(): void;
|
|
41
|
-
}
|
|
42
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Interfaces - Index
|
|
3
|
-
*/
|
|
4
|
-
export type { TaskNode, TaskStatus } from "./task-node.js";
|
|
5
|
-
export type { TaskHierarchy } from "./task-hierarchy.js";
|
|
6
|
-
export type { TaskProgress } from "./task-progress.js";
|
|
7
|
-
export type { TaskInput } from "./task-input.js";
|
|
8
|
-
export { TASK_STATUS } from "../../../shared/index.js";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Node Interface
|
|
3
|
-
*/
|
|
4
|
-
import type { ParallelTaskStatus } from "../../../shared/task/types/index.js";
|
|
5
|
-
export type TaskStatus = ParallelTaskStatus;
|
|
6
|
-
export interface TaskNode {
|
|
7
|
-
id: string;
|
|
8
|
-
description: string;
|
|
9
|
-
level: number;
|
|
10
|
-
parent?: string;
|
|
11
|
-
children: string[];
|
|
12
|
-
status: TaskStatus;
|
|
13
|
-
agent?: string;
|
|
14
|
-
parallelGroup?: string;
|
|
15
|
-
dependsOn: string[];
|
|
16
|
-
createdAt: Date;
|
|
17
|
-
startedAt?: Date;
|
|
18
|
-
completedAt?: Date;
|
|
19
|
-
result?: string;
|
|
20
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Parser - Parse hierarchy from Planner output
|
|
3
|
-
*/
|
|
4
|
-
import type { TaskHierarchy } from "./interfaces.js";
|
|
5
|
-
/**
|
|
6
|
-
* Parse task hierarchy from text (Planner output)
|
|
7
|
-
*/
|
|
8
|
-
export declare function parseFromText(sessionId: string, text: string): TaskHierarchy;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Scheduler - Execution order and dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { TaskNode } from "./interfaces.js";
|
|
5
|
-
/**
|
|
6
|
-
* Get next executable tasks (respecting dependencies)
|
|
7
|
-
*/
|
|
8
|
-
export declare function getNextTasks(sessionId: string): TaskNode[];
|
|
9
|
-
/**
|
|
10
|
-
* Get parallel group tasks that can run together
|
|
11
|
-
*/
|
|
12
|
-
export declare function getParallelBatch(sessionId: string, groupId: string): TaskNode[];
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Store - Hierarchy data management
|
|
3
|
-
*/
|
|
4
|
-
import type { TaskNode, TaskHierarchy, TaskInput, TaskStatus, TaskProgress } from "./interfaces.js";
|
|
5
|
-
/**
|
|
6
|
-
* Create a new task hierarchy
|
|
7
|
-
*/
|
|
8
|
-
export declare function create(sessionId: string, rootDescription: string): TaskHierarchy;
|
|
9
|
-
/**
|
|
10
|
-
* Get hierarchy for session
|
|
11
|
-
*/
|
|
12
|
-
export declare function getHierarchy(sessionId: string): TaskHierarchy | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* Add a task node
|
|
15
|
-
*/
|
|
16
|
-
export declare function addTask(sessionId: string, task: TaskInput): TaskNode;
|
|
17
|
-
/**
|
|
18
|
-
* Update task status
|
|
19
|
-
*/
|
|
20
|
-
export declare function updateStatus(sessionId: string, taskId: string, status: TaskStatus, result?: string): void;
|
|
21
|
-
/**
|
|
22
|
-
* Clear hierarchy
|
|
23
|
-
*/
|
|
24
|
-
export declare function clear(sessionId: string): void;
|
|
25
|
-
/**
|
|
26
|
-
* Check if all tasks are complete
|
|
27
|
-
*/
|
|
28
|
-
export declare function isComplete(sessionId: string): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Get progress statistics
|
|
31
|
-
*/
|
|
32
|
-
export declare function getProgress(sessionId: string): TaskProgress;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Decomposer
|
|
3
|
-
*
|
|
4
|
-
* Automatically decomposes complex tasks into hierarchical subtasks
|
|
5
|
-
*/
|
|
6
|
-
export type { TaskStatus, TaskNode, TaskHierarchy, TaskProgress, TaskInput, } from "./interfaces.js";
|
|
7
|
-
export { create, getHierarchy, addTask, updateStatus, clear, isComplete, getProgress, } from "./store.js";
|
|
8
|
-
export { getNextTasks, getParallelBatch, } from "./scheduler.js";
|
|
9
|
-
export { parseFromText } from "./parser.js";
|
|
10
|
-
export { getSummary } from "./summary.js";
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TodoManager - MVCC-based Optimistic Locking with Mutex for TODO Synchronization
|
|
3
|
-
*/
|
|
4
|
-
export interface TodoVersion {
|
|
5
|
-
version: number;
|
|
6
|
-
timestamp: number;
|
|
7
|
-
author: string;
|
|
8
|
-
}
|
|
9
|
-
export interface TodoData {
|
|
10
|
-
content: string;
|
|
11
|
-
version: TodoVersion;
|
|
12
|
-
}
|
|
13
|
-
export declare class TodoManager {
|
|
14
|
-
private static _instance;
|
|
15
|
-
private directory;
|
|
16
|
-
private todoPath;
|
|
17
|
-
private versionPath;
|
|
18
|
-
private historyPath;
|
|
19
|
-
private updateMutex;
|
|
20
|
-
private constructor();
|
|
21
|
-
static getInstance(directory?: string): TodoManager;
|
|
22
|
-
setDirectory(dir: string): void;
|
|
23
|
-
readWithVersion(): Promise<TodoData>;
|
|
24
|
-
/**
|
|
25
|
-
* Update TODO with both MVCC (for logical consistency) and Mutex (for atomicity)
|
|
26
|
-
*/
|
|
27
|
-
update(expectedVersion: number, updater: (content: string) => string, author: string): Promise<{
|
|
28
|
-
success: boolean;
|
|
29
|
-
currentVersion: number;
|
|
30
|
-
conflict?: boolean;
|
|
31
|
-
}>;
|
|
32
|
-
private _internalUpdate;
|
|
33
|
-
updateItem(searchText: string, newStatus: string, author?: string): Promise<boolean>;
|
|
34
|
-
addSubTask(parentText: string, subTaskText: string, author?: string): Promise<boolean>;
|
|
35
|
-
private logChange;
|
|
36
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Plugin Compatibility Hook
|
|
3
|
-
*
|
|
4
|
-
* Detects if other major plugins are present and ensures orchestrator plays nicely.
|
|
5
|
-
*/
|
|
6
|
-
import type { ChatMessageHook, AssistantDoneHook, HookContext } from "../types.js";
|
|
7
|
-
export declare class ExternalPluginCompatHook implements ChatMessageHook, AssistantDoneHook {
|
|
8
|
-
name: string;
|
|
9
|
-
execute(ctx: HookContext, input: any): Promise<any>;
|
|
10
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook Constants
|
|
3
|
-
* Defines strict constant values for hook actions and statuses.
|
|
4
|
-
*/
|
|
5
|
-
export declare const HOOK_ACTIONS: {
|
|
6
|
-
readonly CONTINUE: "continue";
|
|
7
|
-
readonly STOP: "stop";
|
|
8
|
-
readonly ALLOW: "allow";
|
|
9
|
-
readonly BLOCK: "block";
|
|
10
|
-
readonly MODIFY: "modify";
|
|
11
|
-
readonly INJECT: "inject";
|
|
12
|
-
readonly PROCESS: "process";
|
|
13
|
-
readonly INTERCEPT: "intercept";
|
|
14
|
-
};
|
|
15
|
-
export declare const HOOK_NAMES: {
|
|
16
|
-
readonly MEMORY_GATE: "MemoryGate";
|
|
17
|
-
readonly METRICS_TELEMETRY: "MetricsTelemetry";
|
|
18
|
-
readonly SANITY_CHECK: "SanityCheck";
|
|
19
|
-
readonly MISSION_LOOP: "MissionLoop";
|
|
20
|
-
readonly MISSION_CONTROL: "MissionControl";
|
|
21
|
-
readonly STRICT_ROLE_GUARD: "StrictRoleGuard";
|
|
22
|
-
readonly SECRET_SCANNER: "SecretScanner";
|
|
23
|
-
readonly AGENT_UI: "AgentUI";
|
|
24
|
-
readonly RESOURCE_CONTROL: "ResourceControl";
|
|
25
|
-
readonly USER_ACTIVITY: "UserActivity";
|
|
26
|
-
readonly SLASH_COMMAND: "SlashCommandDispatcher";
|
|
27
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent UI Hook
|
|
3
|
-
*
|
|
4
|
-
* Decorates tool outputs with UI elements:
|
|
5
|
-
* - Agent headers (e.g. [P] PLANNER Working...)
|
|
6
|
-
* - Task ID tracking
|
|
7
|
-
*/
|
|
8
|
-
import type { PostToolUseHook, HookContext } from "../types.js";
|
|
9
|
-
export declare class AgentUIHook implements PostToolUseHook {
|
|
10
|
-
name: "AgentUI";
|
|
11
|
-
execute(ctx: HookContext, tool: string, input: any, output: {
|
|
12
|
-
title: string;
|
|
13
|
-
output: string;
|
|
14
|
-
metadata: any;
|
|
15
|
-
}): Promise<{
|
|
16
|
-
output?: undefined;
|
|
17
|
-
} | {
|
|
18
|
-
output: string;
|
|
19
|
-
}>;
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MemoryGate Hook - Intercepts tool usage and turn completion to maintain memory.
|
|
3
|
-
*/
|
|
4
|
-
import { PostToolUseHook, AssistantDoneHook, HookContext } from "../types.js";
|
|
5
|
-
export declare class MemoryGateHook implements PostToolUseHook, AssistantDoneHook {
|
|
6
|
-
name: "MemoryGate";
|
|
7
|
-
private memoryManager;
|
|
8
|
-
execute(context: HookContext, toolOrText: string, input?: any, output?: {
|
|
9
|
-
title: string;
|
|
10
|
-
output: string;
|
|
11
|
-
metadata: any;
|
|
12
|
-
}): Promise<any>;
|
|
13
|
-
/**
|
|
14
|
-
* Post-Tool: Capture tool outputs to TASK memory
|
|
15
|
-
*/
|
|
16
|
-
private handlePostTool;
|
|
17
|
-
/**
|
|
18
|
-
* Assistant Done: Capture turn summary to MISSION memory if important
|
|
19
|
-
*/
|
|
20
|
-
private handleAssistantDone;
|
|
21
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MetricsHook - Collects telemetry during mission execution
|
|
3
|
-
*/
|
|
4
|
-
import { PreToolUseHook, PostToolUseHook, AssistantDoneHook, HookContext } from "../types.js";
|
|
5
|
-
export declare class MetricsHook implements PreToolUseHook, PostToolUseHook, AssistantDoneHook {
|
|
6
|
-
name: "MetricsTelemetry";
|
|
7
|
-
private startTimes;
|
|
8
|
-
private metrics;
|
|
9
|
-
execute(context: HookContext, toolOrText: string, input?: any, output?: {
|
|
10
|
-
title: string;
|
|
11
|
-
output: string;
|
|
12
|
-
metadata: any;
|
|
13
|
-
}): Promise<any>;
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resource Control Hook
|
|
3
|
-
*
|
|
4
|
-
* Unifies resource tracking, monitoring, and active memory compaction.
|
|
5
|
-
* Replaces separate ResourceUsageHook and MemoryCompactionHook.
|
|
6
|
-
*/
|
|
7
|
-
import type { PostToolUseHook, AssistantDoneHook, HookContext } from "../types.js";
|
|
8
|
-
export declare class ResourceControlHook implements PostToolUseHook, AssistantDoneHook {
|
|
9
|
-
name: "ResourceControl";
|
|
10
|
-
private lastCompactionTime;
|
|
11
|
-
execute(ctx: HookContext, toolOrText: string, input?: any, output?: any): Promise<any>;
|
|
12
|
-
private checkMemoryHealth;
|
|
13
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Secret Scanner Hook
|
|
3
|
-
*
|
|
4
|
-
* Scans tool outputs for potential secrets (API Keys, etc) and masks them.
|
|
5
|
-
* This prevents leaking secrets into the context window or logs.
|
|
6
|
-
*/
|
|
7
|
-
import type { PostToolUseHook, HookContext } from "../types.js";
|
|
8
|
-
export declare class SecretScannerHook implements PostToolUseHook {
|
|
9
|
-
name: "SecretScanner";
|
|
10
|
-
execute(ctx: HookContext, tool: string, input: any, output: {
|
|
11
|
-
title: string;
|
|
12
|
-
output: string;
|
|
13
|
-
metadata: any;
|
|
14
|
-
}): Promise<{
|
|
15
|
-
output: string;
|
|
16
|
-
} | {
|
|
17
|
-
output?: undefined;
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Strict Role Guard Hook
|
|
3
|
-
*
|
|
4
|
-
* Enforces role-based access control (RBAC) for agents.
|
|
5
|
-
* - Planner: Cannot write code or run commands.
|
|
6
|
-
* - Reviewer: Cannot write code (only review).
|
|
7
|
-
*/
|
|
8
|
-
import type { PreToolUseHook, HookContext } from "../types.js";
|
|
9
|
-
export declare class StrictRoleGuardHook implements PreToolUseHook {
|
|
10
|
-
name: "StrictRoleGuard";
|
|
11
|
-
execute(ctx: HookContext, tool: string, args: any): Promise<{
|
|
12
|
-
action: "block";
|
|
13
|
-
reason: "Fork bomb detected.";
|
|
14
|
-
} | {
|
|
15
|
-
action: "block";
|
|
16
|
-
reason: "Root deletion blocked.";
|
|
17
|
-
} | {
|
|
18
|
-
action: "allow";
|
|
19
|
-
reason?: undefined;
|
|
20
|
-
}>;
|
|
21
|
-
}
|