@theagenticguy/microvms 0.8.0 → 0.10.0

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/index.d.ts CHANGED
@@ -1,6 +1,14 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
3
 
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
4
12
  /**
5
13
  * One VM with coding agents in it: the sandbox plus the specs it is built for.
6
14
  *
@@ -17,6 +25,15 @@ export declare class AgentVm {
17
25
  * the core before any AWS call.
18
26
  */
19
27
  static create(region: Region, agents?: Array<AgentSpecInput> | undefined | null): Promise<AgentVm>
28
+ /** Adopts the agent VM registered as `name` in `registry`; see `Sandbox.fromName`. */
29
+ static fromName(region: Region, name: string, registry: NameRegistry, agents?: Array<AgentSpecInput> | undefined | null, port?: number | undefined | null): Promise<AgentVm>
30
+ /**
31
+ * An agent VM for a VM another process launched; see `Sandbox.adopt`.
32
+ *
33
+ * `agents` states what the VM carries and defaults to Claude Code alone; read
34
+ * `installedAgents(session)` first when the adopting process does not know.
35
+ */
36
+ static adopt(region: Region, microvmId: string, endpoint: string, agentToken: string, agents?: Array<AgentSpecInput> | undefined | null, port?: number | undefined | null): Promise<AgentVm>
20
37
  /** The specs this VM carries, resolved, in profile order. */
21
38
  agents(): Array<AgentSpec>
22
39
  region(): Region
