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 162 to 318

Compare

+70 −8 in 7 places
Lines 3–15 at 318 (were 3–13 at 162)
33// 2 MB) is split across rows and joined on load. Ported from the platform's worker/src/engine-project.ts; the
44// writer-adoption and R2 version parts are left out.
55
6+import { jsonValueChunks } from "../../src/engine/json-value-chunks.ts";
67import { blame, folderBlame, why } from "../../worker/project/blame.ts";
78import { feedEvents } from "../../worker/project/feed.ts";
89import { type Entry, type ProjectStore as LogStore, MemoryStore, Project } from "../../worker/project/project.ts";
910import type { EditBody, ProjectCalls, ProjectHistory } from "../../worker/project/project-api.ts";
1011import { where } from "../../worker/project/where.ts";
12+import type { PushSnapshotMetadata } from "./push-snapshot.ts";
1113
1214/** The parts of a Durable Object's storage the log and blob store use, declared structurally so tests can stand in. */
1315export interface SqliteStorage {
Lines 35–56 at 318 (were 33–38 at 162)
3335 return parts;
3436}
3537
38+/** Retains one log row plus an encoder fragment, preserving legacy row boundaries. */
39+export function* streamedLogParts(value: unknown): IterableIterator<string> {
40+ let pending = "";
41+ for (const chunk of jsonValueChunks(value)) {
42+ pending += chunk;
43+ while (pending.length > LOG_PART_CHARACTERS) {
44+ let end = LOG_PART_CHARACTERS;
45+ const last = pending.charCodeAt(end - 1);
46+ if (last >= 0xd800 && last <= 0xdbff) end--;
47+ yield pending.slice(0, end);
48+ pending = pending.slice(end);
49+ }
50+ }
51+ if (pending) yield pending;
52+}
3654/** The lines an entry's atoms write: what a loaded project's size grows with (#46, #56). */
3755function linesIn(entry: Entry): number {
3856 let n = 0;
Lines 442–452 at 318 (were 424–434 at 162)
424442 if (keys > 0) this.storage.sql.exec("UPDATE counts SET value = value + ? WHERE name = 'keys'", keys);
425443 let chars = 0;
426444 for (const entry of entries) {
427− const json = JSON.stringify(entry);
428− logParts(json).forEach((text, part) => {
445+ let part = 0;
446+ for (const text of streamedLogParts(entry)) {
429447 chars += text.length;
430− this.storage.sql.exec("INSERT INTO log (seq, part, text) VALUES (?, ?, ?)", next, part, text);
431− });
448+ this.storage.sql.exec("INSERT INTO log (seq, part, text) VALUES (?, ?, ?)", next, part++, text);
449+ }
432450 next++;
433451 }
434452 // Chars are only added to once counted: a log from before the count is summed whole first (logSize).
Lines 496–507 at 318 (were 478–485 at 162)
478496 ...(folder !== undefined ? { folder } : {}),
479497 });
480498 }
481− why(file: string, line: number, draft?: string, agent?: string) {
482− return why(this.project, file, line, { ...(draft ? { draft } : {}), ...(agent ? { agent } : {}) });
499+ why(file: string, line: number, draft?: string, agent?: string, version?: number) {
500+ return why(this.project, file, line, {
501+ ...(draft ? { draft } : {}),
502+ ...(agent ? { agent } : {}),
503+ ...(version !== undefined ? { version } : {}),
504+ });
483505 }
484506 where() {
485507 return where(this.project);
Lines 523–535 at 318 (were 501–509 at 162)
501523 fileAt(path: string, version: number, draft: string | null, agent?: string) {
502524 return this.project.fileAt(path, version, { draft, ...(agent ? { agent } : {}) });
503525 }
504− compare(from: number, to: number, draft: string | null, agent?: string) {
505− return this.project.compare(from, to, { draft, ...(agent ? { agent } : {}) });
526+ compare(from: number, to: number, draft: string | null, agent?: string, summary?: boolean) {
527+ const where = { draft, ...(agent ? { agent } : {}) };
528+ return summary ? this.project.compareSummary(from, to, where) : this.project.compare(from, to, where);
506529 }
530+ without(version: number, versions: readonly number[]) {
531+ return this.project.without(version, versions);
532+ }
507533 show(version: number, draft: string | null, agent?: string) {
508534 return this.project.show(version, { draft, ...(agent ? { agent } : {}) });
509535 }
Lines 572–581 at 318 (were 546–551 at 162)
546572 announcePerson(person: { id: string; name: string }, text: string, to?: string[]) {
547573 return this.project.announcePerson(person, text, to, Date.now());
548574 }
575+ /** A seat's earlier chat hears that another chat used the seat (277, groups); as abso's worker has it. */
576+ seatNotice(agent: string, place: string, key: string) {
577+ return this.project.seatNotice(agent, place, key);
578+ }
549579 starting(agent: string, text: string | null, files?: string[], options: { issue?: unknown; done?: unknown } = {}) {
550580 return this.project.starting(agent, text, files, Date.now(), options);
551581 }
Lines 820–857 at 318 (were 790–795 at 162)
790820 filesAt(version: number) {
791821 return this.project.viewAt(version).files();
792822 }
823+ fileTextAt(version: number, path: string): string {
824+ return this.project.viewAt(version).text(path);
825+ }
826+ /** One scoped batch: at most 64 files and 64 Ki characters plus one whole file. */
827+ fileTextsAt(version: number, paths: readonly string[]): Record<string, string> {
828+ const view = this.project.viewAt(version);
829+ const files: Record<string, string> = Object.create(null);
830+ let characters = 0;
831+ for (const path of paths.slice(0, 64)) {
832+ const text = view.attrs(path).link !== null ? "" : view.text(path);
833+ files[path] = text;
834+ characters += text.length;
835+ if (characters >= 65536) break;
836+ }
837+ return files;
838+ }
839+ /** Capture metadata now; each text read reopens the captured version in a fresh host scope. */
840+ sharedPushMetadata(): PushSnapshotMetadata {
841+ const version = this.project.version;
842+ const view = this.project.viewAt(version);
843+ const paths: string[] = [];
844+ const modes: PushSnapshotMetadata["modes"] = Object.create(null);
845+ const blobs: Record<string, string> = Object.create(null);
846+ for (const path of view.paths()) {
847+ const attrs = view.attrs(path);
848+ modes[path] = { exec: attrs.exec, link: attrs.link };
849+ if (attrs.blob !== null) blobs[path] = attrs.blob;
850+ else paths.push(path);
851+ }
852+ const by = version > 0 ? this.project.published(version) : undefined;
853+ return { version, paths, modes, blobs, ...(by ? { last: { agent: by.agent, message: by.message } } : {}) };
854+ }
793855 blobsAt(version: number) {
794856 return this.project.viewAt(version).blobs();
795857 }
MCP
compare on this site's /mcp
CLI
abso diff 162 318 server/src/engine-project.ts --json
JSON
/christopher/abso-core/compare/162..318?file=server%2Fsrc%2Fengine-project.ts&format=json