@vite-hub/workspace 0.6.1 → 0.7.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 (95) hide show
  1. package/README.md +5 -5
  2. package/dist/{asset-registry-0CdRAjIV.js → asset-registry-DJyE42kr.js} +1 -1
  3. package/dist/blob-database.d.ts +1 -1
  4. package/dist/blob-database.js +6 -6
  5. package/dist/checkout.js +2 -2
  6. package/dist/cloudflare.d.ts +1 -1
  7. package/dist/cloudflare.js +1 -1
  8. package/dist/{config-jo5QgE1w.js → config--ZzAvhMp.js} +14 -9
  9. package/dist/{config-DeA287c0.d.ts → config-DF6sqKXB.d.ts} +1 -1
  10. package/dist/durability.d.ts +1 -1
  11. package/dist/durability.js +2 -2
  12. package/dist/{error-diagnostics-B4me-ouV.js → error-diagnostics-CHgE8TQM.js} +16 -0
  13. package/dist/{error-diagnostics-kKXseq8d.js → error-diagnostics-CsiNo_oI.js} +3 -3
  14. package/dist/{file-BrNAXQgY.js → file-DQ5-TBTD.js} +1 -1
  15. package/dist/{file-metadata-Bpsvjw_X.js → file-metadata-Dqpldj0h.js} +7 -2
  16. package/dist/{files--z2dLC5z.js → files-D1UkSjzX.js} +2 -2
  17. package/dist/files.d.ts +5 -5
  18. package/dist/files.js +5 -5
  19. package/dist/{github-k--_LCrX.js → github-BECfOMaw.js} +4 -4
  20. package/dist/{glob-BreFjNAV.js → glob-BIg9O4yY.js} +2 -2
  21. package/dist/{glob-BEutagp1.js → glob-BIsxLusH.js} +1 -1
  22. package/dist/{host-C8yZizfk.js → host-BYBRcSnh.js} +7 -7
  23. package/dist/hosted-vercel-blob.d.ts +1 -1
  24. package/dist/hosted-vercel-blob.js +464 -1
  25. package/dist/hosted.d.ts +1 -1
  26. package/dist/hosted.js +917 -1
  27. package/dist/index.d.ts +6 -7
  28. package/dist/index.js +13 -13
  29. package/dist/internal/path.js +108 -1
  30. package/dist/internal/workspace.d.ts +2 -3
  31. package/dist/internal/workspace.js +2 -2
  32. package/dist/{lifecycle-IReZfi0b.js → lifecycle-BK7WNfcP.js} +8 -8
  33. package/dist/loader.d.ts +1 -1
  34. package/dist/loader.js +2 -2
  35. package/dist/{mcp-resources-DeJnbOaw.js → mcp-resources-F4SJF4_P.js} +2 -2
  36. package/dist/{memory-BlSRrBH1.js → memory-BCZl_ZsJ.js} +26 -4
  37. package/dist/{metadata-target-CaGLY4ay.js → metadata-target-DPGF6L68.js} +59 -24
  38. package/dist/{operation-definition-CqZkx1Rm.d.ts → operations-BALFFdKj.d.ts} +1 -0
  39. package/dist/{operations-BIaK_uYG.js → operations-DJ_7W0gs.js} +8 -7
  40. package/dist/operations.d.ts +2 -2
  41. package/dist/operations.js +1327 -2
  42. package/dist/{path-Bb9OIc_F.js → path-DYHw5KNk.js} +11 -3
  43. package/dist/plugins-BYxsPDBH.d.ts +12 -0
  44. package/dist/{provider-CN14ewvx.js → provider-fcI7kJ5k.js} +256 -70
  45. package/dist/providers/github/store.d.ts +1 -1
  46. package/dist/providers/github/store.js +1994 -1
  47. package/dist/{registry-BbUg9vJB.js → registry-CFeUQsja.js} +3 -3
  48. package/dist/{registry-B0g19sdy.d.ts → registry-h1-cT-cE.d.ts} +1 -1
  49. package/dist/{registry-s2Ob9PeX.d.ts → registry-hnARUKNF.d.ts} +2 -2
  50. package/dist/replacement-CVZVsflC.js +76 -0
  51. package/dist/{request-scope-CXCI_wCb.js → request-scope-jH4H0Sbm.js} +3 -1
  52. package/dist/{rule-keys-BLEbi1h5.js → rule-keys-xMpiTLq1.js} +1 -1
  53. package/dist/{rules-BPDXypZV.js → rules-DYQCKYdt.js} +4 -4
  54. package/dist/runtime/assets.d.ts +1 -1
  55. package/dist/runtime/assets.js +4 -4
  56. package/dist/runtime/empty-assets-registry.d.ts +1 -1
  57. package/dist/runtime/empty-registry.d.ts +2 -2
  58. package/dist/runtime/registry.d.ts +1 -1
  59. package/dist/runtime/request.js +1 -1
  60. package/dist/runtime/state.d.ts +17 -6
  61. package/dist/runtime/state.js +7 -7
  62. package/dist/runtime/workspace.d.ts +1 -1
  63. package/dist/runtime/workspace.js +1 -1
  64. package/dist/runtime.d.ts +8 -8
  65. package/dist/runtime.js +38 -23
  66. package/dist/{search-C_nVorq7.js → search-CG6UNOtn.js} +1 -1
  67. package/dist/server.d.ts +2 -2
  68. package/dist/server.js +301 -1
  69. package/dist/{shared-C20Wh1mp.js → shared-PFnkYidS.js} +59 -21
  70. package/dist/source-metadata.d.ts +2 -2
  71. package/dist/source-metadata.js +3 -3
  72. package/dist/{sync-BBfR4g5y.js → sync-CUkCuP_g.js} +5 -5
  73. package/dist/test.d.ts +1 -1
  74. package/dist/test.js +1 -1
  75. package/dist/{types-Bel5IDmF.d.ts → types-BnSUug2v.d.ts} +13 -1
  76. package/dist/{use-D0DyTMxM.js → use-BCMkT-kC.js} +15 -51
  77. package/dist/{use-CpphIBof.d.ts → use-CJ5rdIrW.d.ts} +1 -1
  78. package/dist/{use-tools-CHduR5k6.js → use-tools-CcXs2hFA.js} +4 -4
  79. package/dist/{use-tools-CAK10LTc.d.ts → use-tools-DFVqZwgc.d.ts} +2 -2
  80. package/dist/{utils-DXP9xfXo.js → utils-Bv1NBg8r.js} +5 -5
  81. package/dist/vite.d.ts +2 -2
  82. package/dist/vite.js +368 -62
  83. package/dist/{workspace-BOuxrZrP.d.ts → workspace-B6QreLJd.d.ts} +1 -1
  84. package/dist/{workspace-CLuPkyZR.js → workspace-D1m00MCM.js} +340 -104
  85. package/dist/workspace-inspection-scanner-BlJ8bCAB.js +140 -0
  86. package/package.json +12 -12
  87. package/dist/errors-CnFDXxeJ.d.ts +0 -4
  88. package/dist/hosted-8BTKAtMX.js +0 -883
  89. package/dist/hosted-vercel-blob-B6kygYqn.js +0 -408
  90. package/dist/operations-DS1C4uXd.js +0 -1308
  91. package/dist/path-CuYE8-X6.js +0 -57
  92. package/dist/plugins-CLc32jvL.d.ts +0 -8
  93. package/dist/server-aa1a4rkV.js +0 -301
  94. package/dist/state-BdDfBtOR.d.ts +0 -17
  95. package/dist/store-cx3OqNTi.js +0 -1971
