withruntime 0.11.2 → 0.12.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/BLAXEL.md +2 -2
- package/COMPATIBILITY.md +74 -9
- package/DAYTONA.md +33 -5
- package/E2B.md +85 -24
- package/README.md +9 -8
- package/README.src.md +8 -7
- package/VERCEL.md +43 -5
- package/compatibility-lock.json +58 -49
- package/dist/billing-cli.d.ts +1 -1
- package/dist/billing-cli.js +77 -1
- package/dist/blaxel/errors.d.ts +14 -0
- package/dist/blaxel/errors.js +29 -0
- package/dist/blaxel/index.d.ts +2 -2
- package/dist/blaxel/index.js +4 -4
- package/dist/blaxel/interpreter.d.ts +2 -5
- package/dist/blaxel/sandbox.d.ts +14 -5
- package/dist/blaxel/sandbox.js +63 -7
- package/dist/blaxel/snapshot.d.ts +4 -0
- package/dist/blaxel/snapshot.js +4 -0
- package/dist/cli/logs.d.ts +21 -0
- package/dist/cli/logs.js +188 -0
- package/dist/cli/logs.test.d.ts +1 -0
- package/dist/cli/logs.test.js +272 -0
- package/dist/cli-extras.d.ts +3 -3
- package/dist/cli-extras.js +17 -12
- package/dist/cli-words.d.ts +10 -1
- package/dist/cli-words.js +18 -0
- package/dist/cli.d.ts +5 -1
- package/dist/cli.js +405 -204
- package/dist/client.d.ts +2 -4
- package/dist/client.js +27 -11
- package/dist/cloudflare/errors.d.ts +143 -0
- package/dist/cloudflare/errors.js +167 -0
- package/dist/cloudflare/index.d.ts +175 -6
- package/dist/cloudflare/index.js +416 -26
- package/dist/cloudflare/interpreter.d.ts +119 -0
- package/dist/cloudflare/interpreter.js +223 -0
- package/dist/cloudflare/streams.d.ts +38 -0
- package/dist/cloudflare/streams.js +145 -0
- package/dist/cloudflare/watch.d.ts +9 -0
- package/dist/cloudflare/watch.js +24 -0
- package/dist/codesandbox/index.d.ts +216 -28
- package/dist/codesandbox/index.js +478 -78
- package/dist/compat/core.d.ts +18 -0
- package/dist/compat/core.js +29 -0
- package/dist/compat/files.d.ts +1 -0
- package/dist/compat/files.js +25 -5
- package/dist/daytona/computer-use.d.ts +13 -4
- package/dist/daytona/computer-use.js +66 -8
- package/dist/daytona/daytona.d.ts +6 -0
- package/dist/daytona/daytona.js +30 -3
- package/dist/daytona/errors.d.ts +11 -0
- package/dist/daytona/errors.js +18 -0
- package/dist/daytona/filesystem.js +2 -1
- package/dist/daytona/image.d.ts +13 -9
- package/dist/daytona/image.js +18 -12
- package/dist/daytona/index.d.ts +1 -1
- package/dist/daytona/sandbox.d.ts +8 -2
- package/dist/daytona/sandbox.js +16 -2
- package/dist/domains/index.d.ts +9 -0
- package/dist/domains/index.js +10 -0
- package/dist/e2b/commands.d.ts +1 -1
- package/dist/e2b/commands.js +6 -7
- package/dist/e2b/errors.d.ts +17 -0
- package/dist/e2b/errors.js +40 -1
- package/dist/e2b/index.d.ts +2 -2
- package/dist/e2b/index.js +1 -1
- package/dist/e2b/sandbox.d.ts +27 -21
- package/dist/e2b/sandbox.js +34 -8
- package/dist/e2b/unsupported.js +1 -1
- package/dist/errors.d.ts +10 -1
- package/dist/errors.js +16 -4
- package/dist/freestyle/index.d.ts +285 -37
- package/dist/freestyle/index.js +656 -144
- package/dist/identity.d.ts +3 -0
- package/dist/identity.js +27 -0
- package/dist/images/index.d.ts +9 -0
- package/dist/images/index.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/ips/index.d.ts +9 -0
- package/dist/ips/index.js +10 -0
- package/dist/jobs/index.d.ts +9 -0
- package/dist/jobs/index.js +10 -0
- package/dist/keys.js +2 -0
- package/dist/login.js +2 -0
- package/dist/machine.d.ts +12 -3
- package/dist/machine.js +20 -3
- package/dist/mcp.js +1 -1
- package/dist/modal/index.d.ts +339 -61
- package/dist/modal/index.js +781 -121
- package/dist/network-cli.d.ts +3 -1
- package/dist/network-cli.js +78 -36
- package/dist/networks/index.d.ts +11 -0
- package/dist/networks/index.js +10 -0
- package/dist/ports/index.d.ts +9 -0
- package/dist/ports/index.js +10 -0
- package/dist/product-names.d.ts +52 -0
- package/dist/product-names.js +164 -0
- package/dist/product-renames.d.ts +103 -0
- package/dist/product-renames.js +189 -0
- package/dist/products/apps.d.ts +176 -0
- package/dist/products/apps.js +165 -0
- package/dist/products/billing.d.ts +41 -0
- package/dist/products/billing.js +13 -0
- package/dist/products/browser.d.ts +10 -0
- package/dist/products/browsers.d.ts +71 -0
- package/dist/products/browsers.js +102 -0
- package/dist/products/builds.d.ts +126 -0
- package/dist/products/builds.js +221 -0
- package/dist/products/index.d.ts +3 -16
- package/dist/products/index.js +3 -14
- package/dist/products/jobs.d.ts +17 -0
- package/dist/products/jobs.js +27 -10
- package/dist/products/logs.d.ts +245 -0
- package/dist/products/logs.js +274 -0
- package/dist/products/logs.test.d.ts +1 -0
- package/dist/products/logs.test.js +343 -0
- package/dist/products/network-products.d.ts +38 -7
- package/dist/products/network-products.js +31 -18
- package/dist/products/observability.d.ts +3 -2
- package/dist/products/private-network.js +1 -1
- package/dist/products/queues.d.ts +149 -0
- package/dist/products/queues.js +213 -0
- package/dist/products/referrals.d.ts +21 -7
- package/dist/products/referrals.js +3 -3
- package/dist/products/secrets.d.ts +7 -3
- package/dist/products/secrets.js +39 -18
- package/dist/products/signed-requests.d.ts +21 -0
- package/dist/products/signed-requests.js +11 -0
- package/dist/products/streams.d.ts +73 -0
- package/dist/products/streams.js +17 -0
- package/dist/products/switching.d.ts +35 -7
- package/dist/products/switching.js +4 -3
- package/dist/products/volumes.d.ts +3 -0
- package/dist/record-cli.d.ts +23 -0
- package/dist/record-cli.js +308 -0
- package/dist/renamed-products.d.ts +38 -0
- package/dist/renamed-products.js +34 -0
- package/dist/runloop/index.d.ts +9 -2
- package/dist/runloop/index.js +29 -8
- package/dist/runloop/sdk.d.ts +131 -0
- package/dist/runloop/sdk.js +167 -0
- package/dist/sandbox.d.ts +3 -2
- package/dist/sandbox.js +14 -9
- package/dist/sandboxes/index.d.ts +11 -0
- package/dist/sandboxes/index.js +12 -0
- package/dist/snapshots/index.d.ts +9 -0
- package/dist/snapshots/index.js +11 -0
- package/dist/snapshots.d.ts +7 -4
- package/dist/sprites/index.d.ts +343 -31
- package/dist/sprites/index.js +866 -84
- package/dist/ssh.d.ts +1 -1
- package/dist/ssh.js +11 -11
- package/dist/terminal.d.ts +24 -0
- package/dist/terminal.js +32 -0
- package/dist/transport.d.ts +15 -1
- package/dist/transport.js +56 -3
- package/dist/tunnel.js +1 -1
- package/dist/types.d.ts +63 -0
- package/dist/vercel/sandbox.js +5 -3
- package/dist/vercel/snapshot.js +10 -2
- package/dist/volumes/index.d.ts +9 -0
- package/dist/volumes/index.js +10 -0
- package/package.json +48 -2
package/dist/identity.d.ts
CHANGED
|
@@ -25,3 +25,6 @@ export declare function identityToken(input: {
|
|
|
25
25
|
lifetimeSeconds?: number;
|
|
26
26
|
signal?: AbortSignal;
|
|
27
27
|
}): Promise<IdentityToken>;
|
|
28
|
+
/** Headers for a call to the website's connect API: this sandbox's identity
|
|
29
|
+
* token, or none outside a sandbox or when one cannot be had. Never throws. */
|
|
30
|
+
export declare function sandboxIdentityHeaders(): Promise<Record<string, string>>;
|
package/dist/identity.js
CHANGED
|
@@ -55,3 +55,30 @@ export async function identityToken(input) {
|
|
|
55
55
|
});
|
|
56
56
|
return body;
|
|
57
57
|
}
|
|
58
|
+
/** The header and audience the website keys its per-network limits on
|
|
59
|
+
* (apps/cloud-web/src/lib/limit-key.ts): inside a sandbox, Runtime's own
|
|
60
|
+
* sign-in calls count against this sandbox, not the address every sandbox on
|
|
61
|
+
* its host shares. */
|
|
62
|
+
const LIMIT_HEADER = "x-runtime-sandbox-identity";
|
|
63
|
+
const LIMIT_AUDIENCE = "https://withruntime.com/limits";
|
|
64
|
+
let limitToken;
|
|
65
|
+
/** Headers for a call to the website's connect API: this sandbox's identity
|
|
66
|
+
* token, or none outside a sandbox or when one cannot be had. Never throws. */
|
|
67
|
+
export async function sandboxIdentityHeaders() {
|
|
68
|
+
if (limitToken && Date.now() < limitToken.until)
|
|
69
|
+
return { [LIMIT_HEADER]: limitToken.token };
|
|
70
|
+
if (!(await requestCredentials()))
|
|
71
|
+
return {};
|
|
72
|
+
try {
|
|
73
|
+
const issued = await identityToken({
|
|
74
|
+
audience: LIMIT_AUDIENCE,
|
|
75
|
+
signal: AbortSignal.timeout(3_000),
|
|
76
|
+
});
|
|
77
|
+
// Renewed a minute before it lapses, so a slow call never carries a dead one.
|
|
78
|
+
limitToken = { token: issued.token, until: Date.parse(issued.expiresAt) - 60_000 };
|
|
79
|
+
return { [LIMIT_HEADER]: issued.token };
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** `withruntime/images`: Images alone. Custom images to start sandboxes from.
|
|
2
|
+
*
|
|
3
|
+
* import { images } from "withruntime/images";
|
|
4
|
+
* const client = images(); // RUNTIME_API_KEY, or this machine's saved connection
|
|
5
|
+
*/
|
|
6
|
+
import { Runtime, type RuntimeOptions } from "../client.js";
|
|
7
|
+
export type * from "../products/images.js";
|
|
8
|
+
/** `runtime.images` of a client made with `options`. */
|
|
9
|
+
export declare function images(options?: RuntimeOptions): Runtime["images"];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `withruntime/images`: Images alone. Custom images to start sandboxes from.
|
|
2
|
+
*
|
|
3
|
+
* import { images } from "withruntime/images";
|
|
4
|
+
* const client = images(); // RUNTIME_API_KEY, or this machine's saved connection
|
|
5
|
+
*/
|
|
6
|
+
import { Runtime } from "../client.js";
|
|
7
|
+
/** `runtime.images` of a client made with `options`. */
|
|
8
|
+
export function images(options) {
|
|
9
|
+
return new Runtime(options).images;
|
|
10
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export type { Volume, VolumeBackup, CreateVolume, VolumeAttachment } from "./pro
|
|
|
26
26
|
export type { CreateJob, Job, JobCompute, JobDefinition, JobLogs, JobRun, JobRunState, JobSchedule, } from "./products/jobs.js";
|
|
27
27
|
export type { CheckedDomain, DnsRecord, Domain, EgressAddress, TcpPort, Tunnel as PrivateTunnel, TunnelPeer, TunnelPeerCreated, SetUpstreamProxy, UpstreamProxy, } from "./products/network-products.js";
|
|
28
28
|
export type { PrivateNetwork } from "./products/private-network.js";
|
|
29
|
+
export type { SignedRequests } from "./products/signed-requests.js";
|
|
29
30
|
export { verifyWebhook, WebhookVerificationError, type MetricPoint, type MetricRange, type OtelExport, type RuntimeEvent, type SandboxMetrics, type Webhook, type WebhookDelivery, type WebhookEventType, } from "./products/observability.js";
|
|
30
31
|
export { Snapshots, type Snapshot, type SnapshotOptions } from "./snapshots.js";
|
|
31
32
|
export { Transport, VERSION, apiOrigin, type RequestOptions, type Call } from "./transport.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** `withruntime/ips`: IPs alone. Dedicated outbound addresses every sandbox of the account sends from.
|
|
2
|
+
*
|
|
3
|
+
* import { ips } from "withruntime/ips";
|
|
4
|
+
* const client = ips(); // RUNTIME_API_KEY, or this machine's saved connection
|
|
5
|
+
*/
|
|
6
|
+
import { Runtime, type RuntimeOptions } from "../client.js";
|
|
7
|
+
export type { EgressAddress, NetworkFunding } from "../products/network-products.js";
|
|
8
|
+
/** `runtime.ips` of a client made with `options`. */
|
|
9
|
+
export declare function ips(options?: RuntimeOptions): Runtime["ips"];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `withruntime/ips`: IPs alone. Dedicated outbound addresses every sandbox of the account sends from.
|
|
2
|
+
*
|
|
3
|
+
* import { ips } from "withruntime/ips";
|
|
4
|
+
* const client = ips(); // RUNTIME_API_KEY, or this machine's saved connection
|
|
5
|
+
*/
|
|
6
|
+
import { Runtime } from "../client.js";
|
|
7
|
+
/** `runtime.ips` of a client made with `options`. */
|
|
8
|
+
export function ips(options) {
|
|
9
|
+
return new Runtime(options).ips;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** `withruntime/jobs`: Jobs alone. A command in a fresh sandbox, once or on a schedule.
|
|
2
|
+
*
|
|
3
|
+
* import { jobs } from "withruntime/jobs";
|
|
4
|
+
* const client = jobs(); // RUNTIME_API_KEY, or this machine's saved connection
|
|
5
|
+
*/
|
|
6
|
+
import { Runtime, type RuntimeOptions } from "../client.js";
|
|
7
|
+
export type * from "../products/jobs.js";
|
|
8
|
+
/** `runtime.jobs` of a client made with `options`. */
|
|
9
|
+
export declare function jobs(options?: RuntimeOptions): Runtime["jobs"];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `withruntime/jobs`: Jobs alone. A command in a fresh sandbox, once or on a schedule.
|
|
2
|
+
*
|
|
3
|
+
* import { jobs } from "withruntime/jobs";
|
|
4
|
+
* const client = jobs(); // RUNTIME_API_KEY, or this machine's saved connection
|
|
5
|
+
*/
|
|
6
|
+
import { Runtime } from "../client.js";
|
|
7
|
+
/** `runtime.jobs` of a client made with `options`. */
|
|
8
|
+
export function jobs(options) {
|
|
9
|
+
return new Runtime(options).jobs;
|
|
10
|
+
}
|
package/dist/keys.js
CHANGED
|
@@ -5,6 +5,7 @@ import { promisify } from "node:util";
|
|
|
5
5
|
import { connectionOrigins } from "./credentials.js";
|
|
6
6
|
import { RuntimeError } from "./errors.js";
|
|
7
7
|
import { named } from "./cli-name.js";
|
|
8
|
+
import { sandboxIdentityHeaders } from "./identity.js";
|
|
8
9
|
import { describeRoute, envFetch } from "./proxy.js";
|
|
9
10
|
const KEY = /^rtcloud_([a-f0-9-]{36})_[A-Za-z0-9_-]{43}$/;
|
|
10
11
|
/** How often to ask whether the owner has answered. The website answers
|
|
@@ -79,6 +80,7 @@ export async function createKey(request, env, options = {}) {
|
|
|
79
80
|
headers: {
|
|
80
81
|
"content-type": "application/json",
|
|
81
82
|
...(key ? { authorization: `Bearer ${key}` } : {}),
|
|
83
|
+
...(await sandboxIdentityHeaders()),
|
|
82
84
|
},
|
|
83
85
|
body: JSON.stringify(body),
|
|
84
86
|
});
|
package/dist/login.js
CHANGED
|
@@ -5,6 +5,7 @@ import { promisify } from "node:util";
|
|
|
5
5
|
import { me, named } from "./cli-name.js";
|
|
6
6
|
import { Runtime } from "./client.js";
|
|
7
7
|
import { checkBrowserOrigins, connectionOrigins, connectionStore } from "./credentials.js";
|
|
8
|
+
import { sandboxIdentityHeaders } from "./identity.js";
|
|
8
9
|
import { describeRoute, envFetch } from "./proxy.js";
|
|
9
10
|
class ConnectionError extends Error {
|
|
10
11
|
status;
|
|
@@ -80,6 +81,7 @@ function connection(env, options) {
|
|
|
80
81
|
headers: {
|
|
81
82
|
"content-type": "application/json",
|
|
82
83
|
...(key ? { authorization: `Bearer ${key}` } : {}),
|
|
84
|
+
...(await sandboxIdentityHeaders()),
|
|
83
85
|
},
|
|
84
86
|
body: JSON.stringify(body ?? {}),
|
|
85
87
|
});
|
package/dist/machine.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export type MachineInfo = {
|
|
|
17
17
|
expiresAt: string;
|
|
18
18
|
endsAt?: string | null;
|
|
19
19
|
start?: unknown;
|
|
20
|
+
/** True when getOrCreate found the name already held. */
|
|
21
|
+
reused?: boolean;
|
|
22
|
+
/** True when the answer repeats an earlier call under the same idempotency key. */
|
|
23
|
+
replayed?: boolean;
|
|
20
24
|
};
|
|
21
25
|
/** Any other call's request options, as the caller gave them: `timeoutMs` is
|
|
22
26
|
* the call's whole deadline, and 0 turns it off. */
|
|
@@ -29,7 +33,6 @@ export declare function machinePage<M, Info>(product: MachineProduct, t: Transpo
|
|
|
29
33
|
data: Info[];
|
|
30
34
|
nextCursor: string | null;
|
|
31
35
|
}, query: Record<string, unknown>, options?: RequestOptions): Page<M>;
|
|
32
|
-
/** One machine: its record and the verbs every machine product shares. */
|
|
33
36
|
export declare abstract class Machine<Info extends MachineInfo, Settings extends object, Deleted> implements AsyncDisposable {
|
|
34
37
|
#private;
|
|
35
38
|
constructor(product: MachineProduct, transport: Transport, info: Info);
|
|
@@ -104,8 +107,9 @@ export declare abstract class Machine<Info extends MachineInfo, Settings extends
|
|
|
104
107
|
* unless autoWake is off); a stopped one ends the loop. It does not keep a
|
|
105
108
|
* Node or Bun process alive by itself. */
|
|
106
109
|
keepAlive(options?: KeepAliveOptions): () => void;
|
|
107
|
-
/** Days a paused sandbox is kept before deletion (1 to 365)
|
|
108
|
-
|
|
110
|
+
/** Days a paused sandbox is kept before deletion (1 to 365), or `null` to
|
|
111
|
+
* keep it while your account has credit. */
|
|
112
|
+
setRetention(days: number | null, options?: RequestOptions): Promise<this>;
|
|
109
113
|
/** Keeps this sandbox's whole machine (files, memory, running processes) as
|
|
110
114
|
* a snapshot to start new sandboxes from. A running sandbox is paused for
|
|
111
115
|
* the moment it takes, then woken; a paused one stays paused. Past
|
|
@@ -116,6 +120,10 @@ export declare abstract class Machine<Info extends MachineInfo, Settings extends
|
|
|
116
120
|
restart(options?: RequestOptions & {
|
|
117
121
|
wait?: boolean;
|
|
118
122
|
}): Promise<this>;
|
|
123
|
+
/** The end of an `await using` block. A sandbox this client created is
|
|
124
|
+
* deleted, as E2B's block kills it, unless it was created with
|
|
125
|
+
* `keep: true`; one it found with `get` or `getOrCreate` is stopped, which
|
|
126
|
+
* keeps its disk. */
|
|
119
127
|
[Symbol.asyncDispose](): Promise<void>;
|
|
120
128
|
toJSON(): Info;
|
|
121
129
|
}
|
|
@@ -133,6 +141,7 @@ export type CreateOptions = RequestOptions & {
|
|
|
133
141
|
export declare abstract class Machines<M extends Machine<Info, object, Deleted>, Info extends MachineInfo, Create extends {
|
|
134
142
|
name?: string;
|
|
135
143
|
getOrCreate?: boolean;
|
|
144
|
+
keep?: boolean;
|
|
136
145
|
}, Deleted> {
|
|
137
146
|
#private;
|
|
138
147
|
constructor(product: MachineProduct, t: Transport, wrap: (t: Transport, info: Info) => M);
|
package/dist/machine.js
CHANGED
|
@@ -40,6 +40,10 @@ export function machinePage(product, t, wrap, body, query, options = {}) {
|
|
|
40
40
|
}), query, options));
|
|
41
41
|
}
|
|
42
42
|
/** One machine: its record and the verbs every machine product shares. */
|
|
43
|
+
/** Machines `create` made, which the end of an `await using` block deletes
|
|
44
|
+
* (Marc, 6 October 2026: deleted unless the code passes `keep: true`). One
|
|
45
|
+
* from `get`, or an existing one `getOrCreate` found, is only stopped. */
|
|
46
|
+
const deleteAtBlockEnd = new WeakSet();
|
|
43
47
|
export class Machine {
|
|
44
48
|
#info;
|
|
45
49
|
#keepAlive;
|
|
@@ -227,7 +231,8 @@ export class Machine {
|
|
|
227
231
|
void tick();
|
|
228
232
|
return end;
|
|
229
233
|
}
|
|
230
|
-
/** Days a paused sandbox is kept before deletion (1 to 365)
|
|
234
|
+
/** Days a paused sandbox is kept before deletion (1 to 365), or `null` to
|
|
235
|
+
* keep it while your account has credit. */
|
|
231
236
|
async setRetention(days, options = {}) {
|
|
232
237
|
return this.#lifecycle("retention", { ...options, wait: false }, { days });
|
|
233
238
|
}
|
|
@@ -374,8 +379,16 @@ export class Machine {
|
|
|
374
379
|
}));
|
|
375
380
|
return this;
|
|
376
381
|
}
|
|
382
|
+
/** The end of an `await using` block. A sandbox this client created is
|
|
383
|
+
* deleted, as E2B's block kills it, unless it was created with
|
|
384
|
+
* `keep: true`; one it found with `get` or `getOrCreate` is stopped, which
|
|
385
|
+
* keeps its disk. */
|
|
377
386
|
async [Symbol.asyncDispose]() {
|
|
378
387
|
this.#keepAlive?.();
|
|
388
|
+
if (deleteAtBlockEnd.has(this)) {
|
|
389
|
+
await this.delete().catch(() => undefined);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
379
392
|
if (this.#info.state === "stopped")
|
|
380
393
|
return;
|
|
381
394
|
await this.stop({ wait: false }).catch(() => undefined);
|
|
@@ -400,7 +413,7 @@ export class Machines {
|
|
|
400
413
|
* When every slot without credit or the account's quota is taken, it waits for one to
|
|
401
414
|
* free, up to `waitForCapacityMs` (the client's, two minutes by default). */
|
|
402
415
|
async create(input = {}, options = {}) {
|
|
403
|
-
const { wait, ...body } = input;
|
|
416
|
+
const { wait, keep, ...body } = input;
|
|
404
417
|
const began = performance.now();
|
|
405
418
|
// Time spent waiting for capacity is the room's, not the deadline's.
|
|
406
419
|
let waited = 0;
|
|
@@ -417,6 +430,8 @@ export class Machines {
|
|
|
417
430
|
},
|
|
418
431
|
});
|
|
419
432
|
const machine = this.#wrap(this.#t, info);
|
|
433
|
+
if (!keep && !info.reused)
|
|
434
|
+
deleteAtBlockEnd.add(machine);
|
|
420
435
|
if (wait !== false && info.state !== "running") {
|
|
421
436
|
// One deadline for the whole create: the wait for running gets what the
|
|
422
437
|
// create left of it (1 ms when nothing is left, so it ends as a timeout).
|
|
@@ -431,7 +446,9 @@ export class Machines {
|
|
|
431
446
|
});
|
|
432
447
|
if (machine.state !== "running")
|
|
433
448
|
throw new RuntimeError({
|
|
434
|
-
message:
|
|
449
|
+
message: info.replayed
|
|
450
|
+
? `${this.#product.noun} ${info.id} was made by an earlier call with this idempotency key and is ${machine.state} now. It did not fail to start; create again with a new key.`
|
|
451
|
+
: `${this.#product.noun} ${info.id} is ${machine.state}, not running.`,
|
|
435
452
|
code: "start_failed",
|
|
436
453
|
status: 0,
|
|
437
454
|
hint: `Read it with runtime.${this.#product.plural}.get(id); stopReason says why.`,
|
package/dist/mcp.js
CHANGED
|
@@ -163,7 +163,7 @@ export async function serveMcp(env = process.env, options = {}) {
|
|
|
163
163
|
}));
|
|
164
164
|
await post(JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }));
|
|
165
165
|
write({ jsonrpc: "2.0", method: "notifications/tools/list_changed" });
|
|
166
|
-
return text(`Connected as ${outcome.agentName}. Runtime's tools are available now: list the tools again, then start with
|
|
166
|
+
return text(`Connected as ${outcome.agentName}. Runtime's tools are available now: list the tools again, then start with runtime_sandboxes_create.`);
|
|
167
167
|
}
|
|
168
168
|
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
169
169
|
}
|