opencode-orchestrator 1.0.43 → 1.0.47

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.
Files changed (40) hide show
  1. package/README.md +35 -35
  2. package/dist/core/notification/os-notify/index.d.ts +3 -2
  3. package/dist/core/notification/task-toast-manager.d.ts +9 -20
  4. package/dist/core/notification/toast-core.d.ts +1 -1
  5. package/dist/core/notification/toast.d.ts +2 -2
  6. package/dist/core/recovery/retry.d.ts +59 -0
  7. package/dist/index.js +20424 -19236
  8. package/dist/plugin-handlers/index.d.ts +2 -0
  9. package/dist/plugin-handlers/interfaces/event-handler-context.d.ts +0 -2
  10. package/dist/plugin-handlers/interfaces/index.d.ts +2 -0
  11. package/dist/plugin-handlers/interfaces/session-compacting.d.ts +19 -0
  12. package/dist/plugin-handlers/interfaces/system-transform.d.ts +17 -0
  13. package/dist/plugin-handlers/session-compacting-handler.d.ts +14 -0
  14. package/dist/plugin-handlers/system-transform-handler.d.ts +14 -0
  15. package/dist/shared/agent/types/index.d.ts +0 -1
  16. package/dist/shared/core/constants/index.d.ts +1 -1
  17. package/dist/shared/core/constants/status-labels.d.ts +1 -0
  18. package/dist/shared/notification/constants/index.d.ts +2 -4
  19. package/dist/shared/notification/constants/tui.const.d.ts +24 -0
  20. package/dist/shared/notification/index.d.ts +1 -0
  21. package/dist/shared/notification/interfaces/index.d.ts +1 -0
  22. package/dist/shared/notification/interfaces/task-toast.interface.d.ts +18 -0
  23. package/dist/shared/notification/os-notify/interfaces/notification-config.d.ts +1 -5
  24. package/dist/shared/notification/os-notify/interfaces/notification-state.d.ts +0 -2
  25. package/dist/{core → shared}/notification/presets/mission.d.ts +2 -2
  26. package/dist/{core → shared}/notification/presets/parallel.d.ts +3 -3
  27. package/dist/{core → shared}/notification/presets/session.d.ts +3 -3
  28. package/dist/{core → shared}/notification/presets/task-lifecycle.d.ts +4 -4
  29. package/dist/{core → shared}/notification/presets/tools.d.ts +3 -3
  30. package/dist/{core → shared}/notification/presets/warnings.d.ts +4 -4
  31. package/package.json +2 -2
  32. package/dist/core/notification/os-notify/handler.d.ts +0 -19
  33. package/dist/core/notification/presets.d.ts +0 -7
  34. package/dist/core/notification/types/index.d.ts +0 -6
  35. package/dist/core/notification/types/toast-message.d.ts +0 -13
  36. package/dist/core/notification/types/toast-options.d.ts +0 -10
  37. package/dist/core/notification/types/toast-variant.d.ts +0 -4
  38. package/dist/core/notification/types.d.ts +0 -6
  39. package/dist/shared/agent/types/status-types.d.ts +0 -5
  40. /package/dist/{core → shared}/notification/presets/index.d.ts +0 -0
@@ -4,4 +4,6 @@ export * from "./event-handler.js";
4
4
  export * from "./tool-execute-handler.js";
5
5
  export * from "./tool-execute-pre-handler.js";
6
6
  export * from "./assistant-done-handler.js";
7
+ export * from "./session-compacting-handler.js";
8
+ export * from "./system-transform-handler.js";
7
9
  export * from "./interfaces/index.js";
@@ -4,13 +4,11 @@
4
4
  import type { PluginInput } from "@opencode-ai/plugin";
5
5
  import type { SessionState } from "./session-state.js";
6
6
  import type { OrchestratorState } from "./orchestrator-state.js";
7
- import type { SessionNotificationHandler } from "../../core/notification/os-notify/index.js";
8
7
  type OpencodeClient = PluginInput["client"];
9
8
  export interface EventHandlerContext {
10
9
  client: OpencodeClient;
11
10
  directory: string;
12
11
  sessions: Map<string, SessionState>;
13
12
  state: OrchestratorState;
14
- sessionNotifyHandler?: SessionNotificationHandler;
15
13
  }
16
14
  export {};
@@ -7,3 +7,5 @@ export type { EventHandlerContext } from "./event-handler-context.js";
7
7
  export type { ChatMessageHandlerContext } from "./chat-message-context.js";
8
8
  export type { ToolExecuteHandlerContext } from "./tool-execute-context.js";
9
9
  export type { AssistantDoneHandlerContext } from "./assistant-done-context.js";
