oh-my-opencode 3.5.6 → 3.6.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 (84) hide show
  1. package/dist/cli/index.js +101 -20
  2. package/dist/cli/run/types.d.ts +1 -1
  3. package/dist/features/background-agent/constants.d.ts +1 -1
  4. package/dist/features/background-agent/message-dir.d.ts +1 -1
  5. package/dist/features/background-agent/result-handler.d.ts +1 -1
  6. package/dist/features/claude-code-mcp-loader/loader.d.ts +1 -1
  7. package/dist/features/hook-message-injector/constants.d.ts +1 -3
  8. package/dist/features/hook-message-injector/index.d.ts +1 -1
  9. package/dist/features/hook-message-injector/injector.d.ts +51 -3
  10. package/dist/features/tmux-subagent/manager.d.ts +0 -1
  11. package/dist/hooks/agent-usage-reminder/constants.d.ts +0 -1
  12. package/dist/hooks/anthropic-context-window-limit-recovery/client.d.ts +3 -34
  13. package/dist/hooks/anthropic-context-window-limit-recovery/deduplication-recovery.d.ts +4 -1
  14. package/dist/hooks/anthropic-context-window-limit-recovery/empty-content-recovery-sdk.d.ts +11 -0
  15. package/dist/hooks/anthropic-context-window-limit-recovery/message-builder.d.ts +4 -1
  16. package/dist/hooks/anthropic-context-window-limit-recovery/message-storage-directory.d.ts +5 -1
  17. package/dist/hooks/anthropic-context-window-limit-recovery/pruning-deduplication.d.ts +4 -1
  18. package/dist/hooks/anthropic-context-window-limit-recovery/pruning-tool-output-truncation.d.ts +5 -2
  19. package/dist/hooks/anthropic-context-window-limit-recovery/storage-paths.d.ts +2 -2
  20. package/dist/hooks/anthropic-context-window-limit-recovery/storage.d.ts +1 -0
  21. package/dist/hooks/anthropic-context-window-limit-recovery/target-token-truncation.d.ts +4 -1
  22. package/dist/hooks/anthropic-context-window-limit-recovery/tool-result-storage-sdk.d.ts +29 -0
  23. package/dist/hooks/atlas/session-last-agent.d.ts +4 -1
  24. package/dist/hooks/atlas/tool-execute-before.d.ts +2 -0
  25. package/dist/hooks/context-window-monitor.d.ts +1 -1
  26. package/dist/hooks/directory-agents-injector/constants.d.ts +0 -1
  27. package/dist/hooks/directory-readme-injector/constants.d.ts +0 -1
  28. package/dist/hooks/interactive-bash-session/constants.d.ts +0 -1
  29. package/dist/hooks/prometheus-md-only/agent-resolution.d.ts +4 -1
  30. package/dist/hooks/ralph-loop/message-storage-directory.d.ts +1 -1
  31. package/dist/hooks/rules-injector/constants.d.ts +0 -1
  32. package/dist/hooks/session-recovery/constants.d.ts +1 -3
  33. package/dist/hooks/session-recovery/recover-empty-content-message-sdk.d.ts +13 -0
  34. package/dist/hooks/session-recovery/recover-empty-content-message.d.ts +1 -1
  35. package/dist/hooks/session-recovery/recover-thinking-block-order.d.ts +1 -1
  36. package/dist/hooks/session-recovery/recover-thinking-disabled-violation.d.ts +1 -1
  37. package/dist/hooks/session-recovery/storage/empty-text.d.ts +5 -0
  38. package/dist/hooks/session-recovery/storage/message-dir.d.ts +1 -1
  39. package/dist/hooks/session-recovery/storage/messages-reader.d.ts +4 -0
  40. package/dist/hooks/session-recovery/storage/parts-reader.d.ts +4 -0
  41. package/dist/hooks/session-recovery/storage/text-part-injector.d.ts +4 -0
  42. package/dist/hooks/session-recovery/storage/thinking-prepend.d.ts +4 -0
  43. package/dist/hooks/session-recovery/storage/thinking-strip.d.ts +4 -0
  44. package/dist/hooks/session-recovery/storage.d.ts +7 -0
  45. package/dist/hooks/sisyphus-junior-notepad/hook.d.ts +1 -1
  46. package/dist/hooks/todo-continuation-enforcer/message-directory.d.ts +1 -1
  47. package/dist/hooks/todo-continuation-enforcer/types.d.ts +1 -1
  48. package/dist/index.js +22515 -21580
  49. package/dist/plugin-config.d.ts +1 -1
  50. package/dist/plugin-handlers/agent-key-remapper.d.ts +1 -0
  51. package/dist/shared/agent-display-names.d.ts +5 -0
  52. package/dist/shared/index.d.ts +6 -1
  53. package/dist/shared/model-name-matcher.d.ts +0 -1
  54. package/dist/shared/normalize-sdk-response.d.ts +4 -0
  55. package/dist/shared/opencode-http-api.d.ts +3 -0
  56. package/dist/shared/opencode-storage-detection.d.ts +2 -0
  57. package/dist/shared/opencode-storage-paths.d.ts +4 -0
  58. package/dist/shared/opencode-version.d.ts +5 -0
  59. package/dist/shared/session-utils.d.ts +2 -2
  60. package/dist/tools/background-task/create-background-cancel.d.ts +1 -1
  61. package/dist/tools/background-task/create-background-task.d.ts +2 -2
  62. package/dist/tools/background-task/message-dir.d.ts +1 -1
  63. package/dist/tools/background-task/modules/background-cancel.d.ts +1 -1
  64. package/dist/tools/background-task/modules/utils.d.ts +2 -1
  65. package/dist/tools/call-omo-agent/background-agent-executor.d.ts +2 -1
  66. package/dist/tools/call-omo-agent/background-executor.d.ts +2 -1
  67. package/dist/tools/call-omo-agent/message-dir.d.ts +1 -1
  68. package/dist/tools/call-omo-agent/message-storage-directory.d.ts +1 -1
  69. package/dist/tools/delegate-task/parent-context-resolver.d.ts +2 -1
  70. package/dist/tools/delegate-task/sisyphus-junior-agent.d.ts +1 -1
  71. package/dist/tools/session-manager/constants.d.ts +1 -4
  72. package/dist/tools/session-manager/session-formatter.d.ts +1 -1
  73. package/dist/tools/session-manager/storage.d.ts +5 -2
  74. package/dist/tools/session-manager/types.d.ts +1 -1
  75. package/dist/tools/task/todo-sync.d.ts +2 -2
  76. package/package.json +8 -8
  77. package/dist/tools/task/task-action-create.d.ts +0 -4
  78. package/dist/tools/task/task-action-delete.d.ts +0 -2
  79. package/dist/tools/task/task-action-get.d.ts +0 -2
  80. package/dist/tools/task/task-action-list.d.ts +0 -2
  81. package/dist/tools/task/task-action-update.d.ts +0 -2
  82. package/dist/tools/task/task-id-validator.d.ts +0 -1
  83. package/dist/tools/task/task.d.ts +0 -3
  84. /package/dist/{features/background-agent/message-storage-locator.d.ts → shared/opencode-message-dir.d.ts} +0 -0
