self-bench 0.3.5 → 0.3.6
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 +16 -14
- package/biome.json +7 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +7 -7
- package/dist/api.js.map +1 -1
- package/dist/build-metadata.js +1 -1
- package/dist/cli.js +75 -15
- package/dist/cli.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +6 -5
- package/dist/contracts.js.map +1 -1
- package/dist/extensions/discovery.d.ts.map +1 -1
- package/dist/extensions/discovery.js +12 -5
- package/dist/extensions/discovery.js.map +1 -1
- package/dist/harbor-task.d.ts.map +1 -1
- package/dist/harbor-task.js +3 -1
- package/dist/harbor-task.js.map +1 -1
- package/dist/project-paths.d.ts +2 -0
- package/dist/project-paths.d.ts.map +1 -0
- package/dist/project-paths.js +15 -0
- package/dist/project-paths.js.map +1 -0
- package/dist/provenance-associations.d.ts +49 -0
- package/dist/provenance-associations.d.ts.map +1 -0
- package/dist/provenance-associations.js +220 -0
- package/dist/provenance-associations.js.map +1 -0
- package/dist/provenance.d.ts +34 -13
- package/dist/provenance.d.ts.map +1 -1
- package/dist/provenance.js +81 -9
- package/dist/provenance.js.map +1 -1
- package/dist/reaudit-main.js +3 -3
- package/dist/reaudit-main.js.map +1 -1
- package/dist/repair-main.js +4 -4
- package/dist/repair-main.js.map +1 -1
- package/dist/{sandbox.d.ts → sandbox/contracts.d.ts} +5 -3
- package/dist/sandbox/contracts.d.ts.map +1 -0
- package/dist/sandbox/contracts.js +9 -0
- package/dist/sandbox/contracts.js.map +1 -0
- package/dist/sandbox/index.d.ts +5 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/{sandbox.js → sandbox/index.js} +6 -5
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/programs/author.d.ts +3 -0
- package/dist/sandbox/programs/author.d.ts.map +1 -0
- package/dist/{sandbox-author.js → sandbox/programs/author.js} +2 -2
- package/dist/sandbox/programs/author.js.map +1 -0
- package/dist/sandbox/programs/prepare-repair.d.ts +7 -0
- package/dist/sandbox/programs/prepare-repair.d.ts.map +1 -0
- package/dist/sandbox/programs/prepare-repair.js +30 -0
- package/dist/sandbox/programs/prepare-repair.js.map +1 -0
- package/dist/sandbox/programs/repair.d.ts +3 -0
- package/dist/sandbox/programs/repair.d.ts.map +1 -0
- package/dist/{sandbox-repair.js → sandbox/programs/repair.js} +7 -28
- package/dist/sandbox/programs/repair.js.map +1 -0
- package/dist/sandbox/programs/review.d.ts +2 -0
- package/dist/sandbox/programs/review.d.ts.map +1 -0
- package/dist/{sandbox-review.js → sandbox/programs/review.js} +2 -2
- package/dist/sandbox/programs/review.js.map +1 -0
- package/dist/sandbox/programs/validation-repair.d.ts +3 -0
- package/dist/sandbox/programs/validation-repair.d.ts.map +1 -0
- package/dist/{sandbox-validation-repair.js → sandbox/programs/validation-repair.js} +7 -28
- package/dist/sandbox/programs/validation-repair.js.map +1 -0
- package/dist/{docker-executor.d.ts → sandbox/providers/docker/executor.d.ts} +3 -3
- package/dist/sandbox/providers/docker/executor.d.ts.map +1 -0
- package/dist/{docker-executor.js → sandbox/providers/docker/executor.js} +2 -2
- package/dist/sandbox/providers/docker/executor.js.map +1 -0
- package/dist/{modal-executor.d.ts → sandbox/providers/modal/executor.d.ts} +3 -3
- package/dist/sandbox/providers/modal/executor.d.ts.map +1 -0
- package/dist/{modal-executor.js → sandbox/providers/modal/executor.js} +50 -19
- package/dist/sandbox/providers/modal/executor.js.map +1 -0
- package/dist/{vercel-command.d.ts → sandbox/providers/vercel/command.d.ts} +3 -3
- package/dist/sandbox/providers/vercel/command.d.ts.map +1 -0
- package/dist/{vercel-command.js → sandbox/providers/vercel/command.js} +3 -3
- package/dist/sandbox/providers/vercel/command.js.map +1 -0
- package/dist/{vercel-executor.d.ts → sandbox/providers/vercel/executor.d.ts} +3 -3
- package/dist/sandbox/providers/vercel/executor.d.ts.map +1 -0
- package/dist/{vercel-executor.js → sandbox/providers/vercel/executor.js} +5 -5
- package/dist/sandbox/providers/vercel/executor.js.map +1 -0
- package/dist/{vercel-fetch.d.ts → sandbox/providers/vercel/fetch.d.ts} +1 -1
- package/dist/sandbox/providers/vercel/fetch.d.ts.map +1 -0
- package/dist/{vercel-fetch.js → sandbox/providers/vercel/fetch.js} +1 -1
- package/dist/sandbox/providers/vercel/fetch.js.map +1 -0
- package/dist/{sandbox-timeout.d.ts → sandbox/timeout.d.ts} +2 -2
- package/dist/sandbox/timeout.d.ts.map +1 -0
- package/dist/{sandbox-timeout.js → sandbox/timeout.js} +1 -1
- package/dist/sandbox/timeout.js.map +1 -0
- package/dist/sandbox-author.bundle.js +11 -8
- package/dist/sandbox-repair.bundle.js +43 -35
- package/dist/sandbox-review.bundle.js +2 -2
- package/dist/sandbox-validation-repair.bundle.js +50 -41
- package/dist/{vercel-cli.d.ts → setup/vercel/cli.d.ts} +2 -2
- package/dist/setup/vercel/cli.d.ts.map +1 -0
- package/dist/{vercel-cli.js → setup/vercel/cli.js} +2 -2
- package/dist/setup/vercel/cli.js.map +1 -0
- package/dist/setup/vercel/index.d.ts +4 -0
- package/dist/setup/vercel/index.d.ts.map +1 -0
- package/dist/setup/vercel/index.js +3 -0
- package/dist/setup/vercel/index.js.map +1 -0
- package/dist/{vercel-setup-probe.d.ts → setup/vercel/probe.d.ts} +2 -2
- package/dist/setup/vercel/probe.d.ts.map +1 -0
- package/dist/{vercel-setup-probe.js → setup/vercel/probe.js} +2 -2
- package/dist/setup/vercel/probe.js.map +1 -0
- package/dist/{vercel-profile.d.ts → setup/vercel/profile.d.ts} +1 -1
- package/dist/setup/vercel/profile.d.ts.map +1 -0
- package/dist/{vercel-profile.js → setup/vercel/profile.js} +2 -2
- package/dist/setup/vercel/profile.js.map +1 -0
- package/dist/{vercel-runtime-image.d.ts → setup/vercel/runtime-image.d.ts} +5 -5
- package/dist/setup/vercel/runtime-image.d.ts.map +1 -0
- package/dist/{vercel-runtime-image.js → setup/vercel/runtime-image.js} +2 -2
- package/dist/setup/vercel/runtime-image.js.map +1 -0
- package/dist/{vercel-setup.d.ts → setup/vercel/setup.d.ts} +8 -8
- package/dist/setup/vercel/setup.d.ts.map +1 -0
- package/dist/{vercel-setup.js → setup/vercel/setup.js} +8 -8
- package/dist/setup/vercel/setup.js.map +1 -0
- package/dist/temporal/activities.d.ts +12 -0
- package/dist/temporal/activities.d.ts.map +1 -1
- package/dist/temporal/activities.js +80 -33
- package/dist/temporal/activities.js.map +1 -1
- package/dist/temporal/workflow.d.ts +1 -1
- package/dist/temporal/workflow.d.ts.map +1 -1
- package/dist/temporal/workflow.js +90 -65
- package/dist/temporal/workflow.js.map +1 -1
- package/docs/operations.md +39 -5
- package/docs/task-construction.md +3 -1
- package/package.json +5 -5
- package/scripts/build-sandbox-programs.ts +22 -0
- package/scripts/verify-package.ts +25 -4
- package/scripts/write-build-metadata.ts +1 -1
- package/src/api.ts +7 -6
- package/src/cli.ts +99 -15
- package/src/config.ts +1 -1
- package/src/contracts.ts +7 -5
- package/src/extensions/discovery.ts +14 -5
- package/src/harbor-task.ts +6 -1
- package/src/project-paths.ts +15 -0
- package/src/provenance-associations.ts +311 -0
- package/src/provenance.ts +132 -28
- package/src/reaudit-main.ts +3 -3
- package/src/repair-main.ts +4 -4
- package/src/{sandbox.ts → sandbox/contracts.ts} +11 -20
- package/src/sandbox/index.ts +23 -0
- package/src/{sandbox-author.ts → sandbox/programs/author.ts} +1 -1
- package/src/sandbox/programs/prepare-repair.ts +44 -0
- package/src/{sandbox-repair.ts → sandbox/programs/repair.ts} +7 -31
- package/src/{sandbox-review.ts → sandbox/programs/review.ts} +1 -1
- package/src/{sandbox-validation-repair.ts → sandbox/programs/validation-repair.ts} +6 -30
- package/src/{docker-executor.ts → sandbox/providers/docker/executor.ts} +3 -3
- package/src/{modal-executor.ts → sandbox/providers/modal/executor.ts} +66 -25
- package/src/{vercel-command.ts → sandbox/providers/vercel/command.ts} +3 -3
- package/src/{vercel-executor.ts → sandbox/providers/vercel/executor.ts} +5 -5
- package/src/{sandbox-timeout.ts → sandbox/timeout.ts} +1 -1
- package/src/{vercel-cli.ts → setup/vercel/cli.ts} +1 -1
- package/src/setup/vercel/index.ts +3 -0
- package/src/{vercel-setup-probe.ts → setup/vercel/probe.ts} +5 -2
- package/src/{vercel-profile.ts → setup/vercel/profile.ts} +4 -1
- package/src/{vercel-runtime-image.ts → setup/vercel/runtime-image.ts} +5 -5
- package/src/{vercel-setup.ts → setup/vercel/setup.ts} +8 -8
- package/src/temporal/activities.ts +164 -63
- package/src/temporal/workflow.ts +120 -71
- package/tsconfig.json +1 -1
- package/dist/docker-executor.d.ts.map +0 -1
- package/dist/docker-executor.js.map +0 -1
- package/dist/modal-executor.d.ts.map +0 -1
- package/dist/modal-executor.js.map +0 -1
- package/dist/sandbox-author.d.ts +0 -3
- package/dist/sandbox-author.d.ts.map +0 -1
- package/dist/sandbox-author.js.map +0 -1
- package/dist/sandbox-repair.d.ts +0 -3
- package/dist/sandbox-repair.d.ts.map +0 -1
- package/dist/sandbox-repair.js.map +0 -1
- package/dist/sandbox-review.d.ts +0 -2
- package/dist/sandbox-review.d.ts.map +0 -1
- package/dist/sandbox-review.js.map +0 -1
- package/dist/sandbox-timeout.d.ts.map +0 -1
- package/dist/sandbox-timeout.js.map +0 -1
- package/dist/sandbox-validation-repair.d.ts +0 -3
- package/dist/sandbox-validation-repair.d.ts.map +0 -1
- package/dist/sandbox-validation-repair.js.map +0 -1
- package/dist/sandbox.d.ts.map +0 -1
- package/dist/sandbox.js.map +0 -1
- package/dist/vercel-cli.d.ts.map +0 -1
- package/dist/vercel-cli.js.map +0 -1
- package/dist/vercel-command.d.ts.map +0 -1
- package/dist/vercel-command.js.map +0 -1
- package/dist/vercel-executor.d.ts.map +0 -1
- package/dist/vercel-executor.js.map +0 -1
- package/dist/vercel-fetch.d.ts.map +0 -1
- package/dist/vercel-fetch.js.map +0 -1
- package/dist/vercel-profile.d.ts.map +0 -1
- package/dist/vercel-profile.js.map +0 -1
- package/dist/vercel-runtime-image.d.ts.map +0 -1
- package/dist/vercel-runtime-image.js.map +0 -1
- package/dist/vercel-setup-probe.d.ts.map +0 -1
- package/dist/vercel-setup-probe.js.map +0 -1
- package/dist/vercel-setup.d.ts.map +0 -1
- package/dist/vercel-setup.js.map +0 -1
- /package/src/{vercel-fetch.ts → sandbox/providers/vercel/fetch.ts} +0 -0
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
1
2
|
import { type Image, ModalClient, type Secret } from "modal";
|
|
2
|
-
import type { SelfBenchConfig } from "
|
|
3
|
-
import { InactivityTimeoutError, RollingOutput } from "
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import type { SelfBenchConfig } from "../../../config.js";
|
|
4
|
+
import { InactivityTimeoutError, RollingOutput } from "../../../process.js";
|
|
5
|
+
import {
|
|
6
|
+
SandboxExecutionError,
|
|
7
|
+
type SandboxExecutor,
|
|
8
|
+
type SandboxRequest,
|
|
9
|
+
type SandboxResult,
|
|
10
|
+
type SandboxRunOptions,
|
|
11
|
+
} from "../../contracts.js";
|
|
12
|
+
|
|
13
|
+
const FAILURE_DRAIN_TIMEOUT_MS = 1_000;
|
|
10
14
|
|
|
11
15
|
export class ModalSandboxExecutor implements SandboxExecutor {
|
|
12
16
|
readonly #client: ModalClient;
|
|
@@ -22,10 +26,12 @@ export class ModalSandboxExecutor implements SandboxExecutor {
|
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
async run(request: SandboxRequest, options: SandboxRunOptions = {}): Promise<SandboxResult> {
|
|
29
|
+
options.signal?.throwIfAborted();
|
|
25
30
|
const app = await this.#client.apps.fromName(this.#config.app, {
|
|
26
31
|
createIfMissing: true,
|
|
27
32
|
...(this.#config.environment ? { environment: this.#config.environment } : {}),
|
|
28
33
|
});
|
|
34
|
+
options.signal?.throwIfAborted();
|
|
29
35
|
if (!this.#image) {
|
|
30
36
|
this.#image = this.#buildImage();
|
|
31
37
|
}
|
|
@@ -39,11 +45,14 @@ export class ModalSandboxExecutor implements SandboxExecutor {
|
|
|
39
45
|
tags: { run_id: request.runId, stage: request.stage },
|
|
40
46
|
});
|
|
41
47
|
|
|
48
|
+
let notifyFailure = (): void => {};
|
|
42
49
|
const abort = () => {
|
|
50
|
+
notifyFailure();
|
|
43
51
|
void sandbox.terminate();
|
|
44
52
|
};
|
|
45
53
|
options.signal?.addEventListener("abort", abort, { once: true });
|
|
46
54
|
try {
|
|
55
|
+
options.signal?.throwIfAborted();
|
|
47
56
|
for (const file of request.files ?? []) {
|
|
48
57
|
if (typeof file.contents === "string") {
|
|
49
58
|
await sandbox.filesystem.writeText(file.contents, file.path);
|
|
@@ -60,8 +69,12 @@ export class ModalSandboxExecutor implements SandboxExecutor {
|
|
|
60
69
|
await process.closeStdin();
|
|
61
70
|
const stdoutOutput = new RollingOutput();
|
|
62
71
|
const stderrOutput = new RollingOutput();
|
|
72
|
+
const readers = new Set<ReadableStreamDefaultReader<string | Uint8Array>>();
|
|
63
73
|
let inactivityTimer: ReturnType<typeof setTimeout> | undefined;
|
|
64
74
|
let inactivityError: InactivityTimeoutError | undefined;
|
|
75
|
+
const failure = new Promise<void>((resolve) => {
|
|
76
|
+
notifyFailure = resolve;
|
|
77
|
+
});
|
|
65
78
|
const clearInactivityTimer = (): void => {
|
|
66
79
|
if (inactivityTimer) {
|
|
67
80
|
clearTimeout(inactivityTimer);
|
|
@@ -78,7 +91,7 @@ export class ModalSandboxExecutor implements SandboxExecutor {
|
|
|
78
91
|
`Modal sandbox ${sandbox.sandboxId} stage ${request.stage}`,
|
|
79
92
|
request.inactivityTimeoutMs ?? 0,
|
|
80
93
|
);
|
|
81
|
-
|
|
94
|
+
notifyFailure();
|
|
82
95
|
}, request.inactivityTimeoutMs);
|
|
83
96
|
inactivityTimer.unref();
|
|
84
97
|
};
|
|
@@ -88,6 +101,7 @@ export class ModalSandboxExecutor implements SandboxExecutor {
|
|
|
88
101
|
output: RollingOutput,
|
|
89
102
|
): Promise<void> => {
|
|
90
103
|
const reader = stream.getReader();
|
|
104
|
+
readers.add(reader);
|
|
91
105
|
try {
|
|
92
106
|
while (true) {
|
|
93
107
|
const { value, done } = await reader.read();
|
|
@@ -102,25 +116,38 @@ export class ModalSandboxExecutor implements SandboxExecutor {
|
|
|
102
116
|
}
|
|
103
117
|
}
|
|
104
118
|
} finally {
|
|
119
|
+
readers.delete(reader);
|
|
105
120
|
reader.releaseLock();
|
|
106
121
|
}
|
|
107
122
|
};
|
|
123
|
+
let exitCode: number | undefined;
|
|
124
|
+
let processError: unknown;
|
|
125
|
+
let streamError: unknown;
|
|
126
|
+
const captureFailure = (error: unknown): void => {
|
|
127
|
+
streamError ??= error;
|
|
128
|
+
notifyFailure();
|
|
129
|
+
};
|
|
108
130
|
armInactivityTimer();
|
|
109
|
-
const
|
|
110
|
-
process.wait()
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
.catch(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
const completion = Promise.all([
|
|
132
|
+
process.wait().then(
|
|
133
|
+
(value) => {
|
|
134
|
+
exitCode = value;
|
|
135
|
+
},
|
|
136
|
+
(error: unknown) => {
|
|
137
|
+
processError = error;
|
|
138
|
+
notifyFailure();
|
|
139
|
+
},
|
|
140
|
+
),
|
|
141
|
+
consume("stdout", process.stdout, stdoutOutput).catch(captureFailure),
|
|
142
|
+
consume("stderr", process.stderr, stderrOutput).catch(captureFailure),
|
|
143
|
+
]);
|
|
144
|
+
await Promise.race([completion, failure.then(() => delay(FAILURE_DRAIN_TIMEOUT_MS))]).finally(
|
|
145
|
+
clearInactivityTimer,
|
|
146
|
+
);
|
|
147
|
+
if (readers.size > 0) {
|
|
148
|
+
void Promise.allSettled([...readers].map((reader) => reader.cancel()));
|
|
149
|
+
}
|
|
150
|
+
const executionError = inactivityError ?? processError ?? streamError;
|
|
124
151
|
const outputs: Record<string, Uint8Array> = {};
|
|
125
152
|
for (const path of request.outputPaths ?? []) {
|
|
126
153
|
try {
|
|
@@ -130,7 +157,21 @@ export class ModalSandboxExecutor implements SandboxExecutor {
|
|
|
130
157
|
// absent output keeps the model or command failure diagnosable.
|
|
131
158
|
}
|
|
132
159
|
}
|
|
133
|
-
|
|
160
|
+
const result = {
|
|
161
|
+
sandboxId: sandbox.sandboxId,
|
|
162
|
+
exitCode: exitCode ?? 1,
|
|
163
|
+
stdout: stdoutOutput.text(),
|
|
164
|
+
stderr: stderrOutput.text(),
|
|
165
|
+
outputs,
|
|
166
|
+
};
|
|
167
|
+
if (executionError) {
|
|
168
|
+
throw new SandboxExecutionError(
|
|
169
|
+
`${executionError instanceof Error ? executionError.message : String(executionError)}; sandbox ${sandbox.sandboxId}`,
|
|
170
|
+
result,
|
|
171
|
+
{ cause: executionError },
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
134
175
|
} finally {
|
|
135
176
|
options.signal?.removeEventListener("abort", abort);
|
|
136
177
|
await sandbox.terminate().catch(() => undefined);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Command, Session } from "@vercel/sandbox";
|
|
2
|
-
import { InactivityTimeoutError, type RollingOutput } from "
|
|
3
|
-
import type { SandboxRequest, SandboxResult, SandboxRunOptions } from "
|
|
4
|
-
import { VercelCommandStartError } from "./
|
|
2
|
+
import { InactivityTimeoutError, type RollingOutput } from "../../../process.js";
|
|
3
|
+
import type { SandboxRequest, SandboxResult, SandboxRunOptions } from "../../contracts.js";
|
|
4
|
+
import { VercelCommandStartError } from "./fetch.js";
|
|
5
5
|
|
|
6
6
|
export const VERCEL_WORK_DIRECTORY = "/work";
|
|
7
7
|
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
isDigestPinnedOciImage,
|
|
6
6
|
type SelfBenchWorkerConfig,
|
|
7
7
|
type VercelCredentials,
|
|
8
|
-
} from "
|
|
9
|
-
import { RollingOutput } from "
|
|
8
|
+
} from "../../../config.js";
|
|
9
|
+
import { RollingOutput } from "../../../process.js";
|
|
10
10
|
import type {
|
|
11
11
|
SandboxExecutor,
|
|
12
12
|
SandboxRequest,
|
|
13
13
|
SandboxResult,
|
|
14
14
|
SandboxRunOptions,
|
|
15
|
-
} from "
|
|
16
|
-
import { executeVercelCommand, VERCEL_WORK_DIRECTORY } from "./
|
|
17
|
-
import { preventAmbiguousVercelCommandStartRetries } from "./
|
|
15
|
+
} from "../../contracts.js";
|
|
16
|
+
import { executeVercelCommand, VERCEL_WORK_DIRECTORY } from "./command.js";
|
|
17
|
+
import { preventAmbiguousVercelCommandStartRetries } from "./fetch.js";
|
|
18
18
|
|
|
19
19
|
const CLEANUP_TIMEOUT_MS = 60_000;
|
|
20
20
|
const CLEANUP_RETRY_DELAY_MS = 1_000;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { type CommandOutputHandler, type CommandResult, runCommand } from "
|
|
4
|
+
import { type CommandOutputHandler, type CommandResult, runCommand } from "../../process.js";
|
|
5
5
|
|
|
6
6
|
const MINIMUM_CLI_VERSION = [59, 1, 3] as const;
|
|
7
7
|
const PAGE_SIZE = "100";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { setTimeout as delay } from "node:timers/promises";
|
|
2
2
|
import { APIError, Sandbox } from "@vercel/sandbox";
|
|
3
|
-
import type { VercelCredentials } from "
|
|
4
|
-
import {
|
|
3
|
+
import type { VercelCredentials } from "../../config.js";
|
|
4
|
+
import {
|
|
5
|
+
HOBBY_VERCEL_TIMEOUT_CAP_MS,
|
|
6
|
+
STANDARD_VERCEL_TIMEOUT_CAP_MS,
|
|
7
|
+
} from "../../sandbox/timeout.js";
|
|
5
8
|
|
|
6
9
|
const PROBE_COMMAND_TIMEOUT_MS = 15_000;
|
|
7
10
|
const CLEANUP_TIMEOUT_MS = 60_000;
|
|
@@ -4,7 +4,10 @@ import { chmod, lstat, mkdir, readFile, rename, rm, writeFile } from "node:fs/pr
|
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { join, resolve } from "node:path";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
parseSandboxTimeoutCapText,
|
|
9
|
+
STANDARD_VERCEL_TIMEOUT_CAP_MS,
|
|
10
|
+
} from "../../sandbox/timeout.js";
|
|
8
11
|
|
|
9
12
|
const CONFIG_FILE = "config.json";
|
|
10
13
|
const CREDENTIALS_FILE = "credentials.json";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
-
import { sha256 } from "
|
|
4
|
-
import type { CommandOutputHandler } from "
|
|
5
|
-
import type { SetupPrompter } from "
|
|
6
|
-
import type { SetupReporter } from "
|
|
7
|
-
import type { VcrTag } from "./
|
|
3
|
+
import { sha256 } from "../../hash.js";
|
|
4
|
+
import type { CommandOutputHandler } from "../../process.js";
|
|
5
|
+
import type { SetupPrompter } from "../../terminal-prompts.js";
|
|
6
|
+
import type { SetupReporter } from "../../terminal-reporter.js";
|
|
7
|
+
import type { VcrTag } from "./cli.js";
|
|
8
8
|
|
|
9
9
|
export const DEFAULT_VCR_REPOSITORY = "selfbench-runtime";
|
|
10
10
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { dirname, resolve } from "node:path";
|
|
2
2
|
import { setTimeout as delay } from "node:timers/promises";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import type { VercelCredentials } from "
|
|
4
|
+
import type { VercelCredentials } from "../../config.js";
|
|
5
5
|
import {
|
|
6
6
|
isInteractiveTerminal,
|
|
7
7
|
SetupCanceledError,
|
|
8
8
|
type SetupPrompter,
|
|
9
9
|
TerminalPrompter,
|
|
10
|
-
} from "
|
|
11
|
-
import { type SetupReporter, TerminalSetupReporter } from "
|
|
12
|
-
import { VercelCli, type VercelProject, type VercelTeam } from "./
|
|
10
|
+
} from "../../terminal-prompts.js";
|
|
11
|
+
import { type SetupReporter, TerminalSetupReporter } from "../../terminal-reporter.js";
|
|
12
|
+
import { VercelCli, type VercelProject, type VercelTeam } from "./cli.js";
|
|
13
|
+
import { probeVercelCapability, type VercelCapability } from "./probe.js";
|
|
13
14
|
import {
|
|
14
15
|
loadVercelProfileData,
|
|
15
16
|
saveVercelProfile,
|
|
@@ -17,14 +18,13 @@ import {
|
|
|
17
18
|
type VercelProfile,
|
|
18
19
|
type VercelProfileData,
|
|
19
20
|
validateVercelProfileName,
|
|
20
|
-
} from "./
|
|
21
|
+
} from "./profile.js";
|
|
21
22
|
import {
|
|
22
23
|
DEFAULT_VCR_REPOSITORY,
|
|
23
24
|
ensureVercelRuntimeImage,
|
|
24
25
|
type VercelRuntimeImageCli,
|
|
25
26
|
vercelRuntimeFingerprint,
|
|
26
|
-
} from "./
|
|
27
|
-
import { probeVercelCapability, type VercelCapability } from "./vercel-setup-probe.js";
|
|
27
|
+
} from "./runtime-image.js";
|
|
28
28
|
|
|
29
29
|
const DEFAULT_PROFILE_NAME = "default";
|
|
30
30
|
const DEFAULT_PROJECT_NAME = "selfbench-sandbox";
|
|
@@ -402,7 +402,7 @@ function imageDigest(image: string): string {
|
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
function defaultProjectRoot(): string {
|
|
405
|
-
return resolve(dirname(fileURLToPath(import.meta.url)), "
|
|
405
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
function errorMessage(error: unknown): string {
|