/** * fusion-app — server helpers for driving the Builder Fusion app-building * backend (ai-services) from agent-native apps. * * Fusion projects/branches are full running apps: a cloud container runs the * dev server (preview URL) and an in-container coding agent applies edits. * These helpers cover the lifecycle an app template needs: * * - `ensureFusionContainer` — boot/attach the branch container, resolve the * iframe-able dev-server preview URL. * - `sendFusionBranchMessage` — send a prompt to the branch's coding agent * (fire-and-forget by default so callers stay * within hosted action budgets). * - `pushFusionBranch` — push the branch's code to its git remote. * - `reserveFusionHostingSlug` — reserve a `.builder.cloud` hosting slug. * - `deployFusionProject` — trigger a hosted deploy of the project. * - `getFusionDeploys` — list deploys (poll deploy status). * * All calls authenticate the same way as `runBuilderAgent`: the Builder * private key as a bearer token plus the space/public key as the `apiKey` * query param, resolved through the shared credential provider. * * Endpoints match ai-services `packages/service/main.ts`; streaming endpoints * respond with newline-delimited JSON over chunked HTTP. */ export interface FusionBranchRef { projectId: string; branchName: string; } export interface EnsureFusionContainerResult { /** * `ready` — container is up; `url` is the dev-server preview URL. * `provisioning` — still booting when the time budget ran out; callers * should poll again. * `error` — the backend reported a failure. */ status: "ready" | "provisioning" | "error"; url?: string; /** Last human-readable progress/error message seen on the stream. */ message?: string; } export interface SendFusionMessageResult { sent: boolean; /** Final agent text when the call waited for completion. */ response?: string; error?: string; } /** The Builder visual-editor URL for a fusion branch. */ export declare function getFusionBranchEditorUrl(ref: FusionBranchRef): string; /** Public URL for a reserved fusion hosting slug. */ export declare function getFusionHostingUrl(slug: string): string; /** * Ensure the branch container is running and resolve its preview URL. * * Streams provisioning progress from `/projects/ensure-container`; resolves * `ready` + `url` from the terminal chunk. When the container is still booting * after `timeoutMs`, aborts the request and returns `provisioning` so callers * can poll again without blowing their run budget. */ export declare function ensureFusionContainer(args: FusionBranchRef & { timeoutMs?: number; }): Promise; /** * Send a prompt to the fusion branch's in-container coding agent via * `/projects/branch/message`. * * Defaults to `fireAndForget: true`: the backend dispatches the message and * ends the stream without waiting for the agent turn, so this returns in * seconds. Pass `fireAndForget: false` (with a generous `timeoutMs`) to wait * for the turn and capture the agent's final text. */ export declare function sendFusionBranchMessage(args: FusionBranchRef & { prompt: string; fireAndForget?: boolean; timeoutMs?: number; userEmail?: string; }): Promise; /** * Push the fusion branch's code to its git remote. Starts/attaches the * container if needed, then syncs with `canPush`. */ export declare function pushFusionBranch(ref: FusionBranchRef): Promise>; /** Reserve a hosting slug (`.builder.cloud`) for the project. */ export declare function reserveFusionHostingSlug(args: { projectId: string; slug: string; }): Promise<{ slug: string; }>; /** * Trigger a hosted deploy for the project. Requires a reserved hosting slug. * Returns immediately; poll `getFusionDeploys` for progress * (`queued → building → uploading → deploying → live | failed | canceled`). */ export declare function deployFusionProject(args: { projectId: string; checkoutBranch?: string; }): Promise<{ deployId: string; status: string; }>; /** List the project's deploys, optionally filtered to one deploy id. */ export declare function getFusionDeploys(args: { projectId: string; deployId?: string; }): Promise>>; //# sourceMappingURL=fusion-app.d.ts.map