@skj1724/oh-my-opencode 3.19.6 → 3.19.8

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.
package/dist/cli/index.js CHANGED
@@ -6117,6 +6117,12 @@ var init_model_resolver = __esm(() => {
6117
6117
  init_model_availability();
6118
6118
  });
6119
6119
 
6120
+ // src/shared/runtime-fallback.ts
6121
+ var init_runtime_fallback = __esm(() => {
6122
+ init_model_availability();
6123
+ init_model_requirements();
6124
+ });
6125
+
6120
6126
  // src/shared/perf-timer.ts
6121
6127
  class PerfTimer {
6122
6128
  marks = new Map;
@@ -6226,6 +6232,7 @@ var init_shared = __esm(() => {
6226
6232
  init_model_requirements();
6227
6233
  init_model_resolver();
6228
6234
  init_model_availability();
6235
+ init_runtime_fallback();
6229
6236
  init_perf_tracer();
6230
6237
  init_fileio_monitor();
6231
6238
  init_windows_reserved_names();
@@ -8460,7 +8467,7 @@ var import_picocolors2 = __toESM(require_picocolors(), 1);
8460
8467
  // package.json
8461
8468
  var package_default = {
8462
8469
  name: "@skj1724/oh-my-opencode",
8463
- version: "3.19.6",
8470
+ version: "3.19.8",
8464
8471
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
8465
8472
  main: "dist/index.js",
8466
8473
  types: "dist/index.d.ts",
@@ -24997,6 +25004,7 @@ var HookNameSchema = exports_external.enum([
24997
25004
  "auto-slash-command",
24998
25005
  "edit-error-recovery",
24999
25006
  "delegate-task-retry",
25007
+ "runtime-fallback",
25000
25008
  "prometheus-md-only",
25001
25009
  "perf-profiler",
25002
25010
  "start-work",
@@ -25006,6 +25014,23 @@ var BuiltinCommandNameSchema = exports_external.enum([
25006
25014
  "init-deep",
25007
25015
  "start-work"
25008
25016
  ]);
25017
+ var ProviderModelStringSchema = exports_external.string().refine((value) => {
25018
+ const separatorIndex = value.indexOf("/");
25019
+ return separatorIndex > 0 && separatorIndex < value.length - 1;
25020
+ }, "Expected provider/model format");
25021
+ var NonEmptyStringSchema = exports_external.string().min(1);
25022
+ var FallbackModelEntrySchema = exports_external.union([
25023
+ exports_external.object({
25024
+ model: ProviderModelStringSchema,
25025
+ variant: exports_external.string().optional()
25026
+ }).strict(),
25027
+ exports_external.object({
25028
+ providerID: NonEmptyStringSchema,
25029
+ modelID: NonEmptyStringSchema,
25030
+ variant: exports_external.string().optional()
25031
+ }).strict()
25032
+ ]);
25033
+ var FallbackModelsSchema = exports_external.array(FallbackModelEntrySchema);
25009
25034
  var AgentOverrideConfigSchema = exports_external.object({
25010
25035
  model: exports_external.string().optional(),
25011
25036
  variant: exports_external.string().optional(),
@@ -25020,7 +25045,8 @@ var AgentOverrideConfigSchema = exports_external.object({
25020
25045
  description: exports_external.string().optional(),
25021
25046
  mode: exports_external.enum(["subagent", "primary", "all"]).optional(),
25022
25047
  color: exports_external.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
25023
- permission: AgentPermissionSchema.optional()
25048
+ permission: AgentPermissionSchema.optional(),
25049
+ fallback_models: FallbackModelsSchema.optional()
25024
25050
  });
25025
25051
  var AgentOverridesSchema = exports_external.object({
25026
25052
  build: AgentOverrideConfigSchema.optional(),
@@ -25056,6 +25082,7 @@ var CategoryConfigSchema = exports_external.object({
25056
25082
  description: exports_external.string().optional(),
25057
25083
  model: exports_external.string().optional(),
25058
25084
  variant: exports_external.string().optional(),
25085
+ fallback_models: FallbackModelsSchema.optional(),
25059
25086
  temperature: exports_external.number().min(0).max(2).optional(),
25060
25087
  top_p: exports_external.number().min(0).max(1).optional(),
25061
25088
  maxTokens: exports_external.number().optional(),
@@ -25183,6 +25210,15 @@ var GitMasterConfigSchema = exports_external.object({
25183
25210
  commit_footer: exports_external.boolean().default(true),
25184
25211
  include_co_authored_by: exports_external.boolean().default(true)
25185
25212
  });
25213
+ var RuntimeFallbackConfigSchema = exports_external.object({
25214
+ enabled: exports_external.boolean().default(true),
25215
+ max_attempts: exports_external.number().min(0).default(3),
25216
+ initial_delay_ms: exports_external.number().min(0).default(2000),
25217
+ backoff_factor: exports_external.number().min(1).default(2),
25218
+ max_delay_ms: exports_external.number().min(0).default(30000),
25219
+ respect_retry_after: exports_external.boolean().default(true),
25220
+ jitter: exports_external.boolean().default(true)
25221
+ });
25186
25222
  var OhMyOpenCodeConfigSchema = exports_external.object({
25187
25223
  $schema: exports_external.string().optional(),
25188
25224
  disabled_mcps: exports_external.array(AnyMcpNameSchema).optional(),
@@ -25201,7 +25237,8 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
25201
25237
  ralph_loop: RalphLoopConfigSchema.optional(),
25202
25238
  background_task: BackgroundTaskConfigSchema.optional(),
25203
25239
  notification: NotificationConfigSchema.optional(),
25204
- git_master: GitMasterConfigSchema.optional()
25240
+ git_master: GitMasterConfigSchema.optional(),
25241
+ runtime_fallback: RuntimeFallbackConfigSchema.optional()
25205
25242
  });
25206
25243
  // src/cli/doctor/checks/config.ts
25207
25244
  var USER_CONFIG_DIR2 = getOpenCodeConfigDir({ binary: "opencode" });
@@ -1,2 +1,2 @@
1
- export { OhMyOpenCodeConfigSchema, AgentOverrideConfigSchema, AgentOverridesSchema, McpNameSchema, AgentNameSchema, HookNameSchema, BuiltinCommandNameSchema, SisyphusAgentConfigSchema, ExperimentalConfigSchema, RalphLoopConfigSchema, } from "./schema";
2
- export type { OhMyOpenCodeConfig, AgentOverrideConfig, AgentOverrides, McpName, AgentName, HookName, BuiltinCommandName, SisyphusAgentConfig, ExperimentalConfig, DynamicContextPruningConfig, RalphLoopConfig, } from "./schema";
1
+ export { OhMyOpenCodeConfigSchema, AgentOverrideConfigSchema, AgentOverridesSchema, McpNameSchema, AgentNameSchema, HookNameSchema, BuiltinCommandNameSchema, SisyphusAgentConfigSchema, ExperimentalConfigSchema, RalphLoopConfigSchema, FallbackModelEntrySchema, } from "./schema";
2
+ export type { OhMyOpenCodeConfig, AgentOverrideConfig, AgentOverrides, McpName, AgentName, HookName, BuiltinCommandName, SisyphusAgentConfig, ExperimentalConfig, DynamicContextPruningConfig, RalphLoopConfig, RuntimeFallbackConfig, FallbackModelEntry, } from "./schema";
@@ -70,6 +70,7 @@ export declare const HookNameSchema: z.ZodEnum<{
70
70
  "auto-slash-command": "auto-slash-command";
71
71
  "edit-error-recovery": "edit-error-recovery";
72
72
  "delegate-task-retry": "delegate-task-retry";
73
+ "runtime-fallback": "runtime-fallback";
73
74
  "prometheus-md-only": "prometheus-md-only";
74
75
  "perf-profiler": "perf-profiler";
75
76
  "start-work": "start-work";
@@ -78,6 +79,14 @@ export declare const BuiltinCommandNameSchema: z.ZodEnum<{
78
79
  "start-work": "start-work";
79
80
  "init-deep": "init-deep";
80
81
  }>;
82
+ export declare const FallbackModelEntrySchema: z.ZodUnion<readonly [z.ZodObject<{
83
+ model: z.ZodString;
84
+ variant: z.ZodOptional<z.ZodString>;
85
+ }, z.core.$strict>, z.ZodObject<{
86
+ providerID: z.ZodString;
87
+ modelID: z.ZodString;
88
+ variant: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strict>]>;
81
90
  export declare const AgentOverrideConfigSchema: z.ZodObject<{
82
91
  model: z.ZodOptional<z.ZodString>;
83
92
  variant: z.ZodOptional<z.ZodString>;
@@ -127,6 +136,14 @@ export declare const AgentOverrideConfigSchema: z.ZodObject<{
127
136
  ask: "ask";
128
137
  }>>;
129
138
  }, z.core.$strip>>;
139
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
140
+ model: z.ZodString;
141
+ variant: z.ZodOptional<z.ZodString>;
142
+ }, z.core.$strict>, z.ZodObject<{
143
+ providerID: z.ZodString;
144
+ modelID: z.ZodString;
145
+ variant: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strict>]>>>;
130
147
  }, z.core.$strip>;
131
148
  export declare const AgentOverridesSchema: z.ZodObject<{
132
149
  build: z.ZodOptional<z.ZodObject<{
@@ -178,6 +195,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
178
195
  ask: "ask";
179
196
  }>>;
180
197
  }, z.core.$strip>>;
198
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
199
+ model: z.ZodString;
200
+ variant: z.ZodOptional<z.ZodString>;
201
+ }, z.core.$strict>, z.ZodObject<{
202
+ providerID: z.ZodString;
203
+ modelID: z.ZodString;
204
+ variant: z.ZodOptional<z.ZodString>;
205
+ }, z.core.$strict>]>>>;
181
206
  }, z.core.$strip>>;
182
207
  plan: z.ZodOptional<z.ZodObject<{
183
208
  model: z.ZodOptional<z.ZodString>;
@@ -228,6 +253,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
228
253
  ask: "ask";
229
254
  }>>;
230
255
  }, z.core.$strip>>;
256
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
257
+ model: z.ZodString;
258
+ variant: z.ZodOptional<z.ZodString>;
259
+ }, z.core.$strict>, z.ZodObject<{
260
+ providerID: z.ZodString;
261
+ modelID: z.ZodString;
262
+ variant: z.ZodOptional<z.ZodString>;
263
+ }, z.core.$strict>]>>>;
231
264
  }, z.core.$strip>>;
232
265
  sisyphus: z.ZodOptional<z.ZodObject<{
233
266
  model: z.ZodOptional<z.ZodString>;
@@ -278,6 +311,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
278
311
  ask: "ask";
279
312
  }>>;
280
313
  }, z.core.$strip>>;
314
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
315
+ model: z.ZodString;
316
+ variant: z.ZodOptional<z.ZodString>;
317
+ }, z.core.$strict>, z.ZodObject<{
318
+ providerID: z.ZodString;
319
+ modelID: z.ZodString;
320
+ variant: z.ZodOptional<z.ZodString>;
321
+ }, z.core.$strict>]>>>;
281
322
  }, z.core.$strip>>;
282
323
  "sisyphus-junior": z.ZodOptional<z.ZodObject<{
283
324
  model: z.ZodOptional<z.ZodString>;
@@ -328,6 +369,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
328
369
  ask: "ask";
329
370
  }>>;
330
371
  }, z.core.$strip>>;
