Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 110 to 318

Compare

+22 −0 in 1 place
new file, 22 lines
1+import { jsonEvents } from "./json-events.ts";
2+
3+/** Decode a small canonical frame with the same validation as the streamed path. */
4+export 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], { finiteNumbers: true })) void event;
14+ const freeze = (value: unknown): unknown => {
15+ if (value !== null && typeof value === "object") {
16+ for (const child of Object.values(value)) freeze(child);
17+ Object.freeze(value);
18+ }
19+ return value;
20+ };
21+ return freeze(JSON.parse(text));
22+}
MCP
compare on this site's /mcp
CLI
abso diff 110 318 server/src/small-frame-json.ts --json
JSON
/christopher/abso-core/compare/110..318?file=server%2Fsrc%2Fsmall-frame-json.ts&format=json