import { type IChatConversationInteractionStep, type IChatConversationItemDetail, type IChatConversationVisualisationContent } from "@gooddata/sdk-backend-spi"; import { type GenAIChatEffort, type GenAIObjectType, type IGenAIObjectReference, type IGenAIUserContext, type IGenAIVisualization, type ObjRef } from "@gooddata/sdk-model"; import { type IChatConversationLocalItem } from "./model.js"; export type Config = IGenAIVisualization["config"] | NonNullable["insight"]["properties"]["controls"]; export type SelectedContext = { /** * Dashboard selected by the user. */ dashboard?: IGenAIContextObject; /** * Visualization or widget selected by the user. */ visualization?: IGenAIContextObject; /** * Whether the selected objects are activated. */ activated?: boolean; }; export type StoredConversation = { /** * A record containing chat conversation items indexed by string keys. * * Each key in the record corresponds to a unique identifier for a chat conversation item. * The value associated with each key is an object implementing the IChatConversationLocalItem interface. * * This structure is used to store and manage local chat conversation data in a key-value format. */ items: Record; /** * Represents an array of strings that specifies the order of elements or items. * Typically used to define a sequence or arrangement. */ order: string[]; /** * If the interface is busy, this specifies the details of the async operation. * Where: * - loading: the thread history is being loaded from the backend (no messages to show yet) * - restoring: cached messages have been restored while the backend fetch is still in-flight * - clearing: the thread is being cleared * - evaluating: the new user message is being evaluated by assistant */ asyncProcess?: "loading" | "restoring" | "clearing" | "evaluating"; /** * An agent switch selected by the user that has not yet been sent to the backend. * It is flushed (switchAgent API + optimistic item) just before the next message is sent. */ pendingAgentSwitch?: { agentId: string; previousAgentId: string | undefined; }; /** * The effort this conversation runs at, seeded from its history when it is opened and * overwritten whenever the user picks a different one. Undefined means nothing is recorded * yet, the conversation runs at the default effort. */ reasoningEffort?: GenAIChatEffort; /** * The "Interaction Intelligence" trace of this conversation's responses, keyed by `responseId`. * Kept out of `items` because a step is not a message. */ interactionTrace?: Record; }; /** * The trace of one response: its steps (timing and spend, from the `interaction_step` events) and * the per-action details of the items that ran within them (from the items' own `detail`, keyed by * `stepId`). Neither half is complete alone — a step has no category, and an item has no timing. * @internal */ export type IChatConversationResponseTrace = { steps: IChatConversationInteractionStep[]; /** Details of the actions that ran within each step, keyed by `stepId`. */ detailsByStepId: Record; /** * Details of items carrying a `detail` but no `stepId`, e.g. the memory applied to the turn * before the first step ran. These produce a category row with no steps to highlight. */ responseDetails: IChatConversationTracedAction[]; /** Backend trace id of this response, for support/debugging. Set from the first step that carries one. */ traceId?: string; }; /** * One traced action within a step: the tool that ran, when it ran, and what it did. * * `toolName` is resolved from the matching `toolCall` item, since a `toolResult` carries only its * `callId`. `detail` is absent for a tool whose category has no card body yet — the action is * still recorded, so its step can be named after the tool rather than falling back to nothing. * @internal */ export type IChatConversationTracedAction = { itemId: string; createdAt: number; toolName?: string; detail?: IChatConversationItemDetail; }; export type StoreContext = { /** * Indicates whether some data has been loaded into the store. */ loaded?: boolean; /** * Ambient user context kept in sync by the host (e.g. the open dashboard and its * live filter state). Unlike the one-shot userContext it persists across messages * and is attached to every message that has no one-shot context. */ ambient?: IGenAIUserContext; /** * Selected objects from ambient context. */ ambientSelected?: SelectedContext; /** * Flag indicating whether the ambient context is currently being loaded. */ ambientLoading?: boolean; /** * Active context */ active?: IGenAIUserContext; }; /** * @internal */ export interface IGenAIContextObject { id: string; ref: ObjRef; title: string; nesting: number; type: GenAIObjectType | "widget"; where: "view.dashboard" | "referencedObjects"; context?: IGenAIObjectReference; insightRef?: ObjRef; /** * Visualization URL of the insight (e.g. `local:bar`). */ visualizationUrl?: string; } /** * Kind of the object lists offered by the context chooser, on top of the ambient ones. * @internal */ export type ContextObjectKind = "dashboard" | "visualization"; /** * An object offered by the context chooser. * @internal */ export interface IGenAIContextListItem { id: string; ref: ObjRef; title: string; /** * Visualization URL of the insight (e.g. `local:bar`). Set for the visualizations only. */ visualizationUrl?: string; } /** * State of a single object list offered by the context chooser. * @internal */ export type ContextObjectListState = { items: IGenAIContextListItem[]; loadedPages: number; hasNextPage: boolean; isLoading: boolean; isExternal: boolean; }; /** * State of the object lists offered by the context chooser. Each kind is paged on its own. * @internal */ export type ContextObjectsState = Record; //# sourceMappingURL=types.d.ts.map