372
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
373
+ model: z.ZodString;
374
+ variant: z.ZodOptional<z.ZodString>;
375
+ }, z.core.$strict>, z.ZodObject<{
376
+ providerID: z.ZodString;
377
+ modelID: z.ZodString;
378
+ variant: z.ZodOptional<z.ZodString>;
379
+ }, z.core.$strict>]>>>;
331
380
  }, z.core.$strip>>;
332
381
  "OpenCode-Builder": z.ZodOptional<z.ZodObject<{
333
382
  model: z.ZodOptional<z.ZodString>;
@@ -378,6 +427,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
378
427
  ask: "ask";
379
428
  }>>;
380
429
  }, z.core.$strip>>;
430
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
431
+ model: z.ZodString;
432
+ variant: z.ZodOptional<z.ZodString>;
433
+ }, z.core.$strict>, z.ZodObject<{
434
+ providerID: z.ZodString;
435
+ modelID: z.ZodString;
436
+ variant: z.ZodOptional<z.ZodString>;
437
+ }, z.core.$strict>]>>>;
381
438
  }, z.core.$strip>>;
382
439
  prometheus: z.ZodOptional<z.ZodObject<{
383
440
  model: z.ZodOptional<z.ZodString>;
@@ -428,6 +485,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
428
485
  ask: "ask";
429
486
  }>>;
