@miosa/sdk 1.2.3 → 1.2.5
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 +63 -39
- package/dist/index.d.ts +201 -182
- package/dist/index.js +433 -309
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +5 -5
- package/src/index.ts +16 -11
- package/src/resources/admin.ts +0 -11
- package/src/resources/api-keys.ts +0 -16
- package/src/resources/custom_domains.ts +1 -1
- package/src/resources/deployments.test.ts +127 -51
- package/src/resources/deployments.ts +326 -125
- package/src/resources/devices.test.ts +92 -0
- package/src/resources/devices.ts +291 -0
- package/src/resources/sandboxes.test.ts +2 -0
- package/src/resources/sandboxes.ts +4 -0
- package/src/resources/tenant.ts +19 -101
- package/src/resources/webhooks.ts +54 -39
- package/src/types.ts +5 -5
- package/src/resources/docker-deploy.test.ts +0 -102
- package/src/resources/docker-deploy.ts +0 -183
- package/src/resources/governance.test.ts +0 -355
- package/src/resources/governance.ts +0 -528
- package/src/resources/phase1.test.ts +0 -187
- package/src/resources/quotas.ts +0 -77
- package/src/resources/sandbox-processes.ts +0 -112
- package/src/resources/sandbox-shares.ts +0 -83
- package/src/resources/tenant-events.ts +0 -32
- package/src/resources/workspaces.ts +0 -285
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ console.log(result.stdout); // hello from miosa
|
|
|
38
38
|
|
|
39
39
|
// Expose a live preview URL
|
|
40
40
|
const url = await sbx.expose(3000);
|
|
41
|
-
console.log(url); // https://3000-<slug>.sandbox
|
|
41
|
+
console.log(url); // https://3000-<slug>.sandbox.<tenant-domain>
|
|
42
42
|
|
|
43
43
|
await sbx.destroy();
|
|
44
44
|
```
|
|
@@ -47,6 +47,7 @@ await sbx.destroy();
|
|
|
47
47
|
|
|
48
48
|
| Resource | Description |
|
|
49
49
|
|---|---|
|
|
50
|
+
| `miosa.devices` | Agent device facade for routing work across sandboxes, computers, local devices, and Docker Deploy hosts |
|
|
50
51
|
| `miosa.sandboxes` | Lightweight code-execution VMs — exec, files, snapshots, previews |
|
|
51
52
|
| `miosa.computers` | Full Linux desktop VMs for computer-use agents |
|
|
52
53
|
| `miosa.deployments` | Versioned production releases with rollback |
|
|
@@ -61,6 +62,29 @@ await sbx.destroy();
|
|
|
61
62
|
| `miosa.completions` | OpenAI-compatible chat completions with SSE streaming |
|
|
62
63
|
| `miosa.embeddings` | OpenAI-compatible embedding vectors |
|
|
63
64
|
|
|
65
|
+
## Agent device routing
|
|
66
|
+
|
|
67
|
+
Use the device facade before launching an orchestration workflow. It keeps the
|
|
68
|
+
product model explicit without hiding the lower-level APIs:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const catalog = miosa.devices.catalog();
|
|
72
|
+
const inventory = await miosa.devices.list();
|
|
73
|
+
|
|
74
|
+
// Default for code/build/test/preview work:
|
|
75
|
+
const sbx = await miosa.sandboxes.create({
|
|
76
|
+
templateId: "nextjs",
|
|
77
|
+
timeoutSec: 3600,
|
|
78
|
+
});
|
|
79
|
+
await sbx.exec.run("codex 'build and test the requested app'", {
|
|
80
|
+
cwd: "/workspace",
|
|
81
|
+
timeout: 1800,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Use Computers when the agent needs a full browser/desktop:
|
|
85
|
+
const desktop = await miosa.computers.create({ name: "browser-agent" });
|
|
86
|
+
```
|
|
87
|
+
|
|
64
88
|
## Sandbox sub-resources
|
|
65
89
|
|
|
66
90
|
Every `Sandbox` instance exposes composable sub-resources:
|
|
@@ -99,36 +123,6 @@ await sbx.pause();
|
|
|
99
123
|
await sbx.resume();
|
|
100
124
|
```
|
|
101
125
|
|
|
102
|
-
## Publish from sandbox
|
|
103
|
-
|
|
104
|
-
Preview is mutable; publish creates a durable deployment version. Static output
|
|
105
|
-
is served by MIOSA's artifact plane. Dynamic apps run in reconciled runtime VMs.
|
|
106
|
-
|
|
107
|
-
```ts
|
|
108
|
-
const deployment = await sbx.deploy({
|
|
109
|
-
name: "clinic-intake",
|
|
110
|
-
outputPath: "/workspace/dist",
|
|
111
|
-
entrypoint: "index.html",
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
console.log(deployment.url ?? deployment.deployment?.public_url);
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
For dynamic/full-stack apps:
|
|
118
|
-
|
|
119
|
-
```ts
|
|
120
|
-
const deployment = await sbx.deploy({
|
|
121
|
-
name: "clinic-intake-api",
|
|
122
|
-
outputPath: "/workspace",
|
|
123
|
-
runCommand: "npm start",
|
|
124
|
-
port: 3000,
|
|
125
|
-
domain: "intake.apps.cliniciq.com",
|
|
126
|
-
});
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Always display the server-returned `url` / `public_url`. Do not hardcode
|
|
130
|
-
`preview.miosa.app`, `api.miosa.app`, or `<tenant>.miosa.app`.
|
|
131
|
-
|
|
132
126
|
## Desktop control (Computers)
|
|
133
127
|
|
|
134
128
|
```ts
|
|
@@ -166,17 +160,47 @@ const sandboxes = await miosa.sandboxes.list({
|
|
|
166
160
|
});
|
|
167
161
|
```
|
|
168
162
|
|
|
169
|
-
|
|
163
|
+
## Docker Deploy
|
|
170
164
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
165
|
+
Use Docker Deploy when a sandbox-built app should run as a container on the
|
|
166
|
+
workspace Docker appliance.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
const templates = await miosa.deployments.listDockerDeployTemplates({
|
|
170
|
+
framework: "nextjs",
|
|
171
|
+
includePreview: true,
|
|
172
|
+
});
|
|
173
|
+
const template = templates[0];
|
|
174
|
+
|
|
175
|
+
await miosa.deployments.ensureDockerDeployHost({
|
|
176
|
+
workspaceId: "workspace-uuid",
|
|
177
|
+
size: "small",
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const sbx = await miosa.sandboxes.create({ templateId: "nextjs" });
|
|
181
|
+
// Build or sync the app into /workspace...
|
|
182
|
+
|
|
183
|
+
const published = await sbx.deployDocker({
|
|
184
|
+
name: "customer-site",
|
|
185
|
+
outputPath: "/workspace",
|
|
186
|
+
port: 3000,
|
|
187
|
+
dockerDeployTemplateId: template.id,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
const deploymentId = String(published.deployment_id ?? published.id);
|
|
191
|
+
const proof = await miosa.deployments.doctorDockerDeploy(deploymentId, {
|
|
192
|
+
probePath: "/",
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
if (!proof.ok) {
|
|
196
|
+
throw new Error(JSON.stringify(proof.checks, null, 2));
|
|
197
|
+
}
|
|
175
198
|
```
|
|
176
199
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
200
|
+
Template responses include app files plus optional `design_md`,
|
|
201
|
+
`design_source_url`, `design_sources`, and `design_reference_presets` so agents
|
|
202
|
+
can generate the app with the same design context they later attach to the
|
|
203
|
+
Docker Deploy publish.
|
|
180
204
|
|
|
181
205
|
## Error handling
|
|
182
206
|
|