opencode-orchestrator 1.2.34 → 1.2.36
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 +91 -41
- package/dist/core/agents/agent-registry.d.ts +28 -0
- package/dist/core/agents/concurrency.d.ts +38 -0
- package/dist/core/agents/config.d.ts +9 -0
- package/dist/core/agents/consts/index.d.ts +4 -0
- package/dist/core/agents/index.d.ts +2 -3
- package/dist/core/agents/interfaces/session-pool.interface.d.ts +0 -7
- package/dist/core/agents/manager/event-handler.d.ts +35 -0
- package/dist/core/agents/manager/index.d.ts +10 -0
- package/dist/core/agents/manager/task-cleaner.d.ts +29 -0
- package/dist/core/agents/manager/task-launcher.d.ts +35 -0
- package/dist/core/agents/manager/task-poller.d.ts +28 -0
- package/dist/core/agents/manager/task-resumer.d.ts +18 -0
- package/dist/core/agents/manager.d.ts +41 -9
- package/dist/core/agents/persistence/task-wal.d.ts +26 -0
- package/dist/core/agents/session-pool.d.ts +0 -10
- package/dist/core/agents/task-store.d.ts +54 -0
- package/dist/core/cache/constants.d.ts +2 -2
- package/dist/core/cleanup/cleanup-scheduler.d.ts +11 -0
- package/dist/core/context/context-window-monitor.d.ts +66 -0
- package/dist/core/context/index.d.ts +6 -0
- package/dist/core/loop/formatters.d.ts +17 -0
- package/dist/core/loop/interfaces/index.d.ts +5 -0
- package/dist/core/loop/interfaces/todo-stats.d.ts +11 -0
- package/dist/core/loop/interfaces/todo.d.ts +13 -0
- package/dist/core/loop/interfaces.d.ts +7 -0
- package/dist/core/loop/mission-loop-handler.d.ts +25 -0
- package/dist/core/loop/mission-loop.d.ts +48 -0
- package/dist/core/loop/parser.d.ts +8 -0
- package/dist/core/loop/stats.d.ts +24 -0
- package/dist/core/loop/todo-continuation.d.ts +39 -0
- package/dist/core/loop/todo-enforcer.d.ts +9 -0
- package/dist/core/loop/todo-manager.d.ts +22 -0
- package/dist/core/loop/types/index.d.ts +5 -0
- package/dist/core/loop/types/todo-priority.d.ts +4 -0
- package/dist/core/loop/types/todo-status.d.ts +4 -0
- package/dist/core/loop/verification.d.ts +22 -0
- package/dist/core/memory/interfaces.d.ts +33 -0
- package/dist/core/memory/memory-manager.d.ts +40 -0
- package/dist/core/metrics/collector.d.ts +27 -0
- package/dist/core/notification/os-notify/index.d.ts +7 -0
- package/dist/core/notification/os-notify/notifier.d.ts +7 -0
- package/dist/core/notification/os-notify/platform-resolver.d.ts +7 -0
- package/dist/core/notification/os-notify/platform.d.ts +7 -0
- package/dist/core/notification/os-notify/sound-player.d.ts +7 -0
- package/dist/core/notification/os-notify/todo-checker.d.ts +5 -0
- package/dist/core/notification/task-toast-manager.d.ts +127 -0
- package/dist/core/notification/toast-core.d.ts +36 -0
- package/dist/core/notification/toast.d.ts +9 -0
- package/dist/core/orchestrator/index.d.ts +6 -0
- package/dist/core/orchestrator/interfaces/index.d.ts +4 -0
- package/dist/core/orchestrator/interfaces/session-state.d.ts +11 -0
- package/dist/core/orchestrator/session-manager.d.ts +31 -0
- package/dist/core/orchestrator/state.d.ts +10 -0
- package/dist/core/orchestrator/types/index.d.ts +4 -0
- package/dist/core/orchestrator/types/task-status.d.ts +5 -0
- package/dist/core/plugins/interfaces.d.ts +30 -0
- package/dist/core/plugins/plugin-manager.d.ts +21 -0
- package/dist/core/progress/calculator.d.ts +11 -0
- package/dist/core/progress/formatters.d.ts +20 -0
- package/dist/core/progress/interfaces/index.d.ts +8 -0
- package/dist/core/progress/interfaces/progress-snapshot.d.ts +15 -0
- package/dist/core/progress/interfaces/snapshot-input.d.ts +13 -0
- package/dist/core/progress/interfaces/step-progress.d.ts +7 -0
- package/dist/core/progress/interfaces/task-progress.d.ts +10 -0
- package/dist/core/progress/interfaces/todo-progress.d.ts +9 -0
- package/dist/core/progress/interfaces.d.ts +6 -0
- package/dist/core/progress/progress-notifier.d.ts +14 -0
- package/dist/core/progress/state-broadcaster.d.ts +29 -0
- package/dist/core/progress/store.d.ts +28 -0
- package/dist/core/progress/tracker.d.ts +11 -0
- package/dist/core/queue/async-queue.d.ts +46 -0
- package/dist/core/queue/async-utils.d.ts +20 -0
- package/dist/core/queue/index.d.ts +8 -0
- package/dist/core/queue/work-pool.d.ts +19 -0
- package/dist/core/recovery/auto-recovery.d.ts +9 -0
- package/dist/core/recovery/constants.d.ts +9 -0
- package/dist/core/recovery/handler.d.ts +27 -0
- package/dist/core/recovery/interfaces/error-context.d.ts +11 -0
- package/dist/core/recovery/interfaces/error-pattern.d.ts +10 -0
- package/dist/core/recovery/interfaces/index.d.ts +8 -0
- package/dist/core/recovery/interfaces/recovery-action.d.ts +25 -0
- package/dist/core/recovery/interfaces/recovery-record.d.ts +10 -0
- package/dist/core/recovery/interfaces/recovery-stats.d.ts +9 -0
- package/dist/core/recovery/interfaces.d.ts +6 -0
- package/dist/core/recovery/patterns.d.ts +8 -0
- package/dist/core/recovery/retry.d.ts +59 -0
- package/dist/core/recovery/session-recovery.d.ts +30 -0
- package/dist/core/session/interfaces/context-stats.d.ts +9 -0
- package/dist/core/session/interfaces/index.d.ts +8 -0
- package/dist/core/session/interfaces/shared-context.d.ts +15 -0
- package/dist/core/session/interfaces/shared-decision.d.ts +10 -0
- package/dist/core/session/interfaces/shared-document.d.ts +9 -0
- package/dist/core/session/interfaces/shared-finding.d.ts +10 -0
- package/dist/core/session/interfaces.d.ts +6 -0
- package/dist/core/session/shared-context.d.ts +8 -0
- package/dist/core/session/store.d.ts +44 -0
- package/dist/core/session/summary.d.ts +7 -0
- package/dist/core/sync/todo-parser.d.ts +5 -0
- package/dist/core/sync/todo-sync-service.d.ts +35 -0
- package/dist/core/task/interfaces/index.d.ts +8 -0
- package/dist/core/task/interfaces/task-hierarchy.d.ts +9 -0
- package/dist/core/task/interfaces/task-input.d.ts +11 -0
- package/dist/core/task/interfaces/task-node.d.ts +20 -0
- package/dist/core/task/interfaces/task-progress.d.ts +11 -0
- package/dist/core/task/interfaces.d.ts +6 -0
- package/dist/core/task/parser.d.ts +8 -0
- package/dist/core/task/scheduler.d.ts +12 -0
- package/dist/core/task/store.d.ts +32 -0
- package/dist/core/task/summary.d.ts +7 -0
- package/dist/core/task/task-decomposer.d.ts +10 -0
- package/dist/core/todo/todo-manager.d.ts +28 -0
- package/dist/hooks/compatibility/external-plugin.d.ts +10 -0
- package/dist/hooks/constants.d.ts +27 -0
- package/dist/hooks/custom/agent-ui.d.ts +20 -0
- package/dist/hooks/custom/memory-gate.d.ts +21 -0
- package/dist/hooks/custom/metrics.d.ts +14 -0
- package/dist/hooks/custom/resource-control.d.ts +13 -0
- package/dist/hooks/custom/secret-scanner.d.ts +19 -0
- package/dist/hooks/custom/strict-role-guard.d.ts +21 -0
- package/dist/hooks/custom/user-activity.d.ts +11 -0
- package/dist/hooks/features/mission-loop.d.ts +18 -0
- package/dist/hooks/features/sanity-check.d.ts +15 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/registry.d.ts +37 -0
- package/dist/hooks/types.d.ts +72 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +27219 -6229
- package/dist/plugin-handlers/assistant-done-handler.d.ts +12 -0
- package/dist/plugin-handlers/chat-message-handler.d.ts +30 -0
- package/dist/plugin-handlers/config-handler.d.ts +9 -0
- package/dist/plugin-handlers/event-handler.d.ts +18 -0
- package/dist/plugin-handlers/index.d.ts +9 -0
- package/dist/plugin-handlers/interfaces/assistant-done-context.d.ts +12 -0
- package/dist/plugin-handlers/interfaces/chat-message-context.d.ts +12 -0
- package/dist/plugin-handlers/interfaces/event-handler-context.d.ts +14 -0
- package/dist/plugin-handlers/interfaces/index.d.ts +12 -0
- package/dist/plugin-handlers/interfaces/orchestrator-state.d.ts +14 -0
- package/dist/plugin-handlers/interfaces/session-compacting.d.ts +19 -0
- package/dist/plugin-handlers/interfaces/session-state.d.ts +15 -0
- package/dist/plugin-handlers/interfaces/system-transform.d.ts +17 -0
- package/dist/plugin-handlers/interfaces/tool-execute-context.d.ts +8 -0
- package/dist/plugin-handlers/interfaces/tool-hook.d.ts +14 -0
- package/dist/plugin-handlers/session-compacting-handler.d.ts +14 -0
- package/dist/plugin-handlers/system-transform-handler.d.ts +14 -0
- package/dist/plugin-handlers/tool-execute-handler.d.ts +14 -0
- package/dist/plugin-handlers/tool-execute-pre-handler.d.ts +8 -0
- package/dist/scripts/postinstall.js +29 -125
- package/dist/shared/command/index.d.ts +0 -1
- package/dist/shared/constants/system-messages.d.ts +4 -4
- package/dist/shared/core/constants/index.d.ts +0 -4
- package/dist/shared/core/constants/paths.d.ts +16 -10
- package/dist/shared/errors/constants/error-patterns.d.ts +13 -0
- package/dist/shared/errors/constants/error-type.d.ts +13 -0
- package/dist/shared/errors/constants/index.d.ts +5 -0
- package/dist/shared/errors/detection.d.ts +5 -0
- package/dist/shared/errors/index.d.ts +7 -0
- package/dist/shared/errors/retry.d.ts +7 -0
- package/dist/shared/errors/types/error-pattern-type.d.ts +5 -0
- package/dist/shared/errors/types/index.d.ts +4 -0
- package/dist/shared/index.d.ts +9 -7
- package/dist/shared/loop/constants/index.d.ts +7 -0
- package/dist/shared/loop/constants/labels.d.ts +33 -0
- package/dist/shared/loop/constants/loop.d.ts +17 -0
- package/dist/shared/loop/constants/mission-control.d.ts +20 -0
- package/dist/shared/loop/constants/todo-status.d.ts +9 -0
- package/dist/shared/loop/index.d.ts +6 -0
- package/dist/shared/loop/interfaces/index.d.ts +6 -0
- package/dist/shared/loop/interfaces/mission-loop.d.ts +29 -0
- package/dist/shared/loop/interfaces/todo-stats.d.ts +11 -0
- package/dist/shared/loop/interfaces/todo.d.ts +13 -0
- package/dist/shared/loop/types/index.d.ts +5 -0
- package/dist/shared/loop/types/todo-priority.d.ts +4 -0
- package/dist/shared/loop/types/todo-status.d.ts +4 -0
- package/dist/shared/message/constants/index.d.ts +8 -0
- package/dist/shared/message/constants/message-roles.d.ts +23 -0
- package/dist/shared/message/constants/part-types.d.ts +13 -0
- package/dist/shared/message/constants/plugin-hooks.d.ts +15 -0
- package/dist/shared/message/constants/prompts.d.ts +8 -0
- package/dist/shared/message/constants/slash-commands.d.ts +21 -0
- package/dist/shared/message/index.d.ts +4 -0
- package/dist/shared/notification/constants/index.d.ts +3 -0
- package/dist/shared/notification/constants/toast-duration.d.ts +19 -0
- package/dist/shared/notification/constants/toast-variants.d.ts +10 -0
- package/dist/shared/notification/constants/tui.const.d.ts +24 -0
- package/dist/shared/notification/index.d.ts +7 -0
- package/dist/shared/notification/interfaces/index.d.ts +6 -0
- package/dist/shared/notification/interfaces/task-toast.interface.d.ts +18 -0
- package/dist/shared/notification/interfaces/toast-message.d.ts +13 -0
- package/dist/shared/notification/interfaces/toast-options.d.ts +10 -0
- package/dist/shared/notification/os-notify/constants/index.d.ts +6 -0
- package/dist/shared/notification/os-notify/constants/notification-command-keys.d.ts +11 -0
- package/dist/shared/notification/os-notify/constants/notification-commands.d.ts +11 -0
- package/dist/shared/notification/os-notify/constants/notification-defaults.d.ts +5 -0
- package/dist/shared/notification/os-notify/index.d.ts +6 -0
- package/dist/shared/notification/os-notify/interfaces/index.d.ts +5 -0
- package/dist/shared/notification/os-notify/interfaces/notification-config.d.ts +15 -0
- package/dist/shared/notification/os-notify/interfaces/notification-state.d.ts +13 -0
- package/dist/shared/notification/os-notify/types/index.d.ts +4 -0
- package/dist/shared/notification/os-notify/types/notification-commands.d.ts +5 -0
- package/dist/shared/notification/presets/index.d.ts +9 -0
- package/dist/shared/notification/presets/mission.d.ts +5 -0
- package/dist/shared/notification/presets/parallel.d.ts +6 -0
- package/dist/shared/notification/presets/session.d.ts +6 -0
- package/dist/shared/notification/presets/task-lifecycle.d.ts +7 -0
- package/dist/shared/notification/presets/tools.d.ts +6 -0
- package/dist/shared/notification/presets/warnings.d.ts +7 -0
- package/dist/shared/notification/types/index.d.ts +4 -0
- package/dist/shared/notification/types/toast-variant.d.ts +4 -0
- package/dist/shared/os/constants/index.d.ts +4 -0
- package/dist/shared/{core/constants/os.d.ts → os/constants/platform.d.ts} +3 -4
- package/dist/shared/os/index.d.ts +5 -0
- package/dist/shared/os/types/index.d.ts +4 -0
- package/dist/shared/os/types/platform.d.ts +5 -0
- package/dist/shared/prompt/constants/mandates.d.ts +1 -1
- package/dist/shared/prompt/constants/tags.d.ts +0 -4
- package/dist/shared/prompt/index.d.ts +0 -1
- package/dist/shared/recovery/constants/history.d.ts +11 -0
- package/dist/shared/recovery/constants/index.d.ts +6 -0
- package/dist/shared/recovery/constants/recovery-level.d.ts +15 -0
- package/dist/shared/recovery/constants/recovery.d.ts +13 -0
- package/dist/shared/recovery/index.d.ts +6 -0
- package/dist/shared/recovery/interfaces/error-context.d.ts +11 -0
- package/dist/shared/recovery/interfaces/index.d.ts +5 -0
- package/dist/shared/recovery/interfaces/recovery-record.d.ts +10 -0
- package/dist/shared/recovery/types/index.d.ts +4 -0
- package/dist/shared/recovery/types/recovery-action.d.ts +4 -0
- package/dist/shared/session/constants/events/index.d.ts +0 -5
- package/dist/shared/session/constants/index.d.ts +0 -2
- package/dist/shared/session/index.d.ts +0 -1
- package/dist/shared/task/constants/parallel-task.d.ts +4 -5
- package/dist/shared/todo/index.d.ts +4 -0
- package/dist/shared/todo/interfaces/index.d.ts +12 -0
- package/dist/shared/verification/constants/categories.d.ts +95 -0
- package/dist/shared/verification/constants/checklist.d.ts +16 -0
- package/dist/shared/verification/constants/index.d.ts +7 -0
- package/dist/shared/verification/constants/patterns.d.ts +19 -0
- package/dist/shared/verification/constants/signals.d.ts +10 -0
- package/dist/shared/verification/index.d.ts +8 -0
- package/dist/shared/verification/interfaces/checklist-item.d.ts +21 -0
- package/dist/shared/verification/interfaces/checklist-verification-result.d.ts +24 -0
- package/dist/shared/verification/interfaces/index.d.ts +7 -0
- package/dist/shared/verification/interfaces/verification-checklist.d.ts +19 -0
- package/dist/shared/verification/interfaces/verification-result.d.ts +29 -0
- package/dist/shared/verification/types/checklist-category.d.ts +18 -0
- package/dist/shared/verification/types/index.d.ts +4 -0
- package/dist/tools/parallel/list-agents.d.ts +1 -1
- package/dist/tools/parallel/show-metrics.d.ts +10 -0
- package/dist/tools/parallel/update-todo.d.ts +7 -0
- package/dist/tools/slashCommand.d.ts +1 -1
- package/dist/utils/common.d.ts +5 -3
- package/dist/utils/compatibility/claude.d.ts +9 -0
- package/dist/utils/formatting/elapsed-time.d.ts +4 -0
- package/dist/utils/formatting/index.d.ts +5 -0
- package/dist/utils/formatting/timestamp.d.ts +4 -0
- package/dist/utils/parsing/index.d.ts +4 -0
- package/dist/utils/parsing/slash-command.d.ts +7 -0
- package/dist/utils/sanity/checker.d.ts +8 -0
- package/dist/utils/sanity/constants/escalation-prompt.d.ts +4 -0
- package/dist/utils/sanity/constants/index.d.ts +6 -0
- package/dist/utils/sanity/constants/recovery-prompt.d.ts +4 -0
- package/dist/utils/sanity/constants/severity.d.ts +8 -0
- package/dist/utils/sanity/index.d.ts +7 -0
- package/dist/utils/sanity/interfaces/index.d.ts +4 -0
- package/dist/utils/sanity/interfaces/sanity-result.d.ts +9 -0
- package/dist/utils/sanity/types/index.d.ts +4 -0
- package/dist/utils/sanity/types/severity.d.ts +5 -0
- package/package.json +3 -3
- package/dist/core/agents/adaptive-concurrency.d.ts +0 -57
- package/dist/core/agents/unified-task-executor.d.ts +0 -27
- package/dist/core/mission/mission-controller.d.ts +0 -53
- package/dist/core/resource/resource-tracker.d.ts +0 -61
- package/dist/shared/command/constants/names.d.ts +0 -8
- package/dist/shared/core/constants/labels.d.ts +0 -12
- package/dist/shared/core/constants/mission.d.ts +0 -8
- package/dist/shared/core/constants/signals.d.ts +0 -22
- package/dist/shared/prompt/constants/prompts.d.ts +0 -7
- package/dist/shared/session/constants/events/hook-events.d.ts +0 -9
- package/dist/shared/session/constants/message.d.ts +0 -15
- package/dist/shared/session/constants/status.d.ts +0 -9
- /package/dist/{shared/task/constants/task-status.d.ts → core/agents/consts/task-status.const.d.ts} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Handlers - Assistant Done Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles assistant.done hook:
|
|
5
|
+
* - Delegates to HookRegistry
|
|
6
|
+
*/
|
|
7
|
+
import type { AssistantDoneHandlerContext } from "./interfaces/index.js";
|
|
8
|
+
export type { AssistantDoneHandlerContext } from "./interfaces/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* Create assistant.done handler
|
|
11
|
+
*/
|
|
12
|
+
export declare function createAssistantDoneHandler(ctx: AssistantDoneHandlerContext): (assistantInput: any, assistantOutput: any) => Promise<void>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Message Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles chat.message hook:
|
|
5
|
+
* - Intercepting commands
|
|
6
|
+
* - Setting up sessions
|
|
7
|
+
* - Auto-applying mission mode for Commander
|
|
8
|
+
*/
|
|
9
|
+
import type { ChatMessageHandlerContext } from "./interfaces/index.js";
|
|
10
|
+
export type { ChatMessageHandlerContext } from "./interfaces/index.js";
|
|
11
|
+
type ChatHookInput = {
|
|
12
|
+
sessionID: string;
|
|
13
|
+
agent?: string;
|
|
14
|
+
model?: {
|
|
15
|
+
providerID: string;
|
|
16
|
+
modelID: string;
|
|
17
|
+
};
|
|
18
|
+
messageID?: string;
|
|
19
|
+
variant?: string;
|
|
20
|
+
};
|
|
21
|
+
type ChatHookOutput = {
|
|
22
|
+
parts: Array<{
|
|
23
|
+
type: string;
|
|
24
|
+
text?: string;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Create chat.message handler
|
|
29
|
+
*/
|
|
30
|
+
export declare function createChatMessageHandler(ctx: ChatMessageHandlerContext): (msgInput: ChatHookInput, msgOutput: ChatHookOutput) => Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles OpenCode session events:
|
|
5
|
+
* - session.created, session.deleted, session.error, session.idle
|
|
6
|
+
* - message.updated
|
|
7
|
+
*/
|
|
8
|
+
import type { EventHandlerContext } from "./interfaces/index.js";
|
|
9
|
+
export type { SessionState, OrchestratorState, EventHandlerContext } from "./interfaces/index.js";
|
|
10
|
+
/**
|
|
11
|
+
* Create event handler for session events
|
|
12
|
+
*/
|
|
13
|
+
export declare function createEventHandler(ctx: EventHandlerContext): (input: {
|
|
14
|
+
event: {
|
|
15
|
+
type: string;
|
|
16
|
+
properties?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./chat-message-handler.js";
|
|
2
|
+
export * from "./config-handler.js";
|
|
3
|
+
export * from "./event-handler.js";
|
|
4
|
+
export * from "./tool-execute-handler.js";
|
|
5
|
+
export * from "./tool-execute-pre-handler.js";
|
|
6
|
+
export * from "./assistant-done-handler.js";
|
|
7
|
+
export * from "./session-compacting-handler.js";
|
|
8
|
+
export * from "./system-transform-handler.js";
|
|
9
|
+
export * from "./interfaces/index.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assistant Done Handler Context
|
|
3
|
+
*/
|
|
4
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
5
|
+
import type { SessionState } from "./session-state.js";
|
|
6
|
+
type OpencodeClient = PluginInput["client"];
|
|
7
|
+
export interface AssistantDoneHandlerContext {
|
|
8
|
+
client: OpencodeClient;
|
|
9
|
+
directory: string;
|
|
10
|
+
sessions: Map<string, SessionState>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Message Handler Context
|
|
3
|
+
*/
|
|
4
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
5
|
+
import type { SessionState } from "./session-state.js";
|
|
6
|
+
type OpencodeClient = PluginInput["client"];
|
|
7
|
+
export interface ChatMessageHandlerContext {
|
|
8
|
+
client: OpencodeClient;
|
|
9
|
+
directory: string;
|
|
10
|
+
sessions: Map<string, SessionState>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Handler Context
|
|
3
|
+
*/
|
|
4
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
5
|
+
import type { SessionState } from "./session-state.js";
|
|
6
|
+
import type { OrchestratorState } from "./orchestrator-state.js";
|
|
7
|
+
type OpencodeClient = PluginInput["client"];
|
|
8
|
+
export interface EventHandlerContext {
|
|
9
|
+
client: OpencodeClient;
|
|
10
|
+
directory: string;
|
|
11
|
+
sessions: Map<string, SessionState>;
|
|
12
|
+
state: OrchestratorState;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Handlers Interfaces - Index
|
|
3
|
+
*/
|
|
4
|
+
export type { SessionState } from "./session-state.js";
|
|
5
|
+
export type { OrchestratorState } from "./orchestrator-state.js";
|
|
6
|
+
export type { EventHandlerContext } from "./event-handler-context.js";
|
|
7
|
+
export type { ChatMessageHandlerContext } from "./chat-message-context.js";
|
|
8
|
+
export type { ToolExecuteHandlerContext } from "./tool-execute-context.js";
|
|
9
|
+
export type { ToolHookInput, ToolHookOutput } from "./tool-hook";
|
|
10
|
+
export type { AssistantDoneHandlerContext } from "./assistant-done-context.js";
|
|
11
|
+
export type { SessionCompactingInput, SessionCompactingOutput } from "./session-compacting.js";
|
|
12
|
+
export type { SystemTransformInput, SystemTransformOutput } from "./system-transform.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator State Interface
|
|
3
|
+
*/
|
|
4
|
+
export interface OrchestratorState {
|
|
5
|
+
missionActive: boolean;
|
|
6
|
+
sessions: Map<string, {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
iterations: number;
|
|
9
|
+
taskRetries: Map<string, number>;
|
|
10
|
+
currentTask: string;
|
|
11
|
+
anomalyCount: number;
|
|
12
|
+
lastHealthyOutput?: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Compacting Handler Interfaces
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Input for session compacting hook
|
|
6
|
+
*/
|
|
7
|
+
export interface SessionCompactingInput {
|
|
8
|
+
/** Session ID being compacted */
|
|
9
|
+
sessionID: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Output for session compacting hook
|
|
13
|
+
*/
|
|
14
|
+
export interface SessionCompactingOutput {
|
|
15
|
+
/** Additional context strings to append to compaction prompt */
|
|
16
|
+
context: string[];
|
|
17
|
+
/** Optional: Replace the default compaction prompt entirely */
|
|
18
|
+
prompt?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session State Interface
|
|
3
|
+
*/
|
|
4
|
+
export interface SessionState {
|
|
5
|
+
active: boolean;
|
|
6
|
+
step: number;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
startTime: number;
|
|
9
|
+
lastStepTime: number;
|
|
10
|
+
tokens: {
|
|
11
|
+
totalInput: number;
|
|
12
|
+
totalOutput: number;
|
|
13
|
+
estimatedCost: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System Transform Handler Interfaces
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Input for system transform hook
|
|
6
|
+
*/
|
|
7
|
+
export interface SystemTransformInput {
|
|
8
|
+
/** Session ID for the chat */
|
|
9
|
+
sessionID: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Output for system transform hook
|
|
13
|
+
*/
|
|
14
|
+
export interface SystemTransformOutput {
|
|
15
|
+
/** System prompt strings to inject */
|
|
16
|
+
system: string[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Hook Interfaces
|
|
3
|
+
*/
|
|
4
|
+
export interface ToolHookInput {
|
|
5
|
+
tool: string;
|
|
6
|
+
sessionID: string;
|
|
7
|
+
callID: string;
|
|
8
|
+
arguments?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface ToolHookOutput {
|
|
11
|
+
title: string;
|
|
12
|
+
output: string;
|
|
13
|
+
metadata: Record<string, unknown>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Compacting Handler
|
|
3
|
+
*
|
|
4
|
+
* Hook: experimental.session.compacting
|
|
5
|
+
*
|
|
6
|
+
* Preserves mission state during context compaction by injecting
|
|
7
|
+
* additional context into the compaction prompt.
|
|
8
|
+
*/
|
|
9
|
+
import type { EventHandlerContext, SessionCompactingInput, SessionCompactingOutput } from "./interfaces/index.js";
|
|
10
|
+
export type { SessionCompactingInput, SessionCompactingOutput } from "./interfaces/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Create session compacting handler that preserves mission context
|
|
13
|
+
*/
|
|
14
|
+
export declare function createSessionCompactingHandler(ctx: EventHandlerContext): (input: SessionCompactingInput, output: SessionCompactingOutput) => Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System Transform Handler
|
|
3
|
+
*
|
|
4
|
+
* Hook: experimental.chat.system.transform
|
|
5
|
+
*
|
|
6
|
+
* Dynamically injects agent-specific system prompts based on the current
|
|
7
|
+
* session context and orchestrator state.
|
|
8
|
+
*/
|
|
9
|
+
import type { EventHandlerContext, SystemTransformInput, SystemTransformOutput } from "./interfaces/index.js";
|
|
10
|
+
export type { SystemTransformInput, SystemTransformOutput } from "./interfaces/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Create system transform handler for dynamic prompt injection
|
|
13
|
+
*/
|
|
14
|
+
export declare function createSystemTransformHandler(ctx: EventHandlerContext): (input: SystemTransformInput, output: SystemTransformOutput) => Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Execute Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles tool.execute.after hook:
|
|
5
|
+
* - Sanity checks for LLM output
|
|
6
|
+
* - Task status tracking
|
|
7
|
+
* - Progress display
|
|
8
|
+
*/
|
|
9
|
+
import type { ToolExecuteHandlerContext, ToolHookInput, ToolHookOutput } from "./interfaces/index.js";
|
|
10
|
+
export type { ToolExecuteHandlerContext } from "./interfaces/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Create tool.execute.after handler
|
|
13
|
+
*/
|
|
14
|
+
export declare function createToolExecuteAfterHandler(ctx: ToolExecuteHandlerContext): (toolInput: ToolHookInput, toolOutput: ToolHookOutput) => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-Tool Execute Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles tool.execute.before hook.
|
|
5
|
+
* Used for blocking prohibited actions based on agent roles via Hooks.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolExecuteHandlerContext, ToolHookInput } from "./interfaces/index.js";
|
|
8
|
+
export declare function createToolExecuteBeforeHandler(ctx: ToolExecuteHandlerContext): (toolInput: ToolHookInput) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// scripts/postinstall.ts
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, appendFileSync
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, appendFileSync } from "fs";
|
|
5
5
|
import { homedir, tmpdir } from "os";
|
|
6
6
|
import { join } from "path";
|
|
7
7
|
var LOG_FILE = join(tmpdir(), "opencode-orchestrator.log");
|
|
@@ -57,170 +57,74 @@ function getConfigPaths() {
|
|
|
57
57
|
}
|
|
58
58
|
return paths;
|
|
59
59
|
}
|
|
60
|
-
function createBackup(configFile) {
|
|
61
|
-
try {
|
|
62
|
-
if (!existsSync(configFile)) return true;
|
|
63
|
-
const backupFile = `${configFile}.backup.${Date.now()}`;
|
|
64
|
-
const content = readFileSync(configFile, "utf-8");
|
|
65
|
-
writeFileSync(backupFile, content);
|
|
66
|
-
log("Backup created", { backupFile });
|
|
67
|
-
return true;
|
|
68
|
-
} catch (err) {
|
|
69
|
-
log("Backup creation failed", { error: String(err) });
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
60
|
function registerInConfig(configDir) {
|
|
74
61
|
const configFile = join(configDir, "opencode.json");
|
|
75
62
|
try {
|
|
76
63
|
if (!existsSync(configDir)) {
|
|
77
64
|
mkdirSync(configDir, { recursive: true });
|
|
78
|
-
log("Config directory created", { configDir });
|
|
79
65
|
}
|
|
80
66
|
let config = {};
|
|
81
|
-
let isNewFile = false;
|
|
82
67
|
if (existsSync(configFile)) {
|
|
83
68
|
try {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
config = {};
|
|
87
|
-
log("Empty config file detected, creating new config");
|
|
88
|
-
} else {
|
|
89
|
-
config = JSON.parse(content);
|
|
90
|
-
log("Existing config loaded", { keys: Object.keys(config) });
|
|
91
|
-
}
|
|
92
|
-
} catch (parseErr) {
|
|
93
|
-
log("Config parse error, creating backup", { error: String(parseErr) });
|
|
94
|
-
createBackup(configFile);
|
|
69
|
+
config = JSON.parse(readFileSync(configFile, "utf-8"));
|
|
70
|
+
} catch {
|
|
95
71
|
config = {};
|
|
96
72
|
}
|
|
97
|
-
} else {
|
|
98
|
-
isNewFile = true;
|
|
99
|
-
log("No config file found, creating new");
|
|
100
73
|
}
|
|
101
74
|
if (!config.plugin) {
|
|
102
75
|
config.plugin = [];
|
|
103
76
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return
|
|
111
|
-
});
|
|
112
|
-
if (hasPlugin) {
|
|
113
|
-
log("Plugin already registered", { plugins: config.plugin });
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
config.plugin.push(PLUGIN_NAME);
|
|
117
|
-
if (!config.$schema) {
|
|
118
|
-
config.$schema = "https://opencode.ai/config.json";
|
|
77
|
+
const hasPlugin = config.plugin.some(
|
|
78
|
+
(p) => p.includes(PLUGIN_NAME)
|
|
79
|
+
);
|
|
80
|
+
if (!hasPlugin) {
|
|
81
|
+
config.plugin.push(PLUGIN_NAME);
|
|
82
|
+
writeFileSync(configFile, JSON.stringify(config, null, 2) + "\n");
|
|
83
|
+
return true;
|
|
119
84
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
const configContent = JSON.stringify(config, null, 2) + "\n";
|
|
124
|
-
writeFileSync(configFile, configContent, { encoding: "utf-8", mode: 420 });
|
|
125
|
-
log("Config written successfully", {
|
|
126
|
-
configFile,
|
|
127
|
-
isNewFile,
|
|
128
|
-
plugins: config.plugin,
|
|
129
|
-
allKeys: Object.keys(config)
|
|
130
|
-
});
|
|
131
|
-
return true;
|
|
132
|
-
} catch (err) {
|
|
133
|
-
log("registerInConfig failed", {
|
|
134
|
-
error: String(err),
|
|
135
|
-
code: err.code
|
|
136
|
-
});
|
|
85
|
+
return false;
|
|
86
|
+
} catch {
|
|
137
87
|
return false;
|
|
138
88
|
}
|
|
139
89
|
}
|
|
140
90
|
try {
|
|
141
91
|
console.log("\u{1F3AF} OpenCode Orchestrator - Installing...");
|
|
142
|
-
|
|
143
|
-
log("Installation started", { platform: process.platform, node: process.version });
|
|
92
|
+
log("Installation started", { platform: process.platform });
|
|
144
93
|
const configPaths = getConfigPaths();
|
|
145
94
|
log("Config paths to check", configPaths);
|
|
146
95
|
let registered = false;
|
|
147
96
|
let alreadyRegistered = false;
|
|
148
|
-
let configsChecked = 0;
|
|
149
|
-
let registeredPath = "";
|
|
150
97
|
for (const configDir of configPaths) {
|
|
151
98
|
const configFile = join(configDir, "opencode.json");
|
|
152
|
-
configsChecked++;
|
|
153
99
|
if (existsSync(configFile)) {
|
|
154
100
|
try {
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
console.log(`\u2705 Already registered in: ${configFile}`);
|
|
160
|
-
log("Already registered", { configFile });
|
|
161
|
-
alreadyRegistered = true;
|
|
162
|
-
registeredPath = configFile;
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
101
|
+
const config = JSON.parse(readFileSync(configFile, "utf-8"));
|
|
102
|
+
if (config.plugin?.some((p) => p.includes(PLUGIN_NAME))) {
|
|
103
|
+
alreadyRegistered = true;
|
|
104
|
+
continue;
|
|
165
105
|
}
|
|
166
|
-
} catch
|
|
167
|
-
log("Parse error checking existing config", { configFile, error: String(err) });
|
|
106
|
+
} catch {
|
|
168
107
|
}
|
|
169
108
|
}
|
|
170
109
|
if (registerInConfig(configDir)) {
|
|
171
|
-
console.log(`\u2705 Plugin registered
|
|
172
|
-
console.log(" \u{1F4DD} Your existing settings have been preserved");
|
|
173
|
-
try {
|
|
174
|
-
const files = readdirSync(configDir);
|
|
175
|
-
const hasBackup = files.some((f) => f.startsWith("opencode.json.backup."));
|
|
176
|
-
if (hasBackup) {
|
|
177
|
-
console.log(" \u{1F4BE} Backup created for safety");
|
|
178
|
-
}
|
|
179
|
-
} catch {
|
|
180
|
-
}
|
|
110
|
+
console.log(`\u2705 Plugin registered: ${configFile}`);
|
|
181
111
|
log("Plugin registered successfully", { configFile });
|
|
182
112
|
registered = true;
|
|
183
|
-
registeredPath = configFile;
|
|
184
|
-
break;
|
|
185
113
|
}
|
|
186
114
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
console.log(` Config file: ${registeredPath}`);
|
|
194
|
-
} else {
|
|
195
|
-
console.log("\u26A0\uFE0F Could not register plugin automatically.");
|
|
196
|
-
console.log("");
|
|
197
|
-
console.log(" Please manually add to your OpenCode config:");
|
|
198
|
-
console.log(` ${configPaths[0]}/opencode.json`);
|
|
199
|
-
console.log("");
|
|
200
|
-
console.log(" Add this line:");
|
|
201
|
-
console.log(` "plugin": ["${PLUGIN_NAME}"]`);
|
|
202
|
-
console.log("");
|
|
203
|
-
log("Failed to register plugin in any location", { configsChecked, paths: configPaths });
|
|
115
|
+
if (!registered && alreadyRegistered) {
|
|
116
|
+
console.log("\u2705 Plugin already registered.");
|
|
117
|
+
log("Plugin was already registered");
|
|
118
|
+
} else if (!registered) {
|
|
119
|
+
console.log("\u26A0\uFE0F Could not register plugin in any config location.");
|
|
120
|
+
log("Failed to register plugin in any location");
|
|
204
121
|
}
|
|
205
122
|
console.log("");
|
|
206
|
-
console.log("\u{1F680}
|
|
207
|
-
console.log(" 1. Restart OpenCode");
|
|
208
|
-
console.log(" 2. Try /task command in your project");
|
|
123
|
+
console.log("\u{1F680} Ready! Restart OpenCode to use.");
|
|
209
124
|
console.log("");
|
|
210
|
-
log("Installation completed", {
|
|
211
|
-
registered,
|
|
212
|
-
alreadyRegistered,
|
|
213
|
-
configsChecked,
|
|
214
|
-
registeredPath
|
|
215
|
-
});
|
|
125
|
+
log("Installation completed", { registered, alreadyRegistered });
|
|
216
126
|
} catch (error) {
|
|
217
|
-
|
|
218
|
-
console.error("
|
|
219
|
-
console.error(" " + formatError(error, "register plugin"));
|
|
220
|
-
console.log("");
|
|
221
|
-
console.log(" Please report this issue at:");
|
|
222
|
-
console.log(" https://github.com/agnusdei1207/opencode-orchestrator/issues");
|
|
223
|
-
console.log("");
|
|
224
|
-
log("Installation error", { error: String(error), stack: error instanceof Error ? error.stack : void 0 });
|
|
127
|
+
log("Installation error", { error: String(error) });
|
|
128
|
+
console.error(formatError(error, "register plugin"));
|
|
225
129
|
process.exit(0);
|
|
226
130
|
}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Centralized storage for long prompt templates, user messages, and notifications.
|
|
5
5
|
*/
|
|
6
6
|
export declare const MISSION_MESSAGES: {
|
|
7
|
-
readonly START_LOG: "[
|
|
8
|
-
readonly CANCEL_LOG: "[
|
|
9
|
-
readonly COMPLETE_LOG: "[
|
|
7
|
+
readonly START_LOG: "[mission-loop] Detected /task command. Starting mission...";
|
|
8
|
+
readonly CANCEL_LOG: "[mission-loop] Detected user cancellation signal.";
|
|
9
|
+
readonly COMPLETE_LOG: "[mission-loop] Mission Verified! Finishing loop.";
|
|
10
10
|
readonly TOAST_COMPLETE_TITLE: "Mission Complete";
|
|
11
11
|
readonly TOAST_COMPLETE_MESSAGE: "Mission verified and finished.";
|
|
12
12
|
readonly STOP_TRIGGER: "STOP MISSION";
|
|
@@ -21,5 +21,5 @@ export declare const MISSION_MESSAGES: {
|
|
|
21
21
|
};
|
|
22
22
|
export declare const COMPACTION_PROMPT: string;
|
|
23
23
|
export declare const CONTINUE_INSTRUCTION: string;
|
|
24
|
-
export declare const STAGNATION_INTERVENTION = "\n<system_intervention type=\"stagnation_detected\">\n\u26A0\uFE0F
|
|
24
|
+
export declare const STAGNATION_INTERVENTION = "\n<system_intervention type=\"stagnation_detected\">\n\u26A0\uFE0F **\uACBD\uACE0: \uC9C4\uD589 \uC815\uCCB4 \uAC10\uC9C0 (STAGNATION DETECTED)**\n\uCD5C\uADFC \uC5EC\uB7EC \uD134 \uB3D9\uC548 \uC2E4\uC9C8\uC801\uC778 \uC9C4\uC804\uC774 \uAC10\uC9C0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uB2E8\uC21C \"\uBAA8\uB2C8\uD130\uB9C1\"\uC774\uB098 \uAC19\uC740 \uD589\uB3D9\uC744 \uBC18\uBCF5\uD558\uB294 \uAC83\uC740 \uAE08\uC9C0\uB429\uB2C8\uB2E4.\n\n**\uC790\uC728\uC801 \uC9C4\uB2E8 \uBC0F \uD574\uACB0 \uC9C0\uCE68:**\n1. **\uC2E4\uC2DC\uAC04 \uB85C\uADF8 \uD655\uC778**: `check_background_task` \uB610\uB294 `read_file`\uC744 \uC0AC\uC6A9\uD558\uC5EC \uC9C4\uD589 \uC911\uC778 \uC791\uC5C5\uC758 \uCD9C\uB825 \uB85C\uADF8\uB97C \uC9C1\uC811 \uD655\uC778\uD558\uC2ED\uC2DC\uC624.\n2. **\uD504\uB85C\uC138\uC2A4 \uC0DD\uC874 \uC9C4\uB2E8**: \uC791\uC5C5\uC774 \uC880\uBE44 \uC0C1\uD0DC\uC774\uAC70\uB098 \uBA48\uCD98 \uAC83 \uAC19\uB2E4\uBA74 \uACFC\uAC10\uD558\uAC8C `kill`\uD558\uACE0 \uB2E8\uACC4\uB97C \uC138\uBD84\uD654\uD558\uC5EC \uB2E4\uC2DC \uC2E4\uD589\uD558\uC2ED\uC2DC\uC624.\n3. **\uC804\uB7B5 \uC804\uD658**: \uB3D9\uC77C\uD55C \uC811\uADFC \uBC29\uC2DD\uC774 \uC2E4\uD328\uD558\uACE0 \uC788\uB2E4\uBA74, \uB2E4\uB978 \uB3C4\uAD6C\uB098 \uBC29\uBC95\uC744 \uC0AC\uC6A9\uD558\uC5EC \uBAA9\uD45C\uC5D0 \uB3C4\uB2EC\uD558\uC2ED\uC2DC\uC624.\n\n**\uC9C0\uAE08 \uBC14\uB85C \uB2A5\uB3D9\uC801\uC73C\uB85C \uAC1C\uC785\uD558\uC2ED\uC2DC\uC624. \uB300\uAE30\uD558\uC9C0 \uB9C8\uC2ED\uC2DC\uC624.**\n</system_intervention>";
|
|
25
25
|
export declare const CLEANUP_INSTRUCTION = "\n<system_maintenance type=\"continuous_hygiene\">\n\uD83E\uDDF9 **DOCUMENTATION & STATE HYGIENE (Iteration %ITER%)**\nYou must maintain a pristine workspace. **As part of your move**, perform these checks:\n\n1. **Relevance Assessment**:\n - Review active documents (`.opencode/*.md`). Are they needed for the *current* objective?\n - If a file represents a solved problem or obsolete context, **Archive it** to `.opencode/archive/` or delete it.\n\n2. **Synchronization**:\n - Verify `TODO.md` matches the actual code state. Mark completed items immediately.\n - Check `sync-issues.md`. If issues are resolved, remove them.\n\n3. **Context Optimization**:\n - If `work-log.md` is getting noisy, summarize key decisions into `summary.md` and truncate the log.\n - Keep context lightweight.\n\n**Rule**: A cluttered workspace leads to hallucinations. Clean as you go.\n</system_maintenance>\n";
|
|
@@ -9,9 +9,5 @@ export { STATUS_LABEL, type TaskStatus } from "./status-labels.js";
|
|
|
9
9
|
export { LIMITS } from "./limits.js";
|
|
10
10
|
export { WAL_ACTIONS } from "./wal-actions.js";
|
|
11
11
|
export { PHASES } from "./phases.js";
|
|
12
|
-
export * from "./signals.js";
|
|
13
|
-
export * from "./os.js";
|
|
14
|
-
export * from "./labels.js";
|
|
15
|
-
export * from "./mission.js";
|
|
16
12
|
export { MEMORY_CONSTANTS, HOOK_NAMES, TODO_CONSTANTS, TUI_CONSTANTS } from "./memory-hooks.js";
|
|
17
13
|
export * from "./cli.js";
|
|
@@ -3,19 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare const PATHS: {
|
|
5
5
|
readonly OPENCODE: ".opencode";
|
|
6
|
-
readonly
|
|
6
|
+
readonly MISSION_ROOT: ".opencode/mission";
|
|
7
|
+
readonly TODO: ".opencode/mission/todo.md";
|
|
8
|
+
readonly CONTEXT: ".opencode/mission/context.md";
|
|
9
|
+
readonly SUMMARY: ".opencode/mission/summary.md";
|
|
10
|
+
readonly WORK_LOG: ".opencode/mission/work-log.md";
|
|
11
|
+
readonly STATUS: ".opencode/mission/status.md";
|
|
12
|
+
readonly SYNC_ISSUES: ".opencode/mission/sync-issues.md";
|
|
13
|
+
readonly INTEGRATION_STATUS: ".opencode/mission/integration-status.md";
|
|
14
|
+
readonly UNIT_TESTS: ".opencode/mission/unit-tests";
|
|
15
|
+
readonly TODO_VERSION: ".opencode/mission/todo.version.json";
|
|
16
|
+
readonly VERIFICATION_CHECKLIST: ".opencode/mission/verification-checklist.md";
|
|
17
|
+
readonly ACTIVE_TASKS_LOG: ".opencode/mission/active_tasks.jsonl";
|
|
18
|
+
readonly CACHE_ROOT: ".opencode/cache";
|
|
19
|
+
readonly DOCS: ".opencode/cache/docs";
|
|
20
|
+
readonly DOC_METADATA: ".opencode/cache/docs/_metadata.json";
|
|
7
21
|
readonly ARCHIVE: ".opencode/archive";
|
|
8
22
|
readonly TASK_ARCHIVE: ".opencode/archive/tasks";
|
|
9
23
|
readonly DOC_ARCHIVE: ".opencode/archive/docs";
|
|
10
|
-
readonly
|
|
11
|
-
readonly CONTEXT: ".opencode/context.md";
|
|
12
|
-
readonly SUMMARY: ".opencode/summary.md";
|
|
13
|
-
readonly DOC_METADATA: ".opencode/docs/_metadata.json";
|
|
14
|
-
readonly WORK_LOG: ".opencode/work-log.md";
|
|
15
|
-
readonly UNIT_TESTS: ".opencode/unit-tests";
|
|
16
|
-
readonly SYNC_ISSUES: ".opencode/sync-issues.md";
|
|
17
|
-
readonly INTEGRATION_STATUS: ".opencode/integration-status.md";
|
|
18
|
-
readonly STATUS: ".opencode/status.md";
|
|
24
|
+
readonly TODO_HISTORY: ".opencode/archive/todo_history.jsonl";
|
|
19
25
|
readonly AGENTS_CONFIG: ".opencode/agents.json";
|
|
20
26
|
readonly PLUGINS: ".opencode/plugins";
|
|
21
27
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Pattern RegExps
|
|
3
|
+
*/
|
|
4
|
+
export declare const ERROR_PATTERNS: {
|
|
5
|
+
readonly TOOL_RESULT_MISSING: RegExp;
|
|
6
|
+
readonly THINKING_BLOCK_ORDER: RegExp;
|
|
7
|
+
readonly THINKING_DISABLED: RegExp;
|
|
8
|
+
readonly RATE_LIMIT: RegExp;
|
|
9
|
+
readonly CONTEXT_OVERFLOW: RegExp;
|
|
10
|
+
readonly MESSAGE_ABORTED: RegExp;
|
|
11
|
+
readonly NETWORK_ERROR: RegExp;
|
|
12
|
+
readonly AUTH_ERROR: RegExp;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Type Constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const ERROR_TYPE: {
|
|
5
|
+
readonly TOOL_RESULT_MISSING: "TOOL_RESULT_MISSING";
|
|
6
|
+
readonly THINKING_BLOCK_ORDER: "THINKING_BLOCK_ORDER";
|
|
7
|
+
readonly THINKING_DISABLED: "THINKING_DISABLED";
|
|
8
|
+
readonly RATE_LIMIT: "RATE_LIMIT";
|
|
9
|
+
readonly CONTEXT_OVERFLOW: "CONTEXT_OVERFLOW";
|
|
10
|
+
readonly MESSAGE_ABORTED: "MESSAGE_ABORTED";
|
|
11
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
12
|
+
readonly AUTH_ERROR: "AUTH_ERROR";
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Retry Logic
|
|
3
|
+
*/
|
|
4
|
+
import type { ErrorPatternType } from "./types/error-pattern-type.js";
|
|
5
|
+
export declare function isRetryableError(errorType: ErrorPatternType | null): boolean;
|
|
6
|
+
export declare function shouldAbortOnError(errorType: ErrorPatternType | null): boolean;
|
|
7
|
+
export declare function getRetryDelay(errorType: ErrorPatternType | null, attempt: number): number;
|