430
487
  }, z.core.$strip>>;
488
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
489
+ model: z.ZodString;
490
+ variant: z.ZodOptional<z.ZodString>;
491
+ }, z.core.$strict>, z.ZodObject<{
492
+ providerID: z.ZodString;
493
+ modelID: z.ZodString;
494
+ variant: z.ZodOptional<z.ZodString>;
495
+ }, z.core.$strict>]>>>;
431
496
  }, z.core.$strip>>;
432
497
  metis: z.ZodOptional<z.ZodObject<{
433
498
  model: z.ZodOptional<z.ZodString>;
@@ -478,6 +543,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
478
543
  ask: "ask";
479
544
  }>>;
480
545
  }, z.core.$strip>>;
546
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
547
+ model: z.ZodString;
548
+ variant: z.ZodOptional<z.ZodString>;
549
+ }, z.core.$strict>, z.ZodObject<{
550
+ providerID: z.ZodString;
551
+ modelID: z.ZodString;
552
+ variant: z.ZodOptional<z.ZodString>;
553
+ }, z.core.$strict>]>>>;
481
554
  }, z.core.$strip>>;
482
555
  momus: z.ZodOptional<z.ZodObject<{
483
556
  model: z.ZodOptional<z.ZodString>;
@@ -528,6 +601,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
528
601
  ask: "ask";
529
602
  }>>;
