disk 0.10.0 → 0.11.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 CHANGED
@@ -89,13 +89,30 @@ const sandbox = await client.sandboxes.create({
89
89
  memSizeMiB: 8192,
90
90
  });
91
91
 
92
- const result = await sandbox.exec("uname -a");
92
+ const execution = await sandbox.processes.start("uname -a");
93
+ const result = await execution.wait();
93
94
  console.log(result.stdout);
94
95
 
96
+ const terminal = await sandbox.processes.start("codex", {
97
+ terminal: { cols: 120, rows: 40 },
98
+ onOutput: ({ data }) => process.stdout.write(data),
99
+ });
100
+ const processId = terminal.id;
101
+ await terminal.sendInput("Review this repository\n");
102
+ await terminal.resize({ cols: 160, rows: 50 });
103
+ const cursor = terminal.cursor;
104
+ await terminal.disconnect();
105
+
106
+ const resumed = await sandbox.processes.connect(processId, {
107
+ offset: cursor,
108
+ onOutput: ({ data }) => process.stdout.write(data),
109
+ });
110
+ await resumed.kill();
111
+
95
112
  await sandbox.start();
96
113
  await sandbox.resume();
97
114
 
98
- // Return the initial state immediately instead of waiting for completion.
115
+ // Existing exec API for durable control-plane exec records.
99
116
  const runningExec = await sandbox.exec("sleep 60", { wait: false });
100
117
 
101
118
  await sandbox.stop();
@@ -111,10 +128,45 @@ const usingDisk = await client.sandboxes.list({ disk: "dsk-abc123" });
111
128
  Sandboxes support 1–32 vCPUs and 256–65,536 MiB of memory. When omitted,
112
129
  `vcpuCount` defaults to 1 and `memSizeMiB` defaults to 2,048 MiB.
113
130
 
114
- `create`, `start`, `stop`, `pause`, `resume`, `fork`, and `exec` wait for
115
- completion by default. The server handles the initial wait; if its wait budget
116
- expires first, the SDK continues polling. Pass `{ wait: false }` to return as
117
- soon as the operation is accepted.
131
+ `sandbox.processes.start()` always returns a runtime-owned process immediately.
132
+ Pass `terminal: true` when the command needs terminal behavior, or provide
133
+ `{ cols, rows }` for an initial size. Terminal processes merge stdout and stderr
134
+ into `stdout`; non-terminal processes keep the streams separate. Disconnecting
135
+ leaves the process running. Reconnect with `sandbox.processes.connect(id)` to
136
+ replay buffered output from the beginning, or pass `{ offset: process.cursor }`
137
+ to continue where the previous connection stopped. `onOutput` receives raw
138
+ bytes with their stream and absolute offset. Call `closeStdin()` to deliver EOF
139
+ to a non-terminal process. `sendInput()` streams large input as 1 MiB WebSocket
140
+ frames. Set `collectOutput: false` to stream through `onOutput` without
141
+ retaining decoded output in the process handle or result. Resize and kill use
142
+ separate one-shot process controls, so they do not wait behind stdin.
143
+ `kill()` returns after the control is acknowledged; `wait()` observes exit.
144
+ `maxConcurrentExecs` limits attached exec sessions; detached processes and
145
+ one-shot controls do not count. Pausing a sandbox disconnects attachments but
146
+ preserves its processes for reattachment after resume. Processes end when
147
+ their sandbox is stopped or expires.
148
+ The existing `exec` API remains available for durable control-plane exec records.
149
+
150
+ Transfer files through the sandbox process connection without buffering the
151
+ whole file in memory:
152
+
153
+ ```ts
154
+ await sandbox.files.uploadFile(file.stream(), "/workspace/input.tar.gz");
155
+
156
+ const writable = await fileHandle.createWritable();
157
+ await sandbox.files.downloadFile("/workspace/result.json", (chunk) =>
158
+ writable.write(chunk),
159
+ );
160
+ await writable.close();
161
+ ```
162
+
163
+ Downloads request one bounded chunk at a time. A short or empty chunk marks
164
+ end-of-file, so the source does not need to be sized before transfer.
165
+
166
+ `uploadFile()` accepts a `Uint8Array`, `ArrayBuffer`, `Blob`, async iterable, or
167
+ `ReadableStream`. `downloadFile()` passes each chunk to the provided writer and
168
+ waits for it before requesting more data. Uploads replace the remote target only
169
+ after the transfer succeeds.
118
170
 
119
171
  API keys live at the account level, so those helpers are top-level:
120
172
 
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { E as ArchilApiError, a as deleteApiKey, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-DyVzhbAB.mjs";
2
+ import { O as ArchilApiError, a as deleteApiKey, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-Cpv1TIWC.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { Command, Option } from "commander";
5
5
  //#region bin/cli.ts