- 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=0&format=json
199 linesFirst import 100%Last change First import in version 0, 1 version changed it
You're reading version 0. The newest is 318, and 7 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, Playtester 1). */
67 readonly lost?: readonly string[];
68}
69export interface RecordAnswer {
70 readonly ok: boolean;
71 readonly changed?: readonly string[] | number;
72 readonly news?: News;
73 readonly reason?: string;
74 readonly spelling?: readonly Spelling[];
75 /** New names not in composed Unicode form (#49): a gentle warning. */
76 readonly uncomposed?: readonly string[];
77}
78export type PublishAnswer =
79 | {
80 ok: true;
81 version: number;
82 changes?: number;
83 settled?: readonly Settled[];
84 /** Others' versions this publish went on top of that the folder hasn't synced yet (#37): nothing of theirs was overwritten. */
85 mergedWith?: readonly { readonly version: number; readonly agent: string; readonly message: string }[];
86 }
87 /** With the merge queue on (#39): queued, not landed yet; `ahead` publishes wait in front of it. */
88 | { ok: true; queued: number; position: number; ahead: number; changes: number; settled?: readonly Settled[] }
89 | { ok: false; collisions: readonly Collision[]; reason?: string };
90/** A note on lines (#44): where its lines are now, or null when they're all gone. */
91export interface NoteAnswer {
92 readonly id: number;
93 readonly agent: string;
94 readonly kind: "comment" | "objection" | "read";
95 readonly file: string;
96 readonly lines: readonly [number, number] | null;
97 readonly text: string;
98 readonly change: number | null;
99 readonly reply: number | null;
100 readonly time: number;
101 readonly state: "open" | "addressed" | "outdated" | "resolved" | "withdrawn";
102}
103/** 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. */
104export interface ChangeAnswer {
105 readonly id: number;
106 readonly agent: string;
107 readonly title: string;
108 readonly kind: "note" | "draft" | "publish";
109 readonly note: { readonly text: string; readonly files: readonly string[] } | null;
110 readonly draft: string | null;
111 readonly time: number;
112 /** Its start note still lasts, or its draft hasn't landed: more versions may come. */
113 readonly open: boolean;
114 readonly versions: readonly {
115 readonly version: number;
116 readonly draft: string | null;
117 readonly message: string;
118 readonly time: number;
119 readonly files: readonly string[];
120 }[];
121 readonly files: readonly string[];
122 readonly settled: readonly (Settled & { readonly version: number })[];
123 readonly refusals: readonly {
124 readonly time: number;
125 readonly kinds: readonly string[];
126 readonly files: readonly string[];
127 }[];
128 readonly notes?: readonly NoteAnswer[];
129 readonly reviewers?: readonly { readonly agent: string; readonly files: readonly string[]; readonly read: boolean }[];
130}
131/** The body of a note: on lines, or a reply to one. */
132export type NoteBody =
133 | {
134 readonly file: string;
135 readonly from: number;
136 readonly to: number;
137 readonly text: string;
138 readonly kind?: "comment" | "objection" | "read";
139 readonly of?: string;
140 readonly version?: number;
141 }
142 | { readonly reply: number; readonly text: string };
144export interface SyncAnswer {
145 readonly version: number;
146 readonly files: Readonly<Record<string, string | null>>;
147 /** Files whose executable bit or link changed: {exec, link}. */
148 readonly modes?: Modes;
149 /** Binary files whose bytes changed: path -> sha256, or null when the file is no longer binary. */
150 readonly blobs?: Readonly<Record<string, string | null>>;
151 readonly collisions?: readonly Collision[];
152 /** Lines both sides changed that sync merged item by item (a one-line list both added to): not collisions, but worth a look (#37). */
153 readonly merged?: readonly MergedLine[];
154}
155export interface MergedLine {
156 readonly file: string;
157 readonly line: number;
158 readonly text: string;
159 readonly theirs: { readonly agent: string; readonly message: string; readonly version: number };
160}
161export interface StatusAnswer {
162 readonly version: number;
163 readonly agents: readonly {
164 readonly agent: string;
165 /** The named draft it works in, or null (or absent) for shared. */
166 readonly draft?: string | null;
167 readonly base: number | null;
168 readonly draftChanges: number;
169 readonly files: readonly string[] | number;
170 /** Unpublished work it left parked in other spaces. */
171 readonly parked?: readonly { readonly draft: string | null; readonly draftChanges: number }[];
172 /** Marker blocks still in its draft (#11): collisions to settle. */
173 readonly collisions?: readonly OpenCollision[];
174 /** It reads and records nothing (#37). */
175 readonly reader?: true;
176 /** Its publishes waiting in the merge queue (#39). */
177 readonly queued?: readonly number[];
178 }[];
179 readonly drafts?: readonly {
180 readonly name: string;
181 readonly version: number;
182 readonly sharedBase: number;
183 readonly changes: number;
184 readonly agents: readonly string[];
185 }[];
186 /** The project's CI (#39); absent from servers without it. */
187 readonly ci?: CiStatus;
188 /** The merge queue (#39), while anything waits or it's paused. */
189 readonly queue?: QueueState | null;
190}
191/** `POST /a/:agent/draft` answers like a sync, naming the space the agent is now in. */
192export interface SwitchAnswer extends SyncAnswer {
193 readonly draft: string | null;
194}
195export interface DraftSyncAnswer {
196 readonly draft: string;
197 readonly version: number;
198 readonly sharedBase: number;
199}