@vite-hub/workspace 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/blob-database.js +2 -2
  2. package/dist/checkout.d.ts +0 -6
  3. package/dist/checkout.js +1 -30
  4. package/dist/{config-Bze7OyvB.js → config-B-S_Z4G0.js} +5 -14
  5. package/dist/durability.js +2 -2
  6. package/dist/{error-diagnostics-CHgE8TQM.js → error-diagnostics-Dn4sQcKL.js} +3 -4
  7. package/dist/{file-DIBPXqbk.js → file-B3KxJyxb.js} +1 -1
  8. package/dist/{files-DAJyo7TU.js → files-DSOjTK36.js} +1 -1
  9. package/dist/files.d.ts +0 -6
  10. package/dist/files.js +4 -4
  11. package/dist/{github-DcrnEGNN.js → github-DDUrrKt8.js} +3 -3
  12. package/dist/{glob-YVshR7WP.js → glob-BfZVRPCk.js} +1 -1
  13. package/dist/{host-BT7EnmZf.js → host-CcCDXyJI.js} +3 -3
  14. package/dist/hosted-vercel-blob.js +3 -3
  15. package/dist/hosted.js +4 -19
  16. package/dist/index.js +12 -12
  17. package/dist/internal/path.js +1 -1
  18. package/dist/internal/workspace.js +2 -2
  19. package/dist/{lifecycle-B0ucHUum.js → lifecycle-CXiS7Dks.js} +4 -4
  20. package/dist/loader.js +1 -1
  21. package/dist/{mcp-resources-BDL0llKW.js → mcp-resources-B2J0YCD2.js} +1 -1
  22. package/dist/{metadata-target-mlHAv1p4.js → metadata-target-oc00D8g2.js} +2 -8
  23. package/dist/{operations-D3mZArDi.js → operations-DWPC8nrk.js} +3 -11
  24. package/dist/operations.js +1 -9
  25. package/dist/{provider-DZY1cLP5.js → provider-DBJeUNFI.js} +2 -11
  26. package/dist/providers/github/store.js +3 -35
  27. package/dist/{registry-OonxXCbd.js → registry-CqDWpDe9.js} +2 -2
  28. package/dist/{request-scope-jH4H0Sbm.js → request-scope-DZJbe-tP.js} +0 -2
  29. package/dist/{rule-keys-xMpiTLq1.js → rule-keys-DQYcSewo.js} +1 -1
  30. package/dist/{rules-DYQCKYdt.js → rules-sItt6TP-.js} +2 -10
  31. package/dist/runtime/request.js +1 -1
  32. package/dist/runtime/state.js +6 -6
  33. package/dist/runtime/workspace.js +1 -1
  34. package/dist/runtime.js +12 -12
  35. package/dist/server.js +4 -4
  36. package/dist/{shared-DCAyMX8U.js → shared-CaAKcBBr.js} +1 -14
  37. package/dist/source-metadata.js +3 -3
  38. package/dist/{sync-DkpTCr9u.js → sync-ztyvA0Va.js} +3 -3
  39. package/dist/test.js +1 -1
  40. package/dist/{use-hLouCwGz.js → use-BskfWVjx.js} +6 -6
  41. package/dist/{use-tools-NXEQt099.js → use-tools-D_eorKu1.js} +3 -3
  42. package/dist/{utils-Bv1NBg8r.js → utils-BoFJcaT1.js} +2 -3
  43. package/dist/vite.js +6 -62
  44. package/dist/{workspace-Cz-5Ne1c.js → workspace-Dbo5iYIc.js} +10 -10
  45. package/dist/{workspace-inspection-scanner-BlJ8bCAB.js → workspace-inspection-scanner-6QrvwVJG.js} +0 -5
  46. package/package.json +12 -12
@@ -1,11 +1,11 @@
1
1
  import { n as forkMemoryWorkspaceStore, r as vitehubOwnedPrefix, t as createMemoryWorkspaceStore } from "./memory-BCZl_ZsJ.js";
2
2
  import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
3
3
  import { n as copyJsonFileMetadata, r as copyJsonWorkspaceMetadata } from "./file-metadata-Dqpldj0h.js";
4
- import { d as normalizeHistoryPath, f as normalizeHistoryRef, g as validateHistoryMessage, m as rejectHistoryHead, n as createSnapshotFromEntries, p as readHistoryDeleteRef, r as diffSnapshots, u as historyConflict } from "./utils-Bv1NBg8r.js";
4
+ import { d as normalizeHistoryPath, f as normalizeHistoryRef, g as validateHistoryMessage, m as rejectHistoryHead, n as createSnapshotFromEntries, p as readHistoryDeleteRef, r as diffSnapshots, u as historyConflict } from "./utils-BoFJcaT1.js";
5
5
  import { a as isExcludedWorkspacePath, f as sha256, i as decodeFile, o as isWorkspaceBytes, r as contentToBytes } from "./path-DYHw5KNk.js";