package/README.md CHANGED
@@ -33,9 +33,9 @@ Use `skipLibCheck: true` in app TypeScript configs while ViteHub depends on runt
33
33
 
34
34
  ## Minimal API
35
35
 
36
- The local Store persists file metadata inside `.vitehub` under the Workspace root. If file removal stops before metadata cleanup completes, reads reject with `Interrupted Workspace removal` so a restored file cannot reuse deleted ownership. Retry removal of the reported path with `force: true` and, for directories, `recursive: true` before restoring files.
36
+ The local Store persists file metadata inside `.vitehub` under the Workspace root. If file removal stops before metadata cleanup completes, the next operation on that path rolls the removal back: files that are still on disk or that were restored stay, and their old metadata is dropped, so a restored file cannot reuse deleted ownership.
37
37
 
38
- Lock markers are not reclaimed based on age because a slow operation or failed heartbeat may still own them. If a process crashes and operations report `Timed out waiting to read Workspace` or `Timed out waiting to write Workspace`, stop every process using that Workspace. Call `recoverLocalWorkspaceLocks({ root, offline: true })` from `@vite-hub/workspace/runtime` with the Local Store's root, then restart the processes after recovery succeeds. Prevent changes to the Store and its ancestor directories throughout recovery. The `offline: true` flag confirms exclusive offline access; it does not stop other processes. See [Local Store recovery](https://vitehub.dev/docs/workspace/limits-and-errors#recover-a-local-store-after-a-crash) for the procedure.
38
+ Local Store lock markers do not expire. On Linux, the Store removes a marker when it can confirm that the owner stopped and that the host, boot ID, and process ID namespace match. If the Store cannot confirm this, the marker stays. Stop all Local Store processes before you upgrade ViteHub. Do not share a Local Store between ViteHub versions. If a lock times out, the error names the marker paths. See [Local Store recovery](https://vitehub.dev/docs/workspace/limits-and-errors#recover-a-local-store-after-a-crash) for the offline procedure.
39
39
 
40
40
  Set `locks: "process"` on a local Store when one process owns its root, for example a disposable checkout that one worker uses. The Store then keeps the same per-path read and write locks in memory. It creates no `.vitehub/locks` directory, does not poll lock markers, and lists entries in parallel. Keep the default `locks: "filesystem"` when more than one process can access the root.
41
41
 
@@ -415,7 +415,7 @@ navigation, query, cache, and ranked full-text search.
415
415
 
416
416
  ## Sandbox sessions
417
417
 
418
- Workspace definitions are runtime-free. To run generated code, open a [`@vite-hub/sandbox`](../sandbox/README.md) session and pass it to `workspace.startSession({ host: sandboxSession })`. Workspace materializes files into the host and still owns diff, commit, and rollback; closing without commit restores the host tree from authoritative Workspace state. Sandbox owns execution and the host lifecycle.
418
+ Workspace definitions are runtime-free. To run generated code, open a [`@vite-hub/sandbox`](../sandbox/README.md) session and pass it to `workspace.startSession({ host: sandboxSession })`. Workspace materializes files into the host and still owns diff, commit, and rollback; closing without commit restores the host tree from authoritative Workspace state. Sandbox owns execution and the host lifecycle. An explicit `target` takes precedence. Otherwise, Workspace uses `host.workspaceTarget`, a directory the host lets Workspace replace, or `/workspace` if the host does not provide one. `trusted-host` and Crabbox Sandboxes provide their temporary workspace directory only when `cwd` is not configured.
419
419
 
420
420
  GitHub-backed Workspaces pin the branch head before a hosted Session starts and materialize a full-tree Session from one revision archive. Repeated Sessions reuse that immutable archive while the revision is unchanged; scoped Sessions and stores without revision archives use the normal Workspace file API. A hosted Session exposes that initial retained revision as `session.revision` when its Store provides one. Stores with retained history but no revision materializer, such as Blob Database, expose the retained head only when its file manifest matches the files copied to the host. Draft changes or unavailable history leave the revision unset and do not prevent the Session from opening.
421
421
 
@@ -500,7 +500,7 @@ export default defineConfig({
500
500
  })
501
501
  ```
502
502
 
503
- The Vite Integration writes matching module-level and discovered definition-level Artifacts bindings into generated Cloudflare Provider Output. It reads a definition's `store` by loading the definition at build time. If the build cannot load a definition, it fails with `WORKSPACE_B0005`, unless the source shows a literal object with no `store` or with a literal store whose `driver` is not `cloudflare`; set the store in the `workspace` config then. Each named Workspace uses its own repository by default, and a successful `workspace.snapshot()` pushes a Git commit whose SHA is the snapshot id. The Worker adapter keeps its checkout in isolate memory, so use it for deliberately small Workspaces. Cloudflare Artifacts is in open beta and is not available on Workers Free; Cloudflare hosting therefore continues to default to the `memory` Store.
503
+ The Vite Integration writes matching module-level and discovered definition-level Artifacts bindings into generated Cloudflare Provider Output. It reads a definition's `store` by loading the definition at build time. If the build cannot load a definition, it fails with `WORKSPACE_B0005`, unless the source shows a literal object with no `store` or with a literal store whose `driver` is not `cloudflare`; set the store in the `workspace` config then. Each named Workspace uses its own repository by default, and a successful `workspace.snapshot()` pushes a Git commit whose SHA is the snapshot id. The Worker adapter keeps its checkout in isolate memory, so use it for deliberately small Workspaces. Cloudflare Artifacts is in open beta and is not available on Workers Free; Cloudflare hosting therefore continues to default to the `memory` Store, and the build prints the notice `WORKSPACE_STORE_IN_WORKER_MEMORY` for each build that uses it without an explicit `store: { driver: "memory" }`.
504
504
 
505
505
  Artifacts repositories are private Git storage, not public attachment hosting. Use `@vite-hub/blob` with R2 or another Blob provider when an Agent needs a stable public delivery URL.
506
506
 
@@ -566,7 +566,7 @@ Startup and build Source cleanup track ownership by Workspace name. When definit
566
566
 
567
567
  Source Sync and runtime Source materialization change files only inside the mount of the Source that they process. A Source with an empty mount owns the Workspace root. Source Sync with `stale: "remove"` removes only stale paths inside the current mount. If you move a Source mount, the files in the old mount stay. Remove them yourself if you do not need them. When mounts for the same Source key share an output path, sync retains their claims separately. Each mount can update the file, and every claim tracks the digest of the latest Source write to that shared path. Stale cleanup removes the file only after the other mounts release their claims and its content still matches that digest. Releasing a claim preserves this digest without adopting current file content, including user edits that restore an older Source version.
568
568
 
569
- `history.rebase({ takeRemote })` replaces local content at each listed path, so each path must be writable. A Source-backed path fails with a read-only error before the Store rebases.
569
+ `history.rebase({ takeRemote })` replaces local content at each listed path, so each path must be writable. A Source-backed path fails with `WORKSPACE_SOURCE_READ_ONLY` before the Store rebases.
570
570
 
571
571
  Workspace internals keep Source Sync state, Source snapshots, startup and build indexes, and file owner records in Store metadata. Cleanup uses these records to decide which files to remove. Metadata keys that start with `source:`, `workspace:`, `workspace-file-`, or `loader:` are reserved for this, and public `setMeta` rejects them. Use your own prefix for application metadata.
572
572
 
@@ -1,4 +1,4 @@
1
- import { c as workspaceNotFoundError } from "./path-CuYE8-X6.js";
1
+ import { s as workspaceNotFoundError } from "./internal/path.js";
2
2
  import runtimeAssetsRegistry from "#vitehub-workspace-assets-registry";
3
3
  // src/asset-registry.ts
4
4
  const workspaceAssetsRegistryKey = Symbol.for("vitehub.workspace.assetsRegistry");
@@ -1,4 +1,4 @@
1
- import { Dn as WorkspaceStoreHistory, En as WorkspaceStore } from "./types-Bel5IDmF.js";
1
+ import { Dn as WorkspaceStoreHistory, En as WorkspaceStore } from "./types-BnSUug2v.js";
2
2
  import { n as workspaceHistorySchema } from "./history-schema-BR4UDPHL.js";
3
3
  import { AnyRelations } from "drizzle-orm";
4
4
  import { PgAsyncDatabase, PgQueryResultHKT } from "drizzle-orm/pg-core";
@@ -1,11 +1,11 @@
1
- import { n as forkMemoryWorkspaceStore, r as vitehubOwnedPrefix, t as createMemoryWorkspaceStore } from "./memory-BlSRrBH1.js";
2
- import { a as workspaceConflict, s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
3
- import { n as copyJsonWorkspaceMetadata, t as copyJsonFileMetadata } from "./file-metadata-Bpsvjw_X.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-DXP9xfXo.js";
5
- import { a as isExcludedWorkspacePath, d as sha256, i as decodeFile, o as isWorkspaceBytes, r as contentToBytes } from "./path-Bb9OIc_F.js";
1
+ import { n as forkMemoryWorkspaceStore, r as vitehubOwnedPrefix, t as createMemoryWorkspaceStore } from "./memory-BCZl_ZsJ.js";
2
+ import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
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";
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-B4me-ouV.js";
8
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.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";
package/dist/checkout.js CHANGED
@@ -1,10 +1,10 @@
1
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
1
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.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";
5
+ import { Diagnostic } from "nostics";
5
6
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
6
7
  import { createHash, randomBytes } from "node:crypto";
7
- import { Diagnostic } from "nostics";
8
8
  import { constants } from "node:fs";
9
9
  import { lstat, mkdir, open, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
10
10
  // src/checkout.ts
@@ -1,4 +1,4 @@
1
- import { En as WorkspaceStore, s as GitHubWorkspaceStoreOptions, t as CloudflareArtifactsWorkspaceStoreOptions, v as ResolvedWorkspaceModuleOptions } from "./types-Bel5IDmF.js";
1
+ import { En as WorkspaceStore, s as GitHubWorkspaceStoreOptions, t as CloudflareArtifactsWorkspaceStoreOptions, v as ResolvedWorkspaceModuleOptions } from "./types-BnSUug2v.js";
2
2
  import { configureHostedWorkspaceRuntime } from "./hosted.js";
3
3
  export declare function createCloudflareArtifactsWorkspaceStore(options: CloudflareArtifactsWorkspaceStoreOptions, workspaceName: string): WorkspaceStore;
4
4
  export type CloudflareWorkspaceRuntimeStoreOptions = Partial<CloudflareArtifactsWorkspaceStoreOptions> | (Partial<GitHubWorkspaceStoreOptions> & {
@@ -1 +1 @@
1
- export { t as configureCloudflareWorkspaceRuntime, a as createCloudflareArtifactsWorkspaceStore } from "./hosted-8BTKAtMX.js";
1
+ export { configureHostedWorkspaceRuntime as configureCloudflareWorkspaceRuntime, t as createCloudflareArtifactsWorkspaceStore } from "./hosted.js";
@@ -1,8 +1,8 @@
1
- import { s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
2
- import { i as decodeFile, o as isWorkspaceBytes } from "./path-Bb9OIc_F.js";
1
+ import { normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
2
+ import { i as decodeFile, o as isWorkspaceBytes } from "./path-DYHw5KNk.js";
3
3
  import { t as abortable } from "./abort-CQGxJBqa.js";
4
- import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
5
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
4
+ import { t as internalErrorDiagnostics } from "./error-diagnostics-CsiNo_oI.js";
5
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
6
6
  import { t as isRecord } from "./object-CAK6UYR5.js";
7
7
  import { posix } from "node:path";
8
8
  import { createHash } from "node:crypto";
@@ -681,7 +681,12 @@ async function prepareWorkspaceSource(source, ctx, options = {}) {
681
681
  })();
682
682
  revisionResolutionByContext.set(ctx, revisionResolution);
683
683
  }
684
- await revisionResolution;
684
+ try {
685
+ await revisionResolution;
686
+ } catch (error) {
687
+ if (revisionResolutionByContext.get(ctx) === revisionResolution) revisionResolutionByContext.delete(ctx);
688
+ throw error;
689
+ }
685
690
  await source.prepare?.(ctx);
686
691
  }
687
692
  // src/sources/runtime-options.ts
@@ -948,10 +953,10 @@ function inferredSourceFingerprintOptions(family, input) {
948
953
  async function loadInferredWorkspaceSource(family, input) {
949
954
  if (family === "fetch" && isRecord(input)) return createInferredFetchSource(input);
950
955
  if (family === "fetch") return createInferredFetchSource(input);
951
- if (family === "file") return (await import("./file-BrNAXQgY.js").then((n) => n.n)).file(input);
952
- if (family === "github") return (await import("./github-k--_LCrX.js").then((n) => n.n)).github(input);
953
- if (family === "glob") return (await import("./glob-BEutagp1.js").then((n) => n.n)).glob(input);
954
- return (await import("./mcp-resources-DeJnbOaw.js").then((n) => n.n)).mcpResources(input);
956
+ if (family === "file") return (await import("./file-DQ5-TBTD.js").then((n) => n.n)).file(input);
957
+ if (family === "github") return (await import("./github-BECfOMaw.js").then((n) => n.n)).github(input);
958
+ if (family === "glob") return (await import("./glob-BIsxLusH.js").then((n) => n.n)).glob(input);
959
+ return (await import("./mcp-resources-F4SJF4_P.js").then((n) => n.n)).mcpResources(input);
955
960
  }
956
961
  function inferredSourceDefaults(family, input) {
957
962
  if (!isRecord(input)) return family === "file" ? { key: inferredFileSourceKey(input) } : {};
@@ -1,4 +1,4 @@
1
- import { L as WorkspaceDefinition, M as WorkspaceCacheOptions, Pn as WorkspaceValidateMode, Sn as WorkspaceSourceSyncPolicy, Zt as WorkspaceSource, _t as WorkspaceMaterializeMode, en as WorkspaceSourceInput, sn as WorkspaceSourceRequestDescriptor } from "./types-Bel5IDmF.js";
1
+ import { L as WorkspaceDefinition, M as WorkspaceCacheOptions, Pn as WorkspaceValidateMode, Sn as WorkspaceSourceSyncPolicy, Zt as WorkspaceSource, _t as WorkspaceMaterializeMode, en as WorkspaceSourceInput, sn as WorkspaceSourceRequestDescriptor } from "./types-BnSUug2v.js";
2
2
  declare function getWorkspaceSourceRequestDescriptor(source: WorkspaceSource): WorkspaceSourceRequestDescriptor | undefined;
3
3
  declare function isWorkspaceSourceRequestOnly(source: WorkspaceSource): boolean;
4
4
  declare function workspaceSourceRequestDescriptorPath(sourceKey: string): string;
@@ -1,4 +1,4 @@
1
- import { R as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-Bel5IDmF.js";
1
+ import { R as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-BnSUug2v.js";
2
2
  import { Durability, DurabilityContext } from "@vite-hub/runtime/durability";
3
3
  /** The Blob store and Database names of a Blob + Database Store. `undefined` when the app passed an object. */
4
4
  interface BlobDatabaseSources {
@@ -1,6 +1,6 @@
1
- import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-BbUg9vJB.js";
1
+ import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-CFeUQsja.js";
2
2
  import { n as readBlobDatabaseSources } from "./blob-database-sources-CQPAyCz3.js";
3
- import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-CN14ewvx.js";
3
+ import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-fcI7kJ5k.js";
4
4
  // src/durability.ts
5
5
  const sharedDrivers = {
6
6
  "cloudflare": "Cloudflare Artifacts.",
@@ -9,6 +9,10 @@ const withFix = (fix) => ({
9
9
  const workspaceErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
10
10
  docsBase: "https://vitehub.dev/docs/workspace/diagnostics",
11
11
  codes: {
12
+ WORKSPACE_CONFLICT: {
13
+ ...dynamicError,
14
+ fix: ({ conditionalRemovalUnsupported }) => conditionalRemovalUnsupported ? "Use a Store that supports conditional removal to keep the `ifDigest` check. Remove a file without `ifDigest` only if you intend to delete it even if it changed since you read it." : "Another write changed the file or ref after you read it. Read it again, apply your change to the new content, and retry with its new digest in `ifDigest` or its new head in `ifHead`. For a merge conflict or a publish that is in progress, do the step that the message names first."
15
+ },
12
16
  WORKSPACE_FORBIDDEN: {
13
17
  why: "An Agent may not write past an edit lease that a person holds.",
14
18
  fix: "Tell the person you work for who is editing the files, and try again after they finish. A developer allows overrides with operations({ overrideLeases: true })."
@@ -30,6 +34,14 @@ const workspaceErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
30
34
  })[problem],
31
35
  fix: "Check the Workspace name, the ref or revision, and the path. `vitehub workspace refs <workspace>` lists the refs, and `vitehub workspace get <workspace> <ref>` lists the files. When a base revision is gone, pull again without it."
32
36
  },
37
+ WORKSPACE_PATH_INVALID: {
38
+ why: ({ path, problem }) => problem === "reserved" ? `The Workspace path ${path} uses a reserved name. ViteHub keeps \`.git\` at any depth for Git and \`.vitehub\` at the root for its own data. It also reserves their NTFS short names \`git~N\` and \`vitehu~N\`.` : `The Workspace path ${path} is not a relative path inside the Workspace root. It is empty or absolute, starts with a drive letter, has a NUL byte, or has a \`.\` or \`..\` part.`,
39
+ fix: ({ problem }) => problem === "reserved" ? "Rename the file or folder, for example `.git/config` to `git/config`. No part of a Workspace path can be `.git` or `git~1`, and the first part cannot be `.vitehub` or `vitehu~1`." : "Pass a relative path inside the Workspace, for example `docs/guide.md`. Remove a leading `/` or drive letter, NUL bytes, and `.` or `..` parts. `error.details.path` has the path that the Workspace rejected."
40
+ },
41
+ WORKSPACE_SOURCE_READ_ONLY: {
42
+ why: ({ path, source }) => source === void 0 ? `The Workspace path "${path}" belongs to a Source. Source paths are read-only: a write, removal, or move cannot change them.` : `The Workspace path "${path}" belongs to Source "${source}". Source paths are read-only: a write, removal, or move cannot change them.`,
43
+ fix: "Write the file outside the Source mount, for example under `drafts/`. To change a Source file, change it where the Source reads it, such as its GitHub repository, its URL, or its local files. For a Source with `sync: true`, run `workspace.sync({ sources: ['handbook'] })` with its Source key in place of `handbook`."
44
+ },
33
45
  WORKSPACE_CHECKOUT_CONFLICT: {
34
46
  why: ({ conflicted, workspace }) => `Workspace "${workspace}" has unresolved conflicts: ${conflicted}.`,
35
47
  fix: "Edit each file and remove the conflict markers, or run `vitehub resolve` for a binary file. Then push again."
@@ -112,6 +124,10 @@ const workspaceErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
112
124
  why: ({ reason, workspace }) => `The module of Workspace "${workspace}" did not load: ${reason}`,
113
125
  fix: "Read `error.cause` for the first error. Make sure that the module of the Workspace loads without errors and exports its Definition: the default export of a file in `server/workspaces/`, or the export that the Vite plugin names in its Workspace contribution. Then restart the dev server or build again."
114
126
  },
