import { type SessionEvent, type SessionGoal } from "@opengeni/sdk"; import { type EmbeddedGoalClientOverride } from "../session-context.js"; import { type SessionEventFeedOptions } from "./internal.js"; /** Event types that change the session goal (set/updated/completed/paused/...). */ export declare function isGoalEvent(event: Pick): boolean; /** * Events that can change the server-authoritative continuation projection. * The projection is derived from durable turn, session, control, and system * update state, so those events refresh the goal without model polling. */ export declare function isGoalRefreshEvent(event: Pick): boolean; export type UseGoalOptions = EmbeddedGoalClientOverride & SessionEventFeedOptions & { /** Optional safety-net polling (ms). Off by default — event refreshes drive updates. */ pollIntervalMs?: number | undefined; }; export type UseGoalResult = { /** The session goal, or null when the session has none. */ goal: SessionGoal | null; /** Convenience flags over `goal.status`. */ isActive: boolean; isPaused: boolean; isCompleted: boolean; loading: boolean; error: Error | null; refresh: () => Promise; /** Pause the goal loop (PATCH status=paused). */ pause: (rationale?: string) => Promise; /** Resume a paused goal: resets counters and re-arms continuations. */ resume: () => Promise; /** Clear the session goal; goal-less sessions remain a successful no-op. */ clearGoal: () => Promise; /** Alias for `clearGoal`. */ deleteGoal: () => Promise; /** True while a pause/resume/clear is in flight. */ updating: boolean; mutationError: Error | null; clearMutationError: () => void; }; /** * The session's goal: state, the autonomy counters (`autoContinuations`, * `noProgressStreak`), and pause/resume control. A goal-less session yields * `goal: null`: read through `findGoal` as a successful null when the client * has it, otherwise from an absorbed 404. Live-updates on goal, turn, session, * control, and system-update events — pass `options.events` from * `useSessionEvents` to reuse its stream. */ export declare function useGoal(sessionId: string | null | undefined, options?: UseGoalOptions): UseGoalResult;