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

Compare

+16 −10 in 7 places
Lines 1–8 at 318 (were 1–7 at 98)
1+import { View } from "../../src/engine/index.ts";
12// Move the agent's base to its space's newest version. Writes go through
23// SyncHost; today the host is Project.
34
4−import { type AtomId, type Graph, View } from "../../src/engine/index.ts";
5+import type { AtomId, Graph, ReadView } from "../../src/engine/index.ts";
56import { ProjectError } from "./project-error.ts";
67import type { AgentState, Entry, MergedLine, SyncAnswer } from "./project-types.ts";
78import { last, SHARED, type Space } from "./spaces.ts";
Lines 13–20 at 318 (were 12–18 at 98)
1213 readonly labels: ReadonlyMap<string, readonly number[]>;
1314 agent(name: string, entries: Entry[]): AgentState;
1415 spaceOf(agent: AgentState): Space;
15− agentView(agent: AgentState): View;
16+ agentView(agent: AgentState): ReadView;
17+ captureAgentView?(agent: AgentState): () => ReadView;
1618 at(space: Space, version: number): ReadonlySet<AtomId>;
1719 draft(agent: AgentState): AtomId[];
1820 strandedFiles(draft: readonly AtomId[], set: ReadonlySet<AtomId>): string[];
Lines 22–34 at 318 (were 20–32 at 98)
2022 flush(entries: Entry[]): void;
2123 mergeIdentical(
2224 agent: AgentState,
23− before: View,
25+ before: ReadView,
2426 oldBase: ReadonlySet<AtomId>,
2527 oldVersion: number,
2628 time: number,
2729 entries: Entry[],
2830 ): MergedLine[];
29− changesSince(agent: AgentState, before: View): SyncAnswer;
31+ changesSince(agent: AgentState, before: ReadView): SyncAnswer;
3032}
3133
3234/**
Lines 51–57 at 318 (were 49–54 at 98)
4951 throw new ProjectError("bad-request", `no version of shared has the label ${JSON.stringify(options.label)}`);
5052 target = versions[versions.length - 1]!;
5153 }
54+ const reopenBefore = agent.synced ? host.captureAgentView?.(agent) : undefined;
5255 const before = agent.synced ? host.agentView(agent) : new View(host.graph, []);
5356 const set = host.at(space, target);
5457 const stranded = host.strandedFiles(host.draft(agent), set);
Lines 60–69 at 318 (were 57–66 at 98)
5760 throw new ProjectError(
5861 "conflict",
5962 target === last(space)
60− ? `your unpublished changes to ${stranded.join(", ")} build on lines a drop took out of shared; ` +
61− `restore those files (abso restore ${stranded.join(" ")}) and sync again`
62− : `your unpublished changes to ${stranded.join(", ")} build on lines version ${target} doesn't have yet; ` +
63− `publish or restore them before following label ${options.label}`,
63+ ? `your unpushed changes to ${stranded.join(", ")} build on lines a drop took out of shared; ` +
64+ `restore those files (abso restore ${stranded.join(" ")}) and pull again`
65+ : `your unpushed changes to ${stranded.join(", ")} build on lines version ${target} doesn't have yet; ` +
66+ `push or restore them before following label ${options.label}`,
6467 );
6568 }
6669 // Moving back to a labeled version: the agent's own newer published work must not build on what that version lacks.
Lines 73–79 at 318 (were 70–76 at 98)
7073 host.flush(entries);
7174 throw new ProjectError(
7275 "conflict",
73− `your published changes to ${lacking.join(", ")} build on versions after ${target}, so you can't move back to it`,
76+ `your pushed changes to ${lacking.join(", ")} build on versions after ${target}, so you can't move back to it`,
7477 );
7578 }
7679 const oldBase = host.at(space, agent.base);
Lines 88–97 at 318 (were 85–91 at 98)
8588 }
8689 const merged = host.mergeIdentical(agent, before, oldBase, oldVersion, Date.now(), entries);
8790 // full (#37, a partial join): every file in the view, as for a first sync, whatever the folder had.
88− const answer = host.changesSince(agent, options.full ? new View(host.graph, []) : before);
91+ const answer = host.changesSince(
92+ agent,
93+ options.full ? new View(host.graph, []) : reopenBefore ? reopenBefore() : before,
94+ );
8995 host.flush(entries);
9096 return merged.length > 0 ? { ...answer, merged } : answer;
9197}
MCP
compare on this site's /mcp
CLI
abso diff 98 318 worker/project/sync.ts --json
JSON
/christopher/abso-core/compare/98..318?file=worker%2Fproject%2Fsync.ts&format=json