@multiplayer-app/sandbox 7.0.2 → 7.0.4
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 +73 -0
- package/dist/cli.js +469 -5
- package/dist/cli.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/microvm-guest-agents.d.ts +18 -0
- package/dist/microvm-guest-agents.d.ts.map +1 -0
- package/dist/microvm-images.d.ts +37 -0
- package/dist/microvm-images.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guest-agent source for each stack's Lambda MicroVM base image, as a set of in-memory files
|
|
3
|
+
* (zipped and uploaded by microvm-images.ts — no disk/build step needed).
|
|
4
|
+
*
|
|
5
|
+
* Kept in sync BY HAND with scripts/base-images/{node,python,static}/build.sh, which the
|
|
6
|
+
* internal build-base-images.sh pipeline still uses for QEMU/Firecracker/Docker images (those
|
|
7
|
+
* need a real build host, so unifying the two isn't in scope here) — if you change one, change
|
|
8
|
+
* the other. The agent itself: an HTTP server on :8080 that answers the Lambda MicroVM
|
|
9
|
+
* lifecycle hooks (/aws/lambda-microvms/runtime/v1/*) and {"status":"ok"} elsewhere. The /run
|
|
10
|
+
* hook payload (vmId/sessionId/stack/env from the worker executor) is kept in memory and
|
|
11
|
+
* echoed back so the control plane can identify the VM.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MICROVM_BASE_IMAGE_STACKS: readonly ["node", "python", "static"];
|
|
14
|
+
export type MicrovmBaseImageStack = (typeof MICROVM_BASE_IMAGE_STACKS)[number];
|
|
15
|
+
export declare function isMicrovmBaseImageStack(stack: string): stack is MicrovmBaseImageStack;
|
|
16
|
+
/** Files to zip for `stack`'s base image, relative paths -> contents. */
|
|
17
|
+
export declare function guestAgentFiles(stack: MicrovmBaseImageStack): Record<string, string>;
|
|
18
|
+
//# sourceMappingURL=microvm-guest-agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microvm-guest-agents.d.ts","sourceRoot":"","sources":["../src/microvm-guest-agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,yBAAyB,uCAAwC,CAAA;AAC9E,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,qBAAqB,CAErF;AAoRD,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASpF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type MicrovmBaseImageStack } from './microvm-guest-agents';
|
|
2
|
+
export interface CreateMicrovmImagesOptions {
|
|
3
|
+
region: string;
|
|
4
|
+
/** S3 bucket the built code artifact is uploaded to (must already exist). */
|
|
5
|
+
bucket: string;
|
|
6
|
+
/** AWS-managed base OS image ARN — discover one with listBaseMicrovmImages(). */
|
|
7
|
+
baseImageArn: string;
|
|
8
|
+
/** IAM role ARN the build assumes to read the artifact from `bucket` (needs s3:GetObject). */
|
|
9
|
+
buildRoleArn: string;
|
|
10
|
+
/** Stacks to build/register (default: all of MICROVM_BASE_IMAGE_STACKS). */
|
|
11
|
+
stacks?: MicrovmBaseImageStack[];
|
|
12
|
+
/** Minimum guest memory, MiB (default: 1024). */
|
|
13
|
+
minMemoryMib?: number;
|
|
14
|
+
/** MicroVM image name prefix, "<prefix>-<stack>" (default: 'sandbox'). */
|
|
15
|
+
imageNamePrefix?: string;
|
|
16
|
+
/** Image-build poll interval, ms (default: 5000). */
|
|
17
|
+
pollIntervalMs?: number;
|
|
18
|
+
/** Image-build poll timeout, ms (default: 600000 = 10 min). */
|
|
19
|
+
pollTimeoutMs?: number;
|
|
20
|
+
/** Called after each step so callers (CLI, CI) can report progress. Optional. */
|
|
21
|
+
onProgress?: (message: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface CreateMicrovmImagesResult {
|
|
24
|
+
/** stack -> the image ARN that's now active, ready to use as MICROVM_STACK_IMAGE_ARNS. */
|
|
25
|
+
stackArns: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
/** AWS-managed base OS images available as a `baseImageArn` candidate in this region. */
|
|
28
|
+
export declare function listBaseMicrovmImages(options: {
|
|
29
|
+
region: string;
|
|
30
|
+
}): Promise<string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Builds and registers/updates the guest-agent base images for `options.stacks`, in the
|
|
33
|
+
* caller's own AWS account. Returns the stack -> image ARN map once every image's new version
|
|
34
|
+
* has finished building (polled).
|
|
35
|
+
*/
|
|
36
|
+
export declare function createMicrovmImages(options: CreateMicrovmImagesOptions): Promise<CreateMicrovmImagesResult>;
|
|
37
|
+
//# sourceMappingURL=microvm-images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microvm-images.d.ts","sourceRoot":"","sources":["../src/microvm-images.ts"],"names":[],"mappings":"AAuBA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAA;AAE/B,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAA;IACd,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAA;IACpB,8FAA8F;IAC9F,YAAY,EAAE,MAAM,CAAA;IACpB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAA;IAChC,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iFAAiF;IACjF,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,yBAAyB;IACxC,0FAA0F;IAC1F,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAqCD,yFAAyF;AACzF,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAI1F;AAyCD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,yBAAyB,CAAC,CA+EpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplayer-app/sandbox",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.4",
|
|
4
4
|
"description": "Sandbox worker library and CLI (Docker, QEMU, Firecracker, AWS Lambda MicroVM, Fargate)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@aws-sdk/client-ecs": "^3.1087.0",
|
|
27
27
|
"@aws-sdk/client-lambda-microvms": "^3.1079.0",
|
|
28
28
|
"@aws-sdk/client-s3": "^3.1079.0",
|
|
29
|
+
"archiver": "^8.0.0",
|
|
29
30
|
"bunyan": "1.8.15",
|
|
30
31
|
"commander": "^14.0.0",
|
|
31
32
|
"dotenv": "^17.2.3",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"ws": "^8.18.3"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
38
|
+
"@types/archiver": "^8.0.0",
|
|
37
39
|
"@types/node": "^25.8.0",
|
|
38
40
|
"@types/ws": "^8.18.1",
|
|
39
41
|
"esbuild": "^0.25.12",
|
|
@@ -51,8 +53,6 @@
|
|
|
51
53
|
"images:build": "bash scripts/build-base-images.sh",
|
|
52
54
|
"images:publish:local": "bash scripts/publish-base-images-local.sh",
|
|
53
55
|
"images:upload:local": "SKIP_BUILD=1 bash scripts/publish-base-images-local.sh",
|
|
54
|
-
"images:microvm:create": "node scripts/create-microvm-images.mjs",
|
|
55
|
-
"images:microvm:list-base-images": "node scripts/create-microvm-images.mjs --list-base-images",
|
|
56
56
|
"docker:build": "docker build -f Dockerfile -t multiplayer-sandbox-worker:local ../..",
|
|
57
57
|
"start": "node dist/cli.js",
|
|
58
58
|
"worker:start": "node dist/cli.js start",
|