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/sprites/index.d.ts
CHANGED
|
@@ -2,8 +2,173 @@ import { EventEmitter } from "node:events";
|
|
|
2
2
|
import { PassThrough, Writable } from "node:stream";
|
|
3
3
|
import type { Runtime } from "../client.js";
|
|
4
4
|
import type { Sandbox } from "../sandbox.js";
|
|
5
|
-
import { CompatibilityError, type ClientOptions as RuntimeClientOptions } from "../compat/core.js";
|
|
5
|
+
import { CompatibilityError, type ClientOptions as RuntimeClientOptions, type Refused, type RefusedAsync } from "../compat/core.js";
|
|
6
6
|
export { CompatibilityError };
|
|
7
|
+
export declare const ERR_CODE_CREATION_RATE_LIMITED = "sprite_creation_rate_limited";
|
|
8
|
+
export declare const ERR_CODE_CONCURRENT_LIMIT_EXCEEDED = "concurrent_sprite_limit_exceeded";
|
|
9
|
+
export interface URLSettings {
|
|
10
|
+
auth?: string;
|
|
11
|
+
privateAccess?: "admins" | "org_users";
|
|
12
|
+
}
|
|
13
|
+
export interface Checkpoint {
|
|
14
|
+
id: string;
|
|
15
|
+
createTime: Date;
|
|
16
|
+
comment?: string;
|
|
17
|
+
history?: string[];
|
|
18
|
+
isAuto?: boolean;
|
|
19
|
+
sourceId?: string;
|
|
20
|
+
health?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface StreamMessage {
|
|
23
|
+
type: "info" | "stdout" | "stderr" | "error" | "complete";
|
|
24
|
+
data?: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PortMapping {
|
|
28
|
+
localPort: number;
|
|
29
|
+
remotePort: number;
|
|
30
|
+
remoteHost?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface PolicyRule {
|
|
33
|
+
domain?: string;
|
|
34
|
+
action?: "allow" | "deny";
|
|
35
|
+
include?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface NetworkPolicy {
|
|
38
|
+
rules: PolicyRule[];
|
|
39
|
+
}
|
|
40
|
+
export interface PrivilegesPolicy {
|
|
41
|
+
profile?: "" | "minimal" | "standard" | "privileged";
|
|
42
|
+
devices?: string[];
|
|
43
|
+
noNewPrivileges?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface ResourcesPolicy {
|
|
46
|
+
memory?: {
|
|
47
|
+
limitMB: number;
|
|
48
|
+
autoscale?: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface ServiceRequest {
|
|
52
|
+
cmd: string;
|
|
53
|
+
args?: string[];
|
|
54
|
+
env?: Record<string, string>;
|
|
55
|
+
dir?: string;
|
|
56
|
+
needs?: string[];
|
|
57
|
+
httpPort?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface ServiceLogEvent {
|
|
60
|
+
type: "stdout" | "stderr" | "exit" | "error" | "complete" | "started" | "stopping" | "stopped";
|
|
61
|
+
data?: string;
|
|
62
|
+
exitCode?: number;
|
|
63
|
+
timestamp: number;
|
|
64
|
+
logFiles?: Record<string, string>;
|
|
65
|
+
}
|
|
66
|
+
export interface SessionKillEvent {
|
|
67
|
+
type: "signal" | "timeout" | "exited" | "killed" | "error" | "complete";
|
|
68
|
+
message?: string;
|
|
69
|
+
signal?: string;
|
|
70
|
+
pid?: number;
|
|
71
|
+
exitCode?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface SpriteCheck {
|
|
74
|
+
spriteName: string;
|
|
75
|
+
spriteId: string;
|
|
76
|
+
status: string;
|
|
77
|
+
reason?: string;
|
|
78
|
+
checkedAt: Date;
|
|
79
|
+
elapsed?: number;
|
|
80
|
+
}
|
|
81
|
+
export interface SpriteStateEvent {
|
|
82
|
+
type?: "heartbeat";
|
|
83
|
+
name?: string;
|
|
84
|
+
status?: string;
|
|
85
|
+
organization: {
|
|
86
|
+
running: number;
|
|
87
|
+
warm: number;
|
|
88
|
+
cold: number;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export interface PortNotification {
|
|
92
|
+
type: "port_opened" | "port_closed";
|
|
93
|
+
port: number;
|
|
94
|
+
address: string;
|
|
95
|
+
pid: number;
|
|
96
|
+
}
|
|
97
|
+
export interface PortList {
|
|
98
|
+
type: "port_list";
|
|
99
|
+
ports: PortNotification[];
|
|
100
|
+
}
|
|
101
|
+
export type PortWatchEvent = PortList | PortNotification;
|
|
102
|
+
export interface FilesystemWatchEvent {
|
|
103
|
+
type: "subscribed" | "event" | "error";
|
|
104
|
+
paths?: string[];
|
|
105
|
+
path?: string;
|
|
106
|
+
event?: "write" | "create" | "remove" | "rename" | "chmod";
|
|
107
|
+
timestamp?: string;
|
|
108
|
+
size?: number;
|
|
109
|
+
isDir?: boolean;
|
|
110
|
+
message?: string;
|
|
111
|
+
}
|
|
112
|
+
/** A Sprites progress or event stream: the work behind it runs whether or
|
|
113
|
+
* not anyone reads, as the vendor's server-side operation does; `next()`
|
|
114
|
+
* answers null at the end, `close()` stops reading (and stops a watch). */
|
|
115
|
+
declare class Feed<T> {
|
|
116
|
+
#private;
|
|
117
|
+
constructor(source?: AsyncIterable<T>);
|
|
118
|
+
protected push(item: T): void;
|
|
119
|
+
protected end(error?: unknown): void;
|
|
120
|
+
/** Called once by close(); a watch stops its native watch here. */
|
|
121
|
+
protected stop(): void;
|
|
122
|
+
next(): Promise<T | null>;
|
|
123
|
+
processAll(handler: (item: T) => void | Promise<void>): Promise<void>;
|
|
124
|
+
close(): void;
|
|
125
|
+
isClosed(): boolean;
|
|
126
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
|
127
|
+
}
|
|
128
|
+
export declare class CheckpointStream extends Feed<StreamMessage> {
|
|
129
|
+
}
|
|
130
|
+
export declare class RestoreStream extends Feed<StreamMessage> {
|
|
131
|
+
}
|
|
132
|
+
export declare class ServiceLogStream extends Feed<ServiceLogEvent> {
|
|
133
|
+
}
|
|
134
|
+
export declare class SessionKillStream extends Feed<SessionKillEvent> {
|
|
135
|
+
}
|
|
136
|
+
export declare class SpriteListStream extends Feed<SpriteStateEvent> {
|
|
137
|
+
}
|
|
138
|
+
export declare class APIError extends Error {
|
|
139
|
+
readonly errorCode?: string;
|
|
140
|
+
readonly statusCode?: number;
|
|
141
|
+
readonly limit?: number;
|
|
142
|
+
readonly windowSeconds?: number;
|
|
143
|
+
readonly retryAfterSeconds?: number;
|
|
144
|
+
readonly currentCount?: number;
|
|
145
|
+
readonly upgradeAvailable?: boolean;
|
|
146
|
+
readonly upgradeUrl?: string;
|
|
147
|
+
readonly retryAfterHeader?: number;
|
|
148
|
+
readonly rateLimitLimit?: number;
|
|
149
|
+
readonly rateLimitRemaining?: number;
|
|
150
|
+
readonly rateLimitReset?: number;
|
|
151
|
+
constructor(message: string, options?: {
|
|
152
|
+
errorCode?: string;
|
|
153
|
+
statusCode?: number;
|
|
154
|
+
limit?: number;
|
|
155
|
+
windowSeconds?: number;
|
|
156
|
+
retryAfterSeconds?: number;
|
|
157
|
+
currentCount?: number;
|
|
158
|
+
upgradeAvailable?: boolean;
|
|
159
|
+
upgradeUrl?: string;
|
|
160
|
+
retryAfterHeader?: number;
|
|
161
|
+
rateLimitLimit?: number;
|
|
162
|
+
rateLimitRemaining?: number;
|
|
163
|
+
rateLimitReset?: number;
|
|
164
|
+
});
|
|
165
|
+
isRateLimitError(): boolean;
|
|
166
|
+
isCreationRateLimited(): boolean;
|
|
167
|
+
isConcurrentLimitExceeded(): boolean;
|
|
168
|
+
getRetryAfterSeconds(): number | undefined;
|
|
169
|
+
}
|
|
170
|
+
/** The vendor's parser, for callers that read Sprites-shaped answers themselves. */
|
|
171
|
+
export declare function parseAPIError(statusCode: number, body: string | undefined, headers?: Record<string, string>): APIError | undefined;
|
|
7
172
|
export interface ClientOptions extends RuntimeClientOptions {
|
|
8
173
|
baseURL?: string;
|
|
9
174
|
timeout?: number;
|
|
@@ -68,13 +233,45 @@ export interface ReaddirOptions {
|
|
|
68
233
|
encoding?: BufferEncoding;
|
|
69
234
|
}
|
|
70
235
|
export declare class ExecError extends Error {
|
|
71
|
-
readonly
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
236
|
+
readonly result: ExecResult;
|
|
237
|
+
constructor(message: string, result: ExecResult);
|
|
238
|
+
get exitCode(): number;
|
|
239
|
+
get stdout(): string | Buffer;
|
|
240
|
+
get stderr(): string | Buffer;
|
|
241
|
+
}
|
|
242
|
+
export declare class OpConn extends EventEmitter {
|
|
243
|
+
readonly write: Refused;
|
|
244
|
+
readonly sendEOF: Refused;
|
|
245
|
+
readonly resize: Refused;
|
|
246
|
+
readonly signal: Refused;
|
|
247
|
+
readonly handleData: Refused;
|
|
248
|
+
readonly handleText: Refused;
|
|
249
|
+
readonly complete: Refused;
|
|
250
|
+
readonly close: Refused;
|
|
251
|
+
readonly isClosed: Refused;
|
|
252
|
+
readonly getExitCode: Refused;
|
|
253
|
+
readonly wait: RefusedAsync;
|
|
254
|
+
}
|
|
255
|
+
export declare class ControlConnection extends EventEmitter {
|
|
256
|
+
readonly isActive: Refused;
|
|
257
|
+
readonly setActive: Refused;
|
|
258
|
+
readonly clearOpConn: Refused;
|
|
259
|
+
readonly connect: RefusedAsync;
|
|
260
|
+
readonly startOp: RefusedAsync;
|
|
261
|
+
readonly sendData: Refused;
|
|
262
|
+
readonly close: Refused;
|
|
263
|
+
readonly isClosed: Refused;
|
|
75
264
|
}
|
|
76
265
|
export declare class SpritesClient {
|
|
77
266
|
readonly runtime: Runtime;
|
|
267
|
+
/** The Runtime API the calls go to. */
|
|
268
|
+
readonly baseURL: string;
|
|
269
|
+
/** The Runtime key given, if any; otherwise RUNTIME_API_KEY or the saved login is used. */
|
|
270
|
+
readonly token: string;
|
|
271
|
+
/** Always false: true is refused (control mode). */
|
|
272
|
+
readonly controlMode = false;
|
|
273
|
+
static readonly createToken: RefusedAsync;
|
|
274
|
+
readonly watchSprites: RefusedAsync;
|
|
78
275
|
constructor(token?: string, options?: ClientOptions);
|
|
79
276
|
sprite(name: string): Sprite;
|
|
80
277
|
createSprite(name: string, input?: SpriteConfig | CreateSpriteOptions, extra?: Omit<CreateSpriteOptions, "config">): Promise<Sprite>;
|
|
@@ -108,28 +305,71 @@ export declare class SpritesClient {
|
|
|
108
305
|
machineId: string;
|
|
109
306
|
message: string;
|
|
110
307
|
}>;
|
|
308
|
+
/** Its state as Runtime reports it now; `elapsed` is the lookup's milliseconds. */
|
|
309
|
+
checkSprite(name: string): Promise<SpriteCheck>;
|
|
310
|
+
/** Runtime keeps each sandbox's system current itself, so there is nothing
|
|
311
|
+
* to move to: this checks that the Sprite exists, as the vendor's call does. */
|
|
312
|
+
upgradeSprite(name: string): Promise<void>;
|
|
313
|
+
updateSprite(name: string, options: {
|
|
314
|
+
urlSettings?: URLSettings;
|
|
315
|
+
labels?: string[];
|
|
316
|
+
}): Promise<Sprite>;
|
|
111
317
|
updateURLSettings(name: string, settings: {
|
|
112
318
|
auth?: string;
|
|
113
319
|
privateAccess?: string;
|
|
114
320
|
}): Promise<void>;
|
|
115
321
|
}
|
|
116
322
|
export declare class Sprite {
|
|
323
|
+
#private;
|
|
117
324
|
readonly name: string;
|
|
118
325
|
readonly client: SpritesClient;
|
|
119
326
|
id?: string;
|
|
327
|
+
/** Runtime does not send the organization's name with a sandbox. */
|
|
328
|
+
organizationName?: string;
|
|
120
329
|
status?: string;
|
|
121
330
|
config?: SpriteConfig;
|
|
331
|
+
/** Set by createSprite; Runtime keeps it in the sandbox, not in its listing. */
|
|
332
|
+
environment?: Record<string, string>;
|
|
122
333
|
createdAt?: Date;
|
|
123
334
|
updatedAt?: Date;
|
|
124
335
|
url?: string;
|
|
336
|
+
urlSettings?: URLSettings;
|
|
337
|
+
/** Vendor storage and version fields; Runtime has no equivalent to report. */
|
|
338
|
+
bucketName?: string;
|
|
339
|
+
primaryRegion?: string;
|
|
340
|
+
version?: string;
|
|
341
|
+
environmentVersion?: string;
|
|
125
342
|
labels: string[];
|
|
343
|
+
lastRunningAt?: Date;
|
|
344
|
+
lastWarmingAt?: Date;
|
|
345
|
+
readonly restoreCheckpoint: RefusedAsync;
|
|
346
|
+
readonly getControlConnection: RefusedAsync;
|
|
347
|
+
readonly listServices: RefusedAsync;
|
|
348
|
+
readonly getService: RefusedAsync;
|
|
349
|
+
readonly createService: RefusedAsync;
|
|
350
|
+
readonly deleteService: RefusedAsync;
|
|
351
|
+
readonly startService: RefusedAsync;
|
|
352
|
+
readonly stopService: RefusedAsync;
|
|
353
|
+
readonly restartService: RefusedAsync;
|
|
354
|
+
readonly getServiceLogs: RefusedAsync;
|
|
355
|
+
readonly signalService: RefusedAsync;
|
|
356
|
+
readonly getPrivilegesPolicy: RefusedAsync;
|
|
357
|
+
readonly updatePrivilegesPolicy: RefusedAsync;
|
|
358
|
+
readonly deletePrivilegesPolicy: RefusedAsync;
|
|
359
|
+
readonly getResourcesPolicy: RefusedAsync;
|
|
360
|
+
readonly updateResourcesPolicy: RefusedAsync;
|
|
361
|
+
readonly deleteResourcesPolicy: RefusedAsync;
|
|
126
362
|
constructor(name: string, client: SpritesClient);
|
|
127
363
|
hydrate(s: Sandbox): void;
|
|
128
364
|
native(): Promise<Sandbox>;
|
|
129
365
|
spawn(command: string, args?: string[], options?: SpawnOptions): SpriteCommand;
|
|
130
366
|
exec(command: string, options?: ExecOptions): Promise<ExecResult>;
|
|
131
367
|
execFile(file: string, args?: string[], options?: ExecOptions): Promise<ExecResult>;
|
|
132
|
-
|
|
368
|
+
/** Runtime's commands are HTTP calls already; `input` is written to stdin
|
|
369
|
+
* and stdin closed, and without it stdin is closed at once. */
|
|
370
|
+
execFileHTTP(file: string, args?: string[], options?: Omit<ExecOptions, "tty" | "sessionId" | "controlMode" | "detachable"> & {
|
|
371
|
+
input?: string | Buffer;
|
|
372
|
+
}): Promise<ExecResult>;
|
|
133
373
|
createSession(command: string, args?: string[], options?: SpawnOptions): SpriteCommand;
|
|
134
374
|
attachSession(sessionId: string, options?: SpawnOptions): SpriteCommand;
|
|
135
375
|
listSessions(): Promise<{
|
|
@@ -148,9 +388,34 @@ export declare class Sprite {
|
|
|
148
388
|
message: string;
|
|
149
389
|
}>;
|
|
150
390
|
filesystem(workingDir?: string): SpriteFilesystem;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
391
|
+
/** Ends a session: `signal` (SIGTERM by default; "TERM" works too), then
|
|
392
|
+
* SIGKILL if it has not exited within `timeout` ("10s" by default). */
|
|
393
|
+
killSession(sessionId: string, signal?: string, timeout?: string): Promise<SessionKillStream>;
|
|
394
|
+
/** Ports listening in the Sprite now, then each one opened or closed. */
|
|
395
|
+
watchPorts(): Promise<PortWatcher>;
|
|
396
|
+
/** Runtime keeps each sandbox's system current itself; this checks it exists. */
|
|
397
|
+
upgrade(): Promise<void>;
|
|
398
|
+
check(): Promise<SpriteCheck>;
|
|
399
|
+
/** A checkpoint is a Runtime disk snapshot: the files, not the running
|
|
400
|
+
* processes. The Sprite is paused for the moment it takes, then woken.
|
|
401
|
+
* Progress arrives as the vendor's stream; a refusal is an `error` message. */
|
|
402
|
+
createCheckpoint(comment?: string): Promise<CheckpointStream>;
|
|
403
|
+
/** This Sprite's disk snapshots, newest first. */
|
|
404
|
+
listCheckpoints(historyFilter?: string): Promise<Checkpoint[]>;
|
|
405
|
+
getCheckpoint(id: string): Promise<Checkpoint>;
|
|
406
|
+
/** Forwards localhost:`localPort` here to `remotePort` in the Sprite. */
|
|
407
|
+
proxyPort(localPort: number, remotePort: number, remoteHost?: string): Promise<ProxySession>;
|
|
408
|
+
proxyPorts(mappings: PortMapping[]): Promise<ProxySession[]>;
|
|
409
|
+
/** Runtime's network rules as Sprites rules: `* deny` closes the internet,
|
|
410
|
+
* allow rules are the only destinations reachable, deny rules are refused. */
|
|
411
|
+
getNetworkPolicy(): Promise<NetworkPolicy>;
|
|
412
|
+
/** Replaces the rules, keeping any host:port openings set through Runtime. */
|
|
413
|
+
updateNetworkPolicy(policy: NetworkPolicy): Promise<void>;
|
|
414
|
+
/** Control mode is never on: Runtime refuses `controlMode: true`. */
|
|
415
|
+
useControlMode(): boolean;
|
|
416
|
+
hasControlConnection(): boolean;
|
|
417
|
+
/** Nothing to close: no control connection is ever opened. */
|
|
418
|
+
closeControlConnection(): void;
|
|
154
419
|
updateURLSettings(settings: {
|
|
155
420
|
auth?: string;
|
|
156
421
|
privateAccess?: string;
|
|
@@ -163,6 +428,55 @@ export declare class Sprite {
|
|
|
163
428
|
};
|
|
164
429
|
}): Promise<this>;
|
|
165
430
|
}
|
|
431
|
+
/** A local listener that carries each connection to a port in the Sprite,
|
|
432
|
+
* over Runtime's tunnel. Node and Bun. */
|
|
433
|
+
export declare class ProxySession extends EventEmitter {
|
|
434
|
+
#private;
|
|
435
|
+
readonly localPort: number;
|
|
436
|
+
readonly remotePort: number;
|
|
437
|
+
readonly remoteHost: string;
|
|
438
|
+
constructor(client: SpritesClient | {
|
|
439
|
+
baseURL: string;
|
|
440
|
+
token: string;
|
|
441
|
+
}, spriteName: string, mapping: PortMapping);
|
|
442
|
+
start(): Promise<void>;
|
|
443
|
+
localAddr(): string | null;
|
|
444
|
+
close(): void;
|
|
445
|
+
wait(): Promise<void>;
|
|
446
|
+
}
|
|
447
|
+
export declare class ProxyManager {
|
|
448
|
+
#private;
|
|
449
|
+
addSession(session: ProxySession): void;
|
|
450
|
+
closeAll(): void;
|
|
451
|
+
waitAll(): Promise<void>;
|
|
452
|
+
}
|
|
453
|
+
export declare function proxyPort(client: SpritesClient | {
|
|
454
|
+
baseURL: string;
|
|
455
|
+
token: string;
|
|
456
|
+
}, spriteName: string, localPort: number, remotePort: number, remoteHost?: string): Promise<ProxySession>;
|
|
457
|
+
/** All or none: a mapping that cannot start closes the ones before it. */
|
|
458
|
+
export declare function proxyPorts(client: SpritesClient | {
|
|
459
|
+
baseURL: string;
|
|
460
|
+
token: string;
|
|
461
|
+
}, spriteName: string, mappings: PortMapping[]): Promise<ProxySession[]>;
|
|
462
|
+
/** Polls the Sprite's listening TCP sockets once a second with `ss` (as
|
|
463
|
+
* Sprites' own watcher keeps a connection open, this keeps it awake). */
|
|
464
|
+
export declare class PortWatcher extends Feed<PortWatchEvent> {
|
|
465
|
+
#private;
|
|
466
|
+
constructor(client: SpritesClient, spriteName: string);
|
|
467
|
+
connect(): Promise<void>;
|
|
468
|
+
protected stop(): void;
|
|
469
|
+
}
|
|
470
|
+
/** Runtime's file watch, one per path, as Sprites' watch events. */
|
|
471
|
+
export declare class FilesystemWatcher extends Feed<FilesystemWatchEvent> {
|
|
472
|
+
#private;
|
|
473
|
+
private readonly sandbox;
|
|
474
|
+
private readonly paths;
|
|
475
|
+
private readonly recursive;
|
|
476
|
+
constructor(sandbox: () => Promise<Sandbox>, paths: string[], workingDir: string, recursive: boolean);
|
|
477
|
+
connect(): Promise<void>;
|
|
478
|
+
protected stop(): void;
|
|
479
|
+
}
|
|
166
480
|
export declare class SpriteCommand extends EventEmitter {
|
|
167
481
|
readonly stdout: PassThrough;
|
|
168
482
|
readonly stderr: PassThrough;
|
|
@@ -182,7 +496,9 @@ export declare class SpriteCommand extends EventEmitter {
|
|
|
182
496
|
exitCode(): number;
|
|
183
497
|
}
|
|
184
498
|
export declare class SpriteFilesystem {
|
|
499
|
+
#private;
|
|
185
500
|
private readonly get;
|
|
501
|
+
private readonly cwd;
|
|
186
502
|
private readonly files;
|
|
187
503
|
constructor(get: () => Promise<Sandbox>, cwd?: string);
|
|
188
504
|
readFile(path: string, encoding: "utf8"): Promise<string>;
|
|
@@ -203,6 +519,7 @@ export declare class SpriteFilesystem {
|
|
|
203
519
|
rm(path: string, options?: {
|
|
204
520
|
recursive?: boolean;
|
|
205
521
|
force?: boolean;
|
|
522
|
+
asRoot?: boolean;
|
|
206
523
|
}): Promise<void>;
|
|
207
524
|
stat(path: string): Promise<{
|
|
208
525
|
size: number;
|
|
@@ -214,13 +531,29 @@ export declare class SpriteFilesystem {
|
|
|
214
531
|
isFile: () => boolean;
|
|
215
532
|
isSymbolicLink: () => boolean;
|
|
216
533
|
}>;
|
|
217
|
-
rename(from: string, to: string
|
|
534
|
+
rename(from: string, to: string, options?: {
|
|
535
|
+
asRoot?: boolean;
|
|
536
|
+
}): Promise<void>;
|
|
218
537
|
copyFile(from: string, to: string, options?: {
|
|
219
538
|
recursive?: boolean;
|
|
539
|
+
preserveAttrs?: boolean;
|
|
540
|
+
asRoot?: boolean;
|
|
220
541
|
}): Promise<void>;
|
|
221
542
|
chmod(path: string, mode: number, options?: {
|
|
222
543
|
recursive?: boolean;
|
|
544
|
+
asRoot?: boolean;
|
|
223
545
|
}): Promise<void>;
|
|
546
|
+
/** By number or name, as the Sprite's user unless `asRoot` (sudo). */
|
|
547
|
+
chown(path: string, options: {
|
|
548
|
+
uid?: number | string;
|
|
549
|
+
gid?: number | string;
|
|
550
|
+
recursive?: boolean;
|
|
551
|
+
asRoot?: boolean;
|
|
552
|
+
}): Promise<void>;
|
|
553
|
+
/** Changes to these paths until the watcher is closed. */
|
|
554
|
+
watch(paths: string | string[], options?: {
|
|
555
|
+
recursive?: boolean;
|
|
556
|
+
}): Promise<FilesystemWatcher>;
|
|
224
557
|
exists(path: string): Promise<boolean>;
|
|
225
558
|
appendFile(path: string, data: string | Uint8Array): Promise<void>;
|
|
226
559
|
readJSON<T = unknown>(path: string): Promise<T>;
|
|
@@ -228,24 +561,3 @@ export declare class SpriteFilesystem {
|
|
|
228
561
|
spaces?: number;
|
|
229
562
|
}): Promise<void>;
|
|
230
563
|
}
|
|
231
|
-
export declare class CheckpointStream {
|
|
232
|
-
private readonly messages;
|
|
233
|
-
private index;
|
|
234
|
-
constructor(messages: {
|
|
235
|
-
type: "complete" | "error" | "info";
|
|
236
|
-
data?: string;
|
|
237
|
-
error?: string;
|
|
238
|
-
}[]);
|
|
239
|
-
next(): Promise<{
|
|
240
|
-
type: "complete" | "error" | "info";
|
|
241
|
-
data?: string;
|
|
242
|
-
error?: string;
|
|
243
|
-
} | null>;
|
|
244
|
-
processAll(handler: (message: (typeof this.messages)[number]) => void | Promise<void>): Promise<void>;
|
|
245
|
-
close(): void;
|
|
246
|
-
[Symbol.asyncIterator](): AsyncGenerator<{
|
|
247
|
-
type: "complete" | "error" | "info";
|
|
248
|
-
data?: string;
|
|
249
|
-
error?: string;
|
|
250
|
-
}, void, unknown>;
|
|
251
|
-
}
|