@arker-ai/sdk 0.5.1 → 0.6.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/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ interface components {
7
7
  ErrorCode: "unsupported_operation" | "bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "payload_too_large" | "not_implemented" | "resource_pressure" | "internal" | "unavailable" | "network_error";
8
8
  ErrorResponse: {
9
9
  code: components["schemas"]["ErrorCode"];
10
+ /** @description Human-readable, client-safe error message. For `code: "internal"`, this is intentionally generic; server logs retain the underlying cause. */
10
11
  message: string;
11
12
  };
12
13
  /**
@@ -16,38 +17,36 @@ interface components {
16
17
  VmState: "idle" | "running";
17
18
  SessionState: components["schemas"]["VmState"];
18
19
  /**
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.
20
+ * @description Lifecycle state for a Run. `running` = command in flight.
21
+ * `completed` = the command ran to completion; `exit_code` conveys
22
+ * success (0) or a non-zero program exit (a non-zero exit is still
23
+ * `completed`). `failed` = the platform could not run or finish the
24
+ * command (host died, evicted mid-run, exec error); `fail_reason`
25
+ * explains why, distinct from the program's `stderr`. `cancelled` =
26
+ * cancelled by the client.
20
27
  * @enum {string}
21
28
  */
22
29
  RunState: "running" | "completed" | "failed" | "cancelled";
23
- /**
24
- * @description `starting` = backend is allocating the tunnel; `open` = accepting
25
- * connections; `closed` = torn down or never came up.
26
- * @enum {string}
27
- */
28
- TunnelState: "starting" | "open" | "closed";
29
30
  /** @enum {string} */
30
31
  ResourceKind: "cpu" | "memory" | "disk";
31
- NetworkPolicy: components["schemas"]["NetworkPolicyOpen"] | components["schemas"]["NetworkPolicyBlocked"] | components["schemas"]["NetworkPolicyAllow"] | components["schemas"]["NetworkPolicyBlock"];
32
- NetworkPolicyOpen: {
32
+ /** @description Outbound egress policy stored on the VM. */
33
+ NetworkPolicy: {
33
34
  /** @constant */
34
35
  type: "open";
35
- };
36
- NetworkPolicyBlocked: {
36
+ } | {
37
37
  /** @constant */
38
38
  type: "blocked";
39
- };
40
- NetworkPolicyAllow: {
39
+ } | {
41
40
  /** @constant */
42
41
  type: "allow";
43
42
  allow: string[];
44
- };
45
- NetworkPolicyBlock: {
43
+ } | {
46
44
  /** @constant */
47
45
  type: "block";
48
46
  block: string[];
49
47
  };
50
- NetworkPolicyInput: boolean | string | components["schemas"]["NetworkPolicy"];
48
+ /** @description Outbound egress policy input. `true`/`open` means unrestricted; `false`/`blocked`/`none` means deny all. */
49
+ NetworkPolicyInput: boolean | ("open" | "blocked" | "true" | "false" | "none") | components["schemas"]["NetworkPolicy"];
51
50
  ForkRequest: {
52
51
  /** @description Global VM identifier. Org is inferred from the row. */
53
52
  source_vm_id?: string | null;
@@ -59,14 +58,14 @@ interface components {
59
58
  name?: string | null;
60
59
  /** @description Make the new VM publicly forkable from other orgs. */
61
60
  public?: boolean | null;
62
- network?: components["schemas"]["NetworkPolicyInput"] | null;
63
- /** @default true */
64
- disk?: boolean;
65
- vcpu_count?: number | null;
66
- memory_mib?: number | null;
67
- max_memory_mib?: number | null;
68
- disk_mib?: number | null;
61
+ /** @description Inbound reachability and SSH authorized keys for the new VM. */
62
+ network?: components["schemas"]["NetworkInput"] | null;
63
+ /** @description Outbound egress policy for the new VM. Omit to inherit from the source VM, or default to open for image-created VMs with no source. */
64
+ egress?: components["schemas"]["NetworkPolicyInput"] | null;
65
+ disk?: boolean | null;
69
66
  durable?: boolean | null;
67
+ /** @description Resource shape for the new VM. */
68
+ resources?: components["schemas"]["VmResources"] | null;
70
69
  };
71
70
  Session: {
72
71
  session_id: string;
@@ -108,13 +107,25 @@ interface components {
108
107
  /** @enum {string|null} */
109
108
  provider?: "aws" | "aws-burst" | null;
110
109
  started_at?: string | null;
111
- vcpu_count?: number | null;
112
- memory_mib?: number | null;
113
- disk_mib?: number | null;
114
- /** @description Worker host that owns this VM. Used by routers to populate caches without a fresh PlanetScale lookup. */
115
- worker_id?: string | null;
110
+ /** @description Inbound reachability settings for this VM. */
111
+ network: components["schemas"]["VmNetwork"];
112
+ /** @description Outbound egress policy for this VM. */
113
+ egress?: components["schemas"]["NetworkPolicy"] | null;
114
+ /** @description Hard vCPU ceiling for a fork of this VM (KVM slot count). Requesting more fails the run. */
115
+ max_vcpus?: number | null;
116
+ /** @description Smallest vCPU count accepted for this VM. */
117
+ min_vcpus?: number | null;
118
+ /** @description Hard memory ceiling (MiB) a fork can hotplug up to. */
119
+ max_memory_mib?: number | null;
120
+ /** @description Non-hotpluggable base memory (MiB). */
121
+ min_memory_mib?: number | null;
122
+ /** @description Smallest disk size (MiB) accepted for this VM. `0` means nodisk. */
123
+ min_disk_mib?: number | null;
124
+ /** @description Largest disk size (MiB) accepted for this VM. `0` means nodisk. */
125
+ max_disk_mib?: number | null;
116
126
  sessions: components["schemas"]["Session"][];
117
- tunnels?: components["schemas"]["Tunnel"][];
127
+ /** @description Current VM resource allocation. */
128
+ resources: components["schemas"]["VmResources"];
118
129
  };
119
130
  ListVmsResponse: {
120
131
  vms: components["schemas"]["Vm"][];
@@ -172,6 +183,10 @@ interface components {
172
183
  };
173
184
  RunResponse: components["schemas"]["CompletedRunResponse"] | components["schemas"]["BackgroundRunResponse"];
174
185
  CompletedRunResponse: {
186
+ /** @description The run's own id. Present for executed runs; absent for operation acks (release/signal) with no run record. */
187
+ run_id?: string | null;
188
+ /** @description Lifecycle state — "completed" for this shape. Read this (not the variant) for completion, uniformly with the run-status (`Run`) shape. */
189
+ state?: string;
175
190
  stdout: string;
176
191
  /**
177
192
  * @description TODO(encoding-normalize): goal is to always emit utf-8 from
@@ -183,11 +198,17 @@ interface components {
183
198
  stderr_encoding: string;
184
199
  exit_code: number;
185
200
  dispatch?: string | null;
201
+ /** @description ARK-107: requested total memory (MiB) when this run carried an explicit memory override. Absent when the run had no memory override. */
202
+ memory_requested_mib?: number | null;
203
+ /** @description ARK-107: achieved total memory (MiB) after the run's resize. Memory shrink is best-effort, so this can exceed memory_requested_mib when guest pages are pinned. Absent when the run had no memory override. */
204
+ memory_achieved_mib?: number | null;
205
+ /** @description ARK-107: true when the run's memory shrink was partial (achieved differs from requested beyond the virtio-mem block granularity). The command still ran at the achieved footprint (best-effort); this flags the gap instead of a silent success. Defaults false. */
206
+ memory_partial?: boolean;
186
207
  };
187
208
  BackgroundRunResponse: {
188
209
  run_id: string;
189
- /** @default [] */
190
- tunnels?: components["schemas"]["Tunnel"][];
210
+ /** @description Lifecycle state — "running" for a backgrounded run. */
211
+ state?: string;
191
212
  };
192
213
  Run: {
193
214
  run_id: string;
@@ -197,13 +218,12 @@ interface components {
197
218
  started_at: string;
198
219
  completed_at?: string | null;
199
220
  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. */
221
+ /** @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
222
  fail_reason?: string | null;
202
223
  stdout: string;
203
224
  stdout_encoding: string;
204
225
  stderr: string;
205
226
  stderr_encoding: string;
206
- tunnels: components["schemas"]["Tunnel"][];
207
227
  /** @default 0 */
208
228
  retry_count?: number;
209
229
  vm_id?: string | null;
@@ -221,7 +241,7 @@ interface components {
221
241
  started_at: string;
222
242
  completed_at?: string | null;
223
243
  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. */
244
+ /** @description System failure explanation when `state` is `failed` see `Run.fail_reason`. Distinct from the program's `stderr`. */
225
245
  fail_reason?: string | null;
226
246
  vm_id?: string | null;
227
247
  vm_name?: string | null;
@@ -234,6 +254,48 @@ interface components {
234
254
  runs: components["schemas"]["RunSummary"][];
235
255
  next_cursor?: string | null;
236
256
  };
257
+ OrgRunListRow: {
258
+ /** @enum {string} */
259
+ source: "cf" | "arkerd";
260
+ t_ms: number;
261
+ request_id: string;
262
+ run_id: string;
263
+ vm_id: string;
264
+ session_id: string;
265
+ region: string;
266
+ status: number;
267
+ total_ms: number;
268
+ queue_ms: number;
269
+ lambda_call_ms: number;
270
+ lambda_duration_ms: number;
271
+ executor_duration_ms: number;
272
+ executor_kind: string;
273
+ executor_cpu_ms: number;
274
+ executor_mem_mb: number;
275
+ lambda_cpu_ms: number;
276
+ lambda_mem_mb: number;
277
+ vm_vcpus: number;
278
+ vm_memory_mib: number;
279
+ path: string;
280
+ method: string;
281
+ command: string;
282
+ source_vm_id: string;
283
+ exit_code: number | null;
284
+ endpoint: string;
285
+ api_key_prefix: string;
286
+ body_bytes_in: number;
287
+ body_bytes_out: number;
288
+ body_in: string;
289
+ body_out: string;
290
+ };
291
+ ListOrgRunsResponse: {
292
+ since: number;
293
+ until: number;
294
+ limit: number;
295
+ offset: number;
296
+ lite: boolean;
297
+ rows: components["schemas"]["OrgRunListRow"][];
298
+ };
237
299
  NetworkStatus: {
238
300
  inbound: components["schemas"]["InboundStatus"];
239
301
  };
@@ -249,32 +311,6 @@ interface components {
249
311
  protocol: string;
250
312
  url?: string | null;
251
313
  };
252
- Tunnel: {
253
- /** @description The VM this tunnel belongs to. Always populated, including when embedded in `Run.tunnels`. */
254
- vm_id: string;
255
- /** @description Unique-per-VM identifier. */
256
- port: number;
257
- /** @description The Run that opened this tunnel, if any. Tunnels allocated at fork time have `run_id: null`. */
258
- run_id?: string | null;
259
- visibility: string;
260
- protocol: string;
261
- url?: string | null;
262
- state: components["schemas"]["TunnelState"];
263
- message?: string | null;
264
- started_at?: string | null;
265
- vm_name?: string | null;
266
- source_org_id?: string | null;
267
- region?: string | null;
268
- /** @enum {string|null} */
269
- provider?: "aws" | "aws-burst" | null;
270
- };
271
- ListTunnelsResponse: {
272
- tunnels: components["schemas"]["Tunnel"][];
273
- next_cursor?: string | null;
274
- };
275
- DeleteTunnelResponse: {
276
- deleted: boolean;
277
- };
278
314
  CancelRunResponse: {
279
315
  cancelled: boolean;
280
316
  };
@@ -284,30 +320,13 @@ interface components {
284
320
  } | null;
285
321
  cwd?: string | null;
286
322
  };
287
- ResizeRequest: {
288
- vcpu_count?: number | null;
289
- memory_mib?: number | null;
290
- disk_mib?: number | null;
291
- };
292
- ResizeResponse: {
293
- resized: boolean;
294
- };
295
323
  Sync: {
296
324
  sync_id: string;
297
325
  vm_id: string;
298
326
  filesystem_id: string;
299
327
  /** @description VM-side path where the filesystem is mounted. Same field name as used by `SyncReadRequest.path`. */
300
328
  path: string;
301
- created_at: string;
302
- vm_name?: string | null;
303
- filesystem_name?: string | null;
304
- source_org_id?: string | null;
305
329
  region?: string | null;
306
- /** @enum {string|null} */
307
- provider?: "aws" | "aws-burst" | null;
308
- live?: boolean;
309
- live_error?: string;
310
- idempotent?: boolean;
311
330
  };
312
331
  ListSyncsResponse: {
313
332
  syncs: components["schemas"]["Sync"][];
@@ -318,17 +337,12 @@ interface components {
318
337
  };
319
338
  SyncCreateRequest: {
320
339
  filesystem_id: string;
321
- /** @description VM-side path. Returns `ErrorResponse` code `conflict` if a sync already exists at this path. */
322
340
  path?: string;
323
341
  };
324
342
  SyncReadRequest: {
325
- /** @constant */
326
- op: "read";
327
343
  path: string;
328
344
  };
329
345
  SyncWriteRequest: {
330
- /** @constant */
331
- op: "write";
332
346
  writes: components["schemas"]["SyncWriteEntry"][];
333
347
  };
334
348
  SyncWriteEntry: components["schemas"]["SyncChunkWrite"] | components["schemas"]["SyncPresignedWriteRequest"] | components["schemas"]["SyncPresignedWriteCommit"];
@@ -433,6 +447,32 @@ interface components {
433
447
  FilesystemCreateRequest: {
434
448
  name: string;
435
449
  };
450
+ VmResources: {
451
+ vcpu?: number | null;
452
+ memory_mib?: number | null;
453
+ disk_mib?: number | null;
454
+ };
455
+ NetworkInput: {
456
+ /** @description Enable inbound reachability for this VM. Defaults to false. */
457
+ reachable?: boolean | null;
458
+ /** @description OpenSSH public keys authorized for terminator auth and in-VM sshd injection. */
459
+ ssh_public_keys?: string[];
460
+ };
461
+ SshPublicKeyInfo: {
462
+ public_key: string;
463
+ fingerprint: string;
464
+ };
465
+ VmNetwork: {
466
+ reachable: boolean;
467
+ /** @description Stable per-VM hostname, present when reachable is true. */
468
+ hostname?: string | null;
469
+ /** @description Authorized SSH keys with fingerprints. Returned by GET /v1/vms/{id}; omitted from list responses when empty. */
470
+ ssh_public_keys?: components["schemas"]["SshPublicKeyInfo"][];
471
+ };
472
+ PatchVmRequest: {
473
+ resources?: components["schemas"]["VmResources"] | null;
474
+ network?: components["schemas"]["NetworkInput"] | null;
475
+ };
436
476
  };
437
477
  responses: {
438
478
  /** @description API error. */
@@ -459,7 +499,6 @@ interface components {
459
499
  RunId: string;
460
500
  SessionId: string;
461
501
  SyncId: string;
462
- TunnelPort: number;
463
502
  FilesystemId: string;
464
503
  /** @description Opaque pagination cursor returned by the previous page's `next_cursor`. */
465
504
  Cursor: string | null;
@@ -489,7 +528,7 @@ declare const CHUNK_SIZE: number;
489
528
  */
490
529
  declare const ARKER_ORG_ID = "ArkerHQ";
491
530
  type FetchLike = typeof fetch;
492
- type HttpMethod = "GET" | "POST" | "DELETE";
531
+ type HttpMethod = "GET" | "POST" | "PATCH" | "DELETE";
493
532
  interface RetryOptions {
494
533
  attempts?: number;
495
534
  baseDelayMs?: number;
@@ -522,13 +561,15 @@ interface ArkerOptions {
522
561
  type VmState = ApiSchema<"VmState">;
523
562
  type SessionState = ApiSchema<"SessionState">;
524
563
  type RunState = ApiSchema<"RunState">;
525
- type TunnelState = ApiSchema<"TunnelState">;
526
564
  type ResourceKind = ApiSchema<"ResourceKind">;
527
565
  type ErrorCode = ApiSchema<"ErrorCode">;
528
566
  type NetworkPolicy = ApiSchema<"NetworkPolicy">;
529
567
  type NetworkPolicyInput = ApiSchema<"NetworkPolicyInput">;
530
568
  type ForkRequest = ApiSchema<"ForkRequest">;
531
569
  type ForkOptions = ForkRequest;
570
+ type VmResources = ApiSchema<"VmResources">;
571
+ type VmNetwork = ApiSchema<"VmNetwork">;
572
+ type NetworkInput = ApiSchema<"NetworkInput">;
532
573
  type Session = ApiSchema<"Session">;
533
574
  type Vm = ApiSchema<"Vm">;
534
575
  type ListVmsResponse = ApiSchema<"ListVmsResponse">;
@@ -564,9 +605,6 @@ type RunOptions = Partial<Omit<RunRequest, "command">> & {
564
605
  };
565
606
  type InboundPortRequest = ApiSchema<"InboundPortRequest">;
566
607
  type NetworkRequest = ApiSchema<"NetworkRequest">;
567
- type Tunnel = ApiSchema<"Tunnel">;
568
- type ListTunnelsResponse = ApiSchema<"ListTunnelsResponse">;
569
- type DeleteTunnelResponse = ApiSchema<"DeleteTunnelResponse">;
570
608
  type NetworkStatus = ApiSchema<"NetworkStatus">;
571
609
  type RunResponse = ApiSchema<"RunResponse">;
572
610
  type CompletedRunResponse = ApiSchema<"CompletedRunResponse">;
@@ -574,10 +612,12 @@ type BackgroundRunResponse = ApiSchema<"BackgroundRunResponse">;
574
612
  type Run = ApiSchema<"Run">;
575
613
  type RunSummary = ApiSchema<"RunSummary">;
576
614
  type ListRunsResponse = ApiSchema<"ListRunsResponse">;
615
+ type OrgRunListRow = ApiSchema<"OrgRunListRow">;
616
+ type ListOrgRunsResponse = ApiSchema<"ListOrgRunsResponse">;
617
+ type RunListRow = OrgRunListRow;
577
618
  type CancelRunResponse = ApiSchema<"CancelRunResponse">;
578
619
  type CreateSessionRequest = ApiSchema<"CreateSessionRequest">;
579
- type ResizeRequest = ApiSchema<"ResizeRequest">;
580
- type ResizeResponse = ApiSchema<"ResizeResponse">;
620
+ type PatchVmRequest = ApiSchema<"PatchVmRequest">;
581
621
  type ErrorResponse = ApiSchema<"ErrorResponse">;
582
622
  /** @deprecated Use `Session`. */
583
623
  type SessionInfo = Session;
@@ -589,8 +629,6 @@ type RunNetworkRequest = NetworkRequest;
589
629
  type RunNetworkStatus = NetworkStatus;
590
630
  /** @deprecated Use `InboundPortRequest`. */
591
631
  type RunInboundPortRequest = InboundPortRequest;
592
- /** @deprecated Use `Tunnel`. */
593
- type RunTunnelStatus = Tunnel;
594
632
  interface CompletedRunResult {
595
633
  type: "completed";
596
634
  /** The run's own id. Present for executed runs; absent for operation acks. */
@@ -605,15 +643,91 @@ interface CompletedRunResult {
605
643
  /** System failure explanation when `state` is "failed". Distinct from
606
644
  * `stderr` (the program's own error output); null otherwise. */
607
645
  failReason?: string | null;
646
+ /** Requested total memory (MiB), present when the run carried a memory override. */
647
+ memoryRequestedMib?: number | null;
648
+ /** Achieved total memory (MiB) after the run's resize. */
649
+ memoryAchievedMib?: number | null;
650
+ /** True when the runtime could not reach the requested memory target exactly. */
651
+ memoryPartial?: boolean;
608
652
  }
609
653
  interface BackgroundRunResult {
610
654
  type: "background";
611
655
  runId: string;
612
656
  /** Lifecycle state — "running". */
613
657
  state: string;
614
- tunnels: Tunnel[];
615
658
  }
616
659
  type RunResult = CompletedRunResult | BackgroundRunResult;
660
+ interface ListOrgRunsOptions {
661
+ since?: number;
662
+ until?: number;
663
+ vm?: string;
664
+ vmIds?: string[];
665
+ region?: string;
666
+ provider?: "aws" | "aws-burst";
667
+ source?: "cf" | "arkerd";
668
+ search?: string;
669
+ limit?: number;
670
+ offset?: number;
671
+ lite?: boolean;
672
+ runtime?: string;
673
+ endpoint?: "run" | "fork" | "sync";
674
+ actions?: string[];
675
+ status?: string[];
676
+ statusMin?: number;
677
+ statusMax?: number;
678
+ sort?: "when" | "status" | "path" | "total" | "queue" | "your_code" | "runtime";
679
+ dir?: "asc" | "desc";
680
+ }
681
+ type PtyInput = string | Uint8Array | ArrayBuffer;
682
+ interface PtyConnectOptions {
683
+ /** Existing session to attach. Omit to create a new session first. */
684
+ sessionId?: string;
685
+ cols?: number;
686
+ rows?: number;
687
+ command?: string;
688
+ /** Defaults to the backend's persistent detach semantics. */
689
+ persist?: boolean;
690
+ /**
691
+ * Auto-cancel the PTY run after this many seconds with no terminal I/O. When
692
+ * the window elapses the server completes the underlying run and DESTROYS the
693
+ * shell (not just a detach) — a reconnect to the same `sessionId` starts
694
+ * fresh. Unset (default) means no auto-cancel.
695
+ */
696
+ cancelTtlSecs?: number;
697
+ /** @internal Test/runtime override for browser-ticket vs Node-header auth. */
698
+ useTicket?: boolean;
699
+ /** @internal Test/runtime override for WebSocket construction. */
700
+ webSocketFactory?: PtyWebSocketFactory;
701
+ }
702
+ interface PtyCloseEvent {
703
+ code?: number;
704
+ reason?: string;
705
+ }
706
+ interface PtyConnection {
707
+ readonly sessionId: string;
708
+ readonly ready: Promise<void>;
709
+ onData(listener: (data: Uint8Array) => void): () => void;
710
+ onClose(listener: (event: PtyCloseEvent) => void): () => void;
711
+ onError(listener: (error: unknown) => void): () => void;
712
+ send(data: PtyInput): void;
713
+ resize(cols: number, rows: number): void;
714
+ kill(): void;
715
+ close(code?: number, reason?: string): void;
716
+ }
717
+ interface PtyWebSocketFactoryInit {
718
+ headers?: Record<string, string>;
719
+ }
720
+ type PtyWebSocketFactory = (url: string, init: PtyWebSocketFactoryInit) => PtyWebSocketLike | Promise<PtyWebSocketLike>;
721
+ interface PtyWebSocketLike {
722
+ binaryType?: string;
723
+ readyState?: number;
724
+ send(data: string | Uint8Array | ArrayBuffer): void;
725
+ close(code?: number, reason?: string): void;
726
+ addEventListener?: (type: string, listener: (event: unknown) => void) => void;
727
+ removeEventListener?: (type: string, listener: (event: unknown) => void) => void;
728
+ on?: (type: string, listener: (...args: unknown[]) => void) => void;
729
+ off?: (type: string, listener: (...args: unknown[]) => void) => void;
730
+ }
617
731
  declare class ArkerError extends Error {
618
732
  readonly code: string;
619
733
  readonly status: number;
@@ -687,6 +801,11 @@ declare class Arker {
687
801
  vms: VM[];
688
802
  nextCursor: string | null;
689
803
  }>;
804
+ /**
805
+ * List run activity visible to the authenticated caller across VMs,
806
+ * providers, and regions. Admin call — routed through the control plane.
807
+ */
808
+ listRuns(opts?: ListOrgRunsOptions): Promise<ListOrgRunsResponse>;
690
809
  /** Compute call — goes direct to the backend hosting this VM (no
691
810
  * control-plane hop). Returns a fully-populated VM handle. */
692
811
  getVm(vmId: string): Promise<VM>;
@@ -707,6 +826,8 @@ declare class Arker {
707
826
  /** @internal */
708
827
  _retryDelay(attempt: number): number;
709
828
  /** @internal */
829
+ _authHeaders(): Record<string, string>;
830
+ /** @internal */
710
831
  _baseUrlFor(ref: string): string;
711
832
  }
712
833
  interface ListOpts {
@@ -729,12 +850,15 @@ declare class VM {
729
850
  readonly vcpu_count?: number | null;
730
851
  readonly memory_mib?: number | null;
731
852
  readonly disk_mib?: number | null;
853
+ readonly network?: NetworkPolicy;
854
+ readonly max_vcpus?: number | null;
855
+ readonly max_memory_mib?: number | null;
856
+ readonly min_memory_mib?: number | null;
732
857
  readonly started_at?: string | null;
733
858
  readonly root_source_vm_id?: string | null;
734
859
  readonly root_source_vm_name?: string | null;
735
860
  readonly worker_id?: string | null;
736
861
  readonly sessions?: Session[];
737
- readonly tunnels?: Tunnel[];
738
862
  constructor(client: Arker, vmId: string, baseUrl?: string, data?: Vm);
739
863
  /** Re-fetch this VM and return a fresh, fully-populated handle. */
740
864
  refresh(): Promise<VM>;
@@ -763,7 +887,15 @@ declare class VM {
763
887
  private syncWritePresigned;
764
888
  private putPresigned;
765
889
  private sendOneWrite;
766
- resize(request: ResizeRequest): Promise<ResizeResponse>;
890
+ /**
891
+ * Update this VM's resource allocation and/or network settings via
892
+ * `PATCH /v1/vms/{id}`. Returns the updated `Vm`.
893
+ *
894
+ * Accepts either a `PatchVmRequest` (`{ resources, network }`) or, for
895
+ * convenience, flat resource fields (`{ vcpu, memory_mib, disk_mib }`)
896
+ * which are folded into `resources`.
897
+ */
898
+ resize(request: PatchVmRequest | (VmResources & Pick<PatchVmRequest, "network">)): Promise<Vm>;
767
899
  delete(): Promise<DeleteVmResponse>;
768
900
  listSyncs(opts?: ListOpts & {
769
901
  filesystemId?: string;
@@ -787,11 +919,7 @@ declare class VM {
787
919
  createSession(request?: CreateSessionRequest): Promise<Session>;
788
920
  getSession(sessionId: string): Promise<Session>;
789
921
  deleteSession(sessionId: string): Promise<DeleteSessionResponse>;
790
- listTunnels(opts?: ListOpts & {
791
- state?: TunnelState;
792
- }): Promise<ListTunnelsResponse>;
793
- getTunnel(port: number): Promise<Tunnel>;
794
- deleteTunnel(port: number): Promise<DeleteTunnelResponse>;
922
+ connectPty(options?: PtyConnectOptions): Promise<PtyConnection>;
795
923
  }
796
924
 
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 };
925
+ 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 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 ListVmsResponse, type NetworkInput, type NetworkPolicy, type NetworkPolicyInput, type NetworkRequest, type NetworkStatus, type OrgRunListRow, type PatchVmRequest, type PtyCloseEvent, type PtyConnectOptions, type PtyConnection, type PtyInput, type PtyWebSocketFactory, 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 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, VM, type Vm, type VmNetwork, type VmResources, 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-7BHPVQNG.js";
8
8
  export {
9
9
  ARKER_ORG_ID,
10
10
  Arker,