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

Compare

+18 −6 in 5 places
Lines 1–7 at 318 (were 1–6 at 178)
11import { createHash } from "node:crypto";
22import type { SqliteStorage } from "./engine-project.ts";
33import type { GitByteRanges } from "./git-delta-stream.ts";
4+import { GitIntakeLimitError } from "./git-intake-limit.ts";
45
56export type StoredGitBytes = GitByteRanges & {
67 id: string;
Lines 31–51 at 318 (were 30–43 at 178)
3031 private active(): void {
3132 if (this.closed) throw Error("Git object store is closed");
3233 }
33− put(type: string, produce: (write: (bytes: Uint8Array) => void) => void, maxBytes: number): StoredGitBytes {
34+ put(
35+ type: string,
36+ produce: (write: (bytes: Uint8Array) => void) => void,
37+ maxBytes: number,
38+ rawDelta = false,
39+ ): StoredGitBytes {
3440 this.active();
3541 if (!["blob", "tree", "commit", "tag"].includes(type) || !Number.isSafeInteger(maxBytes) || maxBytes < 0)
3642 throw Error("invalid Git object limits or type");
3743 const id = crypto.randomUUID();
3844 this.storage.transactionSync(() => {
45+ const budgetScope = rawDelta ? `${this.scope}:raw` : this.scope;
46+ if (rawDelta) this.storage.sql.exec("INSERT OR IGNORE INTO git_object_budget VALUES (?, 0)", budgetScope);
3947 const budget = this.storage.sql
40− .exec("SELECT decoded FROM git_object_budget WHERE scope = ?", this.scope)
48+ .exec("SELECT decoded FROM git_object_budget WHERE scope = ?", budgetScope)
4149 .toArray() as { decoded: number }[];
4250 if (budget.length !== 1) throw Error("missing Git decoded budget");
4351 const remaining = this.maxDecodedBytes - budget[0]!.decoded;
Lines 64–75 at 318 (were 56–63 at 178)
5664 used = 0;
5765 };
5866 produce((bytes) => {
59− if (length + bytes.length > maxBytes) throw Error("Git object exceeds byte limit");
60− if (length + bytes.length > remaining) throw Error("Git pack exceeds total decoded byte limit");
67+ if (length + bytes.length > maxBytes) throw new GitIntakeLimitError("object", "Git object exceeds byte limit");
68+ if (length + bytes.length > remaining)
69+ throw new GitIntakeLimitError(
70+ rawDelta ? "delta" : "decoded",
71+ rawDelta ? "Git pack exceeds total delta byte limit" : "Git pack exceeds total decoded byte limit",
72+ );
6173 length += bytes.length;
6274 for (let at = 0; at < bytes.length; ) {
6375 const count = Math.min(pending.length - used, bytes.length - at);
Lines 90–96 at 318 (were 78–84 at 178)
7890 length,
7991 hash.digest("hex"),
8092 );
81− this.storage.sql.exec("UPDATE git_object_budget SET decoded = decoded + ? WHERE scope = ?", length, this.scope);
93+ this.storage.sql.exec("UPDATE git_object_budget SET decoded = decoded + ? WHERE scope = ?", length, budgetScope);
8294 });
8395 return this.get(id);
8496 }
Lines 152–158 at 318 (were 140–146 at 178)
140152 this.storage.transactionSync(() => {
141153 this.storage.sql.exec("DELETE FROM git_object_bytes WHERE scope = ?", this.scope);
142154 this.storage.sql.exec("DELETE FROM git_object_meta WHERE scope = ?", this.scope);
143− this.storage.sql.exec("DELETE FROM git_object_budget WHERE scope = ?", this.scope);
155+ this.storage.sql.exec("DELETE FROM git_object_budget WHERE scope IN (?, ?)", this.scope, `${this.scope}:raw`);
144156 });
145157 }
146158}
MCP
compare on this site's /mcp
CLI
abso diff 178 318 server/src/git-object-bytes.ts --json
JSON
/christopher/abso-core/compare/178..318?file=server%2Fsrc%2Fgit-object-bytes.ts&format=json