@miosa/sdk 1.2.5 → 1.2.6

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.
Files changed (92) hide show
  1. package/README.md +107 -59
  2. package/dist/index.d.ts +331 -202
  3. package/dist/index.js +572 -603
  4. package/dist/index.js.map +1 -1
  5. package/package.json +1 -2
  6. package/src/client.ts +0 -293
  7. package/src/errors.ts +0 -136
  8. package/src/http.test.ts +0 -374
  9. package/src/http.ts +0 -390
  10. package/src/index.ts +0 -569
  11. package/src/resources/admin.ts +0 -348
  12. package/src/resources/analytics.ts +0 -60
  13. package/src/resources/api-keys.ts +0 -119
  14. package/src/resources/audit-log.ts +0 -64
  15. package/src/resources/benchmarks.ts +0 -104
  16. package/src/resources/builder-sessions.ts +0 -75
  17. package/src/resources/channels.ts +0 -143
  18. package/src/resources/checkpoints.ts +0 -225
  19. package/src/resources/command-center.ts +0 -73
  20. package/src/resources/community.ts +0 -103
  21. package/src/resources/completions.ts +0 -104
  22. package/src/resources/computer-auto-stop.ts +0 -43
  23. package/src/resources/computer-env.ts +0 -76
  24. package/src/resources/computer-logs.ts +0 -50
  25. package/src/resources/computer-osa.ts +0 -76
  26. package/src/resources/computer-ports.ts +0 -91
  27. package/src/resources/computer-terminal.ts +0 -61
  28. package/src/resources/computer-volumes.ts +0 -64
  29. package/src/resources/computer.ts +0 -551
  30. package/src/resources/computers.ts +0 -75
  31. package/src/resources/credits.ts +0 -43
  32. package/src/resources/cron-jobs.ts +0 -191
  33. package/src/resources/custom_domains.ts +0 -123
  34. package/src/resources/dashboard.ts +0 -49
  35. package/src/resources/databases.ts +0 -218
  36. package/src/resources/deployments.test.ts +0 -197
  37. package/src/resources/deployments.ts +0 -1208
  38. package/src/resources/desktop.ts +0 -134
  39. package/src/resources/devices.test.ts +0 -92
  40. package/src/resources/devices.ts +0 -291
  41. package/src/resources/egress.test.ts +0 -318
  42. package/src/resources/egressAudit.ts +0 -245
  43. package/src/resources/egressNetwork.ts +0 -450
  44. package/src/resources/egressSecrets.ts +0 -577
  45. package/src/resources/email.ts +0 -212
  46. package/src/resources/embeddings.ts +0 -36
  47. package/src/resources/events.ts +0 -296
  48. package/src/resources/exec.ts +0 -319
  49. package/src/resources/external-keys.ts +0 -79
  50. package/src/resources/files.test.ts +0 -339
  51. package/src/resources/files.ts +0 -220
  52. package/src/resources/flat-custom-domains.ts +0 -127
  53. package/src/resources/functions.ts +0 -178
  54. package/src/resources/health-checks.ts +0 -165
  55. package/src/resources/integrations.ts +0 -183
  56. package/src/resources/mcp.ts +0 -70
  57. package/src/resources/models.ts +0 -45
  58. package/src/resources/network_policy.ts +0 -73
  59. package/src/resources/open-computers/agents.ts +0 -91
  60. package/src/resources/open-computers/apps.ts +0 -102
  61. package/src/resources/open-computers/clusters.ts +0 -88
  62. package/src/resources/open-computers/desktop.ts +0 -34
  63. package/src/resources/open-computers/files.ts +0 -97
  64. package/src/resources/open-computers/hosts.ts +0 -85
  65. package/src/resources/open-computers/index.ts +0 -98
  66. package/src/resources/open-computers/jobs.ts +0 -75
  67. package/src/resources/open-computers/open_computers.test.ts +0 -288
  68. package/src/resources/open-computers/secrets.ts +0 -115
  69. package/src/resources/open-computers/terminal.ts +0 -33
  70. package/src/resources/open-computers/tunnels.ts +0 -87
  71. package/src/resources/open-computers/types.ts +0 -343
  72. package/src/resources/open-computers/workspaces.ts +0 -135
  73. package/src/resources/org-invites.ts +0 -189
  74. package/src/resources/project-auth.ts +0 -142
  75. package/src/resources/project-integrations.ts +0 -133
  76. package/src/resources/provider-defaults.ts +0 -89
  77. package/src/resources/regions.ts +0 -94
  78. package/src/resources/sandbox-templates.ts +0 -195
  79. package/src/resources/sandboxes.live.test.ts +0 -92
  80. package/src/resources/sandboxes.test.ts +0 -655
  81. package/src/resources/sandboxes.ts +0 -1437
  82. package/src/resources/settings.ts +0 -143
  83. package/src/resources/snapshots-standalone.ts +0 -51
  84. package/src/resources/storage.ts +0 -221
  85. package/src/resources/tenant.ts +0 -66
  86. package/src/resources/usage.ts +0 -85
  87. package/src/resources/volumes.ts +0 -117
  88. package/src/resources/webhooks.ts +0 -239
  89. package/src/resources/workspace-invites.ts +0 -188
  90. package/src/resources/workspace-members.test.ts +0 -121
  91. package/src/resources/workspace-members.ts +0 -143
  92. package/src/types.ts +0 -463