6
6
  import { a as provideWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
7
7
  import { t as blobDatabaseSources } from "./blob-database-sources-CQPAyCz3.js";
8
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
8
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
9
9
  import { t as workspaceHistorySchema$1 } from "./history-schema-postgres-DZepCSBq.js";
10
10
  import { and, desc, eq, exists, getColumns, gte, inArray, is, isNotNull, isNull, lt, ne, notExists, sql } from "drizzle-orm";
11
11
  import { PgAsyncDatabase } from "drizzle-orm/pg-core/async/db";
@@ -43,14 +43,11 @@ interface WorkspaceLocalChanges {
43
43
  added: string[];
44
44
  modified: string[];
45
45
  deleted: string[];
46
- /** Text files with conflict markers, and paths in `conflicts` of the lock. */
47
46
  conflicted: string[];
48
47
  }
49
- /** What happened to one path in a pull. */
50
48
  interface WorkspacePullFile {
51
49
  path: string;
52
50
  action: "added" | "updated" | "deleted" | "merged" | "conflict" | "kept";
53
- /** Why a path was kept or conflicts, for the person who resolves it. */
54
51
  note?: string;
55
52
  }
56
53
  export interface WorkspacePullResult {
@@ -95,7 +92,6 @@ interface WorkspacePullOptions {
95
92
  dir?: string;
96
93
  ref?: string;
97
94
  remote?: string;
98
- /** Paths that take the remote version, also when you changed them. */
99
95
  theirs?: string[];
100
96
  }
101
97
  /** Merges the remote changes into each checkout folder and updates the lock file. */
@@ -103,14 +99,12 @@ export declare function pullWorkspaces(context: WorkspaceCheckoutContext, option
103
99
  interface WorkspacePushOptions {
104
100
  workspace?: string;
105
101
  message?: string;
106
- /** Write files that someone else holds an edit lease on, such as a Content document open in the Console. */
107
102
  overrideLease?: boolean;
108
103
  }
109
104
  /** Pulls, then commits the local changes of each checkout folder to its ref. Refuses while a conflict is open. */
110
105
  export declare function pushWorkspaces(context: WorkspaceCheckoutContext, options?: WorkspacePushOptions): Promise<WorkspacePushResult[]>;
111
106
  interface WorkspaceStatusOptions {
112
107
  workspace?: string;
113
- /** Also ask the remote which files changed since the last pull. */
114
108
  remote?: boolean;
115
109
  }
116
110
  /** The local changes of each checkout folder, and with `remote`, the remote changes since the last pull. */
package/dist/checkout.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
1
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
2
2
  import { staleDerivedFiles } from "./lineage.js";
3
3
  import { t as workspaceCommitRequestBytes } from "./results-z-HpV9EP.js";
4
4
  import { isRuntimeDiagnostic } from "@vite-hub/runtime";
@@ -10,7 +10,6 @@ import { lstat, mkdir, open, readFile, readdir, rename, rm, writeFile } from "no
10
10
  // src/checkout.ts
11
11
  /** The lock file at the project root. Commit it: it records the remote revision that each checkout folder matches. */
12
12
  const workspaceLockFile = "vitehub.lock";
13
- /** A failed remote operation, with the code, message, and fix of the app's diagnostic. */
14
13
  function remoteFailure(result) {
15
14
  if (!result.code) return workspaceErrorDiagnostics.WORKSPACE_CHECKOUT_FAILED({ message: result.message });
16
15
  return new Diagnostic({
@@ -37,7 +36,6 @@ const ignored = /* @__PURE__ */ new Set([
37
36
  /** Line patterns shared by working-tree scans and Git index searches. */
38
37
  const conflictMarkerPatterns = ["^<{7}( |\r?$)", "^>{7}( |\r?$)"];
39
38
  const conflictMarkers = conflictMarkerPatterns.map((pattern) => new RegExp(pattern, "m"));
40
- /** The suffix of the temporary file of an atomic write. A command that stopped before the rename leaves one behind. */
41
39
  const temporarySuffix = ".vitehub-tmp";
42
40
  function portableKey(name) {
43
41
  return name.normalize("NFC").toUpperCase().toLowerCase().normalize("NFC");
@@ -50,19 +48,13 @@ function ignoredName(name) {
50
48
  function ignoredPath(path) {
51
49
  return path.split("/").some(ignoredName);
52
50
  }
53
- /** A folder path to compare. Windows and macOS file systems ignore case, so `content` and `CONTENT` are one folder. */
54
51
  function folderKey(folder) {
55
52
  return process.platform === "win32" || process.platform === "darwin" ? portableKey(folder) : folder;
56
53
  }
57
- /** Lock keys are Workspace names and file paths, including names such as `__proto__`. */
58
54
  function ownRecord(record) {
59
55
  Object.setPrototypeOf(record, null);
60
56
  return record;
61
57
  }
62
- /**
63
- * Use one portable spelling for every file and directory component, on every platform. Check the whole tree before
64
- * writing: checking only changed files misses aliases of unchanged files, local files, and shared parent folders.
65
- */
66
58
  function validateCheckoutPaths(paths, directories = []) {
67
59
  const nodes = /* @__PURE__ */ new Map();
68
60
  const add = (path, directory) => {
@@ -124,7 +116,6 @@ function encode(bytes) {
124
116
  encoding: "utf8"
125
117
  };
126
118
  }
127
- /** True when a text file still has Git conflict markers. */
128
119
  function hasConflictMarkers(content) {
129
120
  return conflictMarkers.every((pattern) => pattern.test(content));
130
121
  }
@@ -132,10 +123,6 @@ function lines(value) {
132
123
  return value.match(/[^\n]*\n|[^\n]+$/g) ?? [];
133
124
  }
134
125
  const maximumMatchCells = 4e6;
135
- /**
136
- * For each line of `base`, the index of the same line in `side` on a longest common subsequence, or -1. The common
137
- * first and last lines match directly, so the table covers only the changed middle.
138
- */
139
126
  function matches(base, side) {
140
127
  const result = Array.from({ length: base.length }, () => -1);
141
128
  let start = 0;
@@ -241,10 +228,6 @@ function mergeText(base, local, remote, labels = {
241
228
  text: out.join("")
242
229
  };
243
230
  }
244
- /**
245
- * Writes a file as a new file in the same folder, then renames it over `target`. A hard link to the old file keeps
246
- * its content, a link at `target` is replaced and not followed, and a failed write leaves the old file.
247
- */
248
231
  async function writeAtomic(target, bytes) {
249
232
  const mode = await lstat(target).then((stat) => stat.isFile() ? stat.mode & 511 : 438, () => 438);
250
233
  const temporary = join(dirname(target), `.${basename(target)}.${randomBytes(6).toString("hex")}${temporarySuffix}`);
@@ -339,11 +322,6 @@ async function withLockMutex(rootDir, work) {
339
322
  if (await readFile(path, "utf8").catch(() => void 0) === token) await rm(path, { force: true });
340
323
  }
341
324
  }
342
- /**
343
- * Writes the entries of `names` from `lock` into the lock file as it is now, and keeps the other entries. Another
344
- * command can have changed them since this command read the lock, such as a concurrent pull of another Workspace.
345
- * A name without an entry in `lock` is removed.
346
- */
347
325
  async function saveWorkspaceLock(rootDir, lock, names) {
348
326
  await withLockMutex(rootDir, async () => {
349
327
  const current = await readWorkspaceLock(rootDir);
@@ -377,7 +355,6 @@ function validateCheckoutFolders(rootDir, lock) {
377
355
  folders.set(workspace, folder);
378
356
  }
379
357
  }
380
- /** Every file of the checkout folder by Workspace path, with its bytes. Fails on a link in it or its ancestors. */
381
358
  async function scan(rootDir, folder, directories = []) {
382
359
  await assertNoSymlinks(rootDir, folder);
383
360
  const files = /* @__PURE__ */ new Map();
@@ -418,7 +395,6 @@ async function assertNoSymlinks(rootDir, target) {
418
395
  if (stat.isSymbolicLink()) throw workspaceErrorDiagnostics.WORKSPACE_CHECKOUT_SYMLINK({ path: relative(rootDir, current) });
419
396
  }
420
397
  }
421
- /** The local file of a relative Workspace path, checked for existing symbolic links. */
422
398
  async function localPath(rootDir, folder, path) {
423
399
  validateCheckoutPaths([path]);
424
400
  const segments = path.split("/");
@@ -461,7 +437,6 @@ async function callOrThrow(context, remote, operation, input) {
461
437
  if (!result.ok) throw remoteFailure(result);
462
438
  return result.value;
463
439
  }
464
- /** Creates the lock entry of a Workspace on its first pull, or checks the options of a later pull against it. */
465
440
  function checkoutEntry(rootDir, lock, workspace, options) {
466
441
  const existing = lock.workspaces[workspace];
467
442
  if (existing) {
@@ -746,10 +721,6 @@ function formatBytes(bytes) {
746
721
  if (bytes >= 1024) return `${Number((bytes / 1024).toFixed(1))} KiB`;
747
722
  return `${bytes} bytes`;
748
723
  }
749
- /**
750
- * A push is one revision, so it cannot be split into more calls. Fails before the call when the request body, as
751
- * `callOperation()` sends it, is over the request limit of `workspace.commit`, and names the largest files.
752
- */
753
724
  function assertCommitSize(workspace, input, putFiles) {
754
725
  const bytes = Buffer.byteLength(JSON.stringify({
755
726
  m: "workspace.commit",
@@ -2,7 +2,7 @@ import { normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path
2
2
  import { i as decodeFile, o as isWorkspaceBytes } from "./path-DYHw5KNk.js";
3
3
  import { t as abortable } from "./abort-CQGxJBqa.js";
4
4
  import { t as internalErrorDiagnostics } from "./error-diagnostics-CsiNo_oI.js";
5
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
5
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
6
6
  import { n as isRecord } from "./object-DNOrQSl5.js";
7
7
  import { posix } from "node:path";
8
8
  import { createHash } from "node:crypto";
@@ -50,7 +50,6 @@ function normalizeForeignBlob(value) {
50
50
  }
51
51
  }
52
52
  const httpInterruptedMessage = "[vitehub] HTTP request was interrupted.";
53
- /** `INTERNAL_R0012` with the HTTP status of the failed response. */
54
53
  function httpStatusError(status) {
55
54
  return Object.assign(internalErrorDiagnostics.INTERNAL_R0012({ message: `[vitehub] HTTP request failed with status ${status}.` }), { status });
56
55
  }
@@ -81,10 +80,6 @@ async function fetchWithRetry(definition, responseType, schema, send, retryFetch
81
80
  }));
82
81
  }
83
82
  }
84
- /**
85
- * Sends one request and reads its body inside the request timeout.
86
- * A timeout or a caller abort stops the attempt at once, aborts the fetch, and cancels the body.
87
- */
88
83
  async function fetchOnce(definition, responseType, send, retryFetchError, signal) {
89
84
  const controller = new AbortController();
90
85
  const timeout = new AbortController();
@@ -953,10 +948,10 @@ function inferredSourceFingerprintOptions(family, input) {
953
948
  async function loadInferredWorkspaceSource(family, input) {
954
949
  if (family === "fetch" && isRecord(input)) return createInferredFetchSource(input);
955
950
  if (family === "fetch") return createInferredFetchSource(input);
956
- if (family === "file") return (await import("./file-DIBPXqbk.js").then((n) => n.n)).file(input);
957
- if (family === "github") return (await import("./github-DcrnEGNN.js").then((n) => n.n)).github(input);
958
- if (family === "glob") return (await import("./glob-YVshR7WP.js").then((n) => n.n)).glob(input);
959
- return (await import("./mcp-resources-BDL0llKW.js").then((n) => n.n)).mcpResources(input);
951
+ if (family === "file") return (await import("./file-B3KxJyxb.js").then((n) => n.n)).file(input);
952
+ if (family === "github") return (await import("./github-DDUrrKt8.js").then((n) => n.n)).github(input);
953
+ if (family === "glob") return (await import("./glob-BfZVRPCk.js").then((n) => n.n)).glob(input);
954
+ return (await import("./mcp-resources-B2J0YCD2.js").then((n) => n.n)).mcpResources(input);
960
955
  }
961
956
  function inferredSourceDefaults(family, input) {
962
957
  if (!isRecord(input)) return family === "file" ? { key: inferredFileSourceKey(input) } : {};
@@ -1014,10 +1009,6 @@ function inferFetchWorkspacePath(input) {
1014
1009
  if (!basename$1(path).includes(".")) path = `${path}.${responseType === "json" ? "json" : "txt"}`;
1015
1010
  return path;
1016
1011
  }
1017
- /**
1018
- * A file Source holds one item. Every file helper and the inferred `"README.md"` or `{ path }` forms set its key, so the
1019
- * default mount is the same for all of them: the Workspace root, which puts the item at its own path.
1020
- */
1021
1012
  function fileSourceKey(source) {
1022
1013
  const key = ownSourceOption(source, "key");
1023
1014
  return source.name === "file" && typeof key === "string" ? normalizeSafeWorkspacePath(key) : void 0;
@@ -1,6 +1,6 @@
1
- import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-OonxXCbd.js";
1
+ import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-CqDWpDe9.js";
2
2
  import { n as readBlobDatabaseSources } from "./blob-database-sources-CQPAyCz3.js";
3
- import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-DZY1cLP5.js";
3
+ import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-DBJeUNFI.js";
4
4
  // src/durability.ts
5
5
  const sharedDrivers = {
6
6
  "cloudflare": "Cloudflare Artifacts.",
@@ -1,7 +1,6 @@
1
1
  import { defineDiagnostics } from "nostics";
2
2
  // src/error-diagnostics.ts
3
3
  const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
4
- /** A code whose call site passes the message as `why`, with the fix that the reader applies. */
5
4
  const withFix = (fix) => ({
6
5
  ...dynamicError,
7
6
  fix
@@ -102,15 +101,15 @@ const workspaceErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
102
101
  },
103
102
  WORKSPACE_RENAMED_STORE_PROVIDER_KEY: {
104
103
  why: ({ provider }) => `The Workspace \`store\` sets \`provider: ${provider}\`. ViteHub renamed this key to \`driver\`, and it does not read \`provider\`, so the Store would not be the one you chose.`,
105
- fix: ({ driver }) => `Set \`store: { driver: ${driver} }\`, or run \`npx @vite-hub/codemods driver-key\` to rename it in every config file.`
104
+ fix: ({ driver }) => `Set \`store: { driver: ${driver} }\`.`
106
105
  },
107
106
  WORKSPACE_RENAMED_STORE_REPOSITORY_KEY: {
108
107
  why: () => "The GitHub Workspace `store` sets `repository`. ViteHub renamed this key to `repo`, and it does not read `repository`, so the Store would use `VITEHUB_WORKSPACE_GITHUB_REPOSITORY` or no repository.",
109
- fix: () => "Rename `repository` to `repo` in `store: { driver: \"github\" }`, or run `vitehub migrate` to rename it in every file."
108
+ fix: () => "Rename `repository` to `repo` in `store: { driver: \"github\" }`."
110
109
  },
111
110
  WORKSPACE_UNKNOWN_STORE_DRIVER: {
112
111
  why: ({ driver, renamed }) => renamed ? `The Workspace \`store.driver\` is ${driver}. ViteHub renamed this driver to "${renamed}", and it does not read ${driver}.` : `The Workspace \`store.driver\` ${driver} is not a Workspace Store driver.`,
113
- fix: ({ renamed }) => renamed ? `Set \`store: { driver: "${renamed}" }\`, or run \`npx @vite-hub/codemods driver-key\` to rename it in every config file.` : "Set `store.driver` to \"local\", \"memory\", \"github\", \"cloudflare\", or \"vercel\", or pass a Store object."
112
+ fix: ({ renamed }) => renamed ? `Set \`store: { driver: "${renamed}" }\`.` : "Set `store.driver` to \"local\", \"memory\", \"github\", \"cloudflare\", or \"vercel\", or pass a Store object."
114
113
  },
115
114
  WORKSPACE_DEFAULT_REF_DELETE: {
116
115
  why: "`history.deleteRef()` cannot delete `main` or the ref that the Workspace working tree follows.",
@@ -1,5 +1,5 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
2
- import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-Bze7OyvB.js";
2
+ import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-B-S_Z4G0.js";
3
3
  import { file } from "@vite-hub/source";
4
4
  // src/sources/file.ts
5
5
  var file_exports = /* @__PURE__ */ __exportAll({ file: () => file$1 });
@@ -1,5 +1,5 @@
1
1
  import { l as normalizeWorkspacePath, o as isWorkspaceBytes, s as matchesAny } from "./path-DYHw5KNk.js";
2
- import { f as prepareWorkspaceSource, n as createSourceContext } from "./config-Bze7OyvB.js";
2
+ import { f as prepareWorkspaceSource, n as createSourceContext } from "./config-B-S_Z4G0.js";
3
3
  // src/loaders/files.ts
4
4
  function shouldLoad(path, options) {
5
5
  if (options.include && !matchesAny(path, options.include)) return false;
package/dist/files.d.ts CHANGED
@@ -9,12 +9,6 @@ interface WorkspaceStoreTarget {
9
9
  hasFileDescendants?(path: string): Promise<boolean>;
10
10
  }
11
11
  export declare function resolveWorkspaceStoreTarget(source: unknown): Promise<WorkspaceStoreTarget | undefined>;
12
- /**
13
- * The GitHub answers that the GitHub Store keeps. An answer for a URL that names a commit or tree sha never
14
- * changes, so it goes to the shared KV store when the app has one: another server instance reads it there and sends no
15
- * request. Other answers stay in memory with their ETag. The next read of the same URL asks GitHub with
16
- * `If-None-Match`, and a `304 Not Modified` does not count against the GitHub rate limit.
17
- */
18
12
  /** The part of a ViteHub KV store that the GitHub Store uses, such as `kv` from `@vite-hub/kv`. */
19
13
  interface WorkspaceKV {
20
14
  get<T>(key: string): Promise<readonly [unknown, T | null | undefined]>;
package/dist/files.js CHANGED
@@ -1,7 +1,7 @@
1
- import { r as useWorkspaceFiles } from "./use-hLouCwGz.js";
1
+ import { r as useWorkspaceFiles } from "./use-BskfWVjx.js";
2
2
  import { n as isWorkspaceConflict, normalizeSafeWorkspacePath } from "./internal/path.js";
3
- import { t as isWorkspaceName } from "./registry-OonxXCbd.js";
4
- import { r as registerWorkspacePlugin } from "./rules-DYQCKYdt.js";
3
+ import { t as isWorkspaceName } from "./registry-CqDWpDe9.js";
4
+ import { r as registerWorkspacePlugin } from "./rules-sItt6TP-.js";
5
5
  import { o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
6
- import { E as registerWorkspaceKV, w as readGitHubReadStats } from "./shared-DCAyMX8U.js";
6
+ import { E as registerWorkspaceKV, w as readGitHubReadStats } from "./shared-CaAKcBBr.js";
7
7
  export { isWorkspaceConflict, isWorkspaceName, normalizeSafeWorkspacePath, readGitHubReadStats, registerWorkspaceKV, registerWorkspacePlugin, resolveWorkspaceStoreTarget, useWorkspaceFiles };
@@ -1,8 +1,8 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
2
- import { M as readForgeEnv, h as readGitHubEnvToken, j as forgeEnv } from "./shared-DCAyMX8U.js";
2
+ import { M as readForgeEnv, h as readGitHubEnvToken, j as forgeEnv } from "./shared-CaAKcBBr.js";
3
3
  import { s as matchesAny } from "./path-DYHw5KNk.js";
4
- import { d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, p as resolveGitHubIgnore } from "./config-Bze7OyvB.js";
5
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
4
+ import { d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, p as resolveGitHubIgnore } from "./config-B-S_Z4G0.js";
5
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
6
6
  import { github } from "@vite-hub/source";
7
7
  // src/env.ts
8
8
  let viteLoadEnv;
@@ -1,5 +1,5 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
2
- import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-Bze7OyvB.js";
2
+ import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-B-S_Z4G0.js";
3
3
  import * as source from "@vite-hub/source";
4
4
  // src/sources/glob.ts
5
5
  var glob_exports = /* @__PURE__ */ __exportAll({ glob: () => glob });
@@ -1,10 +1,10 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
2
2
  import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
3
3
  import { a as isExcludedWorkspacePath, f as sha256, i as decodeFile, l as normalizeWorkspacePath, r as contentToBytes, s as matchesAny } from "./path-DYHw5KNk.js";
4
- import { n as createSnapshotFromEntries, r as diffSnapshots } from "./utils-Bv1NBg8r.js";
5
- import { C as assertPathInSessionScope, D as scopedSearchQuery, E as isMissingWorkspacePathError, S as assertDiffInsideSessionPaths, T as filterSessionEntries, w as filterSessionDiff } from "./workspace-Cz-5Ne1c.js";
4
+ import { n as createSnapshotFromEntries, r as diffSnapshots } from "./utils-BoFJcaT1.js";
5
+ import { C as assertPathInSessionScope, D as scopedSearchQuery, E as isMissingWorkspacePathError, S as assertDiffInsideSessionPaths, T as filterSessionEntries, w as filterSessionDiff } from "./workspace-Dbo5iYIc.js";
6
6
  import { r as resolveWorkspaceRevisionMaterializer } from "./vitehub-grants-Co713QTg.js";
7
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
7
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
8
8
  import { normalizeExecutionAuthority } from "@vite-hub/runtime";
9
9
  import { posix } from "node:path";
10
10
  import { randomUUID } from "node:crypto";
@@ -1,11 +1,11 @@
1
- import { d as setWorkspaceHostedStoreLoader, l as ownedBlobPrefix, o as resolveRuntimeVercelBlobWorkspaceStore, s as resolveVercelBlobWorkspaceStore, u as getWorkspaceHostedStoreLoader } from "./provider-DZY1cLP5.js";
1
+ import { d as setWorkspaceHostedStoreLoader, l as ownedBlobPrefix, o as resolveRuntimeVercelBlobWorkspaceStore, s as resolveVercelBlobWorkspaceStore, u as getWorkspaceHostedStoreLoader } from "./provider-DBJeUNFI.js";
2
2
  import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
3
3
  import { a as isExcludedWorkspacePath, c as normalizeSafeWorkspacePattern, f as sha256, l as normalizeWorkspacePath, r as contentToBytes } from "./path-DYHw5KNk.js";
4
4
  import { t as createWorkspaceGlobMatcher } from "./glob-BIg9O4yY.js";
5
- import { r as diffSnapshots, t as createCurrentSnapshotFromStore } from "./utils-Bv1NBg8r.js";
5
+ import { r as diffSnapshots, t as createCurrentSnapshotFromStore } from "./utils-BoFJcaT1.js";
6
6
  import { a as provideWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
7
7
  import { a as replacementRecoveryError, i as replaceStorePath } from "./replacement-CVZVsflC.js";
8
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
8
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
9
9
  import { n as isRecord } from "./object-DNOrQSl5.js";
10
10
  import { n as setWorkspaceRuntimeConfig } from "./config-CsgNNVAI.js";
11
11
  import { resolve } from "node:path";
package/dist/hosted.js CHANGED
@@ -1,14 +1,14 @@
1
- import { a as resolveGitHubWorkspaceStore, d as setWorkspaceHostedStoreLoader, i as resolveCloudflareArtifactsStore, u as getWorkspaceHostedStoreLoader } from "./provider-DZY1cLP5.js";
1
+ import { a as resolveGitHubWorkspaceStore, d as setWorkspaceHostedStoreLoader, i as resolveCloudflareArtifactsStore, u as getWorkspaceHostedStoreLoader } from "./provider-DBJeUNFI.js";
2
2
  import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError, t as assertWorkspaceDigest } from "./internal/path.js";
3
- import { k as getActiveCloudflareBinding } from "./shared-DCAyMX8U.js";
3
+ import { k as getActiveCloudflareBinding } from "./shared-CaAKcBBr.js";
4
4
  import { n as copyJsonFileMetadata } from "./file-metadata-Dqpldj0h.js";
5
5
  import { a as isExcludedWorkspacePath, c as normalizeSafeWorkspacePattern, f as sha256, l as normalizeWorkspacePath, r as contentToBytes } from "./path-DYHw5KNk.js";
6
6
  import { t as createWorkspaceGlobMatcher } from "./glob-BIg9O4yY.js";
7
7
  import { t as workspaceStoreDiscard } from "./discard-BkoLmmmN.js";
8
8
  import { n as isRecord } from "./object-DNOrQSl5.js";
9
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
9
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
10
10
  import { i as replaceStorePath } from "./replacement-CVZVsflC.js";
11
- import { n as createSnapshotFromEntries, r as diffSnapshots } from "./utils-Bv1NBg8r.js";
11
+ import { n as createSnapshotFromEntries, r as diffSnapshots } from "./utils-BoFJcaT1.js";
12
12
  import { createGitHubWorkspaceStore } from "./providers/github/store.js";
13
13
  import { n as setWorkspaceRuntimeConfig } from "./config-CsgNNVAI.js";
14
14
  import { resolve } from "node:path";
@@ -196,7 +196,6 @@ const dir = "/workspace";
196
196
  const fileMetadataPath = ".vitehub/files.json";
197
197
  const fileMetadataJournalPath = ".vitehub/files.pending.json";
198
198
  const tokenRefreshWindow = 6e4;
199
- /** How long a Store without staged writes trusts the branch head that it loaded, in milliseconds. */
200
199
  const remoteHeadCacheMs = 5e3;
201
200
  const fileMetadataSchema = object({
202
201
  mediaType: optional(string()),
@@ -265,9 +264,7 @@ var CloudflareArtifactsWorkspaceStore = class {
265
264
  #head;
266
265
  #loadedAt = 0;
267
266
  #pendingCommit;
268
- /** Whether files or metadata changed since the last load or push. */
269
267
  #staged = false;
270
- /** Metadata written since the last load or push, by absolute path. A rebase writes it again on the new head. */
271
268
  #stagedMeta = /* @__PURE__ */ new Map();
272
269
  #remote;
273
270
  #ready;
@@ -277,7 +274,6 @@ var CloudflareArtifactsWorkspaceStore = class {
277
274
  this.options = options;
278
275
  this.workspaceName = workspaceName;
279
276
  }
280
- /** Drops the staged writes. The next call clones the branch again, as the first call does. */
281
277
  async [workspaceStoreDiscard]() {
282
278
  await this.#mutate(async () => {
283
279
  this.#files = /* @__PURE__ */ new Map();
@@ -458,7 +454,6 @@ var CloudflareArtifactsWorkspaceStore = class {
458
454
  await this.#ensure();
459
455
  await this.#mutate(async () => await this.#rebase(options));
460
456
  }
461
- /** Load the current branch head and write the staged changes on it again. A path that changed on both sides fails with its name in `details.paths`. */
462
457
  async #rebase(options) {
463
458
  const baseline = this.#baseline;
464
459
  const current = await createSnapshotFromEntries(await this.#listEntries("", { recursive: true }));
@@ -519,11 +514,6 @@ var CloudflareArtifactsWorkspaceStore = class {
519
514
  throw error;
520
515
  }
521
516
  }
522
- /**
523
- * Commit and push the staged changes. When the branch moved since the Store loaded, for example because another
524
- * isolate pushed, the Store loads the new head, writes the staged changes on it again, and pushes once more. A path
525
- * that changed on both sides, or a second move, fails with `WORKSPACE_CONFLICT`.
526
- */
527
517
  async #createSnapshot(options, retry = true) {
528
518
  const git = await import("isomorphic-git");
529
519
  const http = await import("isomorphic-git/http/web");
@@ -732,11 +722,6 @@ var CloudflareArtifactsWorkspaceStore = class {
732
722
  if (!binding) throw workspaceError(`[vitehub] Cloudflare Artifacts binding "${bindingName}" not found.`);
733
723
  return binding;
734
724
  }
735
- /**
736
- * Load the branch once. A Store without staged changes that loaded more than `remoteHeadCacheMs` ago asks for the
737
- * branch head again and loads it when it moved, so a Store that one isolate keeps for many requests sees pushes from
738
- * other writers before it stages new changes.
739
- */
740
725
  async #ensure() {
741
726
  const wasReady = !!this.#ready;
742
727
  this.#ready ||= this.#load().catch((error) => {
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
2
- import { t as assertWorkspaceRules } from "./rule-keys-xMpiTLq1.js";
3
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
4
- import { t as createWorkspace } from "./workspace-Cz-5Ne1c.js";
2
+ import { t as assertWorkspaceRules } from "./rule-keys-DQYcSewo.js";
3
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
4
+ import { t as createWorkspace } from "./workspace-Dbo5iYIc.js";
5
5
  import { n as isWorkspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
6
- import { r as withFileSourceOptions, t as file } from "./file-DIBPXqbk.js";
7
- import { m as url } from "./config-Bze7OyvB.js";
8
- import { t as github } from "./github-DcrnEGNN.js";
9
- import { t as glob } from "./glob-YVshR7WP.js";
10
- import { t as mcpResources } from "./mcp-resources-BDL0llKW.js";
11
- import { n as createWorkspaceTools, t as useWorkspace } from "./use-tools-NXEQt099.js";
12
- import { t as isWorkspaceName } from "./registry-OonxXCbd.js";
13
- import { r as registerWorkspacePlugin } from "./rules-DYQCKYdt.js";
14
- import { r as useWorkspaceFiles } from "./use-hLouCwGz.js";
6
+ import { r as withFileSourceOptions, t as file } from "./file-B3KxJyxb.js";
7
+ import { m as url } from "./config-B-S_Z4G0.js";
8
+ import { t as github } from "./github-DDUrrKt8.js";
9
+ import { t as glob } from "./glob-BfZVRPCk.js";
10
+ import { t as mcpResources } from "./mcp-resources-B2J0YCD2.js";
11
+ import { n as createWorkspaceTools, t as useWorkspace } from "./use-tools-D_eorKu1.js";
12
+ import { t as isWorkspaceName } from "./registry-CqDWpDe9.js";
13
+ import { r as registerWorkspacePlugin } from "./rules-sItt6TP-.js";
14
+ import { r as useWorkspaceFiles } from "./use-BskfWVjx.js";
15
15
  import { lookup } from "mrmime";
16
16
  import { markdown as markdown$1, sourceIgnores } from "@vite-hub/source";
17
17
  // src/core/define.ts
@@ -1,4 +1,4 @@
1
- import { t as workspaceErrorDiagnostics } from "../error-diagnostics-CHgE8TQM.js";
1
+ import { t as workspaceErrorDiagnostics } from "../error-diagnostics-Dn4sQcKL.js";
2
2
  import { ViteHubError, getViteHubErrorShape } from "@vite-hub/runtime";
3
3
  // src/core/errors.ts
4
4
  function diagnosticError(diagnostic, options = {}, message = `[vitehub] ${diagnostic.why}`) {
@@ -1,5 +1,5 @@
1
- import { n as resolveWorkspaceAutoCommit } from "../rules-DYQCKYdt.js";
2
- import { t as workspaceErrorDiagnostics } from "../error-diagnostics-CHgE8TQM.js";
1
+ import { n as resolveWorkspaceAutoCommit } from "../rules-sItt6TP-.js";
2
+ import { t as workspaceErrorDiagnostics } from "../error-diagnostics-Dn4sQcKL.js";
3
3
  const modelWorkspaceGlobPatternLimits = Object.freeze({
4
4
  maxBytes: 2048,
5
5
  maxComplexity: 1024,
@@ -1,11 +1,11 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
2
2
  import { n as useWorkspaceAssets } from "./asset-registry-DJyE42kr.js";
3
- import { t as files } from "./files-DAJyo7TU.js";
3
+ import { t as files } from "./files-DSOjTK36.js";
4
4
  import { f as sha256, l as normalizeWorkspacePath, t as contentStreamChunks, u as readStoredFile } from "./path-DYHw5KNk.js";
5
5
  import { o as workspaceError } from "./internal/path.js";
6
- import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext } from "./config-Bze7OyvB.js";
7
- import { A as removeWorkspaceOwnedFile, C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, M as registerWorkspaceStoreAlias, N as workspaceStoreIdentity, O as recordWorkspaceFileOwner, _ as reconcileRemovedStartupSources, d as invalidateSourceSnapshot, j as withWorkspaceFileCheckpoint, k as removeWorkspaceFileOwner, m as readCurrentSourceSnapshot, y as sourceSnapshotOwnsAnyPath } from "./metadata-target-mlHAv1p4.js";
8
- import { s as invalidateWorkspaceSourceMaterialization } from "./workspace-Cz-5Ne1c.js";
6
+ import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext } from "./config-B-S_Z4G0.js";
7
+ import { A as removeWorkspaceOwnedFile, C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, M as registerWorkspaceStoreAlias, N as workspaceStoreIdentity, O as recordWorkspaceFileOwner, _ as reconcileRemovedStartupSources, d as invalidateSourceSnapshot, j as withWorkspaceFileCheckpoint, k as removeWorkspaceFileOwner, m as readCurrentSourceSnapshot, y as sourceSnapshotOwnsAnyPath } from "./metadata-target-oc00D8g2.js";
8
+ import { s as invalidateWorkspaceSourceMaterialization } from "./workspace-Dbo5iYIc.js";
9
9
  import { getViteHubErrorShape } from "@vite-hub/runtime";
10
10
  import { createHash } from "node:crypto";
11
11
  // src/lifecycle.ts
package/dist/loader.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as files } from "./files-DAJyo7TU.js";
1
+ import { t as files } from "./files-DSOjTK36.js";
2
2
  import { o as isWorkspaceBytes } from "./path-DYHw5KNk.js";
3
3
  // src/loaders/json.ts
4
4
  function json(options = {}) {
@@ -1,6 +1,6 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
2
2
  import { normalizeSafeWorkspacePath } from "./internal/path.js";
3
- import { b as markLiveWorkspaceSource, d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, u as ownSourceOption } from "./config-Bze7OyvB.js";
3
+ import { b as markLiveWorkspaceSource, d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, u as ownSourceOption } from "./config-B-S_Z4G0.js";
4
4
  import { mcpResources } from "@vite-hub/source/mcp";
5
5
  // src/sources/mcp-resources.ts
6
6
  var mcp_resources_exports = /* @__PURE__ */ __exportAll({ mcpResources: () => mcpResources$1 });
@@ -1,10 +1,10 @@
1
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
1
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
2
2
  import { n as copyJsonFileMetadata } from "./file-metadata-Dqpldj0h.js";
3
3
  import { normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
4
4
  import { f as sha256, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, o as isWorkspaceBytes, t as contentStreamChunks } from "./path-DYHw5KNk.js";
5
5
  import { i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
6
6
  import { t as searchText } from "./search-CG6UNOtn.js";
7
- import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext, s as sourceMountContainsPath } from "./config-Bze7OyvB.js";
7
+ import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext, s as sourceMountContainsPath } from "./config-B-S_Z4G0.js";
8
8
  import { posix } from "node:path";
9
9
  import { createHash } from "node:crypto";
10
10
  // src/storage/identity.ts
@@ -276,7 +276,6 @@ function sourceMountOwnsPath(source, path) {
276
276
  function createWorkspaceSourceMountAuthority(owner) {
277
277
  const grants = /* @__PURE__ */ new WeakMap();
278
278
  return {
279
- /** Creates a grant bound to the Source key and its normalized mount. */
280
279
  grant(source) {
281
280
  const mountPath = normalizeSafeWorkspacePath(source.mountPath, { allowEmpty: true });
282
281
  const grant = new WorkspaceSourceMountGrant(source.key, mountPath);
@@ -286,11 +285,6 @@ function createWorkspaceSourceMountAuthority(owner) {
286
285
  });
287
286
  return grant;
288
287
  },
289
- /**
290
- * Returns the Store limited to the mount of a grant from this authority.
291
- * File writes, `mkdir`, and `rm` must stay inside the mount. `removeEmptyDirectory` can also remove
292
- * an ancestor of the mount, because the owner created it for the mount.
293
- */
294
288
  store(grant, store) {
295
289
  const scope = grants.get(grant);
296
290
  if (!scope) throw workspaceError(`[vitehub] ${owner} requires a Source mount grant to change Workspace files.`);
@@ -1,9 +1,9 @@
1
1
  import { v as redactInspectionText } from "./operations.js";
2
2
  import { i as workspaceConflict } from "./internal/path.js";
3
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
4
- import { d as normalizeHistoryPath } from "./utils-Bv1NBg8r.js";
3
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
4
+ import { d as normalizeHistoryPath } from "./utils-BoFJcaT1.js";
5
5
  import { r as contentToBytes } from "./path-DYHw5KNk.js";
6
- import { r as useWorkspaceFiles } from "./use-hLouCwGz.js";
6
+ import { r as useWorkspaceFiles } from "./use-BskfWVjx.js";
7
7
  import { readDerivedFrom, staleDerivedFiles } from "./lineage.js";
8
8
  // src/runtime/operations.ts
9
9
  const invalidRequestCodes = /* @__PURE__ */ new Set([
@@ -12,7 +12,6 @@ const invalidRequestCodes = /* @__PURE__ */ new Set([
12
12
  "WORKSPACE_R0070",
13
13
  "WORKSPACE_R0071"
14
14
  ]);
15
- /** Gives an operation error the HTTP status and the redacted message that the CLI and the Console report. */
16
15
  function withStatus(error, status, message = error.message) {
17
16
  return Object.defineProperties(error, {
18
17
  status: {
@@ -29,7 +28,6 @@ function withStatus(error, status, message = error.message) {
29
28
  }
30
29
  });
31
30
  }
32
- /** The status of each Workspace code that the operations throw. A failure that sets its own client status keeps it. */
33
31
  const operationStatus = {
34
32
  WORKSPACE_CONFLICT: 409,
35
33
  WORKSPACE_FORBIDDEN: 403,
@@ -37,7 +35,6 @@ const operationStatus = {
37
35
  WORKSPACE_NOT_FOUND: 404,
38
36
  WORKSPACE_SOURCE_READ_ONLY: 403
39
37
  };
40
- /** Reads the code of a ViteHub error or a Workspace diagnostic. */
41
38
  function errorCode(error) {
42
39
  const code = Object(error) === error ? Reflect.get(Object(error), "code") : void 0;
43
40
  return typeof code === "string" ? code : void 0;
@@ -46,7 +43,6 @@ function isoTime(value) {
46
43
  const time = Date.parse(value);
47
44
  return Number.isNaN(time) ? value : new Date(time).toISOString();
48
45
  }
49
- /** The author of a revision: a string, or a person `{ id, name, email }` as Content and `vitehub push` record it. */
50
46
  function authorName(author) {
51
47
  if (typeof author === "string") return author || void 0;
52
48
  if (Object(author) !== author) return void 0;
@@ -174,7 +170,6 @@ function decodeContent(file) {
174
170
  if (file.encoding === "utf8") return file.content;
175
171
  return Uint8Array.from(atob(file.content), (character) => character.charCodeAt(0));
176
172
  }
177
- /** The files of a revision by path, with the digest of each. */
178
173
  async function filesOf(view) {
179
174
  const files = /* @__PURE__ */ new Map();
180
175
  for (const entry of await view.list("", { recursive: true })) if (entry.type === "file") files.set(entry.path, entry);
@@ -231,14 +226,12 @@ async function listChanges(workspace, history, request) {
231
226
  }
232
227
  return result;
233
228
  }
234
- /** The new content of a file. A file that exists at the base revision keeps its media type and metadata. */
235
229
  function replacement(content, before) {
236
230
  const file = { content };
237
231
  if (before?.mediaType) file.mediaType = before.mediaType;
238
232
  if (before?.metadata) file.metadata = Object.fromEntries(Object.entries(before.metadata).filter(([key]) => key !== "source"));
239
233
  return file;
240
234
  }
241
- /** The caller of a commit in the shape that Content records: the surface, the person, and the Agent Actor. */
242
235
  function callerMetadata(context) {
243
236
  const author = Object.fromEntries([
244
237
  "id",
@@ -254,7 +247,6 @@ function callerMetadata(context) {
254
247
  ...context.actor?.id ? { agent: { actor: context.actor.id } } : {}
255
248
  };
256
249
  }
257
- /** An Agent tool or an MCP client: a model decides the call, for the person it works for. */
258
250
  function modelSurface(context) {
259
251
  return context.surface === "agent" || context.surface === "mcp";
260
252
  }