import { type DecisionProvider, type UiOutcome, type UiSnapshot, type UiStep } from "./contracts.js"; import type { UiExecutionPort } from "./contracts.js"; export interface UiPlan { schema: "omnius.ui-plan.v1"; steps: UiStep[]; } /** Model response contract. Runtime identities and authority are deliberately absent. */ export declare const UI_PLAN_RESPONSE_SCHEMA: { $defs: { target: { anyOf: { required: string[]; }[]; type: string; additionalProperties: boolean; properties: Record; required: string[]; }; expect: { type: string; minItems: number; maxItems: number; items: { anyOf: ({ type: string; additionalProperties: boolean; properties: Record; required: string[]; } | { anyOf: { required: string[]; }[]; type: string; additionalProperties: boolean; properties: Record; required: string[]; })[]; }; }; }; type: string; additionalProperties: boolean; properties: Record; required: string[]; }; export type UiPlanRejectionCode = "response_too_large" | "invalid_json" | "envelope_type" | "schema_mismatch" | "unexpected_envelope_field" | "steps_type" | "steps_count" | "step_type" | "runtime_identity" | "invalid_step"; export declare class UiPlanValidationError extends Error { readonly code: UiPlanRejectionCode; readonly stepIndex?: number | undefined; constructor(code: UiPlanRejectionCode, message: string, stepIndex?: number | undefined); } /** Runtime identities and authority are never accepted from the planner. */ export declare function parseUiPlan(input: unknown, id?: string): UiPlan; export declare class StructuredUiPlanner { private readonly options; constructor(options: { /** Existing host-owned, preflighted model client; no implicit endpoint/model loading. */ infer: (prompt: string, signal: AbortSignal) => Promise; allowedOrigins?: readonly string[]; allowedApplications?: readonly string[]; timeoutMs?: number; }); plan(goal: string, state: UiSnapshot, recovery?: string, signal?: AbortSignal): Promise; assertScope(state: UiSnapshot): void; } export declare function runPlannedUiTask(goal: string, controller: UiExecutionPort, planner: StructuredUiPlanner, options: { provider?: DecisionProvider; signal?: AbortSignal; maxReplans?: number; maxActions?: number; decisionTimeoutMs?: number; verifyGoal: (state: UiSnapshot, outcomes: readonly UiOutcome[]) => boolean | Promise; }): Promise<{ status: "complete" | "needs_replan" | "cancelled"; plans: number; outcomes: UiOutcome[]; reason?: string; }>;