127
+ WORKSPACE_STORE_IN_WORKER_MEMORY: {
128
+ why: "At least one Workspace in this Cloudflare build uses the default Memory Store. It keeps the files that the app writes in the memory of the Worker isolate. The files are lost when the isolate stops, and other isolates do not see them. Sources still read from the bundle.",
129
+ fix: "Set `workspace: { store: { driver: \"cloudflare\" } }` in `vitehub()` to keep the files in Cloudflare Artifacts, or use `{ driver: \"github\" }`. To keep the memory Store on purpose, set `store: { driver: \"memory\" }`, and the build does not print this notice."
130
+ },
115
131
  WORKSPACE_SOURCE_ACCESS_FAILED: {
116
132
  why: ({ source, workspace }) => `Source "${source}" of Workspace "${workspace}" cannot reach its data with the credentials of the build. The deployed app would fail on its first read.`,
117
133
  fix: "Read `error.cause` for the response of the provider. For a GitHub Source, check that `repo` and `ref` exist and that the token of the build (`auth`, `VITEHUB_GITHUB_TOKEN`, or `gh auth token`) can read the repository. Then build again."
@@ -29,7 +29,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
29
29
  why: ({ message }) => message === void 0 ? "" : String(message)
30
30
  },
31
31
  INTERNAL_R0024: {
32
- fix: "Start the dev server with `vite dev`, or pass `--url <origin>` of a deployed app and set VITEHUB_CONSOLE_PRIVATE_KEY_<NAME> to a private key whose public key the app has in VITEHUB_CONSOLE_KEY_<NAME>.",
32
+ fix: "Start the dev server (`nuxt dev` or `vite dev`), or pass `--url <origin>` of a deployed app and set VITEHUB_CONSOLE_PRIVATE_KEY_<NAME> to a private key whose public key the app has in VITEHUB_CONSOLE_KEY_<NAME>.",
33
33
  why: ({ message }) => message === void 0 ? "" : String(message)
34
34
  },
