@miosa/sdk 3.0.0 → 3.0.1
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 +0 -101
- package/dist/index.d.ts +112 -715
- package/dist/index.js +376 -1241
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -55,7 +55,6 @@ await sbx.pause();
|
|
|
55
55
|
| `miosa.sandboxes` | Lightweight code-execution VMs — exec, files, snapshots, previews |
|
|
56
56
|
| `miosa.computers` | Full Linux desktop VMs with desktop control for agents |
|
|
57
57
|
| `miosa.deployments` | Versioned production releases with rollback |
|
|
58
|
-
| `miosa.appDocuments` | Durable generated apps with exact-version review approvals and immutable publication bindings |
|
|
59
58
|
| `miosa.databases` | Managed Postgres / Redis lifecycle |
|
|
60
59
|
| `miosa.storage` | S3-compatible object storage |
|
|
61
60
|
| `miosa.volumes` | Persistent block storage |
|
|
@@ -70,38 +69,6 @@ await sbx.pause();
|
|
|
70
69
|
| `miosa.completions` | OpenAI-compatible chat completions with SSE streaming |
|
|
71
70
|
| `miosa.embeddings` | OpenAI-compatible embedding vectors |
|
|
72
71
|
|
|
73
|
-
## Durable generated apps
|
|
74
|
-
|
|
75
|
-
App Documents persist the generated app contract outside the browser.
|
|
76
|
-
They are workspace-scoped and include the view, declared capabilities, connectors, collections, automations, and component pins.
|
|
77
|
-
Native rendering authority is a separate approval pinned to the current canonical version hash.
|
|
78
|
-
Editing the document changes the hash and invalidates the old approval.
|
|
79
|
-
|
|
80
|
-
```ts
|
|
81
|
-
const app = await miosa.appDocuments.create({
|
|
82
|
-
workspaceId: "workspace-id",
|
|
83
|
-
name: "Clinic triage",
|
|
84
|
-
document: {
|
|
85
|
-
id: crypto.randomUUID(),
|
|
86
|
-
name: "Clinic triage",
|
|
87
|
-
format: "miosa-app/v1",
|
|
88
|
-
view: { kind: "generated", source: "<main>Triage</main>" },
|
|
89
|
-
capabilities: ["computer.exec"],
|
|
90
|
-
collections: ["tickets"],
|
|
91
|
-
connectors: ["linear"],
|
|
92
|
-
automations: [],
|
|
93
|
-
pins: [],
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const approval = await miosa.appDocuments.approveExactVersion(
|
|
98
|
-
app.id,
|
|
99
|
-
"Reviewed for exact release publishing",
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
await miosa.appDocuments.revokeApproval(app.id, approval.id);
|
|
103
|
-
```
|
|
104
|
-
|
|
105
72
|
## Connect vs Egress
|
|
106
73
|
|
|
107
74
|
Use **Connect** when your product needs to manage provider credentials for
|
|
@@ -244,25 +211,7 @@ const result = await sbx.exec.run("python /workspace/app.py");
|
|
|
244
211
|
for await (const event of sbx.exec.stream("tail -f /var/log/app.log")) {
|
|
245
212
|
if ("line" in event) console.log(event.line);
|
|
246
213
|
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
> **`sbx.exec.stream()` vs `computer.exec.stream()` - not the same thing.**
|
|
250
|
-
> They share a name and nothing else, by design:
|
|
251
|
-
>
|
|
252
|
-
> | | `sbx.exec.stream(command)` (Sandbox) | `computer.exec.stream({ command, tty })` (Computer) |
|
|
253
|
-
> |---|---|---|
|
|
254
|
-
> | Transport | SSE, one-way (server → client) | WebSocket, full duplex |
|
|
255
|
-
> | Purpose | Tail output from a batch command | Interactive shell/PTY session |
|
|
256
|
-
> | Input | Takes a fixed command string up front | `sendStdin()` any time after connecting; supports `tty`/`rows`/`cols` |
|
|
257
|
-
> | Event shape | `{ type: "stdout" \| "stderr" \| "exit", ... }` parsed from JSON lines | Raw `Uint8Array` frames over the wire protocol |
|
|
258
|
-
>
|
|
259
|
-
> Use the Sandbox one to watch a log or long-running batch job finish.
|
|
260
|
-
> Use the Computer one to drive an interactive terminal. They will not be
|
|
261
|
-
> merged into one API - a one-way log tail and a duplex PTY session need
|
|
262
|
-
> different guarantees (backpressure, input, framing) that a single shape
|
|
263
|
-
> would blur.
|
|
264
214
|
|
|
265
|
-
```ts
|
|
266
215
|
// Snapshots
|
|
267
216
|
const snap = await sbx.snapshots.create("pre-migration");
|
|
268
217
|
const restored = await sbx.snapshots.restore(snap.id);
|
|
@@ -309,30 +258,6 @@ const deployment = await sbx.deploy({
|
|
|
309
258
|
});
|
|
310
259
|
```
|
|
311
260
|
|
|
312
|
-
To publish the exact snapshot that passed QA instead of whatever the editable
|
|
313
|
-
sandbox holds right now, use `deploySnapshot`. It forks the snapshot into a
|
|
314
|
-
temporary release sandbox, deploys that fork, and destroys it again, so the
|
|
315
|
-
source sandbox is never mutated:
|
|
316
|
-
|
|
317
|
-
```ts
|
|
318
|
-
const snap = await sbx.snapshots.create("qa-approved");
|
|
319
|
-
|
|
320
|
-
const release = await sbx.deploySnapshot(snap.id, {
|
|
321
|
-
name: "clinic-intake",
|
|
322
|
-
outputPath: "/workspace/dist",
|
|
323
|
-
entrypoint: "index.html",
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
console.log(release.source_snapshot_id, release.release_sandbox_id);
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
The result always carries `source_snapshot_id` and `release_sandbox_id` for
|
|
330
|
-
provenance. Pass `{ cleanup: false }` as the third argument to keep the release
|
|
331
|
-
sandbox for inspection. If the release sandbox could not be destroyed, the
|
|
332
|
-
deployment still succeeds and `release.release_cleanup_error` explains why; when
|
|
333
|
-
the deploy itself fails and the release sandbox survives, the thrown error
|
|
334
|
-
carries the same fields so the leftover sandbox can be cleaned up by id.
|
|
335
|
-
|
|
336
261
|
For workspace App Engine, publish from the same sandbox but choose the
|
|
337
262
|
App Engine target:
|
|
338
263
|
|
|
@@ -445,32 +370,6 @@ const miosa = new Miosa({
|
|
|
445
370
|
});
|
|
446
371
|
```
|
|
447
372
|
|
|
448
|
-
### Two sandbox streams need the sandboxes base URL
|
|
449
|
-
|
|
450
|
-
The API serves two routers, selected by Host header. Two SSE routes exist
|
|
451
|
-
only on the `sandboxes.miosa.ai` router, so they return `404` against the
|
|
452
|
-
default `api.miosa.ai` base URL:
|
|
453
|
-
|
|
454
|
-
| Method | Route |
|
|
455
|
-
|---|---|
|
|
456
|
-
| `sbx.files.watch()` | `GET /sandboxes/{id}/files/watch` |
|
|
457
|
-
| `sbx.processes.stream(pid)` | `GET /sandboxes/{id}/processes/{pid}/stream` |
|
|
458
|
-
|
|
459
|
-
Both are implemented server-side; only the platform router is missing them.
|
|
460
|
-
Point the client at the sandboxes host to use them:
|
|
461
|
-
|
|
462
|
-
```ts
|
|
463
|
-
const miosa = new Miosa({
|
|
464
|
-
apiKey: process.env.MIOSA_API_KEY!,
|
|
465
|
-
baseUrl: "https://sandboxes.miosa.ai/api/v1",
|
|
466
|
-
});
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
The alternative is polling: `sbx.files.list()` / `stat()` instead of
|
|
470
|
-
`watch()`, and `sbx.processes.logs(pid)` instead of `stream(pid)`. Calling
|
|
471
|
-
either against the default base URL raises a `NotFoundError` that names this
|
|
472
|
-
gap rather than a bare `404`.
|
|
473
|
-
|
|
474
373
|
## Links
|
|
475
374
|
|
|
476
375
|
- [Full documentation](https://miosa.ai/docs/sdks/typescript)
|