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/publish.ts --json
JSON
/christopher/abso-core/blame/worker/project/publish.ts?format=json
217 linesFirst import 89% · codex-capacity-chair 5% · speed 2% · autosettle 2% · rename 1% · infra-split 1%Last change autosettle in version 211,

217 lines from 7 changes in 7 versions.

init0Start the project1// Add the agent's draft to its space. Writes go through PublishHost; today
2// the host is Project. Ingest calls publishDraft, the inner step.
3
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare4import { type AtomId, buildAtom, type Hunk, joinLines, type ReadView } from "../../src/engine/index.ts";
codex-capacity-chair133Keep persistent publish membership indexed through conflict checksCompare5import { differenceSet, unionOverlay } from "../../src/engine/state-source.ts";
autosettle211Settled automatically, on the record and in the other agent's news (abso-core 23) The client's re-push after settling by itself now ends its message with a fixed trailer, one line per file: 'Settled automatically (abso 19):' then '- <file>: kept <side>, confidence 0.81. <reason>' (or 'by a check in code'). autoTrailer writes it and autoSettledOf reads it back, both in worker/project/autosettle.ts. Publish and the merge queue put it on each settle record as settled[].auto {pick, by, confidence, reason}, so the website can mark the version. The other agent's news says 'X settled its collision with your version N in <file> automatically, as abso's model advised (confidence 0.81), pushing version V: ...' and still outlasts a sync. Tests: autosettle.test.ts 9 (trailer round trip, news words), the client's settle/held tests 21, held-push, markers, project, same-line. Typecheck and server typecheck clean. Local open server under act: the trailer is written as above.Compare6import { autoSettledOf } from "./autosettle.ts";
init0Start the project7import type { Pair } from "./collisions.ts";
8import type { DefinitionCollision } from "./definition-rule.ts";
speed160A held push keeps its message, and why tells every settle: the refusal stores the push's message; why on a line kept by abso settle --yours, --theirs or --both names the collision it was kept from, and both kinds of settle list the settler's held push with its reason; the settle's news and the change page carry it too, and a lone push's change now lists the refusals on its wayCompare9import { heldMessage, keptOf, lostLines, settleLines } from "./markers.ts";
init0Start the project10import { ProjectError } from "./project-error.ts";
11import type { AgentState, Collision, Entry, Meta, Mode, PublishAnswer, Settled } from "./project-types.ts";
12import { last, SHARED, type Space } from "./spaces.ts";
14/** What publishing needs from a project. */
15export interface PublishHost {
16 readonly agents: ReadonlyMap<string, AgentState>;
17 nextAt(): number;
18 checkClash(changes: readonly AtomId[], ahead?: ReadonlySet<AtomId>): void;
19 queueOn(): boolean;
20 queuedAtoms(except?: string): Set<AtomId>;
21 agent(name: string, entries: Entry[]): AgentState;
22 draft(agent: AgentState): AtomId[];
23 spaceOf(agent: AgentState): Space;
24 strandedFiles(draft: readonly AtomId[], set: ReadonlySet<AtomId>): string[];
25 setOf(space: Space): ReadonlySet<AtomId>;
26 markedFiles(agent: AgentState): string[];
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare27 agentView(agent: AgentState): ReadView;
init0Start the project28 recordFile(
29 agent: AgentState,
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare30 view: ReadView,
init0Start the project31 path: string,
32 text: string | null | undefined,
33 time: number,
34 meta: Meta,
35 entries: Entry[],
36 mode?: Mode,
37 blob?: string,
38 hunks?: readonly Hunk[],
39 ): boolean;
40 expressMoves(agent: AgentState, time: number, entries: Entry[]): void;
41 pairs(draft: readonly AtomId[], against: ReadonlySet<AtomId>, settled: ReadonlySet<AtomId>): Pair[];
42 collision(agent: AgentState, pair: Pair): Collision;
43 definitionCollisions(agent: AgentState, newer: ReadonlySet<AtomId>): DefinitionCollision[];
44 duplicates(agent: AgentState): Collision[];
45 refuse(
46 agent: AgentState,
47 space: Space,
48 via: "publish" | "land",
49 time: number,
50 collisions: Collision[],
51 entries: Entry[],
speed160A held push keeps its message, and why tells every settle: the refusal stores the push's message; why on a line kept by abso settle --yours, --theirs or --both names the collision it was kept from, and both kinds of settle list the settler's held push with its reason; the settle's news and the change page carry it too, and a lone push's change now lists the refusals on its wayCompare52 message?: string,
init0Start the project53 ): { ok: false; collisions: Collision[] };
54 markerCollisions(agent: AgentState): Collision[];
55 enqueue(
56 agent: AgentState,
57 message: string,
58 time: number,
59 draft: readonly AtomId[],
60 resolves: readonly AtomId[],
61 entries: Entry[],
62 ): PublishAnswer;
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare63 view(set: ReadonlySet<AtomId>): ReadView;
64 spaceOverlay?(space: Space, atoms: readonly AtomId[]): ReadView;
init0Start the project65 requireClosed(tie: { deps: readonly AtomId[] }, union: ReadonlySet<AtomId>): void;
codex-capacity-chair133Keep persistent publish membership indexed through conflict checksCompare66 newerFor(agent: AgentState): ReadonlySet<AtomId>;
init0Start the project67 currentChange(agent: AgentState, time: number): number | undefined;
68 apply(entry: Entry): void;
69 newsForOthers(publisher: AgentState, space: Space, version: number, entries: Entry[]): void;
70 settledNews(agent: AgentState, version: number, settled: readonly Settled[], entries: Entry[]): void;
71 addressedNews(agent: AgentState, version: number, entries: Entry[]): void;
72 reviewNews(agent: AgentState, version: number, entries: Entry[]): void;
73 flush(entries: Entry[]): void;
76/**
77 * Add the agent's draft to its space (shared, or its named draft). Refused
78 * only when a draft change collides with work published to that space
79 * after the agent's base.
80 */
81export function publish(
82 host: PublishHost,
83 agentName: string,
84 message: string,
85 time: number,
86 options: { asIs?: boolean } = {},
87): PublishAnswer {
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.Compare88 if (typeof message !== "string") throw new ProjectError("bad-request", "push needs a message");
init0Start the project89 const known = host.agents.get(agentName);
90 if (known && known.space === SHARED)
91 host.checkClash(host.draft(known), host.queueOn() ? host.queuedAtoms(known.name) : undefined);
92 const entries: Entry[] = [];
93 const answer = publishDraft(host, host.agent(agentName, entries), message, time, entries, options.asIs === true);
94 host.flush(entries);
95 return answer;
98/** The inner publish, also used when ingesting a git push. */
99export function publishDraft(
100 host: PublishHost,
101 agent: AgentState,
102 message: string,
103 time: number,
104 entries: Entry[],
105 asIs = false,
106 direct = false,
107): PublishAnswer {
108 const space = host.spaceOf(agent);
109 const stranded = host.strandedFiles(host.draft(agent), host.setOf(space));
110 if (stranded.length > 0) {
111 throw new ProjectError(
112 "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.Compare113 `your unpushed changes to ${stranded.join(", ")} build on lines a drop took out of shared; ` +
114 `restore those files (abso restore ${stranded.join(" ")}), pull, and make the change again`,
init0Start the project115 );
116 }
117 // asIs (#11): every block of markers keeps both sides, and the publish says which files it settled that way.
118 if (asIs) {
119 for (const file of host.markedFiles(agent)) {
120 const view = host.agentView(agent);
121 if (!view.hasFile(file)) continue;
122 const s = settleLines(
123 view.lines(file).map((l) => l.text),
124 "both",
125 );
126 if (s.blocks > 0) host.recordFile(agent, view, file, joinLines(s.lines), time, {}, entries);
127 }
128 }
129 host.expressMoves(agent, time, entries);
130 const draft = host.draft(agent);
131 if (draft.length === 0) return { ok: true, version: last(space), changes: 0 };
132 const now = host.setOf(space);
codex-capacity-chair133Keep persistent publish membership indexed through conflict checksCompare133 const union = unionOverlay(now, draft);
init0Start the project134 const newer = host.newerFor(agent);
135 const collisions = [
136 ...host.pairs(draft, newer, union).map((p) => host.collision(agent, p)),
137 ...host.definitionCollisions(agent, newer).map((d) => d.collision),
138 ...host.duplicates(agent),
139 ];
speed160A held push keeps its message, and why tells every settle: the refusal stores the push's message; why on a line kept by abso settle --yours, --theirs or --both names the collision it was kept from, and both kinds of settle list the settler's held push with its reason; the settle's news and the change page carry it too, and a lone push's change now lists the refusals on its wayCompare140 if (collisions.length > 0) return host.refuse(agent, space, "publish", time, collisions, entries, message);
init0Start the project141 // Settled means the markers are gone (#11): refused while the draft adds any.
142 const marked = host.markerCollisions(agent);
143 if (marked.length > 0) return host.refuse(agent, space, "publish", time, marked, entries);
144 // What the agent has seen collide (it synced past both sides) and not
145 // settled by an edit. Lines both sides changed, still untouched since the
146 // sync, are both in the file, and publishing that doubles them in shared
infra-split37Comments and test names give each reason in plain words, without naming who raised it Notes like "(#37, Builder 5)" or "(AVCS - Security)" become "(#37)" or go, and a private commit hash after a name goes with it. Issue numbers and references such as git's CVE-2019-1353 stay. Only comments and test names change; no behavior changes.Compare147 // (#37: twenty goals twice, shared red for three versions). So
init0Start the project148 // that is refused unless the agent says to publish as it is (asIs); then,
149 // like any other seen collision, publishing settles it.
codex-capacity-chair133Keep persistent publish membership indexed through conflict checksCompare150 const seen = host.pairs(draft, differenceSet(now, newer), union);
init0Start the project151 if (!asIs) {
152 const untouched = seen
153 .map((p) => host.collision(agent, p))
154 .filter((c) => c.kind === "lines")
155 .map((c) => ({ ...c, untouched: true as const }));
156 if (untouched.length > 0) return host.refuse(agent, space, "publish", time, untouched, entries);
157 }
158 const resolves = [...new Set(seen.flatMap((p) => [p.yours, p.theirs]))];
159 if (space.name === SHARED && !direct && host.queueOn())
160 return host.enqueue(agent, message, time, draft, resolves, entries);
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare161 const candidate = host.spaceOverlay ? host.spaceOverlay(space, draft) : host.view(union);
162 const tie = buildAtom(candidate, { author: agent.name, message, time, needs: draft, resolves });
init0Start the project163 host.requireClosed(tie, union);
164 const version = last(space) + 1;
165 const othersPublished = space.versions.slice(agent.base + 1).some((p) => p.agent !== agent.name);
166 // What this publish went on top of that the agent's folder doesn't have yet (#37).
167 const mergedWith = space.versions
168 .slice(agent.base + 1)
169 .filter((p) => p.agent !== agent.name && (p.atoms.length > 0 || p.dropped !== undefined))
170 .map((p) => ({ version: p.version, agent: p.agent, message: p.message }));
171 // What each marked collision kept, judged from the file as published (#11).
172 const view = host.agentView(agent);
autosettle211Settled automatically, on the record and in the other agent's news (abso-core 23) The client's re-push after settling by itself now ends its message with a fixed trailer, one line per file: 'Settled automatically (abso 19):' then '- <file>: kept <side>, confidence 0.81. <reason>' (or 'by a check in code'). autoTrailer writes it and autoSettledOf reads it back, both in worker/project/autosettle.ts. Publish and the merge queue put it on each settle record as settled[].auto {pick, by, confidence, reason}, so the website can mark the version. The other agent's news says 'X settled its collision with your version N in <file> automatically, as abso's model advised (confidence 0.81), pushing version V: ...' and still outlasts a sync. Tests: autosettle.test.ts 9 (trailer round trip, news words), the client's settle/held tests 21, held-push, markers, project, same-line. Typecheck and server typecheck clean. Local open server under act: the trailer is written as above.Compare173 const auto = autoSettledOf(message);
init0Start the project174 const settled: Settled[] = agent.marked
175 .filter((r) => r.space === space.name)
176 .map((r) => {
177 const lines = view.hasFile(r.file) ? view.lines(r.file).map((l) => l.text) : [];
178 const lost = lostLines(lines, r);
speed160A held push keeps its message, and why tells every settle: the refusal stores the push's message; why on a line kept by abso settle --yours, --theirs or --both names the collision it was kept from, and both kinds of settle list the settler's held push with its reason; the settle's news and the change page carry it too, and a lone push's change now lists the refusals on its wayCompare179 const held = heldMessage(agent, r.file);
autosettle211Settled automatically, on the record and in the other agent's news (abso-core 23) The client's re-push after settling by itself now ends its message with a fixed trailer, one line per file: 'Settled automatically (abso 19):' then '- <file>: kept <side>, confidence 0.81. <reason>' (or 'by a check in code'). autoTrailer writes it and autoSettledOf reads it back, both in worker/project/autosettle.ts. Publish and the merge queue put it on each settle record as settled[].auto {pick, by, confidence, reason}, so the website can mark the version. The other agent's news says 'X settled its collision with your version N in <file> automatically, as abso's model advised (confidence 0.81), pushing version V: ...' and still outlasts a sync. Tests: autosettle.test.ts 9 (trailer round trip, news words), the client's settle/held tests 21, held-push, markers, project, same-line. Typecheck and server typecheck clean. Local open server under act: the trailer is written as above.Compare180 const by = auto.get(r.file);
init0Start the project181 return {
182 file: r.file,
183 kept: keptOf(lines, r),
184 theirs: { agent: r.agent, version: r.version },
185 ...(lost.length > 0 ? { lost } : {}),
speed160A held push keeps its message, and why tells every settle: the refusal stores the push's message; why on a line kept by abso settle --yours, --theirs or --both names the collision it was kept from, and both kinds of settle list the settler's held push with its reason; the settle's news and the change page carry it too, and a lone push's change now lists the refusals on its wayCompare186 ...(held ? { held } : {}),
autosettle211Settled automatically, on the record and in the other agent's news (abso-core 23) The client's re-push after settling by itself now ends its message with a fixed trailer, one line per file: 'Settled automatically (abso 19):' then '- <file>: kept <side>, confidence 0.81. <reason>' (or 'by a check in code'). autoTrailer writes it and autoSettledOf reads it back, both in worker/project/autosettle.ts. Publish and the merge queue put it on each settle record as settled[].auto {pick, by, confidence, reason}, so the website can mark the version. The other agent's news says 'X settled its collision with your version N in <file> automatically, as abso's model advised (confidence 0.81), pushing version V: ...' and still outlasts a sync. Tests: autosettle.test.ts 9 (trailer round trip, news words), the client's settle/held tests 21, held-push, markers, project, same-line. Typecheck and server typecheck clean. Local open server under act: the trailer is written as above.Compare187 ...(by ? { auto: by } : {}),
init0Start the project188 };
189 });
190 entries.push({
191 type: "publish",
192 agent: agent.name,
193 ...(space.name !== SHARED ? { space: space.name } : {}),
194 version,
195 message,
196 time,
197 changes: draft,
198 tie,
199 rebase: !othersPublished,
200 ...(settled.length > 0 ? { settled } : {}),
201 change: host.currentChange(agent, time) ?? host.nextAt(),
202 });
203 host.apply(entries[entries.length - 1]!);
204 host.newsForOthers(agent, space, version, entries);
205 host.settledNews(agent, version, settled, entries);
206 if (space.name === SHARED) {
207 host.addressedNews(agent, version, entries);
208 host.reviewNews(agent, version, entries);
209 }
210 return {
211 ok: true,
212 version,
213 changes: draft.length,
214 ...(mergedWith.length > 0 ? { mergedWith } : {}),
215 ...(settled.length > 0 ? { settled } : {}),
216 };