35
35
  INTERNAL_R0023: {
@@ -145,7 +145,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
145
145
  fix: "Give a switch column `format: \"switch\"` and `switch: { operation, input }` with a registered operation name, or remove both."
146
146
  },
147
147
  INTERNAL_R0025: {
148
- fix: "Start `vite dev` in the project that you run the command from, or pass `--url` of that server.",
148
+ fix: "Start the dev server (`nuxt dev` or `vite dev`) in the project that you run the command from, or pass `--url` of that server.",
149
149
  why: ({ message }) => message === void 0 ? "" : String(message)
150
150
  },
151
151
  INTERNAL_R0026: {
@@ -166,7 +166,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
166
166
  },
167
167
  INTERNAL_R0002: {
168
168
  ...dynamicError,
169
- fix: "Stop using the feature that the message names, or set `host` in `vitehub()` to a host that provides it. For Blob, you can also set `blob: { driver: \"s3\" }` with a remote store."
169
+ fix: ({ fix }) => fix ?? "Build for a host that provides this capability, or set the option named in the message to `false`."
170
170
  },
171
171
  INTERNAL_R0004: {
172
172
  ...dynamicError,
@@ -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-jo5QgE1w.js";
2
+ import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config--ZzAvhMp.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,10 @@
1
- import { s as workspaceError } from "./path-CuYE8-X6.js";
1
+ import { o as workspaceError } from "./internal/path.js";
2
2
  // src/core/file-metadata.ts
3
+ function assertPublicFileMetadata(path, metadata) {
4
+ metadata = copyJsonFileMetadata(path, metadata);
5
+ if (metadata && Object.hasOwn(metadata, "source")) throw workspaceError(`[vitehub] Invalid Workspace metadata for ${path}. metadata.source is reserved for Source materialization.`);
6
+ return metadata;
7
+ }
3
8
  function invalidMetadata(path) {
4
9
  return workspaceError(`[vitehub] Invalid Workspace metadata for ${path}. Metadata must contain only JSON-safe plain objects, dense arrays, strings, booleans, null, and finite numbers other than negative zero.`);
5
10
  }
@@ -57,4 +62,4 @@ function copyJsonFileMetadata(path, metadata, normalizeOptional = false) {
57
62
  if (source && typeof source.value !== "string") throw workspaceError(`[vitehub] Invalid Workspace metadata for ${path}. metadata.source must be a string when provided.`);
58
63
  return copy;
59
64
  }
60
- export { copyJsonWorkspaceMetadata as n, copyJsonFileMetadata as t };
65
+ export { copyJsonFileMetadata as n, copyJsonWorkspaceMetadata as r, assertPublicFileMetadata as t };
@@ -1,5 +1,5 @@
1
- import { l as normalizeWorkspacePath, o as isWorkspaceBytes, s as matchesAny } from "./path-Bb9OIc_F.js";
2
- import { f as prepareWorkspaceSource, n as createSourceContext } from "./config-jo5QgE1w.js";
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--ZzAvhMp.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
@@ -1,12 +1,12 @@
1
- import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, o as ReadonlyWorkspaceFs, s as UseWorkspaceOptions, u as WorkspaceHistory, v as WritableWorkspaceFs, x as useWorkspaceFiles } from "./use-CpphIBof.js";
2
- import { $ as WorkspaceHistoryDiffOptions, $t as WorkspaceSourceDefinition, A as WorkspaceAuthor, An as WorkspaceStreamFile, At as WorkspaceOptions, B as WorkspaceDiffEntry, Bn as WorkspaceWriteOperation, Bt as WorkspaceScopeName, C as SourceContextWorkspaceFiles, Cn as WorkspaceSourceSyncResult, Ct as WorkspaceMergeConflict, D as WorkspaceAssetPath, Dn as WorkspaceStoreHistory, Dt as WorkspaceName, E as Workspace, En as WorkspaceStore, Et as WorkspaceMergeResolution, F as WorkspaceContentStream, Fn as WorkspaceWriteCommit, Ft as WorkspaceRetainedHistory, G as WorkspaceFileSourceInput, Gt as WorkspaceSessionHost, H as WorkspaceFetchSourceInput, Hn as WorkspaceWriteValidatorResult, Ht as WorkspaceSearchQuery, I as WorkspaceCustomSourceInput, In as WorkspaceWriteErrorHook, It as WorkspaceRevision, J as WorkspaceHistoryChanges, Jt as WorkspaceSessionOptions, K as WorkspaceGitHubSourceInput, Kt as WorkspaceSessionHostFileEntry, L as WorkspaceDefinition, Ln as WorkspaceWriteHook, Lt as WorkspaceRevisionView, M as WorkspaceCacheOptions, Mn as WorkspaceSyncResultDetails, Mt as WorkspacePrepareSessionProgressEvent, N as WorkspaceCapabilities, Nn as WorkspaceSyncSnapshotOptions, Nt as WorkspacePullRequest, O as WorkspaceAssets, On as WorkspaceStoreHistoryCommitOptions, Ot as WorkspaceNameMap, P as WorkspaceContent, Pn as WorkspaceValidateMode, Pt as WorkspaceRebaseOptions, Q as WorkspaceHistoryDeleteRefOptions, Qt as WorkspaceSourceBindingInput, R as WorkspaceDefinitionInput, Rn as WorkspaceWriteInput, Rt as WorkspaceRule, S as SourceContext, Sn as WorkspaceSourceSyncPolicy, St as WorkspaceMergeCommit, T as VercelBlobWorkspaceStoreOptions, Tn as WorkspaceStat, Tt as WorkspaceMergeOptions, U as WorkspaceFetchSourceRequestOptions, Un as WriteFileOptions, Ut as WorkspaceSelectedScope, V as WorkspaceEntry, Vn as WorkspaceWriteValidator, Vt as WorkspaceSearchHit, W as WorkspaceFile, Wt as WorkspaceSession, X as WorkspaceHistoryCommitBase, Xt as WorkspaceSnapshot, Y as WorkspaceHistoryChangesCommitOptions, Yt as WorkspaceSessionWriteFileOptions, Z as WorkspaceHistoryCommitOptions, Zt as WorkspaceSource, _ as ReadFileResult, _n as WorkspaceSourceResolver, _t as WorkspaceMaterializeMode, a as GitHubWorkspaceOption, an as WorkspaceSourceMount, at as WorkspaceHistoryListResult, b as RmOptions, bn as WorkspaceSourceSyncCounts, bt as WorkspaceMaterializeSourcesResult, c as GlobOptions, cn as WorkspaceSourceRequestExecutionInput, ct as WorkspaceHistoryRefOptions, d as LocalWorkspaceStoreOptions, dn as WorkspaceSourceRequestMethod, dt as WorkspaceInstructionBinding, en as WorkspaceSourceInput, et as WorkspaceHistoryExtensions, f as Logger, fn as WorkspaceSourceResolutionContext, ft as WorkspaceInstructionBindingValue, g as ReadFileOptions, gn as WorkspaceSourceResolutionResult, gt as WorkspaceLookupName, h as MkdirOptions, hn as WorkspaceSourceResolutionInvocation, ht as WorkspaceLoaderSource, i as ExecResult, in as WorkspaceSourceMaterializationStatus, it as WorkspaceHistoryListOptions, j as WorkspaceAutoCommitPlan, jn as WorkspaceSyncOptions, jt as WorkspacePlugin, k as WorkspaceAssetsRegistry, kn as WorkspaceStoreOptions, kt as WorkspaceOpenPullRequestOptions, l as ListOptions, ln as WorkspaceSourceRequestExecutionResult, lt as WorkspaceHookContext, m as MemoryWorkspaceStoreOptions, mn as WorkspaceSourceResolutionContextValueReader, mt as WorkspaceLoader, n as DiffOptions, nn as WorkspaceSourceMaterializationCounts, nt as WorkspaceHistoryFileInput, o as GitHubWorkspaceRefs, on as WorkspaceSourceMountOptions, ot as WorkspaceHistoryReader, p as MaybePromise, pn as WorkspaceSourceResolutionContextMap, pt as WorkspaceLastChange, q as WorkspaceGlobSourceInput, qt as WorkspaceSessionHostFiles, r as ExecOptions, rn as WorkspaceSourceMaterializationPathResult, rt as WorkspaceHistoryFilesCommitOptions, s as GitHubWorkspaceStoreOptions, sn as WorkspaceSourceRequestDescriptor, st as WorkspaceHistoryRef, t as CloudflareArtifactsWorkspaceStoreOptions, tn as WorkspaceSourceItem, tt as WorkspaceHistoryFile, u as LoaderContext, un as WorkspaceSourceRequestExecutor, ut as WorkspaceHooks, v as ResolvedWorkspaceModuleOptions, vn as WorkspaceSourceSelection, vt as WorkspaceMaterializeSourcesOptions, w as ValidatedWorkspaceName, wn as WorkspaceSourceSyncStatus, wt as WorkspaceMergeConflictContext, x as SnapshotOptions, xn as WorkspaceSourceSyncPathResult, xt as WorkspaceMcpResourcesSourceInput, y as ResolvedWorkspaceRule, yn as WorkspaceSourceSyncConfig, yt as WorkspaceMaterializeSourcesProgressEvent, z as WorkspaceDiff, zn as WorkspaceWriteMode, zt as WorkspaceRules } from "./types-Bel5IDmF.js";
3
- import { n as isWorkspaceConflict } from "./errors-CnFDXxeJ.js";
4
- import { t as isWorkspaceName } from "./registry-s2Ob9PeX.js";
1
+ import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, o as ReadonlyWorkspaceFs, s as UseWorkspaceOptions, u as WorkspaceHistory, v as WritableWorkspaceFs, x as useWorkspaceFiles } from "./use-CJ5rdIrW.js";
2
+ import { $ as WorkspaceHistoryDiffOptions, $t as WorkspaceSourceDefinition, A as WorkspaceAuthor, An as WorkspaceStreamFile, At as WorkspaceOptions, B as WorkspaceDiffEntry, Bn as WorkspaceWriteOperation, Bt as WorkspaceScopeName, C as SourceContextWorkspaceFiles, Cn as WorkspaceSourceSyncResult, Ct as WorkspaceMergeConflict, D as WorkspaceAssetPath, Dn as WorkspaceStoreHistory, Dt as WorkspaceName, E as Workspace, En as WorkspaceStore, Et as WorkspaceMergeResolution, F as WorkspaceContentStream, Fn as WorkspaceWriteCommit, Ft as WorkspaceRetainedHistory, G as WorkspaceFileSourceInput, Gt as WorkspaceSessionHost, H as WorkspaceFetchSourceInput, Hn as WorkspaceWriteValidatorResult, Ht as WorkspaceSearchQuery, I as WorkspaceCustomSourceInput, In as WorkspaceWriteErrorHook, It as WorkspaceRevision, J as WorkspaceHistoryChanges, Jt as WorkspaceSessionOptions, K as WorkspaceGitHubSourceInput, Kt as WorkspaceSessionHostFileEntry, L as WorkspaceDefinition, Ln as WorkspaceWriteHook, Lt as WorkspaceRevisionView, M as WorkspaceCacheOptions, Mn as WorkspaceSyncResultDetails, Mt as WorkspacePrepareSessionProgressEvent, N as WorkspaceCapabilities, Nn as WorkspaceSyncSnapshotOptions, Nt as WorkspacePullRequest, O as WorkspaceAssets, On as WorkspaceStoreHistoryCommitOptions, Ot as WorkspaceNameMap, P as WorkspaceContent, Pn as WorkspaceValidateMode, Pt as WorkspaceRebaseOptions, Q as WorkspaceHistoryDeleteRefOptions, Qt as WorkspaceSourceBindingInput, R as WorkspaceDefinitionInput, Rn as WorkspaceWriteInput, Rt as WorkspaceRule, S as SourceContext, Sn as WorkspaceSourceSyncPolicy, St as WorkspaceMergeCommit, T as VercelBlobWorkspaceStoreOptions, Tn as WorkspaceStat, Tt as WorkspaceMergeOptions, U as WorkspaceFetchSourceRequestOptions, Un as WriteFileOptions, Ut as WorkspaceSelectedScope, V as WorkspaceEntry, Vn as WorkspaceWriteValidator, Vt as WorkspaceSearchHit, W as WorkspaceFile, Wt as WorkspaceSession, X as WorkspaceHistoryCommitBase, Xt as WorkspaceSnapshot, Y as WorkspaceHistoryChangesCommitOptions, Yt as WorkspaceSessionWriteFileOptions, Z as WorkspaceHistoryCommitOptions, Zt as WorkspaceSource, _ as ReadFileResult, _n as WorkspaceSourceResolver, _t as WorkspaceMaterializeMode, a as GitHubWorkspaceOption, an as WorkspaceSourceMount, at as WorkspaceHistoryListResult, b as RmOptions, bn as WorkspaceSourceSyncCounts, bt as WorkspaceMaterializeSourcesResult, c as GlobOptions, cn as WorkspaceSourceRequestExecutionInput, ct as WorkspaceHistoryRefOptions, d as LocalWorkspaceStoreOptions, dn as WorkspaceSourceRequestMethod, dt as WorkspaceInstructionBinding, en as WorkspaceSourceInput, et as WorkspaceHistoryExtensions, f as Logger, fn as WorkspaceSourceResolutionContext, ft as WorkspaceInstructionBindingValue, g as ReadFileOptions, gn as WorkspaceSourceResolutionResult, gt as WorkspaceLookupName, h as MkdirOptions, hn as WorkspaceSourceResolutionInvocation, ht as WorkspaceLoaderSource, i as ExecResult, in as WorkspaceSourceMaterializationStatus, it as WorkspaceHistoryListOptions, j as WorkspaceAutoCommitPlan, jn as WorkspaceSyncOptions, jt as WorkspacePlugin, k as WorkspaceAssetsRegistry, kn as WorkspaceStoreOptions, kt as WorkspaceOpenPullRequestOptions, l as ListOptions, ln as WorkspaceSourceRequestExecutionResult, lt as WorkspaceHookContext, m as MemoryWorkspaceStoreOptions, mn as WorkspaceSourceResolutionContextValueReader, mt as WorkspaceLoader, n as DiffOptions, nn as WorkspaceSourceMaterializationCounts, nt as WorkspaceHistoryFileInput, o as GitHubWorkspaceRefs, on as WorkspaceSourceMountOptions, ot as WorkspaceHistoryReader, p as MaybePromise, pn as WorkspaceSourceResolutionContextMap, pt as WorkspaceLastChange, q as WorkspaceGlobSourceInput, qt as WorkspaceSessionHostFiles, r as ExecOptions, rn as WorkspaceSourceMaterializationPathResult, rt as WorkspaceHistoryFilesCommitOptions, s as GitHubWorkspaceStoreOptions, sn as WorkspaceSourceRequestDescriptor, st as WorkspaceHistoryRef, t as CloudflareArtifactsWorkspaceStoreOptions, tn as WorkspaceSourceItem, tt as WorkspaceHistoryFile, u as LoaderContext, un as WorkspaceSourceRequestExecutor, ut as WorkspaceHooks, v as ResolvedWorkspaceModuleOptions, vn as WorkspaceSourceSelection, vt as WorkspaceMaterializeSourcesOptions, w as ValidatedWorkspaceName, wn as WorkspaceSourceSyncStatus, wt as WorkspaceMergeConflictContext, x as SnapshotOptions, xn as WorkspaceSourceSyncPathResult, xt as WorkspaceMcpResourcesSourceInput, y as ResolvedWorkspaceRule, yn as WorkspaceSourceSyncConfig, yt as WorkspaceMaterializeSourcesProgressEvent, z as WorkspaceDiff, zn as WorkspaceWriteMode, zt as WorkspaceRules } from "./types-BnSUug2v.js";
3
+ import { r as isWorkspaceConflict, t as registerWorkspacePlugin } from "./plugins-BYxsPDBH.js";
4
+ import { t as isWorkspaceName } from "./registry-hnARUKNF.js";
5
5
  import { n as normalizeSafeWorkspacePath } from "./path-C0uZxDdW.js";