10
+ export type { SessionCompactingInput, SessionCompactingOutput } from "./session-compacting.js";
11
+ export type { SystemTransformInput, SystemTransformOutput } from "./system-transform.js";
@@ -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,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
+ * 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>;
@@ -2,4 +2,3 @@
2
2
  * Agent types
3
3
  */
4
4
  export type { AgentName } from "./agent-name.js";
5
- export * from "./status-types.js";
@@ -5,7 +5,7 @@ export { TIME } from "./time.js";
5
5
  export { ID_PREFIX } from "./id-prefix.js";
6
6
  export { PATHS } from "./paths.js";
7
7
  export { MEMORY_LIMITS } from "./memory-limits.js";
8
- export { STATUS_LABEL } from "./status-labels.js";
8
+ 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";
@@ -31,3 +31,4 @@ export declare const STATUS_LABEL: {
31
31
  readonly MEDIUM: "medium";
32
32
  readonly LOW: "low";
33
33
  };
34
+ export type TaskStatus = typeof STATUS_LABEL[keyof typeof STATUS_LABEL];
@@ -1,5 +1,3 @@
1
- /**
2
- * Notification constants
3
- */
4
- export { TOAST_DURATION } from "./toast-duration.js";
1
+ export * from "./toast-duration.js";
2
+ export * from "./tui.const.js";
5
3
  export { TOAST_VARIANTS } from "./toast-variants.js";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * TUI Constants for Notification System
3
+ */
4
+ export declare const TUI_ICONS: {
5
+ readonly RUNNING: "⚡";
6
+ readonly QUEUED: "⏳";
7
+ readonly MISSION_SEALED: "🎉";
8
+ readonly SHIELD: "🛡️";
9
+ readonly NEW: " <- NEW";
10
+ };
11
+ export declare const TUI_BLOCKS: {
12
+ readonly FILLED: "▣";
13
+ readonly EMPTY: "▢";
14
+ };
15
+ export declare const TUI_TAGS: {
16
+ readonly BACKGROUND: "BACKGROUND";
17
+ readonly FOREGROUND: "FOREGROUND";
18
+ readonly WAITING: "WAITING";
19
+ readonly PENDING: "PENDING";
20
+ };
21
+ export declare const TUI_MESSAGES: {
22
+ readonly MISSION_SEALED_TITLE: "MISSION ACCOMPLISHED";
23
+ readonly MISSION_SEALED_SUBTITLE: "Passed all verifications.\nCodebase is sealed.";
24
+ };
@@ -4,3 +4,4 @@
4
4
  export * from "./constants/index.js";
5
5
  export * from "./interfaces/index.js";
6
6
  export * from "./types/index.js";
7
+ export * as presets from "./presets/index.js";
@@ -3,3 +3,4 @@
3
3
  */
4
4
  export type { ToastOptions } from "./toast-options.js";
5
5
  export type { ToastMessage } from "./toast-message.js";
6
+ export * from "./task-toast.interface.js";
@@ -0,0 +1,18 @@
1
+ import { TaskStatus } from "../../core/index.js";
2
+ export interface TrackedTask {
3
+ id: string;
4
+ description: string;
5
+ agent: string;
6
+ status: TaskStatus;
7
+ startedAt: Date;
8
+ isBackground: boolean;
9
+ parentSessionID?: string;
10
+ sessionID?: string;
11
+ }
12
+ export interface TaskCompletionInfo {
13
+ id: string;
14
+ description: string;
15
+ duration: string;
16
+ status: TaskStatus;
17
+ error?: string;
18
+ }
@@ -4,16 +4,12 @@
4
4
  export interface NotificationConfig {
5
5
  /** Notification title (default: "OpenCode Orchestrator") */
6
6
  title?: string;
7
- /** Notification message (default: "Agent is ready for input") */
7
+ /** Notification message (default: "Task completed") */
8
8
  message?: string;
9
9
  /** Play sound with notification (default: true) */
10
10
  playSound?: boolean;
11
11
  /** Custom sound file path */
12
12
  soundPath?: string;
13
- /** Delay in ms before sending notification to confirm session is still idle (default: 1500) */
14
- idleConfirmationDelay?: number;
15
- /** Skip notification if there are incomplete todos (default: true) */
16
- skipIfIncompleteTodos?: boolean;
17
13
  /** Maximum number of sessions to track before cleanup (default: 100) */
18
14
  maxTrackedSessions?: number;
19
15
  }
