- 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=190&format=json
205 linesFirst import 97% · speed 2% · engine 1% · infra-split 1%Last change speed in version 160, 4 versions changed it
You're reading version 190. The newest is 318, and 4 versions 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 | { ok: false; collisions: readonly Collision[]; reason?: string };
92/** A note on lines (#44): where its lines are now, or null when they're all gone. */
93export interface NoteAnswer {
94 readonly id: number;
95 readonly agent: string;
96 readonly kind: "comment" | "objection" | "read";
97 readonly file: string;
98 readonly lines: readonly [number, number] | null;
99 readonly text: string;
100 readonly change: number | null;
101 readonly reply: number | null;
102 readonly time: number;
103 readonly state: "open" | "addressed" | "outdated" | "resolved" | "withdrawn";
104}
105/** 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. */
106export interface ChangeAnswer {
107 readonly id: number;
108 readonly agent: string;
109 readonly title: string;
110 readonly kind: "note" | "draft" | "publish";
111 readonly note: { readonly text: string; readonly files: readonly string[] } | null;
112 readonly draft: string | null;
113 readonly time: number;
114 /** Its start note still lasts, or its draft hasn't landed: more versions may come. */
115 readonly open: boolean;
116 readonly versions: readonly {
117 readonly version: number;
118 readonly draft: string | null;
119 readonly message: string;
120 readonly time: number;
121 readonly files: readonly string[];
122 }[];
123 readonly files: readonly string[];
124 readonly settled: readonly (Settled & { readonly version: number })[];
125 readonly refusals: readonly {
126 readonly time: number;
127 readonly kinds: readonly string[];
128 readonly files: readonly string[];
129 /** A held push's message. */
130 readonly message?: string;
131 }[];
132 readonly notes?: readonly NoteAnswer[];
133 readonly reviewers?: readonly { readonly agent: string; readonly files: readonly string[]; readonly read: boolean }[];
134}
135/** The body of a note: on lines, or a reply to one. */
136export type NoteBody =
137 | {
138 readonly file: string;
139 readonly from: number;
140 readonly to: number;
141 readonly text: string;
142 readonly kind?: "comment" | "objection" | "read";
143 readonly of?: string;
144 readonly version?: number;
145 }
146 | { readonly reply: number; readonly text: string };
148export interface SyncAnswer {
149 readonly version: number;
150 readonly files: Readonly<Record<string, string | null>>;
151 /** Files whose executable bit or link changed: {exec, link}. */
152 readonly modes?: Modes;
153 /** Binary files whose bytes changed: path -> sha256, or null when the file is no longer binary. */
154 readonly blobs?: Readonly<Record<string, string | null>>;
155 readonly collisions?: readonly Collision[];
156 /** Lines both sides changed that sync merged item by item (a one-line list both added to): not collisions, but worth a look (#37). */
157 readonly merged?: readonly MergedLine[];
158}
159export interface MergedLine {
160 readonly file: string;
161 readonly line: number;
162 readonly text: string;
163 readonly theirs: { readonly agent: string; readonly message: string; readonly version: number };
164}
165export interface StatusAnswer {
166 readonly version: number;
167 readonly agents: readonly {
168 readonly agent: string;
169 /** The named draft it works in, or null (or absent) for shared. */
170 readonly draft?: string | null;
171 readonly base: number | null;
172 readonly draftChanges: number;
173 readonly files: readonly string[] | number;
174 /** Unpublished work it left parked in other spaces. */
175 readonly parked?: readonly { readonly draft: string | null; readonly draftChanges: number }[];
176 /** Marker blocks still in its draft (#11): collisions to settle. */
177 readonly collisions?: readonly OpenCollision[];
178 /** It reads and records nothing (#37). */
179 readonly reader?: true;
180 /** Its publishes waiting in the merge queue (#39). */
181 readonly queued?: readonly number[];
182 }[];
183 readonly drafts?: readonly {
184 readonly name: string;
185 readonly version: number;
186 readonly sharedBase: number;
187 readonly changes: number;
188 readonly agents: readonly string[];
189 }[];
190 /** The project's CI (#39); absent from servers without it. */
191 readonly ci?: CiStatus;
192 /** The merge queue (#39), while anything waits or it's paused. */
193 readonly queue?: QueueState | null;
194 /** Only when shared has both project files: abso.json counts, avcs.json is ignored. */
195 readonly projectFile?: { readonly used: string; readonly ignored: string };
196}
197/** `POST /a/:agent/draft` answers like a sync, naming the space the agent is now in. */
198export interface SwitchAnswer extends SyncAnswer {
199 readonly draft: string | null;
200}
201export interface DraftSyncAnswer {
202 readonly draft: string;
203 readonly version: number;
204 readonly sharedBase: number;
205}