/** * Wire types for the hq-pro `/outpost/*` control plane. * * Portable by construction: this module imports nothing. It is safe to load * from a Next.js server action, a route handler, an edge function, or a CLI. * * Outposts are PERSONAL / caller-scoped — hq-pro keys every `/outpost/*` route * on the caller's Cognito sub, so there is no company parameter anywhere in * this surface. `outpostId` selects a specific box; omitting it targets the * caller's primary slot. */ /** Row summary from `GET /outpost/list`. */ export interface OutpostSummary { outpostId: string; state: string; instanceName: string; region: string; agentRuntime: string; platform: string; createdAt: string; [key: string]: unknown; } /** The agent runtime a box is provisioned with. */ export type OutpostAgentRuntime = "claude" | "codex"; /** Body for `POST /outpost/provision`. */ export interface ProvisionOutpostInput { /** * The caller's Cognito refresh token, so the box can authenticate AS the * caller. SENSITIVE — sent over HTTPS and never logged or printed. */ refreshToken: string; /** The caller's public IP for the box's SSH ingress. Server derives it otherwise. */ clientIp?: string; /** Root disk size in GB (EC2 only). */ diskSizeGb?: number; /** Defaults to `claude` server-side when omitted. */ agentRuntime?: OutpostAgentRuntime; } /** * hq-pro's per-person cap envelope on a `409` provision block. Unlike every * other `/outpost/*` failure this body carries NO `message`/`error` field — * only the cap facts — so it has to be decoded structurally or the reason * degrades to a bare `res.statusText` ("Conflict"). */ export interface OutpostCappedPayload { limit: number; outposts: OutpostSummary[]; } /** Result of a synchronous `POST /outpost/exec` — one SSM invocation. */ export interface OutpostExecResult { ok: true; outpostId: string; instanceId: string; commandId: string; /** SSM invocation status (Success | Failed | Cancelled). */ status: string; /** Remote process exit code, or null when SSM reported none. */ exitCode: number | null; stdout: string; stderr: string; /** True when SSM clipped stdout/stderr at its inline output limit. */ truncated: boolean; } /** Presigned input-upload details from `mode: "stage"`. */ export interface OutpostExecStage { ok: true; userId: string; outpostId: string; key: string; putUrl: string; getUrl: string; expiresInSeconds: number; } /** Asynchronous SSM command details from `mode: "submit"`. */ export interface OutpostExecSubmission { ok: true; userId: string; outpostId: string; instanceId: string; commandId: string; outputPrefix: string; /** Shell budget applied server-side (AWS-RunShellScript executionTimeout). */ executionTimeoutSeconds?: number; } /** Poll response from `mode: "result"`; streams arrive only when terminal. */ export interface OutpostExecAsyncResult { ok: true; userId: string; outpostId: string; status: string; done: boolean; exitCode?: number | null; stdout?: string; stderr?: string; truncated?: boolean; } /** SSH connection details vended by `POST /outpost/ssh-access`. */ export interface OutpostSshAccess { outpostId: string; platform: "ec2" | "lightsail"; host: string; port: number; username: string; /** PEM private key for the box. SENSITIVE — never print or log this. */ privateKey: string; } /** Terminal session mode: an interactive shell or a loopback port-forward. */ export type OutpostTerminalMode = "shell" | "port-forward"; /** * An interactive SSM Session Manager session vended by `POST /outpost/terminal` * (and, shape-identically, by hq-pro's `POST /v1/agents/{uid}/terminal`). The * local `session-manager-plugin` exchanges it for the TTY websocket — the * token is the credential, so no AWS credentials exist client-side. */ export interface OutpostTerminalSession { ok: true; outpostId?: string; instanceId?: string; mode: OutpostTerminalMode; sessionId: string; /** SENSITIVE — one-time session credential. Never print, log, or persist. */ tokenValue: string; streamUrl: string; region: string; /** SSM control-plane endpoint — `session-manager-plugin` argv 6. */ endpoint: string; /** Echo of the StartSession request — `session-manager-plugin` argv 5. */ request: { Target: string; DocumentName?: string; Parameters?: Record; }; } /** * `202` from the terminal routes: the box is coming up (EC2 starting, or * running but its SSM agent has not registered yet). Re-POST after * `retryAfterSeconds`; the successful re-POST IS the session mint. */ export interface OutpostTerminalStarting { ok: false; step: "starting"; state: "starting-instance" | "awaiting-ssm"; retryAfterSeconds?: number; } /** * The server-supplied "how to add a card" action on a `402 billing_required`. * Mirrors hq-pro `src/billing/activation-billing.ts` `BillingSetupAction` and * hq-console's `src/lib/billing-setup.ts`. */ export interface BillingSetupAction { payerType: "company" | "person"; path: "/v1/billing/checkout/org" | "/v1/billing/checkout/person"; method: "POST"; body?: { companyUid?: string; }; } /** The `billing` envelope hq-pro attaches to a billing-blocked provision. */ export interface BillingErrorPayload { status: string; setup?: BillingSetupAction; } //# sourceMappingURL=types.d.ts.map