@vite-hub/workspace 0.4.1 → 0.5.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 +62 -19
  2. package/dist/blob-database/postgres.d.ts +424 -0
  3. package/dist/blob-database/postgres.js +2 -0
  4. package/dist/blob-database-sources-DDZ1wV9w.js +9 -0
  5. package/dist/blob-database.d.ts +33 -447
  6. package/dist/blob-database.js +637 -208
  7. package/dist/checkout.js +1 -1
  8. package/dist/cloudflare.d.ts +1 -1
  9. package/dist/cloudflare.js +1 -1
  10. package/dist/{config-D1QENneP.js → config-DiyPi3Ff.js} +7 -7
  11. package/dist/{config-CDeGd0RB.d.ts → config-hxABr_Gg.d.ts} +1 -1
  12. package/dist/durability.d.ts +11 -2
  13. package/dist/durability.js +46 -4
  14. package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-C0KyI408.js} +5 -1
  15. package/dist/{error-diagnostics-B5s9kNEA.js → error-diagnostics-Cth97txN.js} +10 -2
  16. package/dist/{path-uxLkzrZm.d.ts → errors-DXCZjdUU.d.ts} +0 -1
  17. package/dist/{file-CqG9zqiF.js → file-C1DYoGz3.js} +1 -1
  18. package/dist/{target-Dm9dHAVJ.js → file-metadata-Dv2JZwal.js} +1 -29
  19. package/dist/{files-B6wpAhEx.js → files-iHyik8jj.js} +2 -2
  20. package/dist/files.d.ts +13 -5
  21. package/dist/files.js +6 -5
  22. package/dist/{github-DKAlO0Vh.js → github-CFHl6RI0.js} +4 -4
  23. package/dist/{glob-BOqSKzSg.js → glob-BitxqDhb.js} +7 -7
  24. package/dist/{glob-Cjxms1t7.js → glob-Buxfvmyy.js} +1 -1
  25. package/dist/history-schema-BBWbpDk4.d.ts +436 -0
  26. package/dist/history-schema-postgres-U_ueRvmO.js +41 -0
  27. package/dist/{host-Bf1a2uo_.js → host-Dmr2Ctem.js} +150 -16
  28. package/dist/{hosted-zG7HJaE4.js → hosted-BktlvkF2.js} +20 -11
  29. package/dist/{hosted-vercel-blob-AbXG8fvR.js → hosted-vercel-blob-D0IPAjb1.js} +5 -5
  30. package/dist/hosted-vercel-blob.d.ts +1 -1
  31. package/dist/hosted-vercel-blob.js +1 -1
  32. package/dist/hosted.d.ts +1 -1
  33. package/dist/hosted.js +1 -1
  34. package/dist/index.d.ts +11 -23
  35. package/dist/index.js +28 -106
  36. package/dist/internal/workspace.d.ts +14 -0
  37. package/dist/internal/workspace.js +86 -0
  38. package/dist/{lifecycle-D8FdpBod.js → lifecycle-D6WN2dd_.js} +11 -8
  39. package/dist/loader.d.ts +1 -1
  40. package/dist/loader.js +2 -2
  41. package/dist/{mcp-resources-DntxtmDU.js → mcp-resources-TtxLNSL6.js} +1 -1
  42. package/dist/{memory-D5jq9HZW.js → memory-DjzwSng2.js} +16 -8
  43. package/dist/{metadata-target-DDoOQNp1.js → metadata-target-CR0aDtvS.js} +205 -60
  44. package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CI2PJGqu.d.ts} +8 -2
  45. package/dist/{operations-D8uCpzhM.js → operations-Cib30_dt.js} +5 -5
  46. package/dist/{operations-DsY2MQnG.js → operations-dtcU5LkD.js} +22 -7
  47. package/dist/operations.d.ts +2 -2
  48. package/dist/operations.js +1 -1
  49. package/dist/{path--wrT_Azm.js → path-BlIBpI7U.js} +1 -16
  50. package/dist/{plugins-CsrXCA1Q.d.ts → plugins-DKCBrH31.d.ts} +1 -1
  51. package/dist/{provider-sm9uzkLg.js → provider-Fc3M6bEx.js} +23 -10
  52. package/dist/providers/github/store.d.ts +1 -1
  53. package/dist/providers/github/store.js +1 -1
  54. package/dist/{registry-CwryP59t.d.ts → registry-CLL0TY0L.d.ts} +5 -3
  55. package/dist/{registry-DmVfUe4K.js → registry-CedQvQxW.js} +8 -3
  56. package/dist/{registry-CFl1Htyc.d.ts → registry-DpB5PBA4.d.ts} +5 -4
  57. package/dist/{request-scope-Dw5n8bMC.js → request-scope-Bcv2kD8h.js} +2 -1
  58. package/dist/rule-keys-Bsz6jTTF.js +19 -0
  59. package/dist/rules-OHaPFopX.js +269 -0
  60. package/dist/runtime/assets.d.ts +1 -1
  61. package/dist/runtime/assets.js +3 -3
  62. package/dist/runtime/empty-assets-registry.d.ts +1 -1
  63. package/dist/runtime/empty-registry.d.ts +2 -2
  64. package/dist/runtime/registry.d.ts +2 -2
  65. package/dist/runtime/request.js +1 -1
  66. package/dist/runtime/state.d.ts +5 -4
  67. package/dist/runtime/state.js +18 -6
  68. package/dist/runtime/workspace.d.ts +1 -1
  69. package/dist/runtime/workspace.js +1 -1
  70. package/dist/runtime.d.ts +9 -8
  71. package/dist/runtime.js +23 -16
  72. package/dist/{search-C_RfoM2j.js → search-BqNV9LnO.js} +1 -1
  73. package/dist/{server-Cd4-iCh5.js → server-CFtrOPk6.js} +5 -5
  74. package/dist/server.d.ts +2 -2
  75. package/dist/server.js +1 -1
  76. package/dist/{shared-ovXVSV3-.js → shared-BgDjxY3J.js} +14 -3
  77. package/dist/source-metadata.d.ts +2 -2
  78. package/dist/source-metadata.js +3 -3
  79. package/dist/{state-C-YtsaiJ.d.ts → state-DBV6VHS6.d.ts} +13 -21
  80. package/dist/{store-NZoRto-Y.js → store-BRMdD8Ft.js} +37 -36
  81. package/dist/{sync-CrT8zjwc.js → sync-BezGVzrW.js} +4 -4
  82. package/dist/test.d.ts +1 -1
  83. package/dist/test.js +1 -1
  84. package/dist/{types-1Z-tKK3g.d.ts → types-9DMtFjaa.d.ts} +52 -4
  85. package/dist/{use-B0o5HoBl.js → use-Dm2tbI5F.js} +15 -15
  86. package/dist/{use-CjbF8EO9.d.ts → use-Dv973swc.d.ts} +20 -28
  87. package/dist/{state-Cb_hIyAw.js → use-tools-C1qvhzme.js} +4 -17
  88. package/dist/use-tools-CMUthOdy.d.ts +12 -0
  89. package/dist/{utils-Dw-WULEZ.js → utils-C0Au2R16.js} +77 -268
  90. package/dist/vite.d.ts +32 -3
  91. package/dist/vite.js +990 -1286
  92. package/dist/vitehub-grants-C8IAl5-M.js +38 -0
  93. package/dist/{workspace-DvKu5PRa.js → workspace-CFrwWhEm.js} +18 -17
  94. package/dist/{workspace-CIXgHeyX.d.ts → workspace-Cw4ycIW-.d.ts} +1 -1
  95. package/package.json +22 -12
