{"path":"server/src/engine-project.ts","version":318,"newest":318,"draft":null,"agent":null,"exists":true,"lines":[{"n":1,"text":"// The engine's Project (worker/project/project.ts) behind the server's calls, with its append-only log kept in the","author":"speed","version":150},{"n":2,"text":"// Durable Object's SQLite. An entry longer than one row allows (init holds every starting file; SQLite rows stop at","author":"speed","version":150},{"n":3,"text":"// 2 MB) is split across rows and joined on load. Ported from the platform's worker/src/engine-project.ts; the","author":"speed","version":150},{"n":4,"text":"// writer-adoption and R2 version parts are left out.","author":"speed","version":150},{"n":5,"text":"","author":"speed","version":150},{"n":6,"text":"import { jsonValueChunks } from \"../../src/engine/json-value-chunks.ts\";","author":"codex-capacity-chair","version":167},{"n":7,"text":"import { blame, folderBlame, why } from \"../../worker/project/blame.ts\";","author":"speed","version":150},{"n":8,"text":"import { feedEvents } from \"../../worker/project/feed.ts\";","author":"speed","version":150},{"n":9,"text":"import { type Entry, type ProjectStore as LogStore, MemoryStore, Project } from \"../../worker/project/project.ts\";","author":"speed","version":150},{"n":10,"text":"import type { EditBody, ProjectCalls, ProjectHistory } from \"../../worker/project/project-api.ts\";","author":"speed","version":150},{"n":11,"text":"import { where } from \"../../worker/project/where.ts\";","author":"speed","version":150},{"n":12,"text":"import type { PushSnapshotMetadata } from \"./push-snapshot.ts\";","author":"codex-capacity-chair","version":177},{"n":13,"text":"","author":"speed","version":150},{"n":14,"text":"/** The parts of a Durable Object's storage the log and blob store use, declared structurally so tests can stand in. */","author":"speed","version":150},{"n":15,"text":"export interface SqliteStorage {","author":"speed","version":150},{"n":16,"text":"\tsql: { exec(query: string, ...bindings: unknown[]): { toArray(): unknown[] } };","author":"speed","version":150},{"n":17,"text":"\ttransactionSync<T>(fn: () => T): T;","author":"speed","version":150},{"n":18,"text":"}","author":"speed","version":150},{"n":19,"text":"","author":"speed","version":150},{"n":20,"text":"// Characters per row. SQLite's 2 MB cap is in bytes, and a character is at","author":"speed","version":150},{"n":21,"text":"// most 3 bytes of UTF-8 (an emoji is 2 characters and 4 bytes), so 600,000 stays under it.","author":"speed","version":150},{"n":22,"text":"export const LOG_PART_CHARACTERS = 600_000;","author":"codex-capacity-chair","version":157},{"n":23,"text":"","author":"speed","version":150},{"n":24,"text":"/** An entry's JSON in rows of at most LOG_PART_CHARACTERS characters, never cutting an emoji's two halves apart. */","author":"codex-capacity-chair","version":157},{"n":25,"text":"export function logParts(text: string): string[] {","author":"speed","version":150},{"n":26,"text":"\tconst parts: string[] = [];","author":"speed","version":150},{"n":27,"text":"\tlet at = 0;","author":"speed","version":150},{"n":28,"text":"\tdo {","author":"speed","version":150},{"n":29,"text":"\t\tlet end = Math.min(at + LOG_PART_CHARACTERS, text.length);","author":"codex-capacity-chair","version":157},{"n":30,"text":"\t\tconst c = text.charCodeAt(end - 1);","author":"speed","version":150},{"n":31,"text":"\t\tif (end < text.length && c >= 0xd800 && c <= 0xdbff) end--;","author":"speed","version":150},{"n":32,"text":"\t\tparts.push(text.slice(at, end));","author":"speed","version":150},{"n":33,"text":"\t\tat = end;","author":"speed","version":150},{"n":34,"text":"\t} while (at < text.length);","author":"speed","version":150},{"n":35,"text":"\treturn parts;","author":"speed","version":150},{"n":36,"text":"}","author":"speed","version":150},{"n":37,"text":"","author":"speed","version":150},{"n":38,"text":"/** Retains one log row plus an encoder fragment, preserving legacy row boundaries. */","author":"codex-capacity-chair","version":167},{"n":39,"text":"export function* streamedLogParts(value: unknown): IterableIterator<string> {","author":"codex-capacity-chair","version":167},{"n":40,"text":"\tlet pending = \"\";","author":"codex-capacity-chair","version":167},{"n":41,"text":"\tfor (const chunk of jsonValueChunks(value)) {","author":"codex-capacity-chair","version":167},{"n":42,"text":"\t\tpending += chunk;","author":"codex-capacity-chair","version":167},{"n":43,"text":"\t\twhile (pending.length > LOG_PART_CHARACTERS) {","author":"codex-capacity-chair","version":167},{"n":44,"text":"\t\t\tlet end = LOG_PART_CHARACTERS;","author":"codex-capacity-chair","version":167},{"n":45,"text":"\t\t\tconst last = pending.charCodeAt(end - 1);","author":"codex-capacity-chair","version":167},{"n":46,"text":"\t\t\tif (last >= 0xd800 && last <= 0xdbff) end--;","author":"codex-capacity-chair","version":167},{"n":47,"text":"\t\t\tyield pending.slice(0, end);","author":"codex-capacity-chair","version":167},{"n":48,"text":"\t\t\tpending = pending.slice(end);","author":"codex-capacity-chair","version":167},{"n":49,"text":"\t\t}","author":"codex-capacity-chair","version":167},{"n":50,"text":"\t}","author":"codex-capacity-chair","version":167},{"n":51,"text":"\tif (pending) yield pending;","author":"codex-capacity-chair","version":167},{"n":52,"text":"}","author":"codex-capacity-chair","version":167},{"n":53,"text":"","author":"codex-capacity-chair","version":167},{"n":54,"text":"/** The lines an entry's atoms write: what a loaded project's size grows with (#46, #56). */","author":"speed","version":150},{"n":55,"text":"function linesIn(entry: Entry): number {","author":"speed","version":150},{"n":56,"text":"\tlet n = 0;","author":"speed","version":150},{"n":57,"text":"\tfor (const a of [","author":"speed","version":150},{"n":58,"text":"\t\t(entry as { atom?: { inserts?: { lines: unknown[] }[] } }).atom,","author":"speed","version":150},{"n":59,"text":"\t\t(entry as { tie?: { inserts?: { lines: unknown[] }[] } }).tie,","author":"speed","version":150},{"n":60,"text":"\t]) {","author":"speed","version":150},{"n":61,"text":"\t\tfor (const r of a?.inserts ?? []) n += r.lines.length;","author":"speed","version":150},{"n":62,"text":"\t}","author":"speed","version":150},{"n":63,"text":"\treturn n;","author":"speed","version":150},{"n":64,"text":"}","author":"speed","version":150},{"n":65,"text":"","author":"speed","version":150},{"n":66,"text":"/** The version of shared an entry makes, or undefined (abso issue 78: the access check reads it without loading). */","author":"speed","version":150},{"n":67,"text":"function sharedVersionOf(entry: Entry): number | undefined {","author":"speed","version":150},{"n":68,"text":"\tif (entry.type === \"init\") return 0;","author":"speed","version":150},{"n":69,"text":"\tif (entry.type === \"land\" || entry.type === \"drop\") return entry.version;","author":"speed","version":150},{"n":70,"text":"\tif (entry.type === \"publish\" && (entry.space ?? \"\") === \"\") return entry.version;","author":"speed","version":150},{"n":71,"text":"\treturn undefined;","author":"speed","version":150},{"n":72,"text":"}","author":"speed","version":150},{"n":73,"text":"","author":"speed","version":150},{"n":74,"text":"/** Who made that version of shared, and when. Init is not a publish (abso issue 86). */","author":"speed","version":150},{"n":75,"text":"function lastPublishOf(entry: Entry): { agent: string; time: number } | undefined {","author":"speed","version":150},{"n":76,"text":"\tif (entry.type === \"land\" || entry.type === \"drop\") return { agent: entry.agent, time: entry.time };","author":"speed","version":150},{"n":77,"text":"\tif (entry.type === \"publish\" && (entry.space ?? \"\") === \"\") return { agent: entry.agent, time: entry.time };","author":"speed","version":150},{"n":78,"text":"\treturn undefined;","author":"speed","version":150},{"n":79,"text":"}","author":"speed","version":150},{"n":80,"text":"","author":"speed","version":150},{"n":81,"text":"/** An entry's claim keys and deletes (#46): with entries and lines, what the load guard estimates memory by. */","author":"speed","version":150},{"n":82,"text":"function keysIn(entry: Entry): number {","author":"speed","version":150},{"n":83,"text":"\tlet n = 0;","author":"speed","version":150},{"n":84,"text":"\tfor (const a of [","author":"speed","version":150},{"n":85,"text":"\t\t(entry as { atom?: Partial<Record<\"writes\" | \"reads\" | \"holds\" | \"deletes\", unknown[]>> }).atom,","author":"speed","version":150},{"n":86,"text":"\t\t(entry as { tie?: Partial<Record<\"writes\" | \"reads\" | \"holds\" | \"deletes\", unknown[]>> }).tie,","author":"speed","version":150},{"n":87,"text":"\t]) {","author":"speed","version":150},{"n":88,"text":"\t\tif (a) n += (a.writes?.length ?? 0) + (a.reads?.length ?? 0) + (a.holds?.length ?? 0) + (a.deletes?.length ?? 0);","author":"speed","version":150},{"n":89,"text":"\t}","author":"speed","version":150},{"n":90,"text":"\treturn n;","author":"speed","version":150},{"n":91,"text":"}","author":"speed","version":150},{"n":92,"text":"","author":"speed","version":150},{"n":93,"text":"export class SqliteLog implements LogStore {","author":"speed","version":150},{"n":94,"text":"\tprivate storage: SqliteStorage;","author":"speed","version":150},{"n":95,"text":"\tprivate next: number;","author":"speed","version":150},{"n":96,"text":"","author":"speed","version":150},{"n":97,"text":"\tconstructor(storage: SqliteStorage) {","author":"speed","version":150},{"n":98,"text":"\t\tthis.storage = storage;","author":"speed","version":150},{"n":99,"text":"\t\tstorage.sql.exec(","author":"speed","version":150},{"n":100,"text":"\t\t\t\"CREATE TABLE IF NOT EXISTS log (seq INTEGER, part INTEGER, text TEXT NOT NULL, PRIMARY KEY (seq, part))\",","author":"speed","version":150},{"n":101,"text":"\t\t);","author":"speed","version":150},{"n":102,"text":"\t\tstorage.sql.exec(","author":"speed","version":150},{"n":103,"text":"\t\t\t\"CREATE TABLE IF NOT EXISTS shapes (space TEXT NOT NULL, version INTEGER NOT NULL, value TEXT NOT NULL, PRIMARY KEY (space, version))\",","author":"speed","version":150},{"n":104,"text":"\t\t);","author":"speed","version":150},{"n":105,"text":"\t\tstorage.sql.exec(\"CREATE TABLE IF NOT EXISTS counts (name TEXT PRIMARY KEY, value INTEGER NOT NULL)\");","author":"speed","version":150},{"n":106,"text":"\t\tstorage.sql.exec(\"CREATE TABLE IF NOT EXISTS marks (name TEXT PRIMARY KEY, value TEXT NOT NULL)\");","author":"speed","version":150},{"n":107,"text":"\t\tconst rows = storage.sql.exec(\"SELECT COALESCE(MAX(seq), -1) AS last FROM log\").toArray() as { last: number }[];","author":"speed","version":150},{"n":108,"text":"\t\tthis.next = (rows[0]?.last ?? -1) + 1;","author":"speed","version":150},{"n":109,"text":"\t}","author":"speed","version":150},{"n":110,"text":"","author":"speed","version":150},{"n":111,"text":"\t/** The seq the next entry would take. A copy's next page must start here. */","author":"speed","version":150},{"n":112,"text":"\tseq(): number {","author":"speed","version":150},{"n":113,"text":"\t\treturn this.next;","author":"speed","version":150},{"n":114,"text":"\t}","author":"speed","version":150},{"n":115,"text":"","author":"speed","version":150},{"n":116,"text":"\t/** Reject an oversized canonical frame before loading its text into JavaScript. */","author":"codex-capacity-chair","version":157},{"n":117,"text":"\tframeBytes(seq: number): number {","author":"codex-capacity-chair","version":162},{"n":118,"text":"\t\tif (!Number.isSafeInteger(seq) || seq < 0) throw Error(\"invalid canonical frame position\");","author":"codex-capacity-chair","version":162},{"n":119,"text":"\t\tconst size = this.storage.sql","author":"codex-capacity-chair","version":162},{"n":120,"text":"\t\t\t.exec(","author":"codex-capacity-chair","version":162},{"n":121,"text":"\t\t\t\t\"SELECT COUNT(*) AS parts, COALESCE(SUM(LENGTH(CAST(text AS BLOB))), 0) AS bytes FROM log WHERE seq = ?\",","author":"codex-capacity-chair","version":162},{"n":122,"text":"\t\t\t\tseq,","author":"codex-capacity-chair","version":162},{"n":123,"text":"\t\t\t)","author":"codex-capacity-chair","version":162},{"n":124,"text":"\t\t\t.toArray()[0] as { parts: number; bytes: number };","author":"codex-capacity-chair","version":162},{"n":125,"text":"\t\tif (!size || size.parts < 1 || size.parts > 256 || size.bytes < 1 || !Number.isSafeInteger(size.bytes))","author":"codex-capacity-chair","version":162},{"n":126,"text":"\t\t\tthrow Error(\"canonical frame exceeds hard decoding bound or is missing\");","author":"codex-capacity-chair","version":162},{"n":127,"text":"\t\treturn size.bytes;","author":"codex-capacity-chair","version":162},{"n":128,"text":"\t}","author":"codex-capacity-chair","version":162},{"n":129,"text":"\t/** A larger first frame gets its own budget; later frames are deferred. */","author":"codex-capacity-chair","version":162},{"n":130,"text":"\tadoptionPageBytes(from: number): number {","author":"codex-capacity-chair","version":162},{"n":131,"text":"\t\treturn Math.max(1_048_576, this.frameBytes(from));","author":"codex-capacity-chair","version":162},{"n":132,"text":"\t}","author":"codex-capacity-chair","version":162},{"n":133,"text":"","author":"codex-capacity-chair","version":162},{"n":134,"text":"\tboundedFrame(seq: number, maxBytes: number): string {","author":"codex-capacity-chair","version":157},{"n":135,"text":"\t\tif (","author":"codex-capacity-chair","version":157},{"n":136,"text":"\t\t\t!Number.isSafeInteger(seq) ||","author":"codex-capacity-chair","version":157},{"n":137,"text":"\t\t\tseq < 0 ||","author":"codex-capacity-chair","version":157},{"n":138,"text":"\t\t\t!Number.isSafeInteger(maxBytes) ||","author":"codex-capacity-chair","version":157},{"n":139,"text":"\t\t\tmaxBytes < 1 ||","author":"codex-capacity-chair","version":157},{"n":140,"text":"\t\t\tmaxBytes > 8_000_000","author":"codex-capacity-chair","version":157},{"n":141,"text":"\t\t)","author":"codex-capacity-chair","version":157},{"n":142,"text":"\t\t\tthrow new Error(\"invalid canonical frame bound\");","author":"codex-capacity-chair","version":157},{"n":143,"text":"\t\tconst size = this.storage.sql","author":"codex-capacity-chair","version":157},{"n":144,"text":"\t\t\t.exec(","author":"codex-capacity-chair","version":157},{"n":145,"text":"\t\t\t\t\"SELECT COUNT(*) AS parts, COALESCE(SUM(LENGTH(CAST(text AS BLOB))), 0) AS bytes FROM log WHERE seq = ?\",","author":"codex-capacity-chair","version":157},{"n":146,"text":"\t\t\t\tseq,","author":"codex-capacity-chair","version":157},{"n":147,"text":"\t\t\t)","author":"codex-capacity-chair","version":157},{"n":148,"text":"\t\t\t.toArray()[0] as { parts: number; bytes: number };","author":"codex-capacity-chair","version":157},{"n":149,"text":"\t\tif (!size || size.parts < 1 || size.parts > 256 || size.bytes > maxBytes)","author":"codex-capacity-chair","version":157},{"n":150,"text":"\t\t\tthrow new Error(\"canonical frame exceeds adoption bound or is missing\");","author":"codex-capacity-chair","version":157},{"n":151,"text":"\t\tconst rows = this.storage.sql.exec(\"SELECT part, text FROM log WHERE seq = ? ORDER BY part\", seq).toArray() as {","author":"codex-capacity-chair","version":157},{"n":152,"text":"\t\t\tpart: number;","author":"codex-capacity-chair","version":157},{"n":153,"text":"\t\t\ttext: string;","author":"codex-capacity-chair","version":157},{"n":154,"text":"\t\t}[];","author":"codex-capacity-chair","version":157},{"n":155,"text":"\t\tif (rows.length !== size.parts || rows.some((row, part) => row.part !== part))","author":"codex-capacity-chair","version":157},{"n":156,"text":"\t\t\tthrow new Error(\"canonical frame parts are incomplete\");","author":"codex-capacity-chair","version":157},{"n":157,"text":"\t\treturn rows.map((row) => row.text).join(\"\");","author":"codex-capacity-chair","version":157},{"n":158,"text":"\t}","author":"codex-capacity-chair","version":162},{"n":159,"text":"","author":"codex-capacity-chair","version":162},{"n":160,"text":"\t/** Stream one canonical frame without retaining its complete JSON text. */","author":"codex-capacity-chair","version":162},{"n":161,"text":"\t*frameChunks(seq: number): IterableIterator<string> {","author":"codex-capacity-chair","version":162},{"n":162,"text":"\t\tif (!Number.isSafeInteger(seq) || seq < 0) throw Error(\"invalid canonical frame position\");","author":"codex-capacity-chair","version":162},{"n":163,"text":"\t\tlet expected = 0;","author":"codex-capacity-chair","version":162},{"n":164,"text":"\t\tfor (;;) {","author":"codex-capacity-chair","version":134},{"n":165,"text":"\t\t\tconst rows = this.storage.sql","author":"codex-capacity-chair","version":162},{"n":166,"text":"\t\t\t\t.exec(\"SELECT part, text FROM log WHERE seq = ? AND part >= ? ORDER BY part LIMIT 1\", seq, expected)","author":"codex-capacity-chair","version":162},{"n":167,"text":"\t\t\t\t.toArray() as { part: number; text: string }[];","author":"codex-capacity-chair","version":162},{"n":168,"text":"\t\t\tif (!rows.length) {","author":"codex-capacity-chair","version":162},{"n":169,"text":"\t\t\t\tif (!expected) throw Error(\"canonical frame is missing\");","author":"codex-capacity-chair","version":162},{"n":170,"text":"\t\t\t\treturn;","author":"codex-capacity-chair","version":162},{"n":171,"text":"\t\t\t}","author":"codex-capacity-chair","version":162},{"n":172,"text":"\t\t\tconst row = rows[0]!;","author":"codex-capacity-chair","version":162},{"n":173,"text":"\t\t\tif (row.part !== expected || row.text.length > LOG_PART_CHARACTERS)","author":"codex-capacity-chair","version":162},{"n":174,"text":"\t\t\t\tthrow Error(\"canonical frame parts are incomplete or oversized\");","author":"codex-capacity-chair","version":162},{"n":175,"text":"\t\t\texpected++;","author":"codex-capacity-chair","version":162},{"n":176,"text":"\t\t\tyield row.text;","author":"codex-capacity-chair","version":162},{"n":177,"text":"\t\t}","author":"codex-capacity-chair","version":162},{"n":178,"text":"\t}","author":"codex-capacity-chair","version":157},{"n":179,"text":"","author":"codex-capacity-chair","version":157},{"n":180,"text":"\t/** Refreshes the in-memory cursor after an enclosing transaction rolls back. */","author":"codex-capacity-chair","version":157},{"n":181,"text":"\trefreshSequence(): void {","author":"codex-capacity-chair","version":157},{"n":182,"text":"\t\tconst rows = this.storage.sql.exec(\"SELECT COALESCE(MAX(seq), -1) AS last FROM log\").toArray() as {","author":"codex-capacity-chair","version":157},{"n":183,"text":"\t\t\tlast: number;","author":"codex-capacity-chair","version":157},{"n":184,"text":"\t\t}[];","author":"codex-capacity-chair","version":157},{"n":185,"text":"\t\tthis.next = (rows[0]?.last ?? -1) + 1;","author":"codex-capacity-chair","version":157},{"n":186,"text":"\t}","author":"codex-capacity-chair","version":157},{"n":187,"text":"","author":"codex-capacity-chair","version":157},{"n":188,"text":"\t/** Monotonic cache invalidation epoch for every canonical log mutation. */","author":"speed","version":150},{"n":189,"text":"\tgeneration(): number {","author":"speed","version":150},{"n":190,"text":"\t\tconst rows = this.storage.sql.exec(\"SELECT value FROM marks WHERE name = ?\", \"generation\").toArray() as {","author":"speed","version":150},{"n":191,"text":"\t\t\tvalue: string;","author":"speed","version":150},{"n":192,"text":"\t\t}[];","author":"speed","version":150},{"n":193,"text":"\t\tconst generation = Number(rows[0]?.value ?? 0);","author":"speed","version":150},{"n":194,"text":"\t\tif (!Number.isSafeInteger(generation) || generation < 0) throw new Error(\"canonical log generation is invalid\");","author":"speed","version":150},{"n":195,"text":"\t\treturn generation;","author":"speed","version":150},{"n":196,"text":"\t}","author":"speed","version":150},{"n":197,"text":"","author":"speed","version":150},{"n":198,"text":"\t/**","author":"speed","version":150},{"n":199,"text":"\t * Lines ever recorded (#46, #56): what loading the project costs grows with","author":"speed","version":150},{"n":200,"text":"\t * this, not with the log's size, so a guard can read it without loading.","author":"speed","version":150},{"n":201,"text":"\t * Kept with each append; undefined for a log written before the count,","author":"speed","version":150},{"n":202,"text":"\t * until it next loads.","author":"speed","version":150},{"n":203,"text":"\t */","author":"speed","version":150},{"n":204,"text":"\tlineCount(): number | undefined {","author":"speed","version":150},{"n":205,"text":"\t\tconst rows = this.storage.sql.exec(\"SELECT value FROM counts WHERE name = 'lines'\").toArray() as {","author":"speed","version":150},{"n":206,"text":"\t\t\tvalue: number;","author":"speed","version":150},{"n":207,"text":"\t\t}[];","author":"speed","version":150},{"n":208,"text":"\t\treturn rows[0]?.value;","author":"speed","version":150},{"n":209,"text":"\t}","author":"speed","version":150},{"n":210,"text":"","author":"speed","version":150},{"n":211,"text":"\t/**","author":"speed","version":150},{"n":212,"text":"\t * The newest version of shared, without loading the project (abso issue 78: the website's access check asked","author":"speed","version":150},{"n":213,"text":"\t * every project's engine for it). Kept with each append; a log from before the count is read once by streaming.","author":"speed","version":150},{"n":214,"text":"\t */","author":"speed","version":150},{"n":215,"text":"\tsharedVersion(): number {","author":"speed","version":150},{"n":216,"text":"\t\tconst rows = this.storage.sql.exec(\"SELECT value FROM counts WHERE name = 'shared'\").toArray() as {","author":"speed","version":150},{"n":217,"text":"\t\t\tvalue: number;","author":"speed","version":150},{"n":218,"text":"\t\t}[];","author":"speed","version":150},{"n":219,"text":"\t\tif (rows[0] !== undefined) return rows[0].value;","author":"speed","version":150},{"n":220,"text":"\t\tlet version = -1;","author":"speed","version":150},{"n":221,"text":"\t\tfor (const e of this.#entries()) version = sharedVersionOf(e) ?? version;","author":"speed","version":150},{"n":222,"text":"\t\tif (version >= 0)","author":"speed","version":150},{"n":223,"text":"\t\t\tthis.storage.sql.exec(\"INSERT OR REPLACE INTO counts (name, value) VALUES ('shared', ?)\", version);","author":"speed","version":150},{"n":224,"text":"\t\treturn version;","author":"speed","version":150},{"n":225,"text":"\t}","author":"speed","version":150},{"n":226,"text":"","author":"speed","version":150},{"n":227,"text":"\t/**","author":"speed","version":150},{"n":228,"text":"\t * Who published shared's newest version, and when, without loading the project (abso issue 86).","author":"speed","version":150},{"n":229,"text":"\t * Null when shared has no publish yet. A log from before the mark is read once by streaming.","author":"speed","version":150},{"n":230,"text":"\t */","author":"speed","version":150},{"n":231,"text":"\tlastPublish(): { agent: string; time: number } | null {","author":"speed","version":150},{"n":232,"text":"\t\tconst rows = this.storage.sql.exec(\"SELECT value FROM marks WHERE name = ?\", \"last\").toArray() as {","author":"speed","version":150},{"n":233,"text":"\t\t\tvalue: string;","author":"speed","version":150},{"n":234,"text":"\t\t}[];","author":"speed","version":150},{"n":235,"text":"\t\tif (rows[0] !== undefined) return JSON.parse(rows[0].value) as { agent: string; time: number };","author":"speed","version":150},{"n":236,"text":"\t\tlet last: { agent: string; time: number } | null = null;","author":"speed","version":150},{"n":237,"text":"\t\tfor (const e of this.#entries()) {","author":"speed","version":150},{"n":238,"text":"\t\t\tconst found = lastPublishOf(e);","author":"speed","version":150},{"n":239,"text":"\t\t\tif (found) last = found;","author":"speed","version":150},{"n":240,"text":"\t\t}","author":"speed","version":150},{"n":241,"text":"\t\tif (last)","author":"speed","version":150},{"n":242,"text":"\t\t\tthis.storage.sql.exec(\"INSERT OR REPLACE INTO marks (name, value) VALUES (?, ?)\", \"last\", JSON.stringify(last));","author":"speed","version":150},{"n":243,"text":"\t\treturn last;","author":"speed","version":150},{"n":244,"text":"\t}","author":"speed","version":150},{"n":245,"text":"","author":"speed","version":150},{"n":246,"text":"\t/**","author":"speed","version":150},{"n":247,"text":"\t * How big the log is, without loading the project or scanning it twice (ask 160).","author":"speed","version":150},{"n":248,"text":"\t * Entries are the next seq. Chars are kept like lines; a log from before the","author":"speed","version":150},{"n":249,"text":"\t * count is summed once, then kept. GET /projects' 2-second wait needs this","author":"speed","version":150},{"n":250,"text":"\t * to stay a storage read: SUM(LENGTH(text)) over abso's log misses it.","author":"speed","version":150},{"n":251,"text":"\t */","author":"speed","version":150},{"n":252,"text":"\tlogSize(): { chars: number; entries: number } {","author":"speed","version":150},{"n":253,"text":"\t\tconst entries = this.next;","author":"speed","version":150},{"n":254,"text":"\t\tconst rows = this.storage.sql.exec(\"SELECT value FROM counts WHERE name = 'chars'\").toArray() as {","author":"speed","version":150},{"n":255,"text":"\t\t\tvalue: number;","author":"speed","version":150},{"n":256,"text":"\t\t}[];","author":"speed","version":150},{"n":257,"text":"\t\tif (rows[0] !== undefined) return { chars: rows[0].value, entries };","author":"speed","version":150},{"n":258,"text":"\t\tif (entries === 0) return { chars: 0, entries: 0 };","author":"speed","version":150},{"n":259,"text":"\t\tconst summed = this.storage.sql.exec(\"SELECT COALESCE(SUM(LENGTH(text)), 0) AS chars FROM log\").toArray()[0] as","author":"speed","version":150},{"n":260,"text":"\t\t\t| { chars: number }","author":"speed","version":150},{"n":261,"text":"\t\t\t| undefined;","author":"speed","version":150},{"n":262,"text":"\t\tconst chars = summed?.chars ?? 0;","author":"speed","version":150},{"n":263,"text":"\t\tthis.storage.sql.exec(\"INSERT OR REPLACE INTO counts (name, value) VALUES ('chars', ?)\", chars);","author":"speed","version":150},{"n":264,"text":"\t\treturn { chars, entries };","author":"speed","version":150},{"n":265,"text":"\t}","author":"speed","version":150},{"n":266,"text":"","author":"speed","version":150},{"n":267,"text":"\t/** Claim keys and deletes ever recorded (#46), kept like the line count; undefined before they were counted. */","author":"speed","version":150},{"n":268,"text":"\tkeyCount(): number | undefined {","author":"speed","version":150},{"n":269,"text":"\t\tconst rows = this.storage.sql.exec(\"SELECT value FROM counts WHERE name = 'keys'\").toArray() as { value: number }[];","author":"speed","version":150},{"n":270,"text":"\t\treturn rows[0]?.value;","author":"speed","version":150},{"n":271,"text":"\t}","author":"speed","version":150},{"n":272,"text":"","author":"speed","version":150},{"n":273,"text":"\t/**","author":"speed","version":150},{"n":274,"text":"\t * The lines and keys ever recorded, counting a log from before either count without loading the project","author":"speed","version":150},{"n":275,"text":"\t * (#46): one entry parsed at a time, so a log the load guard would refuse can still be measured. Kept once counted.","author":"speed","version":150},{"n":276,"text":"\t */","author":"speed","version":150},{"n":277,"text":"\tcountSizes(): { lines: number; keys: number } {","author":"speed","version":150},{"n":278,"text":"\t\tconst lines = this.lineCount();","author":"speed","version":150},{"n":279,"text":"\t\tconst keys = this.keyCount();","author":"speed","version":150},{"n":280,"text":"\t\tif (lines !== undefined && keys !== undefined) return { lines, keys };","author":"speed","version":150},{"n":281,"text":"\t\tlet l = 0;","author":"speed","version":150},{"n":282,"text":"\t\tlet k = 0;","author":"speed","version":150},{"n":283,"text":"\t\tfor (const e of this.#entries()) {","author":"speed","version":150},{"n":284,"text":"\t\t\tl += linesIn(e);","author":"speed","version":150},{"n":285,"text":"\t\t\tk += keysIn(e);","author":"speed","version":150},{"n":286,"text":"\t\t}","author":"speed","version":150},{"n":287,"text":"\t\tthis.#keep(lines === undefined ? l : undefined, keys === undefined ? k : undefined);","author":"speed","version":150},{"n":288,"text":"\t\treturn { lines: lines ?? l, keys: keys ?? k };","author":"speed","version":150},{"n":289,"text":"\t}","author":"speed","version":150},{"n":290,"text":"","author":"speed","version":150},{"n":291,"text":"\t/** Stores the counts given. */","author":"speed","version":150},{"n":292,"text":"\t#keep(lines: number | undefined, keys: number | undefined): void {","author":"speed","version":150},{"n":293,"text":"\t\tif (lines !== undefined)","author":"speed","version":150},{"n":294,"text":"\t\t\tthis.storage.sql.exec(\"INSERT OR REPLACE INTO counts (name, value) VALUES ('lines', ?)\", lines);","author":"speed","version":150},{"n":295,"text":"\t\tif (keys !== undefined)","author":"speed","version":150},{"n":296,"text":"\t\t\tthis.storage.sql.exec(\"INSERT OR REPLACE INTO counts (name, value) VALUES ('keys', ?)\", keys);","author":"speed","version":150},{"n":297,"text":"\t}","author":"speed","version":150},{"n":298,"text":"","author":"speed","version":150},{"n":299,"text":"\t/** Every stored entry, in order. Rows are read one at a time, so loading never holds the whole log's text at once (#43). */","author":"speed","version":150},{"n":300,"text":"\t*entries(): Iterable<Entry> {","author":"speed","version":150},{"n":301,"text":"\t\t// A log from before the counts: counted as it loads, and kept.","author":"speed","version":150},{"n":302,"text":"\t\tconst countLines = this.lineCount() === undefined;","author":"speed","version":150},{"n":303,"text":"\t\tconst countKeys = this.keyCount() === undefined;","author":"speed","version":150},{"n":304,"text":"\t\tlet lines = 0;","author":"speed","version":150},{"n":305,"text":"\t\tlet keys = 0;","author":"speed","version":150},{"n":306,"text":"\t\tfor (const e of this.#entries()) {","author":"speed","version":150},{"n":307,"text":"\t\t\tif (countLines) lines += linesIn(e);","author":"speed","version":150},{"n":308,"text":"\t\t\tif (countKeys) keys += keysIn(e);","author":"speed","version":150},{"n":309,"text":"\t\t\tyield e;","author":"speed","version":150},{"n":310,"text":"\t\t}","author":"speed","version":150},{"n":311,"text":"\t\tthis.#keep(countLines ? lines : undefined, countKeys ? keys : undefined);","author":"speed","version":150},{"n":312,"text":"\t}","author":"speed","version":150},{"n":313,"text":"","author":"speed","version":150},{"n":314,"text":"\t*#entries(from = 0): Iterable<Entry> {","author":"speed","version":150},{"n":315,"text":"\t\t// A Workers cursor is iterable; a test's stand-in may only have toArray.","author":"speed","version":150},{"n":316,"text":"\t\tconst cursor = this.storage.sql.exec(\"SELECT seq, text FROM log WHERE seq >= ? ORDER BY seq, part\", from) as {","author":"speed","version":150},{"n":317,"text":"\t\t\ttoArray(): unknown[];","author":"speed","version":150},{"n":318,"text":"\t\t} & Partial<Iterable<unknown>>;","author":"speed","version":150},{"n":319,"text":"\t\tconst rows = (cursor[Symbol.iterator] ? cursor : cursor.toArray()) as Iterable<{ seq: number; text: string }>;","author":"speed","version":150},{"n":320,"text":"\t\tlet seq = -1;","author":"speed","version":150},{"n":321,"text":"\t\tlet text = \"\";","author":"speed","version":150},{"n":322,"text":"\t\tfor (const r of rows) {","author":"speed","version":150},{"n":323,"text":"\t\t\tif (r.seq !== seq && seq >= 0) yield JSON.parse(text) as Entry;","author":"speed","version":150},{"n":324,"text":"\t\t\tif (r.seq !== seq) text = \"\";","author":"speed","version":150},{"n":325,"text":"\t\t\tseq = r.seq;","author":"speed","version":150},{"n":326,"text":"\t\t\ttext += r.text;","author":"speed","version":150},{"n":327,"text":"\t\t}","author":"speed","version":150},{"n":328,"text":"\t\tif (seq >= 0) yield JSON.parse(text) as Entry;","author":"speed","version":150},{"n":329,"text":"\t}","author":"speed","version":150},{"n":330,"text":"","author":"speed","version":150},{"n":331,"text":"\t/**","author":"speed","version":150},{"n":332,"text":"\t * For backups (#29): the entries from seq `from` on as their stored JSON","author":"speed","version":150},{"n":333,"text":"\t * text (not parsed, so an export holds the project up as little as it","author":"speed","version":150},{"n":334,"text":"\t * can), at most `limit` of them and about 8 MB (always at least one), and","author":"speed","version":150},{"n":335,"text":"\t * the seq to ask for next, or null at the end.","author":"speed","version":150},{"n":336,"text":"\t */","author":"speed","version":150},{"n":337,"text":"\tpage(from: number, limit: number): { texts: string[]; next: number | null } {","author":"speed","version":150},{"n":338,"text":"\t\tconst rows = this.storage.sql","author":"speed","version":150},{"n":339,"text":"\t\t\t.exec(\"SELECT seq, text FROM log WHERE seq >= ? AND seq < ? ORDER BY seq, part\", from, from + limit)","author":"speed","version":150},{"n":340,"text":"\t\t\t.toArray() as { seq: number; text: string }[];","author":"speed","version":150},{"n":341,"text":"\t\tconst texts: string[] = [];","author":"speed","version":150},{"n":342,"text":"\t\tlet seq = -1;","author":"speed","version":150},{"n":343,"text":"\t\tlet text = \"\";","author":"speed","version":150},{"n":344,"text":"\t\tlet size = 0;","author":"speed","version":150},{"n":345,"text":"\t\tlet next: number | null = null;","author":"speed","version":150},{"n":346,"text":"\t\tfor (const r of rows) {","author":"speed","version":150},{"n":347,"text":"\t\t\tif (r.seq < from || r.seq >= from + limit) continue;","author":"speed","version":150},{"n":348,"text":"\t\t\tif (r.seq !== seq && seq >= 0) {","author":"speed","version":150},{"n":349,"text":"\t\t\t\ttexts.push(text);","author":"speed","version":150},{"n":350,"text":"\t\t\t\tsize += text.length;","author":"speed","version":150},{"n":351,"text":"\t\t\t\tif (size > 8_000_000) {","author":"speed","version":150},{"n":352,"text":"\t\t\t\t\tnext = r.seq;","author":"speed","version":150},{"n":353,"text":"\t\t\t\t\tbreak;","author":"speed","version":150},{"n":354,"text":"\t\t\t\t}","author":"speed","version":150},{"n":355,"text":"\t\t\t}","author":"speed","version":150},{"n":356,"text":"\t\t\tif (r.seq !== seq) text = \"\";","author":"speed","version":150},{"n":357,"text":"\t\t\tseq = r.seq;","author":"speed","version":150},{"n":358,"text":"\t\t\ttext += r.text;","author":"speed","version":150},{"n":359,"text":"\t\t}","author":"speed","version":150},{"n":360,"text":"\t\tif (next === null && seq >= 0) texts.push(text);","author":"speed","version":150},{"n":361,"text":"\t\tif (next === null && from + limit < this.next) next = from + limit;","author":"speed","version":150},{"n":362,"text":"\t\treturn { texts, next };","author":"speed","version":150},{"n":363,"text":"\t}","author":"speed","version":150},{"n":364,"text":"","author":"speed","version":150},{"n":365,"text":"\t/** Up to `limit` entries from position `from`, parsed (#41: the feed and replay). */","author":"speed","version":150},{"n":366,"text":"\tsince(from: number, limit: number): Entry[] {","author":"speed","version":150},{"n":367,"text":"\t\tconst out: Entry[] = [];","author":"speed","version":150},{"n":368,"text":"\t\tfor (let at = from; out.length < limit; ) {","author":"speed","version":150},{"n":369,"text":"\t\t\tconst { texts, next } = this.page(at, limit - out.length);","author":"speed","version":150},{"n":370,"text":"\t\t\tfor (const t of texts) out.push(JSON.parse(t) as Entry);","author":"speed","version":150},{"n":371,"text":"\t\t\tif (next === null || texts.length === 0) break;","author":"speed","version":150},{"n":372,"text":"\t\t\tat = next;","author":"speed","version":150},{"n":373,"text":"\t\t}","author":"speed","version":150},{"n":374,"text":"\t\treturn out;","author":"speed","version":150},{"n":375,"text":"\t}","author":"speed","version":150},{"n":376,"text":"","author":"speed","version":150},{"n":377,"text":"\t/** Removes every entry: only for a restore whose log didn't load (#29). */","author":"speed","version":150},{"n":378,"text":"\tclear(): void {","author":"speed","version":150},{"n":379,"text":"\t\tconst generation = this.generation() + 1;","author":"speed","version":150},{"n":380,"text":"\t\tthis.storage.transactionSync(() => {","author":"speed","version":150},{"n":381,"text":"\t\t\tthis.storage.sql.exec(\"DELETE FROM log\");","author":"speed","version":150},{"n":382,"text":"\t\t\tthis.storage.sql.exec(\"DELETE FROM shapes\");","author":"speed","version":150},{"n":383,"text":"\t\t\tthis.storage.sql.exec(\"DELETE FROM counts\");","author":"speed","version":150},{"n":384,"text":"\t\t\tthis.storage.sql.exec(\"DELETE FROM marks WHERE name != ?\", \"generation\");","author":"speed","version":150},{"n":385,"text":"\t\t\tthis.storage.sql.exec(","author":"speed","version":150},{"n":386,"text":"\t\t\t\t\"INSERT OR REPLACE INTO marks (name, value) VALUES (?, ?)\",","author":"speed","version":150},{"n":387,"text":"\t\t\t\t\"generation\",","author":"speed","version":150},{"n":388,"text":"\t\t\t\tString(generation),","author":"speed","version":150},{"n":389,"text":"\t\t\t);","author":"speed","version":150},{"n":390,"text":"\t\t});","author":"speed","version":150},{"n":391,"text":"\t\tthis.next = 0;","author":"speed","version":150},{"n":392,"text":"\t}","author":"speed","version":150},{"n":393,"text":"","author":"speed","version":150},{"n":394,"text":"\t/**","author":"speed","version":150},{"n":395,"text":"\t * Each version's changed files, kept between loads (#41, the Files pages):","author":"speed","version":150},{"n":396,"text":"\t * worked out from the log, never part of it, so an older Worker ignores","author":"speed","version":150},{"n":397,"text":"\t * the table and nothing about the project depends on it.","author":"speed","version":150},{"n":398,"text":"\t */","author":"speed","version":150},{"n":399,"text":"\tshapes(): {","author":"speed","version":150},{"n":400,"text":"\t\tget(space: string, version: number): string | undefined;","author":"speed","version":150},{"n":401,"text":"\t\tput(space: string, version: number, value: string): void;","author":"speed","version":150},{"n":402,"text":"\t} {","author":"speed","version":150},{"n":403,"text":"\t\tconst sql = this.storage.sql;","author":"speed","version":150},{"n":404,"text":"\t\treturn {","author":"speed","version":150},{"n":405,"text":"\t\t\tget: (space, version) =>","author":"speed","version":150},{"n":406,"text":"\t\t\t\t(","author":"speed","version":150},{"n":407,"text":"\t\t\t\t\tsql.exec(\"SELECT value FROM shapes WHERE space = ? AND version = ?\", space, version).toArray() as {","author":"speed","version":150},{"n":408,"text":"\t\t\t\t\t\tvalue: string;","author":"speed","version":150},{"n":409,"text":"\t\t\t\t\t}[]","author":"speed","version":150},{"n":410,"text":"\t\t\t\t)[0]?.value,","author":"speed","version":150},{"n":411,"text":"\t\t\tput: (space, version, value) =>","author":"speed","version":150},{"n":412,"text":"\t\t\t\tvoid sql.exec(\"INSERT OR REPLACE INTO shapes (space, version, value) VALUES (?, ?, ?)\", space, version, value),","author":"speed","version":150},{"n":413,"text":"\t\t};","author":"speed","version":150},{"n":414,"text":"\t}","author":"speed","version":150},{"n":415,"text":"","author":"speed","version":150},{"n":416,"text":"\tappend(entries: readonly Entry[]): void {","author":"speed","version":150},{"n":417,"text":"\t\tif (!entries.length) return;","author":"speed","version":150},{"n":418,"text":"\t\tlet next = this.next;","author":"speed","version":150},{"n":419,"text":"\t\tthis.storage.transactionSync(() => {","author":"speed","version":150},{"n":420,"text":"\t\t\tconst lines = entries.reduce((n, e) => n + linesIn(e), 0);","author":"speed","version":150},{"n":421,"text":"\t\t\tif (lines > 0)","author":"speed","version":150},{"n":422,"text":"\t\t\t\tthis.storage.sql.exec(","author":"speed","version":150},{"n":423,"text":"\t\t\t\t\t\"INSERT INTO counts (name, value) VALUES ('lines', ?) ON CONFLICT(name) DO UPDATE SET value = value + ?\",","author":"speed","version":150},{"n":424,"text":"\t\t\t\t\tlines,","author":"speed","version":150},{"n":425,"text":"\t\t\t\t\tlines,","author":"speed","version":150},{"n":426,"text":"\t\t\t\t);","author":"speed","version":150},{"n":427,"text":"\t\t\t// The newest version of shared: appended entries are the newest, so the last one that makes a version wins.","author":"speed","version":150},{"n":428,"text":"\t\t\tfor (const e of entries) {","author":"speed","version":150},{"n":429,"text":"\t\t\t\tconst v = sharedVersionOf(e);","author":"speed","version":150},{"n":430,"text":"\t\t\t\tif (v !== undefined)","author":"speed","version":150},{"n":431,"text":"\t\t\t\t\tthis.storage.sql.exec(\"INSERT OR REPLACE INTO counts (name, value) VALUES ('shared', ?)\", v);","author":"speed","version":150},{"n":432,"text":"\t\t\t\tconst last = lastPublishOf(e);","author":"speed","version":150},{"n":433,"text":"\t\t\t\tif (last)","author":"speed","version":150},{"n":434,"text":"\t\t\t\t\tthis.storage.sql.exec(","author":"speed","version":150},{"n":435,"text":"\t\t\t\t\t\t\"INSERT OR REPLACE INTO marks (name, value) VALUES (?, ?)\",","author":"speed","version":150},{"n":436,"text":"\t\t\t\t\t\t\"last\",","author":"speed","version":150},{"n":437,"text":"\t\t\t\t\t\tJSON.stringify(last),","author":"speed","version":150},{"n":438,"text":"\t\t\t\t\t);","author":"speed","version":150},{"n":439,"text":"\t\t\t}","author":"speed","version":150},{"n":440,"text":"\t\t\t// Keys are only added to once counted: a log from before the key count is counted whole first (countSizes).","author":"speed","version":150},{"n":441,"text":"\t\t\tconst keys = entries.reduce((n, e) => n + keysIn(e), 0);","author":"speed","version":150},{"n":442,"text":"\t\t\tif (keys > 0) this.storage.sql.exec(\"UPDATE counts SET value = value + ? WHERE name = 'keys'\", keys);","author":"speed","version":150},{"n":443,"text":"\t\t\tlet chars = 0;","author":"speed","version":150},{"n":444,"text":"\t\t\tfor (const entry of entries) {","author":"speed","version":150},{"n":445,"text":"\t\t\t\tlet part = 0;","author":"codex-capacity-chair","version":167},{"n":446,"text":"\t\t\t\tfor (const text of streamedLogParts(entry)) {","author":"codex-capacity-chair","version":167},{"n":447,"text":"\t\t\t\t\tchars += text.length;","author":"speed","version":150},{"n":448,"text":"\t\t\t\t\tthis.storage.sql.exec(\"INSERT INTO log (seq, part, text) VALUES (?, ?, ?)\", next, part++, text);","author":"codex-capacity-chair","version":167},{"n":449,"text":"\t\t\t\t}","author":"codex-capacity-chair","version":167},{"n":450,"text":"\t\t\t\tnext++;","author":"speed","version":150},{"n":451,"text":"\t\t\t}","author":"speed","version":150},{"n":452,"text":"\t\t\t// Chars are only added to once counted: a log from before the count is summed whole first (logSize).","author":"speed","version":150},{"n":453,"text":"\t\t\tif (chars > 0) this.storage.sql.exec(\"UPDATE counts SET value = value + ? WHERE name = 'chars'\", chars);","author":"speed","version":150},{"n":454,"text":"\t\t\tconst generation = this.generation() + 1;","author":"speed","version":150},{"n":455,"text":"\t\t\tthis.storage.sql.exec(","author":"speed","version":150},{"n":456,"text":"\t\t\t\t\"INSERT OR REPLACE INTO marks (name, value) VALUES (?, ?)\",","author":"speed","version":150},{"n":457,"text":"\t\t\t\t\"generation\",","author":"speed","version":150},{"n":458,"text":"\t\t\t\tString(generation),","author":"speed","version":150},{"n":459,"text":"\t\t\t);","author":"speed","version":150},{"n":460,"text":"\t\t});","author":"speed","version":150},{"n":461,"text":"\t\tthis.next = next;","author":"speed","version":150},{"n":462,"text":"\t}","author":"speed","version":150},{"n":463,"text":"}","author":"speed","version":150},{"n":464,"text":"","author":"speed","version":150},{"n":465,"text":"/** The engine's Project as the Worker's ProjectCalls; the clock comes from here. */","author":"speed","version":150},{"n":466,"text":"export class EngineProject implements ProjectCalls, ProjectHistory {","author":"speed","version":150},{"n":467,"text":"\tblame(file: string, from?: number, to?: number, version?: number, draft?: string, agent?: string) {","author":"speed","version":150},{"n":468,"text":"\t\treturn blame(this.project, file, from, to, version, { ...(draft ? { draft } : {}), ...(agent ? { agent } : {}) });","author":"speed","version":150},{"n":469,"text":"\t}","author":"speed","version":150},{"n":470,"text":"\tfolderBlame(folder: string, version?: number, draft?: string, agent?: string) {","author":"speed","version":150},{"n":471,"text":"\t\treturn folderBlame(this.project, folder, version, { ...(draft ? { draft } : {}), ...(agent ? { agent } : {}) });","author":"speed","version":150},{"n":472,"text":"\t}","author":"speed","version":150},{"n":473,"text":"\ttree(folder: string, version?: number, draft?: string | null, agent?: string, authors?: boolean) {","author":"speed","version":150},{"n":474,"text":"\t\treturn this.project.tree(folder, {","author":"speed","version":150},{"n":475,"text":"\t\t\t...(version !== undefined ? { version } : {}),","author":"speed","version":150},{"n":476,"text":"\t\t\tdraft: draft ?? null,","author":"speed","version":150},{"n":477,"text":"\t\t\t...(agent !== undefined ? { agent } : {}),","author":"speed","version":150},{"n":478,"text":"\t\t\t...(authors ? { authors } : {}),","author":"speed","version":150},{"n":479,"text":"\t\t});","author":"speed","version":150},{"n":480,"text":"\t}","author":"speed","version":150},{"n":481,"text":"\tpathLife(path: string, version?: number, draft?: string | null) {","author":"speed","version":150},{"n":482,"text":"\t\treturn this.project.pathLife(path, { ...(version !== undefined ? { version } : {}), draft: draft ?? null });","author":"speed","version":150},{"n":483,"text":"\t}","author":"speed","version":150},{"n":484,"text":"\tfollow(path: string, version: number, from: number, to: number, at?: number, draft?: string | null) {","author":"speed","version":150},{"n":485,"text":"\t\treturn this.project.follow(path, version, from, to, { ...(at !== undefined ? { at } : {}), draft: draft ?? null });","author":"speed","version":150},{"n":486,"text":"\t}","author":"speed","version":150},{"n":487,"text":"\tpathsOf(agent: string) {","author":"speed","version":150},{"n":488,"text":"\t\treturn this.project.pathsOf(agent);","author":"speed","version":150},{"n":489,"text":"\t}","author":"speed","version":150},{"n":490,"text":"\tdraftState(name: string) {","author":"speed","version":150},{"n":491,"text":"\t\treturn this.project.draftState(name);","author":"speed","version":150},{"n":492,"text":"\t}","author":"speed","version":150},{"n":493,"text":"\tcollisions(file?: string, folder?: string) {","author":"speed","version":150},{"n":494,"text":"\t\treturn this.project.collisions({","author":"speed","version":150},{"n":495,"text":"\t\t\t...(file !== undefined ? { file } : {}),","author":"speed","version":150},{"n":496,"text":"\t\t\t...(folder !== undefined ? { folder } : {}),","author":"speed","version":150},{"n":497,"text":"\t\t});","author":"speed","version":150},{"n":498,"text":"\t}","author":"speed","version":150},{"n":499,"text":"\twhy(file: string, line: number, draft?: string, agent?: string, version?: number) {","author":"whytrail","version":193},{"n":500,"text":"\t\treturn why(this.project, file, line, {","author":"whytrail","version":193},{"n":501,"text":"\t\t\t...(draft ? { draft } : {}),","author":"whytrail","version":193},{"n":502,"text":"\t\t\t...(agent ? { agent } : {}),","author":"whytrail","version":193},{"n":503,"text":"\t\t\t...(version !== undefined ? { version } : {}),","author":"whytrail","version":193},{"n":504,"text":"\t\t});","author":"whytrail","version":193},{"n":505,"text":"\t}","author":"speed","version":150},{"n":506,"text":"\twhere() {","author":"speed","version":150},{"n":507,"text":"\t\treturn where(this.project);","author":"speed","version":150},{"n":508,"text":"\t}","author":"speed","version":150},{"n":509,"text":"\trefusals(agent?: string, limit?: number) {","author":"speed","version":150},{"n":510,"text":"\t\treturn this.project.refusals({ ...(agent ? { agent } : {}), ...(limit !== undefined ? { limit } : {}) });","author":"speed","version":150},{"n":511,"text":"\t}","author":"speed","version":150},{"n":512,"text":"","author":"speed","version":150},{"n":513,"text":"\tlog(draft: string | null, limit?: number, path?: string, agent?: string, before?: number, follow?: boolean) {","author":"speed","version":150},{"n":514,"text":"\t\treturn this.project.log({","author":"speed","version":150},{"n":515,"text":"\t\t\tdraft,","author":"speed","version":150},{"n":516,"text":"\t\t\t...(limit !== undefined ? { limit } : {}),","author":"speed","version":150},{"n":517,"text":"\t\t\t...(path !== undefined ? { path } : {}),","author":"speed","version":150},{"n":518,"text":"\t\t\t...(agent ? { agent } : {}),","author":"speed","version":150},{"n":519,"text":"\t\t\t...(before !== undefined ? { before } : {}),","author":"speed","version":150},{"n":520,"text":"\t\t\t...(follow ? { follow } : {}),","author":"speed","version":150},{"n":521,"text":"\t\t});","author":"speed","version":150},{"n":522,"text":"\t}","author":"speed","version":150},{"n":523,"text":"\tfileAt(path: string, version: number, draft: string | null, agent?: string) {","author":"speed","version":150},{"n":524,"text":"\t\treturn this.project.fileAt(path, version, { draft, ...(agent ? { agent } : {}) });","author":"speed","version":150},{"n":525,"text":"\t}","author":"speed","version":150},{"n":526,"text":"\tcompare(from: number, to: number, draft: string | null, agent?: string, summary?: boolean) {","author":"capacity","version":243},{"n":527,"text":"\t\tconst where = { draft, ...(agent ? { agent } : {}) };","author":"capacity","version":244},{"n":528,"text":"\t\treturn summary ? this.project.compareSummary(from, to, where) : this.project.compare(from, to, where);","author":"capacity","version":244},{"n":529,"text":"\t}","author":"speed","version":150},{"n":530,"text":"\twithout(version: number, versions: readonly number[]) {","author":"candidates","version":186},{"n":531,"text":"\t\treturn this.project.without(version, versions);","author":"candidates","version":186},{"n":532,"text":"\t}","author":"candidates","version":186},{"n":533,"text":"\tshow(version: number, draft: string | null, agent?: string) {","author":"speed","version":150},{"n":534,"text":"\t\treturn this.project.show(version, { draft, ...(agent ? { agent } : {}) });","author":"speed","version":150},{"n":535,"text":"\t}","author":"speed","version":150},{"n":536,"text":"\tdiff(agent: string) {","author":"speed","version":150},{"n":537,"text":"\t\treturn this.project.diff(agent);","author":"speed","version":150},{"n":538,"text":"\t}","author":"speed","version":150},{"n":539,"text":"\tsyncFull(agent: string, label?: string) {","author":"speed","version":150},{"n":540,"text":"\t\treturn this.project.sync(agent, { full: true, ...(label !== undefined ? { label } : {}) });","author":"speed","version":150},{"n":541,"text":"\t}","author":"speed","version":150},{"n":542,"text":"\tagentPaths(agent: string) {","author":"speed","version":150},{"n":543,"text":"\t\treturn this.project.agentPaths(agent);","author":"speed","version":150},{"n":544,"text":"\t}","author":"speed","version":150},{"n":545,"text":"\tpathsAt(version?: number, draft?: string | null) {","author":"speed","version":150},{"n":546,"text":"\t\treturn this.project.pathsAt(version, draft ?? null);","author":"speed","version":150},{"n":547,"text":"\t}","author":"speed","version":150},{"n":548,"text":"\tsyncTo(agent: string, label: string) {","author":"speed","version":150},{"n":549,"text":"\t\treturn this.project.sync(agent, { label });","author":"speed","version":150},{"n":550,"text":"\t}","author":"speed","version":150},{"n":551,"text":"\tlabel(agent: string, name: string, version?: number, remove?: boolean) {","author":"speed","version":150},{"n":552,"text":"\t\treturn this.project.label(agent, name, version, Date.now(), { remove: remove === true });","author":"speed","version":150},{"n":553,"text":"\t}","author":"speed","version":150},{"n":554,"text":"\tlabels() {","author":"speed","version":150},{"n":555,"text":"\t\treturn this.project.labels();","author":"speed","version":150},{"n":556,"text":"\t}","author":"speed","version":150},{"n":557,"text":"\tamend(agent: string, message: string) {","author":"speed","version":150},{"n":558,"text":"\t\treturn this.project.amend(agent, message, Date.now());","author":"speed","version":150},{"n":559,"text":"\t}","author":"speed","version":150},{"n":560,"text":"\tpluck(agent: string, draft: string, versions: number[], message: string, withDependencies?: boolean) {","author":"speed","version":150},{"n":561,"text":"\t\treturn this.project.pluck(agent, draft, versions, message, Date.now(), {","author":"speed","version":150},{"n":562,"text":"\t\t\twithDependencies: withDependencies === true,","author":"speed","version":150},{"n":563,"text":"\t\t});","author":"speed","version":150},{"n":564,"text":"\t}","author":"speed","version":150},{"n":565,"text":"\tdrop(agent: string, versions: number[], message: string, withDependents?: boolean) {","author":"speed","version":150},{"n":566,"text":"\t\treturn this.project.drop(agent, versions, message, Date.now(), { withDependents: withDependents === true });","author":"speed","version":150},{"n":567,"text":"\t}","author":"speed","version":150},{"n":568,"text":"\tannounce(agent: string, text: string, to?: string[], how?: string) {","author":"speed","version":150},{"n":569,"text":"\t\treturn this.project.announce(agent, text, to, Date.now(), how);","author":"speed","version":150},{"n":570,"text":"\t}","author":"speed","version":150},{"n":571,"text":"","author":"speed","version":150},{"n":572,"text":"\tannouncePerson(person: { id: string; name: string }, text: string, to?: string[]) {","author":"speed","version":150},{"n":573,"text":"\t\treturn this.project.announcePerson(person, text, to, Date.now());","author":"speed","version":150},{"n":574,"text":"\t}","author":"speed","version":150},{"n":575,"text":"\t/** A seat's earlier chat hears that another chat used the seat (277, groups); as abso's worker has it. */","author":"capacity","version":284},{"n":576,"text":"\tseatNotice(agent: string, place: string, key: string) {","author":"capacity","version":284},{"n":577,"text":"\t\treturn this.project.seatNotice(agent, place, key);","author":"capacity","version":284},{"n":578,"text":"\t}","author":"capacity","version":284},{"n":579,"text":"\tstarting(agent: string, text: string | null, files?: string[], options: { issue?: unknown; done?: unknown } = {}) {","author":"speed","version":150},{"n":580,"text":"\t\treturn this.project.starting(agent, text, files, Date.now(), options);","author":"speed","version":150},{"n":581,"text":"\t}","author":"speed","version":150},{"n":582,"text":"\tnews(agent: string) {","author":"speed","version":150},{"n":583,"text":"\t\treturn this.project.news(agent);","author":"speed","version":150},{"n":584,"text":"\t}","author":"speed","version":150},{"n":585,"text":"\trestore(agent: string, files: string[] | null) {","author":"speed","version":150},{"n":586,"text":"\t\treturn this.project.restore(agent, files, Date.now());","author":"speed","version":150},{"n":587,"text":"\t}","author":"speed","version":150},{"n":588,"text":"","author":"speed","version":150},{"n":589,"text":"\tprivate project: Project;","author":"speed","version":150},{"n":590,"text":"","author":"speed","version":150},{"n":591,"text":"\t/** Reads stored entries by log position, for the feed and replay (#41); absent, those answer 501. */","author":"speed","version":150},{"n":592,"text":"\tprivate readonly read: ((from: number, limit: number) => Entry[]) | undefined;","author":"speed","version":150},{"n":593,"text":"\tprivate readonly store: SqliteLog | undefined;","author":"speed","version":150},{"n":594,"text":"\tprivate readonly historical: (<T>(at: number, operation: (project: Project) => T) => T) | undefined;","author":"codex-capacity-chair","version":162},{"n":595,"text":"","author":"speed","version":150},{"n":596,"text":"\tconstructor(","author":"codex-capacity-chair","version":162},{"n":597,"text":"\t\tproject: Project,","author":"codex-capacity-chair","version":162},{"n":598,"text":"\t\tread?: (from: number, limit: number) => Entry[],","author":"codex-capacity-chair","version":162},{"n":599,"text":"\t\tstore?: SqliteLog,","author":"codex-capacity-chair","version":162},{"n":600,"text":"\t\thistorical?: <T>(at: number, operation: (project: Project) => T) => T,","author":"codex-capacity-chair","version":162},{"n":601,"text":"\t) {","author":"codex-capacity-chair","version":162},{"n":602,"text":"\t\tthis.project = project;","author":"speed","version":150},{"n":603,"text":"\t\tthis.read = read;","author":"speed","version":150},{"n":604,"text":"\t\tthis.store = store;","author":"speed","version":150},{"n":605,"text":"\t\tthis.historical = historical;","author":"codex-capacity-chair","version":162},{"n":606,"text":"\t}","author":"speed","version":150},{"n":607,"text":"","author":"speed","version":150},{"n":608,"text":"\t/** The project's events from log position `from` (#41): reading consumes nothing. */","author":"speed","version":150},{"n":609,"text":"\tfeed(from: number, limit = 500) {","author":"speed","version":150},{"n":610,"text":"\t\tif (!this.read) throw Object.assign(new Error(\"the feed needs the log\"), { code: \"not-implemented\" });","author":"speed","version":150},{"n":611,"text":"\t\tconst end = this.project.logLength;","author":"speed","version":150},{"n":612,"text":"\t\tconst start = Math.max(0, Math.min(from, end));","author":"speed","version":150},{"n":613,"text":"\t\t// Discard each canonical payload after extracting its event. A feed page must","author":"codex-capacity-chair","version":158},{"n":614,"text":"\t\t// not retain every historical file payload in the requested range.","author":"codex-capacity-chair","version":158},{"n":615,"text":"\t\tconst events = [];","author":"codex-capacity-chair","version":158},{"n":616,"text":"\t\tlet next = start;","author":"codex-capacity-chair","version":158},{"n":617,"text":"\t\twhile (next < end && next - start < limit) {","author":"codex-capacity-chair","version":158},{"n":618,"text":"\t\t\tconst entries = this.read(next, 1);","author":"codex-capacity-chair","version":158},{"n":619,"text":"\t\t\tif (entries.length === 0) break;","author":"codex-capacity-chair","version":158},{"n":620,"text":"\t\t\tevents.push(...feedEvents(entries, next));","author":"codex-capacity-chair","version":158},{"n":621,"text":"\t\t\tnext += entries.length;","author":"codex-capacity-chair","version":158},{"n":622,"text":"\t\t}","author":"codex-capacity-chair","version":158},{"n":623,"text":"\t\t// A drop event names the files it took out (#41), so a timeline needs no read per drop.","author":"speed","version":150},{"n":624,"text":"\t\tconst enriched = events.map((e) => {","author":"codex-capacity-chair","version":158},{"n":625,"text":"\t\t\tif (e.type !== \"drop\" || e.version === undefined) return e;","author":"speed","version":150},{"n":626,"text":"\t\t\tconst v = this.project.log({ limit: 1, before: e.version + 1 }).versions[0];","author":"speed","version":150},{"n":627,"text":"\t\t\treturn v && v.version === e.version ? { ...e, dropped: v.files } : e;","author":"speed","version":150},{"n":628,"text":"\t\t});","author":"speed","version":150},{"n":629,"text":"\t\treturn { next, end, events: enriched };","author":"codex-capacity-chair","version":158},{"n":630,"text":"\t}","author":"speed","version":150},{"n":631,"text":"","author":"speed","version":150},{"n":632,"text":"\t/** The log position for a time (ms since 1970) or a version of shared (#41). */","author":"speed","version":150},{"n":633,"text":"\tposition(q: { time?: number; version?: number }) {","author":"speed","version":150},{"n":634,"text":"\t\treturn this.project.position(q);","author":"speed","version":150},{"n":635,"text":"\t}","author":"speed","version":150},{"n":636,"text":"\t/** Whether the Worker runs the queue's check; until it does, \"queue\": true does nothing. */","author":"speed","version":150},{"n":637,"text":"\tsetCheckerReady(ready: boolean): void {","author":"speed","version":150},{"n":638,"text":"\t\tthis.project.checkerReady = ready;","author":"speed","version":150},{"n":639,"text":"\t}","author":"speed","version":150},{"n":640,"text":"\t/** An agent withdraws what it has queued (#39). */","author":"speed","version":150},{"n":641,"text":"\tunqueue(agent: string) {","author":"speed","version":150},{"n":642,"text":"\t\treturn this.project.unqueue(agent, Date.now());","author":"speed","version":150},{"n":643,"text":"\t}","author":"speed","version":150},{"n":644,"text":"\t/** The log length now: what a long-poll waits to see grow. */","author":"speed","version":150},{"n":645,"text":"\tlogLength() {","author":"speed","version":150},{"n":646,"text":"\t\treturn this.project.logLength;","author":"speed","version":150},{"n":647,"text":"\t}","author":"speed","version":150},{"n":648,"text":"\t/** An agent's draft diff for a reader: never creates the agent (#41). */","author":"speed","version":150},{"n":649,"text":"\tdiffOf(agent: string) {","author":"speed","version":150},{"n":650,"text":"\t\treturn this.project.diffOf(agent);","author":"speed","version":150},{"n":651,"text":"\t}","author":"speed","version":150},{"n":652,"text":"\t/** Every agent with unpublished changes: its files and how many changes (#41). */","author":"speed","version":150},{"n":653,"text":"\tchange(id: number) {","author":"speed","version":150},{"n":654,"text":"\t\treturn this.project.change(id);","author":"speed","version":150},{"n":655,"text":"\t}","author":"speed","version":150},{"n":656,"text":"","author":"speed","version":150},{"n":657,"text":"\tchanges(since: number, limit: number, before?: number, issue?: number) {","author":"speed","version":150},{"n":658,"text":"\t\treturn this.project.changes(since, limit, before, issue);","author":"speed","version":150},{"n":659,"text":"\t}","author":"speed","version":150},{"n":660,"text":"","author":"speed","version":150},{"n":661,"text":"\tmove(agent: string, from: string, to: string) {","author":"speed","version":150},{"n":662,"text":"\t\treturn this.project.move(agent, from, to, Date.now());","author":"speed","version":150},{"n":663,"text":"\t}","author":"speed","version":150},{"n":664,"text":"","author":"speed","version":150},{"n":665,"text":"\tnote(agent: string, body: Record<string, unknown>) {","author":"speed","version":150},{"n":666,"text":"\t\treturn this.project.note(agent, body, Date.now());","author":"speed","version":150},{"n":667,"text":"\t}","author":"speed","version":150},{"n":668,"text":"","author":"speed","version":150},{"n":669,"text":"\tnotePerson(person: { id: string; name: string }, body: Record<string, unknown>) {","author":"speed","version":150},{"n":670,"text":"\t\treturn this.project.notePerson(person, body, Date.now());","author":"speed","version":150},{"n":671,"text":"\t}","author":"speed","version":150},{"n":672,"text":"","author":"speed","version":150},{"n":673,"text":"\tcloseNotePerson(person: { id: string; name: string }, id: number, how: unknown) {","author":"speed","version":150},{"n":674,"text":"\t\treturn this.project.closeNotePerson(person, id, how, Date.now());","author":"speed","version":150},{"n":675,"text":"\t}","author":"speed","version":150},{"n":676,"text":"","author":"speed","version":150},{"n":677,"text":"\tcloseNote(agent: string, id: number, how: unknown) {","author":"speed","version":150},{"n":678,"text":"\t\treturn this.project.closeNote(agent, id, how, Date.now());","author":"speed","version":150},{"n":679,"text":"\t}","author":"speed","version":150},{"n":680,"text":"","author":"speed","version":150},{"n":681,"text":"\tnotes(options: { file?: string; change?: number; open?: boolean }) {","author":"speed","version":150},{"n":682,"text":"\t\treturn this.project.notes(options);","author":"speed","version":150},{"n":683,"text":"\t}","author":"speed","version":150},{"n":684,"text":"","author":"speed","version":150},{"n":685,"text":"\tribbon() {","author":"speed","version":150},{"n":686,"text":"\t\treturn this.project.ribbon();","author":"speed","version":150},{"n":687,"text":"\t}","author":"speed","version":150},{"n":688,"text":"","author":"speed","version":150},{"n":689,"text":"\tdrafts() {","author":"speed","version":150},{"n":690,"text":"\t\tconst s = this.project.status();","author":"speed","version":150},{"n":691,"text":"\t\treturn {","author":"speed","version":150},{"n":692,"text":"\t\t\tversion: s.version,","author":"speed","version":150},{"n":693,"text":"\t\t\tdrafts: s.agents","author":"speed","version":150},{"n":694,"text":"\t\t\t\t.filter((a) => a.draftChanges > 0)","author":"speed","version":150},{"n":695,"text":"\t\t\t\t.map((a) => ({ agent: a.agent, draft: a.draft, base: a.base, draftChanges: a.draftChanges, files: a.files })),","author":"speed","version":150},{"n":696,"text":"\t\t};","author":"speed","version":150},{"n":697,"text":"\t}","author":"speed","version":150},{"n":698,"text":"\t/** The last copy replay loaded: scrubbing forward from it applies only the entries after it. */","author":"speed","version":150},{"n":699,"text":"\tprivate replica: Project | undefined;","author":"speed","version":150},{"n":700,"text":"","author":"speed","version":150},{"n":701,"text":"\t/** The project as it stood with the first `at` log entries (#41, replay). */","author":"speed","version":150},{"n":702,"text":"\tprivate at(at: number): Project {","author":"speed","version":150},{"n":703,"text":"\t\tif (!this.read) throw Object.assign(new Error(\"replay needs the log\"), { code: \"not-implemented\" });","author":"speed","version":150},{"n":704,"text":"\t\tconst n = Math.max(0, Math.min(at, this.project.logLength));","author":"speed","version":150},{"n":705,"text":"\t\tconst r = this.replica;","author":"speed","version":150},{"n":706,"text":"\t\tif (r && r.logLength === n) return r;","author":"speed","version":150},{"n":707,"text":"\t\tif (r && r.logLength < n) {","author":"speed","version":150},{"n":708,"text":"\t\t\tr.catchUp(this.read(r.logLength, n - r.logLength));","author":"speed","version":150},{"n":709,"text":"\t\t\treturn r;","author":"speed","version":150},{"n":710,"text":"\t\t}","author":"speed","version":150},{"n":711,"text":"\t\tthis.replica = Project.load(this.read(0, n), new MemoryStore());","author":"speed","version":150},{"n":712,"text":"\t\treturn this.replica;","author":"speed","version":150},{"n":713,"text":"\t}","author":"speed","version":150},{"n":714,"text":"\tstatusAt(at: number) {","author":"speed","version":150},{"n":715,"text":"\t\tif (this.historical)","author":"codex-capacity-chair","version":162},{"n":716,"text":"\t\t\treturn this.historical(Math.max(0, Math.min(at, this.project.logLength)), (p) => ({","author":"codex-capacity-chair","version":162},{"n":717,"text":"\t\t\t\tat: Math.min(at, this.project.logLength),","author":"codex-capacity-chair","version":162},{"n":718,"text":"\t\t\t\t...(p.initialized ? p.status() : { version: -1, agents: [] }),","author":"codex-capacity-chair","version":162},{"n":719,"text":"\t\t\t}));","author":"codex-capacity-chair","version":162},{"n":720,"text":"\t\tconst p = this.at(at);","author":"speed","version":150},{"n":721,"text":"\t\tconst answer = {","author":"speed","version":150},{"n":722,"text":"\t\t\tat: Math.min(at, this.project.logLength),","author":"speed","version":150},{"n":723,"text":"\t\t\t...(p.initialized ? p.status() : { version: -1, agents: [] }),","author":"speed","version":150},{"n":724,"text":"\t\t};","author":"speed","version":150},{"n":725,"text":"\t\tthis.release();","author":"speed","version":150},{"n":726,"text":"\t\treturn answer;","author":"speed","version":150},{"n":727,"text":"\t}","author":"speed","version":150},{"n":728,"text":"\twhereAt(at: number) {","author":"speed","version":150},{"n":729,"text":"\t\tif (this.historical)","author":"codex-capacity-chair","version":162},{"n":730,"text":"\t\t\treturn this.historical(Math.max(0, Math.min(at, this.project.logLength)), (p) => ({","author":"codex-capacity-chair","version":162},{"n":731,"text":"\t\t\t\tat: Math.min(at, this.project.logLength),","author":"codex-capacity-chair","version":162},{"n":732,"text":"\t\t\t\t...(p.initialized ? where(p) : { version: -1, files: {} }),","author":"codex-capacity-chair","version":162},{"n":733,"text":"\t\t\t}));","author":"codex-capacity-chair","version":162},{"n":734,"text":"\t\tconst p = this.at(at);","author":"speed","version":150},{"n":735,"text":"\t\tconst answer = {","author":"speed","version":150},{"n":736,"text":"\t\t\tat: Math.min(at, this.project.logLength),","author":"speed","version":150},{"n":737,"text":"\t\t\t...(p.initialized ? where(p) : { version: -1, files: {} }),","author":"speed","version":150},{"n":738,"text":"\t\t};","author":"speed","version":150},{"n":739,"text":"\t\tthis.release();","author":"speed","version":150},{"n":740,"text":"\t\treturn answer;","author":"speed","version":150},{"n":741,"text":"\t}","author":"speed","version":150},{"n":742,"text":"","author":"speed","version":150},{"n":743,"text":"\t/**","author":"speed","version":150},{"n":744,"text":"\t * Drop the replay copy after each read (#46): a second copy of a large","author":"speed","version":150},{"n":745,"text":"\t * project's history doubles its memory, past a Durable Object's 128 MB.","author":"speed","version":150},{"n":746,"text":"\t * Each scrub replays from the start instead (about 0.2 s on game).","author":"speed","version":150},{"n":747,"text":"\t */","author":"speed","version":150},{"n":748,"text":"\tprivate release(): void {","author":"speed","version":150},{"n":749,"text":"\t\tthis.replica = undefined;","author":"speed","version":150},{"n":750,"text":"\t}","author":"speed","version":150},{"n":751,"text":"","author":"speed","version":150},{"n":752,"text":"\t/** hasBlob says whether the project holds a blob's bytes (#27); without it, every blob is refused. */","author":"speed","version":150},{"n":753,"text":"\t/** whole stores and reads files kept whole (#46); without it every text file is tracked by line. */","author":"speed","version":150},{"n":754,"text":"\tstatic open(","author":"speed","version":150},{"n":755,"text":"\t\tstorage: SqliteStorage,","author":"speed","version":150},{"n":756,"text":"\t\thasBlob?: (sha256: string) => boolean,","author":"speed","version":150},{"n":757,"text":"\t\twhole?: { keep(text: string): string; read(sha: string): string | null },","author":"speed","version":150},{"n":758,"text":"\t): EngineProject {","author":"speed","version":150},{"n":759,"text":"\t\tconst log = new SqliteLog(storage);","author":"speed","version":150},{"n":760,"text":"\t\treturn new EngineProject(","author":"speed","version":150},{"n":761,"text":"\t\t\tProject.load(log.entries(), log, {","author":"speed","version":150},{"n":762,"text":"\t\t\t\t...(hasBlob ? { hasBlob } : {}),","author":"speed","version":150},{"n":763,"text":"\t\t\t\t...(whole ? { whole } : {}),","author":"speed","version":150},{"n":764,"text":"\t\t\t\tnow: () => Date.now(),","author":"speed","version":150},{"n":765,"text":"\t\t\t\tshapes: log.shapes(),","author":"speed","version":150},{"n":766,"text":"\t\t\t\tentryAt: (at) => log.since(at, 1)[0]!,","author":"speed","version":150},{"n":767,"text":"\t\t\t}),","author":"speed","version":150},{"n":768,"text":"\t\t\t(from, limit) => log.since(from, limit),","author":"speed","version":150},{"n":769,"text":"\t\t\tlog,","author":"speed","version":150},{"n":770,"text":"\t\t);","author":"speed","version":150},{"n":771,"text":"\t}","author":"speed","version":150},{"n":772,"text":"","author":"speed","version":150},{"n":773,"text":"\texists() {","author":"speed","version":150},{"n":774,"text":"\t\treturn this.project.initialized;","author":"speed","version":150},{"n":775,"text":"\t}","author":"speed","version":150},{"n":776,"text":"\t/** Committed log epoch for host-side cache invalidation; it does not dispatch work. */","author":"speed","version":150},{"n":777,"text":"\tcommittedGeneration(): number {","author":"speed","version":150},{"n":778,"text":"\t\treturn this.store?.generation() ?? 0;","author":"speed","version":150},{"n":779,"text":"\t}","author":"speed","version":150},{"n":780,"text":"\tinit(","author":"speed","version":150},{"n":781,"text":"\t\tfiles: Record<string, string>,","author":"speed","version":150},{"n":782,"text":"\t\tmodes?: Record<string, { exec?: boolean; link?: string | null }>,","author":"speed","version":150},{"n":783,"text":"\t\tblobs?: Record<string, string>,","author":"speed","version":150},{"n":784,"text":"\t) {","author":"speed","version":150},{"n":785,"text":"\t\treturn this.project.init(files, Date.now(), modes ?? {}, blobs ?? {});","author":"speed","version":150},{"n":786,"text":"\t}","author":"speed","version":150},{"n":787,"text":"\tedit(agent: string, body: EditBody) {","author":"speed","version":150},{"n":788,"text":"\t\treturn this.project.edit(agent, body as Parameters<Project[\"edit\"]>[1], Date.now());","author":"speed","version":150},{"n":789,"text":"\t}","author":"speed","version":150},{"n":790,"text":"\trecord(","author":"speed","version":150},{"n":791,"text":"\t\tagent: string,","author":"speed","version":150},{"n":792,"text":"\t\tfiles: Record<string, string | null>,","author":"speed","version":150},{"n":793,"text":"\t\tmodes?: Record<string, { exec?: boolean; link?: string | null }>,","author":"speed","version":150},{"n":794,"text":"\t\tblobs?: Record<string, string>,","author":"speed","version":150},{"n":795,"text":"\t\tmeta?: { session?: string; subagent?: string; client?: string },","author":"speed","version":150},{"n":796,"text":"\t) {","author":"speed","version":150},{"n":797,"text":"\t\treturn this.project.record(agent, files, Date.now(), modes ?? {}, blobs ?? {}, meta ?? {});","author":"speed","version":150},{"n":798,"text":"\t}","author":"speed","version":150},{"n":799,"text":"\tpublish(agent: string, message: string, asIs?: boolean) {","author":"speed","version":150},{"n":800,"text":"\t\treturn this.project.publish(agent, message, Date.now(), { asIs: asIs === true });","author":"speed","version":150},{"n":801,"text":"\t}","author":"speed","version":150},{"n":802,"text":"\tsync(agent: string) {","author":"speed","version":150},{"n":803,"text":"\t\treturn this.project.sync(agent);","author":"speed","version":150},{"n":804,"text":"\t}","author":"speed","version":150},{"n":805,"text":"\tstatus() {","author":"speed","version":150},{"n":806,"text":"\t\treturn this.project.status();","author":"speed","version":150},{"n":807,"text":"\t}","author":"speed","version":150},{"n":808,"text":"\tswitchTo(agent: string, name: string | null, carry = false) {","author":"speed","version":150},{"n":809,"text":"\t\treturn this.project.switchTo(agent, name, Date.now(), { carry });","author":"speed","version":150},{"n":810,"text":"\t}","author":"speed","version":150},{"n":811,"text":"\tland(agent: string, message: string) {","author":"speed","version":150},{"n":812,"text":"\t\treturn this.project.land(agent, message, Date.now());","author":"speed","version":150},{"n":813,"text":"\t}","author":"speed","version":150},{"n":814,"text":"\tingest(input: Parameters<Project[\"ingest\"]>[0], time: number) {","author":"speed","version":150},{"n":815,"text":"\t\treturn this.project.ingest(input, time);","author":"speed","version":150},{"n":816,"text":"\t}","author":"speed","version":150},{"n":817,"text":"\tsyncDraft(agent: string) {","author":"speed","version":150},{"n":818,"text":"\t\treturn this.project.syncDraft(agent, Date.now());","author":"speed","version":150},{"n":819,"text":"\t}","author":"speed","version":150},{"n":820,"text":"\tfilesAt(version: number) {","author":"speed","version":150},{"n":821,"text":"\t\treturn this.project.viewAt(version).files();","author":"speed","version":150},{"n":822,"text":"\t}","author":"codex-capacity-chair","version":177},{"n":823,"text":"\tfileTextAt(version: number, path: string): string {","author":"codex-capacity-chair","version":177},{"n":824,"text":"\t\treturn this.project.viewAt(version).text(path);","author":"codex-capacity-chair","version":177},{"n":825,"text":"\t}","author":"codex-capacity-chair","version":177},{"n":826,"text":"\t/** One scoped batch: at most 64 files and 64 Ki characters plus one whole file. */","author":"codex-capacity-chair","version":177},{"n":827,"text":"\tfileTextsAt(version: number, paths: readonly string[]): Record<string, string> {","author":"codex-capacity-chair","version":177},{"n":828,"text":"\t\tconst view = this.project.viewAt(version);","author":"codex-capacity-chair","version":177},{"n":829,"text":"\t\tconst files: Record<string, string> = Object.create(null);","author":"codex-capacity-chair","version":177},{"n":830,"text":"\t\tlet characters = 0;","author":"codex-capacity-chair","version":177},{"n":831,"text":"\t\tfor (const path of paths.slice(0, 64)) {","author":"codex-capacity-chair","version":177},{"n":832,"text":"\t\t\tconst text = view.attrs(path).link !== null ? \"\" : view.text(path);","author":"codex-capacity-chair","version":177},{"n":833,"text":"\t\t\tfiles[path] = text;","author":"codex-capacity-chair","version":177},{"n":834,"text":"\t\t\tcharacters += text.length;","author":"codex-capacity-chair","version":177},{"n":835,"text":"\t\t\tif (characters >= 65536) break;","author":"codex-capacity-chair","version":177},{"n":836,"text":"\t\t}","author":"codex-capacity-chair","version":177},{"n":837,"text":"\t\treturn files;","author":"codex-capacity-chair","version":177},{"n":838,"text":"\t}","author":"codex-capacity-chair","version":177},{"n":839,"text":"\t/** Capture metadata now; each text read reopens the captured version in a fresh host scope. */","author":"codex-capacity-chair","version":177},{"n":840,"text":"\tsharedPushMetadata(): PushSnapshotMetadata {","author":"codex-capacity-chair","version":177},{"n":841,"text":"\t\tconst version = this.project.version;","author":"codex-capacity-chair","version":177},{"n":842,"text":"\t\tconst view = this.project.viewAt(version);","author":"codex-capacity-chair","version":177},{"n":843,"text":"\t\tconst paths: string[] = [];","author":"codex-capacity-chair","version":177},{"n":844,"text":"\t\tconst modes: PushSnapshotMetadata[\"modes\"] = Object.create(null);","author":"codex-capacity-chair","version":177},{"n":845,"text":"\t\tconst blobs: Record<string, string> = Object.create(null);","author":"codex-capacity-chair","version":177},{"n":846,"text":"\t\tfor (const path of view.paths()) {","author":"codex-capacity-chair","version":177},{"n":847,"text":"\t\t\tconst attrs = view.attrs(path);","author":"codex-capacity-chair","version":177},{"n":848,"text":"\t\t\tmodes[path] = { exec: attrs.exec, link: attrs.link };","author":"codex-capacity-chair","version":177},{"n":849,"text":"\t\t\tif (attrs.blob !== null) blobs[path] = attrs.blob;","author":"codex-capacity-chair","version":177},{"n":850,"text":"\t\t\telse paths.push(path);","author":"codex-capacity-chair","version":177},{"n":851,"text":"\t\t}","author":"codex-capacity-chair","version":177},{"n":852,"text":"\t\tconst by = version > 0 ? this.project.published(version) : undefined;","author":"codex-capacity-chair","version":177},{"n":853,"text":"\t\treturn { version, paths, modes, blobs, ...(by ? { last: { agent: by.agent, message: by.message } } : {}) };","author":"codex-capacity-chair","version":177},{"n":854,"text":"\t}","author":"speed","version":150},{"n":855,"text":"\tblobsAt(version: number) {","author":"speed","version":150},{"n":856,"text":"\t\treturn this.project.viewAt(version).blobs();","author":"speed","version":150},{"n":857,"text":"\t}","author":"speed","version":150},{"n":858,"text":"\t/**","author":"speed","version":150},{"n":859,"text":"\t * Shared's newest version. Its files and modes are laid out on first read: every call reads shared().version","author":"speed","version":150},{"n":860,"text":"\t * before and after its op, and laying out the files reads each file's text from the log, about 0.5 s on abso","author":"speed","version":150},{"n":861,"text":"\t * (abso 299).","author":"speed","version":150},{"n":862,"text":"\t */","author":"speed","version":150},{"n":863,"text":"\tshared() {","author":"speed","version":150},{"n":864,"text":"\t\tconst version = this.project.version;","author":"speed","version":150},{"n":865,"text":"\t\tconst by = version > 0 ? this.project.published(version) : undefined;","author":"speed","version":150},{"n":866,"text":"\t\tconst blobs = this.project.blobs();","author":"speed","version":150},{"n":867,"text":"\t\tconst project = this.project;","author":"speed","version":150},{"n":868,"text":"\t\tlet files: Record<string, string> | undefined;","author":"speed","version":150},{"n":869,"text":"\t\tlet modes: ReturnType<Project[\"modes\"]> | undefined;","author":"speed","version":150},{"n":870,"text":"\t\treturn {","author":"speed","version":150},{"n":871,"text":"\t\t\tversion,","author":"speed","version":150},{"n":872,"text":"\t\t\tget files() {","author":"speed","version":150},{"n":873,"text":"\t\t\t\tfiles ??= project.files();","author":"speed","version":150},{"n":874,"text":"\t\t\t\treturn files;","author":"speed","version":150},{"n":875,"text":"\t\t\t},","author":"speed","version":150},{"n":876,"text":"\t\t\tget modes() {","author":"speed","version":150},{"n":877,"text":"\t\t\t\tmodes ??= project.modes();","author":"speed","version":150},{"n":878,"text":"\t\t\t\treturn modes;","author":"speed","version":150},{"n":879,"text":"\t\t\t},","author":"speed","version":150},{"n":880,"text":"\t\t\t...(Object.keys(blobs).length > 0 ? { blobs } : {}),","author":"speed","version":150},{"n":881,"text":"\t\t\t...(by ? { last: { agent: by.agent, message: by.message } } : {}),","author":"speed","version":150},{"n":882,"text":"\t\t};","author":"speed","version":150},{"n":883,"text":"\t}","author":"speed","version":150},{"n":884,"text":"}","author":"speed","version":150}],"authors":[{"agent":"speed","lines":709},{"agent":"codex-capacity-chair","lines":159},{"agent":"capacity","lines":7},{"agent":"whytrail","lines":6},{"agent":"candidates","lines":3}],"older":null,"followed":null,"life":{"versions":11,"last":{"version":284,"agent":"capacity","time":1792118185051,"timeIso":"2026-10-16T02:36:25.051Z","message":"server/src/engine-project.ts: EngineProject passes seatNotice through (277 added it to ProjectHistory; the server's check failed on it since, 283's too). The same pass-through abso's worker has (abso 1430). Root and server tsc clean."},"made":{"version":150,"agent":"speed","time":1791907522179,"timeIso":"2026-10-13T16:05:22.179Z","message":"Open server: the project Worker, Durable Object and Artifacts (issue 17)"},"removed":null,"next":null},"since":null,"paths":[".absoignore",".gitignore","LICENSE","README.md","abso.json","biome.json","client/.claude-plugin/plugin.json","client/README.md","client/abso.ts","client/avcs.ts","client/hooks/hooks.json","client/hooks/register.test.ts","client/hooks/register.ts","client/hooks/stamp.ts","client/install-mod.ts","client/install-view.ts","client/launch.mjs","client/scripts/import-git.ts","client/skills/abso/SKILL.md","client/src/announce.ts","client/src/api-answers.ts","client/src/api-error.ts","client/src/api.ts","client/src/args.ts","client/src/at.ts","client/src/autosettle-commands.ts","client/src/blobs.ts","client/src/body-files.ts","client/src/box-commands.ts","client/src/box-run.ts","client/src/box.ts","client/src/changes.ts","client/src/check-ignore.ts","client/src/ci-answers.ts","client/src/ci.ts","client/src/clean-files.ts","client/src/client-version.ts","client/src/collision-text.ts","client/src/command-env.ts","client/src/commands.ts","client/src/config.ts","client/src/core.ts","client/src/diff.ts","client/src/doctor.ts","client/src/drafts.ts","client/src/durable-object-stand-in.ts","client/src/env-names.ts","client/src/export.ts","client/src/fetch.ts","client/src/flag-commands.ts","client/src/folder.ts","client/src/git-origin.ts","client/src/group-commands.ts","client/src/history-answers.ts","client/src/history.ts","client/src/hook.ts","client/src/install.ts","client/src/issues-wire.ts","client/src/issues.ts","client/src/join-commands.ts","client/src/key-admin.ts","client/src/local-server.d.mts","client/src/local-server.mjs","client/src/local-store.ts","client/src/lock.ts","client/src/main.ts","client/src/mcp.ts","client/src/modes.ts","client/src/news-stream.ts","client/src/open-browser.ts","client/src/orgs.ts","client/src/pipeline-commands.ts","client/src/project-file.ts","client/src/publish-commands.ts","client/src/queue.ts","client/src/record-batches.ts","client/src/review.ts","client/src/safety.ts","client/src/serve-commands.ts","client/src/server-choice.ts","client/src/settle.ts","client/src/skill.ts","client/src/state-dir.ts","client/src/status-commands.ts","client/src/tar.ts","client/src/terminal-text.ts","client/src/times.ts","client/src/versions.ts","client/src/visibility-commands.ts","client/src/visitor.ts","client/src/web-session.ts","client/src/without.ts","client/test-mods.ts","client/test/api-request-id.test.ts","client/test/attach.test.ts","client/test/autosettle-command.test.ts","client/test/body-files.test.ts","client/test/box.test.ts","client/test/caller.test.ts","client/test/ci-runs.test.ts","client/test/client-version.test.ts","client/test/client.test.ts","client/test/comment-parts.test.ts","client/test/diff.test.ts","client/test/doctor.test.ts","client/test/env-names.test.ts","client/test/error-sentence.test.ts","client/test/failed-start.test.ts","client/test/fake-server.ts","client/test/flag-command.test.ts","client/test/group-commands.test.ts","client/test/held-push.test.ts","client/test/help.test.ts","client/test/ignore.test.ts","client/test/imported-history.test.ts","client/test/init-credential.test.ts","client/test/install.test.ts","client/test/issues.test.ts","client/test/join-empty.test.ts","client/test/join-signed-out.test.ts","client/test/key-admin.test.ts","client/test/key.test.ts","client/test/launch.test.ts","client/test/local.test.ts","client/test/lost-pull.test.ts","client/test/new-folder-dir.test.ts","client/test/news-stream.test.ts","client/test/open-browser.test.ts","client/test/orgs.test.ts","client/test/pipeline-commands.test.ts","client/test/push-ci-where.test.ts","client/test/queue-waiting.test.ts","client/test/record-batches.test.ts","client/test/run-key.test.ts","client/test/server-flag.test.ts","client/test/setup.ts","client/test/skill.test.ts","client/test/terminal-text.test.ts","client/test/times.test.ts","client/test/token-file.test.ts","client/test/visitor.test.ts","client/test/web-session.test.ts","client/test/why-trail.test.ts","client/view/.claude-plugin/plugin.json","client/view/hooks/hooks.json","client/view/hooks/register.test.ts","client/view/hooks/register.tsx","client/view/hooks/stamp.ts","client/view/types/index.d.ts","docs/readme/abso-core-on-abso.png","docs/readme/open-in-abso.svg","package-lock.json","package.json","scripts/autosettle/STORIES.md","scripts/autosettle/clef.ts","scripts/autosettle/extract.ts","scripts/autosettle/jev.ts","scripts/autosettle/replay.ts","scripts/autosettle/rules.ts","scripts/autosettle/score.ts","scripts/autosettle/settle-one.ts","scripts/autosettle/workers-ai.ts","scripts/autosettle/workers-ai/index.ts","scripts/autosettle/workers-ai/wrangler.jsonc","scripts/build-client.mjs","scripts/check-changed.mjs","scripts/check-changed.test.ts","scripts/local-measure.ts","scripts/local-writers.ts","scripts/pack-npm.mjs","server/README.md","server/STORAGE-FORMATS.md","server/package-lock.json","server/package.json","server/scale/README.md","server/scale/results/scale-mv6vy4y3-10x5.json","server/scale/results/scale-mv6vzxzj-100x10.json","server/scale/results/scale-mv6vzxzj-10x5.json","server/scale/results/scale-mv6vzxzj-1x1.json","server/scale/results/scale-mv6vzxzj-200x20.json","server/scale/results/scale-mv6vzxzj-50x10.json","server/scale/results/scale-mv6vzxzj-ramp.json","server/scale/scale.mjs","server/scripts/capacity-git-bounded-fifo.mjs","server/scripts/capacity-install-git-runtime.mjs","server/scripts/capacity-patch-git-fetch.mjs","server/scripts/capacity-patch-git-progress.mjs","server/scripts/capacity-patch-git-pump.mjs","server/scripts/capacity-patch-git-push.mjs","server/scripts/capacity-patch-git-sideband.mjs","server/src/autosettle.ts","server/src/blobs.ts","server/src/decoded-frames.ts","server/src/disk-first-runtime.ts","server/src/engine-project.ts","server/src/env.ts","server/src/git-blob-text.ts","server/src/git-delta-stream.ts","server/src/git-disk-intake.ts","server/src/git-file-contents.ts","server/src/git-http.ts","server/src/git-intake-limit.ts","server/src/git-intake-trees.ts","server/src/git-object-bytes.ts","server/src/git-pack-decode.ts","server/src/git-pack-resolver.ts","server/src/git-pack-spool.ts","server/src/history-host.ts","server/src/history-state.ts","server/src/index.ts","server/src/ingest.ts","server/src/issues-entry.ts","server/src/issues/index.ts","server/src/issues/routes.ts","server/src/issues/seats.ts","server/src/issues/serve.ts","server/src/issues/store.ts","server/src/json-chunk-cursor.ts","server/src/json-events.ts","server/src/keys.ts","server/src/memory-fs.ts","server/src/project-object.ts","server/src/projection-store.ts","server/src/push-snapshot.ts","server/src/push.ts","server/src/request-identity-digest.ts","server/src/router.ts","server/src/small-frame-json.ts","server/src/stored-json-view.ts","server/src/stored-json.ts","server/src/writer-host.ts","server/test/atom-list-history.test.ts","server/test/blobs.test.ts","server/test/canonical-frame-numbers.test.ts","server/test/decoded-adoption-bounds.test.ts","server/test/decoded-entry-adoption.test.ts","server/test/decoded-frames-small.test.ts","server/test/decoded-frames.test.ts","server/test/definition-scratch-runtime.test.ts","server/test/disk-first-runtime.test.ts","server/test/e2e-transcript.md","server/test/engine-project.test.ts","server/test/frame-chunks.test.ts","server/test/git-blob-text.test.ts","server/test/git-budget-recovery.test.ts","server/test/git-delta-stream.test.ts","server/test/git-disk-clone.test.ts","server/test/git-export-http.test.ts","server/test/git-file-contents.test.ts","server/test/git-intake-trees.test.ts","server/test/git-object-bytes.test.ts","server/test/git-pack-decode.test.ts","server/test/git-pack-resolver.test.ts","server/test/git-pack-spool.test.ts","server/test/helpers.ts","server/test/history-host.test.ts","server/test/history-recovery.test.ts","server/test/history-state.test.ts","server/test/issues/ask-threads.test.ts","server/test/issues/changes.test.ts","server/test/issues/issues.test.ts","server/test/issues/news.test.ts","server/test/issues/serve.test.ts","server/test/json-chunk-cursor.test.ts","server/test/json-events.test.ts","server/test/long-text-history.test.ts","server/test/project-object-disk-first.test.ts","server/test/projected-compare.test.ts","server/test/projected-diff.test.ts","server/test/projected-move-sync.test.ts","server/test/projected-move.test.ts","server/test/projected-path-history.test.ts","server/test/projected-queue.test.ts","server/test/projected-restore.test.ts","server/test/projected-sync.test.ts","server/test/push-snapshot-batch.test.ts","server/test/push-snapshot.test.ts","server/test/push.test.ts","server/test/request-identity-digest.test.ts","server/test/router.test.ts","server/test/small-frame-integrity.test.ts","server/test/small-frame-json.test.ts","server/test/stored-json-view.test.ts","server/test/stored-json.test.ts","server/test/streamed-history-host.test.ts","server/test/streamed-large-frame.test.ts","server/test/streamed-large-history.test.ts","server/test/streamed-log-append.test.ts","server/test/streamed-log-transaction.test.ts","server/test/streamed-writer-adoption.test.ts","server/test/writer-host.test.ts","server/test/writer-long-atom.test.ts","server/tsconfig.json","server/wrangler.jsonc","src/caller.ts","src/engine/build.ts","src/engine/child-counts.ts","src/engine/conflicts.ts","src/engine/experimental/projection-atom-adoption.ts","src/engine/experimental/projection-atom-index.ts","src/engine/experimental/projection-locator.ts","src/engine/experimental/projection-marker.ts","src/engine/experimental/projection-move-adoption.ts","src/engine/experimental/projection-move-resolution.ts","src/engine/experimental/projection-overlay-storage.ts","src/engine/experimental/projection-priority.ts","src/engine/experimental/projection-read-scope.ts","src/engine/experimental/projection-reader.ts","src/engine/experimental/projection-records.ts","src/engine/experimental/projection-root.ts","src/engine/experimental/projection-sequence.ts","src/engine/experimental/projection-snapshots.ts","src/engine/graph.ts","src/engine/index.ts","src/engine/json-value-chunks.ts","src/engine/keys.ts","src/engine/labels.ts","src/engine/ordered-index.ts","src/engine/projection-scratch.ts","src/engine/relocation-scratch.ts","src/engine/sets.ts","src/engine/state-source.ts","src/engine/stored-text.ts","src/engine/test/attribute-projection.test.ts","src/engine/test/build-lazy-lines.test.ts","src/engine/test/build.test.ts","src/engine/test/child-counts.test.ts","src/engine/test/concurrent.test.ts","src/engine/test/conflicts.test.ts","src/engine/test/gen.ts","src/engine/test/graph-atom-list-integrity.test.ts","src/engine/test/graph-atom-list-pages.test.ts","src/engine/test/graph-atom-list-rollback.test.ts","src/engine/test/graph-atom-lists.test.ts","src/engine/test/graph-deletion-pages.test.ts","src/engine/test/graph-deletion-rollback.test.ts","src/engine/test/graph-index-dedup.test.ts","src/engine/test/graph-insertion-integrity.test.ts","src/engine/test/graph-insertion-runs.test.ts","src/engine/test/graph-insertion-storage.test.ts","src/engine/test/graph-line-chunks.test.ts","src/engine/test/graph-long-text.test.ts","src/engine/test/graph-metadata-indexed.test.ts","src/engine/test/graph-move-write-membership.test.ts","src/engine/test/graph-replacement-membership.test.ts","src/engine/test/graph-validation-scratch.test.ts","src/engine/test/graph.test.ts","src/engine/test/helpers.ts","src/engine/test/json-string-chunks.test.ts","src/engine/test/json-value-chunks.test.ts","src/engine/test/lamport-pages.test.ts","src/engine/test/moves.test.ts","src/engine/test/ordered-index.test.ts","src/engine/test/packed-files.test.ts","src/engine/test/projection-atom-adoption.test.ts","src/engine/test/projection-atom-index.test.ts","src/engine/test/projection-locator.test.ts","src/engine/test/projection-marker-cycle.test.ts","src/engine/test/projection-marker-move-failures.test.ts","src/engine/test/projection-marker.test.ts","src/engine/test/projection-membership-iterator.test.ts","src/engine/test/projection-move-resolution.test.ts","src/engine/test/projection-overlay-storage.test.ts","src/engine/test/projection-priority.test.ts","src/engine/test/projection-read-scope.test.ts","src/engine/test/projection-reader-integrity.test.ts","src/engine/test/projection-reader.test.ts","src/engine/test/projection-records.test.ts","src/engine/test/projection-root.test.ts","src/engine/test/projection-scratch.test.ts","src/engine/test/projection-sequence.test.ts","src/engine/test/projection-snapshots.test.ts","src/engine/test/properties.test.ts","src/engine/test/reachability-scratch.test.ts","src/engine/test/reasons-to.test.ts","src/engine/test/record-query-contract.test.ts","src/engine/test/relocation-scratch.test.ts","src/engine/test/scenarios.test.ts","src/engine/test/sets.test.ts","src/engine/test/stable-set-algebra.test.ts","src/engine/test/state-cache.test.ts","src/engine/test/state-source.test.ts","src/engine/test/storage-helper.ts","src/engine/test/stored-list-array.test.ts","src/engine/test/stored-list-integrity.test.ts","src/engine/test/stored-text.test.ts","src/engine/test/streamed-diff.test.ts","src/engine/test/text.test.ts","src/engine/test/view.test.ts","src/engine/test/visible-neighbours.test.ts","src/engine/text.ts","src/engine/types.ts","src/engine/view.ts","src/gitview/errors.ts","src/gitview/index.ts","src/gitview/ingest.ts","src/gitview/plain.ts","src/gitview/test/helpers.ts","src/gitview/test/ingest.test.ts","src/gitview/test/random.test.ts","src/gitview/test/view.test.ts","src/gitview/trailers.ts","src/gitview/tree.ts","src/gitview/view.ts","src/pipeline/pipeline.ts","src/pipeline/plan.ts","src/pipeline/test/pipeline.test.ts","src/pipeline/test/plan.test.ts","tsconfig.json","worker/project/add-draft.ts","worker/project/amend.ts","worker/project/announce.ts","worker/project/apply-entry.ts","worker/project/autosettle.ts","worker/project/blame.ts","worker/project/change-records.ts","worker/project/changes-since.ts","worker/project/check-clash.ts","worker/project/collisions.ts","worker/project/definition-code.ts","worker/project/definition-rule.ts","worker/project/definitions.ts","worker/project/draft-collisions.ts","worker/project/draft-diff.ts","worker/project/draft-state.ts","worker/project/drop.ts","worker/project/edit.ts","worker/project/express-moves.ts","worker/project/feed.ts","worker/project/globs.ts","worker/project/history.ts","worker/project/http.ts","worker/project/ingest.ts","worker/project/init.ts","worker/project/kept-parts.ts","worker/project/label.ts","worker/project/land.ts","worker/project/lifecycle-permit-contract.ts","worker/project/markers.ts","worker/project/memory-store.ts","worker/project/merge-identical.ts","worker/project/move-line-text.ts","worker/project/move.ts","worker/project/names.ts","worker/project/news.ts","worker/project/notes.ts","worker/project/operation-protocol.ts","worker/project/overlaps.ts","worker/project/path-rules.ts","worker/project/pathindex.ts","worker/project/pathkey.ts","worker/project/pluck.ts","worker/project/project-api.ts","worker/project/project-error.ts","worker/project/project-helpers.ts","worker/project/project-status.ts","worker/project/project-types.ts","worker/project/project.ts","worker/project/projection-provider.ts","worker/project/publish-of.ts","worker/project/publish.ts","worker/project/queue-driver.ts","worker/project/queue.ts","worker/project/record-file.ts","worker/project/record.ts","worker/project/refuse.ts","worker/project/restore.ts","worker/project/spaces.ts","worker/project/spelling.ts","worker/project/start.ts","worker/project/switch-to.ts","worker/project/sync.ts","worker/project/test/after-read.test.ts","worker/project/test/agent-views-shared.test.ts","worker/project/test/announce-person.test.ts","worker/project/test/appends.test.ts","worker/project/test/attributes.test.ts","worker/project/test/author-totals.test.ts","worker/project/test/authors-stored.test.ts","worker/project/test/autosettle.test.ts","worker/project/test/bench.ts","worker/project/test/blobs-stored.test.ts","worker/project/test/blobs.test.ts","worker/project/test/changed-definition.test.ts","worker/project/test/changes.test.ts","worker/project/test/collision-streaming.test.ts","worker/project/test/collisions-kept-views.test.ts","worker/project/test/compare-summary.test.ts","worker/project/test/definition-code.test.ts","worker/project/test/definitions.test.ts","worker/project/test/draft-files-kept.test.ts","worker/project/test/draft-reads-stored.test.ts","worker/project/test/drop.test.ts","worker/project/test/express-moves-early.test.ts","worker/project/test/file-exact-at.test.ts","worker/project/test/files-reads.test.ts","worker/project/test/history.test.ts","worker/project/test/ingest.test.ts","worker/project/test/issues.test.ts","worker/project/test/kept-parts.test.ts","worker/project/test/known-paths.test.ts","worker/project/test/labels.test.ts","worker/project/test/land-streaming.test.ts","worker/project/test/lifecycle-permit-contract.test.ts","worker/project/test/markers.test.ts","worker/project/test/membership-cache.test.ts","worker/project/test/membership-pages.test.ts","worker/project/test/merge.test.ts","worker/project/test/move-line-text.test.ts","worker/project/test/move-reconstruction.test.ts","worker/project/test/moves.test.ts","worker/project/test/named-drafts.test.ts","worker/project/test/news-cap.test.ts","worker/project/test/news-lazy.test.ts","worker/project/test/news-lines.test.ts","worker/project/test/news-times.test.ts","worker/project/test/news-written.test.ts","worker/project/test/notes.test.ts","worker/project/test/operation-protocol.test.ts","worker/project/test/order.test.ts","worker/project/test/owed-definition-news.test.ts","worker/project/test/packed-crossings.test.ts","worker/project/test/paths.test.ts","worker/project/test/pluck.test.ts","worker/project/test/project-file.test.ts","worker/project/test/project-writer-storage.test.ts","worker/project/test/project.test.ts","worker/project/test/projection-integration.test.ts","worker/project/test/queue-driver.test.ts","worker/project/test/queue.test.ts","worker/project/test/queued-moves.test.ts","worker/project/test/record-idempotence.test.ts","worker/project/test/record-stream.test.ts","worker/project/test/review-fixes.test.ts","worker/project/test/reviewers.test.ts","worker/project/test/same-line.test.ts","worker/project/test/seat-notice.test.ts","worker/project/test/shared-additions.test.ts","worker/project/test/spelling-clash.test.ts","worker/project/test/spelling.test.ts","worker/project/test/starting.test.ts","worker/project/test/stored-closure.test.ts","worker/project/test/stored-membership.test.ts","worker/project/test/tells.test.ts","worker/project/test/told-buckets.test.ts","worker/project/test/touched-beyond.test.ts","worker/project/test/trail.test.ts","worker/project/test/unseen.test.ts","worker/project/test/version-files.test.ts","worker/project/test/view-cache.test.ts","worker/project/test/where-many-agents.test.ts","worker/project/test/whole.test.ts","worker/project/test/without.test.ts","worker/project/test/writer-adoption.test.ts","worker/project/trail.ts","worker/project/tree.ts","worker/project/unseen.ts","worker/project/version-files.ts","worker/project/version-log.ts","worker/project/version-meta.ts","worker/project/view-changes.ts","worker/project/views.ts","worker/project/where.ts","worker/project/whole-files.ts","worker/project/without.ts","worker/project/writer-agents.ts"],"working":{"version":318,"agents":[{"agent":"codex-capacity-chair","files":[{"path":"server/src/engine-project.ts","lines":[[834,834],[836,836]],"shared":[[846,847]],"changes":1,"lastEdit":1791980206618}],"lastEdit":1791980206618,"note":null}]},"agentChanges":[{"agent":"codex-capacity-chair","path":"server/src/engine-project.ts","base":184,"draft":null,"lastEdit":1791980206618,"note":null,"changed":true,"added":2,"removed":1,"blocks":[{"kind":"change","line":834,"through":834,"removed":["\t\tfor (const path of view.paths()) {"],"added":["\t\tfor (const path of view.knownPaths()) {"],"now":[834,834]},{"kind":"insert","line":835,"through":835,"removed":[],"added":["\t\t\tif (!attrs.exists && attrs.link === null && attrs.blob === null && !view.hasFile(path)) continue;"],"now":[836,836]}]}],"overlaps":{"version":318,"agents":["codex-capacity-chair","codex-capacity-policy","review"],"collisions":[]}}