/** * Copyright Linkurious SAS 2012 - 2026 * * - Created on 2026-06-15. */ import { IDataSourceParams, SortDirection } from '../commonTypes'; export type ChatActionType = 'user' | 'toolQuery' | 'toolResponse' | 'ai' | 'error' | 'interrupted'; export interface BaseChatAction { uuid: string; type: ChatActionType; content: string; createdAt: string; metadata?: Record; } export interface UserPromptAction extends BaseChatAction { type: 'user'; } export interface BaseToolAction extends BaseChatAction { type: 'toolQuery' | 'toolResponse'; tool: string; } export interface ToolQueryAction extends BaseToolAction { type: 'toolQuery'; } export interface ToolResponseAction extends BaseToolAction { type: 'toolResponse'; toolQueryUuid: string; truncated?: boolean; } export interface AiResponseAction extends BaseChatAction { type: 'ai'; } /** * Action representing an error that occurred during the processing of the user prompt. */ export interface ErrorAction extends BaseChatAction { type: 'error'; } /** * Action representing an interruption of the processing of the user prompt. */ export interface InterruptedAction extends BaseChatAction { type: 'interrupted'; } export type ChatAction = UserPromptAction | ToolQueryAction | ToolResponseAction | AiResponseAction | ErrorAction | InterruptedAction; export declare enum ChatThreadStatus { IDLE = "idle", PROCESSING = "processing" } /** * Thread scope, since a thread can belong to an investigation * in a visualization or in a case */ export type ChatThreadScope = VisualizationScope | CaseScope; export interface VisualizationScope { type: 'visualization'; visualizationId: number; } export interface CaseScope { type: 'case'; caseId: number; } export interface CreateChatThreadParams extends IDataSourceParams { sourceKey: string; scope: ChatThreadScope; } export interface UnsavedGraphItems { nodeIds?: string[]; edgeIds?: string[]; } /** * Send a message from the user to the chat thread */ export interface SendMessageParams { sourceKey: string; threadId: number; message: string; unsavedGraphItems?: UnsavedGraphItems; } export interface SendMessageResponse { threadId: number; status: 'processing'; } /** * Get the current state of a chat thread: its status and actions (used for polling) */ export interface GetChatThreadParams { sourceKey: string; threadId: number; lastChatActionUuid?: string; } export interface GetChatThreadResponse { actions: ChatAction[]; status: ChatThreadStatus; } export interface GetChatThreadListParams { sourceKey: string; scope: VisualizationScope | CaseScope; offset?: number; limit?: number; sortBy?: 'createdAt' | 'updatedAt'; sortDirection?: SortDirection; } export interface ChatThread { id: number; title: string | null; status: ChatThreadStatus; createdAt: string; updatedAt: string; } /** * Set the LLM business context for a data source. * An empty `businessContext` removes the existing business context if one already exists. */ export interface SetLlmBusinessContextParams extends IDataSourceParams { businessContext: string; } export declare const TOOL_NAMES_REQUIRING_APPROVAL: readonly ['visualizationEntitiesSelectionTool', 'visualizationCameraTool', 'visualizationNodeGroupingTool', 'visualizationEdgeGroupingTool', 'visualizationAddFiltersTool', 'visualizationRemoveFiltersTool', 'visualizationResetFiltersTool']; export declare const TOOL_NAMES: readonly ["graphViewTool", "graphSchemaViewTool", "searchTool", "runQueryTool", "visualizationEntitiesSelectionTool", "visualizationCameraTool", "visualizationNodeGroupingTool", "visualizationEdgeGroupingTool", "visualizationAddFiltersTool", "visualizationRemoveFiltersTool", "visualizationResetFiltersTool"]; export type ToolName = (typeof TOOL_NAMES)[number]; export type ToolNameRequiringApproval = (typeof TOOL_NAMES_REQUIRING_APPROVAL)[number];