/** * GuiAgent — the standalone GUI agent, built directly on pi-agent-core's gen-1 Agent * (the same runtime pi-coding-agent ships on). This is what replaces the execution * agent in gui-use: one task in, an event stream + structured result out. * * Deliberately thin: the loop belongs to pi-agent-core, the tools come from the * resolved driver toolset, context hygiene from agent/context. This file assembles. */ import { type Model, type Api, type MutableModels } from "@earendil-works/pi-ai"; import { type Profile } from "./session.ts"; export interface GuiAgentEvent { type: "assistant" | "action" | "observation" | "result"; [key: string]: unknown; } export interface GuiRunResult { status: "done" | "max_steps" | "error" | "aborted"; note: string; steps: number; usage: { input: number; output: number; }; } export interface GuiAgentOptions { /** "provider/model-id", e.g. "openrouter/google/gemini-2.5-flash". */ model: string; driver?: string; strategy?: string; /** Strict CDP endpoint. Environment-provided endpoints are recoverable hints. */ cdpUrl?: string; maxSteps?: number; onEvent?: (event: GuiAgentEvent) => void; /** Write a debug trace (trace.jsonl): per-request model context (images redacted to * byte counts) plus every action/observation. This is what eval harnesses read to * debug a run at the context level. */ traceDir?: string; /** Test seam: pre-configured registry (e.g. with a faux provider) instead of dynamic loading. */ models?: MutableModels; /** Embedding seam: a pre-resolved profile to BORROW — the run neither builds * nor closes it (the owner does). Unset ⇒ resolve one and close it after, * byte-identical to the historical behavior. The sim executor uses this to * keep one driver across many operate delegations. */ profile?: Profile; } /** Resolve "provider/model-id" by loading the matching pi-ai provider factory. * Exported for the sim layer (sim/inference.ts), which routes through the same * registry + gateway rules. */ export declare function resolveModel(models: MutableModels, spec: string): Promise>; export declare function runGuiTask(task: string, opts: GuiAgentOptions): Promise;