{"file":"server/src/ingest.ts","version":318,"total":275,"from":1,"to":275,"lines":[{"n":1,"text":"// In from plain git (#8, demo moment 5): commits a person pushed to the","atom":"a1448","author":"speed","version":150},{"n":2,"text":"// project's Artifacts repo, read back for project.ingest. Every commit the","atom":"a1448","author":"speed","version":150},{"n":3,"text":"// Worker pushes ends \"abso-version: N\" (\"avcs-version: N\" before the rename); the commits above the newest such","atom":"a1448","author":"speed","version":150},{"n":4,"text":"// commit that haven't been taken in yet are the person's, and N is their base.","atom":"a1448","author":"speed","version":150},{"n":5,"text":"import git, { type HttpClient } from \"isomorphic-git\";","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":6,"text":"import type { FileModes } from \"../../worker/project/project-api.ts\";","atom":"a1448","author":"speed","version":150},{"n":7,"text":"import type { SqliteStorage } from \"./engine-project.ts\";","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":8,"text":"import { gitBlobText, InvalidGitUtf8 } from \"./git-blob-text.ts\";","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":9,"text":"import { GitDiskIntake } from \"./git-disk-intake.ts\";","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":10,"text":"import { gitHttp } from \"./git-http.ts\";","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":11,"text":"import { MemoryFS } from \"./memory-fs.ts\";","atom":"a1448","author":"speed","version":150},{"n":12,"text":"import { repoName } from \"./push.ts\";","atom":"a1448","author":"speed","version":150},{"n":13,"text":"","atom":"a1448","author":"speed","version":150},{"n":14,"text":"const http = gitHttp();","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":15,"text":"","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":16,"text":"const EXEC = 0o100755;","atom":"a1448","author":"speed","version":150},{"n":17,"text":"const LINK = 0o120000;","atom":"a1448","author":"speed","version":150},{"n":18,"text":"","atom":"a1448","author":"speed","version":150},{"n":19,"text":"/** How far back to look for the Worker's last commit. */","atom":"a1448","author":"speed","version":150},{"n":20,"text":"const DEPTH = 50;","atom":"a1448","author":"speed","version":150},{"n":21,"text":"const text = new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: false });","atom":"a1448","author":"speed","version":150},{"n":22,"text":"","atom":"a1448","author":"speed","version":150},{"n":23,"text":"export interface PushedCommits {","atom":"a1448","author":"speed","version":150},{"n":24,"text":"\t/** main's head when read. */","atom":"a1448","author":"speed","version":150},{"n":25,"text":"\thead: string;","atom":"a1448","author":"speed","version":150},{"n":26,"text":"\tauthor: string;","atom":"a1448","author":"speed","version":150},{"n":27,"text":"\tbase: number;","atom":"a1448","author":"speed","version":150},{"n":28,"text":"\t/** Oldest first, each with its whole tree as text and every file's mode. Binary files are left out. */","atom":"a1448","author":"speed","version":150},{"n":29,"text":"\tcommits: {","atom":"a1448","author":"speed","version":150},{"n":30,"text":"\t\tsha: string;","atom":"a1448","author":"speed","version":150},{"n":31,"text":"\t\tmessage: string;","atom":"a1448","author":"speed","version":150},{"n":32,"text":"\t\tfiles: Record<string, string>;","atom":"a1448","author":"speed","version":150},{"n":33,"text":"\t\tmodes: FileModes;","atom":"a1448","author":"speed","version":150},{"n":34,"text":"\t\tblobs: Record<string, string>;","atom":"a1448","author":"speed","version":150},{"n":35,"text":"\t}[];","atom":"a1448","author":"speed","version":150},{"n":36,"text":"\t/** Binary files over the blob limit, left out of the commits. */","atom":"a1448","author":"speed","version":150},{"n":37,"text":"\ttooBig: string[];","atom":"a1448","author":"speed","version":150},{"n":38,"text":"}","atom":"a1448","author":"speed","version":150},{"n":39,"text":"","atom":"a1448","author":"speed","version":150},{"n":40,"text":"export function absoVersion(message: string): number | undefined {","atom":"a1448","author":"speed","version":150},{"n":41,"text":"\tconst m = /^(?:abso|avcs)-version: (\\d+)\\s*$/m.exec(message);","atom":"a1448","author":"speed","version":150},{"n":42,"text":"\treturn m ? Number(m[1]) : undefined;","atom":"a1448","author":"speed","version":150},{"n":43,"text":"}","atom":"a1448","author":"speed","version":150},{"n":44,"text":"","atom":"a1448","author":"speed","version":150},{"n":45,"text":"async function readAccess(","atom":"a1448","author":"speed","version":150},{"n":46,"text":"\tartifacts: Artifacts,","atom":"a1448","author":"speed","version":150},{"n":47,"text":"\tproject: string,","atom":"a1448","author":"speed","version":150},{"n":48,"text":"): Promise<{","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":49,"text":"\turl: string;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":50,"text":"\tonAuth: () => { username: string; password: string };","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":51,"text":"} | null> {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":52,"text":"\tlet repo: Awaited<ReturnType<Artifacts[\"get\"]>>;","atom":"a1448","author":"speed","version":150},{"n":53,"text":"\ttry {","atom":"a1448","author":"speed","version":150},{"n":54,"text":"\t\trepo = await artifacts.get(repoName(project));","atom":"a1448","author":"speed","version":150},{"n":55,"text":"\t} catch {","atom":"a1448","author":"speed","version":150},{"n":56,"text":"\t\treturn null;","atom":"a1448","author":"speed","version":150},{"n":57,"text":"\t}","atom":"a1448","author":"speed","version":150},{"n":58,"text":"\tusing r = repo;","atom":"a1448","author":"speed","version":150},{"n":59,"text":"\tconst [info, token] = await Promise.all([r.info(), r.createToken(\"read\", 600)]);","atom":"a1448","author":"speed","version":150},{"n":60,"text":"\tconst password = token.plaintext.split(\"?expires=\")[0]!;","atom":"a1448","author":"speed","version":150},{"n":61,"text":"\treturn { url: info!.remote, onAuth: () => ({ username: \"x\", password }) };","atom":"a1448","author":"speed","version":150},{"n":62,"text":"}","atom":"a1448","author":"speed","version":150},{"n":63,"text":"","atom":"a1448","author":"speed","version":150},{"n":64,"text":"/** main's head on the project's repo, or null when there's no repo or no main yet. Cheap: one ref listing. */","atom":"a1448","author":"speed","version":150},{"n":65,"text":"export async function remoteHead(artifacts: Artifacts, project: string): Promise<string | null> {","atom":"a1448","author":"speed","version":150},{"n":66,"text":"\tconst access = await readAccess(artifacts, project);","atom":"a1448","author":"speed","version":150},{"n":67,"text":"\tif (!access) return null;","atom":"a1448","author":"speed","version":150},{"n":68,"text":"\tconst refs = await git.listServerRefs({","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":69,"text":"\t\thttp,","atom":"a1448","author":"speed","version":150},{"n":70,"text":"\t\turl: access.url,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":71,"text":"\t\tonAuth: access.onAuth,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":72,"text":"\t\tprefix: \"refs/heads/main\",","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":73,"text":"\t});","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":74,"text":"\treturn refs.find((r) => r.ref === \"refs/heads/main\")?.oid ?? null;","atom":"a1448","author":"speed","version":150},{"n":75,"text":"}","atom":"a1448","author":"speed","version":150},{"n":76,"text":"","atom":"a1448","author":"speed","version":150},{"n":77,"text":"/**","atom":"a1448","author":"speed","version":150},{"n":78,"text":" * The commits pushed since `seen` (the last head this project handled), or","atom":"a1448","author":"speed","version":150},{"n":79,"text":" * none when every commit above the Worker's last one has been seen.","atom":"a1448","author":"speed","version":150},{"n":80,"text":" */","atom":"a1448","author":"speed","version":150},{"n":81,"text":"/** Stores a binary file's bytes and answers their SHA-256, or null when they're over the limit. */","atom":"a1448","author":"speed","version":150},{"n":82,"text":"export type StoreBlob = (bytes: Uint8Array) => Promise<string | null>;","atom":"a1448","author":"speed","version":150},{"n":83,"text":"export type RetainFileChunks = (","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":84,"text":"\tfiles: Record<string, string>,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":85,"text":"\tpath: string,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":86,"text":"\tchunks: Iterable<string>,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":87,"text":"\toid: string,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":88,"text":") => void;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":89,"text":"","atom":"a1448","author":"speed","version":150},{"n":90,"text":"/**","atom":"a1448","author":"speed","version":150},{"n":91,"text":" * `oldBlob` gives shared's blob for a path: a binary file over the limit","atom":"a1448","author":"speed","version":150},{"n":92,"text":" * keeps it, since a path missing from a commit would mean the file was deleted.","atom":"a1448","author":"speed","version":150},{"n":93,"text":" */","atom":"a1448","author":"speed","version":150},{"n":94,"text":"export async function pushedSince(","atom":"a1448","author":"speed","version":150},{"n":95,"text":"\tartifacts: Artifacts,","atom":"a1448","author":"speed","version":150},{"n":96,"text":"\tproject: string,","atom":"a1448","author":"speed","version":150},{"n":97,"text":"\tseen: string | undefined,","atom":"a1448","author":"speed","version":150},{"n":98,"text":"\tstoreBlob?: StoreBlob,","atom":"a1448","author":"speed","version":150},{"n":99,"text":"\toldBlob: (path: string) => string | undefined = () => undefined,","atom":"a1448","author":"speed","version":150},{"n":100,"text":"\tretainFile: (files: Record<string, string>, path: string, body: string, oid?: string) => void = (","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":101,"text":"\t\tfiles,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":102,"text":"\t\tpath,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":103,"text":"\t\tbody,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":104,"text":"\t) => {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":105,"text":"\t\tfiles[path] = body;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":106,"text":"\t},","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":107,"text":"\tdisk?: {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":108,"text":"\t\tstorage: SqliteStorage;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":109,"text":"\t\tmaxPackBytes: number;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":110,"text":"\t\tmaxObjectBytes: number;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":111,"text":"\t\tmaxDecodedBytes?: number;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":112,"text":"\t\tmaxBinaryBytes?: number;","atom":"a2037","author":"codex-capacity-chair","version":183},{"n":113,"text":"\t\thttp?: HttpClient;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":114,"text":"\t\tretainFileChunks?: RetainFileChunks;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":115,"text":"\t},","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":116,"text":"): Promise<PushedCommits | null> {","atom":"a1448","author":"speed","version":150},{"n":117,"text":"\tconst access = await readAccess(artifacts, project);","atom":"a1448","author":"speed","version":150},{"n":118,"text":"\tif (!access) return null;","atom":"a1448","author":"speed","version":150},{"n":119,"text":"\tconst fs = new MemoryFS();","atom":"a1448","author":"speed","version":150},{"n":120,"text":"\tconst dir = \"/repo\";","atom":"a1448","author":"speed","version":150},{"n":121,"text":"\tusing intake = disk","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":122,"text":"\t\t? new GitDiskIntake(disk.storage, disk.maxPackBytes, disk.maxObjectBytes, disk.maxDecodedBytes)","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":123,"text":"\t\t: undefined;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":124,"text":"\tconst cache = disk ? {} : undefined;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":125,"text":"\tif (intake && cache) intake.attach(cache);","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":126,"text":"\tawait git.clone({","atom":"a1448","author":"speed","version":150},{"n":127,"text":"\t\tfs,","atom":"a1448","author":"speed","version":150},{"n":128,"text":"\t\tcache,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":129,"text":"\t\thttp: disk?.http ?? http,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":130,"text":"\t\tdir,","atom":"a1448","author":"speed","version":150},{"n":131,"text":"\t\turl: access.url,","atom":"a1448","author":"speed","version":150},{"n":132,"text":"\t\tonAuth: access.onAuth,","atom":"a1448","author":"speed","version":150},{"n":133,"text":"\t\tref: \"main\",","atom":"a1448","author":"speed","version":150},{"n":134,"text":"\t\tsingleBranch: true,","atom":"a1448","author":"speed","version":150},{"n":135,"text":"\t\tdepth: DEPTH,","atom":"a1448","author":"speed","version":150},{"n":136,"text":"\t\tnoCheckout: true,","atom":"a1448","author":"speed","version":150},{"n":137,"text":"\t});","atom":"a1448","author":"speed","version":150},{"n":138,"text":"\tintake?.assertReady();","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":139,"text":"\tconst log = await git.log({ fs, dir, cache, ref: \"main\", depth: DEPTH });","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":140,"text":"\tif (log.length === 0) return null;","atom":"a1448","author":"speed","version":150},{"n":141,"text":"\tconst head = log[0]!.oid;","atom":"a1448","author":"speed","version":150},{"n":142,"text":"\tconst fresh: typeof log = [];","atom":"a1448","author":"speed","version":150},{"n":143,"text":"\tlet base: number | undefined;","atom":"a1448","author":"speed","version":150},{"n":144,"text":"\tlet past = false;","atom":"a1448","author":"speed","version":150},{"n":145,"text":"\tfor (const c of log) {","atom":"a1448","author":"speed","version":150},{"n":146,"text":"\t\tif (c.oid === seen) past = true;","atom":"a1448","author":"speed","version":150},{"n":147,"text":"\t\tbase = absoVersion(c.commit.message);","atom":"a1448","author":"speed","version":150},{"n":148,"text":"\t\tif (base !== undefined) break;","atom":"a1448","author":"speed","version":150},{"n":149,"text":"\t\tif (!past) fresh.unshift(c);","atom":"a1448","author":"speed","version":150},{"n":150,"text":"\t}","atom":"a1448","author":"speed","version":150},{"n":151,"text":"\tif (base === undefined) throw new Error(`no abso-version commit in main's last ${DEPTH} commits`);","atom":"a1448","author":"speed","version":150},{"n":152,"text":"\tconst commits = [];","atom":"a1448","author":"speed","version":150},{"n":153,"text":"\tconst tooBig = new Set<string>();","atom":"a1448","author":"speed","version":150},{"n":154,"text":"\tfor (const c of fresh)","atom":"a1448","author":"speed","version":150},{"n":155,"text":"\t\tcommits.push({","atom":"a1448","author":"speed","version":150},{"n":156,"text":"\t\t\tsha: c.oid,","atom":"a1448","author":"speed","version":150},{"n":157,"text":"\t\t\tmessage: c.commit.message.trim(),","atom":"a1448","author":"speed","version":150},{"n":158,"text":"\t\t\t...(await treeText(","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":159,"text":"\t\t\t\tfs,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":160,"text":"\t\t\t\tdir,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":161,"text":"\t\t\t\tc.oid,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":162,"text":"\t\t\t\tstoreBlob,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":163,"text":"\t\t\t\ttooBig,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":164,"text":"\t\t\t\toldBlob,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":165,"text":"\t\t\t\tretainFile,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":166,"text":"\t\t\t\tcache,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":167,"text":"\t\t\t\tintake,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":168,"text":"\t\t\t\tdisk?.retainFileChunks,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":169,"text":"\t\t\t\tdisk?.maxBinaryBytes,","atom":"a2037","author":"codex-capacity-chair","version":183},{"n":170,"text":"\t\t\t)),","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":171,"text":"\t\t});","atom":"a1448","author":"speed","version":150},{"n":172,"text":"\treturn {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":173,"text":"\t\thead,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":174,"text":"\t\tauthor: fresh.at(-1)?.commit.author.name ?? \"git\",","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":175,"text":"\t\tbase,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":176,"text":"\t\tcommits,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":177,"text":"\t\ttooBig: [...tooBig],","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":178,"text":"\t};","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":179,"text":"}","atom":"a1448","author":"speed","version":150},{"n":180,"text":"","atom":"a1448","author":"speed","version":150},{"n":181,"text":"/**","atom":"a1448","author":"speed","version":150},{"n":182,"text":" * A commit's whole tree as text, and every file's mode: 100755 is exec, and","atom":"a1448","author":"speed","version":150},{"n":183,"text":" * a link (120000) is \"\" with its target in modes. Files that aren't UTF-8","atom":"a1448","author":"speed","version":150},{"n":184,"text":" * are left out.","atom":"a1448","author":"speed","version":150},{"n":185,"text":" */","atom":"a1448","author":"speed","version":150},{"n":186,"text":"export async function treeText(","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":187,"text":"\tfs: MemoryFS,","atom":"a1448","author":"speed","version":150},{"n":188,"text":"\tdir: string,","atom":"a1448","author":"speed","version":150},{"n":189,"text":"\toid: string,","atom":"a1448","author":"speed","version":150},{"n":190,"text":"\tstoreBlob: StoreBlob | undefined,","atom":"a1448","author":"speed","version":150},{"n":191,"text":"\ttooBig: Set<string>,","atom":"a1448","author":"speed","version":150},{"n":192,"text":"\toldBlob: (path: string) => string | undefined,","atom":"a1448","author":"speed","version":150},{"n":193,"text":"\tretainFile: (files: Record<string, string>, path: string, body: string, oid?: string) => void,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":194,"text":"\tcache: object = {},","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":195,"text":"\tintake?: GitDiskIntake,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":196,"text":"\tretainFileChunks?: RetainFileChunks,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":197,"text":"\tmaxBinaryBytes?: number,","atom":"a2037","author":"codex-capacity-chair","version":183},{"n":198,"text":"): Promise<{","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":199,"text":"\tfiles: Record<string, string>;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":200,"text":"\tmodes: FileModes;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":201,"text":"\tblobs: Record<string, string>;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":202,"text":"}> {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":203,"text":"\tconst files: Record<string, string> = {};","atom":"a1448","author":"speed","version":150},{"n":204,"text":"\tconst modes: FileModes = {};","atom":"a1448","author":"speed","version":150},{"n":205,"text":"\tconst blobs: Record<string, string> = {};","atom":"a1448","author":"speed","version":150},{"n":206,"text":"\tawait git.walk({","atom":"a1448","author":"speed","version":150},{"n":207,"text":"\t\tfs,","atom":"a1448","author":"speed","version":150},{"n":208,"text":"\t\tcache,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":209,"text":"\t\tdir,","atom":"a1448","author":"speed","version":150},{"n":210,"text":"\t\ttrees: [git.TREE({ ref: oid })],","atom":"a1448","author":"speed","version":150},{"n":211,"text":"\t\titerate: async (walk, children) => {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":212,"text":"\t\t\tfor (const child of children) await walk(child);","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":213,"text":"\t\t\treturn [];","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":214,"text":"\t\t},","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":215,"text":"\t\treduce: async () => undefined,","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":216,"text":"\t\tmap: async (path, [entry]) => {","atom":"a1448","author":"speed","version":150},{"n":217,"text":"\t\t\tif (!entry || path === \".\") return true;","atom":"a1448","author":"speed","version":150},{"n":218,"text":"\t\t\tif ((await entry.type()) !== \"blob\") return true;","atom":"a1448","author":"speed","version":150},{"n":219,"text":"\t\t\tconst mode = await entry.mode();","atom":"a1448","author":"speed","version":150},{"n":220,"text":"\t\t\tconst blobOid = await entry.oid();","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":221,"text":"\t\t\tif (intake && retainFileChunks && mode !== LINK) {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":222,"text":"\t\t\t\tconst stored = intake.bytes(blobOid);","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":223,"text":"\t\t\t\tif (stored?.type !== \"blob\") throw Error(\"Git intake blob is missing\");","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":224,"text":"\t\t\t\tlet valid = true;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":225,"text":"\t\t\t\ttry {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":226,"text":"\t\t\t\t\t// Validate before retaining: a late invalid byte must take the binary path.","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":227,"text":"\t\t\t\t\tfor (const _ of gitBlobText(stored)) {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":228,"text":"\t\t\t\t\t\t/* Retain no decoded text. */","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":229,"text":"\t\t\t\t\t}","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":230,"text":"\t\t\t\t} catch (error) {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":231,"text":"\t\t\t\t\tif (!(error instanceof InvalidGitUtf8)) throw error;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":232,"text":"\t\t\t\t\tvalid = false;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":233,"text":"\t\t\t\t}","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":234,"text":"\t\t\t\tif (valid) {","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":235,"text":"\t\t\t\t\tretainFileChunks(files, path, gitBlobText(stored), blobOid);","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":236,"text":"\t\t\t\t\tmodes[path] = { exec: mode === EXEC, link: null };","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":237,"text":"\t\t\t\t\treturn true;","atom":"a2037","author":"codex-capacity-chair","version":183},{"n":238,"text":"\t\t\t\t}","atom":"a2037","author":"codex-capacity-chair","version":183},{"n":239,"text":"\t\t\t\tif (storeBlob && maxBinaryBytes !== undefined && stored.byteLength > maxBinaryBytes) {","atom":"a2037","author":"codex-capacity-chair","version":183},{"n":240,"text":"\t\t\t\t\ttooBig.add(path);","atom":"a2037","author":"codex-capacity-chair","version":183},{"n":241,"text":"\t\t\t\t\tconst kept = oldBlob(path);","atom":"a2037","author":"codex-capacity-chair","version":183},{"n":242,"text":"\t\t\t\t\tif (kept) blobs[path] = kept;","atom":"a2037","author":"codex-capacity-chair","version":183},{"n":243,"text":"\t\t\t\t\treturn true;","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":244,"text":"\t\t\t\t}","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":245,"text":"\t\t\t}","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":246,"text":"\t\t\tconst bytes = await entry.content();","atom":"a1448","author":"speed","version":150},{"n":247,"text":"\t\t\tif (!bytes) return true;","atom":"a1448","author":"speed","version":150},{"n":248,"text":"\t\t\tlet body: string;","atom":"a1448","author":"speed","version":150},{"n":249,"text":"\t\t\ttry {","atom":"a1448","author":"speed","version":150},{"n":250,"text":"\t\t\t\tbody = text.decode(bytes);","atom":"a1448","author":"speed","version":150},{"n":251,"text":"\t\t\t} catch {","atom":"a1448","author":"speed","version":150},{"n":252,"text":"\t\t\t\t// Binary (#27): the bytes go to the blob store, and the file is a pointer to them.","atom":"a1448","author":"speed","version":150},{"n":253,"text":"\t\t\t\tconst sha = storeBlob ? await storeBlob(bytes) : null;","atom":"a1448","author":"speed","version":150},{"n":254,"text":"\t\t\t\tif (sha) {","atom":"a1448","author":"speed","version":150},{"n":255,"text":"\t\t\t\t\tblobs[path] = sha;","atom":"a1448","author":"speed","version":150},{"n":256,"text":"\t\t\t\t\tmodes[path] = { exec: mode === EXEC, link: null };","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":257,"text":"\t\t\t\t} else if (storeBlob) {","atom":"a1448","author":"speed","version":150},{"n":258,"text":"\t\t\t\t\ttooBig.add(path);","atom":"a1448","author":"speed","version":150},{"n":259,"text":"\t\t\t\t\tconst kept = oldBlob(path);","atom":"a1448","author":"speed","version":150},{"n":260,"text":"\t\t\t\t\tif (kept) blobs[path] = kept;","atom":"a1448","author":"speed","version":150},{"n":261,"text":"\t\t\t\t}","atom":"a1448","author":"speed","version":150},{"n":262,"text":"\t\t\t\treturn true;","atom":"a1448","author":"speed","version":150},{"n":263,"text":"\t\t\t}","atom":"a1448","author":"speed","version":150},{"n":264,"text":"\t\t\tif (mode === LINK) {","atom":"a1448","author":"speed","version":150},{"n":265,"text":"\t\t\t\tretainFile(files, path, \"\");","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":266,"text":"\t\t\t\tmodes[path] = { exec: false, link: body };","atom":"a1448","author":"speed","version":150},{"n":267,"text":"\t\t\t} else {","atom":"a1448","author":"speed","version":150},{"n":268,"text":"\t\t\t\tretainFile(files, path, body, blobOid);","atom":"a1960","author":"codex-capacity-chair","version":178},{"n":269,"text":"\t\t\t\tmodes[path] = { exec: mode === EXEC, link: null };","atom":"a1448","author":"speed","version":150},{"n":270,"text":"\t\t\t}","atom":"a1448","author":"speed","version":150},{"n":271,"text":"\t\t\treturn true;","atom":"a1448","author":"speed","version":150},{"n":272,"text":"\t\t},","atom":"a1448","author":"speed","version":150},{"n":273,"text":"\t});","atom":"a1448","author":"speed","version":150},{"n":274,"text":"\treturn { files, modes, blobs };","atom":"a1448","author":"speed","version":150},{"n":275,"text":"}","atom":"a1448","author":"speed","version":150}],"atoms":[{"atom":"a1448","author":"speed","message":"","time":1791906675543,"timeIso":"2026-10-13T15:51:15.543Z","publish":{"draft":null,"version":150,"agent":"speed","message":"Open server: the project Worker, Durable Object and Artifacts (issue 17)","time":1791907522179,"timeIso":"2026-10-13T16:05:22.179Z"}},{"atom":"a1960","author":"codex-capacity-chair","message":"","time":1791973284309,"timeIso":"2026-10-14T10:21:24.309Z","publish":{"draft":null,"version":178,"agent":"codex-capacity-chair","message":"Use disk-backed Git intake behind disk-first switch; cleared in review ask 56","time":1791973284309,"timeIso":"2026-10-14T10:21:24.309Z"}},{"atom":"a2037","author":"codex-capacity-chair","message":"","time":1791976971511,"timeIso":"2026-10-14T11:22:51.511Z","publish":{"draft":null,"version":183,"agent":"codex-capacity-chair","message":"Skip whole reads of binaries over the blob limit on disk intake","time":1791977400174,"timeIso":"2026-10-14T11:30:00.174Z"}}]}