package/dist/cli/index.js CHANGED
@@ -4905,6 +4905,30 @@ var init_tool_name = () => {};
4905
4905
  // src/shared/file-utils.ts
4906
4906
  var init_file_utils = () => {};
4907
4907
 
4908
+ // src/shared/normalize-sdk-response.ts
4909
+ function normalizeSDKResponse(response, fallback, options) {
4910
+ if (response === null || response === undefined) {
4911
+ return fallback;
4912
+ }
4913
+ if (Array.isArray(response)) {
4914
+ return response;
4915
+ }
4916
+ if (typeof response === "object" && "data" in response) {
4917
+ const data = response.data;
4918
+ if (data !== null && data !== undefined) {
4919
+ return data;
4920
+ }
4921
+ if (options?.preferResponseOnMissingData === true) {
4922
+ return response;
4923
+ }
4924
+ return fallback;
4925
+ }
4926
+ if (options?.preferResponseOnMissingData === true) {
4927
+ return response;
4928
+ }
4929
+ return fallback;
4930
+ }
4931
+
4908
4932
  // src/shared/dynamic-truncator.ts
4909
4933
  var ANTHROPIC_ACTUAL_LIMIT;
4910
4934
  var init_dynamic_truncator = __esm(() => {
@@ -6678,6 +6702,15 @@ var NOT_CACHED;
6678
6702
  var init_opencode_version = __esm(() => {
6679
6703
  NOT_CACHED = Symbol("NOT_CACHED");
6680
6704
  });
6705
+
6706
+ // src/shared/opencode-storage-detection.ts
6707
+ var NOT_CACHED2, FALSE_PENDING_RETRY;
6708
+ var init_opencode_storage_detection = __esm(() => {
6709
+ init_data_path();
6710
+ init_opencode_version();
6711
+ NOT_CACHED2 = Symbol("NOT_CACHED");
6712
+ FALSE_PENDING_RETRY = Symbol("FALSE_PENDING_RETRY");
6713
+ });
6681
6714
  // src/shared/external-plugin-detector.ts
6682
6715
  var init_external_plugin_detector = __esm(() => {
6683
6716
  init_logger();
@@ -6975,19 +7008,16 @@ var init_model_resolver = __esm(() => {
6975
7008
  });
6976
7009
 
6977
7010
  // src/features/hook-message-injector/constants.ts
6978
- import { join as join6 } from "path";
6979
- var OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE;
6980
7011
  var init_constants = __esm(() => {
6981
- init_data_path();
6982
- OPENCODE_STORAGE = getOpenCodeStorageDir();
6983
- MESSAGE_STORAGE = join6(OPENCODE_STORAGE, "message");
6984
- PART_STORAGE = join6(OPENCODE_STORAGE, "part");
7012
+ init_shared();
6985
7013
  });
6986
7014
 
6987
7015
  // src/features/hook-message-injector/injector.ts
6988
7016
  var init_injector = __esm(() => {
6989
7017
  init_constants();
6990
7018
  init_logger();
7019
+ init_opencode_storage_detection();
7020
+ init_shared();
6991
7021
  });
6992
7022
 
6993
7023
  // src/features/hook-message-injector/index.ts
@@ -6996,9 +7026,50 @@ var init_hook_message_injector = __esm(() => {
6996
7026
  init_constants();
6997
7027
  });
6998
7028
 
7029
+ // src/shared/opencode-storage-paths.ts
7030
+ import { join as join6 } from "path";
7031
+ var OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE, SESSION_STORAGE;
7032
+ var init_opencode_storage_paths = __esm(() => {
7033
+ init_data_path();
7034
+ OPENCODE_STORAGE = getOpenCodeStorageDir();
7035
+ MESSAGE_STORAGE = join6(OPENCODE_STORAGE, "message");
7036
+ PART_STORAGE = join6(OPENCODE_STORAGE, "part");
7037
+ SESSION_STORAGE = join6(OPENCODE_STORAGE, "session");
7038
+ });
7039
+
7040
+ // src/shared/opencode-message-dir.ts
7041
+ var init_opencode_message_dir = __esm(() => {
7042
+ init_opencode_storage_paths();
7043
+ init_opencode_storage_detection();
7044
+ init_logger();
7045
+ });
7046
+
7047
+ // src/shared/agent-display-names.ts
7048
+ var AGENT_DISPLAY_NAMES, REVERSE_DISPLAY_NAMES;
7049
+ var init_agent_display_names = __esm(() => {
7050
+ AGENT_DISPLAY_NAMES = {
7051
+ sisyphus: "Sisyphus (Ultraworker)",
7052
+ hephaestus: "Hephaestus (Deep Agent)",
7053
+ prometheus: "Prometheus (Plan Builder)",
7054
+ atlas: "Atlas (Plan Executor)",
7055
+ "sisyphus-junior": "Sisyphus-Junior",
7056
+ metis: "Metis (Plan Consultant)",
7057
+ momus: "Momus (Plan Critic)",
7058
+ oracle: "oracle",
7059
+ librarian: "librarian",
7060
+ explore: "explore",
7061
+ "multimodal-looker": "multimodal-looker"
7062
+ };
7063
+ REVERSE_DISPLAY_NAMES = Object.fromEntries(Object.entries(AGENT_DISPLAY_NAMES).map(([key, displayName]) => [displayName.toLowerCase(), key]));
7064
+ });
7065
+
6999
7066
  // src/shared/session-utils.ts
7000
7067
  var init_session_utils = __esm(() => {
7001
7068
  init_hook_message_injector();
7069
+ init_opencode_message_dir();
7070
+ init_opencode_storage_detection();
7071
+ init_logger();
7072
+ init_agent_display_names();
7002
7073
  });
7003
7074
  // src/shared/tmux/constants.ts
7004
7075
  var SESSION_TIMEOUT_MS;
@@ -7057,6 +7128,11 @@ var init_model_suggestion_retry = __esm(() => {
7057
7128
  var init_opencode_server_auth = __esm(() => {
7058
7129
  init_logger();
7059
7130
  });
7131
+ // src/shared/opencode-http-api.ts
7132
+ var init_opencode_http_api = __esm(() => {
7133
+ init_opencode_server_auth();
7134
+ init_logger();
7135
+ });
7060
7136
 
7061
7137
  // src/shared/port-utils.ts
7062
7138
  async function isPortAvailable(port, hostname = "127.0.0.1") {
@@ -7120,6 +7196,7 @@ var init_shared = __esm(() => {
7120
7196
  init_migration();
7121
7197
  init_opencode_config_dir();
7122
7198
  init_opencode_version();
7199
+ init_opencode_storage_detection();
7123
7200
  init_external_plugin_detector();
7124
7201
  init_zip_extractor();
7125
7202
  init_binary_downloader();
@@ -7135,9 +7212,12 @@ var init_shared = __esm(() => {
7135
7212
  init_tmux();
7136
7213
  init_model_suggestion_retry();
7137
7214
  init_opencode_server_auth();
7215
+ init_opencode_http_api();
7138
7216
  init_port_utils();
7139
7217
  init_git_worktree();
7140
7218
  init_safe_create_hook();
7219
+ init_opencode_storage_paths();
7220
+ init_opencode_message_dir();
7141
7221
  });
7142
7222
 
7143
7223
  // src/cli/config-manager/config-context.ts
@@ -8877,7 +8957,7 @@ var {
8877
8957
  // package.json
8878
8958
  var package_default = {
8879
8959
  name: "oh-my-opencode",
8880
- version: "3.5.6",
8960
+ version: "3.6.0",
8881
8961
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
8882
8962
  main: "dist/index.js",
8883
8963
  types: "dist/index.d.ts",
@@ -8951,13 +9031,13 @@ var package_default = {
8951
9031
  typescript: "^5.7.3"
8952
9032
  },
8953
9033
  optionalDependencies: {
8954
- "oh-my-opencode-darwin-arm64": "3.5.6",
8955
- "oh-my-opencode-darwin-x64": "3.5.6",
8956
- "oh-my-opencode-linux-arm64": "3.5.6",
8957
- "oh-my-opencode-linux-arm64-musl": "3.5.6",
8958
- "oh-my-opencode-linux-x64": "3.5.6",
8959
- "oh-my-opencode-linux-x64-musl": "3.5.6",
8960
- "oh-my-opencode-windows-x64": "3.5.6"
9034
+ "oh-my-opencode-darwin-arm64": "3.6.0",
9035
+ "oh-my-opencode-darwin-x64": "3.6.0",
9036
+ "oh-my-opencode-linux-arm64": "3.6.0",
9037
+ "oh-my-opencode-linux-arm64-musl": "3.6.0",
9038
+ "oh-my-opencode-linux-x64": "3.6.0",
9039
+ "oh-my-opencode-linux-x64-musl": "3.6.0",
9040
+ "oh-my-opencode-windows-x64": "3.6.0"
8961
9041
  },
8962
9042
  trustedDependencies: [
8963
9043
  "@ast-grep/cli",
@@ -23004,7 +23084,7 @@ function parseConfigPartially(rawConfig) {
23004
23084
  }
23005
23085
  return partialConfig;
23006
23086
  }
23007
- function loadConfigFromPath(configPath, ctx) {
23087
+ function loadConfigFromPath(configPath, _ctx) {
23008
23088
  try {
23009
23089
  if (fs3.existsSync(configPath)) {
23010
23090
  const content = fs3.readFileSync(configPath, "utf-8");
@@ -24735,6 +24815,7 @@ var resolveRunAgent = (options, pluginConfig, env = process.env) => {
24735
24815
  var import_picocolors13 = __toESM(require_picocolors(), 1);
24736
24816
 
24737
24817
  // src/cli/run/completion.ts
24818
+ init_shared();
24738
24819
  var import_picocolors12 = __toESM(require_picocolors(), 1);
24739
24820
  async function checkCompletionConditions(ctx) {
24740
24821
  try {
@@ -24752,7 +24833,7 @@ async function checkCompletionConditions(ctx) {
24752
24833
  }
24753
24834
  async function areAllTodosComplete(ctx) {
24754
24835
  const todosRes = await ctx.client.session.todo({ path: { id: ctx.sessionID } });
24755
- const todos = todosRes.data ?? [];
24836
+ const todos = normalizeSDKResponse(todosRes, []);
24756
24837
  const incompleteTodos = todos.filter((t) => t.status !== "completed" && t.status !== "cancelled");
24757
24838
  if (incompleteTodos.length > 0) {
24758
24839
  console.log(import_picocolors12.default.dim(` Waiting: ${incompleteTodos.length} todos remaining`));
@@ -24766,13 +24847,13 @@ async function areAllChildrenIdle(ctx) {
24766
24847
  }
24767
24848
  async function fetchAllStatuses(ctx) {
24768
24849
  const statusRes = await ctx.client.session.status();
24769
- return statusRes.data ?? {};
24850
+ return normalizeSDKResponse(statusRes, {});
24770
24851
  }
24771
24852
  async function areAllDescendantsIdle(ctx, sessionID, allStatuses) {
24772
24853
  const childrenRes = await ctx.client.session.children({
24773
24854
  path: { id: sessionID }
24774
24855
  });
24775
- const children = childrenRes.data ?? [];
24856
+ const children = normalizeSDKResponse(childrenRes, []);
24776
24857
  for (const child of children) {
24777
24858
  const status = allStatuses[child.id];
24778
24859
  if (status && status.type !== "idle") {
@@ -26782,7 +26863,7 @@ async function getOrRegisterClient(options) {
26782
26863
  }
26783
26864
  }
26784
26865
  function parseRegistrationResponse(data) {
26785
- if (!isRecord(data))
26866
+ if (!isRecord2(data))
26786
26867
  return null;
26787
26868
  const clientId = data.client_id;
26788
26869
  if (typeof clientId !== "string" || clientId.length === 0)
@@ -26793,7 +26874,7 @@ function parseRegistrationResponse(data) {
26793
26874
  }
26794
26875
  return { clientId };
26795
26876
  }
26796
- function isRecord(value) {
26877
+ function isRecord2(value) {
26797
26878
  return typeof value === "object" && value !== null;
26798
26879
  }
26799
26880
 
@@ -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;
@@ -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;
@@ -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,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 {};
@@ -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;
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import type { PluginInput } from "@opencode-ai/plugin";
2
- export declare function createContextWindowMonitorHook(ctx: PluginInput): {
2
+ export declare function createContextWindowMonitorHook(_ctx: PluginInput): {
3
3
  "tool.execute.after": (input: {
4
4
  tool: string;
5
5
  sessionID: string;
@@ -1,3 +1,2 @@
1
- export declare const OPENCODE_STORAGE: string;
2
1
  export declare const AGENTS_INJECTOR_STORAGE: string;
3
2
  export declare const AGENTS_FILENAME = "AGENTS.md";
@@ -1,3 +1,2 @@
1
- export declare const OPENCODE_STORAGE: string;
2
1
  export declare const README_INJECTOR_STORAGE: string;
3
2
  export declare const README_FILENAME = "README.md";
@@ -1,4 +1,3 @@
1
- export declare const OPENCODE_STORAGE: string;
2
1
  export declare const INTERACTIVE_BASH_SESSION_STORAGE: string;
3
2
  export declare const OMO_SESSION_PREFIX = "omo-";
4
3
  export declare function buildSessionReminderMessage(sessions: string[]): string;
@@ -1,3 +1,5 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ type OpencodeClient = PluginInput["client"];
1
3
  /**
2
4
  * Get the effective agent for the session.
3
5
  * Priority order:
@@ -10,4 +12,5 @@
10
12
  * - Message files return "prometheus" (oldest message from /plan)
11
13
  * - But boulder.json has agent: "atlas" (set by /start-work)
12
14
  */
13
- export declare function getAgentFromSession(sessionID: string, directory: string): string | undefined;
15
+ export declare function getAgentFromSession(sessionID: string, directory: string, client?: OpencodeClient): Promise<string | undefined>;
16
+ export {};
@@ -1 +1 @@
1
- export declare function getMessageDir(sessionID: string): string | null;
1
+ export { getMessageDir } from "../../shared/opencode-message-dir";
@@ -1,4 +1,3 @@
1
- export declare const OPENCODE_STORAGE: string;
2
1
  export declare const RULES_INJECTOR_STORAGE: string;
3
2
  export declare const PROJECT_MARKERS: string[];
4
3
  export declare const PROJECT_RULE_SUBDIRS: [string, string][];
@@ -1,6 +1,4 @@
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";
4
2
  export declare const THINKING_TYPES: Set<string>;
5
3
  export declare const META_TYPES: Set<string>;
6
4
  export declare const CONTENT_TYPES: Set<string>;
@@ -0,0 +1,13 @@
1
+ import type { createOpencodeClient } from "@opencode-ai/sdk";
2
+ import type { MessageData } from "./types";
3
+ type Client = ReturnType<typeof createOpencodeClient>;
4
+ type ReplaceEmptyTextPartsAsync = (client: Client, sessionID: string, messageID: string, replacementText: string) => Promise<boolean>;
5
+ type InjectTextPartAsync = (client: Client, sessionID: string, messageID: string, text: string) => Promise<boolean>;
6
+ type FindMessagesWithEmptyTextPartsFromSDK = (client: Client, sessionID: string) => Promise<string[]>;
7
+ export declare function recoverEmptyContentMessageFromSDK(client: Client, sessionID: string, failedAssistantMsg: MessageData, error: unknown, dependencies: {
8
+ placeholderText: string;
9
+ replaceEmptyTextPartsAsync: ReplaceEmptyTextPartsAsync;
10
+ injectTextPartAsync: InjectTextPartAsync;
11
+ findMessagesWithEmptyTextPartsFromSDK: FindMessagesWithEmptyTextPartsFromSDK;
12
+ }): Promise<boolean>;
13
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { createOpencodeClient } from "@opencode-ai/sdk";
2
2
  import type { MessageData } from "./types";
3
3
  type Client = ReturnType<typeof createOpencodeClient>;
4
- export declare function recoverEmptyContentMessage(_client: Client, sessionID: string, failedAssistantMsg: MessageData, _directory: string, error: unknown): Promise<boolean>;
4
+ export declare function recoverEmptyContentMessage(client: Client, sessionID: string, failedAssistantMsg: MessageData, _directory: string, error: unknown): Promise<boolean>;
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { createOpencodeClient } from "@opencode-ai/sdk";
2
2
  import type { MessageData } from "./types";
3
3
  type Client = ReturnType<typeof createOpencodeClient>;
4
- export declare function recoverThinkingBlockOrder(_client: Client, sessionID: string, _failedAssistantMsg: MessageData, _directory: string, error: unknown): Promise<boolean>;
4
+ export declare function recoverThinkingBlockOrder(client: Client, sessionID: string, _failedAssistantMsg: MessageData, _directory: string, error: unknown): Promise<boolean>;
5
5
  export {};