@arker-ai/sdk 0.5.1 → 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.
@@ -133,7 +133,8 @@ var Arker = class {
133
133
  memory_mib: src.memory_mib ?? null,
134
134
  max_memory_mib: src.max_memory_mib ?? null,
135
135
  disk_mib: src.disk_mib ?? null,
136
- durable: src.durable ?? null
136
+ durable: src.durable ?? null,
137
+ tunnel: src.tunnel ?? null
137
138
  };
138
139
  const useBurst = sourceOrgId === ARKER_ORG_ID && src.sourceVmName !== void 0 && isBurstRef(src.sourceVmName);
139
140
  const baseUrl = useBurst && this.burstBaseUrl ? this.burstBaseUrl : this.baseUrl;
@@ -164,6 +165,33 @@ var Arker = class {
164
165
  });
165
166
  return { vms, nextCursor: resp.next_cursor ?? null };
166
167
  }
168
+ /**
169
+ * List run activity visible to the authenticated caller across VMs,
170
+ * providers, and regions. Admin call — routed through the control plane.
171
+ */
172
+ async listRuns(opts = {}) {
173
+ return this._request("GET", buildQuery("/v1/runs", {
174
+ since: opts.since,
175
+ until: opts.until,
176
+ vm: opts.vm,
177
+ vms: opts.vmIds && opts.vmIds.length > 0 ? opts.vmIds.join(",") : void 0,
178
+ region: opts.region,
179
+ provider: opts.provider,
180
+ source: opts.source,
181
+ search: opts.search,
182
+ limit: opts.limit,
183
+ offset: opts.offset,
184
+ lite: opts.lite === void 0 ? void 0 : opts.lite,
185
+ runtime: opts.runtime,
186
+ endpoint: opts.endpoint,
187
+ actions: opts.actions && opts.actions.length > 0 ? opts.actions.join(",") : void 0,
188
+ status: opts.status && opts.status.length > 0 ? opts.status.join(",") : void 0,
189
+ status_min: opts.statusMin,
190
+ status_max: opts.statusMax,
191
+ sort: opts.sort,
192
+ dir: opts.dir
193
+ }), void 0, this.controlBaseUrl);
194
+ }
167
195
  /** Compute call — goes direct to the backend hosting this VM (no
168
196
  * control-plane hop). Returns a fully-populated VM handle. */
