fix(types): align web fallback contracts (#8819)

This commit is contained in:
backryun
2026-07-28 11:57:23 +09:00
committed by GitHub
parent 07ce14cd82
commit 6133939acd
2 changed files with 12 additions and 4 deletions

View File

@@ -16,6 +16,10 @@ export const OMNIROUTE_WEB_FETCH_FALLBACK_TOOL_NAME = "omniroute_web_fetch";
const WEB_FETCH_TOOL_TYPES = new Set(["web_fetch", "web_fetch_20250910"]);
type JsonRecord = Record<string, unknown>;
type WebFetchFallbackBody = JsonRecord & {
tools?: unknown;
tool_choice?: unknown;
};
export interface WebFetchFallbackPlan {
enabled: boolean;
@@ -88,7 +92,7 @@ export function supportsNativeWebFetchFallbackBypass({
}: {
provider?: string | null;
sourceFormat?: string | null;
targetFormat: string | null | undefined;
targetFormat?: string | null;
nativeCodexPassthrough: boolean;
// Per-model rule (#3384/#7339) — resolveInterceptFetch() in src/lib/db/interceptionRules.ts.
// true = force interception; anything else (false/undefined, i.e. no operator
@@ -104,7 +108,7 @@ export function supportsNativeWebFetchFallbackBypass({
return interceptFetchOverride !== true;
}
export function prepareWebFetchFallbackBody<T extends JsonRecord>(
export function prepareWebFetchFallbackBody<T extends WebFetchFallbackBody>(
body: T,
options: {
provider?: string | null;

View File

@@ -9,6 +9,10 @@ const SEARCH_CONTEXT_DEFAULTS: Record<string, number> = {
};
type JsonRecord = Record<string, unknown>;
type WebSearchFallbackBody = JsonRecord & {
tools?: unknown;
tool_choice?: unknown;
};
export interface WebSearchFallbackPlan {
enabled: boolean;
@@ -146,7 +150,7 @@ export function supportsNativeWebSearchFallbackBypass({
}: {
provider?: string | null;
sourceFormat?: string | null;
targetFormat: string | null | undefined;
targetFormat?: string | null;
nativeCodexPassthrough: boolean;
// Per-model rule (#3384) — resolveInterceptSearch() in src/lib/db/interceptionRules.ts.
// true = force interception (never bypass); false = force native bypass; undefined =
@@ -172,7 +176,7 @@ export function supportsNativeWebSearchFallbackBypass({
return false;
}
export function prepareWebSearchFallbackBody<T extends JsonRecord>(
export function prepareWebSearchFallbackBody<T extends WebSearchFallbackBody>(
body: T,
options: {
provider?: string | null;