oh-my-opencode 4.2.3 → 4.3.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 (171) hide show
  1. package/README.ja.md +1 -0
  2. package/README.ko.md +1 -0
  3. package/README.md +3 -2
  4. package/README.zh-cn.md +1 -0
  5. package/dist/agents/atlas/default-prompt-sections.d.ts +1 -1
  6. package/dist/agents/builtin-agents/available-skills.d.ts +1 -1
  7. package/dist/agents/builtin-agents/model-resolution.d.ts +1 -1
  8. package/dist/agents/prometheus/plan-generation.d.ts +1 -1
  9. package/dist/agents/prometheus/plan-template.d.ts +1 -1
  10. package/dist/agents/prometheus/spec-driven-mode.d.ts +7 -0
  11. package/dist/cli/doctor/checks/system-binary.d.ts +1 -1
  12. package/dist/cli/doctor/checks/tui-plugin-config.d.ts +14 -0
  13. package/dist/cli/doctor/constants.d.ts +1 -0
  14. package/dist/cli/index.js +3168 -2353
  15. package/dist/cli/provider-model-id-transform.d.ts +1 -1
  16. package/dist/config/index.d.ts +1 -1
  17. package/dist/config/schema/agent-overrides.d.ts +147 -1
  18. package/dist/config/schema/background-task.d.ts +1 -0
  19. package/dist/config/schema/default-mode.d.ts +6 -0
  20. package/dist/config/schema/hooks.d.ts +2 -0
  21. package/dist/config/schema/i18n.d.ts +5 -0
  22. package/dist/config/schema/keyword-detector.d.ts +8 -0
  23. package/dist/config/schema/oh-my-opencode-config.d.ts +163 -1
  24. package/dist/config/schema.d.ts +2 -0
  25. package/dist/create-hooks.d.ts +2 -0
  26. package/dist/features/background-agent/fallback-retry-handler.d.ts +3 -0
  27. package/dist/features/background-agent/manager.d.ts +0 -1
  28. package/dist/features/background-agent/parent-wake-notifier.d.ts +4 -0
  29. package/dist/features/background-agent/session-activity.d.ts +12 -0
  30. package/dist/features/background-agent/session-existence.d.ts +2 -0
  31. package/dist/features/background-agent/session-stream-activity.d.ts +18 -0
  32. package/dist/features/background-agent/task-activity-refresh.d.ts +11 -0
  33. package/dist/features/background-agent/task-poller.d.ts +2 -0
  34. package/dist/features/boulder-state/constants.d.ts +1 -10
  35. package/dist/features/boulder-state/format-duration.d.ts +1 -1
  36. package/dist/features/boulder-state/storage.d.ts +1 -83
  37. package/dist/features/boulder-state/top-level-task.d.ts +1 -2
  38. package/dist/features/boulder-state/types.d.ts +1 -100
  39. package/dist/features/task-toast-manager/manager.d.ts +1 -1
  40. package/dist/features/team-mode/team-state-store/locks.d.ts +7 -4
  41. package/dist/features/tmux-subagent/manager.d.ts +2 -0
  42. package/dist/hooks/atlas/system-reminder-templates.d.ts +1 -1
  43. package/dist/hooks/claude-code-hooks/config-loader.d.ts +7 -0
  44. package/dist/hooks/claude-code-hooks/config.d.ts +4 -1
  45. package/dist/hooks/claude-code-hooks/types.d.ts +17 -1
  46. package/dist/hooks/comment-checker/cli.d.ts +2 -22
  47. package/dist/hooks/comment-checker/types.d.ts +1 -31
  48. package/dist/hooks/directory-agents-injector/finder.d.ts +2 -7
  49. package/dist/hooks/directory-agents-injector/injector.d.ts +1 -18
  50. package/dist/hooks/index.d.ts +2 -0
  51. package/dist/hooks/keyword-detector/analyze/default.d.ts +1 -1
  52. package/dist/hooks/keyword-detector/constants.d.ts +10 -5
  53. package/dist/hooks/keyword-detector/detector.d.ts +2 -2
  54. package/dist/hooks/keyword-detector/hook.d.ts +2 -1
  55. package/dist/hooks/keyword-detector/hyperplan/default.d.ts +5 -0
  56. package/dist/hooks/notepad-write-guard/index.d.ts +2 -0
  57. package/dist/hooks/plan-format-validator/hook.d.ts +21 -0
  58. package/dist/hooks/plan-format-validator/index.d.ts +1 -0
  59. package/dist/hooks/prometheus-md-only/constants.d.ts +8 -0
  60. package/dist/hooks/rules-injector/constants.d.ts +1 -7
  61. package/dist/hooks/rules-injector/matcher.d.ts +2 -2
  62. package/dist/hooks/rules-injector/parser.d.ts +2 -2
  63. package/dist/hooks/rules-injector/project-root-finder.d.ts +1 -1
  64. package/dist/hooks/rules-injector/rule-distance.d.ts +1 -1
  65. package/dist/hooks/rules-injector/rule-file-finder.d.ts +2 -2
  66. package/dist/hooks/rules-injector/rule-file-scanner.d.ts +1 -1
  67. package/dist/hooks/rules-injector/rule-scan-cache.d.ts +2 -2
  68. package/dist/hooks/rules-injector/types.d.ts +1 -1
  69. package/dist/hooks/session-todo-status.d.ts +1 -0
  70. package/dist/hooks/sisyphus-junior-notepad/constants.d.ts +1 -1
  71. package/dist/hooks/start-work/context-info-builder.d.ts +1 -0
  72. package/dist/hooks/start-work/session-plan-affinity.d.ts +7 -0
  73. package/dist/hooks/todo-continuation-enforcer/types.d.ts +1 -0
  74. package/dist/index.js +17916 -15893
  75. package/dist/locales/en.d.ts +18 -0
  76. package/dist/locales/index.d.ts +6 -0
  77. package/dist/locales/zh.d.ts +17 -0
  78. package/dist/mcp/ast-grep.d.ts +2 -0
  79. package/dist/mcp/cli-suffix.d.ts +1 -0
  80. package/dist/mcp/index.d.ts +2 -0
  81. package/dist/mcp/lsp.d.ts +2 -0
  82. package/dist/mcp/runtime-executable.d.ts +11 -0
  83. package/dist/oh-my-opencode.schema.json +449 -1
  84. package/dist/plugin/hooks/create-core-hooks.d.ts +2 -0
  85. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +3 -1
  86. package/dist/plugin/system-transform.d.ts +2 -1
  87. package/dist/plugin/tool-definition.d.ts +9 -0
  88. package/dist/plugin-handlers/agent-key-remapper.d.ts +5 -1
  89. package/dist/plugin-handlers/hook-config-handler.d.ts +7 -0
  90. package/dist/plugin-handlers/index.d.ts +1 -0
  91. package/dist/plugin-handlers/plugin-components-loader.d.ts +2 -3
  92. package/dist/shared/agent-display-names.d.ts +10 -2
  93. package/dist/shared/command-executor/execute-hook-command.d.ts +2 -0
  94. package/dist/shared/contains-path.d.ts +1 -2
  95. package/dist/shared/context-limit-resolver.d.ts +2 -5
  96. package/dist/shared/deep-merge.d.ts +1 -13
  97. package/dist/shared/disabled-providers.d.ts +14 -0
  98. package/dist/shared/extract-semver.d.ts +1 -1
  99. package/dist/shared/fallback-chain-from-models.d.ts +1 -12
  100. package/dist/shared/file-utils.d.ts +1 -7
  101. package/dist/shared/frontmatter.d.ts +1 -7
  102. package/dist/shared/i18n.d.ts +9 -0
  103. package/dist/shared/index.d.ts +0 -1
  104. package/dist/shared/jsonc-parser.d.ts +1 -23
  105. package/dist/shared/model-availability.d.ts +18 -5
  106. package/dist/shared/model-capabilities/index.d.ts +6 -3
  107. package/dist/shared/model-capabilities-cache.d.ts +4 -8
  108. package/dist/shared/model-error-classifier.d.ts +4 -33
  109. package/dist/shared/model-format-normalizer.d.ts +1 -7
  110. package/dist/shared/model-normalization.d.ts +1 -2
  111. package/dist/shared/model-requirements.d.ts +2 -22
  112. package/dist/shared/model-resolution-pipeline.d.ts +5 -30
  113. package/dist/shared/model-resolution-types.d.ts +1 -36
  114. package/dist/shared/model-resolver.d.ts +8 -35
  115. package/dist/shared/model-sanitizer.d.ts +1 -3
  116. package/dist/shared/model-settings-compatibility.d.ts +2 -40
  117. package/dist/shared/model-string-parser.d.ts +1 -9
  118. package/dist/shared/model-suggestion-retry.d.ts +3 -7
  119. package/dist/shared/opencode-config-dir.d.ts +1 -0
  120. package/dist/shared/port-utils.d.ts +1 -9
  121. package/dist/shared/prompt-async-gate/pending-tool-turn.d.ts +9 -0
  122. package/dist/shared/prompt-async-gate/queue.d.ts +8 -0
  123. package/dist/shared/prompt-async-gate/reservations.d.ts +9 -0
  124. package/dist/shared/prompt-async-gate/session-idle-dispatch.d.ts +15 -0
  125. package/dist/shared/prompt-async-gate/timing.d.ts +8 -0
  126. package/dist/shared/prompt-async-gate/types.d.ts +120 -0
  127. package/dist/shared/prompt-async-gate.d.ts +3 -90
  128. package/dist/shared/provider-model-id-transform.d.ts +1 -1
  129. package/dist/shared/record-type-guard.d.ts +1 -1
  130. package/dist/shared/replace-tool-args.d.ts +1 -13
  131. package/dist/shared/session-idle-settle.d.ts +2 -1
  132. package/dist/shared/shell-env.d.ts +7 -5
  133. package/dist/shared/snake-case.d.ts +1 -5
  134. package/dist/shared/tool-name.d.ts +1 -1
  135. package/dist/testing/create-plugin-module.d.ts +2 -0
  136. package/dist/tools/delegate-task/constants.d.ts +19 -0
  137. package/dist/tools/delegate-task/skill-resolver.d.ts +9 -2
  138. package/dist/tools/delegate-task/types.d.ts +32 -0
  139. package/dist/tools/glob/constants.d.ts +1 -1
  140. package/dist/tools/grep/constants.d.ts +1 -1
  141. package/dist/tools/hashline-edit/autocorrect-replacement-lines.d.ts +1 -6
  142. package/dist/tools/hashline-edit/constants.d.ts +1 -4
  143. package/dist/tools/hashline-edit/diff-utils.d.ts +1 -6
  144. package/dist/tools/hashline-edit/edit-deduplication.d.ts +1 -5
  145. package/dist/tools/hashline-edit/edit-operation-primitives.d.ts +1 -10
  146. package/dist/tools/hashline-edit/edit-operations.d.ts +2 -8
  147. package/dist/tools/hashline-edit/edit-ordering.d.ts +1 -4
  148. package/dist/tools/hashline-edit/edit-text-normalization.d.ts +1 -7
  149. package/dist/tools/hashline-edit/file-text-canonicalization.d.ts +2 -7
  150. package/dist/tools/hashline-edit/hash-computation.d.ts +2 -11
  151. package/dist/tools/hashline-edit/hashline-chunk-formatter.d.ts +2 -10
  152. package/dist/tools/hashline-edit/hashline-edit-diff.d.ts +1 -1
  153. package/dist/tools/hashline-edit/normalize-edits.d.ts +2 -10
  154. package/dist/tools/hashline-edit/types.d.ts +1 -17
  155. package/dist/tools/hashline-edit/validation.d.ts +2 -20
  156. package/dist/tools/look-at/assistant-message-extractor.d.ts +7 -0
  157. package/dist/tools/look-at/session-poller.d.ts +9 -1
  158. package/dist/tools/skill/tools.d.ts +1 -1
  159. package/dist/tools/skill/types.d.ts +2 -0
  160. package/package.json +31 -16
  161. package/packages/ast-grep-mcp/dist/cli.js +272 -248
  162. package/dist/hooks/comment-checker/apply-patch-edits.d.ts +0 -2
  163. package/dist/shared/known-variants.d.ts +0 -6
  164. package/dist/shared/model-capabilities/bundled-snapshot.d.ts +0 -2
  165. package/dist/shared/model-capabilities/get-model-capabilities.d.ts +0 -2
  166. package/dist/shared/model-capabilities/runtime-model-readers.d.ts +0 -11
  167. package/dist/shared/model-capabilities/supplemental-entries.d.ts +0 -2
  168. package/dist/shared/model-capabilities/types.d.ts +0 -94
  169. package/dist/shared/model-capability-aliases.d.ts +0 -21
  170. package/dist/shared/model-capability-guardrails.d.ts +0 -38
  171. package/dist/shared/model-capability-heuristics.d.ts +0 -11
