@vite-hub/sandbox 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.
- package/dist/{cloudflare-Cog_r2Me.js → cloudflare-DOrMY3MJ.js} +1 -11
- package/dist/{container-CqfD8yuE.js → container-BVb0fw3z.js} +1 -5
- package/dist/{crabbox-sbV3Zjuo.js → crabbox-BU8W1gVC.js} +1 -5
- package/dist/{index-DsoQAUb7.d.ts → index-DHl0T43e.d.ts} +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -10
- package/dist/internal/cloudflare.d.ts +1 -1
- package/dist/internal/cloudflare.js +2 -2
- package/dist/internal/host-toolchain.d.ts +1 -1
- package/dist/internal/host-toolchain.js +1 -1
- package/dist/internal/vercel.d.ts +1 -1
- package/dist/internal/vercel.js +2 -2
- package/dist/{module-types-BoOZiNN4.d.ts → module-types-NYnG3NGz.d.ts} +1 -1
- package/dist/{provider-loader-BDgDJ6bX.d.ts → provider-loader-Cvqoz7_Z.d.ts} +2 -2
- package/dist/{remote-70ZVZZlq.js → remote-fjUPBiLJ.js} +1 -5
- package/dist/ssh.js +6 -2
- package/dist/task/index.d.ts +1 -2
- package/dist/task/index.js +2 -7
- package/dist/task/runtime/provider-loader.d.ts +1 -1
- package/dist/task/runtime/providers/cloudflare.d.ts +2 -2
- package/dist/task/runtime/providers/local.d.ts +1 -1
- package/dist/task/runtime/providers/local.js +2 -2
- package/dist/task/runtime/providers/vercel.d.ts +2 -2
- package/dist/task/runtime/providers/vercel.js +5 -10
- package/dist/task/runtime/state.d.ts +2 -2
- package/dist/task/vite.d.ts +3 -1
- package/dist/task/vite.js +56 -49
- package/dist/{toolchain-BIVGMRty.js → toolchain-DF9eutyQ.js} +0 -6
- package/dist/{trusted-host-RanFsFSB.js → trusted-host-DLYiKP8a.js} +31 -15
- package/dist/{size-DJNpXeAt.js → vercel-credentials-BNTh2X-Y.js} +17 -1
- package/dist/{vercel-BGGrNpza.js → vercel-qyDr7NvU.js} +25 -17
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ import { t as sandboxErrorDiagnostics } from "./error-diagnostics-BJtLRL9w.js";
|
|
|
4
4
|
import { n as invariantError } from "./invariant-DolT9EEx.js";
|
|
5
5
|
import { t as shellQuote } from "./shell-quote-Q3u3plif.js";
|
|
6
6
|
import { t as listCommandFiles } from "./file-listing-CHtRrfo1.js";
|
|
7
|
-
import { i as resolveRemoteEnvironment, n as openRemoteSandbox, o as snapshotStream, r as remoteSandboxPlan } from "./remote-
|
|
7
|
+
import { i as resolveRemoteEnvironment, n as openRemoteSandbox, o as snapshotStream, r as remoteSandboxPlan } from "./remote-fjUPBiLJ.js";
|
|
8
8
|
import { n as cloudflareRetryDelays, r as readCloudflareFailure, t as canRetryCloudflareRequest } from "./cloudflare-failure-CFQhalfh.js";
|
|
9
9
|
import { n as killOnAbort } from "./abortable-CR01hzfi.js";
|
|
10
10
|
//#region src/internal/cloudflare-transport.ts
|
|
@@ -148,7 +148,6 @@ var SandboxProcessRecord = class {
|
|
|
148
148
|
logs() {
|
|
149
149
|
return { ...this.#output };
|
|
150
150
|
}
|
|
151
|
-
/** Server-sent events: buffered output, then live output, then `exit`. Same format as @cloudflare/sandbox 0.12. */
|
|
152
151
|
stream() {
|
|
153
152
|
const encoder = new TextEncoder();
|
|
154
153
|
let listener;
|
|
@@ -539,10 +538,6 @@ function sandboxNetworkAuthority(policy) {
|
|
|
539
538
|
if (policy === "deny-all") return "none";
|
|
540
539
|
return "restricted";
|
|
541
540
|
}
|
|
542
|
-
/**
|
|
543
|
-
* Cloudflare decrypts HTTPS to allowed hosts and signs it again with this CA. It exists while HTTPS interception is on.
|
|
544
|
-
* `exec()` does not inherit the environment of the Container start, so every command gets these variables.
|
|
545
|
-
*/
|
|
546
541
|
const cloudflareContainerCa = "/etc/cloudflare/certs/cloudflare-containers-ca.crt";
|
|
547
542
|
const cloudflareInterceptedHttpsEnv = Object.freeze({
|
|
548
543
|
CURL_CA_BUNDLE: cloudflareContainerCa,
|
|
@@ -600,10 +595,6 @@ function createCloudflareRuntime(options) {
|
|
|
600
595
|
}
|
|
601
596
|
});
|
|
602
597
|
}
|
|
603
|
-
/**
|
|
604
|
-
* Reaches the Sandbox Durable Object that the ViteHub Cloudflare host integration exports.
|
|
605
|
-
* @cloudflare/sandbox 1.0 has no `getSandbox`; the generated class implements this stub over RPC.
|
|
606
|
-
*/
|
|
607
598
|
function getCloudflareSandbox(namespace, id, options = {}, networkPolicy = "allow-all") {
|
|
608
599
|
const target = namespace.get(namespace.idFromName(options.normalizeId ? id.toLowerCase() : id));
|
|
609
600
|
let configured;
|
|
@@ -820,7 +811,6 @@ function exitedProcessLogs(logs) {
|
|
|
820
811
|
stdout: snapshotStream(async () => (await logs).stdout)
|
|
821
812
|
};
|
|
822
813
|
}
|
|
823
|
-
/** Bounds each channel independently so an unread channel cannot stall its sibling. */
|
|
824
814
|
function processLogStreams(logs) {
|
|
825
815
|
const bufferLimit = 1048576;
|
|
826
816
|
const encoder = new TextEncoder();
|
|
@@ -2,7 +2,7 @@ import { r as markBuiltInSandboxRuntime } from "./runtime-DHp6ImeP.js";
|
|
|
2
2
|
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-BJtLRL9w.js";
|
|
3
3
|
import { t as shellQuote } from "./shell-quote-Q3u3plif.js";
|
|
4
4
|
import { t as listCommandFiles } from "./file-listing-CHtRrfo1.js";
|
|
5
|
-
import { i as resolveRemoteEnvironment, n as openRemoteSandbox, r as remoteSandboxPlan } from "./remote-
|
|
5
|
+
import { i as resolveRemoteEnvironment, n as openRemoteSandbox, r as remoteSandboxPlan } from "./remote-fjUPBiLJ.js";
|
|
6
6
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
7
7
|
import { posix } from "node:path";
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
@@ -218,7 +218,6 @@ const reservedCredentialNames = /* @__PURE__ */ new Set([
|
|
|
218
218
|
"XDG_CONFIG_HOME",
|
|
219
219
|
"XDG_STATE_HOME"
|
|
220
220
|
]);
|
|
221
|
-
/** Names that the Docker CLI reads itself. Their Sandbox values travel on the command line instead of the CLI environment. */
|
|
222
221
|
const cliEnvironment = (name) => name === "PATH" || name === "HOME" || name.startsWith("DOCKER_") || name.startsWith("XDG_");
|
|
223
222
|
function createContainerRuntime(options) {
|
|
224
223
|
const normalized = normalizeContainerOptions(options);
|
|
@@ -335,7 +334,6 @@ function assertCredentialNames(input, options) {
|
|
|
335
334
|
function invalid(message) {
|
|
336
335
|
return sandboxErrorDiagnostics.SANDBOX_R0160({ message: `[vitehub] ${message}` });
|
|
337
336
|
}
|
|
338
|
-
/** Docker object names allow [a-zA-Z0-9][a-zA-Z0-9_.-]. */
|
|
339
337
|
function dockerName(id) {
|
|
340
338
|
return `vitehub-sandbox-${id.replace(/[^a-zA-Z0-9_.-]/g, "-").replace(/^[^a-zA-Z0-9]+/, "").slice(0, 40) || "session"}-${randomBytes(4).toString("hex")}`;
|
|
341
339
|
}
|
|
@@ -637,7 +635,6 @@ async function writeContainerFile(docker, container, path, content, signal, user
|
|
|
637
635
|
function createContainerSession(state) {
|
|
638
636
|
const children = /* @__PURE__ */ new Set();
|
|
639
637
|
let destroyPromise;
|
|
640
|
-
/** Starts `command` in the Sandbox. The wrapper records the process id so kill() reaches the Sandbox process, not only the Docker CLI. */
|
|
641
638
|
const start = (options, stdin) => {
|
|
642
639
|
const pidFile = `${pidDirectory}/${randomUUID()}`;
|
|
643
640
|
const environment = {
|
|
@@ -857,7 +854,6 @@ function createContainerSession(state) {
|
|
|
857
854
|
}
|
|
858
855
|
};
|
|
859
856
|
}
|
|
860
|
-
/** Relative file paths are relative to the Sandbox workspace, like command working directories. */
|
|
861
857
|
function sandboxPath(path) {
|
|
862
858
|
return posix.isAbsolute(path) ? path : posix.join(sandboxWorkspace, path);
|
|
863
859
|
}
|
|
@@ -286,13 +286,9 @@ function environmentWrapper(assignments) {
|
|
|
286
286
|
const values = Object.entries(assignments).map(([name, value]) => `${name}=${shellQuote(value)}`).join(" ");
|
|
287
287
|
return new TextEncoder().encode(`#!/bin/sh\nexec env -i ${values} "$@"\n`);
|
|
288
288
|
}
|
|
289
|
-
/**
|
|
290
|
-
* Install into the shared target cache, then rewrite the command wrapper so
|
|
291
|
-
* every Sandbox command sees the toolchain first on PATH.
|
|
292
|
-
*/
|
|
293
289
|
async function provisionCrabboxToolchain(toolchain, session, context) {
|
|
294
290
|
const { abortSignal, leaseId, options } = context;
|
|
295
|
-
const { provisionToolchain, readProjectFilesWithShell, verifyToolchain } = await import("./toolchain-
|
|
291
|
+
const { provisionToolchain, readProjectFilesWithShell, verifyToolchain } = await import("./toolchain-DF9eutyQ.js").then((n) => n.i);
|
|
296
292
|
const run = async (script) => await runCrabbox(options, leaseId, {
|
|
297
293
|
abortSignal,
|
|
298
294
|
command: `sh -c ${shellQuote(script)}`
|
|
@@ -221,7 +221,6 @@ interface VercelSandboxCreateOptions {
|
|
|
221
221
|
timeout?: number;
|
|
222
222
|
token?: string;
|
|
223
223
|
}
|
|
224
|
-
/** The signals that the Vercel Sandbox SDK sends by name. Other signals use their number. */
|
|
225
224
|
declare const vercelSignalNames: readonly ["SIGHUP", "SIGINT", "SIGQUIT", "SIGKILL", "SIGTERM", "SIGCONT", "SIGSTOP"];
|
|
226
225
|
type VercelSandboxSignal = typeof vercelSignalNames[number] | number;
|
|
227
226
|
interface VercelSandboxCommand {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as TrustedHostOptions, A as SandboxRuntime, B as SandboxToolchainPackageManagerPin, C as SandboxPorts, D as SandboxRequirement, E as SandboxRemoveFileOptions, F as SandboxSession, G as resolveSandbox, H as SandboxToolchainPins, I as SandboxSpawnOptions, J as VercelSandboxCreateOptions, K as VercelFileStat, L as SandboxToolchain, M as SandboxRuntimeInput, N as SandboxRuntimeOpenOptions, O as SandboxResolvedRequirement, P as SandboxRuntimePlan, Q as VercelSandboxSource, R as SandboxToolchainInput, S as SandboxPlan, T as SandboxProcessExit, U as SandboxToolchainPlan, V as SandboxToolchainPin, W as SandboxValue, X as VercelSandboxNetworkPolicy, Y as VercelSandboxInstance, Z as VercelSandboxOptions, _ as SandboxFileOptions, a as ResolvedSandboxFile, at as CloudflareSandboxOptions, b as SandboxListFilesOptions, c as ResolvedSandboxState, d as SandboxDefinition, et as CrabboxOptions, f as SandboxEnvironment, g as SandboxFileEntry, h as SandboxFile, i as ResolvedSandboxCheckout, it as CloudflareDurableObjectNamespace, j as SandboxRuntimeDefinition, k as SandboxResolvedToolchain, l as Sandbox, m as SandboxExecResult, n as BuiltInSandboxRuntimeName, nt as ContainerSandboxEgress, o as ResolvedSandboxPlan, ot as CloudflareSandboxStub, p as SandboxExecOptions, q as VercelSandboxCommand, r as ResolveSandboxOptions, rt as ContainerSandboxOptions, s as ResolvedSandboxRequirementInput, st as SandboxNetworkPolicy, t as BuiltInSandboxRuntime, tt as ContainerSandboxCredential, u as SandboxCheckout, v as SandboxFiles, w as SandboxProcess, x as SandboxOpenOptions, y as SandboxHome, z as SandboxToolchainOptions } from "./index-
|
|
1
|
+
import { $ as TrustedHostOptions, A as SandboxRuntime, B as SandboxToolchainPackageManagerPin, C as SandboxPorts, D as SandboxRequirement, E as SandboxRemoveFileOptions, F as SandboxSession, G as resolveSandbox, H as SandboxToolchainPins, I as SandboxSpawnOptions, J as VercelSandboxCreateOptions, K as VercelFileStat, L as SandboxToolchain, M as SandboxRuntimeInput, N as SandboxRuntimeOpenOptions, O as SandboxResolvedRequirement, P as SandboxRuntimePlan, Q as VercelSandboxSource, R as SandboxToolchainInput, S as SandboxPlan, T as SandboxProcessExit, U as SandboxToolchainPlan, V as SandboxToolchainPin, W as SandboxValue, X as VercelSandboxNetworkPolicy, Y as VercelSandboxInstance, Z as VercelSandboxOptions, _ as SandboxFileOptions, a as ResolvedSandboxFile, at as CloudflareSandboxOptions, b as SandboxListFilesOptions, c as ResolvedSandboxState, d as SandboxDefinition, et as CrabboxOptions, f as SandboxEnvironment, g as SandboxFileEntry, h as SandboxFile, i as ResolvedSandboxCheckout, it as CloudflareDurableObjectNamespace, j as SandboxRuntimeDefinition, k as SandboxResolvedToolchain, l as Sandbox, m as SandboxExecResult, n as BuiltInSandboxRuntimeName, nt as ContainerSandboxEgress, o as ResolvedSandboxPlan, ot as CloudflareSandboxStub, p as SandboxExecOptions, q as VercelSandboxCommand, r as ResolveSandboxOptions, rt as ContainerSandboxOptions, s as ResolvedSandboxRequirementInput, st as SandboxNetworkPolicy, t as BuiltInSandboxRuntime, tt as ContainerSandboxCredential, u as SandboxCheckout, v as SandboxFiles, w as SandboxProcess, x as SandboxOpenOptions, y as SandboxHome, z as SandboxToolchainOptions } from "./index-DHl0T43e.js";
|
|
2
2
|
export { BuiltInSandboxRuntime, BuiltInSandboxRuntimeName, type CloudflareDurableObjectNamespace, type CloudflareSandboxOptions, type CloudflareSandboxStub, type ContainerSandboxCredential, type ContainerSandboxEgress, type ContainerSandboxOptions, type CrabboxOptions, ResolveSandboxOptions, ResolvedSandboxCheckout, ResolvedSandboxFile, ResolvedSandboxPlan, ResolvedSandboxRequirementInput, ResolvedSandboxState, Sandbox, SandboxCheckout, SandboxDefinition, SandboxEnvironment, SandboxExecOptions, SandboxExecResult, SandboxFile, SandboxFileEntry, SandboxFileOptions, SandboxFiles, SandboxHome, SandboxListFilesOptions, type SandboxNetworkPolicy, SandboxOpenOptions, SandboxPlan, SandboxPorts, SandboxProcess, SandboxProcessExit, SandboxRemoveFileOptions, SandboxRequirement, SandboxResolvedRequirement, SandboxResolvedToolchain, SandboxRuntime, SandboxRuntimeDefinition, SandboxRuntimeInput, SandboxRuntimeOpenOptions, SandboxRuntimePlan, SandboxSession, SandboxSpawnOptions, SandboxToolchain, SandboxToolchainInput, SandboxToolchainOptions, SandboxToolchainPackageManagerPin, SandboxToolchainPin, SandboxToolchainPins, SandboxToolchainPlan, SandboxValue, type TrustedHostOptions, type VercelFileStat, type VercelSandboxCommand, type VercelSandboxCreateOptions, type VercelSandboxInstance, type VercelSandboxNetworkPolicy, type VercelSandboxOptions, type VercelSandboxSource, resolveSandbox };
|
package/dist/index.js
CHANGED
|
@@ -22,15 +22,15 @@ async function resolveSandboxRuntime(value) {
|
|
|
22
22
|
}
|
|
23
23
|
if (typeof value === "string") {
|
|
24
24
|
if (value === "crabbox") {
|
|
25
|
-
const { createCrabboxRuntime } = await import("./crabbox-
|
|
25
|
+
const { createCrabboxRuntime } = await import("./crabbox-BU8W1gVC.js");
|
|
26
26
|
return createCrabboxRuntime();
|
|
27
27
|
}
|
|
28
28
|
if (value === "trusted-host") {
|
|
29
|
-
const { createTrustedHostRuntime } = await import("./trusted-host-
|
|
29
|
+
const { createTrustedHostRuntime } = await import("./trusted-host-DLYiKP8a.js").then((n) => n.n);
|
|
30
30
|
return createTrustedHostRuntime();
|
|
31
31
|
}
|
|
32
32
|
if (value === "vercel") {
|
|
33
|
-
const { createVercelRuntime } = await import("./vercel-
|
|
33
|
+
const { createVercelRuntime } = await import("./vercel-qyDr7NvU.js").then((n) => n.r);
|
|
34
34
|
return createVercelRuntime();
|
|
35
35
|
}
|
|
36
36
|
throw sandboxErrorDiagnostics.SANDBOX_R0031({ message: `[vitehub] Unknown Sandbox runtime "${value}". Expected "crabbox", "trusted-host", "vercel", a tagged built-in configuration, or a custom runtime.` });
|
|
@@ -40,27 +40,27 @@ async function resolveSandboxRuntime(value) {
|
|
|
40
40
|
const kind = config.kind;
|
|
41
41
|
if (config.kind === "crabbox") {
|
|
42
42
|
const options = withoutKind(config);
|
|
43
|
-
const { createCrabboxRuntime } = await import("./crabbox-
|
|
43
|
+
const { createCrabboxRuntime } = await import("./crabbox-BU8W1gVC.js");
|
|
44
44
|
return createCrabboxRuntime(options);
|
|
45
45
|
}
|
|
46
46
|
if (config.kind === "trusted-host") {
|
|
47
47
|
const options = withoutKind(config);
|
|
48
|
-
const { createTrustedHostRuntime } = await import("./trusted-host-
|
|
48
|
+
const { createTrustedHostRuntime } = await import("./trusted-host-DLYiKP8a.js").then((n) => n.n);
|
|
49
49
|
return createTrustedHostRuntime(options);
|
|
50
50
|
}
|
|
51
51
|
if (config.kind === "cloudflare") {
|
|
52
52
|
const options = withoutKind(config);
|
|
53
|
-
const { createCloudflareRuntime } = await import("./cloudflare-
|
|
53
|
+
const { createCloudflareRuntime } = await import("./cloudflare-DOrMY3MJ.js").then((n) => n.t);
|
|
54
54
|
return createCloudflareRuntime(options);
|
|
55
55
|
}
|
|
56
56
|
if (config.kind === "vercel") {
|
|
57
57
|
const options = withoutKind(config);
|
|
58
|
-
const { createVercelRuntime } = await import("./vercel-
|
|
58
|
+
const { createVercelRuntime } = await import("./vercel-qyDr7NvU.js").then((n) => n.r);
|
|
59
59
|
return createVercelRuntime(options);
|
|
60
60
|
}
|
|
61
61
|
if (config.kind === "container") {
|
|
62
62
|
const options = withoutKind(config);
|
|
63
|
-
const { createContainerRuntime } = await import("./container-
|
|
63
|
+
const { createContainerRuntime } = await import("./container-BVb0fw3z.js");
|
|
64
64
|
return createContainerRuntime(options);
|
|
65
65
|
}
|
|
66
66
|
throw sandboxErrorDiagnostics.SANDBOX_R0033({ message: `[vitehub] Unknown Sandbox runtime kind "${String(kind)}". Expected "crabbox", "trusted-host", "cloudflare", "container", or "vercel".` });
|
|
@@ -148,10 +148,9 @@ async function resolveSandbox(definition, context, options = {}) {
|
|
|
148
148
|
plan: sandboxPlan
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
/** Read toolchain pins now unless they come from a checkout that exists only after open. */
|
|
152
151
|
async function resolveToolchain(declaration, projectRoot) {
|
|
153
152
|
if (declaration === void 0) return;
|
|
154
|
-
const [{ normalizeToolchain, readToolchainPins, toolchainReadsProject }, { readHostProjectFiles }] = await Promise.all([import("./toolchain-
|
|
153
|
+
const [{ normalizeToolchain, readToolchainPins, toolchainReadsProject }, { readHostProjectFiles }] = await Promise.all([import("./toolchain-DF9eutyQ.js").then((n) => n.i), import("./internal/host-toolchain.js")]);
|
|
155
154
|
const toolchain = normalizeToolchain(declaration, "sandbox.toolchain");
|
|
156
155
|
if (!toolchain) return;
|
|
157
156
|
if (!projectRoot && toolchainReadsProject(toolchain)) return toolchain;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { at as CloudflareSandboxOptions, l as Sandbox } from "../index-
|
|
1
|
+
import { at as CloudflareSandboxOptions, l as Sandbox } from "../index-DHl0T43e.js";
|
|
2
2
|
//#region src/internal/cloudflare-durable-object.d.ts
|
|
3
3
|
interface CloudflareContainerExecProcess {
|
|
4
4
|
readonly exitCode: Promise<number>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as resolveRemoteSandboxRuntime } from "../remote-
|
|
2
|
-
import { i as createCloudflareSandboxOutbound, n as createCloudflareRuntime, r as createCloudflareSandboxDurableObject } from "../cloudflare-
|
|
1
|
+
import { a as resolveRemoteSandboxRuntime } from "../remote-fjUPBiLJ.js";
|
|
2
|
+
import { i as createCloudflareSandboxOutbound, n as createCloudflareRuntime, r as createCloudflareSandboxDurableObject } from "../cloudflare-DOrMY3MJ.js";
|
|
3
3
|
//#region src/internal/cloudflare.ts
|
|
4
4
|
async function resolveCloudflareSandbox(options, requirements) {
|
|
5
5
|
return await resolveRemoteSandboxRuntime(createCloudflareRuntime(options), requirements);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as SandboxToolchain, R as SandboxToolchainInput, k as SandboxResolvedToolchain } from "../index-
|
|
1
|
+
import { L as SandboxToolchain, R as SandboxToolchainInput, k as SandboxResolvedToolchain } from "../index-DHl0T43e.js";
|
|
2
2
|
//#region src/internal/host-toolchain.d.ts
|
|
3
3
|
export interface HostToolchainOptions {
|
|
4
4
|
abortSignal?: AbortSignal;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as sandboxErrorDiagnostics } from "../error-diagnostics-BJtLRL9w.js";
|
|
2
2
|
import { t as acquireFileLock } from "../file-lock-D0-XPogS.js";
|
|
3
|
-
import { a as verifyToolchain, n as provisionToolchain, r as toolchainProjectFiles, t as normalizeToolchain } from "../toolchain-
|
|
3
|
+
import { a as verifyToolchain, n as provisionToolchain, r as toolchainProjectFiles, t as normalizeToolchain } from "../toolchain-DF9eutyQ.js";
|
|
4
4
|
import { lstat, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import { delimiter, dirname, join, resolve } from "node:path";
|
|
6
6
|
import { execFile } from "node:child_process";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Z as VercelSandboxOptions, l as Sandbox } from "../index-
|
|
1
|
+
import { Z as VercelSandboxOptions, l as Sandbox } from "../index-DHl0T43e.js";
|
|
2
2
|
//#region src/internal/vercel.d.ts
|
|
3
3
|
export declare function resolveVercelSandbox(options: VercelSandboxOptions, requirements: readonly string[]): Promise<Sandbox>;
|
|
4
4
|
//#endregion
|
package/dist/internal/vercel.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as resolveRemoteSandboxRuntime } from "../remote-
|
|
2
|
-
import { t as createVercelRuntime } from "../vercel-
|
|
1
|
+
import { a as resolveRemoteSandboxRuntime } from "../remote-fjUPBiLJ.js";
|
|
2
|
+
import { t as createVercelRuntime } from "../vercel-qyDr7NvU.js";
|
|
3
3
|
//#region src/internal/vercel.ts
|
|
4
4
|
async function resolveVercelSandbox(options, requirements) {
|
|
5
5
|
return await resolveRemoteSandboxRuntime(createVercelRuntime(options), requirements);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Q as VercelSandboxSource, X as VercelSandboxNetworkPolicy, st as SandboxNetworkPolicy } from "./index-
|
|
1
|
+
import { Q as VercelSandboxSource, X as VercelSandboxNetworkPolicy, st as SandboxNetworkPolicy } from "./index-DHl0T43e.js";
|
|
2
2
|
import { ViteHubError } from "@vite-hub/runtime";
|
|
3
3
|
//#region src/task/project.d.ts
|
|
4
4
|
type SandboxTaskPackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as Sandbox } from "./index-
|
|
2
|
-
import { f as SandboxTaskDriver, o as SandboxTaskDefinitionDriverOptions, u as SandboxTaskDefinitionOptions } from "./module-types-
|
|
1
|
+
import { l as Sandbox } from "./index-DHl0T43e.js";
|
|
2
|
+
import { f as SandboxTaskDriver, o as SandboxTaskDefinitionDriverOptions, u as SandboxTaskDefinitionOptions } from "./module-types-NYnG3NGz.js";
|
|
3
3
|
import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
4
4
|
//#region src/task/runtime/task-sandbox.d.ts
|
|
5
5
|
/** `local` runs a Sandbox Task as a process on this machine, which only `vite dev` does. */
|
|
@@ -163,13 +163,9 @@ async function settleFileOperations(operations, signal) {
|
|
|
163
163
|
const failure = results.find((result) => result.status === "rejected");
|
|
164
164
|
if (failure?.status === "rejected") throw failure.reason;
|
|
165
165
|
}
|
|
166
|
-
/**
|
|
167
|
-
* Remote Sandboxes do not share a cache. Reuse an exact image node, otherwise upload
|
|
168
|
-
* the verified toolchain into the Sandbox Home cache for this session.
|
|
169
|
-
*/
|
|
170
166
|
async function provisionRemoteToolchain(input, session, options, environment) {
|
|
171
167
|
const { abortSignal, home, workspace } = options;
|
|
172
|
-
const { provisionToolchain, readProjectFilesWithShell, verifyToolchain } = await import("./toolchain-
|
|
168
|
+
const { provisionToolchain, readProjectFilesWithShell, verifyToolchain } = await import("./toolchain-DF9eutyQ.js").then((n) => n.i);
|
|
173
169
|
const run = async (script) => await session.run({
|
|
174
170
|
abortSignal,
|
|
175
171
|
command: `sh -c ${shellQuote(script)}`,
|
package/dist/ssh.js
CHANGED
|
@@ -99,8 +99,10 @@ try {
|
|
|
99
99
|
//#region src/ssh.ts
|
|
100
100
|
const maxTimeoutMs = 2147483647;
|
|
101
101
|
const environmentName = /^[A-Z_][A-Z0-9_]*$/;
|
|
102
|
-
/** Every process of one SSH command starts with this variable, so the server can stop the ones that leave its process group. */
|
|
103
102
|
const commandEnvironmentKey = "VITEHUB_SSH_COMMAND";
|
|
103
|
+
function isClosedPipeError(error) {
|
|
104
|
+
return error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED";
|
|
105
|
+
}
|
|
104
106
|
/** Launch a command on a trusted SSH host with the same working-directory path. */
|
|
105
107
|
function sshLaunch(options) {
|
|
106
108
|
if (!options.host || options.host.startsWith("-") || /[\s\0]/.test(options.host)) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "host" });
|
|
@@ -213,12 +215,14 @@ async function serveSsh(options) {
|
|
|
213
215
|
children.add(child);
|
|
214
216
|
markers.set(child, marker);
|
|
215
217
|
stream.pipe(child.stdin);
|
|
216
|
-
child.stdin.on("error", () => {});
|
|
217
218
|
child.stdout.pipe(stream, { end: false });
|
|
218
219
|
child.stderr.pipe(stream.stderr, { end: false });
|
|
219
220
|
const terminate = () => {
|
|
220
221
|
stop(child).catch(() => client.end());
|
|
221
222
|
};
|
|
223
|
+
child.stdin.on("error", (error) => {
|
|
224
|
+
if (!isClosedPipeError(error)) terminate();
|
|
225
|
+
});
|
|
222
226
|
stream.once("close", terminate);
|
|
223
227
|
stream.on("error", terminate);
|
|
224
228
|
child.once("exit", terminate);
|
package/dist/task/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as VercelSandboxTaskDriverOptions, a as SandboxTaskDefinitionBundle, c as SandboxTaskDefinitionHandler, d as SandboxTaskDevOptions, f as SandboxTaskDriver, g as SandboxTaskRunResult, h as SandboxTaskRunArguments, i as SandboxTaskDefinition, l as SandboxTaskDefinitionInput, m as SandboxTaskProjectOptions, n as CloudflareSandboxTaskDefinitionDriverOptions, o as SandboxTaskDefinitionDriverOptions, p as SandboxTaskExecutionOptions, r as CloudflareSandboxTaskOptions, s as SandboxTaskDefinitionFromHandler, t as AgentSandboxTaskConfig, u as SandboxTaskDefinitionOptions, v as getSandboxTaskFeatureDriver, y as SandboxTaskSizeOptions } from "../module-types-
|
|
1
|
+
import { _ as VercelSandboxTaskDriverOptions, a as SandboxTaskDefinitionBundle, c as SandboxTaskDefinitionHandler, d as SandboxTaskDevOptions, f as SandboxTaskDriver, g as SandboxTaskRunResult, h as SandboxTaskRunArguments, i as SandboxTaskDefinition, l as SandboxTaskDefinitionInput, m as SandboxTaskProjectOptions, n as CloudflareSandboxTaskDefinitionDriverOptions, o as SandboxTaskDefinitionDriverOptions, p as SandboxTaskExecutionOptions, r as CloudflareSandboxTaskOptions, s as SandboxTaskDefinitionFromHandler, t as AgentSandboxTaskConfig, u as SandboxTaskDefinitionOptions, v as getSandboxTaskFeatureDriver, y as SandboxTaskSizeOptions } from "../module-types-NYnG3NGz.js";
|
|
2
2
|
import { ExecutionAuthority, ViteHubContext } from "@vite-hub/runtime";
|
|
3
3
|
import { Buffer } from "node:buffer";
|
|
4
4
|
import { SandboxTaskDefinitionModules } from "#vitehub-sandbox-task-registry";
|
|
@@ -48,7 +48,6 @@ type SandboxTaskPayload<TDefinition> = TDefinition extends {
|
|
|
48
48
|
type SandboxTaskResult<TDefinition> = TDefinition extends {
|
|
49
49
|
result: infer TResult;
|
|
50
50
|
} ? DecodedSandboxValue<TResult> : unknown;
|
|
51
|
-
/** Model the result walk in entry-script.injected.ts, not the handler's remote object. */
|
|
52
51
|
type DecodedSandboxValue<TValue, TApplyToJSON extends boolean = true> = TValue extends Response ? Response : TValue extends Blob ? Blob : TValue extends Buffer ? Buffer : TValue extends Uint8Array ? Uint8Array : TApplyToJSON extends false ? DecodedSandboxJson<TValue> : TValue extends {
|
|
53
52
|
toJSON(key: string): infer TSerialized;
|
|
54
53
|
} ? DecodedSandboxValue<TSerialized, false> | (TValue extends Date ? null : never) : DecodedSandboxJson<TValue>;
|
package/dist/task/index.js
CHANGED
|
@@ -4,9 +4,10 @@ import { a as resolveTaskSandbox, c as isSandboxTaskError, i as resolveRuntimePr
|
|
|
4
4
|
import { t as isTrustedHostReservedCommandEnvironmentKey } from "../trusted-host-environment-CWKJ7DD_.js";
|
|
5
5
|
import { getSandboxTaskRuntimeConfig, getSandboxTaskRuntimeLocalProvider, getSandboxTaskRuntimeRegistry } from "./runtime/state.js";
|
|
6
6
|
import { t as getSandboxTaskFeatureDriver } from "../module-types-B0LQ5H2S.js";
|
|
7
|
-
import { defineErrors,
|
|
7
|
+
import { defineErrors, getViteHubErrorShape } from "@vite-hub/runtime";
|
|
8
8
|
import { types } from "node:util";
|
|
9
9
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
10
|
+
import { deserializeResponse, isSerializedResponse } from "@vite-hub/runtime/internal/response";
|
|
10
11
|
import { dirname } from "pathe";
|
|
11
12
|
//#region src/task/internal/shared/definition.ts
|
|
12
13
|
function assertDefinitionHandler(functionName, handler, label) {
|
|
@@ -852,7 +853,6 @@ function getErrorMessage(error) {
|
|
|
852
853
|
if (error === void 0) return void 0;
|
|
853
854
|
return String(error);
|
|
854
855
|
}
|
|
855
|
-
/** The handler command may still write its output when the Cloudflare request failed after it could reach the Container. */
|
|
856
856
|
function mayHaveRunCloudflareExec(error) {
|
|
857
857
|
const metadata = readSandboxTaskErrorMetadata(error);
|
|
858
858
|
if (metadata?.provider && metadata.provider !== "cloudflare") return false;
|
|
@@ -1230,7 +1230,6 @@ const sandboxTaskRunErrors = /*#__PURE__*/ defineErrors({
|
|
|
1230
1230
|
})
|
|
1231
1231
|
} }
|
|
1232
1232
|
});
|
|
1233
|
-
/** Preserve an explicit HTTP status or map the underlying diagnostic code. */
|
|
1234
1233
|
function statusFor(error) {
|
|
1235
1234
|
const status = error.details?.httpStatus;
|
|
1236
1235
|
if (Number.isInteger(status) && Number(status) >= 400 && Number(status) <= 599) return Number(status);
|
|
@@ -1298,10 +1297,6 @@ async function serializeCloudflareRun(id, run, signal) {
|
|
|
1298
1297
|
else previous.then(releaseAfterPrevious, releaseAfterPrevious);
|
|
1299
1298
|
}
|
|
1300
1299
|
}
|
|
1301
|
-
/**
|
|
1302
|
-
* A new run repeats every command of the failed one. Once a command starts, only the transport
|
|
1303
|
-
* can retry that request on a cold start without replaying earlier work.
|
|
1304
|
-
*/
|
|
1305
1300
|
function canRerunCloudflareTask(error, commandMayHaveRun) {
|
|
1306
1301
|
if (commandMayHaveRun) return false;
|
|
1307
1302
|
if (isSandboxTaskError(error) && error.cause instanceof AggregateError) error = error.cause.errors[0];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SandboxTaskRuntimeProvider, r as loadSandboxTaskRuntimeProvider, t as ResolvedTaskSandbox } from "../../provider-loader-
|
|
1
|
+
import { n as SandboxTaskRuntimeProvider, r as loadSandboxTaskRuntimeProvider, t as ResolvedTaskSandbox } from "../../provider-loader-Cvqoz7_Z.js";
|
|
2
2
|
export { ResolvedTaskSandbox, SandboxTaskRuntimeProvider, loadSandboxTaskRuntimeProvider };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as Sandbox } from "../../../index-
|
|
2
|
-
import { n as CloudflareSandboxTaskDefinitionDriverOptions, u as SandboxTaskDefinitionOptions } from "../../../module-types-
|
|
1
|
+
import { l as Sandbox } from "../../../index-DHl0T43e.js";
|
|
2
|
+
import { n as CloudflareSandboxTaskDefinitionDriverOptions, u as SandboxTaskDefinitionOptions } from "../../../module-types-NYnG3NGz.js";
|
|
3
3
|
//#region src/task/runtime/providers/cloudflare.d.ts
|
|
4
4
|
type SandboxTaskOptions = {
|
|
5
5
|
local: SandboxTaskDefinitionOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ResolvedTaskSandbox } from "../../../provider-loader-
|
|
1
|
+
import { t as ResolvedTaskSandbox } from "../../../provider-loader-Cvqoz7_Z.js";
|
|
2
2
|
//#region src/task/runtime/providers/local.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* `vite dev` runs each Sandbox Task as a Node process on this machine, in a temporary directory that the run removes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as resolveRemoteSandboxRuntime } from "../../../remote-
|
|
2
|
-
import { t as createTrustedHostRuntime } from "../../../trusted-host-
|
|
1
|
+
import { a as resolveRemoteSandboxRuntime } from "../../../remote-fjUPBiLJ.js";
|
|
2
|
+
import { t as createTrustedHostRuntime } from "../../../trusted-host-DLYiKP8a.js";
|
|
3
3
|
//#region src/task/runtime/providers/local.ts
|
|
4
4
|
/**
|
|
5
5
|
* `vite dev` runs each Sandbox Task as a Node process on this machine, in a temporary directory that the run removes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as Sandbox } from "../../../index-
|
|
2
|
-
import { _ as VercelSandboxTaskDriverOptions, u as SandboxTaskDefinitionOptions } from "../../../module-types-
|
|
1
|
+
import { l as Sandbox } from "../../../index-DHl0T43e.js";
|
|
2
|
+
import { _ as VercelSandboxTaskDriverOptions, u as SandboxTaskDefinitionOptions } from "../../../module-types-NYnG3NGz.js";
|
|
3
3
|
//#region src/task/runtime/providers/vercel.d.ts
|
|
4
4
|
type SandboxTaskOptions = {
|
|
5
5
|
local: SandboxTaskDefinitionOptions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as loadVercelSandbox } from "../../../vercel-
|
|
1
|
+
import { n as loadVercelSandbox } from "../../../vercel-qyDr7NvU.js";
|
|
2
2
|
import { resolveVercelSandbox } from "../../../internal/vercel.js";
|
|
3
3
|
import { t as sandboxTaskErrorDiagnostics } from "../../../error-diagnostics-BNQwU9yq.js";
|
|
4
4
|
import "../../../provider-resolution-BrQfEQo0.js";
|
|
5
|
-
import {
|
|
5
|
+
import { o as resolveVercelSandboxTaskVcpus, t as vercelCredentialEnv } from "../../../vercel-credentials-BNTh2X-Y.js";
|
|
6
6
|
//#region ../internal/src/env.ts
|
|
7
7
|
function trimmed(value) {
|
|
8
8
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
@@ -15,10 +15,6 @@ function readEnv(env, ...names) {
|
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/task/runtime/providers/vercel.ts
|
|
18
|
-
/**
|
|
19
|
-
* The Vercel VM timeout starts at create, but the task timeout starts after the Sandbox opens.
|
|
20
|
-
* The VM gets this extra time so that ViteHub, not the VM, ends a run at the task timeout.
|
|
21
|
-
*/
|
|
22
18
|
const VERCEL_TASK_SANDBOX_HEADROOM_MS = 3e4;
|
|
23
19
|
function readConfigCredential(value) {
|
|
24
20
|
return value?.trim() || void 0;
|
|
@@ -26,9 +22,9 @@ function readConfigCredential(value) {
|
|
|
26
22
|
function resolveEnvCredentials() {
|
|
27
23
|
const env = typeof process !== "undefined" ? process.env : {};
|
|
28
24
|
return {
|
|
29
|
-
token: readEnv(env,
|
|
30
|
-
teamId: readEnv(env,
|
|
31
|
-
projectId: readEnv(env,
|
|
25
|
+
token: readEnv(env, ...vercelCredentialEnv.token.names),
|
|
26
|
+
teamId: readEnv(env, ...vercelCredentialEnv.teamId.names),
|
|
27
|
+
projectId: readEnv(env, ...vercelCredentialEnv.projectId.names)
|
|
32
28
|
};
|
|
33
29
|
}
|
|
34
30
|
function resolveCredentials(provider) {
|
|
@@ -62,7 +58,6 @@ async function resolveVercelTaskSandbox(options) {
|
|
|
62
58
|
}, requirements)
|
|
63
59
|
};
|
|
64
60
|
}
|
|
65
|
-
/** Reports a session timeout above the Vercel plan maximum with its own code and the limit from Vercel. */
|
|
66
61
|
function withPlanLimitError(create) {
|
|
67
62
|
return async (createOptions) => {
|
|
68
63
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as SandboxTaskDefinitionBundle, t as AgentSandboxTaskConfig, u as SandboxTaskDefinitionOptions } from "../../module-types-
|
|
2
|
-
import { t as ResolvedTaskSandbox } from "../../provider-loader-
|
|
1
|
+
import { a as SandboxTaskDefinitionBundle, t as AgentSandboxTaskConfig, u as SandboxTaskDefinitionOptions } from "../../module-types-NYnG3NGz.js";
|
|
2
|
+
import { t as ResolvedTaskSandbox } from "../../provider-loader-Cvqoz7_Z.js";
|
|
3
3
|
//#region src/task/runtime/state.d.ts
|
|
4
4
|
export type SandboxTaskRegistryEntry = {
|
|
5
5
|
bundle: SandboxTaskDefinitionBundle;
|
package/dist/task/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as AgentSandboxTaskConfig } from "../module-types-
|
|
1
|
+
import { t as AgentSandboxTaskConfig } from "../module-types-NYnG3NGz.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
//#region ../internal/src/deployment.d.ts
|
|
4
4
|
/** The host that ViteHub builds for: the `host` option of `vitehub()` and the value of `VITEHUB_HOST`. */
|
|
@@ -54,6 +54,8 @@ interface ViteHubResourceSummary {
|
|
|
54
54
|
owner: string;
|
|
55
55
|
/** Absent when no id is known yet. */
|
|
56
56
|
source?: ViteHubResourceIdSource;
|
|
57
|
+
/** The resource is in the Wrangler config of a standalone Provider Output Worker, not in Nitro's. */
|
|
58
|
+
standalone?: boolean;
|
|
57
59
|
}
|
|
58
60
|
interface ViteHubInspectionContributor {
|
|
59
61
|
definitions?: readonly ViteHubDefinitionInspector[];
|
package/dist/task/vite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as invariantError, t as invariant } from "../invariant-DolT9EEx.js";
|
|
2
2
|
import { t as sandboxTaskErrorDiagnostics } from "../error-diagnostics-BNQwU9yq.js";
|
|
3
3
|
import { t as getSandboxTaskFeatureDriver } from "../module-types-B0LQ5H2S.js";
|
|
4
|
-
import { a as
|
|
4
|
+
import { a as resolveCloudflareSandboxTaskInstanceType, i as readSandboxTaskSize, n as assertCloudflareInstanceTypeFits, o as resolveVercelSandboxTaskVcpus, r as describeCloudflareInstanceType, t as vercelCredentialEnv } from "../vercel-credentials-BNTh2X-Y.js";
|
|
5
5
|
import { builtinModules, createRequire, isBuiltin } from "node:module";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
import { copyFile, glob, lstat, mkdir, mkdtemp, open, readFile, readdir, readlink, realpath, rename, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
@@ -71,7 +71,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
71
71
|
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
72
72
|
},
|
|
73
73
|
INTERNAL_R0022: {
|
|
74
|
-
fix: "Send input that matches the schema of the operation. `vitehub <namespace> <command> --help` shows the fields.",
|
|
74
|
+
fix: "Send input that matches the schema of the operation. `vitehub <namespace> <command> --help` shows the fields, and the list_operations tool of the ViteHub MCP gives the input schema of each operation.",
|
|
75
75
|
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
76
76
|
},
|
|
77
77
|
INTERNAL_R0024: {
|
|
@@ -290,6 +290,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
290
290
|
why: ({ owner }) => `[vitehub] ${owner} extends tuple requires [preset, options] with an options object.`,
|
|
291
291
|
fix: "Set `extends` to a preset, or to a two-item tuple `[preset, { ...options }]` whose second item is a plain object."
|
|
292
292
|
},
|
|
293
|
+
INTERNAL_RUNTIME_PACKAGE_VERSION_CONFLICT: {
|
|
294
|
+
why: ({ first, name, second }) => `[vitehub] One server function needs ${name} from two installations: ${first} and ${second}.`,
|
|
295
|
+
fix: "Install one version of the package that the message names, for example with `pnpm dedupe` or an `overrides` entry in `package.json`, then build again."
|
|
296
|
+
},
|
|
293
297
|
INTERNAL_SECRET_PURPOSE_MISSING: {
|
|
294
298
|
why: "[vitehub] A derived secret requires a purpose.",
|
|
295
299
|
fix: "Pass a non-empty purpose to `deriveSecret()`, such as `deriveSecret(\"my-module:session\")`."
|
|
@@ -365,6 +369,11 @@ function getResolvedFeatureOptions(config, feature) {
|
|
|
365
369
|
if (!features || typeof features !== "object") return void 0;
|
|
366
370
|
return Reflect.get(features, feature);
|
|
367
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Set by `vite-hub/nuxt` when it replays Vite config hooks for `nuxt prepare`. Prepare uses `command: "build"` to write
|
|
374
|
+
* the same types as the build, but it builds nothing.
|
|
375
|
+
*/
|
|
376
|
+
const VITEHUB_PREPARE = "__vitehubPrepare";
|
|
368
377
|
function includesNitroVitePlugin(value) {
|
|
369
378
|
if (Array.isArray(value)) return value.some(includesNitroVitePlugin);
|
|
370
379
|
if (!value || typeof value !== "object") return false;
|
|
@@ -400,7 +409,7 @@ function hasProjectRootDirectoryMarker(root) {
|
|
|
400
409
|
for (const marker of projectRootDirectoryMarkers) try {
|
|
401
410
|
if (statSync(resolve(root, ...marker)).isDirectory()) return true;
|
|
402
411
|
} catch (error) {
|
|
403
|
-
if (error
|
|
412
|
+
if (!isMissingProjectMarker(error)) throw error;
|
|
404
413
|
}
|
|
405
414
|
return false;
|
|
406
415
|
}
|
|
@@ -414,11 +423,15 @@ function hasProjectRootFileMarker(root, markers) {
|
|
|
414
423
|
try {
|
|
415
424
|
if (statSync(resolve(root, ...path)).isFile()) return true;
|
|
416
425
|
} catch (error) {
|
|
417
|
-
if (error
|
|
426
|
+
if (!isMissingProjectMarker(error)) throw error;
|
|
418
427
|
}
|
|
419
428
|
}
|
|
420
429
|
return false;
|
|
421
430
|
}
|
|
431
|
+
function isMissingProjectMarker(error) {
|
|
432
|
+
const code = error.code;
|
|
433
|
+
return code === "ENOENT" || code === "ENOTDIR";
|
|
434
|
+
}
|
|
422
435
|
/** Maps a host name or a Nitro preset name, such as `cloudflare-module` or `node-server`, to its ViteHub host. */
|
|
423
436
|
function hostFromNitroPreset(value) {
|
|
424
437
|
const normalized = value?.trim().toLowerCase().replaceAll("_", "-");
|
|
@@ -595,8 +608,8 @@ async function writeFileIfChanged(file, contents) {
|
|
|
595
608
|
await mkdir(resolve$1(file, ".."), { recursive: true });
|
|
596
609
|
await writeFile(file, contents, "utf8");
|
|
597
610
|
}
|
|
598
|
-
|
|
599
|
-
|
|
611
|
+
Object.freeze({ vitehubAuthAccess: "handler" });
|
|
612
|
+
Object.freeze({ vitehubOwnAccess: true });
|
|
600
613
|
/** Add one module id to a Nitro or Rollup `external` option, in each form that option takes. */
|
|
601
614
|
function mergeNitroExternal(value, addition) {
|
|
602
615
|
if (typeof value === "undefined") return [addition];
|
|
@@ -711,7 +724,7 @@ const defaultCloudflareSandboxBinding = "SANDBOX";
|
|
|
711
724
|
const defaultCloudflareSandboxClassName = "Sandbox";
|
|
712
725
|
const defaultCloudflareSandboxMaxInstances = 12;
|
|
713
726
|
const cloudflareSandboxNodeImage = "24-bookworm-slim";
|
|
714
|
-
const cloudflareSandboxPackages = "ca-certificates
|
|
727
|
+
const cloudflareSandboxPackages = "ca-certificates git procps tini";
|
|
715
728
|
const durableObjectModule = "@vite-hub/sandbox/internal/cloudflare";
|
|
716
729
|
function resolveModule$1(id) {
|
|
717
730
|
return resolvePathSync(id, {
|
|
@@ -727,8 +740,11 @@ function resolveModule$1(id) {
|
|
|
727
740
|
function resolveCloudflareSandboxEntrypoint() {
|
|
728
741
|
try {
|
|
729
742
|
return resolveModule$1("@cloudflare/sandbox");
|
|
730
|
-
} catch {
|
|
731
|
-
throw sandboxTaskErrorDiagnostics.SANDBOX_TASK_R0003({
|
|
743
|
+
} catch (cause) {
|
|
744
|
+
throw sandboxTaskErrorDiagnostics.SANDBOX_TASK_R0003({
|
|
745
|
+
cause,
|
|
746
|
+
message: "[vitehub] The Cloudflare Sandbox provider requires @cloudflare/sandbox. Install a supported version before building."
|
|
747
|
+
});
|
|
732
748
|
}
|
|
733
749
|
}
|
|
734
750
|
function resolveCloudflareSandboxVersion() {
|
|
@@ -1430,10 +1446,6 @@ function isJsxDefinition(filename) {
|
|
|
1430
1446
|
function isBareSpecifier(id) {
|
|
1431
1447
|
return !/^(?:\.{1,2}(?:\/|$)|\/|[A-Za-z]:[\\/]|\0)/.test(id);
|
|
1432
1448
|
}
|
|
1433
|
-
/**
|
|
1434
|
-
* Vite 8 bundles with Rolldown, so the app already has it. Load the copy next to `vite`, or `vite/rolldown` with
|
|
1435
|
-
* Vite+, instead of installing a second bundler.
|
|
1436
|
-
*/
|
|
1437
1449
|
async function importRolldown() {
|
|
1438
1450
|
let entry;
|
|
1439
1451
|
try {
|
|
@@ -2547,6 +2559,7 @@ async function extractSandboxTaskDefinitionMetadata(file) {
|
|
|
2547
2559
|
}
|
|
2548
2560
|
//#endregion
|
|
2549
2561
|
//#region src/task/type-template.ts
|
|
2562
|
+
const sandboxTaskTypeTemplateFilename = "runtime/sandbox-task.d.ts";
|
|
2550
2563
|
function createDefinitionContract(definition) {
|
|
2551
2564
|
const module = `typeof import(${JSON.stringify(definition.handler)})`;
|
|
2552
2565
|
if (definition.kind === "definition") return `{ payload: Parameters<${module}['default']['handler']>[0], result: Awaited<ReturnType<${module}['default']['handler']>> }`;
|
|
@@ -2642,7 +2655,7 @@ function createSandboxTaskManifest(aliasPath, typeTemplate) {
|
|
|
2642
2655
|
}
|
|
2643
2656
|
],
|
|
2644
2657
|
typeTemplate: {
|
|
2645
|
-
filename:
|
|
2658
|
+
filename: sandboxTaskTypeTemplateFilename,
|
|
2646
2659
|
contents: typeTemplate
|
|
2647
2660
|
}
|
|
2648
2661
|
};
|
|
@@ -2735,13 +2748,7 @@ async function createSandboxTaskFeaturePlan(sandboxTaskConfig, definitions, path
|
|
|
2735
2748
|
}
|
|
2736
2749
|
const definitionMetadata = await loadSandboxTaskDefinitionMetadata(definitions, discoveredDefinitionOptions.rootDir || process.cwd());
|
|
2737
2750
|
const metadataByName = new Map(definitionMetadata.map((definition) => [definition.name, definition]));
|
|
2738
|
-
const manifest = createSandboxTaskManifest(paths.aliasPath, createSandboxTaskTypeTemplateContents(definitions
|
|
2739
|
-
return {
|
|
2740
|
-
handler: definition.handler,
|
|
2741
|
-
kind: definition.kind,
|
|
2742
|
-
name: definition.name
|
|
2743
|
-
};
|
|
2744
|
-
})));
|
|
2751
|
+
const manifest = createSandboxTaskManifest(paths.aliasPath, createSandboxTaskTypeTemplateContents(definitions));
|
|
2745
2752
|
const { bundleAlias, featureImports = manifest.imports, ...definitionCompilerOptions } = discoveredDefinitionOptions;
|
|
2746
2753
|
const definitionCompiler = await createDiscoveredDefinitionCompiler({
|
|
2747
2754
|
...definitionCompilerOptions,
|
|
@@ -3522,17 +3529,32 @@ async function prepareSandboxTaskRuntime(options) {
|
|
|
3522
3529
|
root: rootDir
|
|
3523
3530
|
}, options.env, definitions.length > 0);
|
|
3524
3531
|
const stateModule = createSandboxTaskStateModuleContents(context);
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3532
|
+
const prepareOnly = options.userConfig[VITEHUB_PREPARE] === true;
|
|
3533
|
+
if (!context.config || prepareOnly) {
|
|
3534
|
+
const files = [];
|
|
3535
|
+
if (context.config && options.writeArtifacts !== false) {
|
|
3536
|
+
const generatedDir = ensureGeneratedDir(rootDir, "sandbox-task");
|
|
3537
|
+
const file = resolve$1(generatedDir, sandboxTaskTypeTemplateFilename);
|
|
3538
|
+
const contents = createSandboxTaskTypeTemplateContents(definitions);
|
|
3539
|
+
await mkdir(generatedDir, { recursive: true });
|
|
3540
|
+
await withSandboxTaskRuntimeGenerationLock(generatedDir, (lease) => lease.publish(async () => {
|
|
3541
|
+
await mkdir(dirname$1(file), { recursive: true });
|
|
3542
|
+
await writeStableSandboxTaskRuntimeFile(file, contents, lease);
|
|
3543
|
+
}));
|
|
3544
|
+
files.push(file);
|
|
3545
|
+
}
|
|
3546
|
+
return {
|
|
3547
|
+
aliases: {},
|
|
3548
|
+
definitions,
|
|
3549
|
+
files,
|
|
3550
|
+
hosting: context.hosting,
|
|
3551
|
+
localDev: false,
|
|
3552
|
+
provider: void 0,
|
|
3553
|
+
rootDir,
|
|
3554
|
+
stateModule,
|
|
3555
|
+
watchFiles: []
|
|
3556
|
+
};
|
|
3557
|
+
}
|
|
3536
3558
|
const localDev = context.command === "serve" && !context.config.remote;
|
|
3537
3559
|
if (localDev && process.platform === "win32") throw sandboxTaskErrorDiagnostics.SANDBOX_TASK_LOCAL_WINDOWS();
|
|
3538
3560
|
const facadeFile = resolve$1(ensureGeneratedDir(rootDir, "sandbox-task"), "runtime/sandbox-task.mjs");
|
|
@@ -3587,7 +3609,6 @@ function inspectSandboxTaskDefinitions(options) {
|
|
|
3587
3609
|
source: definition.source
|
|
3588
3610
|
}));
|
|
3589
3611
|
}
|
|
3590
|
-
/** The Cloudflare instance type and instance limit, as the Container resource reports them. */
|
|
3591
3612
|
function describeCloudflareSandboxTaskSize(options) {
|
|
3592
3613
|
const instanceType = options.instanceType === void 0 ? void 0 : describeCloudflareInstanceType(options.instanceType)?.label ?? JSON.stringify(options.instanceType);
|
|
3593
3614
|
return [instanceType ? `Instance type ${instanceType}` : "", options.maxInstances ? `at most ${options.maxInstances} instances` : ""].filter(Boolean).join(", ");
|
|
@@ -3631,20 +3652,6 @@ const sandboxTaskConsoleSection = {
|
|
|
3631
3652
|
//#endregion
|
|
3632
3653
|
//#region src/task/deployment-env.ts
|
|
3633
3654
|
const owners = ["sandbox"];
|
|
3634
|
-
const vercelCredentialNames = {
|
|
3635
|
-
token: {
|
|
3636
|
-
names: ["VITE_SANDBOX_TOKEN", "VERCEL_TOKEN"],
|
|
3637
|
-
secret: true
|
|
3638
|
-
},
|
|
3639
|
-
teamId: {
|
|
3640
|
-
names: ["VITE_SANDBOX_TEAM_ID", "VERCEL_TEAM_ID"],
|
|
3641
|
-
secret: false
|
|
3642
|
-
},
|
|
3643
|
-
projectId: {
|
|
3644
|
-
names: ["VITE_SANDBOX_PROJECT_ID", "VERCEL_PROJECT_ID"],
|
|
3645
|
-
secret: false
|
|
3646
|
-
}
|
|
3647
|
-
};
|
|
3648
3655
|
/**
|
|
3649
3656
|
* The variables that Sandbox Tasks read on the deployed host. A Vercel Sandbox reads its token, team, and project from
|
|
3650
3657
|
* env when the config leaves them out. On Vercel they are optional, since the Sandbox SDK then uses the OIDC token of
|
|
@@ -3659,9 +3666,9 @@ function sandboxDeploymentEnv(config, driver, context) {
|
|
|
3659
3666
|
"teamId",
|
|
3660
3667
|
"projectId"
|
|
3661
3668
|
].flatMap((option) => configured?.[option]?.trim() ? [] : [{
|
|
3662
|
-
names:
|
|
3669
|
+
names: vercelCredentialEnv[option].names,
|
|
3663
3670
|
required,
|
|
3664
|
-
secret:
|
|
3671
|
+
secret: vercelCredentialEnv[option].secret,
|
|
3665
3672
|
hasDefault: false,
|
|
3666
3673
|
owners
|
|
3667
3674
|
}]);
|
|
@@ -153,7 +153,6 @@ function parsePackageManager(value, source) {
|
|
|
153
153
|
version
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
/** Detect the target OS, architecture, and C library with POSIX tools. */
|
|
157
156
|
async function detectToolchainPlatform(target) {
|
|
158
157
|
const result = await target.run([
|
|
159
158
|
"uname -s",
|
|
@@ -385,10 +384,6 @@ async function installEntry(target, key, prepare) {
|
|
|
385
384
|
await release?.();
|
|
386
385
|
}
|
|
387
386
|
}
|
|
388
|
-
/**
|
|
389
|
-
* Extract into a private staging directory, then publish with an atomic
|
|
390
|
-
* symbolic link. A concurrent installer that loses the race keeps the winner.
|
|
391
|
-
*/
|
|
392
387
|
function installScript(options) {
|
|
393
388
|
const final = joinPath(options.cacheRoot, options.key);
|
|
394
389
|
const lines = [
|
|
@@ -419,7 +414,6 @@ async function verifyPackageManagerHash(pin, name, tarball) {
|
|
|
419
414
|
const actual = contents ? createHash(algorithm).update(contents).digest("hex") : void 0;
|
|
420
415
|
if (actual !== expected) throw sandboxErrorDiagnostics.SANDBOX_R0153({ message: `[vitehub] ${pin.name}@${pin.version} does not match the ${algorithm} hash from ${pin.source}: expected ${expected}, received ${actual ?? "<missing>"}.` });
|
|
421
416
|
}
|
|
422
|
-
/** Read one regular file from a gzipped npm package tarball. */
|
|
423
417
|
async function tarEntry(gzipped, path) {
|
|
424
418
|
const stream = new Blob([Uint8Array.from(gzipped)]).stream().pipeThrough(new DecompressionStream("gzip"));
|
|
425
419
|
const bytes = new Uint8Array(await new Response(stream).arrayBuffer());
|
|
@@ -10,6 +10,7 @@ import { access, chmod, lstat, mkdir, mkdtemp, readFile, readdir, realpath, rena
|
|
|
10
10
|
import { basename, delimiter, dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
11
11
|
import { execFile, spawn } from "node:child_process";
|
|
12
12
|
import { promisify } from "node:util";
|
|
13
|
+
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
13
14
|
import { tmpdir } from "node:os";
|
|
14
15
|
import { constants } from "node:fs";
|
|
15
16
|
import { Readable, Writable } from "node:stream";
|
|
@@ -144,10 +145,13 @@ async function createSession(input, options, createOptions) {
|
|
|
144
145
|
env,
|
|
145
146
|
home,
|
|
146
147
|
async release() {
|
|
147
|
-
if (initializationFailed)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
if (initializationFailed) {
|
|
149
|
+
for (const path of initializedState) await rm(path, {
|
|
150
|
+
force: true,
|
|
151
|
+
recursive: true
|
|
152
|
+
});
|
|
153
|
+
initializedState.length = 0;
|
|
154
|
+
}
|
|
151
155
|
await releases();
|
|
152
156
|
},
|
|
153
157
|
root,
|
|
@@ -165,10 +169,10 @@ async function createSession(input, options, createOptions) {
|
|
|
165
169
|
} catch (error) {
|
|
166
170
|
if (session) {
|
|
167
171
|
initializationFailed = true;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
const cleanup = await destroyFailedSession(session);
|
|
173
|
+
if (cleanup) {
|
|
174
|
+
scheduleFailedSessionDestroy(session);
|
|
175
|
+
throw new AggregateError([error, cleanup.error], `[vitehub] Trusted-host Sandbox initialization failed: ${failureMessage(error)} Cleanup failed: ${failureMessage(cleanup.error)}`);
|
|
172
176
|
}
|
|
173
177
|
} else {
|
|
174
178
|
await Promise.all(initializedState.map((path) => rm(path, {
|
|
@@ -184,16 +188,28 @@ async function createSession(input, options, createOptions) {
|
|
|
184
188
|
throw error;
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
const failedSessionDestroyAttempts = 3;
|
|
192
|
+
const failedSessionDestroyDelayMs = 250;
|
|
193
|
+
async function destroyFailedSession(session) {
|
|
194
|
+
let failure;
|
|
195
|
+
for (let attempt = 0; attempt < failedSessionDestroyAttempts; attempt++) {
|
|
196
|
+
if (failure) await setTimeout$1(failedSessionDestroyDelayMs);
|
|
192
197
|
try {
|
|
193
|
-
await session.destroy
|
|
198
|
+
await session.destroy();
|
|
194
199
|
return;
|
|
195
|
-
} catch {
|
|
200
|
+
} catch (error) {
|
|
201
|
+
failure = { error };
|
|
202
|
+
}
|
|
196
203
|
}
|
|
204
|
+
return failure;
|
|
205
|
+
}
|
|
206
|
+
function scheduleFailedSessionDestroy(session) {
|
|
207
|
+
setTimeout(() => {
|
|
208
|
+
session.destroy().catch(() => scheduleFailedSessionDestroy(session));
|
|
209
|
+
}, failedSessionDestroyDelayMs).unref();
|
|
210
|
+
}
|
|
211
|
+
function failureMessage(error) {
|
|
212
|
+
return error instanceof Error ? error.message || error.name : String(error);
|
|
197
213
|
}
|
|
198
214
|
async function provisionTrustedHostToolchain(toolchain, directory, stateRoot, env, abortSignal) {
|
|
199
215
|
const { hostToolchainCacheRoot, provisionHostToolchain, toolchainPath } = await import("./internal/host-toolchain.js");
|
|
@@ -115,4 +115,20 @@ function formatRequest(cpu, memory) {
|
|
|
115
115
|
return [cpu === void 0 ? "" : `cpu: ${cpu}`, memory === void 0 ? "" : `memory: ${memory}`].filter(Boolean).join(", ");
|
|
116
116
|
}
|
|
117
117
|
//#endregion
|
|
118
|
-
|
|
118
|
+
//#region src/task/vercel-credentials.ts
|
|
119
|
+
const vercelCredentialEnv = {
|
|
120
|
+
token: {
|
|
121
|
+
names: ["VITE_SANDBOX_TOKEN", "VERCEL_TOKEN"],
|
|
122
|
+
secret: true
|
|
123
|
+
},
|
|
124
|
+
teamId: {
|
|
125
|
+
names: ["VITE_SANDBOX_TEAM_ID", "VERCEL_TEAM_ID"],
|
|
126
|
+
secret: false
|
|
127
|
+
},
|
|
128
|
+
projectId: {
|
|
129
|
+
names: ["VITE_SANDBOX_PROJECT_ID", "VERCEL_PROJECT_ID"],
|
|
130
|
+
secret: false
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
export { resolveCloudflareSandboxTaskInstanceType as a, readSandboxTaskSize as i, assertCloudflareInstanceTypeFits as n, resolveVercelSandboxTaskVcpus as o, describeCloudflareInstanceType as r, vercelCredentialEnv as t };
|
|
@@ -3,7 +3,7 @@ import { r as markBuiltInSandboxRuntime } from "./runtime-DHp6ImeP.js";
|
|
|
3
3
|
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-BJtLRL9w.js";
|
|
4
4
|
import { t as shellQuote } from "./shell-quote-Q3u3plif.js";
|
|
5
5
|
import { t as listCommandFiles } from "./file-listing-CHtRrfo1.js";
|
|
6
|
-
import { i as resolveRemoteEnvironment, n as openRemoteSandbox, r as remoteSandboxPlan, t as collectProcessOutput } from "./remote-
|
|
6
|
+
import { i as resolveRemoteEnvironment, n as openRemoteSandbox, r as remoteSandboxPlan, t as collectProcessOutput } from "./remote-fjUPBiLJ.js";
|
|
7
7
|
import { n as killOnAbort } from "./abortable-CR01hzfi.js";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
9
|
import { posix } from "node:path";
|
|
@@ -12,7 +12,6 @@ var vercel_exports = /* @__PURE__ */ __exportAll({
|
|
|
12
12
|
createVercelRuntime: () => createVercelRuntime,
|
|
13
13
|
loadVercelSandbox: () => loadVercelSandbox
|
|
14
14
|
});
|
|
15
|
-
/** The signals that the Vercel Sandbox SDK sends by name. Other signals use their number. */
|
|
16
15
|
const vercelSignalNames = [
|
|
17
16
|
"SIGHUP",
|
|
18
17
|
"SIGINT",
|
|
@@ -283,7 +282,6 @@ function vercelProcess(process, stdin) {
|
|
|
283
282
|
}
|
|
284
283
|
};
|
|
285
284
|
}
|
|
286
|
-
/** Bounds each channel independently so an unread channel cannot stall its sibling. */
|
|
287
285
|
function streamLogs(command) {
|
|
288
286
|
const bufferLimit = 1048576;
|
|
289
287
|
const encoder = new TextEncoder();
|
|
@@ -291,13 +289,16 @@ function streamLogs(command) {
|
|
|
291
289
|
const iterator = command.logs({ signal: abort.signal })[Symbol.asyncIterator]();
|
|
292
290
|
const open = /* @__PURE__ */ new Map();
|
|
293
291
|
let stopped = false;
|
|
292
|
+
const isAbortReason = (error) => error === abort.signal.reason || error instanceof Error && error.name === "AbortError";
|
|
294
293
|
const stop = async () => {
|
|
295
294
|
if (stopped) return;
|
|
296
295
|
stopped = true;
|
|
297
296
|
abort.abort();
|
|
298
297
|
try {
|
|
299
298
|
await iterator.return?.();
|
|
300
|
-
} catch {
|
|
299
|
+
} catch (error) {
|
|
300
|
+
if (!isAbortReason(error)) throw error;
|
|
301
|
+
}
|
|
301
302
|
};
|
|
302
303
|
const stream = (name) => new ReadableStream({
|
|
303
304
|
cancel() {
|
|
@@ -314,25 +315,32 @@ function streamLogs(command) {
|
|
|
314
315
|
};
|
|
315
316
|
(async () => {
|
|
316
317
|
try {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
318
|
+
try {
|
|
319
|
+
while (open.size > 0) {
|
|
320
|
+
const entry = await iterator.next();
|
|
321
|
+
if (entry.done) break;
|
|
322
|
+
const line = entry.value;
|
|
323
|
+
const controller = open.get(line.stream);
|
|
324
|
+
if (!controller || line.data.length === 0) continue;
|
|
325
|
+
const chunk = new Uint8Array(Math.min(line.data.length * 3, controller.desiredSize ?? 0));
|
|
326
|
+
const { read, written } = encoder.encodeInto(line.data, chunk);
|
|
327
|
+
if (read < line.data.length) {
|
|
328
|
+
controller.error(sandboxErrorDiagnostics.SANDBOX_R0159({ message: `Vercel ${line.stream} exceeded the ${bufferLimit}-byte output buffer limit. Consume both streams concurrently or cancel unused output.` }));
|
|
329
|
+
open.delete(line.stream);
|
|
330
|
+
} else controller.enqueue(written === chunk.byteLength ? chunk : chunk.slice(0, written));
|
|
331
|
+
}
|
|
332
|
+
} catch (readError) {
|
|
333
|
+
await stop().catch((closeError) => {
|
|
334
|
+
throw new AggregateError([readError, closeError], "Vercel logs failed to read and close", { cause: readError });
|
|
335
|
+
});
|
|
336
|
+
throw readError;
|
|
329
337
|
}
|
|
338
|
+
await stop();
|
|
330
339
|
for (const controller of open.values()) controller.close();
|
|
331
340
|
} catch (error) {
|
|
332
341
|
for (const controller of open.values()) controller.error(error);
|
|
333
342
|
} finally {
|
|
334
343
|
open.clear();
|
|
335
|
-
await stop();
|
|
336
344
|
}
|
|
337
345
|
})();
|
|
338
346
|
return output;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/sandbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Portable, isolated Sandboxes for ViteHub Agents, and Sandbox Tasks that run named package projects in them.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@vite-hub/runtime": "0.
|
|
117
|
+
"@vite-hub/runtime": "0.5.0",
|
|
118
118
|
"local-pkg": "^1.2.1",
|
|
119
119
|
"mlly": "^1.8.2",
|
|
120
120
|
"nostics": "1.4.0",
|