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 146 to 147

Compare

+40 −0 in 1 place
Lines 63–108 at 147 (were 63–68 at 146)
6363 this.#storage.write(this.#collection, "next", next + 1);
6464 return next;
6565 }
66+ /** Persist only pages reachable from the final root of a bounded update batch. */
67+ setMany(root: Page, values: ReadonlyArray<readonly [number, T]>): Page {
68+ page(root);
69+ if (values.length > 256) throw Error("locator batch limit");
70+ return this.#storage.transaction(() => {
71+ const staged = new Map<string, unknown>();
72+ const storage: GraphStateStorage = {
73+ read: (collection, key) =>
74+ collection === this.#collection && staged.has(key) ? staged.get(key) : this.#storage.read(collection, key),
75+ write: (collection, key, value) => {
76+ if (collection !== this.#collection) throw Error("unexpected batch collection");
77+ staged.set(key, value);
78+ },
79+ remove: () => {
80+ throw Error("unexpected batch removal");
81+ },
82+ entries: () => {
83+ throw Error("unexpected batch scan");
84+ },
85+ transaction: (body) => body(),
86+ };
87+ // The namespace is encoded into the collection at construction.
88+ const namespace = JSON.parse(this.#collection.slice("experimental-locator:".length)) as string;
89+ const index = new ProjectionLocator<T>(storage, namespace, this.#decode);
90+ let result = root;
91+ for (const [id, value] of values) result = index.set(result, id, value);
92+ const retained = new Set<number>();
93+ const visit = (id: Page): void => {
94+ if (id === null || retained.has(id) || !staged.has(String(id))) return;
95+ retained.add(id);
96+ const node = staged.get(String(id)) as Node;
97+ if (node.kind === "branch") for (const child of Object.values(node.children)) visit(child);
98+ };
99+ visit(result);
100+ for (const id of retained) this.#storage.write(this.#collection, String(id), staged.get(String(id)));
101+ if (staged.has("next")) this.#storage.write(this.#collection, "next", staged.get("next"));
102+ return result;
103+ });
104+ }
66106 get(root: Page, id: number): T | undefined {
67107 page(root);
68108 const key = keyOf(id);
MCP
compare on this site's /mcp
CLI
abso diff 146 147 src/engine/experimental/projection-locator.ts --json
JSON
/christopher/abso-core/compare/146..147?file=src%2Fengine%2Fexperimental%2Fprojection-locator.ts&format=json