mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 03:49:31 +00:00
* perf: skip cloud-init for minimal-tier agents with tarballs/snapshots Ubuntu 24.04 base images already have curl + git, so minimal-tier agents (claude, opencode, zeroclaw, hermes) don't need the cloud-init package install step when using tarballs or snapshots. Adds skipCloudInit flag to CloudOrchestrator — set automatically when (tarball || snapshot) && tier === "minimal". Each cloud's waitForReady checks this flag and calls waitForSshOnly instead of waitForCloudInit. Saves ~30-60s on minimal-tier agent deploys with --fast or --beta tarball. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: add --fast mode and updated beta features to README Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: remove timing table from README Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
78 lines
1.8 KiB
TypeScript
78 lines
1.8 KiB
TypeScript
#!/usr/bin/env bun
|
|
|
|
// aws/main.ts — Orchestrator: deploys an agent on AWS Lightsail
|
|
|
|
import type { CloudOrchestrator } from "../shared/orchestrate";
|
|
|
|
import { getErrorMessage } from "@openrouter/spawn-shared";
|
|
import { runOrchestration } from "../shared/orchestrate";
|
|
import { agents, resolveAgent } from "./agents";
|
|
import {
|
|
authenticate,
|
|
createInstance,
|
|
downloadFile,
|
|
ensureAwsCli,
|
|
ensureSshKey,
|
|
getConnectionInfo,
|
|
getServerName,
|
|
interactiveSession,
|
|
promptBundle,
|
|
promptRegion,
|
|
promptSpawnName,
|
|
runServer,
|
|
uploadFile,
|
|
waitForCloudInit,
|
|
waitForSshOnly,
|
|
} from "./aws";
|
|
|
|
async function main() {
|
|
const agentName = process.argv[2];
|
|
if (!agentName) {
|
|
console.error("Usage: bun run aws/main.ts <agent>");
|
|
console.error(`Agents: ${Object.keys(agents).join(", ")}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const agent = resolveAgent(agentName);
|
|
|
|
const cloud: CloudOrchestrator = {
|
|
cloudName: "aws",
|
|
cloudLabel: "AWS Lightsail",
|
|
runner: {
|
|
runServer,
|
|
uploadFile,
|
|
downloadFile,
|
|
},
|
|
async authenticate() {
|
|
await promptSpawnName();
|
|
await ensureAwsCli();
|
|
await authenticate();
|
|
await promptRegion();
|
|
await promptBundle(agentName);
|
|
await ensureSshKey();
|
|
},
|
|
async promptSize() {
|
|
// Bundle selection handled during authenticate()
|
|
},
|
|
async createServer(name: string) {
|
|
return await createInstance(name, agent.cloudInitTier);
|
|
},
|
|
getServerName,
|
|
async waitForReady() {
|
|
if (cloud.skipCloudInit) {
|
|
await waitForSshOnly();
|
|
} else {
|
|
await waitForCloudInit();
|
|
}
|
|
},
|
|
interactiveSession,
|
|
getConnectionInfo,
|
|
};
|
|
|
|
await runOrchestration(cloud, agent, agentName);
|
|
}
|
|
|
|
main().catch((err) => {
|
|
process.stderr.write(`\x1b[0;31mFatal: ${getErrorMessage(err)}\x1b[0m\n`);
|
|
process.exit(1);
|
|
});
|