{"draft":null,"from":176,"to":177,"files":[{"path":"server/src/engine-project.ts","added":33,"removed":0,"diff":"--- a/server/src/engine-project.ts\n+++ b/server/src/engine-project.ts\n@@ -9,6 +9,7 @@\n import { type Entry, type ProjectStore as LogStore, MemoryStore, Project } from \"../../worker/project/project.ts\";\n import type { EditBody, ProjectCalls, ProjectHistory } from \"../../worker/project/project-api.ts\";\n import { where } from \"../../worker/project/where.ts\";\n+import type { PushSnapshotMetadata } from \"./push-snapshot.ts\";\n \n /** The parts of a Durable Object's storage the log and blob store use, declared structurally so tests can stand in. */\n export interface SqliteStorage {\n@@ -807,6 +808,38 @@\n \tfilesAt(version: number) {\n \t\treturn this.project.viewAt(version).files();\n \t}\n+\tfileTextAt(version: number, path: string): string {\n+\t\treturn this.project.viewAt(version).text(path);\n+\t}\n+\t/** One scoped batch: at most 64 files and 64 Ki characters plus one whole file. */\n+\tfileTextsAt(version: number, paths: readonly string[]): Record<string, string> {\n+\t\tconst view = this.project.viewAt(version);\n+\t\tconst files: Record<string, string> = Object.create(null);\n+\t\tlet characters = 0;\n+\t\tfor (const path of paths.slice(0, 64)) {\n+\t\t\tconst text = view.attrs(path).link !== null ? \"\" : view.text(path);\n+\t\t\tfiles[path] = text;\n+\t\t\tcharacters += text.length;\n+\t\t\tif (characters >= 65536) break;\n+\t\t}\n+\t\treturn files;\n+\t}\n+\t/** Capture metadata now; each text read reopens the captured version in a fresh host scope. */\n+\tsharedPushMetadata(): PushSnapshotMetadata {\n+\t\tconst version = this.project.version;\n+\t\tconst view = this.project.viewAt(version);\n+\t\tconst paths: string[] = [];\n+\t\tconst modes: PushSnapshotMetadata[\"modes\"] = Object.create(null);\n+\t\tconst blobs: Record<string, string> = Object.create(null);\n+\t\tfor (const path of view.paths()) {\n+\t\t\tconst attrs = view.attrs(path);\n+\t\t\tmodes[path] = { exec: attrs.exec, link: attrs.link };\n+\t\t\tif (attrs.blob !== null) blobs[path] = attrs.blob;\n+\t\t\telse paths.push(path);\n+\t\t}\n+\t\tconst by = version > 0 ? this.project.published(version) : undefined;\n+\t\treturn { version, paths, modes, blobs, ...(by ? { last: { agent: by.agent, message: by.message } } : {}) };\n+\t}\n \tblobsAt(version: number) {\n \t\treturn this.project.viewAt(version).blobs();\n \t}"}],"unmatched":[]}