Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5f3f638
fix(proxy): classify proven connect-phase ETIMEDOUT failures
Afloat16 Nov 18, 2026
ea0bcd7
fix(egress): count protected originals against image caps
Afloat16 Nov 18, 2026
8f07895
fix: restore byte-triggered image re-encoding
Afloat16 Nov 18, 2026
955af15
fix: normalize plan text once per source
Afloat16 Nov 18, 2026
b5ce202
fix: bound completed proxy CONNECT response headers
Afloat16 Nov 18, 2026
dfd49db
fix: cancel rejected continuation response bodies
Afloat16 Nov 18, 2026
3682e35
fix: preserve own JSON keys in anonymous affinity (#7172)
Afloat16 Nov 18, 2026
f617ed7
fix: parse complete SSE events during Responses warmup (#7180)
Afloat16 Nov 18, 2026
b96c9cb
fix: preserve Google thinking budgets after tool errors (#7183)
Afloat16 Nov 18, 2026
aa64805
fix: isolate Google query-key throttle holds
Afloat16 Nov 18, 2026
7e69d5b
fix: validate Claude watchdog health payloads
Afloat16 Nov 18, 2026
cee5b4e
perf(registry): index relay model suffix candidates
Afloat16 Nov 19, 2026
fd6c59b
fix(web): select freshest disk session summaries
Afloat16 Nov 19, 2026
04a7017
fix(web): refresh cached disk summaries when prices change
Afloat16 Nov 19, 2026
377c00d
fix(diagnostics): avoid reading unused log generations
Afloat16 Nov 19, 2026
8a29d3a
fix(web): enforce decoded blog download byte limits
Afloat16 Nov 20, 2026
dcf235a
refactor(web): share unread blog response cleanup
Afloat16 Nov 20, 2026
bf39ca6
fix: keep listen retries within the valid port range
Afloat16 Nov 20, 2026
7f0bd0e
fix: refresh skipped-proxy evidence in repeated alerts
Afloat16 Nov 20, 2026
265fd18
fix(web): preserve the complete blog feed on manifest read failures
Afloat16 Nov 20, 2026
8e3a8fa
fix(web): release unread changelog error response bodies
Afloat16 Nov 20, 2026
619b529
fix(web): avoid repeated scans of malformed Markdown links
Afloat16 Nov 20, 2026
5bf83a1
Merge PR #7138: fix(proxy): classify proven connect-phase ETIMEDOUT f…
ranxianglei Nov 20, 2026
58da73d
Merge PR #7141: fix(egress): count protected originals against image …
ranxianglei Nov 20, 2026
3f48b89
Merge PR #7147: fix: restore byte-triggered image re-encoding
ranxianglei Nov 20, 2026
df25acb
Merge PR #7162: fix: normalize plan text once per source
ranxianglei Nov 20, 2026
10ee8d1
Merge PR #7166: fix: bound completed proxy CONNECT response headers
ranxianglei Nov 20, 2026
cc7c954
Merge PR #7171: fix: cancel rejected continuation response bodies
ranxianglei Nov 20, 2026
793b1fc
Merge PR #7174: fix: preserve own JSON keys in anonymous affinity (#7…
ranxianglei Nov 20, 2026
cb4c894
Merge PR #7182: fix: parse complete SSE events during Responses warmu…
ranxianglei Nov 20, 2026
48cec0e
Merge PR #7185: fix: preserve Google thinking budgets after tool erro…
ranxianglei Nov 20, 2026
bb797c0
Merge PR #7187: fix: isolate Google query-key throttle holds
ranxianglei Nov 20, 2026
2b92e00
Merge PR #7220: fix: validate Claude watchdog health payloads
ranxianglei Nov 20, 2026
5a99a47
Merge PR #7285: perf(registry): index relay model suffix candidates
ranxianglei Nov 20, 2026
fb33082
Merge PR #7290: fix(web): select freshest disk session summaries
ranxianglei Nov 20, 2026
49d604a
Merge PR #7294: fix(diagnostics): avoid reading unused log generations
ranxianglei Nov 20, 2026
159d247
Merge PR #7341: refactor(web): share unread blog response cleanup
ranxianglei Nov 20, 2026
d9733b4
Merge PR #7359: fix(web): avoid repeated scans of malformed Markdown …
ranxianglei Nov 20, 2026
2e2c68a
Merge PR #7362: fix: keep listen retries within the valid port range
ranxianglei Nov 20, 2026
5aaefd5
Merge PR #7370: fix: refresh skipped-proxy evidence in repeated alerts
ranxianglei Nov 20, 2026
be46645
Merge PR #7384: fix(web): release unread changelog error response bodies
ranxianglei Nov 20, 2026
1f18f66
Merge PR #7292: fix(web): refresh cached disk summaries when prices c…
ranxianglei Nov 20, 2026
dd59c3d
Merge PR #7375: fix(web): preserve the complete blog feed on manifest…
ranxianglei Nov 20, 2026
d5ab3aa
docs: update stale force comment in image-rescale.ts
Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions scripts/bench-plan-aware-search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Run with --import ./tests/preload-test-env.mjs --import tsx.
// Optional argument: module URL relative to this script (for a saved base).
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { performance } from "node:perf_hooks";
import { createCore, defaultConfig, type Config, type CoreMessage } from "acp-kernel";
import { applyCompressSettings } from "../src/compress-settings.ts";
import { createSession } from "../src/session.ts";
import { applyRanges } from "../src/stream.ts";
import { parseCompressInput } from "../src/compress-tool.ts";

const { executeSearchContext, extractPlanState } = await import(
new URL(process.argv[2] ?? "../src/decompress-shared.ts", import.meta.url).href
) as typeof import("../src/decompress-shared.ts");
const core = createCore();
const config = applyCompressSettings(defaultConfig(200_000), 200_000, {
absorb: { enabled: true, minToolTokens: 50 },
ccr: { enabled: true, minToolTokens: 50 },
}) as Config;
const session = createSession("plan-normalization-benchmark");
const messages: CoreMessage[] = Array.from({ length: 40 }, (_, i) => ({
id: `history_${i}`, role: i % 2 === 0 ? "user" : "assistant", contentType: "text",
text: `Historical detail ${i}. ${"retained context evidence. ".repeat(80)}`,
timestamp: 1_700_000_000_000 + i,
}));
const turn = core.processTurn({ messages, state: session.state, config, tokenCount: 9999, renderTags: "text-only" });
session.state = turn.state;
const topics = ["auth", "storage", "validation", "refresh", "ratelimit 缓存路由会话", "metrics"];
applyRanges(parseCompressInput({ content: topics.map((topic, i) => ({
startId: `m${String(i * 5 + 1).padStart(5, "0")}`,
endId: `m${String(i * 5 + 5).padStart(5, "0")}`,
topic: `token ${topic}`, summary: `Historical token ${topic} implementation and verification.`,
})) }), { core, config, messages: turn.messages, session, log: () => {} });
assert.equal(session.state.blocks.filter(b => b.active).length, 6);

function measure(work: () => string) {
const expected = work();
for (let i = 0; i < 3; i++) assert.equal(work(), expected);
const elapsed: number[] = [];
for (let i = 0; i < 15; i++) {
const start = performance.now();
const actual = work();
elapsed.push(performance.now() - start);
assert.equal(actual, expected);
}
elapsed.sort((a, b) => a - b);
return {
medianMs: elapsed[7], minMs: elapsed[0], maxMs: elapsed[14],
digest: createHash("sha256").update(expected).digest("hex"),
};
}

const languages = {
latin: "Implement Ratelimit Middleware And Preserve Session Identity With Tests. ",
cjk: "实现缓存路由并保留会话身份验证和回归测试。",
mixed: "实现Cache路由API和Session身份Verification测试。",
};
for (const [language, sentence] of Object.entries(languages)) {
for (const characters of [1000, 2000, 4000]) {
const text = sentence.repeat(Math.ceil(characters / sentence.length)).slice(0, characters);
const plan: CoreMessage[] = [
{ id: "user", role: "user", contentType: "text", text },
{ id: "plan", role: "assistant", contentType: "tool-call", toolName: "TodoWrite",
text: JSON.stringify({ todos: [{ content: text, status: "in_progress", activeForm: "Implementing the plan" }] }) },
];
const opts = { messages: plan, session, log: () => {}, protectedPatterns: config.protectedLatestTools };
const search = () => executeSearchContext({ query: "token", limit: 5 }, core, session.state, undefined, opts).text;
assert.match(search(), /\[plan-aware\]/);
console.log(JSON.stringify({ language, characters, sources: plan.length, workload: "extract", ...measure(
() => JSON.stringify([...extractPlanState(plan)!.terms]),
) }));
console.log(JSON.stringify({ language, characters, sources: plan.length, workload: "search", ...measure(search) }));
}
}
console.log(JSON.stringify({ workload: "plain-search", ...measure(
() => executeSearchContext({ query: "token", limit: 5 }, core, session.state).text,
) }));
45 changes: 45 additions & 0 deletions scripts/bench-registry-suffix-index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { createHash } from "node:crypto";
import { performance } from "node:perf_hooks";
import { _resetForTest, _setForTest, peekRegistryContext, peekRegistryOutputLimit, scanRegistryCostRow, type CostsShape } from "../src/registry.js";
import snapshot from "../src/registry-snapshot.json" with { type: "json" };

// Run from the repository root with:
// node --expose-gc --import ./tests/preload-test-env.mjs --import tsx scripts/bench-registry-suffix-index.ts
// Use the bundled real roster; no network request or configuration mutation.
const costs = snapshot.costs as CostsShape;
const bareNames = [...new Set(Object.keys(costs).map((key) => key.slice(key.lastIndexOf("/") + 1)))];
const probes = bareNames.slice(0, 500);
const iterations = 5000;
function measure(label: string, names: string[]): void {
_resetForTest();
_setForTest(snapshot.models, costs);
global.gc?.();
const heapBefore = process.memoryUsage().heapUsed;
const coldStart = performance.now();
scanRegistryCostRow(costs, names[0], "relay.example");
peekRegistryContext(names[0], "relay.example");
peekRegistryOutputLimit(names[0], "relay.example");
const coldMs = performance.now() - coldStart;
global.gc?.();
const retainedBytes = process.memoryUsage().heapUsed - heapBefore;
// Warm conflict diagnostics before measurement; output is hashed below.
for (let i = 0; i < 5000; i++) {
const name = names[i % names.length];
scanRegistryCostRow(costs, name, "relay.example");
peekRegistryContext(name, "relay.example");
peekRegistryOutputLimit(name, "relay.example");
}
global.gc?.();
const outputs: unknown[] = [];
const cpuStart = process.cpuUsage();
const wallStart = performance.now();
for (let i = 0; i < iterations; i++) {
const name = names[i % names.length];
outputs.push([scanRegistryCostRow(costs, name, "relay.example"), peekRegistryContext(name, "relay.example"), peekRegistryOutputLimit(name, "relay.example")]);
}
const wallMs = performance.now() - wallStart;
const cpu = process.cpuUsage(cpuStart);
console.log(JSON.stringify({label, rows: Object.keys(costs).length, models: Object.keys(snapshot.models).length, names: names.length, iterations, coldMs, retainedBytes, cpuMs: (cpu.user + cpu.system) / 1000, wallMs, digest: createHash("sha256").update(JSON.stringify(outputs)).digest("hex")}));
}
measure("real-roster-relay-models", probes);
measure("unlisted-relay-models", Array.from({length: 100}, (_, i) => `unlisted-benchmark-model-${i}`));
2 changes: 1 addition & 1 deletion src/affinity-neutral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function sortKeys(value: unknown): unknown {
if (Array.isArray(value)) return value.map(sortKeys);
if (value !== null && typeof value === "object") {
const record = value as Record<string, unknown>;
const out: Record<string, unknown> = {};
const out: Record<string, unknown> = Object.create(null);
for (const key of Object.keys(record).sort()) out[key] = sortKeys(record[key]);
return out;
}
Expand Down
4 changes: 3 additions & 1 deletion src/claude-mcp-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export function _setClaudeHostPidForTest(pid: number | undefined): void {
async function probeProxyHealth(origin: string): Promise<boolean> {
try {
const res = await fetch(healthUrl(origin), { signal: AbortSignal.timeout(2000) });
return res.ok;
if (!res.ok) return false;
const payload = await res.json() as { ok?: unknown } | null;
return payload?.ok === true;
} catch {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/decompress-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,10 @@ type PlanTerms = Map<string, number>;
function planTokenize(text: string): string[] {
const out: string[] = [];
// Rendered ref-tag markup () is proxy metadata, not plan content.
const clean = text.replace(/\x3cacp\b[\s\S]*?\x3c\/acp\x3e/g, " ");
const clean = text.replace(/\x3cacp\b[\s\S]*?\x3c\/acp\x3e/g, " ").toLowerCase();
const re = /[a-z0-9]+|[\u4e00-\u9fff]/g;
let m: RegExpExecArray | null;
while ((m = re.exec(clean.toLowerCase())) !== null) {
while ((m = re.exec(clean)) !== null) {
const t = m[0];
const cjk = /[\u4e00-\u9fff]/.test(t);
// Latin tokens need >= 3 chars to carry signal; CJK single chars count.
Expand Down
2 changes: 2 additions & 0 deletions src/degenerate-retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ export function makeContinuationRefetch(opts: ContinuationRetryOpts): () => Prom
classificationReservation.release();
classificationReservation = undefined;
r.clearTimer();
// A discarded body has no consumer; do not wait for a tee sibling to cancel.
void r.response.body?.cancel().catch(() => undefined);
}
opts.log("warn", `[${opts.label}] [plugin] degenerate-terminal retry rejected (HTTP ${r.response.status}); passing the empty turn through`);
return null;
Expand Down
25 changes: 14 additions & 11 deletions src/egress-shed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ interface Occurrence {
entryIndex: number;
b64: string;
mediaType: string;
exempt: boolean;
protectedTail: boolean;
/** Set once rung A replaced this occurrence — rung B must never shrink a detached part. */
archived: boolean;
Expand Down Expand Up @@ -140,17 +141,17 @@ function isExemptOutput(protocol: WireProtocol, item: Part, names: Map<string, s

function collectOccurrences(protocol: WireProtocol, body: Part): Occurrence[] {
const occ: Occurrence[] = [];
const addAnthropicImages = (parts: unknown[], entryIndex: number, toolOutput: boolean): void => {
const addAnthropicImages = (parts: unknown[], entryIndex: number, toolOutput: boolean, exemptOutput = false): void => {
parts.forEach((part, pos) => {
if (!isObj(part) || part.type !== "image") return;
const src = part.source;
if (!isObj(src) || src.type !== "base64" || typeof src.data !== "string" || src.data.length === 0) return;
if (toolOutput && matchesOriginalImageReceipt(src.data, parts)) return;
const mediaType = typeof src.media_type === "string" ? src.media_type : "image/png";
occ.push({
entryIndex,
b64: src.data,
mediaType,
exempt: exemptOutput || (toolOutput && matchesOriginalImageReceipt(src.data, parts)),
protectedTail: false,
archived: false,
applyArchive: (note) => { parts[pos] = { type: "text", text: note }; },
Expand All @@ -169,12 +170,12 @@ function collectOccurrences(protocol: WireProtocol, body: Part): Occurrence[] {
const inline = part.inlineData;
if (!isObj(inline) || typeof inline.data !== "string" || inline.data.length === 0) return;
if (typeof inline.mimeType !== "string" || !/^image\//i.test(inline.mimeType)) return;
if (matchesOriginalImageReceipt(inline.data, parts)) return;
const mediaType = inline.mimeType;
occ.push({
entryIndex,
b64: inline.data,
mediaType,
exempt: matchesOriginalImageReceipt(inline.data, parts),
protectedTail: false,
archived: false,
applyArchive: (note) => { parts[pos] = { text: note }; },
Expand All @@ -192,16 +193,17 @@ function collectOccurrences(protocol: WireProtocol, body: Part): Occurrence[] {
if (!isObj(item)) return;
const partsKey = item.type === "message" ? "content" : item.type === "function_call_output" || item.type === "custom_tool_call_output" ? "output" : undefined;
if (partsKey === undefined || !Array.isArray(item[partsKey])) return;
if ((item.type === "function_call_output" || item.type === "custom_tool_call_output") && isExemptOutput(protocol, item, names)) return;
const exemptOutput = partsKey === "output" && isExemptOutput(protocol, item, names);
const parts = item[partsKey] as unknown[];
parts.forEach((part, pos) => {
if (!isObj(part) || part.type !== "input_image" || typeof part.image_url !== "string") return;
const d = parseDataUrl(part.image_url);
if (!d || (partsKey === "output" && matchesOriginalImageReceipt(d.base64, parts))) return;
if (!d) return;
occ.push({
entryIndex,
b64: d.base64,
mediaType: d.mediaType,
exempt: exemptOutput || (partsKey === "output" && matchesOriginalImageReceipt(d.base64, parts)),
protectedTail: false,
archived: false,
applyArchive: (note) => { parts[pos] = { type: "input_text", text: note }; },
Expand All @@ -217,7 +219,7 @@ function collectOccurrences(protocol: WireProtocol, body: Part): Occurrence[] {
const names = callNameMap(protocol, body);
messages.forEach((m, entryIndex) => {
if (!isObj(m)) return;
if (protocol === "openai" && m.role === "tool" && isExemptOutput(protocol, m, names)) return;
const exemptOutput = protocol === "openai" && m.role === "tool" && isExemptOutput(protocol, m, names);
if (!Array.isArray(m.content)) return;
const content = m.content as unknown[];
if (protocol === "anthropic") addAnthropicImages(content, entryIndex, false);
Expand All @@ -235,14 +237,14 @@ function collectOccurrences(protocol: WireProtocol, body: Part): Occurrence[] {
entryIndex,
b64: d.base64,
mediaType: d.mediaType,
exempt: exemptOutput,
protectedTail: false,
archived: false,
applyArchive: (note) => { content[pos] = { type: "text", text: note }; },
applyShrink: (b64) => { p.image_url = typeof iu === "string" ? dataUrl(d.mediaType, b64) : { ...(iu ?? {}), url: dataUrl(d.mediaType, b64) }; },
});
} else if (p.type === "tool_result" && Array.isArray(p.content)) {
if (isExemptOutput(protocol, p, names)) return;
addAnthropicImages(p.content, entryIndex, true);
addAnthropicImages(p.content, entryIndex, true, isExemptOutput(protocol, p, names));
}
});
});
Expand All @@ -268,7 +270,7 @@ export async function shedWireImages(
return { body, stats: noop };
}
if (!isObj(parsed)) return { body, stats: noop };
const occurrences = collectOccurrences(protocol, parsed);
const occurrences = collectOccurrences(protocol, parsed).filter((o) => !o.exempt);
if (occurrences.length === 0) return { body, stats: noop };

const totalEntries = protocol === "google" ? (Array.isArray(parsed.contents) ? parsed.contents.length : 0)
Expand Down Expand Up @@ -336,8 +338,8 @@ export async function shedWireImages(
* - the protected tail YIELDS to the cap: an upstream count wall is HARD (sending
* over it fails the whole request), unlike the WS byte budget which is soft —
* once non-tail images are exhausted, tail images are archived too (oldest-first).
* Exempt read_original_image occurrences never enter the walk (collectOccurrences
* skips them); if exempt images alone exceed the cap the body cannot be brought
* Exempt read_original_image occurrences count toward the cap but never enter the
* archive walk; if exempt images alone exceed the cap the body cannot be brought
* under it and the rejection stays visible. Pure on the string; byte-identical
* passthrough when the count is already within maxImages or nothing was sheddable. */
export async function shedWireImagesToCount(
Expand Down Expand Up @@ -371,6 +373,7 @@ export async function shedWireImagesToCount(
if (remaining <= maxImages) break;
for (const o of occurrences) {
if (remaining <= maxImages) break;
if (o.exempt) continue;
if (o.archived) continue;
if (!allowTail && o.protectedTail) continue;
const note = await shedNote(o.mediaType, o.b64, opts.resolveRef);
Expand Down
10 changes: 5 additions & 5 deletions src/image-rescale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ function loadJimp(): Promise<JimpModule | null> {
return jimpLoad;
}

// force (#3701 byte-shed ladder): skips the 100 KiB trigger gate and adopts ANY
// strict byte reduction (not just <80%). A within-maxDim image is NOT skipped
// here — a same-dim re-encode is adopted only if strictly smaller; the byte-shed
// caller pre-filters maxDim-fitting images before calling (egress-shed rung B).
// force (#3701 byte-shed ladder): adopts ANY strict byte reduction (not just <80%).
// The 100 KiB trigger gate applies equally to both; a within-maxDim image is
// re-encoded only if it exceeds the trigger. The byte-shed caller pre-filters
// maxDim-fitting images before calling (egress-shed rung B).
async function doRescale(mime: RescaledMime, b64: string, origBytes: number, maxDim: number, force = false): Promise<RescaledImage | null> {
try {
const mod = await loadJimp();
Expand All @@ -163,7 +163,7 @@ async function doRescale(mime: RescaledMime, b64: string, origBytes: number, max
// Re-check the gate against the AUTHORITATIVE dims (the header parse
// may have failed for exotic containers).
const scale = Math.min(1, maxDim / Math.max(ow, oh));
if (scale >= 1 && (!force || origBytes <= RESCALE_TRIGGER_BYTES)) return null;
if (scale >= 1 && origBytes <= RESCALE_TRIGGER_BYTES) return null;
const tw = Math.max(1, Math.round(ow * scale));
const th = Math.max(1, Math.round(oh * scale));
if (tw !== ow || th !== oh) await img.resize({ w: tw, h: th });
Expand Down
9 changes: 8 additions & 1 deletion src/listen-policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export interface EaddrinuseContext {
lastTriedPort: number;
}

/** Use the existing ephemeral fallback when either the retry budget or the
* valid numeric port range is exhausted. Both pre- and post-bind retries
* must avoid handing 65536 to Node's listener. */
export function nextListenPort(port: number, nextAttempt: number, maxAttempts: number): number {
return nextAttempt >= maxAttempts || port >= 65535 ? 0 : port + 1;
}

export function decideEaddrinuse(ctx: EaddrinuseContext): EaddrinuseAction {
// The twin rule outranks everything else: a healthy peer already serves
// real traffic on that port, so no wait/ladder variant may touch it — the
Expand All @@ -89,7 +96,7 @@ export function decideEaddrinuse(ctx: EaddrinuseContext): EaddrinuseAction {
return { kind: "wait-predecessor", port: ctx.lastTriedPort };
}
const nextAttempts = ctx.attempts + 1;
return { kind: "ladder", nextPort: nextAttempts === ctx.maxAttempts ? 0 : ctx.lastTriedPort + 1 };
return { kind: "ladder", nextPort: nextListenPort(ctx.lastTriedPort, nextAttempts, ctx.maxAttempts) };
}

/** #3044/#2941: ladder rights for the POST-BIND claim check (port-owner's
Expand Down
6 changes: 4 additions & 2 deletions src/output-steering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ function normalizeGoogle(contents: unknown): StructuralMessage[] {
for (const raw of parts) {
const p = asRecord(raw);
if (!p) return [{ role: "user", text: "" }];
if (p.functionResponse) blocks.push({ kind: "tool_result" });
else if (typeof p.text === "string") {
if (p.functionResponse) {
const response = asRecord(asRecord(p.functionResponse)?.response);
blocks.push({ kind: "tool_result", isError: response !== null && Object.hasOwn(response, "error") });
} else if (typeof p.text === "string") {
if (p.text.trim() !== "") blocks.push({ kind: "text" });
} else if (p.inlineData || p.fileData || p.videoMetadata) blocks.push({ kind: "image" });
else return [{ role: "user", text: "" }];
Expand Down
Loading
Loading