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 148 to 149

Compare

+19 −9 in 6 places
Lines 2–17 at 149 (were 2–9 at 148)
22import type { Graph, RelocationInfo } from "../graph.ts";
33import { isStartNode } from "../keys.ts";
44import type { GraphStateStorage } from "../state-source.ts";
5−import type { NodeId } from "../types.ts";
5+import type { NodeId, Relocation } from "../types.ts";
66
7+export interface ProjectionMoveSource {
8+ count(id: string): number;
9+ at(id: string, k: number): Relocation | undefined;
10+}
11+export function graphMoveSource(graph: Graph): ProjectionMoveSource {
12+ return { count: (id) => graph.atom(id).moves?.length ?? 0, at: (id, k) => graph.atom(id).moves?.[k] };
13+}
715interface Progress {
816 identity: string;
917 phase: "scan" | "walk" | "entry" | "weakest" | "repick" | "mark" | "done";
Lines 41–47 at 149 (were 33–39 at 148)
3341 )
3442 throw Error("invalid move resolution record");
3543}
36−function readProgress(value: unknown, graph: Graph): Progress | undefined {
44+function readProgress(value: unknown, graph: Graph, source: ProjectionMoveSource): Progress | undefined {
3745 if (value === undefined) return undefined;
3846 shape(value, "format checksum state");
3947 if (value.format !== 1 || value.checksum !== digest(value.state)) throw Error("damaged move resolution cursor");
Lines 59–65 at 149 (were 51–58 at 148)
5159 )
5260 throw Error("invalid move resolution position");
5361 const mover = graph.movers()[Number(state.mover)];
54− if (Number(state.move) > (mover === undefined ? 0 : (graph.atom(mover).moves?.length ?? 0)))
55− throw Error("invalid move offset");
62+ if (Number(state.move) > (mover === undefined ? 0 : source.count(mover))) throw Error("invalid move offset");
5663 for (const key of ["line", "slow", "fast", "meeting", "entry", "current"])
5764 if (state[key] !== null && (typeof state[key] !== "string" || !state[key] || String(state[key]).length > 4096))
5865 throw Error("invalid move ancestry cursor");
Lines 68–74 at 149 (were 61–67 at 148)
6168 if (move === null) continue;
6269 shape(move, "atom line parent k");
6370 if (typeof move.atom !== "string" || !integer(move.k)) throw Error("invalid saved move");
64− const canonical = graph.atom(move.atom).moves?.[move.k];
71+ const canonical = source.at(move.atom, move.k);
6572 if (!canonical || canonical.line !== move.line || canonical.parent !== move.parent)
6673 throw Error("saved move identity mismatch");
6774 }
Lines 90–101 at 149 (were 83–93 at 148)
8390 storage: GraphStateStorage,
8491 identity: string,
8592 maxSteps: number,
93+ source: ProjectionMoveSource = graphMoveSource(graph),
8694): { done: boolean; steps: number } {
8795 if (!identity || identity.length > 4096 || !Number.isSafeInteger(maxSteps) || maxSteps < 1 || maxSteps > 256)
8896 throw Error("invalid move resolution page");
8997 return storage.transaction(() => {
90− let state = readProgress(storage.read("progress", "cursor"), graph);
98+ let state = readProgress(storage.read("progress", "cursor"), graph, source);
9199 if (state && state.identity !== identity) throw Error("move resolution identity changed");
92100 state ??= {
93101 identity,
Lines 152–167 at 149 (were 144–157 at 148)
144152 state.move = 0;
145153 break;
146154 }
147− const moves = graph.atom(id).moves ?? [];
148− if (state.move === moves.length) {
155+ const count = source.count(id);
156+ if (state.move === count) {
149157 state.mover++;
150158 state.move = 0;
151159 break;
152160 }
153161 const k = state.move++;
154− const candidate: RelocationInfo = { atom: id, ...moves[k]!, k };
162+ const move = source.at(id, k);
163+ if (!move) throw Error("missing indexed move");
164+ const candidate: RelocationInfo = { atom: id, ...move, k };
155165 if (state.phase === "scan") {
156166 if (!storage.read("seen", candidate.line)) {
157167 storage.write("seen", candidate.line, true);
MCP
compare on this site's /mcp
CLI
abso diff 148 149 src/engine/experimental/projection-move-resolution.ts --json
JSON
/christopher/abso-core/compare/148..149?file=src%2Fengine%2Fexperimental%2Fprojection-move-resolution.ts&format=json