@devicai/ui 0.41.1 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/assistantInfo.js +68 -0
- package/dist/cjs/api/assistantInfo.js.map +1 -0
- package/dist/cjs/api/types.js.map +1 -1
- package/dist/cjs/components/ChatDrawer/ChatDrawer.js +60 -16
- package/dist/cjs/components/ChatDrawer/ChatDrawer.js.map +1 -1
- package/dist/cjs/components/IntegrationsModal/IntegrationsLauncher.js +6 -1
- package/dist/cjs/components/IntegrationsModal/IntegrationsLauncher.js.map +1 -1
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/esm/api/assistantInfo.d.ts +30 -0
- package/dist/esm/api/assistantInfo.js +65 -0
- package/dist/esm/api/assistantInfo.js.map +1 -0
- package/dist/esm/api/types.d.ts +15 -0
- package/dist/esm/api/types.js.map +1 -1
- package/dist/esm/components/ChatDrawer/ChatDrawer.js +61 -17
- package/dist/esm/components/ChatDrawer/ChatDrawer.js.map +1 -1
- package/dist/esm/components/IntegrationsModal/IntegrationsLauncher.d.ts +10 -1
- package/dist/esm/components/IntegrationsModal/IntegrationsLauncher.js +7 -2
- package/dist/esm/components/IntegrationsModal/IntegrationsLauncher.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/api/types.ts"],"sourcesContent":["import type React from 'react';\n\n/**\n * File attachment for messages\n */\nexport interface ChatFile {\n name: string;\n downloadUrl?: string;\n fileType?: 'image' | 'document' | 'audio' | 'video' | 'other';\n}\n\n/**\n * Attachment as it appears on a message.\n *\n * Two shapes reach the UI for the same thing: the optimistic message built\n * locally on send uses `url`/`type`, while the history returned by the API\n * carries the stored `downloadUrl`/`fileType`. Both are accepted here; use\n * `normalizeMessageFile` before reading them.\n */\nexport interface MessageFile {\n name: string;\n url?: string;\n type?: string;\n downloadUrl?: string;\n fileType?: string;\n}\n\n/**\n * Message content structure\n */\nexport interface MessageContent {\n message?: string;\n data?: any;\n files?: MessageFile[];\n}\n\n/** Collapse either attachment shape into a single one the UI can render. */\nexport function normalizeMessageFile(file: MessageFile): {\n name: string;\n url: string;\n type: string;\n} {\n return {\n name: file.name,\n url: file.url || file.downloadUrl || '',\n type: file.type || file.fileType || 'other',\n };\n}\n\n/**\n * Tool call from the model\n */\nexport interface ToolCall {\n id: string;\n type: 'function';\n function: {\n name: string;\n arguments: string;\n };\n}\n\n/**\n * Chat message structure\n */\nexport interface ChatMessage {\n uid: string;\n role: 'user' | 'assistant' | 'developer' | 'system' | 'tool';\n content: MessageContent;\n timestamp: number;\n chatUid?: string;\n tool_calls?: ToolCall[];\n tool_call_id?: string;\n summary?: string;\n /**\n * Where `content.message` came from, when the model did not write it.\n * `'finish_tool'`: the assistant is configured to require a tool call to\n * finish (\"Require Tool Use to Finish\") and the backend lifted the reply from\n * the finish tool's `message` argument, so it can be read without parsing\n * tool calls. Absent on replies the model wrote itself — use it to label the\n * bubble as produced by the tool.\n */\n contentSource?: string;\n /**\n * Id of a speech-to-text transcript (from POST /api/v1/whisper) that seeded\n * this message. Present on user messages dictated by voice; the chat can use\n * it to fetch the source audio (GET /api/v1/whisper/:transcriptId) and offer\n * playback.\n */\n transcriptId?: string;\n /**\n * Original server uid, present when the UI adopted an optimistic uid for\n * this message to keep React keys stable. Server-side references (e.g.\n * memory recall anchors) match against it.\n */\n serverUid?: string;\n}\n\n/**\n * Previous conversation message for initialization\n */\nexport interface PreviousMessage {\n message: string;\n role: 'user' | 'assistant';\n}\n\n/**\n * Model interface tool schema following OpenAI function calling format\n */\nexport interface ModelInterfaceToolSchema {\n type: 'function';\n function: {\n name: string;\n description: string;\n parameters: {\n type: 'object';\n properties: Record<string, any>;\n required?: string[];\n };\n };\n}\n\n/**\n * Props passed to a response widget component.\n * The widget is responsible for collecting the user's response and\n * calling `submit` with the payload to resolve the tool call.\n */\nexport interface ResponseWidgetProps {\n /** The tool call this widget is responding to */\n toolCall: ToolCall;\n /** Parsed arguments from the tool call */\n params: any;\n /** Submit the tool response payload (sent as the tool call result to the model) */\n submit: (response: any) => void;\n /** Cancel the tool call. Sends an error response so the model can continue. */\n cancel?: (reason?: string) => void;\n /** Whether the widget is currently submitting */\n isSubmitting?: boolean;\n}\n\n/**\n * Interactive response widget configuration for a client-side tool.\n *\n * When the model calls a tool configured with a `responseWidget`, the\n * widget is rendered in the chat UI instead of executing a callback.\n * The user interacts with the widget, which calls `submit(response)` to\n * define the tool response sent back to the model.\n *\n * - `render: 'inline'` renders the widget in the message thread at the\n * position of the tool call. The text input remains enabled.\n * - `render: 'input'` replaces the chat input area with the widget\n * while it is pending. The text input is disabled until submission.\n */\nexport interface ResponseWidgetConfig {\n /** Where to render the widget */\n render: 'inline' | 'input';\n /** The widget component */\n component: React.ComponentType<ResponseWidgetProps>;\n}\n\n/**\n * Model interface tool definition for client-side tools.\n *\n * A tool must provide either a `callback` (executed automatically when\n * the model invokes the tool) or a `responseWidget` (renders UI for\n * the user to produce the tool response). Providing both is an error.\n */\nexport interface ModelInterfaceTool {\n toolName: string;\n schema: ModelInterfaceToolSchema;\n /** Executed automatically when the model calls this tool */\n callback?: (params: any) => Promise<any> | any;\n /** Interactive widget that collects the user's tool response */\n responseWidget?: ResponseWidgetConfig;\n}\n\n/**\n * Tool call response to send back to the API\n */\nexport interface ToolCallResponse {\n tool_call_id: string;\n content: any;\n role: 'tool';\n}\n\n/**\n * DTO for sending messages to the assistant\n */\nexport interface ProcessMessageDto {\n message: string;\n chatUid?: string;\n userName?: string;\n files?: ChatFile[];\n /** Tags to associate with this chat (top-level, distinct from `metadata`). */\n tags?: string[];\n metadata?: {\n promptTemplateParams?: Record<string, any>;\n tenantToken?: string;\n [key: string]: any;\n };\n tenantId?: string;\n previousConversation?: PreviousMessage[];\n enabledTools?: string[];\n provider?: string;\n model?: string;\n // Model interface protocol fields\n tools?: ModelInterfaceToolSchema[];\n applicationState?: Record<string, any>;\n skipSummarization?: boolean;\n /**\n * Id of a speech-to-text transcript (from POST /api/v1/whisper) that seeded\n * this message. Sent so the conversation keeps a link to the original audio.\n */\n transcriptId?: string;\n}\n\n/**\n * Response from the /whisper speech-to-text endpoint.\n */\nexport interface WhisperTranscriptionResponse {\n /** Public id of the transcript; send it back as ProcessMessageDto.transcriptId. */\n transcriptId: string;\n /** Transcribed text. */\n text: string;\n /** Language hint used, if any. */\n language?: string;\n /** Download URL of the source audio. */\n audioUrl?: string;\n /** Transcription model used. */\n model?: string;\n}\n\n/**\n * Response from the assistant\n */\nexport interface AssistantResponse {\n messages: ChatMessage[];\n chatUid: string;\n inputTokens?: number;\n outputTokens?: number;\n}\n\n/**\n * Async mode response\n */\nexport interface AsyncResponse {\n chatUid: string;\n message?: string;\n error?: string;\n}\n\n/**\n * Real-time chat history status.\n * `limit_exceeded` means the message was blocked before reaching the LLM\n * because a configured tenant/subtenant usage limit was reached.\n */\nexport type RealtimeStatus =\n | 'processing'\n | 'completed'\n | 'error'\n | 'waiting_for_tool_response'\n | 'handed_off'\n | 'limit_exceeded';\n\n/**\n * Details of a tenant/subtenant usage limit that blocked a message.\n * Returned on the realtime endpoint when status is `limit_exceeded`, and on\n * the HTTP 429 body (`details`) when a synchronous request is blocked.\n */\nexport interface TenantLimitExceeded {\n /** Human-readable message describing the block. */\n message?: string;\n /** The rule that triggered the block (scope, metric, window, limit…). */\n blockingRule?: {\n scope?: 'tenant' | 'subtenant';\n subtenantId?: string;\n metric?: 'tokens' | 'cost';\n windowUnit?: 'hour' | 'day' | 'week' | 'month';\n windowEvery?: number;\n limit?: number;\n };\n /** Current consumption in the blocking window. */\n current?: number;\n /** The limit that was reached. */\n limit?: number;\n /** Epoch ms when the blocking window resets and usage is allowed again. */\n resetsAt?: number;\n}\n\n/** One fact a long-term-memory recall surfaced. */\nexport interface RecalledMemoryFact {\n fact: string;\n relation: string;\n /** Source entity name of the graph edge, when the fact connects two. */\n source: string | null;\n /** Target entity name of the graph edge, when the fact connects two. */\n target: string | null;\n /** ISO date the fact became valid, if known. */\n validAt: string | null;\n}\n\n/** One graph entity a long-term-memory recall surfaced. */\nexport interface RecalledMemoryEntity {\n id: string;\n name: string;\n type: string;\n summary: string | null;\n}\n\n/** One previous-session turn a conversation-start recall carried over. */\nexport interface RecalledMemoryTurn {\n role: string;\n content: string;\n}\n\n/**\n * One structured long-term-memory recall event of a conversation: the facts,\n * entities and previous-session turns a recall surfaced, plus the uid of the\n * message that brought it in (`messageUid`: the initial user message, or the\n * assistant message carrying the memory tool call — resolvable through\n * `toolCallId` while the run is still in flight).\n */\nexport interface RecalledMemoryRecord {\n uid: string;\n messageUid?: string;\n toolCallId?: string;\n source:\n | 'conversation_start'\n | 'search_memory'\n | 'search_memory_nodes'\n | 'explore_memory_graph';\n query?: string;\n facts?: RecalledMemoryFact[];\n entities?: RecalledMemoryEntity[];\n turns?: RecalledMemoryTurn[];\n timestampMs: number;\n}\n\n/**\n * Snapshot of the core-memory block a conversation saw (audit trail): the\n * render revision plus the injected entries as structured items.\n */\nexport interface CoreMemorySnapshot {\n uid: string;\n revision: string;\n items: Array<{\n id: number;\n section: string;\n content: string;\n pinned: boolean;\n source: string;\n }>;\n entries: number;\n omitted: number;\n chars: number;\n timestampMs: number;\n}\n\n/**\n * Real-time chat history response\n */\nexport interface RealtimeChatHistory {\n chatUID: string;\n clientUID: string;\n chatHistory: ChatMessage[];\n status: RealtimeStatus;\n lastUpdatedAt: number;\n pendingToolCalls?: ToolCall[];\n handedOffSubThreadId?: string;\n /** Present only when status is `limit_exceeded`. */\n limitExceeded?: TenantLimitExceeded;\n /**\n * Memory-recall events of the in-flight run — lets the UI show what the\n * assistant is recalling while the response is still processing.\n */\n recalledMemories?: RecalledMemoryRecord[];\n}\n\n/**\n * A single usage rule with its current consumption (from GET\n * /api/v1/tenant-usage/:tenantId[/subtenants/:subtenantId]).\n */\nexport interface TenantUsageRule {\n scope: 'tenant' | 'subtenant';\n subtenantId?: string;\n metric: 'tokens' | 'cost';\n windowUnit: 'hour' | 'day' | 'week' | 'month';\n windowEvery: number;\n /** Configured limit for the window. */\n limit: number;\n /** Current consumption in the active window. */\n current: number;\n /** Utilization percentage (0..100, capped). */\n percent: number;\n /** Epoch ms when the active window resets. */\n resetsAt?: number;\n /** Where the rule comes from ('tier' | 'adhoc'). */\n origin?: string;\n /** Tier the rule belongs to, if any. */\n tierId?: string;\n}\n\n/**\n * Response of GET /api/v1/tenant-usage/:tenantId[/subtenants/:subtenantId]:\n * the effective usage rules with their current consumption + the active tier.\n */\nexport interface TenantUsage {\n tenantId: string;\n subtenantId?: string;\n tierId?: string;\n usage: TenantUsageRule[];\n}\n\n/**\n * A durable per-window usage history row (from GET\n * /api/v1/tenant-usage/:tenantId/history).\n */\nexport interface TenantUsageHistoryRow {\n clientUID: string;\n tenantId: string;\n subtenantId: string;\n scope: 'tenant' | 'subtenant';\n metric: 'tokens' | 'cost';\n windowUnit: 'hour' | 'day' | 'week' | 'month';\n windowEvery: number;\n windowKey: string;\n windowStart: number;\n windowEnd: number;\n /** Counted consumption (enforced). */\n consumption: number;\n /** Exempt consumption that did not count toward the limit, if any. */\n exemptConsumption?: number;\n limit: number;\n percent: number;\n tierId?: string;\n origin?: string;\n capturedAt: number;\n}\n\n/**\n * Options for querying tenant usage history.\n */\nexport interface TenantUsageHistoryQuery {\n subtenantId?: string;\n scope?: 'tenant' | 'subtenant';\n metric?: 'tokens' | 'cost';\n windowUnit?: 'hour' | 'day' | 'week' | 'month';\n /** Epoch ms lower bound (windowEnd >= from). */\n from?: number;\n /** Epoch ms upper bound (windowEnd <= to). */\n to?: number;\n limit?: number;\n skip?: number;\n}\n\n/**\n * Chat history structure\n */\nexport interface ChatHistory {\n chatUID: string;\n clientUID: string;\n userUID: string;\n chatContent: ChatMessage[];\n name?: string;\n assistantSpecializationIdentifier: string;\n creationTimestampMs: number;\n lastEditTimestampMs?: number;\n llm?: string;\n inputTokens?: number;\n outputTokens?: number;\n metadata?: Record<string, any>;\n tenantId?: string;\n handedOff?: boolean;\n handedOffSubThreadId?: string;\n handedOffToolCallId?: string;\n /** Structured long-term-memory recall events of the conversation. */\n recalledMemories?: RecalledMemoryRecord[];\n /** Audit trail of the core-memory blocks the conversation saw. */\n coreMemories?: CoreMemorySnapshot[];\n}\n\n/** One core memory entry (the always-injected tier), as returned by the memory API. */\nexport interface CoreMemoryEntry {\n id: number;\n section: string;\n content: string;\n source: string;\n pinned: boolean;\n supersedes: number | null;\n archivedAt: string | null;\n createdAt?: string;\n updatedAt?: string;\n}\n\n/** Deployment caps of the core memory tier. */\nexport interface CoreMemoryLimits {\n maxChars: number;\n maxEntries: number;\n maxEntryChars: number;\n}\n\n/**\n * Response of GET /api/v1/memory/assistants/:identifier/core — the entries\n * of the bucket the assistant resolves for a tenant/subtenant combination.\n */\nexport interface CoreMemoryList {\n /** False when the assistant does not have the core memory tier enabled. */\n enabled: boolean;\n /** The resolved bucket tuple (tenant/subtenant/owner dimensions). */\n bucket: { tenantId?: string; subtenantId?: string; entityId?: string };\n entries: CoreMemoryEntry[];\n limits?: CoreMemoryLimits;\n}\n\n/**\n * Assistant specialization info\n */\nexport interface AssistantSpecialization {\n identifier: string;\n name: string;\n description: string;\n state: 'active' | 'inactive' | 'coming_soon';\n imgUrl?: string;\n availableToolsGroups?: Array<{\n name: string;\n description?: string;\n uid?: string;\n iconUrl?: string;\n tools?: Array<{\n name: string;\n description: string;\n }>;\n }>;\n model?: string;\n isCustom?: boolean;\n creationTimestampMs?: number;\n}\n\n/**\n * Summary of a conversation for listing\n */\nexport interface ConversationSummary {\n chatUID: string;\n name?: string;\n creationTimestampMs: number;\n lastEditTimestampMs?: number;\n}\n\nexport interface ListConversationsResponse {\n histories: ConversationSummary[];\n total: number;\n offset: number;\n limit: number;\n}\n\n/**\n * API error response\n */\nexport interface ApiError {\n statusCode: number;\n message: string;\n error?: string;\n /** Optional structured details (e.g. usage-limit blocking info on a 429). */\n details?: any;\n}\n\n/**\n * Feedback submission request\n */\nexport interface FeedbackSubmission {\n messageId: string;\n feedback?: boolean;\n feedbackComment?: string;\n feedbackData?: Record<string, any>;\n}\n\n/**\n * Feedback entry response\n */\nexport interface FeedbackEntry {\n _id: string;\n requestId: string;\n chatUID?: string;\n threadId?: string;\n agentId?: string;\n feedback?: boolean;\n feedbackComment?: string;\n feedbackData?: Record<string, any>;\n creationTimestamp: string;\n lastEditTimestamp?: string;\n}\n\n/**\n * Agent thread states\n */\nexport enum AgentThreadState {\n QUEUED = 'queued',\n PROCESSING = 'processing',\n COMPLETED = 'completed',\n FAILED = 'failed',\n TERMINATED = 'terminated',\n PAUSED = 'paused',\n PAUSED_FOR_APPROVAL = 'paused_for_approval',\n APPROVAL_REJECTED = 'approval_rejected',\n WAITING_FOR_RESPONSE = 'waiting_for_response',\n PAUSED_FOR_RESUME = 'paused_for_resume',\n HANDED_OFF = 'handed_off',\n GUARDRAIL_TRIGGER = 'guardrail_trigger',\n}\n\n/**\n * Task within an agent thread\n */\nexport interface AgentTaskDto {\n _id?: string;\n title?: string;\n description?: string;\n completed: boolean;\n}\n\n/**\n * Agent thread DTO\n */\nexport interface AgentThreadDto {\n _id?: string;\n agentId: string;\n state: AgentThreadState;\n threadContent: ChatMessage[];\n tasks?: AgentTaskDto[];\n finishReason?: string;\n pausedReason?: string;\n name?: string;\n creationTimestampMs?: number;\n lastEditTimestampMs?: number;\n pauseUntil?: number;\n isSubthread?: boolean;\n parentThreadId?: string;\n subThreadToolCallId?: string;\n parentAgentId?: string;\n}\n\n/**\n * Agent details\n */\nexport interface AgentDto {\n _id?: string;\n name: string;\n description?: string;\n imgUrl?: string;\n agentId?: string;\n}\n\n/**\n * Hand-off tool response content\n */\nexport interface HandOffToolResponse {\n response: string;\n subthreadId: string;\n}\n\n/**\n * Represents a single tool call within a tool group\n */\nexport interface ToolGroupCall {\n name: string;\n input: any;\n output: any;\n toolCallId: string;\n}\n\n/**\n * Configuration for grouping consecutive tool calls under a single renderer\n */\nexport interface ToolGroupConfig {\n tools: string[];\n renderer: (calls: ToolGroupCall[]) => React.ReactNode;\n}\n\n/**\n * One of the end user's connected accounts for an app.\n *\n * The provider's own identifiers do not travel here beyond `id`, which the\n * client needs in order to name the account it wants disconnected — and which\n * the server re-checks against the caller's tenant on the way back in.\n */\nexport interface IntegrationAccount {\n id: string;\n status: string;\n connectedAt?: string;\n updatedAt?: string;\n /** True when the account exists but can no longer run tools. */\n needsReconnect?: boolean;\n statusReason?: string;\n}\n\n/**\n * An app the assistant offers to its tenants, with the accounts THIS tenant\n * has connected. Never another tenant's.\n */\nexport interface Integration {\n /** App slug, e.g. `gmail`. */\n app: string;\n name: string;\n description?: string;\n logo?: string;\n /** True when at least one account is active. */\n connected: boolean;\n accounts: IntegrationAccount[];\n /** Event types the developer allows this tenant to switch on. */\n availableTriggers?: string[];\n}\n"],"names":[],"mappings":"AAoCA;AACM,SAAU,oBAAoB,CAAC,IAAiB,EAAA;IAKpD,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,WAAW,IAAI,EAAE;QACvC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,IAAI,OAAO;KAC5C;AACH;AAgiBA;;AAEG;IACS;AAAZ,CAAA,UAAY,gBAAgB,EAAA;AAC1B,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,gBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,gBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,gBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,gBAAA,CAAA,qBAAA,CAAA,GAAA,qBAA2C;AAC3C,IAAA,gBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC;AACvC,IAAA,gBAAA,CAAA,sBAAA,CAAA,GAAA,sBAA6C;AAC7C,IAAA,gBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC;AACvC,IAAA,gBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,gBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC;AACzC,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/api/types.ts"],"sourcesContent":["import type React from 'react';\n\n/**\n * File attachment for messages\n */\nexport interface ChatFile {\n name: string;\n downloadUrl?: string;\n fileType?: 'image' | 'document' | 'audio' | 'video' | 'other';\n}\n\n/**\n * Attachment as it appears on a message.\n *\n * Two shapes reach the UI for the same thing: the optimistic message built\n * locally on send uses `url`/`type`, while the history returned by the API\n * carries the stored `downloadUrl`/`fileType`. Both are accepted here; use\n * `normalizeMessageFile` before reading them.\n */\nexport interface MessageFile {\n name: string;\n url?: string;\n type?: string;\n downloadUrl?: string;\n fileType?: string;\n}\n\n/**\n * Message content structure\n */\nexport interface MessageContent {\n message?: string;\n data?: any;\n files?: MessageFile[];\n}\n\n/** Collapse either attachment shape into a single one the UI can render. */\nexport function normalizeMessageFile(file: MessageFile): {\n name: string;\n url: string;\n type: string;\n} {\n return {\n name: file.name,\n url: file.url || file.downloadUrl || '',\n type: file.type || file.fileType || 'other',\n };\n}\n\n/**\n * Tool call from the model\n */\nexport interface ToolCall {\n id: string;\n type: 'function';\n function: {\n name: string;\n arguments: string;\n };\n}\n\n/**\n * Chat message structure\n */\nexport interface ChatMessage {\n uid: string;\n role: 'user' | 'assistant' | 'developer' | 'system' | 'tool';\n content: MessageContent;\n timestamp: number;\n chatUid?: string;\n tool_calls?: ToolCall[];\n tool_call_id?: string;\n summary?: string;\n /**\n * Where `content.message` came from, when the model did not write it.\n * `'finish_tool'`: the assistant is configured to require a tool call to\n * finish (\"Require Tool Use to Finish\") and the backend lifted the reply from\n * the finish tool's `message` argument, so it can be read without parsing\n * tool calls. Absent on replies the model wrote itself — use it to label the\n * bubble as produced by the tool.\n */\n contentSource?: string;\n /**\n * Id of a speech-to-text transcript (from POST /api/v1/whisper) that seeded\n * this message. Present on user messages dictated by voice; the chat can use\n * it to fetch the source audio (GET /api/v1/whisper/:transcriptId) and offer\n * playback.\n */\n transcriptId?: string;\n /**\n * Original server uid, present when the UI adopted an optimistic uid for\n * this message to keep React keys stable. Server-side references (e.g.\n * memory recall anchors) match against it.\n */\n serverUid?: string;\n}\n\n/**\n * Previous conversation message for initialization\n */\nexport interface PreviousMessage {\n message: string;\n role: 'user' | 'assistant';\n}\n\n/**\n * Model interface tool schema following OpenAI function calling format\n */\nexport interface ModelInterfaceToolSchema {\n type: 'function';\n function: {\n name: string;\n description: string;\n parameters: {\n type: 'object';\n properties: Record<string, any>;\n required?: string[];\n };\n };\n}\n\n/**\n * Props passed to a response widget component.\n * The widget is responsible for collecting the user's response and\n * calling `submit` with the payload to resolve the tool call.\n */\nexport interface ResponseWidgetProps {\n /** The tool call this widget is responding to */\n toolCall: ToolCall;\n /** Parsed arguments from the tool call */\n params: any;\n /** Submit the tool response payload (sent as the tool call result to the model) */\n submit: (response: any) => void;\n /** Cancel the tool call. Sends an error response so the model can continue. */\n cancel?: (reason?: string) => void;\n /** Whether the widget is currently submitting */\n isSubmitting?: boolean;\n}\n\n/**\n * Interactive response widget configuration for a client-side tool.\n *\n * When the model calls a tool configured with a `responseWidget`, the\n * widget is rendered in the chat UI instead of executing a callback.\n * The user interacts with the widget, which calls `submit(response)` to\n * define the tool response sent back to the model.\n *\n * - `render: 'inline'` renders the widget in the message thread at the\n * position of the tool call. The text input remains enabled.\n * - `render: 'input'` replaces the chat input area with the widget\n * while it is pending. The text input is disabled until submission.\n */\nexport interface ResponseWidgetConfig {\n /** Where to render the widget */\n render: 'inline' | 'input';\n /** The widget component */\n component: React.ComponentType<ResponseWidgetProps>;\n}\n\n/**\n * Model interface tool definition for client-side tools.\n *\n * A tool must provide either a `callback` (executed automatically when\n * the model invokes the tool) or a `responseWidget` (renders UI for\n * the user to produce the tool response). Providing both is an error.\n */\nexport interface ModelInterfaceTool {\n toolName: string;\n schema: ModelInterfaceToolSchema;\n /** Executed automatically when the model calls this tool */\n callback?: (params: any) => Promise<any> | any;\n /** Interactive widget that collects the user's tool response */\n responseWidget?: ResponseWidgetConfig;\n}\n\n/**\n * Tool call response to send back to the API\n */\nexport interface ToolCallResponse {\n tool_call_id: string;\n content: any;\n role: 'tool';\n}\n\n/**\n * DTO for sending messages to the assistant\n */\nexport interface ProcessMessageDto {\n message: string;\n chatUid?: string;\n userName?: string;\n files?: ChatFile[];\n /** Tags to associate with this chat (top-level, distinct from `metadata`). */\n tags?: string[];\n metadata?: {\n promptTemplateParams?: Record<string, any>;\n tenantToken?: string;\n [key: string]: any;\n };\n tenantId?: string;\n previousConversation?: PreviousMessage[];\n enabledTools?: string[];\n provider?: string;\n model?: string;\n // Model interface protocol fields\n tools?: ModelInterfaceToolSchema[];\n applicationState?: Record<string, any>;\n skipSummarization?: boolean;\n /**\n * Id of a speech-to-text transcript (from POST /api/v1/whisper) that seeded\n * this message. Sent so the conversation keeps a link to the original audio.\n */\n transcriptId?: string;\n}\n\n/**\n * Response from the /whisper speech-to-text endpoint.\n */\nexport interface WhisperTranscriptionResponse {\n /** Public id of the transcript; send it back as ProcessMessageDto.transcriptId. */\n transcriptId: string;\n /** Transcribed text. */\n text: string;\n /** Language hint used, if any. */\n language?: string;\n /** Download URL of the source audio. */\n audioUrl?: string;\n /** Transcription model used. */\n model?: string;\n}\n\n/**\n * Response from the assistant\n */\nexport interface AssistantResponse {\n messages: ChatMessage[];\n chatUid: string;\n inputTokens?: number;\n outputTokens?: number;\n}\n\n/**\n * Async mode response\n */\nexport interface AsyncResponse {\n chatUid: string;\n message?: string;\n error?: string;\n}\n\n/**\n * Real-time chat history status.\n * `limit_exceeded` means the message was blocked before reaching the LLM\n * because a configured tenant/subtenant usage limit was reached.\n */\nexport type RealtimeStatus =\n | 'processing'\n | 'completed'\n | 'error'\n | 'waiting_for_tool_response'\n | 'handed_off'\n | 'limit_exceeded';\n\n/**\n * Details of a tenant/subtenant usage limit that blocked a message.\n * Returned on the realtime endpoint when status is `limit_exceeded`, and on\n * the HTTP 429 body (`details`) when a synchronous request is blocked.\n */\nexport interface TenantLimitExceeded {\n /** Human-readable message describing the block. */\n message?: string;\n /** The rule that triggered the block (scope, metric, window, limit…). */\n blockingRule?: {\n scope?: 'tenant' | 'subtenant';\n subtenantId?: string;\n metric?: 'tokens' | 'cost';\n windowUnit?: 'hour' | 'day' | 'week' | 'month';\n windowEvery?: number;\n limit?: number;\n };\n /** Current consumption in the blocking window. */\n current?: number;\n /** The limit that was reached. */\n limit?: number;\n /** Epoch ms when the blocking window resets and usage is allowed again. */\n resetsAt?: number;\n}\n\n/** One fact a long-term-memory recall surfaced. */\nexport interface RecalledMemoryFact {\n fact: string;\n relation: string;\n /** Source entity name of the graph edge, when the fact connects two. */\n source: string | null;\n /** Target entity name of the graph edge, when the fact connects two. */\n target: string | null;\n /** ISO date the fact became valid, if known. */\n validAt: string | null;\n}\n\n/** One graph entity a long-term-memory recall surfaced. */\nexport interface RecalledMemoryEntity {\n id: string;\n name: string;\n type: string;\n summary: string | null;\n}\n\n/** One previous-session turn a conversation-start recall carried over. */\nexport interface RecalledMemoryTurn {\n role: string;\n content: string;\n}\n\n/**\n * One structured long-term-memory recall event of a conversation: the facts,\n * entities and previous-session turns a recall surfaced, plus the uid of the\n * message that brought it in (`messageUid`: the initial user message, or the\n * assistant message carrying the memory tool call — resolvable through\n * `toolCallId` while the run is still in flight).\n */\nexport interface RecalledMemoryRecord {\n uid: string;\n messageUid?: string;\n toolCallId?: string;\n source:\n | 'conversation_start'\n | 'search_memory'\n | 'search_memory_nodes'\n | 'explore_memory_graph';\n query?: string;\n facts?: RecalledMemoryFact[];\n entities?: RecalledMemoryEntity[];\n turns?: RecalledMemoryTurn[];\n timestampMs: number;\n}\n\n/**\n * Snapshot of the core-memory block a conversation saw (audit trail): the\n * render revision plus the injected entries as structured items.\n */\nexport interface CoreMemorySnapshot {\n uid: string;\n revision: string;\n items: Array<{\n id: number;\n section: string;\n content: string;\n pinned: boolean;\n source: string;\n }>;\n entries: number;\n omitted: number;\n chars: number;\n timestampMs: number;\n}\n\n/**\n * Real-time chat history response\n */\nexport interface RealtimeChatHistory {\n chatUID: string;\n clientUID: string;\n chatHistory: ChatMessage[];\n status: RealtimeStatus;\n lastUpdatedAt: number;\n pendingToolCalls?: ToolCall[];\n handedOffSubThreadId?: string;\n /** Present only when status is `limit_exceeded`. */\n limitExceeded?: TenantLimitExceeded;\n /**\n * Memory-recall events of the in-flight run — lets the UI show what the\n * assistant is recalling while the response is still processing.\n */\n recalledMemories?: RecalledMemoryRecord[];\n}\n\n/**\n * A single usage rule with its current consumption (from GET\n * /api/v1/tenant-usage/:tenantId[/subtenants/:subtenantId]).\n */\nexport interface TenantUsageRule {\n scope: 'tenant' | 'subtenant';\n subtenantId?: string;\n metric: 'tokens' | 'cost';\n windowUnit: 'hour' | 'day' | 'week' | 'month';\n windowEvery: number;\n /** Configured limit for the window. */\n limit: number;\n /** Current consumption in the active window. */\n current: number;\n /** Utilization percentage (0..100, capped). */\n percent: number;\n /** Epoch ms when the active window resets. */\n resetsAt?: number;\n /** Where the rule comes from ('tier' | 'adhoc'). */\n origin?: string;\n /** Tier the rule belongs to, if any. */\n tierId?: string;\n}\n\n/**\n * Response of GET /api/v1/tenant-usage/:tenantId[/subtenants/:subtenantId]:\n * the effective usage rules with their current consumption + the active tier.\n */\nexport interface TenantUsage {\n tenantId: string;\n subtenantId?: string;\n tierId?: string;\n usage: TenantUsageRule[];\n}\n\n/**\n * A durable per-window usage history row (from GET\n * /api/v1/tenant-usage/:tenantId/history).\n */\nexport interface TenantUsageHistoryRow {\n clientUID: string;\n tenantId: string;\n subtenantId: string;\n scope: 'tenant' | 'subtenant';\n metric: 'tokens' | 'cost';\n windowUnit: 'hour' | 'day' | 'week' | 'month';\n windowEvery: number;\n windowKey: string;\n windowStart: number;\n windowEnd: number;\n /** Counted consumption (enforced). */\n consumption: number;\n /** Exempt consumption that did not count toward the limit, if any. */\n exemptConsumption?: number;\n limit: number;\n percent: number;\n tierId?: string;\n origin?: string;\n capturedAt: number;\n}\n\n/**\n * Options for querying tenant usage history.\n */\nexport interface TenantUsageHistoryQuery {\n subtenantId?: string;\n scope?: 'tenant' | 'subtenant';\n metric?: 'tokens' | 'cost';\n windowUnit?: 'hour' | 'day' | 'week' | 'month';\n /** Epoch ms lower bound (windowEnd >= from). */\n from?: number;\n /** Epoch ms upper bound (windowEnd <= to). */\n to?: number;\n limit?: number;\n skip?: number;\n}\n\n/**\n * Chat history structure\n */\nexport interface ChatHistory {\n chatUID: string;\n clientUID: string;\n userUID: string;\n chatContent: ChatMessage[];\n name?: string;\n assistantSpecializationIdentifier: string;\n creationTimestampMs: number;\n lastEditTimestampMs?: number;\n llm?: string;\n inputTokens?: number;\n outputTokens?: number;\n metadata?: Record<string, any>;\n tenantId?: string;\n handedOff?: boolean;\n handedOffSubThreadId?: string;\n handedOffToolCallId?: string;\n /** Structured long-term-memory recall events of the conversation. */\n recalledMemories?: RecalledMemoryRecord[];\n /** Audit trail of the core-memory blocks the conversation saw. */\n coreMemories?: CoreMemorySnapshot[];\n}\n\n/** One core memory entry (the always-injected tier), as returned by the memory API. */\nexport interface CoreMemoryEntry {\n id: number;\n section: string;\n content: string;\n source: string;\n pinned: boolean;\n supersedes: number | null;\n archivedAt: string | null;\n createdAt?: string;\n updatedAt?: string;\n}\n\n/** Deployment caps of the core memory tier. */\nexport interface CoreMemoryLimits {\n maxChars: number;\n maxEntries: number;\n maxEntryChars: number;\n}\n\n/**\n * Response of GET /api/v1/memory/assistants/:identifier/core — the entries\n * of the bucket the assistant resolves for a tenant/subtenant combination.\n */\nexport interface CoreMemoryList {\n /** False when the assistant does not have the core memory tier enabled. */\n enabled: boolean;\n /** The resolved bucket tuple (tenant/subtenant/owner dimensions). */\n bucket: { tenantId?: string; subtenantId?: string; entityId?: string };\n entries: CoreMemoryEntry[];\n limits?: CoreMemoryLimits;\n}\n\n/**\n * Assistant specialization info\n */\nexport interface AssistantSpecialization {\n identifier: string;\n name: string;\n description: string;\n state: 'active' | 'inactive' | 'coming_soon';\n imgUrl?: string;\n availableToolsGroups?: Array<{\n name: string;\n description?: string;\n uid?: string;\n iconUrl?: string;\n tools?: Array<{\n name: string;\n description: string;\n }>;\n }>;\n model?: string;\n isCustom?: boolean;\n creationTimestampMs?: number;\n /**\n * Whether this assistant offers connected apps to its tenants.\n *\n * **Absent means \"cannot tell\", not \"no\"** — an API older than this field\n * says nothing, and treating silence as a no would hide the connected-apps\n * button from anyone whose deployment has not caught up yet.\n */\n tenantIntegrations?: {\n enabled: boolean;\n /**\n * How many apps the catalogue offers. An upper bound — the listing drops\n * any the provider cannot resolve — and enough to size a placeholder.\n */\n count?: number;\n };\n}\n\n/**\n * Summary of a conversation for listing\n */\nexport interface ConversationSummary {\n chatUID: string;\n name?: string;\n creationTimestampMs: number;\n lastEditTimestampMs?: number;\n}\n\nexport interface ListConversationsResponse {\n histories: ConversationSummary[];\n total: number;\n offset: number;\n limit: number;\n}\n\n/**\n * API error response\n */\nexport interface ApiError {\n statusCode: number;\n message: string;\n error?: string;\n /** Optional structured details (e.g. usage-limit blocking info on a 429). */\n details?: any;\n}\n\n/**\n * Feedback submission request\n */\nexport interface FeedbackSubmission {\n messageId: string;\n feedback?: boolean;\n feedbackComment?: string;\n feedbackData?: Record<string, any>;\n}\n\n/**\n * Feedback entry response\n */\nexport interface FeedbackEntry {\n _id: string;\n requestId: string;\n chatUID?: string;\n threadId?: string;\n agentId?: string;\n feedback?: boolean;\n feedbackComment?: string;\n feedbackData?: Record<string, any>;\n creationTimestamp: string;\n lastEditTimestamp?: string;\n}\n\n/**\n * Agent thread states\n */\nexport enum AgentThreadState {\n QUEUED = 'queued',\n PROCESSING = 'processing',\n COMPLETED = 'completed',\n FAILED = 'failed',\n TERMINATED = 'terminated',\n PAUSED = 'paused',\n PAUSED_FOR_APPROVAL = 'paused_for_approval',\n APPROVAL_REJECTED = 'approval_rejected',\n WAITING_FOR_RESPONSE = 'waiting_for_response',\n PAUSED_FOR_RESUME = 'paused_for_resume',\n HANDED_OFF = 'handed_off',\n GUARDRAIL_TRIGGER = 'guardrail_trigger',\n}\n\n/**\n * Task within an agent thread\n */\nexport interface AgentTaskDto {\n _id?: string;\n title?: string;\n description?: string;\n completed: boolean;\n}\n\n/**\n * Agent thread DTO\n */\nexport interface AgentThreadDto {\n _id?: string;\n agentId: string;\n state: AgentThreadState;\n threadContent: ChatMessage[];\n tasks?: AgentTaskDto[];\n finishReason?: string;\n pausedReason?: string;\n name?: string;\n creationTimestampMs?: number;\n lastEditTimestampMs?: number;\n pauseUntil?: number;\n isSubthread?: boolean;\n parentThreadId?: string;\n subThreadToolCallId?: string;\n parentAgentId?: string;\n}\n\n/**\n * Agent details\n */\nexport interface AgentDto {\n _id?: string;\n name: string;\n description?: string;\n imgUrl?: string;\n agentId?: string;\n}\n\n/**\n * Hand-off tool response content\n */\nexport interface HandOffToolResponse {\n response: string;\n subthreadId: string;\n}\n\n/**\n * Represents a single tool call within a tool group\n */\nexport interface ToolGroupCall {\n name: string;\n input: any;\n output: any;\n toolCallId: string;\n}\n\n/**\n * Configuration for grouping consecutive tool calls under a single renderer\n */\nexport interface ToolGroupConfig {\n tools: string[];\n renderer: (calls: ToolGroupCall[]) => React.ReactNode;\n}\n\n/**\n * One of the end user's connected accounts for an app.\n *\n * The provider's own identifiers do not travel here beyond `id`, which the\n * client needs in order to name the account it wants disconnected — and which\n * the server re-checks against the caller's tenant on the way back in.\n */\nexport interface IntegrationAccount {\n id: string;\n status: string;\n connectedAt?: string;\n updatedAt?: string;\n /** True when the account exists but can no longer run tools. */\n needsReconnect?: boolean;\n statusReason?: string;\n}\n\n/**\n * An app the assistant offers to its tenants, with the accounts THIS tenant\n * has connected. Never another tenant's.\n */\nexport interface Integration {\n /** App slug, e.g. `gmail`. */\n app: string;\n name: string;\n description?: string;\n logo?: string;\n /** True when at least one account is active. */\n connected: boolean;\n accounts: IntegrationAccount[];\n /** Event types the developer allows this tenant to switch on. */\n availableTriggers?: string[];\n}\n"],"names":[],"mappings":"AAoCA;AACM,SAAU,oBAAoB,CAAC,IAAiB,EAAA;IAKpD,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,WAAW,IAAI,EAAE;QACvC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,IAAI,OAAO;KAC5C;AACH;AA+iBA;;AAEG;IACS;AAAZ,CAAA,UAAY,gBAAgB,EAAA;AAC1B,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,gBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,gBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,gBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,gBAAA,CAAA,qBAAA,CAAA,GAAA,qBAA2C;AAC3C,IAAA,gBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC;AACvC,IAAA,gBAAA,CAAA,sBAAA,CAAA,GAAA,sBAA6C;AAC7C,IAAA,gBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC;AACvC,IAAA,gBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,gBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC;AACzC,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useMemo, useState, useCallback,
|
|
2
|
+
import { forwardRef, useMemo, useState, useCallback, useImperativeHandle, useEffect, useRef } from 'react';
|
|
3
3
|
import { useDevicChat } from '../../hooks/useDevicChat.js';
|
|
4
4
|
import { useOptionalDevicContext } from '../../provider/DevicContext.js';
|
|
5
5
|
import { DevicApiClient } from '../../api/client.js';
|
|
6
|
+
import { useAssistantInfo } from '../../api/assistantInfo.js';
|
|
6
7
|
import { ChatMessages } from './ChatMessages.js';
|
|
7
8
|
import { ChatInput } from './ChatInput.js';
|
|
8
9
|
import { ConversationSelector } from './ConversationSelector.js';
|
|
@@ -183,10 +184,50 @@ function ChatDrawerInner({ assistantId, chatUid: initialChatUid, options = {}, e
|
|
|
183
184
|
const resolvedTenantSession = context?.getTenantSession;
|
|
184
185
|
const onSessionExpired = context?.onSessionExpired;
|
|
185
186
|
const resolvedBaseUrl = baseUrl || context?.baseUrl || 'https://api.devic.ai';
|
|
186
|
-
const [avatarUrl, setAvatarUrl] = useState(null);
|
|
187
187
|
const [coreMemoryOpen, setCoreMemoryOpen] = useState(false);
|
|
188
188
|
const [integrationsOpen, setIntegrationsOpen] = useState(false);
|
|
189
|
-
const
|
|
189
|
+
const infoClient = useMemo(() => resolvedApiKey || resolvedTenantSession
|
|
190
|
+
? new DevicApiClient({
|
|
191
|
+
apiKey: resolvedApiKey,
|
|
192
|
+
baseUrl: resolvedBaseUrl,
|
|
193
|
+
getTenantSession: resolvedTenantSession,
|
|
194
|
+
onSessionExpired,
|
|
195
|
+
})
|
|
196
|
+
: null, [resolvedApiKey, resolvedTenantSession, resolvedBaseUrl]);
|
|
197
|
+
// Asked for only when something on screen depends on it, and then at most
|
|
198
|
+
// once per assistant however many times this drawer is mounted — a host that
|
|
199
|
+
// remounts it to start a fresh conversation used to pay for the answer again
|
|
200
|
+
// every time.
|
|
201
|
+
const assistantInfo = useAssistantInfo({
|
|
202
|
+
assistantId,
|
|
203
|
+
client: infoClient,
|
|
204
|
+
baseUrl: resolvedBaseUrl,
|
|
205
|
+
credential: resolvedApiKey || 'session',
|
|
206
|
+
enabled: !!mergedOptions.showAvatar ||
|
|
207
|
+
(mergedOptions.showIntegrationsButton !== false && isOpen),
|
|
208
|
+
});
|
|
209
|
+
const avatarUrl = mergedOptions.showAvatar
|
|
210
|
+
? (assistantInfo.assistant?.imgUrl ?? null)
|
|
211
|
+
: null;
|
|
212
|
+
/**
|
|
213
|
+
* Whether to ask which apps this assistant offers.
|
|
214
|
+
*
|
|
215
|
+
* The listing is worth a request only when there is something to list, and
|
|
216
|
+
* most assistants offer nothing — for those, the call existed purely to be
|
|
217
|
+
* refused, once per page load. The assistant now says so itself, so a plain
|
|
218
|
+
* `false` settles it without asking.
|
|
219
|
+
*
|
|
220
|
+
* Anything else asks, exactly as before: a field that is absent means the API
|
|
221
|
+
* is older than it, not that the answer is no, and a failed lookup means we
|
|
222
|
+
* could not find out. Hiding the button on either would lose the feature for
|
|
223
|
+
* a deployment that has it, which is far worse than one spare request.
|
|
224
|
+
*
|
|
225
|
+
* Where there are apps to show, this puts the two requests in sequence rather
|
|
226
|
+
* than at once, so the listing lands later than it used to. The header holds
|
|
227
|
+
* its place in the meantime — see `pendingIntegrations`.
|
|
228
|
+
*/
|
|
229
|
+
const mayOfferIntegrations = assistantInfo.settled &&
|
|
230
|
+
assistantInfo.assistant?.tenantIntegrations?.enabled !== false;
|
|
190
231
|
// The apps this assistant offers its tenants. Loaded once, here, because the
|
|
191
232
|
// header control cannot decide whether to exist without it — and lent to the
|
|
192
233
|
// modal so opening it does not ask for the same listing again. Nothing is
|
|
@@ -197,20 +238,23 @@ function ChatDrawerInner({ assistantId, chatUid: initialChatUid, options = {}, e
|
|
|
197
238
|
subtenantId,
|
|
198
239
|
apiKey: resolvedApiKey,
|
|
199
240
|
baseUrl: resolvedBaseUrl,
|
|
200
|
-
enabled: mergedOptions.showIntegrationsButton !== false &&
|
|
241
|
+
enabled: mergedOptions.showIntegrationsButton !== false &&
|
|
242
|
+
isOpen &&
|
|
243
|
+
mayOfferIntegrations,
|
|
201
244
|
});
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Placeholder chips to hold while the listing is in flight.
|
|
247
|
+
*
|
|
248
|
+
* Only when the assistant has said outright that it offers apps, and how
|
|
249
|
+
* many: on a maybe there would be nothing to hold the place of half the time,
|
|
250
|
+
* and a control that appears and then vanishes is worse than one that arrives
|
|
251
|
+
* late. So this stays at zero for an API that does not say, which is also the
|
|
252
|
+
* behaviour every version until now had.
|
|
253
|
+
*/
|
|
254
|
+
const pendingIntegrations = assistantInfo.assistant?.tenantIntegrations?.enabled === true &&
|
|
255
|
+
!integrationsState.settled
|
|
256
|
+
? (assistantInfo.assistant.tenantIntegrations.count ?? 0)
|
|
257
|
+
: 0;
|
|
214
258
|
// Tenant/subtenant resolution mirrors useDevicChat (prop overrides provider).
|
|
215
259
|
const resolvedTenantId = tenantId || context?.tenantId;
|
|
216
260
|
const resolvedSubtenantId = subtenantId || context?.subtenantId;
|
|
@@ -485,7 +529,7 @@ function ChatDrawerInner({ assistantId, chatUid: initialChatUid, options = {}, e
|
|
|
485
529
|
[mergedOptions.position]: 20,
|
|
486
530
|
bottom: 20,
|
|
487
531
|
}), [mergedOptions.zIndex, mergedOptions.position]);
|
|
488
|
-
return (jsxs(Fragment, { children: [!isInline && (jsx("div", { className: "devic-drawer-overlay", "data-open": isOpen, style: overlayStyle, onClick: handleClose })), jsxs("div", { ref: drawerRef, className: `devic-chat-drawer ${className || ''}`, "data-position": mergedOptions.position, "data-open": isOpen, "data-mode": mode, style: drawerStyle, children: [mergedOptions.resizable && (jsx("div", { className: "devic-resize-handle", "data-position": mergedOptions.position, onMouseDown: handleResizeStart })), jsxs("div", { className: "devic-drawer-header", children: [avatarUrl && (jsx("img", { className: "devic-drawer-avatar", src: avatarUrl, alt: "", "aria-hidden": "true" })), jsx("h2", { className: "devic-drawer-title", children: mergedOptions.title }), jsx(ConversationSelector, { assistantId: assistantId, currentChatUid: chat.chatUid, onSelect: handleConversationSelect, onNewChat: handleNewChat, apiKey: apiKey, baseUrl: baseUrl, tenantId: tenantId, subtenantId: subtenantId, conversationPreview: mergedOptions.conversationPreview }), jsxs("div", { className: "devic-drawer-header-actions", children: [mergedOptions.showIntegrationsButton !== false && (jsx(IntegrationsLauncher, { state: integrationsState, onClick: () => setIntegrationsOpen(true), label: mergedOptions.integrationsLabel, maxLogos: mergedOptions.maxIntegrationLogos, dark: isDarkTheme(modalTheme) })), mergedOptions.showCoreMemoryButton && (jsx("button", { className: "devic-new-chat-btn", onClick: () => setCoreMemoryOpen(true), type: "button", "aria-label": "Assistant memory", title: "Assistant memory", children: jsx(BrainIcon, {}) })), jsx("button", { className: "devic-new-chat-btn", onClick: handleNewChat, type: "button", "aria-label": "New chat", title: "New chat", children: jsx(PlusIcon, {}) }), !isInline && (jsx("button", { className: "devic-drawer-close", onClick: handleClose, type: "button", "aria-label": "Close chat", children: jsx(CloseIcon, {}) }))] })] }), chat.error && (jsx("div", { className: "devic-error", children: chat.error.message })), jsx(ChatMessages, { messages: chat.messages, allMessages: chat.messages, isLoading: chat.isLoading, welcomeMessage: mergedOptions.welcomeMessage, suggestedMessages: mergedOptions.suggestedMessages, onSuggestedClick: handleSuggestedClick, showToolTimeline: mergedOptions.showToolTimeline, toolRenderers: mergedOptions.toolRenderers, toolIcons: mergedOptions.toolIcons, loadingIndicator: mergedOptions.loadingIndicator, showFeedback: mergedOptions.showFeedback, feedbackMap: feedbackMap, onFeedback: handleFeedback, handedOffSubThreadId: chat.handedOffSubThreadId || undefined, onHandoffCompleted: chat.onHandoffCompleted, handoffWidgetRenderer: mergedOptions.handoffWidgetRenderer, toolGroups: mergedOptions.toolGroups, userMessageRenderer: mergedOptions.userMessageRenderer, assistantMessageRenderer: mergedOptions.assistantMessageRenderer, apiKey: resolvedApiKey, baseUrl: resolvedBaseUrl, pendingInlineWidgets: inlineWidgets, onSubmitWidget: chat.submitWidgetResponse, onCancelWidget: chat.cancelWidgetCall, recalledMemories: mergedOptions.showRecalledMemories
|
|
532
|
+
return (jsxs(Fragment, { children: [!isInline && (jsx("div", { className: "devic-drawer-overlay", "data-open": isOpen, style: overlayStyle, onClick: handleClose })), jsxs("div", { ref: drawerRef, className: `devic-chat-drawer ${className || ''}`, "data-position": mergedOptions.position, "data-open": isOpen, "data-mode": mode, style: drawerStyle, children: [mergedOptions.resizable && (jsx("div", { className: "devic-resize-handle", "data-position": mergedOptions.position, onMouseDown: handleResizeStart })), jsxs("div", { className: "devic-drawer-header", children: [avatarUrl && (jsx("img", { className: "devic-drawer-avatar", src: avatarUrl, alt: "", "aria-hidden": "true" })), jsx("h2", { className: "devic-drawer-title", children: mergedOptions.title }), jsx(ConversationSelector, { assistantId: assistantId, currentChatUid: chat.chatUid, onSelect: handleConversationSelect, onNewChat: handleNewChat, apiKey: apiKey, baseUrl: baseUrl, tenantId: tenantId, subtenantId: subtenantId, conversationPreview: mergedOptions.conversationPreview }), jsxs("div", { className: "devic-drawer-header-actions", children: [mergedOptions.showIntegrationsButton !== false && (jsx(IntegrationsLauncher, { state: integrationsState, onClick: () => setIntegrationsOpen(true), label: mergedOptions.integrationsLabel, maxLogos: mergedOptions.maxIntegrationLogos, dark: isDarkTheme(modalTheme), placeholders: pendingIntegrations })), mergedOptions.showCoreMemoryButton && (jsx("button", { className: "devic-new-chat-btn", onClick: () => setCoreMemoryOpen(true), type: "button", "aria-label": "Assistant memory", title: "Assistant memory", children: jsx(BrainIcon, {}) })), jsx("button", { className: "devic-new-chat-btn", onClick: handleNewChat, type: "button", "aria-label": "New chat", title: "New chat", children: jsx(PlusIcon, {}) }), !isInline && (jsx("button", { className: "devic-drawer-close", onClick: handleClose, type: "button", "aria-label": "Close chat", children: jsx(CloseIcon, {}) }))] })] }), chat.error && (jsx("div", { className: "devic-error", children: chat.error.message })), jsx(ChatMessages, { messages: chat.messages, allMessages: chat.messages, isLoading: chat.isLoading, welcomeMessage: mergedOptions.welcomeMessage, suggestedMessages: mergedOptions.suggestedMessages, onSuggestedClick: handleSuggestedClick, showToolTimeline: mergedOptions.showToolTimeline, toolRenderers: mergedOptions.toolRenderers, toolIcons: mergedOptions.toolIcons, loadingIndicator: mergedOptions.loadingIndicator, showFeedback: mergedOptions.showFeedback, feedbackMap: feedbackMap, onFeedback: handleFeedback, handedOffSubThreadId: chat.handedOffSubThreadId || undefined, onHandoffCompleted: chat.onHandoffCompleted, handoffWidgetRenderer: mergedOptions.handoffWidgetRenderer, toolGroups: mergedOptions.toolGroups, userMessageRenderer: mergedOptions.userMessageRenderer, assistantMessageRenderer: mergedOptions.assistantMessageRenderer, apiKey: resolvedApiKey, baseUrl: resolvedBaseUrl, pendingInlineWidgets: inlineWidgets, onSubmitWidget: chat.submitWidgetResponse, onCancelWidget: chat.cancelWidgetCall, recalledMemories: mergedOptions.showRecalledMemories
|
|
489
533
|
? chat.recalledMemories
|
|
490
534
|
: undefined, recalledMemoriesRenderer: mergedOptions.recalledMemoriesRenderer }), mergedOptions.customPromptBox ? (jsxs("div", { className: "devic-input-area", children: [limitBannerNode, usageBarNode, integrationsHintNode, mergedOptions.customPromptBox({
|
|
491
535
|
sendMessage: handleSend,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatDrawer.js","sources":["../../../../src/components/ChatDrawer/ChatDrawer.tsx"],"sourcesContent":["import React, { useState, useEffect, useCallback, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';\nimport { useDevicChat } from '../../hooks/useDevicChat';\nimport { useOptionalDevicContext } from '../../provider';\nimport { DevicApiClient } from '../../api/client';\nimport { ChatMessages } from './ChatMessages';\nimport { ChatInput } from './ChatInput';\nimport { ConversationSelector } from './ConversationSelector';\nimport { ChatDrawerErrorBoundary } from './ErrorBoundary';\nimport { UsageBar } from './UsageBar';\nimport { LimitBanner } from './LimitBanner';\nimport { CoreMemoryModal } from '../CoreMemoryModal';\nimport {\n IntegrationsHint,\n IntegrationsLauncher,\n IntegrationsModal,\n useIntegrations,\n} from '../IntegrationsModal';\nimport { isDarkTheme } from '../theme';\nimport type { DevicTheme } from '../theme';\nimport type { ChatDrawerProps, ChatDrawerOptions, ChatDrawerHandle } from './ChatDrawer.types';\nimport './styles.css';\n\nconst DEFAULT_OPTIONS: Required<ChatDrawerOptions> = {\n position: 'right',\n width: '100%',\n defaultOpen: false,\n color: '#1890ff',\n welcomeMessage: '',\n suggestedMessages: [],\n enableFileUploads: false,\n allowedFileTypes: { images: true, documents: true },\n maxFileSize: 10 * 1024 * 1024,\n enableLongTextPaste: false,\n longTextPasteThreshold: 2000,\n enableSpeechToText: false,\n speechLanguage: undefined as any,\n speechAutoStop: true,\n speechAutoStopCountdownMs: 1000,\n speechAutoStopSilenceMs: 1000,\n speechAutoStopSilenceRatio: 0.1,\n speechAutoStopSilenceLevel: 0.02,\n speechAutoStopSpeechLevel: 0.12,\n speechHandoff: false,\n speechHandoffSendDelayMs: 1000,\n speechHandoffHoldMs: 3000,\n inputPlaceholder: 'Type a message...',\n title: 'Chat',\n showAvatar: false,\n showToolTimeline: true,\n zIndex: 1000,\n borderRadius: 0,\n resizable: false,\n minWidth: 300,\n maxWidth: 800,\n style: {},\n fontFamily: undefined as any,\n backgroundColor: undefined as any,\n textColor: undefined as any,\n secondaryBackgroundColor: undefined as any,\n borderColor: undefined as any,\n userBubbleColor: undefined as any,\n userBubbleTextColor: undefined as any,\n assistantBubbleColor: undefined as any,\n assistantBubbleTextColor: undefined as any,\n sendButtonColor: undefined as any,\n loadingIndicator: undefined as any,\n sendButtonContent: undefined as any,\n toolRenderers: undefined as any,\n toolIcons: undefined as any,\n showFeedback: true,\n handoffWidgetRenderer: undefined as any,\n toolGroups: undefined as any,\n stopButtonContent: undefined as any,\n debug: false,\n persistConversation: false,\n customPromptBox: undefined as any,\n userMessageRenderer: undefined as any,\n assistantMessageRenderer: undefined as any,\n conversationPreview: 'date',\n showUsageBar: false,\n usageBarMetric: undefined as any,\n usageBarDisplay: undefined as any,\n customUsageBar: undefined as any,\n hideLimitBanner: false,\n limitBannerRenderer: undefined as any,\n showRecalledMemories: true,\n recalledMemoriesRenderer: undefined as any,\n showCoreMemoryButton: false,\n showIntegrationsButton: true,\n integrationsLabel: 'Connected apps',\n maxIntegrationLogos: 6,\n showIntegrationsHint: true,\n // Left unset so the strip can say \"Connect your apps\" or \"Explore connected\n // apps\" depending on what the end user has actually done.\n integrationsHintLabel: undefined as any,\n};\n\n/**\n * Chat drawer component for Devic assistants\n *\n * @example\n * ```tsx\n * <ChatDrawer\n * ref={drawerRef}\n * assistantId=\"my-assistant\"\n * options={{\n * position: 'right',\n * width: 400,\n * welcomeMessage: 'Hello! How can I help you?',\n * suggestedMessages: ['Help me with...', 'Tell me about...'],\n * }}\n * modelInterfaceTools={[\n * {\n * toolName: 'get_user_location',\n * schema: { ... },\n * callback: async () => ({ lat: 40.7, lng: -74.0 })\n * }\n * ]}\n * onMessageReceived={(msg) => console.log('Received:', msg)}\n * />\n * ```\n */\nexport const ChatDrawer = forwardRef<ChatDrawerHandle, ChatDrawerProps>(\n function ChatDrawer(props, ref) {\n return (\n <ChatDrawerErrorBoundary>\n <ChatDrawerInner {...props} forwardedRef={ref} />\n </ChatDrawerErrorBoundary>\n );\n }\n);\n\ninterface ChatDrawerInnerProps extends ChatDrawerProps {\n forwardedRef?: React.Ref<ChatDrawerHandle>;\n}\n\nfunction ChatDrawerInner({\n assistantId,\n chatUid: initialChatUid,\n options = {},\n enabledTools,\n modelInterfaceTools,\n tenantId,\n tenantMetadata,\n subtenantId,\n subtenantMetadata,\n tags,\n apiKey,\n baseUrl,\n onMessageSent,\n onMessageReceived,\n onToolCall,\n onError,\n onChatCreated,\n onFileUpload,\n onOpen,\n onClose,\n isOpen: controlledIsOpen,\n className,\n mode = 'drawer',\n onConversationChange,\n forwardedRef,\n}: ChatDrawerInnerProps): JSX.Element {\n // Merge options with defaults\n const mergedOptions = useMemo(\n () => ({ ...DEFAULT_OPTIONS, ...options }),\n [options]\n );\n\n // localStorage key for persisting selected conversation\n const storageKey = mergedOptions.persistConversation\n ? `devic-ui-chatUid-${assistantId}`\n : null;\n\n // Resolve initial chatUid: prop takes priority, then localStorage\n const resolvedInitialChatUid = useMemo(() => {\n if (initialChatUid) return initialChatUid;\n if (storageKey) {\n try { return localStorage.getItem(storageKey) || undefined; } catch { return undefined; }\n }\n return undefined;\n }, [initialChatUid, storageKey]);\n\n // Drawer open state (can be controlled or uncontrolled; inline mode is always open)\n const [internalIsOpen, setInternalIsOpen] = useState(mergedOptions.defaultOpen);\n const isInline = mode === 'inline';\n const isOpen = isInline ? true : (controlledIsOpen ?? internalIsOpen);\n\n // Wrap onChatCreated to persist chatUid in localStorage\n const handleChatCreated = useCallback(\n (chatUid: string) => {\n if (storageKey) {\n try { localStorage.setItem(storageKey, chatUid); } catch {}\n }\n onChatCreated?.(chatUid);\n },\n [storageKey, onChatCreated]\n );\n\n // Use chat hook\n const chat = useDevicChat({\n assistantId,\n chatUid: resolvedInitialChatUid,\n apiKey,\n baseUrl,\n tenantId,\n tenantMetadata,\n subtenantId,\n subtenantMetadata,\n tags,\n enabledTools,\n modelInterfaceTools,\n onMessageSent,\n onMessageReceived,\n onToolCall,\n onError,\n onChatCreated: handleChatCreated,\n onFileUpload,\n debug: mergedOptions.debug,\n });\n\n // Fetch assistant avatar when showAvatar is enabled\n const context = useOptionalDevicContext();\n const resolvedApiKey = apiKey || context?.apiKey;\n // The session source, when the page authenticates with one. Every client\n // built below gets it, or a page without an API key would have nothing to\n // authenticate with.\n const resolvedTenantSession = context?.getTenantSession;\n const onSessionExpired = context?.onSessionExpired;\n const resolvedBaseUrl = baseUrl || context?.baseUrl || 'https://api.devic.ai';\n const [avatarUrl, setAvatarUrl] = useState<string | null>(null);\n const [coreMemoryOpen, setCoreMemoryOpen] = useState(false);\n const [integrationsOpen, setIntegrationsOpen] = useState(false);\n const avatarFetchedRef = useRef<string | null>(null);\n\n // The apps this assistant offers its tenants. Loaded once, here, because the\n // header control cannot decide whether to exist without it — and lent to the\n // modal so opening it does not ask for the same listing again. Nothing is\n // fetched until the drawer is opened for the first time.\n const integrationsState = useIntegrations({\n assistantId,\n tenantId,\n subtenantId,\n apiKey: resolvedApiKey,\n baseUrl: resolvedBaseUrl,\n enabled: mergedOptions.showIntegrationsButton !== false && isOpen,\n });\n\n useEffect(() => {\n if (!mergedOptions.showAvatar || avatarFetchedRef.current === assistantId) return;\n if (!resolvedApiKey && !resolvedTenantSession) return;\n avatarFetchedRef.current = assistantId;\n const client = new DevicApiClient({ apiKey: resolvedApiKey, baseUrl: resolvedBaseUrl, getTenantSession: resolvedTenantSession, onSessionExpired });\n client.getAssistant(assistantId).then((a) => {\n if (a.imgUrl) setAvatarUrl(a.imgUrl);\n }).catch(() => {});\n }, [mergedOptions.showAvatar, assistantId, resolvedApiKey, resolvedTenantSession, resolvedBaseUrl]);\n\n // Tenant/subtenant resolution mirrors useDevicChat (prop overrides provider).\n const resolvedTenantId = tenantId || context?.tenantId;\n const resolvedSubtenantId = subtenantId || context?.subtenantId;\n\n // Usage bar (above the input) — only when enabled and a tenant is known.\n // Refetches after each turn via the message count as refresh key.\n const usageBarNode =\n (mergedOptions.showUsageBar ||\n typeof mergedOptions.customUsageBar === 'function') &&\n resolvedTenantId ? (\n <UsageBar\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n tenantId={resolvedTenantId}\n subtenantId={resolvedSubtenantId}\n mode={mergedOptions.showUsageBar === 'onDemand' ? 'onDemand' : 'always'}\n metric={mergedOptions.usageBarMetric}\n display={mergedOptions.usageBarDisplay}\n customUsageBar={mergedOptions.customUsageBar}\n color={mergedOptions.color}\n refreshKey={chat.messages.length}\n debug={mergedOptions.debug}\n />\n ) : null;\n\n // Default usage-limit banner (above the input) — opt-out via hideLimitBanner,\n // override via limitBannerRenderer.\n const limitBannerNode =\n chat.limitExceeded && !mergedOptions.hideLimitBanner\n ? mergedOptions.limitBannerRenderer\n ? mergedOptions.limitBannerRenderer(chat.limitExceeded)\n : <LimitBanner limit={chat.limitExceeded} />\n : null;\n\n // Speech-to-text transcription, exposed to custom prompt boxes so a developer\n // can transcribe audio (binary or URL) and attach the resulting transcriptId.\n const transcribeAudio = useCallback(\n (\n audio: Blob | string,\n transcribeOptions?: {\n language?: string;\n messageUid?: string;\n chatUid?: string;\n tenantId?: string;\n },\n ) => {\n if (!resolvedApiKey && !resolvedTenantSession) {\n return Promise.reject(\n new Error('No credentials configured. Cannot transcribe audio.'),\n );\n }\n const client = new DevicApiClient({ apiKey: resolvedApiKey, baseUrl: resolvedBaseUrl, getTenantSession: resolvedTenantSession, onSessionExpired });\n return client.transcribeAudio(audio, {\n language: transcribeOptions?.language ?? mergedOptions.speechLanguage,\n messageUid: transcribeOptions?.messageUid,\n chatUid: transcribeOptions?.chatUid,\n tenantId: transcribeOptions?.tenantId ?? tenantId,\n });\n },\n [resolvedApiKey, resolvedTenantSession, resolvedBaseUrl, mergedOptions.speechLanguage, tenantId],\n );\n\n // Handle open/close\n const handleOpen = useCallback(() => {\n setInternalIsOpen(true);\n onOpen?.();\n }, [onOpen]);\n\n const handleClose = useCallback(() => {\n setInternalIsOpen(false);\n onClose?.();\n }, [onClose]);\n\n const handleToggle = useCallback(() => {\n setInternalIsOpen((prev) => !prev);\n }, []);\n\n // Expose handle for programmatic control\n useImperativeHandle(forwardedRef, () => ({\n open: handleOpen,\n close: handleClose,\n toggle: handleToggle,\n setChatUid: (chatUid: string) => {\n chat.loadChat(chatUid);\n },\n sendMessage: (message: string) => {\n chat.sendMessage(message);\n },\n }), [handleOpen, handleClose, handleToggle, chat]);\n\n // Register this drawer in the DevicProvider so AIElementWrapper can open it\n useEffect(() => {\n if (!context?.registerDrawer) return;\n const unregister = context.registerDrawer({\n open: handleOpen,\n close: handleClose,\n toggle: handleToggle,\n sendMessage: (message: string) => chat.sendMessage(message),\n });\n return unregister;\n }, [context, handleOpen, handleClose, handleToggle, chat]);\n\n // Partition pending widget calls by render mode\n const { inlineWidgets, inputWidget } = useMemo(() => {\n const inline: typeof chat.pendingWidgetCalls = [];\n let input: typeof chat.pendingWidgetCalls[number] | null = null;\n for (const wc of chat.pendingWidgetCalls) {\n if (wc.widget.render === 'input' && !input) {\n input = wc;\n } else {\n inline.push(wc);\n }\n }\n return { inlineWidgets: inline, inputWidget: input };\n }, [chat.pendingWidgetCalls]);\n\n // Active references from DevicProvider (created by AIElementWrapper)\n const references = context?.references ?? [];\n const removeReference = useCallback(\n (id: string) => {\n context?.removeReference(id);\n },\n [context]\n );\n const clearReferences = useCallback(() => {\n context?.clearReferences();\n }, [context]);\n\n // Handle send message — prefix references and clear them after sending\n const handleSend = useCallback(\n (\n message: string,\n files?: File[],\n meta?: { transcriptId?: string; tags?: string[] }\n ) => {\n let finalMessage = message;\n if (references.length > 0) {\n const labels = references.map((r) => `\"${r.label}\"`).join(', ');\n finalMessage = `Elemento referenciado: ${labels}\\n\\n${message}`;\n }\n chat.sendMessage(finalMessage, {\n files,\n transcriptId: meta?.transcriptId,\n tags: meta?.tags,\n });\n if (references.length > 0) clearReferences();\n },\n [chat, references, clearReferences]\n );\n\n // Handle conversation selection\n const handleConversationSelect = useCallback(\n (chatUid: string) => {\n chat.loadChat(chatUid);\n onConversationChange?.(chatUid);\n if (storageKey) {\n try { localStorage.setItem(storageKey, chatUid); } catch {}\n }\n },\n [chat, onConversationChange, storageKey]\n );\n\n const handleNewChat = useCallback(() => {\n chat.clearChat();\n if (storageKey) {\n try { localStorage.removeItem(storageKey); } catch {}\n }\n }, [chat, storageKey]);\n\n // Handle suggested message click\n const handleSuggestedClick = useCallback(\n (message: string) => {\n chat.sendMessage(message);\n },\n [chat]\n );\n\n // Feedback state\n const [feedbackMap, setFeedbackMap] = useState<Map<string, 'positive' | 'negative'>>(new Map());\n const feedbackClientRef = useRef<DevicApiClient | null>(null);\n\n // Initialize feedback client\n useEffect(() => {\n if ((resolvedApiKey || resolvedTenantSession) && !feedbackClientRef.current) {\n feedbackClientRef.current = new DevicApiClient({\n apiKey: resolvedApiKey,\n baseUrl: resolvedBaseUrl,\n getTenantSession: resolvedTenantSession,\n onSessionExpired,\n });\n }\n }, [resolvedApiKey, resolvedTenantSession, resolvedBaseUrl]);\n\n // Load existing feedback when chat changes\n useEffect(() => {\n if (!chat.chatUid || !feedbackClientRef.current || !mergedOptions.showFeedback) return;\n\n feedbackClientRef.current.getChatFeedback(assistantId, chat.chatUid)\n .then((entries) => {\n const newMap = new Map<string, 'positive' | 'negative'>();\n for (const entry of entries) {\n if (entry.feedback !== undefined) {\n newMap.set(entry.requestId, entry.feedback ? 'positive' : 'negative');\n }\n }\n setFeedbackMap(newMap);\n })\n .catch(() => {\n // Silently ignore feedback loading errors\n });\n }, [chat.chatUid, assistantId, mergedOptions.showFeedback]);\n\n // Handle feedback submission\n const handleFeedback = useCallback(\n async (messageId: string, positive: boolean, comment?: string) => {\n if (!chat.chatUid || !feedbackClientRef.current) return;\n\n try {\n await feedbackClientRef.current.submitChatFeedback(assistantId, chat.chatUid, {\n messageId,\n feedback: positive,\n feedbackComment: comment,\n });\n\n setFeedbackMap((prev) => {\n const newMap = new Map(prev);\n newMap.set(messageId, positive ? 'positive' : 'negative');\n return newMap;\n });\n } catch (err) {\n console.error('Failed to submit feedback:', err);\n throw err;\n }\n },\n [chat.chatUid, assistantId]\n );\n\n // Apply CSS variables for theming on the drawer element itself\n // (must target the component root so they override the defaults defined on .devic-chat-drawer)\n const drawerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const el = drawerRef.current;\n if (!el) return;\n const vars: [string, string | undefined][] = [\n ['--devic-primary', mergedOptions.color !== DEFAULT_OPTIONS.color ? mergedOptions.color : undefined],\n ['--devic-font-family', mergedOptions.fontFamily],\n ['--devic-bg', mergedOptions.backgroundColor],\n ['--devic-text', mergedOptions.textColor],\n ['--devic-bg-secondary', mergedOptions.secondaryBackgroundColor],\n ['--devic-border', mergedOptions.borderColor],\n ['--devic-user-bubble', mergedOptions.userBubbleColor],\n ['--devic-user-bubble-text', mergedOptions.userBubbleTextColor],\n ['--devic-assistant-bubble', mergedOptions.assistantBubbleColor],\n ['--devic-assistant-bubble-text', mergedOptions.assistantBubbleTextColor],\n ['--devic-send-btn', mergedOptions.sendButtonColor],\n ];\n for (const [name, value] of vars) {\n if (value) {\n el.style.setProperty(name, value);\n } else {\n el.style.removeProperty(name);\n }\n }\n }, [mergedOptions.color, mergedOptions.fontFamily, mergedOptions.backgroundColor, mergedOptions.textColor, mergedOptions.secondaryBackgroundColor, mergedOptions.borderColor, mergedOptions.userBubbleColor, mergedOptions.userBubbleTextColor, mergedOptions.assistantBubbleColor, mergedOptions.assistantBubbleTextColor, mergedOptions.sendButtonColor]);\n\n // The same values, handed to the dialogs this drawer opens. They render\n // through a portal into document.body, so the variables set above — which\n // live on the drawer element — never reach them.\n const modalTheme: DevicTheme = useMemo(\n () => ({\n color:\n mergedOptions.color !== DEFAULT_OPTIONS.color\n ? mergedOptions.color\n : undefined,\n fontFamily: mergedOptions.fontFamily,\n backgroundColor: mergedOptions.backgroundColor,\n textColor: mergedOptions.textColor,\n secondaryBackgroundColor: mergedOptions.secondaryBackgroundColor,\n borderColor: mergedOptions.borderColor,\n }),\n [\n mergedOptions.color,\n mergedOptions.fontFamily,\n mergedOptions.backgroundColor,\n mergedOptions.textColor,\n mergedOptions.secondaryBackgroundColor,\n mergedOptions.borderColor,\n ]\n );\n\n // The strip above the composer. Dismissed per end user, because the whole\n // point of remembering a dismissal is that the same person is not told twice.\n const integrationsHintNode =\n mergedOptions.showIntegrationsButton !== false &&\n mergedOptions.showIntegrationsHint !== false ? (\n <IntegrationsHint\n state={integrationsState}\n onOpen={() => setIntegrationsOpen(true)}\n label={mergedOptions.integrationsHintLabel}\n maxLogos={mergedOptions.maxIntegrationLogos}\n storageKey={`${assistantId}:${resolvedTenantId ?? ''}:${resolvedSubtenantId ?? ''}`}\n dark={isDarkTheme(modalTheme)}\n />\n ) : null;\n\n // Resizable drawer\n const [resizedWidth, setResizedWidth] = useState<number | null>(null);\n\n const handleResizeStart = useCallback(\n (e: React.MouseEvent) => {\n e.preventDefault();\n const startX = e.clientX;\n const startWidth = drawerRef.current?.offsetWidth ?? 0;\n const isLeft = mergedOptions.position === 'left';\n\n const onMove = (ev: MouseEvent) => {\n const delta = ev.clientX - startX;\n const newWidth = startWidth + (isLeft ? delta : -delta);\n const clamped = Math.min(\n mergedOptions.maxWidth,\n Math.max(mergedOptions.minWidth, newWidth)\n );\n setResizedWidth(clamped);\n };\n\n const onUp = () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n };\n\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n },\n [mergedOptions.position, mergedOptions.minWidth, mergedOptions.maxWidth]\n );\n\n // Build style object\n const baseWidth = resizedWidth\n ? `${resizedWidth}px`\n : typeof mergedOptions.width === 'number'\n ? `${mergedOptions.width}px`\n : mergedOptions.width;\n\n const drawerStyle = useMemo(\n () => ({\n width: baseWidth,\n zIndex: mergedOptions.zIndex,\n borderRadius: typeof mergedOptions.borderRadius === 'number'\n ? `${mergedOptions.borderRadius}px`\n : mergedOptions.borderRadius,\n ...mergedOptions.style,\n }),\n [baseWidth, mergedOptions.zIndex, mergedOptions.borderRadius, mergedOptions.style]\n );\n\n const overlayStyle = useMemo(\n () => ({\n zIndex: mergedOptions.zIndex - 1,\n }),\n [mergedOptions.zIndex]\n );\n\n const triggerStyle = useMemo(\n () => ({\n zIndex: mergedOptions.zIndex - 1,\n [mergedOptions.position]: 20,\n bottom: 20,\n }),\n [mergedOptions.zIndex, mergedOptions.position]\n );\n\n return (\n <>\n {/* Overlay (drawer mode only) */}\n {!isInline && (\n <div\n className=\"devic-drawer-overlay\"\n data-open={isOpen}\n style={overlayStyle}\n onClick={handleClose}\n />\n )}\n\n {/* Drawer */}\n <div\n ref={drawerRef}\n className={`devic-chat-drawer ${className || ''}`}\n data-position={mergedOptions.position}\n data-open={isOpen}\n data-mode={mode}\n style={drawerStyle}\n >\n {/* Resize handle */}\n {mergedOptions.resizable && (\n <div\n className=\"devic-resize-handle\"\n data-position={mergedOptions.position}\n onMouseDown={handleResizeStart}\n />\n )}\n\n {/* Header */}\n <div className=\"devic-drawer-header\">\n {avatarUrl && (\n <img\n className=\"devic-drawer-avatar\"\n src={avatarUrl}\n alt=\"\"\n aria-hidden=\"true\"\n />\n )}\n <h2 className=\"devic-drawer-title\">{mergedOptions.title}</h2>\n <ConversationSelector\n assistantId={assistantId}\n currentChatUid={chat.chatUid}\n onSelect={handleConversationSelect}\n onNewChat={handleNewChat}\n apiKey={apiKey}\n baseUrl={baseUrl}\n tenantId={tenantId}\n subtenantId={subtenantId}\n conversationPreview={mergedOptions.conversationPreview}\n />\n <div className=\"devic-drawer-header-actions\">\n {mergedOptions.showIntegrationsButton !== false && (\n <IntegrationsLauncher\n state={integrationsState}\n onClick={() => setIntegrationsOpen(true)}\n label={mergedOptions.integrationsLabel}\n maxLogos={mergedOptions.maxIntegrationLogos}\n dark={isDarkTheme(modalTheme)}\n />\n )}\n {mergedOptions.showCoreMemoryButton && (\n <button\n className=\"devic-new-chat-btn\"\n onClick={() => setCoreMemoryOpen(true)}\n type=\"button\"\n aria-label=\"Assistant memory\"\n title=\"Assistant memory\"\n >\n <BrainIcon />\n </button>\n )}\n <button\n className=\"devic-new-chat-btn\"\n onClick={handleNewChat}\n type=\"button\"\n aria-label=\"New chat\"\n title=\"New chat\"\n >\n <PlusIcon />\n </button>\n {!isInline && (\n <button\n className=\"devic-drawer-close\"\n onClick={handleClose}\n type=\"button\"\n aria-label=\"Close chat\"\n >\n <CloseIcon />\n </button>\n )}\n </div>\n </div>\n\n {/* Error display */}\n {chat.error && (\n <div className=\"devic-error\">\n {chat.error.message}\n </div>\n )}\n\n {/* Messages */}\n <ChatMessages\n messages={chat.messages}\n allMessages={chat.messages}\n isLoading={chat.isLoading}\n welcomeMessage={mergedOptions.welcomeMessage}\n suggestedMessages={mergedOptions.suggestedMessages}\n onSuggestedClick={handleSuggestedClick}\n showToolTimeline={mergedOptions.showToolTimeline}\n toolRenderers={mergedOptions.toolRenderers}\n toolIcons={mergedOptions.toolIcons}\n loadingIndicator={mergedOptions.loadingIndicator}\n showFeedback={mergedOptions.showFeedback}\n feedbackMap={feedbackMap}\n onFeedback={handleFeedback}\n handedOffSubThreadId={chat.handedOffSubThreadId || undefined}\n onHandoffCompleted={chat.onHandoffCompleted}\n handoffWidgetRenderer={mergedOptions.handoffWidgetRenderer}\n toolGroups={mergedOptions.toolGroups}\n userMessageRenderer={mergedOptions.userMessageRenderer}\n assistantMessageRenderer={mergedOptions.assistantMessageRenderer}\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n pendingInlineWidgets={inlineWidgets}\n onSubmitWidget={chat.submitWidgetResponse}\n onCancelWidget={chat.cancelWidgetCall}\n recalledMemories={\n mergedOptions.showRecalledMemories\n ? chat.recalledMemories\n : undefined\n }\n recalledMemoriesRenderer={mergedOptions.recalledMemoriesRenderer}\n />\n\n {/* Input */}\n {mergedOptions.customPromptBox ? (\n <div className=\"devic-input-area\">\n {limitBannerNode}\n {usageBarNode}\n {integrationsHintNode}\n {mergedOptions.customPromptBox({\n sendMessage: handleSend,\n transcribeAudio,\n stop: chat.stopChat,\n isLoading: chat.isLoading,\n newConversation: chat.clearChat,\n references,\n removeReference,\n clearReferences,\n limitExceeded: chat.limitExceeded,\n })}\n </div>\n ) : (\n <ChatInput\n onSend={handleSend}\n disabled={\n chat.isLoading ||\n chat.handedOff ||\n inlineWidgets.length > 0 ||\n !!chat.limitExceeded\n }\n placeholder={mergedOptions.inputPlaceholder}\n enableFileUploads={mergedOptions.enableFileUploads}\n allowedFileTypes={mergedOptions.allowedFileTypes}\n maxFileSize={mergedOptions.maxFileSize}\n enableLongTextPaste={mergedOptions.enableLongTextPaste}\n longTextPasteThreshold={mergedOptions.longTextPasteThreshold}\n enableSpeechToText={mergedOptions.enableSpeechToText}\n speechLanguage={mergedOptions.speechLanguage}\n speechTenantId={tenantId}\n speechAutoStop={mergedOptions.speechAutoStop}\n speechAutoStopCountdownMs={mergedOptions.speechAutoStopCountdownMs}\n speechAutoStopSilenceMs={mergedOptions.speechAutoStopSilenceMs}\n speechAutoStopSilenceRatio={mergedOptions.speechAutoStopSilenceRatio}\n speechAutoStopSilenceLevel={mergedOptions.speechAutoStopSilenceLevel}\n speechAutoStopSpeechLevel={mergedOptions.speechAutoStopSpeechLevel}\n speechHandoff={mergedOptions.speechHandoff}\n speechHandoffSendDelayMs={mergedOptions.speechHandoffSendDelayMs}\n speechHandoffHoldMs={mergedOptions.speechHandoffHoldMs}\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n sendButtonContent={mergedOptions.sendButtonContent}\n disabledMessage={\n chat.handedOff\n ? 'Waiting for subagent to complete'\n : inlineWidgets.length > 0\n ? 'Waiting for tool response'\n : undefined\n }\n isProcessing={chat.isLoading && !chat.handedOff}\n onStop={chat.stopChat}\n stopButtonContent={mergedOptions.stopButtonContent}\n pendingInputWidget={inputWidget}\n onSubmitWidget={chat.submitWidgetResponse}\n onCancelWidget={chat.cancelWidgetCall}\n references={references}\n onRemoveReference={removeReference}\n usageBar={usageBarNode}\n limitBanner={limitBannerNode}\n integrationsHint={integrationsHintNode}\n />\n )}\n </div>\n\n {/* Trigger button (drawer mode only, when closed) */}\n {!isInline && !isOpen && (\n <button\n className=\"devic-trigger\"\n onClick={handleOpen}\n style={triggerStyle}\n type=\"button\"\n aria-label=\"Open chat\"\n >\n <ChatIcon />\n </button>\n )}\n\n {/* Core memory modal (opened from the header brain button) */}\n {mergedOptions.showCoreMemoryButton && (\n <CoreMemoryModal\n isOpen={coreMemoryOpen}\n onClose={() => setCoreMemoryOpen(false)}\n assistantId={assistantId}\n tenantId={tenantId}\n subtenantId={subtenantId}\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n theme={modalTheme}\n />\n )}\n\n {/* Connected apps modal (opened from the header app stack) */}\n {mergedOptions.showIntegrationsButton !== false && (\n <IntegrationsModal\n isOpen={integrationsOpen}\n onClose={() => setIntegrationsOpen(false)}\n assistantId={assistantId}\n tenantId={tenantId}\n subtenantId={subtenantId}\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n title={mergedOptions.integrationsLabel}\n theme={modalTheme}\n state={integrationsState}\n />\n )}\n </>\n );\n}\n\n/**\n * Brain icon for the core memory button\n */\nfunction BrainIcon(): JSX.Element {\n return (\n <svg\n width=\"17\"\n height=\"17\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M9.5 2a2.5 2.5 0 0 0-2.45 2A3.5 3.5 0 0 0 4.6 8.6 3.5 3.5 0 0 0 3 11.5c0 1.1.5 2.08 1.29 2.73A3.5 3.5 0 0 0 7 20a3 3 0 0 0 5-2.24V4.5A2.5 2.5 0 0 0 9.5 2Z\" />\n <path d=\"M14.5 2a2.5 2.5 0 0 1 2.45 2 3.5 3.5 0 0 1 2.45 4.6A3.5 3.5 0 0 1 21 11.5a3.49 3.49 0 0 1-1.29 2.73A3.5 3.5 0 0 1 17 20a3 3 0 0 1-5-2.24V4.5A2.5 2.5 0 0 1 14.5 2Z\" />\n </svg>\n );\n}\n\nfunction CloseIcon(): JSX.Element {\n return (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n );\n}\n\n/**\n * Plus icon for new chat button\n */\nfunction PlusIcon(): JSX.Element {\n return (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" />\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" />\n </svg>\n );\n}\n\n/**\n * Chat icon for trigger button\n */\nfunction ChatIcon(): JSX.Element {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n >\n <path d=\"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z\" />\n </svg>\n );\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAM,eAAe,GAAgC;AACnD,IAAA,QAAQ,EAAE,OAAO;AACjB,IAAA,KAAK,EAAE,MAAM;AACb,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,iBAAiB,EAAE,EAAE;AACrB,IAAA,iBAAiB,EAAE,KAAK;IACxB,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;AACnD,IAAA,WAAW,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;AAC7B,IAAA,mBAAmB,EAAE,KAAK;AAC1B,IAAA,sBAAsB,EAAE,IAAI;AAC5B,IAAA,kBAAkB,EAAE,KAAK;AACzB,IAAA,cAAc,EAAE,SAAgB;AAChC,IAAA,cAAc,EAAE,IAAI;AACp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,IAAA,QACEC,IAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EAAA,QAAA,EAAA,CAEtBD,GAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAA,CAAG,EACvCA,GAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAA,CAAG,CAAA,EAAA,CACnC;AAEV;AAEA;;AAEG;AACH,SAAS,QAAQ,GAAA;IACf,QACEA,GAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,cAAc,EAAA,QAAA,EAEnBA,GAAA,CAAA,MAAA,EAAA,EAAM,CAAC,EAAC,yFAAyF,EAAA,CAAG,EAAA,CAChG;AAEV;;;;"}
|
|
1
|
+
{"version":3,"file":"ChatDrawer.js","sources":["../../../../src/components/ChatDrawer/ChatDrawer.tsx"],"sourcesContent":["import React, { useState, useEffect, useCallback, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';\nimport { useDevicChat } from '../../hooks/useDevicChat';\nimport { useOptionalDevicContext } from '../../provider';\nimport { DevicApiClient } from '../../api/client';\nimport { useAssistantInfo } from '../../api/assistantInfo';\nimport { ChatMessages } from './ChatMessages';\nimport { ChatInput } from './ChatInput';\nimport { ConversationSelector } from './ConversationSelector';\nimport { ChatDrawerErrorBoundary } from './ErrorBoundary';\nimport { UsageBar } from './UsageBar';\nimport { LimitBanner } from './LimitBanner';\nimport { CoreMemoryModal } from '../CoreMemoryModal';\nimport {\n IntegrationsHint,\n IntegrationsLauncher,\n IntegrationsModal,\n useIntegrations,\n} from '../IntegrationsModal';\nimport { isDarkTheme } from '../theme';\nimport type { DevicTheme } from '../theme';\nimport type { ChatDrawerProps, ChatDrawerOptions, ChatDrawerHandle } from './ChatDrawer.types';\nimport './styles.css';\n\nconst DEFAULT_OPTIONS: Required<ChatDrawerOptions> = {\n position: 'right',\n width: '100%',\n defaultOpen: false,\n color: '#1890ff',\n welcomeMessage: '',\n suggestedMessages: [],\n enableFileUploads: false,\n allowedFileTypes: { images: true, documents: true },\n maxFileSize: 10 * 1024 * 1024,\n enableLongTextPaste: false,\n longTextPasteThreshold: 2000,\n enableSpeechToText: false,\n speechLanguage: undefined as any,\n speechAutoStop: true,\n speechAutoStopCountdownMs: 1000,\n speechAutoStopSilenceMs: 1000,\n speechAutoStopSilenceRatio: 0.1,\n speechAutoStopSilenceLevel: 0.02,\n speechAutoStopSpeechLevel: 0.12,\n speechHandoff: false,\n speechHandoffSendDelayMs: 1000,\n speechHandoffHoldMs: 3000,\n inputPlaceholder: 'Type a message...',\n title: 'Chat',\n showAvatar: false,\n showToolTimeline: true,\n zIndex: 1000,\n borderRadius: 0,\n resizable: false,\n minWidth: 300,\n maxWidth: 800,\n style: {},\n fontFamily: undefined as any,\n backgroundColor: undefined as any,\n textColor: undefined as any,\n secondaryBackgroundColor: undefined as any,\n borderColor: undefined as any,\n userBubbleColor: undefined as any,\n userBubbleTextColor: undefined as any,\n assistantBubbleColor: undefined as any,\n assistantBubbleTextColor: undefined as any,\n sendButtonColor: undefined as any,\n loadingIndicator: undefined as any,\n sendButtonContent: undefined as any,\n toolRenderers: undefined as any,\n toolIcons: undefined as any,\n showFeedback: true,\n handoffWidgetRenderer: undefined as any,\n toolGroups: undefined as any,\n stopButtonContent: undefined as any,\n debug: false,\n persistConversation: false,\n customPromptBox: undefined as any,\n userMessageRenderer: undefined as any,\n assistantMessageRenderer: undefined as any,\n conversationPreview: 'date',\n showUsageBar: false,\n usageBarMetric: undefined as any,\n usageBarDisplay: undefined as any,\n customUsageBar: undefined as any,\n hideLimitBanner: false,\n limitBannerRenderer: undefined as any,\n showRecalledMemories: true,\n recalledMemoriesRenderer: undefined as any,\n showCoreMemoryButton: false,\n showIntegrationsButton: true,\n integrationsLabel: 'Connected apps',\n maxIntegrationLogos: 6,\n showIntegrationsHint: true,\n // Left unset so the strip can say \"Connect your apps\" or \"Explore connected\n // apps\" depending on what the end user has actually done.\n integrationsHintLabel: undefined as any,\n};\n\n/**\n * Chat drawer component for Devic assistants\n *\n * @example\n * ```tsx\n * <ChatDrawer\n * ref={drawerRef}\n * assistantId=\"my-assistant\"\n * options={{\n * position: 'right',\n * width: 400,\n * welcomeMessage: 'Hello! How can I help you?',\n * suggestedMessages: ['Help me with...', 'Tell me about...'],\n * }}\n * modelInterfaceTools={[\n * {\n * toolName: 'get_user_location',\n * schema: { ... },\n * callback: async () => ({ lat: 40.7, lng: -74.0 })\n * }\n * ]}\n * onMessageReceived={(msg) => console.log('Received:', msg)}\n * />\n * ```\n */\nexport const ChatDrawer = forwardRef<ChatDrawerHandle, ChatDrawerProps>(\n function ChatDrawer(props, ref) {\n return (\n <ChatDrawerErrorBoundary>\n <ChatDrawerInner {...props} forwardedRef={ref} />\n </ChatDrawerErrorBoundary>\n );\n }\n);\n\ninterface ChatDrawerInnerProps extends ChatDrawerProps {\n forwardedRef?: React.Ref<ChatDrawerHandle>;\n}\n\nfunction ChatDrawerInner({\n assistantId,\n chatUid: initialChatUid,\n options = {},\n enabledTools,\n modelInterfaceTools,\n tenantId,\n tenantMetadata,\n subtenantId,\n subtenantMetadata,\n tags,\n apiKey,\n baseUrl,\n onMessageSent,\n onMessageReceived,\n onToolCall,\n onError,\n onChatCreated,\n onFileUpload,\n onOpen,\n onClose,\n isOpen: controlledIsOpen,\n className,\n mode = 'drawer',\n onConversationChange,\n forwardedRef,\n}: ChatDrawerInnerProps): JSX.Element {\n // Merge options with defaults\n const mergedOptions = useMemo(\n () => ({ ...DEFAULT_OPTIONS, ...options }),\n [options]\n );\n\n // localStorage key for persisting selected conversation\n const storageKey = mergedOptions.persistConversation\n ? `devic-ui-chatUid-${assistantId}`\n : null;\n\n // Resolve initial chatUid: prop takes priority, then localStorage\n const resolvedInitialChatUid = useMemo(() => {\n if (initialChatUid) return initialChatUid;\n if (storageKey) {\n try { return localStorage.getItem(storageKey) || undefined; } catch { return undefined; }\n }\n return undefined;\n }, [initialChatUid, storageKey]);\n\n // Drawer open state (can be controlled or uncontrolled; inline mode is always open)\n const [internalIsOpen, setInternalIsOpen] = useState(mergedOptions.defaultOpen);\n const isInline = mode === 'inline';\n const isOpen = isInline ? true : (controlledIsOpen ?? internalIsOpen);\n\n // Wrap onChatCreated to persist chatUid in localStorage\n const handleChatCreated = useCallback(\n (chatUid: string) => {\n if (storageKey) {\n try { localStorage.setItem(storageKey, chatUid); } catch {}\n }\n onChatCreated?.(chatUid);\n },\n [storageKey, onChatCreated]\n );\n\n // Use chat hook\n const chat = useDevicChat({\n assistantId,\n chatUid: resolvedInitialChatUid,\n apiKey,\n baseUrl,\n tenantId,\n tenantMetadata,\n subtenantId,\n subtenantMetadata,\n tags,\n enabledTools,\n modelInterfaceTools,\n onMessageSent,\n onMessageReceived,\n onToolCall,\n onError,\n onChatCreated: handleChatCreated,\n onFileUpload,\n debug: mergedOptions.debug,\n });\n\n // Fetch assistant avatar when showAvatar is enabled\n const context = useOptionalDevicContext();\n const resolvedApiKey = apiKey || context?.apiKey;\n // The session source, when the page authenticates with one. Every client\n // built below gets it, or a page without an API key would have nothing to\n // authenticate with.\n const resolvedTenantSession = context?.getTenantSession;\n const onSessionExpired = context?.onSessionExpired;\n const resolvedBaseUrl = baseUrl || context?.baseUrl || 'https://api.devic.ai';\n const [coreMemoryOpen, setCoreMemoryOpen] = useState(false);\n const [integrationsOpen, setIntegrationsOpen] = useState(false);\n\n const infoClient = useMemo(\n () =>\n resolvedApiKey || resolvedTenantSession\n ? new DevicApiClient({\n apiKey: resolvedApiKey,\n baseUrl: resolvedBaseUrl,\n getTenantSession: resolvedTenantSession,\n onSessionExpired,\n })\n : null,\n [resolvedApiKey, resolvedTenantSession, resolvedBaseUrl]\n );\n\n // Asked for only when something on screen depends on it, and then at most\n // once per assistant however many times this drawer is mounted — a host that\n // remounts it to start a fresh conversation used to pay for the answer again\n // every time.\n const assistantInfo = useAssistantInfo({\n assistantId,\n client: infoClient,\n baseUrl: resolvedBaseUrl,\n credential: resolvedApiKey || 'session',\n enabled:\n !!mergedOptions.showAvatar ||\n (mergedOptions.showIntegrationsButton !== false && isOpen),\n });\n const avatarUrl = mergedOptions.showAvatar\n ? (assistantInfo.assistant?.imgUrl ?? null)\n : null;\n\n /**\n * Whether to ask which apps this assistant offers.\n *\n * The listing is worth a request only when there is something to list, and\n * most assistants offer nothing — for those, the call existed purely to be\n * refused, once per page load. The assistant now says so itself, so a plain\n * `false` settles it without asking.\n *\n * Anything else asks, exactly as before: a field that is absent means the API\n * is older than it, not that the answer is no, and a failed lookup means we\n * could not find out. Hiding the button on either would lose the feature for\n * a deployment that has it, which is far worse than one spare request.\n *\n * Where there are apps to show, this puts the two requests in sequence rather\n * than at once, so the listing lands later than it used to. The header holds\n * its place in the meantime — see `pendingIntegrations`.\n */\n const mayOfferIntegrations =\n assistantInfo.settled &&\n assistantInfo.assistant?.tenantIntegrations?.enabled !== false;\n\n // The apps this assistant offers its tenants. Loaded once, here, because the\n // header control cannot decide whether to exist without it — and lent to the\n // modal so opening it does not ask for the same listing again. Nothing is\n // fetched until the drawer is opened for the first time.\n const integrationsState = useIntegrations({\n assistantId,\n tenantId,\n subtenantId,\n apiKey: resolvedApiKey,\n baseUrl: resolvedBaseUrl,\n enabled:\n mergedOptions.showIntegrationsButton !== false &&\n isOpen &&\n mayOfferIntegrations,\n });\n\n /**\n * Placeholder chips to hold while the listing is in flight.\n *\n * Only when the assistant has said outright that it offers apps, and how\n * many: on a maybe there would be nothing to hold the place of half the time,\n * and a control that appears and then vanishes is worse than one that arrives\n * late. So this stays at zero for an API that does not say, which is also the\n * behaviour every version until now had.\n */\n const pendingIntegrations =\n assistantInfo.assistant?.tenantIntegrations?.enabled === true &&\n !integrationsState.settled\n ? (assistantInfo.assistant.tenantIntegrations.count ?? 0)\n : 0;\n\n // Tenant/subtenant resolution mirrors useDevicChat (prop overrides provider).\n const resolvedTenantId = tenantId || context?.tenantId;\n const resolvedSubtenantId = subtenantId || context?.subtenantId;\n\n // Usage bar (above the input) — only when enabled and a tenant is known.\n // Refetches after each turn via the message count as refresh key.\n const usageBarNode =\n (mergedOptions.showUsageBar ||\n typeof mergedOptions.customUsageBar === 'function') &&\n resolvedTenantId ? (\n <UsageBar\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n tenantId={resolvedTenantId}\n subtenantId={resolvedSubtenantId}\n mode={mergedOptions.showUsageBar === 'onDemand' ? 'onDemand' : 'always'}\n metric={mergedOptions.usageBarMetric}\n display={mergedOptions.usageBarDisplay}\n customUsageBar={mergedOptions.customUsageBar}\n color={mergedOptions.color}\n refreshKey={chat.messages.length}\n debug={mergedOptions.debug}\n />\n ) : null;\n\n // Default usage-limit banner (above the input) — opt-out via hideLimitBanner,\n // override via limitBannerRenderer.\n const limitBannerNode =\n chat.limitExceeded && !mergedOptions.hideLimitBanner\n ? mergedOptions.limitBannerRenderer\n ? mergedOptions.limitBannerRenderer(chat.limitExceeded)\n : <LimitBanner limit={chat.limitExceeded} />\n : null;\n\n // Speech-to-text transcription, exposed to custom prompt boxes so a developer\n // can transcribe audio (binary or URL) and attach the resulting transcriptId.\n const transcribeAudio = useCallback(\n (\n audio: Blob | string,\n transcribeOptions?: {\n language?: string;\n messageUid?: string;\n chatUid?: string;\n tenantId?: string;\n },\n ) => {\n if (!resolvedApiKey && !resolvedTenantSession) {\n return Promise.reject(\n new Error('No credentials configured. Cannot transcribe audio.'),\n );\n }\n const client = new DevicApiClient({ apiKey: resolvedApiKey, baseUrl: resolvedBaseUrl, getTenantSession: resolvedTenantSession, onSessionExpired });\n return client.transcribeAudio(audio, {\n language: transcribeOptions?.language ?? mergedOptions.speechLanguage,\n messageUid: transcribeOptions?.messageUid,\n chatUid: transcribeOptions?.chatUid,\n tenantId: transcribeOptions?.tenantId ?? tenantId,\n });\n },\n [resolvedApiKey, resolvedTenantSession, resolvedBaseUrl, mergedOptions.speechLanguage, tenantId],\n );\n\n // Handle open/close\n const handleOpen = useCallback(() => {\n setInternalIsOpen(true);\n onOpen?.();\n }, [onOpen]);\n\n const handleClose = useCallback(() => {\n setInternalIsOpen(false);\n onClose?.();\n }, [onClose]);\n\n const handleToggle = useCallback(() => {\n setInternalIsOpen((prev) => !prev);\n }, []);\n\n // Expose handle for programmatic control\n useImperativeHandle(forwardedRef, () => ({\n open: handleOpen,\n close: handleClose,\n toggle: handleToggle,\n setChatUid: (chatUid: string) => {\n chat.loadChat(chatUid);\n },\n sendMessage: (message: string) => {\n chat.sendMessage(message);\n },\n }), [handleOpen, handleClose, handleToggle, chat]);\n\n // Register this drawer in the DevicProvider so AIElementWrapper can open it\n useEffect(() => {\n if (!context?.registerDrawer) return;\n const unregister = context.registerDrawer({\n open: handleOpen,\n close: handleClose,\n toggle: handleToggle,\n sendMessage: (message: string) => chat.sendMessage(message),\n });\n return unregister;\n }, [context, handleOpen, handleClose, handleToggle, chat]);\n\n // Partition pending widget calls by render mode\n const { inlineWidgets, inputWidget } = useMemo(() => {\n const inline: typeof chat.pendingWidgetCalls = [];\n let input: typeof chat.pendingWidgetCalls[number] | null = null;\n for (const wc of chat.pendingWidgetCalls) {\n if (wc.widget.render === 'input' && !input) {\n input = wc;\n } else {\n inline.push(wc);\n }\n }\n return { inlineWidgets: inline, inputWidget: input };\n }, [chat.pendingWidgetCalls]);\n\n // Active references from DevicProvider (created by AIElementWrapper)\n const references = context?.references ?? [];\n const removeReference = useCallback(\n (id: string) => {\n context?.removeReference(id);\n },\n [context]\n );\n const clearReferences = useCallback(() => {\n context?.clearReferences();\n }, [context]);\n\n // Handle send message — prefix references and clear them after sending\n const handleSend = useCallback(\n (\n message: string,\n files?: File[],\n meta?: { transcriptId?: string; tags?: string[] }\n ) => {\n let finalMessage = message;\n if (references.length > 0) {\n const labels = references.map((r) => `\"${r.label}\"`).join(', ');\n finalMessage = `Elemento referenciado: ${labels}\\n\\n${message}`;\n }\n chat.sendMessage(finalMessage, {\n files,\n transcriptId: meta?.transcriptId,\n tags: meta?.tags,\n });\n if (references.length > 0) clearReferences();\n },\n [chat, references, clearReferences]\n );\n\n // Handle conversation selection\n const handleConversationSelect = useCallback(\n (chatUid: string) => {\n chat.loadChat(chatUid);\n onConversationChange?.(chatUid);\n if (storageKey) {\n try { localStorage.setItem(storageKey, chatUid); } catch {}\n }\n },\n [chat, onConversationChange, storageKey]\n );\n\n const handleNewChat = useCallback(() => {\n chat.clearChat();\n if (storageKey) {\n try { localStorage.removeItem(storageKey); } catch {}\n }\n }, [chat, storageKey]);\n\n // Handle suggested message click\n const handleSuggestedClick = useCallback(\n (message: string) => {\n chat.sendMessage(message);\n },\n [chat]\n );\n\n // Feedback state\n const [feedbackMap, setFeedbackMap] = useState<Map<string, 'positive' | 'negative'>>(new Map());\n const feedbackClientRef = useRef<DevicApiClient | null>(null);\n\n // Initialize feedback client\n useEffect(() => {\n if ((resolvedApiKey || resolvedTenantSession) && !feedbackClientRef.current) {\n feedbackClientRef.current = new DevicApiClient({\n apiKey: resolvedApiKey,\n baseUrl: resolvedBaseUrl,\n getTenantSession: resolvedTenantSession,\n onSessionExpired,\n });\n }\n }, [resolvedApiKey, resolvedTenantSession, resolvedBaseUrl]);\n\n // Load existing feedback when chat changes\n useEffect(() => {\n if (!chat.chatUid || !feedbackClientRef.current || !mergedOptions.showFeedback) return;\n\n feedbackClientRef.current.getChatFeedback(assistantId, chat.chatUid)\n .then((entries) => {\n const newMap = new Map<string, 'positive' | 'negative'>();\n for (const entry of entries) {\n if (entry.feedback !== undefined) {\n newMap.set(entry.requestId, entry.feedback ? 'positive' : 'negative');\n }\n }\n setFeedbackMap(newMap);\n })\n .catch(() => {\n // Silently ignore feedback loading errors\n });\n }, [chat.chatUid, assistantId, mergedOptions.showFeedback]);\n\n // Handle feedback submission\n const handleFeedback = useCallback(\n async (messageId: string, positive: boolean, comment?: string) => {\n if (!chat.chatUid || !feedbackClientRef.current) return;\n\n try {\n await feedbackClientRef.current.submitChatFeedback(assistantId, chat.chatUid, {\n messageId,\n feedback: positive,\n feedbackComment: comment,\n });\n\n setFeedbackMap((prev) => {\n const newMap = new Map(prev);\n newMap.set(messageId, positive ? 'positive' : 'negative');\n return newMap;\n });\n } catch (err) {\n console.error('Failed to submit feedback:', err);\n throw err;\n }\n },\n [chat.chatUid, assistantId]\n );\n\n // Apply CSS variables for theming on the drawer element itself\n // (must target the component root so they override the defaults defined on .devic-chat-drawer)\n const drawerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const el = drawerRef.current;\n if (!el) return;\n const vars: [string, string | undefined][] = [\n ['--devic-primary', mergedOptions.color !== DEFAULT_OPTIONS.color ? mergedOptions.color : undefined],\n ['--devic-font-family', mergedOptions.fontFamily],\n ['--devic-bg', mergedOptions.backgroundColor],\n ['--devic-text', mergedOptions.textColor],\n ['--devic-bg-secondary', mergedOptions.secondaryBackgroundColor],\n ['--devic-border', mergedOptions.borderColor],\n ['--devic-user-bubble', mergedOptions.userBubbleColor],\n ['--devic-user-bubble-text', mergedOptions.userBubbleTextColor],\n ['--devic-assistant-bubble', mergedOptions.assistantBubbleColor],\n ['--devic-assistant-bubble-text', mergedOptions.assistantBubbleTextColor],\n ['--devic-send-btn', mergedOptions.sendButtonColor],\n ];\n for (const [name, value] of vars) {\n if (value) {\n el.style.setProperty(name, value);\n } else {\n el.style.removeProperty(name);\n }\n }\n }, [mergedOptions.color, mergedOptions.fontFamily, mergedOptions.backgroundColor, mergedOptions.textColor, mergedOptions.secondaryBackgroundColor, mergedOptions.borderColor, mergedOptions.userBubbleColor, mergedOptions.userBubbleTextColor, mergedOptions.assistantBubbleColor, mergedOptions.assistantBubbleTextColor, mergedOptions.sendButtonColor]);\n\n // The same values, handed to the dialogs this drawer opens. They render\n // through a portal into document.body, so the variables set above — which\n // live on the drawer element — never reach them.\n const modalTheme: DevicTheme = useMemo(\n () => ({\n color:\n mergedOptions.color !== DEFAULT_OPTIONS.color\n ? mergedOptions.color\n : undefined,\n fontFamily: mergedOptions.fontFamily,\n backgroundColor: mergedOptions.backgroundColor,\n textColor: mergedOptions.textColor,\n secondaryBackgroundColor: mergedOptions.secondaryBackgroundColor,\n borderColor: mergedOptions.borderColor,\n }),\n [\n mergedOptions.color,\n mergedOptions.fontFamily,\n mergedOptions.backgroundColor,\n mergedOptions.textColor,\n mergedOptions.secondaryBackgroundColor,\n mergedOptions.borderColor,\n ]\n );\n\n // The strip above the composer. Dismissed per end user, because the whole\n // point of remembering a dismissal is that the same person is not told twice.\n const integrationsHintNode =\n mergedOptions.showIntegrationsButton !== false &&\n mergedOptions.showIntegrationsHint !== false ? (\n <IntegrationsHint\n state={integrationsState}\n onOpen={() => setIntegrationsOpen(true)}\n label={mergedOptions.integrationsHintLabel}\n maxLogos={mergedOptions.maxIntegrationLogos}\n storageKey={`${assistantId}:${resolvedTenantId ?? ''}:${resolvedSubtenantId ?? ''}`}\n dark={isDarkTheme(modalTheme)}\n />\n ) : null;\n\n // Resizable drawer\n const [resizedWidth, setResizedWidth] = useState<number | null>(null);\n\n const handleResizeStart = useCallback(\n (e: React.MouseEvent) => {\n e.preventDefault();\n const startX = e.clientX;\n const startWidth = drawerRef.current?.offsetWidth ?? 0;\n const isLeft = mergedOptions.position === 'left';\n\n const onMove = (ev: MouseEvent) => {\n const delta = ev.clientX - startX;\n const newWidth = startWidth + (isLeft ? delta : -delta);\n const clamped = Math.min(\n mergedOptions.maxWidth,\n Math.max(mergedOptions.minWidth, newWidth)\n );\n setResizedWidth(clamped);\n };\n\n const onUp = () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n };\n\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n },\n [mergedOptions.position, mergedOptions.minWidth, mergedOptions.maxWidth]\n );\n\n // Build style object\n const baseWidth = resizedWidth\n ? `${resizedWidth}px`\n : typeof mergedOptions.width === 'number'\n ? `${mergedOptions.width}px`\n : mergedOptions.width;\n\n const drawerStyle = useMemo(\n () => ({\n width: baseWidth,\n zIndex: mergedOptions.zIndex,\n borderRadius: typeof mergedOptions.borderRadius === 'number'\n ? `${mergedOptions.borderRadius}px`\n : mergedOptions.borderRadius,\n ...mergedOptions.style,\n }),\n [baseWidth, mergedOptions.zIndex, mergedOptions.borderRadius, mergedOptions.style]\n );\n\n const overlayStyle = useMemo(\n () => ({\n zIndex: mergedOptions.zIndex - 1,\n }),\n [mergedOptions.zIndex]\n );\n\n const triggerStyle = useMemo(\n () => ({\n zIndex: mergedOptions.zIndex - 1,\n [mergedOptions.position]: 20,\n bottom: 20,\n }),\n [mergedOptions.zIndex, mergedOptions.position]\n );\n\n return (\n <>\n {/* Overlay (drawer mode only) */}\n {!isInline && (\n <div\n className=\"devic-drawer-overlay\"\n data-open={isOpen}\n style={overlayStyle}\n onClick={handleClose}\n />\n )}\n\n {/* Drawer */}\n <div\n ref={drawerRef}\n className={`devic-chat-drawer ${className || ''}`}\n data-position={mergedOptions.position}\n data-open={isOpen}\n data-mode={mode}\n style={drawerStyle}\n >\n {/* Resize handle */}\n {mergedOptions.resizable && (\n <div\n className=\"devic-resize-handle\"\n data-position={mergedOptions.position}\n onMouseDown={handleResizeStart}\n />\n )}\n\n {/* Header */}\n <div className=\"devic-drawer-header\">\n {avatarUrl && (\n <img\n className=\"devic-drawer-avatar\"\n src={avatarUrl}\n alt=\"\"\n aria-hidden=\"true\"\n />\n )}\n <h2 className=\"devic-drawer-title\">{mergedOptions.title}</h2>\n <ConversationSelector\n assistantId={assistantId}\n currentChatUid={chat.chatUid}\n onSelect={handleConversationSelect}\n onNewChat={handleNewChat}\n apiKey={apiKey}\n baseUrl={baseUrl}\n tenantId={tenantId}\n subtenantId={subtenantId}\n conversationPreview={mergedOptions.conversationPreview}\n />\n <div className=\"devic-drawer-header-actions\">\n {mergedOptions.showIntegrationsButton !== false && (\n <IntegrationsLauncher\n state={integrationsState}\n onClick={() => setIntegrationsOpen(true)}\n label={mergedOptions.integrationsLabel}\n maxLogos={mergedOptions.maxIntegrationLogos}\n dark={isDarkTheme(modalTheme)}\n placeholders={pendingIntegrations}\n />\n )}\n {mergedOptions.showCoreMemoryButton && (\n <button\n className=\"devic-new-chat-btn\"\n onClick={() => setCoreMemoryOpen(true)}\n type=\"button\"\n aria-label=\"Assistant memory\"\n title=\"Assistant memory\"\n >\n <BrainIcon />\n </button>\n )}\n <button\n className=\"devic-new-chat-btn\"\n onClick={handleNewChat}\n type=\"button\"\n aria-label=\"New chat\"\n title=\"New chat\"\n >\n <PlusIcon />\n </button>\n {!isInline && (\n <button\n className=\"devic-drawer-close\"\n onClick={handleClose}\n type=\"button\"\n aria-label=\"Close chat\"\n >\n <CloseIcon />\n </button>\n )}\n </div>\n </div>\n\n {/* Error display */}\n {chat.error && (\n <div className=\"devic-error\">\n {chat.error.message}\n </div>\n )}\n\n {/* Messages */}\n <ChatMessages\n messages={chat.messages}\n allMessages={chat.messages}\n isLoading={chat.isLoading}\n welcomeMessage={mergedOptions.welcomeMessage}\n suggestedMessages={mergedOptions.suggestedMessages}\n onSuggestedClick={handleSuggestedClick}\n showToolTimeline={mergedOptions.showToolTimeline}\n toolRenderers={mergedOptions.toolRenderers}\n toolIcons={mergedOptions.toolIcons}\n loadingIndicator={mergedOptions.loadingIndicator}\n showFeedback={mergedOptions.showFeedback}\n feedbackMap={feedbackMap}\n onFeedback={handleFeedback}\n handedOffSubThreadId={chat.handedOffSubThreadId || undefined}\n onHandoffCompleted={chat.onHandoffCompleted}\n handoffWidgetRenderer={mergedOptions.handoffWidgetRenderer}\n toolGroups={mergedOptions.toolGroups}\n userMessageRenderer={mergedOptions.userMessageRenderer}\n assistantMessageRenderer={mergedOptions.assistantMessageRenderer}\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n pendingInlineWidgets={inlineWidgets}\n onSubmitWidget={chat.submitWidgetResponse}\n onCancelWidget={chat.cancelWidgetCall}\n recalledMemories={\n mergedOptions.showRecalledMemories\n ? chat.recalledMemories\n : undefined\n }\n recalledMemoriesRenderer={mergedOptions.recalledMemoriesRenderer}\n />\n\n {/* Input */}\n {mergedOptions.customPromptBox ? (\n <div className=\"devic-input-area\">\n {limitBannerNode}\n {usageBarNode}\n {integrationsHintNode}\n {mergedOptions.customPromptBox({\n sendMessage: handleSend,\n transcribeAudio,\n stop: chat.stopChat,\n isLoading: chat.isLoading,\n newConversation: chat.clearChat,\n references,\n removeReference,\n clearReferences,\n limitExceeded: chat.limitExceeded,\n })}\n </div>\n ) : (\n <ChatInput\n onSend={handleSend}\n disabled={\n chat.isLoading ||\n chat.handedOff ||\n inlineWidgets.length > 0 ||\n !!chat.limitExceeded\n }\n placeholder={mergedOptions.inputPlaceholder}\n enableFileUploads={mergedOptions.enableFileUploads}\n allowedFileTypes={mergedOptions.allowedFileTypes}\n maxFileSize={mergedOptions.maxFileSize}\n enableLongTextPaste={mergedOptions.enableLongTextPaste}\n longTextPasteThreshold={mergedOptions.longTextPasteThreshold}\n enableSpeechToText={mergedOptions.enableSpeechToText}\n speechLanguage={mergedOptions.speechLanguage}\n speechTenantId={tenantId}\n speechAutoStop={mergedOptions.speechAutoStop}\n speechAutoStopCountdownMs={mergedOptions.speechAutoStopCountdownMs}\n speechAutoStopSilenceMs={mergedOptions.speechAutoStopSilenceMs}\n speechAutoStopSilenceRatio={mergedOptions.speechAutoStopSilenceRatio}\n speechAutoStopSilenceLevel={mergedOptions.speechAutoStopSilenceLevel}\n speechAutoStopSpeechLevel={mergedOptions.speechAutoStopSpeechLevel}\n speechHandoff={mergedOptions.speechHandoff}\n speechHandoffSendDelayMs={mergedOptions.speechHandoffSendDelayMs}\n speechHandoffHoldMs={mergedOptions.speechHandoffHoldMs}\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n sendButtonContent={mergedOptions.sendButtonContent}\n disabledMessage={\n chat.handedOff\n ? 'Waiting for subagent to complete'\n : inlineWidgets.length > 0\n ? 'Waiting for tool response'\n : undefined\n }\n isProcessing={chat.isLoading && !chat.handedOff}\n onStop={chat.stopChat}\n stopButtonContent={mergedOptions.stopButtonContent}\n pendingInputWidget={inputWidget}\n onSubmitWidget={chat.submitWidgetResponse}\n onCancelWidget={chat.cancelWidgetCall}\n references={references}\n onRemoveReference={removeReference}\n usageBar={usageBarNode}\n limitBanner={limitBannerNode}\n integrationsHint={integrationsHintNode}\n />\n )}\n </div>\n\n {/* Trigger button (drawer mode only, when closed) */}\n {!isInline && !isOpen && (\n <button\n className=\"devic-trigger\"\n onClick={handleOpen}\n style={triggerStyle}\n type=\"button\"\n aria-label=\"Open chat\"\n >\n <ChatIcon />\n </button>\n )}\n\n {/* Core memory modal (opened from the header brain button) */}\n {mergedOptions.showCoreMemoryButton && (\n <CoreMemoryModal\n isOpen={coreMemoryOpen}\n onClose={() => setCoreMemoryOpen(false)}\n assistantId={assistantId}\n tenantId={tenantId}\n subtenantId={subtenantId}\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n theme={modalTheme}\n />\n )}\n\n {/* Connected apps modal (opened from the header app stack) */}\n {mergedOptions.showIntegrationsButton !== false && (\n <IntegrationsModal\n isOpen={integrationsOpen}\n onClose={() => setIntegrationsOpen(false)}\n assistantId={assistantId}\n tenantId={tenantId}\n subtenantId={subtenantId}\n apiKey={resolvedApiKey}\n baseUrl={resolvedBaseUrl}\n title={mergedOptions.integrationsLabel}\n theme={modalTheme}\n state={integrationsState}\n />\n )}\n </>\n );\n}\n\n/**\n * Brain icon for the core memory button\n */\nfunction BrainIcon(): JSX.Element {\n return (\n <svg\n width=\"17\"\n height=\"17\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M9.5 2a2.5 2.5 0 0 0-2.45 2A3.5 3.5 0 0 0 4.6 8.6 3.5 3.5 0 0 0 3 11.5c0 1.1.5 2.08 1.29 2.73A3.5 3.5 0 0 0 7 20a3 3 0 0 0 5-2.24V4.5A2.5 2.5 0 0 0 9.5 2Z\" />\n <path d=\"M14.5 2a2.5 2.5 0 0 1 2.45 2 3.5 3.5 0 0 1 2.45 4.6A3.5 3.5 0 0 1 21 11.5a3.49 3.49 0 0 1-1.29 2.73A3.5 3.5 0 0 1 17 20a3 3 0 0 1-5-2.24V4.5A2.5 2.5 0 0 1 14.5 2Z\" />\n </svg>\n );\n}\n\nfunction CloseIcon(): JSX.Element {\n return (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n );\n}\n\n/**\n * Plus icon for new chat button\n */\nfunction PlusIcon(): JSX.Element {\n return (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" />\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" />\n </svg>\n );\n}\n\n/**\n * Chat icon for trigger button\n */\nfunction ChatIcon(): JSX.Element {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n >\n <path d=\"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-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,GAAG,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAA,CAAG,CAAA,EAAA,CACnC;AAEV;AAEA;;AAEG;AACH,SAAS,QAAQ,GAAA;IACf,QACEA,GAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,cAAc,EAAA,QAAA,EAEnBA,GAAA,CAAA,MAAA,EAAA,EAAM,CAAC,EAAC,yFAAyF,EAAA,CAAG,EAAA,CAChG;AAEV;;;;"}
|
|
@@ -16,6 +16,15 @@ export interface IntegrationsLauncherProps {
|
|
|
16
16
|
* app logos are solid black on transparency and vanish otherwise.
|
|
17
17
|
*/
|
|
18
18
|
dark?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* How many placeholder chips to hold while the listing is on its way.
|
|
21
|
+
*
|
|
22
|
+
* Only pass a number when the apps are known to exist — the assistant having
|
|
23
|
+
* said so — never on the chance that they might. A placeholder is a promise
|
|
24
|
+
* that something is coming, and one that resolves to nothing is worse than
|
|
25
|
+
* the gap it filled.
|
|
26
|
+
*/
|
|
27
|
+
placeholders?: number;
|
|
19
28
|
className?: string;
|
|
20
29
|
}
|
|
21
30
|
/**
|
|
@@ -27,5 +36,5 @@ export interface IntegrationsLauncherProps {
|
|
|
27
36
|
* it promises the end user something the assistant was never configured to
|
|
28
37
|
* give them.
|
|
29
38
|
*/
|
|
30
|
-
export declare function IntegrationsLauncher({ state, onClick, label, maxLogos, dark, className, }: IntegrationsLauncherProps): JSX.Element | null;
|
|
39
|
+
export declare function IntegrationsLauncher({ state, onClick, label, maxLogos, dark, placeholders, className, }: IntegrationsLauncherProps): JSX.Element | null;
|
|
31
40
|
export default IntegrationsLauncher;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useMemo, useRef, useState, useEffect } from 'react';
|
|
3
3
|
import { IntegrationLogo } from './IntegrationLogo.js';
|
|
4
4
|
|
|
@@ -38,7 +38,7 @@ function logosThatFit(hostWidth, max) {
|
|
|
38
38
|
* it promises the end user something the assistant was never configured to
|
|
39
39
|
* give them.
|
|
40
40
|
*/
|
|
41
|
-
function IntegrationsLauncher({ state, onClick, label = "Connected apps", maxLogos = DEFAULT_MAX_LOGOS, dark = false, className = "", }) {
|
|
41
|
+
function IntegrationsLauncher({ state, onClick, label = "Connected apps", maxLogos = DEFAULT_MAX_LOGOS, dark = false, placeholders = 0, className = "", }) {
|
|
42
42
|
const sorted = useMemo(() => order(state.integrations), [state.integrations]);
|
|
43
43
|
const ref = useRef(null);
|
|
44
44
|
const [fit, setFit] = useState(maxLogos);
|
|
@@ -53,6 +53,11 @@ function IntegrationsLauncher({ state, onClick, label = "Connected apps", maxLog
|
|
|
53
53
|
observer.observe(host);
|
|
54
54
|
return () => observer.disconnect();
|
|
55
55
|
}, [maxLogos, state.offered]);
|
|
56
|
+
// Nothing yet, but the assistant has already said there will be: hold the
|
|
57
|
+
// shape rather than let the header reflow when the logos land.
|
|
58
|
+
if (sorted.length === 0 && placeholders > 0) {
|
|
59
|
+
return (jsx("span", { className: `devic-int-launcher devic-int-launcher-loading ${className}`.trim(), "data-dark": dark, "aria-busy": "true", "aria-label": `${label} (loading)`, children: Array.from({ length: Math.min(placeholders, Math.max(1, fit)) }).map((_, i) => (jsx("span", { className: "devic-int-launcher-item devic-int-launcher-skeleton" }, i))) }));
|
|
60
|
+
}
|
|
56
61
|
if (!state.offered || sorted.length === 0)
|
|
57
62
|
return null;
|
|
58
63
|
const shown = sorted.slice(0, Math.max(1, fit));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrationsLauncher.js","sources":["../../../../src/components/IntegrationsModal/IntegrationsLauncher.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState, type JSX } from \"react\";\nimport type { Integration } from \"../../api/types\";\nimport { IntegrationLogo } from \"./IntegrationLogo\";\nimport type { IntegrationsState } from \"./useIntegrations\";\nimport \"./IntegrationsModal.css\";\n\n/** How many logos fit before the rest are counted instead. */\nexport const DEFAULT_MAX_LOGOS = 6;\n\nexport interface IntegrationsLauncherProps {\n /** Shared listing, so this and the modal load the catalogue once. */\n state: IntegrationsState;\n onClick: () => void;\n /** Tooltip and accessible name. @default \"Connected apps\" */\n label?: string;\n /** Logos shown before the `+N` box. @default 6 */\n maxLogos?: number;\n /**\n * Whether the surrounding surface is dark, so the logo chips go light. Many\n * app logos are solid black on transparency and vanish otherwise.\n */\n dark?: boolean;\n className?: string;\n}\n\n/** Connected first: with more apps than fit, those are the ones worth showing. */\nfunction order(integrations: Integration[]): Integration[] {\n return [...integrations].sort((a, b) => {\n if (a.connected !== b.connected) return a.connected ? -1 : 1;\n return 0;\n });\n}\n\n/**\n * Logos a row this wide can afford.\n *\n * The stack shares the drawer header with a title, the conversation picker and\n * two more buttons, and a 400px drawer is the common case. Six logos there push\n * the picker down to a stub — so on a narrow header the count drops and the\n * `+N` box absorbs the difference, which is what it is for.\n */\nfunction logosThatFit(hostWidth: number, max: number): number {\n if (!hostWidth) return max;\n if (hostWidth >= 520) return max;\n if (hostWidth >= 460) return Math.min(max, 5);\n return Math.min(max, 4);\n}\n\n/**\n * The header control that opens the connected-apps modal, drawn as the real\n * logos of the apps on offer.\n *\n * It renders nothing until the server has confirmed the assistant offers apps\n * to its tenants. A button that opens an empty dialog is worse than no button:\n * it promises the end user something the assistant was never configured to\n * give them.\n */\nexport function IntegrationsLauncher({\n state,\n onClick,\n label = \"Connected apps\",\n maxLogos = DEFAULT_MAX_LOGOS,\n dark = false,\n className = \"\",\n}: IntegrationsLauncherProps): JSX.Element | null {\n const sorted = useMemo(() => order(state.integrations), [state.integrations]);\n const ref = useRef<HTMLButtonElement>(null);\n const [fit, setFit] = useState(maxLogos);\n\n useEffect(() => {\n const host =\n ref.current?.closest(\".devic-drawer-header\") ??\n ref.current?.parentElement;\n if (!host || typeof ResizeObserver === \"undefined\") return;\n const measure = () =>\n setFit(logosThatFit(host.getBoundingClientRect().width, maxLogos));\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(host);\n return () => observer.disconnect();\n }, [maxLogos, state.offered]);\n\n if (!state.offered || sorted.length === 0) return null;\n\n const shown = sorted.slice(0, Math.max(1, fit));\n const extra = sorted.length - shown.length;\n const connected = sorted.filter((i) => i.connected).length;\n\n return (\n <button\n type=\"button\"\n ref={ref}\n className={`devic-int-launcher ${className}`.trim()}\n data-dark={dark}\n onClick={onClick}\n title={label}\n aria-label={`${label} (${connected}/${sorted.length} connected)`}\n >\n {shown.map((integration) => (\n <span\n key={integration.app}\n className=\"devic-int-launcher-item\"\n // Dimmed until connected, so the stack doubles as the status: the\n // end user can see at a glance which of their apps are set up.\n data-connected={integration.connected}\n title={integration.name}\n >\n <IntegrationLogo\n integration={integration}\n className=\"devic-int-launcher-logo\"\n />\n </span>\n ))}\n {extra > 0 && (\n <span className=\"devic-int-launcher-item devic-int-launcher-more\">\n +{extra}\n </span>\n )}\n </button>\n );\n}\n\nexport default IntegrationsLauncher;\n"],"names":["
|
|
1
|
+
{"version":3,"file":"IntegrationsLauncher.js","sources":["../../../../src/components/IntegrationsModal/IntegrationsLauncher.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState, type JSX } from \"react\";\nimport type { Integration } from \"../../api/types\";\nimport { IntegrationLogo } from \"./IntegrationLogo\";\nimport type { IntegrationsState } from \"./useIntegrations\";\nimport \"./IntegrationsModal.css\";\n\n/** How many logos fit before the rest are counted instead. */\nexport const DEFAULT_MAX_LOGOS = 6;\n\nexport interface IntegrationsLauncherProps {\n /** Shared listing, so this and the modal load the catalogue once. */\n state: IntegrationsState;\n onClick: () => void;\n /** Tooltip and accessible name. @default \"Connected apps\" */\n label?: string;\n /** Logos shown before the `+N` box. @default 6 */\n maxLogos?: number;\n /**\n * Whether the surrounding surface is dark, so the logo chips go light. Many\n * app logos are solid black on transparency and vanish otherwise.\n */\n dark?: boolean;\n /**\n * How many placeholder chips to hold while the listing is on its way.\n *\n * Only pass a number when the apps are known to exist — the assistant having\n * said so — never on the chance that they might. A placeholder is a promise\n * that something is coming, and one that resolves to nothing is worse than\n * the gap it filled.\n */\n placeholders?: number;\n className?: string;\n}\n\n/** Connected first: with more apps than fit, those are the ones worth showing. */\nfunction order(integrations: Integration[]): Integration[] {\n return [...integrations].sort((a, b) => {\n if (a.connected !== b.connected) return a.connected ? -1 : 1;\n return 0;\n });\n}\n\n/**\n * Logos a row this wide can afford.\n *\n * The stack shares the drawer header with a title, the conversation picker and\n * two more buttons, and a 400px drawer is the common case. Six logos there push\n * the picker down to a stub — so on a narrow header the count drops and the\n * `+N` box absorbs the difference, which is what it is for.\n */\nfunction logosThatFit(hostWidth: number, max: number): number {\n if (!hostWidth) return max;\n if (hostWidth >= 520) return max;\n if (hostWidth >= 460) return Math.min(max, 5);\n return Math.min(max, 4);\n}\n\n/**\n * The header control that opens the connected-apps modal, drawn as the real\n * logos of the apps on offer.\n *\n * It renders nothing until the server has confirmed the assistant offers apps\n * to its tenants. A button that opens an empty dialog is worse than no button:\n * it promises the end user something the assistant was never configured to\n * give them.\n */\nexport function IntegrationsLauncher({\n state,\n onClick,\n label = \"Connected apps\",\n maxLogos = DEFAULT_MAX_LOGOS,\n dark = false,\n placeholders = 0,\n className = \"\",\n}: IntegrationsLauncherProps): JSX.Element | null {\n const sorted = useMemo(() => order(state.integrations), [state.integrations]);\n const ref = useRef<HTMLButtonElement>(null);\n const [fit, setFit] = useState(maxLogos);\n\n useEffect(() => {\n const host =\n ref.current?.closest(\".devic-drawer-header\") ??\n ref.current?.parentElement;\n if (!host || typeof ResizeObserver === \"undefined\") return;\n const measure = () =>\n setFit(logosThatFit(host.getBoundingClientRect().width, maxLogos));\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(host);\n return () => observer.disconnect();\n }, [maxLogos, state.offered]);\n\n // Nothing yet, but the assistant has already said there will be: hold the\n // shape rather than let the header reflow when the logos land.\n if (sorted.length === 0 && placeholders > 0) {\n return (\n <span\n className={`devic-int-launcher devic-int-launcher-loading ${className}`.trim()}\n data-dark={dark}\n aria-busy=\"true\"\n aria-label={`${label} (loading)`}\n >\n {Array.from({ length: Math.min(placeholders, Math.max(1, fit)) }).map(\n (_, i) => (\n <span\n key={i}\n className=\"devic-int-launcher-item devic-int-launcher-skeleton\"\n />\n )\n )}\n </span>\n );\n }\n\n if (!state.offered || sorted.length === 0) return null;\n\n const shown = sorted.slice(0, Math.max(1, fit));\n const extra = sorted.length - shown.length;\n const connected = sorted.filter((i) => i.connected).length;\n\n return (\n <button\n type=\"button\"\n ref={ref}\n className={`devic-int-launcher ${className}`.trim()}\n data-dark={dark}\n onClick={onClick}\n title={label}\n aria-label={`${label} (${connected}/${sorted.length} connected)`}\n >\n {shown.map((integration) => (\n <span\n key={integration.app}\n className=\"devic-int-launcher-item\"\n // Dimmed until connected, so the stack doubles as the status: the\n // end user can see at a glance which of their apps are set up.\n data-connected={integration.connected}\n title={integration.name}\n >\n <IntegrationLogo\n integration={integration}\n className=\"devic-int-launcher-logo\"\n />\n </span>\n ))}\n {extra > 0 && (\n <span className=\"devic-int-launcher-item devic-int-launcher-more\">\n +{extra}\n </span>\n )}\n </button>\n );\n}\n\nexport default IntegrationsLauncher;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;AAMA;AACO,MAAM,iBAAiB,GAAG;AA2BjC;AACA,SAAS,KAAK,CAAC,YAA2B,EAAA;AACxC,IAAA,OAAO,CAAC,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAI;AACrC,QAAA,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS;AAAE,YAAA,OAAO,CAAC,CAAC,SAAS,GAAG,EAAE,GAAG,CAAC;AAC5D,QAAA,OAAO,CAAC;AACV,IAAA,CAAC,CAAC;AACJ;AAEA;;;;;;;AAOG;AACH,SA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