@@ -0,0 +1,38 @@
1
+ import { defineGrant } from "@vite-hub/runtime/internal/grant";
2
+ //#region src/storage/target.ts
3
+ const storeTargetKey = Symbol("vitehub.workspace.store-target");
4
+ const storeTarget = defineGrant("vitehub.workspace.store-target", (resolve) => resolve);
5
+ function readStoreTarget(source) {
6
+ return source === null || source === void 0 ? void 0 : source[storeTargetKey];
7
+ }
8
+ /** Records where a Store or Workspace keeps its files. Only Store implementations and Workspace wrappers call it. */
9
+ function provideWorkspaceStoreTarget(owner, resolve) {
10
+ owner[storeTargetKey] = storeTarget.issue(resolve);
11
+ }
12
+ function forwardWorkspaceStoreTarget(source, target) {
13
+ const grant = readStoreTarget(source);
14
+ if (storeTarget.isValid(grant)) target[storeTargetKey] = grant;
15
+ }
16
+ async function resolveWorkspaceStoreTarget(source) {
17
+ return await storeTarget.check(readStoreTarget(source))?.();
18
+ }
19
+ //#endregion
20
+ //#region src/storage/materialization.ts
21
+ const revisionMaterializerKey = Symbol("vitehub.workspace.revision-materializer");
22
+ const revisionMaterializer = defineGrant("vitehub.workspace.revision-materializer", (materializer) => materializer);
23
+ function readRevisionMaterializer(source) {
24
+ return source === null || source === void 0 ? void 0 : source[revisionMaterializerKey];
25
+ }
26
+ /** Lets hosted sessions read and materialize Store revisions. Only Store implementations call it. */
27
+ function provideWorkspaceRevisionMaterializer(owner, materializer) {
28
+ owner[revisionMaterializerKey] = revisionMaterializer.issue(materializer);
29
+ }
30
+ function forwardWorkspaceRevisionMaterializer(source, target) {
31
+ const grant = readRevisionMaterializer(source);
32
+ if (revisionMaterializer.isValid(grant)) target[revisionMaterializerKey] = grant;
33
+ }
34
+ function resolveWorkspaceRevisionMaterializer(workspace) {
35
+ return revisionMaterializer.check(readRevisionMaterializer(workspace));
36
+ }
37
+ //#endregion
38
+ export { provideWorkspaceStoreTarget as a, forwardWorkspaceStoreTarget as i, provideWorkspaceRevisionMaterializer as n, resolveWorkspaceStoreTarget as o, resolveWorkspaceRevisionMaterializer as r, forwardWorkspaceRevisionMaterializer as t };
@@ -1,16 +1,17 @@
1
- import { t as createMemoryWorkspaceStore } from "./memory-D5jq9HZW.js";
1
+ import { t as createMemoryWorkspaceStore } from "./memory-DjzwSng2.js";
2
2
  import { s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
3
- import { o as copyJsonFileMetadata, t as forwardWorkspaceStoreTarget } from "./target-Dm9dHAVJ.js";
4
- import { a as isExcludedWorkspacePath, f as sha256, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, r as contentToBytes, s as matchesAny } from "./path--wrT_Azm.js";
5
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B5s9kNEA.js";
6
- import { d as normalizeHistoryRef, f as rejectHistoryHead, h as createWorkspaceWritePolicy, i as createWorkspaceHistory, l as historyConflict } from "./utils-Dw-WULEZ.js";
7
- import { t as createWorkspaceGlobMatcher } from "./glob-Cjxms1t7.js";
8
- import { t as createWorkspaceStoreFromProvider } from "./provider-sm9uzkLg.js";
9
- import { n as forwardWorkspaceRevisionMaterializer } from "./store-NZoRto-Y.js";
10
- import { t as searchText } from "./search-C_RfoM2j.js";
11
- import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, g as getWorkspaceSourceRequestExecutor, n as createSourceContext, s as sourceMountContainsPath, v as workspaceSourceRequestDescriptorPath, y as requestJsonEqual } from "./config-D1QENneP.js";
12
- import { C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, _ as reconcileRemovedStartupSources, b as statVirtualSourcePath, c as workspaceInternalMetadataCapability, f as materializeWorkspaceSources, g as readSourceSnapshotPaths, h as readResolvedSourceFile, l as hasCurrentSourceSnapshot, m as readCurrentSourceSnapshot, n as createWorkspaceMetadataTarget, p as materializesCompleteSource, t as attachWorkspaceMetadataTarget, u as hasFreshSourceSnapshot, v as searchMaterializedStore } from "./metadata-target-DDoOQNp1.js";
13
- import { n as trackStagedWrites } from "./request-scope-Dw5n8bMC.js";
3
+ import { t as copyJsonFileMetadata } from "./file-metadata-Dv2JZwal.js";
4
+ import { a as isExcludedWorkspacePath, d as sha256, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, r as contentToBytes, s as matchesAny } from "./path-BlIBpI7U.js";
5
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Cth97txN.js";
6
+ import { t as createWorkspaceWritePolicy } from "./rules-OHaPFopX.js";
7
+ import { f as normalizeHistoryRef, i as createWorkspaceHistory, m as rejectHistoryHead, u as historyConflict } from "./utils-C0Au2R16.js";
8
+ import { t as createWorkspaceGlobMatcher } from "./glob-Buxfvmyy.js";
9
+ import { i as forwardWorkspaceStoreTarget, t as forwardWorkspaceRevisionMaterializer } from "./vitehub-grants-C8IAl5-M.js";
10
+ import { t as createWorkspaceStoreFromProvider } from "./provider-Fc3M6bEx.js";
11
+ import { t as searchText } from "./search-BqNV9LnO.js";
12
+ import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, g as getWorkspaceSourceRequestExecutor, n as createSourceContext, s as sourceMountContainsPath, v as workspaceSourceRequestDescriptorPath, y as requestJsonEqual } from "./config-DiyPi3Ff.js";
13
+ import { C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, _ as reconcileRemovedStartupSources, b as statVirtualSourcePath, c as workspaceInternalMetadataCapability, f as materializeWorkspaceSources, g as readSourceSnapshotPaths, h as readResolvedSourceFile, l as hasCurrentSourceSnapshot, m as readCurrentSourceSnapshot, n as createWorkspaceMetadataTarget, p as materializesCompleteSource, t as attachWorkspaceMetadataTarget, u as hasFreshSourceSnapshot, v as searchMaterializedStore } from "./metadata-target-CR0aDtvS.js";
14
+ import { n as trackStagedWrites } from "./request-scope-Bcv2kD8h.js";
14
15
  import { noExecutionAuthority } from "@vite-hub/runtime";