@@ -1,7 +1,7 @@
1
1
  import type { HookName, OhMyOpenCodeConfig } from "../../config";
2
2
  import type { ModelCacheState } from "../../plugin-state";
3
3
  import type { PluginContext } from "../types";
4
- import { createCommentCheckerHooks, createToolOutputTruncatorHook, createDirectoryAgentsInjectorHook, createDirectoryReadmeInjectorHook, createEmptyTaskResponseDetectorHook, createRulesInjectorHook, createTasksTodowriteDisablerHook, createWriteExistingFileGuardHook, createBashFileReadGuardHook, createHashlineReadEnhancerHook, createReadImageResizerHook, createJsonErrorRecoveryHook, createTodoDescriptionOverrideHook, createWebFetchRedirectGuardHook, createTeamToolGating, createFsyncSkipWarningHook } from "../../hooks";
4
+ import { createCommentCheckerHooks, createToolOutputTruncatorHook, createDirectoryAgentsInjectorHook, createDirectoryReadmeInjectorHook, createEmptyTaskResponseDetectorHook, createRulesInjectorHook, createTasksTodowriteDisablerHook, createWriteExistingFileGuardHook, createBashFileReadGuardHook, createHashlineReadEnhancerHook, createReadImageResizerHook, createJsonErrorRecoveryHook, createTodoDescriptionOverrideHook, createWebFetchRedirectGuardHook, createTeamToolGating, createFsyncSkipWarningHook, createNotepadWriteGuardHook, createPlanFormatValidatorHook } from "../../hooks";
5
5
  export type ToolGuardHooks = {
6
6
  commentChecker: ReturnType<typeof createCommentCheckerHooks> | null;
7
7
  toolOutputTruncator: ReturnType<typeof createToolOutputTruncatorHook> | null;
@@ -19,6 +19,8 @@ export type ToolGuardHooks = {
19
19
  webfetchRedirectGuard: ReturnType<typeof createWebFetchRedirectGuardHook> | null;
20
20
  fsyncSkipWarning: ReturnType<typeof createFsyncSkipWarningHook> | null;
21
21
  teamToolGating: ReturnType<typeof createTeamToolGating> | null;
22
+ notepadWriteGuard: ReturnType<typeof createNotepadWriteGuardHook> | null;
23
+ planFormatValidator: ReturnType<typeof createPlanFormatValidatorHook> | null;
22
24
  };
23
25
  export declare function createToolGuardHooks(args: {
24
26
  ctx: PluginContext;
@@ -1,4 +1,5 @@
1
- export declare function createSystemTransformHandler(): (input: {
1
+ import type { DefaultModeConfig } from "../config/schema/default-mode";
2
+ export declare function createSystemTransformHandler(defaultMode?: DefaultModeConfig, getUltraworkMessage?: (agentName?: string, modelID?: string) => string): (input: {
2
3
  sessionID?: string;
3
4
  model: {
4
5
  id: string;
@@ -0,0 +1,9 @@
1
+ import type { CreatedHooks } from "../create-hooks";
2
+ export declare function createToolDefinitionHandler(args: {
3
+ hooks: CreatedHooks;
4
+ }): (input: {
5
+ toolID: string;
6
+ }, output: {
7
+ description: string;
8
+ parameters: unknown;
9
+ }) => Promise<void>;
@@ -1 +1,5 @@
1
- export declare function remapAgentKeysToDisplayNames(agents: Record<string, unknown>): Record<string, unknown>;
1
+ type AgentOverridesMap = Record<string, {
2
+ displayName?: string;
3
+ } | undefined>;
4
+ export declare function remapAgentKeysToDisplayNames(agents: Record<string, unknown>, overrides?: AgentOverridesMap): Record<string, unknown>;
5
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { PluginComponents } from "./plugin-components-loader";
2
+ export declare function applyHookConfig(params: {
3
+ pluginComponents: PluginComponents;
4
+ ctx: {
5
+ directory: string;
6
+ };
7
+ }): void;
@@ -3,6 +3,7 @@ export * from "./provider-config-handler";
3
3
  export * from "./agent-config-handler";
4
4
  export * from "./tool-config-handler";
5
5
  export * from "./mcp-config-handler";
6
+ export * from "./hook-config-handler";
6
7
  export * from "./command-config-handler";
7
8
  export * from "./plugin-components-loader";
8
9
  export * from "./category-config-resolver";
@@ -1,12 +1,11 @@
1
1
  import type { OhMyOpenCodeConfig } from "../config";
2
+ import type { PluginHooksConfig } from "../hooks/claude-code-hooks/types";
2
3
  export type PluginComponents = {
3
4
  commands: Record<string, unknown>;
4
5
  skills: Record<string, unknown>;
5
6
  agents: Record<string, unknown>;
6
7
  mcpServers: Record<string, unknown>;
7
- hooksConfigs: Array<{
8
- hooks?: Record<string, unknown>;
9
- }>;
8
+ hooksConfigs: PluginHooksConfig[];
10
9
  plugins: Array<{
11
10
  name: string;
12
11
  version: string;
@@ -16,8 +16,14 @@ export declare function stripAgentListSortPrefix(agentName: string): string;
16
16
  * Get display name for an agent config key.
17
17
  * Uses case-insensitive lookup for backward compatibility.
18
18
  * Returns original key if not found.
19
+ *
20
+ * @param overrides - Optional per-agent overrides map. If the agent has a `displayName`
21
+ * field set, it takes precedence over the hardcoded AGENT_DISPLAY_NAMES entry.
22
+ * This enables i18n: `agents.sisyphus.displayName = "总指挥"` in oh-my-openagent.json.
19
23
  */
20
- export declare function getAgentDisplayName(configKey: string): string;
24
+ export declare function getAgentDisplayName(configKey: string, overrides?: Record<string, {
25
+ displayName?: string;
26
+ } | undefined>): string;
21
27
  /**
22
28
  * Thin alias for `getAgentDisplayName` preserved for external imports.
23
29
  *
@@ -27,7 +33,9 @@ export declare function getAgentDisplayName(configKey: string): string;
27
33
  * display name verbatim. Kept exported because downstream modules still
28
34
  * import this symbol; do not collapse the call sites without coordinating.
29
35
  */
30
- export declare function getAgentListDisplayName(configKey: string): string;
36
+ export declare function getAgentListDisplayName(configKey: string, overrides?: Record<string, {
37
+ displayName?: string;
38
+ } | undefined>): string;
31
39
  /**
32
40
  * Resolve an agent name (display name or config key) to its lowercase config key.
33
41
  * "Atlas - Plan Executor" -> "atlas", "Atlas (Plan Executor)" -> "atlas", "atlas" -> "atlas"
@@ -8,5 +8,7 @@ export interface ExecuteHookOptions {
8
8
  zshPath?: string;
9
9
  /** Timeout in milliseconds. Process is killed after this. Default: 30000 */
10
10
  timeoutMs?: number;
11
+ /** When provided, scrub process.env to only include these vars plus HOME/PATH/etc. Used for plugin-sourced hooks. */
12
+ allowedEnvVars?: string[];
11
13
  }
12
14
  export declare function executeHookCommand(command: string, stdin: string, cwd: string, options?: ExecuteHookOptions): Promise<CommandResult>;
@@ -1,2 +1 @@
1
- export declare function containsPath(rootPath: string, candidatePath: string): boolean;
2
- export declare function isWithinProject(candidatePath: string, projectRoot: string): boolean;
1
+ export { containsPath, isWithinProject } from "@oh-my-opencode/utils";
@@ -1,5 +1,2 @@
1
- export type ContextLimitModelCacheState = {
2
- anthropicContext1MEnabled: boolean;
3
- modelContextLimitsCache?: Map<string, number>;
4
- };
5
- export declare function resolveActualContextLimit(providerID: string, modelID: string, modelCacheState?: ContextLimitModelCacheState): number | null;
1
+ export type { ContextLimitModelCacheState } from "@oh-my-opencode/model-core";
2
+ export { resolveActualContextLimit } from "@oh-my-opencode/model-core";
@@ -1,13 +1 @@
1
- export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
2
- /**
3
- * Deep merges two objects, with override values taking precedence.
4
- * - Objects are recursively merged
5
- * - Arrays are replaced (not concatenated)
6
- * - undefined values in override do not overwrite base values
7
- *
8
- * @example
9
- * deepMerge({ a: 1, b: { c: 2, d: 3 } }, { b: { c: 10 }, e: 5 })
10
- * // => { a: 1, b: { c: 10, d: 3 }, e: 5 }
11
- */
12
- export declare function deepMerge<T extends Record<string, unknown>>(base: T, override: Partial<T>, depth?: number): T;
13
- export declare function deepMerge<T extends Record<string, unknown>>(base: T | undefined, override: T | undefined, depth?: number): T | undefined;
1
+ export { deepMerge, isPlainObject } from "@oh-my-opencode/utils";
@@ -0,0 +1,14 @@
1
+ import type { OhMyOpenCodeConfig } from "../config";
2
+ import type { FallbackModelObject } from "../config/schema/fallback-models";
3
+ export declare function getModelProvider(model: string): string | undefined;
4
+ export declare function isProviderDisabled(model: string | undefined, disabled: readonly string[]): boolean;
5
+ export declare function filterDisabledProviderModels<T extends string | FallbackModelObject>(models: readonly T[], disabled: readonly string[]): T[];
6
+ /**
7
+ * Filters `disabled_providers`-listed entries out of every agent/category
8
+ * fallback chain and substitutes any primary `model` referencing a disabled
9
+ * provider with the first allowed entry from the same chain.
10
+ *
11
+ * Returns the same config reference (mutated in place). Safe to call when
12
+ * `disabled_providers` is unset or empty - it becomes a no-op.
13
+ */
14
+ export declare function applyDisabledProviders(config: OhMyOpenCodeConfig): OhMyOpenCodeConfig;
@@ -1 +1 @@
1
- export declare function extractSemverFromOutput(output: string): string | null;
1
+ export { extractSemverFromOutput } from "@oh-my-opencode/utils";
@@ -1,12 +1 @@
1
- import type { FallbackEntry } from "./model-requirements";
2
- import type { FallbackModelObject } from "../config/schema/fallback-models";
3
- export declare function parseFallbackModelEntry(model: string, contextProviderID: string | undefined, defaultProviderID?: string): FallbackEntry | undefined;
4
- export declare function parseFallbackModelObjectEntry(obj: FallbackModelObject, contextProviderID: string | undefined, defaultProviderID?: string): FallbackEntry | undefined;
5
- /**
6
- * Find the most specific FallbackEntry whose `provider/model` is a prefix of
7
- * the resolved `provider/modelID`. Longest match wins so that e.g.
8
- * `openai/gpt-5.4-preview` picks the entry for `openai/gpt-5.4-preview` over
9
- * the shorter `openai/gpt-5.4`.
10
- */
11
- export declare function findMostSpecificFallbackEntry(providerID: string, modelID: string, chain: FallbackEntry[]): FallbackEntry | undefined;
12
- export declare function buildFallbackChainFromModels(fallbackModels: string | (string | FallbackModelObject)[] | undefined, contextProviderID: string | undefined, defaultProviderID?: string): FallbackEntry[] | undefined;
1
+ export { parseFallbackModelEntry, parseFallbackModelObjectEntry, findMostSpecificFallbackEntry, buildFallbackChainFromModels, } from "@oh-my-opencode/model-core";
@@ -1,7 +1 @@
1
- export declare function isMarkdownFile(entry: {
2
- name: string;
3
- isFile: () => boolean;
4
- }): boolean;
5
- export declare function isSymbolicLink(filePath: string): boolean;
6
- export declare function resolveSymlink(filePath: string): string;
7
- export declare function resolveSymlinkAsync(filePath: string): Promise<string>;
1
+ export { isMarkdownFile, isSymbolicLink, resolveSymlink, resolveSymlinkAsync } from "@oh-my-opencode/utils";
@@ -1,7 +1 @@
1
- export interface FrontmatterResult<T = Record<string, unknown>> {
2
- data: T;
3
- body: string;
4
- hadFrontmatter: boolean;
5
- parseError: boolean;
6
- }
7
- export declare function parseFrontmatter<T = Record<string, unknown>>(content: string): FrontmatterResult<T>;
1
+ export { parseFrontmatter, type FrontmatterResult } from "@oh-my-opencode/utils";
@@ -0,0 +1,9 @@
1
+ import { type SupportedLocale, type TranslationKey } from "../locales";
2
+ export declare function initI18n(opts?: {
3
+ locale?: string;
4
+ fallback?: string;
5
+ }): void;
6
+ export declare function getLocale(): SupportedLocale;
7
+ export declare function setLocale(lang: string): void;
8
+ export declare function t(key: TranslationKey, params?: Record<string, string | number>): string;
9
+ export declare function t(key: string, params?: Record<string, string | number>): string;
@@ -40,7 +40,6 @@ export type { ModelResolutionRequest, ModelResolutionProvenance, ModelResolution
40
40
  export * from "./model-availability";
41
41
  export * from "./model-capabilities";
42
42
  export * from "./model-capabilities-cache";
43
- export * from "./model-capability-heuristics";
44
43
  export * from "./model-settings-compatibility";
45
44
  export * from "./fallback-model-availability";
46
45
  export * from "./connected-providers-cache";
@@ -1,23 +1 @@
1
- export interface JsoncParseResult<T> {
2
- data: T | null;
3
- errors: Array<{
4
- message: string;
5
- offset: number;
6
- length: number;
7
- }>;
8
- }
9
- type DetectPluginConfigResult = {
10
- format: "json" | "jsonc" | "none";
11
- path: string;
12
- legacyPath?: string;
13
- };
14
- export declare function parseJsonc<T = unknown>(content: string): T;
15
- export declare function parseJsoncSafe<T = unknown>(content: string): JsoncParseResult<T>;
16
- export declare function readJsoncFile<T = unknown>(filePath: string): T | null;
17
- export declare function detectConfigFile(basePath: string): {
18
- format: "json" | "jsonc" | "none";
19
- path: string;
20
- };
21
- export declare function clearPluginConfigFileDetectionCache(): void;
22
- export declare function detectPluginConfigFile(dir: string): DetectPluginConfigResult;
23
- export {};
1
+ export { clearPluginConfigFileDetectionCache, detectConfigFile, detectPluginConfigFile, parseJsonc, parseJsoncSafe, readJsoncFile, type DetectPluginConfigFileOptions, type JsoncParseResult, } from "@oh-my-opencode/utils";
@@ -1,11 +1,24 @@
1
- export declare function fuzzyMatchModel(target: string, available: Set<string>, providers?: string[]): string | null;
2
1
  /**
3
- * Check if a target model is available (fuzzy match by model name, no provider filtering)
2
+ * Fuzzy match a target model name against available models
3
+ *
4
+ * @param target - The model name or substring to search for (e.g., "gpt-5.4", "claude-opus")
5
+ * @param available - Set of available model names in format "provider/model-name"
6
+ * @param providers - Optional array of provider names to filter by (e.g., ["openai", "anthropic"])
7
+ * @returns The matched model name or null if no match found
8
+ *
9
+ * Matching priority:
10
+ * 1. Exact match (if exists)
11
+ * 2. Shorter model name (more specific)
4
12
  *
5
- * @param targetModel - Model name to check (e.g., "gpt-5.3-codex")
6
- * @param availableModels - Set of available models in "provider/model" format
7
- * @returns true if model is available, false otherwise
13
+ * Matching is case-insensitive substring match.
14
+ * If providers array is given, only models starting with "provider/" are considered.
15
+ *
16
+ * @example
17
+ * const available = new Set(["openai/gpt-5.4", "openai/gpt-5.3-codex", "anthropic/claude-opus-4-7"])
18
+ * fuzzyMatchModel("gpt-5.4", available) // → "openai/gpt-5.4"
19
+ * fuzzyMatchModel("claude", available, ["openai"]) // → null (provider filter excludes anthropic)
8
20
  */
21
+ export declare function fuzzyMatchModel(target: string, available: Set<string>, providers?: string[]): string | null;
9
22
  export declare function isModelAvailable(targetModel: string, availableModels: Set<string>): boolean;
10
23
  export declare function getConnectedProviders(client: any): Promise<string[]>;
11
24
  export declare function fetchAvailableModels(client?: any, options?: {
@@ -1,3 +1,6 @@
1
- export { getBundledModelCapabilitiesSnapshot } from "./bundled-snapshot";
2
- export { getModelCapabilities } from "./get-model-capabilities";
3
- export type { GetModelCapabilitiesInput, ModelCapabilities, ModelCapabilitiesDiagnostics, ModelCapabilitiesSnapshot, ModelCapabilitiesSnapshotEntry, } from "./types";
1
+ import type { GetModelCapabilitiesInput, ModelCapabilities } from "@oh-my-opencode/model-core";
2
+ export declare function getBundledModelCapabilitiesSnapshotForRuntime(): import("@oh-my-opencode/model-core").ModelCapabilitiesSnapshot;
3
+ export declare function getBundledModelCapabilitiesSnapshotForShared(): ReturnType<typeof getBundledModelCapabilitiesSnapshotForRuntime>;
4
+ export { getBundledModelCapabilitiesSnapshotForShared as getBundledModelCapabilitiesSnapshot };
5
+ export declare function getModelCapabilities(input: GetModelCapabilitiesInput): ModelCapabilities;
6
+ export type { GetModelCapabilitiesInput, ModelCapabilities, ModelCapabilitiesDiagnostics, ModelCapabilitiesSnapshot, ModelCapabilitiesSnapshotEntry, } from "@oh-my-opencode/model-core";
@@ -1,20 +1,16 @@
1
+ import { MODELS_DEV_SOURCE_URL, buildModelCapabilitiesSnapshotFromModelsDev, fetchModelCapabilitiesSnapshot } from "@oh-my-opencode/model-core";
1
2
  import type { ModelCapabilitiesSnapshot } from "./model-capabilities";
2
- export declare const MODELS_DEV_SOURCE_URL = "https://models.dev/api.json";
3
- export declare function buildModelCapabilitiesSnapshotFromModelsDev(raw: unknown): ModelCapabilitiesSnapshot;
4
- export declare function fetchModelCapabilitiesSnapshot(args?: {
5
- sourceUrl?: string;
6
- fetchImpl?: typeof fetch;
7
- }): Promise<ModelCapabilitiesSnapshot>;
3
+ export { MODELS_DEV_SOURCE_URL, buildModelCapabilitiesSnapshotFromModelsDev, fetchModelCapabilitiesSnapshot, };
8
4
  export declare function createModelCapabilitiesCacheStore(getCacheDir?: () => string): {
9
5
  readModelCapabilitiesCache: () => ModelCapabilitiesSnapshot | null;
10
6
  hasModelCapabilitiesCache: () => boolean;
11
7
  writeModelCapabilitiesCache: (snapshot: ModelCapabilitiesSnapshot) => void;
12
8
  refreshModelCapabilitiesCache: (args?: {
13
9
  sourceUrl?: string;
14
- fetchImpl?: typeof fetch;
10
+ fetchImpl?: (input: string) => Promise<Response>;
15
11
  }) => Promise<ModelCapabilitiesSnapshot>;
16
12
  };
17
13
  export declare const readModelCapabilitiesCache: () => ModelCapabilitiesSnapshot | null, hasModelCapabilitiesCache: () => boolean, writeModelCapabilitiesCache: (snapshot: ModelCapabilitiesSnapshot) => void, refreshModelCapabilitiesCache: (args?: {
18
14
  sourceUrl?: string;
19
- fetchImpl?: typeof fetch;
15
+ fetchImpl?: (input: string) => Promise<Response>;
20
16
  }) => Promise<ModelCapabilitiesSnapshot>;
@@ -1,34 +1,5 @@
1
- import type { FallbackEntry } from "./model-requirements";
2
- export interface ErrorInfo {
3
- name?: string;
4
- message?: string;
5
- /** HTTP status code from the provider response (e.g., 429 for rate limit) */
6
- statusCode?: number;
7
- }
8
- /**
9
- * Determines if an error is a retryable model error.
10
- * Returns true if it's a known retryable type OR matches retryable message patterns.
11
- */
12
- export declare function isRetryableModelError(error: ErrorInfo): boolean;
13
- /**
14
- * Determines if an error should trigger a fallback retry.
15
- * Returns true for errors that halt execution.
16
- */
17
- export declare function shouldRetryError(error: ErrorInfo): boolean;
18
- /**
19
- * Gets the next fallback model from the chain based on attempt count.
20
- * Returns undefined if all fallbacks have been exhausted.
21
- */
22
- export declare function getNextFallback(fallbackChain: FallbackEntry[], attemptCount: number): FallbackEntry | undefined;
23
- /**
24
- * Checks if there are more fallbacks available after the current attempt.
25
- */
26
- export declare function hasMoreFallbacks(fallbackChain: FallbackEntry[], attemptCount: number): boolean;
27
- /**
28
- * Selects the best provider for a fallback entry.
29
- * Priority:
30
- * 1) First connected provider in the entry's provider preference order
31
- * 2) Preferred provider when connected (and entry providers are unavailable)
32
- * 3) First provider listed in the fallback entry
33
- */
1
+ import { getNextFallback, hasMoreFallbacks, isRetryableModelError, selectFallbackProviderWithCache, shouldRetryError } from "@oh-my-opencode/model-core";
2
+ import type { ErrorInfo } from "@oh-my-opencode/model-core";
3
+ export type { ErrorInfo };
4
+ export { isRetryableModelError, shouldRetryError, getNextFallback, hasMoreFallbacks, selectFallbackProviderWithCache, };
34
5
  export declare function selectFallbackProvider(providers: string[], preferredProviderID?: string): string;
@@ -1,7 +1 @@
1
- export declare function normalizeModelFormat(model: string | {
2
- providerID: string;
3
- modelID: string;
4
- }): {
5
- providerID: string;
6
- modelID: string;
7
- } | undefined;
1
+ export { normalizeModelFormat } from "@oh-my-opencode/model-core";
@@ -1,2 +1 @@
1
- export declare function normalizeModel(model?: string): string | undefined;
2
- export declare function normalizeModelID(modelID: string): string;
1
+ export { normalizeModel, normalizeModelID } from "@oh-my-opencode/model-core";
@@ -1,22 +1,2 @@
1
- export type FallbackEntry = {
2
- providers: string[];
3
- model: string;
4
- variant?: string;
5
- reasoningEffort?: string;
6
- temperature?: number;
7
- top_p?: number;
8
- maxTokens?: number;
9
- thinking?: {
10
- type: "enabled" | "disabled";
11
- budgetTokens?: number;
12
- };
13
- };
14
- export type ModelRequirement = {
15
- fallbackChain: FallbackEntry[];
16
- variant?: string;
17
- requiresModel?: string;
18
- requiresAnyModel?: boolean;
19
- requiresProvider?: string[];
20
- };
21
- export declare const AGENT_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
22
- export declare const CATEGORY_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
1
+ export type { FallbackEntry, ModelRequirement } from "@oh-my-opencode/model-core";
2
+ export { AGENT_MODEL_REQUIREMENTS, CATEGORY_MODEL_REQUIREMENTS, } from "@oh-my-opencode/model-core";
@@ -1,30 +1,5 @@
1
- import { log as writeLog } from "./logger";
2
- import type { FallbackEntry } from "./model-requirements";
3
- type LogImplementation = typeof writeLog;
4
- export declare function _setModelResolutionLogImplementationForTesting(logImplementation: LogImplementation | undefined): void;
5
- export type ModelResolutionRequest = {
6
- intent?: {
7
- uiSelectedModel?: string;
8
- userModel?: string;
9
- userFallbackModels?: string[];
10
- categoryDefaultModel?: string;
11
- };
12
- constraints: {
13
- availableModels: Set<string>;
14
- connectedProviders?: string[] | null;
15
- };
16
- policy?: {
17
- fallbackChain?: FallbackEntry[];
18
- systemDefaultModel?: string;
19
- };
20
- };
21
- export type ModelResolutionProvenance = "override" | "category-default" | "provider-fallback" | "system-default";
22
- export type ModelResolutionResult = {
23
- model: string;
24
- provenance: ModelResolutionProvenance;
25
- variant?: string;
26
- attempted?: string[];
27
- reason?: string;
28
- };
29
- export declare function resolveModelPipeline(request: ModelResolutionRequest): ModelResolutionResult | undefined;
30
- export {};
1
+ import { _setModelResolutionLogImplementationForTesting } from "@oh-my-opencode/model-core";
2
+ import type { PipelineModelResolutionRequest, PipelineModelResolutionResult } from "@oh-my-opencode/model-core";
3
+ export { _setModelResolutionLogImplementationForTesting };
4
+ export declare function resolveModelPipeline(request: PipelineModelResolutionRequest): PipelineModelResolutionResult | undefined;
5
+ export type { PipelineModelResolutionRequest as ModelResolutionRequest, PipelineModelResolutionProvenance as ModelResolutionProvenance, PipelineModelResolutionResult as ModelResolutionResult, } from "@oh-my-opencode/model-core";
@@ -1,36 +1 @@
1
- import type { FallbackEntry } from "./model-requirements";
2
- export interface DelegatedModelConfig {
3
- providerID: string;
4
- modelID: string;
5
- variant?: string;
6
- reasoningEffort?: string;
7
- temperature?: number;
8
- top_p?: number;
9
- maxTokens?: number;
10
- thinking?: {
11
- type: "enabled" | "disabled";
12
- budgetTokens?: number;
13
- };
14
- }
15
- export type ModelResolutionRequest = {
16
- intent?: {
17
- uiSelectedModel?: string;
18
- userModel?: string;
19
- categoryDefaultModel?: string;
20
- };
21
- constraints: {
22
- availableModels: Set<string>;
23
- };
24
- policy?: {
25
- fallbackChain?: FallbackEntry[];
26
- systemDefaultModel?: string;
27
- };
28
- };
29
- export type ModelResolutionProvenance = "override" | "category-default" | "provider-fallback" | "system-default";
30
- export type ModelResolutionResult = {
31
- model: string;
32
- provenance: ModelResolutionProvenance;
33
- variant?: string;
34
- attempted?: string[];
35
- reason?: string;
36
- };
1
+ export type { DelegatedModelConfig, ModelResolutionRequest, ModelResolutionProvenance, ModelResolutionResult, } from "@oh-my-opencode/model-core";
@@ -1,35 +1,8 @@
1
- import type { FallbackEntry } from "./model-requirements";
2
- import type { FallbackModelObject } from "../config/schema/fallback-models";
3
- export type ModelResolutionInput = {
4
- userModel?: string;
5
- inheritedModel?: string;
6
- systemDefault?: string;
7
- };
8
- export type ModelSource = "override" | "category-default" | "provider-fallback" | "system-default";
9
- export type ModelResolutionResult = {
10
- model: string;
11
- source: ModelSource;
12
- variant?: string;
13
- };
14
- export type ExtendedModelResolutionInput = {
15
- uiSelectedModel?: string;
16
- userModel?: string;
17
- userFallbackModels?: string[];
18
- categoryDefaultModel?: string;
19
- fallbackChain?: FallbackEntry[];
20
- availableModels: Set<string>;
21
- systemDefaultModel?: string;
22
- };
23
- export declare function resolveModel(input: ModelResolutionInput): string | undefined;
24
- export declare function resolveModelWithFallback(input: ExtendedModelResolutionInput): ModelResolutionResult | undefined;
25
- /**
26
- * Normalizes fallback_models config to a mixed array.
27
- * Accepts string, string[], or mixed arrays of strings and FallbackModelObject entries.
28
- */
29
- export declare function normalizeFallbackModels(models: string | (string | FallbackModelObject)[] | undefined): (string | FallbackModelObject)[] | undefined;
30
- /**
31
- * Extracts plain model strings from a mixed fallback models array.
32
- * Object entries are flattened to "model" or "model(variant)" strings.
33
- * Use this when consumers need string[] (e.g., resolveModelForDelegateTask).
34
- */
35
- export declare function flattenToFallbackModelStrings(models: (string | FallbackModelObject)[] | undefined): string[] | undefined;
1
+ import { resolveModel, resolveModelWithFallback as resolveModelWithFallbackFromCore, normalizeFallbackModels, flattenToFallbackModelStrings } from "@oh-my-opencode/model-core";
2
+ import type { ModelResolutionInput, ExtendedModelResolutionInput } from "@oh-my-opencode/model-core";
3
+ export { resolveModel, normalizeFallbackModels, flattenToFallbackModelStrings };
4
+ type CoreModelResolutionResult = ReturnType<typeof resolveModelWithFallbackFromCore>;
5
+ export type ModelResolutionResult = Exclude<CoreModelResolutionResult, undefined>;
6
+ export type ModelSource = ModelResolutionResult["source"];
7
+ export declare function resolveModelWithFallback(input: ExtendedModelResolutionInput): CoreModelResolutionResult;
8
+ export type { ModelResolutionInput, ExtendedModelResolutionInput, };
@@ -1,3 +1 @@
1
- type CommandSource = "claude-code" | "opencode";
2
- export declare function sanitizeModelField(model: unknown, source?: CommandSource): string | undefined;
3
- export {};
1
+ export { sanitizeModelField } from "@oh-my-opencode/model-core";
@@ -1,40 +1,2 @@
1
- type CompatibilityField = "variant" | "reasoningEffort" | "temperature" | "topP" | "maxTokens" | "thinking";
2
- type DesiredModelSettings = {
3
- variant?: string;
4
- reasoningEffort?: string;
5
- temperature?: number;
6
- topP?: number;
7
- maxTokens?: number;
8
- thinking?: Record<string, unknown>;
9
- };
10
- type CompatibilityCapabilities = {
11
- variants?: string[];
12
- reasoningEfforts?: string[];
13
- supportsTemperature?: boolean;
14
- supportsTopP?: boolean;
15
- maxOutputTokens?: number;
16
- supportsThinking?: boolean;
17
- };
18
- export type ModelSettingsCompatibilityInput = {
19
- providerID: string;
20
- modelID: string;
21
- desired: DesiredModelSettings;
22
- capabilities?: CompatibilityCapabilities;
23
- };
24
- export type ModelSettingsCompatibilityChange = {
25
- field: CompatibilityField;
26
- from: string;
27
- to?: string;
28
- reason: "unsupported-by-model-family" | "unknown-model-family" | "unsupported-by-model-metadata" | "max-output-limit";
29
- };
30
- export type ModelSettingsCompatibilityResult = {
31
- variant?: string;
32
- reasoningEffort?: string;
33
- temperature?: number;
34
- topP?: number;
35
- maxTokens?: number;
36
- thinking?: Record<string, unknown>;
37
- changes: ModelSettingsCompatibilityChange[];
38
- };
39
- export declare function resolveCompatibleModelSettings(input: ModelSettingsCompatibilityInput): ModelSettingsCompatibilityResult;
40
- export {};
1
+ export type { ModelSettingsCompatibilityInput, ModelSettingsCompatibilityChange, ModelSettingsCompatibilityResult, } from "@oh-my-opencode/model-core";
2
+ export { resolveCompatibleModelSettings } from "@oh-my-opencode/model-core";
@@ -1,9 +1 @@
1
- export declare function parseVariantFromModelID(rawModelID: string): {
2
- modelID: string;
3
- variant?: string;
4
- };
5
- export declare function parseModelString(model: string): {
6
- providerID: string;
7
- modelID: string;
8
- variant?: string;
9
- } | undefined;
1
+ export { parseVariantFromModelID, parseModelString } from "@oh-my-opencode/model-core";
@@ -1,12 +1,9 @@
1
1
  import type { createOpencodeClient } from "@opencode-ai/sdk";
2
+ import { parseModelSuggestion as parseModelSuggestionFromCore } from "@oh-my-opencode/model-core";
2
3
  import { type PromptRetryOptions } from "./prompt-timeout-context";
3
4
  type Client = ReturnType<typeof createOpencodeClient>;
4
- export interface ModelSuggestionInfo {
5
- providerID: string;
6
- modelID: string;
7
- suggestion: string;
8
- }
9
- export declare function parseModelSuggestion(error: unknown): ModelSuggestionInfo | null;
5
+ export type { ModelSuggestionInfo } from "@oh-my-opencode/model-core";
6
+ export { parseModelSuggestionFromCore as parseModelSuggestion };
10
7
  interface PromptBody {
11
8
  model?: {
12
9
  providerID: string;
@@ -24,4 +21,3 @@ interface PromptArgs {
24
21
  }
25
22
  export declare function promptWithModelSuggestionRetry(client: Client, args: PromptArgs, options?: PromptRetryOptions): Promise<void>;
26
23
  export declare function promptSyncWithModelSuggestionRetry(client: Client, args: PromptArgs, options?: PromptRetryOptions): Promise<void>;
27
- export {};
@@ -3,6 +3,7 @@ export type { OpenCodeBinaryType, OpenCodeConfigDirOptions, OpenCodeConfigPaths,
3
3
  export declare const TAURI_APP_IDENTIFIER = "ai.opencode.desktop";
4
4
  export declare const TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
5
5
  export declare function isDevBuild(version: string | null | undefined): boolean;
6
+ export declare function getOpenCodeConfigDirs(options: OpenCodeConfigDirOptions): string[];
6
7
  export declare function getOpenCodeConfigDir(options: OpenCodeConfigDirOptions): string;
7
8
  export declare function getOpenCodeConfigPaths(options: OpenCodeConfigDirOptions): OpenCodeConfigPaths;
8
9
  export declare function detectExistingConfigDir(binary: OpenCodeBinaryType, version?: string | null): string | null;
@@ -1,9 +1 @@
1
- declare const DEFAULT_SERVER_PORT = 4096;
2
- export declare function isPortAvailable(port: number, hostname?: string): Promise<boolean>;
3
- export declare function findAvailablePort(startPort?: number, hostname?: string): Promise<number>;
4
- export interface AutoPortResult {
5
- port: number;
6
- wasAutoSelected: boolean;
7
- }
8
- export declare function getAvailableServerPort(preferredPort?: number, hostname?: string): Promise<AutoPortResult>;
9
- export { DEFAULT_SERVER_PORT };
1
+ export { DEFAULT_SERVER_PORT, findAvailablePort, getAvailableServerPort, isPortAvailable, type AutoPortResult, } from "@oh-my-opencode/utils";