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
blame on this site's /mcp
CLI
abso blame worker/project/sync.ts --version 143 --json
JSON
/christopher/abso-core/blame/worker/project/sync.ts?version=143&format=json
92 linesFirst import 88% · codex-capacity-chair 5% · rename 5% · trials 1%Last change codex-capacity-chair in version 143,

92 lines from 4 changes in 4 versions.

codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare1import { View } from "../../src/engine/index.ts";
init0Start the project2// Move the agent's base to its space's newest version. Writes go through
3// SyncHost; today the host is Project.
4
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare5import type { AtomId, Graph, ReadView } from "../../src/engine/index.ts";
init0Start the project6import { ProjectError } from "./project-error.ts";
7import type { AgentState, Entry, MergedLine, SyncAnswer } from "./project-types.ts";
8import { last, SHARED, type Space } from "./spaces.ts";
9
10/** What a sync needs from a project. */
11export interface SyncHost {
12 readonly graph: Graph;
13 readonly labels: ReadonlyMap<string, readonly number[]>;
14 agent(name: string, entries: Entry[]): AgentState;
15 spaceOf(agent: AgentState): Space;
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare16 agentView(agent: AgentState): ReadView;
init0Start the project17 at(space: Space, version: number): ReadonlySet<AtomId>;
18 draft(agent: AgentState): AtomId[];
19 strandedFiles(draft: readonly AtomId[], set: ReadonlySet<AtomId>): string[];
20 apply(entry: Entry): void;
21 flush(entries: Entry[]): void;
22 mergeIdentical(
23 agent: AgentState,
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare24 before: ReadView,
init0Start the project25 oldBase: ReadonlySet<AtomId>,
26 oldVersion: number,
27 time: number,
28 entries: Entry[],
29 ): MergedLine[];
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare30 changesSince(agent: AgentState, before: ReadView): SyncAnswer;
init0Start the project31}
33/**
34 * Move the agent's base to its space's newest version. Returns every file
35 * whose text in its view changes (null when it's gone), and the collisions
36 * it now has to settle. A first sync returns every file (that's how a
37 * folder joins).
38 */
39export function sync(host: SyncHost, agentName: string, options: { label?: string; full?: boolean } = {}): SyncAnswer {
40 const entries: Entry[] = [];
41 const agent = host.agent(agentName, entries);
42 const space = host.spaceOf(agent);
43 let target = last(space);
44 if (options.label !== undefined) {
45 // Follow a label (#10): the newest version of shared that carries it.
46 if (space.name !== SHARED)
47 throw new ProjectError("bad-request", "labels mark versions of shared; switch to shared to follow one");
48 const versions = host.labels.get(options.label);
49 if (!versions)
50 throw new ProjectError("bad-request", `no version of shared has the label ${JSON.stringify(options.label)}`);
51 target = versions[versions.length - 1]!;
52 }
53 const before = agent.synced ? host.agentView(agent) : new View(host.graph, []);
54 const set = host.at(space, target);
55 const stranded = host.strandedFiles(host.draft(agent), set);
56 if (stranded.length > 0) {
57 host.flush(entries);
58 throw new ProjectError(
59 "conflict",
60 target === last(space)
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare61 ? `your unpushed changes to ${stranded.join(", ")} build on lines a drop took out of shared; ` +
62 `restore those files (abso restore ${stranded.join(" ")}) and pull again`
63 : `your unpushed changes to ${stranded.join(", ")} build on lines version ${target} doesn't have yet; ` +
64 `push or restore them before following label ${options.label}`,
init0Start the project65 );
66 }
67 // Moving back to a labeled version: the agent's own newer published work must not build on what that version lacks.
68 const mineAfter = agent.mine.filter((id) => !set.has(id));
69 const lacking = host.strandedFiles(mineAfter, set);
70 if (lacking.length > 0) {
71 host.flush(entries);
72 throw new ProjectError(
73 "conflict",
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare74 `your pushed changes to ${lacking.join(", ")} build on versions after ${target}, so you can't move back to it`,
init0Start the project75 );
76 }
77 const oldBase = host.at(space, agent.base);
78 const oldVersion = agent.base;
79 entries.push({ type: "sync", agent: agent.name, version: target });
80 host.apply(entries[entries.length - 1]!);
81 // News about versions the agent has now synced past is moot: the sync answer lists what's still open (#37).
82 if (agent.news.some((t) => !t.startsWith("Announcement from "))) {
83 const heard: Entry = { type: "heard", agent: agent.name, stale: true };
84 entries.push(heard);
85 host.apply(heard);
86 }
87 const merged = host.mergeIdentical(agent, before, oldBase, oldVersion, Date.now(), entries);
trials51Drop a seat name from notes on who reported things Nine comments and test names named the person who reported a #37 case. The notes keep the case and drop the name. Only comments and test names change.Compare88 // full (#37, a partial join): every file in the view, as for a first sync, whatever the folder had.
init0Start the project89 const answer = host.changesSince(agent, options.full ? new View(host.graph, []) : before);
90 host.flush(entries);
91 return merged.length > 0 ? { ...answer, merged } : answer;