@vite-hub/workspace 0.1.0 → 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.
- package/README.md +164 -107
- package/dist/abort-BCwpdrN0.js +32 -0
- package/dist/blob-database.d.ts +70 -117
- package/dist/blob-database.js +48 -41
- package/dist/checkout.d.ts +128 -0
- package/dist/checkout.js +849 -0
- package/dist/cloudflare.d.ts +2 -2
- package/dist/cloudflare.js +1 -1
- package/dist/config-B-863EgC.js +15 -0
- package/dist/{config-B7dmzDX3.js → config-BAgL2dtB.js} +48 -84
- package/dist/{config-DLKdaFWN.d.ts → config-BQKcPawI.d.ts} +1 -1
- package/dist/discard-CNNtCozM.js +8 -0
- package/dist/durability.d.ts +22 -0
- package/dist/durability.js +70 -0
- package/dist/error-diagnostics-CtKjGtGb.js +188 -0
- package/dist/error-diagnostics-DSkCJC_L.js +266 -0
- package/dist/file-2pFYNtsU.js +22 -0
- package/dist/{files-C7Px8uaC.js → files-BOo4SbwE.js} +2 -2
- package/dist/files.d.ts +38 -0
- package/dist/files.js +6 -0
- package/dist/{github-CPxHtFB7.js → github-CrYp4v8k.js} +32 -5
- package/dist/{glob--XcLlcml.js → glob-B8YGvTrZ.js} +4 -5
- package/dist/{glob--kNYDbfU.js → glob-Cjxms1t7.js} +1 -1
- package/dist/{host-CFnrTXTK.js → host-BFBpXn0N.js} +58 -47
- package/dist/{hosted-acMA5XyL.js → hosted-KcUR_jPv.js} +216 -93
- package/dist/hosted-vercel-blob-B3-wRdUm.js +410 -0
- package/dist/hosted-vercel-blob.d.ts +2 -2
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +5 -3
- package/dist/hosted.js +2 -2
- package/dist/index.d.ts +9 -51
- package/dist/index.js +21 -91
- package/dist/{lifecycle-BwZ7c9hb.js → lifecycle-B-enk_4A.js} +8 -8
- package/dist/lineage.d.ts +26 -0
- package/dist/lineage.js +76 -0
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +2 -2
- package/dist/{mcp-resources-BREFCmtn.js → mcp-resources-DF0F5rcL.js} +2 -2
- package/dist/{memory-BbwOqDXl.js → memory-BOexthyW.js} +3 -4
- package/dist/{metadata-target-DZEZQGHA.js → metadata-target-CWz6KHKq.js} +17 -16
- package/dist/object-Da1zyPCR.js +11 -0
- package/dist/operation-definition-8gOe-ubD.d.ts +234 -0
- package/dist/operations-C6FpR8Rr.js +389 -0
- package/dist/operations-CE2drFih.js +1234 -0
- package/dist/operations.d.ts +41 -4
- package/dist/operations.js +3 -2
- package/dist/{path-CNAwN7pw.js → path--wrT_Azm.js} +2 -3
- package/dist/path-AxMho1wo.d.ts +7 -0
- package/dist/{plugins-DqQ8b4T5.d.ts → plugins-C8C0auoW.d.ts} +1 -1
- package/dist/{provider-kXjfli9u.js → provider-9s4Ufkm5.js} +104 -82
- package/dist/providers/github/store.d.ts +1 -1
- package/dist/providers/github/store.js +1 -1
- package/dist/registry-B3BBm4Ts.d.ts +19 -0
- package/dist/{registry-Bp-8UUfG.js → registry-CNphafBx.js} +55 -20
- package/dist/registry-CYNN623b.d.ts +9 -0
- package/dist/request-scope-Dw5n8bMC.js +83 -0
- package/dist/results-DgkZUmTL.js +8 -0
- package/dist/{rolldown-runtime-B4iAMlE-.js → rolldown-runtime-rQ84J-ij.js} +2 -3
- package/dist/runtime/assets.d.ts +1 -1
- package/dist/runtime/assets.js +3 -3
- package/dist/runtime/empty-assets-registry.d.ts +1 -1
- package/dist/runtime/empty-registry.d.ts +2 -1
- package/dist/runtime/registry.d.ts +2 -0
- package/dist/runtime/registry.js +23 -0
- package/dist/runtime/request.d.ts +4 -0
- package/dist/runtime/request.js +8 -0
- package/dist/runtime/state.d.ts +5 -4
- package/dist/runtime/state.js +8 -18
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +9 -8
- package/dist/runtime.js +23 -26
- package/dist/{search-CrTmXj5h.js → search-C_RfoM2j.js} +2 -2
- package/dist/{server-BNQ-Nbjj.js → server-8tGltlGz.js} +53 -40
- package/dist/server.d.ts +17 -8
- package/dist/server.js +1 -1
- package/dist/shared-B3_EUk89.js +848 -0
- package/dist/source-metadata.d.ts +6 -2
- package/dist/source-metadata.js +8 -8
- package/dist/state-BISnUf1s.d.ts +35 -0
- package/dist/{ai-BZyLwULx.js → state-DbrW-njQ.js} +96 -54
- package/dist/{store-CXgmu-uw.js → store-ybhyD38Z.js} +250 -106
- package/dist/{sync-CN6ec-5M.js → sync-CCD_VYC8.js} +4 -4
- package/dist/target-jWhTdIuF.js +89 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{types-DeK9GIxy.d.ts → types-BbtwmBZ5.d.ts} +68 -14
- package/dist/use-C6lV3-wC.d.ts +321 -0
- package/dist/{use-BQj7nSz6.js → use-CSpT5W87.js} +75 -82
- package/dist/{utils-Blrh4N2n.js → utils-CgMZCHsX.js} +112 -41
- package/dist/vite.d.ts +585 -2
- package/dist/vite.js +21368 -1
- package/dist/{workspace-BWJQBK1u.d.ts → workspace-CYB2xZ1T.d.ts} +1 -1
- package/dist/{workspace-6pxkOuxr.js → workspace-sPWn2Jxj.js} +125 -40
- package/package.json +46 -55
- package/dist/ai-BW2ZhizI.d.ts +0 -177
- package/dist/ai.d.ts +0 -3
- package/dist/ai.js +0 -2
- package/dist/association-Cm0dUTDU-CDDhJnIh-Cv3bWnVb.js +0 -19
- package/dist/error-diagnostics-A_8Kp-48.js +0 -116
- package/dist/error-diagnostics-DY5GP47p.js +0 -96
- package/dist/events-7EBoeIPd-A2RUkJi5-BxrICQ17.js +0 -354
- package/dist/events-CRaLy7U3-3PNNp5WZ-Gv9nd0cH.js +0 -214
- package/dist/events-CeChclTf-CX-gD8oy-4aL2j6V-.js +0 -527
- package/dist/feed-DsC7Vws1-M_de2nSK-tKc0Pwo8.js +0 -248
- package/dist/feed-Dyf730Ys-D0HgBba6-BUnCa5gS.js +0 -179
- package/dist/file-C0_aPWSS.js +0 -26
- package/dist/file-metadata-CxDy-E2H.js +0 -58
- package/dist/forgejo-BN8ItCfl-Bbn4vhDd.js +0 -2278
- package/dist/github-DtncTfmv-Du2S8lGF.js +0 -4159
- package/dist/gitlab-BoDm8-BC-xzZsW9eW.js +0 -2530
- package/dist/graphql-DG5aJBT3-DceyFYdM-C4saqX37.js +0 -489
- package/dist/hosted-vercel-blob-DKntsHaf.js +0 -12603
- package/dist/inspect-BoObD2cJ.js +0 -167
- package/dist/mountx.d.ts +0 -8
- package/dist/mountx.js +0 -145
- package/dist/nitro.d.ts +0 -2
- package/dist/nitro.js +0 -2
- package/dist/nuxt.d.ts +0 -27
- package/dist/nuxt.js +0 -38
- package/dist/operations-BcpWr41m.js +0 -159
- package/dist/operations-CGqY1XeG.js +0 -965
- package/dist/operations-DnOwKsJT.d.ts +0 -136
- package/dist/registry-Cg1TJVVZ.d.ts +0 -10
- package/dist/request-execution-Dk9rY-Yh.js +0 -84
- package/dist/shared-DalXdP0i.js +0 -2158
- package/dist/state-B8zbLi5t.d.ts +0 -26
- package/dist/target-D4Bqb1eH.js +0 -11
- package/dist/templates-Bn8a-pd2-D9DhJEVD-CBfXNRzz.js +0 -125
- package/dist/token-CO62GglH.js +0 -61
- package/dist/use-DhwhbAVV.d.ts +0 -108
- package/dist/vite-BEvgU2GY.js +0 -20909
- package/dist/vite-CcZmMQ7S.d.ts +0 -476
- package/dist/webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js +0 -1565
package/dist/cloudflare.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as GitHubWorkspaceStoreOptions, t as CloudflareArtifactsWorkspaceStoreOptions, v as ResolvedWorkspaceModuleOptions, xn as WorkspaceStore } from "./types-BbtwmBZ5.js";
|
|
2
2
|
import { configureHostedWorkspaceRuntime } from "./hosted.js";
|
|
3
3
|
//#region src/providers/cloudflare/artifacts-store.d.ts
|
|
4
4
|
export declare function createCloudflareArtifactsWorkspaceStore(options: CloudflareArtifactsWorkspaceStoreOptions, workspaceName: string): WorkspaceStore;
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/cloudflare.d.ts
|
|
7
7
|
export type CloudflareWorkspaceRuntimeStoreOptions = Partial<CloudflareArtifactsWorkspaceStoreOptions> | (Partial<GitHubWorkspaceStoreOptions> & {
|
|
8
|
-
|
|
8
|
+
driver: "github";
|
|
9
9
|
});
|
|
10
10
|
export interface CloudflareWorkspaceRuntimeOptions {
|
|
11
11
|
assets?: boolean | string[];
|
package/dist/cloudflare.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as createCloudflareArtifactsWorkspaceStore, t as configureHostedWorkspaceRuntime } from "./hosted-KcUR_jPv.js";
|
|
2
2
|
export { configureHostedWorkspaceRuntime as configureCloudflareWorkspaceRuntime, createCloudflareArtifactsWorkspaceStore };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/runtime/config.ts
|
|
2
|
+
const workspaceRuntimeConfigKey = Symbol.for("vitehub.workspace.runtimeConfig");
|
|
3
|
+
function workspaceRuntimeConfigGlobal() {
|
|
4
|
+
const scope = globalThis;
|
|
5
|
+
scope[workspaceRuntimeConfigKey] ??= false;
|
|
6
|
+
return scope;
|
|
7
|
+
}
|
|
8
|
+
function setWorkspaceRuntimeConfig(config) {
|
|
9
|
+
workspaceRuntimeConfigGlobal()[workspaceRuntimeConfigKey] = config;
|
|
10
|
+
}
|
|
11
|
+
function getWorkspaceRuntimeConfig() {
|
|
12
|
+
return workspaceRuntimeConfigGlobal()[workspaceRuntimeConfigKey] ?? false;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { setWorkspaceRuntimeConfig as n, getWorkspaceRuntimeConfig as t };
|
|
@@ -1,43 +1,12 @@
|
|
|
1
1
|
import { s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
|
|
2
|
-
import { i as decodeFile, o as isWorkspaceBytes } from "./path
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
2
|
+
import { i as decodeFile, o as isWorkspaceBytes } from "./path--wrT_Azm.js";
|
|
3
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CtKjGtGb.js";
|
|
4
|
+
import { t as isRecord } from "./object-Da1zyPCR.js";
|
|
5
|
+
import { t as internalErrorDiagnostics } from "./error-diagnostics-DSkCJC_L.js";
|
|
6
|
+
import { t as abortable } from "./abort-BCwpdrN0.js";
|
|
5
7
|
import { posix } from "node:path";
|
|
6
8
|
import { createHash } from "node:crypto";
|
|
7
|
-
import { Diagnostic } from "nostics";
|
|
8
9
|
import { sourceIgnores } from "@vite-hub/source";
|
|
9
|
-
//#region ../internal/src/abort.ts
|
|
10
|
-
/**
|
|
11
|
-
* Runs `task` and rejects as soon as `signal` aborts, without waiting for the task.
|
|
12
|
-
*
|
|
13
|
-
* The rejection is `signal.reason`. When the reason is absent, it is an `AbortError` with `message`.
|
|
14
|
-
* When `signal` is already aborted, `task` does not run. The task should stop its own work
|
|
15
|
-
* through the same signal.
|
|
16
|
-
*/
|
|
17
|
-
function abortable(signal, message, task) {
|
|
18
|
-
return new Promise((resolve, reject) => {
|
|
19
|
-
if (signal?.aborted) {
|
|
20
|
-
reject(abortReason(signal, message));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const onAbort = () => reject(abortReason(signal, message));
|
|
24
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
25
|
-
const settle = () => signal?.removeEventListener("abort", onAbort);
|
|
26
|
-
new Promise((resolveTask) => resolveTask(task())).then((value) => {
|
|
27
|
-
settle();
|
|
28
|
-
resolve(value);
|
|
29
|
-
}, (error) => {
|
|
30
|
-
settle();
|
|
31
|
-
reject(error);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function abortReason(signal, message) {
|
|
36
|
-
if (signal?.reason !== void 0) return signal.reason;
|
|
37
|
-
const error = internalErrorDiagnostics.INTERNAL_R0003({ message });
|
|
38
|
-
error.name = "AbortError";
|
|
39
|
-
return error;
|
|
40
|
-
}
|
|
41
10
|
const maximumHttpMaxResponseBytes = 26214400;
|
|
42
11
|
function primitiveRuntimeTag(value) {
|
|
43
12
|
return value !== null && value !== void 0 && Object(value) !== value ? Object.prototype.toString.call(value) : void 0;
|
|
@@ -81,18 +50,10 @@ function normalizeForeignBlob(value) {
|
|
|
81
50
|
}
|
|
82
51
|
}
|
|
83
52
|
const httpInterruptedMessage = "[vitehub] HTTP request was interrupted.";
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
code: "INTERNAL_R0012",
|
|
89
|
-
docs: "https://vitehub.dev/docs/reference/diagnostics",
|
|
90
|
-
why: `[vitehub] HTTP request failed with status ${status}.`
|
|
91
|
-
}, HttpStatusError);
|
|
92
|
-
this.status = status;
|
|
93
|
-
this.name = "HttpStatusError";
|
|
94
|
-
}
|
|
95
|
-
};
|
|
53
|
+
/** `INTERNAL_R0012` with the HTTP status of the failed response. */
|
|
54
|
+
function httpStatusError(status) {
|
|
55
|
+
return Object.assign(internalErrorDiagnostics.INTERNAL_R0012({ message: `[vitehub] HTTP request failed with status ${status}.` }), { status });
|
|
56
|
+
}
|
|
96
57
|
async function executeHttpRequest(definition, options = {}) {
|
|
97
58
|
const normalized = normalizeHttpRequest(definition);
|
|
98
59
|
const responseType = options.responseType || "json";
|
|
@@ -158,7 +119,7 @@ async function fetchOnce(definition, responseType, send, retryFetchError, signal
|
|
|
158
119
|
} };
|
|
159
120
|
}
|
|
160
121
|
if (!response.ok) {
|
|
161
|
-
const cause =
|
|
122
|
+
const cause = httpStatusError(response.status);
|
|
162
123
|
cancelResponseBody(response);
|
|
163
124
|
return { failure: {
|
|
164
125
|
cause,
|
|
@@ -791,7 +752,10 @@ function normalizeWorkspaceSource(key, input) {
|
|
|
791
752
|
const mount = normalizeSourceMount(source);
|
|
792
753
|
const cache = ownSourceOption(mount, "cache") ?? normalizeSourceCache(source) ?? false;
|
|
793
754
|
const sync = normalizeSourceSync(ownSourceOption(source, "sync"));
|
|
794
|
-
const
|
|
755
|
+
const fileKey = fileSourceKey(source);
|
|
756
|
+
const declaredMountPath = ownSourceOption(mount, "path");
|
|
757
|
+
const mountPath = typeof declaredMountPath === "string" ? declaredMountPath : fileKey === void 0 ? defaultSourceMountPath(key, source) : "";
|
|
758
|
+
const probeKeys = ownSourceOption(source, "probeKeys")?.length ? ownSourceOption(source, "probeKeys") : fileKey === void 0 ? void 0 : [fileKey];
|
|
795
759
|
const requestDescriptor = getWorkspaceSourceRequestDescriptor(source);
|
|
796
760
|
if (requestDescriptor) assertWorkspaceSourceRequestDescriptorKey(key);
|
|
797
761
|
return {
|
|
@@ -803,7 +767,7 @@ function normalizeWorkspaceSource(key, input) {
|
|
|
803
767
|
sync,
|
|
804
768
|
validate: ownSourceOption(mount, "validate") ?? ownSourceOption(source, "validate") ?? false,
|
|
805
769
|
livePaths: getLiveWorkspaceSourcePaths(source),
|
|
806
|
-
...
|
|
770
|
+
...probeKeys ? { probeKeys } : {},
|
|
807
771
|
readonly: true,
|
|
808
772
|
requestDescriptor,
|
|
809
773
|
requestOnly: isWorkspaceSourceRequestOnly(source)
|
|
@@ -885,7 +849,7 @@ function toWorkspaceSource(input) {
|
|
|
885
849
|
return input;
|
|
886
850
|
}
|
|
887
851
|
function inferWorkspaceSource(input) {
|
|
888
|
-
if (!
|
|
852
|
+
if (!isRecord(input)) return input;
|
|
889
853
|
if (hasSourceMethods(input)) return input;
|
|
890
854
|
const providerFamilies = [];
|
|
891
855
|
if (hasOwn(input, "repo")) providerFamilies.push("github");
|
|
@@ -907,10 +871,10 @@ function inferWorkspaceSource(input) {
|
|
|
907
871
|
return input;
|
|
908
872
|
}
|
|
909
873
|
function ambiguousSourceConfiguration(families) {
|
|
910
|
-
return workspaceErrorDiagnostics.WORKSPACE_C0005({ message: `[vitehub] Workspace source configuration is ambiguous. Matched ${families.join(", ")}. A
|
|
874
|
+
return workspaceErrorDiagnostics.WORKSPACE_C0005({ message: `[vitehub] Workspace source configuration is ambiguous. Matched ${families.join(", ")}. A Source helper call, for example github(...) or custom(...), makes the source kind explicit.` });
|
|
911
875
|
}
|
|
912
876
|
function createInferredFetchSource(input) {
|
|
913
|
-
if (!
|
|
877
|
+
if (!isRecord(input)) return fetch$1(input);
|
|
914
878
|
const record = input;
|
|
915
879
|
const workspacePath = typeof record.workspacePath === "string" ? record.workspacePath : inferFetchWorkspacePath(record);
|
|
916
880
|
return fetch$1({
|
|
@@ -922,7 +886,10 @@ function createInferredWorkspaceSource(family, input) {
|
|
|
922
886
|
let sourcePromise;
|
|
923
887
|
const livePaths = inferredLivePaths(family, input);
|
|
924
888
|
async function loadSource() {
|
|
925
|
-
sourcePromise ||= loadInferredWorkspaceSource(family, input)
|
|
889
|
+
sourcePromise ||= loadInferredWorkspaceSource(family, input).catch((error) => {
|
|
890
|
+
sourcePromise = void 0;
|
|
891
|
+
throw error;
|
|
892
|
+
});
|
|
926
893
|
return await sourcePromise;
|
|
927
894
|
}
|
|
928
895
|
const source = {
|
|
@@ -962,12 +929,15 @@ function createInferredWorkspaceSource(family, input) {
|
|
|
962
929
|
},
|
|
963
930
|
async resolveRevision(ctx) {
|
|
964
931
|
return await (await loadSource()).resolveRevision?.(ctx);
|
|
932
|
+
},
|
|
933
|
+
async checkAccess(ctx) {
|
|
934
|
+
await (await loadSource()).checkAccess?.(ctx);
|
|
965
935
|
}
|
|
966
936
|
};
|
|
967
937
|
return livePaths ? markLiveWorkspaceSource(source, livePaths) : source;
|
|
968
938
|
}
|
|
969
939
|
function inferredSourceFingerprintOptions(family, input) {
|
|
970
|
-
if (family === "file" &&
|
|
940
|
+
if (family === "file" && isRecord(input)) {
|
|
971
941
|
const options = input;
|
|
972
942
|
if (hasOwn(options, "content") && isWorkspaceBytes(options.content)) return {
|
|
973
943
|
...options,
|
|
@@ -977,35 +947,23 @@ function inferredSourceFingerprintOptions(family, input) {
|
|
|
977
947
|
}
|
|
978
948
|
};
|
|
979
949
|
}
|
|
980
|
-
if (family !== "github" || !
|
|
950
|
+
if (family !== "github" || !isRecord(input)) return input;
|
|
981
951
|
return {
|
|
982
952
|
...input,
|
|
983
953
|
ignore: resolveGitHubIgnore(input.ignore)
|
|
984
954
|
};
|
|
985
955
|
}
|
|
986
956
|
async function loadInferredWorkspaceSource(family, input) {
|
|
987
|
-
if (family === "fetch" &&
|
|
957
|
+
if (family === "fetch" && isRecord(input)) return createInferredFetchSource(input);
|
|
988
958
|
if (family === "fetch") return createInferredFetchSource(input);
|
|
989
|
-
if (family === "file") return (await import("./file-
|
|
990
|
-
if (family === "github") return (await import("./github-
|
|
991
|
-
if (family === "glob") return (await import("./glob
|
|
992
|
-
return (await import("./mcp-resources-
|
|
959
|
+
if (family === "file") return (await import("./file-2pFYNtsU.js").then((n) => n.n)).file(input);
|
|
960
|
+
if (family === "github") return (await import("./github-CrYp4v8k.js").then((n) => n.n)).github(input);
|
|
961
|
+
if (family === "glob") return (await import("./glob-B8YGvTrZ.js").then((n) => n.n)).glob(input);
|
|
962
|
+
return (await import("./mcp-resources-DF0F5rcL.js").then((n) => n.n)).mcpResources(input);
|
|
993
963
|
}
|
|
994
964
|
function inferredSourceDefaults(family, input) {
|
|
995
|
-
if (!
|
|
996
|
-
|
|
997
|
-
probeKeys: [inferredFileSourceKey(input)]
|
|
998
|
-
} : {};
|
|
999
|
-
if (family === "file") {
|
|
1000
|
-
const declaredMount = ownSourceOption(input, "mount");
|
|
1001
|
-
return copySourceRuntimeOptions(input, {
|
|
1002
|
-
mount: typeof declaredMount === "object" && declaredMount && !Object.hasOwn(declaredMount, "path") ? {
|
|
1003
|
-
...declaredMount,
|
|
1004
|
-
path: ""
|
|
1005
|
-
} : declaredMount ?? "",
|
|
1006
|
-
probeKeys: [inferredFileSourceKey(input)]
|
|
1007
|
-
});
|
|
1008
|
-
}
|
|
965
|
+
if (!isRecord(input)) return family === "file" ? { key: inferredFileSourceKey(input) } : {};
|
|
966
|
+
if (family === "file") return copySourceRuntimeOptions(input, { key: inferredFileSourceKey(input) });
|
|
1009
967
|
if (family === "fetch") {
|
|
1010
968
|
const mountPath = dirname$1(inferFetchWorkspacePath(input));
|
|
1011
969
|
return copySourceRuntimeOptions(input, {
|
|
@@ -1038,7 +996,7 @@ function inferredFileSourceKey(input) {
|
|
|
1038
996
|
}
|
|
1039
997
|
function inferredLivePaths(family, input) {
|
|
1040
998
|
if (family === "mcpResources") return {};
|
|
1041
|
-
if (family !== "fetch" || !
|
|
999
|
+
if (family !== "fetch" || !isRecord(input)) return void 0;
|
|
1042
1000
|
const workspacePath = inferFetchWorkspacePath(input);
|
|
1043
1001
|
const mountPath = dirname$1(workspacePath);
|
|
1044
1002
|
const key = mountPath ? workspacePath.slice(mountPath.length + 1) : workspacePath;
|
|
@@ -1059,6 +1017,14 @@ function inferFetchWorkspacePath(input) {
|
|
|
1059
1017
|
if (!basename$1(path).includes(".")) path = `${path}.${responseType === "json" ? "json" : "txt"}`;
|
|
1060
1018
|
return path;
|
|
1061
1019
|
}
|
|
1020
|
+
/**
|
|
1021
|
+
* A file Source holds one item. Every file helper and the inferred `"README.md"` or `{ path }` forms set its key, so the
|
|
1022
|
+
* default mount is the same for all of them: the Workspace root, which puts the item at its own path.
|
|
1023
|
+
*/
|
|
1024
|
+
function fileSourceKey(source) {
|
|
1025
|
+
const key = ownSourceOption(source, "key");
|
|
1026
|
+
return source.name === "file" && typeof key === "string" ? normalizeSafeWorkspacePath(key) : void 0;
|
|
1027
|
+
}
|
|
1062
1028
|
function inferRepositoryMount(repo) {
|
|
1063
1029
|
return typeof repo === "string" ? repo.split("/").filter(Boolean).at(-1) : void 0;
|
|
1064
1030
|
}
|
|
@@ -1068,10 +1034,10 @@ function defaultSourceMountPath(key, source) {
|
|
|
1068
1034
|
}
|
|
1069
1035
|
function sourceFingerprintRepo(source) {
|
|
1070
1036
|
const fingerprint = source.fingerprint;
|
|
1071
|
-
if (!
|
|
1037
|
+
if (!isRecord(fingerprint)) return;
|
|
1072
1038
|
if (typeof fingerprint.repo === "string") return fingerprint.repo;
|
|
1073
1039
|
const options = fingerprint.options;
|
|
1074
|
-
if (
|
|
1040
|
+
if (isRecord(options) && typeof options.repo === "string") return options.repo;
|
|
1075
1041
|
}
|
|
1076
1042
|
function dirname$1(path) {
|
|
1077
1043
|
const parts = path.split("/").filter(Boolean);
|
|
@@ -1082,13 +1048,14 @@ function basename$1(path) {
|
|
|
1082
1048
|
return path.split("/").filter(Boolean).at(-1) || "";
|
|
1083
1049
|
}
|
|
1084
1050
|
function applyWorkspaceBinding(source, input) {
|
|
1085
|
-
if (!
|
|
1051
|
+
if (!isRecord(input)) return source;
|
|
1086
1052
|
const next = { ...source };
|
|
1087
1053
|
copyWorkspaceSourceMetadata(source, next);
|
|
1088
1054
|
copyDefinedWorkspaceBindingOption(next, input, "cache");
|
|
1089
1055
|
copyDefinedWorkspaceBindingOption(next, input, "materialize");
|
|
1090
1056
|
copyDefinedWorkspaceBindingOption(next, input, "mount");
|
|
1091
1057
|
copyDefinedWorkspaceBindingOption(next, input, "probeKeys");
|
|
1058
|
+
copyDefinedWorkspaceBindingOption(next, input, "skills");
|
|
1092
1059
|
copyDefinedWorkspaceBindingOption(next, input, "sync");
|
|
1093
1060
|
copyDefinedWorkspaceBindingOption(next, input, "validate");
|
|
1094
1061
|
return next;
|
|
@@ -1097,14 +1064,11 @@ function copyDefinedWorkspaceBindingOption(target, input, key) {
|
|
|
1097
1064
|
if (Object.hasOwn(input, key) && input[key] !== void 0) target[key] = input[key];
|
|
1098
1065
|
}
|
|
1099
1066
|
function isExplicitSourceBinding(input) {
|
|
1100
|
-
return
|
|
1067
|
+
return isRecord(input) && hasOwn(input, "source");
|
|
1101
1068
|
}
|
|
1102
1069
|
function hasSourceMethods(input) {
|
|
1103
1070
|
return typeof input.getKeys === "function" && typeof input.getItem === "function";
|
|
1104
1071
|
}
|
|
1105
|
-
function isPlainRecord(input) {
|
|
1106
|
-
return !!input && typeof input === "object" && !Array.isArray(input);
|
|
1107
|
-
}
|
|
1108
1072
|
function hasOwn(input, key) {
|
|
1109
1073
|
return Object.prototype.hasOwnProperty.call(input, key);
|
|
1110
1074
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as WorkspaceDefinition, Kt as WorkspaceSource, Yt as WorkspaceSourceInput, _n as WorkspaceSourceSyncPolicy, ft as WorkspaceMaterializeMode, j as WorkspaceCacheOptions, kn as WorkspaceValidateMode, nn as WorkspaceSourceRequestDescriptor } from "./types-BbtwmBZ5.js";
|
|
2
2
|
//#region src/sources/request-metadata.d.ts
|
|
3
3
|
declare function getWorkspaceSourceRequestDescriptor(source: WorkspaceSource): WorkspaceSourceRequestDescriptor | undefined;
|
|
4
4
|
declare function isWorkspaceSourceRequestOnly(source: WorkspaceSource): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/storage/discard.ts
|
|
2
|
+
/**
|
|
3
|
+
* Drops the writes that a Store keeps staged until `snapshot()`, so it loads the branch again on its next call. Only
|
|
4
|
+
* the GitHub and Cloudflare Artifacts Stores stage writes. Other Stores write through and do not have it.
|
|
5
|
+
*/
|
|
6
|
+
const workspaceStoreDiscard = Symbol.for("vitehub.workspace.storeDiscard");
|
|
7
|
+
//#endregion
|
|
8
|
+
export { workspaceStoreDiscard as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { L as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-BbtwmBZ5.js";
|
|
2
|
+
import { Durability, DurabilityContext } from "@vite-hub/runtime/durability";
|
|
3
|
+
//#region src/durability.d.ts
|
|
4
|
+
/** What the build passes to `workspaceDurability()`. */
|
|
5
|
+
export interface WorkspaceDurabilityInput {
|
|
6
|
+
/** The app passes its own `WorkspaceStore` object. */
|
|
7
|
+
custom?: true;
|
|
8
|
+
/** The build chose the store, so `BLOB_STORE_ID` or `BLOB_READ_WRITE_TOKEN` can switch it to Vercel Blob at boot. */
|
|
9
|
+
inferred?: boolean;
|
|
10
|
+
driver?: string;
|
|
11
|
+
/** The folder of the local store, relative to the project. */
|
|
12
|
+
root?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The durability of Workspace files, from the store driver. */
|
|
15
|
+
export declare function workspaceDurability(input: WorkspaceDurabilityInput, { env }: DurabilityContext): Durability[];
|
|
16
|
+
/** Read the Definitions of the eager generated registry, whose loaders return the module without a Promise. */
|
|
17
|
+
export declare function workspaceRegistryDefinitions(registry: Record<string, () => {
|
|
18
|
+
default?: WorkspaceDefinitionInput;
|
|
19
|
+
}>): Record<string, WorkspaceDefinitionInput | undefined>;
|
|
20
|
+
/** Read evaluated Definitions, including Agent Workspace options, with the runtime's store precedence. */
|
|
21
|
+
export declare function workspaceDefinitionsDurability(definitions: Record<string, WorkspaceDefinitionInput | undefined>, config: false | ResolvedWorkspaceModuleOptions, context: DurabilityContext): Durability[];
|
|
22
|
+
//#endregion
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-9s4Ufkm5.js";
|
|
2
|
+
import { s as workspaceRegistryLoadError, t as normalizeWorkspaceDefinition } from "./registry-CNphafBx.js";
|
|
3
|
+
//#region src/durability.ts
|
|
4
|
+
const sharedDrivers = {
|
|
5
|
+
"cloudflare": "Cloudflare Artifacts.",
|
|
6
|
+
"github": "A GitHub repository.",
|
|
7
|
+
"vercel": "Vercel Blob."
|
|
8
|
+
};
|
|
9
|
+
const fix = "Use a shared Workspace store, such as `workspace: { store: { driver: \"github\" } }` or Vercel Blob.";
|
|
10
|
+
/** The durability of Workspace files, from the store driver. */
|
|
11
|
+
function workspaceDurability(input, { env }) {
|
|
12
|
+
if (input.custom) return [{
|
|
13
|
+
primitive: "workspace",
|
|
14
|
+
store: "custom",
|
|
15
|
+
scope: "shared",
|
|
16
|
+
reason: "A custom Workspace store. ViteHub cannot see where it keeps files, so check that every instance reads the same store."
|
|
17
|
+
}];
|
|
18
|
+
const driver = input.inferred && input.driver === "local" && (env.BLOB_STORE_ID?.trim() || env.BLOB_READ_WRITE_TOKEN?.trim()) ? "vercel" : input.driver ?? "local";
|
|
19
|
+
const shared = sharedDrivers[driver];
|
|
20
|
+
if (shared) return [{
|
|
21
|
+
primitive: "workspace",
|
|
22
|
+
store: driver,
|
|
23
|
+
scope: "shared",
|
|
24
|
+
reason: shared
|
|
25
|
+
}];
|
|
26
|
+
if (driver === "memory") return [{
|
|
27
|
+
primitive: "workspace",
|
|
28
|
+
store: "memory",
|
|
29
|
+
scope: "process",
|
|
30
|
+
reason: "Workspace files live in the memory of this process.",
|
|
31
|
+
fix
|
|
32
|
+
}];
|
|
33
|
+
return [{
|
|
34
|
+
primitive: "workspace",
|
|
35
|
+
store: "local",
|
|
36
|
+
scope: "host",
|
|
37
|
+
reason: `Files in ${input.root ?? ".vitehub/workspaces"} on this host.`,
|
|
38
|
+
fix
|
|
39
|
+
}];
|
|
40
|
+
}
|
|
41
|
+
/** Read the Definitions of the eager generated registry, whose loaders return the module without a Promise. */
|
|
42
|
+
function workspaceRegistryDefinitions(registry) {
|
|
43
|
+
return Object.fromEntries(Object.entries(registry).map(([name, load]) => {
|
|
44
|
+
try {
|
|
45
|
+
return [name, load().default];
|
|
46
|
+
} catch (error) {
|
|
47
|
+
throw workspaceRegistryLoadError(name, error);
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
/** Read evaluated Definitions, including Agent Workspace options, with the runtime's store precedence. */
|
|
52
|
+
function workspaceDefinitionsDurability(definitions, config, context) {
|
|
53
|
+
const entries = Object.entries(definitions);
|
|
54
|
+
return (entries.length ? entries : [["default", {}]]).flatMap(([name, input]) => {
|
|
55
|
+
const definition = normalizeWorkspaceDefinition(name, input);
|
|
56
|
+
const store = resolveWorkspaceDefinitionStore(definition, config, {
|
|
57
|
+
env: context.env,
|
|
58
|
+
hosting: context.env.VITEHUB_HOST
|
|
59
|
+
});
|
|
60
|
+
return workspaceDurability(isWorkspaceStore(store) ? { custom: true } : {
|
|
61
|
+
driver: store?.driver,
|
|
62
|
+
root: store && "root" in store && typeof store.root === "string" ? store.root : config ? `${config.root}/${name}` : void 0
|
|
63
|
+
}, context).map((entry) => ({
|
|
64
|
+
...entry,
|
|
65
|
+
...entries.length ? { name } : {}
|
|
66
|
+
}));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { workspaceDefinitionsDurability, workspaceDurability, workspaceRegistryDefinitions };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { defineDiagnostics } from "nostics";
|
|
2
|
+
//#region src/error-diagnostics.ts
|
|
3
|
+
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
|
+
/** A code whose call site passes the message as `why`, with the fix that the reader applies. */
|
|
5
|
+
const withFix = (fix) => ({
|
|
6
|
+
...dynamicError,
|
|
7
|
+
fix
|
|
8
|
+
});
|
|
9
|
+
const workspaceErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
10
|
+
docsBase: "https://vitehub.dev/docs/workspace/diagnostics",
|
|
11
|
+
codes: {
|
|
12
|
+
WORKSPACE_FORBIDDEN: {
|
|
13
|
+
why: "An Agent may not write past an edit lease that a person holds.",
|
|
14
|
+
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 })."
|
|
15
|
+
},
|
|
16
|
+
WORKSPACE_HISTORY_FAILED: {
|
|
17
|
+
why: ({ workspace }) => `The history operation of Workspace "${workspace}" failed.`,
|
|
18
|
+
fix: "Read `error.cause` for the Store error. Check that the Store of the Workspace is reachable, then retry."
|
|
19
|
+
},
|
|
20
|
+
WORKSPACE_HISTORY_INVALID: {
|
|
21
|
+
why: ({ problem }) => problem === "empty-commit" ? "The commit has no changes. Pass `put` or `delete`." : "The cursor belongs to one ref. Pass the same ref.",
|
|
22
|
+
fix: "Pass `put` or `delete` to `workspace.commit`, and pass a `cursor` only with the `ref` of the `workspace.history` call that returned it."
|
|
23
|
+
},
|
|
24
|
+
WORKSPACE_NOT_FOUND: {
|
|
25
|
+
why: ({ id, path, problem, workspace }) => ({
|
|
26
|
+
path: `Revision ${id} has no path "${path}".`,
|
|
27
|
+
revision: `The Workspace has no revision "${id}". Pull again without a base revision.`,
|
|
28
|
+
target: `Workspace "${workspace}" has no ref or revision "${id}". Run \`vitehub workspace refs ${workspace}\` to list refs.`,
|
|
29
|
+
workspace: `Unknown Workspace: ${workspace}.`
|
|
30
|
+
})[problem],
|
|
31
|
+
fix: "Check the Workspace name, the ref or revision, and the path. `vitehub workspace refs <workspace>` lists the refs, and `vitehub workspace show <workspace> <ref>` lists the files. When a base revision is gone, pull again without it."
|
|
32
|
+
},
|
|
33
|
+
WORKSPACE_CHECKOUT_CONFLICT: {
|
|
34
|
+
why: ({ conflicted, workspace }) => `Workspace "${workspace}" has unresolved conflicts: ${conflicted}.`,
|
|
35
|
+
fix: "Edit each file and remove the conflict markers, or run `vitehub resolve` for a binary file. Then push again."
|
|
36
|
+
},
|
|
37
|
+
WORKSPACE_CHECKOUT_DIR: {
|
|
38
|
+
why: ({ dir, workspace }) => dir === void 0 ? `Workspace "${workspace}" is not checked out yet.` : `The checkout folder "${dir}" must be a folder inside the project, not the project root.`,
|
|
39
|
+
fix: "Pass `--dir` with a folder inside the project, such as `vitehub pull <workspace> --dir content`."
|
|
40
|
+
},
|
|
41
|
+
WORKSPACE_CHECKOUT_FAILED: {
|
|
42
|
+
why: ({ message }) => message,
|
|
43
|
+
fix: "Read the message. Run `vitehub status` to see the state of the checkout, then run the command again."
|
|
44
|
+
},
|
|
45
|
+
WORKSPACE_CHECKOUT_MISSING: {
|
|
46
|
+
why: ({ workspace }) => workspace === void 0 ? "vitehub.lock has no checked-out Workspace." : `Workspace "${workspace}" is not checked out.`,
|
|
47
|
+
fix: "Run `vitehub pull <workspace> --dir <folder>` first."
|
|
48
|
+
},
|
|
49
|
+
WORKSPACE_CHECKOUT_OPTIONS: {
|
|
50
|
+
why: ({ actual, expected, key, workspace }) => workspace === void 0 ? `This checkout uses ${expected}, not "${actual}".` : `Workspace "${workspace}" is checked out with ${key} "${expected}", not "${actual}".`,
|
|
51
|
+
fix: "Edit `vitehub.lock` to change the `dir` or `ref` of the entry. To change the remote, remove the entry from `vitehub.lock` and pull into a new folder."
|
|
52
|
+
},
|
|
53
|
+
WORKSPACE_CHECKOUT_OVERLAP: {
|
|
54
|
+
why: ({ dir, other, otherDir, workspace }) => `Workspace "${workspace}" folder "${dir}" overlaps Workspace "${other}" folder "${otherDir}".`,
|
|
55
|
+
fix: "Use separate checkout folders that do not contain one another."
|
|
56
|
+
},
|
|
57
|
+
WORKSPACE_CHECKOUT_PATH: {
|
|
58
|
+
why: ({ other, path, problem }) => ({
|
|
59
|
+
"excluded": `The path "${path}" is excluded from the checkout.`,
|
|
60
|
+
"not-portable": `The path "${path}" has a component that is not portable between file systems.`,
|
|
61
|
+
"not-relative": `The remote path "${path}" is not a relative Workspace path.`,
|
|
62
|
+
"reserved": `The top-level file name "${path}" is reserved by the operation input map.`,
|
|
63
|
+
"spelling": `The checkout paths "${other}" and "${path}" use different spellings for one file-system path, or replace a file with a directory.`
|
|
64
|
+
})[problem],
|
|
65
|
+
fix: "Rename the path to a portable name that the checkout does not exclude, before you pull or push it. For two spellings of one path, rename one. For a file that a folder replaces, keep local edits elsewhere, remove the `vitehub.lock` entry, and pull into a new empty folder."
|
|
66
|
+
},
|
|
67
|
+
WORKSPACE_CHECKOUT_SYMLINK: {
|
|
68
|
+
why: ({ path }) => path === "vitehub.lock" ? "vitehub.lock is a symbolic link. A checkout reads and writes only a real lock file." : `${path} is a symbolic link. A checkout reads and writes only real files and folders.`,
|
|
69
|
+
fix: "Replace the symbolic link with a real folder or file, then try again."
|
|
70
|
+
},
|
|
71
|
+
WORKSPACE_CHECKOUT_TOO_LARGE: {
|
|
72
|
+
why: ({ largest, limit, size, workspace }) => `The push of Workspace "${workspace}" is ${size}, over the ${limit} limit of one push.${largest ? ` Largest files: ${largest}.` : ""}`,
|
|
73
|
+
fix: "A push is one revision and sends each changed file whole, with binary files in base64. Keep large media in Blob, or add new files in smaller groups with a push after each group."
|
|
74
|
+
},
|
|
75
|
+
WORKSPACE_CHECKOUT_USAGE: {
|
|
76
|
+
why: ({ command, flag, problem }) => ({
|
|
77
|
+
flag: `Unknown flag --${flag}.`,
|
|
78
|
+
names: `${command} accepts at most one Workspace name.`,
|
|
79
|
+
value: `--${flag} needs a value.`
|
|
80
|
+
})[problem],
|
|
81
|
+
fix: "Pass only the flags of the command, each with its value, and at most one Workspace name, for example `vitehub pull docs --dir content`."
|
|
82
|
+
},
|
|
83
|
+
WORKSPACE_LOCK_BUSY: {
|
|
84
|
+
why: "Another vitehub command is writing vitehub.lock: vitehub.lock.lock exists.",
|
|
85
|
+
fix: "Wait for that command to finish and try again. If no vitehub command runs, delete `vitehub.lock.lock`."
|
|
86
|
+
},
|
|
87
|
+
WORKSPACE_LOCK_INVALID: {
|
|
88
|
+
why: ({ problem }) => problem === "json" ? "vitehub.lock is not valid JSON." : "vitehub.lock has no `version: 1` and `workspaces` object.",
|
|
89
|
+
fix: "Fix the conflict in `vitehub.lock`, or delete the entry and pull again."
|
|
90
|
+
},
|
|
91
|
+
WORKSPACE_RENAMED_STORE_PROVIDER_KEY: {
|
|
92
|
+
why: ({ provider }) => `The Workspace \`store\` sets \`provider: ${provider}\`. ViteHub renamed this key to \`driver\`, and it does not read \`provider\`, so the Store would not be the one you chose.`,
|
|
93
|
+
fix: ({ driver }) => `Set \`store: { driver: ${driver} }\`, or run \`npx @vite-hub/codemods driver-key\` to rename it in every config file.`
|
|
94
|
+
},
|
|
95
|
+
WORKSPACE_UNKNOWN_STORE_DRIVER: {
|
|
96
|
+
why: ({ driver, renamed }) => renamed ? `The Workspace \`store.driver\` is ${driver}. ViteHub renamed this driver to "${renamed}", and it does not read ${driver}.` : `The Workspace \`store.driver\` ${driver} is not a Workspace Store driver.`,
|
|
97
|
+
fix: ({ renamed }) => renamed ? `Set \`store: { driver: "${renamed}" }\`, or run \`npx @vite-hub/codemods driver-key\` to rename it in every config file.` : "Set `store.driver` to \"local\", \"memory\", \"github\", \"cloudflare\", or \"vercel\", or pass a Store object."
|
|
98
|
+
},
|
|
99
|
+
WORKSPACE_REGISTRY_LOAD_FAILED: {
|
|
100
|
+
why: ({ reason, workspace }) => `The module of Workspace "${workspace}" did not load: ${reason}`,
|
|
101
|
+
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."
|
|
102
|
+
},
|
|
103
|
+
WORKSPACE_SOURCE_ACCESS_FAILED: {
|
|
104
|
+
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.`,
|
|
105
|
+
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."
|
|
106
|
+
},
|
|
107
|
+
WORKSPACE_R0069: withFix("Use a Store with retained history: `createBlobDatabaseWorkspaceStore()` or the `github` Store. Open the Workspace with a scope that grants the complete Workspace, not selected paths."),
|
|
108
|
+
WORKSPACE_R0070: withFix("Pass a `limit` from 1 to 100, and pass a `cursor` only with the `ref` of the `history.list()` call that returned it."),
|
|
109
|
+
WORKSPACE_R0071: withFix("Use a ref name with up to 128 letters, numbers, `_`, and `-`, joined by single `.` or `/`, for example `draft` or `team/review`. In a GitHub Store with `refs`, use `published` or `draft`, not the branch name."),
|
|
110
|
+
WORKSPACE_R0072: withFix("Set the `repository` option of the GitHub Store or `VITEHUB_WORKSPACE_GITHUB_REPOSITORY`, for example `owner/repo`. Set the `token` option or `VITEHUB_GITHUB_TOKEN`."),
|
|
111
|
+
WORKSPACE_R0073: withFix("Make the commit message or metadata shorter, as the message says. Remove each `Vitehub-Metadata:` line from the message, and pass the values in the `metadata` option."),
|
|
112
|
+
WORKSPACE_R0001: withFix("Pass the path of a file or folder in the Workspace, for example `docs/guide.md`. The Workspace root itself cannot be written, moved, or deleted."),
|
|
113
|
+
WORKSPACE_R0002: withFix("Enable at least one operation in `createWorkspaceTools(workspace, { operations })`, for example `{ operations: { read: true } }`."),
|
|
114
|
+
WORKSPACE_R0003: withFix("Get write tools from `useWorkspace(name, { mode: \"write\" }).tools.write()`. Do not pass the result of `useWorkspace()` to `createWorkspaceTools()`. Or remove `write` from `operations`."),
|
|
115
|
+
WORKSPACE_B0001: withFix("Export the Workspace Definition from the file, for example `export default defineWorkspace({ ... })`. For a contributed Workspace, set `definition.export` to the name of the export."),
|
|
116
|
+
WORKSPACE_B0002: withFix("Use `defineWorkspace()` in `server/workspaces/<name>.ts`. Move the `defineAgent()` call to `server/agents/<name>/agent.ts`."),
|
|
117
|
+
WORKSPACE_B0003: withFix("Rename or remove one of the definitions that the message lists. Each Workspace name has one definition."),
|
|
118
|
+
WORKSPACE_B0004: withFix("Set `vitehub.workspaces` in the plugin to an array of `{ name, definition: { module, export? }, reason? }` entries, or to a function that returns one. Set `module` to an absolute path, a `file:` URL, or a package specifier."),
|
|
119
|
+
WORKSPACE_B0005: withFix("Set the Cloudflare Artifacts Store in the `workspace` config, for example `vitehub({ workspace: { store: { driver: \"cloudflare\", binding: \"WORKSPACE_ARTIFACTS\", namespace: \"vitehub\" } } })`, and remove `store` from the Workspace Definition. Or remove the import that the build cannot load from the Definition file, so that the build can read its `store`."),
|
|
120
|
+
WORKSPACE_R0004: withFix("Put a value after the option, for example `--timeout 30000` or `--url http://localhost:5173`."),
|
|
121
|
+
WORKSPACE_R0005: withFix("Pass a whole number of milliseconds from 1 to 2147483647, for example `--timeout 30000`."),
|
|
122
|
+
WORKSPACE_R0006: withFix("Pass a whole number of milliseconds from 1 to 2147483647, for example `--timeout 30000`."),
|
|
123
|
+
WORKSPACE_R0007: withFix("Remove the option. `vitehub workspace dev --help` lists the options."),
|
|
124
|
+
WORKSPACE_R0008: withFix("Put a command after `exec`, for example `vitehub workspace dev docs exec ls`."),
|
|
125
|
+
WORKSPACE_R0009: withFix("Put `exec` before the command, for example `vitehub workspace dev docs exec ls -la`. Or omit the command to open the interactive command loop."),
|
|
126
|
+
WORKSPACE_C0001: withFix("Set `workspace` to an object, for example `workspace: { store: { driver: \"memory\" } }`, or to `false`."),
|
|
127
|
+
WORKSPACE_C0002: withFix("Remove the option. The `workspace` config accepts `assets`, `projectRoot`, `root`, and `store`."),
|
|
128
|
+
WORKSPACE_R0015: withFix("Remove the option. `defineWorkspace()` accepts `bindings`, `commit`, `hooks`, `loaders`, `plugins`, `rootDir`, `rules`, `sourceRootDir`, `sources`, and `store`."),
|
|
129
|
+
WORKSPACE_R0016: withFix("Pass an object to `defineWorkspace()`, for example `defineWorkspace({ sources: {} })`."),
|
|
130
|
+
WORKSPACE_R0017: withFix("Remove `name` from the Workspace Definition. The file name sets the Workspace name, for example `server/workspaces/docs.ts` defines `docs`."),
|
|
131
|
+
WORKSPACE_R0018: withFix("Use fewer and shorter glob patterns with fewer `{a,b}` and `*` parts, for example `docs/**/*.md` in place of a list of patterns."),
|
|
132
|
+
WORKSPACE_R0019: withFix("Use fewer and shorter glob patterns with fewer `{a,b}` and `*` parts, for example `docs/**/*.md` in place of a list of patterns."),
|
|
133
|
+
WORKSPACE_R0020: withFix("Use fewer and shorter glob patterns with fewer `{a,b}` and `*` parts, for example `docs/**/*.md` in place of a list of patterns."),
|
|
134
|
+
WORKSPACE_R0021: withFix("Remove `name` from the Workspace Definition. The file name sets the Workspace name, for example `server/workspaces/docs.ts` defines `docs`."),
|
|
135
|
+
WORKSPACE_R0022: withFix("Pass the Workspace name as a non-empty string, for example `registerWorkspace(\"docs\", definition)` or `registerWorkspacePlugin(\"docs\", plugin)`."),
|
|
136
|
+
WORKSPACE_R0023: withFix("Set `maxBytes` to a number of bytes or to a string such as `\"512kb\"` or `\"10mb\"`."),
|
|
137
|
+
WORKSPACE_R0024: withFix("Give each Workspace plugin a non-empty string `id`, for example `{ id: \"my-plugin\", rules }`."),
|
|
138
|
+
WORKSPACE_R0025: withFix("Declare the target as a `fetch()` Source in the Workspace Definition, and make the Source visible in the Workspace scope."),
|
|
139
|
+
WORKSPACE_R0026: withFix("Use a Store that supports rebase: `github` or `cloudflare`. Or do not call `rebase()` on this Workspace."),
|
|
140
|
+
WORKSPACE_R0027: withFix("Set another `binding` in the Workspace `store` options, or set `namespace` to the namespace that Wrangler config already has for that binding."),
|
|
141
|
+
WORKSPACE_R0028: withFix("The client closed the Workspace Dev connection before the command finished. Run the command again and keep the connection open."),
|
|
142
|
+
WORKSPACE_R0029: withFix("Give each Cloudflare Artifacts namespace its own `binding` in the Workspace `store` options."),
|
|
143
|
+
WORKSPACE_R0033: withFix("Run the operation again. If it fails again, check the Blob store of the project in the Vercel dashboard."),
|
|
144
|
+
WORKSPACE_R0034: withFix("Pass the Workspace name, for example `createWorkspacePreparation({ workspace: \"docs\" })`."),
|
|
145
|
+
WORKSPACE_R0035: withFix("Pass Source keys of the Workspace as non-empty strings, for example `sources: [\"handbook\"]`, or omit `sources`."),
|
|
146
|
+
WORKSPACE_R0036: withFix("Set `retryDelayMs` to a number of milliseconds from 0 to 2147483647, or omit it to use 10000."),
|
|
147
|
+
WORKSPACE_R0037: withFix("Set `materialize: \"startup\"` on the Sources to prepare, or pass their keys in `sources`."),
|
|
148
|
+
WORKSPACE_R0038: withFix("Check each Source that the message names: its URL, repository, or files, and its credentials. Without `requireNonEmpty`, an empty Source is ready."),
|
|
149
|
+
WORKSPACE_R0039: withFix("`stop()` cancelled this preparation. Call `start()` again to prepare the Workspace."),
|
|
150
|
+
WORKSPACE_R0040: withFix("Pass a non-empty command, for example `vitehub workspace dev docs exec ls`."),
|
|
151
|
+
WORKSPACE_R0041: withFix("Pass a Workspace name, or a Workspace from `useWorkspace(name, { mode: \"write\" })`, that can start a Workspace Session."),
|
|
152
|
+
WORKSPACE_R0042: withFix("This is a ViteHub bug. Report it at https://github.com/vite-hub/vitehub/issues with the message and your Workspace Definition."),
|
|
153
|
+
WORKSPACE_R0043: withFix("This is a ViteHub bug. Report it at https://github.com/vite-hub/vitehub/issues with the message and your Workspace Definition."),
|
|
154
|
+
WORKSPACE_R0044: withFix("Make sure that the Workspace Session host can run `readlink` and can read the path in the message."),
|
|
155
|
+
WORKSPACE_R0045: withFix("Set `executionAuthority` on the Workspace Session host. Use `unknownExecutionAuthority` from `@vite-hub/runtime` when the host cannot describe it."),
|
|
156
|
+
WORKSPACE_C0003: withFix("Rename the Source key to one file name without `/` and without a `.json` ending, for example `issues`. ViteHub keeps the request descriptor at `.vitehub/sources/<key>.json`."),
|
|
157
|
+
WORKSPACE_C0004: withFix("Set `mount` on the Source to a folder, for example `mount: \"docs\"`, or set `probeKeys`. A Workspace Scope grant needs paths, and a Source at the root has none."),
|
|
158
|
+
WORKSPACE_C0005: withFix("Use a Source helper so that the Source kind is explicit, for example `github({ repo: \"owner/name\" })`, `fetch({ url, workspacePath: \"issues.json\" })`, or `file({ path: \"README.md\" })`. A `{ source: { ... } }` wrapper does not help, because ViteHub reads the options in it the same way."),
|
|
159
|
+
WORKSPACE_C0006: withFix("Pass `path` or `workspacePath` to `file()`, for example `file({ path: \"README.md\" })`."),
|
|
160
|
+
WORKSPACE_C0007: withFix("When the URL has a query, set `path` on the Source config, for example `{ url, path: \"issues.json\" }`. Or use the `fetch()` helper with `workspacePath: \"issues.json\"`."),
|
|
161
|
+
WORKSPACE_R0046: withFix("Set `workspacePath` on the `fetch()` Source to read the response as a file. A request-only Source answers only `curl` Source requests."),
|
|
162
|
+
WORKSPACE_R0047: withFix("Read the `fetch()` Source at its `workspacePath`. The Source has no other file."),
|
|
163
|
+
WORKSPACE_R0048: withFix("Read this Source in an Agent Invocation. The Agent runs the resolver with the Invocation context before it reads the Source. Outside an Invocation, the Source has no files."),
|
|
164
|
+
WORKSPACE_R0049: withFix("Set `responseType` to `\"json\"` or `\"text\"`."),
|
|
165
|
+
WORKSPACE_R0050: withFix("Set `method` to `\"GET\"`, `\"HEAD\"`, or `\"POST\"`."),
|
|
166
|
+
WORKSPACE_R0051: withFix("Use `query` for a fixed query or `querySchema` for a query that the Agent sets. Remove the other one, and remove the query from `url` when you use `querySchema`."),
|
|
167
|
+
WORKSPACE_R0052: withFix("Use `body` for a fixed body or `bodySchema` for a body that the Agent sets. Remove the other one."),
|
|
168
|
+
WORKSPACE_R0053: withFix("Set `method: \"POST\"` to send a body, or remove `body` and `bodySchema`."),
|
|
169
|
+
WORKSPACE_R0054: withFix("Pass a schema that has `~standard.jsonSchema.input()`, the Standard JSON Schema interface. Or use a fixed `query` or `body`."),
|
|
170
|
+
WORKSPACE_R0055: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
171
|
+
WORKSPACE_R0056: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
172
|
+
WORKSPACE_R0057: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
173
|
+
WORKSPACE_R0058: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
174
|
+
WORKSPACE_R0059: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
175
|
+
WORKSPACE_R0060: withFix("Read this Source in an Agent Invocation. The Agent runs the resolver with the Invocation context before it reads the Source. Outside an Invocation, the Source has no files."),
|
|
176
|
+
WORKSPACE_R0061: withFix("Return `repo` from the `github()` resolver, for example `{ repo: \"owner/name\" }`, or start the Agent Invocation with a `pullRequest` context value."),
|
|
177
|
+
WORKSPACE_R0063: withFix("Use the URL of exactly one Source that the Workspace scope can see. Read `.vitehub/sources/<source>.json` in the Workspace and send the URL, method, query, and body that it declares."),
|
|
178
|
+
WORKSPACE_R0064: withFix("This is a ViteHub bug. Report it at https://github.com/vite-hub/vitehub/issues with the message and your Workspace Definition."),
|
|
179
|
+
WORKSPACE_R0065: withFix("The Cloudflare Artifacts Store keeps its Git checkout in memory. A Git step used the path in the message in a way that the error code rejects, for example `ENOENT` for a missing file. Run the operation again. If it fails again, report it at https://github.com/vite-hub/vitehub/issues with the message."),
|
|
180
|
+
WORKSPACE_R0066: withFix("Connect a Blob store to the Vercel project so that it gets `BLOB_STORE_ID`. Off Vercel, set `BLOB_READ_WRITE_TOKEN`."),
|
|
181
|
+
WORKSPACE_R0074: withFix("The Workspace Store keeps no file revisions, so ViteHub cannot prove that the file at the path in the message is the one it started to remove. Check the file. If it must go, delete it in the Store itself, for example in its directory or bucket, because the Workspace rejects writes under a Source. Then run the Source operation again."),
|
|
182
|
+
WORKSPACE_R0075: withFix("Remove `read` from the rule. Workspace rules limit writes only, so `read: false` would not hide the files. Keep files that a reader must not see out of the Workspace, for example in another Workspace or in an Env secret."),
|
|
183
|
+
WORKSPACE_R0076: withFix("Remove the option from the rule. A Workspace rule accepts `commit`, `maxBytes`, `mediaType`, `validate`, and `write`."),
|
|
184
|
+
WORKSPACE_R0077: withFix("Pass the Drizzle database of the history Database: `database: () => useDatabase(\"history\").db` with `import { useDatabase } from \"vite-hub/database\"`. A Database Definition from `defineDatabase()` is not a Drizzle database.")
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
//#endregion
|
|
188
|
+
export { workspaceErrorDiagnostics as t };
|