@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.
@@ -29,3 +29,4 @@ export { createAtlasHook } from "./atlas";
29
29
  export { createDelegateTaskRetryHook } from "./delegate-task-retry";
30
30
  export { createQuestionLabelTruncatorHook } from "./question-label-truncator";
31
31
  export { createPerfProfilerHook } from "./perf-profiler";
32
+ export { createRuntimeFallbackHook } from "./runtime-fallback";
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Runtime Fallback Hook
3
+ *
4
+ * 处理 session.error 事件中的 provider 错误(quota、rate_limit),
5
+ * 在 retry 耗尽后自动切换到 fallback 模型。
6
+ *
7
+ * 不处理:context_overflow(由 context-window-recovery 处理)、auth、bad_request。
8
+ * 避让 sessionRecovery(可恢复错误优先由 sessionRecovery 处理)。
9
+ */
10
+ import type { PluginInput } from "@opencode-ai/plugin";
11
+ import type { RuntimeFallbackConfig } from "../../config/schema";
12
+ import { type FallbackModel } from "../../shared/runtime-fallback";
13
+ export interface RuntimeFallbackOptions {
14
+ config?: RuntimeFallbackConfig;
15
+ sessionRecovery?: {
16
+ isRecoverableError: (error: unknown) => boolean;
17
+ };
18
+ getConfiguredFallbackModels?: (agent?: string, category?: string) => FallbackModel[] | undefined;
19
+ }
20
+ export declare function createRuntimeFallbackHook(ctx: PluginInput, options?: RuntimeFallbackOptions): {
21
+ handler: ({ event, }: {
22
+ event: {
23
+ type: string;
24
+ properties?: unknown;
25
+ };
26
+ }) => Promise<boolean>;
27
+ };
@@ -0,0 +1 @@
1
+ export {};