import { type ReactNode } from "react"; import type { SessionEvent, SessionStatus } from "@opengeni/sdk"; import type { SessionStarter } from "../components/new-session-starters.js"; import type { AppApiHost } from "./app-api.js"; import type { AppSurfaces } from "./app-surfaces.js"; import type { MessageContextPill, MessageContextStore } from "./message-context.js"; import type { NavigationHost } from "./navigation.js"; /** The open chat as its page holds it, for a host that reacts to its progress. */ export type SessionViewState = Readonly<{ sessionId: string; /** The latest status in the chat's event log; null before one is loaded. */ status: SessionStatus | null; /** * The events the page holds, ordered by sequence: its own window of the * chat's history, with a turn's steps while the turn is live. Not the full * history of a long chat. */ events: readonly SessionEvent[]; /** True until the first page of history has loaded. */ initialLoading: boolean; }>; export type AppHost = Readonly<{ navigation: NavigationHost; api: AppApiHost; /** Optional surfaces; an absent one renders its plain fallback or nothing. */ surfaces?: Partial | undefined; /** * Model context the page adds to each new chat and message (where the person * is writing from, such as an open workbook, and what they selected there). * Labeled items show as pills above the composer. Context, never * instructions. */ messageContext?: MessageContextStore | undefined; /** * Suggestions under the new-chat composer in place of Opengeni's own, such * as tasks that fit the app the chat sits in. An empty list shows none. */ starters?: readonly SessionStarter[] | undefined; /** * Receives the open chat's state each time it changes, read from the * page's own event stream (no second connection). */ onSessionState?: ((state: SessionViewState) => void) | undefined; }>; /** * Sets the host of the page that owns the document, before the session UI * renders. Parts merge into what is set (tests set only the parts they use). */ export declare function configurePageAppHost(host: Partial): void; export declare function AppHostProvider(props: { host: AppHost; children?: ReactNode; }): import("react").JSX.Element; /** This app's host: the embed's own, or the page's. */ export declare function useAppHost(): Partial; /** Whether this app is embedded in a page it does not own. */ export declare function useEmbedded(): boolean; /** Tells the host the open chat's state each time it changes. */ export declare function useReportSessionState(state: SessionViewState, enabled?: boolean): void; /** Reads the host's per-message model context at send time, if it supplies one. */ export declare function useHostMessageContext(): (() => string | undefined) | undefined; /** Reads the tools the host's context is for at send time (see MessageContextItem.tools). */ export declare function useHostMessageContextTools(): (() => string[] | undefined) | undefined; /** The host's context pills for the composer, with the controls to leave one out. */ export declare function useMessageContextPills(): { pills: readonly MessageContextPill[]; exclude: (id: string) => void; include: (id: string) => void; };