@@ -6,8 +6,6 @@ export interface NotificationState {
6
6
  notifiedSessions: Set<string>;
7
7
  /** Pending notification timers */
8
8
  pendingTimers: Map<string, ReturnType<typeof setTimeout>>;
9
- /** Sessions with activity since idle event */
10
- sessionActivitySinceIdle: Set<string>;
11
9
  /** Version tracking for race condition handling */
12
10
  notificationVersions: Map<string, number>;
13
11
  /** Sessions currently executing notification */
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Mission & Progress Presets
3
3
  */
4
- export declare const missionComplete: (summary: string) => import("../types.js").ToastMessage;
5
- export declare const missionStarted: (description: string) => import("../types.js").ToastMessage;
4
+ export declare const missionComplete: (summary: string) => import("../index.js").ToastMessage;
5
+ export declare const missionStarted: (description: string) => import("../index.js").ToastMessage;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Parallel Processing Presets
3
3
  */
4
- export declare const parallelTasksLaunched: (count: number, agents: string[]) => import("../types.js").ToastMessage;
5
- export declare const concurrencyAcquired: (agent: string, slot: string) => import("../types.js").ToastMessage;
6
- export declare const concurrencyReleased: (agent: string) => import("../types.js").ToastMessage;
4
+ export declare const parallelTasksLaunched: (count: number, agents: string[]) => import("../index.js").ToastMessage;
5
+ export declare const concurrencyAcquired: (agent: string, slot: string) => import("../index.js").ToastMessage;
6
+ export declare const concurrencyReleased: (agent: string) => import("../index.js").ToastMessage;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Session Management Presets
3
3
  */
4
- export declare const sessionCreated: (sessionId: string, agent: string) => import("../types.js").ToastMessage;
5
- export declare const sessionResumed: (sessionId: string, agent: string) => import("../types.js").ToastMessage;
6
- export declare const sessionCompleted: (sessionId: string, duration: string) => import("../types.js").ToastMessage;
4
+ export declare const sessionCreated: (sessionId: string, agent: string) => import("../index.js").ToastMessage;
5
+ export declare const sessionResumed: (sessionId: string, agent: string) => import("../index.js").ToastMessage;
6
+ export declare const sessionCompleted: (sessionId: string, duration: string) => import("../index.js").ToastMessage;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Task Lifecycle Presets
3
3
  */
4
- export declare const taskStarted: (taskId: string, agent: string) => import("../types.js").ToastMessage;
5
- export declare const taskCompleted: (taskId: string, agent: string) => import("../types.js").ToastMessage;
6
- export declare const taskFailed: (taskId: string, error: string) => import("../types.js").ToastMessage;
7
- export declare const allTasksComplete: (count: number) => import("../types.js").ToastMessage;
4
+ export declare const taskStarted: (taskId: string, agent: string) => import("../index.js").ToastMessage;
5
+ export declare const taskCompleted: (taskId: string, agent: string) => import("../index.js").ToastMessage;
6
+ export declare const taskFailed: (taskId: string, error: string) => import("../index.js").ToastMessage;
7
+ export declare const allTasksComplete: (count: number) => import("../index.js").ToastMessage;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Tools & Research Presets
3
3
  */
4
- export declare const toolExecuted: (toolName: string, target: string) => import("../types.js").ToastMessage;
5
- export declare const documentCached: (filename: string) => import("../types.js").ToastMessage;
6
- export declare const researchStarted: (topic: string) => import("../types.js").ToastMessage;
4
+ export declare const toolExecuted: (toolName: string, target: string) => import("../index.js").ToastMessage;
5
+ export declare const documentCached: (filename: string) => import("../index.js").ToastMessage;
6
+ export declare const researchStarted: (topic: string) => import("../index.js").ToastMessage;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Warnings & Errors Presets
3
3
  */
4
- export declare const warningRateLimited: () => import("../types.js").ToastMessage;
5
- export declare const errorRecovery: (action: string) => import("../types.js").ToastMessage;
6
- export declare const warningMaxDepth: (depth: number) => import("../types.js").ToastMessage;
7
- export declare const warningMaxRetries: () => import("../types.js").ToastMessage;
4
+ export declare const warningRateLimited: () => import("../index.js").ToastMessage;
5
+ export declare const errorRecovery: (action: string) => import("../index.js").ToastMessage;
6
+ export declare const warningMaxDepth: (depth: number) => import("../index.js").ToastMessage;
7
+ export declare const warningMaxRetries: () => import("../index.js").ToastMessage;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "opencode-orchestrator",
3
3
  "displayName": "OpenCode Orchestrator",
4
4
  "description": "Distributed Cognitive Architecture for OpenCode. Turns simple prompts into specialized multi-agent workflows (Planner, Coder, Reviewer).",
5
- "version": "1.0.43",
5
+ "version": "1.0.47",
6
6
  "author": "agnusdei1207",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -62,7 +62,7 @@
62
62
  "release:minor": "npm run build && npm run rust:dist && npm version minor && git push --follow-tags && npm publish --access public",
63
63
  "release:major": "npm run build && npm run rust:dist && npm version major && git push --follow-tags && npm publish --access public",
64
64
  "reset:local": "brew uninstall opencode 2>/dev/null; rm -rf ~/.config/opencode ~/.opencode ~/.local/share/opencode ~/.cache/opencode/node_modules/opencode-orchestrator && echo '=== Clean done ===' && brew install opencode && echo '{\"plugin\": [\"opencode-orchestrator\"], \"$schema\": \"https://opencode.ai/config.json\"}' > ~/.config/opencode/opencode.json && echo '=== Reset (Dev) complete. Run: opencode ==='",
65
- "reset:prod": "brew uninstall opencode 2>/dev/null; rm -rf ~/.config/opencode ~/.opencode ~/.local/share/opencode ~/.cache/opencode/node_modules/opencode-orchestrator && echo '=== Clean done ===' && brew install opencode && echo '{\"plugin\": [\"opencode-orchestrator\"], \"$schema\": \"https://opencode.ai/config.json\"}' > ~/.config/opencode/opencode.json && npm uninstall -g opencode-orchestrator && npm install -g opencode-orchestrator && echo '=== Reset (Prod) complete. Run: opencode ==='",
65
+ "reset:prod": "brew uninstall opencode 2>/dev/null; rm -rf ~/.config/opencode ~/.opencode ~/.local/share/opencode ~/.cache/opencode/node_modules/opencode-orchestrator && echo '=== Clean done ===' && brew install opencode && echo '{\"plugin\": [\"opencode-orchestrator\"], \"$schema\": \"https://opencode.ai/config.json\"}' > ~/.config/opencode/opencode.json && npm uninstall -g opencode-orchestrator && echo '=== Reset (Prod) complete. Run: opencode ==='",
66
66
  "ginstall": "npm install -g opencode-orchestrator",
67
67
  "log": "tail -f \"$(node -e 'console.log(require(\"os\").tmpdir())')/opencode-orchestrator.log\""
68
68
  },