530
603
  }, z.core.$strip>>;
604
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
605
+ model: z.ZodString;
606
+ variant: z.ZodOptional<z.ZodString>;
607
+ }, z.core.$strict>, z.ZodObject<{
608
+ providerID: z.ZodString;
609
+ modelID: z.ZodString;
610
+ variant: z.ZodOptional<z.ZodString>;
611
+ }, z.core.$strict>]>>>;
531
612
  }, z.core.$strip>>;
532
613
  oracle: z.ZodOptional<z.ZodObject<{
533
614
  model: z.ZodOptional<z.ZodString>;
@@ -578,6 +659,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
578
659
  ask: "ask";
579
660
  }>>;
580
661
  }, z.core.$strip>>;
662
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
663
+ model: z.ZodString;
664
+ variant: z.ZodOptional<z.ZodString>;
665
+ }, z.core.$strict>, z.ZodObject<{
666
+ providerID: z.ZodString;
667
+ modelID: z.ZodString;
668
+ variant: z.ZodOptional<z.ZodString>;
669
+ }, z.core.$strict>]>>>;
581
670
  }, z.core.$strip>>;
582
671
  librarian: z.ZodOptional<z.ZodObject<{
583
672
  model: z.ZodOptional<z.ZodString>;
@@ -628,6 +717,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
628
717
  ask: "ask";
629
718
  }>>;
630
719
  }, z.core.$strip>>;
720
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
721
+ model: z.ZodString;
722
+ variant: z.ZodOptional<z.ZodString>;
723
+ }, z.core.$strict>, z.ZodObject<{
724
+ providerID: z.ZodString;
725
+ modelID: z.ZodString;
726
+ variant: z.ZodOptional<z.ZodString>;
727
+ }, z.core.$strict>]>>>;
631
728
  }, z.core.$strip>>;
632
729
  explore: z.ZodOptional<z.ZodObject<{
633
730
  model: z.ZodOptional<z.ZodString>;
@@ -678,6 +775,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
678
775
  ask: "ask";
679
776
  }>>;
680
777
  }, z.core.$strip>>;
778
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
779
+ model: z.ZodString;
780
+ variant: z.ZodOptional<z.ZodString>;
781
+ }, z.core.$strict>, z.ZodObject<{
782
+ providerID: z.ZodString;
783
+ modelID: z.ZodString;
784
+ variant: z.ZodOptional<z.ZodString>;
785
+ }, z.core.$strict>]>>>;
681
786
  }, z.core.$strip>>;
682
787
  "multimodal-looker": z.ZodOptional<z.ZodObject<{
683
788
  model: z.ZodOptional<z.ZodString>;
@@ -728,6 +833,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
728
833
  ask: "ask";
729
834
  }>>;
730
835
  }, z.core.$strip>>;
836
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
837
+ model: z.ZodString;
838
+ variant: z.ZodOptional<z.ZodString>;
839
+ }, z.core.$strict>, z.ZodObject<{
840
+ providerID: z.ZodString;
841
+ modelID: z.ZodString;
842
+ variant: z.ZodOptional<z.ZodString>;
843
+ }, z.core.$strict>]>>>;
731
844
  }, z.core.$strip>>;
732
845
  atlas: z.ZodOptional<z.ZodObject<{
733
846
  model: z.ZodOptional<z.ZodString>;
@@ -778,6 +891,14 @@ export declare const AgentOverridesSchema: z.ZodObject<{
778
891
  ask: "ask";
779
892
  }>>;
780
893
  }, z.core.$strip>>;
894
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
895
+ model: z.ZodString;
896
+ variant: z.ZodOptional<z.ZodString>;
897
+ }, z.core.$strict>, z.ZodObject<{
898
+ providerID: z.ZodString;
899
+ modelID: z.ZodString;
900
+ variant: z.ZodOptional<z.ZodString>;
901
+ }, z.core.$strict>]>>>;
781
902
  }, z.core.$strip>>;
782
903
  }, z.core.$strip>;
