/** * video-factory — GPU infrastructure control for Pi. * * One package: the agent can provision, deploy, run, monitor, and destroy GPU * workloads on whatever cloud provider you have access to (RunPod, Vast.ai, * Modal, Lambda, Prime), 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/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 { registerGpuTools } from "./tools.js"; import { registerGpuCommands } from "./commands.js"; import { loadProviders, loadDeployments } from "./registry.js"; export default function (pi: ExtensionAPI) { registerGpuTools(pi); registerGpuCommands(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( "video-factory: first run. /gpu onboard shows the H3 production economics (Turbo 4-8 step + SageAttention + INT8, Vast/Salad/RunPod lanes). Ask me to run the gpu-onboarding skill to get your first deployment going.", "info", ); } else if (providers.length === 0 || authed === 0) { ctx.ui.notify("video-factory: no GPU providers configured. Run /gpu setup (or ask me to run gpu_setup).", "info"); } else if (deployments.length) { const ready = deployments.filter((d) => d.status === "ready").length; ctx.ui.notify(`video-factory: ${authed} provider(s) ready, ${ready} deployment(s) live. /gpu for the dashboard.`, "info"); } } catch { // registry not writable (no project) — stay silent } }); }