import type { Goal, GoalBudgetSteering, GoalModeState, GoalRuntimeEvent, GoalTokenUsage } from "./state"; export interface GoalRuntimeHost { getState(): GoalModeState | undefined; setState(state: GoalModeState | undefined): void; getCurrentUsage(): GoalTokenUsage; emit(event: GoalRuntimeEvent): void | Promise; persist(mode: "goal" | "goal_paused" | "none", state?: GoalModeState): void; sendHiddenMessage(message: { customType: string; content: string; deliverAs?: "steer" | "followUp" | "nextTurn"; }): Promise; now?(): number; } export interface GoalTurnSnapshot { turnId: string; baselineUsage: GoalTokenUsage; activeGoalId?: string; } export interface GoalWallClockSnapshot { lastAccountedAt: number; activeGoalId?: string; } export interface GoalRuntimeSnapshot { turnSnapshot?: GoalTurnSnapshot; wallClock: GoalWallClockSnapshot; budgetReportedFor?: string; } export type GoalPromptKind = "active" | "continuation" | "budget-limit"; export declare function remainingTokens(goal: Goal | null | undefined): number | null; export declare function escapeXmlText(input: string): string; export declare function renderTrustedObjective(objective: string): string; export declare function goalTokenDelta(current: GoalTokenUsage, baseline: GoalTokenUsage): number; export declare function renderGoalPrompt(kind: GoalPromptKind, goal: Goal): string; export declare function completionBudgetReport(goal: Goal): string | null; export declare class GoalRuntime { #private; constructor(host: GoalRuntimeHost); get snapshot(): GoalRuntimeSnapshot; onTurnStart(turnId: string, baselineUsage: GoalTokenUsage): void; onToolCompleted(toolName: string): Promise; onGoalToolCompleted(): Promise; onAgentEnd(options?: { turnCompleted?: boolean; currentUsage?: GoalTokenUsage; }): Promise; onTaskAborted(options?: { reason?: "interrupted" | "internal"; }): Promise; onThreadResumed(): Promise; onBudgetMutated(newBudget: number | undefined): Promise; flushUsage(steering: GoalBudgetSteering, currentUsage?: GoalTokenUsage): Promise; createGoal(input: { objective: string; tokenBudget?: number; }): Promise; resumeGoal(): Promise; pauseGoal(): Promise; dropGoal(): Promise; completeGoalFromTool(): Promise; buildActivePrompt(): string | undefined; buildContinuationPrompt(): string | undefined; }