@nimbus-sh/sdk 0.1.5 → 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 +18 -3
- package/dist/sandbox.d.ts +262 -11
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +439 -69
- package/dist/worker.d.ts +2 -2
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +1 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -161,6 +161,10 @@ Worker verifies the JWT, enforces `sid` pins and `sandbox:use` scope, applies
|
|
|
161
161
|
the configured runtime policy, and delegates to the same `NimbusSession` RPC
|
|
162
162
|
methods used by `Nimbus.fromEnv()`.
|
|
163
163
|
|
|
164
|
+
Sandbox destruction is a separate lifecycle operation. Tokens that call
|
|
165
|
+
`box.destroy()` must include `session:destroy` or `session:admin` in addition
|
|
166
|
+
to the normal sandbox scope.
|
|
167
|
+
|
|
164
168
|
## Flue connector
|
|
165
169
|
|
|
166
170
|
Use `@nimbus-sh/sdk/flue` when an agent runtime expects Flue's sandbox
|
|
@@ -199,14 +203,20 @@ const box = nimbus.sandbox('session-or-job-id', {
|
|
|
199
203
|
|
|
200
204
|
await box.ready();
|
|
201
205
|
await box.exec('node -e "console.log(2 + 2)"');
|
|
202
|
-
await box.startProcess('node --watch /home/user/app/server.js');
|
|
206
|
+
const proc = await box.startProcess('node --watch /home/user/app/server.js');
|
|
207
|
+
// returns immediately with proc.pid; poll box.processes.logs(proc.pid) for
|
|
208
|
+
// output and the exit record, or box.processes.kill(proc.pid) to stop it
|
|
203
209
|
await box.runCode('print(2 + 2)', { language: 'python', install: 'ifMissing' });
|
|
204
210
|
|
|
205
211
|
await box.files.write('/home/user/app/a.txt', 'hello');
|
|
206
212
|
await box.files.read('/home/user/app/a.txt');
|
|
207
213
|
await box.files.list('/home/user/app');
|
|
208
214
|
await box.files.stat('/home/user/app/a.txt');
|
|
209
|
-
await box.files.
|
|
215
|
+
await box.files.lstat('/home/user/app/link');
|
|
216
|
+
await box.files.rename('/home/user/app/a.txt', '/home/user/app/b.txt');
|
|
217
|
+
await box.files.chmod('/home/user/app/b.txt', 0o755);
|
|
218
|
+
await box.files.readRange('/home/user/app/b.txt', 0, 64);
|
|
219
|
+
await box.files.delete('/home/user/app/b.txt');
|
|
210
220
|
|
|
211
221
|
await box.runtimes.available();
|
|
212
222
|
await box.runtimes.installed();
|
|
@@ -222,6 +232,11 @@ const port = await box.ports.expose(3000);
|
|
|
222
232
|
await box.ports.unexpose(3000);
|
|
223
233
|
```
|
|
224
234
|
|
|
235
|
+
On deployments with a preview host suffix configured (the hosted product sets
|
|
236
|
+
`NIMBUS_PREVIEW_HOST_SUFFIX=nimbus-os.dev`), `port.url` is the hostname form
|
|
237
|
+
`https://<port>--<session-id>.<suffix>/` instead; the `/s/<id>/port/<n>/`
|
|
238
|
+
path route works on every deployment.
|
|
239
|
+
|
|
225
240
|
Runtime policy comes from the sandbox profile:
|
|
226
241
|
|
|
227
242
|
- `runtimes.preinstall` is applied by `box.ready()`.
|
|
@@ -240,7 +255,7 @@ object with `tools.exec.execute`, `runCode`, `readFile`, `writeFile`,
|
|
|
240
255
|
`provider.capabilities` is intentionally honest: Nimbus claims shell,
|
|
241
256
|
JavaScript/TypeScript, npm, git, owned filesystem, outbound fetch, inbound
|
|
242
257
|
HTTP-like port routing, process spawn/long-running processes, Python/Ruby
|
|
243
|
-
when allowed, and clang
|
|
258
|
+
when allowed, and clang-backed WASI/WebAssembly execution. It does not claim Docker, apt, GPU,
|
|
244
259
|
custom Linux images, native Linux ELF execution, or raw TCP listeners.
|
|
245
260
|
|
|
246
261
|
## Quickstart — mint a session token
|
package/dist/sandbox.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @nimbus-sh/sdk/sandbox - programmatic Nimbus sandbox handle.
|
|
3
3
|
*/
|
|
4
|
+
import type { VfsCred } from '@nimbus-sh/core/runtime/os-contracts.js';
|
|
4
5
|
export type RuntimeSpec = string;
|
|
5
6
|
export type RuntimeName = 'node' | 'bun' | 'npm' | 'git' | 'python' | 'ruby' | 'clang' | 'shell' | (string & {});
|
|
6
7
|
export interface NimbusRuntimePolicy {
|
|
@@ -22,6 +23,14 @@ export interface NimbusSandboxProfile {
|
|
|
22
23
|
}
|
|
23
24
|
export interface NimbusConfig {
|
|
24
25
|
endpoint?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The deployment's `NIMBUS_PREVIEW_HOST_SUFFIX`, enabling the
|
|
28
|
+
* `<port>--<sid>.<suffix>` preview origin. `Nimbus.fromEnv` reads it off
|
|
29
|
+
* the bindings, so in-Worker callers never restate it; remote clients
|
|
30
|
+
* (`Nimbus.connect`) have no bindings and must supply it to get host-form
|
|
31
|
+
* preview URLs.
|
|
32
|
+
*/
|
|
33
|
+
previewHostSuffix?: string;
|
|
25
34
|
sandboxes?: Record<string, NimbusSandboxProfile>;
|
|
26
35
|
}
|
|
27
36
|
export interface NimbusFromEnvOptions {
|
|
@@ -50,10 +59,21 @@ export interface NimbusSandboxOptions {
|
|
|
50
59
|
root?: string;
|
|
51
60
|
}
|
|
52
61
|
export interface NimbusExecOptions {
|
|
62
|
+
/**
|
|
63
|
+
* Run in a named shell whose cwd and environment persist between calls, the
|
|
64
|
+
* way a terminal tab does. Omitted, the call runs on the session's one shell
|
|
65
|
+
* and remembers nothing — the behaviour every programmatic exec has had.
|
|
66
|
+
*/
|
|
67
|
+
shellId?: string;
|
|
53
68
|
cwd?: string;
|
|
54
69
|
env?: Record<string, string>;
|
|
55
70
|
timeoutMs?: number;
|
|
56
71
|
stdin?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Identity the command runs as. Omitted, the spawn inherits the session
|
|
74
|
+
* user, which is what every programmatic exec has always run as.
|
|
75
|
+
*/
|
|
76
|
+
cred?: VfsCred;
|
|
57
77
|
}
|
|
58
78
|
export interface NimbusExecResult {
|
|
59
79
|
command: string;
|
|
@@ -64,6 +84,10 @@ export interface NimbusExecResult {
|
|
|
64
84
|
duration: number;
|
|
65
85
|
timestamp: number;
|
|
66
86
|
}
|
|
87
|
+
export interface NimbusTerminalSize {
|
|
88
|
+
columns: number;
|
|
89
|
+
rows: number;
|
|
90
|
+
}
|
|
67
91
|
export interface NimbusDestroyOptions {
|
|
68
92
|
reason?: string;
|
|
69
93
|
}
|
|
@@ -73,10 +97,18 @@ export interface NimbusDestroyResult {
|
|
|
73
97
|
destroyedAt: number;
|
|
74
98
|
reason: string | null;
|
|
75
99
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
100
|
+
/**
|
|
101
|
+
* A started background process. It is still running when `startProcess`
|
|
102
|
+
* returns, so there is no exit code or captured output here — poll
|
|
103
|
+
* `processes.logs(pid)` (which carries the exit record once it lands),
|
|
104
|
+
* `processes.list()`, or `processes.attach(pid)`.
|
|
105
|
+
*/
|
|
106
|
+
export interface NimbusStartResult {
|
|
107
|
+
command: string;
|
|
108
|
+
pid: number;
|
|
109
|
+
process: NimbusProcess;
|
|
79
110
|
ports: NimbusPort[];
|
|
111
|
+
startedAt: number;
|
|
80
112
|
}
|
|
81
113
|
export interface NimbusProcess {
|
|
82
114
|
pid: number;
|
|
@@ -88,11 +120,50 @@ export interface NimbusProcess {
|
|
|
88
120
|
startTime: number;
|
|
89
121
|
endTime: number | null;
|
|
90
122
|
longRunning: boolean;
|
|
123
|
+
attachedTty: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface NimbusProcessLogChunk {
|
|
126
|
+
seq: number;
|
|
127
|
+
ts: number;
|
|
128
|
+
stream: 'stdout' | 'stderr';
|
|
129
|
+
data: string;
|
|
130
|
+
binary?: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface NimbusProcessExitInfo {
|
|
133
|
+
code: number;
|
|
134
|
+
at: number;
|
|
135
|
+
reason?: string;
|
|
136
|
+
}
|
|
137
|
+
export interface NimbusProcessLogsOptions {
|
|
138
|
+
cursor?: number;
|
|
139
|
+
lines?: number;
|
|
140
|
+
bytes?: number;
|
|
141
|
+
}
|
|
142
|
+
export interface NimbusProcessLogsResult {
|
|
143
|
+
pid: number;
|
|
144
|
+
chunks: NimbusProcessLogChunk[];
|
|
145
|
+
text: string;
|
|
146
|
+
cursor: number;
|
|
147
|
+
truncated: boolean;
|
|
148
|
+
exit: NimbusProcessExitInfo | null;
|
|
149
|
+
}
|
|
150
|
+
export interface NimbusProcessAttachOptions {
|
|
151
|
+
pollIntervalMs?: number;
|
|
152
|
+
lines?: number;
|
|
153
|
+
bytes?: number;
|
|
154
|
+
signal?: AbortSignal;
|
|
91
155
|
}
|
|
92
156
|
export interface NimbusPort {
|
|
93
157
|
port: number;
|
|
94
158
|
pid: number;
|
|
95
159
|
registeredAt: number;
|
|
160
|
+
/**
|
|
161
|
+
* Bearer token for THIS port on THIS session. Presenting it on the
|
|
162
|
+
* preview route authorises that one port and nothing else, which is what
|
|
163
|
+
* lets an embedder publish a guest's dev server without publishing the
|
|
164
|
+
* session. A new registration on the port retires it.
|
|
165
|
+
*/
|
|
166
|
+
capability: string;
|
|
96
167
|
}
|
|
97
168
|
export interface NimbusFileStat {
|
|
98
169
|
type: 'file' | 'directory' | string;
|
|
@@ -105,12 +176,14 @@ export interface NimbusRuntimeSummary {
|
|
|
105
176
|
name: string;
|
|
106
177
|
version: string;
|
|
107
178
|
root: string;
|
|
179
|
+
abi: string;
|
|
108
180
|
bins: string[];
|
|
109
181
|
sizeBytes: number;
|
|
110
182
|
license: string;
|
|
111
183
|
}
|
|
112
184
|
export interface NimbusAvailableRuntime {
|
|
113
185
|
name: string;
|
|
186
|
+
abi: string;
|
|
114
187
|
defaultVersion: string;
|
|
115
188
|
versions: Array<{
|
|
116
189
|
version: string;
|
|
@@ -118,7 +191,83 @@ export interface NimbusAvailableRuntime {
|
|
|
118
191
|
license: string;
|
|
119
192
|
}>;
|
|
120
193
|
}
|
|
121
|
-
|
|
194
|
+
interface NimbusSessionStub {
|
|
195
|
+
_rpcReady(options?: {
|
|
196
|
+
preinstall?: string[];
|
|
197
|
+
}): Promise<{
|
|
198
|
+
ok: true;
|
|
199
|
+
preinstalled: string[];
|
|
200
|
+
}>;
|
|
201
|
+
_rpcExec(command: string, options?: Record<string, unknown>): Promise<NimbusExecResult>;
|
|
202
|
+
_rpcStartProcess(command: string, options?: Record<string, unknown>): Promise<NimbusStartResult>;
|
|
203
|
+
_rpcRunCode(code: string, options?: Record<string, unknown>): Promise<NimbusExecResult>;
|
|
204
|
+
_rpcReadFile(path: string): Promise<string | null>;
|
|
205
|
+
_rpcReadFileBytes(path: string): Promise<Uint8Array | null>;
|
|
206
|
+
_rpcWriteFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
207
|
+
_rpcStat(path: string): Promise<NimbusFileStat | null>;
|
|
208
|
+
_rpcLstat(path: string): Promise<NimbusFileStat | null>;
|
|
209
|
+
_rpcReaddir(path: string): Promise<{
|
|
210
|
+
name: string;
|
|
211
|
+
type: string;
|
|
212
|
+
}[]>;
|
|
213
|
+
_rpcRename(from: string, to: string): Promise<void>;
|
|
214
|
+
_rpcChmod(path: string, mode: number): Promise<void>;
|
|
215
|
+
_rpcFsReadRange(path: string, offset: number, length: number): Promise<Uint8Array | null>;
|
|
216
|
+
_rpcExists(path: string): Promise<boolean>;
|
|
217
|
+
_rpcMkdir(path: string): Promise<void>;
|
|
218
|
+
_rpcDeleteFile(path: string, options?: {
|
|
219
|
+
recursive?: boolean;
|
|
220
|
+
}): Promise<void>;
|
|
221
|
+
_rpcInstallRuntime(spec: string, options?: {
|
|
222
|
+
force?: boolean;
|
|
223
|
+
}): Promise<unknown>;
|
|
224
|
+
_rpcEnsureRuntimes(specs: string[], options?: {
|
|
225
|
+
force?: boolean;
|
|
226
|
+
}): Promise<unknown>;
|
|
227
|
+
_rpcListRuntimes(): Promise<{
|
|
228
|
+
installed: NimbusRuntimeSummary[];
|
|
229
|
+
available: NimbusAvailableRuntime[];
|
|
230
|
+
}>;
|
|
231
|
+
_rpcListProcesses(): Promise<NimbusProcess[]>;
|
|
232
|
+
_rpcKillProcess(pid: number): Promise<{
|
|
233
|
+
ok: boolean;
|
|
234
|
+
pid: number;
|
|
235
|
+
}>;
|
|
236
|
+
_rpcWriteProcessInput(pid: number, data: string): Promise<{
|
|
237
|
+
ok: boolean;
|
|
238
|
+
pid: number;
|
|
239
|
+
}>;
|
|
240
|
+
_rpcEndProcessInput(pid: number): Promise<{
|
|
241
|
+
ok: boolean;
|
|
242
|
+
pid: number;
|
|
243
|
+
}>;
|
|
244
|
+
_rpcResizeProcess(pid: number, size: NimbusTerminalSize): Promise<{
|
|
245
|
+
ok: boolean;
|
|
246
|
+
pid: number;
|
|
247
|
+
}>;
|
|
248
|
+
_rpcSignalProcess(pid: number, signal: string): Promise<{
|
|
249
|
+
ok: boolean;
|
|
250
|
+
pid: number;
|
|
251
|
+
}>;
|
|
252
|
+
_rpcProcessLogs(pid: number, options?: NimbusProcessLogsOptions): Promise<NimbusProcessLogsResult>;
|
|
253
|
+
_rpcListPorts(): Promise<NimbusPort[]>;
|
|
254
|
+
_rpcExposePort(port: number): Promise<{
|
|
255
|
+
port: number;
|
|
256
|
+
listening: boolean;
|
|
257
|
+
pid: number | null;
|
|
258
|
+
registeredAt: number | null;
|
|
259
|
+
capability: string | null;
|
|
260
|
+
}>;
|
|
261
|
+
_rpcUnexposePort(port: number): Promise<{
|
|
262
|
+
port: number;
|
|
263
|
+
ok: boolean;
|
|
264
|
+
}>;
|
|
265
|
+
_rpcDestroy(options?: NimbusDestroyOptions): Promise<NimbusDestroyResult>;
|
|
266
|
+
}
|
|
267
|
+
interface NimbusSessionNamespace {
|
|
268
|
+
idFromName(name: string): DurableObjectId;
|
|
269
|
+
get(id: DurableObjectId): NimbusSessionStub;
|
|
270
|
+
}
|
|
122
271
|
type NimbusTarget = {
|
|
123
272
|
kind: 'binding';
|
|
124
273
|
namespace: NimbusSessionNamespace;
|
|
@@ -165,6 +314,10 @@ export declare class NimbusSandbox {
|
|
|
165
314
|
private remoteRpc;
|
|
166
315
|
ready(): Promise<void>;
|
|
167
316
|
exec(command: string, options?: NimbusExecOptions): Promise<NimbusExecResult>;
|
|
317
|
+
/**
|
|
318
|
+
* Start a command in the background. Returns as soon as the process has a
|
|
319
|
+
* pid — it does not wait for the command to finish.
|
|
320
|
+
*/
|
|
168
321
|
startProcess(command: string, options?: NimbusExecOptions): Promise<NimbusStartResult>;
|
|
169
322
|
runCode(code: string, options?: NimbusExecOptions & {
|
|
170
323
|
language?: 'javascript' | 'typescript' | 'python' | 'ruby' | 'shell';
|
|
@@ -176,6 +329,12 @@ export declare class NimbusSandbox {
|
|
|
176
329
|
readBytes: (path: string) => Promise<Uint8Array | null>;
|
|
177
330
|
write: (path: string, content: string | Uint8Array) => Promise<void>;
|
|
178
331
|
stat: (path: string) => Promise<NimbusFileStat | null>;
|
|
332
|
+
/** stat without following a symlink leaf. */
|
|
333
|
+
lstat: (path: string) => Promise<NimbusFileStat | null>;
|
|
334
|
+
rename: (from: string, to: string) => Promise<void>;
|
|
335
|
+
chmod: (path: string, mode: number) => Promise<void>;
|
|
336
|
+
/** Read `length` bytes at `offset` without materializing the whole file. */
|
|
337
|
+
readRange: (path: string, offset: number, length: number) => Promise<Uint8Array | null>;
|
|
179
338
|
list: (path?: string) => Promise<{
|
|
180
339
|
name: string;
|
|
181
340
|
type: string;
|
|
@@ -206,10 +365,24 @@ export declare class NimbusSandbox {
|
|
|
206
365
|
ok: boolean;
|
|
207
366
|
pid: number;
|
|
208
367
|
}>;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
368
|
+
write: (pid: number, data: string) => Promise<{
|
|
369
|
+
ok: boolean;
|
|
370
|
+
pid: number;
|
|
371
|
+
}>;
|
|
372
|
+
endInput: (pid: number) => Promise<{
|
|
373
|
+
ok: boolean;
|
|
374
|
+
pid: number;
|
|
375
|
+
}>;
|
|
376
|
+
resize: (pid: number, size: NimbusTerminalSize) => Promise<{
|
|
377
|
+
ok: boolean;
|
|
378
|
+
pid: number;
|
|
379
|
+
}>;
|
|
380
|
+
signal: (pid: number, signal: string) => Promise<{
|
|
381
|
+
ok: boolean;
|
|
382
|
+
pid: number;
|
|
383
|
+
}>;
|
|
384
|
+
logs: (pid: number, options?: NimbusProcessLogsOptions) => Promise<NimbusProcessLogsResult>;
|
|
385
|
+
attach: (pid: number, options?: NimbusProcessAttachOptions) => NimbusProcessAttachment;
|
|
213
386
|
};
|
|
214
387
|
ports: {
|
|
215
388
|
list: () => Promise<NimbusPort[]>;
|
|
@@ -219,6 +392,7 @@ export declare class NimbusSandbox {
|
|
|
219
392
|
listening: boolean;
|
|
220
393
|
pid: number | null;
|
|
221
394
|
registeredAt: number | null;
|
|
395
|
+
capability: string | null;
|
|
222
396
|
}>;
|
|
223
397
|
unexpose: (port: number) => Promise<{
|
|
224
398
|
port: number;
|
|
@@ -248,7 +422,7 @@ export declare class NimbusSandbox {
|
|
|
248
422
|
execute: (input: unknown) => Promise<string | null>;
|
|
249
423
|
};
|
|
250
424
|
writeFile: {
|
|
251
|
-
execute: (input:
|
|
425
|
+
execute: (input: unknown) => Promise<void>;
|
|
252
426
|
};
|
|
253
427
|
listFiles: {
|
|
254
428
|
execute: (input?: unknown) => Promise<{
|
|
@@ -263,7 +437,7 @@ export declare class NimbusSandbox {
|
|
|
263
437
|
}[]>;
|
|
264
438
|
};
|
|
265
439
|
deleteFile: {
|
|
266
|
-
execute: (input:
|
|
440
|
+
execute: (input: unknown) => Promise<void>;
|
|
267
441
|
};
|
|
268
442
|
exists: {
|
|
269
443
|
execute: (input: unknown) => Promise<boolean>;
|
|
@@ -279,12 +453,48 @@ export declare class NimbusSandbox {
|
|
|
279
453
|
pid: number;
|
|
280
454
|
}>;
|
|
281
455
|
};
|
|
456
|
+
writeProcessInput: {
|
|
457
|
+
execute: (input: {
|
|
458
|
+
pid: number;
|
|
459
|
+
data: string;
|
|
460
|
+
}) => Promise<{
|
|
461
|
+
ok: boolean;
|
|
462
|
+
pid: number;
|
|
463
|
+
}>;
|
|
464
|
+
};
|
|
465
|
+
endProcessInput: {
|
|
466
|
+
execute: (input: number | {
|
|
467
|
+
pid: number;
|
|
468
|
+
}) => Promise<{
|
|
469
|
+
ok: boolean;
|
|
470
|
+
pid: number;
|
|
471
|
+
}>;
|
|
472
|
+
};
|
|
473
|
+
resizeProcess: {
|
|
474
|
+
execute: (input: {
|
|
475
|
+
pid: number;
|
|
476
|
+
columns: number;
|
|
477
|
+
rows: number;
|
|
478
|
+
}) => Promise<{
|
|
479
|
+
ok: boolean;
|
|
480
|
+
pid: number;
|
|
481
|
+
}>;
|
|
482
|
+
};
|
|
483
|
+
signalProcess: {
|
|
484
|
+
execute: (input: {
|
|
485
|
+
pid: number;
|
|
486
|
+
signal: string;
|
|
487
|
+
}) => Promise<{
|
|
488
|
+
ok: boolean;
|
|
489
|
+
pid: number;
|
|
490
|
+
}>;
|
|
491
|
+
};
|
|
282
492
|
logs: {
|
|
283
493
|
execute: (input: number | {
|
|
284
494
|
pid: number;
|
|
285
495
|
lines?: number;
|
|
286
496
|
bytes?: number;
|
|
287
|
-
}) => Promise<
|
|
497
|
+
}) => Promise<NimbusProcessLogsResult>;
|
|
288
498
|
};
|
|
289
499
|
exposePort: {
|
|
290
500
|
execute: (input: number | {
|
|
@@ -295,6 +505,7 @@ export declare class NimbusSandbox {
|
|
|
295
505
|
listening: boolean;
|
|
296
506
|
pid: number | null;
|
|
297
507
|
registeredAt: number | null;
|
|
508
|
+
capability: string | null;
|
|
298
509
|
}>;
|
|
299
510
|
};
|
|
300
511
|
unexposePort: {
|
|
@@ -322,7 +533,47 @@ export declare class NimbusSandbox {
|
|
|
322
533
|
capabilities(): string[];
|
|
323
534
|
private execOptions;
|
|
324
535
|
private assertRuntimeAllowed;
|
|
536
|
+
/**
|
|
537
|
+
* Browser-facing URL for an exposed port, or undefined when the deployment
|
|
538
|
+
* is not addressable (no `endpoint`, no configured preview base).
|
|
539
|
+
*
|
|
540
|
+
* The URL carries NO credential. On a deployment with auth enforced it is
|
|
541
|
+
* the destination, not the ticket: the session mints a single-use attach
|
|
542
|
+
* token for it at `GET /s/<id>/api/preview-url?port=<n>`, which is what the
|
|
543
|
+
* session shell opens and what an embedder should hand to a browser.
|
|
544
|
+
*/
|
|
325
545
|
private portUrl;
|
|
546
|
+
private rpc;
|
|
547
|
+
}
|
|
548
|
+
export declare class NimbusProcessAttachment implements AsyncIterable<NimbusProcessLogChunk> {
|
|
549
|
+
private readonly sandbox;
|
|
550
|
+
readonly pid: number;
|
|
551
|
+
private readonly options;
|
|
552
|
+
private cursor;
|
|
553
|
+
constructor(sandbox: NimbusSandbox, pid: number, options?: NimbusProcessAttachOptions);
|
|
554
|
+
write(data: string): Promise<{
|
|
555
|
+
ok: boolean;
|
|
556
|
+
pid: number;
|
|
557
|
+
}>;
|
|
558
|
+
endInput(): Promise<{
|
|
559
|
+
ok: boolean;
|
|
560
|
+
pid: number;
|
|
561
|
+
}>;
|
|
562
|
+
resize(size: NimbusTerminalSize): Promise<{
|
|
563
|
+
ok: boolean;
|
|
564
|
+
pid: number;
|
|
565
|
+
}>;
|
|
566
|
+
signal(signal: string): Promise<{
|
|
567
|
+
ok: boolean;
|
|
568
|
+
pid: number;
|
|
569
|
+
}>;
|
|
570
|
+
kill(): Promise<{
|
|
571
|
+
ok: boolean;
|
|
572
|
+
pid: number;
|
|
573
|
+
}>;
|
|
574
|
+
logs(options?: NimbusProcessLogsOptions): Promise<NimbusProcessLogsResult>;
|
|
575
|
+
stream(options?: NimbusProcessAttachOptions): AsyncIterable<NimbusProcessLogChunk>;
|
|
576
|
+
[Symbol.asyncIterator](): AsyncIterator<NimbusProcessLogChunk>;
|
|
326
577
|
}
|
|
327
578
|
export {};
|
|
328
579
|
//# sourceMappingURL=sandbox.d.ts.map
|
package/dist/sandbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings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,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAMpF,MAAM,CAAC,OAAO,GAAE,0BAA+B,GAAG,aAAa,CAAC,qBAAqB,CAAC;IAkCtF,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,qBAAqB,CAAC;CAG/D"}
|
package/dist/sandbox.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @nimbus-sh/sdk/sandbox - programmatic Nimbus sandbox handle.
|
|
3
3
|
*/
|
|
4
|
+
import { buildPreviewHost, isPreviewHostSafeSid, readPreviewHostSuffix, } from '@nimbus-sh/worker/preview-host';
|
|
5
|
+
import { z } from 'zod/v4';
|
|
4
6
|
export class NimbusRemoteError extends Error {
|
|
5
7
|
status;
|
|
6
8
|
code;
|
|
@@ -13,6 +15,152 @@ export class NimbusRemoteError extends Error {
|
|
|
13
15
|
this.body = options.body;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
18
|
+
const RemoteRpcSuccessSchema = z.object({
|
|
19
|
+
ok: z.literal(true),
|
|
20
|
+
result: z.unknown().optional(),
|
|
21
|
+
}).passthrough();
|
|
22
|
+
const RemoteRpcFailureSchema = z.object({
|
|
23
|
+
ok: z.boolean().optional(),
|
|
24
|
+
error: z.string().optional(),
|
|
25
|
+
message: z.string().optional(),
|
|
26
|
+
code: z.string().optional(),
|
|
27
|
+
}).passthrough();
|
|
28
|
+
const WireBytesSchema = z.object({
|
|
29
|
+
__nimbusWireType: z.literal('bytes'),
|
|
30
|
+
base64: z.string(),
|
|
31
|
+
}).passthrough();
|
|
32
|
+
const UndefinedResultSchema = z.undefined();
|
|
33
|
+
const UnknownResultSchema = z.unknown();
|
|
34
|
+
/** `_rpcWriteFile` answers with the byte count the VFS wrote. */
|
|
35
|
+
const WriteFileResultSchema = z.number();
|
|
36
|
+
const StringOrNullSchema = z.string().nullable();
|
|
37
|
+
const Uint8ArrayOrNullSchema = z.instanceof(Uint8Array).nullable();
|
|
38
|
+
const BooleanResultSchema = z.boolean();
|
|
39
|
+
const ReadyResultSchema = z.object({
|
|
40
|
+
ok: z.literal(true),
|
|
41
|
+
preinstalled: z.array(z.string()),
|
|
42
|
+
});
|
|
43
|
+
const ExecResultSchema = z.object({
|
|
44
|
+
command: z.string(),
|
|
45
|
+
exitCode: z.number(),
|
|
46
|
+
success: z.boolean(),
|
|
47
|
+
stdout: z.string(),
|
|
48
|
+
stderr: z.string(),
|
|
49
|
+
duration: z.number(),
|
|
50
|
+
timestamp: z.number(),
|
|
51
|
+
});
|
|
52
|
+
const ProcessSchema = z.object({
|
|
53
|
+
pid: z.number(),
|
|
54
|
+
command: z.string(),
|
|
55
|
+
argv: z.array(z.string()),
|
|
56
|
+
cwd: z.string(),
|
|
57
|
+
state: z.string(),
|
|
58
|
+
exitCode: z.number().nullable(),
|
|
59
|
+
startTime: z.number(),
|
|
60
|
+
endTime: z.number().nullable(),
|
|
61
|
+
longRunning: z.boolean(),
|
|
62
|
+
attachedTty: z.boolean().optional().default(false),
|
|
63
|
+
});
|
|
64
|
+
const PortSchema = z.object({
|
|
65
|
+
port: z.number(),
|
|
66
|
+
pid: z.number(),
|
|
67
|
+
registeredAt: z.number(),
|
|
68
|
+
capability: z.string(),
|
|
69
|
+
});
|
|
70
|
+
const StartResultSchema = z.object({
|
|
71
|
+
command: z.string(),
|
|
72
|
+
pid: z.number(),
|
|
73
|
+
process: ProcessSchema,
|
|
74
|
+
ports: z.array(PortSchema),
|
|
75
|
+
startedAt: z.number(),
|
|
76
|
+
});
|
|
77
|
+
const FileStatSchema = z.object({
|
|
78
|
+
type: z.string(),
|
|
79
|
+
size: z.number(),
|
|
80
|
+
ctime: z.number().optional(),
|
|
81
|
+
mtime: z.number(),
|
|
82
|
+
mode: z.number(),
|
|
83
|
+
});
|
|
84
|
+
const DirectoryEntrySchema = z.object({
|
|
85
|
+
name: z.string(),
|
|
86
|
+
type: z.string(),
|
|
87
|
+
});
|
|
88
|
+
const RuntimeSummarySchema = z.object({
|
|
89
|
+
name: z.string(),
|
|
90
|
+
version: z.string(),
|
|
91
|
+
root: z.string(),
|
|
92
|
+
abi: z.string(),
|
|
93
|
+
bins: z.array(z.string()),
|
|
94
|
+
sizeBytes: z.number(),
|
|
95
|
+
license: z.string(),
|
|
96
|
+
});
|
|
97
|
+
const AvailableRuntimeSchema = z.object({
|
|
98
|
+
name: z.string(),
|
|
99
|
+
abi: z.string(),
|
|
100
|
+
defaultVersion: z.string(),
|
|
101
|
+
versions: z.array(z.object({
|
|
102
|
+
version: z.string(),
|
|
103
|
+
sizeBytes: z.number(),
|
|
104
|
+
license: z.string(),
|
|
105
|
+
})),
|
|
106
|
+
});
|
|
107
|
+
const RuntimeListSchema = z.object({
|
|
108
|
+
installed: z.array(RuntimeSummarySchema),
|
|
109
|
+
available: z.array(AvailableRuntimeSchema),
|
|
110
|
+
});
|
|
111
|
+
const ProcessControlResultSchema = z.object({
|
|
112
|
+
ok: z.boolean(),
|
|
113
|
+
pid: z.number(),
|
|
114
|
+
});
|
|
115
|
+
const ProcessLogChunkSchema = z.object({
|
|
116
|
+
seq: z.number(),
|
|
117
|
+
ts: z.number(),
|
|
118
|
+
stream: z.enum(['stdout', 'stderr']),
|
|
119
|
+
data: z.string(),
|
|
120
|
+
binary: z.boolean().optional(),
|
|
121
|
+
});
|
|
122
|
+
const ProcessExitInfoSchema = z.object({
|
|
123
|
+
code: z.number(),
|
|
124
|
+
at: z.number(),
|
|
125
|
+
reason: z.string().optional(),
|
|
126
|
+
});
|
|
127
|
+
const ProcessLogsResultSchema = z.object({
|
|
128
|
+
pid: z.number(),
|
|
129
|
+
chunks: z.array(ProcessLogChunkSchema),
|
|
130
|
+
text: z.string(),
|
|
131
|
+
cursor: z.number(),
|
|
132
|
+
truncated: z.boolean(),
|
|
133
|
+
exit: ProcessExitInfoSchema.nullable(),
|
|
134
|
+
});
|
|
135
|
+
const ExposedPortSchema = z.object({
|
|
136
|
+
port: z.number(),
|
|
137
|
+
listening: z.boolean(),
|
|
138
|
+
pid: z.number().nullable(),
|
|
139
|
+
registeredAt: z.number().nullable(),
|
|
140
|
+
capability: z.string().nullable(),
|
|
141
|
+
});
|
|
142
|
+
const UnexposedPortSchema = z.object({
|
|
143
|
+
port: z.number(),
|
|
144
|
+
ok: z.boolean(),
|
|
145
|
+
});
|
|
146
|
+
const DestroyResultSchema = z.object({
|
|
147
|
+
ok: z.literal(true),
|
|
148
|
+
killed: z.number(),
|
|
149
|
+
destroyedAt: z.number(),
|
|
150
|
+
reason: z.string().nullable(),
|
|
151
|
+
});
|
|
152
|
+
const ToolPathInputSchema = z.object({
|
|
153
|
+
path: z.string().optional(),
|
|
154
|
+
}).passthrough();
|
|
155
|
+
const ToolWriteFileInputSchema = z.object({
|
|
156
|
+
path: z.string().optional(),
|
|
157
|
+
content: z.union([z.string(), z.instanceof(Uint8Array)]).optional(),
|
|
158
|
+
data: z.union([z.string(), z.instanceof(Uint8Array)]).optional(),
|
|
159
|
+
}).passthrough();
|
|
160
|
+
const ToolDeleteFileInputSchema = z.object({
|
|
161
|
+
path: z.string().optional(),
|
|
162
|
+
recursive: z.boolean().optional(),
|
|
163
|
+
}).passthrough();
|
|
16
164
|
export class Nimbus {
|
|
17
165
|
config;
|
|
18
166
|
static fromEnv(env, config = {}, options = {}) {
|
|
@@ -24,6 +172,9 @@ export class Nimbus {
|
|
|
24
172
|
return new Nimbus({ kind: 'binding', namespace: binding }, {
|
|
25
173
|
...config,
|
|
26
174
|
endpoint: options.endpoint ?? config.endpoint,
|
|
175
|
+
// The binding is the deployment's own answer for whether port previews
|
|
176
|
+
// have a host suffix, so in-Worker callers never restate it in config.
|
|
177
|
+
previewHostSuffix: readPreviewHostSuffix(env) ?? config.previewHostSuffix,
|
|
27
178
|
});
|
|
28
179
|
}
|
|
29
180
|
static connect(options) {
|
|
@@ -88,37 +239,49 @@ export class NimbusSandbox {
|
|
|
88
239
|
stub() {
|
|
89
240
|
if (this.target.kind === 'remote')
|
|
90
241
|
return this.remoteStub();
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
return namespace.get(id);
|
|
242
|
+
const id = this.target.namespace.idFromName(this.doName);
|
|
243
|
+
return this.target.namespace.get(id);
|
|
94
244
|
}
|
|
95
245
|
remoteStub() {
|
|
96
246
|
return {
|
|
97
|
-
_rpcReady: (options) => this.remoteRpc('ready', [options]),
|
|
98
|
-
_rpcExec: (command, options) => this.remoteRpc('exec', [command, options]),
|
|
99
|
-
_rpcStartProcess: (command, options) => this.remoteRpc('startProcess', [command, options]),
|
|
100
|
-
_rpcRunCode: (code, options) => this.remoteRpc('runCode', [code, options]),
|
|
101
|
-
_rpcReadFile: (path) => this.remoteRpc('readFile', [path]),
|
|
102
|
-
_rpcReadFileBytes: (path) => this.remoteRpc('readFileBytes', [path]),
|
|
103
|
-
_rpcWriteFile: (path, content) =>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
247
|
+
_rpcReady: (options) => this.remoteRpc('ready', [options], ReadyResultSchema),
|
|
248
|
+
_rpcExec: (command, options) => this.remoteRpc('exec', [command, options], ExecResultSchema),
|
|
249
|
+
_rpcStartProcess: (command, options) => this.remoteRpc('startProcess', [command, options], StartResultSchema),
|
|
250
|
+
_rpcRunCode: (code, options) => this.remoteRpc('runCode', [code, options], ExecResultSchema),
|
|
251
|
+
_rpcReadFile: (path) => this.remoteRpc('readFile', [path], StringOrNullSchema),
|
|
252
|
+
_rpcReadFileBytes: (path) => this.remoteRpc('readFileBytes', [path], Uint8ArrayOrNullSchema),
|
|
253
|
+
_rpcWriteFile: async (path, content) => {
|
|
254
|
+
// The byte count is the wire contract but not part of the public
|
|
255
|
+
// `files.write` surface, so it is validated and dropped. Declaring
|
|
256
|
+
// this `undefined` made every remote write throw after succeeding.
|
|
257
|
+
await this.remoteRpc('writeFile', [path, content], WriteFileResultSchema);
|
|
258
|
+
},
|
|
259
|
+
_rpcStat: (path) => this.remoteRpc('stat', [path], FileStatSchema.nullable()),
|
|
260
|
+
_rpcLstat: (path) => this.remoteRpc('lstat', [path], FileStatSchema.nullable()),
|
|
261
|
+
_rpcRename: (from, to) => this.remoteRpc('rename', [from, to], UndefinedResultSchema),
|
|
262
|
+
_rpcChmod: (path, mode) => this.remoteRpc('chmod', [path, mode], UndefinedResultSchema),
|
|
263
|
+
_rpcFsReadRange: (path, offset, length) => this.remoteRpc('readRange', [path, offset, length], Uint8ArrayOrNullSchema),
|
|
264
|
+
_rpcReaddir: (path) => this.remoteRpc('readdir', [path], z.array(DirectoryEntrySchema)),
|
|
265
|
+
_rpcExists: (path) => this.remoteRpc('exists', [path], BooleanResultSchema),
|
|
266
|
+
_rpcMkdir: (path) => this.remoteRpc('mkdir', [path], UndefinedResultSchema),
|
|
267
|
+
_rpcDeleteFile: (path, options) => this.remoteRpc('deleteFile', [path, options], UndefinedResultSchema),
|
|
268
|
+
_rpcInstallRuntime: (spec, options) => this.remoteRpc('installRuntime', [spec, options], UnknownResultSchema),
|
|
269
|
+
_rpcEnsureRuntimes: (specs, options) => this.remoteRpc('ensureRuntimes', [specs, options], UnknownResultSchema),
|
|
270
|
+
_rpcListRuntimes: () => this.remoteRpc('listRuntimes', [], RuntimeListSchema),
|
|
271
|
+
_rpcListProcesses: () => this.remoteRpc('listProcesses', [], z.array(ProcessSchema)),
|
|
272
|
+
_rpcKillProcess: (pid) => this.remoteRpc('killProcess', [pid], ProcessControlResultSchema),
|
|
273
|
+
_rpcWriteProcessInput: (pid, data) => this.remoteRpc('writeProcessInput', [pid, data], ProcessControlResultSchema),
|
|
274
|
+
_rpcEndProcessInput: (pid) => this.remoteRpc('endProcessInput', [pid], ProcessControlResultSchema),
|
|
275
|
+
_rpcResizeProcess: (pid, size) => this.remoteRpc('resizeProcess', [pid, size], ProcessControlResultSchema),
|
|
276
|
+
_rpcSignalProcess: (pid, signal) => this.remoteRpc('signalProcess', [pid, signal], ProcessControlResultSchema),
|
|
277
|
+
_rpcProcessLogs: (pid, options) => this.remoteRpc('processLogs', [pid, options], ProcessLogsResultSchema),
|
|
278
|
+
_rpcListPorts: () => this.remoteRpc('listPorts', [], z.array(PortSchema)),
|
|
279
|
+
_rpcExposePort: (port) => this.remoteRpc('exposePort', [port], ExposedPortSchema),
|
|
280
|
+
_rpcUnexposePort: (port) => this.remoteRpc('unexposePort', [port], UnexposedPortSchema),
|
|
281
|
+
_rpcDestroy: (options) => this.remoteRpc('destroy', [options], DestroyResultSchema),
|
|
119
282
|
};
|
|
120
283
|
}
|
|
121
|
-
async remoteRpc(op, args) {
|
|
284
|
+
async remoteRpc(op, args, resultSchema) {
|
|
122
285
|
if (this.target.kind !== 'remote') {
|
|
123
286
|
throw new Error('Nimbus internal error: remoteRpc called on non-remote target');
|
|
124
287
|
}
|
|
@@ -153,32 +316,40 @@ export class NimbusSandbox {
|
|
|
153
316
|
});
|
|
154
317
|
}
|
|
155
318
|
}
|
|
156
|
-
|
|
157
|
-
|
|
319
|
+
const success = RemoteRpcSuccessSchema.safeParse(payload);
|
|
320
|
+
if (!response.ok || !success.success) {
|
|
321
|
+
const failure = RemoteRpcFailureSchema.safeParse(payload);
|
|
322
|
+
const message = failure.success
|
|
323
|
+
? failure.data.error ?? failure.data.message ?? `Nimbus remote API request failed (${response.status})`
|
|
324
|
+
: `Nimbus remote API request failed (${response.status})`;
|
|
158
325
|
throw new NimbusRemoteError(message, {
|
|
159
326
|
status: response.status,
|
|
160
|
-
code:
|
|
327
|
+
code: failure.success ? failure.data.code : undefined,
|
|
161
328
|
body: payload,
|
|
162
329
|
});
|
|
163
330
|
}
|
|
164
|
-
return decodeWire(
|
|
331
|
+
return resultSchema.parse(decodeWire(success.data.result));
|
|
165
332
|
}
|
|
166
333
|
async ready() {
|
|
167
334
|
if (!this.readyPromise) {
|
|
168
335
|
const preinstall = this.profile.runtimes?.preinstall ?? [];
|
|
169
336
|
for (const spec of preinstall)
|
|
170
337
|
this.assertRuntimeAllowed(spec, 'preinstall');
|
|
171
|
-
this.readyPromise = this.stub()._rpcReady({ preinstall }).then(() => undefined);
|
|
338
|
+
this.readyPromise = this.rpc(this.stub()._rpcReady({ preinstall })).then(() => undefined);
|
|
172
339
|
}
|
|
173
340
|
return this.readyPromise;
|
|
174
341
|
}
|
|
175
342
|
async exec(command, options = {}) {
|
|
176
343
|
await this.ready();
|
|
177
|
-
return this.stub()._rpcExec(command, this.execOptions(options));
|
|
344
|
+
return this.rpc(this.stub()._rpcExec(command, this.execOptions(options)));
|
|
178
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* Start a command in the background. Returns as soon as the process has a
|
|
348
|
+
* pid — it does not wait for the command to finish.
|
|
349
|
+
*/
|
|
179
350
|
async startProcess(command, options = {}) {
|
|
180
351
|
await this.ready();
|
|
181
|
-
return this.stub()._rpcStartProcess(command, this.execOptions(options));
|
|
352
|
+
return this.rpc(this.stub()._rpcStartProcess(command, this.execOptions(options)));
|
|
182
353
|
}
|
|
183
354
|
async runCode(code, options = {}) {
|
|
184
355
|
const language = options.language ?? 'javascript';
|
|
@@ -186,110 +357,164 @@ export class NimbusSandbox {
|
|
|
186
357
|
this.assertRuntimeAllowed(language, options.install === 'ifMissing' ? 'onDemand' : 'use');
|
|
187
358
|
}
|
|
188
359
|
await this.ready();
|
|
189
|
-
return this.stub()._rpcRunCode(code, {
|
|
360
|
+
return this.rpc(this.stub()._rpcRunCode(code, {
|
|
190
361
|
...this.execOptions(options),
|
|
191
362
|
language,
|
|
192
363
|
install: options.install ?? 'never',
|
|
193
|
-
});
|
|
364
|
+
}));
|
|
194
365
|
}
|
|
195
366
|
async destroy(options = {}) {
|
|
196
367
|
this.readyPromise = null;
|
|
197
|
-
return this.stub()._rpcDestroy(options);
|
|
368
|
+
return this.rpc(this.stub()._rpcDestroy(options));
|
|
198
369
|
}
|
|
199
370
|
files = {
|
|
200
371
|
read: async (path) => {
|
|
201
372
|
await this.ready();
|
|
202
|
-
return this.stub()._rpcReadFile(path);
|
|
373
|
+
return this.rpc(this.stub()._rpcReadFile(path));
|
|
203
374
|
},
|
|
204
375
|
readBytes: async (path) => {
|
|
205
376
|
await this.ready();
|
|
206
|
-
return this.stub()._rpcReadFileBytes(path);
|
|
377
|
+
return this.rpc(this.stub()._rpcReadFileBytes(path));
|
|
207
378
|
},
|
|
208
379
|
write: async (path, content) => {
|
|
209
380
|
await this.ready();
|
|
210
|
-
return this.stub()._rpcWriteFile(path, content);
|
|
381
|
+
return this.rpc(this.stub()._rpcWriteFile(path, content));
|
|
211
382
|
},
|
|
212
383
|
stat: async (path) => {
|
|
213
384
|
await this.ready();
|
|
214
|
-
return this.stub()._rpcStat(path);
|
|
385
|
+
return this.rpc(this.stub()._rpcStat(path));
|
|
386
|
+
},
|
|
387
|
+
/** stat without following a symlink leaf. */
|
|
388
|
+
lstat: async (path) => {
|
|
389
|
+
await this.ready();
|
|
390
|
+
return this.rpc(this.stub()._rpcLstat(path));
|
|
391
|
+
},
|
|
392
|
+
rename: async (from, to) => {
|
|
393
|
+
await this.ready();
|
|
394
|
+
return this.rpc(this.stub()._rpcRename(from, to));
|
|
395
|
+
},
|
|
396
|
+
chmod: async (path, mode) => {
|
|
397
|
+
await this.ready();
|
|
398
|
+
return this.rpc(this.stub()._rpcChmod(path, mode));
|
|
399
|
+
},
|
|
400
|
+
/** Read `length` bytes at `offset` without materializing the whole file. */
|
|
401
|
+
readRange: async (path, offset, length) => {
|
|
402
|
+
await this.ready();
|
|
403
|
+
return this.rpc(this.stub()._rpcFsReadRange(path, offset, length));
|
|
215
404
|
},
|
|
216
405
|
list: async (path = this.root) => {
|
|
217
406
|
await this.ready();
|
|
218
|
-
return this.stub()._rpcReaddir(path);
|
|
407
|
+
return this.rpc(this.stub()._rpcReaddir(path));
|
|
219
408
|
},
|
|
220
409
|
mkdir: async (path) => {
|
|
221
410
|
await this.ready();
|
|
222
|
-
return this.stub()._rpcMkdir(path);
|
|
411
|
+
return this.rpc(this.stub()._rpcMkdir(path));
|
|
223
412
|
},
|
|
224
413
|
exists: async (path) => {
|
|
225
414
|
await this.ready();
|
|
226
|
-
return this.stub()._rpcExists(path);
|
|
415
|
+
return this.rpc(this.stub()._rpcExists(path));
|
|
227
416
|
},
|
|
228
417
|
delete: async (path, options = {}) => {
|
|
229
418
|
await this.ready();
|
|
230
|
-
return this.stub()._rpcDeleteFile(path, options);
|
|
419
|
+
return this.rpc(this.stub()._rpcDeleteFile(path, options));
|
|
231
420
|
},
|
|
232
421
|
};
|
|
233
422
|
runtimes = {
|
|
234
423
|
available: async () => {
|
|
235
424
|
await this.ready();
|
|
236
|
-
return (await this.stub()._rpcListRuntimes()).available;
|
|
425
|
+
return (await this.rpc(this.stub()._rpcListRuntimes())).available;
|
|
237
426
|
},
|
|
238
427
|
installed: async () => {
|
|
239
428
|
await this.ready();
|
|
240
|
-
return (await this.stub()._rpcListRuntimes()).installed;
|
|
429
|
+
return (await this.rpc(this.stub()._rpcListRuntimes())).installed;
|
|
241
430
|
},
|
|
242
431
|
list: async () => {
|
|
243
432
|
await this.ready();
|
|
244
|
-
return this.stub()._rpcListRuntimes();
|
|
433
|
+
return this.rpc(this.stub()._rpcListRuntimes());
|
|
245
434
|
},
|
|
246
435
|
install: async (spec, options = {}) => {
|
|
247
436
|
this.assertRuntimeAllowed(spec, 'onDemand');
|
|
248
437
|
await this.ready();
|
|
249
|
-
return this.stub()._rpcInstallRuntime(spec, options);
|
|
438
|
+
return this.rpc(this.stub()._rpcInstallRuntime(spec, options));
|
|
250
439
|
},
|
|
251
440
|
ensure: async (specs, options = {}) => {
|
|
252
441
|
const list = Array.isArray(specs) ? specs : [specs];
|
|
253
442
|
for (const spec of list)
|
|
254
443
|
this.assertRuntimeAllowed(spec, 'onDemand');
|
|
255
444
|
await this.ready();
|
|
256
|
-
return this.stub()._rpcEnsureRuntimes(list, options);
|
|
445
|
+
return this.rpc(this.stub()._rpcEnsureRuntimes(list, options));
|
|
257
446
|
},
|
|
258
447
|
};
|
|
259
448
|
processes = {
|
|
260
449
|
list: async () => {
|
|
261
450
|
await this.ready();
|
|
262
|
-
return this.stub()._rpcListProcesses();
|
|
451
|
+
return this.rpc(this.stub()._rpcListProcesses());
|
|
263
452
|
},
|
|
264
453
|
kill: async (pid) => {
|
|
265
454
|
await this.ready();
|
|
266
|
-
return this.stub()._rpcKillProcess(pid);
|
|
455
|
+
return this.rpc(this.stub()._rpcKillProcess(pid));
|
|
456
|
+
},
|
|
457
|
+
write: async (pid, data) => {
|
|
458
|
+
await this.ready();
|
|
459
|
+
return this.rpc(this.stub()._rpcWriteProcessInput(pid, data));
|
|
460
|
+
},
|
|
461
|
+
endInput: async (pid) => {
|
|
462
|
+
await this.ready();
|
|
463
|
+
return this.rpc(this.stub()._rpcEndProcessInput(pid));
|
|
464
|
+
},
|
|
465
|
+
resize: async (pid, size) => {
|
|
466
|
+
await this.ready();
|
|
467
|
+
return this.rpc(this.stub()._rpcResizeProcess(pid, size));
|
|
468
|
+
},
|
|
469
|
+
signal: async (pid, signal) => {
|
|
470
|
+
await this.ready();
|
|
471
|
+
return this.rpc(this.stub()._rpcSignalProcess(pid, signal));
|
|
267
472
|
},
|
|
268
473
|
logs: async (pid, options = {}) => {
|
|
269
474
|
await this.ready();
|
|
270
|
-
return this.stub()._rpcProcessLogs(pid, options);
|
|
475
|
+
return this.rpc(this.stub()._rpcProcessLogs(pid, options));
|
|
476
|
+
},
|
|
477
|
+
attach: (pid, options = {}) => {
|
|
478
|
+
return new NimbusProcessAttachment(this, pid, options);
|
|
271
479
|
},
|
|
272
480
|
};
|
|
273
481
|
ports = {
|
|
274
482
|
list: async () => {
|
|
275
483
|
await this.ready();
|
|
276
|
-
return this.stub()._rpcListPorts();
|
|
484
|
+
return this.rpc(this.stub()._rpcListPorts());
|
|
277
485
|
},
|
|
278
486
|
expose: async (port) => {
|
|
279
487
|
await this.ready();
|
|
280
|
-
const result = await this.stub()._rpcExposePort(port);
|
|
488
|
+
const result = await this.rpc(this.stub()._rpcExposePort(port));
|
|
281
489
|
return { ...result, url: this.portUrl(port) };
|
|
282
490
|
},
|
|
283
491
|
unexpose: async (port) => {
|
|
284
492
|
await this.ready();
|
|
285
|
-
return this.stub()._rpcUnexposePort(port);
|
|
493
|
+
return this.rpc(this.stub()._rpcUnexposePort(port));
|
|
286
494
|
},
|
|
287
495
|
url: (port) => this.portUrl(port),
|
|
288
496
|
};
|
|
289
497
|
tools(options = {}) {
|
|
290
498
|
const namespace = options.namespace ?? this.profile.tools?.namespace ?? 'nimbus';
|
|
291
499
|
const kind = options.kind ?? this.profile.tools?.kind ?? 'nimbus';
|
|
292
|
-
const callPath = (input) =>
|
|
500
|
+
const callPath = (input) => {
|
|
501
|
+
if (typeof input === 'string')
|
|
502
|
+
return input;
|
|
503
|
+
return ToolPathInputSchema.parse(input).path ?? '';
|
|
504
|
+
};
|
|
505
|
+
const writeFileInput = (input) => {
|
|
506
|
+
const parsed = ToolWriteFileInputSchema.parse(input);
|
|
507
|
+
return {
|
|
508
|
+
path: parsed.path ?? '',
|
|
509
|
+
content: parsed.content ?? parsed.data ?? '',
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
const deleteFileInput = (input) => {
|
|
513
|
+
if (typeof input === 'string')
|
|
514
|
+
return { path: input, recursive: false };
|
|
515
|
+
const parsed = ToolDeleteFileInputSchema.parse(input);
|
|
516
|
+
return { path: parsed.path ?? '', recursive: parsed.recursive === true };
|
|
517
|
+
};
|
|
293
518
|
return {
|
|
294
519
|
name: options.name ?? namespace,
|
|
295
520
|
kind,
|
|
@@ -301,13 +526,23 @@ export class NimbusSandbox {
|
|
|
301
526
|
exec: { execute: (command, opts) => this.exec(command, opts) },
|
|
302
527
|
runCode: { execute: (code, opts) => this.runCode(code, opts) },
|
|
303
528
|
readFile: { execute: (input) => this.files.read(callPath(input)) },
|
|
304
|
-
writeFile: { execute: (input) =>
|
|
529
|
+
writeFile: { execute: (input) => {
|
|
530
|
+
const parsed = writeFileInput(input);
|
|
531
|
+
return this.files.write(parsed.path, parsed.content);
|
|
532
|
+
} },
|
|
305
533
|
listFiles: { execute: (input = this.root) => this.files.list(callPath(input) || this.root) },
|
|
306
534
|
readdir: { execute: (input = this.root) => this.files.list(callPath(input) || this.root) },
|
|
307
|
-
deleteFile: { execute: (input) =>
|
|
535
|
+
deleteFile: { execute: (input) => {
|
|
536
|
+
const parsed = deleteFileInput(input);
|
|
537
|
+
return this.files.delete(parsed.path, { recursive: parsed.recursive });
|
|
538
|
+
} },
|
|
308
539
|
exists: { execute: (input) => this.files.exists(callPath(input)) },
|
|
309
540
|
startProcess: { execute: (command, opts) => this.startProcess(command, opts) },
|
|
310
541
|
killProcess: { execute: (input) => this.processes.kill(typeof input === 'number' ? input : input.pid) },
|
|
542
|
+
writeProcessInput: { execute: (input) => this.processes.write(input.pid, input.data) },
|
|
543
|
+
endProcessInput: { execute: (input) => this.processes.endInput(typeof input === 'number' ? input : input.pid) },
|
|
544
|
+
resizeProcess: { execute: (input) => this.processes.resize(input.pid, { columns: input.columns, rows: input.rows }) },
|
|
545
|
+
signalProcess: { execute: (input) => this.processes.signal(input.pid, input.signal) },
|
|
311
546
|
logs: { execute: (input) => this.processes.logs(typeof input === 'number' ? input : input.pid, typeof input === 'number' ? {} : input) },
|
|
312
547
|
exposePort: { execute: (input) => this.ports.expose(typeof input === 'number' ? input : input.port) },
|
|
313
548
|
unexposePort: { execute: (input) => this.ports.unexpose(typeof input === 'number' ? input : input.port) },
|
|
@@ -331,18 +566,29 @@ export class NimbusSandbox {
|
|
|
331
566
|
'net_inbound',
|
|
332
567
|
'process_spawn',
|
|
333
568
|
'process_long',
|
|
569
|
+
'process_attached_stdio',
|
|
570
|
+
'terminal_resize',
|
|
571
|
+
'ansi_output',
|
|
334
572
|
];
|
|
335
573
|
if (hasRuntime('python'))
|
|
336
574
|
caps.push('python');
|
|
575
|
+
if (hasRuntime('ruby'))
|
|
576
|
+
caps.push('ruby');
|
|
337
577
|
if (hasRuntime('clang'))
|
|
338
|
-
caps.push('
|
|
578
|
+
caps.push('wasi', 'clang_wasi');
|
|
339
579
|
return caps;
|
|
340
580
|
}
|
|
341
581
|
execOptions(options) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
582
|
+
const normalized = { ...options };
|
|
583
|
+
if (normalized.shellId) {
|
|
584
|
+
// A named shell owns its cwd, so defaulting one here would reset it on
|
|
585
|
+
// every call. The sandbox root is only where a NEW shell starts.
|
|
586
|
+
normalized.shellRoot = this.root;
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
normalized.cwd ??= this.root;
|
|
590
|
+
}
|
|
591
|
+
return normalized;
|
|
346
592
|
}
|
|
347
593
|
assertRuntimeAllowed(spec, action) {
|
|
348
594
|
const policy = this.profile.runtimes;
|
|
@@ -358,7 +604,20 @@ export class NimbusSandbox {
|
|
|
358
604
|
throw new Error(`Nimbus runtime '${name}' is not preinstalled and on-demand runtime installs are disabled by sandbox profile '${this.profileName}'`);
|
|
359
605
|
}
|
|
360
606
|
}
|
|
607
|
+
/**
|
|
608
|
+
* Browser-facing URL for an exposed port, or undefined when the deployment
|
|
609
|
+
* is not addressable (no `endpoint`, no configured preview base).
|
|
610
|
+
*
|
|
611
|
+
* The URL carries NO credential. On a deployment with auth enforced it is
|
|
612
|
+
* the destination, not the ticket: the session mints a single-use attach
|
|
613
|
+
* token for it at `GET /s/<id>/api/preview-url?port=<n>`, which is what the
|
|
614
|
+
* session shell opens and what an embedder should hand to a browser.
|
|
615
|
+
*/
|
|
361
616
|
portUrl(port) {
|
|
617
|
+
const hostSuffix = this.config.previewHostSuffix;
|
|
618
|
+
if (hostSuffix && !this.profile.preview?.pathStyle && isPreviewHostSafeSid(this.id)) {
|
|
619
|
+
return `https://${buildPreviewHost(this.id, port, hostSuffix)}/`;
|
|
620
|
+
}
|
|
362
621
|
const explicit = this.profile.preview?.baseUrl;
|
|
363
622
|
if (explicit) {
|
|
364
623
|
const base = trimTrailingSlashes(explicit.replace('{sessionId}', encodeURIComponent(this.id)));
|
|
@@ -369,6 +628,81 @@ export class NimbusSandbox {
|
|
|
369
628
|
return undefined;
|
|
370
629
|
return `${endpoint}/s/${encodeURIComponent(this.id)}/port/${port}/`;
|
|
371
630
|
}
|
|
631
|
+
async rpc(promise) {
|
|
632
|
+
const value = await promise;
|
|
633
|
+
disposeSdkRpcResult(value);
|
|
634
|
+
return value;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
export class NimbusProcessAttachment {
|
|
638
|
+
sandbox;
|
|
639
|
+
pid;
|
|
640
|
+
options;
|
|
641
|
+
cursor = null;
|
|
642
|
+
constructor(sandbox, pid, options = {}) {
|
|
643
|
+
this.sandbox = sandbox;
|
|
644
|
+
this.pid = pid;
|
|
645
|
+
this.options = options;
|
|
646
|
+
}
|
|
647
|
+
async write(data) {
|
|
648
|
+
return this.sandbox.processes.write(this.pid, data);
|
|
649
|
+
}
|
|
650
|
+
async endInput() {
|
|
651
|
+
return this.sandbox.processes.endInput(this.pid);
|
|
652
|
+
}
|
|
653
|
+
async resize(size) {
|
|
654
|
+
return this.sandbox.processes.resize(this.pid, size);
|
|
655
|
+
}
|
|
656
|
+
async signal(signal) {
|
|
657
|
+
return this.sandbox.processes.signal(this.pid, signal);
|
|
658
|
+
}
|
|
659
|
+
async kill() {
|
|
660
|
+
return this.sandbox.processes.kill(this.pid);
|
|
661
|
+
}
|
|
662
|
+
async logs(options = {}) {
|
|
663
|
+
const result = await this.sandbox.processes.logs(this.pid, options);
|
|
664
|
+
this.cursor = result.cursor;
|
|
665
|
+
return result;
|
|
666
|
+
}
|
|
667
|
+
stream(options = {}) {
|
|
668
|
+
const attach = this;
|
|
669
|
+
const pollIntervalMs = boundedPollInterval(options.pollIntervalMs ?? this.options.pollIntervalMs);
|
|
670
|
+
const signal = options.signal ?? this.options.signal;
|
|
671
|
+
const initialLines = options.lines ?? this.options.lines;
|
|
672
|
+
const initialBytes = options.bytes ?? this.options.bytes;
|
|
673
|
+
return {
|
|
674
|
+
async *[Symbol.asyncIterator]() {
|
|
675
|
+
if (signal?.aborted)
|
|
676
|
+
return;
|
|
677
|
+
let cursor = attach.cursor;
|
|
678
|
+
if (cursor === null) {
|
|
679
|
+
const initial = await attach.logs({
|
|
680
|
+
...(initialBytes !== undefined ? { bytes: initialBytes } : {}),
|
|
681
|
+
...(initialBytes === undefined && initialLines !== undefined ? { lines: initialLines } : {}),
|
|
682
|
+
});
|
|
683
|
+
cursor = initial.cursor;
|
|
684
|
+
for (const chunk of initial.chunks)
|
|
685
|
+
yield chunk;
|
|
686
|
+
if (initial.exit || signal?.aborted)
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
while (!signal?.aborted) {
|
|
690
|
+
await sleep(pollIntervalMs, signal);
|
|
691
|
+
if (signal?.aborted)
|
|
692
|
+
return;
|
|
693
|
+
const next = await attach.logs({ cursor });
|
|
694
|
+
cursor = next.cursor;
|
|
695
|
+
for (const chunk of next.chunks)
|
|
696
|
+
yield chunk;
|
|
697
|
+
if (next.exit)
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
[Symbol.asyncIterator]() {
|
|
704
|
+
return this.stream()[Symbol.asyncIterator]();
|
|
705
|
+
}
|
|
372
706
|
}
|
|
373
707
|
function idComponent(value, field) {
|
|
374
708
|
const text = String(value);
|
|
@@ -391,6 +725,29 @@ function isIdComponent(value) {
|
|
|
391
725
|
}
|
|
392
726
|
return true;
|
|
393
727
|
}
|
|
728
|
+
function boundedPollInterval(value) {
|
|
729
|
+
if (!Number.isFinite(value))
|
|
730
|
+
return 100;
|
|
731
|
+
return Math.max(25, Math.min(5000, Math.floor(Number(value))));
|
|
732
|
+
}
|
|
733
|
+
function sleep(ms, signal) {
|
|
734
|
+
if (signal?.aborted)
|
|
735
|
+
return Promise.resolve();
|
|
736
|
+
return new Promise((resolve) => {
|
|
737
|
+
let done = false;
|
|
738
|
+
let timer;
|
|
739
|
+
const finish = () => {
|
|
740
|
+
if (done)
|
|
741
|
+
return;
|
|
742
|
+
done = true;
|
|
743
|
+
clearTimeout(timer);
|
|
744
|
+
signal?.removeEventListener('abort', finish);
|
|
745
|
+
resolve();
|
|
746
|
+
};
|
|
747
|
+
timer = setTimeout(finish, ms);
|
|
748
|
+
signal?.addEventListener('abort', finish, { once: true });
|
|
749
|
+
});
|
|
750
|
+
}
|
|
394
751
|
function isNimbusTarget(value) {
|
|
395
752
|
return !!value && typeof value === 'object' && 'kind' in value;
|
|
396
753
|
}
|
|
@@ -413,6 +770,22 @@ function trimTrailingSlashes(value) {
|
|
|
413
770
|
end--;
|
|
414
771
|
return value.slice(0, end);
|
|
415
772
|
}
|
|
773
|
+
function disposeSdkRpcResult(value) {
|
|
774
|
+
if ((typeof value !== 'object' && typeof value !== 'function') || value === null)
|
|
775
|
+
return;
|
|
776
|
+
const disposerKey = Symbol.dispose;
|
|
777
|
+
if (!disposerKey)
|
|
778
|
+
return;
|
|
779
|
+
const disposer = Reflect.get(value, disposerKey);
|
|
780
|
+
if (typeof disposer !== 'function')
|
|
781
|
+
return;
|
|
782
|
+
try {
|
|
783
|
+
Reflect.apply(disposer, value, []);
|
|
784
|
+
}
|
|
785
|
+
catch {
|
|
786
|
+
// Disposal only releases Worker RPC bookkeeping. Preserve SDK behavior.
|
|
787
|
+
}
|
|
788
|
+
}
|
|
416
789
|
async function resolveHeaders(input) {
|
|
417
790
|
if (!input)
|
|
418
791
|
return undefined;
|
|
@@ -451,12 +824,9 @@ function encodeWire(value) {
|
|
|
451
824
|
return value;
|
|
452
825
|
}
|
|
453
826
|
function decodeWire(value) {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
&& typeof value.base64 === 'string') {
|
|
458
|
-
return base64ToBytes(value.base64);
|
|
459
|
-
}
|
|
827
|
+
const bytes = WireBytesSchema.safeParse(value);
|
|
828
|
+
if (bytes.success)
|
|
829
|
+
return base64ToBytes(bytes.data.base64);
|
|
460
830
|
if (Array.isArray(value))
|
|
461
831
|
return value.map(decodeWire);
|
|
462
832
|
if (value && typeof value === 'object') {
|
package/dist/worker.d.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* should import through the SDK so the interactive app and programmatic
|
|
7
7
|
* sandbox APIs share one public package surface.
|
|
8
8
|
*/
|
|
9
|
-
export { NimbusSession, SupervisorRPC, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub, CirrusHmrRPC, base64Utf8, base64Url, base64UrlDecode, createNimbusHandler, decodeJsonBase64Url, encodeJsonBase64Url, generateSessionId, isValidSessionId, issueNimbusToken, pkceChallenge, randomBase64Url, sealJson, sha256Base64Url, unsealJson, verifyNimbusToken, NimbusAuthError, } from '@nimbus-sh/worker';
|
|
10
|
-
export type { NimbusHandler, NimbusHooks, NimbusHookContext, CustomRoutes, CreateNimbusHandlerOptions, NimbusRemoteApiConfig, NimbusRuntimePolicy, NimbusSandboxProfile, NimbusSdkConfig, NimbusSdkRouterConfig, AuthMode, NimbusAuthConfig, NimbusAuthEnv, NimbusTokenClaims, VerifiedNimbusToken, } from '@nimbus-sh/worker';
|
|
9
|
+
export { NimbusSession, SupervisorRPC, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub, CirrusHmrRPC, base64Utf8, base64Url, base64UrlDecode, clearNimbusAgentOAuthCookie, createNimbusHandler, createNimbusAgentOAuthCookie, decodeJsonBase64Url, encodeJsonBase64Url, fetchNimbusCloudflareAccounts, fetchNimbusCloudflareUserInfo, generateSessionId, isNimbusCloudflareAccountId, isNimbusTenantSegment, isPreviewHostRequest, isValidSessionId, issueNimbusToken, loadNimbusAgentOAuthFromRequest, nimbusAgentAuthCookiePath, nimbusAgentRouteContext, NIMBUS_AGENT_AUTH_COOKIE, NIMBUS_AGENT_AUTH_COOKIE_PURPOSE, NIMBUS_AGENT_AUTH_COOKIE_TTL_SECONDS, NIMBUS_CF_OAUTH_AUTH_URL, NIMBUS_CF_OAUTH_TOKEN_URL, NIMBUS_CF_OAUTH_USERINFO_URL, NIMBUS_CLOUDFLARE_API, pkceChallenge, randomBase64Url, readNimbusAgentCookieSecret, readNimbusCookie, requestNimbusCloudflareOAuthToken, sealJson, serializeNimbusCookie, sha256Base64Url, unsealJson, verifyNimbusToken, NimbusAuthError, } from '@nimbus-sh/worker';
|
|
10
|
+
export type { NimbusHandler, NimbusHooks, NimbusHookContext, CustomRoutes, CreateNimbusHandlerOptions, NimbusRemoteApiConfig, NimbusRuntimePolicy, NimbusSandboxProfile, NimbusSdkConfig, NimbusSdkRouterConfig, AuthMode, NimbusAuthConfig, NimbusAuthEnv, NimbusAgentOAuthCookie, NimbusCloudflareAccount, NimbusTokenClaims, VerifiedNimbusToken, } from '@nimbus-sh/worker';
|
|
11
11
|
//# sourceMappingURL=worker.d.ts.map
|
package/dist/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,QAAQ,EACR,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,eAAe,EACf,2BAA2B,EAC3B,mBAAmB,EACnB,4BAA4B,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,iBAAiB,EACjB,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,+BAA+B,EAC/B,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,gCAAgC,EAChC,oCAAoC,EACpC,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,2BAA2B,EAC3B,gBAAgB,EAChB,iCAAiC,EACjC,QAAQ,EACR,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC"}
|
package/dist/worker.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* should import through the SDK so the interactive app and programmatic
|
|
7
7
|
* sandbox APIs share one public package surface.
|
|
8
8
|
*/
|
|
9
|
-
export { NimbusSession, SupervisorRPC, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub, CirrusHmrRPC, base64Utf8, base64Url, base64UrlDecode, createNimbusHandler, decodeJsonBase64Url, encodeJsonBase64Url, generateSessionId, isValidSessionId, issueNimbusToken, pkceChallenge, randomBase64Url, sealJson, sha256Base64Url, unsealJson, verifyNimbusToken, NimbusAuthError, } from '@nimbus-sh/worker';
|
|
9
|
+
export { NimbusSession, SupervisorRPC, NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker, NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub, CirrusHmrRPC, base64Utf8, base64Url, base64UrlDecode, clearNimbusAgentOAuthCookie, createNimbusHandler, createNimbusAgentOAuthCookie, decodeJsonBase64Url, encodeJsonBase64Url, fetchNimbusCloudflareAccounts, fetchNimbusCloudflareUserInfo, generateSessionId, isNimbusCloudflareAccountId, isNimbusTenantSegment, isPreviewHostRequest, isValidSessionId, issueNimbusToken, loadNimbusAgentOAuthFromRequest, nimbusAgentAuthCookiePath, nimbusAgentRouteContext, NIMBUS_AGENT_AUTH_COOKIE, NIMBUS_AGENT_AUTH_COOKIE_PURPOSE, NIMBUS_AGENT_AUTH_COOKIE_TTL_SECONDS, NIMBUS_CF_OAUTH_AUTH_URL, NIMBUS_CF_OAUTH_TOKEN_URL, NIMBUS_CF_OAUTH_USERINFO_URL, NIMBUS_CLOUDFLARE_API, pkceChallenge, randomBase64Url, readNimbusAgentCookieSecret, readNimbusCookie, requestNimbusCloudflareOAuthToken, sealJson, serializeNimbusCookie, sha256Base64Url, unsealJson, verifyNimbusToken, NimbusAuthError, } from '@nimbus-sh/worker';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimbus-sh/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Nimbus SDK — Worker embedder, programmatic sandboxes, token mint, and client helpers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -72,14 +72,18 @@
|
|
|
72
72
|
"typecheck": "tsc --noEmit"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@nimbus-sh/
|
|
75
|
+
"@nimbus-sh/core": "^0.5.0",
|
|
76
|
+
"@nimbus-sh/worker": "^0.3.0"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@cloudflare/workers-types": "^4.20250327.0",
|
|
79
|
-
"@nimbus-sh/worker": "^0.
|
|
80
|
+
"@nimbus-sh/worker": "^0.3.0",
|
|
80
81
|
"typescript": "^5.7.0"
|
|
81
82
|
},
|
|
82
83
|
"publishConfig": {
|
|
83
84
|
"access": "public"
|
|
85
|
+
},
|
|
86
|
+
"dependencies": {
|
|
87
|
+
"zod": "^4.4.3"
|
|
84
88
|
}
|
|
85
89
|
}
|