783
904
  export declare const ClaudeCodeConfigSchema: z.ZodObject<{
@@ -799,6 +920,14 @@ export declare const CategoryConfigSchema: z.ZodObject<{
799
920
  description: z.ZodOptional<z.ZodString>;
800
921
  model: z.ZodOptional<z.ZodString>;
801
922
  variant: z.ZodOptional<z.ZodString>;
923
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
924
+ model: z.ZodString;
925
+ variant: z.ZodOptional<z.ZodString>;
926
+ }, z.core.$strict>, z.ZodObject<{
927
+ providerID: z.ZodString;
928
+ modelID: z.ZodString;
929
+ variant: z.ZodOptional<z.ZodString>;
930
+ }, z.core.$strict>]>>>;
802
931
  temperature: z.ZodOptional<z.ZodNumber>;
803
932
  top_p: z.ZodOptional<z.ZodNumber>;
804
933
  maxTokens: z.ZodOptional<z.ZodNumber>;
@@ -837,6 +966,14 @@ export declare const CategoriesConfigSchema: z.ZodRecord<z.ZodString, z.ZodObjec
837
966
  description: z.ZodOptional<z.ZodString>;
838
967
  model: z.ZodOptional<z.ZodString>;
839
968
  variant: z.ZodOptional<z.ZodString>;
969
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
970
+ model: z.ZodString;
971
+ variant: z.ZodOptional<z.ZodString>;
972
+ }, z.core.$strict>, z.ZodObject<{
973
+ providerID: z.ZodString;
974
+ modelID: z.ZodString;
975
+ variant: z.ZodOptional<z.ZodString>;
976
+ }, z.core.$strict>]>>>;
840
977
  temperature: z.ZodOptional<z.ZodNumber>;
841
978
  top_p: z.ZodOptional<z.ZodNumber>;
842
979
  maxTokens: z.ZodOptional<z.ZodNumber>;
@@ -1016,6 +1153,15 @@ export declare const GitMasterConfigSchema: z.ZodObject<{
1016
1153
  commit_footer: z.ZodDefault<z.ZodBoolean>;
1017
1154
  include_co_authored_by: z.ZodDefault<z.ZodBoolean>;
1018
1155
  }, z.core.$strip>;
1156
+ export declare const RuntimeFallbackConfigSchema: z.ZodObject<{
1157
+ enabled: z.ZodDefault<z.ZodBoolean>;
1158
+ max_attempts: z.ZodDefault<z.ZodNumber>;
1159
+ initial_delay_ms: z.ZodDefault<z.ZodNumber>;
1160
+ backoff_factor: z.ZodDefault<z.ZodNumber>;
1161
+ max_delay_ms: z.ZodDefault<z.ZodNumber>;
1162
+ respect_retry_after: z.ZodDefault<z.ZodBoolean>;
1163
+ jitter: z.ZodDefault<z.ZodBoolean>;
1164
+ }, z.core.$strip>;
1019
1165
  export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1020
1166
  $schema: z.ZodOptional<z.ZodString>;
1021
1167
  disabled_mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1064,6 +1210,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1064
1210
  "auto-slash-command": "auto-slash-command";
1065
1211
  "edit-error-recovery": "edit-error-recovery";
1066
1212
  "delegate-task-retry": "delegate-task-retry";
1213
+ "runtime-fallback": "runtime-fallback";
1067
1214
  "prometheus-md-only": "prometheus-md-only";
1068
1215
  "perf-profiler": "perf-profiler";
1069
1216
  "start-work": "start-work";
@@ -1122,6 +1269,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1122
1269
  ask: "ask";
1123
1270
  }>>;
1124
1271
  }, z.core.$strip>>;
1272
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1273
+ model: z.ZodString;
1274
+ variant: z.ZodOptional<z.ZodString>;
1275
+ }, z.core.$strict>, z.ZodObject<{
1276
+ providerID: z.ZodString;
1277
+ modelID: z.ZodString;
1278
+ variant: z.ZodOptional<z.ZodString>;
1279
+ }, z.core.$strict>]>>>;
1125
1280
  }, z.core.$strip>>;
1126
1281
  plan: z.ZodOptional<z.ZodObject<{
1127
1282
  model: z.ZodOptional<z.ZodString>;
@@ -1172,6 +1327,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1172
1327
  ask: "ask";
1173
1328
  }>>;
1174
1329
  }, z.core.$strip>>;
1330
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1331
+ model: z.ZodString;
1332
+ variant: z.ZodOptional<z.ZodString>;
1333
+ }, z.core.$strict>, z.ZodObject<{
1334
+ providerID: z.ZodString;
1335
+ modelID: z.ZodString;
1336
+ variant: z.ZodOptional<z.ZodString>;
1337
+ }, z.core.$strict>]>>>;
1175
1338
  }, z.core.$strip>>;
1176
1339
  sisyphus: z.ZodOptional<z.ZodObject<{
1177
1340
  model: z.ZodOptional<z.ZodString>;
@@ -1222,6 +1385,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1222
1385
  ask: "ask";
1223
1386
  }>>;
