import http from "node:http"; import type { SessionContext } from "../session-types.js"; export declare const LIVE_HEADER = "x-gg-live"; /** Which browser tab the frame is in: each tab chats with its own session. */ export declare const TAB_HEADER = "x-gg-live-tab"; /** One tab's chat: its session and what that session said before the tab connected. */ export interface FrameTab { session: SessionContext; replay: readonly string[]; /** An event stream opened; call the result when it closes. */ watch: () => () => void; } export interface FrameConfig { /** The dev server the agent is told about (not the proxy). */ devUrl: string; /** Origins the page proxy is reachable at; the only parents the frame talks to. */ proxyOrigins: string[]; } export interface FrameServerOptions { assetsDir: string; /** The tab's chat, started on its first request; an error to send when there can't be one. */ tab: (id: string) => Promise; config: () => FrameConfig; usage: (provider: "anthropic" | "moonshot") => Promise; } export interface FrameServer { server: http.Server; listen: (port: number) => Promise; close: () => Promise; origin: () => string; } /** * Whether an API request comes from the frame itself. Exported for tests. * The custom header can't be sent cross-origin without a preflight, and we * answer every preflight without CORS headers, so browsers block it. */ export declare function fromFrame(req: http.IncomingMessage, frameOrigin: string): boolean; export declare function frameCsp(proxyOrigins: readonly string[]): string; export declare function createFrameServer(opts: FrameServerOptions): FrameServer;