Skip to content

abso-core

Public

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

Check passed

Versions 2 to 318

Compare

+44 −0 in 1 place
new file, 44 lines
1+import assert from "node:assert/strict";
2+import { it } from "node:test";
3+import { Repo } from "../../../src/engine/test/helpers.ts";
4+import type { AgentState } from "../project-types.ts";
5+import { type RecordFileHost, recordFile } from "../record-file.ts";
6+
7+it("records replacements without materializing old file text or line arrays", () => {
8+ const view = Repo.init({ "large.txt": `${"x".repeat(100000)}\nkeep\n` }).view();
9+ view.text = () => {
10+ throw Error("whole old text is forbidden");
11+ };
12+ view.lines = () => {
13+ throw Error("old line array is forbidden");
14+ };
15+ const calls: Parameters<RecordFileHost["addDraft"]>[2][] = [];
16+ const host: RecordFileHost = {
17+ addDraft(_agent, _view, input) {
18+ calls.push(input);
19+ },
20+ };
21+ const agent: AgentState = {
22+ name: "writer",
23+ space: "",
24+ base: 0,
25+ synced: true,
26+ mine: [],
27+ news: [],
28+ newsAt: [],
29+ told: new Set(),
30+ parked: new Map(),
31+ marked: [],
32+ };
33+ assert.equal(recordFile(host, agent, view, "large.txt", "changed\nkeep\n", 1, {}, []), true);
34+ assert.deepEqual(calls[0]!.edits, [{ file: "large.txt", start: 0, end: 1, lines: ["changed"] }]);
35+ const unchanged = `${"x".repeat(100000)}\nkeep\n`;
36+ assert.equal(recordFile(host, agent, view, "large.txt", unchanged, 1, {}, []), false);
37+ assert.equal(
38+ recordFile(host, agent, view, "large.txt", unchanged, 1, {}, [], {}, undefined, [
39+ { start: 0, end: 1, lines: ["ignored"] },
40+ ]),
41+ false,
42+ );
43+ assert.equal(calls.length, 1);
44+});
MCP
compare on this site's /mcp
CLI
abso diff 2 318 worker/project/test/record-stream.test.ts --json
JSON
/christopher/abso-core/compare/2..318?file=worker%2Fproject%2Ftest%2Frecord-stream.test.ts&format=json