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

Compare

+43 −0 in 1 place
new file, 43 lines
1+import assert from "node:assert/strict";
2+import { test } from "node:test";
3+import { JsonChunkCursor } from "../src/json-chunk-cursor.ts";
4+
5+test("JSON strings decode exactly across every input boundary", () => {
6+ const values = ["", "plain", 'quotes" and slash\\', "\n\r\t\b\f", "\uD83D\uDE00", "\uD800", "\uDC00"];
7+ const encoded = values.map((value) => JSON.stringify(value));
8+ encoded.push('"\\uD83D\\uDE00\\u0000\\/"');
9+ for (const json of encoded)
10+ for (let split = 0; split <= json.length; split++) {
11+ const cursor = new JsonChunkCursor([json.slice(0, split), "", json.slice(split), ","]);
12+ assert.equal([...cursor.stringChunks()].join(""), JSON.parse(json));
13+ assert.equal(cursor.take(), ",");
14+ assert.equal(cursor.peek(), undefined);
15+ }
16+ for (const invalid of ['"unterminated', '"\\x"', '"\\u12xz"', '"\\u123', '"raw\ncontrol"']) {
17+ const cursor = new JsonChunkCursor(invalid.split(""));
18+ assert.throws(() => [...cursor.stringChunks()], /JSON/);
19+ }
20+});
22+test("long JSON strings decode in fixed-size output chunks", () => {
23+ let closed = false;
24+ const cursor = new JsonChunkCursor(
25+ (function* () {
26+ try {
27+ yield '"';
28+ for (let i = 0; i < 500; i++) yield "x".repeat(16384);
29+ yield '"';
30+ } finally {
31+ closed = true;
32+ }
33+ })(),
34+ );
35+ let count = 0;
36+ for (const chunk of cursor.stringChunks()) {
37+ assert.ok(chunk.length <= 16384);
38+ count += chunk.length;
39+ }
40+ assert.equal(count, 8192000);
41+ cursor.close();
42+ assert.equal(closed, true);
43+});
MCP
compare on this site's /mcp
CLI
abso diff 116 318 server/test/json-chunk-cursor.test.ts --json
JSON
/christopher/abso-core/compare/116..318?file=server%2Ftest%2Fjson-chunk-cursor.test.ts&format=json