- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/server/src/small-frame-json.ts?version=163&format=json
15 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 163, 1 version changed it
You're reading version 163. The newest is 318, and 1 version since then changed this file.
1import { jsonEvents } from "./json-events.ts";
3/** Decode a small canonical frame with the same validation as the streamed path. */
4export function smallFrameJson(chunks: Iterable<string>): unknown {
5 let text = "";
6 for (const chunk of chunks) {
7 if (text.length + chunk.length > 4096) throw Error("small canonical frame exceeds bound");
8 text += chunk;
9 }
10 // Count UTF-8 after joining so a surrogate pair split across chunks counts once.
11 if (new TextEncoder().encode(text).byteLength > 4096) throw Error("small canonical frame exceeds bound");
12 // Preserve depth, key and scalar limits; the fast path must not change acceptance.
13 for (const event of jsonEvents([text])) void event;
14 return JSON.parse(text);
15}