@arker-ai/sdk 0.3.0 → 0.5.2
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 +40 -125
- package/dist/chunk-YGZOUXII.js +731 -0
- package/dist/cli.cjs +1362 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +618 -0
- package/dist/index.cjs +355 -103
- package/dist/index.d.cts +578 -210
- package/dist/index.d.ts +578 -210
- package/dist/index.js +9 -473
- package/package.json +17 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,39 @@
|
|
|
1
1
|
interface components {
|
|
2
2
|
schemas: {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @description Stable machine-readable error code. `unsupported_operation` means the backend doesn't implement the requested optional feature.
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
ErrorCode: "unsupported_operation" | "bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "payload_too_large" | "not_implemented" | "resource_pressure" | "internal" | "unavailable" | "network_error";
|
|
4
8
|
ErrorResponse: {
|
|
5
|
-
|
|
6
|
-
* @description Stable machine-readable error code. "unsupported_operation" means the backend does not implement the requested optional feature.
|
|
7
|
-
* @example unsupported_operation
|
|
8
|
-
*/
|
|
9
|
-
code: string;
|
|
10
|
-
/** @description Human-readable error message. */
|
|
9
|
+
code: components["schemas"]["ErrorCode"];
|
|
11
10
|
message: string;
|
|
12
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* @description Unified lifecycle state for a VM or a Session. `idle` means no command is currently executing; `running` means a command is in flight.
|
|
14
|
+
* @enum {string}
|
|
15
|
+
*/
|
|
16
|
+
VmState: "idle" | "running";
|
|
17
|
+
SessionState: components["schemas"]["VmState"];
|
|
18
|
+
/**
|
|
19
|
+
* @description Lifecycle state for a Run. `running` = command in flight.
|
|
20
|
+
* `completed` = the command ran to completion; `exit_code` conveys
|
|
21
|
+
* success (0) or a non-zero program exit (a non-zero exit is still
|
|
22
|
+
* `completed`). `failed` = the platform could not run or finish the
|
|
23
|
+
* command (host died, evicted mid-run, exec error); `fail_reason`
|
|
24
|
+
* explains why, distinct from the program's `stderr`. `cancelled` =
|
|
25
|
+
* cancelled by the client.
|
|
26
|
+
* @enum {string}
|
|
27
|
+
*/
|
|
28
|
+
RunState: "running" | "completed" | "failed" | "cancelled";
|
|
29
|
+
/**
|
|
30
|
+
* @description `starting` = backend is allocating the tunnel; `open` = accepting
|
|
31
|
+
* connections; `closed` = torn down or never came up.
|
|
32
|
+
* @enum {string}
|
|
33
|
+
*/
|
|
34
|
+
TunnelState: "starting" | "open" | "closed";
|
|
35
|
+
/** @enum {string} */
|
|
36
|
+
ResourceKind: "cpu" | "memory" | "disk";
|
|
13
37
|
NetworkPolicy: components["schemas"]["NetworkPolicyOpen"] | components["schemas"]["NetworkPolicyBlocked"] | components["schemas"]["NetworkPolicyAllow"] | components["schemas"]["NetworkPolicyBlock"];
|
|
14
38
|
NetworkPolicyOpen: {
|
|
15
39
|
/** @constant */
|
|
@@ -31,8 +55,16 @@ interface components {
|
|
|
31
55
|
};
|
|
32
56
|
NetworkPolicyInput: boolean | string | components["schemas"]["NetworkPolicy"];
|
|
33
57
|
ForkRequest: {
|
|
58
|
+
/** @description Global VM identifier. Org is inferred from the row. */
|
|
59
|
+
source_vm_id?: string | null;
|
|
60
|
+
/** @description VM name within an org. Defaults `source_org_id` to the caller's org. A different org must be either the Arker org (for the public goldens `arkuntu` / `ubuntu`) or one with a `public: true` VM by that name. */
|
|
61
|
+
source_vm_name?: string | null;
|
|
62
|
+
/** @description Optional explicit org context for `source_vm_name`. SDK auto-fills the Arker org when forking the public goldens. */
|
|
63
|
+
source_org_id?: string | null;
|
|
64
|
+
/** @description Optional name for the new VM, scoped to the caller's org. */
|
|
34
65
|
name?: string | null;
|
|
35
|
-
|
|
66
|
+
/** @description Make the new VM publicly forkable from other orgs. */
|
|
67
|
+
public?: boolean | null;
|
|
36
68
|
network?: components["schemas"]["NetworkPolicyInput"] | null;
|
|
37
69
|
/** @default true */
|
|
38
70
|
disk?: boolean;
|
|
@@ -40,53 +72,69 @@ interface components {
|
|
|
40
72
|
memory_mib?: number | null;
|
|
41
73
|
max_memory_mib?: number | null;
|
|
42
74
|
disk_mib?: number | null;
|
|
43
|
-
/**
|
|
44
|
-
* @description Request a durable VM. If the underlying host fails mid-run, the run resumes on a healthy host with the VM's filesystem state preserved. Use for long-running or non-idempotent work. Forked children default to non-durable. Backends without durability support return ErrorResponse code "unsupported_operation".
|
|
45
|
-
* @default false
|
|
46
|
-
*/
|
|
47
75
|
durable?: boolean | null;
|
|
76
|
+
/** @description Optional VM-scoped tunnel customization. Omitting it allocates an open any-port tunnel where supported. */
|
|
77
|
+
tunnel?: components["schemas"]["TunnelRequest"] | null;
|
|
48
78
|
};
|
|
49
|
-
|
|
79
|
+
Session: {
|
|
50
80
|
session_id: string;
|
|
51
|
-
|
|
81
|
+
/** @default 0 */
|
|
82
|
+
session_idx?: number;
|
|
83
|
+
state: components["schemas"]["SessionState"];
|
|
52
84
|
cwd: string;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
85
|
+
/** @description Optional environment-variable overrides for this session. */
|
|
86
|
+
env?: {
|
|
87
|
+
[key: string]: string;
|
|
88
|
+
} | null;
|
|
89
|
+
started_at?: string | null;
|
|
90
|
+
vm_id?: string | null;
|
|
91
|
+
vm_name?: string | null;
|
|
92
|
+
source_org_id?: string | null;
|
|
93
|
+
region?: string | null;
|
|
94
|
+
/** @enum {string|null} */
|
|
95
|
+
provider?: "aws" | "aws-burst" | null;
|
|
96
|
+
};
|
|
97
|
+
ListSessionsResponse: {
|
|
98
|
+
sessions: components["schemas"]["Session"][];
|
|
99
|
+
next_cursor?: string | null;
|
|
100
|
+
};
|
|
101
|
+
Vm: {
|
|
67
102
|
vm_id: string;
|
|
68
|
-
|
|
103
|
+
/** @description Org that owns this VM. */
|
|
104
|
+
owner_org_id: string;
|
|
69
105
|
created_at: string;
|
|
106
|
+
/** @description VM name, scoped to `owner_org_id`. */
|
|
70
107
|
name?: string | null;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
108
|
+
/** @description When `true`, other orgs can fork this VM (but cannot run on it). */
|
|
109
|
+
public: boolean;
|
|
110
|
+
/** @description ID of the root (deepest-ancestor) source VM, if this VM was created by a chain of forks. None for VMs forked directly from an image. */
|
|
111
|
+
root_source_vm_id?: string | null;
|
|
112
|
+
/** @description Name of the root source VM. Populated together with `root_source_vm_id`. */
|
|
113
|
+
root_source_vm_name?: string | null;
|
|
114
|
+
state: components["schemas"]["VmState"];
|
|
115
|
+
region?: string | null;
|
|
116
|
+
/** @enum {string|null} */
|
|
117
|
+
provider?: "aws" | "aws-burst" | null;
|
|
118
|
+
started_at?: string | null;
|
|
74
119
|
vcpu_count?: number | null;
|
|
75
120
|
memory_mib?: number | null;
|
|
76
121
|
disk_mib?: number | null;
|
|
77
|
-
|
|
122
|
+
/** @description Effective VM fork-time egress policy. */
|
|
123
|
+
network?: components["schemas"]["NetworkPolicy"];
|
|
124
|
+
/** @description Hard vCPU ceiling for a fork of this VM (KVM slot count). Requesting more fails the run. */
|
|
125
|
+
max_vcpus?: number | null;
|
|
126
|
+
/** @description Hard memory ceiling (MiB) a fork can hotplug up to. */
|
|
127
|
+
max_memory_mib?: number | null;
|
|
128
|
+
/** @description Non-hotpluggable base memory (MiB). */
|
|
129
|
+
min_memory_mib?: number | null;
|
|
130
|
+
/** @description Worker host that owns this VM. Used by routers to populate caches without a fresh PlanetScale lookup. */
|
|
131
|
+
worker_id?: string | null;
|
|
132
|
+
sessions: components["schemas"]["Session"][];
|
|
133
|
+
tunnels?: components["schemas"]["Tunnel"][];
|
|
78
134
|
};
|
|
79
135
|
ListVmsResponse: {
|
|
80
|
-
vms: components["schemas"]["
|
|
81
|
-
|
|
82
|
-
ForkVmResponse: {
|
|
83
|
-
vm_id: string;
|
|
84
|
-
owner_id: string;
|
|
85
|
-
created_at: string;
|
|
86
|
-
sessions: components["schemas"]["SessionInfo"][];
|
|
87
|
-
ssh_private_key?: string | null;
|
|
88
|
-
tunnels?: components["schemas"]["RunTunnelStatus"][];
|
|
89
|
-
network?: components["schemas"]["RunNetworkStatus"] | null;
|
|
136
|
+
vms: components["schemas"]["Vm"][];
|
|
137
|
+
next_cursor?: string | null;
|
|
90
138
|
};
|
|
91
139
|
DeleteVmResponse: {
|
|
92
140
|
deleted: boolean;
|
|
@@ -94,162 +142,249 @@ interface components {
|
|
|
94
142
|
DeleteSessionResponse: {
|
|
95
143
|
deleted: boolean;
|
|
96
144
|
};
|
|
97
|
-
MountRequest: {
|
|
98
|
-
uri: string;
|
|
99
|
-
mount_point: string;
|
|
100
|
-
/** @default dir */
|
|
101
|
-
format?: string;
|
|
102
|
-
};
|
|
103
|
-
/** @description Foreground command execution is the portable baseline. Optional session, background, mount, resource, network, signal, release, and runtime fields may return ErrorResponse code "unsupported_operation" on backends that do not support them. */
|
|
104
145
|
RunRequest: {
|
|
105
|
-
/** @description Optional persistent session id. Backends without persistent sessions return unsupported_operation when this is requested. */
|
|
106
146
|
session_id?: string | null;
|
|
147
|
+
session_idx?: number | null;
|
|
107
148
|
command: string;
|
|
108
|
-
/**
|
|
109
|
-
* @description Run asynchronously. Backends without background execution return unsupported_operation and must not silently run the command synchronously.
|
|
110
|
-
* @default false
|
|
111
|
-
*/
|
|
149
|
+
/** @default false */
|
|
112
150
|
background?: boolean;
|
|
113
151
|
timeout?: number | null;
|
|
114
152
|
/** @default auto */
|
|
115
153
|
end_symbol?: string | null;
|
|
116
|
-
/**
|
|
117
|
-
* @description Optional external mounts. Backends without mount support return unsupported_operation when this is non-empty.
|
|
118
|
-
* @default []
|
|
119
|
-
*/
|
|
120
|
-
mounts?: components["schemas"]["MountRequest"][];
|
|
121
|
-
/** @description Optional per-run resource override. Backends without resource override support return unsupported_operation when this is requested. */
|
|
122
154
|
vcpu_count?: number | null;
|
|
123
|
-
/** @description Optional per-run resource override. Backends without resource override support return unsupported_operation when this is requested. */
|
|
124
155
|
memory_mib?: number | null;
|
|
125
|
-
/** @description Optional per-run resource override. Backends without resource override support return unsupported_operation when this is requested. */
|
|
126
156
|
disk_mib?: number | null;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
157
|
+
network?: components["schemas"]["NetworkRequest"] | null;
|
|
158
|
+
/**
|
|
159
|
+
* @description Comma-separated list of resources to ensure are
|
|
160
|
+
* pre-allocated (warm) before the run starts. Values: `cpu`,
|
|
161
|
+
* `memory`, `disk`. Example: `"cpu,memory"`.
|
|
162
|
+
*/
|
|
163
|
+
acquire?: string | null;
|
|
164
|
+
/**
|
|
165
|
+
* @description Comma-separated list of resources to release after the run
|
|
166
|
+
* finishes. Values: `cpu`, `memory`, `disk`. `"cpu"` frees
|
|
167
|
+
* vCPU but keeps memory hot for the next run on this VM;
|
|
168
|
+
* `"cpu,memory,disk"` is a full release (closest to a
|
|
169
|
+
* suspend).
|
|
170
|
+
*/
|
|
130
171
|
release?: string | null;
|
|
131
|
-
/** @description Optional session signal. Backends without signal support return unsupported_operation when this is requested. */
|
|
132
172
|
signal?: string | null;
|
|
133
|
-
/** @description Optional runtime selection. Backends without runtime selection support return unsupported_operation when this is requested. */
|
|
134
|
-
runtime?: string | null;
|
|
135
|
-
/** @description Optional runtime override. Backends without runtime overrides return unsupported_operation when this is requested. */
|
|
136
|
-
runtime_override?: string | null;
|
|
137
173
|
};
|
|
138
|
-
|
|
139
|
-
inbound?: components["schemas"]["
|
|
174
|
+
NetworkRequest: {
|
|
175
|
+
inbound?: components["schemas"]["InboundRequest"] | null;
|
|
140
176
|
};
|
|
141
|
-
|
|
177
|
+
InboundRequest: {
|
|
142
178
|
/** @default {} */
|
|
143
179
|
ports?: {
|
|
144
|
-
[key: string]: components["schemas"]["
|
|
180
|
+
[key: string]: components["schemas"]["InboundPortRequest"];
|
|
145
181
|
};
|
|
146
182
|
};
|
|
147
|
-
|
|
183
|
+
InboundPortRequest: {
|
|
148
184
|
/** @default private */
|
|
149
185
|
visibility?: string;
|
|
150
186
|
/** @default http */
|
|
151
187
|
protocol?: string;
|
|
152
188
|
};
|
|
153
|
-
|
|
154
|
-
RunResponse: components["schemas"]["CompletedRunResponse"] | components["schemas"]["BackgroundRunResponse"] | components["schemas"]["PtyRunResponse"];
|
|
189
|
+
RunResponse: components["schemas"]["CompletedRunResponse"] | components["schemas"]["BackgroundRunResponse"];
|
|
155
190
|
CompletedRunResponse: {
|
|
191
|
+
/** @description The run's own id. Present for executed runs; absent for operation acks (release/signal) with no run record. */
|
|
192
|
+
run_id?: string | null;
|
|
193
|
+
/** @description Lifecycle state — "completed" for this shape. Read this (not the variant) for completion, uniformly with the run-status (`Run`) shape. */
|
|
194
|
+
state?: string;
|
|
156
195
|
stdout: string;
|
|
196
|
+
/**
|
|
197
|
+
* @description TODO(encoding-normalize): goal is to always emit utf-8 from
|
|
198
|
+
* every source so this field becomes unnecessary. Until then
|
|
199
|
+
* the SDK uses it to decode.
|
|
200
|
+
*/
|
|
157
201
|
stdout_encoding: string;
|
|
158
202
|
stderr: string;
|
|
159
203
|
stderr_encoding: string;
|
|
160
204
|
exit_code: number;
|
|
161
|
-
|
|
205
|
+
dispatch?: string | null;
|
|
162
206
|
};
|
|
163
207
|
BackgroundRunResponse: {
|
|
164
208
|
run_id: string;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
tunnels?: components["schemas"]["RunTunnelStatus"][];
|
|
168
|
-
network?: components["schemas"]["RunNetworkStatus"] | null;
|
|
209
|
+
/** @description Lifecycle state — "running" for a backgrounded run. */
|
|
210
|
+
state?: string;
|
|
169
211
|
};
|
|
170
|
-
|
|
171
|
-
/** @constant */
|
|
172
|
-
pty: true;
|
|
173
|
-
session_id: string;
|
|
174
|
-
ws_url: string;
|
|
175
|
-
};
|
|
176
|
-
RunStatusResponse: {
|
|
212
|
+
Run: {
|
|
177
213
|
run_id: string;
|
|
214
|
+
session_id?: string | null;
|
|
215
|
+
command?: string | null;
|
|
216
|
+
state: components["schemas"]["RunState"];
|
|
217
|
+
started_at: string;
|
|
218
|
+
completed_at?: string | null;
|
|
219
|
+
exit_code: number | null;
|
|
220
|
+
/** @description System failure explanation when `state` is `failed` (e.g. "host died: <id>", "evicted mid-run"). Distinct from `stderr`, which is the program's own error output. Null for runs that ran to completion. */
|
|
221
|
+
fail_reason?: string | null;
|
|
178
222
|
stdout: string;
|
|
179
223
|
stdout_encoding: string;
|
|
180
224
|
stderr: string;
|
|
181
225
|
stderr_encoding: string;
|
|
182
|
-
|
|
183
|
-
completed: boolean;
|
|
184
|
-
tunnels: components["schemas"]["RunTunnelStatus"][];
|
|
185
|
-
network?: components["schemas"]["RunNetworkStatus"] | null;
|
|
186
|
-
/**
|
|
187
|
-
* @description Number of times this run has been automatically retried after an infrastructure failure. 0 for runs that completed without interruption. Backends without durability support omit this field; clients should treat it as 0 when absent.
|
|
188
|
-
* @default 0
|
|
189
|
-
*/
|
|
226
|
+
/** @default 0 */
|
|
190
227
|
retry_count?: number;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
228
|
+
vm_id?: string | null;
|
|
229
|
+
vm_name?: string | null;
|
|
230
|
+
source_org_id?: string | null;
|
|
231
|
+
region?: string | null;
|
|
232
|
+
/** @enum {string|null} */
|
|
233
|
+
provider?: "aws" | "aws-burst" | null;
|
|
234
|
+
};
|
|
235
|
+
RunSummary: {
|
|
236
|
+
run_id: string;
|
|
237
|
+
session_id?: string | null;
|
|
238
|
+
command?: string | null;
|
|
239
|
+
state: components["schemas"]["RunState"];
|
|
240
|
+
started_at: string;
|
|
241
|
+
completed_at?: string | null;
|
|
242
|
+
exit_code: number | null;
|
|
243
|
+
/** @description System failure explanation when `state` is `failed` — see `Run.fail_reason`. Distinct from the program's `stderr`. */
|
|
244
|
+
fail_reason?: string | null;
|
|
245
|
+
vm_id?: string | null;
|
|
246
|
+
vm_name?: string | null;
|
|
247
|
+
source_org_id?: string | null;
|
|
248
|
+
region?: string | null;
|
|
249
|
+
/** @enum {string|null} */
|
|
250
|
+
provider?: "aws" | "aws-burst" | null;
|
|
251
|
+
};
|
|
252
|
+
ListRunsResponse: {
|
|
253
|
+
runs: components["schemas"]["RunSummary"][];
|
|
254
|
+
next_cursor?: string | null;
|
|
255
|
+
};
|
|
256
|
+
OrgRunListRow: {
|
|
257
|
+
/** @enum {string} */
|
|
258
|
+
source: "cf" | "arkerd";
|
|
259
|
+
t_ms: number;
|
|
260
|
+
request_id: string;
|
|
261
|
+
run_id: string;
|
|
262
|
+
vm_id: string;
|
|
263
|
+
session_id: string;
|
|
264
|
+
region: string;
|
|
265
|
+
status: number;
|
|
266
|
+
total_ms: number;
|
|
267
|
+
queue_ms: number;
|
|
268
|
+
lambda_call_ms: number;
|
|
269
|
+
lambda_duration_ms: number;
|
|
270
|
+
executor_duration_ms: number;
|
|
271
|
+
executor_kind: string;
|
|
272
|
+
executor_cpu_ms: number;
|
|
273
|
+
executor_mem_mb: number;
|
|
274
|
+
lambda_cpu_ms: number;
|
|
275
|
+
lambda_mem_mb: number;
|
|
276
|
+
vm_vcpus: number;
|
|
277
|
+
vm_memory_mib: number;
|
|
278
|
+
path: string;
|
|
279
|
+
method: string;
|
|
280
|
+
command: string;
|
|
281
|
+
source_vm_id: string;
|
|
282
|
+
exit_code: number | null;
|
|
283
|
+
endpoint: string;
|
|
284
|
+
api_key_prefix: string;
|
|
285
|
+
body_bytes_in: number;
|
|
286
|
+
body_bytes_out: number;
|
|
287
|
+
body_in: string;
|
|
288
|
+
body_out: string;
|
|
289
|
+
};
|
|
290
|
+
ListOrgRunsResponse: {
|
|
291
|
+
since: number;
|
|
292
|
+
until: number;
|
|
293
|
+
limit: number;
|
|
294
|
+
offset: number;
|
|
295
|
+
lite: boolean;
|
|
296
|
+
rows: components["schemas"]["OrgRunListRow"][];
|
|
297
|
+
};
|
|
298
|
+
NetworkStatus: {
|
|
299
|
+
inbound: components["schemas"]["InboundStatus"];
|
|
300
|
+
};
|
|
301
|
+
InboundStatus: {
|
|
196
302
|
ports: {
|
|
197
|
-
[key: string]: components["schemas"]["
|
|
303
|
+
[key: string]: components["schemas"]["InboundPortStatus"];
|
|
198
304
|
};
|
|
199
305
|
};
|
|
200
|
-
|
|
306
|
+
InboundPortStatus: {
|
|
201
307
|
requested: string;
|
|
202
308
|
observed: string;
|
|
203
309
|
effective: string;
|
|
204
310
|
protocol: string;
|
|
205
311
|
url?: string | null;
|
|
206
312
|
};
|
|
207
|
-
|
|
208
|
-
/** @
|
|
209
|
-
|
|
313
|
+
Tunnel: {
|
|
314
|
+
/** @description The VM this tunnel belongs to. Always populated so flat tunnel listings work without restructuring. */
|
|
315
|
+
vm_id: string;
|
|
316
|
+
/** @description Unique-per-VM identifier. */
|
|
210
317
|
port: number;
|
|
318
|
+
/** @description The Run that opened this tunnel, if any. VM-scoped tunnels created at fork time or via `POST /vms/{id}/tunnels` have `run_id: null`. */
|
|
319
|
+
run_id?: string | null;
|
|
211
320
|
visibility: string;
|
|
212
321
|
protocol: string;
|
|
213
322
|
url?: string | null;
|
|
214
|
-
|
|
323
|
+
state: components["schemas"]["TunnelState"];
|
|
215
324
|
message?: string | null;
|
|
325
|
+
started_at?: string | null;
|
|
326
|
+
vm_name?: string | null;
|
|
327
|
+
source_org_id?: string | null;
|
|
328
|
+
region?: string | null;
|
|
329
|
+
/** @enum {string|null} */
|
|
330
|
+
provider?: "aws" | "aws-burst" | null;
|
|
331
|
+
/** @description Recoverable tunnel identity embedded in URLs (`p{port}-{key}`). Not a secret. Present on VM-scoped tunnel responses. */
|
|
332
|
+
tunnel_key?: string | null;
|
|
333
|
+
/**
|
|
334
|
+
* @description `open` or `authenticated` for VM-scoped tunnels.
|
|
335
|
+
* @enum {string|null}
|
|
336
|
+
*/
|
|
337
|
+
auth_mode?: "open" | "authenticated" | null;
|
|
338
|
+
/** @description One-time bearer secret returned only when allocating an authenticated tunnel; never echoed on listings. */
|
|
339
|
+
auth_token?: string | null;
|
|
340
|
+
};
|
|
341
|
+
ListTunnelsResponse: {
|
|
342
|
+
tunnels: components["schemas"]["Tunnel"][];
|
|
343
|
+
next_cursor?: string | null;
|
|
344
|
+
};
|
|
345
|
+
DeleteTunnelResponse: {
|
|
346
|
+
deleted: boolean;
|
|
216
347
|
};
|
|
217
348
|
CancelRunResponse: {
|
|
218
349
|
cancelled: boolean;
|
|
219
350
|
};
|
|
220
|
-
/** @description Create a persistent session. Backends without persistent sessions return unsupported_operation. */
|
|
221
351
|
CreateSessionRequest: {
|
|
222
352
|
env?: {
|
|
223
353
|
[key: string]: string;
|
|
224
354
|
} | null;
|
|
225
355
|
cwd?: string | null;
|
|
226
356
|
};
|
|
227
|
-
/** @description Resize a PTY session. Backends without PTY sessions return unsupported_operation. */
|
|
228
|
-
ResizePtyRequest: {
|
|
229
|
-
cols: number;
|
|
230
|
-
rows: number;
|
|
231
|
-
};
|
|
232
|
-
ResizePtyResponse: {
|
|
233
|
-
resized: boolean;
|
|
234
|
-
};
|
|
235
|
-
/** @description Resize VM resources. Backends without VM resize support return unsupported_operation. */
|
|
236
357
|
ResizeRequest: {
|
|
237
358
|
vcpu_count?: number | null;
|
|
238
359
|
memory_mib?: number | null;
|
|
239
360
|
disk_mib?: number | null;
|
|
240
361
|
};
|
|
241
362
|
ResizeResponse: {
|
|
242
|
-
|
|
363
|
+
resized: boolean;
|
|
364
|
+
};
|
|
365
|
+
Sync: {
|
|
366
|
+
sync_id: string;
|
|
367
|
+
vm_id: string;
|
|
368
|
+
filesystem_id: string;
|
|
369
|
+
/** @description VM-side path where the filesystem is mounted. Same field name as used by `SyncReadRequest.path`. */
|
|
370
|
+
path: string;
|
|
371
|
+
region?: string | null;
|
|
372
|
+
};
|
|
373
|
+
ListSyncsResponse: {
|
|
374
|
+
syncs: components["schemas"]["Sync"][];
|
|
375
|
+
next_cursor?: string | null;
|
|
376
|
+
};
|
|
377
|
+
DeleteSyncResponse: {
|
|
378
|
+
deleted: boolean;
|
|
379
|
+
};
|
|
380
|
+
SyncCreateRequest: {
|
|
381
|
+
filesystem_id: string;
|
|
382
|
+
path?: string;
|
|
243
383
|
};
|
|
244
|
-
SyncRequest: components["schemas"]["SyncReadRequest"] | components["schemas"]["SyncWriteRequest"];
|
|
245
384
|
SyncReadRequest: {
|
|
246
|
-
/** @constant */
|
|
247
|
-
op: "read";
|
|
248
385
|
path: string;
|
|
249
386
|
};
|
|
250
387
|
SyncWriteRequest: {
|
|
251
|
-
/** @constant */
|
|
252
|
-
op: "write";
|
|
253
388
|
writes: components["schemas"]["SyncWriteEntry"][];
|
|
254
389
|
};
|
|
255
390
|
SyncWriteEntry: components["schemas"]["SyncChunkWrite"] | components["schemas"]["SyncPresignedWriteRequest"] | components["schemas"]["SyncPresignedWriteCommit"];
|
|
@@ -277,21 +412,14 @@ interface components {
|
|
|
277
412
|
upload_id: string;
|
|
278
413
|
sha256?: string | null;
|
|
279
414
|
};
|
|
280
|
-
SyncResponse: components["schemas"]["SyncReadResponse"] | components["schemas"]["SyncWriteResponse"];
|
|
281
415
|
SyncReadResponse: components["schemas"]["SyncReadInlineResponse"] | components["schemas"]["SyncReadPresignedResponse"];
|
|
282
416
|
SyncReadInlineResponse: {
|
|
283
|
-
ok: boolean;
|
|
284
|
-
/** @constant */
|
|
285
|
-
op: "read";
|
|
286
417
|
path: string;
|
|
287
418
|
size: number;
|
|
288
419
|
content: string;
|
|
289
420
|
encoding: string;
|
|
290
421
|
};
|
|
291
422
|
SyncReadPresignedResponse: {
|
|
292
|
-
ok: boolean;
|
|
293
|
-
/** @constant */
|
|
294
|
-
op: "read";
|
|
295
423
|
path: string;
|
|
296
424
|
size: number;
|
|
297
425
|
presigned_url: string;
|
|
@@ -299,9 +427,6 @@ interface components {
|
|
|
299
427
|
method: string;
|
|
300
428
|
};
|
|
301
429
|
SyncWriteResponse: {
|
|
302
|
-
ok: boolean;
|
|
303
|
-
/** @constant */
|
|
304
|
-
op: "write";
|
|
305
430
|
results: components["schemas"]["SyncWriteResult"][];
|
|
306
431
|
};
|
|
307
432
|
SyncWriteResult: components["schemas"]["SyncChunkWriteResult"] | components["schemas"]["SyncPresignedWriteRequestResult"] | components["schemas"]["SyncCommitWriteResult"];
|
|
@@ -340,6 +465,43 @@ interface components {
|
|
|
340
465
|
code: string;
|
|
341
466
|
message: string;
|
|
342
467
|
};
|
|
468
|
+
Filesystem: {
|
|
469
|
+
filesystem_id: string;
|
|
470
|
+
name: string;
|
|
471
|
+
owner_org_id: string;
|
|
472
|
+
created_at: string;
|
|
473
|
+
size_bytes?: number | null;
|
|
474
|
+
/** @default us-west-2 */
|
|
475
|
+
region?: string | null;
|
|
476
|
+
/**
|
|
477
|
+
* @default aws
|
|
478
|
+
* @enum {string|null}
|
|
479
|
+
*/
|
|
480
|
+
provider?: "aws" | "aws-burst" | null;
|
|
481
|
+
};
|
|
482
|
+
ListFilesystemsResponse: {
|
|
483
|
+
filesystems: components["schemas"]["Filesystem"][];
|
|
484
|
+
next_cursor?: string | null;
|
|
485
|
+
};
|
|
486
|
+
DeleteFilesystemResponse: {
|
|
487
|
+
deleted: boolean;
|
|
488
|
+
};
|
|
489
|
+
FilesystemCreateRequest: {
|
|
490
|
+
name: string;
|
|
491
|
+
};
|
|
492
|
+
TunnelRequest: {
|
|
493
|
+
/**
|
|
494
|
+
* @description Allowed VM ports for this tunnel. Omitted, null, or empty means any port.
|
|
495
|
+
* @default []
|
|
496
|
+
*/
|
|
497
|
+
ports?: number[] | null;
|
|
498
|
+
/**
|
|
499
|
+
* @description `open` allows unauthenticated tunnel requests. `authenticated` returns a one-time bearer `auth_token` and requires it on tunnel requests.
|
|
500
|
+
* @default open
|
|
501
|
+
* @enum {string|null}
|
|
502
|
+
*/
|
|
503
|
+
auth_mode?: "open" | "authenticated" | null;
|
|
504
|
+
};
|
|
343
505
|
};
|
|
344
506
|
responses: {
|
|
345
507
|
/** @description API error. */
|
|
@@ -351,7 +513,7 @@ interface components {
|
|
|
351
513
|
"application/json": components["schemas"]["ErrorResponse"];
|
|
352
514
|
};
|
|
353
515
|
};
|
|
354
|
-
/** @description The request is valid, but this backend does not support the requested operation or option.
|
|
516
|
+
/** @description The request is valid, but this backend does not support the requested operation or option. */
|
|
355
517
|
UnsupportedOperation: {
|
|
356
518
|
headers: {
|
|
357
519
|
[name: string]: unknown;
|
|
@@ -365,8 +527,14 @@ interface components {
|
|
|
365
527
|
VmId: string;
|
|
366
528
|
RunId: string;
|
|
367
529
|
SessionId: string;
|
|
368
|
-
|
|
369
|
-
|
|
530
|
+
SyncId: string;
|
|
531
|
+
FilesystemId: string;
|
|
532
|
+
/** @description Opaque pagination cursor returned by the previous page's `next_cursor`. */
|
|
533
|
+
Cursor: string | null;
|
|
534
|
+
/** @description Max items per page. Backend caps may apply. */
|
|
535
|
+
Limit: number;
|
|
536
|
+
/** @description Recoverable tunnel identity returned as `Tunnel.tunnel_key` and embedded in tunnel URLs. */
|
|
537
|
+
TunnelKey: string;
|
|
370
538
|
};
|
|
371
539
|
requestBodies: never;
|
|
372
540
|
headers: never;
|
|
@@ -382,6 +550,14 @@ interface components {
|
|
|
382
550
|
|
|
383
551
|
type ApiSchema<Name extends keyof components["schemas"]> = components["schemas"][Name];
|
|
384
552
|
declare const CHUNK_SIZE: number;
|
|
553
|
+
/**
|
|
554
|
+
* Org id for the "Arker" org — the org that owns the public golden VMs
|
|
555
|
+
* (`arkuntu`, `ubuntu`, `ubuntu-full`, `ubuntu-py-repl`, …). Pass it as
|
|
556
|
+
* `sourceOrgId` to fork a public golden:
|
|
557
|
+
*
|
|
558
|
+
* arker.fork({ sourceVmName: "ubuntu-full", sourceOrgId: ARKER_ORG_ID })
|
|
559
|
+
*/
|
|
560
|
+
declare const ARKER_ORG_ID = "ArkerHQ";
|
|
385
561
|
type FetchLike = typeof fetch;
|
|
386
562
|
type HttpMethod = "GET" | "POST" | "DELETE";
|
|
387
563
|
interface RetryOptions {
|
|
@@ -392,107 +568,235 @@ interface RetryOptions {
|
|
|
392
568
|
}
|
|
393
569
|
interface ArkerOptions {
|
|
394
570
|
apiKey?: string;
|
|
571
|
+
/** Region (e.g. `"us-west-2"`). Combined with `provider` to build the
|
|
572
|
+
* compute endpoint. Back-compat: accepts the legacy combined form
|
|
573
|
+
* `"aws-us-west-2"`. */
|
|
574
|
+
region?: string;
|
|
575
|
+
/** Provider for compute calls. Defaults to `"aws"` (arkerd-managed
|
|
576
|
+
* VMs). Use `"aws-burst"` to target the Lambda burst backend
|
|
577
|
+
* directly. Has no effect on the burst-classified routing — a fork
|
|
578
|
+
* of `arkuntu` in the Arker org still goes to burst regardless. */
|
|
579
|
+
provider?: "aws" | "aws-burst";
|
|
580
|
+
/** Override the compute base URL (e.g. for internal / dev targets).
|
|
581
|
+
* If set, `provider` + `region` are ignored for compute. */
|
|
395
582
|
baseUrl?: string;
|
|
583
|
+
/** Override the burst compute base URL. */
|
|
396
584
|
burstBaseUrl?: string;
|
|
585
|
+
/** Override the control-plane URL — the CF Worker that owns
|
|
586
|
+
* administrative endpoints like `GET /v1/vms` (cross-provider list)
|
|
587
|
+
* and `/v1/filesystems`. Default `https://arker.ai/api`. */
|
|
588
|
+
controlBaseUrl?: string;
|
|
397
589
|
fetch?: FetchLike;
|
|
398
|
-
region?: string;
|
|
399
590
|
retry?: RetryOptions | false;
|
|
400
591
|
}
|
|
592
|
+
type VmState = ApiSchema<"VmState">;
|
|
593
|
+
type SessionState = ApiSchema<"SessionState">;
|
|
594
|
+
type RunState = ApiSchema<"RunState">;
|
|
595
|
+
type TunnelState = ApiSchema<"TunnelState">;
|
|
596
|
+
type ResourceKind = ApiSchema<"ResourceKind">;
|
|
597
|
+
type ErrorCode = ApiSchema<"ErrorCode">;
|
|
401
598
|
type NetworkPolicy = ApiSchema<"NetworkPolicy">;
|
|
402
599
|
type NetworkPolicyInput = ApiSchema<"NetworkPolicyInput">;
|
|
403
600
|
type ForkRequest = ApiSchema<"ForkRequest">;
|
|
404
601
|
type ForkOptions = ForkRequest;
|
|
405
|
-
type
|
|
406
|
-
type
|
|
407
|
-
type ListGoldensResponse = ApiSchema<"ListGoldensResponse">;
|
|
408
|
-
type VmInfo = ApiSchema<"VmInfo">;
|
|
602
|
+
type Session = ApiSchema<"Session">;
|
|
603
|
+
type Vm = ApiSchema<"Vm">;
|
|
409
604
|
type ListVmsResponse = ApiSchema<"ListVmsResponse">;
|
|
410
605
|
type ListSessionsResponse = ApiSchema<"ListSessionsResponse">;
|
|
411
|
-
type VmSummary = VmInfo;
|
|
412
|
-
type VmList = ListVmsResponse;
|
|
413
|
-
type ForkVmResponse = ApiSchema<"ForkVmResponse">;
|
|
414
606
|
type DeleteVmResponse = ApiSchema<"DeleteVmResponse">;
|
|
415
607
|
type DeleteSessionResponse = ApiSchema<"DeleteSessionResponse">;
|
|
416
|
-
type
|
|
608
|
+
type Filesystem = ApiSchema<"Filesystem">;
|
|
609
|
+
type ListFilesystemsResponse = ApiSchema<"ListFilesystemsResponse">;
|
|
610
|
+
type DeleteFilesystemResponse = ApiSchema<"DeleteFilesystemResponse">;
|
|
611
|
+
type FilesystemCreateRequest = ApiSchema<"FilesystemCreateRequest">;
|
|
612
|
+
type Sync = ApiSchema<"Sync">;
|
|
613
|
+
type ListSyncsResponse = ApiSchema<"ListSyncsResponse">;
|
|
614
|
+
type DeleteSyncResponse = ApiSchema<"DeleteSyncResponse">;
|
|
615
|
+
type SyncCreateRequest = ApiSchema<"SyncCreateRequest">;
|
|
616
|
+
type SyncReadRequest = ApiSchema<"SyncReadRequest">;
|
|
617
|
+
type SyncWriteRequest = ApiSchema<"SyncWriteRequest">;
|
|
618
|
+
type SyncReadResponse = ApiSchema<"SyncReadResponse">;
|
|
619
|
+
type SyncReadInlineResponse = ApiSchema<"SyncReadInlineResponse">;
|
|
620
|
+
type SyncReadPresignedResponse = ApiSchema<"SyncReadPresignedResponse">;
|
|
621
|
+
type SyncWriteResponse = ApiSchema<"SyncWriteResponse">;
|
|
622
|
+
type SyncWriteResult = ApiSchema<"SyncWriteResult">;
|
|
623
|
+
type SyncChunkWriteResult = ApiSchema<"SyncChunkWriteResult">;
|
|
624
|
+
type SyncPresignedWriteRequestResult = ApiSchema<"SyncPresignedWriteRequestResult">;
|
|
625
|
+
type SyncCommitWriteResult = ApiSchema<"SyncCommitWriteResult">;
|
|
626
|
+
type SyncByteRange = ApiSchema<"SyncByteRange">;
|
|
417
627
|
type RunRequest = ApiSchema<"RunRequest">;
|
|
418
|
-
type RunOptions = Omit<RunRequest, "command"
|
|
628
|
+
type RunOptions = Partial<Omit<RunRequest, "command">> & {
|
|
419
629
|
/**
|
|
420
|
-
* Optional idempotency key for retrying
|
|
421
|
-
*
|
|
422
|
-
* key and the same semantic request return the original run; a
|
|
423
|
-
* different semantic request under the same key returns
|
|
424
|
-
* ArkerError code "conflict" with the original run_id.
|
|
630
|
+
* Optional idempotency key for retrying the run. Sent as the
|
|
631
|
+
* `Idempotency-Key` HTTP header.
|
|
425
632
|
*/
|
|
426
633
|
idempotencyKey?: string;
|
|
427
634
|
};
|
|
428
|
-
type
|
|
429
|
-
type
|
|
430
|
-
type
|
|
431
|
-
type
|
|
635
|
+
type InboundPortRequest = ApiSchema<"InboundPortRequest">;
|
|
636
|
+
type NetworkRequest = ApiSchema<"NetworkRequest">;
|
|
637
|
+
type TunnelRequest = ApiSchema<"TunnelRequest">;
|
|
638
|
+
type Tunnel = ApiSchema<"Tunnel">;
|
|
639
|
+
type ListTunnelsResponse = ApiSchema<"ListTunnelsResponse">;
|
|
640
|
+
type DeleteTunnelResponse = ApiSchema<"DeleteTunnelResponse">;
|
|
641
|
+
type NetworkStatus = ApiSchema<"NetworkStatus">;
|
|
432
642
|
type RunResponse = ApiSchema<"RunResponse">;
|
|
433
643
|
type CompletedRunResponse = ApiSchema<"CompletedRunResponse">;
|
|
434
644
|
type BackgroundRunResponse = ApiSchema<"BackgroundRunResponse">;
|
|
435
|
-
type
|
|
436
|
-
type
|
|
645
|
+
type Run = ApiSchema<"Run">;
|
|
646
|
+
type RunSummary = ApiSchema<"RunSummary">;
|
|
647
|
+
type ListRunsResponse = ApiSchema<"ListRunsResponse">;
|
|
648
|
+
type OrgRunListRow = ApiSchema<"OrgRunListRow">;
|
|
649
|
+
type ListOrgRunsResponse = ApiSchema<"ListOrgRunsResponse">;
|
|
650
|
+
type RunListRow = OrgRunListRow;
|
|
651
|
+
type CancelRunResponse = ApiSchema<"CancelRunResponse">;
|
|
652
|
+
type CreateSessionRequest = ApiSchema<"CreateSessionRequest">;
|
|
653
|
+
type ResizeRequest = ApiSchema<"ResizeRequest">;
|
|
654
|
+
type ResizeResponse = ApiSchema<"ResizeResponse">;
|
|
655
|
+
type ErrorResponse = ApiSchema<"ErrorResponse">;
|
|
656
|
+
/** @deprecated Use `Session`. */
|
|
657
|
+
type SessionInfo = Session;
|
|
658
|
+
/** @deprecated Use `Run`. */
|
|
659
|
+
type RunStatusResponse = Run;
|
|
660
|
+
/** @deprecated Use `NetworkRequest`. */
|
|
661
|
+
type RunNetworkRequest = NetworkRequest;
|
|
662
|
+
/** @deprecated Use `NetworkStatus`. */
|
|
663
|
+
type RunNetworkStatus = NetworkStatus;
|
|
664
|
+
/** @deprecated Use `InboundPortRequest`. */
|
|
665
|
+
type RunInboundPortRequest = InboundPortRequest;
|
|
666
|
+
/** @deprecated Use `Tunnel`. */
|
|
667
|
+
type RunTunnelStatus = Tunnel;
|
|
437
668
|
interface CompletedRunResult {
|
|
438
669
|
type: "completed";
|
|
439
|
-
|
|
670
|
+
/** The run's own id. Present for executed runs; absent for operation acks. */
|
|
671
|
+
runId?: string;
|
|
672
|
+
/** Lifecycle state — "completed" or "failed". Mirrors the run-status (`Run`) shape. */
|
|
673
|
+
state: string;
|
|
440
674
|
stdout: Uint8Array;
|
|
441
675
|
stdoutEncoding: string;
|
|
442
676
|
stderr: Uint8Array;
|
|
443
677
|
stderrEncoding: string;
|
|
444
678
|
exitCode: number;
|
|
679
|
+
/** System failure explanation when `state` is "failed". Distinct from
|
|
680
|
+
* `stderr` (the program's own error output); null otherwise. */
|
|
681
|
+
failReason?: string | null;
|
|
445
682
|
}
|
|
446
683
|
interface BackgroundRunResult {
|
|
447
684
|
type: "background";
|
|
448
|
-
completed: boolean;
|
|
449
685
|
runId: string;
|
|
450
|
-
|
|
451
|
-
|
|
686
|
+
/** Lifecycle state — "running". */
|
|
687
|
+
state: string;
|
|
452
688
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
689
|
+
type RunResult = CompletedRunResult | BackgroundRunResult;
|
|
690
|
+
interface ListOrgRunsOptions {
|
|
691
|
+
since?: number;
|
|
692
|
+
until?: number;
|
|
693
|
+
vm?: string;
|
|
694
|
+
vmIds?: string[];
|
|
695
|
+
region?: string;
|
|
696
|
+
provider?: "aws" | "aws-burst";
|
|
697
|
+
source?: "cf" | "arkerd";
|
|
698
|
+
search?: string;
|
|
699
|
+
limit?: number;
|
|
700
|
+
offset?: number;
|
|
701
|
+
lite?: boolean;
|
|
702
|
+
runtime?: string;
|
|
703
|
+
endpoint?: "run" | "fork" | "sync";
|
|
704
|
+
actions?: string[];
|
|
705
|
+
status?: string[];
|
|
706
|
+
statusMin?: number;
|
|
707
|
+
statusMax?: number;
|
|
708
|
+
sort?: "when" | "status" | "path" | "total" | "queue" | "your_code" | "runtime";
|
|
709
|
+
dir?: "asc" | "desc";
|
|
458
710
|
}
|
|
459
|
-
type RunResult = CompletedRunResult | BackgroundRunResult | PtyRunResult;
|
|
460
|
-
type RunStatusResponse = ApiSchema<"RunStatusResponse">;
|
|
461
|
-
type CancelRunResponse = ApiSchema<"CancelRunResponse">;
|
|
462
|
-
type CreateSessionRequest = ApiSchema<"CreateSessionRequest">;
|
|
463
|
-
type ResizePtyRequest = ApiSchema<"ResizePtyRequest">;
|
|
464
|
-
type ResizePtyResponse = ApiSchema<"ResizePtyResponse">;
|
|
465
|
-
type ResizeRequest = ApiSchema<"ResizeRequest">;
|
|
466
|
-
type ResizeResponse = ApiSchema<"ResizeResponse">;
|
|
467
|
-
type SyncRequest = ApiSchema<"SyncRequest">;
|
|
468
|
-
type SyncResponse = ApiSchema<"SyncResponse">;
|
|
469
|
-
type SyncReadResponse = ApiSchema<"SyncReadResponse">;
|
|
470
|
-
type SyncReadInlineResponse = ApiSchema<"SyncReadInlineResponse">;
|
|
471
|
-
type SyncReadPresignedResponse = ApiSchema<"SyncReadPresignedResponse">;
|
|
472
|
-
type SyncByteRange = ApiSchema<"SyncByteRange">;
|
|
473
|
-
type ErrorResponse = ApiSchema<"ErrorResponse">;
|
|
474
|
-
type SyncChunkWriteResult = ApiSchema<"SyncChunkWriteResult">;
|
|
475
|
-
type SyncPresignedWriteRequestResult = ApiSchema<"SyncPresignedWriteRequestResult">;
|
|
476
|
-
type SyncCommitWriteResult = ApiSchema<"SyncCommitWriteResult">;
|
|
477
|
-
type SyncWriteResult = ApiSchema<"SyncWriteResult">;
|
|
478
|
-
type SyncWriteResponse = ApiSchema<"SyncWriteResponse">;
|
|
479
711
|
declare class ArkerError extends Error {
|
|
480
712
|
readonly code: string;
|
|
481
713
|
readonly status: number;
|
|
482
714
|
constructor(code: string, message: string, status: number);
|
|
483
715
|
}
|
|
716
|
+
/** Source for `Arker.fork()`. Exactly one of `sourceVmId` or
|
|
717
|
+
* `sourceVmName` must be set. When `sourceVmName` is set,
|
|
718
|
+
* `sourceOrgId` selects which org to look the name up in (defaults
|
|
719
|
+
* server-side to the caller's org; pass `ARKER_ORG_ID` to fork the
|
|
720
|
+
* public goldens like `"arkuntu"` / `"ubuntu"`).
|
|
721
|
+
*
|
|
722
|
+
* Distinct from the new VM's `name`, which is the *destination* name. */
|
|
723
|
+
interface ForkSource {
|
|
724
|
+
sourceVmId?: string;
|
|
725
|
+
sourceVmName?: string;
|
|
726
|
+
sourceOrgId?: string;
|
|
727
|
+
}
|
|
484
728
|
declare class Arker {
|
|
729
|
+
/** Compute base URL for `provider` + `region` — used for fork/run/
|
|
730
|
+
* per-VM ops. SDK calls go straight to this host, skipping the CF
|
|
731
|
+
* Worker control plane. */
|
|
485
732
|
readonly baseUrl: string;
|
|
733
|
+
/** Compute base URL for the burst provider in this region. */
|
|
486
734
|
readonly burstBaseUrl?: string;
|
|
735
|
+
/** CF Worker control-plane URL — used for cross-cutting admin calls
|
|
736
|
+
* like list-VMs and filesystems. */
|
|
737
|
+
readonly controlBaseUrl: string;
|
|
487
738
|
readonly region?: string;
|
|
739
|
+
readonly provider: "aws" | "aws-burst";
|
|
488
740
|
private readonly apiKey;
|
|
489
741
|
private readonly fetchImpl;
|
|
490
742
|
private readonly retry;
|
|
491
743
|
constructor(opts?: ArkerOptions);
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
744
|
+
/**
|
|
745
|
+
* Address an existing VM. Doesn't make any network calls; returns a
|
|
746
|
+
* lightweight handle.
|
|
747
|
+
*/
|
|
748
|
+
vm(vmId: string): VM;
|
|
749
|
+
/**
|
|
750
|
+
* Create a new VM by forking from a source.
|
|
751
|
+
*
|
|
752
|
+
* fork("ubuntu-full") // public golden by name
|
|
753
|
+
* fork("base") // a VM by name in your org
|
|
754
|
+
* fork(vm) // an existing VM (uses its id)
|
|
755
|
+
* fork({ sourceVmId: "vm_abc..." })
|
|
756
|
+
* fork({ sourceVmName: "base", sourceOrgId: "org_..." })
|
|
757
|
+
*
|
|
758
|
+
* The source can be a name string, a `VM` handle, or a `ForkSource`
|
|
759
|
+
* object. `sourceOrgId` defaults to the Arker org when `sourceVmName`
|
|
760
|
+
* is a known public golden, otherwise to your own org; an explicit
|
|
761
|
+
* value always wins, and it's irrelevant when forking by id. Forking a
|
|
762
|
+
* VM in another org requires that VM to be `public: true`. The new VM's
|
|
763
|
+
* name (in your org) is passed as `name`. When the source is a name or
|
|
764
|
+
* `VM`, extra fork options go in the second `opts` argument.
|
|
765
|
+
*/
|
|
766
|
+
fork(source: string | VM | (ForkSource & Partial<Omit<ForkRequest, "source_vm_id" | "source_vm_name" | "source_org_id">>), opts?: Partial<Omit<ForkRequest, "source_vm_id" | "source_vm_name" | "source_org_id">>): Promise<VM>;
|
|
767
|
+
/**
|
|
768
|
+
* List VMs visible to the authenticated caller. **Admin call** —
|
|
769
|
+
* goes through the control plane (`controlBaseUrl`) so it can
|
|
770
|
+
* aggregate across providers and regions. Pass `?provider=` /
|
|
771
|
+
* `?region=` to narrow.
|
|
772
|
+
*/
|
|
773
|
+
listVms(opts?: ListOpts & {
|
|
774
|
+
region?: string;
|
|
775
|
+
provider?: "aws" | "aws-burst";
|
|
776
|
+
state?: VmState;
|
|
777
|
+
sourceOrgId?: string;
|
|
778
|
+
startedAfter?: string;
|
|
779
|
+
startedBefore?: string;
|
|
780
|
+
}): Promise<{
|
|
781
|
+
vms: VM[];
|
|
782
|
+
nextCursor: string | null;
|
|
783
|
+
}>;
|
|
784
|
+
/**
|
|
785
|
+
* List run activity visible to the authenticated caller across VMs,
|
|
786
|
+
* providers, and regions. Admin call — routed through the control plane.
|
|
787
|
+
*/
|
|
788
|
+
listRuns(opts?: ListOrgRunsOptions): Promise<ListOrgRunsResponse>;
|
|
789
|
+
/** Compute call — goes direct to the backend hosting this VM (no
|
|
790
|
+
* control-plane hop). Returns a fully-populated VM handle. */
|
|
791
|
+
getVm(vmId: string): Promise<VM>;
|
|
792
|
+
listFilesystems(opts?: ListOpts & {
|
|
793
|
+
namePrefix?: string;
|
|
794
|
+
}): Promise<ListFilesystemsResponse>;
|
|
795
|
+
createFilesystem(request: {
|
|
796
|
+
name: string;
|
|
797
|
+
}): Promise<Filesystem>;
|
|
798
|
+
getFilesystem(filesystemId: string): Promise<Filesystem>;
|
|
799
|
+
deleteFilesystem(filesystemId: string): Promise<DeleteFilesystemResponse>;
|
|
496
800
|
/** @internal */
|
|
497
801
|
_request<T>(method: HttpMethod, path: string, body?: unknown, baseUrl?: string, extraHeaders?: Record<string, string | undefined>): Promise<T>;
|
|
498
802
|
/** @internal */
|
|
@@ -504,30 +808,94 @@ declare class Arker {
|
|
|
504
808
|
/** @internal */
|
|
505
809
|
_baseUrlFor(ref: string): string;
|
|
506
810
|
}
|
|
507
|
-
|
|
811
|
+
interface ListOpts {
|
|
812
|
+
cursor?: string;
|
|
813
|
+
limit?: number;
|
|
814
|
+
}
|
|
815
|
+
declare class VM {
|
|
508
816
|
readonly id: string;
|
|
509
817
|
readonly baseUrl: string;
|
|
510
|
-
readonly sync: Sync;
|
|
511
818
|
/** @internal */
|
|
512
819
|
readonly _client: Arker;
|
|
513
|
-
|
|
514
|
-
|
|
820
|
+
readonly vm_id?: string;
|
|
821
|
+
readonly name?: string | null;
|
|
822
|
+
readonly state?: VmState;
|
|
823
|
+
readonly owner_org_id?: string;
|
|
824
|
+
readonly created_at?: string;
|
|
825
|
+
readonly public?: boolean;
|
|
826
|
+
readonly region?: string | null;
|
|
827
|
+
readonly provider?: string | null;
|
|
828
|
+
readonly vcpu_count?: number | null;
|
|
829
|
+
readonly memory_mib?: number | null;
|
|
830
|
+
readonly disk_mib?: number | null;
|
|
831
|
+
readonly network?: NetworkPolicy;
|
|
832
|
+
readonly max_vcpus?: number | null;
|
|
833
|
+
readonly max_memory_mib?: number | null;
|
|
834
|
+
readonly min_memory_mib?: number | null;
|
|
835
|
+
readonly started_at?: string | null;
|
|
836
|
+
readonly root_source_vm_id?: string | null;
|
|
837
|
+
readonly root_source_vm_name?: string | null;
|
|
838
|
+
readonly worker_id?: string | null;
|
|
839
|
+
readonly sessions?: Session[];
|
|
840
|
+
readonly tunnels?: Tunnel[];
|
|
841
|
+
constructor(client: Arker, vmId: string, baseUrl?: string, data?: Vm);
|
|
842
|
+
/** Re-fetch this VM and return a fresh, fully-populated handle. */
|
|
843
|
+
refresh(): Promise<VM>;
|
|
844
|
+
/**
|
|
845
|
+
* @deprecated Use `Arker.fork({ sourceVmId: this.id, ... })`.
|
|
846
|
+
* Kept for back-compat with older user code that called `.fork()` on
|
|
847
|
+
* a VM instance.
|
|
848
|
+
*/
|
|
849
|
+
fork(request?: Partial<ForkRequest>): Promise<VM>;
|
|
515
850
|
run(command: string, options?: RunOptions): Promise<RunResult>;
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
851
|
+
/**
|
|
852
|
+
* Read or write a file in this VM over `POST /v1/vms/{id}/sync`.
|
|
853
|
+
* Omit `data` to read; pass `data` (string or bytes) to write. The
|
|
854
|
+
* client picks inline transfer for small files and presigned uploads
|
|
855
|
+
* for large ones automatically.
|
|
856
|
+
*
|
|
857
|
+
* const bytes = await vm.sync("/home/user/out.txt"); // read
|
|
858
|
+
* await vm.sync("/home/user/in.txt", "hello\n"); // write
|
|
859
|
+
*
|
|
860
|
+
* To mount a standalone filesystem into the VM, use `vm.syncs.create`.
|
|
861
|
+
*/
|
|
862
|
+
sync(path: string): Promise<Uint8Array>;
|
|
863
|
+
sync(path: string, data: Uint8Array | string): Promise<void>;
|
|
864
|
+
private syncRead;
|
|
865
|
+
private syncWriteInline;
|
|
866
|
+
private syncWritePresigned;
|
|
529
867
|
private putPresigned;
|
|
530
868
|
private sendOneWrite;
|
|
869
|
+
resize(request: ResizeRequest): Promise<ResizeResponse>;
|
|
870
|
+
delete(): Promise<DeleteVmResponse>;
|
|
871
|
+
listSyncs(opts?: ListOpts & {
|
|
872
|
+
filesystemId?: string;
|
|
873
|
+
}): Promise<ListSyncsResponse>;
|
|
874
|
+
createSync(request: {
|
|
875
|
+
filesystemId: string;
|
|
876
|
+
path?: string;
|
|
877
|
+
}): Promise<Sync>;
|
|
878
|
+
deleteSync(syncId: string): Promise<DeleteSyncResponse>;
|
|
879
|
+
listRuns(opts?: ListOpts & {
|
|
880
|
+
state?: RunState;
|
|
881
|
+
startedAfter?: string;
|
|
882
|
+
startedBefore?: string;
|
|
883
|
+
completedAfter?: string;
|
|
884
|
+
}): Promise<ListRunsResponse>;
|
|
885
|
+
getRun(runId: string): Promise<Run>;
|
|
886
|
+
cancelRun(runId: string): Promise<CancelRunResponse>;
|
|
887
|
+
listSessions(opts?: ListOpts & {
|
|
888
|
+
state?: SessionState;
|
|
889
|
+
}): Promise<ListSessionsResponse>;
|
|
890
|
+
createSession(request?: CreateSessionRequest): Promise<Session>;
|
|
891
|
+
getSession(sessionId: string): Promise<Session>;
|
|
892
|
+
deleteSession(sessionId: string): Promise<DeleteSessionResponse>;
|
|
893
|
+
listTunnels(opts?: ListOpts & {
|
|
894
|
+
state?: TunnelState;
|
|
895
|
+
}): Promise<ListTunnelsResponse>;
|
|
896
|
+
createTunnel(request?: TunnelRequest): Promise<Tunnel>;
|
|
897
|
+
getTunnel(key: string): Promise<Tunnel>;
|
|
898
|
+
deleteTunnel(key: string): Promise<DeleteTunnelResponse>;
|
|
531
899
|
}
|
|
532
900
|
|
|
533
|
-
export { Arker, ArkerError, type ArkerOptions, type BackgroundRunResponse, type BackgroundRunResult, CHUNK_SIZE, type CancelRunResponse, type CompletedRunResponse, type CompletedRunResult,
|
|
901
|
+
export { ARKER_ORG_ID, Arker, ArkerError, type ArkerOptions, type BackgroundRunResponse, type BackgroundRunResult, CHUNK_SIZE, type CancelRunResponse, type CompletedRunResponse, type CompletedRunResult, type CreateSessionRequest, type DeleteFilesystemResponse, type DeleteSessionResponse, type DeleteSyncResponse, type DeleteTunnelResponse, type DeleteVmResponse, type ErrorCode, type ErrorResponse, type Filesystem, type FilesystemCreateRequest, type ForkOptions, type ForkRequest, type ForkSource, type InboundPortRequest, type ListFilesystemsResponse, type ListOpts, type ListOrgRunsOptions, type ListOrgRunsResponse, type ListRunsResponse, type ListSessionsResponse, type ListSyncsResponse, type ListTunnelsResponse, type ListVmsResponse, type NetworkPolicy, type NetworkPolicyInput, type NetworkRequest, type NetworkStatus, type OrgRunListRow, type ResizeRequest, type ResizeResponse, type ResourceKind, type RetryOptions, type Run, type RunInboundPortRequest, type RunListRow, type RunNetworkRequest, type RunNetworkStatus, type RunOptions, type RunRequest, type RunResponse, type RunResult, type RunState, type RunStatusResponse, type RunSummary, type RunTunnelStatus, type Session, type SessionInfo, type SessionState, type Sync, type SyncByteRange, type SyncChunkWriteResult, type SyncCommitWriteResult, type SyncCreateRequest, type SyncPresignedWriteRequestResult, type SyncReadInlineResponse, type SyncReadPresignedResponse, type SyncReadRequest, type SyncReadResponse, type SyncWriteRequest, type SyncWriteResponse, type SyncWriteResult, type Tunnel, type TunnelRequest, type TunnelState, VM, type Vm, type VmState };
|