disk 1.15.1 → 1.16.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 +33 -2
- package/dist/{archil-CenIy1WD.d.mts → archil-DiHA0VsS.d.mts} +400 -250
- package/dist/{archil-DHPfg1b9.d.cts → archil-Dte6VwUg.d.cts} +400 -250
- package/dist/archil-cli.mjs +4 -4
- package/dist/cli.mjs +2 -2
- package/dist/{disk-command-CusW9mn8.mjs → disk-command-e1AyXrI4.mjs} +3 -3
- package/dist/index.cjs +2731 -2024
- package/dist/index.d.cts +6 -5
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +1 -1
- package/dist/internal/tools.d.cts +1 -1
- package/dist/internal/tools.d.mts +1 -1
- package/dist/node/index.cjs +2731 -2024
- package/dist/node/index.mjs +2732 -2025
- package/dist/sandbox-cli.mjs +3 -3
- package/dist/{sandbox-command-BZys6M2u.mjs → sandbox-command-qj_ZlLev.mjs} +1 -1
- package/dist/{sandbox-options-DkEtNyFE.mjs → sandbox-options-Ck_EAl3Z.mjs} +1 -1
- package/dist/{src-BLxQg4dX.mjs → src-B_nMppCu.mjs} +2733 -2026
- package/dist/tunnel.d.cts +1 -1
- package/dist/tunnel.d.mts +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -186,6 +186,37 @@ await d.removeUser("token", user.identifier!);
|
|
|
186
186
|
await d.delete();
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
+
### Streaming an exec (Node.js)
|
|
190
|
+
|
|
191
|
+
With `stream: true`, `archil.exec()` streams the command's input and output
|
|
192
|
+
while it runs, instead of returning them when it exits. It takes the same
|
|
193
|
+
options as a waiting exec, plus the process options `sandbox.run()` takes, and
|
|
194
|
+
resolves once the command has started with the same handle `sandbox.run()`
|
|
195
|
+
returns:
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
const proc = await archil.exec({
|
|
199
|
+
stream: true,
|
|
200
|
+
command: "python3 train.py",
|
|
201
|
+
disks: { data: d }, // mounted at /mnt/archil/data, as for a waiting exec
|
|
202
|
+
baseImage: "python:3.12-slim",
|
|
203
|
+
vcpuCount: 4,
|
|
204
|
+
memSizeMib: 8192,
|
|
205
|
+
timeoutSeconds: 3600,
|
|
206
|
+
});
|
|
207
|
+
for await (const chunk of proc.output) {
|
|
208
|
+
process.stdout.write(chunk.data);
|
|
209
|
+
}
|
|
210
|
+
const { exitCode } = await proc.wait();
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Send input with `sendInput()` and end it with `closeStdin()`. Streamed execs
|
|
214
|
+
share connections: up to 32 run at once on one, and later ones reuse it, so an
|
|
215
|
+
exec after the first skips connection setup. `kill()` and `disconnect()` both
|
|
216
|
+
stop the command and its VM. `disks` may be empty for a command that needs no
|
|
217
|
+
disk, which takes the `workspace:exec` permission. Streaming needs Node.js or
|
|
218
|
+
Bun, because a browser WebSocket cannot send the API key.
|
|
219
|
+
|
|
189
220
|
### Private certificate authorities (Node.js)
|
|
190
221
|
|
|
191
222
|
For BYOC endpoints signed by a private CA, configure trust on the client:
|
|
@@ -513,8 +544,8 @@ replay buffered output from the beginning, or pass `{ offset: process.cursor }`
|
|
|
513
544
|
to continue where the previous connection stopped. Iterating `output` yields
|
|
514
545
|
raw bytes with their stream and absolute offset; one iterator may consume each
|
|
515
546
|
handle. Call `closeStdin()` to deliver EOF
|
|
516
|
-
to a non-terminal process. `sendInput()`
|
|
517
|
-
|
|
547
|
+
to a non-terminal process. `sendInput()` resolves once the runtime has
|
|
548
|
+
accepted the input, waiting while the process is not reading it. Set `collectOutput: false` to stream through `output` without
|
|
518
549
|
retaining decoded output in the process handle or result. The `onOutput`
|
|
519
550
|
option is deprecated; iterate `output` instead. Resize and kill use
|
|
520
551
|
separate one-shot process controls, so they do not wait behind stdin.
|