Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 4 to 5

Compare

+43 −5 in 4 places
Lines 50–56 at 5 (were 50–56 at 4)
5050 WhereAnswer,
5151 WhyAnswer,
5252} from "./history-answers.ts";
53−import type { Ask, Draft, DraftBody, News as IssueNews, IssuePage, IssueRow } from "./issues-wire.ts";
53+import type { Ask, Attachment, Draft, DraftBody, News as IssueNews, IssuePage, IssueRow } from "./issues-wire.ts";
5454import type { Modes } from "./modes.ts";
5555
5656export * from "./api-answers.ts";
Lines 65–71 at 5 (were 65–71 at 4)
6565} from "./box-run.ts";
6666export * from "./ci-answers.ts";
6767export * from "./history-answers.ts";
68−export type { Ask, Draft, DraftBody, IssueNews, IssuePage, IssueRow };
68+export type { Ask, Attachment, Draft, DraftBody, IssueNews, IssuePage, IssueRow };
6969
7070/**
7171 * How long a call may take: the base, plus 1 s for each 100 KB it sends
Lines 400–438 at 5 (were 400–409 at 4)
400400 }
401401 }
402402
403− issueOpen(body: DraftBody & { title: string }): Promise<{ id: number; news?: IssueNews }> {
403+ issueOpen(body: DraftBody & { title: string; attachments?: string[] }): Promise<{ id: number; news?: IssueNews }> {
404404 return this.#issues("POST", this.agentPath("issue"), body);
405405 }
406406
407+ /** Uploads an image to the Issues Worker (abso issue 171): it checks the type by the bytes, strips metadata and answers its id. */
408+ async attachmentUpload(bytes: Uint8Array, name: string): Promise<Attachment> {
409+ if (this.issuesServer === undefined)
410+ throw new ApiError(`${this.config.server} has no Issues Worker beside it; AVCS_ISSUES_SERVER names one`);
411+ const path = this.agentPath("attachments");
412+ let res: Response;
413+ try {
414+ res = await fetch(this.url(path, this.issuesServer), {
415+ method: "POST",
416+ headers: { ...this.headers("application/octet-stream"), "x-avcs-name": encodeURIComponent(name) },
417+ body: bytes as Uint8Array<ArrayBuffer>,
418+ signal: AbortSignal.timeout(Math.max(this.timeoutMs, 120_000)),
419+ });
420+ } catch (err) {
421+ const e = err as Error;
422+ throw new ApiError(
423+ `could not reach ${this.issuesServer}: ${(e.cause as Error | undefined)?.message ?? e.message}`,
424+ );
425+ }
426+ const text = await res.text();
427+ if (!res.ok) throw new ApiError(`uploading ${name} answered ${res.status}: ${errorSentence(text)}`, res.status);
428+ return JSON.parse(text) as Attachment;
429+ }
431+ /** Where an attachment is served. */
432+ attachmentUrl(id: string): string {
433+ return this.url(`/attachments/${id}`, this.issuesServer);
434+ }
407436 /** An edit (abso issue 3): it tells the issue's watchers, and `also`, unless `notify` is false. null clears a parent or Agent. */
408437 issueEdit(
409438 id: number,
Lines 451–467 at 5 (were 422–429 at 4)
422451 return this.#issues("POST", this.agentPath(`issue/${id}/edit`), body);
423452 }
424453
425− issueComment(id: number, text: string, objection = false): Promise<{ id: number; news?: IssueNews }> {
426− return this.#issues("POST", this.agentPath(`issue/${id}/comment`), { text, ...(objection ? { objection } : {}) });
454+ issueComment(
455+ id: number,
456+ text: string,
457+ objection = false,
458+ attachments: readonly string[] = [],
459+ ): Promise<{ id: number; news?: IssueNews }> {
460+ return this.#issues("POST", this.agentPath(`issue/${id}/comment`), {
461+ text,
462+ ...(objection ? { objection } : {}),
463+ ...(attachments.length > 0 ? { attachments } : {}),
464+ });
427465 }
428466
429467 issueDrop(id: number): Promise<{ news?: IssueNews }> {
MCP
compare on this site's /mcp
CLI
abso diff 4 5 client/src/api.ts --json
JSON
/christopher/abso-core/compare/4..5?file=client%2Fsrc%2Fapi.ts&format=json