/** One piece of per-message context. Context for the model, never instructions. */ export type MessageContextItem = Readonly<{ /** Stable identity, such as "selection"; leaving an item out is remembered per id and label. */ id: string; /** The text the model receives with each message. */ text: string; /** Short pill text, such as "Sheet1 ยท B2:D14". Without one, the item is sent but not shown. */ label?: string | undefined; /** Longer description in the pill's tooltip. */ detail?: string | undefined; /** * Tools this context is for, such as the tool that reaches the open * document it names. A new chat that starts with this context loads them * before its first model request, so the agent can use them right away; * context that arrives later never loads tools. */ tools?: readonly string[] | undefined; }>; /** * What a page supplies: plain text, one item, a list of items, or a function * read when each message is sent (not shown in the composer). */ export type MessageContextInput = string | MessageContextItem | readonly MessageContextItem[] | (() => string | undefined) | undefined; export type MessageContextPill = Readonly<{ id: string; label: string; detail?: string | undefined; /** The person left this out of their messages. */ excluded: boolean; }>; export type MessageContextStore = Readonly<{ set(input: MessageContextInput): void; /** The pills to show, stable between changes (for useSyncExternalStore). */ pills(): readonly MessageContextPill[]; subscribe(listener: () => void): () => void; exclude(id: string): void; include(id: string): void; /** The context text to send with a message now, without excluded items. */ forSend(): string | undefined; /** The tools the context sent now is for (see {@link MessageContextItem.tools}). */ toolsForSend(): string[] | undefined; }>; export declare function createMessageContextStore(initial?: MessageContextInput): MessageContextStore; /** * A new chat's create request with the page's context: the tools that context * is for travel only with the context itself. */ export declare function withOpeningContext(request: T, context: string | undefined, tools: readonly string[] | undefined): T | (T & { modelContext: string; modelContextTools?: string[]; }); /** * Create a new chat with the page's context. A session proxy from before * `modelContextTools` refuses that field before anything is created; the chat * is then created with the context alone, as before. */ export declare function createWithOpeningContext(create: (request: T | (T & { modelContext: string; modelContextTools?: string[]; })) => Promise, request: T, context: string | undefined, tools: readonly string[] | undefined): Promise;