oh-my-opencode 3.5.6 → 3.7.0

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 (137) hide show
  1. package/README.ja.md +6 -6
  2. package/README.ko.md +6 -6
  3. package/README.md +6 -6
  4. package/README.zh-cn.md +6 -6
  5. package/dist/agents/sisyphus-junior/gpt.d.ts +4 -14
  6. package/dist/cli/index.js +450 -116
  7. package/dist/cli/run/event-handlers.d.ts +1 -0
  8. package/dist/cli/run/opencode-bin-path.d.ts +3 -0
  9. package/dist/cli/run/opencode-binary-resolver.d.ts +5 -0
  10. package/dist/cli/run/session-resolver.d.ts +1 -0
  11. package/dist/cli/run/types.d.ts +30 -1
  12. package/dist/config/schema/browser-automation.d.ts +2 -0
  13. package/dist/config/schema/experimental.d.ts +1 -0
  14. package/dist/config/schema/hooks.d.ts +1 -0
  15. package/dist/config/schema/oh-my-opencode-config.d.ts +3 -0
  16. package/dist/create-hooks.d.ts +3 -0
  17. package/dist/create-managers.d.ts +1 -0
  18. package/dist/features/background-agent/constants.d.ts +1 -1
  19. package/dist/features/background-agent/manager.d.ts +3 -0
  20. package/dist/features/background-agent/message-dir.d.ts +1 -1
  21. package/dist/features/background-agent/result-handler.d.ts +1 -1
  22. package/dist/features/builtin-skills/skills/index.d.ts +1 -0
  23. package/dist/features/builtin-skills/skills/playwright-cli.d.ts +10 -0
  24. package/dist/features/claude-code-mcp-loader/loader.d.ts +1 -1
  25. package/dist/features/hook-message-injector/constants.d.ts +1 -3
  26. package/dist/features/hook-message-injector/index.d.ts +1 -1
  27. package/dist/features/hook-message-injector/injector.d.ts +51 -3
  28. package/dist/features/tmux-subagent/action-executor-core.d.ts +21 -0
  29. package/dist/features/tmux-subagent/action-executor.d.ts +3 -12
  30. package/dist/features/tmux-subagent/grid-planning.d.ts +2 -2
  31. package/dist/features/tmux-subagent/manager.d.ts +0 -1
  32. package/dist/features/tmux-subagent/pane-split-availability.d.ts +3 -2
  33. package/dist/features/tmux-subagent/polling-manager.d.ts +1 -0
  34. package/dist/features/tmux-subagent/spawn-target-finder.d.ts +1 -1
  35. package/dist/hooks/agent-usage-reminder/constants.d.ts +0 -1
  36. package/dist/hooks/anthropic-context-window-limit-recovery/client.d.ts +3 -34
  37. package/dist/hooks/anthropic-context-window-limit-recovery/deduplication-recovery.d.ts +4 -1
  38. package/dist/hooks/anthropic-context-window-limit-recovery/empty-content-recovery-sdk.d.ts +11 -0
  39. package/dist/hooks/anthropic-context-window-limit-recovery/message-builder.d.ts +4 -1
  40. package/dist/hooks/anthropic-context-window-limit-recovery/message-storage-directory.d.ts +5 -1
  41. package/dist/hooks/anthropic-context-window-limit-recovery/pruning-deduplication.d.ts +4 -1
  42. package/dist/hooks/anthropic-context-window-limit-recovery/pruning-tool-output-truncation.d.ts +5 -2
  43. package/dist/hooks/anthropic-context-window-limit-recovery/storage-paths.d.ts +2 -2
  44. package/dist/hooks/anthropic-context-window-limit-recovery/storage.d.ts +1 -0
  45. package/dist/hooks/anthropic-context-window-limit-recovery/target-token-truncation.d.ts +4 -1
  46. package/dist/hooks/anthropic-context-window-limit-recovery/tool-result-storage-sdk.d.ts +29 -0
  47. package/dist/hooks/atlas/session-last-agent.d.ts +4 -1
  48. package/dist/hooks/atlas/tool-execute-before.d.ts +2 -0
  49. package/dist/hooks/context-window-monitor.d.ts +5 -1
  50. package/dist/hooks/directory-agents-injector/constants.d.ts +0 -1
  51. package/dist/hooks/directory-agents-injector/hook.d.ts +3 -1
  52. package/dist/hooks/directory-readme-injector/constants.d.ts +0 -1
  53. package/dist/hooks/directory-readme-injector/hook.d.ts +3 -1
  54. package/dist/hooks/hashline-read-enhancer/hook.d.ts +18 -0
  55. package/dist/hooks/hashline-read-enhancer/index.d.ts +1 -0
  56. package/dist/hooks/index.d.ts +1 -0
  57. package/dist/hooks/interactive-bash-session/constants.d.ts +0 -1
  58. package/dist/hooks/preemptive-compaction.d.ts +4 -1
  59. package/dist/hooks/prometheus-md-only/agent-resolution.d.ts +4 -1
  60. package/dist/hooks/ralph-loop/message-storage-directory.d.ts +1 -1
  61. package/dist/hooks/rules-injector/constants.d.ts +0 -1
  62. package/dist/hooks/rules-injector/hook.d.ts +3 -1
  63. package/dist/hooks/session-recovery/constants.d.ts +1 -3
  64. package/dist/hooks/session-recovery/recover-empty-content-message-sdk.d.ts +13 -0
  65. package/dist/hooks/session-recovery/recover-empty-content-message.d.ts +1 -1
  66. package/dist/hooks/session-recovery/recover-thinking-block-order.d.ts +1 -1
  67. package/dist/hooks/session-recovery/recover-thinking-disabled-violation.d.ts +1 -1
  68. package/dist/hooks/session-recovery/storage/empty-text.d.ts +5 -0
  69. package/dist/hooks/session-recovery/storage/message-dir.d.ts +1 -1
  70. package/dist/hooks/session-recovery/storage/messages-reader.d.ts +4 -0
  71. package/dist/hooks/session-recovery/storage/parts-reader.d.ts +4 -0
  72. package/dist/hooks/session-recovery/storage/text-part-injector.d.ts +4 -0
  73. package/dist/hooks/session-recovery/storage/thinking-prepend.d.ts +4 -0
  74. package/dist/hooks/session-recovery/storage/thinking-strip.d.ts +4 -0
  75. package/dist/hooks/session-recovery/storage.d.ts +7 -0
  76. package/dist/hooks/sisyphus-junior-notepad/hook.d.ts +1 -1
  77. package/dist/hooks/think-mode/switcher.d.ts +7 -0
  78. package/dist/hooks/todo-continuation-enforcer/message-directory.d.ts +1 -1
  79. package/dist/hooks/todo-continuation-enforcer/types.d.ts +1 -1
  80. package/dist/hooks/tool-output-truncator.d.ts +3 -0
  81. package/dist/index.js +24207 -22344
  82. package/dist/plugin/hooks/create-core-hooks.d.ts +3 -0
  83. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
  84. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +4 -1
  85. package/dist/plugin-config.d.ts +1 -1
  86. package/dist/plugin-handlers/agent-key-remapper.d.ts +1 -0
  87. package/dist/shared/agent-display-names.d.ts +5 -0
  88. package/dist/shared/dynamic-truncator.d.ts +7 -3
  89. package/dist/shared/fallback-model-availability.d.ts +9 -2
  90. package/dist/shared/git-worktree/index.d.ts +2 -0
  91. package/dist/shared/git-worktree/parse-status-porcelain-line.d.ts +6 -0
  92. package/dist/shared/index.d.ts +8 -1
  93. package/dist/shared/model-availability.d.ts +0 -5
  94. package/dist/shared/model-name-matcher.d.ts +0 -1
  95. package/dist/shared/normalize-sdk-response.d.ts +4 -0
  96. package/dist/shared/opencode-http-api.d.ts +3 -0
  97. package/dist/shared/opencode-storage-detection.d.ts +2 -0
  98. package/dist/shared/opencode-storage-paths.d.ts +4 -0
  99. package/dist/shared/opencode-version.d.ts +5 -0
  100. package/dist/shared/session-directory-resolver.d.ts +7 -0
  101. package/dist/shared/session-utils.d.ts +2 -2
  102. package/dist/shared/tmux/tmux-utils/layout.d.ts +2 -2
  103. package/dist/tools/background-task/create-background-cancel.d.ts +1 -1
  104. package/dist/tools/background-task/create-background-task.d.ts +2 -2
  105. package/dist/tools/background-task/message-dir.d.ts +1 -1
  106. package/dist/tools/background-task/modules/background-cancel.d.ts +1 -1
  107. package/dist/tools/background-task/modules/utils.d.ts +2 -1
  108. package/dist/tools/call-omo-agent/background-agent-executor.d.ts +2 -1
  109. package/dist/tools/call-omo-agent/background-executor.d.ts +2 -1
  110. package/dist/tools/call-omo-agent/message-dir.d.ts +1 -1
  111. package/dist/tools/call-omo-agent/message-storage-directory.d.ts +1 -1
  112. package/dist/tools/call-omo-agent/tools.d.ts +1 -1
  113. package/dist/tools/delegate-task/parent-context-resolver.d.ts +2 -1
  114. package/dist/tools/delegate-task/sisyphus-junior-agent.d.ts +1 -1
  115. package/dist/tools/delegate-task/sync-prompt-sender.d.ts +7 -1
  116. package/dist/tools/hashline-edit/constants.d.ts +2 -0
  117. package/dist/tools/hashline-edit/edit-operations.d.ts +6 -0
  118. package/dist/tools/hashline-edit/hash-computation.d.ts +3 -0
  119. package/dist/tools/hashline-edit/index.d.ts +7 -0
  120. package/dist/tools/hashline-edit/tools.d.ts +2 -0
  121. package/dist/tools/hashline-edit/types.d.ts +22 -0
  122. package/dist/tools/hashline-edit/validation.d.ts +6 -0
  123. package/dist/tools/index.d.ts +1 -0
  124. package/dist/tools/session-manager/constants.d.ts +1 -4
  125. package/dist/tools/session-manager/session-formatter.d.ts +1 -1
  126. package/dist/tools/session-manager/storage.d.ts +5 -2
  127. package/dist/tools/session-manager/types.d.ts +1 -1
  128. package/dist/tools/task/todo-sync.d.ts +2 -2
  129. package/package.json +8 -8
  130. package/dist/tools/task/task-action-create.d.ts +0 -4
  131. package/dist/tools/task/task-action-delete.d.ts +0 -2
  132. package/dist/tools/task/task-action-get.d.ts +0 -2
  133. package/dist/tools/task/task-action-list.d.ts +0 -2
  134. package/dist/tools/task/task-action-update.d.ts +0 -2
  135. package/dist/tools/task/task-id-validator.d.ts +0 -1
  136. package/dist/tools/task/task.d.ts +0 -3
  137. /package/dist/{features/background-agent/message-storage-locator.d.ts → shared/opencode-message-dir.d.ts} +0 -0
