- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/client/src/api-answers.ts?version=217&format=json
226 linesFirst import 87% · autosettle 10% · speed 2% · engine 1% · infra-split 1%Last change autosettle in version 204, 7 versions changed it
You're reading version 217. The newest is 318, and 1 version since then changed this file.
1// What the server answers for recording, publishing, syncing, notes and status.
3import type { CiStatus, QueueState } from "./ci-answers.ts";
4import type { Modes } from "./modes.ts";
6/** A collision as publish and sync report it. */
7export interface Collision {
8 /**
9 * `lines`: both changed the same lines. `definition`: your draft uses `name`, whose definition they changed.
10 * `attribute`: both set `name` (exec or link). `duplicate`: you and they each define `name` at the top level of `file`.
11 */
12 readonly kind?: "lines" | "definition" | "attribute" | "duplicate";
13 /** A lines collision you synced into and haven't edited since (#37): both sides' lines are in your file. */
14 readonly untouched?: true;
15 /** A lines collision written into the file as a marker block (#11): `lines` is the block's range there. */
16 readonly marked?: true;
17 readonly lines?: readonly [number, number];
18 readonly name?: string;
19 readonly file: string;
20 readonly yours: { readonly lines: unknown; readonly text: string };
21 /** For a definition, `file` is where the definition is, and `text` is "" when it's gone. */
22 readonly theirs: {
23 readonly file?: string;
24 readonly agent: string;
25 readonly message: string;
26 readonly version: number;
27 readonly lines: unknown;
28 readonly text: string;
29 /** Theirs is waiting in the merge queue, not landed yet (#39): its queue id. */
30 readonly queued?: number;
31 };
32}
34/** News arrives as one plain sentence per collision; accept a single string too. */
35export type News = string | readonly string[] | undefined;
37export interface EditBody {
38 readonly file: string;
39 readonly old?: string;
40 readonly new?: string;
41 readonly content?: string;
42 readonly edits?: readonly { readonly old: string; readonly new: string }[];
43 readonly session?: string;
44 readonly subagent?: string;
45}
47/** A path recorded under another spelling of an existing file (#49): one file whatever its case. */
48export interface Spelling {
49 readonly path: string;
50 readonly existing: string;
51}
52export type EditAnswer =
53 | { ok: true; news?: News; spelling?: readonly Spelling[]; uncomposed?: readonly string[] }
54 | { ok: false; reason: string };
55/** A marker block still in an agent's draft (#11). */
56export interface OpenCollision {
57 readonly file: string;
58 readonly lines: readonly [number, number];
59 readonly theirs: { readonly agent: string; readonly version: number; readonly message: string };
60}
61/** What a publish settled, file by file, and which side survived (#11). */
62export interface Settled {
63 readonly file: string;
64 readonly kept: "yours" | "theirs" | "both" | "rewrote";
65 readonly theirs: { readonly agent: string; readonly version: number };
66 /** Lines both sides still had that the settled file no longer has (#37). */
67 readonly lost?: readonly string[];
68 /** The message of the settler's push that was held for this collision. */
69 readonly held?: string;
70}
71export interface RecordAnswer {
72 readonly ok: boolean;
73 readonly changed?: readonly string[] | number;
74 readonly news?: News;
75 readonly reason?: string;
76 readonly spelling?: readonly Spelling[];
77 /** New names not in composed Unicode form (#49): a gentle warning. */
78 readonly uncomposed?: readonly string[];
79}
80export type PublishAnswer =
81 | {
82 ok: true;
83 version: number;
84 changes?: number;
85 settled?: readonly Settled[];
86 /** Others' versions this publish went on top of that the folder hasn't synced yet (#37): nothing of theirs was overwritten. */
87 mergedWith?: readonly { readonly version: number; readonly agent: string; readonly message: string }[];
88 }
89 /** With the merge queue on (#39): queued, not landed yet; `ahead` publishes wait in front of it. */
90 | { ok: true; queued: number; position: number; ahead: number; changes: number; settled?: readonly Settled[] }
91 | {
92 ok: false;
93 collisions: readonly Collision[];
94 reason?: string;
95 advice?: readonly (Advice | null)[];
96 /** The server runs AUTOSETTLE=act: settle the collisions it advised a side of, and push again (#19). */
97 settle?: boolean;
98 };
99/**
100 * A server's first opinion on one collision of a held push (#19), when it runs AUTOSETTLE: which settle fits,
101 * how sure, and why. `by`: rule (code decided), model (Workers AI), turned down (the model's pick would break
102 * the file, so an agent settles), or unsure (the model leaned to a side under the server's threshold).
103 */
104export interface Advice {
105 readonly pick: "yours" | "theirs" | "both" | "agent";
106 readonly confidence: number;
107 readonly reason: string;
108 readonly by: "rule" | "model" | "turned down" | "unsure";
109 readonly modelPick?: string;
110 readonly model?: string;
111 readonly ms: number;
112}
113/** A note on lines (#44): where its lines are now, or null when they're all gone. */
114export interface NoteAnswer {
115 readonly id: number;
116 readonly agent: string;
117 readonly kind: "comment" | "objection" | "read";
118 readonly file: string;
119 readonly lines: readonly [number, number] | null;
120 readonly text: string;
121 readonly change: number | null;
122 readonly reply: number | null;
123 readonly time: number;
124 readonly state: "open" | "addressed" | "outdated" | "resolved" | "withdrawn";
125}
126/** One change (#44): a start note's work, a named draft's, or a lone publish. Its id is the log position that began it. */
127export interface ChangeAnswer {
128 readonly id: number;
129 readonly agent: string;
130 readonly title: string;
131 readonly kind: "note" | "draft" | "publish";
132 readonly note: { readonly text: string; readonly files: readonly string[] } | null;
133 readonly draft: string | null;
134 readonly time: number;
135 /** Its start note still lasts, or its draft hasn't landed: more versions may come. */
136 readonly open: boolean;
137 readonly versions: readonly {
138 readonly version: number;
139 readonly draft: string | null;
140 readonly message: string;
141 readonly time: number;
142 readonly files: readonly string[];
143 }[];
144 readonly files: readonly string[];
145 readonly settled: readonly (Settled & { readonly version: number })[];
146 readonly refusals: readonly {
147 readonly time: number;
148 readonly kinds: readonly string[];
149 readonly files: readonly string[];
150 /** A held push's message. */
151 readonly message?: string;
152 }[];
153 readonly notes?: readonly NoteAnswer[];
154 readonly reviewers?: readonly { readonly agent: string; readonly files: readonly string[]; readonly read: boolean }[];
155}
156/** The body of a note: on lines, or a reply to one. */
157export type NoteBody =
158 | {
159 readonly file: string;
160 readonly from: number;
161 readonly to: number;
162 readonly text: string;
163 readonly kind?: "comment" | "objection" | "read";
164 readonly of?: string;
165 readonly version?: number;
166 }
167 | { readonly reply: number; readonly text: string };
169export interface SyncAnswer {
170 readonly version: number;
171 readonly files: Readonly<Record<string, string | null>>;
172 /** Files whose executable bit or link changed: {exec, link}. */
173 readonly modes?: Modes;
174 /** Binary files whose bytes changed: path -> sha256, or null when the file is no longer binary. */
175 readonly blobs?: Readonly<Record<string, string | null>>;
176 readonly collisions?: readonly Collision[];
177 /** Lines both sides changed that sync merged item by item (a one-line list both added to): not collisions, but worth a look (#37). */
178 readonly merged?: readonly MergedLine[];
179}
180export interface MergedLine {
181 readonly file: string;
182 readonly line: number;
183 readonly text: string;
184 readonly theirs: { readonly agent: string; readonly message: string; readonly version: number };
185}
186export interface StatusAnswer {
187 readonly version: number;
188 readonly agents: readonly {
189 readonly agent: string;
190 /** The named draft it works in, or null (or absent) for shared. */
191 readonly draft?: string | null;
192 readonly base: number | null;
193 readonly draftChanges: number;
194 readonly files: readonly string[] | number;
195 /** Unpublished work it left parked in other spaces. */
196 readonly parked?: readonly { readonly draft: string | null; readonly draftChanges: number }[];
197 /** Marker blocks still in its draft (#11): collisions to settle. */
198 readonly collisions?: readonly OpenCollision[];
199 /** It reads and records nothing (#37). */
200 readonly reader?: true;
201 /** Its publishes waiting in the merge queue (#39). */
202 readonly queued?: readonly number[];
203 }[];
204 readonly drafts?: readonly {
205 readonly name: string;
206 readonly version: number;
207 readonly sharedBase: number;
208 readonly changes: number;
209 readonly agents: readonly string[];
210 }[];
211 /** The project's CI (#39); absent from servers without it. */
212 readonly ci?: CiStatus;
213 /** The merge queue (#39), while anything waits or it's paused. */
214 readonly queue?: QueueState | null;
215 /** Only when shared has both project files: abso.json counts, avcs.json is ignored. */
216 readonly projectFile?: { readonly used: string; readonly ignored: string };
217}
218/** `POST /a/:agent/draft` answers like a sync, naming the space the agent is now in. */
219export interface SwitchAnswer extends SyncAnswer {
220 readonly draft: string | null;
221}
222export interface DraftSyncAnswer {
223 readonly draft: string;
224 readonly version: number;
225 readonly sharedBase: number;
226}