oh-my-opencode 3.13.1 → 3.15.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 (256) hide show
  1. package/README.ja.md +2 -2
  2. package/README.ko.md +2 -2
  3. package/README.md +16 -8
  4. package/README.ru.md +2 -2
  5. package/README.zh-cn.md +2 -2
  6. package/bin/oh-my-opencode.js +11 -0
  7. package/bin/platform.js +13 -13
  8. package/bin/platform.test.ts +15 -0
  9. package/dist/agents/atlas/agent.d.ts +1 -1
  10. package/dist/agents/atlas/default-prompt-sections.d.ts +6 -0
  11. package/dist/agents/atlas/default.d.ts +0 -9
  12. package/dist/agents/atlas/gemini-prompt-sections.d.ts +6 -0
  13. package/dist/agents/atlas/gemini.d.ts +0 -9
  14. package/dist/agents/atlas/gpt-prompt-sections.d.ts +6 -0
  15. package/dist/agents/atlas/gpt.d.ts +0 -9
  16. package/dist/agents/atlas/shared-prompt.d.ts +9 -0
  17. package/dist/agents/dynamic-agent-category-skills-guide.d.ts +2 -0
  18. package/dist/agents/dynamic-agent-core-sections.d.ts +10 -0
  19. package/dist/agents/dynamic-agent-policy-sections.d.ts +6 -0
  20. package/dist/agents/dynamic-agent-prompt-builder.d.ts +5 -35
  21. package/dist/agents/dynamic-agent-prompt-types.d.ts +20 -0
  22. package/dist/agents/dynamic-agent-tool-categorization.d.ts +3 -0
  23. package/dist/agents/hephaestus/agent.d.ts +1 -1
  24. package/dist/agents/hephaestus/gpt-5-3-codex.d.ts +1 -1
  25. package/dist/agents/hephaestus/gpt.d.ts +1 -1
  26. package/dist/agents/momus.d.ts +2 -2
  27. package/dist/agents/prometheus/behavioral-summary.d.ts +1 -1
  28. package/dist/agents/prometheus/identity-constraints.d.ts +1 -1
  29. package/dist/agents/prometheus/plan-generation.d.ts +1 -1
  30. package/dist/agents/prometheus/plan-template.d.ts +1 -1
  31. package/dist/agents/sisyphus/gpt-5-4.d.ts +14 -14
  32. package/dist/agents/sisyphus/index.d.ts +1 -1
  33. package/dist/agents/sisyphus.d.ts +1 -1
  34. package/dist/agents/types.d.ts +3 -1
  35. package/dist/cli/doctor/checks/model-resolution-types.d.ts +3 -0
  36. package/dist/cli/doctor/checks/model-resolution.d.ts +2 -1
  37. package/dist/cli/doctor/constants.d.ts +1 -1
  38. package/dist/cli/index.js +42241 -390
  39. package/dist/cli/mcp-oauth/login.d.ts +6 -1
  40. package/dist/cli/refresh-model-capabilities.d.ts +15 -0
  41. package/dist/cli/run/event-state.d.ts +0 -2
  42. package/dist/cli/run/types.d.ts +0 -1
  43. package/dist/config/index.d.ts +1 -1
  44. package/dist/config/schema/agent-names.d.ts +2 -0
  45. package/dist/config/schema/agent-overrides.d.ts +675 -15
  46. package/dist/config/schema/background-task.d.ts +2 -0
  47. package/dist/config/schema/categories.d.ts +90 -2
  48. package/dist/config/schema/commands.d.ts +1 -0
  49. package/dist/config/schema/dynamic-context-pruning.d.ts +1 -1
  50. package/dist/config/schema/experimental.d.ts +2 -1
  51. package/dist/config/schema/fallback-models.d.ts +111 -1
  52. package/dist/config/schema/hooks.d.ts +3 -0
  53. package/dist/config/schema/model-capabilities.d.ts +8 -0
  54. package/dist/config/schema/oh-my-opencode-config.d.ts +696 -17
  55. package/dist/config/schema/sisyphus-agent.d.ts +1 -0
  56. package/dist/config/schema/tmux.d.ts +11 -0
  57. package/dist/config/schema.d.ts +1 -0
  58. package/dist/create-hooks.d.ts +6 -0
  59. package/dist/create-runtime-tmux-config.d.ts +9 -0
  60. package/dist/features/background-agent/abort-with-timeout.d.ts +2 -0
  61. package/dist/features/background-agent/background-task-notification-template.d.ts +10 -4
  62. package/dist/features/background-agent/constants.d.ts +1 -0
  63. package/dist/features/background-agent/fallback-retry-handler.d.ts +1 -1
  64. package/dist/features/background-agent/manager.d.ts +10 -0
  65. package/dist/features/background-agent/process-cleanup.d.ts +1 -1
  66. package/dist/features/background-agent/session-existence.d.ts +3 -0
  67. package/dist/features/background-agent/task-poller.d.ts +1 -0
  68. package/dist/features/background-agent/types.d.ts +5 -10
  69. package/dist/features/builtin-commands/commands.d.ts +4 -1
  70. package/dist/features/builtin-commands/templates/handoff.d.ts +1 -1
  71. package/dist/features/builtin-commands/templates/init-deep.d.ts +1 -1
  72. package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -0
  73. package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
  74. package/dist/features/builtin-commands/types.d.ts +1 -1
  75. package/dist/features/builtin-skills/skills/ai-slop-remover.d.ts +2 -0
  76. package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +1 -0
  77. package/dist/features/builtin-skills/skills/git-master-sections/history-search-workflow.d.ts +1 -0
  78. package/dist/features/builtin-skills/skills/git-master-sections/overview.d.ts +1 -0
  79. package/dist/features/builtin-skills/skills/git-master-sections/quick-reference.d.ts +1 -0
  80. package/dist/features/builtin-skills/skills/git-master-sections/rebase-workflow.d.ts +1 -0
  81. package/dist/features/builtin-skills/skills/index.d.ts +2 -0
  82. package/dist/features/builtin-skills/skills/playwright-cli.d.ts +1 -1
  83. package/dist/features/builtin-skills/skills/review-work.d.ts +2 -0
  84. package/dist/features/claude-code-mcp-loader/configure-allowed-env-vars.d.ts +5 -0
  85. package/dist/features/claude-code-mcp-loader/index.d.ts +1 -0
  86. package/dist/features/claude-code-mcp-loader/scope-filter.d.ts +2 -0
  87. package/dist/features/claude-code-mcp-loader/types.d.ts +8 -4
  88. package/dist/features/claude-code-session-state/state.d.ts +2 -0
  89. package/dist/features/context-injector/collector.d.ts +1 -0
  90. package/dist/features/opencode-skill-loader/async-loader.d.ts +2 -2
  91. package/dist/features/opencode-skill-loader/loader.d.ts +2 -0
  92. package/dist/features/skill-mcp-manager/manager.d.ts +4 -1
  93. package/dist/features/skill-mcp-manager/oauth-handler.d.ts +5 -4
  94. package/dist/features/skill-mcp-manager/types.d.ts +7 -0
  95. package/dist/features/tmux-subagent/manager.d.ts +15 -13
  96. package/dist/features/tmux-subagent/polling-manager.d.ts +5 -0
  97. package/dist/features/tmux-subagent/types.d.ts +2 -0
  98. package/dist/hooks/agent-usage-reminder/constants.d.ts +1 -1
  99. package/dist/hooks/anthropic-context-window-limit-recovery/message-builder.d.ts +4 -1
  100. package/dist/hooks/anthropic-context-window-limit-recovery/recovery-hook.d.ts +10 -0
  101. package/dist/hooks/anthropic-context-window-limit-recovery/recovery-hook.test-support.d.ts +29 -0
  102. package/dist/hooks/anthropic-context-window-limit-recovery/session-timeout-map.d.ts +2 -0
  103. package/dist/hooks/anthropic-context-window-limit-recovery/state.d.ts +2 -0
  104. package/dist/hooks/anthropic-context-window-limit-recovery/types.d.ts +1 -0
  105. package/dist/hooks/atlas/subagent-session-id.d.ts +1 -0
  106. package/dist/hooks/atlas/system-reminder-templates.d.ts +2 -2
  107. package/dist/hooks/auto-slash-command/executor.d.ts +1 -0
  108. package/dist/hooks/auto-slash-command/hook.d.ts +1 -0
  109. package/dist/hooks/auto-update-checker/hook/background-update-check.d.ts +29 -1
  110. package/dist/hooks/auto-update-checker/hook/model-capabilities-status.d.ts +2 -0
  111. package/dist/hooks/auto-update-checker/types.d.ts +2 -0
  112. package/dist/hooks/bash-file-read-guard.d.ts +2 -0
  113. package/dist/hooks/claude-code-hooks/claude-code-hooks-hook.d.ts +1 -0
  114. package/dist/hooks/claude-code-hooks/config-loader.d.ts +1 -0
  115. package/dist/hooks/claude-code-hooks/config.d.ts +1 -0
  116. package/dist/hooks/claude-code-hooks/handlers/session-event-handler.d.ts +3 -1
  117. package/dist/hooks/claude-code-hooks/session-hook-state.d.ts +1 -0
  118. package/dist/hooks/claude-code-hooks/tool-input-cache.d.ts +2 -0
  119. package/dist/hooks/claude-code-hooks/transcript.d.ts +1 -3
  120. package/dist/hooks/comment-checker/hook.d.ts +1 -0
  121. package/dist/hooks/comment-checker/pending-calls.d.ts +1 -0
  122. package/dist/hooks/index.d.ts +3 -0
  123. package/dist/hooks/keyword-detector/ultrawork/default.d.ts +1 -1
  124. package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +1 -1
  125. package/dist/hooks/keyword-detector/ultrawork/gpt.d.ts +1 -1
  126. package/dist/hooks/legacy-plugin-toast/auto-migrate-runner.d.ts +2 -0
  127. package/dist/hooks/legacy-plugin-toast/auto-migrate.d.ts +7 -0
  128. package/dist/hooks/legacy-plugin-toast/hook.d.ts +18 -0
  129. package/dist/hooks/legacy-plugin-toast/index.d.ts +1 -0
  130. package/dist/hooks/legacy-plugin-toast/plugin-entry-migrator.d.ts +1 -0
  131. package/dist/hooks/model-fallback/chat-message-fallback-handler.d.ts +23 -0
  132. package/dist/hooks/model-fallback/hook.d.ts +5 -0
  133. package/dist/hooks/model-fallback/next-fallback.d.ts +6 -0
  134. package/dist/hooks/ralph-loop/completion-promise-detector-test-input.d.ts +11 -0
  135. package/dist/hooks/rules-injector/constants.d.ts +1 -0
  136. package/dist/hooks/rules-injector/finder.d.ts +1 -1
  137. package/dist/hooks/rules-injector/hook.d.ts +2 -0
  138. package/dist/hooks/rules-injector/injector.d.ts +2 -0
  139. package/dist/hooks/rules-injector/rule-file-finder.d.ts +9 -1
  140. package/dist/hooks/runtime-fallback/fallback-models.d.ts +12 -0
  141. package/dist/hooks/runtime-fallback/retry-model-payload.d.ts +5 -1
  142. package/dist/hooks/start-work/context-info-builder.d.ts +12 -0
  143. package/dist/hooks/start-work/start-work-hook.d.ts +7 -0
  144. package/dist/hooks/start-work/worktree-block.d.ts +1 -0
  145. package/dist/hooks/todo-continuation-enforcer/resolve-message-info.d.ts +2 -2
  146. package/dist/hooks/todo-continuation-enforcer/types.d.ts +4 -0
  147. package/dist/hooks/todo-description-override/description.d.ts +1 -1
  148. package/dist/hooks/tool-pair-validator/hook.d.ts +28 -0
  149. package/dist/hooks/tool-pair-validator/index.d.ts +1 -0
  150. package/dist/hooks/write-existing-file-guard/hook.d.ts +12 -0
  151. package/dist/hooks/write-existing-file-guard/session-read-permissions.d.ts +3 -0
  152. package/dist/hooks/write-existing-file-guard/tool-execute-before-handler.d.ts +15 -0
  153. package/dist/index.js +112232 -65637
  154. package/dist/mcp/websearch.d.ts +2 -2
  155. package/dist/oh-my-opencode.schema.json +2034 -4
  156. package/dist/openclaw/dispatcher.d.ts +6 -0
  157. package/dist/plugin/chat-params.d.ts +1 -0
  158. package/dist/plugin/command-execute-before.d.ts +17 -0
  159. package/dist/plugin/hooks/create-core-hooks.d.ts +3 -0
  160. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -1
  161. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +2 -1
  162. package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -1
  163. package/dist/plugin/tool-registry.d.ts +1 -0
  164. package/dist/plugin/types.d.ts +1 -0
  165. package/dist/plugin-dispose.d.ts +3 -0
  166. package/dist/shared/agent-display-names.d.ts +8 -0
  167. package/dist/shared/archive-entry-validator.d.ts +6 -0
  168. package/dist/shared/background-output-consumption.d.ts +5 -0
  169. package/dist/shared/connected-providers-cache.d.ts +22 -6
  170. package/dist/shared/contains-path.d.ts +2 -0
  171. package/dist/shared/external-plugin-detector.d.ts +14 -0
  172. package/dist/shared/fallback-chain-from-models.d.ts +10 -1
  173. package/dist/shared/index.d.ts +10 -1
  174. package/dist/shared/is-abort-error.d.ts +1 -0
  175. package/dist/shared/json-file-cache-store.d.ts +16 -0
  176. package/dist/shared/jsonc-parser.d.ts +1 -0
  177. package/dist/shared/known-variants.d.ts +6 -0
  178. package/dist/shared/legacy-plugin-warning.d.ts +7 -0
  179. package/dist/shared/load-opencode-plugins.d.ts +1 -0
  180. package/dist/shared/log-legacy-plugin-startup-warning.d.ts +10 -0
  181. package/dist/shared/migrate-legacy-config-file.d.ts +1 -0
  182. package/dist/shared/migrate-legacy-plugin-entry.d.ts +1 -0
  183. package/dist/shared/model-capabilities/bundled-snapshot.d.ts +2 -0
  184. package/dist/shared/model-capabilities/get-model-capabilities.d.ts +2 -0
  185. package/dist/shared/model-capabilities/index.d.ts +3 -0
  186. package/dist/shared/model-capabilities/runtime-model-readers.d.ts +11 -0
  187. package/dist/shared/model-capabilities/types.d.ts +94 -0
  188. package/dist/shared/model-capabilities-cache.d.ts +20 -0
  189. package/dist/shared/model-capability-aliases.d.ts +21 -0
  190. package/dist/shared/model-capability-guardrails.d.ts +38 -0
  191. package/dist/shared/model-capability-heuristics.d.ts +10 -0
  192. package/dist/shared/model-requirements.d.ts +8 -0
  193. package/dist/shared/model-resolution-types.d.ts +13 -0
  194. package/dist/shared/model-resolver.d.ts +10 -3
  195. package/dist/shared/model-settings-compatibility.d.ts +40 -0
  196. package/dist/shared/model-suggestion-retry.d.ts +0 -9
  197. package/dist/shared/plugin-entry-migrator.d.ts +3 -0
  198. package/dist/shared/plugin-identity.d.ts +4 -3
  199. package/dist/shared/project-discovery-dirs.d.ts +4 -0
  200. package/dist/shared/session-category-registry.d.ts +0 -24
  201. package/dist/shared/session-cursor.d.ts +6 -0
  202. package/dist/shared/session-prompt-params-helpers.d.ts +12 -0
  203. package/dist/shared/session-prompt-params-state.d.ts +9 -0
  204. package/dist/shared/skill-path-resolver.d.ts +0 -8
  205. package/dist/shared/task-system-enabled.d.ts +6 -0
  206. package/dist/shared/tmux/tmux-utils/server-health.d.ts +1 -0
  207. package/dist/shared/tmux/tmux-utils/session-spawn.d.ts +3 -0
  208. package/dist/shared/tmux/tmux-utils/window-spawn.d.ts +3 -0
  209. package/dist/shared/tmux/tmux-utils.d.ts +3 -1
  210. package/dist/shared/write-file-atomically.d.ts +1 -0
  211. package/dist/shared/zip-entry-listing/powershell-zip-entry-listing.d.ts +4 -0
  212. package/dist/shared/zip-entry-listing/python-zip-entry-listing.d.ts +3 -0
  213. package/dist/shared/zip-entry-listing/read-zip-symlink-target.d.ts +1 -0
  214. package/dist/shared/zip-entry-listing/tar-zip-entry-listing.d.ts +3 -0
  215. package/dist/shared/zip-entry-listing/zipinfo-zip-entry-listing.d.ts +4 -0
  216. package/dist/shared/zip-entry-listing.d.ts +4 -0
  217. package/dist/tools/call-omo-agent/background-executor.d.ts +2 -1
  218. package/dist/tools/call-omo-agent/sync-executor.d.ts +2 -1
  219. package/dist/tools/delegate-task/anthropic-categories.d.ts +2 -0
  220. package/dist/tools/delegate-task/background-task.d.ts +2 -6
  221. package/dist/tools/delegate-task/builtin-categories.d.ts +4 -0
  222. package/dist/tools/delegate-task/builtin-category-definition.d.ts +7 -0
  223. package/dist/tools/delegate-task/category-resolver.d.ts +2 -5
  224. package/dist/tools/delegate-task/constants.d.ts +1 -12
  225. package/dist/tools/delegate-task/executor-types.d.ts +2 -1
  226. package/dist/tools/delegate-task/google-categories.d.ts +2 -0
  227. package/dist/tools/delegate-task/kimi-categories.d.ts +2 -0
  228. package/dist/tools/delegate-task/model-selection.d.ts +2 -0
  229. package/dist/tools/delegate-task/openai-categories.d.ts +2 -0
  230. package/dist/tools/delegate-task/prompt-builder.d.ts +1 -1
  231. package/dist/tools/delegate-task/subagent-resolver.d.ts +3 -6
  232. package/dist/tools/delegate-task/sync-prompt-sender.d.ts +4 -6
  233. package/dist/tools/delegate-task/sync-session-poller.d.ts +1 -0
  234. package/dist/tools/delegate-task/sync-task.d.ts +2 -6
  235. package/dist/tools/delegate-task/types.d.ts +5 -6
  236. package/dist/tools/delegate-task/unstable-agent-task.d.ts +2 -6
  237. package/dist/tools/grep/cli.d.ts +3 -2
  238. package/dist/tools/grep/constants.d.ts +1 -2
  239. package/dist/tools/hashline-edit/tool-description.d.ts +1 -1
  240. package/dist/tools/look-at/constants.d.ts +1 -1
  241. package/dist/tools/lsp/infer-extension.d.ts +1 -0
  242. package/dist/tools/session-manager/file-storage.d.ts +8 -0
  243. package/dist/tools/session-manager/sdk-storage.d.ts +8 -0
  244. package/dist/tools/session-manager/sdk-unavailable.d.ts +1 -0
  245. package/dist/tools/session-manager/storage.d.ts +1 -1
  246. package/dist/tools/skill/description-formatter.d.ts +3 -0
  247. package/dist/tools/skill/mcp-capability-formatter.d.ts +3 -0
  248. package/dist/tools/skill/native-skills.d.ts +12 -0
  249. package/dist/tools/skill/scope-priority.d.ts +4 -0
  250. package/dist/tools/skill/skill-body.d.ts +2 -0
  251. package/dist/tools/skill/skill-matcher.d.ts +5 -0
  252. package/dist/tools/skill/types.d.ts +30 -2
  253. package/dist/tools/skill-mcp/tools.d.ts +1 -1
  254. package/package.json +16 -14
  255. package/postinstall.mjs +12 -0
  256. package/dist/hooks/openclaw.d.ts +0 -11
