@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
@@ -1,343 +0,0 @@
1
- // ─── OpenComputers shared types ──────────────────────────────────────────────
2
-
3
- export type HostId = string & { readonly __brand: "HostId" };
4
- export type JobId = string & { readonly __brand: "JobId" };
5
- export type TunnelId = string & { readonly __brand: "TunnelId" };
6
- export type ClusterId = string & { readonly __brand: "ClusterId" };
7
- export type WorkspaceId = string & { readonly __brand: "WorkspaceId" };
8
- export type SecretId = string & { readonly __brand: "SecretId" };
9
-
10
- // ─── Hosts ───────────────────────────────────────────────────────────────────
11
-
12
- export type HostStatus = "pending" | "online" | "offline" | "error" | "revoked";
13
-
14
- export interface HostData {
15
- id: HostId;
16
- name: string;
17
- region: string | null;
18
- status: HostStatus;
19
- tenant_id: string;
20
- labels: Record<string, string>;
21
- /** Present only on create response — treat as write-once. */
22
- host_key?: string;
23
- created_at: string;
24
- updated_at: string;
25
- }
26
-
27
- export interface HostCreateParams {
28
- name: string;
29
- region?: string;
30
- labels?: Record<string, string>;
31
- }
32
-
33
- export interface HostUpdateParams {
34
- name?: string;
35
- labels?: Record<string, string>;
36
- }
37
-
38
- export interface HostListResponse {
39
- data: HostData[];
40
- meta: { total: number; page: number; per_page: number };
41
- }
42
-
43
- export interface HostEvent {
44
- type: "host_connected" | "host_disconnected" | "host_error" | string;
45
- host_id: HostId;
46
- data: unknown;
47
- timestamp: string;
48
- }
49
-
50
- // ─── Jobs (exec on host) ─────────────────────────────────────────────────────
51
-
52
- export type JobStatus =
53
- | "queued"
54
- | "running"
55
- | "completed"
56
- | "failed"
57
- | "cancelled";
58
-
59
- export interface JobData {
60
- id: JobId;
61
- host_id: HostId;
62
- status: JobStatus;
63
- command: string;
64
- args: string[];
65
- env: string[];
66
- cwd: string | null;
67
- exit_code: number | null;
68
- stdout: string | null;
69
- stderr: string | null;
70
- created_at: string;
71
- updated_at: string;
72
- completed_at: string | null;
73
- }
74
-
75
- export interface JobRunParams {
76
- command: string;
77
- args?: string[];
78
- env?: string[];
79
- cwd?: string;
80
- timeout?: number;
81
- }
82
-
83
- export interface JobListResponse {
84
- data: JobData[];
85
- meta: { total: number; page: number; per_page: number };
86
- }
87
-
88
- export type JobEventType =
89
- | "stdout"
90
- | "stderr"
91
- | "exit"
92
- | "error"
93
- | "started"
94
- | "done";
95
-
96
- export interface JobEvent {
97
- type: JobEventType;
98
- job_id: JobId;
99
- data: string | number | null;
100
- timestamp: string;
101
- }
102
-
103
- // ─── File system ─────────────────────────────────────────────────────────────
104
-
105
- export interface FsEntry {
106
- name: string;
107
- path: string;
108
- size: number;
109
- is_dir: boolean;
110
- modified_at: string;
111
- }
112
-
113
- export interface FsStat {
114
- path: string;
115
- size: number;
116
- mode: number;
117
- is_dir: boolean;
118
- is_symlink: boolean;
119
- symlink_target?: string;
120
- modified_at: string;
121
- }
122
-
123
- export interface FsListResponse {
124
- entries: FsEntry[];
125
- path: string;
126
- }
127
-
128
- // ─── Terminal / Desktop tickets ───────────────────────────────────────────────
129
-
130
- export interface WsTicket {
131
- /** Short-lived JWT for WS authentication. */
132
- ticket: string;
133
- /** Fully-qualified WS URL to connect to. */
134
- ws_url: string;
135
- expires_at: string;
136
- }
137
-
138
- // ─── Tunnels ─────────────────────────────────────────────────────────────────
139
-
140
- export type TunnelAuthMode = "public" | "tenant_only" | "password";
141
-
142
- export interface TunnelData {
143
- id: TunnelId;
144
- host_id: HostId;
145
- slug: string;
146
- target_port: number;
147
- auth_mode: TunnelAuthMode;
148
- public_url: string;
149
- enabled: boolean;
150
- created_at: string;
151
- updated_at: string;
152
- }
153
-
154
- export interface TunnelCreateParams {
155
- target_port: number;
156
- auth_mode?: TunnelAuthMode;
157
- slug?: string;
158
- }
159
-
160
- export interface TunnelUpdateParams {
161
- target_port?: number;
162
- auth_mode?: TunnelAuthMode;
163
- enabled?: boolean;
164
- }
165
-
166
- export interface TunnelListResponse {
167
- data: TunnelData[];
168
- }
169
-
170
- // ─── Agents ──────────────────────────────────────────────────────────────────
171
-
172
- export type AgentSessionStatus =
173
- | "pending"
174
- | "running"
175
- | "completed"
176
- | "failed"
177
- | "cancelled";
178
-
179
- export interface OcAgentSessionData {
180
- id: string;
181
- host_id: HostId;
182
- task: string;
183
- model_id: string | null;
184
- status: AgentSessionStatus;
185
- max_turns: number;
186
- turns_used: number;
187
- created_at: string;
188
- updated_at: string;
189
- completed_at: string | null;
190
- error: string | null;
191
- }
192
-
193
- export interface AgentDispatchParams {
194
- task: string;
195
- model_id?: string;
196
- max_turns?: number;
197
- context?: Record<string, unknown>;
198
- }
199
-
200
- export interface AgentSessionListResponse {
201
- data: OcAgentSessionData[];
202
- }
203
-
204
- export interface AgentEvent {
205
- type: string;
206
- session_id: string;
207
- data: unknown;
208
- timestamp: string;
209
- }
210
-
211
- // ─── Inference Clusters ───────────────────────────────────────────────────────
212
-
213
- export type ClusterStatus =
214
- | "provisioning"
215
- | "active"
216
- | "stopped"
217
- | "error"
218
- | "destroyed";
219
-
220
- export interface ClusterData {
221
- id: ClusterId;
222
- name: string;
223
- model: string;
224
- slug: string;
225
- status: ClusterStatus;
226
- host_ids: HostId[];
227
- /** OpenAI-compatible endpoint: POST /inference/{slug}/v1/chat/completions */
228
- inference_url: string;
229
- created_at: string;
230
- updated_at: string;
231
- }
232
-
233
- export interface ClusterCreateParams {
234
- name: string;
235
- model: string;
236
- host_ids: string[];
237
- }
238
-
239
- export interface ClusterListResponse {
240
- data: ClusterData[];
241
- }
242
-
243
- export interface ClusterEvent {
244
- type: string;
245
- cluster_id: ClusterId;
246
- data: unknown;
247
- timestamp: string;
248
- }
249
-
250
- // ─── Apps ────────────────────────────────────────────────────────────────────
251
-
252
- export interface AppCatalogEntry {
253
- id: string;
254
- name: string;
255
- description: string;
256
- category: string;
257
- version: string;
258
- icon_url: string | null;
259
- }
260
-
261
- export interface AppInstallData {
262
- id: string;
263
- host_id: HostId;
264
- app_id: string;
265
- status: "pending" | "installing" | "installed" | "failed" | "uninstalled";
266
- error: string | null;
267
- created_at: string;
268
- updated_at: string;
269
- }
270
-
271
- export interface AppInstallEvent {
272
- type: string;
273
- install_id: string;
274
- data: unknown;
275
- timestamp: string;
276
- }
277
-
278
- // ─── Workspaces ───────────────────────────────────────────────────────────────
279
-
280
- export type OcWorkspaceStatus =
281
- | "creating"
282
- | "ready"
283
- | "running"
284
- | "stopped"
285
- | "error";
286
-
287
- export interface OcWorkspaceData {
288
- id: WorkspaceId;
289
- host_id: HostId;
290
- name: string;
291
- repo_url: string | null;
292
- branch: string | null;
293
- status: OcWorkspaceStatus;
294
- directory: string;
295
- created_at: string;
296
- updated_at: string;
297
- }
298
-
299
- export interface OcWorkspaceCreateParams {
300
- name: string;
301
- repo_url?: string;
302
- branch?: string;
303
- directory?: string;
304
- }
305
-
306
- export interface OcWorkspaceUpdateParams {
307
- name?: string;
308
- branch?: string;
309
- }
310
-
311
- export interface OcWorkspaceListResponse {
312
- data: OcWorkspaceData[];
313
- }
314
-
315
- export interface OcWorkspaceEvent {
316
- type: string;
317
- workspace_id: WorkspaceId;
318
- data: unknown;
319
- timestamp: string;
320
- }
321
-
322
- // ─── Secrets ─────────────────────────────────────────────────────────────────
323
-
324
- export interface SecretData {
325
- id: SecretId;
326
- name: string;
327
- description: string | null;
328
- host_id: HostId | null;
329
- tenant_id: string;
330
- created_at: string;
331
- updated_at: string;
332
- }
333
-
334
- export interface SecretCreateParams {
335
- name: string;
336
- value: string;
337
- description?: string;
338
- }
339
-
340
- export interface SecretUpdateParams {
341
- value?: string;
342
- description?: string;
343
- }
@@ -1,135 +0,0 @@
1
- import { HttpClient } from "../../http.js";
2
- import type {
3
- HostId,
4
- OcWorkspaceCreateParams,
5
- OcWorkspaceData,
6
- OcWorkspaceEvent,
7
- OcWorkspaceListResponse,
8
- OcWorkspaceUpdateParams,
9
- WorkspaceId,
10
- WsTicket,
11
- } from "./types.js";
12
-
13
- /**
14
- * Workspaces resource — git-backed development environments on a remote host.
15
- *
16
- * A workspace clones a repository, installs dependencies, and gives you a
17
- * ready-to-use terminal scoped to the project root.
18
- *
19
- * ```ts
20
- * const ws = await client.openComputers.workspaces.create(hostId, {
21
- * name: "my-project",
22
- * repo_url: "https://github.com/acme/backend",
23
- * branch: "main",
24
- * });
25
- * const { ws_url } = await client.openComputers.workspaces.openTerminal(hostId, ws.id);
26
- * ```
27
- */
28
- export class OcWorkspaces {
29
- private readonly http: HttpClient;
30
-
31
- constructor(http: HttpClient) {
32
- this.http = http;
33
- }
34
-
35
- private base(hostId: string): string {
36
- return `/opencomputers/hosts/${hostId}/workspaces`;
37
- }
38
-
39
- /**
40
- * List all workspaces across all hosts for the tenant.
41
- */
42
- async listAll(): Promise<OcWorkspaceListResponse> {
43
- return this.http.get<OcWorkspaceListResponse>("/opencomputers/workspaces");
44
- }
45
-
46
- /**
47
- * List workspaces on a specific host.
48
- */
49
- async list(hostId: HostId | string): Promise<OcWorkspaceListResponse> {
50
- return this.http.get<OcWorkspaceListResponse>(this.base(hostId));
51
- }
52
-
53
- /**
54
- * Create a new workspace on a host.
55
- */
56
- async create(
57
- hostId: HostId | string,
58
- params: OcWorkspaceCreateParams,
59
- ): Promise<OcWorkspaceData> {
60
- return this.http.post<OcWorkspaceData>(this.base(hostId), params);
61
- }
62
-
63
- /**
64
- * Fetch a single workspace.
65
- */
66
- async get(
67
- hostId: HostId | string,
68
- workspaceId: WorkspaceId | string,
69
- ): Promise<OcWorkspaceData> {
70
- return this.http.get<OcWorkspaceData>(
71
- `${this.base(hostId)}/${workspaceId}`,
72
- );
73
- }
74
-
75
- /**
76
- * Update workspace metadata (name, branch).
77
- */
78
- async update(
79
- hostId: HostId | string,
80
- workspaceId: WorkspaceId | string,
81
- params: OcWorkspaceUpdateParams,
82
- ): Promise<OcWorkspaceData> {
83
- return this.http.patch<OcWorkspaceData>(
84
- `${this.base(hostId)}/${workspaceId}`,
85
- params,
86
- );
87
- }
88
-
89
- /**
90
- * Delete a workspace.
91
- */
92
- async delete(
93
- hostId: HostId | string,
94
- workspaceId: WorkspaceId | string,
95
- ): Promise<void> {
96
- return this.http.delete<void>(`${this.base(hostId)}/${workspaceId}`);
97
- }
98
-
99
- /**
100
- * Pull the latest changes from the remote repository.
101
- */
102
- async pull(
103
- hostId: HostId | string,
104
- workspaceId: WorkspaceId | string,
105
- ): Promise<OcWorkspaceData> {
106
- return this.http.post<OcWorkspaceData>(
107
- `${this.base(hostId)}/${workspaceId}/pull`,
108
- );
109
- }
110
-
111
- /**
112
- * Open a terminal session scoped to the workspace root directory.
113
- * Returns a short-lived WebSocket ticket.
114
- */
115
- async openTerminal(
116
- hostId: HostId | string,
117
- workspaceId: WorkspaceId | string,
118
- ): Promise<WsTicket> {
119
- return this.http.post<WsTicket>(
120
- `${this.base(hostId)}/${workspaceId}/open-terminal`,
121
- );
122
- }
123
-
124
- /**
125
- * Stream workspace setup / clone / install events.
126
- */
127
- events(
128
- hostId: HostId | string,
129
- workspaceId: WorkspaceId | string,
130
- ): AsyncIterableIterator<OcWorkspaceEvent> {
131
- return this.http.stream<OcWorkspaceEvent>(
132
- `${this.base(hostId)}/${workspaceId}/events`,
133
- );
134
- }
135
- }
@@ -1,189 +0,0 @@
1
- /**
2
- * Org Invites — email invite flow for org (tenant) membership.
3
- *
4
- * Public endpoints (no auth):
5
- * GET /invites/:token
6
- *
7
- * Authenticated endpoints (admin/owner role required for create/list/revoke):
8
- * POST /tenants/:id/invites
9
- * GET /tenants/:id/invites
10
- * DELETE /tenants/:id/invites/:invite_id
11
- * POST /invites/:token/accept
12
- */
13
-
14
- import type { HttpClient } from "../http.js";
15
-
16
- // ── Resource shapes ──────────────────────────────────────────────────────────
17
-
18
- export type OrgRole = "owner" | "admin" | "member";
19
-
20
- export interface OrgInvite {
21
- id: string;
22
- tenant_id: string;
23
- email: string;
24
- role: OrgRole;
25
- invited_by: string | null;
26
- expires_at: string;
27
- accepted_at: string | null;
28
- created_at: string;
29
- }
30
-
31
- export interface OrgInviteCreated {
32
- invite_id: string;
33
- email: string;
34
- role: OrgRole;
35
- expires_at: string;
36
- /**
37
- * Full URL for the invite landing page. On white-label tenants this uses
38
- * the tenant's custom domain.
39
- */
40
- invite_url: string;
41
- }
42
-
43
- export interface OrgInvitePreview {
44
- email: string;
45
- tenant_name: string;
46
- role: OrgRole;
47
- expires_at: string;
48
- expired: boolean;
49
- accepted: boolean;
50
- }
51
-
52
- export interface TenantSummary {
53
- id: string;
54
- name: string;
55
- slug: string;
56
- owner_user_id: string | null;
57
- plan_id: string | null;
58
- plan_name: string | null;
59
- settings: Record<string, unknown>;
60
- inserted_at: string;
61
- updated_at: string;
62
- }
63
-
64
- // ── Request payloads ─────────────────────────────────────────────────────────
65
-
66
- export interface CreateOrgInviteParams {
67
- email: string;
68
- role?: OrgRole;
69
- }
70
-
71
- // ── Response shapes ───────────────────────────────────────────────────────────
72
-
73
- export interface OrgInviteCreatedResponse {
74
- data: OrgInviteCreated;
75
- }
76
-
77
- export interface OrgInviteListResponse {
78
- data: OrgInvite[];
79
- total: number;
80
- }
81
-
82
- export interface OrgInviteRevokeResponse {
83
- invite_id: string;
84
- revoked: boolean;
85
- }
86
-
87
- export interface OrgInvitePreviewResponse {
88
- data: OrgInvitePreview;
89
- }
90
-
91
- export interface AcceptOrgInviteResponse {
92
- accepted: boolean;
93
- tenant_id: string;
94
- tenant: TenantSummary | null;
95
- }
96
-
97
- // ── Main resource ─────────────────────────────────────────────────────────────
98
-
99
- export class OrgInvites {
100
- constructor(private readonly http: HttpClient) {}
101
-
102
- /**
103
- * Create an org invite and dispatch the invite email.
104
- *
105
- * The invite URL in the response is host-aware: on white-label tenants it
106
- * uses the custom domain so the recipient lands on the branded experience.
107
- * Requires `admin` or `owner` role in the tenant.
108
- *
109
- * `POST /tenants/:id/invites`
110
- */
111
- async create(
112
- tenantId: string,
113
- params: CreateOrgInviteParams,
114
- ): Promise<OrgInviteCreated> {
115
- const res = await this.http.post<OrgInviteCreatedResponse>(
116
- `/tenants/${tenantId}/invites`,
117
- params,
118
- );
119
- return res.data;
120
- }
121
-
122
- /**
123
- * List all pending (non-expired, non-accepted, non-revoked) org invites.
124
- *
125
- * Requires `admin` or `owner` role.
126
- *
127
- * `GET /tenants/:id/invites`
128
- */
129
- async list(tenantId: string): Promise<OrgInvite[]> {
130
- const res = await this.http.get<OrgInviteListResponse>(
131
- `/tenants/${tenantId}/invites`,
132
- );
133
- return res.data ?? [];
134
- }
135
-
136
- /**
137
- * Revoke a pending org invite.
138
- *
139
- * Returns `409` when the invite was already legitimately accepted.
140
- * Requires `admin` or `owner` role.
141
- *
142
- * `DELETE /tenants/:id/invites/:invite_id`
143
- */
144
- async revoke(
145
- tenantId: string,
146
- inviteId: string,
147
- ): Promise<OrgInviteRevokeResponse> {
148
- return this.http.delete<OrgInviteRevokeResponse>(
149
- `/tenants/${tenantId}/invites/${inviteId}`,
150
- );
151
- }
152
-
153
- /**
154
- * Preview an org invite by token (no auth required).
155
- *
156
- * Returns `null` when the token is unknown or has been revoked.
157
- *
158
- * `GET /invites/:token`
159
- */
160
- async preview(token: string): Promise<OrgInvitePreview | null> {
161
- try {
162
- const res = await this.http.get<OrgInvitePreviewResponse>(
163
- `/invites/${token}`,
164
- );
165
- return res.data ?? null;
166
- } catch {
167
- return null;
168
- }
169
- }
170
-
171
- /**
172
- * Accept an org invite on behalf of the authenticated user.
173
- *
174
- * The caller's JWT email must match the invite email (case-insensitive).
175
- * On success inserts a `tenant_members` row.
176
- *
177
- * Error responses:
178
- * - `400` — invalid or expired token.
179
- * - `422 EMAIL_MISMATCH` — JWT email does not match the invite email.
180
- *
181
- * `POST /invites/:token/accept`
182
- */
183
- async accept(token: string): Promise<AcceptOrgInviteResponse> {
184
- return this.http.post<AcceptOrgInviteResponse>(
185
- `/invites/${token}/accept`,
186
- {},
187
- );
188
- }
189
- }