@theagenticguy/microvms 0.10.0 → 0.11.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/README.md +4 -2
- package/index.d.ts +626 -29
- package/index.js +60 -54
- package/microvms.darwin-arm64.node +0 -0
- package/microvms.linux-arm64-gnu.node +0 -0
- package/microvms.linux-x64-gnu.node +0 -0
- package/microvms.win32-x64-msvc.node +0 -0
- package/package.json +7 -4
package/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/* auto-generated by NAPI-RS from bindings/microvms-js/src/. Regenerate with `mise run dts`; `mise run dts:check` fails when this file drifts. */
|
|
2
3
|
/* eslint-disable */
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -9,6 +10,15 @@
|
|
|
9
10
|
*/
|
|
10
11
|
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
|
|
11
12
|
|
|
13
|
+
declare global {
|
|
14
|
+
interface __NapiRsAsyncGenerator<TOwner, T, TReturn, TNext> {
|
|
15
|
+
next(...[value]: [] | [TNext]): globalThis.Promise<globalThis.IteratorResult<T, TReturn | undefined>>
|
|
16
|
+
return(...[value]: [] | [TReturn]): globalThis.Promise<globalThis.IteratorResult<T, TReturn | undefined>>
|
|
17
|
+
throw(exception?: unknown): globalThis.Promise<globalThis.IteratorResult<T, TReturn | undefined>>
|
|
18
|
+
[globalThis.Symbol.asyncIterator](): this
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
/**
|
|
13
23
|
* One VM with coding agents in it: the sandbox plus the specs it is built for.
|
|
14
24
|
*
|
|
@@ -51,12 +61,18 @@ export declare class AgentVm {
|
|
|
51
61
|
dockerfile(): Promise<string>
|
|
52
62
|
/**
|
|
53
63
|
* The image name for these specs and this daemon binary: `agent-vm-<agents>-<hash12>`.
|
|
54
|
-
* Content-addressed, so an unchanged binary
|
|
55
|
-
* built; `findImage` looks it up.
|
|
64
|
+
* Content-addressed, so an unchanged binary, spec set and size name the image a previous
|
|
65
|
+
* run built; `findImage` looks it up, and `ensureImage` builds or reuses it.
|
|
56
66
|
*/
|
|
57
67
|
imageName(options: AgentImageOptions, size?: SizeClass | undefined | null): Promise<string>
|
|
58
68
|
/** The ARN of an existing image named per `imageName`, or `null` when there is none. */
|
|
59
69
|
findImage(options: AgentImageOptions, size?: SizeClass | undefined | null): Promise<string | null>
|
|
70
|
+
/**
|
|
71
|
+
* Builds or reuses this VM's image, named per `imageName`: resolved at once when ready,
|
|
72
|
+
* waited on while building, deleted and rebuilt when failed, and uploaded to
|
|
73
|
+
* `s3://<s3Bucket>/<s3KeyPrefix>/<name>/artifact.zip` only when a build is needed.
|
|
74
|
+
*/
|
|
75
|
+
ensureImage(options: AgentEnsureOptions, size?: SizeClass | undefined | null): Promise<EnsuredImage>
|
|
60
76
|
/** The artifact bytes to upload to `s3://<bucket>/<imageName>.zip` before `buildImage`. */
|
|
61
77
|
buildArtifact(options: AgentImageOptions, size?: SizeClass | undefined | null): Promise<Buffer>
|
|
62
78
|
/**
|
|
@@ -136,18 +152,54 @@ export declare class BearerToken {
|
|
|
136
152
|
toString(): string
|
|
137
153
|
}
|
|
138
154
|
|
|
155
|
+
/**
|
|
156
|
+
* A report's total judged against a budget: core's `Budget::check`, the verdict
|
|
157
|
+
* `microvm cost --max-cost` renders.
|
|
158
|
+
*/
|
|
159
|
+
export declare class BudgetVerdict {
|
|
160
|
+
/** The ceiling, as the caller wrote it. */
|
|
161
|
+
get maxUsd(): EstimatedUsd
|
|
162
|
+
/** `"warn"` or `"abort"`: what the caller said a breach does. */
|
|
163
|
+
get onBreach(): string
|
|
164
|
+
/** The total's floor: the whole estimate unless `isLowerBound`. */
|
|
165
|
+
get floor(): EstimatedUsd
|
|
166
|
+
/** Whether the floor is a lower bound, because a line is unpriced. */
|
|
167
|
+
get isLowerBound(): boolean
|
|
168
|
+
/** `"exact"` or `"lower-bound"`. */
|
|
169
|
+
get basis(): string
|
|
170
|
+
/** The phases whose lines are unpriced, sorted. */
|
|
171
|
+
get unpricedPhases(): Array<string>
|
|
172
|
+
/** Whether the floor is over the ceiling. At the ceiling is within it. */
|
|
173
|
+
get breached(): boolean
|
|
174
|
+
/** Whether the caller's judgement refuses the report: breached, under `"abort"`. */
|
|
175
|
+
get aborts(): boolean
|
|
176
|
+
/**
|
|
177
|
+
* How far over the ceiling the floor is, when breached; at least that much for a lower
|
|
178
|
+
* bound.
|
|
179
|
+
*/
|
|
180
|
+
get overage(): EstimatedUsd | null
|
|
181
|
+
/** One line for a human, the one `microvm cost --max-cost` prints. */
|
|
182
|
+
render(): string
|
|
183
|
+
/**
|
|
184
|
+
* Core's JSON shape for the verdict, as a JSON **string**: `maxUsd`, `onBreach`, `basis`,
|
|
185
|
+
* `breached`, `overageAtLeastUsd`.
|
|
186
|
+
*/
|
|
187
|
+
toJson(): string
|
|
188
|
+
}
|
|
189
|
+
|
|
139
190
|
/** A timeout for the `ready` or `validate` image-build hook: 1..=3600 seconds. */
|
|
140
191
|
export declare class BuildHookTimeout {
|
|
141
192
|
/** A build-family timeout, or a refusal naming both ceilings. */
|
|
142
193
|
constructor(seconds: number)
|
|
143
194
|
/** The service ceiling for this family: 3600. */
|
|
144
|
-
get maxSecs():
|
|
195
|
+
get maxSecs(): 3600
|
|
145
196
|
get seconds(): number
|
|
146
197
|
toString(): string
|
|
147
198
|
}
|
|
148
199
|
|
|
149
200
|
/**
|
|
150
|
-
* MicroVM lifecycle by ID
|
|
201
|
+
* MicroVM lifecycle by ID (get, list, suspend, resume, terminate, and wait) and image
|
|
202
|
+
* administration (list, delete, versions and their status, builds).
|
|
151
203
|
*
|
|
152
204
|
* Holds no lifecycle state, so it checks nothing a `Sandbox` would (STATE-5, STATE-7,
|
|
153
205
|
* STATE-12). Use it when a process has only an identifier.
|
|
@@ -175,6 +227,37 @@ export declare class ControlPlane {
|
|
|
175
227
|
* past `timeout` rejects with a timeout.
|
|
176
228
|
*/
|
|
177
229
|
waitForState(microvmId: string, wanted: Array<string>, options?: WaitForStateOptions | undefined | null): Promise<Microvm>
|
|
230
|
+
/** `ListMicrovmImages`, every page: every image in the account and region. */
|
|
231
|
+
listImages(): Promise<Array<ImageSummary>>
|
|
232
|
+
/**
|
|
233
|
+
* Deletes the image, its extra versions first, retrying while it refuses (an image still
|
|
234
|
+
* `CREATING`, or one a terminating VM holds).
|
|
235
|
+
*
|
|
236
|
+
* Resolves `true` once the service took the deletion and `false` when every attempt
|
|
237
|
+
* failed or `identifier` is not one the service accepts. It doesn't reject, as a
|
|
238
|
+
* teardown's delete shouldn't.
|
|
239
|
+
*/
|
|
240
|
+
deleteImage(identifier: string, options?: DeleteImageOptions | undefined | null): Promise<boolean>
|
|
241
|
+
/**
|
|
242
|
+
* `ListMicrovmImageVersions`, every page: each version, its status, and its build
|
|
243
|
+
* configuration.
|
|
244
|
+
*/
|
|
245
|
+
listImageVersions(identifier: string): Promise<Array<ImageVersion>>
|
|
246
|
+
/**
|
|
247
|
+
* `UpdateMicrovmImageVersion`: `status` is `"ACTIVE"` or `"INACTIVE"`.
|
|
248
|
+
*
|
|
249
|
+
* `INACTIVE` is the non-destructive retire: `RunMicrovm` refuses the version, running VMs
|
|
250
|
+
* keep running, and the version's readback stays. Resolves with the readback, and rejects
|
|
251
|
+
* when it doesn't carry the status asked for, so a 200 that didn't take isn't a rollback.
|
|
252
|
+
*/
|
|
253
|
+
setImageVersionStatus(identifier: string, version: string, status: string): Promise<ImageVersion>
|
|
254
|
+
/**
|
|
255
|
+
* `ListMicrovmImageBuilds` for one version, every page: one build per Graviton
|
|
256
|
+
* generation. Each `buildId` is what `getImageBuild` takes.
|
|
257
|
+
*/
|
|
258
|
+
listImageBuilds(identifier: string, version: string): Promise<Array<ImageBuild>>
|
|
259
|
+
/** `GetMicrovmImageBuild`: one build, with the snapshot sizes the listing doesn't carry. */
|
|
260
|
+
getImageBuild(identifier: string, version: string, buildId: string): Promise<ImageBuild>
|
|
178
261
|
/** The region this plane addresses. */
|
|
179
262
|
get region(): string
|
|
180
263
|
}
|
|
@@ -202,7 +285,7 @@ export declare class CostReport {
|
|
|
202
285
|
*
|
|
203
286
|
* The string is judged by the core's own [`CostPhase::from_str`], which is where the
|
|
204
287
|
* closed set lives. This file used to carry its own seven-element table for it, as did
|
|
205
|
-
* `microvms-py/src/cost.rs` — two parallel lists over one enum, which would have gone
|
|
288
|
+
* `bindings/microvms-py/src/cost.rs` — two parallel lists over one enum, which would have gone
|
|
206
289
|
* stale the first time a phase was added and would have disagreed with each other in
|
|
207
290
|
* whichever direction was edited first.
|
|
208
291
|
*/
|
|
@@ -210,7 +293,8 @@ export declare class CostReport {
|
|
|
210
293
|
/** Plain text, leading with what the dollars are rather than with the dollars. */
|
|
211
294
|
render(): string
|
|
212
295
|
/**
|
|
213
|
-
*
|
|
296
|
+
* Core's JSON shape for a report, as a JSON **string**: the one `microvm cost --json`
|
|
297
|
+
* and Python's `to_dict` emit (#255).
|
|
214
298
|
*
|
|
215
299
|
* A string for the same reason [`LineItem::to_json`] is: the unpriced line item omits
|
|
216
300
|
* its `usd` key, which no typed return shape can express.
|
|
@@ -418,6 +502,12 @@ export declare class ExecProcess {
|
|
|
418
502
|
/**
|
|
419
503
|
* A JS async iterator over an exec's output.
|
|
420
504
|
*
|
|
505
|
+
* Loop over the stream itself: `for await (const event of handle.stream())`. The object
|
|
506
|
+
* `[Symbol.asyncIterator]()` returns has `next`, `return` and `throw` and no
|
|
507
|
+
* `[Symbol.asyncIterator]()` of its own, though its generated type, `__NapiRsAsyncGenerator`,
|
|
508
|
+
* declares one. So `for await` over that object type-checks, then throws a `TypeError`
|
|
509
|
+
* because it isn't async iterable (#262).
|
|
510
|
+
*
|
|
421
511
|
* See the module docs for why this is a task and a bounded channel. The receiver is behind
|
|
422
512
|
* a tokio `Mutex` because `AsyncGenerator::next` must answer a `Send + 'static` future, so
|
|
423
513
|
* the guard is taken *inside* that future rather than borrowed from `&mut self`.
|
|
@@ -427,7 +517,10 @@ export declare class ExecProcess {
|
|
|
427
517
|
*
|
|
428
518
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
|
|
429
519
|
*/
|
|
430
|
-
export declare class ExecStream {
|
|
520
|
+
export declare class ExecStream {
|
|
521
|
+
|
|
522
|
+
[globalThis.Symbol.asyncIterator](): globalThis.__NapiRsAsyncGenerator<ExecStream, StreamEvent, void, undefined>
|
|
523
|
+
}
|
|
431
524
|
|
|
432
525
|
/**
|
|
433
526
|
* A running keepalive. Call `stop()` when the work is done; `done()` resolves when it
|
|
@@ -464,7 +557,7 @@ export declare class LineItem {
|
|
|
464
557
|
get duration(): Duration | null
|
|
465
558
|
get note(): string
|
|
466
559
|
/**
|
|
467
|
-
*
|
|
560
|
+
* Core's JSON shape for a line item, as a JSON **string**.
|
|
468
561
|
*
|
|
469
562
|
* A string rather than an object because the unpriced case must **omit** the `usd` key
|
|
470
563
|
* entirely, and a `#[napi(object)]` return type cannot express an absent key — an
|
|
@@ -503,6 +596,14 @@ export declare class NameRecord {
|
|
|
503
596
|
/** Seconds since the epoch when the name was registered. */
|
|
504
597
|
get at(): number
|
|
505
598
|
get egressPosture(): string | null
|
|
599
|
+
/**
|
|
600
|
+
* The VM's tunnel identity, when it was launched with `identity: true`; `null` otherwise.
|
|
601
|
+
*
|
|
602
|
+
* Throws when the record carries one half of the pair, or a half that doesn't decode: the
|
|
603
|
+
* record claims a verifiable VM, and reading it as unverifiable would hide that it's
|
|
604
|
+
* broken. A method, like `agentToken()`, because it holds the host's secret half.
|
|
605
|
+
*/
|
|
606
|
+
tunnelIdentity(): TunnelIdentity | null
|
|
506
607
|
/** The record without its secrets. */
|
|
507
608
|
toString(): string
|
|
508
609
|
}
|
|
@@ -535,6 +636,39 @@ export declare class NameRegistry {
|
|
|
535
636
|
* terminate, so no name outlives its VM.
|
|
536
637
|
*/
|
|
537
638
|
releaseByVm(microvmId: string): Array<string>
|
|
639
|
+
/**
|
|
640
|
+
* Registers a record this registry didn't write, once the VM has answered one
|
|
641
|
+
* authenticated request with the record's token; resolves with whether it refreshed a
|
|
642
|
+
* record of the same VM.
|
|
643
|
+
*
|
|
644
|
+
* `session` must be attached with the record's endpoint and token (`Session.attach` from
|
|
645
|
+
* its fields). A name held by another VM, or by an unreadable file, is refused before any
|
|
646
|
+
* request, and a probe the daemon refuses writes nothing. Core's `names::import`, the rule
|
|
647
|
+
* `microvm attach` applies.
|
|
648
|
+
*/
|
|
649
|
+
importRecord(record: NameRecord, session: Session): Promise<boolean>
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* A running port-forward. Call `stop()` when done; a garbage-collected handle stops the
|
|
654
|
+
* forward and cuts its open connections.
|
|
655
|
+
*/
|
|
656
|
+
export declare class PortForward {
|
|
657
|
+
/** The local address to connect to, `host:port`, with the port the OS picked. */
|
|
658
|
+
get localAddress(): string
|
|
659
|
+
/** Whether the forward is still serving. */
|
|
660
|
+
get running(): boolean
|
|
661
|
+
/**
|
|
662
|
+
* Stops accepting, waits for the connections still open to end, and resolves with the
|
|
663
|
+
* report.
|
|
664
|
+
*
|
|
665
|
+
* With `timeout` (seconds), connections still open after it are cut and listed as
|
|
666
|
+
* `"failed"`. Without it, a client that keeps its connection open keeps this waiting.
|
|
667
|
+
* Callable again, with the same report.
|
|
668
|
+
*/
|
|
669
|
+
stop(timeout?: number | undefined | null): Promise<PortForwardReport>
|
|
670
|
+
/** The handle without its credentials. */
|
|
671
|
+
toString(): string
|
|
538
672
|
}
|
|
539
673
|
|
|
540
674
|
/** The pinned rate table, and everything it says about itself. */
|
|
@@ -667,7 +801,7 @@ export declare class RunHookTimeout {
|
|
|
667
801
|
/** A run-family timeout, or a refusal naming **both** ceilings. */
|
|
668
802
|
constructor(seconds: number)
|
|
669
803
|
/** The service ceiling for this family: 60. */
|
|
670
|
-
get maxSecs():
|
|
804
|
+
get maxSecs(): 60
|
|
671
805
|
get seconds(): number
|
|
672
806
|
toString(): string
|
|
673
807
|
}
|
|
@@ -759,6 +893,14 @@ export declare class Sandbox {
|
|
|
759
893
|
* window; `GetMicrovm` also returns the service's idle policy.
|
|
760
894
|
*/
|
|
761
895
|
suspendedWindowSecondsAsync(): Promise<number | null>
|
|
896
|
+
/**
|
|
897
|
+
* The tunnel identity a launch with `identity: true` generated, or that an adopted record
|
|
898
|
+
* carried; `null` otherwise.
|
|
899
|
+
*
|
|
900
|
+
* Holds the host's secret half: pass it to `session.tunnel(...)`, and store it only
|
|
901
|
+
* where the agent token goes.
|
|
902
|
+
*/
|
|
903
|
+
tunnelIdentity(): Promise<TunnelIdentity | null>
|
|
762
904
|
/**
|
|
763
905
|
* The session, once launched.
|
|
764
906
|
*
|
|
@@ -797,7 +939,26 @@ export declare class Sandbox {
|
|
|
797
939
|
*/
|
|
798
940
|
buildArtifact(options: BuildImageOptions, size?: SizeClass | undefined | null, runHookTimeout?: RunHookTimeout | undefined | null, buildHookTimeout?: BuildHookTimeout | undefined | null): Promise<Buffer>
|
|
799
941
|
/**
|
|
800
|
-
*
|
|
942
|
+
* Every local guard `buildImage` runs, with zero calls: rejects with the refusal
|
|
943
|
+
* `buildImage` would, so a caller who uploads its own artifact checks the request before
|
|
944
|
+
* paying for the upload. Takes `buildImage`'s arguments.
|
|
945
|
+
*/
|
|
946
|
+
preflight(options: BuildImageOptions, size?: SizeClass | undefined | null, runHookTimeout?: RunHookTimeout | undefined | null, buildHookTimeout?: BuildHookTimeout | undefined | null): Promise<void>
|
|
947
|
+
/**
|
|
948
|
+
* `ListManagedMicrovmImageVersions`, every page: the versions of a managed base, the
|
|
949
|
+
* values `buildImage`'s base-version pin takes.
|
|
950
|
+
*
|
|
951
|
+
* `baseImageArn` is the base's full ARN, such as
|
|
952
|
+
* `arn:aws:lambda:us-east-1:aws:microvm-image:al2023-1`; a bare name is refused.
|
|
953
|
+
*/
|
|
954
|
+
managedBaseVersions(baseImageArn: string): Promise<Array<ManagedBaseVersion>>
|
|
955
|
+
/**
|
|
956
|
+
* Launches a MicroVM, waits for RUNNING and for its daemon to answer, and resolves with
|
|
957
|
+
* its session.
|
|
958
|
+
*
|
|
959
|
+
* `readyTimeout` bounds the wait for RUNNING; the wait for the daemon after it is
|
|
960
|
+
* `sessionConstants().defaultReadyTimeoutSeconds`, and a daemon that never answers
|
|
961
|
+
* rejects with `ERR_TIMEOUT` with the VM left RUNNING.
|
|
801
962
|
*
|
|
802
963
|
* # What the core refuses here, and this file does not
|
|
803
964
|
*
|
|
@@ -807,7 +968,9 @@ export declare class Sandbox {
|
|
|
807
968
|
*/
|
|
808
969
|
run(options?: RunOptions | undefined | null): Promise<Session>
|
|
809
970
|
/**
|
|
810
|
-
* Finishes a `run({ wait: false })`: waits for RUNNING and
|
|
971
|
+
* Finishes a `run({ wait: false })`: waits for RUNNING and for the daemon to answer, and
|
|
972
|
+
* resolves with the session. `timeout` bounds the wait for RUNNING, as `readyTimeout`
|
|
973
|
+
* does.
|
|
811
974
|
*
|
|
812
975
|
* A launch whose `clientToken` adopted an existing, idle-suspended VM resumes it; a
|
|
813
976
|
* fresh launch that reaches a terminal state first rejects with the service's
|
|
@@ -970,8 +1133,39 @@ export declare class Session {
|
|
|
970
1133
|
* the daemon's shape — a number here would be ambiguous between 0o755 and 755.
|
|
971
1134
|
*/
|
|
972
1135
|
uploadFile(path: string, data: Uint8Array, mode?: string | undefined | null): Promise<void>
|
|
973
|
-
/**
|
|
974
|
-
|
|
1136
|
+
/**
|
|
1137
|
+
* Reads one file, or lines `startLine` through `endLine` of it.
|
|
1138
|
+
*
|
|
1139
|
+
* The range is 1-based and inclusive, and the daemon slices the file, so reading lines 40
|
|
1140
|
+
* to 60 of a large log reads those lines alone. Either bound may be left out (line 1,
|
|
1141
|
+
* through EOF), and an `endLine` past the last line reads through EOF. Line 0 and an end
|
|
1142
|
+
* before the start reject with `ERR_INVALID_ARG` before any request.
|
|
1143
|
+
*/
|
|
1144
|
+
downloadFile(path: string, options?: DownloadFileOptions | undefined | null): Promise<Buffer>
|
|
1145
|
+
/**
|
|
1146
|
+
* Brings the files of a directory in the VM back under `localDir`: the regular files
|
|
1147
|
+
* `globs` select, and nothing else.
|
|
1148
|
+
*
|
|
1149
|
+
* The daemon packs `remote`, and the archive describes the VM's filesystem, where
|
|
1150
|
+
* untrusted work runs, so core writes only regular-file members that match a glob, never
|
|
1151
|
+
* under `.git` whatever the globs say, and never outside `localDir`. A symlink, a special
|
|
1152
|
+
* file or a `../` member is skipped, not refused. `['**']` brings every regular file back.
|
|
1153
|
+
* Resolves to what was written; a local directory that can't be written to rejects with
|
|
1154
|
+
* `ERR_INVALID_ARG`.
|
|
1155
|
+
*/
|
|
1156
|
+
downloadDir(remote: string, localDir: string, globs: Array<string>): Promise<Array<DownloadedFile>>
|
|
1157
|
+
/**
|
|
1158
|
+
* Syncs `localDir` into the VM's `/workspace` once, uploading only what changed.
|
|
1159
|
+
*
|
|
1160
|
+
* Core's one pass, `microvm sync`'s: the local tree is hashed and diffed against the
|
|
1161
|
+
* manifest the last sync left in the VM, the changed members travel as one archive, the
|
|
1162
|
+
* paths gone locally are removed in the VM with one `rm` whose deadline is
|
|
1163
|
+
* `deleteTimeout` seconds (core's default when omitted), and the manifest is rewritten.
|
|
1164
|
+
* `full: true` ignores the manifest and uploads everything. `.git`, `target`,
|
|
1165
|
+
* `node_modules` and `.venv` never travel. A tree over the daemon's budgets rejects with
|
|
1166
|
+
* `ERR_INVALID_ARG` before anything is sent.
|
|
1167
|
+
*/
|
|
1168
|
+
syncDir(localDir: string, options?: SyncDirOptions | undefined | null): Promise<SyncReport>
|
|
975
1169
|
/** Whether a path exists, distinguishing absence from every other refusal. */
|
|
976
1170
|
fileExists(path: string): Promise<boolean>
|
|
977
1171
|
/**
|
|
@@ -1023,6 +1217,28 @@ export declare class Session {
|
|
|
1023
1217
|
* The middle string **contains the credential**. Same rule as `connectHeaders`.
|
|
1024
1218
|
*/
|
|
1025
1219
|
connectSubprotocols(port: number): Promise<Array<string> | null>
|
|
1220
|
+
/**
|
|
1221
|
+
* Serves a local TCP port as a tunnel to `guestPort` in the VM, on a background task, and
|
|
1222
|
+
* resolves at once with its handle: `microvm tunnel`'s loop.
|
|
1223
|
+
*
|
|
1224
|
+
* Each local connection gets a WebSocket of its own through the endpoint proxy, and a
|
|
1225
|
+
* connection the daemon refuses is listed in the report while the tunnel keeps serving.
|
|
1226
|
+
* With `verifyIdentity` (a `TunnelIdentity`, such as `sandbox.tunnelIdentity()`), each
|
|
1227
|
+
* connection first proves the far end is the daemon of the VM that identity was launched
|
|
1228
|
+
* with, and a connection that can't is refused. A separate parameter rather than an
|
|
1229
|
+
* option, for the reason `buildImage`'s guarded values are: a class in an options object
|
|
1230
|
+
* can't cross an async call.
|
|
1231
|
+
*/
|
|
1232
|
+
tunnel(guestPort: number, options?: ServeOptions | undefined | null, verifyIdentity?: TunnelIdentity | undefined | null): Promise<Tunnel>
|
|
1233
|
+
/**
|
|
1234
|
+
* Serves a local port as an HTTP and WebSocket forward to `guestPort` in the VM, on a
|
|
1235
|
+
* background task, and resolves at once with its handle: `microvm port-forward`'s loop.
|
|
1236
|
+
*
|
|
1237
|
+
* Connections are served at once rather than one after another, so a slow request
|
|
1238
|
+
* doesn't hold the next. A request the endpoint proxy refuses is listed in the report
|
|
1239
|
+
* with its status while the forward keeps serving.
|
|
1240
|
+
*/
|
|
1241
|
+
portForward(guestPort: number, options?: ServeOptions | undefined | null): Promise<PortForward>
|
|
1026
1242
|
/**
|
|
1027
1243
|
* How many proxy tokens this session has minted, or `null` for a direct session.
|
|
1028
1244
|
*
|
|
@@ -1096,6 +1312,50 @@ export declare class Total {
|
|
|
1096
1312
|
toString(): string
|
|
1097
1313
|
}
|
|
1098
1314
|
|
|
1315
|
+
/**
|
|
1316
|
+
* A running tunnel. Call `stop()` when done; a garbage-collected handle stops the tunnel and
|
|
1317
|
+
* cuts its open connections.
|
|
1318
|
+
*/
|
|
1319
|
+
export declare class Tunnel {
|
|
1320
|
+
/** The local address to connect to, `host:port`, with the port the OS picked. */
|
|
1321
|
+
get localAddress(): string
|
|
1322
|
+
/** Whether the tunnel is still serving. */
|
|
1323
|
+
get running(): boolean
|
|
1324
|
+
/**
|
|
1325
|
+
* Stops accepting, waits for the connections still open to end, and resolves with the
|
|
1326
|
+
* report.
|
|
1327
|
+
*
|
|
1328
|
+
* With `timeout` (seconds), connections still open after it are cut and listed as
|
|
1329
|
+
* `"failed"`. Without it, a client that keeps its connection open keeps this waiting.
|
|
1330
|
+
* Callable again, with the same report.
|
|
1331
|
+
*/
|
|
1332
|
+
stop(timeout?: number | undefined | null): Promise<TunnelReport>
|
|
1333
|
+
/** The handle without its credentials. */
|
|
1334
|
+
toString(): string
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* What a launcher keeps to verify its VM: the host's secret seed and the VM's public key,
|
|
1339
|
+
* both base64.
|
|
1340
|
+
*
|
|
1341
|
+
* From `sandbox.tunnelIdentity()` after a `run({ identity: true })`, from a `NameRecord`, or
|
|
1342
|
+
* built from the two values `microvm run --identity` prints. Holds a secret: `hostSeed()` is a
|
|
1343
|
+
* method rather than a getter so it's never read by accident, and `toString()` leaves it out.
|
|
1344
|
+
*/
|
|
1345
|
+
export declare class TunnelIdentity {
|
|
1346
|
+
/**
|
|
1347
|
+
* Rebuilds the pair from its base64 spellings. Refuses a value that doesn't decode, or a
|
|
1348
|
+
* seed or key of the wrong length.
|
|
1349
|
+
*/
|
|
1350
|
+
constructor(hostSeed: string, vmPublicKey: string)
|
|
1351
|
+
/** The host's secret half, base64. Store only privately. */
|
|
1352
|
+
hostSeed(): string
|
|
1353
|
+
/** The VM's public key, base64: the pin. Safe to print and compare. */
|
|
1354
|
+
get vmPublicKey(): string
|
|
1355
|
+
/** The pair without its secret. */
|
|
1356
|
+
toString(): string
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1099
1359
|
/**
|
|
1100
1360
|
* A quantity we can measure but cannot price, because no rate is published.
|
|
1101
1361
|
*
|
|
@@ -1110,6 +1370,21 @@ export declare class Unpriced {
|
|
|
1110
1370
|
/** The layer's fixed values as JSON, for a caller that wants to reason about the guest. */
|
|
1111
1371
|
export declare function agentConstants(): string
|
|
1112
1372
|
|
|
1373
|
+
/**
|
|
1374
|
+
* What `ensureImage` builds or reuses from: the daemon binary, the build role, and where
|
|
1375
|
+
* the artifact goes.
|
|
1376
|
+
*/
|
|
1377
|
+
export interface AgentEnsureOptions {
|
|
1378
|
+
/** The daemon binary's bytes, zipped into the artifact. */
|
|
1379
|
+
binary: Uint8Array
|
|
1380
|
+
/** The build role, which must read the bucket and grant logs on `/aws/lambda-microvms/*`. */
|
|
1381
|
+
buildRoleArn: string
|
|
1382
|
+
/** The bucket the artifact is uploaded to, in the VM's region. */
|
|
1383
|
+
s3Bucket: string
|
|
1384
|
+
/** A key prefix inside the bucket, or absent for the bucket root. */
|
|
1385
|
+
s3KeyPrefix?: string
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1113
1388
|
/** What an agent image is derived from: the daemon binary and the build role. */
|
|
1114
1389
|
export interface AgentImageOptions {
|
|
1115
1390
|
/** The daemon binary's bytes, zipped into the artifact. */
|
|
@@ -1125,7 +1400,10 @@ export interface AgentImageOptions {
|
|
|
1125
1400
|
|
|
1126
1401
|
/** Everything a launch takes beyond what the layer fixes (egress on, the image). */
|
|
1127
1402
|
export interface AgentLaunchOptions {
|
|
1128
|
-
/**
|
|
1403
|
+
/**
|
|
1404
|
+
* The image ARN from `findImage` or `buildImage`, or a bare image name, which the core
|
|
1405
|
+
* resolves with one `ListMicrovmImages` read.
|
|
1406
|
+
*/
|
|
1129
1407
|
imageIdentifier: string
|
|
1130
1408
|
/** The execution role. Optional in the model; every real launch needs one. */
|
|
1131
1409
|
executionRoleArn?: string
|
|
@@ -1150,6 +1428,15 @@ export interface AgentLaunchOptions {
|
|
|
1150
1428
|
logStream?: string
|
|
1151
1429
|
/** Turns per-VM logging off. Cannot be combined with `logGroup` or `logStream`. */
|
|
1152
1430
|
disableLogging?: boolean
|
|
1431
|
+
/** The base environment for every exec in the VM. See `RunOptions.launchEnv`. */
|
|
1432
|
+
launchEnv?: Record<string, string>
|
|
1433
|
+
/** Launch shell-capable. See `RunOptions.shell`. */
|
|
1434
|
+
shell?: boolean
|
|
1435
|
+
/**
|
|
1436
|
+
* How long to wait for RUNNING. The wait for the daemon after it is the core's
|
|
1437
|
+
* `defaultReadyTimeoutSeconds`.
|
|
1438
|
+
*/
|
|
1439
|
+
readyTimeout?: number
|
|
1153
1440
|
}
|
|
1154
1441
|
|
|
1155
1442
|
/** A resolved spec: the model it will use and the command `prompt` runs. */
|
|
@@ -1236,8 +1523,16 @@ export interface BuildImageOptions {
|
|
|
1236
1523
|
/** The build role, which must grant logs on `/aws/lambda-microvms/*`. */
|
|
1237
1524
|
buildRoleArn: string
|
|
1238
1525
|
baseImage?: BaseImageInput
|
|
1526
|
+
/** Pins the managed base to one version, a value `managedBaseVersions` lists. */
|
|
1527
|
+
baseImageVersion?: string
|
|
1239
1528
|
/** A caller-supplied Dockerfile, checked against the base image's `FROM`. */
|
|
1240
1529
|
dockerfile?: string
|
|
1530
|
+
/**
|
|
1531
|
+
* A directory whose one manifest+lockfile pair bakes an environment layer, by the rule
|
|
1532
|
+
* the CLI's `--project` uses. A directory without exactly one pair is refused before any
|
|
1533
|
+
* call.
|
|
1534
|
+
*/
|
|
1535
|
+
projectDir?: string
|
|
1241
1536
|
/** Whether to repair guest identity. A boolean, not a capability list — see above. */
|
|
1242
1537
|
repairGuestIdentity?: boolean
|
|
1243
1538
|
/**
|
|
@@ -1266,6 +1561,16 @@ export interface BuildImageOptions {
|
|
|
1266
1561
|
/** Why the image build has no price, as the reason that lands on the line item. */
|
|
1267
1562
|
export declare function buildUnpricedReason(): string
|
|
1268
1563
|
|
|
1564
|
+
/**
|
|
1565
|
+
* Judges `report`'s total against a ceiling of `maxUsd` (a decimal string, such as `"1.50"`),
|
|
1566
|
+
* with `onBreach` (`"warn"` or `"abort"`) saying what a breach does.
|
|
1567
|
+
*
|
|
1568
|
+
* `onBreach` has no default, because a breach of a lower-bound total has already been exceeded
|
|
1569
|
+
* by an unknown margin, and whether that warns or refuses is the caller's call. Core's
|
|
1570
|
+
* `Budget::check`, the gate `microvm cost --max-cost` applies.
|
|
1571
|
+
*/
|
|
1572
|
+
export declare function checkBudget(report: CostReport, maxUsd: string, onBreach: string): BudgetVerdict
|
|
1573
|
+
|
|
1269
1574
|
/** The warm-pool argument, with its own counter-argument attached. */
|
|
1270
1575
|
export declare function compareResidency(size: SizeClass, holdSeconds: number, cycles?: number | undefined | null, rates?: RateTable | undefined | null): ResidencyComparison
|
|
1271
1576
|
|
|
@@ -1294,6 +1599,11 @@ export interface CompletionRequest {
|
|
|
1294
1599
|
timeoutSec?: number
|
|
1295
1600
|
/** The idempotency key. Omitted, one is minted. */
|
|
1296
1601
|
execId?: string
|
|
1602
|
+
/**
|
|
1603
|
+
* Signal the whole process group once the command's own child exits. See
|
|
1604
|
+
* `ExecOptions.reapGroupOnExit`.
|
|
1605
|
+
*/
|
|
1606
|
+
reapGroupOnExit?: boolean
|
|
1297
1607
|
/** Start the child's environment from the image's `ENV`. See `ExecOptions.inheritImageEnv`. */
|
|
1298
1608
|
inheritImageEnv?: boolean
|
|
1299
1609
|
/**
|
|
@@ -1303,6 +1613,18 @@ export interface CompletionRequest {
|
|
|
1303
1613
|
clientGraceSec?: number
|
|
1304
1614
|
}
|
|
1305
1615
|
|
|
1616
|
+
/** A connection that didn't end clean. */
|
|
1617
|
+
export interface ConnectionEnd {
|
|
1618
|
+
/** The local client's address, `host:port`. */
|
|
1619
|
+
peer: string
|
|
1620
|
+
/** `"refused"`, `"truncated"`, `"unproven"`, or `"failed"`. */
|
|
1621
|
+
kind: string
|
|
1622
|
+
/** The close code or the HTTP status, when the end carried one. */
|
|
1623
|
+
code?: number
|
|
1624
|
+
/** The daemon's reason, the forwarder's explanation, or the error. */
|
|
1625
|
+
detail: string
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1306
1628
|
/**
|
|
1307
1629
|
* The core crate's version, for a `doctor` or `manifest` command to report.
|
|
1308
1630
|
*
|
|
@@ -1324,6 +1646,14 @@ export declare function costConstants(): string
|
|
|
1324
1646
|
/** The managed base every `docs/PLATFORM.md` measurement from 2026-08-06 onward used. */
|
|
1325
1647
|
export declare function defaultBaseImage(): BaseImageInput
|
|
1326
1648
|
|
|
1649
|
+
/** How `deleteImage` retries while the image refuses. */
|
|
1650
|
+
export interface DeleteImageOptions {
|
|
1651
|
+
/** Attempts before giving up. Default: the core's teardown figure. */
|
|
1652
|
+
attempts?: number
|
|
1653
|
+
/** Seconds between attempts. Default: the core's teardown figure. */
|
|
1654
|
+
backoff?: number
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1327
1657
|
/** `Detached` as a plain object, token included, for a private store. */
|
|
1328
1658
|
export interface DetachedObject {
|
|
1329
1659
|
microvmId: string
|
|
@@ -1333,6 +1663,22 @@ export interface DetachedObject {
|
|
|
1333
1663
|
agentToken: string
|
|
1334
1664
|
}
|
|
1335
1665
|
|
|
1666
|
+
/** One file `downloadDir` wrote. */
|
|
1667
|
+
export interface DownloadedFile {
|
|
1668
|
+
/** The file's path under the local directory, as the archive named it. */
|
|
1669
|
+
path: string
|
|
1670
|
+
/** The file's size in bytes. */
|
|
1671
|
+
size: number
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/** The line range `downloadFile` reads, 1-based and inclusive. Both absent reads the file. */
|
|
1675
|
+
export interface DownloadFileOptions {
|
|
1676
|
+
/** The first line to read. Absent means line 1. */
|
|
1677
|
+
startLine?: number
|
|
1678
|
+
/** The last line to read. Absent, or past the last line, means through EOF. */
|
|
1679
|
+
endLine?: number
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1336
1682
|
/**
|
|
1337
1683
|
* The egress posture `sandbox.run` with these options would report, without launching.
|
|
1338
1684
|
*
|
|
@@ -1389,6 +1735,10 @@ export interface EnsureImageOptions {
|
|
|
1389
1735
|
/** The build role. */
|
|
1390
1736
|
buildRoleArn: string
|
|
1391
1737
|
baseImage?: BaseImageInput
|
|
1738
|
+
/** `buildImage`'s `baseImageVersion`; it joins the name's hash. */
|
|
1739
|
+
baseImageVersion?: string
|
|
1740
|
+
/** `buildImage`'s `projectDir`; the pair joins the name's hash. */
|
|
1741
|
+
projectDir?: string
|
|
1392
1742
|
/** Delete what exists under the name and build afresh. */
|
|
1393
1743
|
force?: boolean
|
|
1394
1744
|
tags?: Record<string, string>
|
|
@@ -1681,6 +2031,92 @@ export interface Image {
|
|
|
1681
2031
|
logStream?: string
|
|
1682
2032
|
}
|
|
1683
2033
|
|
|
2034
|
+
/**
|
|
2035
|
+
* One build of an image version: one per Graviton generation, so a version's builds differ
|
|
2036
|
+
* in `chipsetGeneration`. `getImageBuild` adds the snapshot sizes the listing lacks.
|
|
2037
|
+
*/
|
|
2038
|
+
export interface ImageBuild {
|
|
2039
|
+
imageArn: string
|
|
2040
|
+
imageVersion: string
|
|
2041
|
+
/** What `getImageBuild` takes, and nothing else in the API mints one. */
|
|
2042
|
+
buildId: string
|
|
2043
|
+
/** `buildState`, as the service spells it. */
|
|
2044
|
+
buildState: string
|
|
2045
|
+
architecture: string
|
|
2046
|
+
chipset: string
|
|
2047
|
+
chipsetGeneration: string
|
|
2048
|
+
/** Unix seconds. */
|
|
2049
|
+
createdAt: number
|
|
2050
|
+
/**
|
|
2051
|
+
* Why the build is in this state, when the service said: where a failed build's reason
|
|
2052
|
+
* lives.
|
|
2053
|
+
*/
|
|
2054
|
+
stateReason?: string
|
|
2055
|
+
/**
|
|
2056
|
+
* `snapshotBuild.memorySnapshotSizeInBytes`, from `getImageBuild` only, and only when the
|
|
2057
|
+
* service reported it.
|
|
2058
|
+
*/
|
|
2059
|
+
memorySnapshotSizeInBytes?: number
|
|
2060
|
+
/** `snapshotBuild.codeInstallSizeInBytes`, from `getImageBuild` only. */
|
|
2061
|
+
codeInstallSizeInBytes?: number
|
|
2062
|
+
/** `snapshotBuild.diskSnapshotSizeInBytes`, from `getImageBuild` only. */
|
|
2063
|
+
diskSnapshotSizeInBytes?: number
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
/** One `ListMicrovmImages` item: an image's ARN, name and state. */
|
|
2067
|
+
export interface ImageSummary {
|
|
2068
|
+
imageArn: string
|
|
2069
|
+
name: string
|
|
2070
|
+
/** As the service spells it, such as `"CREATING"` or `"CREATED"`. */
|
|
2071
|
+
state: string
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* One image version as `ListMicrovmImageVersions` or `UpdateMicrovmImageVersion` reads it
|
|
2076
|
+
* back: its build state, whether `RunMicrovm` launches it, and what it was built with.
|
|
2077
|
+
*/
|
|
2078
|
+
export interface ImageVersion {
|
|
2079
|
+
imageArn: string
|
|
2080
|
+
imageVersion: string
|
|
2081
|
+
/** The version's build state, as the service spells it. */
|
|
2082
|
+
state: string
|
|
2083
|
+
/**
|
|
2084
|
+
* `"ACTIVE"` (`RunMicrovm` launches it) or `"INACTIVE"` (it refuses; running VMs keep
|
|
2085
|
+
* running).
|
|
2086
|
+
*/
|
|
2087
|
+
status: string
|
|
2088
|
+
/** Whether `RunMicrovm` launches this version. */
|
|
2089
|
+
isActive: boolean
|
|
2090
|
+
/**
|
|
2091
|
+
* Why the version is in this state, when the service said. A failed build's reason is on
|
|
2092
|
+
* its build (`listImageBuilds`), and this one is usually absent.
|
|
2093
|
+
*/
|
|
2094
|
+
stateReason?: string
|
|
2095
|
+
/** Unix seconds. */
|
|
2096
|
+
createdAt: number
|
|
2097
|
+
/** Unix seconds, when the service reported it. */
|
|
2098
|
+
updatedAt?: number
|
|
2099
|
+
baseImageArn: string
|
|
2100
|
+
/**
|
|
2101
|
+
* The base version the build used, as the service spells it (`"1.0"` where the managed
|
|
2102
|
+
* base lists `"1"`). A record of the build, not a value to pass back as a pin.
|
|
2103
|
+
*/
|
|
2104
|
+
baseImageVersion?: string
|
|
2105
|
+
buildRoleArn: string
|
|
2106
|
+
/** `codeArtifact.uri`: the artifact the version was built from. */
|
|
2107
|
+
codeArtifactUri: string
|
|
2108
|
+
description?: string
|
|
2109
|
+
/**
|
|
2110
|
+
* `resources[0].minimumMemoryInMiB`, the list's one member: the size class the version
|
|
2111
|
+
* was built for, and the only place a built image reports it.
|
|
2112
|
+
*/
|
|
2113
|
+
minimumMemoryMib?: number
|
|
2114
|
+
egressNetworkConnectors?: Array<string>
|
|
2115
|
+
additionalOsCapabilities?: Array<string>
|
|
2116
|
+
environmentVariables?: Record<string, string>
|
|
2117
|
+
tags?: Record<string, string>
|
|
2118
|
+
}
|
|
2119
|
+
|
|
1684
2120
|
/**
|
|
1685
2121
|
* Installs Bedrock access for `agents` into a running VM over `session`.
|
|
1686
2122
|
*
|
|
@@ -1699,6 +2135,18 @@ export declare function installAgentAccess(session: Session, agents: Array<Agent
|
|
|
1699
2135
|
*/
|
|
1700
2136
|
export declare function installedAgents(session: Session): Promise<Array<AgentSpec>>
|
|
1701
2137
|
|
|
2138
|
+
/**
|
|
2139
|
+
* Whether retrying the identical call could plausibly succeed, for an error this library raised.
|
|
2140
|
+
*
|
|
2141
|
+
* The TypeScript spelling of Python's `.retryable`, read off the chain every error here
|
|
2142
|
+
* carries: `err.cause.message` is the `ERR_*` code, and core answers for its kind. A
|
|
2143
|
+
* transient condition (a refused connection, a mint failure, a daemon not yet bootstrapped)
|
|
2144
|
+
* is `true`; a full disk, a credential, or a refused argument is `false`. Anything that
|
|
2145
|
+
* isn't a library error (no cause, or a cause whose message is no `ERR_*` code) is `false`,
|
|
2146
|
+
* because nothing says a retry would land differently.
|
|
2147
|
+
*/
|
|
2148
|
+
export declare function isRetryable(error: unknown): boolean
|
|
2149
|
+
|
|
1702
2150
|
/** The options bag for `keepAwake`. */
|
|
1703
2151
|
export interface KeepAwakeOptions {
|
|
1704
2152
|
/** Seconds between polls. Default: a third of the idle window, at most 20. */
|
|
@@ -1712,6 +2160,11 @@ export interface KeepAwakeOptions {
|
|
|
1712
2160
|
* platform minimum of 60 is assumed. The interval may be at most half of it.
|
|
1713
2161
|
*/
|
|
1714
2162
|
idleWindowSec?: number
|
|
2163
|
+
/**
|
|
2164
|
+
* How many retryable poll failures in a row are retried, a second apart, before the
|
|
2165
|
+
* keepalive ends with the error. Default: the core's `DEFAULT_TOLERATED_ERRORS`.
|
|
2166
|
+
*/
|
|
2167
|
+
toleratedErrors?: number
|
|
1715
2168
|
}
|
|
1716
2169
|
|
|
1717
2170
|
/** What a finished keepalive did. */
|
|
@@ -1732,6 +2185,45 @@ export interface ListMicrovmsOptions {
|
|
|
1732
2185
|
imageVersion?: string
|
|
1733
2186
|
}
|
|
1734
2187
|
|
|
2188
|
+
/**
|
|
2189
|
+
* The three guarded values a build takes, as separate parameters rather than fields.
|
|
2190
|
+
*
|
|
2191
|
+
* # Why they are not in [`BuildImageOptions`]
|
|
2192
|
+
*
|
|
2193
|
+
* Measured, not preferred. A `#[napi(object)]` field holding a class instance must be a
|
|
2194
|
+
* `ClassInstance<'a, T>`, which carries raw `napi_value`/`napi_env` pointers and is therefore
|
|
2195
|
+
* **not `Send`** — and napi's async path requires `Future: Send`. So an options object with a
|
|
2196
|
+
* `size: SizeClass` field cannot be a parameter of an `async fn`, which
|
|
2197
|
+
* `Sandbox.buildImage` has to be. The compiler said so in as many words:
|
|
2198
|
+
* `future created by async block is not Send ... has type BuildImageOptions<'_> which is not
|
|
2199
|
+
* Send`.
|
|
2200
|
+
*
|
|
2201
|
+
* A *reference* parameter — `Option<&SizeClass>` — has no such problem, because napi
|
|
2202
|
+
* dereferences it before the future is built. So the guarded types move out of the bag and
|
|
2203
|
+
* into the signature, which loses the keyword-argument look and keeps every closure:
|
|
2204
|
+
*
|
|
2205
|
+
* * `size` still refuses an off-table baseline, because the only way to have a `SizeClass` is
|
|
2206
|
+
* `SizeClass.fromBaselineMib` or `SizeClass.defaultClass` (TRAP-10).
|
|
2207
|
+
* * `runHookTimeout` and `buildHookTimeout` are still two distinct classes, so they still
|
|
2208
|
+
* cannot be transposed — which was the whole reason they are types (BIND-2).
|
|
2209
|
+
*
|
|
2210
|
+
* A caller writes `sandbox.buildImage(opts, size, runTimeout, buildTimeout)` with the last
|
|
2211
|
+
* three optional.
|
|
2212
|
+
* One version of a managed base image, from `ListManagedMicrovmImageVersions`.
|
|
2213
|
+
*/
|
|
2214
|
+
export interface ManagedBaseVersion {
|
|
2215
|
+
imageArn: string
|
|
2216
|
+
/**
|
|
2217
|
+
* A bare integer for a managed base (`"0"`, `"1"`), where a custom image's versions read
|
|
2218
|
+
* `"1.0"`: the value `buildImage`'s pin takes, not one to compare with a build's readback.
|
|
2219
|
+
*/
|
|
2220
|
+
imageVersion: string
|
|
2221
|
+
/** Unix seconds. */
|
|
2222
|
+
createdAt: number
|
|
2223
|
+
/** Unix seconds, when the service reported it. */
|
|
2224
|
+
updatedAt?: number
|
|
2225
|
+
}
|
|
2226
|
+
|
|
1735
2227
|
/** A MicroVM as `GetMicrovm` last described it. */
|
|
1736
2228
|
export interface Microvm {
|
|
1737
2229
|
id: string
|
|
@@ -1825,10 +2317,34 @@ export interface PlanUsageOptions {
|
|
|
1825
2317
|
imageRetainedSeconds?: number
|
|
1826
2318
|
suspendResumeCycles?: number
|
|
1827
2319
|
snapshotGb?: number
|
|
2320
|
+
/**
|
|
2321
|
+
* Whether the plan launches, which reads a snapshot. Left out, the core infers it: running
|
|
2322
|
+
* time, or an image of non-zero size, so suspended time alone reads no launch snapshot.
|
|
2323
|
+
*/
|
|
1828
2324
|
launched?: boolean
|
|
2325
|
+
/**
|
|
2326
|
+
* What the report is of. Left out, `"estimate"`: the core's label, the one
|
|
2327
|
+
* `microvm cost --estimate` uses for the same plan (#255).
|
|
2328
|
+
*/
|
|
1829
2329
|
label?: string
|
|
1830
2330
|
}
|
|
1831
2331
|
|
|
2332
|
+
/** What a stopped port-forward did. */
|
|
2333
|
+
export interface PortForwardReport {
|
|
2334
|
+
/** Connections accepted. */
|
|
2335
|
+
served: number
|
|
2336
|
+
/** Exchanges the endpoint proxy refused, a 403 or a 502 among them. */
|
|
2337
|
+
refused: number
|
|
2338
|
+
/** Exchanges that upgraded, a WebSocket among them. */
|
|
2339
|
+
upgrades: number
|
|
2340
|
+
/** Proxy tokens the session minted by the time the forward stopped. */
|
|
2341
|
+
proxyTokenMints: number
|
|
2342
|
+
/** Why it stopped: `"stopped"`, `"limit"`, or `"listener-failed: <why>"`. */
|
|
2343
|
+
stopped: string
|
|
2344
|
+
/** Each connection that didn't end clean, in the order they ended. */
|
|
2345
|
+
ended: Array<ConnectionEnd>
|
|
2346
|
+
}
|
|
2347
|
+
|
|
1832
2348
|
/**
|
|
1833
2349
|
* Whether a harness can launch in `region` (default: `$AWS_REGION`, `$AWS_DEFAULT_REGION`,
|
|
1834
2350
|
* then us-east-1), checked before it queues work.
|
|
@@ -1941,10 +2457,11 @@ export interface PromptOptions {
|
|
|
1941
2457
|
* The `agentd` daemon binary for `options.version` (default: this client's own).
|
|
1942
2458
|
*
|
|
1943
2459
|
* 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
|
|
1945
|
-
*
|
|
1946
|
-
* cannot be verified rejects with `ERR_PRECONDITION`
|
|
1947
|
-
* any binary that is not an aarch64 ELF.
|
|
2460
|
+
* version's cache entry, else the GitHub release asset, verified in-process against the
|
|
2461
|
+
* release workflow's Sigstore attestation or, only when GitHub can't be reached for one, the
|
|
2462
|
+
* release's `SHA256SUMS`. A fetch that cannot be verified rejects with `ERR_PRECONDITION`
|
|
2463
|
+
* (on `err.cause.message`), and so does any binary that is not an aarch64 ELF. Neither
|
|
2464
|
+
* `gh` nor `curl` is needed.
|
|
1948
2465
|
*/
|
|
1949
2466
|
export declare function provisionAgentd(options?: ProvisionOptions | undefined | null): Promise<Buffer>
|
|
1950
2467
|
|
|
@@ -1965,9 +2482,9 @@ export interface ProvisionedAgentd {
|
|
|
1965
2482
|
*/
|
|
1966
2483
|
suppliedBy?: string
|
|
1967
2484
|
/**
|
|
1968
|
-
* `"attestation"` (
|
|
1969
|
-
* `SHA256SUMS`, integrity), when fetched or when the cache
|
|
1970
|
-
* for a caller-supplied binary.
|
|
2485
|
+
* `"attestation"` (the release workflow's Sigstore attestation, provenance) or
|
|
2486
|
+
* `"checksum"` (the release's `SHA256SUMS`, integrity), when fetched or when the cache
|
|
2487
|
+
* entry was installed. Absent for a caller-supplied binary.
|
|
1971
2488
|
*/
|
|
1972
2489
|
verification?: string
|
|
1973
2490
|
/** The release version provisioned for, without a leading `v`. */
|
|
@@ -1991,7 +2508,12 @@ export interface ProvisionOptions {
|
|
|
1991
2508
|
|
|
1992
2509
|
/** Everything a launch needs. */
|
|
1993
2510
|
export interface RunOptions {
|
|
1994
|
-
/**
|
|
2511
|
+
/**
|
|
2512
|
+
* The image to launch, as an ARN or a bare image name, or omitted for the one
|
|
2513
|
+
* `buildImage` built. The core resolves a name to its ARN with one `ListMicrovmImages`
|
|
2514
|
+
* read, and a name no image carries is refused with `ERR_PRECONDITION` before anything
|
|
2515
|
+
* launches.
|
|
2516
|
+
*/
|
|
1995
2517
|
imageIdentifier?: string
|
|
1996
2518
|
/**
|
|
1997
2519
|
* `imageVersion`, or omitted for the image's own latest active version.
|
|
@@ -2024,6 +2546,12 @@ export interface RunOptions {
|
|
|
2024
2546
|
* payload before the launch, naming the byte count.
|
|
2025
2547
|
*/
|
|
2026
2548
|
launchEnv?: Record<string, string>
|
|
2549
|
+
/**
|
|
2550
|
+
* Generate a tunnel identity and deliver the VM's half with the launch, so
|
|
2551
|
+
* `session.tunnel(port, {}, await sandbox.tunnelIdentity())` can prove the far end is
|
|
2552
|
+
* this VM's daemon.
|
|
2553
|
+
*/
|
|
2554
|
+
identity?: boolean
|
|
2027
2555
|
/** Request the managed INTERNET_EGRESS connector. Omission does not block egress. */
|
|
2028
2556
|
egress?: boolean
|
|
2029
2557
|
/**
|
|
@@ -2046,13 +2574,17 @@ export interface RunOptions {
|
|
|
2046
2574
|
suspendedSec?: number
|
|
2047
2575
|
autoResume?: boolean
|
|
2048
2576
|
maxDurationSec?: number
|
|
2049
|
-
/**
|
|
2577
|
+
/**
|
|
2578
|
+
* How long to wait for RUNNING. The wait for the daemon after it is the core's
|
|
2579
|
+
* `defaultReadyTimeoutSeconds`.
|
|
2580
|
+
*/
|
|
2050
2581
|
readyTimeout?: number
|
|
2051
2582
|
/** A label for the run token. Never the token. */
|
|
2052
2583
|
tokenScope?: string
|
|
2053
2584
|
/**
|
|
2054
|
-
* Whether `run` waits for RUNNING (default `true`).
|
|
2055
|
-
* is accepted, with the lifecycle PENDING;
|
|
2585
|
+
* Whether `run` waits for RUNNING and for the daemon to answer (default `true`).
|
|
2586
|
+
* `false` resolves once the launch is accepted, with the lifecycle PENDING;
|
|
2587
|
+
* `waitUntilRunning` finishes both waits.
|
|
2056
2588
|
*/
|
|
2057
2589
|
wait?: boolean
|
|
2058
2590
|
/** Per-VM CloudWatch log group. Omitted keeps the service's default destination. */
|
|
@@ -2107,11 +2639,27 @@ export interface RunUsageOptions {
|
|
|
2107
2639
|
suspendResumeCycles?: number
|
|
2108
2640
|
/** The suspend snapshot's size. Defaults to the baseline memory footprint. */
|
|
2109
2641
|
snapshotGb?: number
|
|
2110
|
-
/**
|
|
2642
|
+
/**
|
|
2643
|
+
* Whether a launch happened. A launch reads a snapshot. Left out, the core infers it:
|
|
2644
|
+
* running time, or an image of non-zero size.
|
|
2645
|
+
*/
|
|
2111
2646
|
launched?: boolean
|
|
2647
|
+
/** What the report is of. Left out, `"run"`: the core's label, the one `microvm cost` uses. */
|
|
2112
2648
|
label?: string
|
|
2113
2649
|
}
|
|
2114
2650
|
|
|
2651
|
+
/** Where a tunnel or a port-forward listens, and when it stops on its own. */
|
|
2652
|
+
export interface ServeOptions {
|
|
2653
|
+
/**
|
|
2654
|
+
* A `host:port` to listen on. Default: loopback, on a port the OS picks; the handle's
|
|
2655
|
+
* `localAddress` says which. Bind beyond loopback only on a network you trust: whoever
|
|
2656
|
+
* connects reaches the VM with this session's credentials.
|
|
2657
|
+
*/
|
|
2658
|
+
bind?: string
|
|
2659
|
+
/** Stop accepting after this many connections. Default: serve until stopped. */
|
|
2660
|
+
maxConnections?: number
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2115
2663
|
/**
|
|
2116
2664
|
* The daemon's protocol constants, as a JSON string, for a caller asserting against the
|
|
2117
2665
|
* wire contract.
|
|
@@ -2226,6 +2774,30 @@ export interface StreamOptionsInput {
|
|
|
2226
2774
|
idleTimeout?: number
|
|
2227
2775
|
}
|
|
2228
2776
|
|
|
2777
|
+
/** How `syncDir` should behave. */
|
|
2778
|
+
export interface SyncDirOptions {
|
|
2779
|
+
/** Ignore the manifest the last sync left in the VM and upload everything. */
|
|
2780
|
+
full?: boolean
|
|
2781
|
+
/** The in-VM removal's deadline, in seconds. Default: core's, 60. */
|
|
2782
|
+
deleteTimeout?: number
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
/** What one `syncDir` did. */
|
|
2786
|
+
export interface SyncReport {
|
|
2787
|
+
/** The uploaded archive's size, 0 when nothing travelled. */
|
|
2788
|
+
uploadedBytes: number
|
|
2789
|
+
/** How many members the upload carried: the changed ones, or every one when `full`. */
|
|
2790
|
+
uploadedMembers: number
|
|
2791
|
+
/** How many paths gone locally were removed in the VM. */
|
|
2792
|
+
deleted: number
|
|
2793
|
+
/** Deletions the VM's manifest ordered that weren't plain relative paths, so weren't run. */
|
|
2794
|
+
refusedDeletions: number
|
|
2795
|
+
/** No manifest was read (`full: true`, or none in the VM), so the whole tree travelled. */
|
|
2796
|
+
full: boolean
|
|
2797
|
+
/** The VM already held the tree as it is, so nothing travelled. */
|
|
2798
|
+
unchanged: boolean
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2229
2801
|
/**
|
|
2230
2802
|
* What a teardown should delete beyond the VM itself.
|
|
2231
2803
|
*
|
|
@@ -2246,9 +2818,10 @@ export interface TeardownOptions {
|
|
|
2246
2818
|
/**
|
|
2247
2819
|
* `false` by default: the caller is on the way out, and a teardown that blocked five
|
|
2248
2820
|
* minutes on a state nobody reads is five minutes of a CI job. The report then honestly
|
|
2249
|
-
* ends in `"TERMINATING"`.
|
|
2821
|
+
* ends in `"TERMINATING"`. `true` waits for TERMINATED up to the core's lifecycle default;
|
|
2822
|
+
* a number of seconds waits up to that instead.
|
|
2250
2823
|
*/
|
|
2251
|
-
waitForTerminated?: boolean
|
|
2824
|
+
waitForTerminated?: boolean | number
|
|
2252
2825
|
}
|
|
2253
2826
|
|
|
2254
2827
|
/** What a teardown did, and what it left behind. */
|
|
@@ -2284,6 +2857,30 @@ export interface TeardownReport {
|
|
|
2284
2857
|
leaked: boolean
|
|
2285
2858
|
}
|
|
2286
2859
|
|
|
2860
|
+
/** What a stopped tunnel did. */
|
|
2861
|
+
export interface TunnelReport {
|
|
2862
|
+
/** Connections accepted. */
|
|
2863
|
+
served: number
|
|
2864
|
+
/** Connections the daemon refused, or that failed with an error. */
|
|
2865
|
+
refused: number
|
|
2866
|
+
/**
|
|
2867
|
+
* Verified connections that ended without the daemon's end of stream, so their stream
|
|
2868
|
+
* may have been cut short.
|
|
2869
|
+
*/
|
|
2870
|
+
truncated: number
|
|
2871
|
+
/**
|
|
2872
|
+
* Verified connections into a daemon from before the end of stream, whose end nothing
|
|
2873
|
+
* proved.
|
|
2874
|
+
*/
|
|
2875
|
+
unproven: number
|
|
2876
|
+
/** Proxy tokens the session minted by the time the tunnel stopped. */
|
|
2877
|
+
proxyTokenMints: number
|
|
2878
|
+
/** Why it stopped: `"stopped"`, `"limit"`, or `"listener-failed: <why>"`. */
|
|
2879
|
+
stopped: string
|
|
2880
|
+
/** Each connection that didn't end clean, in the order they ended. */
|
|
2881
|
+
ended: Array<ConnectionEnd>
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2287
2884
|
/** How `waitForState` polls. */
|
|
2288
2885
|
export interface WaitForStateOptions {
|
|
2289
2886
|
/** States that reject with `stateReason` instead of being waited through. */
|