@@ -7,5 +7,5 @@
7
7
  * - Two-track parallel context gathering (Direct tools + Background agents)
8
8
  * - Deterministic tool usage and explicit decision criteria
9
9
  */
10
- export declare const ULTRAWORK_GPT_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Think deeply before acting.\n\n<output_verbosity_spec>\n- Default: 1-2 short paragraphs. Do not default to bullets.\n- Simple yes/no questions: \u22642 sentences.\n- Complex multi-file tasks: 1 overview paragraph + up to 4 high-level sections grouped by outcome, not by file.\n- Use lists only when content is inherently list-shaped (distinct items, steps, options).\n- Do not rephrase the user's request unless it changes semantics.\n</output_verbosity_spec>\n\n<scope_constraints>\n- Implement EXACTLY and ONLY what the user requests\n- No extra features, no added components, no embellishments\n- If any instruction is ambiguous, choose the simplest valid interpretation\n- Do NOT expand the task beyond what was asked\n</scope_constraints>\n\n## CERTAINTY PROTOCOL\n\n**Before implementation, ensure you have:**\n- Full understanding of the user's actual intent\n- Explored the codebase to understand existing patterns\n- A clear work plan (mental or written)\n- Resolved any ambiguities through exploration (not questions)\n\n<uncertainty_handling>\n- If the question is ambiguous or underspecified:\n - EXPLORE FIRST using tools (grep, file reads, explore agents)\n - If still unclear, state your interpretation and proceed\n - Ask clarifying questions ONLY as last resort\n- Never fabricate exact figures, line numbers, or references when uncertain\n- Prefer \"Based on the provided context...\" over absolute claims when unsure\n</uncertainty_handling>\n\n## DECISION FRAMEWORK: Self vs Delegate\n\n**Evaluate each task against these criteria to decide:**\n\n| Complexity | Criteria | Decision |\n|------------|----------|----------|\n| **Trivial** | <10 lines, single file, obvious pattern | **DO IT YOURSELF** |\n| **Moderate** | Single domain, clear pattern, <100 lines | **DO IT YOURSELF** (faster than delegation overhead) |\n| **Complex** | Multi-file, unfamiliar domain, >100 lines, needs specialized expertise | **DELEGATE** to appropriate category+skills |\n| **Research** | Need broad codebase context or external docs | **DELEGATE** to explore/librarian (background, parallel) |\n\n**Decision Factors:**\n- Delegation overhead \u2248 10-15 seconds. If task takes less, do it yourself.\n- If you already have full context loaded, do it yourself.\n- If task requires specialized expertise (frontend-ui-ux, git operations), delegate.\n- If you need information from multiple sources, fire parallel background agents.\n\n## AVAILABLE RESOURCES\n\nUse these when they provide clear value based on the decision framework above:\n\n| Resource | When to Use | How to Use |\n|----------|-------------|------------|\n| explore agent | Need codebase patterns you don't have | `task(subagent_type=\"explore\", load_skills=[], run_in_background=true, ...)` |\n| librarian agent | External library docs, OSS examples | `task(subagent_type=\"librarian\", load_skills=[], run_in_background=true, ...)` |\n| oracle agent | Stuck on architecture/debugging after 2+ attempts | `task(subagent_type=\"oracle\", load_skills=[], ...)` |\n| plan agent | Complex multi-step with dependencies (5+ steps) | `task(subagent_type=\"plan\", load_skills=[], ...)` |\n| task category | Specialized work matching a category | `task(category=\"...\", load_skills=[...])` |\n\n<tool_usage_rules>\n- Prefer tools over internal knowledge for fresh or user-specific data\n- Parallelize independent reads (read_file, grep, explore, librarian) to reduce latency\n- After any write/update, briefly restate: What changed, Where (path), Follow-up needed\n</tool_usage_rules>\n\n## EXECUTION PATTERN\n\n**Context gathering uses TWO parallel tracks:**\n\n| Track | Tools | Speed | Purpose |\n|-------|-------|-------|---------|\n| **Direct** | Grep, Read, LSP, AST-grep | Instant | Quick wins, known locations |\n| **Background** | explore, librarian agents | Async | Deep search, external docs |\n\n**ALWAYS run both tracks in parallel:**\n```\n// Fire background agents for deep exploration\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"I'm implementing [TASK] and need to understand [KNOWLEDGE GAP]. Find [X] patterns in the codebase \u2014 file paths, implementation approach, conventions used, and how modules connect. I'll use this to [DOWNSTREAM DECISION]. Focus on production code in src/. Return file paths with brief descriptions.\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"I'm working with [TECHNOLOGY] and need [SPECIFIC INFO]. Find official docs and production examples for [Y] \u2014 API reference, configuration, recommended patterns, and pitfalls. Skip tutorials. I'll use this to [DECISION THIS INFORMS].\", run_in_background=true)\n\n// WHILE THEY RUN - use direct tools for immediate context\ngrep(pattern=\"relevant_pattern\", path=\"src/\")\nread_file(filePath=\"known/important/file.ts\")\n\n// Collect background results when ready\ndeep_context = background_output(task_id=...)\n\n// Merge ALL findings for comprehensive understanding\n```\n\n**Plan agent (complex tasks only):**\n- Only if 5+ interdependent steps\n- Invoke AFTER gathering context from both tracks\n\n**Execute:**\n- Surgical, minimal changes matching existing patterns\n- If delegating: provide exhaustive context and success criteria\n\n**Verify:**\n- `lsp_diagnostics` on modified files\n- Run tests if available\n\n## ACCEPTANCE CRITERIA WORKFLOW\n\n**BEFORE implementation**, define what \"done\" means in concrete, binary terms:\n\n1. Write acceptance criteria as pass/fail conditions (not \"should work\" \u2014 specific observable outcomes)\n2. Record them in your TODO/Task items with a \"QA: [how to verify]\" field\n3. Work toward those criteria, not just \"finishing code\"\n\n## QUALITY STANDARDS\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| Build | Run build command | Exit code 0 |\n| Test | Execute test suite | All tests pass |\n| Lint | Run lsp_diagnostics | Zero new errors |\n| **Manual QA** | **Execute the feature yourself** | **Actual output shown** |\n\n<MANUAL_QA_MANDATE>\n### MANUAL QA IS MANDATORY. lsp_diagnostics IS NOT ENOUGH.\n\nlsp_diagnostics catches type errors. It does NOT catch logic bugs, missing behavior, or broken features. After EVERY implementation, you MUST manually test the actual feature.\n\n**Execute ALL that apply:**\n\n| If your change... | YOU MUST... |\n|---|---|\n| Adds/modifies a CLI command | Run the command with Bash. Show the output. |\n| Changes build output | Run the build. Verify output files. |\n| Modifies API behavior | Call the endpoint. Show the response. |\n| Adds a new tool/hook/feature | Test it end-to-end in a real scenario. |\n| Modifies config handling | Load the config. Verify it parses correctly. |\n\n**\"This should work\" is NOT evidence. RUN IT. Show what happened. That is evidence.**\n</MANUAL_QA_MANDATE>\n\n## COMPLETION CRITERIA\n\nA task is complete when:\n1. Requested functionality is fully implemented (not partial, not simplified)\n2. lsp_diagnostics shows zero errors on modified files\n3. Tests pass (or pre-existing failures documented)\n4. Code matches existing codebase patterns\n5. **Manual QA executed \u2014 actual feature tested, output observed and reported**\n\n**Deliver exactly what was asked. No more, no less.**\n\n</ultrawork-mode>\n\n---\n\n";
10
+ export declare const ULTRAWORK_GPT_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Think deeply before acting.\n\n<output_verbosity_spec>\n- Default: 1-2 short paragraphs. Do not default to bullets.\n- Simple yes/no questions: \u22642 sentences.\n- Complex multi-file tasks: 1 overview paragraph + up to 4 high-level sections grouped by outcome, not by file.\n- Use lists only when content is inherently list-shaped (distinct items, steps, options).\n- Do not rephrase the user's request unless it changes semantics.\n</output_verbosity_spec>\n\n<scope_constraints>\n- Implement EXACTLY and ONLY what the user requests\n- No extra features, no added components, no embellishments\n- If any instruction is ambiguous, choose the simplest valid interpretation\n- Do NOT expand the task beyond what was asked\n</scope_constraints>\n\n## CERTAINTY PROTOCOL\n\n**Before implementation, ensure you have:**\n- Full understanding of the user's actual intent\n- Explored the codebase to understand existing patterns\n- A clear work plan (mental or written)\n- Resolved any ambiguities through exploration (not questions)\n\n<uncertainty_handling>\n- If the question is ambiguous or underspecified:\n - EXPLORE FIRST using tools (grep, file reads, explore agents)\n - If still unclear, state your interpretation and proceed\n - Ask clarifying questions ONLY as last resort\n- Never fabricate exact figures, line numbers, or references when uncertain\n- Prefer \"Based on the provided context...\" over absolute claims when unsure\n</uncertainty_handling>\n\n## DECISION FRAMEWORK: Self vs Delegate\n\n**Evaluate each task against these criteria to decide:**\n\n| Complexity | Criteria | Decision |\n|------------|----------|----------|\n| **Trivial** | <10 lines, single file, obvious pattern | **DO IT YOURSELF** |\n| **Moderate** | Single domain, clear pattern, <100 lines | **DO IT YOURSELF** (faster than delegation overhead) |\n| **Complex** | Multi-file, unfamiliar domain, >100 lines, needs specialized expertise | **DELEGATE** to appropriate category+skills |\n| **Research** | Need broad codebase context or external docs | **DELEGATE** to explore/librarian (background, parallel) |\n\n**Decision Factors:**\n- Delegation overhead \u2248 10-15 seconds. If task takes less, do it yourself.\n- If you already have full context loaded, do it yourself.\n- If task requires specialized expertise (frontend-ui-ux, git operations), delegate.\n- If you need information from multiple sources, fire parallel background agents.\n\n## AVAILABLE RESOURCES\n\nUse these when they provide clear value based on the decision framework above:\n\n| Resource | When to Use | How to Use |\n|----------|-------------|------------|\n| explore agent | Need codebase patterns you don't have | `task(subagent_type=\"explore\", load_skills=[], run_in_background=true, ...)` |\n| librarian agent | External library docs, OSS examples | `task(subagent_type=\"librarian\", load_skills=[], run_in_background=true, ...)` |\n| oracle agent | Stuck on architecture/debugging after 2+ attempts | `task(subagent_type=\"oracle\", load_skills=[], ...)` |\n| plan agent | Complex multi-step with dependencies (5+ steps) | `task(subagent_type=\"plan\", load_skills=[], ...)` |\n| task category | Specialized work matching a category | `task(category=\"...\", load_skills=[...])` |\n\n<tool_usage_rules>\n- Prefer tools over internal knowledge for fresh or user-specific data\n- Parallelize independent reads (read_file, grep, explore, librarian) to reduce latency\n- After any write/update, briefly restate: What changed, Where (path), Follow-up needed\n</tool_usage_rules>\n\n## EXECUTION PATTERN\n\n**Context gathering uses TWO parallel tracks:**\n\n| Track | Tools | Speed | Purpose |\n|-------|-------|-------|---------|\n| **Direct** | Grep, Read, LSP, AST-grep | Instant | Quick wins, known locations |\n| **Background** | explore, librarian agents | Async | Deep search, external docs |\n\n**ALWAYS run both tracks in parallel:**\n```\n// Fire background agents for deep exploration\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"I'm implementing [TASK] and need to understand [KNOWLEDGE GAP]. Find [X] patterns in the codebase - file paths, implementation approach, conventions used, and how modules connect. I'll use this to [DOWNSTREAM DECISION]. Focus on production code in src/. Return file paths with brief descriptions.\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"I'm working with [TECHNOLOGY] and need [SPECIFIC INFO]. Find official docs and production examples for [Y] - API reference, configuration, recommended patterns, and pitfalls. Skip tutorials. I'll use this to [DECISION THIS INFORMS].\", run_in_background=true)\n\n// WHILE THEY RUN - use direct tools for immediate context\ngrep(pattern=\"relevant_pattern\", path=\"src/\")\nread_file(filePath=\"known/important/file.ts\")\n\n// Collect background results when ready\ndeep_context = background_output(task_id=...)\n\n// Merge ALL findings for comprehensive understanding\n```\n\n**Plan agent (complex tasks only):**\n- Only if 5+ interdependent steps\n- Invoke AFTER gathering context from both tracks\n\n**Execute:**\n- Surgical, minimal changes matching existing patterns\n- If delegating: provide exhaustive context and success criteria\n\n**Verify:**\n- `lsp_diagnostics` on modified files\n- Run tests if available\n\n## ACCEPTANCE CRITERIA WORKFLOW\n\n**BEFORE implementation**, define what \"done\" means in concrete, binary terms:\n\n1. Write acceptance criteria as pass/fail conditions (not \"should work\" - specific observable outcomes)\n2. Record them in your TODO/Task items with a \"QA: [how to verify]\" field\n3. Work toward those criteria, not just \"finishing code\"\n\n## QUALITY STANDARDS\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| Build | Run build command | Exit code 0 |\n| Test | Execute test suite | All tests pass |\n| Lint | Run lsp_diagnostics | Zero new errors |\n| **Manual QA** | **Execute the feature yourself** | **Actual output shown** |\n\n<MANUAL_QA_MANDATE>\n### MANUAL QA IS MANDATORY. lsp_diagnostics IS NOT ENOUGH.\n\nlsp_diagnostics catches type errors. It does NOT catch logic bugs, missing behavior, or broken features. After EVERY implementation, you MUST manually test the actual feature.\n\n**Execute ALL that apply:**\n\n| If your change... | YOU MUST... |\n|---|---|\n| Adds/modifies a CLI command | Run the command with Bash. Show the output. |\n| Changes build output | Run the build. Verify output files. |\n| Modifies API behavior | Call the endpoint. Show the response. |\n| Adds a new tool/hook/feature | Test it end-to-end in a real scenario. |\n| Modifies config handling | Load the config. Verify it parses correctly. |\n\n**\"This should work\" is NOT evidence. RUN IT. Show what happened. That is evidence.**\n</MANUAL_QA_MANDATE>\n\n## COMPLETION CRITERIA\n\nA task is complete when:\n1. Requested functionality is fully implemented (not partial, not simplified)\n2. lsp_diagnostics shows zero errors on modified files\n3. Tests pass (or pre-existing failures documented)\n4. Code matches existing codebase patterns\n5. **Manual QA executed - actual feature tested, output observed and reported**\n\n**Deliver exactly what was asked. No more, no less.**\n\n</ultrawork-mode>\n\n";
11
11
  export declare function getGptUltraworkMessage(): string;