169
197
  async getVm(vmId) {
@@ -278,6 +306,10 @@ var VM = class _VM {
278
306
  vcpu_count;
279
307
  memory_mib;
280
308
  disk_mib;
309
+ network;
310
+ max_vcpus;
311
+ max_memory_mib;
312
+ min_memory_mib;
281
313
  started_at;
282
314
  root_source_vm_id;
283
315
  root_source_vm_name;
@@ -463,7 +495,7 @@ var VM = class _VM {
463
495
  async deleteSession(sessionId) {
464
496
  return this._client._request("DELETE", `${vmPath(this.id)}/sessions/${pathSegment(sessionId)}`, void 0, this.baseUrl);
465
497
  }
466
- // ── Tunnels: opened as a side effect of fork/run, addressed by port
498
+ // ── Tunnels: VM-scoped, addressed by recoverable tunnel key ───────
467
499
  async listTunnels(opts = {}) {
468
500
  return this._client._request("GET", buildQuery(`${vmPath(this.id)}/tunnels`, {
469
501
  cursor: opts.cursor,
@@ -471,11 +503,14 @@ var VM = class _VM {
471
503
  state: opts.state
472
504
  }), void 0, this.baseUrl);
473
505
  }
474
- async getTunnel(port) {
475
- return this._client._request("GET", `${vmPath(this.id)}/tunnels/${port}`, void 0, this.baseUrl);
506
+ async createTunnel(request = {}) {
507
+ return this._client._request("POST", `${vmPath(this.id)}/tunnels`, request, this.baseUrl);
508
+ }
509
+ async getTunnel(key) {
510
+ return this._client._request("GET", `${vmPath(this.id)}/tunnels/${pathSegment(key)}`, void 0, this.baseUrl);
476
511
  }
477
- async deleteTunnel(port) {
478
- return this._client._request("DELETE", `${vmPath(this.id)}/tunnels/${port}`, void 0, this.baseUrl);
512
+ async deleteTunnel(key) {
513
+ return this._client._request("DELETE", `${vmPath(this.id)}/tunnels/${pathSegment(key)}`, void 0, this.baseUrl);
479
514
  }
480
515
  };
481
516
  function buildQuery(path, params) {
@@ -576,8 +611,7 @@ function parseRunResponse(payload) {
576
611
  return {
577
612
  type: "background",
578
613
  runId: body.run_id,
579
- state: typeof body.state === "string" ? body.state : "running",
580
- tunnels: Array.isArray(body.tunnels) ? body.tunnels : []
614
+ state: typeof body.state === "string" ? body.state : "running"
581
615
  };
582
616
  }
583
617
  throw new ArkerError("internal", "unrecognized run response shape", 200);
package/dist/cli.cjs CHANGED
@@ -165,7 +165,8 @@ var Arker = class {
165
165
  memory_mib: src.memory_mib ?? null,
166
166
  max_memory_mib: src.max_memory_mib ?? null,
167
167
  disk_mib: src.disk_mib ?? null,
168
- durable: src.durable ?? null
168
+ durable: src.durable ?? null,
169
+ tunnel: src.tunnel ?? null
169
170
  };
170
171
  const useBurst = sourceOrgId === ARKER_ORG_ID && src.sourceVmName !== void 0 && isBurstRef(src.sourceVmName);
171
172
  const baseUrl = useBurst && this.burstBaseUrl ? this.burstBaseUrl : this.baseUrl;
@@ -196,6 +197,33 @@ var Arker = class {
196
197
  });
197
198
  return { vms, nextCursor: resp.next_cursor ?? null };
198
199
  }
200
+ /**
201
+ * List run activity visible to the authenticated caller across VMs,
202
+ * providers, and regions. Admin call — routed through the control plane.
203
+ */
204
+ async listRuns(opts = {}) {
205
+ return this._request("GET", buildQuery("/v1/runs", {
206
+ since: opts.since,
207
+ until: opts.until,
208
+ vm: opts.vm,
209
+ vms: opts.vmIds && opts.vmIds.length > 0 ? opts.vmIds.join(",") : void 0,
210
+ region: opts.region,
211
+ provider: opts.provider,
212
+ source: opts.source,
213
+ search: opts.search,
214
+ limit: opts.limit,
215
+ offset: opts.offset,
216
+ lite: opts.lite === void 0 ? void 0 : opts.lite,
217
+ runtime: opts.runtime,
218
+ endpoint: opts.endpoint,
219
+ actions: opts.actions && opts.actions.length > 0 ? opts.actions.join(",") : void 0,
220
+ status: opts.status && opts.status.length > 0 ? opts.status.join(",") : void 0,
221
+ status_min: opts.statusMin,
222
+ status_max: opts.statusMax,
223
+ sort: opts.sort,
224
+ dir: opts.dir
225
+ }), void 0, this.controlBaseUrl);
226
+ }
199
227
  /** Compute call — goes direct to the backend hosting this VM (no
200
228
  * control-plane hop). Returns a fully-populated VM handle. */
201
229
  async getVm(vmId) {
@@ -310,6 +338,10 @@ var VM = class _VM {
310
338
  vcpu_count;
311
339
  memory_mib;
312
340
  disk_mib;
341
+ network;
342
+ max_vcpus;
343
+ max_memory_mib;
344
+ min_memory_mib;
313
345
  started_at;
314
346
  root_source_vm_id;
315
347
  root_source_vm_name;
@@ -495,7 +527,7 @@ var VM = class _VM {
495
527
  async deleteSession(sessionId) {
496
528
  return this._client._request("DELETE", `${vmPath(this.id)}/sessions/${pathSegment(sessionId)}`, void 0, this.baseUrl);
497
529
  }
498
- // ── Tunnels: opened as a side effect of fork/run, addressed by port
530
+ // ── Tunnels: VM-scoped, addressed by recoverable tunnel key ───────
499
531
  async listTunnels(opts = {}) {
500
532
  return this._client._request("GET", buildQuery(`${vmPath(this.id)}/tunnels`, {
501
533
  cursor: opts.cursor,
@@ -503,11 +535,14 @@ var VM = class _VM {
503
535
  state: opts.state
504
536
  }), void 0, this.baseUrl);
505
537
  }
506
- async getTunnel(port) {
507
- return this._client._request("GET", `${vmPath(this.id)}/tunnels/${port}`, void 0, this.baseUrl);
538
+ async createTunnel(request = {}) {
539
+ return this._client._request("POST", `${vmPath(this.id)}/tunnels`, request, this.baseUrl);
540
+ }
541
+ async getTunnel(key) {
542
+ return this._client._request("GET", `${vmPath(this.id)}/tunnels/${pathSegment(key)}`, void 0, this.baseUrl);
508
543
  }
509
- async deleteTunnel(port) {
510
- return this._client._request("DELETE", `${vmPath(this.id)}/tunnels/${port}`, void 0, this.baseUrl);
544
+ async deleteTunnel(key) {
545
+ return this._client._request("DELETE", `${vmPath(this.id)}/tunnels/${pathSegment(key)}`, void 0, this.baseUrl);
511
546
  }
512
547
  };
513
548
  function buildQuery(path, params) {
@@ -608,8 +643,7 @@ function parseRunResponse(payload) {
608
643
  return {
609
644
  type: "background",
610
645
  runId: body.run_id,
611
- state: typeof body.state === "string" ? body.state : "running",
612
- tunnels: Array.isArray(body.tunnels) ? body.tunnels : []
646
+ state: typeof body.state === "string" ? body.state : "running"
613
647
  };
614
648
  }
615
649
  throw new ArkerError("internal", "unrecognized run response shape", 200);
@@ -881,7 +915,7 @@ async function cmdRun(args, client) {
881
915
  process.exitCode = result.exitCode === 0 ? 0 : result.exitCode;
882
916
  return;
883
917
  }
884
- out({ run_id: result.runId, tunnels: result.tunnels });
918
+ out({ run_id: result.runId, state: result.state });
885
919
  }
886
920
  async function cmdRuns(args, client) {
887
921
  const sub = args.positional[0];
@@ -1039,27 +1073,35 @@ async function cmdTunnels(args, client) {
1039
1073
  });
1040
1074
  if (args.flags.json) return out(res);
1041
1075
  for (const t of res.tunnels) {
1042
- out(`${t.port} ${t.state} ${t.protocol} ${t.url ?? "-"}`);
1076
+ out(`${t.tunnel_key ?? "-"} ${t.port} ${t.state} ${t.protocol} ${t.url ?? "-"}`);
1043
1077
  }
1044
1078
  if (res.next_cursor) out(`# next_cursor=${res.next_cursor}`);
1045
1079
  return;
1046
1080
  }
1081
+ case "create": {
1082
+ if (!vm) die("usage: arker tunnels create <vm_id> [--ports 80,8080] [--auth-mode open|authenticated]");
1083
+ const tunnel = await client.vm(vm).createTunnel({
1084
+ ports: parsePorts(args.flags.ports),
1085
+ auth_mode: args.flags["auth-mode"]
1086
+ });
1087
+ return out(tunnel);
1088
+ }
1047
1089
  case "get": {
1048
- if (!vm) die("usage: arker tunnels get <vm_id> <port>");
1049
- const port = Number(rest[1] ?? die("missing port"));
1050
- out(await client.vm(vm).getTunnel(port));
1090
+ if (!vm) die("usage: arker tunnels get <vm_id> <key>");
1091
+ const key = rest[1] ?? die("missing key");
1092
+ out(await client.vm(vm).getTunnel(key));
1051
1093
  return;
1052
1094
  }
1053
1095
  case "rm":
1054
1096
  case "delete": {
1055
- if (!vm) die("usage: arker tunnels rm <vm_id> <port>");
1056
- const port = Number(rest[1] ?? die("missing port"));
1057
- const r = await client.vm(vm).deleteTunnel(port);
1058
- out(r.deleted ? `deleted tunnel ${port}` : "delete failed");
1097
+ if (!vm) die("usage: arker tunnels rm <vm_id> <key>");
1098
+ const key = rest[1] ?? die("missing key");
1099
+ const r = await client.vm(vm).deleteTunnel(key);
1100
+ out(r.deleted ? `deleted tunnel ${key}` : "delete failed");
1059
1101
  return;
1060
1102
  }
1061
1103
  default:
1062
- die(`usage: arker tunnels <ls|get|rm> ...`);
1104
+ die(`usage: arker tunnels <ls|create|get|rm> ...`);
1063
1105
  }
1064
1106
  }
1065
1107
  async function cmdFilesystems(args, client) {
@@ -1221,6 +1263,10 @@ function boolFlag(args, name) {
1221
1263
  if (v === "false" || v === "0") return false;
1222
1264
  return true;
1223
1265
  }
1266
+ function parsePorts(value) {
1267
+ if (typeof value !== "string" || value.trim() === "") return void 0;
1268
+ return value.split(",").map((part) => Number(part.trim())).filter((port) => Number.isFinite(port));
1269
+ }
1224
1270
  async function readAllStdin() {
1225
1271
  const chunks = [];
1226
1272
  for await (const chunk of import_node_process.stdin) chunks.push(chunk);
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  ARKER_ORG_ID,
4
4
  Arker,
5
5
  ArkerError
6
- } from "./chunk-PI3H3TGC.js";
6
+ } from "./chunk-YGZOUXII.js";
7
7
 
8
8
  // src/cli.ts
9
9
  import { readFileSync, existsSync } from "fs";
@@ -171,7 +171,7 @@ async function cmdRun(args, client) {
171
171
  process.exitCode = result.exitCode === 0 ? 0 : result.exitCode;
172
172
  return;
173
173
  }
174
- out({ run_id: result.runId, tunnels: result.tunnels });
174
+ out({ run_id: result.runId, state: result.state });
175
175
  }
176
176
  async function cmdRuns(args, client) {
177
177
  const sub = args.positional[0];
@@ -329,27 +329,35 @@ async function cmdTunnels(args, client) {
329
329
  });
330
330
  if (args.flags.json) return out(res);
331
331
  for (const t of res.tunnels) {
332
- out(`${t.port} ${t.state} ${t.protocol} ${t.url ?? "-"}`);
332
+ out(`${t.tunnel_key ?? "-"} ${t.port} ${t.state} ${t.protocol} ${t.url ?? "-"}`);
333
333
  }
334
334
  if (res.next_cursor) out(`# next_cursor=${res.next_cursor}`);
335
335
  return;
336
336
  }
337
+ case "create": {
338
+ if (!vm) die("usage: arker tunnels create <vm_id> [--ports 80,8080] [--auth-mode open|authenticated]");
339
+ const tunnel = await client.vm(vm).createTunnel({
340
+ ports: parsePorts(args.flags.ports),
341
+ auth_mode: args.flags["auth-mode"]
342
+ });
343
+ return out(tunnel);
344
+ }
337
345
  case "get": {
338
- if (!vm) die("usage: arker tunnels get <vm_id> <port>");
339
- const port = Number(rest[1] ?? die("missing port"));
340
- out(await client.vm(vm).getTunnel(port));
346
+ if (!vm) die("usage: arker tunnels get <vm_id> <key>");
347
+ const key = rest[1] ?? die("missing key");
348
+ out(await client.vm(vm).getTunnel(key));
341
349
  return;
342
350
  }
343
351
  case "rm":
344
352
  case "delete": {
345
- if (!vm) die("usage: arker tunnels rm <vm_id> <port>");
346
- const port = Number(rest[1] ?? die("missing port"));
347
- const r = await client.vm(vm).deleteTunnel(port);
348
- out(r.deleted ? `deleted tunnel ${port}` : "delete failed");
353
+ if (!vm) die("usage: arker tunnels rm <vm_id> <key>");
354
+ const key = rest[1] ?? die("missing key");
355
+ const r = await client.vm(vm).deleteTunnel(key);
356
+ out(r.deleted ? `deleted tunnel ${key}` : "delete failed");
349
357
  return;
350
358
  }
351
359
  default:
352
- die(`usage: arker tunnels <ls|get|rm> ...`);
360
+ die(`usage: arker tunnels <ls|create|get|rm> ...`);
353
361
  }
354
362
  }
355
363
  async function cmdFilesystems(args, client) {
@@ -511,6 +519,10 @@ function boolFlag(args, name) {
511
519
  if (v === "false" || v === "0") return false;
512
520
  return true;
513
521
  }
522
+ function parsePorts(value) {
523
+ if (typeof value !== "string" || value.trim() === "") return void 0;
524
+ return value.split(",").map((part) => Number(part.trim())).filter((port) => Number.isFinite(port));
525
+ }
514
526
  async function readAllStdin() {
515
527
  const chunks = [];
516
528
  for await (const chunk of input) chunks.push(chunk);
package/dist/index.cjs CHANGED
@@ -161,7 +161,8 @@ var Arker = class {
161
161
  memory_mib: src.memory_mib ?? null,
162
162
  max_memory_mib: src.max_memory_mib ?? null,
163
163
  disk_mib: src.disk_mib ?? null,
164
- durable: src.durable ?? null
164
+ durable: src.durable ?? null,
165
+ tunnel: src.tunnel ?? null
165
166
  };
166
167
  const useBurst = sourceOrgId === ARKER_ORG_ID && src.sourceVmName !== void 0 && isBurstRef(src.sourceVmName);
167
168
  const baseUrl = useBurst && this.burstBaseUrl ? this.burstBaseUrl : this.baseUrl;
@@ -192,6 +193,33 @@ var Arker = class {
192
193
  });
193
194
  return { vms, nextCursor: resp.next_cursor ?? null };
194
195
  }
196
+ /**
197
+ * List run activity visible to the authenticated caller across VMs,
198
+ * providers, and regions. Admin call — routed through the control plane.
199
+ */
200
+ async listRuns(opts = {}) {
201
+ return this._request("GET", buildQuery("/v1/runs", {
202
+ since: opts.since,
203
+ until: opts.until,
204
+ vm: opts.vm,
205
+ vms: opts.vmIds && opts.vmIds.length > 0 ? opts.vmIds.join(",") : void 0,
206
+ region: opts.region,
207
+ provider: opts.provider,
208
+ source: opts.source,
209
+ search: opts.search,
210
+ limit: opts.limit,
211
+ offset: opts.offset,
212
+ lite: opts.lite === void 0 ? void 0 : opts.lite,
213
+ runtime: opts.runtime,
214
+ endpoint: opts.endpoint,
215
+ actions: opts.actions && opts.actions.length > 0 ? opts.actions.join(",") : void 0,
216
+ status: opts.status && opts.status.length > 0 ? opts.status.join(",") : void 0,
217
+ status_min: opts.statusMin,
218
+ status_max: opts.statusMax,
219
+ sort: opts.sort,
220
+ dir: opts.dir
221
+ }), void 0, this.controlBaseUrl);
222
+ }
195
223
  /** Compute call — goes direct to the backend hosting this VM (no
196
224
  * control-plane hop). Returns a fully-populated VM handle. */
197
225
  async getVm(vmId) {
@@ -306,6 +334,10 @@ var VM = class _VM {
306
334
  vcpu_count;
307
335
  memory_mib;
308
336
  disk_mib;
337
+ network;
338
+ max_vcpus;
339
+ max_memory_mib;
340
+ min_memory_mib;
309
341
  started_at;
310
342
  root_source_vm_id;
311
343
  root_source_vm_name;
@@ -491,7 +523,7 @@ var VM = class _VM {
491
523
  async deleteSession(sessionId) {
492
524
  return this._client._request("DELETE", `${vmPath(this.id)}/sessions/${pathSegment(sessionId)}`, void 0, this.baseUrl);
493
525
  }
494
- // ── Tunnels: opened as a side effect of fork/run, addressed by port
526
+ // ── Tunnels: VM-scoped, addressed by recoverable tunnel key ───────
495
527
  async listTunnels(opts = {}) {
496
528
  return this._client._request("GET", buildQuery(`${vmPath(this.id)}/tunnels`, {
497
529
  cursor: opts.cursor,
@@ -499,11 +531,14 @@ var VM = class _VM {
499
531
  state: opts.state
500
532
  }), void 0, this.baseUrl);
501
533
  }
502
- async getTunnel(port) {
503
- return this._client._request("GET", `${vmPath(this.id)}/tunnels/${port}`, void 0, this.baseUrl);
534
+ async createTunnel(request = {}) {
535
+ return this._client._request("POST", `${vmPath(this.id)}/tunnels`, request, this.baseUrl);
536
+ }
537
+ async getTunnel(key) {
538
+ return this._client._request("GET", `${vmPath(this.id)}/tunnels/${pathSegment(key)}`, void 0, this.baseUrl);
504
539
  }
505
- async deleteTunnel(port) {
506
- return this._client._request("DELETE", `${vmPath(this.id)}/tunnels/${port}`, void 0, this.baseUrl);
540
+ async deleteTunnel(key) {
541
+ return this._client._request("DELETE", `${vmPath(this.id)}/tunnels/${pathSegment(key)}`, void 0, this.baseUrl);
507
542
  }
508
543
  };
509
544
  function buildQuery(path, params) {
@@ -604,8 +639,7 @@ function parseRunResponse(payload) {
604
639
  return {
605
640
  type: "background",
606
641
  runId: body.run_id,
607
- state: typeof body.state === "string" ? body.state : "running",
608
- tunnels: Array.isArray(body.tunnels) ? body.tunnels : []
642
+ state: typeof body.state === "string" ? body.state : "running"
609
643
  };
610
644
  }
611
645
  throw new ArkerError("internal", "unrecognized run response shape", 200);
package/dist/index.d.cts CHANGED
@@ -16,7 +16,13 @@ interface components {
16
16
  VmState: "idle" | "running";
17
17
  SessionState: components["schemas"]["VmState"];
18
18
  /**
19
- * @description Lifecycle state for a Run. `running` = command in flight. `completed` = ran to completion; `exit_code` conveys success (0) or a non-zero program exit (still `completed`). `failed` = the platform could not run/finish the command (worker died, evicted mid-run); `fail_reason` explains why, distinct from the program's `stderr`. `cancelled` = cancelled by the client.
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.
20
26
  * @enum {string}
21
27
  */
22
28
  RunState: "running" | "completed" | "failed" | "cancelled";
@@ -67,6 +73,8 @@ interface components {
67
73
  max_memory_mib?: number | null;
68
74
  disk_mib?: number | null;
69
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;
70
78
  };
71
79
  Session: {
72
80
  session_id: string;
@@ -111,6 +119,14 @@ interface components {
111
119
  vcpu_count?: number | null;
112
120
  memory_mib?: number | null;
113
121
  disk_mib?: number | null;
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;
114
130
  /** @description Worker host that owns this VM. Used by routers to populate caches without a fresh PlanetScale lookup. */
115
131
  worker_id?: string | null;
116
132
  sessions: components["schemas"]["Session"][];
@@ -172,6 +188,10 @@ interface components {
172
188
  };
173
189
  RunResponse: components["schemas"]["CompletedRunResponse"] | components["schemas"]["BackgroundRunResponse"];
174
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;
175
195
  stdout: string;
176
196
  /**
177
197
  * @description TODO(encoding-normalize): goal is to always emit utf-8 from
@@ -186,8 +206,8 @@ interface components {
186
206
  };
187
207
  BackgroundRunResponse: {
188
208
  run_id: string;
189
- /** @default [] */
190
- tunnels?: components["schemas"]["Tunnel"][];
209
+ /** @description Lifecycle state — "running" for a backgrounded run. */
210
+ state?: string;
191
211
  };
192
212
  Run: {
193
213
  run_id: string;
@@ -197,13 +217,12 @@ interface components {
197
217
  started_at: string;
198
218
  completed_at?: string | null;
199
219
  exit_code: number | null;
200
- /** @description System failure explanation when `state` is `failed` (e.g. "worker died: <id>"). Distinct from `stderr`, which is the program's own output. */
220
+ /** @description System failure explanation when `state` is `failed` (e.g. "host died:&nbsp;<id>", "evicted mid-run"). Distinct from `stderr`, which is the program's own error output. Null for runs that ran to completion. */
201
221
  fail_reason?: string | null;
202
222
  stdout: string;
203
223
  stdout_encoding: string;
204
224
  stderr: string;
205
225
  stderr_encoding: string;
206
- tunnels: components["schemas"]["Tunnel"][];
207
226
  /** @default 0 */
208
227
  retry_count?: number;
209
228
  vm_id?: string | null;
@@ -221,7 +240,7 @@ interface components {
221
240
  started_at: string;
222
241
  completed_at?: string | null;
223
242
  exit_code: number | null;
224
- /** @description System failure explanation when `state` is `failed` (e.g. "worker died: <id>"). Distinct from `stderr`, which is the program's own output. */
243
+ /** @description System failure explanation when `state` is `failed` see `Run.fail_reason`. Distinct from the program's `stderr`. */
225
244
  fail_reason?: string | null;
226
245
  vm_id?: string | null;
227
246
  vm_name?: string | null;
@@ -234,6 +253,48 @@ interface components {
234
253
  runs: components["schemas"]["RunSummary"][];
235
254
  next_cursor?: string | null;
236
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
+ };
237
298
  NetworkStatus: {
238
299
  inbound: components["schemas"]["InboundStatus"];
239
300
  };
@@ -250,11 +311,11 @@ interface components {
250
311
  url?: string | null;
251
312
  };
252
313
  Tunnel: {
253
- /** @description The VM this tunnel belongs to. Always populated, including when embedded in `Run.tunnels`. */
314
+ /** @description The VM this tunnel belongs to. Always populated so flat tunnel listings work without restructuring. */
254
315
  vm_id: string;
255
316
  /** @description Unique-per-VM identifier. */
256
317
  port: number;
257
- /** @description The Run that opened this tunnel, if any. Tunnels allocated at fork time have `run_id: null`. */
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`. */
258
319
  run_id?: string | null;
259
320
  visibility: string;
260
321
  protocol: string;
@@ -267,6 +328,15 @@ interface components {
267
328
  region?: string | null;
268
329
  /** @enum {string|null} */
269
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;
270
340
  };
271
341
  ListTunnelsResponse: {
272
342
  tunnels: components["schemas"]["Tunnel"][];
@@ -298,16 +368,7 @@ interface components {
298
368
  filesystem_id: string;
299
369
  /** @description VM-side path where the filesystem is mounted. Same field name as used by `SyncReadRequest.path`. */
300
370
  path: string;
301
- created_at: string;
302
- vm_name?: string | null;
303
- filesystem_name?: string | null;
304
- source_org_id?: string | null;
305
371
  region?: string | null;
306
- /** @enum {string|null} */
307
- provider?: "aws" | "aws-burst" | null;
308
- live?: boolean;
309
- live_error?: string;
310
- idempotent?: boolean;
311
372
  };
312
373
  ListSyncsResponse: {
313
374
  syncs: components["schemas"]["Sync"][];
@@ -318,17 +379,12 @@ interface components {
318
379
  };
319
380
  SyncCreateRequest: {
320
381
  filesystem_id: string;
321
- /** @description VM-side path. Returns `ErrorResponse` code `conflict` if a sync already exists at this path. */
322
382
  path?: string;
323
383
  };
324
384
  SyncReadRequest: {
325
- /** @constant */
326
- op: "read";
327
385
  path: string;
328
386
  };
329
387
  SyncWriteRequest: {
330
- /** @constant */
331
- op: "write";
332
388
  writes: components["schemas"]["SyncWriteEntry"][];
333
389
  };
334
390
  SyncWriteEntry: components["schemas"]["SyncChunkWrite"] | components["schemas"]["SyncPresignedWriteRequest"] | components["schemas"]["SyncPresignedWriteCommit"];
@@ -433,6 +489,19 @@ interface components {
433
489
  FilesystemCreateRequest: {
434
490
  name: string;
435
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
+ };
436
505
  };
437
506
  responses: {
438
507
  /** @description API error. */
@@ -459,12 +528,13 @@ interface components {
459
528
  RunId: string;
460
529
  SessionId: string;
461
530
  SyncId: string;
462
- TunnelPort: number;
463
531
  FilesystemId: string;
464
532
  /** @description Opaque pagination cursor returned by the previous page's `next_cursor`. */
465
533
  Cursor: string | null;
466
534
  /** @description Max items per page. Backend caps may apply. */
467
535
  Limit: number;
536
+ /** @description Recoverable tunnel identity returned as `Tunnel.tunnel_key` and embedded in tunnel URLs. */
537
+ TunnelKey: string;
468
538
  };
469
539
  requestBodies: never;
470
540
  headers: never;
@@ -564,6 +634,7 @@ type RunOptions = Partial<Omit<RunRequest, "command">> & {
564
634
  };
565
635
  type InboundPortRequest = ApiSchema<"InboundPortRequest">;
566
636
  type NetworkRequest = ApiSchema<"NetworkRequest">;
637
+ type TunnelRequest = ApiSchema<"TunnelRequest">;
567
638
  type Tunnel = ApiSchema<"Tunnel">;
568
639
  type ListTunnelsResponse = ApiSchema<"ListTunnelsResponse">;
569
640
  type DeleteTunnelResponse = ApiSchema<"DeleteTunnelResponse">;
@@ -574,6 +645,9 @@ type BackgroundRunResponse = ApiSchema<"BackgroundRunResponse">;
574
645
  type Run = ApiSchema<"Run">;
575
646
  type RunSummary = ApiSchema<"RunSummary">;
576
647
  type ListRunsResponse = ApiSchema<"ListRunsResponse">;
648
+ type OrgRunListRow = ApiSchema<"OrgRunListRow">;
649
+ type ListOrgRunsResponse = ApiSchema<"ListOrgRunsResponse">;
650
+ type RunListRow = OrgRunListRow;
577
651
  type CancelRunResponse = ApiSchema<"CancelRunResponse">;
578
652
  type CreateSessionRequest = ApiSchema<"CreateSessionRequest">;
579
653
  type ResizeRequest = ApiSchema<"ResizeRequest">;
@@ -611,9 +685,29 @@ interface BackgroundRunResult {
611
685
  runId: string;
612
686
  /** Lifecycle state — "running". */
613
687
  state: string;
614
- tunnels: Tunnel[];
615
688
  }
616
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";
710
+ }
617
711
  declare class ArkerError extends Error {
618
712
  readonly code: string;
619
713
  readonly status: number;
@@ -687,6 +781,11 @@ declare class Arker {
687
781
  vms: VM[];
688
782
  nextCursor: string | null;
689
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>;
690
789
  /** Compute call — goes direct to the backend hosting this VM (no
691
790
  * control-plane hop). Returns a fully-populated VM handle. */
692
791
  getVm(vmId: string): Promise<VM>;
@@ -729,6 +828,10 @@ declare class VM {
729
828
  readonly vcpu_count?: number | null;
730
829
  readonly memory_mib?: number | null;
731
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;
732
835
  readonly started_at?: string | null;
733
836
  readonly root_source_vm_id?: string | null;
734
837
  readonly root_source_vm_name?: string | null;
@@ -790,8 +893,9 @@ declare class VM {
790
893
  listTunnels(opts?: ListOpts & {
791
894
  state?: TunnelState;
792
895
  }): Promise<ListTunnelsResponse>;
793
- getTunnel(port: number): Promise<Tunnel>;
794
- deleteTunnel(port: number): Promise<DeleteTunnelResponse>;
896
+ createTunnel(request?: TunnelRequest): Promise<Tunnel>;
897
+ getTunnel(key: string): Promise<Tunnel>;
898
+ deleteTunnel(key: string): Promise<DeleteTunnelResponse>;
795
899
  }
796
900
 
797
- 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 ListRunsResponse, type ListSessionsResponse, type ListSyncsResponse, type ListTunnelsResponse, type ListVmsResponse, type NetworkPolicy, type NetworkPolicyInput, type NetworkRequest, type NetworkStatus, type ResizeRequest, type ResizeResponse, type ResourceKind, type RetryOptions, type Run, type RunInboundPortRequest, 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 TunnelState, VM, type Vm, type VmState };
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 };
package/dist/index.d.ts CHANGED
@@ -16,7 +16,13 @@ interface components {
16
16
  VmState: "idle" | "running";
17
17
  SessionState: components["schemas"]["VmState"];
18
18
  /**
19
- * @description Lifecycle state for a Run. `running` = command in flight. `completed` = ran to completion; `exit_code` conveys success (0) or a non-zero program exit (still `completed`). `failed` = the platform could not run/finish the command (worker died, evicted mid-run); `fail_reason` explains why, distinct from the program's `stderr`. `cancelled` = cancelled by the client.
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.
20
26
  * @enum {string}
21
27
  */
22
28
  RunState: "running" | "completed" | "failed" | "cancelled";
@@ -67,6 +73,8 @@ interface components {
67
73
  max_memory_mib?: number | null;
68
74
  disk_mib?: number | null;
69
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;
70
78
  };
71
79
  Session: {
72
80
  session_id: string;
@@ -111,6 +119,14 @@ interface components {
111
119
  vcpu_count?: number | null;
112
120
  memory_mib?: number | null;
113
121
  disk_mib?: number | null;
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;
114
130
  /** @description Worker host that owns this VM. Used by routers to populate caches without a fresh PlanetScale lookup. */
115
131
  worker_id?: string | null;
116
132
  sessions: components["schemas"]["Session"][];
@@ -172,6 +188,10 @@ interface components {
172
188
  };
173
189
  RunResponse: components["schemas"]["CompletedRunResponse"] | components["schemas"]["BackgroundRunResponse"];
174
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;
175
195
  stdout: string;
176
196
  /**
177
197
  * @description TODO(encoding-normalize): goal is to always emit utf-8 from
@@ -186,8 +206,8 @@ interface components {
186
206
  };
187
207
  BackgroundRunResponse: {
188
208
  run_id: string;
189
- /** @default [] */
190
- tunnels?: components["schemas"]["Tunnel"][];
209
+ /** @description Lifecycle state — "running" for a backgrounded run. */
210
+ state?: string;
191
211
  };
192
212
  Run: {
193
213
  run_id: string;
@@ -197,13 +217,12 @@ interface components {
197
217
  started_at: string;
198
218
  completed_at?: string | null;
199
219
  exit_code: number | null;
200
- /** @description System failure explanation when `state` is `failed` (e.g. "worker died: <id>"). Distinct from `stderr`, which is the program's own output. */
220
+ /** @description System failure explanation when `state` is `failed` (e.g. "host died:&nbsp;<id>", "evicted mid-run"). Distinct from `stderr`, which is the program's own error output. Null for runs that ran to completion. */
201
221
  fail_reason?: string | null;
202
222
  stdout: string;
203
223
  stdout_encoding: string;
204
224
  stderr: string;
205
225
  stderr_encoding: string;
206
- tunnels: components["schemas"]["Tunnel"][];
207
226
  /** @default 0 */
208
227
  retry_count?: number;
209
228
  vm_id?: string | null;
@@ -221,7 +240,7 @@ interface components {
221
240
  started_at: string;
222
241
  completed_at?: string | null;
223
242
  exit_code: number | null;
224
- /** @description System failure explanation when `state` is `failed` (e.g. "worker died: <id>"). Distinct from `stderr`, which is the program's own output. */
243
+ /** @description System failure explanation when `state` is `failed` see `Run.fail_reason`. Distinct from the program's `stderr`. */
225
244
  fail_reason?: string | null;
226
245
  vm_id?: string | null;
227
246
  vm_name?: string | null;
@@ -234,6 +253,48 @@ interface components {
234
253
  runs: components["schemas"]["RunSummary"][];
235
254
  next_cursor?: string | null;
236
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
+ };
237
298
  NetworkStatus: {
238
299
  inbound: components["schemas"]["InboundStatus"];
239
300
  };
@@ -250,11 +311,11 @@ interface components {
250
311
  url?: string | null;
251
312
  };
252
313
  Tunnel: {
253
- /** @description The VM this tunnel belongs to. Always populated, including when embedded in `Run.tunnels`. */
314
+ /** @description The VM this tunnel belongs to. Always populated so flat tunnel listings work without restructuring. */
254
315
  vm_id: string;
255
316
  /** @description Unique-per-VM identifier. */
256
317
  port: number;
257
- /** @description The Run that opened this tunnel, if any. Tunnels allocated at fork time have `run_id: null`. */
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`. */
258
319
  run_id?: string | null;
259
320
  visibility: string;
260
321
  protocol: string;
@@ -267,6 +328,15 @@ interface components {
267
328
  region?: string | null;
268
329
  /** @enum {string|null} */
269
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;
270
340
  };
271
341
  ListTunnelsResponse: {
272
342
  tunnels: components["schemas"]["Tunnel"][];
@@ -298,16 +368,7 @@ interface components {
298
368
  filesystem_id: string;
299
369
  /** @description VM-side path where the filesystem is mounted. Same field name as used by `SyncReadRequest.path`. */
300
370
  path: string;
301
- created_at: string;
302
- vm_name?: string | null;
303
- filesystem_name?: string | null;
304
- source_org_id?: string | null;
305
371
  region?: string | null;
306
- /** @enum {string|null} */
307
- provider?: "aws" | "aws-burst" | null;
308
- live?: boolean;
309
- live_error?: string;
310
- idempotent?: boolean;
311
372
  };
312
373
  ListSyncsResponse: {
313
374
  syncs: components["schemas"]["Sync"][];
@@ -318,17 +379,12 @@ interface components {
318
379
  };
319
380
  SyncCreateRequest: {
320
381
  filesystem_id: string;
321
- /** @description VM-side path. Returns `ErrorResponse` code `conflict` if a sync already exists at this path. */
322
382
  path?: string;
323
383
  };
324
384
  SyncReadRequest: {
325
- /** @constant */
326
- op: "read";
327
385
  path: string;
328
386
  };
329
387
  SyncWriteRequest: {
330
- /** @constant */
331
- op: "write";
332
388
  writes: components["schemas"]["SyncWriteEntry"][];
333
389
  };
334
390
  SyncWriteEntry: components["schemas"]["SyncChunkWrite"] | components["schemas"]["SyncPresignedWriteRequest"] | components["schemas"]["SyncPresignedWriteCommit"];
@@ -433,6 +489,19 @@ interface components {
433
489
  FilesystemCreateRequest: {
434
490
  name: string;
435
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
+ };
436
505
  };
437
506
  responses: {
438
507
  /** @description API error. */
@@ -459,12 +528,13 @@ interface components {
459
528
  RunId: string;
460
529
  SessionId: string;
461
530
  SyncId: string;
462
- TunnelPort: number;
463
531
  FilesystemId: string;
464
532
  /** @description Opaque pagination cursor returned by the previous page's `next_cursor`. */
465
533
  Cursor: string | null;
466
534
  /** @description Max items per page. Backend caps may apply. */
467
535
  Limit: number;
536
+ /** @description Recoverable tunnel identity returned as `Tunnel.tunnel_key` and embedded in tunnel URLs. */
537
+ TunnelKey: string;
468
538
  };
469
539
  requestBodies: never;
470
540
  headers: never;
@@ -564,6 +634,7 @@ type RunOptions = Partial<Omit<RunRequest, "command">> & {
564
634
  };
565
635
  type InboundPortRequest = ApiSchema<"InboundPortRequest">;
566
636
  type NetworkRequest = ApiSchema<"NetworkRequest">;
637
+ type TunnelRequest = ApiSchema<"TunnelRequest">;
567
638
  type Tunnel = ApiSchema<"Tunnel">;
568
639
  type ListTunnelsResponse = ApiSchema<"ListTunnelsResponse">;
569
640
  type DeleteTunnelResponse = ApiSchema<"DeleteTunnelResponse">;
@@ -574,6 +645,9 @@ type BackgroundRunResponse = ApiSchema<"BackgroundRunResponse">;
574
645
  type Run = ApiSchema<"Run">;
575
646
  type RunSummary = ApiSchema<"RunSummary">;
576
647
  type ListRunsResponse = ApiSchema<"ListRunsResponse">;
648
+ type OrgRunListRow = ApiSchema<"OrgRunListRow">;
649
+ type ListOrgRunsResponse = ApiSchema<"ListOrgRunsResponse">;
650
+ type RunListRow = OrgRunListRow;
577
651
  type CancelRunResponse = ApiSchema<"CancelRunResponse">;
578
652
  type CreateSessionRequest = ApiSchema<"CreateSessionRequest">;
579
653
  type ResizeRequest = ApiSchema<"ResizeRequest">;
@@ -611,9 +685,29 @@ interface BackgroundRunResult {
611
685
  runId: string;
612
686
  /** Lifecycle state — "running". */
613
687
  state: string;
614
- tunnels: Tunnel[];
615
688
  }
616
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";
710
+ }
617
711
  declare class ArkerError extends Error {
618
712
  readonly code: string;
619
713
  readonly status: number;
@@ -687,6 +781,11 @@ declare class Arker {
687
781
  vms: VM[];
688
782
  nextCursor: string | null;
689
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>;
690
789
  /** Compute call — goes direct to the backend hosting this VM (no
691
790
  * control-plane hop). Returns a fully-populated VM handle. */
692
791
  getVm(vmId: string): Promise<VM>;
@@ -729,6 +828,10 @@ declare class VM {
729
828
  readonly vcpu_count?: number | null;
730
829
  readonly memory_mib?: number | null;
731
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;
732
835
  readonly started_at?: string | null;
733
836
  readonly root_source_vm_id?: string | null;
734
837
  readonly root_source_vm_name?: string | null;
@@ -790,8 +893,9 @@ declare class VM {
790
893
  listTunnels(opts?: ListOpts & {
791
894
  state?: TunnelState;
792
895
  }): Promise<ListTunnelsResponse>;
793
- getTunnel(port: number): Promise<Tunnel>;
794
- deleteTunnel(port: number): Promise<DeleteTunnelResponse>;
896
+ createTunnel(request?: TunnelRequest): Promise<Tunnel>;
897
+ getTunnel(key: string): Promise<Tunnel>;
898
+ deleteTunnel(key: string): Promise<DeleteTunnelResponse>;
795
899
  }
796
900
 
797
- 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 ListRunsResponse, type ListSessionsResponse, type ListSyncsResponse, type ListTunnelsResponse, type ListVmsResponse, type NetworkPolicy, type NetworkPolicyInput, type NetworkRequest, type NetworkStatus, type ResizeRequest, type ResizeResponse, type ResourceKind, type RetryOptions, type Run, type RunInboundPortRequest, 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 TunnelState, VM, type Vm, type VmState };
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 };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  ArkerError,
5
5
  CHUNK_SIZE,
6
6
  VM
7
- } from "./chunk-PI3H3TGC.js";
7
+ } from "./chunk-YGZOUXII.js";
8
8
  export {
9
9
  ARKER_ORG_ID,
10
10
  Arker,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arker-ai/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "TypeScript SDK for the Arker virtual computer platform — spawn sandboxed VMs, run code, sync files.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",