/** * lvrged-factory — GPU infrastructure control for Pi. * * One package: the agent can provision, deploy, run, monitor, and destroy GPU * workloads on RunPod (the first-class adapter; more plug in via the adapter * pattern), with video generation as the first-class workload * (H3, Wan 2.2, HunyuanVideo, Seedance). * * Security: this extension executes provider CLIs and can spend real money. * The spend policy (.pi/lvrged-factory/gpu/policy.json) is the trust boundary — provisioning * above the confirm threshold always asks the user. Review before installing. */ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; import { registerFactoryTools } from "./tools.js"; import { registerFactoryCommands } from "./commands.js"; import { loadProviders, loadDeployments } from "./registry.js"; export default function (pi: ExtensionAPI) { registerFactoryTools(pi); registerFactoryCommands(pi); pi.on("session_start", async (_event, ctx) => { try { const providers = loadProviders(); const deployments = loadDeployments(); const authed = providers.filter((p) => p.installed && p.authenticated).length; if (providers.length === 0 && deployments.length === 0) { // brand-new registry — first-run onboarding ctx.ui.notify( "lvrged-factory: first run. /lvrged-factory gpu onboard shows the H3 production economics (Turbo 4-8 step + SageAttention + INT8, RunPod PRO 6000 lane). Ask me to run the lvrged-factory-gpu-onboarding skill to get your first deployment going.", "info", ); } else if (providers.length === 0 || authed === 0) { ctx.ui.notify("lvrged-factory: no GPU providers configured. Run /lvrged-factory setup (or ask me to run lvrged_factory_setup).", "info"); } else if (deployments.length) { const ready = deployments.filter((d) => d.status === "ready").length; ctx.ui.notify(`lvrged-factory: ${authed} provider(s) ready, ${ready} deployment(s) live. /lvrged-factory gpu for the dashboard.`, "info"); } } catch { // registry not writable (no project) — stay silent } }); }