@@ -0,0 +1,2 @@
1
+ export { autoMigrateLegacyPluginEntry } from "./auto-migrate";
2
+ export type { MigrationResult } from "./auto-migrate";
@@ -0,0 +1,7 @@
1
+ export interface MigrationResult {
2
+ migrated: boolean;
3
+ from: string | null;
4
+ to: string | null;
5
+ configPath: string | null;
6
+ }
7
+ export declare function autoMigrateLegacyPluginEntry(overrideConfigDir?: string): MigrationResult;
@@ -0,0 +1,18 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import { checkForLegacyPluginEntry } from "../../shared/legacy-plugin-warning";
3
+ import { log } from "../../shared/logger";
4
+ import { autoMigrateLegacyPluginEntry } from "./auto-migrate-runner";
5
+ type LegacyPluginToastDeps = {
6
+ checkForLegacyPluginEntry?: typeof checkForLegacyPluginEntry;
7
+ log?: typeof log;
8
+ autoMigrateLegacyPluginEntry?: typeof autoMigrateLegacyPluginEntry;
9
+ };
10
+ export declare function createLegacyPluginToastHook(ctx: PluginInput, deps?: LegacyPluginToastDeps): {
11
+ event: ({ event }: {
12
+ event: {
13
+ type: string;
14
+ properties?: unknown;
15
+ };
16
+ }) => Promise<void>;
17
+ };
18
+ export {};
@@ -0,0 +1 @@
1
+ export { createLegacyPluginToastHook } from "./hook";
@@ -0,0 +1 @@
1
+ export { migrateLegacyPluginEntry } from "../../shared/migrate-legacy-plugin-entry";
@@ -0,0 +1,23 @@
1
+ import type { ChatMessageHandlerOutput, ChatMessageInput } from "../../plugin/chat-message";
2
+ export declare function applyFallbackToChatMessage(params: {
3
+ input: ChatMessageInput;
4
+ output: ChatMessageHandlerOutput;
5
+ fallback: {
6
+ providerID: string;
7
+ modelID: string;
8
+ variant?: string;
9
+ };
10
+ toast?: (input: {
11
+ title: string;
12
+ message: string;
13
+ variant?: "info" | "success" | "warning" | "error";
14
+ duration?: number;
15
+ }) => void | Promise<void>;
16
+ onApplied?: (input: {
17
+ sessionID: string;
18
+ providerID: string;
19
+ modelID: string;
20
+ variant?: string;
21
+ }) => void | Promise<void>;
22
+ lastToastKey: Map<string, string>;
23
+ }): Promise<void>;
@@ -57,4 +57,9 @@ export declare function createModelFallbackHook(args?: {
57
57
  }): {
58
58
  "chat.message": (input: ChatMessageInput, output: ChatMessageHandlerOutput) => Promise<void>;
59
59
  };