1224
1387
  }, z.core.$strip>>;
1388
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1389
+ model: z.ZodString;
1390
+ variant: z.ZodOptional<z.ZodString>;
1391
+ }, z.core.$strict>, z.ZodObject<{
1392
+ providerID: z.ZodString;
1393
+ modelID: z.ZodString;
1394
+ variant: z.ZodOptional<z.ZodString>;
1395
+ }, z.core.$strict>]>>>;
1225
1396
  }, z.core.$strip>>;
1226
1397
  "sisyphus-junior": z.ZodOptional<z.ZodObject<{
1227
1398
  model: z.ZodOptional<z.ZodString>;
@@ -1272,6 +1443,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1272
1443
  ask: "ask";
1273
1444
  }>>;
1274
1445
  }, z.core.$strip>>;
1446
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1447
+ model: z.ZodString;
1448
+ variant: z.ZodOptional<z.ZodString>;
1449
+ }, z.core.$strict>, z.ZodObject<{
1450
+ providerID: z.ZodString;
1451
+ modelID: z.ZodString;
1452
+ variant: z.ZodOptional<z.ZodString>;
1453
+ }, z.core.$strict>]>>>;
1275
1454
  }, z.core.$strip>>;
1276
1455
  "OpenCode-Builder": z.ZodOptional<z.ZodObject<{
1277
1456
  model: z.ZodOptional<z.ZodString>;
@@ -1322,6 +1501,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1322
1501
  ask: "ask";
1323
1502
  }>>;
1324
1503
  }, z.core.$strip>>;
1504
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1505
+ model: z.ZodString;
1506
+ variant: z.ZodOptional<z.ZodString>;
1507
+ }, z.core.$strict>, z.ZodObject<{
1508
+ providerID: z.ZodString;
1509
+ modelID: z.ZodString;
1510
+ variant: z.ZodOptional<z.ZodString>;
1511
+ }, z.core.$strict>]>>>;
1325
1512
  }, z.core.$strip>>;
1326
1513
  prometheus: z.ZodOptional<z.ZodObject<{
1327
1514
  model: z.ZodOptional<z.ZodString>;
@@ -1372,6 +1559,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1372
1559
  ask: "ask";
1373
1560
  }>>;
1374
1561
  }, z.core.$strip>>;
1562
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1563
+ model: z.ZodString;
1564
+ variant: z.ZodOptional<z.ZodString>;
1565
+ }, z.core.$strict>, z.ZodObject<{
1566
+ providerID: z.ZodString;
1567
+ modelID: z.ZodString;
1568
+ variant: z.ZodOptional<z.ZodString>;
1569
+ }, z.core.$strict>]>>>;
1375
1570
  }, z.core.$strip>>;
1376
1571
  metis: z.ZodOptional<z.ZodObject<{
1377
1572
  model: z.ZodOptional<z.ZodString>;
@@ -1422,6 +1617,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1422
1617
  ask: "ask";
1423
1618
  }>>;
1424
1619
  }, z.core.$strip>>;
1620
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1621
+ model: z.ZodString;
1622
+ variant: z.ZodOptional<z.ZodString>;
1623
+ }, z.core.$strict>, z.ZodObject<{
1624
+ providerID: z.ZodString;
1625
+ modelID: z.ZodString;
1626
+ variant: z.ZodOptional<z.ZodString>;
1627
+ }, z.core.$strict>]>>>;
1425
1628
  }, z.core.$strip>>;
1426
1629
  momus: z.ZodOptional<z.ZodObject<{
1427
1630
  model: z.ZodOptional<z.ZodString>;
@@ -1472,6 +1675,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1472
1675
  ask: "ask";
1473
1676
  }>>;
1474
1677
  }, z.core.$strip>>;
1678
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1679
+ model: z.ZodString;
1680
+ variant: z.ZodOptional<z.ZodString>;
1681
+ }, z.core.$strict>, z.ZodObject<{
1682
+ providerID: z.ZodString;
1683
+ modelID: z.ZodString;
1684
+ variant: z.ZodOptional<z.ZodString>;
1685
+ }, z.core.$strict>]>>>;
1475
1686
  }, z.core.$strip>>;
1476
1687
  oracle: z.ZodOptional<z.ZodObject<{
1477
1688
  model: z.ZodOptional<z.ZodString>;
@@ -1522,6 +1733,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1522
1733
  ask: "ask";
1523
1734
  }>>;
1524
1735
  }, z.core.$strip>>;