@@ -7,3 +7,4 @@ export declare function handleMessagePartUpdated(ctx: RunContext, payload: Event
7
7
  export declare function handleMessageUpdated(ctx: RunContext, payload: EventPayload, state: EventState): void;
8
8
  export declare function handleToolExecute(ctx: RunContext, payload: EventPayload, state: EventState): void;
9
9
  export declare function handleToolResult(ctx: RunContext, payload: EventPayload, state: EventState): void;
10
+ export declare function handleTuiToast(_ctx: RunContext, payload: EventPayload, state: EventState): void;
@@ -0,0 +1,3 @@
1
+ type EnvLike = Record<string, string | undefined>;
2
+ export declare function prependResolvedOpencodeBinToPath(env?: EnvLike, resolve?: (id: string) => string): void;
3
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare function collectCandidateBinaryPaths(pathEnv: string | undefined, which?: (command: string) => string | null | undefined, platform?: NodeJS.Platform): string[];
2
+ export declare function canExecuteBinary(binaryPath: string): Promise<boolean>;
3
+ export declare function findWorkingOpencodeBinary(pathEnv?: string | undefined, probe?: (binaryPath: string) => Promise<boolean>, which?: (command: string) => string | null | undefined, platform?: NodeJS.Platform): Promise<string | null>;
4
+ export declare function buildPathWithBinaryFirst(pathEnv: string | undefined, binaryPath: string): string;
5
+ export declare function withWorkingOpencodePath<T>(startServer: () => Promise<T>, finder?: (pathEnv: string | undefined) => Promise<string | null>): Promise<T>;
@@ -2,4 +2,5 @@ import type { OpencodeClient } from "./types";
2
2
  export declare function resolveSession(options: {
3
3
  client: OpencodeClient;
4
4
  sessionId?: string;
5
+ directory: string;
5
6
  }): Promise<string>;
@@ -29,7 +29,7 @@ export interface RunContext {
29
29
  abortController: AbortController;
30
30
  }
31
31
  export interface Todo {
32
- id: string;
32
+ id?: string;
33
33
  content: string;
34
34
  status: string;
35
35
  priority: string;
@@ -46,9 +46,11 @@ export interface EventPayload {
46
46
  }
47
47
  export interface SessionIdleProps {
48
48
  sessionID?: string;
49
+ sessionId?: string;
49
50
  }
50
51
  export interface SessionStatusProps {
51
52
  sessionID?: string;
53
+ sessionId?: string;
52
54
  status?: {
53
55
  type?: string;
54
56
  };
@@ -56,6 +58,7 @@ export interface SessionStatusProps {
56
58
  export interface MessageUpdatedProps {
57
59
  info?: {
58
60
  sessionID?: string;
61
+ sessionId?: string;
59
62
  role?: string;
60
63
  modelID?: string;
61
64
  providerID?: string;
@@ -63,28 +66,54 @@ export interface MessageUpdatedProps {
63
66
  };
64
67
  }
65
68
  export interface MessagePartUpdatedProps {
69
+ /** @deprecated Legacy structure — current OpenCode puts sessionID inside part */
66
70
  info?: {
67
71
  sessionID?: string;
72
+ sessionId?: string;
68
73
  role?: string;
69
74
  };
70
75
  part?: {
76
+ id?: string;
77
+ sessionID?: string;
78
+ sessionId?: string;
79
+ messageID?: string;
71
80
  type?: string;
72
81
  text?: string;
82
+ /** Tool name (for part.type === "tool") */
83
+ tool?: string;
84
+ /** Tool state (for part.type === "tool") */
85
+ state?: {
86
+ status?: string;
87
+ input?: Record<string, unknown>;
88
+ output?: string;
89
+ };
73
90
  name?: string;
74
91
  input?: unknown;
92
+ time?: {
93
+ start?: number;
94
+ end?: number;
95
+ };
75
96
  };
76
97
  }
77
98
  export interface ToolExecuteProps {
78
99
  sessionID?: string;
100
+ sessionId?: string;
79
101
  name?: string;
80
102
  input?: Record<string, unknown>;
81
103
  }
82
104
  export interface ToolResultProps {
83
105
  sessionID?: string;
106
+ sessionId?: string;
84
107
  name?: string;
85
108
  output?: string;
86
109
  }
87
110
  export interface SessionErrorProps {
88
111
  sessionID?: string;
112
+ sessionId?: string;
89
113
  error?: unknown;
90
114
  }
115
+ export interface TuiToastShowProps {
116
+ title?: string;
117
+ message?: string;
118
+ variant?: "info" | "success" | "warning" | "error";
119
+ }
@@ -3,12 +3,14 @@ export declare const BrowserAutomationProviderSchema: z.ZodEnum<{
3
3
  playwright: "playwright";
4
4
  "agent-browser": "agent-browser";
5
5
  "dev-browser": "dev-browser";
6
+ "playwright-cli": "playwright-cli";
6
7
  }>;
7
8
  export declare const BrowserAutomationConfigSchema: z.ZodObject<{
8
9
  provider: z.ZodDefault<z.ZodEnum<{
9
10
  playwright: "playwright";
10
11
  "agent-browser": "agent-browser";
11
12
  "dev-browser": "dev-browser";
13
+ "playwright-cli": "playwright-cli";
12
14
  }>>;
13
15
  }, z.core.$strip>;
14
16
  export type BrowserAutomationProvider = z.infer<typeof BrowserAutomationProviderSchema>;
@@ -33,5 +33,6 @@ export declare const ExperimentalConfigSchema: z.ZodObject<{
33
33
  task_system: z.ZodOptional<z.ZodBoolean>;
34
34
  plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
35
35
  safe_hook_creation: z.ZodOptional<z.ZodBoolean>;
36
+ hashline_edit: z.ZodOptional<z.ZodBoolean>;
36
37
  }, z.core.$strip>;
37
38
  export type ExperimentalConfig = z.infer<typeof ExperimentalConfigSchema>;
@@ -42,5 +42,6 @@ export declare const HookNameSchema: z.ZodEnum<{
42
42
  "tasks-todowrite-disabler": "tasks-todowrite-disabler";
43
43
  "write-existing-file-guard": "write-existing-file-guard";
44
44
  "anthropic-effort": "anthropic-effort";
45
+ "hashline-read-enhancer": "hashline-read-enhancer";
45
46
  }>;
46
47
  export type HookName = z.infer<typeof HookNameSchema>;
@@ -66,6 +66,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
66
66
  "tasks-todowrite-disabler": "tasks-todowrite-disabler";
67
67
  "write-existing-file-guard": "write-existing-file-guard";
68
68
  "anthropic-effort": "anthropic-effort";
69
+ "hashline-read-enhancer": "hashline-read-enhancer";
69
70
  }>>>;
70
71
  disabled_commands: z.ZodOptional<z.ZodArray<z.ZodEnum<{
71
72
  "init-deep": "init-deep";
@@ -1211,6 +1212,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1211
1212
  task_system: z.ZodOptional<z.ZodBoolean>;
1212
1213
  plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
1213
1214
  safe_hook_creation: z.ZodOptional<z.ZodBoolean>;
1215
+ hashline_edit: z.ZodOptional<z.ZodBoolean>;
1214
1216
  }, z.core.$strip>>;
1215
1217
  auto_update: z.ZodOptional<z.ZodBoolean>;
1216
1218
  skills: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
@@ -1262,6 +1264,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1262
1264
  playwright: "playwright";
1263
1265
  "agent-browser": "agent-browser";
1264
1266
  "dev-browser": "dev-browser";
1267
+ "playwright-cli": "playwright-cli";
1265
1268
  }>>;
1266
1269
  }, z.core.$strip>>;
1267
1270
  websearch: z.ZodOptional<z.ZodObject<{
@@ -3,10 +3,12 @@ import type { HookName, OhMyOpenCodeConfig } from "./config";
3
3
  import type { LoadedSkill } from "./features/opencode-skill-loader/types";
4
4
  import type { BackgroundManager } from "./features/background-agent";
5
5
  import type { PluginContext } from "./plugin/types";
6
+ import type { ModelCacheState } from "./plugin-state";
6
7
  export type CreatedHooks = ReturnType<typeof createHooks>;
7
8
  export declare function createHooks(args: {
8
9
  ctx: PluginContext;
9
10
  pluginConfig: OhMyOpenCodeConfig;
11
+ modelCacheState: ModelCacheState;
10
12
  backgroundManager: BackgroundManager;
11
13
  isHookEnabled: (hookName: HookName) => boolean;
12
14
  safeHookEnabled: boolean;
@@ -34,6 +36,7 @@ export declare function createHooks(args: {
34
36
  rulesInjector: ReturnType<typeof import("./hooks").createRulesInjectorHook> | null;
35
37
  tasksTodowriteDisabler: ReturnType<typeof import("./hooks").createTasksTodowriteDisablerHook> | null;
36
38
  writeExistingFileGuard: ReturnType<typeof import("./hooks").createWriteExistingFileGuardHook> | null;
39
+ hashlineReadEnhancer: ReturnType<typeof import("./hooks").createHashlineReadEnhancerHook> | null;
37
40
  contextWindowMonitor: ReturnType<typeof import("./hooks").createContextWindowMonitorHook> | null;
38
41
  preemptiveCompaction: ReturnType<typeof import("./hooks").createPreemptiveCompactionHook> | null;
39
42
  sessionRecovery: ReturnType<typeof import("./hooks").createSessionRecoveryHook> | null;
@@ -16,4 +16,5 @@ export declare function createManagers(args: {
16
16
  pluginConfig: OhMyOpenCodeConfig;
17
17
  tmuxConfig: TmuxConfig;
18
18
  modelCacheState: ModelCacheState;
19
+ backgroundNotificationHookEnabled: boolean;
19
20
  }): Managers;
@@ -31,7 +31,7 @@ export interface Todo {
31
31
  content: string;
32
32
  status: string;
33
33
  priority: string;
34
- id: string;
34
+ id?: string;
35
35
  }
36
36
  export interface QueueItem {
37
37
  task: BackgroundTask;
@@ -29,6 +29,7 @@ export declare class BackgroundManager {
29
29
  private client;
30
30
  private directory;
31
31
  private pollingInterval?;
32
+ private pollingInFlight;
32
33
  private concurrencyManager;
33
34
  private shutdownTriggered;
34
35
  private config?;
@@ -40,11 +41,13 @@ export declare class BackgroundManager {
40
41
  private completionTimers;
41
42
  private idleDeferralTimers;
42
43
  private notificationQueueByParent;
44
+ private enableParentSessionNotifications;
43
45
  readonly taskHistory: TaskHistory;
44
46
  constructor(ctx: PluginInput, config?: BackgroundTaskConfig, options?: {
45
47
  tmuxConfig?: TmuxConfig;
46
48
  onSubagentSessionCreated?: OnSubagentSessionCreated;
47
49
  onShutdown?: () => void;
50
+ enableParentSessionNotifications?: boolean;
48
51
  });
49
52
  launch(input: LaunchInput): Promise<BackgroundTask>;
50
53
  private processKey;
@@ -1 +1 @@
1
- export { getMessageDir } from "./message-storage-locator";
1
+ export { getMessageDir } from "../../shared";
@@ -1,6 +1,6 @@
1
1
  export type { ResultHandlerContext } from "./result-handler-context";
2
2
  export { formatDuration } from "./duration-formatter";
3
- export { getMessageDir } from "./message-storage-locator";
3
+ export { getMessageDir } from "../../shared";
4
4
  export { checkSessionTodos } from "./session-todo-checker";
5
5
  export { validateSessionHasOutput } from "./session-output-validator";
6
6
  export { tryCompleteTask } from "./background-task-completer";
@@ -1,4 +1,5 @@
1
1
  export { playwrightSkill, agentBrowserSkill } from "./playwright";
2
+ export { playwrightCliSkill } from "./playwright-cli";
2
3
  export { frontendUiUxSkill } from "./frontend-ui-ux";
3
4
  export { gitMasterSkill } from "./git-master";
4
5
  export { devBrowserSkill } from "./dev-browser";
@@ -0,0 +1,10 @@
1
+ import type { BuiltinSkill } from "../types";
2
+ /**
3
+ * Playwright CLI skill — token-efficient CLI alternative to the MCP-based playwright skill.
4
+ *
5
+ * Uses name "playwright" (not "playwright-cli") because agents hardcode "playwright" as the
6
+ * canonical browser skill name. The browserProvider config swaps the implementation behind
7
+ * the same name: "playwright" gives MCP, "playwright-cli" gives this CLI variant.
8
+ * The binary is still called `playwright-cli` (see allowedTools).
9
+ */
10
+ export declare const playwrightCliSkill: BuiltinSkill;
@@ -1,4 +1,4 @@
1
1
  import type { LoadedMcpServer, McpLoadResult } from "./types";
2
2
  export declare function getSystemMcpServerNames(): Set<string>;
3
- export declare function loadMcpConfigs(): Promise<McpLoadResult>;
3
+ export declare function loadMcpConfigs(disabledMcps?: string[]): Promise<McpLoadResult>;
4
4
  export declare function formatLoadedServersForToast(loadedServers: LoadedMcpServer[]): string;
@@ -1,3 +1 @@
1
- export declare const OPENCODE_STORAGE: string;
2
- export declare const MESSAGE_STORAGE: string;
3
- export declare const PART_STORAGE: string;
1
+ export { OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE } from "../../shared";
@@ -1,4 +1,4 @@
1
- export { injectHookMessage, findNearestMessageWithFields, findFirstMessageWithAgent } from "./injector";
1
+ export { injectHookMessage, findNearestMessageWithFields, findFirstMessageWithAgent, findNearestMessageWithFieldsFromSDK, findFirstMessageWithAgentFromSDK, resolveMessageContext, } from "./injector";
2
2
  export type { StoredMessage } from "./injector";
3
3
  export type { MessageMeta, OriginalMessageContext, TextPart, ToolPermission } from "./types";
4
4
  export { MESSAGE_STORAGE } from "./constants";
@@ -1,3 +1,4 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
1
2
  import type { OriginalMessageContext, ToolPermission } from "./types";
2
3
  export interface StoredMessage {
3
4
  agent?: string;
@@ -8,12 +9,59 @@ export interface StoredMessage {
8
9
  };
9
10
  tools?: Record<string, ToolPermission>;
10
11
  }
12
+ type OpencodeClient = PluginInput["client"];
13
+ /**
14
+ * Finds the nearest message with required fields using SDK (for beta/SQLite backend).
15
+ * Uses client.session.messages() to fetch message data from SQLite.
16
+ */
17
+ export declare function findNearestMessageWithFieldsFromSDK(client: OpencodeClient, sessionID: string): Promise<StoredMessage | null>;
18
+ /**
19
+ * Finds the FIRST (oldest) message with agent field using SDK (for beta/SQLite backend).
20
+ */
21
+ export declare function findFirstMessageWithAgentFromSDK(client: OpencodeClient, sessionID: string): Promise<string | null>;
22
+ /**
23
+ * Finds the nearest message with required fields (agent, model.providerID, model.modelID).
24
+ * Reads from JSON files - for stable (JSON) backend.
25
+ *
26
+ * **Version-gated behavior:**
27
+ * - On beta (SQLite backend): Returns null immediately (no JSON storage)
28
+ * - On stable (JSON backend): Reads from JSON files in messageDir
29
+ *
30
+ * @deprecated Use findNearestMessageWithFieldsFromSDK for beta/SQLite backend
31
+ */
11
32
  export declare function findNearestMessageWithFields(messageDir: string): StoredMessage | null;
12
33
  /**
13
34
  * Finds the FIRST (oldest) message in the session with agent field.
14
- * This is used to get the original agent that started the session,
15
- * avoiding issues where newer messages may have a different agent
16
- * due to OpenCode's internal agent switching.
35
+ * Reads from JSON files - for stable (JSON) backend.
36
+ *
37
+ * **Version-gated behavior:**
38
+ * - On beta (SQLite backend): Returns null immediately (no JSON storage)
39
+ * - On stable (JSON backend): Reads from JSON files in messageDir
40
+ *
41
+ * @deprecated Use findFirstMessageWithAgentFromSDK for beta/SQLite backend
17
42
  */
18
43
  export declare function findFirstMessageWithAgent(messageDir: string): string | null;
44
+ /**
45
+ * Injects a hook message into the session storage.
46
+ *
47
+ * **Version-gated behavior:**
48
+ * - On beta (SQLite backend): Logs warning and skips injection (writes are invisible to SQLite)
49
+ * - On stable (JSON backend): Writes message and part JSON files
50
+ *
51
+ * Features degraded on beta:
52
+ * - Hook message injection (e.g., continuation prompts, context injection) won't persist
53
+ * - Atlas hook's injected messages won't be visible in SQLite backend
54
+ * - Todo continuation enforcer's injected prompts won't persist
55
+ * - Ralph loop's continuation prompts won't persist
56
+ *
57
+ * @param sessionID - Target session ID
58
+ * @param hookContent - Content to inject
59
+ * @param originalMessage - Context from the original message
60
+ * @returns true if injection succeeded, false otherwise
61
+ */
19
62
  export declare function injectHookMessage(sessionID: string, hookContent: string, originalMessage: OriginalMessageContext): boolean;
63
+ export declare function resolveMessageContext(sessionID: string, client: OpencodeClient, messageDir: string | null): Promise<{
64
+ prevMessage: StoredMessage | null;
65
+ firstMessageAgent: string | null;
66
+ }>;
67
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { TmuxConfig } from "../../config/schema";
2
+ import type { applyLayout, closeTmuxPane, enforceMainPaneWidth, replaceTmuxPane, spawnTmuxPane } from "../../shared/tmux";
3
+ import type { PaneAction, WindowState } from "./types";
4
+ export interface ActionResult {
5
+ success: boolean;
6
+ paneId?: string;
7
+ error?: string;
8
+ }
9
+ export interface ExecuteContext {
10
+ config: TmuxConfig;
11
+ serverUrl: string;
12
+ windowState: WindowState;
13
+ }
14
+ export interface ActionExecutorDeps {
15
+ spawnTmuxPane: typeof spawnTmuxPane;
16
+ closeTmuxPane: typeof closeTmuxPane;
17
+ replaceTmuxPane: typeof replaceTmuxPane;
18
+ applyLayout: typeof applyLayout;
19
+ enforceMainPaneWidth: typeof enforceMainPaneWidth;
20
+ }
21
+ export declare function executeActionWithDeps(action: PaneAction, ctx: ExecuteContext, deps: ActionExecutorDeps): Promise<ActionResult>;
@@ -1,10 +1,6 @@
1
- import type { TmuxConfig } from "../../config/schema";
2
- import type { PaneAction, WindowState } from "./types";
3
- export interface ActionResult {
4
- success: boolean;
5
- paneId?: string;
6
- error?: string;
7
- }
1
+ import type { PaneAction } from "./types";
2
+ import type { ActionResult, ExecuteContext } from "./action-executor-core";
3
+ export type { ActionExecutorDeps, ActionResult, ExecuteContext } from "./action-executor-core";
8
4
  export interface ExecuteActionsResult {
9
5
  success: boolean;
10
6
  spawnedPaneId?: string;
@@ -13,10 +9,5 @@ export interface ExecuteActionsResult {
13
9
  result: ActionResult;
14
10
  }>;
15
11
  }
16
- export interface ExecuteContext {
17
- config: TmuxConfig;
18
- serverUrl: string;
19
- windowState: WindowState;
20
- }
21
12
  export declare function executeAction(action: PaneAction, ctx: ExecuteContext): Promise<ActionResult>;
22
13
  export declare function executeActions(actions: PaneAction[], ctx: ExecuteContext): Promise<ExecuteActionsResult>;
@@ -14,6 +14,6 @@ export interface GridPlan {
14
14
  slotWidth: number;
15
15
  slotHeight: number;
16
16
  }
17
- export declare function calculateCapacity(windowWidth: number, windowHeight: number, minPaneWidth?: number): GridCapacity;
18
- export declare function computeGridPlan(windowWidth: number, windowHeight: number, paneCount: number): GridPlan;
17
+ export declare function calculateCapacity(windowWidth: number, windowHeight: number, minPaneWidth?: number, mainPaneWidth?: number): GridCapacity;
18
+ export declare function computeGridPlan(windowWidth: number, windowHeight: number, paneCount: number, mainPaneWidth?: number, minPaneWidth?: number): GridPlan;
19
19
  export declare function mapPaneToSlot(pane: TmuxPaneInfo, plan: GridPlan, mainPaneWidth: number): GridSlot;
@@ -40,7 +40,6 @@ export declare class TmuxSessionManager {
40
40
  private getCapacityConfig;
41
41
  private getSessionMappings;
42
42
  private waitForSessionReady;
43
- private pollSessions;
44
43
  onSessionCreated(event: SessionCreatedEvent): Promise<void>;
45
44
  onSessionDeleted(event: {
46
45
  sessionID: string;
@@ -4,5 +4,6 @@ export declare function getColumnWidth(agentAreaWidth: number, paneCount: number
4
4
  export declare function isSplittableAtCount(agentAreaWidth: number, paneCount: number, minPaneWidth?: number): boolean;
5
5
  export declare function findMinimalEvictions(agentAreaWidth: number, currentCount: number, minPaneWidth?: number): number | null;
6
6
  export declare function canSplitPane(pane: TmuxPaneInfo, direction: SplitDirection, minPaneWidth?: number): boolean;
7
- export declare function canSplitPaneAnyDirection(pane: TmuxPaneInfo): boolean;
8
- export declare function getBestSplitDirection(pane: TmuxPaneInfo): SplitDirection | null;
7
+ export declare function canSplitPaneAnyDirection(pane: TmuxPaneInfo, minPaneWidth?: number): boolean;
8
+ export declare function canSplitPaneAnyDirectionWithMinWidth(pane: TmuxPaneInfo, minPaneWidth?: number): boolean;
9
+ export declare function getBestSplitDirection(pane: TmuxPaneInfo, minPaneWidth?: number): SplitDirection | null;
@@ -5,6 +5,7 @@ export declare class TmuxPollingManager {
5
5
  private sessions;
6
6
  private closeSessionById;
7
7
  private pollInterval?;
8
+ private pollingInFlight;
8
9
  constructor(client: OpencodeClient, sessions: Map<string, TrackedSession>, closeSessionById: (sessionId: string) => Promise<void>);
9
10
  startPolling(): void;
10
11
  stopPolling(): void;
@@ -3,4 +3,4 @@ export interface SpawnTarget {
3
3
  targetPaneId: string;
4
4
  splitDirection: SplitDirection;
5
5
  }
6
- export declare function findSpawnTarget(state: WindowState): SpawnTarget | null;
6
+ export declare function findSpawnTarget(state: WindowState, minPaneWidth?: number): SpawnTarget | null;
@@ -1,4 +1,3 @@
1
- export declare const OPENCODE_STORAGE: string;
2
1
  export declare const AGENT_USAGE_REMINDER_STORAGE: string;
3
2
  export declare const TARGET_TOOLS: Set<string>;
4
3
  export declare const AGENT_TOOLS: Set<string>;
@@ -1,38 +1,7 @@
1
- export type Client = {
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ export type Client = PluginInput["client"] & {
2
3
  session: {
3
- messages: (opts: {
4
- path: {
5
- id: string;
6
- };
7
- query?: {
8
- directory?: string;
9
- };
10
- }) => Promise<unknown>;
11
- summarize: (opts: {
12
- path: {
13
- id: string;
14
- };
15
- body: {
16
- providerID: string;
17
- modelID: string;
18
- };
19
- query: {
20
- directory: string;
21
- };
22
- }) => Promise<unknown>;
23
- revert: (opts: {
24
- path: {
25
- id: string;
26
- };
27
- body: {
28
- messageID: string;
29
- partID?: string;
30
- };
31
- query: {
32
- directory: string;
33
- };
34
- }) => Promise<unknown>;
35
- prompt_async: (opts: {
4
+ promptAsync: (opts: {
36
5
  path: {
37
6
  id: string;
38
7
  };
@@ -1,3 +1,6 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
1
2
  import type { ParsedTokenLimitError } from "./types";
2
3
  import type { ExperimentalConfig } from "../../config";
3
- export declare function attemptDeduplicationRecovery(sessionID: string, parsed: ParsedTokenLimitError, experimental: ExperimentalConfig | undefined): Promise<void>;
4
+ type OpencodeClient = PluginInput["client"];
5
+ export declare function attemptDeduplicationRecovery(sessionID: string, parsed: ParsedTokenLimitError, experimental: ExperimentalConfig | undefined, client?: OpencodeClient): Promise<void>;
6
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Client } from "./client";
2
+ export declare function fixEmptyMessagesWithSDK(params: {
3
+ sessionID: string;
4
+ client: Client;
5
+ placeholderText: string;
6
+ messageIndex?: number;
7
+ }): Promise<{
8
+ fixed: boolean;
9
+ fixedMessageIds: string[];
10
+ scannedEmptyCount: number;
11
+ }>;
@@ -1,4 +1,7 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
1
2
  export declare const PLACEHOLDER_TEXT = "[user interrupted]";
2
- export declare function sanitizeEmptyMessagesBeforeSummarize(sessionID: string): number;
3
+ type OpencodeClient = PluginInput["client"];
4
+ export declare function sanitizeEmptyMessagesBeforeSummarize(sessionID: string, client?: OpencodeClient): Promise<number>;
3
5
  export declare function formatBytes(bytes: number): string;
4
6
  export declare function getLastAssistant(sessionID: string, client: any, directory: string): Promise<Record<string, unknown> | null>;
7
+ export {};
@@ -1,2 +1,6 @@
1
- export declare function getMessageDir(sessionID: string): string;
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import { getMessageDir } from "../../shared/opencode-message-dir";
3
+ export { getMessageDir };
4
+ type OpencodeClient = PluginInput["client"];
5
+ export declare function getMessageIdsFromSDK(client: OpencodeClient, sessionID: string): Promise<string[]>;
2
6
  export declare function getMessageIds(sessionID: string): string[];
@@ -1,7 +1,10 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
1
2
  import type { PruningState } from "./pruning-types";
3
+ type OpencodeClient = PluginInput["client"];
2
4
  export interface DeduplicationConfig {
3
5
  enabled: boolean;
4
6
  protectedTools?: string[];
5
7
  }
6
8
  export declare function createToolSignature(toolName: string, input: unknown): string;
7
- export declare function executeDeduplication(sessionID: string, state: PruningState, config: DeduplicationConfig, protectedTools: Set<string>): number;
9
+ export declare function executeDeduplication(sessionID: string, state: PruningState, config: DeduplicationConfig, protectedTools: Set<string>, client?: OpencodeClient): Promise<number>;
10
+ export {};
@@ -1,3 +1,6 @@
1
- export declare function truncateToolOutputsByCallId(sessionID: string, callIds: Set<string>): {
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ type OpencodeClient = PluginInput["client"];
3
+ export declare function truncateToolOutputsByCallId(sessionID: string, callIds: Set<string>, client?: OpencodeClient): Promise<{
2
4
  truncatedCount: number;
3
- };
5
+ }>;
6
+ export {};
@@ -1,3 +1,3 @@
1
- export declare const MESSAGE_STORAGE_DIR: string;
2
- export declare const PART_STORAGE_DIR: string;
1
+ import { MESSAGE_STORAGE, PART_STORAGE } from "../../shared";
2
+ export { MESSAGE_STORAGE as MESSAGE_STORAGE_DIR, PART_STORAGE as PART_STORAGE_DIR };
3
3
  export declare const TRUNCATION_MESSAGE = "[TOOL RESULT TRUNCATED - Context limit exceeded. Original output was too large and has been truncated to recover the session. Please re-run this tool if you need the full output.]";
@@ -1,3 +1,4 @@
1
1
  export type { AggressiveTruncateResult, ToolResultInfo } from "./tool-part-types";
2
2
  export { countTruncatedResults, findLargestToolResult, findToolResultsBySize, getTotalToolOutputSize, truncateToolResult, } from "./tool-result-storage";
3
+ export { countTruncatedResultsFromSDK, findToolResultsBySizeFromSDK, getTotalToolOutputSizeFromSDK, truncateToolResultAsync, } from "./tool-result-storage-sdk";
3
4
  export { truncateUntilTargetTokens } from "./target-token-truncation";
@@ -1,2 +1,5 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
1
2
  import type { AggressiveTruncateResult } from "./tool-part-types";
2
- export declare function truncateUntilTargetTokens(sessionID: string, currentTokens: number, maxTokens: number, targetRatio?: number, charsPerToken?: number): AggressiveTruncateResult;
3
+ type OpencodeClient = PluginInput["client"];
4
+ export declare function truncateUntilTargetTokens(sessionID: string, currentTokens: number, maxTokens: number, targetRatio?: number, charsPerToken?: number, client?: OpencodeClient): Promise<AggressiveTruncateResult>;
5
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { ToolResultInfo } from "./tool-part-types";
3
+ type OpencodeClient = PluginInput["client"];
4
+ interface SDKToolPart {
5
+ id: string;
6
+ type: string;
7
+ callID?: string;
8
+ tool?: string;
9
+ state?: {
10
+ status?: string;
11
+ input?: Record<string, unknown>;
12
+ output?: string;
13
+ error?: string;
14
+ time?: {
15
+ start?: number;
16
+ end?: number;
17
+ compacted?: number;
18
+ };
19
+ };
20
+ }
21
+ export declare function findToolResultsBySizeFromSDK(client: OpencodeClient, sessionID: string): Promise<ToolResultInfo[]>;
22
+ export declare function truncateToolResultAsync(client: OpencodeClient, sessionID: string, messageID: string, partId: string, part: SDKToolPart): Promise<{
23
+ success: boolean;
24
+ toolName?: string;
25
+ originalSize?: number;
26
+ }>;
27
+ export declare function countTruncatedResultsFromSDK(client: OpencodeClient, sessionID: string): Promise<number>;
28
+ export declare function getTotalToolOutputSizeFromSDK(client: OpencodeClient, sessionID: string): Promise<number>;
29
+ export {};
@@ -1 +1,4 @@
1
- export declare function getLastAgentFromSession(sessionID: string): string | null;
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ type OpencodeClient = PluginInput["client"];
3
+ export declare function getLastAgentFromSession(sessionID: string, client?: OpencodeClient): Promise<string | null>;
4
+ export {};
@@ -1,4 +1,6 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
1
2
  export declare function createToolExecuteBeforeHandler(input: {
3
+ ctx: PluginInput;
2
4
  pendingFilePaths: Map<string, string>;
3
5
  }): (toolInput: {
4
6
  tool: string;