package/src/types.ts DELETED
@@ -1,463 +0,0 @@
1
- // ─── Shared primitives ──────────────────────────────────────────────────────
2
-
3
- export type ComputerId = string & { readonly __brand: "ComputerId" };
4
- export type SessionId = string & { readonly __brand: "SessionId" };
5
- export type TenantId = string & { readonly __brand: "TenantId" };
6
-
7
- // ─── Computers ───────────────────────────────────────────────────────────────
8
-
9
- export type ComputerSize = "small" | "medium" | "large";
10
- /**
11
- * Lifecycle states emitted by the control plane.
12
- *
13
- * Canonical states (what the server actually emits):
14
- * provisioning — VM is being created + booted (~30-50s on small tier)
15
- * active — running and reachable (same as legacy "running")
16
- * paused — RAM snapshot on disk, cold start available
17
- * stopped — explicitly halted
18
- * error — terminal failure; destroy and retry
19
- * destroyed — terminal; gone
20
- *
21
- * Legacy aliases (`running`, `starting`, `creating`, `stopping`) are kept
22
- * in the union so older callers still typecheck, but the server will emit
23
- * the canonical names. Treat `active` and `running` as synonymous.
24
- */
25
- export type ComputerStatus =
26
- | "provisioning"
27
- | "active"
28
- | "paused"
29
- | "stopped"
30
- | "error"
31
- | "destroyed"
32
- // legacy — retained for backwards compatibility
33
- | "creating"
34
- | "starting"
35
- | "running"
36
- | "stopping";
37
- /**
38
- * Template slug for the rootfs a computer boots into.
39
- *
40
- * - `miosa-desktop` — full KasmVNC + Xfce GUI (default)
41
- * - `miosa-sandbox` — lightweight code-exec rootfs, no desktop
42
- *
43
- * Additional templates can be added at the platform level; the type is kept
44
- * open so future templates don't require an SDK release.
45
- */
46
- export type ComputerTemplateType =
47
- | "miosa-desktop"
48
- | "miosa-sandbox"
49
- | (string & {});
50
-
51
- /**
52
- * Controls who can access the computer's HTTP preview URL.
53
- *
54
- * - `public` — unauthenticated access to preview paths (default)
55
- * - `tenant` — requires a valid JWT with matching tenant_id
56
- * - `key` — requires a Bearer `msk_u_*` key matching the owner tenant
57
- *
58
- * Sensitive paths (`/api/*`, `/vnc/*`, `/term/*`) are always auth-gated
59
- * regardless of visibility mode.
60
- */
61
- export type ComputerVisibility = "public" | "tenant" | "key";
62
-
63
- export interface ComputerCreateParams {
64
- name: string;
65
- template_type?: ComputerTemplateType;
66
- size?: ComputerSize;
67
- visibility?: ComputerVisibility;
68
- metadata?: Record<string, string>;
69
- }
70
-
71
- export interface ComputerUpdateParams {
72
- name?: string;
73
- visibility?: ComputerVisibility;
74
- metadata?: Record<string, string>;
75
- }
76
-
77
- export interface ComputerData {
78
- id: ComputerId;
79
- name: string;
80
- /**
81
- * URL-safe identifier used in preview URLs:
82
- * `https://{port}-{slug}.sandbox.{preview_domain}`.
83
- * Falls back to the computer id when no slug is assigned.
84
- */
85
- slug: string;
86
- status: ComputerStatus;
87
- template_type: ComputerTemplateType;
88
- size: ComputerSize;
89
- tenant_id: TenantId;
90
- ip_address: string | null;
91
- metadata: Record<string, string>;
92
- /** Controls who can access the HTTP preview URL. Defaults to `"public"`. */
93
- visibility: ComputerVisibility;
94
- /** Public ingress root, e.g. `https://<slug>.sandbox.<preview_domain>`. */
95
- sandbox_url?: string;
96
- /** Tenant's white-label preview/base domain, e.g. `cliniciq.com`. */
97
- preview_domain?: string;
98
- /** KasmVNC URL for desktop templates. */
99
- desktop_url?: string;
100
- created_at: string;
101
- updated_at: string;
102
- }
103
-
104
- // ─── Network Policy ───────────────────────────────────────────────────────────
105
-
106
- export type NetworkPolicyEffect = "allow" | "deny";
107
- export type NetworkPolicyProtocol = "tcp" | "udp" | "any";
108
-
109
- /**
110
- * A single egress rule.
111
- *
112
- * - `effect` — `"allow"` or `"deny"`
113
- * - `destination` — CIDR (`"10.0.0.0/8"`), IP, domain (`"example.com"`),
114
- * wildcard (`"*.example.com"`), or `"any"`
115
- * - `ports` — optional: `"80"`, `"80,443"`, `"8000-9000"` (omit = all ports)
116
- * - `protocol` — `"tcp"` | `"udp"` | `"any"` (default `"any"`)
117
- */
118
- export interface NetworkPolicyRule {
119
- effect: NetworkPolicyEffect;
120
- destination: string;
121
- ports?: string;
122
- protocol?: NetworkPolicyProtocol;
123
- }
124
-
125
- export interface NetworkPolicySetParams {
126
- /** Rules evaluated top-to-bottom. */
127
- rules: NetworkPolicyRule[];
128
- /**
129
- * Verdict when no rule matches.
130
- * `"allow"` = allowlist entries, deny everything else.
131
- * `"deny"` = blocklist entries, allow everything else (default).
132
- */
133
- default_effect?: NetworkPolicyEffect;
134
- }
135
-
136
- export interface NetworkPolicyData {
137
- computer_id: ComputerId;
138
- tenant_id: TenantId;
139
- rules: NetworkPolicyRule[];
140
- default_effect: NetworkPolicyEffect;
141
- inserted_at?: string;
142
- updated_at?: string;
143
- }
144
-
145
- export interface ComputerListResponse {
146
- data: ComputerData[];
147
- meta: {
148
- total: number;
149
- page: number;
150
- per_page: number;
151
- };
152
- }
153
-
154
- export interface ComputerListParams {
155
- page?: number;
156
- per_page?: number;
157
- status?: ComputerStatus;
158
- }
159
-
160
- // ─── Desktop ─────────────────────────────────────────────────────────────────
161
-
162
- export type MouseButton = "left" | "right" | "middle";
163
- export type ScrollDirection = "up" | "down" | "left" | "right";
164
-
165
- export interface ClickParams {
166
- x: number;
167
- y: number;
168
- button?: MouseButton;
169
- }
170
-
171
- export interface DoubleClickParams {
172
- x: number;
173
- y: number;
174
- }
175
-
176
- export interface TypeParams {
177
- text: string;
178
- delay?: number;
179
- }
180
-
181
- export interface KeyParams {
182
- key: string;
183
- }
184
-
185
- export interface ScrollParams {
186
- x?: number;
187
- y?: number;
188
- direction: ScrollDirection;
189
- clicks?: number;
190
- }
191
-
192
- export interface DragParams {
193
- from_x: number;
194
- from_y: number;
195
- to_x: number;
196
- to_y: number;
197
- }
198
-
199
- export interface WaitParams {
200
- seconds: number;
201
- }
202
-
203
- export interface WindowInfo {
204
- id: string;
205
- title: string;
206
- x: number;
207
- y: number;
208
- width: number;
209
- height: number;
210
- is_focused: boolean;
211
- }
212
-
213
- export interface CursorInfo {
214
- x: number;
215
- y: number;
216
- }
217
-
218
- export interface WindowFocusParams {
219
- window_id: string;
220
- }
221
-
222
- export interface LaunchParams {
223
- app_name: string;
224
- }
225
-
226
- export interface DesktopActionResult {
227
- success: boolean;
228
- }
229
-
230
- // ─── Exec ────────────────────────────────────────────────────────────────────
231
-
232
- export interface ExecParams {
233
- command: string;
234
- timeout?: number;
235
- }
236
-
237
- export interface ExecPythonParams {
238
- code: string;
239
- timeout?: number;
240
- }
241
-
242
- /**
243
- * Result of `exec.bash()` / `exec.python()`.
244
- *
245
- * The server returns stdout and stderr separately (what every other
246
- * runtime does too) — the older `{output, success}` shape was never
247
- * actually emitted. `output` is kept as a read-only alias of `stdout`
248
- * for backwards compatibility; new code should use `stdout` + `stderr`.
249
- */
250
- export interface ExecResult {
251
- /** Standard output from the command. */
252
- stdout: string;
253
- /** Standard error from the command. Empty string when no error output. */
254
- stderr: string;
255
- /** Process exit code. 0 = success. */
256
- exit_code: number;
257
- /** @deprecated alias for `stdout`; prefer `stdout` in new code. */
258
- output?: string;
259
- /** @deprecated derive from `exit_code === 0` in new code. */
260
- success?: boolean;
261
- }
262
-
263
- // ─── Files ───────────────────────────────────────────────────────────────────
264
-
265
- export interface FileEntry {
266
- name: string;
267
- path: string;
268
- size: number;
269
- is_dir: boolean;
270
- modified_at: string;
271
- }
272
-
273
- export interface FileListParams {
274
- path: string;
275
- }
276
-
277
- export interface FileDownloadParams {
278
- path: string;
279
- }
280
-
281
- export interface FileDeleteParams {
282
- path: string;
283
- }
284
-
285
- export interface FileExportParams {
286
- path: string;
287
- }
288
-
289
- export interface FileExportResult {
290
- url: string;
291
- expires_at: string;
292
- }
293
-
294
- export interface FileListResult {
295
- entries: FileEntry[];
296
- path: string;
297
- }
298
-
299
- // ─── Phase-7 stdlib-parity file types ────────────────────────────────────────
300
-
301
- export interface FileStat {
302
- path: string;
303
- /** File size in bytes. */
304
- size: number;
305
- /** Unix mode bits (e.g. 0o100644 for a regular file with rw-r--r--). */
306
- mode: number;
307
- is_dir: boolean;
308
- is_symlink: boolean;
309
- /** Populated when is_symlink is true. */
310
- symlink_target?: string;
311
- modified_at: string;
312
- }
313
-
314
- export interface DirEntry {
315
- name: string;
316
- is_dir: boolean;
317
- is_symlink: boolean;
318
- size: number;
319
- modified_at: string;
320
- }
321
-
322
- export interface MkdirParams {
323
- /** Create parent directories as needed. Defaults to true. */
324
- recursive?: boolean;
325
- /** Octal mode bits (e.g. 0o755). Defaults to 0o755. */
326
- mode?: number;
327
- }
328
-
329
- export interface CopyParams {
330
- /** Copy directory trees recursively. Defaults to false. */
331
- recursive?: boolean;
332
- }
333
-
334
- export interface DirListResult {
335
- data: {
336
- entries: DirEntry[];
337
- path: string;
338
- };
339
- }
340
-
341
- // ─── Agent / CUA ─────────────────────────────────────────────────────────────
342
-
343
- export type AgentSessionStatus =
344
- | "pending"
345
- | "running"
346
- | "completed"
347
- | "failed"
348
- | "cancelled";
349
-
350
- export interface AgentSessionCreateParams {
351
- goal: string;
352
- model_id?: string;
353
- max_turns?: number;
354
- }
355
-
356
- export interface AgentSessionData {
357
- id: SessionId;
358
- computer_id: ComputerId;
359
- goal: string;
360
- model_id: string;
361
- status: AgentSessionStatus;
362
- max_turns: number;
363
- turns_used: number;
364
- created_at: string;
365
- updated_at: string;
366
- completed_at: string | null;
367
- error: string | null;
368
- }
369
-
370
- export interface AgentSessionListResponse {
371
- data: AgentSessionData[];
372
- }
373
-
374
- export type AgentEventType =
375
- | "session_started"
376
- | "turn_started"
377
- | "thinking"
378
- | "tool_call"
379
- | "tool_result"
380
- | "streaming_token"
381
- | "agent_response"
382
- | "turn_completed"
383
- | "session_completed"
384
- | "session_failed"
385
- | "done"
386
- | "error";
387
-
388
- export interface AgentEvent {
389
- type: AgentEventType;
390
- session_id: SessionId;
391
- data: unknown;
392
- timestamp: string;
393
- }
394
-
395
- // ─── Credits ─────────────────────────────────────────────────────────────────
396
-
397
- export interface CreditBalance {
398
- balance: number;
399
- expires_at: string | null;
400
- }
401
-
402
- export interface CreditTransaction {
403
- id: string;
404
- amount: number;
405
- type: "credit" | "debit";
406
- description: string;
407
- created_at: string;
408
- }
409
-
410
- export interface CreditTransactionListResponse {
411
- data: CreditTransaction[];
412
- meta: {
413
- total: number;
414
- page: number;
415
- per_page: number;
416
- };
417
- }
418
-
419
- export interface CreditUsage {
420
- period_start: string;
421
- period_end: string;
422
- compute_credits: number;
423
- ai_credits: number;
424
- total_credits: number;
425
- }
426
-
427
- // ─── Events ──────────────────────────────────────────────────────────────────
428
-
429
- export type {
430
- EventProducer,
431
- EventSubscribeOptions,
432
- ComputerEvent,
433
- EventStream,
434
- WindowFocusChangedPayload,
435
- WindowOpenedPayload,
436
- WindowClosedPayload,
437
- ClipboardChangedPayload,
438
- FileCreatedPayload,
439
- FileModifiedPayload,
440
- FileDeletedPayload,
441
- ProcessStartedPayload,
442
- ProcessStoppedPayload,
443
- IdleInactivePayload,
444
- IdleActivePayload,
445
- ProducerUnavailablePayload,
446
- } from "./resources/events.js";
447
-
448
- // ─── Custom Domains ──────────────────────────────────────────────────────────
449
-
450
- export type {
451
- CustomDomainStatus,
452
- CustomDomainData,
453
- CustomDomainRegisterParams,
454
- } from "./resources/custom_domains.js";
455
-
456
- // ─── Client config ───────────────────────────────────────────────────────────
457
-
458
- export interface MiosaClientConfig {
459
- apiKey: string;
460
- baseUrl?: string;
461
- timeout?: number;
462
- maxRetries?: number;
463
- }