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

Compare

+91 −0 in 1 place
new file, 91 lines
1+import { createHash } from "node:crypto";
2+import { readFileSync, writeFileSync } from "node:fs";
3+import { join } from "node:path";
4+
5+// Extends only the reviewed-version push prototype in this isolated dependency tree.
6+const root = "capacity-git-dependency-sandbox/node_modules/isomorphic-git";
7+const inputs = {
8+ "index.js": "0bd051b1a38bf8d593bf37b5acf9ee453ddab33d48950c84e2c2c3f3ec449fc8",
9+ "index.cjs": "6c9f6eab37a10c9311f2b7aa8d24b0772d4ba2703d848525a0519e1454d016e7",
10+};
11+const hash = (source) => createHash("sha256").update(source).digest("hex");
12+const expectedOutputs = {
13+ "index.js": "eebe6911fa660d4b95857768ea2308be74435dd5f9a796bb7b2491a31bdd109d",
14+ "index.cjs": "33364e3ed7f3a1a6cf17a1ecabbfc5d6de6a8494f31a524d8ac293402ad4e447",
15+};
16+function once(source, before, after) {
17+ if (source.split(before).length !== 2) throw Error("Fetch patch anchor mismatch");
18+ return source.replace(before, after);
19+}
20+if (JSON.parse(readFileSync(join(root, "package.json"), "utf8")).version !== "1.44.2") {
21+ throw Error("Unsupported Git version");
22+}
23+const outputs = [];
24+const installed = Object.fromEntries(Object.keys(inputs).map((file) => [file, readFileSync(join(root, file), "utf8")]));
25+if (Object.entries(expectedOutputs).every(([file, expected]) => hash(installed[file]) === expected)) {
26+ console.log(
27+ JSON.stringify({
28+ verified: true,
29+ scope: "Isolated fetch prototype",
30+ bundles: expectedOutputs,
31+ }),
32+ );
33+ process.exit(0);
34+}
35+for (const [file, expected] of Object.entries(inputs)) {
36+ const source = installed[file];
37+ if (hash(source) !== expected) throw Error(`Unrecognized input: ${file}`);
38+ let result = once(
39+ source,
40+ " const packfile = Buffer.from(await collect(response.packfile));",
41+ ` const diskPack = cache && cache[Symbol.for('abso.git.disk-pack')];
42+ if (diskPack) {
43+ await diskPack.ingest(response.packfile, () => new pako.Inflate({ chunkSize: 16384 }));
44+ if (raw.body.error) throw raw.body.error
45+ const result = {
46+ defaultBranch: response.HEAD,
47+ fetchHead: response.FETCH_HEAD.oid,
48+ fetchHeadDescription: response.FETCH_HEAD.description,
49+ };
50+ if (response.headers) result.headers = response.headers;
51+ if (prune) result.pruned = response.pruned;
52+ return result
53+ }
54+ const packfile = Buffer.from(await collect(response.packfile));`,
55+ );
56+ const readStart = result.indexOf("async function _readObject({");
57+ const readEnd = result.indexOf("\nclass AlreadyExistsError", readStart);
58+ if (readStart < 0 || readEnd < 0) throw Error("Missing object reader boundary");
59+ const readFunction = once(
60+ result.slice(readStart, readEnd),
61+ " // Curry the current read method so that the packfile un-deltification",
62+ ` const diskPack = cache && cache[Symbol.for('abso.git.disk-pack')];
63+ if (diskPack && format === 'content') {
64+ const stored = await diskPack.read(oid);
65+ if (stored) return stored
66+ }
68+ // Curry the current read method so that the packfile un-deltification`,
69+ );
70+ result = result.slice(0, readStart) + readFunction + result.slice(readEnd);
71+ if (hash(result) !== expectedOutputs[file]) throw Error(`Unexpected fetch patch output: ${file}`);
72+ outputs.push({ file, result, sha256: hash(result) });
73+}
74+// Validate both installed bundles and every anchor before either write.
75+if (!process.argv.includes("--check")) {
76+ for (const { file, result } of outputs) writeFileSync(join(root, file), result);
77+ writeFileSync(
78+ "capacity-git-fetch-patch-manifest.json",
79+ JSON.stringify(
80+ outputs.map(({ file, sha256 }) => ({ file, sha256 })),
81+ null,
82+ 2,
83+ ),
84+ );
85+}
86+console.log(
87+ JSON.stringify({
88+ scope: "Isolated fetch prototype; runtime adapter and transport acceptance still required",
89+ outputs: outputs.map(({ file, sha256 }) => ({ file, sha256 })),
90+ }),
91+);
MCP
compare on this site's /mcp
CLI
abso diff 164 318 server/scripts/capacity-patch-git-fetch.mjs --json
JSON
/christopher/abso-core/compare/164..318?file=server%2Fscripts%2Fcapacity-patch-git-fetch.mjs&format=json