60
+ /**
61
+ * Resets all module-global state for testing.
62
+ * Clears pending fallbacks, toast keys, and session chains.
63
+ */
64
+ export declare function _resetForTesting(): void;
60
65
  export {};
@@ -0,0 +1,6 @@
1
+ import type { ModelFallbackState } from "./hook";
2
+ export declare function getNextReachableFallback(sessionID: string, state: ModelFallbackState): {
3
+ providerID: string;
4
+ modelID: string;
5
+ variant?: string;
6
+ } | null;
@@ -0,0 +1,11 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ export type SessionMessage = {
3
+ info?: {
4
+ role?: string;
5
+ };
6
+ parts?: Array<{
7
+ type: string;
8
+ text?: string;
9
+ }>;
10
+ };
11
+ export declare function createPluginInput(messages: SessionMessage[]): PluginInput;
@@ -4,4 +4,5 @@ export declare const PROJECT_RULE_SUBDIRS: [string, string][];
4
4
  export declare const PROJECT_RULE_FILES: string[];
5
5
  export declare const GITHUB_INSTRUCTIONS_PATTERN: RegExp;
6
6
  export declare const USER_RULE_DIR = ".claude/rules";
7
+ export declare const OPENCODE_USER_RULE_DIRS: string[];
7
8
  export declare const RULE_EXTENSIONS: string[];
