The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type * as microvms from "@distilled.cloud/aws/lambda-microvms"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import type { MicrovmImage } from "./MicrovmImage.ts"; |
| 5 | |
| 6 | export interface RunMicrovmRequest extends Omit<microvms.RunMicrovmRequest, "imageIdentifier"> {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `RunMicrovm`. |
| 10 | * |
| 11 | * Bind it to a {@link MicrovmImage} inside a Lambda Function to get a callable |
| 12 | * that launches a MicroVM from that image (the `imageIdentifier` is injected). |
| 13 | * The response carries the MicroVM `endpoint`; connect to it with an |
| 14 | * `X-aws-proxy-auth` token from {@link CreateAuthToken}. |
| 15 | * |
| 16 | * ### Running MicroVMs |
| 17 | * **Example:** Run a MicroVM |
| 18 | * ```typescript |
| 19 | * const runMicrovm = yield* AWS.Lambda.RunMicrovm(Sandbox); |
| 20 | * |
| 21 | * const vm = yield* runMicrovm({ |
| 22 | * idlePolicy: { |
| 23 | * maxIdleDurationSeconds: 900, |
| 24 | * suspendedDurationSeconds: 300, |
| 25 | * autoResumeEnabled: true, |
| 26 | * }, |
| 27 | * }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface RunMicrovm extends Binding.Service< |
| 33 | RunMicrovm, |
| 34 | "AWS.Lambda.RunMicrovm", |
| 35 | ( |
| 36 | image: MicrovmImage, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: RunMicrovmRequest, |
| 40 | ) => Effect.Effect<microvms.RunMicrovmResponse, microvms.RunMicrovmError> |
| 41 | > |
| 42 | > {} |
| 43 | export const RunMicrovm = Binding.Service<RunMicrovm>("AWS.Lambda.RunMicrovm"); |