withruntime 0.34.0 → 0.35.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/cli-words.js +1 -0
- package/dist/cli.js +9 -2
- package/dist/functions/index.d.ts +10 -0
- package/dist/functions/index.js +11 -0
- package/dist/products/functions.d.ts +2 -0
- package/dist/products/functions.js +5 -0
- package/dist/products/index.d.ts +2 -0
- package/dist/products/index.js +3 -0
- package/dist/transport.d.ts +1 -1
- package/dist/transport.js +1 -1
- package/dist/types.d.ts +15 -3
- package/package.json +6 -1
package/dist/cli-words.js
CHANGED
|
@@ -21,6 +21,7 @@ const OPTIONS = {
|
|
|
21
21
|
onLeaseEnd: { flag: "--on-timeout" },
|
|
22
22
|
idlePauseSeconds: { flag: "--idle-pause" },
|
|
23
23
|
autoWake: { flag: "--no-auto-wake / --auto-wake" },
|
|
24
|
+
user: { flag: "--user" },
|
|
24
25
|
persistent: { flag: "--persistent" },
|
|
25
26
|
funding: { flag: "--trial / --paid" },
|
|
26
27
|
image: { flag: "--image" },
|
package/dist/cli.js
CHANGED
|
@@ -168,6 +168,8 @@ const SANDBOX_HELP = `runtime sandboxes <command>
|
|
|
168
168
|
[--image <name:tag|imageId> | --snapshot <snapshotId>] [--volume <volumeId>:/data[:snapshot]]...
|
|
169
169
|
[--spread-from <id>]... [--secret NAME]... [--no-secrets]
|
|
170
170
|
[--idle-pause <seconds>] [--no-auto-wake] [--persistent] [--get-or-create]
|
|
171
|
+
[--user root|sandbox] --user root: its commands, processes and
|
|
172
|
+
shells run as root unless one says otherwise
|
|
171
173
|
Create one; prints its id
|
|
172
174
|
ls [--all] [--label k=v]... [--state running] List (live ones unless --all)
|
|
173
175
|
get <id> One sandbox, in full
|
|
@@ -202,7 +204,7 @@ const SANDBOX_HELP = `runtime sandboxes <command>
|
|
|
202
204
|
resize <id> --disk 20480 Grow a running sandbox's disk live, programs running
|
|
203
205
|
extend <id> <seconds> Move a time limit on (one with none needs nothing)
|
|
204
206
|
update <id> [--name n] [--label k=v]... [--env K[=V]]... [--unset-env K]... [--idle-pause <seconds>] [--auto-wake on|off]
|
|
205
|
-
[--persistent on|off] [--max-total-cost <usd>|none]
|
|
207
|
+
[--persistent on|off] [--max-total-cost <usd>|none] [--user root|sandbox]
|
|
206
208
|
[--timeout <60-86400 from now>|0] [--on-timeout pause|stop|delete]
|
|
207
209
|
Change its settings; persistent keeps it running until stopped;
|
|
208
210
|
--env K alone sends K's value from your own environment,
|
|
@@ -651,6 +653,7 @@ function describe(info) {
|
|
|
651
653
|
...(info.endedAt ? [["ended", info.endedAt]] : []),
|
|
652
654
|
...(info.stopReason ? [["stop reason", info.stopReason]] : []),
|
|
653
655
|
["auto wake", info.autoWake === false ? "off" : "on"],
|
|
656
|
+
["runs as", info.user === "root" ? "root" : "sandbox user"],
|
|
654
657
|
[
|
|
655
658
|
"idle pause",
|
|
656
659
|
info.idlePauseSeconds
|
|
@@ -2218,6 +2221,7 @@ async function sandbox(argv, env, out) {
|
|
|
2218
2221
|
"max-total-cost",
|
|
2219
2222
|
"timeout",
|
|
2220
2223
|
"on-timeout",
|
|
2224
|
+
"user",
|
|
2221
2225
|
]);
|
|
2222
2226
|
const sbx = await get(args.positional[0]);
|
|
2223
2227
|
const onOff = (name) => {
|
|
@@ -2247,6 +2251,7 @@ async function sandbox(argv, env, out) {
|
|
|
2247
2251
|
: {}),
|
|
2248
2252
|
...(onOff("auto-wake") === undefined ? {} : { autoWake: onOff("auto-wake") }),
|
|
2249
2253
|
...(onOff("persistent") === undefined ? {} : { persistent: onOff("persistent") }),
|
|
2254
|
+
...(flag(args, "user") ? { user: oneOf(args, "user", ["sandbox", "root"]) } : {}),
|
|
2250
2255
|
...(cost === undefined
|
|
2251
2256
|
? {}
|
|
2252
2257
|
: {
|
|
@@ -2258,7 +2263,7 @@ async function sandbox(argv, env, out) {
|
|
|
2258
2263
|
...(onTimeout === undefined ? {} : { onTimeout }),
|
|
2259
2264
|
};
|
|
2260
2265
|
if (!Object.keys(settings).length)
|
|
2261
|
-
throw usage("Say what to change: --name, --label, --env, --unset-env, --idle-pause, --auto-wake, --persistent, --max-total-cost, --timeout or --on-timeout.");
|
|
2266
|
+
throw usage("Say what to change: --name, --label, --env, --unset-env, --idle-pause, --auto-wake, --persistent, --user, --max-total-cost, --timeout or --on-timeout.");
|
|
2262
2267
|
await sbx.update(settings);
|
|
2263
2268
|
print(describe(sbx.info), sbx.info);
|
|
2264
2269
|
return 0;
|
|
@@ -4708,6 +4713,7 @@ const CREATE_VALUES = [
|
|
|
4708
4713
|
"secret",
|
|
4709
4714
|
"volume",
|
|
4710
4715
|
"env",
|
|
4716
|
+
"user",
|
|
4711
4717
|
];
|
|
4712
4718
|
/** Dollars from the command line as integer microdollars: 25, 2.50 or 0.000001. */
|
|
4713
4719
|
function usdMicros(args, name) {
|
|
@@ -4804,6 +4810,7 @@ function createInput(args, env) {
|
|
|
4804
4810
|
? { idlePauseSeconds: integer(args, "idle-pause") }
|
|
4805
4811
|
: {}),
|
|
4806
4812
|
...(has(args, "no-auto-wake") ? { autoWake: false } : {}),
|
|
4813
|
+
...(flag(args, "user") ? { user: oneOf(args, "user", ["sandbox", "root"]) } : {}),
|
|
4807
4814
|
...(has(args, "persistent") ? { persistent: true } : {}),
|
|
4808
4815
|
...(has(args, "get-or-create") ? { getOrCreate: true } : {}),
|
|
4809
4816
|
...(has(args, "trial")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `withruntime/functions`: Functions alone. An HTTP handler on copies that
|
|
2
|
+
* start when calls come and sleep a second after the last. In a private beta.
|
|
3
|
+
*
|
|
4
|
+
* import { functions } from "withruntime/functions";
|
|
5
|
+
* const client = functions(); // RUNTIME_API_KEY, or this machine's saved connection
|
|
6
|
+
*/
|
|
7
|
+
import { Runtime, type RuntimeOptions } from "../client.js";
|
|
8
|
+
export type * from "../products/functions.js";
|
|
9
|
+
/** `runtime.functions` of a client made with `options`. */
|
|
10
|
+
export declare function functions(options?: RuntimeOptions): Runtime["functions"];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** `withruntime/functions`: Functions alone. An HTTP handler on copies that
|
|
2
|
+
* start when calls come and sleep a second after the last. In a private beta.
|
|
3
|
+
*
|
|
4
|
+
* import { functions } from "withruntime/functions";
|
|
5
|
+
* const client = functions(); // RUNTIME_API_KEY, or this machine's saved connection
|
|
6
|
+
*/
|
|
7
|
+
import { Runtime } from "../client.js";
|
|
8
|
+
/** `runtime.functions` of a client made with `options`. */
|
|
9
|
+
export function functions(options) {
|
|
10
|
+
return new Runtime(options).functions;
|
|
11
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* runtime.functions: Apps whose copies all sleep when idle, on the same
|
|
2
|
+
* calls under /v1/functions (apps.ts holds both kinds). A private beta
|
|
3
|
+
* (PRODUCT_BETAS): an account outside it is refused with product_in_beta
|
|
4
|
+
* until Functions launches. */
|
|
5
|
+
export { functions } from "./apps.js";
|
package/dist/products/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ import { containers } from "./containers.js";
|
|
|
30
30
|
import { browsers } from "./browsers.js";
|
|
31
31
|
import { desktops } from "./desktops.js";
|
|
32
32
|
import { apps } from "./apps.js";
|
|
33
|
+
import { functions } from "./functions.js";
|
|
33
34
|
export declare const clientExtensions: {
|
|
34
35
|
images: typeof images;
|
|
35
36
|
volumes: typeof volumes;
|
|
@@ -59,6 +60,7 @@ export declare const clientExtensions: {
|
|
|
59
60
|
browsers: typeof browsers;
|
|
60
61
|
desktops: typeof desktops;
|
|
61
62
|
apps: typeof apps;
|
|
63
|
+
functions: typeof functions;
|
|
62
64
|
};
|
|
63
65
|
export declare const sandboxExtensions: {
|
|
64
66
|
interpreter: typeof sandboxInterpreter;
|
package/dist/products/index.js
CHANGED
|
@@ -32,6 +32,7 @@ import { desktops } from "./desktops.js";
|
|
|
32
32
|
// imports of files the hub loads, so importing them runs nothing in the hub
|
|
33
33
|
// (agents/hub-sdk-products.test.ts parses every product file the hub loads).
|
|
34
34
|
import { apps } from "./apps.js";
|
|
35
|
+
import { functions } from "./functions.js";
|
|
35
36
|
/* HOW A LANE ADDS A PRODUCT TO THE SDK
|
|
36
37
|
*
|
|
37
38
|
* 1. Write src/products/<name>.ts exporting a factory:
|
|
@@ -81,6 +82,8 @@ export const clientExtensions = {
|
|
|
81
82
|
// A private beta (PRODUCT_BETAS): an account outside it is refused with
|
|
82
83
|
// product_in_beta until Apps launches.
|
|
83
84
|
apps,
|
|
85
|
+
// The same until Functions launches.
|
|
86
|
+
functions,
|
|
84
87
|
};
|
|
85
88
|
export const sandboxExtensions = {
|
|
86
89
|
interpreter: sandboxInterpreter,
|
package/dist/transport.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RuntimeError } from "./errors.js";
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.35.0";
|
|
3
3
|
export declare const DEFAULT_BASE_URL = "https://api.withruntime.com";
|
|
4
4
|
/** Runtime's API as code inside a Runtime sandbox reaches it: the sandbox's
|
|
5
5
|
* own host sends each request on to DEFAULT_BASE_URL over HTTPS. The API runs
|
package/dist/transport.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConnectionError, DELIBERATE, errorFor, NOTHING_RAN, RuntimeError, WAITS_FOR_ROOM, } from "./errors.js";
|
|
2
2
|
import { describeRoute, envFetch, openWebSocket, untrustedCertificate } from "./proxy.js";
|
|
3
3
|
import { warningText } from "./product-renames.js";
|
|
4
|
-
export const VERSION = "0.
|
|
4
|
+
export const VERSION = "0.35.0";
|
|
5
5
|
export const DEFAULT_BASE_URL = "https://api.withruntime.com";
|
|
6
6
|
/** Runtime's API as code inside a Runtime sandbox reaches it: the sandbox's
|
|
7
7
|
* own host sends each request on to DEFAULT_BASE_URL over HTTPS. The API runs
|
package/dist/types.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ export type SandboxInfo = {
|
|
|
28
28
|
idlePauseUnusedOnly?: boolean;
|
|
29
29
|
/** A request (exec, files, terminal, a visit to a shared port) wakes it when paused. */
|
|
30
30
|
autoWake?: boolean;
|
|
31
|
+
/** Who its commands, processes and terminals run as when one names no
|
|
32
|
+
* user: "sandbox" (uid 1000) or "root". Absent from APIs before 25 October 2026. */
|
|
33
|
+
user?: "sandbox" | "root";
|
|
31
34
|
/** Runs until stopped while credit lasts, never paused for idleness or a
|
|
32
35
|
* time limit, and its disk is kept after a stop. */
|
|
33
36
|
persistent?: boolean;
|
|
@@ -139,6 +142,11 @@ export type CreateSandbox = {
|
|
|
139
142
|
idlePauseSeconds?: number;
|
|
140
143
|
/** A request to a paused sandbox wakes it. Default true. */
|
|
141
144
|
autoWake?: boolean;
|
|
145
|
+
/** "root": its commands, processes and terminals run as root, through the
|
|
146
|
+
* sandbox's passwordless sudo, unless one says `user: "sandbox"`. Default
|
|
147
|
+
* "sandbox"; a sandbox made from a snapshot runs as its source did. Files
|
|
148
|
+
* written through `files` stay the sandbox user's. */
|
|
149
|
+
user?: "sandbox" | "root";
|
|
142
150
|
/** Keep it running until you stop it, while credit lasts, with no idle
|
|
143
151
|
* pause unless idlePauseSeconds asks for one. Its disk is billed as any
|
|
144
152
|
* sandbox's, and kept after a stop, for restart(), as any sandbox's is.
|
|
@@ -224,9 +232,10 @@ export type CommandResult = {
|
|
|
224
232
|
};
|
|
225
233
|
export type ExecOptions = {
|
|
226
234
|
cwd?: string;
|
|
227
|
-
/** Who runs it: "sandbox" (
|
|
228
|
-
*
|
|
229
|
-
*
|
|
235
|
+
/** Who runs it: "sandbox" (uid 1000, HOME=/workspace) or "root", through
|
|
236
|
+
* the sandbox's passwordless sudo with the same environment and PATH and
|
|
237
|
+
* HOME=/root: no need to prefix it with sudo. Default: the sandbox's own
|
|
238
|
+
* `user`, the sandbox user unless it was made with "root". */
|
|
230
239
|
user?: "sandbox" | "root";
|
|
231
240
|
/** Merged over the sandbox's environment. Put secrets here, never in the command. */
|
|
232
241
|
env?: Record<string, string>;
|
|
@@ -487,6 +496,9 @@ export type SandboxSettings = {
|
|
|
487
496
|
env?: Record<string, string | null>;
|
|
488
497
|
/** A request to a paused sandbox wakes it. */
|
|
489
498
|
autoWake?: boolean;
|
|
499
|
+
/** Who later commands, processes and terminals run as when one names no
|
|
500
|
+
* user; running ones keep theirs. */
|
|
501
|
+
user?: "sandbox" | "root";
|
|
490
502
|
/** Pause after this many seconds with no activity, counted from now; 0
|
|
491
503
|
* never, otherwise 60 to 86400 (a shorter time is raised to 60). */
|
|
492
504
|
idlePauseSeconds?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "withruntime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"mcpName": "com.withruntime/runtime",
|
|
6
6
|
"type": "module",
|
|
@@ -91,6 +91,11 @@
|
|
|
91
91
|
"import": "./dist/apps/index.js",
|
|
92
92
|
"default": "./dist/apps/index.js"
|
|
93
93
|
},
|
|
94
|
+
"./functions": {
|
|
95
|
+
"types": "./dist/functions/index.d.ts",
|
|
96
|
+
"import": "./dist/functions/index.js",
|
|
97
|
+
"default": "./dist/functions/index.js"
|
|
98
|
+
},
|
|
94
99
|
"./e2b": {
|
|
95
100
|
"types": "./dist/e2b/index.d.ts",
|
|
96
101
|
"import": "./dist/e2b/index.js",
|