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
MCP
code on this site's /mcp
CLI
none: the JSON below is the answer
JSON
/christopher/abso-core/files/server/src/json-chunk-cursor.ts?version=166&format=json
68 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 162, 1 version changed it

You're reading version 166. The newest is 318, and 1 version since then changed this file. Go to the newestCompare with 318

1/** Incremental UTF-16 cursor over canonical log chunks. */
2export class JsonChunkCursor {
3 readonly #input: Iterator<string>;
4 #chunk = "";
5 #offset = 0;
6 constructor(chunks: Iterable<string>) {
7 this.#input = chunks[Symbol.iterator]();
8 }
9 peek(): string | undefined {
10 while (this.#offset === this.#chunk.length) {
11 const next = this.#input.next();
12 if (next.done) return undefined;
13 if (typeof next.value !== "string" || next.value.length > 600000) throw Error("invalid JSON input chunk");
14 this.#chunk = next.value;
15 this.#offset = 0;
16 }
17 return this.#chunk[this.#offset];
18 }
19 take(): string {
20 const char = this.peek();
21 if (char === undefined) throw Error("truncated JSON input");
22 this.#offset++;
23 return char;
24 }
25 /** Consume one quoted JSON string, yielding bounded decoded text. */
26 *stringChunks(): IterableIterator<string> {
27 if (this.take() !== '"') throw Error("expected JSON string");
28 let buffer = "";
29 for (;;) {
30 let char = this.take();
31 if (char === '"') {
32 if (buffer) yield buffer;
33 return;
34 }
35 if (char.charCodeAt(0) < 32) throw Error("unescaped JSON control character");
36 if (char === "\\") {
37 const escape = this.take();
38 const simple: Record<string, string> = {
39 '"': '"',
40 "\\": "\\",
41 "/": "/",
42 b: "\b",
43 f: "\f",
44 n: "\n",
45 r: "\r",
46 t: "\t",
47 };
48 if (escape === "u") {
49 let hex = "";
50 for (let i = 0; i < 4; i++) hex += this.take();
51 if (!/^[0-9a-fA-F]{4}$/.test(hex)) throw Error("invalid JSON Unicode escape");
52 char = String.fromCharCode(Number.parseInt(hex, 16));
53 } else {
54 if (!Object.hasOwn(simple, escape)) throw Error("invalid JSON escape");
55 char = simple[escape]!;
56 }
57 }
58 buffer += char;
59 if (buffer.length === 16384) {
60 yield buffer;
61 buffer = "";
62 }
63 }
64 }
65 close(): void {
66 this.#input.return?.();
67 }