1.6 KiB
1.6 KiB
Project Hints
Architecture
- Wraps Amazon Firecracker VMM using HTTP-over-Unix-socket API
- Uses
@push.rocks/smartrequestwith URL formathttp://unix:<socket>:<path>for socket communication - Uses
@push.rocks/smartshellexecStreaming()to manage Firecracker child processes - Uses
@push.rocks/smartexitfor cleanup on process exit BaseImageManagerdownloads Firecracker CI demo artifacts or hosted project manifests into/tmp/.smartvm/base-imagesby default- Base image cache keeps 2 bundles by default and warns before evicting older bundles
- Hosted manifest examples live in
assets/base-images/
Key API Patterns
- SmartRequest:
SmartRequest.create().url(...).json(body).put()— response has.status,.ok,.json() - Smartshell:
shell.execStreaming(cmd)returns{ childProcess, terminate(), kill(), finalPromise } - SmartExit:
smartExit.addProcess(child),smartExit.addCleanupFunction(fn),smartExit.killAll()
Firecracker API
- Pre-boot config: PUT /boot-source, PUT /machine-config, PUT /drives/{id}, PUT /network-interfaces/{id}
- Start: PUT /actions { action_type: "InstanceStart" }
- Pause/Resume: PATCH /vm { state: "Paused" | "Resumed" }
- Stop: PUT /actions { action_type: "SendCtrlAltDel" }
Integration Testing
- Default
pnpm testskips real Firecracker boot testing - Set
SMARTVM_RUN_INTEGRATION=trueto run the opt-in boot test SMARTVM_BASE_IMAGE_PRESETsupportslatestandlts; default islatest- Hosted/project-owned bundles use
baseImageManifestUrl,baseImageManifestPath,manifestUrl, ormanifestPath