@vite-hub/workspace 0.0.4 → 0.3.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 (137) hide show
  1. package/README.md +339 -115
  2. package/dist/abort-BCwpdrN0.js +32 -0
  3. package/dist/{asset-registry-8QI3ML3K.js → asset-registry-DfBV5kmw.js} +3 -2
  4. package/dist/blob-database.d.ts +474 -0
  5. package/dist/blob-database.js +608 -0
  6. package/dist/checkout.d.ts +128 -0
  7. package/dist/checkout.js +849 -0
  8. package/dist/cloudflare.d.ts +6 -7
  9. package/dist/cloudflare.js +1 -1
  10. package/dist/config-B-863EgC.js +15 -0
  11. package/dist/config-BAgL2dtB.js +1076 -0
  12. package/dist/{config-DE9xlaIw.d.ts → config-BQKcPawI.d.ts} +1 -2
  13. package/dist/discard-CNNtCozM.js +8 -0
  14. package/dist/durability.d.ts +22 -0
  15. package/dist/durability.js +70 -0
  16. package/dist/error-diagnostics-CtKjGtGb.js +188 -0
  17. package/dist/error-diagnostics-DSkCJC_L.js +266 -0
  18. package/dist/file-2pFYNtsU.js +22 -0
  19. package/dist/{files-Q6xZjDHA.js → files-BOo4SbwE.js} +3 -3
  20. package/dist/files.d.ts +38 -0
  21. package/dist/files.js +6 -0
  22. package/dist/{github-DHnjxQIX.js → github-CrYp4v8k.js} +44 -24
  23. package/dist/glob-B8YGvTrZ.js +21 -0
  24. package/dist/glob-Cjxms1t7.js +30 -0
  25. package/dist/{host-DJH8cuoU.js → host-BFBpXn0N.js} +144 -77
  26. package/dist/{hosted-RPeJOCFz.js → hosted-KcUR_jPv.js} +303 -97
  27. package/dist/hosted-vercel-blob-B3-wRdUm.js +410 -0
  28. package/dist/hosted-vercel-blob.d.ts +6 -7
  29. package/dist/hosted-vercel-blob.js +1 -1
  30. package/dist/hosted.d.ts +10 -9
  31. package/dist/hosted.js +2 -2
  32. package/dist/index.d.ts +26 -47
  33. package/dist/index.js +30 -100
  34. package/dist/internal/path.d.ts +2 -0
  35. package/dist/internal/path.js +2 -0
  36. package/dist/lifecycle-B-enk_4A.js +596 -0
  37. package/dist/lineage.d.ts +26 -0
  38. package/dist/lineage.js +76 -0
  39. package/dist/loader.d.ts +5 -6
  40. package/dist/loader.js +3 -2
  41. package/dist/mcp-resources-DF0F5rcL.js +39 -0
  42. package/dist/memory-BOexthyW.js +247 -0
  43. package/dist/metadata-target-CWz6KHKq.js +1589 -0
  44. package/dist/object-Da1zyPCR.js +11 -0
  45. package/dist/operation-definition-8gOe-ubD.d.ts +234 -0
  46. package/dist/operations-C6FpR8Rr.js +389 -0
  47. package/dist/operations-CE2drFih.js +1234 -0
  48. package/dist/operations.d.ts +90 -0
  49. package/dist/operations.js +3 -0
  50. package/dist/path--wrT_Azm.js +113 -0
  51. package/dist/path-AxMho1wo.d.ts +7 -0
  52. package/dist/path-DrSIenjj.js +59 -0
  53. package/dist/path-zHxQUbqa.d.ts +9 -0
  54. package/dist/plugins-C8C0auoW.d.ts +10 -0
  55. package/dist/provider-9s4Ufkm5.js +1479 -0
  56. package/dist/providers/github/store.d.ts +3 -5
  57. package/dist/providers/github/store.js +1 -1
  58. package/dist/registry-B3BBm4Ts.d.ts +19 -0
  59. package/dist/{registry-D3yzt8HQ.js → registry-CNphafBx.js} +60 -23
  60. package/dist/registry-CYNN623b.d.ts +9 -0
  61. package/dist/request-scope-Dw5n8bMC.js +83 -0
  62. package/dist/results-DgkZUmTL.js +8 -0
  63. package/dist/{chunk-2rV9d50f.js → rolldown-runtime-rQ84J-ij.js} +3 -4
  64. package/dist/runtime/assets.d.ts +3 -5
  65. package/dist/runtime/assets.js +7 -6
  66. package/dist/runtime/empty-assets-registry.d.ts +1 -2
  67. package/dist/runtime/empty-registry.d.ts +2 -2
  68. package/dist/runtime/registry.d.ts +2 -0
  69. package/dist/runtime/registry.js +23 -0
  70. package/dist/runtime/request.d.ts +4 -0
  71. package/dist/runtime/request.js +8 -0
  72. package/dist/runtime/state.d.ts +5 -4
  73. package/dist/runtime/state.js +8 -18
  74. package/dist/runtime/workspace.d.ts +1 -1
  75. package/dist/runtime/workspace.js +1 -1
  76. package/dist/runtime.d.ts +52 -17
  77. package/dist/runtime.js +324 -67
  78. package/dist/{search-BpiCF2Tw.js → search-C_RfoM2j.js} +10 -9
  79. package/dist/server-8tGltlGz.js +303 -0
  80. package/dist/server.d.ts +36 -39
  81. package/dist/server.js +2 -328
  82. package/dist/shared-B3_EUk89.js +848 -0
  83. package/dist/source-metadata.d.ts +10 -7
  84. package/dist/source-metadata.js +12 -12
  85. package/dist/state-BISnUf1s.d.ts +35 -0
  86. package/dist/{ai-BqCC8BpY.js → state-DbrW-njQ.js} +237 -114
  87. package/dist/store-ybhyD38Z.js +1873 -0
  88. package/dist/{sync-DnTQwt8r.js → sync-CCD_VYC8.js} +61 -41
  89. package/dist/target-jWhTdIuF.js +89 -0
  90. package/dist/test.d.ts +1 -1
  91. package/dist/test.js +1 -1
  92. package/dist/{types-CYuwjJ4V.d.ts → types-BbtwmBZ5.d.ts} +321 -35
  93. package/dist/use-C6lV3-wC.d.ts +321 -0
  94. package/dist/{use-BTNDR5Rd.js → use-CSpT5W87.js} +141 -107
  95. package/dist/utils-CgMZCHsX.js +616 -0
  96. package/dist/vite.d.ts +585 -2
  97. package/dist/vite.js +21369 -2
  98. package/dist/workspace-CYB2xZ1T.d.ts +7 -0
  99. package/dist/{workspace-Dq08Yn72.js → workspace-sPWn2Jxj.js} +441 -225
  100. package/package.json +97 -72
  101. package/dist/ai-CjxvGqM0.d.ts +0 -162
  102. package/dist/ai.d.ts +0 -3
  103. package/dist/ai.js +0 -2
  104. package/dist/collections/client.d.ts +0 -39
  105. package/dist/collections/client.js +0 -137
  106. package/dist/collections.d.ts +0 -59
  107. package/dist/collections.js +0 -159
  108. package/dist/config-Bc3c4Su1.js +0 -7904
  109. package/dist/config-CHLLWklZ.js +0 -36
  110. package/dist/file-Bc1X7pco.js +0 -23
  111. package/dist/glob-CEZKeZFC.js +0 -18
  112. package/dist/hosted-vercel-blob-d6C8ND5j.js +0 -23580
  113. package/dist/lifecycle-LrL3sA4n.js +0 -316
  114. package/dist/metadata-target-B0tOmVW7.js +0 -717
  115. package/dist/mountx.d.ts +0 -10
  116. package/dist/mountx.js +0 -143
  117. package/dist/nitro.d.ts +0 -2
  118. package/dist/nitro.js +0 -2
  119. package/dist/nuxt.d.ts +0 -26
  120. package/dist/nuxt.js +0 -42
  121. package/dist/path-Cp59koVz.js +0 -139
  122. package/dist/provider-B1yLjCJJ.js +0 -746
  123. package/dist/publish.d.ts +0 -35
  124. package/dist/publish.js +0 -112
  125. package/dist/registry-Uj6IVxes.d.ts +0 -11
  126. package/dist/request-execution-B-dSFlGB.js +0 -84
  127. package/dist/runtime-options-BsPSv5O7.js +0 -13
  128. package/dist/runtime-type-iEE6BjQJ.js +0 -34
  129. package/dist/shared-DTR1Hhma.js +0 -331
  130. package/dist/state-tYcRWEh2.d.ts +0 -26
  131. package/dist/store-Dt_Jyys3.js +0 -608
  132. package/dist/target-D4Bqb1eH.js +0 -11
  133. package/dist/token-CVzURBxC.js +0 -61
  134. package/dist/use-BiHzt0xA.d.ts +0 -103
  135. package/dist/vite-BptCrpv2.js +0 -4526
  136. package/dist/vite-CtA9guIM.d.ts +0 -66
  137. package/dist/workspace-Xddf4G1B.d.ts +0 -6
