{"file":"client/src/api.ts","version":318,"total":1102,"from":1,"to":1102,"lines":[{"n":1,"text":"// Calls to the server's HTTP API (docs/v2-slice1.md). Every call is JSON","atom":"a0","author":"init","version":0},{"n":2,"text":"// except `run`, which sends a tar.gz and reads the answer as a stream of JSON","atom":"a0","author":"init","version":0},{"n":3,"text":"// lines (box-run.ts).","atom":"a0","author":"init","version":0},{"n":4,"text":"","atom":"a0","author":"init","version":0},{"n":5,"text":"import { randomUUID } from \"node:crypto\";","atom":"a1656","author":"codex-capacity-chair","version":162},{"n":6,"text":"import { setDefaultResultOrder } from \"node:dns\";","atom":"a0","author":"init","version":0},{"n":7,"text":"import { CALLER_HEADER } from \"../../src/caller.ts\";","atom":"a2741","author":"groups","version":277},{"n":8,"text":"import type {","atom":"a0","author":"init","version":0},{"n":9,"text":"\tChangeAnswer,","atom":"a0","author":"init","version":0},{"n":10,"text":"\tDraftSyncAnswer,","atom":"a0","author":"init","version":0},{"n":11,"text":"\tEditAnswer,","atom":"a0","author":"init","version":0},{"n":12,"text":"\tEditBody,","atom":"a0","author":"init","version":0},{"n":13,"text":"\tNews,","atom":"a0","author":"init","version":0},{"n":14,"text":"\tNoteAnswer,","atom":"a0","author":"init","version":0},{"n":15,"text":"\tNoteBody,","atom":"a0","author":"init","version":0},{"n":16,"text":"\tPublishAnswer,","atom":"a0","author":"init","version":0},{"n":17,"text":"\tRecordAnswer,","atom":"a0","author":"init","version":0},{"n":18,"text":"\tStatusAnswer,","atom":"a0","author":"init","version":0},{"n":19,"text":"\tSwitchAnswer,","atom":"a0","author":"init","version":0},{"n":20,"text":"\tSyncAnswer,","atom":"a0","author":"init","version":0},{"n":21,"text":"} from \"./api-answers.ts\";","atom":"a0","author":"init","version":0},{"n":22,"text":"import { ApiError, errorSentence, neverSent } from \"./api-error.ts\";","atom":"a0","author":"init","version":0},{"n":23,"text":"import { UsageError } from \"./args.ts\";","atom":"a2819","author":"pinch","version":287},{"n":24,"text":"import type { AutosettleAnswer, AutosettleMode } from \"./autosettle-commands.ts\";","atom":"a2392","author":"autosettle","version":220},{"n":25,"text":"import {","atom":"a0","author":"init","version":0},{"n":26,"text":"\tboxQuery,","atom":"a0","author":"init","version":0},{"n":27,"text":"\tconsumeRun,","atom":"a0","author":"init","version":0},{"n":28,"text":"\tfollow,","atom":"a0","author":"init","version":0},{"n":29,"text":"\tfollowUrl,","atom":"a0","author":"init","version":0},{"n":30,"text":"\ttype PrepAnswer,","atom":"a0","author":"init","version":0},{"n":31,"text":"\tpostRun,","atom":"a0","author":"init","version":0},{"n":32,"text":"\tRECONNECT_DELAYS_MS,","atom":"a0","author":"init","version":0},{"n":33,"text":"\tRUN_START_RETRY_MS,","atom":"a0","author":"init","version":0},{"n":34,"text":"\ttype RunIO,","atom":"a0","author":"init","version":0},{"n":35,"text":"\ttype RunKind,","atom":"a0","author":"init","version":0},{"n":36,"text":"\ttype ServeAnswer,","atom":"a0","author":"init","version":0},{"n":37,"text":"} from \"./box-run.ts\";","atom":"a0","author":"init","version":0},{"n":38,"text":"import type { CiJob, CiStatus, QueueState } from \"./ci-answers.ts\";","atom":"a0","author":"init","version":0},{"n":39,"text":"import { clientVersion } from \"./client-version.ts\";","atom":"a0","author":"init","version":0},{"n":40,"text":"import type { Config } from \"./config.ts\";","atom":"a0","author":"init","version":0},{"n":41,"text":"import type {","atom":"a0","author":"init","version":0},{"n":42,"text":"\tBlameAnswer,","atom":"a0","author":"init","version":0},{"n":43,"text":"\tDiffAnswer,","atom":"a0","author":"init","version":0},{"n":44,"text":"\tDropAnswer,","atom":"a0","author":"init","version":0},{"n":45,"text":"\tFileChange,","atom":"a0","author":"init","version":0},{"n":46,"text":"\tFilesAnswer,","atom":"a0","author":"init","version":0},{"n":47,"text":"\tLogAnswer,","atom":"a0","author":"init","version":0},{"n":48,"text":"\tOverlap,","atom":"a0","author":"init","version":0},{"n":49,"text":"\tPluckAnswer,","atom":"a0","author":"init","version":0},{"n":50,"text":"\tRestoreAnswer,","atom":"a0","author":"init","version":0},{"n":51,"text":"\tShowAnswer,","atom":"a0","author":"init","version":0},{"n":52,"text":"\tView,","atom":"a0","author":"init","version":0},{"n":53,"text":"\tWhere,","atom":"a0","author":"init","version":0},{"n":54,"text":"\tWhereAnswer,","atom":"a0","author":"init","version":0},{"n":55,"text":"\tWhyAnswer,","atom":"a0","author":"init","version":0},{"n":56,"text":"\tWithoutAnswer,","atom":"a2090","author":"candidates","version":186},{"n":57,"text":"} from \"./history-answers.ts\";","atom":"a0","author":"init","version":0},{"n":58,"text":"import type {","atom":"a142","author":"devops","version":20},{"n":59,"text":"\tAsk,","atom":"a142","author":"devops","version":20},{"n":60,"text":"\tAttachment,","atom":"a142","author":"devops","version":20},{"n":61,"text":"\tDraft,","atom":"a142","author":"devops","version":20},{"n":62,"text":"\tDraftBody,","atom":"a142","author":"devops","version":20},{"n":63,"text":"\tGroupEvent,","atom":"a2608","author":"groups","version":256},{"n":64,"text":"\tGroupShown,","atom":"a2608","author":"groups","version":256},{"n":65,"text":"\tGroupSummary,","atom":"a2608","author":"groups","version":256},{"n":66,"text":"\tGroupWrite,","atom":"a2608","author":"groups","version":256},{"n":67,"text":"\tNews as IssueNews,","atom":"a142","author":"devops","version":20},{"n":68,"text":"\tIssuePage,","atom":"a142","author":"devops","version":20},{"n":69,"text":"\tIssueRow,","atom":"a142","author":"devops","version":20},{"n":70,"text":"\tIssueSearchHit,","atom":"a142","author":"devops","version":20},{"n":71,"text":"} from \"./issues-wire.ts\";","atom":"a142","author":"devops","version":20},{"n":72,"text":"import { isLocal, LOCAL_BASE, localFetch, NO_STORE } from \"./local-store.ts\";","atom":"a2819","author":"pinch","version":287},{"n":73,"text":"import type { Modes } from \"./modes.ts\";","atom":"a0","author":"init","version":0},{"n":74,"text":"","atom":"a0","author":"init","version":0},{"n":75,"text":"export * from \"./api-answers.ts\";","atom":"a0","author":"init","version":0},{"n":76,"text":"export { ApiError, neverSent } from \"./api-error.ts\";","atom":"a0","author":"init","version":0},{"n":77,"text":"export {","atom":"a0","author":"init","version":0},{"n":78,"text":"\ttype PrepAnswer,","atom":"a0","author":"init","version":0},{"n":79,"text":"\tRECONNECT_DELAYS_MS,","atom":"a0","author":"init","version":0},{"n":80,"text":"\tRUN_START_RETRY_MS,","atom":"a0","author":"init","version":0},{"n":81,"text":"\ttype RunIO,","atom":"a0","author":"init","version":0},{"n":82,"text":"\ttype RunKind,","atom":"a0","author":"init","version":0},{"n":83,"text":"\ttype ServeAnswer,","atom":"a0","author":"init","version":0},{"n":84,"text":"} from \"./box-run.ts\";","atom":"a0","author":"init","version":0},{"n":85,"text":"export * from \"./ci-answers.ts\";","atom":"a0","author":"init","version":0},{"n":86,"text":"export * from \"./history-answers.ts\";","atom":"a0","author":"init","version":0},{"n":87,"text":"export type { Ask, Attachment, Draft, DraftBody, IssueNews, IssuePage, IssueRow, IssueSearchHit };","atom":"a142","author":"devops","version":20},{"n":88,"text":"","atom":"a0","author":"init","version":0},{"n":89,"text":"/**","atom":"a0","author":"init","version":0},{"n":90,"text":" * How long a call may take: the base, plus 1 s for each 100 KB it sends","atom":"a0","author":"init","version":0},{"n":91,"text":" * (abso issue 34: a sync that recorded 191 reformatted files first ran out of","atom":"a0","author":"init","version":0},{"n":92,"text":" * its 30 s while the server was still taking them in).","atom":"a0","author":"init","version":0},{"n":93,"text":" */","atom":"a0","author":"init","version":0},{"n":94,"text":"export function timeoutFor(baseMs: number, sent: string | undefined): number {","atom":"a0","author":"init","version":0},{"n":95,"text":"\treturn sent === undefined ? baseMs : baseMs + Math.floor(Buffer.byteLength(sent) / 100_000) * 1000;","atom":"a0","author":"init","version":0},{"n":96,"text":"}","atom":"a0","author":"init","version":0},{"n":97,"text":"","atom":"a0","author":"init","version":0},{"n":98,"text":"/**","atom":"a189","author":"pinch","version":26},{"n":99,"text":" * How long a publish or a land may take before the client stops waiting: the","atom":"a189","author":"pinch","version":26},{"n":100,"text":" * server gives one request up to 2 minutes of work, so a small body can still","atom":"a189","author":"pinch","version":26},{"n":101,"text":" * take that long (a large merge). Waiting less reported publishes as failed","atom":"a189","author":"pinch","version":26},{"n":102,"text":" * that went on to land.","atom":"a189","author":"pinch","version":26},{"n":103,"text":" */","atom":"a189","author":"pinch","version":26},{"n":104,"text":"export const PUBLISH_TIMEOUT_MS = 150_000;","atom":"a189","author":"pinch","version":26},{"n":105,"text":"","atom":"a189","author":"pinch","version":26},{"n":106,"text":"/** The most versions the server's log sends at once. */","atom":"a189","author":"pinch","version":26},{"n":107,"text":"export const LOG_PAGE = 200;","atom":"a189","author":"pinch","version":26},{"n":108,"text":"","atom":"a189","author":"pinch","version":26},{"n":109,"text":"/** A query string from the values that are set (null and undefined are left out). */","atom":"a0","author":"init","version":0},{"n":110,"text":"function query(values: Record<string, string | number | null | undefined>): URLSearchParams {","atom":"a0","author":"init","version":0},{"n":111,"text":"\tconst q = new URLSearchParams();","atom":"a0","author":"init","version":0},{"n":112,"text":"\tfor (const [k, v] of Object.entries(values)) if (v !== null && v !== undefined) q.set(k, String(v));","atom":"a0","author":"init","version":0},{"n":113,"text":"\treturn q;","atom":"a0","author":"init","version":0},{"n":114,"text":"}","atom":"a0","author":"init","version":0},{"n":115,"text":"","atom":"a0","author":"init","version":0},{"n":116,"text":"export function newsLines(news: News): string[] {","atom":"a0","author":"init","version":0},{"n":117,"text":"\tif (news === undefined || news === null) return [];","atom":"a0","author":"init","version":0},{"n":118,"text":"\treturn (typeof news === \"string\" ? [news] : [...news]).filter((s) => typeof s === \"string\" && s.trim() !== \"\");","atom":"a0","author":"init","version":0},{"n":119,"text":"}","atom":"a0","author":"init","version":0},{"n":120,"text":"","atom":"a0","author":"init","version":0},{"n":121,"text":"/** An issue copy's request: the source, and any texts given cleaned, by their source ids. */","atom":"a163","author":"pinch","version":23},{"n":122,"text":"export interface CopyBody {","atom":"a163","author":"pinch","version":23},{"n":123,"text":"\tfrom: string;","atom":"a163","author":"pinch","version":23},{"n":124,"text":"\tissue: number;","atom":"a163","author":"pinch","version":23},{"n":125,"text":"\ttitle?: string;","atom":"a163","author":"pinch","version":23},{"n":126,"text":"\tdescription?: string;","atom":"a163","author":"pinch","version":23},{"n":127,"text":"\tcomments?: { id: number; text?: string }[];","atom":"a163","author":"pinch","version":23},{"n":128,"text":"\tasks?: { id: number; question?: string; answer?: string }[];","atom":"a163","author":"pinch","version":23},{"n":129,"text":"}","atom":"a163","author":"pinch","version":23},{"n":130,"text":"","atom":"a163","author":"pinch","version":23},{"n":131,"text":"/** What a copy writes, as a dry run answers it. */","atom":"a163","author":"pinch","version":23},{"n":132,"text":"export interface CopyPlan {","atom":"a163","author":"pinch","version":23},{"n":133,"text":"\tfrom: { project: string; issue: number };","atom":"a163","author":"pinch","version":23},{"n":134,"text":"\ttitle: string;","atom":"a163","author":"pinch","version":23},{"n":135,"text":"\tedited: (\"title\" | \"description\")[];","atom":"a163","author":"pinch","version":23},{"n":136,"text":"\tlabels: string[];","atom":"a163","author":"pinch","version":23},{"n":137,"text":"\tclosed: { how: \"done\" | \"dropped\" } | null;","atom":"a163","author":"pinch","version":23},{"n":138,"text":"\tcomments: { edited: boolean }[];","atom":"a163","author":"pinch","version":23},{"n":139,"text":"\tasks: { edited: boolean }[];","atom":"a163","author":"pinch","version":23},{"n":140,"text":"\tskipped: { comments: number[]; asks: number[] };","atom":"a163","author":"pinch","version":23},{"n":141,"text":"}","atom":"a163","author":"pinch","version":23},{"n":142,"text":"","atom":"a163","author":"pinch","version":23},{"n":143,"text":"export type CopyAnswer =","atom":"a163","author":"pinch","version":23},{"n":144,"text":"\t| { dryRun: true; plan: CopyPlan }","atom":"a163","author":"pinch","version":23},{"n":145,"text":"\t| { ok: true; id: number; from: { project: string; issue: number }; skipped: { comments: number[]; asks: number[] } };","atom":"a163","author":"pinch","version":23},{"n":146,"text":"","atom":"a163","author":"pinch","version":23},{"n":147,"text":"/**","atom":"a2741","author":"groups","version":277},{"n":148,"text":" * The server's line when another chat just used this seat (seatNotice on an answer): kept until main() prints it with","atom":"a2741","author":"groups","version":277},{"n":149,"text":" * the news, once however many answers carried it.","atom":"a2741","author":"groups","version":277},{"n":150,"text":" */","atom":"a2741","author":"groups","version":277},{"n":151,"text":"const seatNotices = new Set<string>();","atom":"a2741","author":"groups","version":277},{"n":152,"text":"function noteSeat(answer: unknown): void {","atom":"a2741","author":"groups","version":277},{"n":153,"text":"\tif (typeof answer !== \"object\" || answer === null || Array.isArray(answer)) return;","atom":"a2741","author":"groups","version":277},{"n":154,"text":"\tconst line = (answer as { seatNotice?: unknown }).seatNotice;","atom":"a2741","author":"groups","version":277},{"n":155,"text":"\tif (typeof line === \"string\" && line !== \"\" && line.length <= 300 && !/[\\u0000-\\u001f]/.test(line))","atom":"a2741","author":"groups","version":277},{"n":156,"text":"\t\tseatNotices.add(line);","atom":"a2741","author":"groups","version":277},{"n":157,"text":"}","atom":"a2741","author":"groups","version":277},{"n":158,"text":"export function takeSeatNotices(): string[] {","atom":"a2741","author":"groups","version":277},{"n":159,"text":"\tconst out = [...seatNotices];","atom":"a2741","author":"groups","version":277},{"n":160,"text":"\tseatNotices.clear();","atom":"a2741","author":"groups","version":277},{"n":161,"text":"\treturn out;","atom":"a2741","author":"groups","version":277},{"n":162,"text":"}","atom":"a2741","author":"groups","version":277},{"n":163,"text":"","atom":"a2741","author":"groups","version":277},{"n":164,"text":"export class Api {","atom":"a0","author":"init","version":0},{"n":165,"text":"\treadonly config: Config;","atom":"a0","author":"init","version":0},{"n":166,"text":"\treadonly timeoutMs: number;","atom":"a0","author":"init","version":0},{"n":167,"text":"","atom":"a0","author":"init","version":0},{"n":168,"text":"\t/** Waits between tries when a run's stream breaks; tests shorten them. */","atom":"a0","author":"init","version":0},{"n":169,"text":"\treadonly reconnectDelaysMs: readonly number[];","atom":"a0","author":"init","version":0},{"n":170,"text":"\treadonly startRetryDelaysMs: readonly number[];","atom":"a0","author":"init","version":0},{"n":171,"text":"\t/** Another box of this agent for run, logs and fetch (--box or ABSO_BOX, #37); undefined is its own box. */","atom":"a198","author":"review","version":27},{"n":172,"text":"\tbox: string | undefined;","atom":"a0","author":"init","version":0},{"n":173,"text":"","atom":"a0","author":"init","version":0},{"n":174,"text":"\tconstructor(","atom":"a0","author":"init","version":0},{"n":175,"text":"\t\tconfig: Config,","atom":"a0","author":"init","version":0},{"n":176,"text":"\t\ttimeoutMs = 30_000,","atom":"a0","author":"init","version":0},{"n":177,"text":"\t\treconnectDelaysMs: readonly number[] = RECONNECT_DELAYS_MS,","atom":"a0","author":"init","version":0},{"n":178,"text":"\t\tstartRetryDelaysMs: readonly number[] = RUN_START_RETRY_MS,","atom":"a0","author":"init","version":0},{"n":179,"text":"\t) {","atom":"a0","author":"init","version":0},{"n":180,"text":"\t\tthis.config = config;","atom":"a0","author":"init","version":0},{"n":181,"text":"\t\tthis.timeoutMs = timeoutMs;","atom":"a0","author":"init","version":0},{"n":182,"text":"\t\tthis.reconnectDelaysMs = reconnectDelaysMs;","atom":"a0","author":"init","version":0},{"n":183,"text":"\t\tthis.startRetryDelaysMs = startRetryDelaysMs;","atom":"a0","author":"init","version":0},{"n":184,"text":"\t}","atom":"a0","author":"init","version":0},{"n":185,"text":"","atom":"a0","author":"init","version":0},{"n":186,"text":"\t/** What a box run is for, for the server's box-run records (#39): X-Abso-Kind on POST /run. */","atom":"a491","author":"pinch","version":54},{"n":187,"text":"\trunKind: RunKind = \"run\";","atom":"a0","author":"init","version":0},{"n":188,"text":"","atom":"a0","author":"init","version":0},{"n":189,"text":"\t/** The Issues Worker (#54) this folder's issues calls go to; set by the issues commands (issues.ts). */","atom":"a0","author":"init","version":0},{"n":190,"text":"\tissuesServer: string | undefined;","atom":"a0","author":"init","version":0},{"n":191,"text":"","atom":"a2741","author":"groups","version":277},{"n":192,"text":"\t/** Who is calling this seat (src/caller.ts): this chat's session, this computer and this folder. Set by open(). */","atom":"a2741","author":"groups","version":277},{"n":193,"text":"\tcaller: string | undefined;","atom":"a2741","author":"groups","version":277},{"n":194,"text":"","atom":"a0","author":"init","version":0},{"n":195,"text":"\turl(path: string, server = this.config.server): string {","atom":"a0","author":"init","version":0},{"n":196,"text":"\t\tconst base = isLocal(server) ? LOCAL_BASE : server;","atom":"a2819","author":"pinch","version":287},{"n":197,"text":"\t\treturn `${base.replace(/\\/+$/, \"\")}/p/${encodeURIComponent(this.config.project)}${path}`;","atom":"a2819","author":"pinch","version":287},{"n":198,"text":"\t}","atom":"a0","author":"init","version":0},{"n":199,"text":"","atom":"a0","author":"init","version":0},{"n":200,"text":"\t/** A local project's calls: answered in this process (local-store.ts). */","atom":"a2819","author":"pinch","version":287},{"n":201,"text":"\tprivate local: ((input: string, init?: RequestInit) => Promise<Response>) | undefined;","atom":"a2819","author":"pinch","version":287},{"n":202,"text":"","atom":"a2819","author":"pinch","version":287},{"n":203,"text":"\tagentPath(action: string): string {","atom":"a0","author":"init","version":0},{"n":204,"text":"\t\treturn `/a/${encodeURIComponent(this.config.agent)}/${action}`;","atom":"a0","author":"init","version":0},{"n":205,"text":"\t}","atom":"a0","author":"init","version":0},{"n":206,"text":"","atom":"a0","author":"init","version":0},{"n":207,"text":"\theaders(contentType?: string): Record<string, string> {","atom":"a0","author":"init","version":0},{"n":208,"text":"\t\treturn {","atom":"a0","author":"init","version":0},{"n":209,"text":"\t\t\t// Which client made the call (#29); the mods send theirs too.","atom":"a0","author":"init","version":0},{"n":210,"text":"\t\t\t\"x-abso-client\": `abso-cli/${clientVersion()}`,","atom":"a491","author":"pinch","version":54},{"n":211,"text":"\t\t\t...(this.config.token && !this.config.visitor ? { authorization: `Bearer ${this.config.token}` } : {}),","atom":"a764","author":"pinch","version":86},{"n":212,"text":"\t\t\t// A visitor says nothing about where it's reading from.","atom":"a2741","author":"groups","version":277},{"n":213,"text":"\t\t\t...(this.caller !== undefined && !this.config.visitor ? { [CALLER_HEADER]: this.caller } : {}),","atom":"a2741","author":"groups","version":277},{"n":214,"text":"\t\t\t...(contentType ? { \"content-type\": contentType } : {}),","atom":"a0","author":"init","version":0},{"n":215,"text":"\t\t};","atom":"a0","author":"init","version":0},{"n":216,"text":"\t}","atom":"a0","author":"init","version":0},{"n":217,"text":"","atom":"a0","author":"init","version":0},{"n":218,"text":"\t/**","atom":"a782","author":"pinch","version":88},{"n":219,"text":"\t * Every request this Api makes goes through here. In a visitor folder it never sends anything but a GET,","atom":"a782","author":"pinch","version":88},{"n":220,"text":"\t * and follows no redirect, so nothing it sends goes anywhere it didn't name (headers() adds no sign-in).","atom":"a782","author":"pinch","version":88},{"n":221,"text":"\t */","atom":"a782","author":"pinch","version":88},{"n":222,"text":"\tsend(url: string, init: RequestInit = {}): Promise<Response> {","atom":"a782","author":"pinch","version":88},{"n":223,"text":"\t\tif (isLocal(this.config.server)) {","atom":"a2819","author":"pinch","version":287},{"n":224,"text":"\t\t\tconst dir = this.config.localStore;","atom":"a2819","author":"pinch","version":287},{"n":225,"text":"\t\t\tif (dir === undefined) return Promise.reject(new UsageError(NO_STORE));","atom":"a2819","author":"pinch","version":287},{"n":226,"text":"\t\t\tthis.local ??= localFetch(dir);","atom":"a2819","author":"pinch","version":287},{"n":227,"text":"\t\t\treturn this.local(url, init);","atom":"a2819","author":"pinch","version":287},{"n":228,"text":"\t\t}","atom":"a2819","author":"pinch","version":287},{"n":229,"text":"\t\tif (!this.config.visitor) return fetch(url, init);","atom":"a782","author":"pinch","version":88},{"n":230,"text":"\t\tif ((init.method ?? \"GET\") !== \"GET\")","atom":"a782","author":"pinch","version":88},{"n":231,"text":"\t\t\treturn Promise.reject(new ApiError(\"a folder that reads signed out sends only reads\"));","atom":"a782","author":"pinch","version":88},{"n":232,"text":"\t\treturn fetch(url, { ...init, redirect: \"error\" });","atom":"a782","author":"pinch","version":88},{"n":233,"text":"\t}","atom":"a782","author":"pinch","version":88},{"n":234,"text":"","atom":"a782","author":"pinch","version":88},{"n":235,"text":"\tasync json<T>(","atom":"a189","author":"pinch","version":26},{"n":236,"text":"\t\tmethod: \"GET\" | \"POST\",","atom":"a189","author":"pinch","version":26},{"n":237,"text":"\t\tpath: string,","atom":"a189","author":"pinch","version":26},{"n":238,"text":"\t\tbody?: unknown,","atom":"a189","author":"pinch","version":26},{"n":239,"text":"\t\tserver = this.config.server,","atom":"a189","author":"pinch","version":26},{"n":240,"text":"\t\tatLeastMs = 0,","atom":"a189","author":"pinch","version":26},{"n":241,"text":"\t): Promise<T> {","atom":"a189","author":"pinch","version":26},{"n":242,"text":"\t\tlet res: Response | undefined;","atom":"a0","author":"init","version":0},{"n":243,"text":"\t\tif (this.config.visitor && method !== \"GET\")","atom":"a782","author":"pinch","version":88},{"n":244,"text":"\t\t\tthrow new ApiError(`${path}: a folder that reads signed out sends only reads`);","atom":"a782","author":"pinch","version":88},{"n":245,"text":"\t\tconst sent = body === undefined ? undefined : JSON.stringify(body);","atom":"a0","author":"init","version":0},{"n":246,"text":"\t\tconst requestId = method === \"POST\" ? randomUUID() : undefined;","atom":"a1656","author":"codex-capacity-chair","version":162},{"n":247,"text":"\t\tconst timeoutMs = Math.max(atLeastMs, timeoutFor(this.timeoutMs, sent));","atom":"a189","author":"pinch","version":26},{"n":248,"text":"\t\t// A connection that never opened is tried once more, IPv4 first (#37, GAME - UI/UX: one IPv6","atom":"a0","author":"init","version":0},{"n":249,"text":"\t\t// address timed out, and the same command went through seconds later). Nothing went out, so","atom":"a0","author":"init","version":0},{"n":250,"text":"\t\t// a POST is as safe to send again as a GET.","atom":"a0","author":"init","version":0},{"n":251,"text":"\t\tfor (let attempt = 0; res === undefined; attempt++) {","atom":"a0","author":"init","version":0},{"n":252,"text":"\t\t\ttry {","atom":"a0","author":"init","version":0},{"n":253,"text":"\t\t\t\tres = await this.send(this.url(path, server), {","atom":"a782","author":"pinch","version":88},{"n":254,"text":"\t\t\t\t\tmethod,","atom":"a0","author":"init","version":0},{"n":255,"text":"\t\t\t\t\theaders: {","atom":"a1656","author":"codex-capacity-chair","version":162},{"n":256,"text":"\t\t\t\t\t\t...this.headers(sent === undefined ? undefined : \"application/json\"),","atom":"a1656","author":"codex-capacity-chair","version":162},{"n":257,"text":"\t\t\t\t\t\t...(requestId ? { \"Idempotency-Key\": requestId } : {}),","atom":"a1656","author":"codex-capacity-chair","version":162},{"n":258,"text":"\t\t\t\t\t},","atom":"a1656","author":"codex-capacity-chair","version":162},{"n":259,"text":"\t\t\t\t\t...(sent === undefined ? {} : { body: sent }),","atom":"a0","author":"init","version":0},{"n":260,"text":"\t\t\t\t\tsignal: AbortSignal.timeout(timeoutMs),","atom":"a0","author":"init","version":0},{"n":261,"text":"\t\t\t\t});","atom":"a0","author":"init","version":0},{"n":262,"text":"\t\t\t} catch (err) {","atom":"a0","author":"init","version":0},{"n":263,"text":"\t\t\t\t// A local project's refusal (no store, a Node without SQLite) says itself.","atom":"a2819","author":"pinch","version":287},{"n":264,"text":"\t\t\t\tif (err instanceof UsageError) throw err;","atom":"a2819","author":"pinch","version":287},{"n":265,"text":"\t\t\t\tconst e = err as Error;","atom":"a0","author":"init","version":0},{"n":266,"text":"\t\t\t\tconst why =","atom":"a0","author":"init","version":0},{"n":267,"text":"\t\t\t\t\te.name === \"TimeoutError\"","atom":"a0","author":"init","version":0},{"n":268,"text":"\t\t\t\t\t\t? `no answer within ${timeoutMs} ms`","atom":"a0","author":"init","version":0},{"n":269,"text":"\t\t\t\t\t\t: ((e.cause as Error | undefined)?.message ?? e.message);","atom":"a0","author":"init","version":0},{"n":270,"text":"\t\t\t\tif (!neverSent(err)) throw new ApiError(`could not reach ${server}: ${why}`);","atom":"a0","author":"init","version":0},{"n":271,"text":"\t\t\t\tif (attempt >= 1) {","atom":"a0","author":"init","version":0},{"n":272,"text":"\t\t\t\t\tthrow new ApiError(","atom":"a0","author":"init","version":0},{"n":273,"text":"\t\t\t\t\t\t`could not reach ${server}: ${why}. Tried twice, the second time IPv4 first; the connection never opened, so nothing reached the server`,","atom":"a0","author":"init","version":0},{"n":274,"text":"\t\t\t\t\t\tundefined,","atom":"a0","author":"init","version":0},{"n":275,"text":"\t\t\t\t\t\ttrue,","atom":"a0","author":"init","version":0},{"n":276,"text":"\t\t\t\t\t);","atom":"a0","author":"init","version":0},{"n":277,"text":"\t\t\t\t}","atom":"a0","author":"init","version":0},{"n":278,"text":"\t\t\t\tsetDefaultResultOrder(\"ipv4first\");","atom":"a0","author":"init","version":0},{"n":279,"text":"\t\t\t\tawait new Promise((ok) => setTimeout(ok, 500));","atom":"a0","author":"init","version":0},{"n":280,"text":"\t\t\t}","atom":"a0","author":"init","version":0},{"n":281,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":282,"text":"\t\tlet text: string;","atom":"a964","author":"codex-prose-authorship-1","version":108},{"n":283,"text":"\t\ttry {","atom":"a964","author":"codex-prose-authorship-1","version":108},{"n":284,"text":"\t\t\ttext = await res.text();","atom":"a964","author":"codex-prose-authorship-1","version":108},{"n":285,"text":"\t\t} catch (err) {","atom":"a964","author":"codex-prose-authorship-1","version":108},{"n":286,"text":"\t\t\tconst reason = err instanceof Error ? err.message : String(err);","atom":"a964","author":"codex-prose-authorship-1","version":108},{"n":287,"text":"\t\t\tthrow new ApiError(`${method} ${path} response body ended unexpectedly: ${reason}`, res.status);","atom":"a964","author":"codex-prose-authorship-1","version":108},{"n":288,"text":"\t\t}","atom":"a964","author":"codex-prose-authorship-1","version":108},{"n":289,"text":"\t\t// 409 is a refusal that says what to do (a drop took out lines your work builds on): print it as it is.","atom":"a0","author":"init","version":0},{"n":290,"text":"\t\tif (!res.ok)","atom":"a0","author":"init","version":0},{"n":291,"text":"\t\t\tthrow new ApiError(","atom":"a0","author":"init","version":0},{"n":292,"text":"\t\t\t\tres.status === 409","atom":"a0","author":"init","version":0},{"n":293,"text":"\t\t\t\t\t? `refused: ${errorSentence(text)}`","atom":"a0","author":"init","version":0},{"n":294,"text":"\t\t\t\t\t: `${method} ${path} answered ${res.status}: ${errorSentence(text)}`,","atom":"a0","author":"init","version":0},{"n":295,"text":"\t\t\t\tres.status,","atom":"a0","author":"init","version":0},{"n":296,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":297,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":298,"text":"\t\t\tconst parsed = JSON.parse(text) as T;","atom":"a2741","author":"groups","version":277},{"n":299,"text":"\t\t\tnoteSeat(parsed);","atom":"a2741","author":"groups","version":277},{"n":300,"text":"\t\t\treturn parsed;","atom":"a2741","author":"groups","version":277},{"n":301,"text":"\t\t} catch {","atom":"a0","author":"init","version":0},{"n":302,"text":"\t\t\tthrow new ApiError(","atom":"a0","author":"init","version":0},{"n":303,"text":"\t\t\t\t`${method} ${path} answered with something that isn't JSON: ${text.slice(0, 300)}`,","atom":"a0","author":"init","version":0},{"n":304,"text":"\t\t\t\tres.status,","atom":"a0","author":"init","version":0},{"n":305,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":306,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":307,"text":"\t}","atom":"a0","author":"init","version":0},{"n":308,"text":"","atom":"a0","author":"init","version":0},{"n":309,"text":"\tinit(","atom":"a0","author":"init","version":0},{"n":310,"text":"\t\tfiles: Record<string, string>,","atom":"a0","author":"init","version":0},{"n":311,"text":"\t\tmodes: Modes = {},","atom":"a0","author":"init","version":0},{"n":312,"text":"\t\tblobs: Readonly<Record<string, string>> = {},","atom":"a0","author":"init","version":0},{"n":313,"text":"\t): Promise<{ version: number; skipped?: readonly string[] }> {","atom":"a0","author":"init","version":0},{"n":314,"text":"\t\treturn this.json(\"POST\", \"/init\", {","atom":"a0","author":"init","version":0},{"n":315,"text":"\t\t\tfiles,","atom":"a0","author":"init","version":0},{"n":316,"text":"\t\t\t...(Object.keys(modes).length > 0 ? { modes } : {}),","atom":"a0","author":"init","version":0},{"n":317,"text":"\t\t\t...(Object.keys(blobs).length > 0 ? { blobs } : {}),","atom":"a0","author":"init","version":0},{"n":318,"text":"\t\t});","atom":"a0","author":"init","version":0},{"n":319,"text":"\t}","atom":"a0","author":"init","version":0},{"n":320,"text":"","atom":"a0","author":"init","version":0},{"n":321,"text":"\tedit(body: EditBody): Promise<EditAnswer> {","atom":"a0","author":"init","version":0},{"n":322,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"edit\"), body);","atom":"a0","author":"init","version":0},{"n":323,"text":"\t}","atom":"a0","author":"init","version":0},{"n":324,"text":"","atom":"a0","author":"init","version":0},{"n":325,"text":"\trecord(","atom":"a0","author":"init","version":0},{"n":326,"text":"\t\tfiles: Record<string, string | null>,","atom":"a0","author":"init","version":0},{"n":327,"text":"\t\textra: { session?: string; subagent?: string } = {},","atom":"a0","author":"init","version":0},{"n":328,"text":"\t\tmodes: Modes = {},","atom":"a0","author":"init","version":0},{"n":329,"text":"\t\tblobs: Readonly<Record<string, string>> = {},","atom":"a0","author":"init","version":0},{"n":330,"text":"\t): Promise<RecordAnswer> {","atom":"a0","author":"init","version":0},{"n":331,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"record\"), {","atom":"a0","author":"init","version":0},{"n":332,"text":"\t\t\tfiles,","atom":"a0","author":"init","version":0},{"n":333,"text":"\t\t\t...(Object.keys(modes).length > 0 ? { modes } : {}),","atom":"a0","author":"init","version":0},{"n":334,"text":"\t\t\t...(Object.keys(blobs).length > 0 ? { blobs } : {}),","atom":"a0","author":"init","version":0},{"n":335,"text":"\t\t\t...extra,","atom":"a0","author":"init","version":0},{"n":336,"text":"\t\t});","atom":"a0","author":"init","version":0},{"n":337,"text":"\t}","atom":"a0","author":"init","version":0},{"n":338,"text":"","atom":"a0","author":"init","version":0},{"n":339,"text":"\t/** Move a file in the draft (#49): its lines keep their ids. The way to change a file's case. */","atom":"a0","author":"init","version":0},{"n":340,"text":"\tmove(from: string, to: string): Promise<{ ok: boolean; from: string; to: string; news?: News }> {","atom":"a0","author":"init","version":0},{"n":341,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"move\"), { from, to });","atom":"a0","author":"init","version":0},{"n":342,"text":"\t}","atom":"a0","author":"init","version":0},{"n":343,"text":"","atom":"a0","author":"init","version":0},{"n":344,"text":"\t/** Upload a binary file's bytes under their sha256 (the server checks the hash). */","atom":"a0","author":"init","version":0},{"n":345,"text":"\tasync putBlob(sha: string, bytes: Uint8Array): Promise<void> {","atom":"a0","author":"init","version":0},{"n":346,"text":"\t\tawait this.bytes(\"PUT\", `/blobs/${sha}`, bytes);","atom":"a0","author":"init","version":0},{"n":347,"text":"\t}","atom":"a0","author":"init","version":0},{"n":348,"text":"","atom":"a0","author":"init","version":0},{"n":349,"text":"\t/** A preview of one version of shared at a stable URL (abso serve, #37); a build answers 422 with its output. */","atom":"a0","author":"init","version":0},{"n":350,"text":"\tasync serve(version?: number, cmd?: string, out?: string): Promise<ServeAnswer> {","atom":"a0","author":"init","version":0},{"n":351,"text":"\t\tconst q = new URLSearchParams({","atom":"a0","author":"init","version":0},{"n":352,"text":"\t\t\t...(version !== undefined ? { version: String(version) } : {}),","atom":"a0","author":"init","version":0},{"n":353,"text":"\t\t\t...(cmd ? { cmd } : {}),","atom":"a0","author":"init","version":0},{"n":354,"text":"\t\t\t...(out ? { out } : {}),","atom":"a0","author":"init","version":0},{"n":355,"text":"\t\t});","atom":"a0","author":"init","version":0},{"n":356,"text":"\t\tlet res: Response;","atom":"a0","author":"init","version":0},{"n":357,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":358,"text":"\t\t\tres = await this.send(`${this.url(\"/serve\")}?${q}`, {","atom":"a782","author":"pinch","version":88},{"n":359,"text":"\t\t\t\tmethod: \"POST\",","atom":"a0","author":"init","version":0},{"n":360,"text":"\t\t\t\theaders: this.headers(),","atom":"a0","author":"init","version":0},{"n":361,"text":"\t\t\t\tsignal: AbortSignal.timeout(20 * 60_000),","atom":"a0","author":"init","version":0},{"n":362,"text":"\t\t\t});","atom":"a0","author":"init","version":0},{"n":363,"text":"\t\t} catch (err) {","atom":"a0","author":"init","version":0},{"n":364,"text":"\t\t\tconst e = err as Error;","atom":"a0","author":"init","version":0},{"n":365,"text":"\t\t\tthrow new ApiError(","atom":"a0","author":"init","version":0},{"n":366,"text":"\t\t\t\t`could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,","atom":"a0","author":"init","version":0},{"n":367,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":368,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":369,"text":"\t\tconst text = await res.text();","atom":"a0","author":"init","version":0},{"n":370,"text":"\t\tif (!res.ok && res.status !== 422)","atom":"a0","author":"init","version":0},{"n":371,"text":"\t\t\tthrow new ApiError(`serve answered ${res.status}: ${errorSentence(text)}`, res.status);","atom":"a0","author":"init","version":0},{"n":372,"text":"\t\treturn JSON.parse(text) as ServeAnswer;","atom":"a0","author":"init","version":0},{"n":373,"text":"\t}","atom":"a0","author":"init","version":0},{"n":374,"text":"","atom":"a0","author":"init","version":0},{"n":375,"text":"\t/** Runs a setup command on the folder in a fresh box and keeps the box as what it starts from (abso prep, #37). */","atom":"a0","author":"init","version":0},{"n":376,"text":"\tasync prep(command: string, tarGz: Uint8Array<ArrayBuffer>): Promise<PrepAnswer> {","atom":"a0","author":"init","version":0},{"n":377,"text":"\t\tlet res: Response;","atom":"a0","author":"init","version":0},{"n":378,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":379,"text":"\t\t\tres = await this.send(","atom":"a782","author":"pinch","version":88},{"n":380,"text":"\t\t\t\t`${this.url(this.agentPath(\"prep\"))}?cmd=${encodeURIComponent(command)}${boxQuery(this.box)}`,","atom":"a782","author":"pinch","version":88},{"n":381,"text":"\t\t\t\t{","atom":"a782","author":"pinch","version":88},{"n":382,"text":"\t\t\t\t\tmethod: \"POST\",","atom":"a782","author":"pinch","version":88},{"n":383,"text":"\t\t\t\t\theaders: this.headers(\"application/gzip\"),","atom":"a782","author":"pinch","version":88},{"n":384,"text":"\t\t\t\t\tbody: tarGz,","atom":"a782","author":"pinch","version":88},{"n":385,"text":"\t\t\t\t\t// A setup command can take minutes (npm ci, a browser download).","atom":"a782","author":"pinch","version":88},{"n":386,"text":"\t\t\t\t\tsignal: AbortSignal.timeout(30 * 60_000),","atom":"a782","author":"pinch","version":88},{"n":387,"text":"\t\t\t\t},","atom":"a782","author":"pinch","version":88},{"n":388,"text":"\t\t\t);","atom":"a782","author":"pinch","version":88},{"n":389,"text":"\t\t} catch (err) {","atom":"a0","author":"init","version":0},{"n":390,"text":"\t\t\tconst e = err as Error;","atom":"a0","author":"init","version":0},{"n":391,"text":"\t\t\tthrow new ApiError(","atom":"a0","author":"init","version":0},{"n":392,"text":"\t\t\t\t`could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,","atom":"a0","author":"init","version":0},{"n":393,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":394,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":395,"text":"\t\tconst text = await res.text();","atom":"a0","author":"init","version":0},{"n":396,"text":"\t\tif (!res.ok) throw new ApiError(`prep answered ${res.status}: ${errorSentence(text)}`, res.status);","atom":"a0","author":"init","version":0},{"n":397,"text":"\t\treturn JSON.parse(text) as PrepAnswer;","atom":"a0","author":"init","version":0},{"n":398,"text":"\t}","atom":"a0","author":"init","version":0},{"n":399,"text":"","atom":"a0","author":"init","version":0},{"n":400,"text":"\t/** Forgets the box's prep: it starts from the plain image again. Answers whether it had one. */","atom":"a0","author":"init","version":0},{"n":401,"text":"\tasync unprep(): Promise<boolean> {","atom":"a0","author":"init","version":0},{"n":402,"text":"\t\tlet res: Response;","atom":"a0","author":"init","version":0},{"n":403,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":404,"text":"\t\t\tres = await this.send(","atom":"a782","author":"pinch","version":88},{"n":405,"text":"\t\t\t\t`${this.url(this.agentPath(\"prep\"))}${this.box ? `?box=${encodeURIComponent(this.box)}` : \"\"}`,","atom":"a0","author":"init","version":0},{"n":406,"text":"\t\t\t\t{ method: \"DELETE\", headers: this.headers(), signal: AbortSignal.timeout(this.timeoutMs) },","atom":"a0","author":"init","version":0},{"n":407,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":408,"text":"\t\t} catch (err) {","atom":"a0","author":"init","version":0},{"n":409,"text":"\t\t\tconst e = err as Error;","atom":"a0","author":"init","version":0},{"n":410,"text":"\t\t\tthrow new ApiError(","atom":"a0","author":"init","version":0},{"n":411,"text":"\t\t\t\t`could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,","atom":"a0","author":"init","version":0},{"n":412,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":413,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":414,"text":"\t\tconst text = await res.text();","atom":"a0","author":"init","version":0},{"n":415,"text":"\t\tif (!res.ok) throw new ApiError(`prep answered ${res.status}: ${errorSentence(text)}`, res.status);","atom":"a0","author":"init","version":0},{"n":416,"text":"\t\treturn (JSON.parse(text) as { forgot: boolean }).forgot;","atom":"a0","author":"init","version":0},{"n":417,"text":"\t}","atom":"a0","author":"init","version":0},{"n":418,"text":"","atom":"a0","author":"init","version":0},{"n":419,"text":"\t/** A binary file's bytes by their sha256. */","atom":"a0","author":"init","version":0},{"n":420,"text":"\t/** A tar.gz of the files under the box's /w that match a glob (bash globstar); null when none match or the box has stopped. */","atom":"a0","author":"init","version":0},{"n":421,"text":"\tasync boxFiles(glob: string): Promise<Uint8Array | null> {","atom":"a0","author":"init","version":0},{"n":422,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":423,"text":"\t\t\treturn await this.bytes(","atom":"a0","author":"init","version":0},{"n":424,"text":"\t\t\t\t\"GET\",","atom":"a0","author":"init","version":0},{"n":425,"text":"\t\t\t\t`${this.agentPath(\"box-files\")}?${new URLSearchParams({ glob, ...(this.box ? { box: this.box } : {}) })}`,","atom":"a0","author":"init","version":0},{"n":426,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":427,"text":"\t\t} catch (err) {","atom":"a0","author":"init","version":0},{"n":428,"text":"\t\t\tif (err instanceof ApiError && err.status === 404) return null;","atom":"a0","author":"init","version":0},{"n":429,"text":"\t\t\tthrow err;","atom":"a0","author":"init","version":0},{"n":430,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":431,"text":"\t}","atom":"a0","author":"init","version":0},{"n":432,"text":"","atom":"a0","author":"init","version":0},{"n":433,"text":"\tgetBlob(sha: string): Promise<Uint8Array> {","atom":"a0","author":"init","version":0},{"n":434,"text":"\t\treturn this.bytes(\"GET\", `/blobs/${sha}`);","atom":"a0","author":"init","version":0},{"n":435,"text":"\t}","atom":"a0","author":"init","version":0},{"n":436,"text":"","atom":"a0","author":"init","version":0},{"n":437,"text":"\tasync bytes(method: \"GET\" | \"PUT\", path: string, body?: Uint8Array): Promise<Uint8Array> {","atom":"a0","author":"init","version":0},{"n":438,"text":"\t\tlet res: Response;","atom":"a0","author":"init","version":0},{"n":439,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":440,"text":"\t\t\tres = await this.send(this.url(path), {","atom":"a782","author":"pinch","version":88},{"n":441,"text":"\t\t\t\tmethod,","atom":"a0","author":"init","version":0},{"n":442,"text":"\t\t\t\theaders: this.headers(body === undefined ? undefined : \"application/octet-stream\"),","atom":"a0","author":"init","version":0},{"n":443,"text":"\t\t\t\t...(body === undefined ? {} : { body: body as Uint8Array<ArrayBuffer> }),","atom":"a0","author":"init","version":0},{"n":444,"text":"\t\t\t\tsignal: AbortSignal.timeout(Math.max(this.timeoutMs, 120_000)),","atom":"a0","author":"init","version":0},{"n":445,"text":"\t\t\t});","atom":"a0","author":"init","version":0},{"n":446,"text":"\t\t} catch (err) {","atom":"a0","author":"init","version":0},{"n":447,"text":"\t\t\tconst e = err as Error;","atom":"a0","author":"init","version":0},{"n":448,"text":"\t\t\tthrow new ApiError(","atom":"a0","author":"init","version":0},{"n":449,"text":"\t\t\t\t`could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,","atom":"a0","author":"init","version":0},{"n":450,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":451,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":452,"text":"\t\tconst data = new Uint8Array(await res.arrayBuffer());","atom":"a0","author":"init","version":0},{"n":453,"text":"\t\tif (!res.ok)","atom":"a0","author":"init","version":0},{"n":454,"text":"\t\t\tthrow new ApiError(","atom":"a0","author":"init","version":0},{"n":455,"text":"\t\t\t\t`${method} ${path} answered ${res.status}: ${errorSentence(new TextDecoder().decode(data))}`,","atom":"a0","author":"init","version":0},{"n":456,"text":"\t\t\t\tres.status,","atom":"a0","author":"init","version":0},{"n":457,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":458,"text":"\t\treturn data;","atom":"a0","author":"init","version":0},{"n":459,"text":"\t}","atom":"a0","author":"init","version":0},{"n":460,"text":"","atom":"a0","author":"init","version":0},{"n":461,"text":"\t/** Make this agent a reader, or not (#37): a reader's edits, records and publishes are refused. */","atom":"a0","author":"init","version":0},{"n":462,"text":"\treader(on: boolean): Promise<{ agent: string; reader: boolean }> {","atom":"a0","author":"init","version":0},{"n":463,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"reader\"), { reader: on });","atom":"a0","author":"init","version":0},{"n":464,"text":"\t}","atom":"a0","author":"init","version":0},{"n":465,"text":"","atom":"a0","author":"init","version":0},{"n":466,"text":"\tpublish(message: string, asIs = false): Promise<PublishAnswer> {","atom":"a0","author":"init","version":0},{"n":467,"text":"\t\treturn this.json(","atom":"a189","author":"pinch","version":26},{"n":468,"text":"\t\t\t\"POST\",","atom":"a189","author":"pinch","version":26},{"n":469,"text":"\t\t\tthis.agentPath(\"publish\"),","atom":"a189","author":"pinch","version":26},{"n":470,"text":"\t\t\t{ message, ...(asIs ? { asIs: true } : {}) },","atom":"a189","author":"pinch","version":26},{"n":471,"text":"\t\t\tundefined,","atom":"a189","author":"pinch","version":26},{"n":472,"text":"\t\t\tPUBLISH_TIMEOUT_MS,","atom":"a189","author":"pinch","version":26},{"n":473,"text":"\t\t);","atom":"a189","author":"pinch","version":26},{"n":474,"text":"\t}","atom":"a0","author":"init","version":0},{"n":475,"text":"","atom":"a0","author":"init","version":0},{"n":476,"text":"\t/** One change (#44). */","atom":"a0","author":"init","version":0},{"n":477,"text":"\tchange(id: number): Promise<ChangeAnswer> {","atom":"a0","author":"init","version":0},{"n":478,"text":"\t\treturn this.json(\"GET\", `/change/${id}`);","atom":"a0","author":"init","version":0},{"n":479,"text":"\t}","atom":"a0","author":"init","version":0},{"n":480,"text":"","atom":"a0","author":"init","version":0},{"n":481,"text":"\t/** The changes with anything new at or after log position `since`, newest first (#44). */","atom":"a0","author":"init","version":0},{"n":482,"text":"\t/** Changes active since a log position, newest first; `older` is set when more come before the page (ask again with `before`). */","atom":"a0","author":"init","version":0},{"n":483,"text":"\tchanges(","atom":"a0","author":"init","version":0},{"n":484,"text":"\t\tsince: number,","atom":"a0","author":"init","version":0},{"n":485,"text":"\t\tlimit = 50,","atom":"a0","author":"init","version":0},{"n":486,"text":"\t\tbefore?: number,","atom":"a0","author":"init","version":0},{"n":487,"text":"\t): Promise<{ since: number; next: number; changes: readonly ChangeAnswer[]; older?: number }> {","atom":"a0","author":"init","version":0},{"n":488,"text":"\t\treturn this.json(\"GET\", `/changes?${query({ since, limit, before })}`);","atom":"a0","author":"init","version":0},{"n":489,"text":"\t}","atom":"a0","author":"init","version":0},{"n":490,"text":"","atom":"a0","author":"init","version":0},{"n":491,"text":"\t/** A call to the Issues Worker (#54), with the same token. */","atom":"a0","author":"init","version":0},{"n":492,"text":"\t#issues<T>(method: \"GET\" | \"POST\", path: string, body?: unknown): Promise<T> {","atom":"a0","author":"init","version":0},{"n":493,"text":"\t\tif (this.issuesServer === undefined)","atom":"a0","author":"init","version":0},{"n":494,"text":"\t\t\tthrow new ApiError(`${this.config.server} has no Issues Worker beside it; ABSO_ISSUES_SERVER names one`);","atom":"a198","author":"review","version":27},{"n":495,"text":"\t\treturn this.json(method, path, body, this.issuesServer);","atom":"a0","author":"init","version":0},{"n":496,"text":"\t}","atom":"a0","author":"init","version":0},{"n":497,"text":"","atom":"a0","author":"init","version":0},{"n":498,"text":"\t/** An ask-thread call, with a server from before ask threads named as that rather than a bare 404. */","atom":"a786","author":"pinch","version":89},{"n":499,"text":"\tasync #threads<T>(call: Promise<T>): Promise<T> {","atom":"a786","author":"pinch","version":89},{"n":500,"text":"\t\ttry {","atom":"a786","author":"pinch","version":89},{"n":501,"text":"\t\t\treturn await call;","atom":"a786","author":"pinch","version":89},{"n":502,"text":"\t\t} catch (err) {","atom":"a786","author":"pinch","version":89},{"n":503,"text":"\t\t\tif (err instanceof ApiError && err.status === 404 && /no such issues route/.test(err.message))","atom":"a786","author":"pinch","version":89},{"n":504,"text":"\t\t\t\tthrow new ApiError(`${this.config.server} doesn't have ask threads yet`, 404);","atom":"a786","author":"pinch","version":89},{"n":505,"text":"\t\t\tthrow err;","atom":"a786","author":"pinch","version":89},{"n":506,"text":"\t\t}","atom":"a786","author":"pinch","version":89},{"n":507,"text":"\t}","atom":"a786","author":"pinch","version":89},{"n":508,"text":"","atom":"a786","author":"pinch","version":89},{"n":509,"text":"\t/** Issues, most recently updated first. */","atom":"a0","author":"init","version":0},{"n":510,"text":"\tissues(","atom":"a0","author":"init","version":0},{"n":511,"text":"\t\tq: { status?: string; agent?: string; parent?: number; open?: boolean; labels?: readonly string[] } = {},","atom":"a0","author":"init","version":0},{"n":512,"text":"\t): Promise<{ issues: readonly IssueRow[] }> {","atom":"a0","author":"init","version":0},{"n":513,"text":"\t\treturn this.#issues(","atom":"a0","author":"init","version":0},{"n":514,"text":"\t\t\t\"GET\",","atom":"a0","author":"init","version":0},{"n":515,"text":"\t\t\t`/issues?${query({ status: q.status, agent: q.agent, parent: q.parent, open: q.open ? 1 : undefined, label: q.labels && q.labels.length > 0 ? q.labels.join(\",\") : undefined })}`,","atom":"a0","author":"init","version":0},{"n":516,"text":"\t\t);","atom":"a0","author":"init","version":0},{"n":517,"text":"\t}","atom":"a142","author":"devops","version":20},{"n":518,"text":"","atom":"a142","author":"devops","version":20},{"n":519,"text":"\t/**","atom":"a142","author":"devops","version":20},{"n":520,"text":"\t * The project's issues matching q, best first: by its words and, where","atom":"a142","author":"devops","version":20},{"n":521,"text":"\t * the server has it on, by what it means.","atom":"a142","author":"devops","version":20},{"n":522,"text":"\t */","atom":"a142","author":"devops","version":20},{"n":523,"text":"\tissueSearch(q: string, limit?: number): Promise<{ hits: readonly IssueSearchHit[] }> {","atom":"a142","author":"devops","version":20},{"n":524,"text":"\t\treturn this.#issues(\"GET\", `/search?${query({ q, limit })}`);","atom":"a142","author":"devops","version":20},{"n":525,"text":"\t}","atom":"a0","author":"init","version":0},{"n":526,"text":"","atom":"a0","author":"init","version":0},{"n":527,"text":"\t/** Every label in use, with how many issues have it and how many of those are open. */","atom":"a0","author":"init","version":0},{"n":528,"text":"\tissueLabels(): Promise<{ labels: readonly { label: string; open: number; total: number }[] }> {","atom":"a0","author":"init","version":0},{"n":529,"text":"\t\treturn this.#issues(\"GET\", \"/labels\");","atom":"a0","author":"init","version":0},{"n":530,"text":"\t}","atom":"a0","author":"init","version":0},{"n":531,"text":"","atom":"a0","author":"init","version":0},{"n":532,"text":"\tissue(id: number): Promise<IssuePage> {","atom":"a0","author":"init","version":0},{"n":533,"text":"\t\treturn this.#issues(\"GET\", `/issue/${id}`);","atom":"a0","author":"init","version":0},{"n":534,"text":"\t}","atom":"a0","author":"init","version":0},{"n":535,"text":"","atom":"a0","author":"init","version":0},{"n":536,"text":"\t/** The asks this agent sent: the open ones, then the latest answered, each with its thread. */","atom":"a658","author":"pinch","version":72},{"n":537,"text":"\tasked(): Promise<{ asks: readonly (Ask & { title: string | null })[] }> {","atom":"a658","author":"pinch","version":72},{"n":538,"text":"\t\treturn this.#threads(this.#issues(\"GET\", this.agentPath(\"asked\")));","atom":"a786","author":"pinch","version":89},{"n":539,"text":"\t}","atom":"a658","author":"pinch","version":72},{"n":540,"text":"","atom":"a658","author":"pinch","version":72},{"n":541,"text":"\t/** One ask, open or closed, with its thread and who it waits on. */","atom":"a658","author":"pinch","version":72},{"n":542,"text":"\taskThread(id: number): Promise<{ ask: Ask & { title: string | null } }> {","atom":"a658","author":"pinch","version":72},{"n":543,"text":"\t\treturn this.#threads(this.#issues(\"GET\", `/ask/${id}`));","atom":"a786","author":"pinch","version":89},{"n":544,"text":"\t}","atom":"a658","author":"pinch","version":72},{"n":545,"text":"","atom":"a658","author":"pinch","version":72},{"n":546,"text":"\t/** Open asks of someone (an agent, or person:<id>), soonest due first; every open ask without `of`. */","atom":"a0","author":"init","version":0},{"n":547,"text":"\twaiting(of?: string): Promise<{ asks: readonly (Ask & { title: string | null })[] }> {","atom":"a0","author":"init","version":0},{"n":548,"text":"\t\treturn this.#issues(\"GET\", `/waiting?${query({ of })}`);","atom":"a0","author":"init","version":0},{"n":549,"text":"\t}","atom":"a0","author":"init","version":0},{"n":550,"text":"","atom":"a0","author":"init","version":0},{"n":551,"text":"\t/** This agent's open asks; the Worker marks each it lists for the first time as seen (abso issue 124). */","atom":"a0","author":"init","version":0},{"n":552,"text":"\tasync waitingMine(): Promise<{ asks: readonly (Ask & { title: string | null })[] }> {","atom":"a0","author":"init","version":0},{"n":553,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":554,"text":"\t\t\treturn await this.#issues(\"GET\", this.agentPath(\"waiting\"));","atom":"a0","author":"init","version":0},{"n":555,"text":"\t\t} catch (err) {","atom":"a0","author":"init","version":0},{"n":556,"text":"\t\t\t// An Issues Worker from before 124 has no /a/:agent/ reads.","atom":"a0","author":"init","version":0},{"n":557,"text":"\t\t\tif (err instanceof ApiError && err.status === 404) return this.waiting(this.config.agent);","atom":"a0","author":"init","version":0},{"n":558,"text":"\t\t\tthrow err;","atom":"a0","author":"init","version":0},{"n":559,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":560,"text":"\t}","atom":"a0","author":"init","version":0},{"n":561,"text":"","atom":"a0","author":"init","version":0},{"n":562,"text":"\tissueOpen(body: DraftBody & { title: string; attachments?: string[] }): Promise<{ id: number; news?: IssueNews }> {","atom":"a24","author":"pinch","version":5},{"n":563,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(\"issue\"), body);","atom":"a0","author":"init","version":0},{"n":564,"text":"\t}","atom":"a0","author":"init","version":0},{"n":565,"text":"","atom":"a0","author":"init","version":0},{"n":566,"text":"\t/** Uploads an image to the Issues Worker (abso issue 171): it checks the type by the bytes, strips metadata and answers its id. */","atom":"a24","author":"pinch","version":5},{"n":567,"text":"\tasync attachmentUpload(bytes: Uint8Array, name: string): Promise<Attachment> {","atom":"a24","author":"pinch","version":5},{"n":568,"text":"\t\tif (this.issuesServer === undefined)","atom":"a24","author":"pinch","version":5},{"n":569,"text":"\t\t\tthrow new ApiError(`${this.config.server} has no Issues Worker beside it; ABSO_ISSUES_SERVER names one`);","atom":"a198","author":"review","version":27},{"n":570,"text":"\t\tconst path = this.agentPath(\"attachments\");","atom":"a24","author":"pinch","version":5},{"n":571,"text":"\t\tlet res: Response;","atom":"a24","author":"pinch","version":5},{"n":572,"text":"\t\ttry {","atom":"a24","author":"pinch","version":5},{"n":573,"text":"\t\t\tres = await this.send(this.url(path, this.issuesServer), {","atom":"a782","author":"pinch","version":88},{"n":574,"text":"\t\t\t\tmethod: \"POST\",","atom":"a24","author":"pinch","version":5},{"n":575,"text":"\t\t\t\theaders: { ...this.headers(\"application/octet-stream\"), \"x-abso-name\": encodeURIComponent(name) },","atom":"a491","author":"pinch","version":54},{"n":576,"text":"\t\t\t\tbody: bytes as Uint8Array<ArrayBuffer>,","atom":"a24","author":"pinch","version":5},{"n":577,"text":"\t\t\t\tsignal: AbortSignal.timeout(Math.max(this.timeoutMs, 120_000)),","atom":"a24","author":"pinch","version":5},{"n":578,"text":"\t\t\t});","atom":"a24","author":"pinch","version":5},{"n":579,"text":"\t\t} catch (err) {","atom":"a24","author":"pinch","version":5},{"n":580,"text":"\t\t\tconst e = err as Error;","atom":"a24","author":"pinch","version":5},{"n":581,"text":"\t\t\tthrow new ApiError(","atom":"a24","author":"pinch","version":5},{"n":582,"text":"\t\t\t\t`could not reach ${this.issuesServer}: ${(e.cause as Error | undefined)?.message ?? e.message}`,","atom":"a24","author":"pinch","version":5},{"n":583,"text":"\t\t\t);","atom":"a24","author":"pinch","version":5},{"n":584,"text":"\t\t}","atom":"a24","author":"pinch","version":5},{"n":585,"text":"\t\tconst text = await res.text();","atom":"a24","author":"pinch","version":5},{"n":586,"text":"\t\t// A server from before attachments has no upload route: it answers 404, or 400 because the body isn't JSON;","atom":"a74","author":"pinch","version":15},{"n":587,"text":"\t\t// one with the route but nowhere to keep files answers 501. Say so plainly, and that nothing was sent.","atom":"a74","author":"pinch","version":15},{"n":588,"text":"\t\tif (res.status === 404 || res.status === 501 || (res.status === 400 && /the body is JSON/.test(text)))","atom":"a74","author":"pinch","version":15},{"n":589,"text":"\t\t\tthrow new ApiError(","atom":"a74","author":"pinch","version":15},{"n":590,"text":"\t\t\t\t`${this.issuesServer} doesn't take attachments yet, so ${name} wasn't sent and nothing was written. Leave --attach off, or link the image instead.`,","atom":"a74","author":"pinch","version":15},{"n":591,"text":"\t\t\t\tres.status,","atom":"a74","author":"pinch","version":15},{"n":592,"text":"\t\t\t);","atom":"a74","author":"pinch","version":15},{"n":593,"text":"\t\tif (!res.ok) throw new ApiError(`uploading ${name} answered ${res.status}: ${errorSentence(text)}`, res.status);","atom":"a24","author":"pinch","version":5},{"n":594,"text":"\t\treturn JSON.parse(text) as Attachment;","atom":"a24","author":"pinch","version":5},{"n":595,"text":"\t}","atom":"a163","author":"pinch","version":23},{"n":596,"text":"","atom":"a163","author":"pinch","version":23},{"n":597,"text":"\t/**","atom":"a163","author":"pinch","version":23},{"n":598,"text":"\t * Copies issue `body.issue` of this project into project `to`, keeping","atom":"a163","author":"pinch","version":23},{"n":599,"text":"\t * authors and times: the Issues server reads the source itself, and only","atom":"a163","author":"pinch","version":23},{"n":600,"text":"\t * texts may be given cleaned. A dry run answers the plan and writes nothing.","atom":"a163","author":"pinch","version":23},{"n":601,"text":"\t */","atom":"a163","author":"pinch","version":23},{"n":602,"text":"\tissueCopy(to: string, body: CopyBody & { dryRun?: boolean }): Promise<CopyAnswer> {","atom":"a163","author":"pinch","version":23},{"n":603,"text":"\t\tconst there = new Api({ ...this.config, project: to }, this.timeoutMs);","atom":"a163","author":"pinch","version":23},{"n":604,"text":"\t\tthere.issuesServer = this.issuesServer;","atom":"a163","author":"pinch","version":23},{"n":605,"text":"\t\treturn there.#issues(\"POST\", there.agentPath(\"copy\"), body);","atom":"a163","author":"pinch","version":23},{"n":606,"text":"\t}","atom":"a24","author":"pinch","version":5},{"n":607,"text":"","atom":"a24","author":"pinch","version":5},{"n":608,"text":"\t/** Where an attachment is served. */","atom":"a24","author":"pinch","version":5},{"n":609,"text":"\tattachmentUrl(id: string): string {","atom":"a24","author":"pinch","version":5},{"n":610,"text":"\t\treturn this.url(`/attachments/${id}`, this.issuesServer);","atom":"a24","author":"pinch","version":5},{"n":611,"text":"\t}","atom":"a24","author":"pinch","version":5},{"n":612,"text":"","atom":"a223","author":"pinch","version":29},{"n":613,"text":"\t/** An attachment's bytes, or with `source` the svg it was drawn from; refused past `max` bytes. */","atom":"a223","author":"pinch","version":29},{"n":614,"text":"\tasync attachmentBytes(id: string, source: boolean, max: number): Promise<Uint8Array> {","atom":"a223","author":"pinch","version":29},{"n":615,"text":"\t\tif (this.issuesServer === undefined)","atom":"a223","author":"pinch","version":29},{"n":616,"text":"\t\t\tthrow new ApiError(`${this.config.server} has no Issues Worker beside it; ABSO_ISSUES_SERVER names one`);","atom":"a223","author":"pinch","version":29},{"n":617,"text":"\t\tconst url = `${this.attachmentUrl(id)}${source ? \"/source\" : \"\"}`;","atom":"a223","author":"pinch","version":29},{"n":618,"text":"\t\tlet res: Response;","atom":"a223","author":"pinch","version":29},{"n":619,"text":"\t\ttry {","atom":"a223","author":"pinch","version":29},{"n":620,"text":"\t\t\tres = await this.send(url, {","atom":"a782","author":"pinch","version":88},{"n":621,"text":"\t\t\t\theaders: this.headers(),","atom":"a223","author":"pinch","version":29},{"n":622,"text":"\t\t\t\tsignal: AbortSignal.timeout(Math.max(this.timeoutMs, 120_000)),","atom":"a223","author":"pinch","version":29},{"n":623,"text":"\t\t\t});","atom":"a223","author":"pinch","version":29},{"n":624,"text":"\t\t} catch (err) {","atom":"a223","author":"pinch","version":29},{"n":625,"text":"\t\t\tconst e = err as Error;","atom":"a223","author":"pinch","version":29},{"n":626,"text":"\t\t\tthrow new ApiError(","atom":"a223","author":"pinch","version":29},{"n":627,"text":"\t\t\t\t`could not reach ${this.issuesServer}: ${(e.cause as Error | undefined)?.message ?? e.message}`,","atom":"a223","author":"pinch","version":29},{"n":628,"text":"\t\t\t);","atom":"a223","author":"pinch","version":29},{"n":629,"text":"\t\t}","atom":"a223","author":"pinch","version":29},{"n":630,"text":"\t\tif (!res.ok) throw new ApiError(`${url} answered ${res.status}: ${errorSentence(await res.text())}`, res.status);","atom":"a223","author":"pinch","version":29},{"n":631,"text":"\t\tconst bytes = new Uint8Array(await res.arrayBuffer());","atom":"a223","author":"pinch","version":29},{"n":632,"text":"\t\tif (bytes.length > max) throw new ApiError(`${url} sent ${bytes.length} bytes, more than an attachment may be`);","atom":"a223","author":"pinch","version":29},{"n":633,"text":"\t\treturn bytes;","atom":"a223","author":"pinch","version":29},{"n":634,"text":"\t}","atom":"a223","author":"pinch","version":29},{"n":635,"text":"","atom":"a24","author":"pinch","version":5},{"n":636,"text":"\t/** An edit (abso issue 3): it tells the issue's watchers, and `also`, unless `notify` is false. null clears a parent or Agent. */","atom":"a0","author":"init","version":0},{"n":637,"text":"\tissueEdit(","atom":"a0","author":"init","version":0},{"n":638,"text":"\t\tid: number,","atom":"a0","author":"init","version":0},{"n":639,"text":"\t\tbody: {","atom":"a0","author":"init","version":0},{"n":640,"text":"\t\t\ttitle?: string;","atom":"a0","author":"init","version":0},{"n":641,"text":"\t\t\tdescription?: string;","atom":"a0","author":"init","version":0},{"n":642,"text":"\t\t\tparent?: number | null;","atom":"a0","author":"init","version":0},{"n":643,"text":"\t\t\tagent?: string | null;","atom":"a0","author":"init","version":0},{"n":644,"text":"\t\t\tblockedBy?: number[];","atom":"a0","author":"init","version":0},{"n":645,"text":"\t\t\tnotify?: boolean;","atom":"a0","author":"init","version":0},{"n":646,"text":"\t\t\talso?: string[];","atom":"a0","author":"init","version":0},{"n":647,"text":"\t\t\taddLabels?: string[];","atom":"a0","author":"init","version":0},{"n":648,"text":"\t\t\tremoveLabels?: string[];","atom":"a0","author":"init","version":0},{"n":649,"text":"\t\t},","atom":"a0","author":"init","version":0},{"n":650,"text":"\t): Promise<{ edit: number; notified: readonly string[]; news?: IssueNews }> {","atom":"a0","author":"init","version":0},{"n":651,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`issue/${id}/edit`), body);","atom":"a0","author":"init","version":0},{"n":652,"text":"\t}","atom":"a0","author":"init","version":0},{"n":653,"text":"","atom":"a0","author":"init","version":0},{"n":654,"text":"\tissueComment(","atom":"a24","author":"pinch","version":5},{"n":655,"text":"\t\tid: number,","atom":"a24","author":"pinch","version":5},{"n":656,"text":"\t\ttext: string,","atom":"a24","author":"pinch","version":5},{"n":657,"text":"\t\tobjection = false,","atom":"a24","author":"pinch","version":5},{"n":658,"text":"\t\tattachments: readonly string[] = [],","atom":"a24","author":"pinch","version":5},{"n":659,"text":"\t): Promise<{ id: number; news?: IssueNews }> {","atom":"a24","author":"pinch","version":5},{"n":660,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`issue/${id}/comment`), {","atom":"a24","author":"pinch","version":5},{"n":661,"text":"\t\t\ttext,","atom":"a24","author":"pinch","version":5},{"n":662,"text":"\t\t\t...(objection ? { objection } : {}),","atom":"a24","author":"pinch","version":5},{"n":663,"text":"\t\t\t...(attachments.length > 0 ? { attachments } : {}),","atom":"a24","author":"pinch","version":5},{"n":664,"text":"\t\t});","atom":"a24","author":"pinch","version":5},{"n":665,"text":"\t}","atom":"a0","author":"init","version":0},{"n":666,"text":"","atom":"a0","author":"init","version":0},{"n":667,"text":"\tissueDrop(id: number): Promise<{ news?: IssueNews }> {","atom":"a0","author":"init","version":0},{"n":668,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`issue/${id}/drop`), {});","atom":"a0","author":"init","version":0},{"n":669,"text":"\t}","atom":"a0","author":"init","version":0},{"n":670,"text":"","atom":"a0","author":"init","version":0},{"n":671,"text":"\t/** Opens a dropped issue again (abso issue 104). */","atom":"a0","author":"init","version":0},{"n":672,"text":"\tissueReopen(id: number): Promise<{ news?: IssueNews }> {","atom":"a0","author":"init","version":0},{"n":673,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`issue/${id}/reopen`), {});","atom":"a0","author":"init","version":0},{"n":674,"text":"\t}","atom":"a0","author":"init","version":0},{"n":675,"text":"","atom":"a0","author":"init","version":0},{"n":676,"text":"\t/** Marks an issue done by hand (abso issue 38). `version` is the publish that did it, when there is one. */","atom":"a0","author":"init","version":0},{"n":677,"text":"\tissueDone(id: number, version: number | null): Promise<{ news?: IssueNews }> {","atom":"a0","author":"init","version":0},{"n":678,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`issue/${id}/done`), { ...(version !== null ? { version } : {}) });","atom":"a0","author":"init","version":0},{"n":679,"text":"\t}","atom":"a0","author":"init","version":0},{"n":680,"text":"","atom":"a0","author":"init","version":0},{"n":681,"text":"\t/** This agent's drafts (abso issue 3): its own, with no number and no news, newest first. */","atom":"a0","author":"init","version":0},{"n":682,"text":"\tdrafts(): Promise<{ drafts: readonly Draft[] }> {","atom":"a0","author":"init","version":0},{"n":683,"text":"\t\treturn this.#issues(\"GET\", this.agentPath(\"drafts\"));","atom":"a0","author":"init","version":0},{"n":684,"text":"\t}","atom":"a0","author":"init","version":0},{"n":685,"text":"","atom":"a0","author":"init","version":0},{"n":686,"text":"\t/** Saves a draft, new or (with id) over one of this agent's: the body replaces the draft's. */","atom":"a0","author":"init","version":0},{"n":687,"text":"\tsaveDraft(body: DraftBody & { id?: number }): Promise<{ id: number }> {","atom":"a0","author":"init","version":0},{"n":688,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(\"draft\"), body);","atom":"a0","author":"init","version":0},{"n":689,"text":"\t}","atom":"a0","author":"init","version":0},{"n":690,"text":"","atom":"a0","author":"init","version":0},{"n":691,"text":"\t/** Opens a draft as an issue, `body`'s fields over the draft's, and deletes the draft. */","atom":"a0","author":"init","version":0},{"n":692,"text":"\topenDraft(id: number, body: DraftBody = {}): Promise<{ id: number; news?: IssueNews }> {","atom":"a0","author":"init","version":0},{"n":693,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`draft/${id}/open`), body);","atom":"a0","author":"init","version":0},{"n":694,"text":"\t}","atom":"a0","author":"init","version":0},{"n":695,"text":"","atom":"a0","author":"init","version":0},{"n":696,"text":"\tdeleteDraft(id: number): Promise<{ ok: boolean }> {","atom":"a0","author":"init","version":0},{"n":697,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`draft/${id}/delete`), {});","atom":"a0","author":"init","version":0},{"n":698,"text":"\t}","atom":"a0","author":"init","version":0},{"n":699,"text":"","atom":"a0","author":"init","version":0},{"n":700,"text":"\task(body: {","atom":"a0","author":"init","version":0},{"n":701,"text":"\t\tissue?: number;","atom":"a0","author":"init","version":0},{"n":702,"text":"\t\tof: string;","atom":"a0","author":"init","version":0},{"n":703,"text":"\t\tquestion: string;","atom":"a0","author":"init","version":0},{"n":704,"text":"\t\treview?: boolean;","atom":"a0","author":"init","version":0},{"n":705,"text":"\t\tkind?: \"question\" | \"task\";","atom":"a0","author":"init","version":0},{"n":706,"text":"\t\tdue?: string;","atom":"a0","author":"init","version":0},{"n":707,"text":"\t\tblocks?: number[];","atom":"a0","author":"init","version":0},{"n":708,"text":"\t\toptions?: string[];","atom":"a0","author":"init","version":0},{"n":709,"text":"\t\tattachments?: string[];","atom":"a297","author":"pinch","version":35},{"n":710,"text":"\t}): Promise<{ id: number; news?: IssueNews; attachments?: string[] }> {","atom":"a297","author":"pinch","version":35},{"n":711,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(\"ask\"), body);","atom":"a0","author":"init","version":0},{"n":712,"text":"\t}","atom":"a0","author":"init","version":0},{"n":713,"text":"","atom":"a0","author":"init","version":0},{"n":714,"text":"\tanswer(","atom":"a0","author":"init","version":0},{"n":715,"text":"\t\tid: number,","atom":"a0","author":"init","version":0},{"n":716,"text":"\t\tbody: { words?: string; option?: number | string; note?: string; done?: boolean; attachments?: string[] },","atom":"a297","author":"pinch","version":35},{"n":717,"text":"\t): Promise<{ ask: Ask; news?: IssueNews }> {","atom":"a0","author":"init","version":0},{"n":718,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`answer/${id}`), body);","atom":"a0","author":"init","version":0},{"n":719,"text":"\t}","atom":"a0","author":"init","version":0},{"n":720,"text":"","atom":"a62","author":"infra-split","version":14},{"n":721,"text":"\t/** Acknowledges an ask of this agent without answering it: the asker hears it, and the ask stays open. */","atom":"a479","author":"pinch","version":53},{"n":722,"text":"\tack(id: number, body: { note?: string }): Promise<{ ask: Ask; news?: IssueNews }> {","atom":"a479","author":"pinch","version":53},{"n":723,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`ack/${id}`), body);","atom":"a479","author":"pinch","version":53},{"n":724,"text":"\t}","atom":"a658","author":"pinch","version":72},{"n":725,"text":"","atom":"a658","author":"pinch","version":72},{"n":726,"text":"\t/** Adds to an ask's thread, as its asker or the one asked; the other side hears it, and the ask stays as it is. */","atom":"a658","author":"pinch","version":72},{"n":727,"text":"\treply(id: number, body: { text: string; question?: boolean }): Promise<{ ask: Ask; news?: IssueNews }> {","atom":"a658","author":"pinch","version":72},{"n":728,"text":"\t\treturn this.#threads(this.#issues(\"POST\", this.agentPath(`reply/${id}`), body));","atom":"a786","author":"pinch","version":89},{"n":729,"text":"\t}","atom":"a479","author":"pinch","version":53},{"n":730,"text":"","atom":"a479","author":"pinch","version":53},{"n":731,"text":"\t/** A groups call, with a server from before groups named as that rather than a bare 404. */","atom":"a2609","author":"groups","version":256},{"n":732,"text":"\tasync #groups<T>(call: Promise<T>): Promise<T> {","atom":"a2609","author":"groups","version":256},{"n":733,"text":"\t\ttry {","atom":"a2609","author":"groups","version":256},{"n":734,"text":"\t\t\treturn await call;","atom":"a2609","author":"groups","version":256},{"n":735,"text":"\t\t} catch (err) {","atom":"a2609","author":"groups","version":256},{"n":736,"text":"\t\t\tif (err instanceof ApiError && err.status === 404 && /no such issues route|reads have no/.test(err.message))","atom":"a2609","author":"groups","version":256},{"n":737,"text":"\t\t\t\tthrow new ApiError(`${this.config.server} doesn't have groups yet`, 404);","atom":"a2609","author":"groups","version":256},{"n":738,"text":"\t\t\tthrow err;","atom":"a2609","author":"groups","version":256},{"n":739,"text":"\t\t}","atom":"a2609","author":"groups","version":256},{"n":740,"text":"\t}","atom":"a2609","author":"groups","version":256},{"n":741,"text":"","atom":"a2609","author":"groups","version":256},{"n":742,"text":"\t/** The project's groups this agent can see. */","atom":"a2609","author":"groups","version":256},{"n":743,"text":"\tgroupList(): Promise<{ groups: readonly GroupSummary[] }> {","atom":"a2609","author":"groups","version":256},{"n":744,"text":"\t\treturn this.#groups(this.#issues(\"GET\", this.agentPath(\"groups\")));","atom":"a2609","author":"groups","version":256},{"n":745,"text":"\t}","atom":"a2609","author":"groups","version":256},{"n":746,"text":"","atom":"a2609","author":"groups","version":256},{"n":747,"text":"\t/** One group's settings and roster, by name or id. */","atom":"a2609","author":"groups","version":256},{"n":748,"text":"\tgroup(ref: string): Promise<GroupShown> {","atom":"a2609","author":"groups","version":256},{"n":749,"text":"\t\treturn this.#groups(this.#issues(\"GET\", this.agentPath(`group/${encodeURIComponent(ref)}`)));","atom":"a2609","author":"groups","version":256},{"n":750,"text":"\t}","atom":"a2609","author":"groups","version":256},{"n":751,"text":"","atom":"a2609","author":"groups","version":256},{"n":752,"text":"\t/** A page of a group's history, newest first, and the `before` that reads further back (null at the start). */","atom":"a2609","author":"groups","version":256},{"n":753,"text":"\tgroupEvents(","atom":"a2609","author":"groups","version":256},{"n":754,"text":"\t\tref: string,","atom":"a2609","author":"groups","version":256},{"n":755,"text":"\t\tq: { before?: number; limit?: number; kind?: string } = {},","atom":"a2609","author":"groups","version":256},{"n":756,"text":"\t): Promise<{ events: readonly GroupEvent[]; before: number | null }> {","atom":"a2609","author":"groups","version":256},{"n":757,"text":"\t\tconst qs = query({ before: q.before, limit: q.limit, kind: q.kind }).toString();","atom":"a2609","author":"groups","version":256},{"n":758,"text":"\t\treturn this.#groups(","atom":"a2609","author":"groups","version":256},{"n":759,"text":"\t\t\tthis.#issues(\"GET\", this.agentPath(`group/${encodeURIComponent(ref)}/events${qs ? `?${qs}` : \"\"}`)),","atom":"a2609","author":"groups","version":256},{"n":760,"text":"\t\t);","atom":"a2609","author":"groups","version":256},{"n":761,"text":"\t}","atom":"a2609","author":"groups","version":256},{"n":762,"text":"","atom":"a2609","author":"groups","version":256},{"n":763,"text":"\t/** Make a group (ref undefined), or post, join, leave, add, remove or change settings in one. */","atom":"a2609","author":"groups","version":256},{"n":764,"text":"\tgroupWrite(","atom":"a2609","author":"groups","version":256},{"n":765,"text":"\t\tref: string | undefined,","atom":"a2609","author":"groups","version":256},{"n":766,"text":"\t\taction: \"post\" | \"join\" | \"leave\" | \"add\" | \"remove\" | \"settings\" | undefined,","atom":"a2609","author":"groups","version":256},{"n":767,"text":"\t\tbody: Record<string, unknown>,","atom":"a2609","author":"groups","version":256},{"n":768,"text":"\t): Promise<GroupWrite> {","atom":"a2609","author":"groups","version":256},{"n":769,"text":"\t\tconst path = ref === undefined ? \"groups\" : `group/${encodeURIComponent(ref)}/${action}`;","atom":"a2609","author":"groups","version":256},{"n":770,"text":"\t\treturn this.#groups(this.#issues(\"POST\", this.agentPath(path), body));","atom":"a2609","author":"groups","version":256},{"n":771,"text":"\t}","atom":"a2609","author":"groups","version":256},{"n":772,"text":"","atom":"a2609","author":"groups","version":256},{"n":773,"text":"\t/** Takes back an ask this agent made, with a note on why; the one asked hears it. */","atom":"a62","author":"infra-split","version":14},{"n":774,"text":"\twithdraw(id: number, body: { note?: string }): Promise<{ ask: Ask; news?: IssueNews }> {","atom":"a62","author":"infra-split","version":14},{"n":775,"text":"\t\treturn this.#issues(\"POST\", this.agentPath(`withdraw/${id}`), body);","atom":"a62","author":"infra-split","version":14},{"n":776,"text":"\t}","atom":"a62","author":"infra-split","version":14},{"n":777,"text":"","atom":"a0","author":"init","version":0},{"n":778,"text":"\t/** Notes on lines (#44), by file or change; open ones only with `open`. */","atom":"a0","author":"init","version":0},{"n":779,"text":"\tnotes(q: { file?: string; change?: number; open?: boolean } = {}): Promise<{ notes: readonly NoteAnswer[] }> {","atom":"a0","author":"init","version":0},{"n":780,"text":"\t\treturn this.json(\"GET\", `/notes?${query({ file: q.file, change: q.change, open: q.open ? 1 : undefined })}`);","atom":"a0","author":"init","version":0},{"n":781,"text":"\t}","atom":"a0","author":"init","version":0},{"n":782,"text":"","atom":"a0","author":"init","version":0},{"n":783,"text":"\tnote(body: NoteBody): Promise<{ id: number; change: number | null; lines: readonly [number, number] }> {","atom":"a0","author":"init","version":0},{"n":784,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"note\"), body);","atom":"a0","author":"init","version":0},{"n":785,"text":"\t}","atom":"a0","author":"init","version":0},{"n":786,"text":"","atom":"a0","author":"init","version":0},{"n":787,"text":"\tnoteClose(id: number, how: \"resolved\" | \"withdrawn\"): Promise<unknown> {","atom":"a0","author":"init","version":0},{"n":788,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"note-close\"), { id, how });","atom":"a0","author":"init","version":0},{"n":789,"text":"\t}","atom":"a0","author":"init","version":0},{"n":790,"text":"","atom":"a0","author":"init","version":0},{"n":791,"text":"\t/** The merge queue now (#39). */","atom":"a0","author":"init","version":0},{"n":792,"text":"\tqueueState(): Promise<QueueState> {","atom":"a0","author":"init","version":0},{"n":793,"text":"\t\treturn this.json(\"GET\", \"/queue\");","atom":"a0","author":"init","version":0},{"n":794,"text":"\t}","atom":"a0","author":"init","version":0},{"n":795,"text":"","atom":"a0","author":"init","version":0},{"n":796,"text":"\t/** The project's visibility (abso issue 152): public or private. */","atom":"a0","author":"init","version":0},{"n":797,"text":"\tvisibility(): Promise<{ project: string; visibility: \"public\" | \"private\" }> {","atom":"a0","author":"init","version":0},{"n":798,"text":"\t\treturn this.json(\"GET\", \"/visibility\");","atom":"a0","author":"init","version":0},{"n":799,"text":"\t}","atom":"a0","author":"init","version":0},{"n":800,"text":"","atom":"a0","author":"init","version":0},{"n":801,"text":"\t/** Switch the project's visibility (abso issue 140): an owner's key, or the shared token on staging. */","atom":"a0","author":"init","version":0},{"n":802,"text":"\tsetVisibility(v: \"public\" | \"private\"): Promise<{ project: string; visibility: \"public\" | \"private\" }> {","atom":"a0","author":"init","version":0},{"n":803,"text":"\t\treturn this.json(\"POST\", `/visibility?visibility=${v}`, {});","atom":"a0","author":"init","version":0},{"n":804,"text":"\t}","atom":"a2392","author":"autosettle","version":220},{"n":805,"text":"","atom":"a2392","author":"autosettle","version":220},{"n":806,"text":"\t/** The project's auto-settle choice (abso-core 23): off, advise or settle, and how sure before abso settles. */","atom":"a2392","author":"autosettle","version":220},{"n":807,"text":"\tautosettle(): Promise<AutosettleAnswer> {","atom":"a2392","author":"autosettle","version":220},{"n":808,"text":"\t\treturn this.json(\"GET\", \"/autosettle\");","atom":"a2392","author":"autosettle","version":220},{"n":809,"text":"\t}","atom":"a2392","author":"autosettle","version":220},{"n":810,"text":"","atom":"a2392","author":"autosettle","version":220},{"n":811,"text":"\t/** Change it (abso-core 23): an owner's key, or the shared token on staging. Without `at`, the server keeps its own. */","atom":"a2392","author":"autosettle","version":220},{"n":812,"text":"\tsetAutosettle(mode: AutosettleMode, at?: number): Promise<AutosettleAnswer> {","atom":"a2392","author":"autosettle","version":220},{"n":813,"text":"\t\treturn this.json(\"POST\", `/autosettle?mode=${mode}${at === undefined ? \"\" : `&at=${at}`}`, {});","atom":"a2392","author":"autosettle","version":220},{"n":814,"text":"\t}","atom":"a0","author":"init","version":0},{"n":815,"text":"","atom":"a0","author":"init","version":0},{"n":816,"text":"\t/** Auto-settle's history (abso-core 23): held pushes the model advised on, newest first. */","atom":"a2407","author":"autosettle","version":223},{"n":817,"text":"\tautosettleHistory(): Promise<unknown> {","atom":"a2407","author":"autosettle","version":223},{"n":818,"text":"\t\treturn this.json(\"GET\", \"/autosettle/history\");","atom":"a2407","author":"autosettle","version":223},{"n":819,"text":"\t}","atom":"a2407","author":"autosettle","version":223},{"n":820,"text":"","atom":"a2407","author":"autosettle","version":223},{"n":821,"text":"\t/** One held push from the history, with each collision's calls to the model. */","atom":"a2407","author":"autosettle","version":223},{"n":822,"text":"\tautosettleHold(id: number): Promise<unknown> {","atom":"a2407","author":"autosettle","version":223},{"n":823,"text":"\t\treturn this.json(\"GET\", `/autosettle/history/${id}`);","atom":"a2407","author":"autosettle","version":223},{"n":824,"text":"\t}","atom":"a2407","author":"autosettle","version":223},{"n":825,"text":"","atom":"a2407","author":"autosettle","version":223},{"n":826,"text":"\t/** Take back this agent's queued publishes (#39); refused while one is being checked. */","atom":"a0","author":"init","version":0},{"n":827,"text":"\tunqueue(): Promise<{ pulled: readonly number[] }> {","atom":"a0","author":"init","version":0},{"n":828,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"unqueue\"), {});","atom":"a0","author":"init","version":0},{"n":829,"text":"\t}","atom":"a0","author":"init","version":0},{"n":830,"text":"","atom":"a0","author":"init","version":0},{"n":831,"text":"\t/**","atom":"a0","author":"init","version":0},{"n":832,"text":"\t * Sync; a folder following a label goes to the newest version with that label.","atom":"a0","author":"init","version":0},{"n":833,"text":"\t * With `full`, the answer holds every file in the agent's view, as a first sync's does,","atom":"a0","author":"init","version":0},{"n":834,"text":"\t * not only what changed since its last sync (#37: a join for an agent the server knew).","atom":"a0","author":"init","version":0},{"n":835,"text":"\t */","atom":"a0","author":"init","version":0},{"n":836,"text":"\tsync(options: { full?: boolean } = {}): Promise<SyncAnswer> {","atom":"a0","author":"init","version":0},{"n":837,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"sync\"), {","atom":"a0","author":"init","version":0},{"n":838,"text":"\t\t\t...(this.config.follow ? { label: this.config.follow } : {}),","atom":"a0","author":"init","version":0},{"n":839,"text":"\t\t\t...(options.full ? { full: true } : {}),","atom":"a0","author":"init","version":0},{"n":840,"text":"\t\t});","atom":"a0","author":"init","version":0},{"n":841,"text":"\t}","atom":"a0","author":"init","version":0},{"n":842,"text":"","atom":"a0","author":"init","version":0},{"n":843,"text":"\t/** Take published versions back out of shared (with the versions that build on them, when asked). */","atom":"a0","author":"init","version":0},{"n":844,"text":"\tdrop(versions: readonly number[], message: string, withDependents = false): Promise<DropAnswer> {","atom":"a0","author":"init","version":0},{"n":845,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"drop\"), {","atom":"a0","author":"init","version":0},{"n":846,"text":"\t\t\tversions,","atom":"a0","author":"init","version":0},{"n":847,"text":"\t\t\tmessage,","atom":"a0","author":"init","version":0},{"n":848,"text":"\t\t\t...(withDependents ? { withDependents: true } : {}),","atom":"a0","author":"init","version":0},{"n":849,"text":"\t\t});","atom":"a0","author":"init","version":0},{"n":850,"text":"\t}","atom":"a0","author":"init","version":0},{"n":851,"text":"","atom":"a0","author":"init","version":0},{"n":852,"text":"\t/** Take some versions of a named draft into shared, as one version. */","atom":"a0","author":"init","version":0},{"n":853,"text":"\tpluck(draft: string, versions: readonly number[], message: string, withDependencies = false): Promise<PluckAnswer> {","atom":"a0","author":"init","version":0},{"n":854,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"pluck\"), {","atom":"a0","author":"init","version":0},{"n":855,"text":"\t\t\tdraft,","atom":"a0","author":"init","version":0},{"n":856,"text":"\t\t\tversions,","atom":"a0","author":"init","version":0},{"n":857,"text":"\t\t\tmessage,","atom":"a0","author":"init","version":0},{"n":858,"text":"\t\t\t...(withDependencies ? { withDependencies: true } : {}),","atom":"a0","author":"init","version":0},{"n":859,"text":"\t\t});","atom":"a0","author":"init","version":0},{"n":860,"text":"\t}","atom":"a0","author":"init","version":0},{"n":861,"text":"","atom":"a0","author":"init","version":0},{"n":862,"text":"\t/** Correct the message of this agent's newest publish in its space. */","atom":"a0","author":"init","version":0},{"n":863,"text":"\tamend(message: string): Promise<{ version: number; draft: string | null; message: string; was: string }> {","atom":"a0","author":"init","version":0},{"n":864,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"amend\"), { message });","atom":"a0","author":"init","version":0},{"n":865,"text":"\t}","atom":"a0","author":"init","version":0},{"n":866,"text":"","atom":"a0","author":"init","version":0},{"n":867,"text":"\t/** Put a label on a version of shared (the newest by default), or take it off. */","atom":"a0","author":"init","version":0},{"n":868,"text":"\tlabel(","atom":"a0","author":"init","version":0},{"n":869,"text":"\t\tname: string,","atom":"a0","author":"init","version":0},{"n":870,"text":"\t\tversion?: number,","atom":"a0","author":"init","version":0},{"n":871,"text":"\t\tremove = false,","atom":"a0","author":"init","version":0},{"n":872,"text":"\t): Promise<{ name: string; version: number; versions: readonly number[] }> {","atom":"a0","author":"init","version":0},{"n":873,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"label\"), {","atom":"a0","author":"init","version":0},{"n":874,"text":"\t\t\tname,","atom":"a0","author":"init","version":0},{"n":875,"text":"\t\t\t...(version === undefined ? {} : { version }),","atom":"a0","author":"init","version":0},{"n":876,"text":"\t\t\t...(remove ? { remove: true } : {}),","atom":"a0","author":"init","version":0},{"n":877,"text":"\t\t});","atom":"a0","author":"init","version":0},{"n":878,"text":"\t}","atom":"a0","author":"init","version":0},{"n":879,"text":"","atom":"a0","author":"init","version":0},{"n":880,"text":"\tlabels(): Promise<{ labels: Readonly<Record<string, readonly number[]>> }> {","atom":"a0","author":"init","version":0},{"n":881,"text":"\t\treturn this.json(\"GET\", \"/labels\");","atom":"a0","author":"init","version":0},{"n":882,"text":"\t}","atom":"a0","author":"init","version":0},{"n":883,"text":"","atom":"a0","author":"init","version":0},{"n":884,"text":"\tstatus(): Promise<StatusAnswer> {","atom":"a0","author":"init","version":0},{"n":885,"text":"\t\treturn this.json(\"GET\", \"/status\");","atom":"a0","author":"init","version":0},{"n":886,"text":"\t}","atom":"a0","author":"init","version":0},{"n":887,"text":"","atom":"a0","author":"init","version":0},{"n":888,"text":"\t/** The status and the paths in the agent's view, in one trip (abso issue 80). */","atom":"a0","author":"init","version":0},{"n":889,"text":"\tasync statusAndFiles(): Promise<StatusAnswer & { files: FilesAnswer | undefined }> {","atom":"a0","author":"init","version":0},{"n":890,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":891,"text":"\t\t\treturn await this.json(\"GET\", this.agentPath(\"status\"));","atom":"a0","author":"init","version":0},{"n":892,"text":"\t\t} catch (err) {","atom":"a0","author":"init","version":0},{"n":893,"text":"\t\t\t// A server from before it has no /a/:agent/status; the listing itself is from #37.","atom":"a0","author":"init","version":0},{"n":894,"text":"\t\t\tif (!(err instanceof ApiError && err.status === 404)) throw err;","atom":"a0","author":"init","version":0},{"n":895,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":896,"text":"\t\tconst status = await this.status();","atom":"a0","author":"init","version":0},{"n":897,"text":"\t\treturn { ...status, files: await this.viewFiles().catch(() => undefined) };","atom":"a0","author":"init","version":0},{"n":898,"text":"\t}","atom":"a0","author":"init","version":0},{"n":899,"text":"","atom":"a0","author":"init","version":0},{"n":900,"text":"\t/** CI's state (#39), or one version's job. */","atom":"a0","author":"init","version":0},{"n":901,"text":"\tci(): Promise<CiStatus>;","atom":"a0","author":"init","version":0},{"n":902,"text":"\tci(version: number): Promise<CiJob>;","atom":"a0","author":"init","version":0},{"n":903,"text":"\tci(version?: number): Promise<CiStatus | CiJob> {","atom":"a0","author":"init","version":0},{"n":904,"text":"\t\treturn this.json(\"GET\", version === undefined ? \"/ci\" : `/ci?${query({ version })}`);","atom":"a0","author":"init","version":0},{"n":905,"text":"\t}","atom":"a0","author":"init","version":0},{"n":906,"text":"","atom":"a0","author":"init","version":0},{"n":907,"text":"\t/** The project's pipeline runs, newest first; one run with its jobs; or one job's log (`log` is pipeline.job). */","atom":"a759","author":"infra-pipeline","version":85},{"n":908,"text":"\tpipelineRuns(run?: number, log?: string): Promise<unknown> {","atom":"a759","author":"infra-pipeline","version":85},{"n":909,"text":"\t\treturn this.json(\"GET\", run === undefined ? \"/pipelines\" : `/pipelines?${query({ run, log })}`);","atom":"a759","author":"infra-pipeline","version":85},{"n":910,"text":"\t}","atom":"a759","author":"infra-pipeline","version":85},{"n":911,"text":"","atom":"a759","author":"infra-pipeline","version":85},{"n":912,"text":"\t/** Ends every /latest link handed out so far; answers CI's state with the new link. */","atom":"a0","author":"init","version":0},{"n":913,"text":"\tciRevoke(): Promise<CiStatus> {","atom":"a0","author":"init","version":0},{"n":914,"text":"\t\treturn this.json(\"POST\", \"/ci/revoke\", {});","atom":"a0","author":"init","version":0},{"n":915,"text":"\t}","atom":"a0","author":"init","version":0},{"n":916,"text":"","atom":"a0","author":"init","version":0},{"n":917,"text":"\t/** Count versions up to `through` as seen by CI and end any red or bisect, so an import's history isn't checked (#56). */","atom":"a0","author":"init","version":0},{"n":918,"text":"\tciSkip(through: number): Promise<unknown> {","atom":"a0","author":"init","version":0},{"n":919,"text":"\t\treturn this.json(\"POST\", \"/ci/skip\", { through });","atom":"a0","author":"init","version":0},{"n":920,"text":"\t}","atom":"a0","author":"init","version":0},{"n":921,"text":"","atom":"a0","author":"init","version":0},{"n":922,"text":"\t/** Move to a named draft (null: shared). With carry, the current unpublished changes start a new draft. */","atom":"a0","author":"init","version":0},{"n":923,"text":"\tswitchDraft(name: string | null, carry = false): Promise<SwitchAnswer> {","atom":"a0","author":"init","version":0},{"n":924,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"draft\"), { name, ...(carry ? { carry: true } : {}) });","atom":"a0","author":"init","version":0},{"n":925,"text":"\t}","atom":"a0","author":"init","version":0},{"n":926,"text":"","atom":"a0","author":"init","version":0},{"n":927,"text":"\t/** Land never queues: with the merge queue on, the server refuses it (#39). */","atom":"a0","author":"init","version":0},{"n":928,"text":"\tland(message: string): Promise<Exclude<PublishAnswer, { queued: number }>> {","atom":"a0","author":"init","version":0},{"n":929,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"land\"), { message }, undefined, PUBLISH_TIMEOUT_MS);","atom":"a189","author":"pinch","version":26},{"n":930,"text":"\t}","atom":"a0","author":"init","version":0},{"n":931,"text":"","atom":"a0","author":"init","version":0},{"n":932,"text":"\tdraftSync(): Promise<DraftSyncAnswer> {","atom":"a0","author":"init","version":0},{"n":933,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"draft-sync\"), {});","atom":"a0","author":"init","version":0},{"n":934,"text":"\t}","atom":"a0","author":"init","version":0},{"n":935,"text":"","atom":"a0","author":"init","version":0},{"n":936,"text":"\tblame(file: string, from?: number, to?: number, version?: number, view: View = {}): Promise<BlameAnswer> {","atom":"a0","author":"init","version":0},{"n":937,"text":"\t\treturn this.json(\"GET\", `/blame?${query({ file, from, to, version, ...view })}`);","atom":"a0","author":"init","version":0},{"n":938,"text":"\t}","atom":"a0","author":"init","version":0},{"n":939,"text":"","atom":"a0","author":"init","version":0},{"n":940,"text":"\t/** The paths in the agent's view: what its folder should hold (#37). */","atom":"a0","author":"init","version":0},{"n":941,"text":"\tviewFiles(): Promise<FilesAnswer> {","atom":"a0","author":"init","version":0},{"n":942,"text":"\t\treturn this.json(\"GET\", this.agentPath(\"files\"));","atom":"a0","author":"init","version":0},{"n":943,"text":"\t}","atom":"a0","author":"init","version":0},{"n":944,"text":"","atom":"a0","author":"init","version":0},{"n":945,"text":"\t/** The paths in shared, or a named draft, at a version (the newest by default). */","atom":"a0","author":"init","version":0},{"n":946,"text":"\tfilesAt(draft: string | null, version?: number): Promise<FilesAnswer> {","atom":"a0","author":"init","version":0},{"n":947,"text":"\t\treturn this.json(\"GET\", `/files?${query({ draft, version })}`);","atom":"a0","author":"init","version":0},{"n":948,"text":"\t}","atom":"a0","author":"init","version":0},{"n":949,"text":"","atom":"a0","author":"init","version":0},{"n":950,"text":"\t/** The versions of a space, newest first; with `path`, only those that changed it. */","atom":"a0","author":"init","version":0},{"n":951,"text":"\t/**","atom":"a189","author":"pinch","version":26},{"n":952,"text":"\t * The versions newest first, below `before` when it's given. The server","atom":"a189","author":"pinch","version":26},{"n":953,"text":"\t * sends at most LOG_PAGE at a time, so a longer log is read page by page,","atom":"a189","author":"pinch","version":26},{"n":954,"text":"\t * following each page's next. `next` on the answer says older ones are left.","atom":"a189","author":"pinch","version":26},{"n":955,"text":"\t */","atom":"a189","author":"pinch","version":26},{"n":956,"text":"\tasync log(where: Where, limit?: number, path?: string, before?: number): Promise<LogAnswer> {","atom":"a189","author":"pinch","version":26},{"n":957,"text":"\t\tlet page = await this.#logPage(where, limit === undefined ? undefined : Math.min(limit, LOG_PAGE), path, before);","atom":"a189","author":"pinch","version":26},{"n":958,"text":"\t\tconst versions = [...page.versions];","atom":"a189","author":"pinch","version":26},{"n":959,"text":"\t\twhile (limit !== undefined && versions.length < limit && page.next !== undefined) {","atom":"a189","author":"pinch","version":26},{"n":960,"text":"\t\t\tpage = await this.#logPage(where, Math.min(limit - versions.length, LOG_PAGE), path, page.next);","atom":"a189","author":"pinch","version":26},{"n":961,"text":"\t\t\tversions.push(...page.versions);","atom":"a189","author":"pinch","version":26},{"n":962,"text":"\t\t}","atom":"a189","author":"pinch","version":26},{"n":963,"text":"\t\tconst { next, ...rest } = page;","atom":"a189","author":"pinch","version":26},{"n":964,"text":"\t\treturn { ...rest, versions, ...(next !== undefined ? { next } : {}) };","atom":"a189","author":"pinch","version":26},{"n":965,"text":"\t}","atom":"a189","author":"pinch","version":26},{"n":966,"text":"","atom":"a189","author":"pinch","version":26},{"n":967,"text":"\t#logPage(","atom":"a189","author":"pinch","version":26},{"n":968,"text":"\t\twhere: Where,","atom":"a189","author":"pinch","version":26},{"n":969,"text":"\t\tlimit: number | undefined,","atom":"a189","author":"pinch","version":26},{"n":970,"text":"\t\tpath: string | undefined,","atom":"a189","author":"pinch","version":26},{"n":971,"text":"\t\tbefore: number | undefined,","atom":"a189","author":"pinch","version":26},{"n":972,"text":"\t): Promise<LogAnswer> {","atom":"a189","author":"pinch","version":26},{"n":973,"text":"\t\treturn this.json(\"GET\", `/log?${query({ ...where, limit, path, before })}`);","atom":"a189","author":"pinch","version":26},{"n":974,"text":"\t}","atom":"a0","author":"init","version":0},{"n":975,"text":"","atom":"a0","author":"init","version":0},{"n":976,"text":"\tshow(version: number, where: Where): Promise<ShowAnswer> {","atom":"a0","author":"init","version":0},{"n":977,"text":"\t\treturn this.json(\"GET\", `/show?${query({ version, ...where })}`);","atom":"a0","author":"init","version":0},{"n":978,"text":"\t}","atom":"a0","author":"init","version":0},{"n":979,"text":"","atom":"a0","author":"init","version":0},{"n":980,"text":"\tfileAt(path: string, version: number, where: Where): Promise<{ path: string; version: number; text: string | null }> {","atom":"a0","author":"init","version":0},{"n":981,"text":"\t\treturn this.json(\"GET\", `/file?${query({ path, version, ...where })}`);","atom":"a0","author":"init","version":0},{"n":982,"text":"\t}","atom":"a0","author":"init","version":0},{"n":983,"text":"","atom":"a0","author":"init","version":0},{"n":984,"text":"\tcompare(from: number, to: number, where: Where): Promise<{ from: number; to: number; files: readonly FileChange[] }> {","atom":"a0","author":"init","version":0},{"n":985,"text":"\t\treturn this.json(\"GET\", `/compare?${query({ from, to, ...where })}`);","atom":"a0","author":"init","version":0},{"n":986,"text":"\t}","atom":"a2090","author":"candidates","version":186},{"n":987,"text":"","atom":"a2090","author":"candidates","version":186},{"n":988,"text":"\t/** Version `version` of shared with `versions` left out, or the refusal naming what builds on them. */","atom":"a2090","author":"candidates","version":186},{"n":989,"text":"\twithout(version: number, versions: readonly number[]): Promise<WithoutAnswer> {","atom":"a2090","author":"candidates","version":186},{"n":990,"text":"\t\treturn this.json(\"GET\", `/without?${query({ version, versions: versions.join(\",\") })}`);","atom":"a2090","author":"candidates","version":186},{"n":991,"text":"\t}","atom":"a0","author":"init","version":0},{"n":992,"text":"","atom":"a0","author":"init","version":0},{"n":993,"text":"\t/** A message to the project's other agents (or those named), delivered once as news. */","atom":"a0","author":"init","version":0},{"n":994,"text":"\tstarting(","atom":"a0","author":"init","version":0},{"n":995,"text":"\t\ttext: string | null,","atom":"a0","author":"init","version":0},{"n":996,"text":"\t\tfiles?: readonly string[],","atom":"a0","author":"init","version":0},{"n":997,"text":"\t\toptions: { issue?: number; done?: boolean } = {},","atom":"a0","author":"init","version":0},{"n":998,"text":"\t): Promise<{","atom":"a0","author":"init","version":0},{"n":999,"text":"\t\tstarting: { text: string; files: readonly string[]; time: number; issue?: number } | null;","atom":"a0","author":"init","version":0},{"n":1000,"text":"\t\toverlaps: readonly Overlap[];","atom":"a0","author":"init","version":0},{"n":1001,"text":"\t}> {","atom":"a0","author":"init","version":0},{"n":1002,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"starting\"), {","atom":"a0","author":"init","version":0},{"n":1003,"text":"\t\t\ttext,","atom":"a0","author":"init","version":0},{"n":1004,"text":"\t\t\t...(files && files.length > 0 ? { files } : {}),","atom":"a0","author":"init","version":0},{"n":1005,"text":"\t\t\t...(options.issue !== undefined ? { issue: options.issue } : {}),","atom":"a0","author":"init","version":0},{"n":1006,"text":"\t\t\t...(options.done ? { done: true } : {}),","atom":"a0","author":"init","version":0},{"n":1007,"text":"\t\t});","atom":"a0","author":"init","version":0},{"n":1008,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1009,"text":"","atom":"a0","author":"init","version":0},{"n":1010,"text":"\tannounce(text: string, to?: readonly string[]): Promise<{ id: number; to: readonly string[] }> {","atom":"a0","author":"init","version":0},{"n":1011,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"announce\"), { text, ...(to ? { to } : {}) });","atom":"a0","author":"init","version":0},{"n":1012,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1013,"text":"","atom":"a0","author":"init","version":0},{"n":1014,"text":"\t/** The news waiting for this agent, handed over once. */","atom":"a0","author":"init","version":0},{"n":1015,"text":"\tnews(): Promise<{ news: News; items?: readonly { readonly text: string; readonly at: number | null }[] }> {","atom":"a0","author":"init","version":0},{"n":1016,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"news\"), {});","atom":"a0","author":"init","version":0},{"n":1017,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1018,"text":"","atom":"a0","author":"init","version":0},{"n":1019,"text":"\t/** A ticket that opens this agent's news stream once, within a minute (abso 690; news-stream.ts). */","atom":"a2692","author":"box-grants","version":269},{"n":1020,"text":"\tnewsTicket(): Promise<{ url: string; protocols: string[]; expiresAt: number | string }> {","atom":"a2799","author":"box-grants","version":285},{"n":1021,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"news/ticket\"), {});","atom":"a2692","author":"box-grants","version":269},{"n":1022,"text":"\t}","atom":"a2692","author":"box-grants","version":269},{"n":1023,"text":"","atom":"a2692","author":"box-grants","version":269},{"n":1024,"text":"\t/** This agent's unpublished changes, file by file. */","atom":"a0","author":"init","version":0},{"n":1025,"text":"\tdiff(): Promise<DiffAnswer> {","atom":"a0","author":"init","version":0},{"n":1026,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"diff\"), {});","atom":"a0","author":"init","version":0},{"n":1027,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1028,"text":"","atom":"a469","author":"pinch","version":52},{"n":1029,"text":"\t/** Another agent's recorded, unpublished changes, file by file: read only, as the website's drafts show them. */","atom":"a469","author":"pinch","version":52},{"n":1030,"text":"\tdiffOf(agent: string): Promise<DiffAnswer> {","atom":"a469","author":"pinch","version":52},{"n":1031,"text":"\t\treturn this.json(\"GET\", `/diff?${query({ agent })}`);","atom":"a469","author":"pinch","version":52},{"n":1032,"text":"\t}","atom":"a469","author":"pinch","version":52},{"n":1033,"text":"","atom":"a0","author":"init","version":0},{"n":1034,"text":"\t/** Discard this agent's unpublished changes to `files` (null: all of them). */","atom":"a0","author":"init","version":0},{"n":1035,"text":"\trestore(files: readonly string[] | null): Promise<RestoreAnswer> {","atom":"a0","author":"init","version":0},{"n":1036,"text":"\t\treturn this.json(\"POST\", this.agentPath(\"restore\"), files === null ? { all: true } : { files });","atom":"a0","author":"init","version":0},{"n":1037,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1038,"text":"","atom":"a0","author":"init","version":0},{"n":1039,"text":"\twhy(file: string, line: number, view: View = {}, version?: number): Promise<WhyAnswer> {","atom":"a2166","author":"whytrail","version":193},{"n":1040,"text":"\t\treturn this.json(\"GET\", `/why?${query({ file, line, version, ...view })}`);","atom":"a2166","author":"whytrail","version":193},{"n":1041,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1042,"text":"","atom":"a0","author":"init","version":0},{"n":1043,"text":"\twhere(): Promise<WhereAnswer> {","atom":"a0","author":"init","version":0},{"n":1044,"text":"\t\treturn this.json(\"GET\", \"/where\");","atom":"a0","author":"init","version":0},{"n":1045,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1046,"text":"","atom":"a0","author":"init","version":0},{"n":1047,"text":"\t/**","atom":"a0","author":"init","version":0},{"n":1048,"text":"\t * Send the folder as a tar.gz and run a command in the agent's box. Output","atom":"a0","author":"init","version":0},{"n":1049,"text":"\t * goes to `io.out` as it arrives, and the box's stderr to `io.err` (the","atom":"a0","author":"init","version":0},{"n":1050,"text":"\t * server keeps them apart when asked; an older one sends both as out).","atom":"a0","author":"init","version":0},{"n":1051,"text":"\t * Answers the command's exit code.","atom":"a0","author":"init","version":0},{"n":1052,"text":"\t *","atom":"a0","author":"init","version":0},{"n":1053,"text":"\t * When the stream breaks before the exit line and the server gave the run","atom":"a0","author":"init","version":0},{"n":1054,"text":"\t * an id, the run goes on in the box: this reconnects to it and carries on","atom":"a0","author":"init","version":0},{"n":1055,"text":"\t * from the last output printed, so nothing is lost or printed twice. The","atom":"a0","author":"init","version":0},{"n":1056,"text":"\t * command itself is never sent twice.","atom":"a0","author":"init","version":0},{"n":1057,"text":"\t */","atom":"a0","author":"init","version":0},{"n":1058,"text":"\tasync run(command: string, tarGz: Uint8Array<ArrayBuffer>, io: RunIO): Promise<number> {","atom":"a0","author":"init","version":0},{"n":1059,"text":"\t\tconst res = await postRun(this, command, tarGz, io.onRetry, io.replace, io.fresh);","atom":"a0","author":"init","version":0},{"n":1060,"text":"\t\t// X-Abso-Box: cold means the box started for this run; X-Abso-Prep says whether it started from the prep (#37).","atom":"a491","author":"pinch","version":54},{"n":1061,"text":"\t\tio.onBox?.(res.headers.get(\"x-abso-box\") === \"cold\", res.headers.get(\"x-abso-prep\") ?? undefined);","atom":"a491","author":"pinch","version":54},{"n":1062,"text":"\t\treturn follow(this, res, res.headers.get(\"x-abso-run\"), { at: 0, errAt: 0 }, io);","atom":"a491","author":"pinch","version":54},{"n":1063,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1064,"text":"","atom":"a0","author":"init","version":0},{"n":1065,"text":"\t/**","atom":"a0","author":"init","version":0},{"n":1066,"text":"\t * Start a run and answer its id without waiting: the job goes on in the box","atom":"a0","author":"init","version":0},{"n":1067,"text":"\t * after this connection closes (abso run --detach; abso logs <id> follows it).","atom":"a0","author":"init","version":0},{"n":1068,"text":"\t */","atom":"a0","author":"init","version":0},{"n":1069,"text":"\tasync startRun(","atom":"a0","author":"init","version":0},{"n":1070,"text":"\t\tcommand: string,","atom":"a0","author":"init","version":0},{"n":1071,"text":"\t\ttarGz: Uint8Array<ArrayBuffer>,","atom":"a0","author":"init","version":0},{"n":1072,"text":"\t\tonRetry?: (why: string, attempt: number) => void,","atom":"a0","author":"init","version":0},{"n":1073,"text":"\t\treplace = false,","atom":"a0","author":"init","version":0},{"n":1074,"text":"\t): Promise<string> {","atom":"a0","author":"init","version":0},{"n":1075,"text":"\t\tconst res = await postRun(this, command, tarGz, onRetry, replace);","atom":"a0","author":"init","version":0},{"n":1076,"text":"\t\tconst id = res.headers.get(\"x-abso-run\");","atom":"a491","author":"pinch","version":54},{"n":1077,"text":"\t\tif (id === null) {","atom":"a0","author":"init","version":0},{"n":1078,"text":"\t\t\t// No id: the box failed before the job started ({\"error\"} in the body), or the server can't detach.","atom":"a0","author":"init","version":0},{"n":1079,"text":"\t\t\tawait consumeRun(res, { out: () => {} }, { at: 0, errAt: 0 });","atom":"a0","author":"init","version":0},{"n":1080,"text":"\t\t\tthrow new ApiError(\"this server gives runs no id, so a run can't be detached\");","atom":"a0","author":"init","version":0},{"n":1081,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":1082,"text":"\t\tawait res.body?.cancel();","atom":"a0","author":"init","version":0},{"n":1083,"text":"\t\treturn id;","atom":"a0","author":"init","version":0},{"n":1084,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1085,"text":"","atom":"a0","author":"init","version":0},{"n":1086,"text":"\t/** A run's output from its start, for as long as the box keeps it, until it ends (abso logs). Answers its exit code. */","atom":"a0","author":"init","version":0},{"n":1087,"text":"\tasync logs(id: string, io: RunIO): Promise<number> {","atom":"a0","author":"init","version":0},{"n":1088,"text":"\t\tlet res: Response;","atom":"a0","author":"init","version":0},{"n":1089,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":1090,"text":"\t\t\tres = await this.send(followUrl(this, id, { at: 0, errAt: 0 }), { headers: this.headers() });","atom":"a782","author":"pinch","version":88},{"n":1091,"text":"\t\t} catch (err) {","atom":"a0","author":"init","version":0},{"n":1092,"text":"\t\t\tconst e = err as Error;","atom":"a0","author":"init","version":0},{"n":1093,"text":"\t\t\tthrow new ApiError(","atom":"a0","author":"init","version":0},{"n":1094,"text":"\t\t\t\t`could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,","atom":"a0","author":"init","version":0},{"n":1095,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":1096,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":1097,"text":"\t\tif (res.status === 404) throw new ApiError(`no run ${id} in this box: ${errorSentence(await res.text())}`, 404);","atom":"a0","author":"init","version":0},{"n":1098,"text":"\t\tif (!res.ok || res.body === null)","atom":"a0","author":"init","version":0},{"n":1099,"text":"\t\t\tthrow new ApiError(`logs answered ${res.status}: ${errorSentence(await res.text())}`, res.status);","atom":"a0","author":"init","version":0},{"n":1100,"text":"\t\treturn follow(this, res, id, { at: 0, errAt: 0 }, io);","atom":"a0","author":"init","version":0},{"n":1101,"text":"\t}","atom":"a0","author":"init","version":0},{"n":1102,"text":"}","atom":"a0","author":"init","version":0}],"atoms":[{"atom":"a0","author":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z","publish":{"draft":null,"version":0,"agent":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z"}},{"atom":"a24","author":"pinch","message":"","time":1791510162333,"timeIso":"2026-10-09T01:42:42.333Z","publish":{"draft":null,"version":5,"agent":"pinch","message":"abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).","time":1791510167765,"timeIso":"2026-10-09T01:42:47.765Z"}},{"atom":"a62","author":"infra-split","message":"","time":1791514747081,"timeIso":"2026-10-09T02:59:07.081Z","publish":{"draft":null,"version":14,"agent":"infra-split","message":"An asker can take back an ask: abso ask --withdraw <ask> [--note \"why\"]\n\nAn ask that later decisions have overtaken used to sit in the asked person's waiting list for good. Only they could answer it, and \"none of these\" wasn't an option. Now the one who asked can withdraw it.\n\n- `abso ask --withdraw <ask> [--note \"why\"]` sends one call to the server's withdraw route. It's refused before any call when mixed with a question or the other ask flags. `--note-file` reads the note from a file or stdin, like every text flag.\n- A withdrawn ask closes the way an answered one does: it leaves the waiting list, and it stops holding its issue at Blocked. The ask keeps its question. The asker's note is kept as why, and the one asked hears it.\n- Ask gains `outcome?: \"withdrawn\"`. Older servers leave it out. The asks list and an issue's page show \"withdrawn by <asker>\" and the note, instead of \"answered by\".\n- The server side of the route comes with the hosted Issues service. Until it's there, the call answers with that server's error.\n\nTests: the new usage mistakes, and the single POST to the asker's own route. Checked: npx biome ci . and npm run check exit 0 (704 pass, 1 skipped).","time":1791514878707,"timeIso":"2026-10-09T03:01:18.707Z"}},{"atom":"a74","author":"pinch","message":"","time":1791520722147,"timeIso":"2026-10-09T04:38:42.147Z","publish":{"draft":null,"version":15,"agent":"pinch","message":"--attach says plainly when the Issues server doesn't take attachments yet\n\nA server from before attachments has no upload route. It answered 400 'the body is JSON', or 404, and the client printed that as it came, which told nobody what had happened. Now the client says the server doesn't take attachments yet, that the file wasn't sent and nothing was written, and to leave --attach off or link the image instead. A server that has the route but nowhere to keep files (501) gets the same message. A test checks the message and that no issue is opened.","time":1791520723403,"timeIso":"2026-10-09T04:38:43.403Z"}},{"atom":"a142","author":"devops","message":"","time":1791528389952,"timeIso":"2026-10-09T06:46:29.952Z","publish":{"draft":null,"version":20,"agent":"devops","message":"Add abso search: find a project's issues by words or meaning\n\n`abso search \"<words>\" [--limit <N>]` lists the project's issues that\nmatch, best first, and is served as an MCP tool as well.\n\n- Each hit shows the issue, then where it matched: the title, the\n  description, a comment, or \"by meaning\".\n- \"#N\" or \"N\" puts issue N first.\n- Where the server also searches by meaning, an issue worded unlike\n  the search still turns up; the hit says so.","time":1791528391686,"timeIso":"2026-10-09T06:46:31.686Z"}},{"atom":"a163","author":"pinch","message":"","time":1791529997817,"timeIso":"2026-10-09T07:13:17.817Z","publish":{"draft":null,"version":23,"agent":"pinch","message":"abso issue <N> --copy-to <project>: copy an issue into another project, with its comments, answered asks and labels, each keeping its author and time. The Issues server reads the source issue itself; the client sends only which issue, and any cleaned texts.\n\n- --dry-run shows what the copy would make (title, how many comments and asks, which were edited, labels) and what's left behind. It writes nothing.\n- --clean <file> gives cleaned texts by source id, as JSON: {title, description, comments: [{id, text}], asks: [{id, question, answer}]}. A comment left out of a given list isn't copied.\n- --copy-to goes alone, so a copy is never half an edit. Copying into the project the issue is already in is refused before any call.\n- When a live server refuses the copy (copying out of a project there takes an owner of it), the message says --dry-run still works.\n- The MCP issue tool's clean input is a file too, so it's confined to the server's start folder like attach.\n\nTests: client/test/issues.test.ts, against a stand-in Issues server. The run --parallel test that sometimes times out under a full run passed when rerun.","time":1791530025571,"timeIso":"2026-10-09T07:13:45.571Z"}},{"atom":"a189","author":"pinch","message":"","time":1791532995488,"timeIso":"2026-10-09T08:03:15.488Z","publish":{"draft":null,"version":26,"agent":"pinch","message":"Publish and log fixes, and a flaky test removed.\n\n- A publish or a land now waits up to 150 s for the server's answer, not 30 s. The server may work on one request for up to 2 minutes, so a slow merge was reported as failed and then landed.\n- abso log reads any length of history. The server sends at most 200 versions a page, and the client now follows its pages: -n 2000 gives 2000, and --since or a folder reads up to 1000. abso log --before <version> starts below that version. The end of the list names the --before for the next older ones, and a filtered read says when it stopped short.\n- The test 'sends one run, and takes each command as one quoted word' is removed: it failed on Windows about half the time. The stand-in server the client tests use no longer closes idle kept-alive connections, which other tests also tripped on under load (ECONNRESET).\n\nCheck: 722 pass, 0 fail.","time":1791533012122,"timeIso":"2026-10-09T08:03:32.122Z"}},{"atom":"a198","author":"review","message":"","time":1791533506483,"timeIso":"2026-10-09T08:11:46.483Z","publish":{"draft":null,"version":27,"agent":"review","message":"Client: ABSO_ environment names (AVCS_ still read), .absoignore (.avcsignore still read), .abso-export.json, shot files; READMEs say abso (abso 224)","time":1791533840174,"timeIso":"2026-10-09T08:17:20.174Z"}},{"atom":"a223","author":"pinch","message":"","time":1791537862280,"timeIso":"2026-10-09T09:24:22.280Z","publish":{"draft":null,"version":29,"agent":"pinch","message":"Client: abso issue N --save-attachments <dir> saves each attachment on an issue and its comments once (an SVG's own file beside its drawing), outside the abso folder unless the place is ignored; MCP confines the folder like attach. abso export now stamps its folder with .abso-export, one line of JSON in a file with no extension, so the exported project's own formatter and linter pass it by; a folder stamped .abso-export.json or .avcs-export.json still counts as an export.","time":1791540340754,"timeIso":"2026-10-09T10:05:40.754Z"}},{"atom":"a297","author":"pinch","message":"","time":1791544558067,"timeIso":"2026-10-09T11:15:58.067Z","publish":{"draft":null,"version":35,"agent":"pinch","message":"Client: files on asks and answers. abso ask and abso answer take --attach (uploaded first, as on issues; not with --withdraw); an ask lists its question's files under it and its answer's under the answer; abso issue N --save-attachments takes them too. An Issues server from before asks carried files keeps the words and drops the files: abso says so (notKept in --json) instead of losing them quietly. Wire: Ask.attachments and answer.attachments, optional. Client tests 286/286, tsc and biome clean.","time":1791544592629,"timeIso":"2026-10-09T11:16:32.629Z"}},{"atom":"a469","author":"pinch","message":"","time":1791581006700,"timeIso":"2026-10-09T21:23:26.700Z","publish":{"draft":null,"version":52,"agent":"pinch","message":"abso diff --agent <name>: review another agent's unpublished changes\n\nReviewing a teammate's work before it's published had no command: abso diff showed only your own draft, and abso status names files but not lines. Reviewers read the other agent's folder on disk, which only works on a shared machine and shows their disk, not what they recorded.\n\nabso diff --agent alice now prints alice's recorded, unpublished changes line by line, the way abso diff prints yours: \"alice's recorded, unpublished changes in shared (on version 12): 2 files, 5 lines added, 1 removed.\" Paths narrow it as usual. It reads what the server holds, the same route the website's drafts use, so it records nothing and changes nothing. An agent with no changes says so; a name the project doesn't know is refused by the server. --agent doesn't go with two versions or --draft.\n\nThe test server answers GET /p/:project/diff?agent= as the Worker does. Tested in client.test.ts.","time":1791581673467,"timeIso":"2026-10-09T21:34:33.467Z"}},{"atom":"a479","author":"pinch","message":"","time":1791583010910,"timeIso":"2026-10-09T21:56:50.910Z","publish":{"draft":null,"version":53,"agent":"pinch","message":"abso ack <ask> [\"note\"]: the one asked says they have an ask and will answer later. The ask stays open and keeps blocking; abso issue shows it as acknowledged with the note, and the asker hears it. The Ask wire type gains ack, the API client gains ack(), and the skill mentions the command.","time":1791583024285,"timeIso":"2026-10-09T21:57:04.285Z"}},{"atom":"a491","author":"pinch","message":"","time":1791586659806,"timeIso":"2026-10-09T22:57:39.806Z","publish":{"draft":null,"version":54,"agent":"pinch","message":"The client and the edit mods send and read X-Abso-* headers only (Client, Name, Run-Key, Kind, Admin; Run, Box, Prep from answers). Servers have read X-Abso-* beside the old names for a while and answer under both, so this works with any current server.","time":1791586669845,"timeIso":"2026-10-09T22:57:49.845Z"}},{"atom":"a658","author":"pinch","message":"","time":1791609963115,"timeIso":"2026-10-10T05:26:03.115Z","publish":{"draft":null,"version":72,"agent":"pinch","message":"Asks become threads: abso reply <ask> \"...\" adds to an ask from either side, open or answered, and --question hands the turn to the asker until they reply. abso ask <N> shows one ask with its whole thread and whose turn it is; abso waiting --asked lists the asks you sent. An ack's note is the thread's first reply. reply is an MCP tool too. Needs an Issues server with the reply, ask and asked routes.","time":1791609984916,"timeIso":"2026-10-10T05:26:24.916Z"}},{"atom":"a759","author":"infra-pipeline","message":"","time":1791615855440,"timeIso":"2026-10-10T07:04:15.440Z","publish":{"draft":null,"version":85,"agent":"infra-pipeline","message":"abso pipeline runs: list a project's pipeline runs, show one run's jobs (state, why each stopped, exit, time, an npm or deploy job's phase), and print a job's log with --log <pipeline.job>","time":1791615856832,"timeIso":"2026-10-10T07:04:16.832Z"}},{"atom":"a764","author":"pinch","message":"","time":1791616755509,"timeIso":"2026-10-10T07:19:15.509Z","publish":{"draft":null,"version":86,"agent":"pinch","message":"Read a public project signed out: abso join <project> --reader with no sign-in makes a folder that reads it. The folder holds only its settings (server, project, visitor), sends no sign-in whatever the environment or the box holds, follows no redirect, and runs status, log, show, files, blame, why, where, issues, issue and search; every other command is refused before any call, from an allow-list a new command has to join. join answers a private project and a missing one alike, by the status answer's code alone. Tests in client/test/visitor.test.ts.","time":1791616980022,"timeIso":"2026-10-10T07:23:00.022Z"}},{"atom":"a782","author":"pinch","message":"","time":1791618430979,"timeIso":"2026-10-10T07:47:10.979Z","publish":{"draft":null,"version":88,"agent":"pinch","message":"Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.","time":1791618771034,"timeIso":"2026-10-10T07:52:51.034Z"}},{"atom":"a786","author":"pinch","message":"","time":1791619086037,"timeIso":"2026-10-10T07:58:06.037Z","publish":{"draft":null,"version":89,"agent":"pinch","message":"abso reply N, abso ask N and abso asked name a server without ask threads instead of answering its bare 404.","time":1791619328862,"timeIso":"2026-10-10T08:02:08.862Z"}},{"atom":"a964","author":"codex-prose-authorship-1","message":"","time":1791788216502,"timeIso":"2026-10-12T06:56:56.502Z","publish":{"draft":null,"version":108,"agent":"codex-prose-authorship-1","message":"Implement bounded sequential client recording for #606","time":1791788591360,"timeIso":"2026-10-12T07:03:11.360Z"}},{"atom":"a1656","author":"codex-capacity-chair","message":"","time":1791944420248,"timeIso":"2026-10-14T02:20:20.248Z","publish":{"draft":null,"version":162,"agent":"codex-capacity-chair","message":"Add reviewed disk-first history and indexed graph storage for core issue 16; retain runtime activation gate","time":1791945013341,"timeIso":"2026-10-14T02:30:13.341Z"}},{"atom":"a2090","author":"candidates","message":"","time":1792003615465,"timeIso":"2026-10-14T18:46:55.465Z","publish":{"draft":null,"version":186,"agent":"candidates","message":"Read a version of shared without some earlier versions: abso show <N> --without A,B shows what differs and abso export <dir> --version N --without A,B writes the files. The server's GET without?version=&versions= checks the set left exactly as asked: when a version it keeps builds on one left out, it refuses with that chain, the files and the wider set that works, and never widens it. Atoms keep their ids and authors; shared and its log don't change; the same ask gives the same tree hash.","time":1792004002371,"timeIso":"2026-10-14T18:53:22.371Z"}},{"atom":"a2166","author":"whytrail","message":"","time":1792019576836,"timeIso":"2026-10-14T23:12:56.836Z","publish":{"draft":null,"version":193,"agent":"whytrail","message":"abso why follows a line back past formatting to its reason, and names git commits\n\nwhy now lists a line's earlier changes, newest first, with what the line read before each. A change that rewrote a line left the line it replaced in the file's history; why pairs the two (same code formatted differently, the same code rewrapped, or the most similar line) and follows the pairs back. A change that only touched formatting (whitespace, line wrapping, quotes, trailing commas, line-end semicolons, parentheses around a lone arrow parameter) is skipped by default, and why names it: 'Skipped 1 formatting change since: version 366'. --all shows those too. --at <version> reads the line as it was at that version.\n\nA push imported from git (client/scripts/import-git.ts, or a plain git push) names its commit and author in why and blame. import-git.ts now also records where the repository's issues are, from origin on GitHub or GitLab or --issues, and why says which issue #N in an imported message or line means. A project imported before this can say it once in abso.json: \"gitIssues\": \"https://github.com/owner/repo/issues\".\n\nCloses issues 20 and 21's tool side.","time":1792019638939,"timeIso":"2026-10-14T23:13:58.939Z"}},{"atom":"a2392","author":"autosettle","message":"","time":1792048145950,"timeIso":"2026-10-15T07:09:05.950Z","publish":{"draft":null,"version":220,"agent":"autosettle","message":"abso autosettle: see or change what the server does with a held push (abso-core 23)\n\nabso autosettle says the project's choice: Off, Advise, or Settle at a confidence. It also says when the gate is stopped and who changed it last. abso autosettle off|advise|settle [--at 0.3-0.95] changes it, which takes the owner's key (on staging, the shared token too); without --at the server keeps its own. On a server with no choice per project (the open server), it says the operator's AUTOSETTLE decides. A visitor folder refuses it.\n\nTried on project abso's Worker run locally (read, settle --at 0.7, advise, a bad word, --at 2) and on the open server. Tests: autosettle-command (words), visitor (the allow-list), typecheck clean.","time":1792048146388,"timeIso":"2026-10-15T07:09:06.388Z"}},{"atom":"a2407","author":"autosettle","message":"","time":1792051756544,"timeIso":"2026-10-15T08:09:16.544Z","publish":{"draft":null,"version":223,"agent":"autosettle","message":"abso autosettle history: the held pushes the model advised on, and what was then kept (abso-core 23)\n\nabso autosettle history lists a project's held pushes that got advice, newest first. Each collision gets one line: what the model said (a side or leave it to an agent, by a check in code or the model with its confidence), whether abso was told to settle it, and what the agent then kept, automatically or by hand, in which version. abso autosettle history <id> shows one, naming its calls to the model; --json has each exact request and raw answer. It reads the platform's /autosettle/history routes (project abso 1249).\n\nTests: autosettle-command (words, history lines), visitor (the allow-list); typecheck clean.","time":1792051943717,"timeIso":"2026-10-15T08:12:23.717Z"}},{"atom":"a2608","author":"groups","message":"","time":1792091008046,"timeIso":"2026-10-15T19:03:28.046Z","publish":{"draft":null,"version":256,"agent":"groups","message":"groups: abso groups and abso group, for a project's named groups of agents and people with one shared history. abso group <name> reads its settings, members and history (newest first; --before, --limit, --kind). --post adds a message, with news for every other member unless --news names some, --except leaves some out, or --news none keeps it in the history only. --join, --leave, --add, --remove, --rename, --private on|off and --joinable on|off change it; abso group new makes one. A retried post never posts twice (the Idempotency-Key every POST sends). Both are MCP tools; a visitor folder refuses them. Tests: client/test/group-commands.test.ts, visitor.test.ts.","time":1792091364906,"timeIso":"2026-10-15T19:09:24.906Z"}},{"atom":"a2609","author":"groups","message":"","time":1792091008903,"timeIso":"2026-10-15T19:03:28.903Z","publish":{"draft":null,"version":256,"agent":"groups","message":"groups: abso groups and abso group, for a project's named groups of agents and people with one shared history. abso group <name> reads its settings, members and history (newest first; --before, --limit, --kind). --post adds a message, with news for every other member unless --news names some, --except leaves some out, or --news none keeps it in the history only. --join, --leave, --add, --remove, --rename, --private on|off and --joinable on|off change it; abso group new makes one. A retried post never posts twice (the Idempotency-Key every POST sends). Both are MCP tools; a visitor folder refuses them. Tests: client/test/group-commands.test.ts, visitor.test.ts.","time":1792091364906,"timeIso":"2026-10-15T19:09:24.906Z"}},{"atom":"a2692","author":"box-grants","message":"","time":1792101552634,"timeIso":"2026-10-15T21:59:12.634Z","publish":{"draft":null,"version":269,"agent":"box-grants","message":"abso news --stream and --follow (abso 690, news wakes agents): --stream mints a ticket and prints the Monitor call (ws URL plus subprotocols, 30-minute timeout) so a Claude Code chat wakes the moment news arrives, with no polling. --follow holds the seat's stream itself, a line per item, a new ticket per socket, a ping every 45 s, waits 1 s doubling to a minute between sockets, and stops on a refused key or a server without the stream (404). The key never goes in a URL or a Monitor call. Needs the server's news/ticket and news/stream routes (Read Speed, next). Tests: client/test/news-stream.test.ts.","time":1792101553240,"timeIso":"2026-10-15T21:59:13.240Z"}},{"atom":"a2741","author":"groups","message":"","time":1792107664909,"timeIso":"2026-10-15T23:41:04.909Z","publish":{"draft":null,"version":277,"agent":"groups","message":"Seats say who is calling, and a seat's earlier chat can hear that another chat picked it up.\n\nThe CLI sends X-Abso-Caller on every call: the chat's session id (CLAUDE_CODE_SESSION_ID, when abso runs in a Claude Code chat), the computer's name and the folder, base64url JSON, at most 512 bytes. A folder that reads signed out sends none. src/caller.ts reads it back exactly or not at all. It's information only; the agent key still decides who is calling.\n\nThe engine's seatNotice(agent, place, key) queues one fixed-wording news line to that seat, once per key. An answer carrying seatNotice is printed once with the news.\n\nTests: client caller and visitor, worker/project seat-notice, announce-person, news-*, tells (29 pass); tsc clean.","time":1792107667407,"timeIso":"2026-10-15T23:41:07.407Z"}},{"atom":"a2799","author":"box-grants","message":"","time":1792119148993,"timeIso":"2026-10-16T02:52:28.993Z","publish":{"draft":null,"version":285,"agent":"box-grants","message":"abso news --stream (abso 690): read the ticket's expiry as the ISO time the server sends (staging 1418) as well as milliseconds. It printed 'within NaN seconds', and the stream mark that stands the hooks mod's poll down came out NaN, so the poll kept running. Found in the staging proof. Tests: client/test/news-stream.test.ts.","time":1792119149637,"timeIso":"2026-10-16T02:52:29.637Z"}},{"atom":"a2819","author":"pinch","message":"","time":1792119773277,"timeIso":"2026-10-16T03:02:53.277Z","publish":{"draft":null,"version":287,"agent":"pinch","message":"Local projects: abso init --local keeps a project's history on this machine, with no server, sign-in or network\n\nA local folder's calls never leave the process. The client runs the open server's own router and project object (server/src) in-process, over Node's built-in SQLite. It's the same engine with the same answers, so what the commands print matches a server.\n\n- abso init --local [--project <name>] [--agent <name>] [--store <folder>] makes the project, and abso join <project> --local adds a folder. After that, record, push, pull, log, blame and the held collisions work as usual. The folder's config says \"server\": \"local\".\n- Where the store lives: --store (kept in the folder's config; a store inside the folder is left out of its files through .absoignore), else ABSO_STORE, else this user's data folder: %LOCALAPPDATA%\\abso\\store, ~/Library/Application Support/abso/store, or $XDG_DATA_HOME/abso/store. Nothing needs a writable home folder when ABSO_STORE or --store is set.\n- Each project is <store>/<project>/project.sqlite. Every call runs in one SQLite write transaction, which is the store's lock: other processes wait for it, and a process that dies mid-call keeps nothing half-written. A process reloads the project only when SQLite's data_version shows another process wrote.\n- No credential goes with a local folder's calls. The edit mod leaves local folders alone, so abso record sends their edits. Issues, asks and news aren't in local projects yet.\n- Needs Node 22.13 or later (node:sqlite); its experimental warning is kept out of the output. Run as .ts, a module hook supplies the Durable Object base class (client/src/durable-object-stand-in.ts); the build aliases cloudflare:workers to the same file. client/src/local-server.mjs, with its .d.mts, keeps the client's typecheck out of server/src, which has its own.\n- Each command closes the store files it opened.\n\nTests: local (8, with fetch replaced by one that throws: init, record, push, join, pull, log, blame, a held collision, --store inside the folder, refusals), plus failed-start, install, caller, doctor, lost-pull, help, body-files: 60 pass; tsc clean. The bundle built with the alias runs init, push and log locally.","time":1792119778236,"timeIso":"2026-10-16T03:02:58.236Z"}}]}