6
- import { t as registerWorkspacePlugin } from "./plugins-CLc32jvL.js";
7
6
  interface WorkspaceStoreTarget {
8
7
  provider: string;
9
8
  containsPath?(ancestor: string, path: string): Promise<boolean>;
9
+ hasFileDescendants?(path: string): Promise<boolean>;
10
10
  }
11
11
  export declare function resolveWorkspaceStoreTarget(source: unknown): Promise<WorkspaceStoreTarget | undefined>;
12
12
  /**
package/dist/files.js CHANGED
@@ -1,7 +1,7 @@
1
- import { r as useWorkspaceFiles } from "./use-D0DyTMxM.js";
2
- import { r as isWorkspaceConflict, t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
3
- import { t as isWorkspaceName } from "./registry-BbUg9vJB.js";
4
- import { r as registerWorkspacePlugin } from "./rules-BPDXypZV.js";
1
+ import { r as useWorkspaceFiles } from "./use-BCMkT-kC.js";
2
+ import { n as isWorkspaceConflict, normalizeSafeWorkspacePath } from "./internal/path.js";
3
+ import { t as isWorkspaceName } from "./registry-CFeUQsja.js";
4
+ import { r as registerWorkspacePlugin } from "./rules-DYQCKYdt.js";
5
5
  import { o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
6
- import { E as registerWorkspaceKV, w as readGitHubReadStats } from "./shared-C20Wh1mp.js";
6
+ import { E as registerWorkspaceKV, w as readGitHubReadStats } from "./shared-PFnkYidS.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-C20Wh1mp.js";
3
- import { s as matchesAny } from "./path-Bb9OIc_F.js";
4
- import { d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, p as resolveGitHubIgnore } from "./config-jo5QgE1w.js";
5
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
2
+ import { M as readForgeEnv, h as readGitHubEnvToken, j as forgeEnv } from "./shared-PFnkYidS.js";
3
+ import { s as matchesAny } from "./path-DYHw5KNk.js";
4
+ import { d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, p as resolveGitHubIgnore } from "./config--ZzAvhMp.js";
5
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
6
6
  import { github } from "@vite-hub/source";
7
7
  // src/env.ts
8
8
  let viteLoadEnv;
@@ -1,5 +1,5 @@
1
- import { t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
2
- import { l as normalizeWorkspacePath } from "./path-Bb9OIc_F.js";
1
+ import { normalizeSafeWorkspacePath } from "./internal/path.js";
2
+ import { l as normalizeWorkspacePath } from "./path-DYHw5KNk.js";
3
3
  import { Minimatch } from "minimatch";
4
4
  // src/core/glob.ts
5
5
  function createWorkspaceGlobMatcher(pattern, options = {}) {
@@ -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-jo5QgE1w.js";
2
+ import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config--ZzAvhMp.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
- import { a as workspaceConflict, s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
3
- import { a as isExcludedWorkspacePath, d as sha256, i as decodeFile, l as normalizeWorkspacePath, r as contentToBytes, s as matchesAny } from "./path-Bb9OIc_F.js";
4
- import { n as createSnapshotFromEntries, r as diffSnapshots } from "./utils-DXP9xfXo.js";
5
- import { C as isMissingWorkspacePathError, S as filterSessionEntries, b as assertPathInSessionScope, w as scopedSearchQuery, x as filterSessionDiff, y as assertDiffInsideSessionPaths } from "./workspace-CLuPkyZR.js";
2
+ import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
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-D1m00MCM.js";
6
6
  import { r as resolveWorkspaceRevisionMaterializer } from "./vitehub-grants-Co713QTg.js";
7
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
7
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
8
8
  import { normalizeExecutionAuthority } from "@vite-hub/runtime";
9
9
  import { posix } from "node:path";
10
10
  import { randomUUID } from "node:crypto";
@@ -949,7 +949,7 @@ async function createHostedWorkspaceSession(workspace, options) {
949
949
  resolveHostInspectionConcurrency(host);
950
950
  resolveHostMaterializationConcurrency(host);
951
951
  if (options.attach && options.disposableTarget) throw workspaceError("[vitehub] Workspace Session attach and disposableTarget cannot be combined.");
952
- const root = normalizeTarget(options.target);
952
+ const root = normalizeTarget(options.target ?? host.workspaceTarget);
953
953
  const sessionPaths = normalizeSessionPaths(options);
954
954
  const excludedWriteBackPaths = [...defaultExcludedSessionPaths, ...(options.writeBack && options.writeBack.exclude || []).map((path) => normalizeSafeWorkspacePath(path, { allowReserved: true }))];
955
955
  let closed = false;
@@ -1049,7 +1049,7 @@ async function createHostedWorkspaceSession(workspace, options) {
1049
1049
  },
1050
1050
  async search(query) {
1051
1051
  assertOpen();
1052
- const { searchText } = await import("./search-C_nVorq7.js").then((n) => n.n);
1052
+ const { searchText } = await import("./search-CG6UNOtn.js").then((n) => n.n);
1053
1053
  const scoped = scopedSearchQuery(query, sessionPaths, normalizeSearchRoot);
1054
1054
  if (!scoped) return [];
1055
1055
  const scopedSearchRoots = [...new Set((scoped.paths?.length ? scoped.paths : [scoped.cwd || ""]).map(normalizeSearchRoot))].filter(Boolean);
@@ -1,4 +1,4 @@
1
- import { T as VercelBlobWorkspaceStoreOptions, v as ResolvedWorkspaceModuleOptions } from "./types-Bel5IDmF.js";
1
+ import { T as VercelBlobWorkspaceStoreOptions, v as ResolvedWorkspaceModuleOptions } from "./types-BnSUug2v.js";
2
2
  export interface HostedVercelBlobWorkspaceRuntimeOptions {
3
3
  assets?: boolean | string[];
4
4
  env?: Record<string, string | undefined>;