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

+64 −6 in 8 places
Lines 13–20 at 318 (were 13–18 at 178)
1313import { EngineProject, SqliteLog } from "./engine-project.ts";
1414import { artifactsOf, type Env } from "./env.ts";
1515import { GitDiskIntake } from "./git-disk-intake.ts";
16+import { GitFileContents } from "./git-file-contents.ts";
17+import { GitIntakeLimitError } from "./git-intake-limit.ts";
1618import { GitIntakeTrees } from "./git-intake-trees.ts";
1719import { pushedSince, remoteHead } from "./ingest.ts";
1820import {
Lines 49–55 at 318 (were 47–52 at 178)
4749 "file",
4850 "files",
4951 "compare",
52+ "without",
5053 "where",
5154 "feed",
5255 "drafts",
Lines 68–74 at 318 (were 65–70 at 178)
6568const GIT_PACK_MAX_BYTES = 128 * 1024 * 1024;
6669const GIT_OBJECT_MAX_BYTES = 64 * 1024 * 1024;
6770const GIT_DECODED_MAX_BYTES = 256 * 1024 * 1024;
71+const GIT_LIMIT_POLICY = `expanded-v2:${GIT_PACK_MAX_BYTES}:${GIT_OBJECT_MAX_BYTES}:${GIT_DECODED_MAX_BYTES}`;
6872
6973/**
7074 * The load guard (platform issue 46): an estimate of a loaded project's memory from its log entries, lines and claim
Lines 131–137 at 318 (were 127–132 at 178)
127131 this.blobs = new BlobStore(ctx.storage);
128132 if (env.ABSO_DISK_FIRST === "on") {
129133 GitDiskIntake.recover(ctx.storage);
134+ GitFileContents.recover(ctx.storage);
130135 GitIntakeTrees.recover(ctx.storage);
131136 }
132137 }
Lines 546–567 at 318 (were 541–546 at 178)
541546 const seen = await this.ctx.storage.get<string>("git:head");
542547 const pushed = await this.ctx.storage.get<PushResult>("pushed");
543548 const head = await remoteHead(artifacts, name);
549+ const refusal = this.diskRuntime()
550+ ? await this.ctx.storage.get<{ head: string; policy: string; kind: GitIntakeLimitError["kind"]; error: string }>(
551+ "git:size-refusal",
552+ )
553+ : undefined;
554+ if (refusal) {
555+ if (
556+ head &&
557+ head !== seen &&
558+ head !== pushed?.commit &&
559+ refusal.head === head &&
560+ refusal.policy === GIT_LIMIT_POLICY
561+ )
562+ throw new GitIntakeLimitError(refusal.kind, refusal.error);
563+ await this.ctx.storage.delete("git:size-refusal");
564+ }
544565 if (!head || head === seen || head === pushed?.commit) return null;
545566 const sharedBlobs = this.useProject((p) => p.shared().blobs ?? {});
546567 using trees = this.diskRuntime() ? new GitIntakeTrees(this.ctx.storage) : undefined;
Lines 578–600 at 318 (were 557–566 at 178)
557578 maxPackBytes: GIT_PACK_MAX_BYTES,
558579 maxObjectBytes: GIT_OBJECT_MAX_BYTES,
559580 maxDecodedBytes: GIT_DECODED_MAX_BYTES,
581+ maxBinaryBytes: BLOB_MAX,
560582 retainFileChunks: (files, path, chunks, oid) => trees.retainChunks(files, path, chunks, oid),
561583 }
562584 : undefined,
563− );
585+ ).catch(async (error: unknown) => {
586+ if (trees && error instanceof GitIntakeLimitError) {
587+ const refusal = {
588+ head,
589+ policy: GIT_LIMIT_POLICY,
590+ kind: error.kind,
591+ error: error.message,
592+ at: new Date().toISOString(),
593+ };
594+ await this.ctx.storage.put({ "git:size-refusal": refusal, "git:error": refusal });
595+ }
596+ throw error;
597+ });
564598 if (!found || found.commits.length === 0) {
565599 if (found) await this.ctx.storage.put("git:head", found.head);
566600 return null;
Lines 653–677 at 318 (were 619–632 at 178)
619653 if (!artifacts) return;
620654 const name = await this.ctx.storage.get<string>("name");
621655 if (!name || !this.useProject((p) => p.exists())) return;
656+ let intakeFailed = false;
622657 await this.gitSync().then(
623− () => this.ctx.storage.delete("git:error"),
624− (e) =>
625− this.ctx.storage.put("git:error", {
658+ async () => {
659+ await this.ctx.storage.delete("git:error");
660+ await this.ctx.storage.delete("git:retry-attempts");
661+ },
662+ async (e) => {
663+ intakeFailed = true;
664+ const attempts = ((await this.ctx.storage.get<number>("git:retry-attempts")) ?? 0) + 1;
665+ await this.ctx.storage.put("git:retry-attempts", attempts);
666+ await this.ctx.storage.put("git:error", {
626667 at: new Date().toISOString(),
627668 error: e instanceof Error ? e.message : String(e),
628− }),
669+ });
670+ await this.soon(Date.now() + (attempts === 1 ? 1 : attempts === 2 ? 5 : 15) * 60_000);
671+ },
629672 );
673+ // Never export over a remote head whose changes could not be taken in.
674+ if (intakeFailed) return;
630675 const shared = pushSnapshot(
631676 this.useProject((p) => p.sharedPushMetadata()),
632677 (version, path) => this.useProject((current) => current.fileTextAt(version, path)),
Lines 686–705 at 318 (were 641–647 at 178)
641686 }
642687 let result: PushResult;
643688 try {
644− result = await pushShared(artifacts, name, shared, (sha) => this.blobs.read(sha));
689+ result = await pushShared(
690+ artifacts,
691+ name,
692+ shared,
693+ (sha) => this.blobs.read(sha),
694+ this.env.ABSO_DISK_FIRST === "on"
695+ ? {
696+ storage: this.ctx.storage,
697+ maxPackBytes: GIT_PACK_MAX_BYTES,
698+ maxObjectBytes: GIT_OBJECT_MAX_BYTES,
699+ maxDecodedBytes: GIT_DECODED_MAX_BYTES,
700+ }
701+ : undefined,
702+ );
645703 } catch (e) {
646704 // Kept for /out, and tried again with a backoff of our own (a thrown alarm is retried only six times).
647705 const was = await this.ctx.storage.get<{ attempts?: number }>("pushError");
MCP
compare on this site's /mcp
CLI
abso diff 178 318 server/src/project-object.ts --json
JSON
/christopher/abso-core/compare/178..318?file=server%2Fsrc%2Fproject-object.ts&format=json