@@ -1,19 +0,0 @@
1
- /**
2
- * Session Notification Handler
3
- *
4
- * High-level orchestration for session idle notifications.
5
- */
6
- import type { PluginInput } from "@opencode-ai/plugin";
7
- import { type NotificationConfig, type NotificationState } from "../../../shared/notification/os-notify/index.js";
8
- import { type Platform } from "../../../shared/os/index.js";
9
- export declare function createSessionNotificationHandler(client: PluginInput["client"], config?: NotificationConfig): {
10
- registerBackgroundSession: (id: string) => Set<string>;
11
- unregisterBackgroundSession: (id: string) => boolean;
12
- getPlatform: () => Platform;
13
- getState: () => Readonly<NotificationState>;
14
- handleEvent: (event: {
15
- type: string;
16
- properties?: unknown;
17
- }) => Promise<void>;
18
- };
19
- export type SessionNotificationHandler = ReturnType<typeof createSessionNotificationHandler>;
@@ -1,7 +0,0 @@
1
- /**
2
- * Toast Presets
3
- *
4
- * Re-exports for backward compatibility.
5
- */
6
- import * as presetFunctions from "./presets/index.js";
7
- export declare const presets: typeof presetFunctions;
@@ -1,6 +0,0 @@
1
- /**
2
- * Notification Types - Index
3
- */
4
- export type { ToastVariant } from "./toast-variant.js";
5
- export type { ToastMessage } from "./toast-message.js";
6
- export type { ToastOptions } from "./toast-options.js";
@@ -1,13 +0,0 @@
1
- /**
2
- * Toast Message Interface
3
- */
4
- import type { ToastVariant } from "./toast-variant.js";
5
- export interface ToastMessage {
6
- id: string;
7
- title: string;
8
- message: string;
9
- variant: ToastVariant;
10
- timestamp: Date;
11
- duration: number;
12
- dismissed: boolean;
13
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Toast Options Interface
3
- */
4
- import type { ToastVariant } from "./toast-variant.js";
5
- export interface ToastOptions {
6
- title: string;
7
- message: string;
8
- variant?: ToastVariant;
9
- duration?: number;
10
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * Toast Variant Type
3
- */
4
- export type ToastVariant = "info" | "success" | "warning" | "error";
@@ -1,6 +0,0 @@
1
- /**
2
- * Toast Types
3
- *
4
- * Re-exports for backward compatibility.
5
- */
6
- export * from "./types/index.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Status Types
3
- */
4
- import { STATUS_LABEL } from "../../core/constants/status-labels.js";
5
- export type TaskStatus = keyof typeof STATUS_LABEL;