import type { FabricHostedLiveness, FabricHostedReporter, FabricHostedRunContext, FabricHostedRunner } from "./runner-registry.js"; import type { AgentChildQuestionResponse, AgentRunRecord, AgentTransportHandle } from "./types.js"; /** Persisted beside status.json; recovery rebuilds the run from it. */ export declare const HOSTED_STATE_FILE = "hosted.json"; export interface HostedRunState { version: 1; runner: string; locator: unknown; context: FabricHostedRunContext; /** The run holds routed questions with no deadline; recovery keeps it. */ holdQuestions?: true; } export interface HostedRunFiles { statusFile: string; lifecycleFile: string; logFile: string; stateFile: string; } export interface HostedRunHooks { /** * Route a dialog through the parent (UI or decision); absent when childQuestions * is not "route". `onDecision` names the decision that backs a headless question. */ ask?: (question: Record, onDecision: (decisionId: string) => void) => Promise; questionTimeoutMs: number; /** holdQuestions: a question with no timeoutMs of its own waits with no deadline. */ holdQuestions?: boolean; } export declare const readHostedRunState: (filePath: string) => HostedRunState | undefined; /** * One adapter-owned run. Fabric spawns no process: this object writes the same * status, lifecycle and transcript files a worker would, so the manager's * monitor, budgets, dashboard and residency readers need no hosted branch. */ export declare class HostedRun { #private; readonly adapter: FabricHostedRunner; readonly locator: unknown; readonly context: FabricHostedRunContext; readonly files: HostedRunFiles; readonly hooks: HostedRunHooks; readonly handle: AgentTransportHandle; lastLiveness: FabricHostedLiveness; readonly reporter: FabricHostedReporter; private constructor(); /** `prepare`, then persist the locator in the run record before anything is submitted. */ static prepare(adapter: FabricHostedRunner, context: FabricHostedRunContext, files: HostedRunFiles, record: AgentRunRecord, hooks: HostedRunHooks): Promise; /** * Rebuild a run persisted by `prepare`; never calls `start`. No question is * routed through this host yet, so a `blockedOn` left by an earlier host is * dropped; the runner asks again through the new reporter. */ static recover(adapter: FabricHostedRunner, state: HostedRunState, files: HostedRunFiles, record: AgentRunRecord, hooks: HostedRunHooks): HostedRun; get record(): AgentRunRecord; get terminal(): boolean; /** Submit once. A failed submission may still have started remote work. */ start(): Promise; /** Re-attach after a restart; an unreachable or interrupted run is indeterminate. */ attach(): Promise; /** Terminal record for a run whose adapter reports it gone without a result. */ settleLost(): AgentRunRecord; stop(): Promise; /** The owning session is ending: the next stop carries reason "shutdown". */ markShutdown(): void; /** Settle a prepared run that was never submitted; recovery must not attach to it. */ abandon(error: string): void; /** * Keep the remote run alive and stop observing it; recovery re-attaches. The * manager cancels the decisions behind open questions, so the record stops * naming one. Pending and later `question` calls never settle: the runner * sees no answer and asks again through the next host's reporter. */ detach(): void; get detached(): boolean; close(): void; deliver(kind: "steer" | "followUp", text: string, data?: unknown): string; park(action: "sleep" | "wake"): Promise; } //# sourceMappingURL=hosted-run.d.ts.map