mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-06 07:12:12 +03:00
fix(types): align web executor event contracts (#9138)
Validated in local merge-train (devbox-vm-06-dev002) @ combined-tip (FAST gates: typecheck/complexity/cognitive/changelog/vitest — only pre-existing audit.test.ts flake). Evidence: /home/diegosouzapw/dev/proxys/OmniRoute/.claude/worktrees/merge-train-20260805-222248-suite.log
This commit is contained in:
@@ -148,7 +148,8 @@ async function* decodeSseData(
|
||||
}
|
||||
|
||||
function safeMetadataValue(value: unknown): string | number | boolean | null | undefined {
|
||||
if (value === null || typeof value === "boolean") return value;
|
||||
if (value === null) return null;
|
||||
if (typeof value === "boolean") return value;
|
||||
if (typeof value === "number" && Number.isFinite(value)) return value;
|
||||
if (typeof value === "string" && value.length <= 128 && /^[A-Za-z0-9._:+/@-]+$/.test(value)) {
|
||||
return value;
|
||||
@@ -715,7 +716,7 @@ async function pullStreamingChunk(
|
||||
while (!state.terminal) {
|
||||
const next = await state.iterator.next();
|
||||
if (state.control.cancelled) return;
|
||||
if (next.done) {
|
||||
if (next.done === true) {
|
||||
throw new ClaudeWebProtocolError("Claude Web stream ended without a terminal event");
|
||||
}
|
||||
await queueSemanticEvent(state, next.value, options);
|
||||
|
||||
@@ -23,6 +23,7 @@ interface InnerAiModel {
|
||||
unavailable_api?: boolean;
|
||||
pro_only?: boolean;
|
||||
ultra_only?: boolean;
|
||||
ai_model_categories?: Array<Record<string, unknown>>;
|
||||
}
|
||||
|
||||
interface CredentialCache {
|
||||
@@ -283,9 +284,7 @@ async function resolveModels(
|
||||
if (m.enable === false || m.unavailable_api) return false;
|
||||
if (m.ultra_only && !isUltra) return false;
|
||||
if (m.pro_only && !isPro) return false;
|
||||
const cats = Array.isArray((m as Record<string, unknown>).ai_model_categories)
|
||||
? ((m as Record<string, unknown>).ai_model_categories as Array<Record<string, unknown>>)
|
||||
: null;
|
||||
const cats = Array.isArray(m.ai_model_categories) ? m.ai_model_categories : null;
|
||||
if (cats && cats.length > 0) {
|
||||
return cats.some((c) => String(c.unique_identifier ?? c.name ?? "").toLowerCase() === "text");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user