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 2 to 318

Compare

+21 −0 in 1 place
new file, 21 lines
1+import assert from "node:assert/strict";
2+import { test } from "node:test";
3+import { smallFrameJson } from "../src/small-frame-json.ts";
4+
5+test("small frame decoding enforces a byte bound and streamed parser rules", () => {
6+ assert.deepEqual(smallFrameJson(['{"type":"jo', 'in","agent":"alice"}']), { type: "join", agent: "alice" });
7+ assert.deepEqual(smallFrameJson(['{"x":1,"x":2}']), { x: 2 });
8+ assert.throws(() => smallFrameJson(['"' + "\u00e9".repeat(2048) + '"']), /exceeds bound/);
9+ assert.throws(() => smallFrameJson(["[".repeat(130) + "0" + "]".repeat(130)]), /nesting/);
10+ assert.throws(() => smallFrameJson(["1" + "0".repeat(256)]), /scalar/);
11+ assert.throws(() => smallFrameJson(["{} trailing"]), /trailing/);
12+});
13+test("small frame byte accounting handles a split surrogate pair at the limit", () => {
14+ const pair = String.fromCodePoint(0x1f600);
15+ const body = "x".repeat(4090) + pair;
16+ const json = JSON.stringify(body);
17+ assert.equal(new TextEncoder().encode(json).byteLength, 4096);
18+ const split = json.indexOf(pair) + 1;
19+ assert.equal(smallFrameJson([json.slice(0, split), json.slice(split)]), body);
20+ assert.throws(() => smallFrameJson([JSON.stringify(body + "x")]), /exceeds bound/);
21+});
MCP
compare on this site's /mcp
CLI
abso diff 2 318 server/test/small-frame-json.test.ts --json
JSON
/christopher/abso-core/compare/2..318?file=server%2Ftest%2Fsmall-frame-json.test.ts&format=json