@@ -47,11 +64,18 @@ export declare class AgentVm {
47
64
  * uploaded `buildArtifact`'s bytes. Several minutes, server-side.
48
65
  */
49
66
  buildImage(options: AgentImageOptions, size?: SizeClass | undefined | null): Promise<Image>
67
+ /**
68
+ * Hands the VM off to another process; see `Sandbox.detach`. The adopter passes the
69
+ * same agents to `AgentVm.adopt`.
70
+ */
71
+ detach(): Promise<Detached>
50
72
  /**
51
73
  * Launches with egress and waits for the daemon to answer.
52
74
  *
53
- * Egress is not optional: neither agent reaches Bedrock without it. The idle knobs default
54
- * to the core's figures (ten-minute idle and suspended windows, a one-hour ceiling).
75
+ * Egress is not optional: neither agent reaches Bedrock without it. The managed internet
76
+ * connector is the default; `egressNetworkConnectors` replaces it with customer-managed
77
+ * VPC connectors, whose VPC must route to Bedrock. The idle knobs default to the core's
78
+ * figures (ten-minute idle and suspended windows, a one-hour ceiling).
55
79
  */
56
80
  launch(options: AgentLaunchOptions): Promise<Session>
57
81
  /**
@@ -102,8 +126,8 @@ export declare class BearerToken {
102
126
  /** The token text, for a caller writing it into an environment themselves. */
103
127
  expose(): string
104
128
  /**
105
- * The presign's expiry, seconds since the epoch. An upper bound: the service also caps
106
- * validity at the signing credentials' own expiry.
129
+ * Effective Unix expiry, capped at the known signing credential expiry.
130
+ * With missing credential expiry metadata this is only an upper bound.
107
131
  */
108
132
  get expiresAt(): number
109
133
  /** The region the token was minted for. */
@@ -122,6 +146,39 @@ export declare class BuildHookTimeout {
122
146
  toString(): string
123
147
  }
124
148
 
149
+ /**
150
+ * MicroVM lifecycle by ID: get, list, suspend, resume, terminate, and wait.
151
+ *
152
+ * Holds no lifecycle state, so it checks nothing a `Sandbox` would (STATE-5, STATE-7,
153
+ * STATE-12). Use it when a process has only an identifier.
154
+ */
155
+ export declare class ControlPlane {
156
+ /**
157
+ * Resolves credentials for `region` from the default chain. A factory because
158
+ * credential resolution is async.
159
+ */
160
+ static create(region: Region): Promise<ControlPlane>
161
+ /** `GetMicrovm`. */
162
+ get(microvmId: string): Promise<Microvm>
163
+ /** `ListMicrovms`, every page, optionally narrowed to one image and version. */
164
+ list(options?: ListMicrovmsOptions | undefined | null): Promise<Array<MicrovmSummary>>
165
+ /** `SuspendMicrovm`. Resolves once accepted; `waitForState` for SUSPENDED. */
166
+ suspend(microvmId: string): Promise<void>
167
+ /** `ResumeMicrovm`. Resolves once accepted; `waitForState` for RUNNING. */
168
+ resume(microvmId: string): Promise<void>
169
+ /** `TerminateMicrovm`. Resolves once accepted; `waitForState` for TERMINATED. */
170
+ terminate(microvmId: string): Promise<void>
171
+ /**
172
+ * Polls `GetMicrovm` until the state is one of `wanted`.
173
+ *
174
+ * Reaching one of `failOn` first rejects naming the state and `stateReason`; running
175
+ * past `timeout` rejects with a timeout.
176
+ */
177
+ waitForState(microvmId: string, wanted: Array<string>, options?: WaitForStateOptions | undefined | null): Promise<Microvm>
178
+ /** The region this plane addresses. */
179
+ get region(): string
180
+ }
181
+
125
182
  /** Per-phase attribution for one sandbox, measured or projected. */
126
183
  export declare class CostReport {
127
184
  get label(): string
@@ -161,6 +218,28 @@ export declare class CostReport {
161
218
  toJson(): string
162
219
  }
163
220
 
221
+ /**
222
+ * What another process needs to adopt a VM handed off by `sandbox.detach()`.
223
+ *
224
+ * Pass the fields to `Sandbox.adopt(region, microvmId, endpoint, agentToken, port)`. The
225
+ * token is a method rather than a getter so it is never read by accident, and it is absent
226
+ * from `toString()`; `JSON.stringify` of the instance carries nothing.
227
+ */
228
+ export declare class Detached {
229
+ get microvmId(): string
230
+ get endpoint(): string
231
+ /** The region the VM runs in, ready to pass to `Sandbox.adopt`. */
232
+ get region(): Region
233
+ /** The daemon port the endpoint's proxy tokens are minted for. */
234
+ get port(): number
235
+ /** The VM's bearer credential; store it only privately. */
236
+ agentToken(): string
237
+ /** Every field, token included, for a private encrypted store. */
238
+ toObject(): DetachedObject
239
+ /** The record without its secret. */
240
+ toString(): string
241
+ }
242
+
164
243
  /**
165
244
  * Seconds, plus how we know them.
166
245
  *
@@ -350,6 +429,19 @@ export declare class ExecProcess {
350
429
  */
351
430
  export declare class ExecStream {}
352
431
 
432
+ /**
433
+ * A running keepalive. Call `stop()` when the work is done; `done()` resolves when it
434
+ * ends on its own. A garbage-collected handle stops the keepalive.
435
+ */
436
+ export declare class KeepAwake {
437
+ /** Whether the keepalive is still polling. */
438
+ get running(): boolean
439
+ /** Stops polling and resolves with the report; rejects with the error that ended it. */
440
+ stop(): Promise<KeepAwakeReport>
441
+ /** Resolves when the keepalive ends (`whileBusy`, `maxDurationSec`, or `stop()`). */
442
+ done(): Promise<KeepAwakeReport>
443
+ }
444
+
353
445
  /** One phase's one billing line: what was consumed, and what that costs. */
354
446
  export declare class LineItem {
355
447
  get phase(): string
@@ -383,6 +475,68 @@ export declare class LineItem {
383
475
  toString(): string
384
476
  }
385
477
 
478
+ /** One named VM: everything `Sandbox.adopt` needs, under a name. */
479
+ export declare class NameRecord {
480
+ /**
481
+ * A record for a VM this process can already address. Refuses an illegal name or an
482
+ * empty id, endpoint, or token.
483
+ */
484
+ constructor(name: string, microvmId: string, endpoint: string, agentToken: string, region: Region)
485
+ /** A record naming the VM `sandbox` addresses — launched or adopted. */
486
+ static forSandbox(name: string, sandbox: Sandbox): Promise<NameRecord>
487
+ /** A record from `toObject()` output (or a CLI registry file's JSON), checked. */
488
+ static fromObject(object: NameRecordObject): NameRecord
489
+ /**
490
+ * The record as a plain object, **agent token included** — the form to store privately
491
+ * and read back with `fromObject`.
492
+ */
493
+ toObject(): NameRecordObject
494
+ get name(): string
495
+ get microvmId(): string
496
+ get endpoint(): string
497
+ /**
498
+ * The VM's bearer credential. A method rather than a getter, so it is never read by
499
+ * accident; store it only privately.
500
+ */
501
+ agentToken(): string
502
+ get region(): string
503
+ /** Seconds since the epoch when the name was registered. */
504
+ get at(): number
505
+ get egressPosture(): string | null
506
+ /** The record without its secrets. */
507
+ toString(): string
508
+ }
509
+
510
+ /**
511
+ * The CLI's name registry: one owner-only JSON file per name under `<stateDir>/names/`.
512
+ *
513
+ * `stateDir` defaults to the CLI's — `$MICROVM_STATE_DIR`, else `~/.microvm/runs` — so a
514
+ * name registered here resolves in `microvm exec --name` and the reverse.
515
+ */
516
+ export declare class NameRegistry {
517
+ constructor(stateDir?: string | undefined | null)
518
+ /** The directory holding the name files. */
519
+ get directory(): string
520
+ /**
521
+ * The record registered as `name`, or `null`. A file that exists but does not parse
522
+ * throws rather than reading as free.
523
+ */
524
+ get(name: string): NameRecord | null
525
+ /** Writes `record` under its name, replacing any earlier record, owner-only on Unix. */
526
+ put(record: NameRecord): void
527
+ /** Names the VM `sandbox` addresses and writes the record; resolves with it. */
528
+ register(name: string, sandbox: Sandbox): Promise<NameRecord>
529
+ /** Removes `name`, answering whether a record was there. */
530
+ delete(name: string): boolean
531
+ /** Every readable record, sorted by name. */
532
+ list(): Array<NameRecord>
533
+ /**
534
+ * Removes every name registered to `microvmId` and returns them — the step after a
535
+ * terminate, so no name outlives its VM.
536
+ */
537
+ releaseByVm(microvmId: string): Array<string>
538
+ }
539
+
386
540
  /** The pinned rate table, and everything it says about itself. */
387
541
  export declare class RateTable {
388
542
  /**
@@ -554,6 +708,37 @@ export declare class Sandbox {
554
708
  wasTerminated(): Promise<boolean>
555
709
  /** How many times the token has been installed. Never above one (STATE-3). */
556
710
  bootstrapCount(): Promise<number>
711
+ /**
712
+ * A sandbox for a VM another process launched, from its private record.
713
+ *
714
+ * The lifecycle is read from `GetMicrovm`, so suspend, resume, and terminate start from
715
+ * the service's state and keep every guard. The VM was bootstrapped by its own launch,
716
+ * so `run` is refused and no run-hook payload is ever sent. Never publish or log
717
+ * `agentToken`; it appears in no error.
718
+ */
719
+ static adopt(region: Region, microvmId: string, endpoint: string, agentToken: string, port?: number | undefined | null): Promise<Sandbox>
720
+ /**
721
+ * Adopts the VM registered as `name` in `registry`; see `Sandbox.adopt`.
722
+ *
723
+ * `region` must match the record's: an id from another region addresses nothing here.
724
+ */
725
+ static fromName(region: Region, name: string, registry: NameRegistry, port?: number | undefined | null): Promise<Sandbox>
726
+ /** Whether this sandbox was built by `adopt` rather than by its own launch. */
727
+ adopted(): Promise<boolean>
728
+ /**
729
+ * Hands the VM off to another process and resolves with what that process adopts it
730
+ * with.
731
+ *
732
+ * For a workflow whose steps run in different processes: the launching step calls this
733
+ * instead of dropping the sandbox (which warns that a live VM was abandoned), persists
734
+ * the record privately, and a later step calls `Sandbox.adopt` with it. The VM keeps
735
+ * running and no AWS call is made. Afterwards this sandbox is inert: `run`,
736
+ * `waitUntilRunning`, `suspend`, `resume`, and `terminate` are refused. Rejects with
737
+ * `ERR_PRECONDITION` without a live VM or when already detached.
738
+ */
739
+ detach(): Promise<Detached>
740
+ /** Whether `detach()` handed this sandbox's VM to another process. */
741
+ isDetached(): Promise<boolean>
557
742
  /** The VM id, once launched. */
558
743
  microvmId(): Promise<string | null>
559
744
  /** The proxy endpoint, once launched. */
@@ -570,9 +755,8 @@ export declare class Sandbox {
570
755
  /**
571
756
  * The suspended window this sandbox asked for at launch, in seconds.
572
757
  *
573
- * `null` before a launch, and for a sandbox that did not send the launch — this client is
574
- * the only party that can name the number, because `suspendedDurationSeconds` exists only
575
- * in the `RunMicrovm` request.
758
+ * `null` before this sandbox launches a VM. This accessor reports the requested
759
+ * window; `GetMicrovm` also returns the service's idle policy.
576
760
  */
577
761
  suspendedWindowSecondsAsync(): Promise<number | null>
578
762
  /**
@@ -591,10 +775,23 @@ export declare class Sandbox {
591
775
  * after the caller's artifact upload: a rejection AWS raises costs the upload first.
592
776
  */
593
777
  buildImage(options: BuildImageOptions, size?: SizeClass | undefined | null, runHookTimeout?: RunHookTimeout | undefined | null, buildHookTimeout?: BuildHookTimeout | undefined | null): Promise<Image>
778
+ /**
779
+ * Builds or reuses the content-addressed image for a task: one call from build inputs
780
+ * to a ready image.
781
+ *
782
+ * The name is `<namePrefix>-<hash12>` over the daemon, the Dockerfile, the build
783
+ * context, the base image and the size class. A ready image is returned with
784
+ * `reused: true` and no upload; a running build is waited out; a failed image — or any
785
+ * image under `force` — is deleted and rebuilt; an absent one is uploaded to
786
+ * `s3://<s3Bucket>/<s3KeyPrefix>/<name>/artifact.zip`, created, and waited for. When a
787
+ * concurrent caller creates the name first, this call waits for that build and returns
788
+ * it with `reused: true`. Every local check runs before the first AWS call.
789
+ */
790
+ ensureImage(options: EnsureImageOptions, size?: SizeClass | undefined | null): Promise<EnsuredImage>
594
791
  /**
595
792
  * The artifact bytes to upload to `codeArtifactUri`.
596
793
  *
597
- * The upload is the caller's: S3 is not in the core's dependency set. Takes the same
794
+ * The upload is the caller's on this path (`ensureImage` uploads for itself). Takes the same
598
795
  * options as [`Self::build_image`] so the bytes a caller puts in the bucket are the bytes
599
796
  * the build will receive.
600
797
  */
@@ -609,6 +806,14 @@ export declare class Sandbox {
609
806
  * `Sandbox`. A run with no image at all, before any call. Neither check is in this file.
610
807
  */
611
808
  run(options?: RunOptions | undefined | null): Promise<Session>
809
+ /**
810
+ * Finishes a `run({ wait: false })`: waits for RUNNING and resolves with the session.
811
+ *
812
+ * A launch whose `clientToken` adopted an existing, idle-suspended VM resumes it; a
813
+ * fresh launch that reaches a terminal state first rejects with the service's
814
+ * `stateReason`. Refused unless the launch is still PENDING.
815
+ */
816
+ waitUntilRunning(timeout?: number | undefined | null): Promise<Session>
612
817
  /**
613
818
  * Freezes the VM and waits for the platform to report it.
614
819
  *
@@ -660,12 +865,40 @@ export declare class Session {
660
865
  * in would be handing in one that expires.
661
866
  */
662
867
  static direct(endpoint: string, agentToken: string): Session
868
+ /**
869
+ * Reattach using a private control record, without bootstrapping again.
870
+ * Owns its transport independently of sandbox locks; use a separate attach with
871
+ * a short requestTimeout for keepalives. Never publish or log agentToken.
872
+ */
873
+ static attach(region: Region, microvmId: string, endpoint: string, agentToken: string, port?: number | undefined | null, requestTimeout?: number | undefined | null): Promise<Session>
874
+ /** The guest bearer credential. Store only in a private encrypted control record. */
875
+ agentToken(): Promise<string>
663
876
  /** The endpoint this session addresses. */
664
877
  endpoint(): Promise<string>
878
+ /**
879
+ * The launch's egress posture: `"open"`, `"unsealed"`, `"best-effort"`, or `"sealed"`.
880
+ *
881
+ * The value the CLI envelope's `egressPosture` reports for the same launch options, and
882
+ * what `egressPostureFor` answers before the launch. A session that does not hold its
883
+ * launch options (`Session.direct`, `Session.attach`, an adopted sandbox) reports
884
+ * `"unsealed"`. Advertise network isolation only for `"sealed"`. Async like `endpoint()`,
885
+ * because a sandbox-held session is read under the sandbox's lock.
886
+ */
887
+ egressPosture(): Promise<string>
665
888
  /** The port the proxy token is scoped to. */
666
889
  port(): Promise<number>
667
890
  /** Unauthenticated liveness. */
668
891
  health(): Promise<Health>
892
+ /**
893
+ * Keeps the VM awake by polling health from this process until stopped.
894
+ *
895
+ * The platform counts only inbound requests as activity, so an exec working with no
896
+ * client traffic is suspended once `maxIdleDurationSeconds` passes. Resolves at once
897
+ * with a running handle. On a sandbox-held session a suspend or terminate through the
898
+ * sandbox ends the keepalive before its next poll; stop it before suspending through
899
+ * anything else, or the next poll auto-resumes the VM.
900
+ */
901
+ keepAwake(options?: KeepAwakeOptions | undefined | null): Promise<KeepAwake>
669
902
  /**
670
903
  * Polls health until the daemon reports bootstrapped.
671
904
  *
@@ -706,6 +939,22 @@ export declare class Session {
706
939
  exec(execId: string): Promise<ExecHandle>
707
940
  /** Start, wait, ack. The one-shot shape, for when output is all you want. */
708
941
  runSync(command: string | Array<string>, options?: ExecOptions | undefined | null): Promise<ExecResult>
942
+ /**
943
+ * Start, stream, and collect one command: exactly one `ExecResult` back (BIND-6..10).
944
+ *
945
+ * With `onOutput`, each output chunk (a `StreamEvent` of kind `"output"`) is handed to it
946
+ * as it arrives. The result then comes from the ack that follows the terminal `exit`
947
+ * event, or, when the stream ends without one, from a wait and ack. When `timeoutSec +
948
+ * clientGraceSec` passes first (or, with no `timeoutSec`, the VM's maximum lifetime), the
949
+ * process group is killed and the exec waited for and acked within `clientGraceSec` once
950
+ * more; if that fails too the result is synthesized with `posixExitCode` 124.
951
+ *
952
+ * A throwing `onOutput` stops delivery; the exec is still waited for and acked so nothing
953
+ * is left behind, and then the promise rejects with the callback's message. `shell: true`
954
+ * runs `/bin/sh -c`; for bash semantics pass `shell: "bash"` with a script string, or
955
+ * `["bash", "-c", script]` for a daemon that predates named shells.
956
+ */
957
+ runToCompletion(command: string | string[], options?: CompletionRequest | undefined | null, onOutput?: ((chunk: StreamEvent) => unknown) | undefined | null): Promise<ExecResult>
709
958
  /** Signals an exec's whole process group. Returns whether anything was signalled. */
710
959
  kill(execId: string): Promise<boolean>
711
960
  /**
@@ -800,6 +1049,16 @@ export declare class SizeClass {
800
1049
  * readings differ in both memory and rate, and neither has been measured.
801
1050
  */
802
1051
  static fromBaselineMib(mib: number): SizeClass
1052
+ /**
1053
+ * The smallest class whose baseline covers a resource request (BIND-14).
1054
+ *
1055
+ * `cpus` in vCPUs and `memoryMib` in MiB, each a request; `undefined` or zero is no
1056
+ * requirement on that axis, and with none on either the answer is `defaultClass()`.
1057
+ * Chosen by baseline, the billed and always-present figure. Throws `ERR_INVALID_ARG`
1058
+ * naming the largest class when no class covers the request, or for a CPU figure that is
1059
+ * not a finite non-negative number.
1060
+ */
1061
+ static fromRequest(cpus?: number | undefined | null, memoryMib?: number | undefined | null): SizeClass
803
1062
  /**
804
1063
  * The platform's default, 2048 MiB. Not the smallest — a 0.5 GB baseline fixes the
805
1064
  * guest's always-present ceiling at 2 GB, which OOM-kills a real test suite, and the
@@ -870,10 +1129,27 @@ export interface AgentLaunchOptions {
870
1129
  imageIdentifier: string
871
1130
  /** The execution role. Optional in the model; every real launch needs one. */
872
1131
  executionRoleArn?: string
1132
+ /** Persist this secret privately before launch when recovery is needed. */
1133
+ agentToken?: string
1134
+ /** Persist once per intended launch and reuse with the identical request. */
1135
+ clientToken?: string
873
1136
  maxIdleSec?: number
874
1137
  suspendedSec?: number
875
1138
  autoResume?: boolean
876
1139
  maxDurationSec?: number
1140
+ /** Pins the launch to one image version rather than the latest active one. */
1141
+ imageVersion?: string
1142
+ /**
1143
+ * Customer-managed VPC egress connector ARNs. When given they replace the managed
1144
+ * internet connector, and the VPC must route to Bedrock.
1145
+ */
1146
+ egressNetworkConnectors?: Array<string>
1147
+ /** Per-VM CloudWatch log group. Omitted keeps the service's default destination. */
1148
+ logGroup?: string
1149
+ /** An exact log stream inside `logGroup`. */
1150
+ logStream?: string
1151
+ /** Turns per-VM logging off. Cannot be combined with `logGroup` or `logStream`. */
1152
+ disableLogging?: boolean
877
1153
  }
878
1154
 
879
1155
  /** A resolved spec: the model it will use and the command `prompt` runs. */
@@ -901,6 +1177,16 @@ export interface AgentSpecInput {
901
1177
  cliVersion?: string
902
1178
  }
903
1179
 
1180
+ /**
1181
+ * The base a task Dockerfile pairs with: the managed base's `name`, so `baseImageArn` is
1182
+ * unchanged, and the Dockerfile's first `FROM` as `dockerRef`, digest pin included.
1183
+ *
1184
+ * `buildImage` refuses a Dockerfile whose first `FROM` is not the base's `dockerRef`; a base
1185
+ * derived from that Dockerfile passes by construction. Throws `ERR_INVALID_ARG` for a
1186
+ * Dockerfile with no `FROM`.
1187
+ */
1188
+ export declare function baseImageFromDockerfile(dockerfile: string): BaseImageInput
1189
+
904
1190
  /**
905
1191
  * The platform's managed base image, paired with the Dockerfile `FROM` it goes with.
906
1192
  *
@@ -943,8 +1229,8 @@ export interface BuildImageOptions {
943
1229
  /** The daemon binary's bytes, zipped into the artifact. */
944
1230
  binary: Uint8Array
945
1231
  /**
946
- * Where the artifact is uploaded to. This client does not upload — S3 is not in the
947
- * core's dependency set — so the caller puts the bytes there and passes the URI.
1232
+ * Where the artifact is uploaded to. `buildImage` does not upload: the caller puts the
1233
+ * bytes there and passes the URI. `ensureImage` is the path that uploads for itself.
948
1234
  */
949
1235
  codeArtifactUri: string
950
1236
  /** The build role, which must grant logs on `/aws/lambda-microvms/*`. */
@@ -983,6 +1269,40 @@ export declare function buildUnpricedReason(): string
983
1269
  /** The warm-pool argument, with its own counter-argument attached. */
984
1270
  export declare function compareResidency(size: SizeClass, holdSeconds: number, cycles?: number | undefined | null, rates?: RateTable | undefined | null): ResidencyComparison
985
1271
 
1272
+ /**
1273
+ * How `runToCompletion` should start and collect a command.
1274
+ *
1275
+ * The `ExecOptions` a completed run can use (no `stdin`, which nothing would write, and no
1276
+ * `timeout`, which `clientGraceSec` replaces), plus the client grace.
1277
+ */
1278
+ export interface CompletionRequest {
1279
+ /**
1280
+ * `true` runs a single script string under `/bin/sh -c`; a string such as `"bash"` runs
1281
+ * it under that shell, resolved by the daemon in the guest. See `ExecOptions.shell`.
1282
+ */
1283
+ shell?: boolean | string
1284
+ cwd?: string
1285
+ env?: Record<string, string>
1286
+ /** A numeric uid, or a name the daemon resolves in the guest. See `ExecOptions.user`. */
1287
+ user?: number | string
1288
+ /** A numeric gid, or a name the daemon resolves in the guest. */
1289
+ group?: number | string
1290
+ /**
1291
+ * The daemon's own kill deadline for the child. The client deadline is this plus
1292
+ * `clientGraceSec`.
1293
+ */
1294
+ timeoutSec?: number
1295
+ /** The idempotency key. Omitted, one is minted. */
1296
+ execId?: string
1297
+ /** Start the child's environment from the image's `ENV`. See `ExecOptions.inheritImageEnv`. */
1298
+ inheritImageEnv?: boolean
1299
+ /**
1300
+ * How long past `timeoutSec` the client waits before it kills, and how long it then
1301
+ * waits for the killed exec's result. Defaults to the core's 60 seconds.
1302
+ */
1303
+ clientGraceSec?: number
1304
+ }
1305
+
986
1306
  /**
987
1307
  * The core crate's version, for a `doctor` or `manifest` command to report.
988
1308
  *
@@ -1004,6 +1324,77 @@ export declare function costConstants(): string
1004
1324
  /** The managed base every `docs/PLATFORM.md` measurement from 2026-08-06 onward used. */
1005
1325
  export declare function defaultBaseImage(): BaseImageInput
1006
1326
 
1327
+ /** `Detached` as a plain object, token included, for a private store. */
1328
+ export interface DetachedObject {
1329
+ microvmId: string
1330
+ endpoint: string
1331
+ region: string
1332
+ port: number
1333
+ agentToken: string
1334
+ }
1335
+
1336
+ /**
1337
+ * The egress posture `sandbox.run` with these options would report, without launching.
1338
+ *
1339
+ * One of `"open"`, `"unsealed"`, `"best-effort"`, or `"sealed"`: the value the launched
1340
+ * session's `egressPosture()` and the CLI envelope's `egressPosture` carry. Throws the launch's
1341
+ * own `ERR_INVALID_ARG` for options it would refuse. No AWS call and no credentials, so a
1342
+ * harness can decide before a build whether a no-network task is satisfiable.
1343
+ *
1344
+ * Only `"sealed"` is network isolation, and no option answers it: isolation needs a VPC
1345
+ * egress connector and separately verified VPC routing without an internet gateway or NAT
1346
+ * gateway. Omitting `egress` is `"unsealed"`; `denyEgress` is `"best-effort"`. Without a
1347
+ * `region`, each connector ARN is checked against the region it names.
1348
+ */
1349
+ export declare function egressPostureFor(egress?: boolean | undefined | null, connectors?: Array<string> | undefined | null, denyEgress?: boolean | undefined | null, region?: Region | undefined | null): string
1350
+
1351
+ /** What `ensureImage` returns: the ready image and how this call got it. */
1352
+ export interface EnsuredImage {
1353
+ /** The ready image; pass `image.identifier` to `run`. */
1354
+ image: Image
1355
+ /**
1356
+ * True when this call's own create did not build the image: it was ready, a build
1357
+ * already running was waited out, or a concurrent caller won the create race.
1358
+ */
1359
+ reused: boolean
1360
+ /** `s3://<bucket>/<prefix>/<name>/artifact.zip`, whether or not this call uploaded it. */
1361
+ artifactUri: string
1362
+ /** Whether this call uploaded the artifact. */
1363
+ uploaded: boolean
1364
+ /** What reading the build context skipped, one line each. */
1365
+ warnings: Array<string>
1366
+ }
1367
+
1368
+ /**
1369
+ * Everything `ensureImage` needs besides the size class.
1370
+ *
1371
+ * `baseImage` defaults to `baseImageFromDockerfile(dockerfile)`; `waitTimeoutSeconds` is
1372
+ * the build wait, 45 minutes by default. `contextDir` is read as `docker build` reads a
1373
+ * context: `Dockerfile.dockerignore`, else `.dockerignore`, is honoured, and symlinks are
1374
+ * skipped with a line in the result's `warnings`.
1375
+ */
1376
+ export interface EnsureImageOptions {
1377
+ /** The image name's stem; the name is `<namePrefix>-<hash12>`. */
1378
+ namePrefix: string
1379
+ /** The daemon binary's bytes. */
1380
+ binary: Uint8Array
1381
+ /** The Dockerfile, usually `wrapDockerfile(task)`. */
1382
+ dockerfile: string
1383
+ /** The directory the Dockerfile's `COPY` lines read, or omitted for none. */
1384
+ contextDir?: string
1385
+ /** The artifact bucket, in the sandbox's region. */
1386
+ s3Bucket: string
1387
+ /** A key prefix inside the bucket, or omitted for the bucket root. */
1388
+ s3KeyPrefix?: string
1389
+ /** The build role. */
1390
+ buildRoleArn: string
1391
+ baseImage?: BaseImageInput
1392
+ /** Delete what exists under the name and build afresh. */
1393
+ force?: boolean
1394
+ tags?: Record<string, string>
1395
+ waitTimeoutSeconds?: number
1396
+ }
1397
+
1007
1398
  /**
1008
1399
  * Every `ERR_*` code this library can raise, for a caller building an exhaustive switch.
1009
1400
  *
@@ -1023,12 +1414,23 @@ export declare function estimateRun(size: SizeClass, options?: PlanUsageOptions
1023
1414
 
1024
1415
  /** How an exec should be started. Every field optional; the defaults are the daemon's. */
1025
1416
  export interface ExecOptions {
1026
- /** A single script string rather than an argv. Requires `shell: true`. */
1027
- shell?: boolean
1417
+ /**
1418
+ * `true` runs a single script string under `/bin/sh -c`; a string such as `"bash"`
1419
+ * runs it under that shell, resolved by the daemon in the guest, and a shell the guest
1420
+ * does not have is refused (`unknown_shell`) before anything starts.
1421
+ */
1422
+ shell?: boolean | string
1028
1423
  cwd?: string
1029
1424
  env?: Record<string, string>
1030
- user?: number
1031
- group?: number
1425
+ /**
1426
+ * A numeric uid, or a name the daemon resolves against the guest's `/etc/passwd`. An
1427
+ * unknown name is refused (`unknown_user`) before anything starts. A user with a passwd
1428
+ * row gets `HOME`, `USER` and `LOGNAME` from it, beneath the launch environment and
1429
+ * `env`.
1430
+ */
1431
+ user?: number | string
1432
+ /** A numeric gid, or a name the daemon resolves against the guest's `/etc/group`. */
1433
+ group?: number | string
1032
1434
  /** The daemon's own kill deadline for the child, distinct from a client-side `wait`. */
1033
1435
  timeoutSec?: number
1034
1436
  /** Whether to open a stdin pipe. Writing without this is a 409. */
@@ -1047,6 +1449,12 @@ export interface ExecOptions {
1047
1449
  * guarantee for callers who rely on it.
1048
1450
  */
1049
1451
  reapGroupOnExit?: boolean
1452
+ /**
1453
+ * Start the child's environment from the image's `ENV` (minus `AGENTD_*`, never the
1454
+ * token), beneath everything else (AGENTD-11). Off by default, which keeps the child's environment
1455
+ * exactly the launch environment plus `env`.
1456
+ */
1457
+ inheritImageEnv?: boolean
1050
1458
  }
1051
1459
 
1052
1460
  /**
@@ -1071,6 +1479,8 @@ export interface ExecResult {
1071
1479
  * inside the bytes, which would be indistinguishable from output containing it.
1072
1480
  */
1073
1481
  truncated: boolean
1482
+ /** True when the daemon execution deadline expired, distinct from cancellation. */
1483
+ timedOut: boolean
1074
1484
  /**
1075
1485
  * Set when the post-exit linger deadline expired with the pipes still open: some
1076
1486
  * grandchild is alive and may write more that nobody will see.
@@ -1083,6 +1493,22 @@ export interface ExecResult {
1083
1493
  * exec, since neither is a success.
1084
1494
  */
1085
1495
  ok: boolean
1496
+ /**
1497
+ * The exit code a POSIX shell would report (BIND-6): 124 when a deadline ended the
1498
+ * command (the daemon's, or `runToCompletion`'s client deadline), 128 plus the signal
1499
+ * for any other signal death, otherwise `exitCode`. `null` only for a running exec.
1500
+ */
1501
+ posixExitCode?: number
1502
+ /**
1503
+ * Human-readable annotations, one per condition that changes how the output reads
1504
+ * (BIND-7). Empty for a clean result; append them to stderr as they are.
1505
+ */
1506
+ notes: Array<string>
1507
+ /**
1508
+ * True when `runToCompletion` synthesized this result because nothing came back after
1509
+ * its client-deadline kill (BIND-10): `posixExitCode` is 124 and the output is unknown.
1510
+ */
1511
+ synthesized: boolean
1086
1512
  }
1087
1513
 
1088
1514
  /**
@@ -1108,6 +1534,22 @@ export declare const enum GapPolicy {
1108
1534
  Event = 'event',
1109
1535
  }
1110
1536
 
1537
+ /** What a workload's hook handler did. Its output is in the daemon's log, not here. */
1538
+ export interface HandlerOutcome {
1539
+ /** The exit code, or `null` when the handler was killed or never started. */
1540
+ exitCode?: number
1541
+ /** The signal that ended it, if one did. */
1542
+ signal?: number
1543
+ /** Whether the daemon killed it at its time budget. */
1544
+ timedOut: boolean
1545
+ /** Milliseconds from spawn to exit or kill. */
1546
+ durationMs: number
1547
+ /** Why it could not run at all, such as `not executable`. */
1548
+ error?: string
1549
+ /** Whether it ran and exited 0 within its budget. */
1550
+ succeeded: boolean
1551
+ }
1552
+
1111
1553
  /** The daemon's liveness answer. `bootstrapped` is the useful field. */
1112
1554
  export interface Health {
1113
1555
  /** The daemon's own version, distinct from the protocol version. */
@@ -1154,6 +1596,56 @@ export interface Health {
1154
1596
  * VM holding unacked output somebody still has to collect.
1155
1597
  */
1156
1598
  execs: number
1599
+ /**
1600
+ * Every lifecycle-hook invocation the daemon observed, oldest first, each with its
1601
+ * workload handler's outcome when the image carries one. The hook routes are
1602
+ * reachable over loopback from inside the guest, so a workload can add entries; the
1603
+ * earliest are the platform's.
1604
+ */
1605
+ hooks: Array<HookObservation>
1606
+ /** How many hook invocations the daemon's log cap dropped. */
1607
+ hooksDropped: number
1608
+ /**
1609
+ * Each identity-repair step and its outcome. Empty until the run hook repairs this
1610
+ * VM's identity.
1611
+ */
1612
+ identitySteps: Array<IdentityStep>
1613
+ /**
1614
+ * How many variables the daemon's image-environment snapshot holds, or `null` when it
1615
+ * holds none. `null` is also what a daemon built before `inheritImageEnv` reports, and
1616
+ * such a daemon ignores that option. The values are never reported.
1617
+ */
1618
+ imageEnvKeys?: number
1619
+ }
1620
+
1621
+ /** One lifecycle-hook invocation, as the daemon observed it. */
1622
+ export interface HookObservation {
1623
+ /** `ready`, `validate`, `run`, `suspend`, `resume`, or `terminate`. */
1624
+ hook: string
1625
+ /** Seconds since the epoch on the daemon's clock when the hook arrived. */
1626
+ firedAt: number
1627
+ /** The workload handler's outcome, or `null` when the image has no handler for it. */
1628
+ handler?: HandlerOutcome
1629
+ }
1630
+
1631
+ /** One identity-repair step. */
1632
+ export interface IdentityStep {
1633
+ /** `machine-id`, `hostname`, `boot-id`, `random-seed`, or `cached-credential`. */
1634
+ name: string
1635
+ /** `repaired`, `not_applicable`, or `failed`. */
1636
+ outcome: string
1637
+ /** The OS error for a failed step. */
1638
+ error?: string
1639
+ }
1640
+
1641
+ /** The idle policy the service reports a VM is running under. */
1642
+ export interface IdlePolicy {
1643
+ /** `maxIdleDurationSeconds`: inbound-traffic silence before an auto-suspend. */
1644
+ maxIdleSec: number
1645
+ /** `suspendedDurationSeconds`: how long a suspended VM lasts before it is terminated. */
1646
+ suspendedSec: number
1647
+ /** `autoResumeEnabled`: whether a request to a suspended VM resumes it. */
1648
+ autoResume: boolean
1157
1649
  }
1158
1650
 
1159
1651
  /** A built image, and the log group the service created alongside it. */
@@ -1207,6 +1699,67 @@ export declare function installAgentAccess(session: Session, agents: Array<Agent
1207
1699
  */
1208
1700
  export declare function installedAgents(session: Session): Promise<Array<AgentSpec>>
1209
1701
 
1702
+ /** The options bag for `keepAwake`. */
1703
+ export interface KeepAwakeOptions {
1704
+ /** Seconds between polls. Default: a third of the idle window, at most 20. */
1705
+ intervalSec?: number
1706
+ /** End once no exec is running. */
1707
+ whileBusy?: boolean
1708
+ /** End after this many seconds even if still busy. */
1709
+ maxDurationSec?: number
1710
+ /**
1711
+ * The VM's `maxIdleDurationSeconds`. A sandbox-held session knows it; otherwise the
1712
+ * platform minimum of 60 is assumed. The interval may be at most half of it.
1713
+ */
1714
+ idleWindowSec?: number
1715
+ }
1716
+
1717
+ /** What a finished keepalive did. */
1718
+ export interface KeepAwakeReport {
1719
+ /** Why it ended: `"stopped"`, `"idle"`, `"elapsed"`, or `"not-running"`. */
1720
+ end: string
1721
+ /** Health polls that answered. */
1722
+ polls: number
1723
+ /** `busy` from the last answered poll, or `null` when none answered. */
1724
+ lastBusy?: boolean
1725
+ /** Seconds from start to end. */
1726
+ elapsedSec: number
1727
+ }
1728
+
1729
+ /** The service's optional `ListMicrovms` filters. */
1730
+ export interface ListMicrovmsOptions {
1731
+ imageIdentifier?: string
1732
+ imageVersion?: string
1733
+ }
1734
+
1735
+ /** A MicroVM as `GetMicrovm` last described it. */
1736
+ export interface Microvm {
1737
+ id: string
1738
+ /** As the service spells it. Eventually consistent. */
1739
+ state: string
1740
+ /** Why the VM is in this state, when the service said. */
1741
+ stateReason?: string
1742
+ /** The proxy endpoint. Pair it with the agent token in `Session.attach`. */
1743
+ endpoint: string
1744
+ imageArn: string
1745
+ imageVersion: string
1746
+ idlePolicy?: IdlePolicy
1747
+ /** `maximumDurationInSeconds`. Suspended time counts toward it. */
1748
+ maximumDurationSeconds?: number
1749
+ /** When the VM first started, as Unix seconds. */
1750
+ startedAt?: number
1751
+ /** When the VM terminated, as Unix seconds, once it has. */
1752
+ terminatedAt?: number
1753
+ }
1754
+
1755
+ /** One `ListMicrovms` item: narrower than `Microvm`, with no endpoint or reason. */
1756
+ export interface MicrovmSummary {
1757
+ id: string
1758
+ state: string
1759
+ imageArn: string
1760
+ imageVersion: string
1761
+ }
1762
+
1210
1763
  /**
1211
1764
  * Mints a Bedrock bearer token from the default credential chain.
1212
1765
  *
@@ -1216,6 +1769,29 @@ export declare function installedAgents(session: Session): Promise<Array<AgentSp
1216
1769
  */
1217
1770
  export declare function mintBedrockToken(region: Region, ttlSeconds?: number | undefined | null): Promise<BearerToken>
1218
1771
 
1772
+ /**
1773
+ * Mint using explicit STS credentials without changing the process environment.
1774
+ * credentialsExpiresAt is Unix seconds from STS Expiration. Do not log these inputs.
1775
+ */
1776
+ export declare function mintBedrockTokenWithCredentials(region: Region, accessKeyId: string, secretAccessKey: string, sessionToken: string | undefined | null, credentialsExpiresAt: number, ttlSeconds?: number | undefined | null): BearerToken
1777
+
1778
+ /**
1779
+ * A record's JSON-safe form, with the CLI registry's camelCase keys. **Holds the agent
1780
+ * token**; store it privately.
1781
+ */
1782
+ export interface NameRecordObject {
1783
+ name: string
1784
+ microvmId: string
1785
+ endpoint: string
1786
+ agentToken: string
1787
+ region: string
1788
+ /** Seconds since the epoch when the name was registered. */
1789
+ at: number
1790
+ identityHostSeed?: string
1791
+ identityVmPublicKey?: string
1792
+ egressPosture?: string
1793
+ }
1794
+
1219
1795
  /**
1220
1796
  * One byte range the daemon could not replay.
1221
1797
  *
@@ -1253,6 +1829,42 @@ export interface PlanUsageOptions {
1253
1829
  label?: string
1254
1830
  }
1255
1831
 
1832
+ /**
1833
+ * Whether a harness can launch in `region` (default: `$AWS_REGION`, `$AWS_DEFAULT_REGION`,
1834
+ * then us-east-1), checked before it queues work.
1835
+ *
1836
+ * Three checks: the region resolves (advisory when `Region.unlisted`), the credential chain
1837
+ * resolves credentials (no AWS call), and one `ListManagedMicrovmImages` page answers in that
1838
+ * region, the only AWS operation, free and read-only. A check after a failure is reported
1839
+ * with `ran: false` and makes no call. Nothing billable, nothing mutating. It does not check
1840
+ * roles, the artifact bucket, quotas, or VPC connectors. Never rejects; read `report.ok`.
1841
+ */
1842
+ export declare function preflight(region?: Region | undefined | null): Promise<PreflightReport>
1843
+
1844
+ /** One line of a preflight report. */
1845
+ export interface PreflightCheck {
1846
+ /** `"region"`, `"credentials"`, or `"service"`. */
1847
+ name: string
1848
+ ok: boolean
1849
+ /** Whether a failure decides the report's `ok`. An unlisted region's line is advisory. */
1850
+ fatal: boolean
1851
+ /** False when an earlier check's failure kept this one from running (and calling AWS). */
1852
+ ran: boolean
1853
+ detail: string
1854
+ /** What to do about a failure; empty on a pass. */
1855
+ remedy: string
1856
+ }
1857
+
1858
+ /** What `preflight` found: three checks and whether a launch could proceed. */
1859
+ export interface PreflightReport {
1860
+ /** True exactly when no fatal check failed or was skipped. */
1861
+ ok: boolean
1862
+ /** The region checked, absent when none resolved. */
1863
+ region?: string
1864
+ /** `region`, `credentials`, and `service`, in that order. */
1865
+ checks: Array<PreflightCheck>
1866
+ }
1867
+
1256
1868
  /**
1257
1869
  * What `wait()` resolves to.
1258
1870
  *
@@ -1278,6 +1890,8 @@ export interface ProcessExit {
1278
1890
  * because it is the only thing that makes a `null` exit code actionable.
1279
1891
  */
1280
1892
  signal?: number
1893
+ /** True when the remote execution deadline expired. */
1894
+ timedOut: boolean
1281
1895
  }
1282
1896
 
1283
1897
  /**
@@ -1317,6 +1931,62 @@ export interface PromptOptions {
1317
1931
  timeoutSec?: number
1318
1932
  /** A stable exec id, for a retry that must not spawn twice. */
1319
1933
  execId?: string
1934
+ /** Agent process permissions: agent-default (default) or unrestricted. */
1935
+ permissionMode?: 'agent-default' | 'unrestricted'
1936
+ /** Stop residual children when the main agent exits. Defaults to false. */
1937
+ reapGroupOnExit?: boolean
1938
+ }
1939
+
1940
+ /**
1941
+ * The `agentd` daemon binary for `options.version` (default: this client's own).
1942
+ *
1943
+ * Answered from `options.binary` or `$MICROVM_AGENTD` when either names a file, else the
1944
+ * version's cache entry, else the GitHub release asset, verified by `gh attestation
1945
+ * verify` or, when `gh` cannot download, by the release's `SHA256SUMS`. A fetch that
1946
+ * cannot be verified rejects with `ERR_PRECONDITION` (on `err.cause.message`), and so does
1947
+ * any binary that is not an aarch64 ELF.
1948
+ */
1949
+ export declare function provisionAgentd(options?: ProvisionOptions | undefined | null): Promise<Buffer>
1950
+
1951
+ /** `provisionAgentd`, answering with the bytes and how they got here. */
1952
+ export declare function provisionAgentdReport(options?: ProvisionOptions | undefined | null): Promise<ProvisionedAgentd>
1953
+
1954
+ /** A provisioned `agentd` binary and how it got here: `provisionAgentdReport()`'s answer. */
1955
+ export interface ProvisionedAgentd {
1956
+ /** The binary itself, an aarch64 ELF. */
1957
+ data: Buffer
1958
+ /** Where the binary is on disk: the cache entry, or the caller's own path. */
1959
+ path: string
1960
+ /** `"caller-supplied"`, `"cache"`, or `"fetched"`. */
1961
+ source: string
1962
+ /**
1963
+ * For a caller-supplied binary, `"argument"` (the `binary` option) or `"env"`
1964
+ * (`$MICROVM_AGENTD`).
1965
+ */
1966
+ suppliedBy?: string
1967
+ /**
1968
+ * `"attestation"` (`gh attestation verify`, provenance) or `"checksum"` (the release's
1969
+ * `SHA256SUMS`, integrity), when fetched or when the cache entry was installed. Absent
1970
+ * for a caller-supplied binary.
1971
+ */
1972
+ verification?: string
1973
+ /** The release version provisioned for, without a leading `v`. */
1974
+ version: string
1975
+ /** The lowercase hex SHA-256 of `data`. */
1976
+ sha256: string
1977
+ }
1978
+
1979
+ /** What to provision. Every field is optional. */
1980
+ export interface ProvisionOptions {
1981
+ /** The release version, with or without a leading `v`. Defaults to `coreVersion()`. */
1982
+ version?: string
1983
+ /**
1984
+ * The state directory the cache lives under. Defaults to the CLI's
1985
+ * (`$MICROVM_STATE_DIR`, else `~/.microvm/runs`), so every surface shares one cache.
1986
+ */
1987
+ stateDir?: string
1988
+ /** A binary the caller manages. Outranks `$MICROVM_AGENTD`; must be an aarch64 ELF. */
1989
+ binary?: string
1320
1990
  }
1321
1991
 
1322
1992
  /** Everything a launch needs. */
@@ -1343,6 +2013,8 @@ export interface RunOptions {
1343
2013
  * shared image snapshot.
1344
2014
  */
1345
2015
  agentToken?: string
2016
+ /** Persist once per intended launch and reuse with the identical request. */
2017
+ clientToken?: string
1346
2018
  /**
1347
2019
  * Base environment for every exec in the launched VM, delivered in the same
1348
2020
  * `runHookPayload` as the token.
@@ -1352,21 +2024,25 @@ export interface RunOptions {
1352
2024
  * payload before the launch, naming the byte count.
1353
2025
  */
1354
2026
  launchEnv?: Record<string, string>
2027
+ /** Request the managed INTERNET_EGRESS connector. Omission does not block egress. */
2028
+ egress?: boolean
1355
2029
  /**
1356
- * Whether to request the egress connector. Off omits it from the request; measured
1357
- * 2026-09-12 the platform gave a connector-less VM outbound network anyway.
2030
+ * Existing VPC network connector ARNs. For no egress, use a VPC without an
2031
+ * internet gateway or NAT gateway. Cannot be combined with `egress: true`.
1358
2032
  */
1359
- egress?: boolean
2033
+ egressNetworkConnectors?: Array<string>
2034
+ /**
2035
+ * Set advisory HTTP proxy variables. Workloads can ignore or override them;
2036
+ * use a VPC without an internet gateway or NAT gateway for no egress.
2037
+ */
2038
+ denyEgress?: boolean
1360
2039
  /**
1361
2040
  * Whether to launch shell-capable: the ingress set becomes the measured pair
1362
2041
  * `[HTTP_INGRESS, SHELL_INGRESS]`, which is what `microvm shell` attaches to.
1363
2042
  */
1364
2043
  shell?: boolean
1365
2044
  maxIdleSec?: number
1366
- /**
1367
- * The window a resume is refused past (STATE-12). Exists **only** in the launch request:
1368
- * `GetMicrovm` does not return it, so this client is the only party that can name it.
1369
- */
2045
+ /** Requested suspended window, in seconds; the service also reports its idle policy. */
1370
2046
  suspendedSec?: number
1371
2047
  autoResume?: boolean
1372
2048
  maxDurationSec?: number
@@ -1374,6 +2050,17 @@ export interface RunOptions {
1374
2050
  readyTimeout?: number
1375
2051
  /** A label for the run token. Never the token. */
1376
2052
  tokenScope?: string
2053
+ /**
2054
+ * Whether `run` waits for RUNNING (default `true`). `false` resolves once the launch
2055
+ * is accepted, with the lifecycle PENDING; `waitUntilRunning` finishes it.
2056
+ */
2057
+ wait?: boolean
2058
+ /** Per-VM CloudWatch log group. Omitted keeps the service's default destination. */
2059
+ logGroup?: string
2060
+ /** An exact log stream inside `logGroup`. */
2061
+ logStream?: string
2062
+ /** Turns per-VM logging off. Cannot be combined with `logGroup` or `logStream`. */
2063
+ disableLogging?: boolean
1377
2064
  }
1378
2065
 
1379
2066
  /**
@@ -1511,6 +2198,8 @@ export interface StreamEvent {
1511
2198
  exitCode?: number
1512
2199
  signal?: number
1513
2200
  truncated?: boolean
2201
+ /** Present on exit: whether the remote execution deadline expired. */
2202
+ timedOut?: boolean
1514
2203
  writersMayBeAlive?: boolean
1515
2204
  }
1516
2205
 
@@ -1595,5 +2284,40 @@ export interface TeardownReport {
1595
2284
  leaked: boolean
1596
2285
  }
1597
2286
 
2287
+ /** How `waitForState` polls. */
2288
+ export interface WaitForStateOptions {
2289
+ /** States that reject with `stateReason` instead of being waited through. */
2290
+ failOn?: Array<string>
2291
+ /** Seconds before giving up. Default 300. */
2292
+ timeout?: number
2293
+ /** Seconds between polls. Default 5. */
2294
+ pollInterval?: number
2295
+ }
2296
+
1598
2297
  /** Every daemon-status class, as `err.cause.cause.message` names them. */
1599
2298
  export declare function wireKinds(): Array<string>
2299
+
2300
+ /**
2301
+ * A task Dockerfile with the agentd stanza appended, ready for `buildImage`.
2302
+ *
2303
+ * The result is the task text, a newline if it lacked one, `USER root` when the task's last
2304
+ * `USER` is anyone else, then the stanza the default Dockerfile uses: `COPY agentd /agentd`,
2305
+ * the chmod, `ENV AGENTD_PORT`, `EXPOSE`, `ENTRYPOINT []` and `CMD ["/agentd"]`. Pass the
2306
+ * result to `buildImage` with `baseImage: baseImageFromDockerfile(result)`.
2307
+ *
2308
+ * Throws `ERR_INVALID_ARG` for a task with no `FROM`, one that ends inside a line
2309
+ * continuation or an unterminated heredoc (either would swallow the stanza), a keepalive the
2310
+ * client cannot tolerate, a port of 0, a workdir that is not one absolute path, or
2311
+ * `inheritWorkdir` with nothing to inherit.
2312
+ */
2313
+ export declare function wrapDockerfile(taskDockerfile: string, options?: WrapDockerfileOptions | undefined | null): string
2314
+
2315
+ /** What `wrapDockerfile` takes besides the task text. Every field is optional. */
2316
+ export interface WrapDockerfileOptions {
2317
+ /** The agent port the stanza names, 9000 by default. It must match the sandbox's. */
2318
+ port?: number
2319
+ /** A working directory for the stanza to create and set, as the default Dockerfile does. */
2320
+ workdir?: string
2321
+ /** Refuse a result with no `WORKDIR` anywhere, because the exec would inherit `/`. */
2322
+ inheritWorkdir?: boolean
2323
+ }