@@ -1,3 +1,3 @@
1
1
  export { findProjectRoot } from "./project-root-finder";
2
2
  export { calculateDistance } from "./rule-distance";
3
- export { findRuleFiles } from "./rule-file-finder";
3
+ export { findRuleFiles, type FindRuleFilesOptions } from "./rule-file-finder";
@@ -20,6 +20,8 @@ interface EventInput {
20
20
  }
21
21
  export declare function createRulesInjectorHook(ctx: PluginInput, modelCacheState?: {
22
22
  anthropicContext1MEnabled: boolean;
23
+ }, options?: {
24
+ skipClaudeUserRules?: boolean;
23
25
  }): {
24
26
  "tool.execute.before": (input: ToolExecuteInput, output: ToolExecuteBeforeOutput) => Promise<void>;
25
27
  "tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
@@ -1,3 +1,4 @@
1
+ import type { FindRuleFilesOptions } from "./rule-file-finder";
1
2
  import type { SessionInjectedRulesCache } from "./cache";
2
3
  type ToolExecuteOutput = {
3
4
  title: string;
@@ -14,6 +15,7 @@ export declare function createRuleInjectionProcessor(deps: {
14
15
  workspaceDirectory: string;
15
16
  truncator: DynamicTruncator;
16
17
  getSessionCache: (sessionID: string) => SessionInjectedRulesCache;
18
+ ruleFinderOptions?: FindRuleFilesOptions;
17
19
  }): {
18
20
  processFilePathForInjection: (filePath: string, sessionID: string, output: ToolExecuteOutput) => Promise<void>;
19
21
  };
@@ -1,4 +1,12 @@
1
1
  import type { RuleFileCandidate } from "./types";
2
+ export interface FindRuleFilesOptions {
3
+ /**
4
+ * When true, skip loading rules from ~/.claude/rules/.
5
+ * Use when claude_code integration is disabled to prevent
6
+ * Claude Code-specific instructions from leaking into non-Claude agents.
7
+ */
8
+ skipClaudeUserRules?: boolean;
9
+ }
2
10
  /**
3
11
  * Find all rule files for a given context.
4
12
  * Searches from currentFile upward to projectRoot for rule directories,
@@ -12,4 +20,4 @@ import type { RuleFileCandidate } from "./types";
12
20
  * @param currentFile - Current file being edited (for distance calculation)
13
21
  * @returns Array of rule file candidates sorted by distance
14
22
  */
15
- export declare function findRuleFiles(projectRoot: string | null, homeDir: string, currentFile: string): RuleFileCandidate[];
23
+ export declare function findRuleFiles(projectRoot: string | null, homeDir: string, currentFile: string, options?: FindRuleFilesOptions): RuleFileCandidate[];
@@ -1,2 +1,14 @@
1
1
  import type { OhMyOpenCodeConfig } from "../../config";
2
+ import type { FallbackModelObject } from "../../config/schema/fallback-models";
3
+ /**
4
+ * Returns fallback model strings for the runtime-fallback system.
5
+ * Object entries are flattened to "provider/model(variant)" strings so the
6
+ * string-based fallback state machine can work with them unchanged.
7
+ */
2
8
  export declare function getFallbackModelsForSession(sessionID: string, agent: string | undefined, pluginConfig: OhMyOpenCodeConfig | undefined): string[];
9
+ /**
10
+ * Returns the raw fallback model entries (strings and objects) for a session.
11
+ * Use this when per-model settings (temperature, reasoningEffort, etc.) must be
12
+ * preserved - e.g. before passing to buildFallbackChainFromModels.
13
+ */
14
+ export declare function getRawFallbackModels(sessionID: string, agent: string | undefined, pluginConfig: OhMyOpenCodeConfig | undefined): (string | FallbackModelObject)[] | undefined;
@@ -1,7 +1,11 @@
1
- export declare function buildRetryModelPayload(model: string): {
1
+ export declare function buildRetryModelPayload(model: string, agentSettings?: {
2
+ variant?: string;
3
+ reasoningEffort?: string;
4
+ }): {
2
5
  model: {
3
6
  providerID: string;
4
7
  modelID: string;
5
8
  };
6
9
  variant?: string;
10
+ reasoningEffort?: string;
7
11
  } | undefined;
@@ -0,0 +1,12 @@
1
+ import { readBoulderState } from "../../features/boulder-state";
2
+ import type { PluginInput } from "@opencode-ai/plugin";
3
+ export declare function buildStartWorkContextInfo(params: {
4
+ ctx: PluginInput;
5
+ explicitPlanName: string | null;
6
+ existingState: ReturnType<typeof readBoulderState>;
7
+ sessionId: string;
8
+ timestamp: string;
9
+ activeAgent: string;
10
+ worktreePath: string | undefined;
11
+ worktreeBlock: string;
12
+ }): string;
@@ -4,7 +4,13 @@ interface StartWorkHookInput {
4
4
  sessionID: string;
5
5
  messageID?: string;
6
6
  }
7
+ interface StartWorkCommandExecuteBeforeInput {
8
+ sessionID: string;
9
+ command: string;
10
+ arguments: string;
11
+ }
7
12
  interface StartWorkHookOutput {
13
+ message?: Record<string, unknown>;
8
14
  parts: Array<{
9
15
  type: string;
10
16
  text?: string;
@@ -12,5 +18,6 @@ interface StartWorkHookOutput {
12
18
  }
13
19
  export declare function createStartWorkHook(ctx: PluginInput): {
14
20
  "chat.message": (input: StartWorkHookInput, output: StartWorkHookOutput) => Promise<void>;
21
+ "command.execute.before": (input: StartWorkCommandExecuteBeforeInput, output: StartWorkHookOutput) => Promise<void>;
15
22
  };
16
23
  export {};
@@ -0,0 +1 @@
1
+ export declare function createWorktreeActiveBlock(worktreePath: string): string;
@@ -1,3 +1,3 @@
1
1
  import type { PluginInput } from "@opencode-ai/plugin";
2
- import type { ResolveLatestMessageInfoResult } from "./types";
3
- export declare function resolveLatestMessageInfo(ctx: PluginInput, sessionID: string): Promise<ResolveLatestMessageInfoResult>;
2
+ import type { MessageWithInfo, ResolveLatestMessageInfoResult } from "./types";
3
+ export declare function resolveLatestMessageInfo(ctx: PluginInput, sessionID: string, prefetchedMessages?: MessageWithInfo[]): Promise<ResolveLatestMessageInfoResult>;
@@ -27,6 +27,7 @@ export interface SessionState {
27
27
  countdownTimer?: ReturnType<typeof setTimeout>;
28
28
  countdownInterval?: ReturnType<typeof setInterval>;
29
29
  isRecovering?: boolean;
30
+ wasCancelled?: boolean;
30
31
  countdownStartedAt?: number;
31
32
  abortDetectedAt?: number;
32
33
  lastIncompleteCount?: number;
@@ -55,6 +56,9 @@ export interface MessageInfo {
55
56
  modelID?: string;
56
57
  tools?: Record<string, ToolPermission>;
57
58
  }
59
+ export interface MessageWithInfo {
60
+ info?: MessageInfo;
61
+ }
58
62
  export interface ResolvedMessageInfo {
59
63
  agent?: string;
60
64
  model?: {
@@ -1 +1 @@
1
- export declare const TODOWRITE_DESCRIPTION = "Use this tool to create and manage a structured task list for tracking progress on multi-step work.\n\n## Todo Format (MANDATORY)\n\nEach todo title MUST encode four elements: WHERE, WHY, HOW, and EXPECTED RESULT.\n\nFormat: \"[WHERE] [HOW] to [WHY] \u2014 expect [RESULT]\"\n\nGOOD:\n- \"src/utils/validation.ts: Add validateEmail() for input sanitization \u2014 returns boolean\"\n- \"UserService.create(): Call validateEmail() before DB insert \u2014 rejects invalid emails with 400\"\n- \"validation.test.ts: Add test for missing @ sign \u2014 expect validateEmail('foo') to return false\"\n\nBAD:\n- \"Implement email validation\" (where? how? what result?)\n- \"Add dark mode\" (this is a feature, not a todo)\n- \"Fix auth\" (what file? what changes? what's expected?)\n\n## Granularity Rules\n\nEach todo MUST be a single atomic action completable in 1-3 tool calls. If it needs more, split it.\n\n**Size test**: Can you complete this todo by editing one file or running one command? If not, it's too big.\n\n## Task Management\n- One in_progress at a time. Complete it before starting the next.\n- Mark completed immediately after finishing each item.\n- Skip this tool for single trivial tasks (one-step, obvious action).";
1
+ export declare const TODOWRITE_DESCRIPTION = "Use this tool to create and manage a structured task list for tracking progress on multi-step work.\n\n## Todo Format (MANDATORY)\n\nEach todo title MUST encode four elements: WHERE, WHY, HOW, and EXPECTED RESULT.\n\nFormat: \"[WHERE] [HOW] to [WHY] - expect [RESULT]\"\n\nGOOD:\n- \"src/utils/validation.ts: Add validateEmail() for input sanitization - returns boolean\"\n- \"UserService.create(): Call validateEmail() before DB insert - rejects invalid emails with 400\"\n- \"validation.test.ts: Add test for missing @ sign - expect validateEmail('foo') to return false\"\n\nBAD:\n- \"Implement email validation\" (where? how? what result?)\n- \"Add dark mode\" (feature, not a todo)\n- \"Fix auth\" (what file? what changes? what's expected?)\n\n## Granularity Rules\n\nEach todo MUST be a single atomic action completable in 1-3 tool calls. If it needs more, split it.\n\n**Size test**: Can you complete this todo by editing one file or running one command? If not, it's too big.\n\n## Task Management\n- One in_progress at a time. Complete it before starting the next.\n- Mark completed immediately after finishing each item.\n- Skip this tool for single trivial tasks (one-step, obvious action).";
@@ -0,0 +1,28 @@
1
+ import type { Message, Part } from "@opencode-ai/sdk";
2
+ type ToolUsePart = {
3
+ type: "tool_use";
4
+ id: string;
5
+ [key: string]: unknown;
6
+ };
7
+ type ToolResultPart = {
8
+ type: "tool_result";
9
+ tool_use_id: string;
10
+ content: string;
11
+ [key: string]: unknown;
12
+ };
13
+ type TransformPart = Part | ToolUsePart | ToolResultPart;
14
+ type TransformMessageInfo = Message | {
15
+ role: "user";
16
+ sessionID?: string;
17
+ };
18
+ interface MessageWithParts {
19
+ info: TransformMessageInfo;
20
+ parts: TransformPart[];
21
+ }
22
+ type MessagesTransformHook = {
23
+ "experimental.chat.messages.transform"?: (input: Record<string, never>, output: {
24
+ messages: MessageWithParts[];
25
+ }) => Promise<void>;
26
+ };
27
+ export declare function createToolPairValidatorHook(): MessagesTransformHook;
28
+ export {};
@@ -0,0 +1 @@
1
+ export { createToolPairValidatorHook } from "./hook";
@@ -1,3 +1,15 @@
1
1
  import type { Hooks, PluginInput } from "@opencode-ai/plugin";
2
+ export type GuardArgs = {
3
+ filePath?: string;
4
+ path?: string;
5
+ file_path?: string;
6
+ overwrite?: boolean | string;
7
+ };
2
8
  export declare const MAX_TRACKED_PATHS_PER_SESSION = 1024;
9
+ export declare function asRecord(value: unknown): Record<string, unknown> | undefined;
10
+ export declare function getPathFromArgs(args: GuardArgs | undefined): string | undefined;
11
+ export declare function resolveInputPath(ctx: PluginInput, inputPath: string): string;
12
+ export declare function isPathInsideDirectory(pathToCheck: string, directory: string): boolean;
13
+ export declare function toCanonicalPath(absolutePath: string): string;
14
+ export declare function isOverwriteEnabled(value: boolean | string | undefined): boolean;
3
15
  export declare function createWriteExistingFileGuardHook(ctx: PluginInput): Hooks;
@@ -0,0 +1,3 @@
1
+ export declare function touchSession(sessionLastAccess: Map<string, number>, sessionID: string): void;
2
+ export declare function evictLeastRecentlyUsedSession(readPermissionsBySession: Map<string, Set<string>>, sessionLastAccess: Map<string, number>): void;
3
+ export declare function trimSessionReadSet(readSet: Set<string>, maxTrackedPathsPerSession: number): void;
@@ -0,0 +1,15 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ export declare function handleWriteExistingFileGuardToolExecuteBefore(params: {
3
+ ctx: PluginInput;
4
+ input: {
5
+ tool?: string;
6
+ sessionID?: string;
7
+ };
8
+ output: {
9
+ args?: unknown;
10
+ };
11
+ readPermissionsBySession: Map<string, Set<string>>;
12
+ sessionLastAccess: Map<string, number>;
13
+ canonicalSessionRoot: string;
14
+ maxTrackedSessions: number;
15
+ }): Promise<void>;