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

Compare

+20 −14 in 4 places
Lines 1–11 at 318 (were 1–10 at 176)
11import { createHash } from "node:crypto";
2−import { canonicalJson } from "../../worker/project/operation-protocol.ts";
2+import { jsonValueChunks } from "../../src/engine/json-value-chunks.ts";
33import { Project, type WriterSource } from "../../worker/project/project.ts";
44import type { ProjectOptions } from "../../worker/project/project-types.ts";
55import { EngineProject, SqliteLog, type SqliteStorage } from "./engine-project.ts";
66import { SqliteHistoryHost } from "./history-host.ts";
77import { SqliteProjectionStore } from "./projection-store.ts";
8+import { requestIdentityDigest } from "./request-identity-digest.ts";
89import { SqliteWriterHost, SqliteWriterState } from "./writer-host.ts";
1011type Services = Pick<ProjectOptions, "hasBlob" | "whole">;
Lines 47–73 at 318 (were 46–62 at 176)
4647 #saveReceipt(state: SqliteWriterState, id: string, identity: string, result: unknown) {
4748 // Receipt payloads can exceed the graph-state value bound. Keep each stored
4849 // piece small without increasing that bound for engine state.
49− const json = JSON.stringify({ result });
5050 const characters = 64 * 1024;
51− const parts = Math.ceil(json.length / characters);
52− for (let part = 0; part < parts; part++)
53− state.write(`runtime:receipt:${id}`, String(part), json.slice(part * characters, (part + 1) * characters));
51+ const digest = createHash("sha256");
52+ let pending = "",
53+ parts = 0,
54+ length = 0;
55+ for (const chunk of jsonValueChunks({ result }, { maxDepth: Infinity, unboxPrimitives: true })) {
56+ digest.update(chunk);
57+ length += chunk.length;
58+ pending += chunk;
59+ while (pending.length >= characters) {
60+ state.write(`runtime:receipt:${id}`, String(parts++), pending.slice(0, characters));
61+ pending = pending.slice(characters);
62+ }
63+ }
64+ if (pending) state.write(`runtime:receipt:${id}`, String(parts++), pending);
5465 state.write("runtime:receipts", id, {
5566 format: 3,
5667 identity,
5768 parts,
58− characters: json.length,
59− digest: createHash("sha256").update(json).digest("hex"),
69+ characters: length,
70+ digest: digest.digest("hex"),
6071 });
6172 }
6273 #receiptResult<T>(
Lines 128–134 at 318 (were 117–128 at 176)
117128 const result = structuredClone(operation(new EngineProject(project)));
118129 this.#validate(validate);
119130 if (request && log.seq() > 0)
120− this.#saveReceipt(
121− this.#setup(),
122− request.id,
123− createHash("sha256").update(canonicalJson(request.identity)).digest("hex"),
124− result,
125− );
131+ this.#saveReceipt(this.#setup(), request.id, requestIdentityDigest(request.identity), result);
126132 return result;
127133 });
128134 }
Lines 229–235 at 318 (were 223–229 at 176)
223229 const host = this.#host();
224230 host.root();
225231 if (request && (!request.id || request.id.length > 128)) throw Error("invalid disk-first request identity");
226− const identity = request ? createHash("sha256").update(canonicalJson(request.identity)).digest("hex") : undefined;
232+ const identity = request ? requestIdentityDigest(request.identity) : undefined;
227233 if (request) {
228234 const receipt = state.read("runtime:receipts", request.id) as
229235 | { format: number; identity: string; result: T }
MCP
compare on this site's /mcp
CLI
abso diff 176 318 server/src/disk-first-runtime.ts --json
JSON
/christopher/abso-core/compare/176..318?file=server%2Fsrc%2Fdisk-first-runtime.ts&format=json