15
16
  //#region src/session/scope.ts
16
17
  function isMissingWorkspacePathError(error) {
@@ -678,8 +679,8 @@ function createWorkspaceSourceView(definition, store, options = {}) {
678
679
  const normalized = normalizeWorkspacePath(path);
679
680
  if (!isDescriptorPath(normalized)) for (const source of await getLazySourcesForPath(normalized)) {
680
681
  if (source.materialize !== "startup" || isExcludedWorkspacePath(source.mountPath, options.exclude)) continue;
681
- await ensurePrepared(source.key);
682
- if (!usesLiveProvider(source)) await ensureMaterialized(source.key);
682
+ await ensurePrepared(source.key, { directory: normalized });
683
+ if (!usesLiveProvider(source)) await ensureMaterialized(source.key, true, { directory: normalized });
683
684
  }
684
685
  const storeEntries = isDescriptorPath(normalized) ? [] : await store.list(path, options);
685
686
  const result = new Map(storeEntries.map((entry) => [entry.path, entry]));
@@ -1292,7 +1293,7 @@ function createWorkspace(definition, options = {}) {
1292
1293
  };
1293
1294
  },
1294
1295
  async sync(options) {
1295
- const { syncWorkspaceSources } = await import("./sync-CrT8zjwc.js");
1296
+ const { syncWorkspaceSources } = await import("./sync-BezGVzrW.js");
1296
1297
  return await syncWorkspaceSources(definition, store, options);
1297
1298
  },
1298
1299
  async materializeSources(options) {
@@ -1347,7 +1348,7 @@ function createWorkspace(definition, options = {}) {
1347
1348
  async startSession(options) {
1348
1349
  const host = options?.host;
1349
1350
  if (host) {
1350
- const { createHostedWorkspaceSession } = await import("./host-Bf1a2uo_.js").then((n) => n.n);
1351
+ const { createHostedWorkspaceSession } = await import("./host-Dmr2Ctem.js").then((n) => n.n);
1351
1352
  return await createHostedWorkspaceSession(workspace, {
1352
1353
  ...options,
1353
1354
  host
@@ -1362,7 +1363,7 @@ function createWorkspace(definition, options = {}) {
1362
1363
  const synchronizedWorkspace = workspace;
1363
1364
  synchronizedWorkspace.__workspaceDefinitionSyncKey = definition;
1364
1365
  synchronizedWorkspace.__syncWorkspaceDefinition = async (abortSignal) => {
1365
- const { syncWorkspaceDefinition } = await import("./lifecycle-D8FdpBod.js").then((n) => n.t);
1366
+ const { syncWorkspaceDefinition } = await import("./lifecycle-D6WN2dd_.js").then((n) => n.t);
1366
1367
  await syncWorkspaceDefinition(definition, store, abortSignal);
1367
1368
  };
1368
1369
  return attachWorkspaceSourceRequestExecution(workspace, createWorkspaceSourceRequestExecution(definition));
@@ -1,4 +1,4 @@
1
- import { I as WorkspaceDefinition, T as Workspace } from "./types-1Z-tKK3g.js";
1
+ import { E as Workspace, L as WorkspaceDefinition } from "./types-9DMtFjaa.js";
2
2
  //#region src/core/workspace.d.ts
3
3
  declare function createWorkspace(definition: WorkspaceDefinition, options?: {
4
4
  reuseStartupSnapshots?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-hub/workspace",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Agent-oriented filesystem state and Vite integration for ViteHub.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -50,6 +50,11 @@
50
50
  "import": "./dist/blob-database.js",
51
51
  "default": "./dist/blob-database.js"
52
52
  },
53
+ "./blob-database/postgres": {
54
+ "types": "./dist/blob-database/postgres.d.ts",
55
+ "import": "./dist/blob-database/postgres.js",
56
+ "default": "./dist/blob-database/postgres.js"
57
+ },
53
58
  "./checkout": {
54
59
  "types": "./dist/checkout.d.ts",
55
60
  "import": "./dist/checkout.js",
@@ -75,6 +80,11 @@
75
80
  "import": "./dist/internal/path.js",
76
81
  "default": "./dist/internal/path.js"
77
82
  },
83
+ "./internal/workspace": {
84
+ "types": "./dist/internal/workspace.d.ts",
85
+ "import": "./dist/internal/workspace.js",
86
+ "default": "./dist/internal/workspace.js"
87
+ },
78
88
  "./lineage": {
79
89
  "types": "./dist/lineage.d.ts",
80
90
  "import": "./dist/lineage.js",
@@ -140,8 +150,8 @@
140
150
  "dependencies": {
141
151
  "@valibot/to-json-schema": "^1.8.0",
142
152
  "@vercel/nft": "^1.11.0",
143
- "@vite-hub/runtime": "0.4.1",
144
- "@vite-hub/source": "0.4.1",
153
+ "@vite-hub/runtime": "0.5.0",
154
+ "@vite-hub/source": "0.5.0",
145
155
  "birpc": "^4.2.0",
146
156
  "defu": "^6.1.7",
147
157
  "exsolve": "^1.1.3",
@@ -152,18 +162,18 @@
152
162
  "nostics": "1.4.0",
153
163
  "valibot": "^1.5.0",
154
164
  "yaml": "^2.9.1",
155
- "@vite-hub/markdown-template": "0.4.1",
156
- "@vite-hub/blob": "0.4.1",
157
- "@vite-hub/database": "0.4.1",
158
- "@vite-hub/sandbox": "0.4.1"
165
+ "@vite-hub/markdown-template": "0.5.0",
166
+ "@vite-hub/blob": "0.5.0",
167
+ "@vite-hub/database": "0.5.0",
168
+ "@vite-hub/sandbox": "0.5.0"
159
169
  },
160
170
  "devDependencies": {
161
171
  "@types/node": "^24.19.1",
162
172
  "@vercel/blob": "^2.8.0",
163
- "@vite-hub/env": "0.4.1",
164
- "@vite-hub/forge": "0.4.1",
173
+ "@vite-hub/env": "0.5.0",
174
+ "@vite-hub/forge": "0.5.0",
165
175
  "@vite-hub/internal": "0.0.1",
166
- "@vite-hub/shell": "0.4.1",
176
+ "@vite-hub/shell": "0.5.0",
167
177
  "ai": "7.0.130",
168
178
  "esbuild": "^0.28.2",
169
179
  "publint": "^0.3.25",
@@ -176,11 +186,11 @@
176
186
  "@libsql/client": "^0.18.0"
177
187
  },
178
188
  "peerDependencies": {
179
- "@vite-hub/shell": "0.4.1",
189
+ "@vite-hub/shell": "0.5.0",
180
190
  "ai": "^6.0.0 || ^7.0.0-0",
181
191
  "vite": ">=8.0.0",
182
192
  "drizzle-orm": "1.0.0-rc.5 || ^1.0.0",
183
- "@vite-hub/forge": "0.4.1"
193
+ "@vite-hub/forge": "0.5.0"
184
194
  },
185
195
  "peerDependenciesMeta": {
186
196
  "@vite-hub/shell": {