diff --git a/assets/oh-my-opencode.schema.json b/assets/oh-my-opencode.schema.json index e5ff4c3ed..bcc1f09bf 100644 --- a/assets/oh-my-opencode.schema.json +++ b/assets/oh-my-opencode.schema.json @@ -91,7 +91,8 @@ "delegate-task-retry", "prometheus-md-only", "sisyphus-junior-notepad", - "sisyphus-gpt-hephaestus-reminder", + "no-sisyphus-gpt", + "no-hephaestus-non-gpt", "start-work", "atlas", "unstable-agent-babysitter", @@ -99,10 +100,11 @@ "task-resume-info", "stop-continuation-guard", "tasks-todowrite-disabler", + "runtime-fallback", "write-existing-file-guard", "anthropic-effort", - "runtime-fallback", - "hashline-read-enhancer" + "hashline-read-enhancer", + "hashline-edit-diff-enhancer" ] } }, @@ -127,6 +129,9 @@ "type": "string" } }, + "hashline_edit": { + "type": "boolean" + }, "agents": { "type": "object", "properties": { @@ -136,6 +141,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -300,18 +318,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -322,6 +339,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -486,18 +516,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -508,6 +537,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -672,18 +714,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -694,6 +735,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -858,18 +912,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -880,6 +933,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -1044,18 +1110,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1066,6 +1131,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -1230,18 +1308,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1252,6 +1329,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -1416,18 +1506,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1438,6 +1527,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -1602,18 +1704,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1624,6 +1725,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -1788,18 +1902,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1810,6 +1923,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -1974,18 +2100,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1996,6 +2121,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -2160,18 +2298,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2182,6 +2319,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -2346,18 +2496,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2368,6 +2517,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -2532,18 +2694,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2554,6 +2715,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -2718,18 +2892,17 @@ "type": "object", "additionalProperties": {} }, - "fallback_models": { - "anyOf": [ - { + "ultrawork": { + "type": "object", + "properties": { + "model": { "type": "string" }, - { - "type": "array", - "items": { - "type": "string" - } + "variant": { + "type": "string" } - ] + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2748,6 +2921,19 @@ "model": { "type": "string" }, + "fallback_models": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "variant": { "type": "string" }, @@ -2812,19 +2998,6 @@ "is_unstable_agent": { "type": "boolean" }, - "fallback_models": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, "disable": { "type": "boolean" } @@ -3030,7 +3203,7 @@ "safe_hook_creation": { "type": "boolean" }, - "hashline_edit": { + "disable_omo_env": { "type": "boolean" } }, diff --git a/src/config/schema/oh-my-opencode-config.ts b/src/config/schema/oh-my-opencode-config.ts index ddbbf7249..283d71a3f 100644 --- a/src/config/schema/oh-my-opencode-config.ts +++ b/src/config/schema/oh-my-opencode-config.ts @@ -54,7 +54,6 @@ export const OhMyOpenCodeConfigSchema = z.object({ websearch: WebsearchConfigSchema.optional(), tmux: TmuxConfigSchema.optional(), sisyphus: SisyphusConfigSchema.optional(), - runtime_fallback: RuntimeFallbackConfigSchema.optional(), /** Migration history to prevent re-applying migrations (e.g., model version upgrades) */ _migrations: z.array(z.string()).optional(), }) diff --git a/src/plugin/event.ts b/src/plugin/event.ts index 56baa9875..41f7683e4 100644 --- a/src/plugin/event.ts +++ b/src/plugin/event.ts @@ -20,16 +20,20 @@ type FirstMessageVariantGate = { clear: (sessionID: string) => void } +type EventInput = Parameters< + NonNullable["event"]> +>[0] + export function createEventHandler(args: { ctx: PluginContext pluginConfig: OhMyOpenCodeConfig firstMessageVariantGate: FirstMessageVariantGate managers: Managers hooks: CreatedHooks -}): (input: { event: { type: string; properties?: Record } }) => Promise { +}): (input: EventInput) => Promise { const { ctx, firstMessageVariantGate, managers, hooks } = args - const dispatchToHooks = async (input: { event: { type: string; properties?: Record } }): Promise => { + const dispatchToHooks = async (input: EventInput): Promise => { await Promise.resolve(hooks.autoUpdateChecker?.event?.(input)) await Promise.resolve(hooks.claudeCodeHooks?.event?.(input)) await Promise.resolve(hooks.backgroundNotificationHook?.event?.(input)) @@ -45,7 +49,7 @@ export function createEventHandler(args: { await Promise.resolve(hooks.runtimeFallback?.event?.(input)) await Promise.resolve(hooks.agentUsageReminder?.event?.(input)) await Promise.resolve(hooks.categorySkillReminder?.event?.(input)) - await Promise.resolve(hooks.interactiveBashSession?.event?.(input)) + await Promise.resolve(hooks.interactiveBashSession?.event?.(input as EventInput)) await Promise.resolve(hooks.ralphLoop?.event?.(input)) await Promise.resolve(hooks.stopContinuationGuard?.event?.(input)) await Promise.resolve(hooks.compactionTodoPreserver?.event?.(input)) @@ -88,7 +92,7 @@ export function createEventHandler(args: { return } recentSyntheticIdles.set(sessionID, Date.now()) - await dispatchToHooks(syntheticIdle) + await dispatchToHooks(syntheticIdle as EventInput) } const { event } = input diff --git a/src/shared/model-resolver.ts b/src/shared/model-resolver.ts index 9618b15ed..e2e02fce3 100644 --- a/src/shared/model-resolver.ts +++ b/src/shared/model-resolver.ts @@ -7,17 +7,6 @@ export type ModelResolutionInput = { systemDefault?: string } -/** - * Normalizes fallback_models to an array. - * Handles single string or array input, returns undefined for falsy values. - */ -export function normalizeFallbackModels( - fallbackModels: string | string[] | undefined | null -): string[] | undefined { - if (!fallbackModels) return undefined - return Array.isArray(fallbackModels) ? fallbackModels : [fallbackModels] -} - export type ModelSource = | "override" | "category-default"