@vite-hub/sandbox 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 +118 -53
- package/dist/abortable-CR01hzfi.js +57 -0
- package/dist/cloudflare-Cog_r2Me.js +910 -0
- package/dist/cloudflare-env-lookup-DzI6Xv1Y.js +16 -0
- package/dist/cloudflare-failure-CFQhalfh.js +50 -0
- package/dist/container-CqfD8yuE.js +868 -0
- package/dist/{crabbox-BFCdf41h.js → crabbox-sbV3Zjuo.js} +10 -6
- package/dist/error-diagnostics-5QT_BjbQ.js +354 -0
- package/dist/error-diagnostics-BJtLRL9w.js +536 -0
- package/dist/{file-listing-DECFTdSl.js → file-listing-CHtRrfo1.js} +1 -1
- package/dist/{file-lock-CxyVl4Cv.js → file-lock-D0-XPogS.js} +3 -2
- package/dist/{index-CXej1Bt0.d.ts → index-DsoQAUb7.d.ts} +94 -19
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -10
- package/dist/internal/cloudflare.d.ts +173 -1
- package/dist/internal/cloudflare.js +4 -12
- package/dist/internal/host-toolchain.d.ts +1 -1
- package/dist/internal/host-toolchain.js +6 -7
- package/dist/internal/vercel.d.ts +1 -1
- package/dist/internal/vercel.js +3 -11
- package/dist/invariant-DolT9EEx.js +22 -0
- package/dist/module-types-B0LQ5H2S.js +7 -0
- package/dist/module-types-DCeJbS9Z.d.ts +110 -0
- package/dist/process-sweep-CMaujWE5.js +33 -0
- package/dist/provider-resolution-C6AQzuFG.js +133 -0
- package/dist/{remote-1Jz2oUMK.js → remote-70ZVZZlq.js} +32 -14
- package/dist/runtime-type-Deo4qzxN.js +9 -0
- package/dist/{session-DD0S1PDC.js → session-e0lyzjJ3.js} +2 -1
- package/dist/size-7AkVwGZb.js +118 -0
- package/dist/ssh.d.ts +8 -0
- package/dist/ssh.js +107 -40
- package/dist/task/index.d.ts +19 -17
- package/dist/task/index.js +92 -201
- package/dist/task/runtime/provider-loader.d.ts +7 -9
- package/dist/task/runtime/provider-loader.js +2 -5
- package/dist/task/runtime/providers/cloudflare.d.ts +5 -19
- package/dist/task/runtime/providers/cloudflare.js +7 -6
- package/dist/task/runtime/providers/vercel.d.ts +3 -3
- package/dist/task/runtime/providers/vercel.js +35 -4
- package/dist/task/runtime/state.d.ts +4 -1
- package/dist/task/runtime/state.js +11 -2
- package/dist/task/vite.d.ts +143 -17
- package/dist/task/vite.js +723 -400
- package/dist/{toolchain-BUVXtQ2m.js → toolchain-BIVGMRty.js} +12 -11
- package/dist/{trusted-host-DNMJ-Oig.js → trusted-host-kxkpaQcs.js} +21 -179
- package/dist/{vercel-Jtxa9TJx.js → vercel-BGGrNpza.js} +107 -34
- package/package.json +15 -12
- package/dist/cloudflare-DO0h3Ncf.js +0 -281
- package/dist/cloudflare-env-BBJaBbuQ.js +0 -39
- package/dist/error-diagnostics-BSysPv-D.js +0 -166
- package/dist/error-diagnostics-dGQqfgLt.js +0 -99
- package/dist/module-types-BfyRBaiP.js +0 -7
- package/dist/module-types-Cis4hrF1.d.ts +0 -95
- package/dist/runtime-type-DrmrW5m5.js +0 -42
package/dist/ssh.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-BJtLRL9w.js";
|
|
2
|
+
import { t as invariant } from "./invariant-DolT9EEx.js";
|
|
3
|
+
import { t as stopMarkedProcesses } from "./process-sweep-CMaujWE5.js";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
1
5
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { spawn } from "node:child_process";
|
|
6
|
+
import { execFile, spawn } from "node:child_process";
|
|
3
7
|
import { once } from "node:events";
|
|
4
8
|
import { createServer } from "node:net";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
import { promisify } from "node:util";
|
|
10
|
+
//#region src/ssh-launcher.injected.ts
|
|
11
|
+
/**
|
|
12
|
+
* Source text of the SSH launcher. It runs in its own Node process outside the application bundle, with only Node and
|
|
13
|
+
* OpenSSH, so its errors are plain. Its exit status and stderr reach the caller of `sshLaunch()`.
|
|
14
|
+
*/
|
|
8
15
|
const launcherSource = String.raw`
|
|
9
16
|
import { spawn } from "node:child_process"
|
|
10
17
|
import { mkdtemp, readFile, writeFile, rm } from "node:fs/promises"
|
|
@@ -12,18 +19,18 @@ import { tmpdir } from "node:os"
|
|
|
12
19
|
import { join } from "node:path"
|
|
13
20
|
const config = JSON.parse(process.argv[1])
|
|
14
21
|
const quote = value => "'" + value.replaceAll("'", "'\"'\"'") + "'"
|
|
15
|
-
|
|
22
|
+
const temporary = await mkdtemp(join(tmpdir(), "vitehub-ssh-"))
|
|
16
23
|
try {
|
|
24
|
+
const diagnostics = join(temporary, "diagnostics")
|
|
17
25
|
let knownHostsFile = config.knownHostsFile
|
|
18
26
|
if (config.hostKeyFile) {
|
|
19
|
-
temporary = await mkdtemp(join(tmpdir(), "vitehub-ssh-"))
|
|
20
27
|
knownHostsFile = join(temporary, "known_hosts")
|
|
21
28
|
const key = (await readFile(config.hostKeyFile, "utf8")).trim()
|
|
22
29
|
if (!/^(ssh-ed25519|ssh-rsa|ecdsa-sha2-\S+) [A-Za-z0-9+/=]+(?: .*)?$/.test(key)) throw new Error("Invalid SSH host public key")
|
|
23
30
|
await writeFile(knownHostsFile, "vitehub-runner " + key + "\n", { mode: 0o600 })
|
|
24
31
|
}
|
|
25
|
-
const
|
|
26
|
-
"-T", "-o", "BatchMode=yes", "-o", "ConnectTimeout=10",
|
|
32
|
+
const sshArgs = [
|
|
33
|
+
"-E", diagnostics, "-T", "-o", "BatchMode=yes", "-o", "ConnectTimeout=10",
|
|
27
34
|
"-o", "LogLevel=ERROR", "-o", "ServerAliveInterval=30",
|
|
28
35
|
"-o", "ServerAliveCountMax=3", "-o", "StrictHostKeyChecking=yes",
|
|
29
36
|
...(knownHostsFile ? ["-o", "UserKnownHostsFile=" + knownHostsFile] : []),
|
|
@@ -32,15 +39,55 @@ try {
|
|
|
32
39
|
...config.forwardEnvironment.flatMap(name => ["-o", "SendEnv=" + name]),
|
|
33
40
|
config.user + "@" + config.host,
|
|
34
41
|
"cd " + quote(config.cwd) + " && exec " + [config.command, ...process.argv.slice(2)].map(quote).join(" "),
|
|
35
|
-
]
|
|
36
|
-
|
|
42
|
+
]
|
|
43
|
+
// -E separates local OpenSSH diagnostics from remote stderr, which may itself contain an SSH refusal.
|
|
44
|
+
// Only a local connection refusal establishes that the remote command did not start.
|
|
45
|
+
const refused = /^ssh: connect to host \S+ port \d+: Connection refused\r?$/m
|
|
46
|
+
const deadline = Date.now() + config.connectRetryMs
|
|
47
|
+
let child
|
|
48
|
+
let stopped
|
|
49
|
+
let wake
|
|
50
|
+
const handlers = new Map(["SIGINT", "SIGTERM", "SIGHUP"].map(signal => [signal, () => {
|
|
51
|
+
stopped = signal
|
|
52
|
+
if (child) child.kill(signal)
|
|
53
|
+
wake?.()
|
|
54
|
+
}]))
|
|
37
55
|
for (const [signal, handler] of handlers) process.on(signal, handler)
|
|
38
56
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
for (let delay = 250; ; delay = Math.min(delay * 2, 4000)) {
|
|
58
|
+
await writeFile(diagnostics, "", { mode: 0o600 })
|
|
59
|
+
if (stopped) {
|
|
60
|
+
process.exitCode = 255
|
|
61
|
+
break
|
|
62
|
+
}
|
|
63
|
+
child = spawn("ssh", sshArgs, { stdio: ["inherit", "inherit", "pipe"] })
|
|
64
|
+
child.stderr.on("data", chunk => {
|
|
65
|
+
if (!process.stderr.write(chunk)) {
|
|
66
|
+
child.stderr.pause()
|
|
67
|
+
process.stderr.once("drain", () => child.stderr.resume())
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
const result = await new Promise((resolve, reject) => {
|
|
71
|
+
child.once("error", reject)
|
|
72
|
+
child.once("close", (code, signal) => resolve({ code, signal }))
|
|
73
|
+
})
|
|
74
|
+
const localDiagnostics = await readFile(diagnostics, "utf8")
|
|
75
|
+
process.stderr.write(localDiagnostics)
|
|
76
|
+
const wait = Math.min(delay, deadline - Date.now())
|
|
77
|
+
if (stopped || result.code !== 255 || !refused.test(localDiagnostics) || wait <= 0) {
|
|
78
|
+
process.exitCode = result.code ?? 1
|
|
79
|
+
break
|
|
80
|
+
}
|
|
81
|
+
await new Promise(resolve => {
|
|
82
|
+
const timer = setTimeout(resolve, wait)
|
|
83
|
+
wake = () => { clearTimeout(timer); resolve() }
|
|
84
|
+
})
|
|
85
|
+
wake = undefined
|
|
86
|
+
if (stopped) {
|
|
87
|
+
process.exitCode = 255
|
|
88
|
+
break
|
|
89
|
+
}
|
|
90
|
+
}
|
|
44
91
|
} finally {
|
|
45
92
|
for (const [signal, handler] of handlers) process.off(signal, handler)
|
|
46
93
|
}
|
|
@@ -48,41 +95,54 @@ try {
|
|
|
48
95
|
if (temporary) await rm(temporary, { recursive: true, force: true })
|
|
49
96
|
}
|
|
50
97
|
`;
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/ssh.ts
|
|
100
|
+
const maxTimeoutMs = 2147483647;
|
|
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
|
+
const commandEnvironmentKey = "VITEHUB_SSH_COMMAND";
|
|
51
104
|
/** Launch a command on a trusted SSH host with the same working-directory path. */
|
|
52
105
|
function sshLaunch(options) {
|
|
53
|
-
if (!options.host || options.host.startsWith("-") || /[\s\0]/.test(options.host)) throw
|
|
54
|
-
if (!/^[a-zA-Z_][a-zA-Z0-9_.-]*$/.test(options.user)) throw
|
|
55
|
-
if (!options.identityFile || options.identityFile.includes("\0")) throw
|
|
106
|
+
if (!options.host || options.host.startsWith("-") || /[\s\0]/.test(options.host)) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "host" });
|
|
107
|
+
if (!/^[a-zA-Z_][a-zA-Z0-9_.-]*$/.test(options.user)) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "user" });
|
|
108
|
+
if (!options.identityFile || options.identityFile.includes("\0")) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "identityFile" });
|
|
56
109
|
const port = options.port ?? 22;
|
|
57
|
-
if (!Number.isInteger(port) || port < 1 || port > 65535) throw
|
|
58
|
-
if (options.hostKeyFile && options.knownHostsFile) throw
|
|
110
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "port" });
|
|
111
|
+
if (options.hostKeyFile && options.knownHostsFile) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "hostKey" });
|
|
112
|
+
const connectRetryMs = options.connectRetryMs ?? 3e4;
|
|
113
|
+
if (!Number.isSafeInteger(connectRetryMs) || connectRetryMs < 0) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "connectRetryMs" });
|
|
59
114
|
const forwardEnvironment = [...new Set(options.forwardEnvironment ?? [])];
|
|
60
|
-
if (forwardEnvironment.some((name) => !environmentName.test(name))) throw
|
|
115
|
+
if (forwardEnvironment.some((name) => !environmentName.test(name))) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "environment" });
|
|
61
116
|
return ({ command, cwd, environment, requiredEnvironment }) => {
|
|
62
117
|
const names = options.forwardEnvironment === void 0 ? Object.keys(environment || {}).filter((name) => environmentName.test(name)) : forwardEnvironment;
|
|
63
118
|
const forwarded = [.../* @__PURE__ */ new Set([...names, ...requiredEnvironment || []])];
|
|
64
|
-
if (forwarded.some((name) => !environmentName.test(name))) throw
|
|
65
|
-
if (!command || !cwd || command.includes("\0") || cwd.includes("\0")) throw
|
|
119
|
+
if (forwarded.some((name) => !environmentName.test(name))) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "environment" });
|
|
120
|
+
if (!command || !cwd || command.includes("\0") || cwd.includes("\0")) throw sandboxErrorDiagnostics.SANDBOX_SSH_LAUNCH_INVALID({ problem: "command" });
|
|
121
|
+
const args = (command, cwd) => [
|
|
122
|
+
"--input-type=module",
|
|
123
|
+
"-e",
|
|
124
|
+
launcherSource,
|
|
125
|
+
JSON.stringify({
|
|
126
|
+
...options,
|
|
127
|
+
port,
|
|
128
|
+
connectRetryMs,
|
|
129
|
+
forwardEnvironment: forwarded,
|
|
130
|
+
command,
|
|
131
|
+
cwd
|
|
132
|
+
})
|
|
133
|
+
];
|
|
66
134
|
return {
|
|
67
135
|
command: process.execPath,
|
|
68
|
-
args:
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
JSON.stringify({
|
|
73
|
-
...options,
|
|
74
|
-
port,
|
|
75
|
-
forwardEnvironment: forwarded,
|
|
76
|
-
command,
|
|
77
|
-
cwd
|
|
78
|
-
})
|
|
79
|
-
]
|
|
136
|
+
args: args(command, cwd),
|
|
137
|
+
prepare: async ({ abortSignal }) => {
|
|
138
|
+
await promisify(execFile)(process.execPath, args("/bin/true", "/"), { signal: abortSignal });
|
|
139
|
+
}
|
|
80
140
|
};
|
|
81
141
|
};
|
|
82
142
|
}
|
|
83
143
|
/** An authenticated command server, not a filesystem or network sandbox. */
|
|
84
144
|
async function serveSsh(options) {
|
|
85
|
-
if (process.platform === "win32") throw
|
|
145
|
+
if (process.platform === "win32") throw sandboxErrorDiagnostics.SANDBOX_SSH_POSIX_REQUIRED();
|
|
86
146
|
const { default: ssh2 } = await import("ssh2");
|
|
87
147
|
const [hostKey, authorizedKey] = await Promise.all([readFile(options.hostKeyFile), readFile(options.authorizedKeyFile)]);
|
|
88
148
|
const parsedKey = ssh2.utils.parseKey(authorizedKey);
|
|
@@ -91,6 +151,7 @@ async function serveSsh(options) {
|
|
|
91
151
|
const clients = /* @__PURE__ */ new Set();
|
|
92
152
|
const sockets = /* @__PURE__ */ new Set();
|
|
93
153
|
const children = /* @__PURE__ */ new Set();
|
|
154
|
+
const markers = /* @__PURE__ */ new Map();
|
|
94
155
|
const terminations = /* @__PURE__ */ new Map();
|
|
95
156
|
const allowed = options.acceptEnvironment && new Set(options.acceptEnvironment);
|
|
96
157
|
function stop(child) {
|
|
@@ -108,6 +169,8 @@ async function serveSsh(options) {
|
|
|
108
169
|
signalGroup("SIGTERM");
|
|
109
170
|
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
110
171
|
signalGroup("SIGKILL");
|
|
172
|
+
const marker = markers.get(child);
|
|
173
|
+
if (marker) await stopMarkedProcesses(commandEnvironmentKey, marker);
|
|
111
174
|
})();
|
|
112
175
|
terminations.set(child, done);
|
|
113
176
|
return done;
|
|
@@ -132,12 +195,14 @@ async function serveSsh(options) {
|
|
|
132
195
|
session.on("exec", (acceptExec, _reject, info) => {
|
|
133
196
|
const stream = acceptExec();
|
|
134
197
|
stream.allowHalfOpen = true;
|
|
135
|
-
const
|
|
198
|
+
const marker = randomUUID();
|
|
199
|
+
const child = spawn("/bin/sh", ["-c", info.command], {
|
|
136
200
|
cwd: options.cwd,
|
|
137
201
|
detached: true,
|
|
138
202
|
env: {
|
|
139
203
|
...process.env,
|
|
140
|
-
...environment
|
|
204
|
+
...environment,
|
|
205
|
+
[commandEnvironmentKey]: marker
|
|
141
206
|
},
|
|
142
207
|
stdio: [
|
|
143
208
|
"pipe",
|
|
@@ -146,6 +211,7 @@ async function serveSsh(options) {
|
|
|
146
211
|
]
|
|
147
212
|
});
|
|
148
213
|
children.add(child);
|
|
214
|
+
markers.set(child, marker);
|
|
149
215
|
stream.pipe(child.stdin);
|
|
150
216
|
child.stdin.on("error", () => {});
|
|
151
217
|
child.stdout.pipe(stream, { end: false });
|
|
@@ -163,6 +229,7 @@ async function serveSsh(options) {
|
|
|
163
229
|
child.once("close", (code) => {
|
|
164
230
|
stop(child).finally(() => {
|
|
165
231
|
children.delete(child);
|
|
232
|
+
markers.delete(child);
|
|
166
233
|
terminations.delete(child);
|
|
167
234
|
});
|
|
168
235
|
stream.exit(code ?? 1);
|
|
@@ -184,7 +251,7 @@ async function serveSsh(options) {
|
|
|
184
251
|
listener.listen(options.port ?? 2222, options.host ?? "127.0.0.1");
|
|
185
252
|
await listening;
|
|
186
253
|
const address = listener.address();
|
|
187
|
-
|
|
254
|
+
invariant(address && address instanceof Object, "an SSH listener on a TCP host and port has a TCP address");
|
|
188
255
|
let closing;
|
|
189
256
|
return {
|
|
190
257
|
port: address.port,
|
|
@@ -192,7 +259,7 @@ async function serveSsh(options) {
|
|
|
192
259
|
return sockets.size;
|
|
193
260
|
},
|
|
194
261
|
close({ drainTimeoutMs = 0 } = {}) {
|
|
195
|
-
if (!Number.isSafeInteger(drainTimeoutMs) || drainTimeoutMs < 0 || drainTimeoutMs > maxTimeoutMs) throw
|
|
262
|
+
if (!Number.isSafeInteger(drainTimeoutMs) || drainTimeoutMs < 0 || drainTimeoutMs > maxTimeoutMs) throw sandboxErrorDiagnostics.SANDBOX_SSH_DRAIN_TIMEOUT_INVALID();
|
|
196
263
|
if (closing) {
|
|
197
264
|
if (!drainTimeoutMs) endDrain?.();
|
|
198
265
|
return closing;
|
package/dist/task/index.d.ts
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { a as SandboxTaskDefinitionBundle, c as
|
|
2
|
-
import {
|
|
3
|
-
import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
1
|
+
import { _ as getSandboxTaskFeatureDriver, a as SandboxTaskDefinitionBundle, c as SandboxTaskDefinitionHandler, d as SandboxTaskDriver, f as SandboxTaskExecutionOptions, g as VercelSandboxTaskDriverOptions, h as SandboxTaskRunResult, i as SandboxTaskDefinition, l as SandboxTaskDefinitionInput, m as SandboxTaskRunArguments, n as CloudflareSandboxTaskDefinitionDriverOptions, o as SandboxTaskDefinitionDriverOptions, p as SandboxTaskProjectOptions, r as CloudflareSandboxTaskOptions, s as SandboxTaskDefinitionFromHandler, t as AgentSandboxTaskConfig, u as SandboxTaskDefinitionOptions, v as SandboxTaskSizeOptions } from "../module-types-DCeJbS9Z.js";
|
|
2
|
+
import { ExecutionAuthority, ViteHubContext } from "@vite-hub/runtime";
|
|
4
3
|
import { SandboxTaskDefinitionModules } from "#vitehub-sandbox-task-registry";
|
|
5
4
|
//#region src/task/runtime/registry.d.ts
|
|
6
5
|
export declare function defineSandboxTask<THandler extends (...args: any[]) => any>(input: SandboxTaskDefinitionInput<Parameters<THandler>[0], Awaited<ReturnType<THandler>>> & {
|
|
7
|
-
|
|
6
|
+
handler: THandler;
|
|
8
7
|
}): SandboxTaskDefinitionFromHandler<THandler>;
|
|
9
8
|
//#endregion
|
|
10
9
|
//#region src/task/internal/shared/request-payload.d.ts
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
json: () => Promise<unknown>;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export declare function readRequestPayload(event: RequestPayloadEvent, fallback?: unknown): Promise<unknown>;
|
|
10
|
+
/** Read the JSON body of the request in the event's Standard Context, or `fallback` when the body is not JSON. */
|
|
11
|
+
export declare function readRequestPayload(event: ViteHubContext, fallback?: unknown): Promise<unknown>;
|
|
17
12
|
//#endregion
|
|
18
13
|
//#region src/task/internal/shared/validation.d.ts
|
|
19
14
|
interface ValidationIssue {
|
|
@@ -49,19 +44,26 @@ type SandboxTaskRegistryDefinition<TName extends keyof SandboxTaskDefinitionModu
|
|
|
49
44
|
type SandboxTaskPayload<TDefinition> = TDefinition extends {
|
|
50
45
|
payload: infer TPayload;
|
|
51
46
|
} ? TPayload : unknown;
|
|
47
|
+
type SandboxTaskResult<TDefinition> = TDefinition extends {
|
|
48
|
+
result: infer TResult;
|
|
49
|
+
} ? TResult : unknown;
|
|
52
50
|
//#endregion
|
|
53
51
|
//#region src/task/runtime/public.d.ts
|
|
54
|
-
export declare function runSandboxTask<const TName extends
|
|
55
|
-
|
|
52
|
+
export declare function runSandboxTask<const TName extends string>(name: TName, ...args: SandboxTaskRunArguments<TName extends SandboxTaskDefinitionName ? SandboxTaskPayload<SandboxTaskRegistryDefinition<TName>> : unknown>): Promise<SandboxTaskRunResult>;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/task/runtime/provider-resolution.d.ts
|
|
55
|
+
export declare function unsupportedHostedSandboxTaskProviderError(provider: unknown): Error;
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/task/runtime/runtime.d.ts
|
|
58
58
|
interface SandboxTaskRunner {
|
|
59
59
|
readonly executionAuthority: ExecutionAuthority;
|
|
60
60
|
name: string;
|
|
61
|
-
run: <TPayload = unknown, TResult = unknown>(
|
|
61
|
+
run: <TPayload = unknown, TResult = unknown>(...args: SandboxTaskRunArguments<TPayload>) => Promise<TResult>;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
run: (
|
|
65
|
-
}
|
|
63
|
+
type ResolvedSandboxTaskRunner<TPayload, TResult> = Omit<SandboxTaskRunner, 'run'> & {
|
|
64
|
+
run: (...args: SandboxTaskRunArguments<TPayload>) => Promise<TResult>;
|
|
65
|
+
};
|
|
66
|
+
export declare function resolveSandboxTaskRunner<const TName extends SandboxTaskDefinitionName>(name: TName): Promise<ResolvedSandboxTaskRunner<SandboxTaskPayload<SandboxTaskRegistryDefinition<TName>>, SandboxTaskResult<SandboxTaskRegistryDefinition<TName>>>>;
|
|
67
|
+
export declare function resolveSandboxTaskRunner<TPayload = unknown, TResult = unknown>(name?: string): Promise<ResolvedSandboxTaskRunner<TPayload, TResult>>;
|
|
66
68
|
//#endregion
|
|
67
|
-
export {
|
|
69
|
+
export type { AgentSandboxTaskConfig, CloudflareSandboxTaskDefinitionDriverOptions, CloudflareSandboxTaskOptions, SandboxTaskDefinition, SandboxTaskDefinitionBundle, SandboxTaskDefinitionDriverOptions, SandboxTaskDefinitionFromHandler, SandboxTaskDefinitionHandler, SandboxTaskDefinitionInput, SandboxTaskDefinitionOptions, SandboxTaskDriver, SandboxTaskExecutionOptions, SandboxTaskProjectOptions, SandboxTaskRunArguments, SandboxTaskRunResult, SandboxTaskRunner, SandboxTaskSizeOptions, VercelSandboxTaskDriverOptions, getSandboxTaskFeatureDriver };
|