@miosa/sdk 1.2.15 → 1.2.17
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 +57 -0
- package/dist/index.d.ts +644 -1
- package/dist/index.js +1162 -404
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,9 +63,46 @@ await sbx.pause();
|
|
|
63
63
|
| `miosa.settings` | Workspace config, branding, BYOK provider keys |
|
|
64
64
|
| `miosa.webhooks` | Outgoing tenant webhooks — CRUD, test, delivery history |
|
|
65
65
|
| `miosa.openComputers` | BYOC host management — register your own machines |
|
|
66
|
+
| `miosa.devices` | Unified device facade for sandbox/computer list, exec, files, previews |
|
|
67
|
+
| `miosa.connectors` | Provider credentials and short-lived runtime tokens |
|
|
68
|
+
| `miosa.runtimeEnv` | Inherited tenant/workspace/project runtime environment variables |
|
|
66
69
|
| `miosa.completions` | OpenAI-compatible chat completions with SSE streaming |
|
|
67
70
|
| `miosa.embeddings` | OpenAI-compatible embedding vectors |
|
|
68
71
|
|
|
72
|
+
## Connect vs Egress
|
|
73
|
+
|
|
74
|
+
Use **Connect** when your product needs to manage provider credentials for
|
|
75
|
+
agents, sandboxes, computers, or deployments. Connect owns the product-level
|
|
76
|
+
contract: connectors, installations, project links, inherited defaults,
|
|
77
|
+
short-lived tokens, white-label attribution, and runtime bindings.
|
|
78
|
+
|
|
79
|
+
Use **Egress** when you need the low-level security boundary: encrypted secret
|
|
80
|
+
storage, outbound host allowlists, placeholder token exchange, and audit logs.
|
|
81
|
+
Egress is the enforcement layer under Connect. Most white-label apps should
|
|
82
|
+
call `miosa.connectors` and runtime binding helpers first; only call
|
|
83
|
+
`miosa.secrets`, `miosa.network`, or `miosa.audit` when you are building
|
|
84
|
+
security/admin controls directly.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
// Product-level credential setup.
|
|
88
|
+
const connector = await miosa.connectors.create("anthropic", {
|
|
89
|
+
name: "workspace-claude",
|
|
90
|
+
scope: "workspace",
|
|
91
|
+
externalWorkspaceId: "clinic-iq",
|
|
92
|
+
value: process.env.ANTHROPIC_API_KEY,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Runtime-level materialization: the sandbox sees ANTHROPIC_API_KEY, but your
|
|
96
|
+
// app does not get the raw provider key back from MIOSA.
|
|
97
|
+
await miosa.connectors.materializeDefaults({
|
|
98
|
+
workspaceId: "workspace-id",
|
|
99
|
+
resourceType: "sandbox",
|
|
100
|
+
resourceId: sbx.id,
|
|
101
|
+
target: "agent",
|
|
102
|
+
externalWorkspaceId: "clinic-iq",
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
69
106
|
## Agent workspaces
|
|
70
107
|
|
|
71
108
|
For AI builders, code assistants, and white-label agent products, the sandbox
|
|
@@ -101,6 +138,26 @@ const preview = await sbx.previews.create(3000);
|
|
|
101
138
|
console.log(preview.url);
|
|
102
139
|
```
|
|
103
140
|
|
|
141
|
+
For platform agents that plan work outside the sandbox and then hand execution
|
|
142
|
+
to a runtime inside the sandbox/computer, use the unified device API:
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
await miosa.devices.writeFile(sbx.id, {
|
|
146
|
+
path: "/workspace/PLAN.md",
|
|
147
|
+
content: "# Build plan\nUse the customer profile and export /workspace/out.",
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const build = await miosa.devices.exec(sbx.id, {
|
|
151
|
+
command: "npm install && npm run build",
|
|
152
|
+
cwd: "/workspace",
|
|
153
|
+
timeoutMs: 600_000,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const artifact = await miosa.devices.readFile(sbx.id, {
|
|
157
|
+
path: "/workspace/out/report.pdf",
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
104
161
|
`createAgentWorkspace()` is a convenience wrapper around `getOrCreate()` with
|
|
105
162
|
builder defaults: a 24-hour activity cap, thirty-minute idle snapshot/pause,
|
|
106
163
|
readiness waiting, 30-day snapshot-retention metadata, keep-last-snapshot
|