1736
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1737
+ model: z.ZodString;
1738
+ variant: z.ZodOptional<z.ZodString>;
1739
+ }, z.core.$strict>, z.ZodObject<{
1740
+ providerID: z.ZodString;
1741
+ modelID: z.ZodString;
1742
+ variant: z.ZodOptional<z.ZodString>;
1743
+ }, z.core.$strict>]>>>;
1525
1744
  }, z.core.$strip>>;
1526
1745
  librarian: z.ZodOptional<z.ZodObject<{
1527
1746
  model: z.ZodOptional<z.ZodString>;
@@ -1572,6 +1791,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1572
1791
  ask: "ask";
1573
1792
  }>>;
1574
1793
  }, z.core.$strip>>;
1794
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1795
+ model: z.ZodString;
1796
+ variant: z.ZodOptional<z.ZodString>;
1797
+ }, z.core.$strict>, z.ZodObject<{
1798
+ providerID: z.ZodString;
1799
+ modelID: z.ZodString;
1800
+ variant: z.ZodOptional<z.ZodString>;
1801
+ }, z.core.$strict>]>>>;
1575
1802
  }, z.core.$strip>>;
1576
1803
  explore: z.ZodOptional<z.ZodObject<{
1577
1804
  model: z.ZodOptional<z.ZodString>;
@@ -1622,6 +1849,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1622
1849
  ask: "ask";
1623
1850
  }>>;
1624
1851
  }, z.core.$strip>>;
1852
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1853
+ model: z.ZodString;
1854
+ variant: z.ZodOptional<z.ZodString>;
1855
+ }, z.core.$strict>, z.ZodObject<{
1856
+ providerID: z.ZodString;
1857
+ modelID: z.ZodString;
1858
+ variant: z.ZodOptional<z.ZodString>;
1859
+ }, z.core.$strict>]>>>;
1625
1860
  }, z.core.$strip>>;
1626
1861
  "multimodal-looker": z.ZodOptional<z.ZodObject<{
1627
1862
  model: z.ZodOptional<z.ZodString>;
@@ -1672,6 +1907,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1672
1907
  ask: "ask";
1673
1908
  }>>;
1674
1909
  }, z.core.$strip>>;
1910
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1911
+ model: z.ZodString;
1912
+ variant: z.ZodOptional<z.ZodString>;
1913
+ }, z.core.$strict>, z.ZodObject<{
1914
+ providerID: z.ZodString;
1915
+ modelID: z.ZodString;
1916
+ variant: z.ZodOptional<z.ZodString>;
1917
+ }, z.core.$strict>]>>>;
1675
1918
  }, z.core.$strip>>;
1676
1919
  atlas: z.ZodOptional<z.ZodObject<{
1677
1920
  model: z.ZodOptional<z.ZodString>;
@@ -1722,12 +1965,28 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1722
1965
  ask: "ask";
1723
1966
  }>>;
1724
1967
  }, z.core.$strip>>;
1968
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1969
+ model: z.ZodString;
1970
+ variant: z.ZodOptional<z.ZodString>;
1971
+ }, z.core.$strict>, z.ZodObject<{
1972
+ providerID: z.ZodString;
1973
+ modelID: z.ZodString;
1974
+ variant: z.ZodOptional<z.ZodString>;
1975
+ }, z.core.$strict>]>>>;
1725
1976
  }, z.core.$strip>>;
1726
1977
  }, z.core.$strip>>;
1727
1978
  categories: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1728
1979
  description: z.ZodOptional<z.ZodString>;
1729
1980
  model: z.ZodOptional<z.ZodString>;
1730
1981
  variant: z.ZodOptional<z.ZodString>;
1982
+ fallback_models: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1983
+ model: z.ZodString;
1984
+ variant: z.ZodOptional<z.ZodString>;
1985
+ }, z.core.$strict>, z.ZodObject<{
1986
+ providerID: z.ZodString;
1987
+ modelID: z.ZodString;
1988
+ variant: z.ZodOptional<z.ZodString>;
1989
+ }, z.core.$strict>]>>>;
1731
1990
  temperature: z.ZodOptional<z.ZodNumber>;
1732
1991
  top_p: z.ZodOptional<z.ZodNumber>;
1733
1992
  maxTokens: z.ZodOptional<z.ZodNumber>;
@@ -1855,6 +2114,15 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1855
2114
  commit_footer: z.ZodDefault<z.ZodBoolean>;
1856
2115
  include_co_authored_by: z.ZodDefault<z.ZodBoolean>;
1857
2116
  }, z.core.$strip>>;