@@ -1,6 +1,4 @@
1
- import { $t as WorkspaceStore, o as GitHubWorkspaceStoreOptions } from "../../types-CYuwjJ4V.js";
2
-
1
+ import { s as GitHubWorkspaceStoreOptions, xn as WorkspaceStore } from "../../types-BbtwmBZ5.js";
3
2
  //#region src/providers/github/store.d.ts
4
- declare function createGitHubWorkspaceStore(options: GitHubWorkspaceStoreOptions, workspaceName: string): WorkspaceStore;
5
- //#endregion
6
- export { createGitHubWorkspaceStore };
3
+ export declare function createGitHubWorkspaceStore(options: GitHubWorkspaceStoreOptions, workspaceName: string): WorkspaceStore;
4
+ //#endregion
@@ -1,2 +1,2 @@
1
- import { t as createGitHubWorkspaceStore } from "../../store-Dt_Jyys3.js";
1
+ import { t as createGitHubWorkspaceStore } from "../../store-ybhyD38Z.js";
2
2
  export { createGitHubWorkspaceStore };
@@ -0,0 +1,19 @@
1
+ import { L as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-BbtwmBZ5.js";
2
+ //#region src/runtime/config.d.ts
3
+ declare function setWorkspaceRuntimeConfig(config: false | ResolvedWorkspaceModuleOptions): void;
4
+ declare function getWorkspaceRuntimeConfig(): false | ResolvedWorkspaceModuleOptions;
5
+ //#endregion
6
+ //#region src/runtime/registry.d.ts
7
+ type WorkspaceRegistryModule = {
8
+ default?: WorkspaceDefinitionInput;
9
+ };
10
+ type WorkspaceRegistry = Record<string, () => Promise<WorkspaceRegistryModule>>;
11
+ interface WorkspaceRuntimeRegistryState {
12
+ loaders: WorkspaceRegistry;
13
+ version: number;
14
+ }
15
+ declare function workspaceRuntimeRegistryState(): Readonly<WorkspaceRuntimeRegistryState>;
16
+ declare function setWorkspaceRuntimeRegistry(registry: WorkspaceRegistry): void;
17
+ declare function resetWorkspaceRuntimeRegistry(): void;
18
+ //#endregion
19
+ export { workspaceRuntimeRegistryState as a, setWorkspaceRuntimeRegistry as i, WorkspaceRegistryModule as n, getWorkspaceRuntimeConfig as o, resetWorkspaceRuntimeRegistry as r, setWorkspaceRuntimeConfig as s, WorkspaceRegistry as t };
@@ -1,7 +1,8 @@
1
- import { v as workspaceNotFoundError } from "./path-Cp59koVz.js";
2
- import { t as hasRuntimeType } from "./runtime-type-iEE6BjQJ.js";
3
- import { t as createWorkspace } from "./workspace-Dq08Yn72.js";
4
- import runtimeRegistry from "#vitehub-workspace-registry";
1
+ import { c as workspaceNotFoundError } from "./path-DrSIenjj.js";
2
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CtKjGtGb.js";
3
+ import { t as createWorkspace } from "./workspace-sPWn2Jxj.js";
4
+ import { setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState } from "./runtime/registry.js";
5
+ import { getViteHubErrorShape, isRuntimeDiagnostic } from "@vite-hub/runtime";
5
6
  //#region src/core/registry.ts
6
7
  const workspaceRegistryStateKey = Symbol.for("vitehub.workspace.registryState");
7
8
  function workspaceRegistryState() {
@@ -10,23 +11,45 @@ function workspaceRegistryState() {
10
11
  loadingDefinitions: /* @__PURE__ */ new Map(),
11
12
  loadGenerations: /* @__PURE__ */ new Map(),
12
13
  loadedDefinitions: /* @__PURE__ */ new Map(),
13
- loaders: runtimeRegistry,
14
- registeredDefinitions: /* @__PURE__ */ new Map()
14
+ registeredDefinitions: /* @__PURE__ */ new Map(),
15
+ registryVersion: workspaceRuntimeRegistryState().version,
16
+ scopedDefinitions: /* @__PURE__ */ new Map()
15
17
  };
16
- scope[workspaceRegistryStateKey].loadingDefinitions ??= /* @__PURE__ */ new Map();
17
- scope[workspaceRegistryStateKey].loadGenerations ??= /* @__PURE__ */ new Map();
18
- return scope[workspaceRegistryStateKey];
18
+ const state = scope[workspaceRegistryStateKey];
19
+ state.loadingDefinitions ??= /* @__PURE__ */ new Map();
20
+ state.loadGenerations ??= /* @__PURE__ */ new Map();
21
+ state.scopedDefinitions ??= /* @__PURE__ */ new Map();
22
+ const { version } = workspaceRuntimeRegistryState();
23
+ if (state.registryVersion !== version) {
24
+ invalidateWorkspaceLoads(state);
25
+ state.loadedDefinitions.clear();
26
+ state.registryVersion = version;
27
+ }
28
+ return state;
19
29
  }
20
30
  function pickWorkspaceFields(definition) {
21
31
  const { __vitehubWorkspaceAgent: _agent, __vitehubWorkspaceAgentOptions: _agentOptions, description: _description, fallback: _fallback, instructions: _instructions, model: _model, name: _agentName, resolve: _resolve, run: _run, stepLimit: _stepLimit, workspace: _workspace, ...workspace } = definition;
22
32
  return workspace;
23
33
  }
34
+ /**
35
+ * The error for a failed loader of the generated Workspace registry. The registry runs plain source text without the
36
+ * Workspace catalog, so its own failures and the errors of the Definition module get a code here. A coded error passes.
37
+ */
38
+ function workspaceRegistryLoadError(workspace, error) {
39
+ if (isRuntimeDiagnostic(error) || getViteHubErrorShape(error)) return error;
40
+ const reason = error instanceof Error ? error.message : String(error);
41
+ return workspaceErrorDiagnostics.WORKSPACE_REGISTRY_LOAD_FAILED({
42
+ reason,
43
+ workspace,
44
+ cause: error
45
+ });
46
+ }
24
47
  function normalizeWorkspaceDefinition(name, definition) {
25
48
  if (!definition) throw workspaceNotFoundError(name);
26
49
  const workspaceAgentOptions = definition.__vitehubWorkspaceAgentOptions;
27
50
  if (workspaceAgentOptions?.workspace) {
28
51
  const injectedWorkspace = pickWorkspaceFields(definition);
29
- const configuredWorkspace = hasRuntimeType(workspaceAgentOptions.workspace, "string") ? {} : workspaceAgentOptions.workspace;
52
+ const configuredWorkspace = typeof workspaceAgentOptions.workspace === "string" ? {} : workspaceAgentOptions.workspace;
30
53
  const sources = mergeWorkspaceSources(injectedWorkspace.sources, configuredWorkspace.sources);
31
54
  const normalizedWorkspace = {
32
55
  ...injectedWorkspace,
@@ -38,7 +61,7 @@ function normalizeWorkspaceDefinition(name, definition) {
38
61
  if (sources) normalizedWorkspace.sources = sources;
39
62
  return normalizedWorkspace;
40
63
  }
41
- if ("name" in definition) throw new TypeError(`[vitehub] Workspace definition "${name}" must not declare a name. Workspace names are inferred from filenames.`);
64
+ if ("name" in definition) throw workspaceErrorDiagnostics.WORKSPACE_R0021({ message: `[vitehub] Workspace definition "${name}" must not declare a name. Workspace names are inferred from filenames.` });
42
65
  return {
43
66
  ...pickWorkspaceFields(definition),
44
67
  name
@@ -52,16 +75,21 @@ function mergeWorkspaceSources(injected, configured) {
52
75
  };
53
76
  }
54
77
  function registerWorkspace(name, definition) {
55
- if (!name || !hasRuntimeType(name, "string")) throw new TypeError("[vitehub] registerWorkspace requires a string name.");
78
+ if (!name || typeof name !== "string") throw workspaceErrorDiagnostics.WORKSPACE_R0022({ message: "[vitehub] registerWorkspace requires a string name." });
56
79
  const registered = normalizeWorkspaceDefinition(name, definition);
57
80
  workspaceRegistryState().registeredDefinitions.set(name, registered);
58
81
  return registered;
59
82
  }
60
- function setWorkspaceRegistry(registry) {
83
+ /** Replace one generated catalog's definitions without replacing application registrations. */
84
+ function setWorkspaceRuntimeDefinitions(scope, definitions) {
85
+ const normalized = new Map(Object.entries(definitions).map(([name, definition]) => [name, normalizeWorkspaceDefinition(name, definition)]));
61
86
  const state = workspaceRegistryState();
62
- invalidateWorkspaceLoads(state);
63
- state.loaders = registry;
64
- state.loadedDefinitions.clear();
87
+ if (normalized.size) state.scopedDefinitions.set(scope, normalized);
88
+ else state.scopedDefinitions.delete(scope);
89
+ }
90
+ function setWorkspaceRegistry(registry) {
91
+ setWorkspaceRuntimeRegistry(registry);
92
+ workspaceRegistryState();
65
93
  }
66
94
  function invalidateWorkspaceLoads(state) {
67
95
  for (const [name, loading] of state.loadingDefinitions) if (state.loadGenerations.get(name) === loading.generation) state.loadGenerations.set(name, loading.generation + 1);
@@ -69,17 +97,25 @@ function invalidateWorkspaceLoads(state) {
69
97
  }
70
98
  async function resolveWorkspaceDefinition(name, abortSignal) {
71
99
  const state = workspaceRegistryState();
72
- const existing = state.registeredDefinitions.get(name) || state.loadedDefinitions.get(name);
100
+ const registered = state.registeredDefinitions.get(name);
101
+ if (registered) return registered;
102
+ for (const definitions of state.scopedDefinitions.values()) {
103
+ const definition = definitions.get(name);
104
+ if (definition) return definition;
105
+ }
106
+ const existing = state.loadedDefinitions.get(name);
73
107
  if (existing) return existing;
74
- const load = state.loaders[name];
108
+ const load = workspaceRuntimeRegistryState().loaders[name];
75
109
  if (!load) throw workspaceNotFoundError(name);
76
110
  let loading = state.loadingDefinitions.get(name);
77
111
  if (!loading || loading.load !== load) {
78
112
  const generation = (state.loadGenerations.get(name) ?? 0) + 1;
79
113
  state.loadGenerations.set(name, generation);
80
- const promise = load().then((mod) => {
114
+ const promise = (async () => load())().catch((error) => {
115
+ throw workspaceRegistryLoadError(name, error);
116
+ }).then((mod) => {
81
117
  const definition = normalizeWorkspaceDefinition(name, mod.default);
82
- if (state.loadGenerations.get(name) === generation && state.loaders[name] === load) state.loadedDefinitions.set(name, definition);
118
+ if (state.loadGenerations.get(name) === generation && workspaceRuntimeRegistryState().loaders[name] === load) state.loadedDefinitions.set(name, definition);
83
119
  return definition;
84
120
  });
85
121
  loading = {
@@ -120,8 +156,9 @@ async function resolveWorkspaceDefinition(name, abortSignal) {
120
156
  async function resolveRegisteredWorkspaceDefinition(name, abortSignal) {
121
157
  return resolveWorkspaceDefinition(name, abortSignal);
122
158
  }
123
- async function useRegisteredWorkspace(name) {
124
- return createWorkspace(await resolveWorkspaceDefinition(name));
159
+ async function useRegisteredWorkspace(name, options = {}) {
160
+ const definition = await resolveWorkspaceDefinition(name);
161
+ return createWorkspace(definition, options);
125
162
  }
126
163
  //#endregion
127
- export { useRegisteredWorkspace as a, setWorkspaceRegistry as i, registerWorkspace as n, resolveRegisteredWorkspaceDefinition as r, normalizeWorkspaceDefinition as t };
164
+ export { setWorkspaceRuntimeDefinitions as a, setWorkspaceRegistry as i, registerWorkspace as n, useRegisteredWorkspace as o, resolveRegisteredWorkspaceDefinition as r, workspaceRegistryLoadError as s, normalizeWorkspaceDefinition as t };
@@ -0,0 +1,9 @@
1
+ import { I as WorkspaceDefinition, L as WorkspaceDefinitionInput } from "./types-BbtwmBZ5.js";
2
+ import "./registry-B3BBm4Ts.js";
3
+ //#region src/core/registry.d.ts
4
+ declare function registerWorkspace(name: string, definition: WorkspaceDefinitionInput): WorkspaceDefinition;
5
+ /** Replace one generated catalog's definitions without replacing application registrations. */
6
+ declare function setWorkspaceRuntimeDefinitions(scope: string, definitions: Record<string, WorkspaceDefinitionInput>): void;
7
+ declare function resolveRegisteredWorkspaceDefinition(name: string, abortSignal?: AbortSignal): Promise<WorkspaceDefinition>;
8
+ //#endregion
9
+ export { resolveRegisteredWorkspaceDefinition as n, setWorkspaceRuntimeDefinitions as r, registerWorkspace as t };
@@ -0,0 +1,83 @@
1
+ import { t as workspaceStoreDiscard } from "./discard-CNNtCozM.js";
2
+ import { registerRunScope } from "@vite-hub/runtime/internal/run-scope";
3
+ //#region src/core/request-scope.ts
4
+ const runtimeGlobal = globalThis;
5
+ const storageKey = Symbol.for("vitehub.workspace.request");
6
+ const writersKey = Symbol.for("vitehub.workspace.writers");
7
+ /** Writes made outside a request and a run, such as at startup, which no request may drop. */
8
+ const outsideRequest = { staged: /* @__PURE__ */ new Set() };
9
+ function requestStorage() {
10
+ const existing = runtimeGlobal[storageKey];
11
+ if (existing) return existing;
12
+ const Storage = globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncLocalStorage;
13
+ if (!Storage) return;
14
+ const storage = new Storage();
15
+ runtimeGlobal[storageKey] = storage;
16
+ return storage;
17
+ }
18
+ /** The requests that staged writes in each Store since its last snapshot. */
19
+ function writers() {
20
+ return runtimeGlobal[writersKey] ??= /* @__PURE__ */ new WeakMap();
21
+ }
22
+ function isDiscardable(store) {
23
+ return typeof store[workspaceStoreDiscard] === "function";
24
+ }
25
+ const stagingMethods = [
26
+ "mkdir",
27
+ "rebase",
28
+ "removeEmptyDirectory",
29
+ "rm",
30
+ "setMeta",
31
+ "writeFile",
32
+ "writeFileConditional",
33
+ "writeFileStream"
34
+ ];
35
+ /**
36
+ * Records which request stages writes in a Store that keeps them until `snapshot()`, for every caller of the Store:
37
+ * Workspace methods, Source materialization, and sync. Other Stores write through and are returned as they are.
38
+ */
39
+ function trackStagedWrites(store) {
40
+ if (!isDiscardable(store)) return store;
41
+ for (const name of stagingMethods) {
42
+ const method = store[name];
43
+ if (typeof method !== "function") continue;
44
+ Reflect.set(store, name, (...args) => {
45
+ const request = requestStorage()?.getStore() ?? outsideRequest;
46
+ if (request !== outsideRequest) request.staged.add(store);
47
+ const staged = writers().get(store);
48
+ if (staged) staged.add(request);
49
+ else writers().set(store, /* @__PURE__ */ new Set([request]));
50
+ return Reflect.apply(method, store, args);
51
+ });
52
+ }
53
+ const snapshot = store.snapshot;
54
+ store.snapshot = async (options) => {
55
+ const result = await Reflect.apply(snapshot, store, [options]);
56
+ writers().delete(store);
57
+ return result;
58
+ };
59
+ return store;
60
+ }
61
+ /**
62
+ * Runs one request. When it throws, each Store that only this request staged writes in since its last snapshot drops
63
+ * them, so a later snapshot cannot commit them. Facades that hold the Store see the same branch as a new request.
64
+ */
65
+ async function runWorkspaceRequest(next) {
66
+ const storage = requestStorage();
67
+ if (!storage) return await next();
68
+ const request = { staged: /* @__PURE__ */ new Set() };
69
+ try {
70
+ return await storage.run(request, next);
71
+ } catch (error) {
72
+ for (const store of request.staged) {
73
+ const staged = writers().get(store);
74
+ if (staged?.size !== 1 || !staged.has(request) || !isDiscardable(store)) continue;
75
+ writers().delete(store);
76
+ await store[workspaceStoreDiscard]();
77
+ }
78
+ throw error;
79
+ }
80
+ }
81
+ registerRunScope(runWorkspaceRequest);
82
+ //#endregion
83
+ export { trackStagedWrites as n, runWorkspaceRequest as t };
@@ -0,0 +1,8 @@
1
+ //#region src/results.ts
2
+ /**
3
+ * The largest `workspace.commit` request body: 4 MiB of JSON, with base64 for binary files. Vercel Functions accept
4
+ * request bodies up to 4.5 MB and Cloudflare Workers up to 100 MB, so one push works on every host.
5
+ */
6
+ const workspaceCommitRequestBytes = 4194304;
7
+ //#endregion
8
+ export { workspaceCommitRequestBytes as t };
@@ -1,4 +1,4 @@
1
- import { createRequire } from "node:module";
1
+ import "node:module";
2
2
  //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -26,10 +26,9 @@ var __copyProps = (to, from, except, desc) => {
26
26
  }
27
27
  return to;
28
28
  };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
30
30
  value: mod,
31
31
  enumerable: true
32
32
  }) : target, mod));
33
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
34
33
  //#endregion
35
- export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
34
+ export { __exportAll as n, __toESM as r, __commonJSMin as t };
@@ -1,5 +1,4 @@
1
- import { D as WorkspaceAssets, M as WorkspaceContent } from "../types-CYuwjJ4V.js";
2
-
1
+ import { D as WorkspaceAssets, N as WorkspaceContent } from "../types-BbtwmBZ5.js";
3
2
  //#region src/runtime/assets.d.ts
4
3
  interface WorkspaceAssetFile {
5
4
  load: () => Promise<WorkspaceContent>;
@@ -7,6 +6,5 @@ interface WorkspaceAssetFile {
7
6
  metadata?: Record<string, unknown>;
8
7
  }
9
8
  type WorkspaceAssetFiles<TKey extends string = string> = Record<TKey, WorkspaceAssetFile>;
10
- declare function createWorkspaceAssets<TKey extends string = string>(files: WorkspaceAssetFiles<TKey>): WorkspaceAssets<TKey>;
11
- //#endregion
12
- export { createWorkspaceAssets };
9
+ export declare function createWorkspaceAssets<TKey extends string = string>(files: WorkspaceAssetFiles<TKey>): WorkspaceAssets<TKey>;
10
+ //#endregion
@@ -1,5 +1,7 @@
1
- import { _ as workspaceError, a as isExcludedWorkspacePath, f as sha256, h as isWorkspaceError, i as decodeFile, l as normalizeWorkspacePath, o as matchesAny, s as normalizeSafeWorkspacePath } from "../path-Cp59koVz.js";
2
- import { t as searchText } from "../search-BpiCF2Tw.js";
1
+ import { i as isWorkspaceError, s as workspaceError, t as normalizeSafeWorkspacePath } from "../path-DrSIenjj.js";
2
+ import { a as isExcludedWorkspacePath, f as sha256, i as decodeFile, l as normalizeWorkspacePath } from "../path--wrT_Azm.js";
3
+ import { t as createWorkspaceGlobMatcher } from "../glob-Cjxms1t7.js";
4
+ import { t as searchText } from "../search-C_RfoM2j.js";
3
5
  //#region src/runtime/assets.ts
4
6
  function createMissingPathError(path) {
5
7
  return workspaceError(`[vitehub] Workspace file does not exist: ${path}.`);
@@ -112,10 +114,9 @@ function createWorkspaceAssets(files) {
112
114
  async list(path, options) {
113
115
  return await listEntries(path || "", options);
114
116
  },
115
- async glob(pattern, _options = {}) {
116
- const entries = await listEntries("", { recursive: true });
117
- const patterns = Array.isArray(pattern) ? pattern : [pattern];
118
- return entries.filter((entry) => entry.type === "file" && patterns.some((item) => matchesAny(entry.path, item)));
117
+ async glob(pattern, options = {}) {
118
+ const { cwd, matches } = createWorkspaceGlobMatcher(pattern, options);
119
+ return (await listEntries(cwd, { recursive: true })).filter((entry) => entry.type === "file" && matches(entry.path));
119
120
  },
120
121
  async search(query) {
121
122
  const result = [];
@@ -1,5 +1,4 @@
1
- import { O as WorkspaceAssetsRegistry } from "../types-CYuwjJ4V.js";
2
-
1
+ import { O as WorkspaceAssetsRegistry } from "../types-BbtwmBZ5.js";
3
2
  //#region src/runtime/empty-assets-registry.d.ts
4
3
  declare const registry: WorkspaceAssetsRegistry;
5
4
  //#endregion
@@ -1,5 +1,5 @@
1
- import { t as WorkspaceRegistry } from "../registry-Uj6IVxes.js";
2
-
1
+ import { t as WorkspaceRegistry } from "../registry-B3BBm4Ts.js";
2
+ import "../registry-CYNN623b.js";
3
3
  //#region src/runtime/empty-registry.d.ts
4
4
  declare const registry: WorkspaceRegistry;
5
5
  //#endregion
@@ -0,0 +1,2 @@
1
+ import { a as workspaceRuntimeRegistryState, i as setWorkspaceRuntimeRegistry, n as WorkspaceRegistryModule, r as resetWorkspaceRuntimeRegistry, s as setWorkspaceRuntimeConfig, t as WorkspaceRegistry } from "../registry-B3BBm4Ts.js";
2
+ export { WorkspaceRegistry, WorkspaceRegistryModule, resetWorkspaceRuntimeRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState };
@@ -0,0 +1,23 @@
1
+ import { n as setWorkspaceRuntimeConfig } from "../config-B-863EgC.js";
2
+ import runtimeRegistry from "#vitehub-workspace-registry";
3
+ //#region src/runtime/registry.ts
4
+ const workspaceRuntimeRegistryKey = Symbol.for("vitehub.workspace.runtimeRegistry");
5
+ function workspaceRuntimeRegistryState() {
6
+ const scope = globalThis;
7
+ return scope[workspaceRuntimeRegistryKey] ??= {
8
+ loaders: runtimeRegistry,
9
+ version: 0
10
+ };
11
+ }
12
+ function setWorkspaceRuntimeRegistry(registry) {
13
+ const scope = globalThis;
14
+ scope[workspaceRuntimeRegistryKey] = {
15
+ loaders: registry,
16
+ version: workspaceRuntimeRegistryState().version + 1
17
+ };
18
+ }
19
+ function resetWorkspaceRuntimeRegistry() {
20
+ setWorkspaceRuntimeRegistry(runtimeRegistry);
21
+ }
22
+ //#endregion
23
+ export { resetWorkspaceRuntimeRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState };
@@ -0,0 +1,4 @@
1
+ //#region src/runtime/request.d.ts
2
+ /** Nitro middleware: runs the rest of the request in its own Workspace request scope. */
3
+ export default function workspaceRequestMiddleware(_event: unknown, next: () => unknown): Promise<unknown>;
4
+ //#endregion
@@ -0,0 +1,8 @@
1
+ import { t as runWorkspaceRequest } from "../request-scope-Dw5n8bMC.js";
2
+ //#region src/runtime/request.ts
3
+ /** Nitro middleware: runs the rest of the request in its own Workspace request scope. */
4
+ function workspaceRequestMiddleware(_event, next) {
5
+ return runWorkspaceRequest(next);
6
+ }
7
+ //#endregion
8
+ export { workspaceRequestMiddleware as default };
@@ -1,4 +1,5 @@
1
- import { _ as useWorkspace, i as ReadonlyWorkspaceFacade, m as WritableWorkspaceFacade, o as UseWorkspaceOptions } from "../use-BiHzt0xA.js";
2
- import { n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-Uj6IVxes.js";
3
- import { a as setWorkspaceRuntimeConfig, c as getWorkspaceHostedStoreLoader, d as setActiveCloudflareEnv, i as getWorkspaceRuntimeConfig, l as setWorkspaceHostedStoreLoader, n as setWorkspaceRuntimeAssetsRegistry, r as setWorkspaceRuntimeRegistry, t as invalidateWorkspaceStore, u as resetWorkspaceStoreCache } from "../state-tYcRWEh2.js";
4
- export { type ReadonlyWorkspaceFacade, type UseWorkspaceOptions, type WritableWorkspaceFacade, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, invalidateWorkspaceStore, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, useWorkspace };
1
+ import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, h as WritableWorkspaceFacade, i as ReadonlyWorkspaceFacade, s as UseWorkspaceOptions, x as useWorkspaceFiles } from "../use-C6lV3-wC.js";
2
+ import { o as getWorkspaceRuntimeConfig, s as setWorkspaceRuntimeConfig } from "../registry-B3BBm4Ts.js";
3
+ import { n as resolveRegisteredWorkspaceDefinition, r as setWorkspaceRuntimeDefinitions, t as registerWorkspace } from "../registry-CYNN623b.js";
4
+ import { c as resetWorkspaceStoreCache, l as useWorkspace, n as setWorkspaceRuntimeAssetsRegistry, o as getWorkspaceHostedStoreLoader, r as setWorkspaceRuntimeRegistry, s as setWorkspaceHostedStoreLoader, t as invalidateWorkspaceStore, u as setActiveCloudflareEnv } from "../state-BISnUf1s.js";
5
+ export { type ReadonlyWorkspaceFacade, type ReadonlyWorkspaceFiles, type UseWorkspaceOptions, type WritableWorkspaceFacade, type WritableWorkspaceFiles, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, invalidateWorkspaceStore, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeDefinitions, setWorkspaceRuntimeRegistry, useWorkspace, useWorkspaceFiles };
@@ -1,18 +1,8 @@
1
- import { c as getWorkspaceHostedStoreLoader, d as setWorkspaceRuntimeConfig, l as setWorkspaceHostedStoreLoader, u as getWorkspaceRuntimeConfig } from "../provider-B1yLjCJJ.js";
2
- import { v as setActiveCloudflareEnv } from "../shared-DTR1Hhma.js";
3
- import { t as setWorkspaceAssetsRegistry } from "../asset-registry-8QI3ML3K.js";
4
- import { n as invalidateCachedWorkspaceStore, r as resetWorkspaceStoreCache } from "../workspace-Dq08Yn72.js";
5
- import { i as setWorkspaceRegistry, n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-D3yzt8HQ.js";
6
- import { t as useWorkspace } from "../use-BTNDR5Rd.js";
7
- //#region src/runtime/state.ts
8
- async function invalidateWorkspaceStore(name) {
9
- invalidateCachedWorkspaceStore(await resolveRegisteredWorkspaceDefinition(name));
10
- }
11
- function setWorkspaceRuntimeRegistry(registry) {
12
- setWorkspaceRegistry(registry);
13
- }
14
- function setWorkspaceRuntimeAssetsRegistry(registry) {
15
- setWorkspaceAssetsRegistry(registry);
16
- }
17
- //#endregion
18
- export { getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, invalidateWorkspaceStore, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, useWorkspace };
1
+ import { E as setActiveCloudflareEnv } from "../shared-B3_EUk89.js";
2
+ import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "../provider-9s4Ufkm5.js";
3
+ import { n as setWorkspaceRuntimeConfig, t as getWorkspaceRuntimeConfig } from "../config-B-863EgC.js";
4
+ import { r as resetWorkspaceStoreCache } from "../workspace-sPWn2Jxj.js";
5
+ import { a as setWorkspaceRuntimeDefinitions, n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-CNphafBx.js";
6
+ import { r as useWorkspaceFiles } from "../use-CSpT5W87.js";
7
+ import { i as useWorkspace, n as setWorkspaceRuntimeAssetsRegistry, r as setWorkspaceRuntimeRegistry, t as invalidateWorkspaceStore } from "../state-DbrW-njQ.js";
8
+ export { getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, invalidateWorkspaceStore, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeDefinitions, setWorkspaceRuntimeRegistry, useWorkspace, useWorkspaceFiles };
@@ -1,2 +1,2 @@
1
- import { t as createWorkspace } from "../workspace-Xddf4G1B.js";
1
+ import { t as createWorkspace } from "../workspace-CYB2xZ1T.js";
2
2
  export { createWorkspace };
@@ -1,2 +1,2 @@
1
- import { t as createWorkspace } from "../workspace-Dq08Yn72.js";
1
+ import { t as createWorkspace } from "../workspace-sPWn2Jxj.js";
2
2
  export { createWorkspace };
package/dist/runtime.d.ts CHANGED
@@ -1,15 +1,16 @@
1
- import { F as WorkspaceDefinition, Ft as WorkspaceSourceRequestExecutionInput, Ht as WorkspaceSourceResolutionInvocation, It as WorkspaceSourceRequestExecutionResult, gt as WorkspaceSelectedScope, it as WorkspaceName, tt as WorkspaceMaterializeSourcesResult, wt as WorkspaceSource } from "./types-CYuwjJ4V.js";
2
- import { _ as useWorkspace, i as ReadonlyWorkspaceFacade, m as WritableWorkspaceFacade, o as UseWorkspaceOptions } from "./use-BiHzt0xA.js";
3
- import { n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "./registry-Uj6IVxes.js";
4
- import { a as setWorkspaceRuntimeConfig, c as getWorkspaceHostedStoreLoader, i as getWorkspaceRuntimeConfig, l as setWorkspaceHostedStoreLoader, n as setWorkspaceRuntimeAssetsRegistry, o as HostedWorkspaceStoreOptions, r as setWorkspaceRuntimeRegistry, s as WorkspaceHostedStoreLoader, t as invalidateWorkspaceStore, u as resetWorkspaceStoreCache } from "./state-tYcRWEh2.js";
5
- import { a as getWorkspaceSourceRequestDescriptor, i as workspaceSourceGrantPaths, n as normalizeWorkspaceSourceMetadata, o as isWorkspaceSourceRequestOnly, r as normalizeWorkspaceSourcesMetadata, s as workspaceSourceRequestDescriptorPath, t as WorkspaceSourceMetadata } from "./config-DE9xlaIw.js";
6
-
1
+ import { B as WorkspaceEntry, I as WorkspaceDefinition, Kt as WorkspaceSource, Rt as WorkspaceSelectedScope, St as WorkspaceName, T as Workspace, ht as WorkspaceMaterializeSourcesResult, in as WorkspaceSourceRequestExecutionResult, nn as WorkspaceSourceRequestDescriptor, rn as WorkspaceSourceRequestExecutionInput, rt as WorkspaceHistoryReader, un as WorkspaceSourceResolutionInvocation } from "./types-BbtwmBZ5.js";
2
+ import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, h as WritableWorkspaceFacade, i as ReadonlyWorkspaceFacade, o as ReadonlyWorkspaceFs, s as UseWorkspaceOptions, v as WritableWorkspaceFs, x as useWorkspaceFiles } from "./use-C6lV3-wC.js";
3
+ import { t as registerWorkspacePlugin } from "./plugins-C8C0auoW.js";
4
+ import { o as getWorkspaceRuntimeConfig, s as setWorkspaceRuntimeConfig } from "./registry-B3BBm4Ts.js";
5
+ import { n as resolveRegisteredWorkspaceDefinition, r as setWorkspaceRuntimeDefinitions, t as registerWorkspace } from "./registry-CYNN623b.js";
6
+ import { a as WorkspaceHostedStoreLoader, c as resetWorkspaceStoreCache, i as HostedWorkspaceStoreOptions, l as useWorkspace, n as setWorkspaceRuntimeAssetsRegistry, o as getWorkspaceHostedStoreLoader, r as setWorkspaceRuntimeRegistry, s as setWorkspaceHostedStoreLoader, t as invalidateWorkspaceStore } from "./state-BISnUf1s.js";
7
+ import { a as getWorkspaceSourceRequestDescriptor, i as workspaceSourceGrantPaths, n as normalizeWorkspaceSourceMetadata, o as isWorkspaceSourceRequestOnly, r as normalizeWorkspaceSourcesMetadata, s as workspaceSourceRequestDescriptorPath, t as WorkspaceSourceMetadata } from "./config-BQKcPawI.js";
7
8
  //#region src/runtime/dependency-loaders.d.ts
8
9
  interface WorkspaceDependencyRuntimeLoaders {
9
10
  shellWorkspace: () => Promise<unknown>;
10
11
  }
11
- declare function setWorkspaceDependencyRuntimeLoaders(loaders: Partial<WorkspaceDependencyRuntimeLoaders> | undefined): void;
12
- declare function getWorkspaceDependencyRuntimeLoaders(): WorkspaceDependencyRuntimeLoaders;
12
+ export declare function setWorkspaceDependencyRuntimeLoaders(loaders: Partial<WorkspaceDependencyRuntimeLoaders> | undefined): void;
13
+ export declare function getWorkspaceDependencyRuntimeLoaders(): WorkspaceDependencyRuntimeLoaders;
13
14
  //#endregion
14
15
  //#region src/sources/resolution.d.ts
15
16
  interface WorkspaceSourceResolutionOptions {
@@ -21,19 +22,37 @@ interface WorkspaceSourceResolutionFacade<Name extends WorkspaceName = Workspace
21
22
  definition: WorkspaceDefinition;
22
23
  workspace: ReadonlyWorkspaceFacade<Name>;
23
24
  }
24
- declare function hasWorkspaceSourceResolvers(definition: Pick<WorkspaceDefinition, "sources"> | undefined): boolean;
25
- declare function resolveWorkspaceSources(definition: WorkspaceDefinition, options: WorkspaceSourceResolutionOptions): Promise<WorkspaceDefinition>;
26
- declare function createWorkspaceSourceResolutionFacade<Name extends WorkspaceName = WorkspaceName>(workspace: ReadonlyWorkspaceFacade<Name>, definition: WorkspaceDefinition, options: WorkspaceSourceResolutionOptions): Promise<WorkspaceSourceResolutionFacade<Name>>;
25
+ export declare function hasWorkspaceSourceResolvers(definition: Pick<WorkspaceDefinition, "sources"> | undefined): boolean;
26
+ /** Preserve internal Source Sync routing when wrapping a writable facade. */
27
+ export declare function forwardWorkspaceFacade(source: WritableWorkspaceFacade, target: WritableWorkspaceFacade): void;
28
+ export declare function resolveWorkspaceSources(definition: WorkspaceDefinition, options: WorkspaceSourceResolutionOptions): Promise<WorkspaceDefinition>;
29
+ export declare function createWorkspaceSourceResolutionFacade<Name extends WorkspaceName = WorkspaceName>(workspace: ReadonlyWorkspaceFacade<Name>, definition: WorkspaceDefinition, options: WorkspaceSourceResolutionOptions): Promise<WorkspaceSourceResolutionFacade<Name>>;
30
+ //#endregion
31
+ //#region src/core/history.d.ts
32
+ /** Forward history only when the caller can inspect the complete folder. */
33
+ export declare function createWorkspaceHistoryReader(history: WorkspaceHistoryReader | undefined, complete: boolean): WorkspaceHistoryReader;
27
34
  //#endregion
28
35
  //#region src/sources/live.d.ts
29
- declare function markLiveWorkspaceSource(source: WorkspaceSource, paths: Record<string, string>): WorkspaceSource;
36
+ export declare function markLiveWorkspaceSource(source: WorkspaceSource, paths: Record<string, string>): WorkspaceSource;
37
+ //#endregion
38
+ //#region src/storage/metadata-target.d.ts
39
+ /** An object that can carry a metadata target: a Workspace, a Workspace facade, or the `fs` of a facade. */
40
+ type WorkspaceMetadataCarrier = Workspace | ReadonlyWorkspaceFiles | WritableWorkspaceFiles | ReadonlyWorkspaceFs | WritableWorkspaceFs;
41
+ /**
42
+ * Attaches a read-only metadata view of `source` to `target`.
43
+ * The view has the Workspace name, `getMeta`, `list`, and the Store target. It never has Store writes.
44
+ * `filterEntries` limits the listed entries, for example to an access scope.
45
+ * Internal: `@vite-hub/agent` uses this for its Workspace facades.
46
+ */
47
+ export declare function forwardWorkspaceMetadataView(source: unknown, target: WorkspaceMetadataCarrier, filterEntries?: (entries: WorkspaceEntry[]) => WorkspaceEntry[]): void;
30
48
  //#endregion
31
49
  //#region src/sources/request-execution.d.ts
32
50
  interface WorkspaceSourceRequestExecutionTarget {
33
51
  executeSourceRequest(input: WorkspaceSourceRequestExecutionInput): Promise<WorkspaceSourceRequestExecutionResult>;
34
52
  }
35
- declare function attachWorkspaceSourceRequestExecution<T extends object>(target: T, executor: WorkspaceSourceRequestExecutionTarget | undefined): T;
36
- declare function getWorkspaceSourceRequestExecution(input: unknown): WorkspaceSourceRequestExecutionTarget | undefined;
53
+ export declare function attachWorkspaceSourceRequestExecution<T extends object>(target: T, executor: WorkspaceSourceRequestExecutionTarget | undefined): T;
54
+ export declare function getWorkspaceSourceRequestExecution(input: unknown): WorkspaceSourceRequestExecutionTarget | undefined;
55
+ export declare function workspaceSourceRequestMatches(descriptor: WorkspaceSourceRequestDescriptor, input: WorkspaceSourceRequestExecutionInput): boolean;
37
56
  //#endregion
38
57
  //#region src/runtime/preparation.d.ts
39
58
  type WorkspacePreparationState = {
@@ -57,6 +76,8 @@ type WorkspacePreparationState = {
57
76
  };
58
77
  interface WorkspacePreparationOptions<Name extends WorkspaceName = WorkspaceName> {
59
78
  onStateChange?: (state: WorkspacePreparationState) => void;
79
+ /** Fail readiness when a selected source contains no files. Empty sources are allowed by default. */
80
+ requireNonEmpty?: boolean;
60
81
  retryDelayMs?: number;
61
82
  sources?: readonly string[];
62
83
  validate?: (result: WorkspaceMaterializeSourcesResult) => void | Promise<void>;
@@ -64,10 +85,24 @@ interface WorkspacePreparationOptions<Name extends WorkspaceName = WorkspaceName
64
85
  }
65
86
  interface WorkspacePreparation {
66
87
  getState(): WorkspacePreparationState;
67
- response(): Response;
88
+ response(method?: string): Response;
68
89
  start(): Promise<WorkspacePreparationState>;
69
90
  stop(): Promise<void>;
70
91
  }
71
- declare function createWorkspacePreparation<Name extends WorkspaceName = WorkspaceName>(options: WorkspacePreparationOptions<Name>): WorkspacePreparation;
92
+ export declare function createWorkspacePreparation<Name extends WorkspaceName = WorkspaceName>(options: WorkspacePreparationOptions<Name>): WorkspacePreparation;
93
+ //#endregion
94
+ //#region src/storage/recover-local-locks.d.ts
95
+ /**
96
+ * Remove abandoned markers from a trusted, exclusively owned local store.
97
+ * Stop all store users and prevent changes to the store and its ancestor directories
98
+ * for the entire call. Path checks catch existing symlinks; they do not provide
99
+ * protection against concurrent filesystem mutation.
100
+ */
101
+ export declare function recoverLocalWorkspaceLocks(options: {
102
+ root: string;
103
+ offline: true;
104
+ }): Promise<{
105
+ removed: number;
106
+ }>;
72
107
  //#endregion
73
- export { type HostedWorkspaceStoreOptions, type ReadonlyWorkspaceFacade, type UseWorkspaceOptions, type WorkspaceDependencyRuntimeLoaders, type WorkspaceHostedStoreLoader, type WorkspacePreparation, type WorkspacePreparationOptions, type WorkspacePreparationState, type WorkspaceSourceMetadata, type WorkspaceSourceResolutionFacade, type WorkspaceSourceResolutionOptions, type WritableWorkspaceFacade, attachWorkspaceSourceRequestExecution, createWorkspacePreparation, createWorkspaceSourceResolutionFacade, getWorkspaceDependencyRuntimeLoaders, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, getWorkspaceSourceRequestDescriptor, getWorkspaceSourceRequestExecution, hasWorkspaceSourceResolvers, invalidateWorkspaceStore, isWorkspaceSourceRequestOnly, markLiveWorkspaceSource, normalizeWorkspaceSourceMetadata, normalizeWorkspaceSourcesMetadata, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, resolveWorkspaceSources, setWorkspaceDependencyRuntimeLoaders, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, useWorkspace, workspaceSourceGrantPaths, workspaceSourceRequestDescriptorPath };
108
+ export { type HostedWorkspaceStoreOptions, type ReadonlyWorkspaceFacade, type ReadonlyWorkspaceFiles, type UseWorkspaceOptions, type WorkspaceDependencyRuntimeLoaders, type WorkspaceHostedStoreLoader, type WorkspacePreparation, type WorkspacePreparationOptions, type WorkspacePreparationState, type WorkspaceSourceMetadata, type WorkspaceSourceResolutionFacade, type WorkspaceSourceResolutionOptions, type WritableWorkspaceFacade, type WritableWorkspaceFiles, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, getWorkspaceSourceRequestDescriptor, invalidateWorkspaceStore, isWorkspaceSourceRequestOnly, normalizeWorkspaceSourceMetadata, normalizeWorkspaceSourcesMetadata, registerWorkspace, registerWorkspacePlugin, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeDefinitions, setWorkspaceRuntimeRegistry, useWorkspace, useWorkspaceFiles, workspaceSourceGrantPaths, workspaceSourceRequestDescriptorPath };