mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-19 21:52:21 +03:00
fix(types): align web fallback contracts (#8819)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user