2117
+ runtime_fallback: z.ZodOptional<z.ZodObject<{
2118
+ enabled: z.ZodDefault<z.ZodBoolean>;
2119
+ max_attempts: z.ZodDefault<z.ZodNumber>;
2120
+ initial_delay_ms: z.ZodDefault<z.ZodNumber>;
2121
+ backoff_factor: z.ZodDefault<z.ZodNumber>;
2122
+ max_delay_ms: z.ZodDefault<z.ZodNumber>;
2123
+ respect_retry_after: z.ZodDefault<z.ZodBoolean>;
2124
+ jitter: z.ZodDefault<z.ZodBoolean>;
2125
+ }, z.core.$strip>>;
1858
2126
  }, z.core.$strip>;
1859
2127
  export type OhMyOpenCodeConfig = z.infer<typeof OhMyOpenCodeConfigSchema>;
1860
2128
  export type AgentOverrideConfig = z.infer<typeof AgentOverrideConfigSchema>;
@@ -1877,4 +2145,6 @@ export type CategoryConfig = z.infer<typeof CategoryConfigSchema>;
1877
2145
  export type CategoriesConfig = z.infer<typeof CategoriesConfigSchema>;
1878
2146
  export type BuiltinCategoryName = z.infer<typeof BuiltinCategoryNameSchema>;
1879
2147
  export type GitMasterConfig = z.infer<typeof GitMasterConfigSchema>;
2148
+ export type RuntimeFallbackConfig = z.infer<typeof RuntimeFallbackConfigSchema>;
2149
+ export type FallbackModelEntry = z.infer<typeof FallbackModelEntrySchema>;
1880
2150
  export { AnyMcpNameSchema, type AnyMcpName, McpNameSchema, type McpName } from "../mcp/types";
@@ -1,7 +1,7 @@
1
1
  import type { PluginInput } from "@opencode-ai/plugin";
2
2
  import type { BackgroundTask, LaunchInput, ResumeInput } from "./types";
3
3
  import type { PerfTracer } from "../../shared/perf-tracer";
4
- import type { BackgroundTaskConfig } from "../../config/schema";
4
+ import type { BackgroundTaskConfig, RuntimeFallbackConfig } from "../../config/schema";
5
5
  interface EventProperties {
6
6
  sessionID?: string;
7
7
  info?: {
@@ -13,6 +13,9 @@ interface Event {
13
13
  type: string;
14
14
  properties?: EventProperties;
15
15
  }
16
+ type BackgroundManagerConfig = BackgroundTaskConfig & {
17
+ runtimeFallback?: RuntimeFallbackConfig;
18
+ };
16
19
  export declare class BackgroundManager {
17
20
  private static cleanupManagers;
18
21
  private static cleanupRegistered;
@@ -30,11 +33,12 @@ export declare class BackgroundManager {
30
33
  private perfTracer?;
31
34
  private queuesByKey;
32
35
  private processingKeys;
33
- constructor(ctx: PluginInput, config?: BackgroundTaskConfig);
36
+ constructor(ctx: PluginInput, config?: BackgroundManagerConfig);
34
37
  setPerfTracer(tracer: PerfTracer): void;
35
38
  launch(input: LaunchInput): Promise<BackgroundTask>;
36
39
  private processKey;
37
40
  private startTask;
41
+ private handlePromptFailure;
38
42
  getTask(id: string): BackgroundTask | undefined;
39
43
  getTasksByParentSession(sessionID: string): BackgroundTask[];
40
44
  getAllDescendantTasks(sessionID: string): BackgroundTask[];
@@ -1,3 +1,5 @@
1
+ import type { FallbackAttempt } from "../../shared/runtime-fallback";
2
+ export type { FallbackAttempt };
1
3
  export type BackgroundTaskStatus = "pending" | "running" | "completed" | "error" | "cancelled";
2
4
  export interface PhaseTiming {
3
5
  /** queuedAt -> startedAt in ms */
@@ -53,6 +55,7 @@ export interface BackgroundTask {
53
55
  concurrencyGroup?: string;
54
56
  /** Parent session's agent name for notification */
55
57
  parentAgent?: string;
58
+ category?: string;
56
59
  /** Last message count for stability detection */
57
60
  lastMsgCount?: number;
58
61
  /** Number of consecutive polls with stable message count */
@@ -65,6 +68,8 @@ export interface BackgroundTask {
65
68
  maxRuntimeMs?: number;
66
69
  /** Max duration of a single step in ms (0 / undefined = unlimited) */
67
70
  stepTimeoutMs?: number;
71
+ /** Fallback attempts history */
72
+ attempts?: FallbackAttempt[];
68
73
  }
69
74
  export interface LaunchInput {
70
75
  description: string;
@@ -77,6 +82,7 @@ export interface LaunchInput {
77
82
  modelID: string;
78
83
  };
79
84
  parentAgent?: string;
85
+ category?: string;
80
86
  model?: {
81
87
  providerID: string;
82
88
  modelID: string;