vpschatbotwidget 1.2.1 → 1.2.3

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.
Files changed (68) hide show
  1. package/README.md +56 -16
  2. package/dist-lib/types/chatbot/api/chatbot-types.d.ts +8 -1
  3. package/dist-lib/types/chatbot/core/AgentReasoning.d.ts +4 -1
  4. package/dist-lib/types/chatbot/core/ChatContext.d.ts +5 -1
  5. package/dist-lib/types/chatbot/core/ChatHeader.d.ts +2 -0
  6. package/dist-lib/types/chatbot/core/ChatInlineCitation.d.ts +5 -0
  7. package/dist-lib/types/chatbot/core/ChatInput.d.ts +5 -0
  8. package/dist-lib/types/chatbot/core/ChatMarkdown.d.ts +4 -1
  9. package/dist-lib/types/chatbot/core/ChatMessage.d.ts +1 -0
  10. package/dist-lib/types/chatbot/core/ChatMessageActions.d.ts +7 -0
  11. package/dist-lib/types/chatbot/core/ChatMessageList.d.ts +3 -1
  12. package/dist-lib/types/chatbot/core/ChatProvider.d.ts +2 -2
  13. package/dist-lib/types/chatbot/core/GroundedSources.d.ts +5 -0
  14. package/dist-lib/types/chatbot/embedded/EmbeddedChatbot.d.ts +2 -2
  15. package/dist-lib/types/chatbot/hooks/useCopyText.d.ts +4 -0
  16. package/dist-lib/types/chatbot/hooks/useResponseSound.d.ts +6 -0
  17. package/dist-lib/types/chatbot/index.d.ts +1 -1
  18. package/dist-lib/types/chatbot/widget/ChatbotWidget.d.ts +2 -2
  19. package/dist-lib/types/components/ai-elements/inline-citation.d.ts +52 -0
  20. package/dist-lib/types/components/ai-elements/reasoning.d.ts +21 -0
  21. package/dist-lib/types/components/ai-elements/suggestion.d.ts +9 -0
  22. package/dist-lib/types/components/ui/bubble.d.ts +6 -0
  23. package/dist-lib/types/components/ui/button.d.ts +8 -0
  24. package/dist-lib/types/components/ui/hover-card.d.ts +5 -0
  25. package/dist-lib/types/components/ui/input-group.d.ts +5 -0
  26. package/dist-lib/types/components/ui/marker.d.ts +6 -0
  27. package/dist-lib/types/components/ui/message.d.ts +8 -0
  28. package/dist-lib/types/components/ui/trace.d.ts +19 -0
  29. package/dist-lib/types/lib/safeHref.d.ts +1 -0
  30. package/dist-lib/vps-chatbot.cjs +110 -29
  31. package/dist-lib/vps-chatbot.js +9540 -1654
  32. package/package.json +6 -2
  33. package/src/chatbot/api/chatbot-api.ts +1 -0
  34. package/src/chatbot/api/chatbot-types.ts +9 -1
  35. package/src/chatbot/chatbot.test.tsx +125 -7
  36. package/src/chatbot/core/AgentReasoning.tsx +68 -36
  37. package/src/chatbot/core/ChatContext.tsx +5 -0
  38. package/src/chatbot/core/ChatEmptyState.tsx +14 -13
  39. package/src/chatbot/core/ChatError.tsx +20 -12
  40. package/src/chatbot/core/ChatHeader.tsx +17 -1
  41. package/src/chatbot/core/ChatInlineCitation.tsx +63 -0
  42. package/src/chatbot/core/ChatInput.tsx +73 -51
  43. package/src/chatbot/core/ChatMarkdown.tsx +70 -24
  44. package/src/chatbot/core/ChatMessage.tsx +77 -88
  45. package/src/chatbot/core/ChatMessageActions.tsx +51 -0
  46. package/src/chatbot/core/ChatMessageList.tsx +15 -7
  47. package/src/chatbot/core/ChatPanel.tsx +19 -7
  48. package/src/chatbot/core/ChatProvider.tsx +58 -10
  49. package/src/chatbot/core/ChatSuggestions.tsx +14 -34
  50. package/src/chatbot/core/GroundedSources.tsx +113 -90
  51. package/src/chatbot/core/grounding.test.tsx +111 -4
  52. package/src/chatbot/embedded/EmbeddedChatbot.tsx +2 -2
  53. package/src/chatbot/hooks/useCopyText.ts +23 -0
  54. package/src/chatbot/hooks/useResponseSound.ts +74 -0
  55. package/src/chatbot/index.ts +1 -0
  56. package/src/chatbot/widget/ChatbotWidget.tsx +2 -2
  57. package/src/components/ai-elements/inline-citation.tsx +299 -0
  58. package/src/components/ai-elements/reasoning.tsx +126 -0
  59. package/src/components/ai-elements/suggestion.tsx +42 -0
  60. package/src/components/ui/bubble.tsx +18 -0
  61. package/src/components/ui/button.tsx +43 -0
  62. package/src/components/ui/hover-card.tsx +43 -0
  63. package/src/components/ui/input-group.tsx +18 -0
  64. package/src/components/ui/marker.tsx +18 -0
  65. package/src/components/ui/message.tsx +26 -0
  66. package/src/components/ui/trace.tsx +68 -0
  67. package/src/index.css +579 -272
  68. package/src/lib/safeHref.ts +6 -0
package/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  [![VpsChatbot-widget](https://github.com/dhineshkumar-natobotics/VPS-Chatbot-Widget/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/dhineshkumar-natobotics/VPS-Chatbot-Widget/actions/workflows/npm-publish.yml)
4
4
 
5
- A modular, highly customizable React + TypeScript assistant widget and slide-out panel for customer portals. Built with Tailwind CSS, Lucide icons, and full TypeScript typings.
6
-
7
- Supports both **standalone mode** (drop-in with zero setup) and **shared conversation mode** (floating widget + slide-out panel syncing the same session).
5
+ A React 19 and TypeScript chat widget for the VPS Customer Portal. Use the floating widget or slide-out panel on its own, or wrap both in a shared `ChatProvider` to keep one conversation.
8
6
 
9
7
  ---
10
8
 
@@ -15,6 +13,7 @@ Supports both **standalone mode** (drop-in with zero setup) and **shared convers
15
13
  - [1. Standalone Widget](#1-standalone-widget-no-provider-required)
16
14
  - [2. Standalone Slide-out Panel](#2-standalone-slide-out-panel)
17
15
  - [3. Shared Conversation Mode](#3-shared-conversation-mode-multiple-views)
16
+ - [Conversation UI](#conversation-ui)
18
17
  - [API & Proxy URL Configuration](#api--proxy-url-configuration)
19
18
  - [URL Normalization Behavior](#url-normalization-behavior)
20
19
  - [Component Props Reference](#component-props-reference)
@@ -36,14 +35,19 @@ Supports both **standalone mode** (drop-in with zero setup) and **shared convers
36
35
 
37
36
  ## Installation
38
37
 
39
- ### From GitHub Repository
38
+ ### From a Local Checkout
39
+
40
+ Run these commands from the root of the chatbot repository.
40
41
 
41
42
  ```bash
42
- # Using npm
43
- npm install git+https://github.com/dhineshkumar-natobotics/VPS-Chatbot-Widget.git
43
+ npm --prefix frontend ci
44
+ npm --prefix frontend run build:lib
45
+ ```
46
+
47
+ From the host application, install the built package.
44
48
 
45
- # Or if importing from a monorepo branch subdirectory
46
- npm install github:dhineshkumar-natobotics/VPS-AI-Chatbot#main:frontend
49
+ ```bash
50
+ npm install /path/to/VPS-AI-Chatbot/frontend
47
51
  ```
48
52
 
49
53
  ### From npm Registry
@@ -108,7 +112,7 @@ export function App() {
108
112
 
109
113
  ### 3. Shared Conversation Mode (Multiple Views)
110
114
 
111
- Wrap both components in `<ChatProvider>` so messages, session state, and ticket flows stay synchronized between views:
115
+ Pass shared settings to `<ChatProvider>` so both views use the same session, messages, and feedback. Pass view settings such as `open` or `envStage` to each widget.
112
116
 
113
117
  ```tsx
114
118
  import { useState } from "react";
@@ -140,9 +144,19 @@ export function App() {
140
144
 
141
145
  ---
142
146
 
147
+ ## Conversation UI
148
+
149
+ - The suggestion strip scrolls horizontally. Clicking a suggestion fills the composer. Enter sends the message, and Shift+Enter adds a line.
150
+ - During a reply, **Thinking** expands to show API progress. After completion, **Thought** shows elapsed time. Activity collapses automatically unless the reader changed its open state.
151
+ - **Stop response** preserves the text already displayed. Completed replies offer Copy, Like, and Dislike. Ratings belong to the current conversation. **Edit message** loads a previous prompt into the composer.
152
+ - Inline references such as `[S1]` open a source preview when the reply includes matching metadata. A source link opens in a new tab when a URL is available. Set `showGroundedSources` to show the separate source list or `hideInspectSources` to suppress previews.
153
+ - A short chime plays when a reply completes. The **Response sound** button mutes it, and the browser remembers the preference when local storage is available. Playback depends on the browser allowing audio after interaction.
154
+
155
+ ---
156
+
143
157
  ## API & Proxy URL Configuration
144
158
 
145
- You can configure the backend target using any of the following 4 methods:
159
+ Pass the API URL as a prop, use a same-origin proxy, or configure it when building the frontend with Vite.
146
160
 
147
161
  ### 1. Component Prop
148
162
 
@@ -198,7 +212,7 @@ VITE_API_BASE_URL=https://yourapiurl.com
198
212
  VITE_API_URL=https://yourapiurl.com
199
213
  ```
200
214
 
201
- When no prop is provided, the components automatically read `VITE_API_BASE`.
215
+ Vite reads these variables at build time. If you consume the prebuilt npm package, pass `apiBaseUrl` for a custom URL or use a same-origin proxy.
202
216
 
203
217
  ### URL Normalization Behavior
204
218
 
@@ -234,6 +248,8 @@ Floating round launcher button in the bottom-right corner with an animated pop-u
234
248
  | `suggestions` | [`Suggestion[]`](#suggestion) | `DEFAULT_SUGGESTIONS` | Custom quick prompt suggestions rendered above the input. |
235
249
  | `disableSuggestions` | `boolean` | `false` | When `true`, hides the suggestion badges entirely. |
236
250
  | `initialMessage` | `string` | `undefined` | Starter message sent automatically to the assistant upon session creation. |
251
+ | `showGroundedSources` | `boolean` | `false` | Show the source list below replies. |
252
+ | `hideInspectSources` | `boolean` | `false` | Hide inline previews and the source list’s inspection control. |
237
253
 
238
254
  ---
239
255
 
@@ -256,6 +272,8 @@ A draggable side tab on the right edge of the screen that slides out into a full
256
272
  | `suggestions` | [`Suggestion[]`](#suggestion) | `DEFAULT_SUGGESTIONS` | Quick prompt suggestions. |
257
273
  | `disableSuggestions` | `boolean` | `false` | Hide suggestion pills. |
258
274
  | `initialMessage` | `string` | `undefined` | Starter message automatically sent on mount. |
275
+ | `showGroundedSources` | `boolean` | `false` | Show the source list below replies. |
276
+ | `hideInspectSources` | `boolean` | `false` | Hide inline previews and the source list’s inspection control. |
259
277
 
260
278
  ---
261
279
 
@@ -274,6 +292,9 @@ React context provider that coordinates conversation state, API communication, m
274
292
  | `disableSuggestions` | `boolean` | `false` | Disable suggestion badges across all views. |
275
293
  | `initialMessage` | `string` | `undefined` | Message triggered upon provider initialization. |
276
294
  | `api` | `ChatApiClient` | `undefined` | Optional pre-configured API client instance from `createChatApi(baseUrl)`. |
295
+ | `showGroundedSources` | `boolean` | `false` | Show the source list across shared views. |
296
+ | `hideInspectSources` | `boolean` | `false` | Hide inline previews and the source list’s inspection control across shared views. |
297
+ | `modelId` | `string` | `"auto"` | Select a configured model alias. |
277
298
 
278
299
  ---
279
300
 
@@ -309,6 +330,8 @@ export interface ChatUserContext {
309
330
  name?: string;
310
331
  /** User role (e.g. "admin", "customer", "operator") */
311
332
  role?: string;
333
+ roleId?: number;
334
+ client?: "mobile" | "web" | "admin";
312
335
  /** Current page/route context (e.g. "reports", "sample-status") */
313
336
  page?: string;
314
337
  }
@@ -345,10 +368,15 @@ export interface ChatMessage {
345
368
  role: "user" | "assistant" | "system";
346
369
  content: string;
347
370
  createdAt: string;
348
- status?: "pending" | "complete" | "error";
371
+ status?: "pending" | "complete" | "error" | "stopped";
372
+ streamId?: string;
373
+ durationMs?: number;
374
+ progressText?: string;
375
+ progressSteps?: string[];
349
376
  sources?: Source[];
350
377
  toolCalls?: ToolCall[];
351
378
  usage?: TokenUsage;
379
+ feedback?: "like" | "dislike";
352
380
  }
353
381
  ```
354
382
 
@@ -371,6 +399,9 @@ function CustomStatus() {
371
399
  sessionId, // string | null
372
400
  apiBaseUrl, // string
373
401
  sendMessage, // (text: string) => Promise<void>
402
+ stopResponse, // () => void
403
+ soundEnabled, // boolean
404
+ toggleSound, // () => void
374
405
  retryLast, // () => Promise<void>
375
406
  resetConversation, // () => Promise<void>
376
407
  } = useChatbot();
@@ -395,6 +426,15 @@ const reply = await client.sendMessage(session.sessionId, "Hello");
395
426
 
396
427
  ## Building & Distributing
397
428
 
429
+ Run the frontend checks from this directory.
430
+
431
+ ```bash
432
+ npm ci
433
+ npm run typecheck
434
+ npm test
435
+ npm run build
436
+ ```
437
+
398
438
  ### Build Standalone Library
399
439
 
400
440
  Compiles the package into `dist-lib/` with ES Modules, CommonJS, and TypeScript types:
@@ -417,8 +457,8 @@ npm run typecheck
417
457
 
418
458
  ### Package Exports Overview
419
459
 
420
- When imported as a library, `package.json` maps:
460
+ `package.json` exposes the widget through the following paths.
421
461
 
422
- - `.` &rarr; TypeScript source / `dist-lib/vps-chatbot.js` / CommonJS
423
- - `./css` &rarr; `dist-lib/style.css` (or `src/index.css`)
424
- - Types &rarr; `dist-lib/types/chatbot/index.d.ts`
462
+ - `vpschatbotwidget` and `vpschatbotwidget/chatbot` resolve to ESM or CommonJS builds in `dist-lib/`.
463
+ - `vpschatbotwidget/css` loads `src/index.css`.
464
+ - TypeScript resolves both entry points to `dist-lib/types/chatbot/index.d.ts`.
@@ -1,10 +1,12 @@
1
1
  export type ChatRole = "user" | "assistant" | "system";
2
- export type MessageStatus = "pending" | "complete" | "error";
2
+ export type MessageStatus = "pending" | "complete" | "error" | "stopped";
3
+ export type MessageFeedback = "like" | "dislike";
3
4
  export interface Source {
4
5
  chunkId: string;
5
6
  source: string;
6
7
  score: number;
7
8
  title?: string;
9
+ url?: string;
8
10
  snippet?: string;
9
11
  }
10
12
  export interface ToolCall {
@@ -20,15 +22,19 @@ export interface TokenUsage {
20
22
  }
21
23
  export interface ChatMessage {
22
24
  id: string;
25
+ /** Stable view identity while a streamed reply receives its server request ID. */
26
+ streamId?: string;
23
27
  role: ChatRole;
24
28
  content: string;
25
29
  createdAt: string;
26
30
  status?: MessageStatus;
27
31
  progressText?: string;
32
+ progressSteps?: string[];
28
33
  durationMs?: number;
29
34
  sources?: Source[];
30
35
  toolCalls?: ToolCall[];
31
36
  usage?: TokenUsage;
37
+ feedback?: MessageFeedback;
32
38
  }
33
39
  export interface ChatUserContext {
34
40
  customerId?: string;
@@ -93,6 +99,7 @@ export interface SourceDto {
93
99
  source: string;
94
100
  score: number;
95
101
  title?: string;
102
+ url?: string;
96
103
  snippet?: string;
97
104
  }
98
105
  export interface ToolCallDto {
@@ -1,8 +1,11 @@
1
1
  import React from "react";
2
+ import type { ToolCall } from "../api/chatbot-types";
2
3
  interface AgentReasoningProps {
3
- status?: "pending" | "complete" | "error";
4
+ status?: "pending" | "complete" | "stopped";
4
5
  progressText?: string;
6
+ progressSteps?: string[];
5
7
  durationMs?: number;
8
+ toolCalls?: ToolCall[];
6
9
  }
7
10
  export declare const AgentReasoning: React.FC<AgentReasoningProps>;
8
11
  export {};
@@ -1,4 +1,4 @@
1
- import type { ChatMessage, ChatUserContext, Suggestion, Ticket, ModelOption } from "../api/chatbot-types";
1
+ import type { ChatMessage, ChatUserContext, MessageFeedback, Suggestion, Ticket, ModelOption } from "../api/chatbot-types";
2
2
  export type ChatUiStatus = "idle" | "connecting" | "awaiting" | "error";
3
3
  export interface PendingTicket {
4
4
  subject: string;
@@ -19,7 +19,11 @@ export interface ChatContextValue {
19
19
  apiBaseUrl?: string;
20
20
  hideInspectSources?: boolean;
21
21
  showGroundedSources?: boolean;
22
+ soundEnabled: boolean;
23
+ toggleSound: () => void;
22
24
  sendMessage: (text: string) => Promise<void>;
25
+ stopResponse: () => void;
26
+ toggleMessageFeedback: (messageId: string, feedback: MessageFeedback) => void;
23
27
  retryLast: () => Promise<void>;
24
28
  confirmTicket: (customerIdOrEmail?: string) => Promise<void>;
25
29
  cancelTicket: () => void;
@@ -6,6 +6,8 @@ interface ChatHeaderProps {
6
6
  onClose?: () => void;
7
7
  onReset?: () => void;
8
8
  onBack?: () => void;
9
+ soundEnabled?: boolean;
10
+ onToggleSound?: () => void;
9
11
  showMinimize?: boolean;
10
12
  /** Environment badge stage shown in the header. Omit for production. */
11
13
  envStage?: EnvStage;
@@ -0,0 +1,5 @@
1
+ import type { Source } from "../api/chatbot-types";
2
+ export declare function ChatInlineCitation({ label, sources }: {
3
+ label: string;
4
+ sources: Source[];
5
+ }): import("react").JSX.Element;
@@ -1,8 +1,13 @@
1
1
  import React from "react";
2
2
  interface ChatInputProps {
3
3
  onSend: (message: string) => void;
4
+ onStop?: () => void;
4
5
  disabled?: boolean;
5
6
  placeholder?: string;
7
+ ref?: React.Ref<ChatInputHandle>;
8
+ }
9
+ export interface ChatInputHandle {
10
+ edit: (text: string) => void;
6
11
  }
7
12
  export declare const ChatInput: React.FC<ChatInputProps>;
8
13
  export {};
@@ -1,5 +1,8 @@
1
1
  import React from "react";
2
- export declare function safeHref(value: string): string | undefined;
2
+ import type { Source } from "../api/chatbot-types";
3
+ export { safeHref } from "../../lib/safeHref";
3
4
  export declare const ChatMarkdown: React.NamedExoticComponent<{
4
5
  text: string;
6
+ streaming?: boolean;
7
+ sources?: Source[];
5
8
  }>;
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import type { ChatMessage } from "../api/chatbot-types";
3
3
  interface ChatMessageProps {
4
4
  message: ChatMessage;
5
+ onEdit?: (text: string) => void;
5
6
  }
6
7
  export declare const ChatMessageBubble: React.FC<ChatMessageProps>;
7
8
  export {};
@@ -0,0 +1,7 @@
1
+ import type { ChatMessage, MessageFeedback } from "../api/chatbot-types";
2
+ interface ChatMessageActionsProps {
3
+ message: ChatMessage;
4
+ onFeedback: (messageId: string, feedback: MessageFeedback) => void;
5
+ }
6
+ export declare function ChatMessageActions({ message, onFeedback }: ChatMessageActionsProps): import("react").JSX.Element;
7
+ export {};
@@ -1,2 +1,4 @@
1
1
  import React from "react";
2
- export declare const ChatMessageList: React.FC;
2
+ export declare const ChatMessageList: React.FC<{
3
+ onEdit?: (text: string) => void;
4
+ }>;
@@ -23,9 +23,9 @@ export interface ChatProviderProps {
23
23
  proxyUrl?: string;
24
24
  /** Optional custom chat API client */
25
25
  api?: ChatApiClient;
26
- /** If true, hides the "Inspect Sources" toggle and details drawer */
26
+ /** Hide inline previews and the source list's inspection controls. */
27
27
  hideInspectSources?: boolean;
28
- /** Whether to render grounded sources (default: true) */
28
+ /** Whether to render grounded sources (default: false) */
29
29
  showGroundedSources?: boolean;
30
30
  /** Configured model alias, or auto for server-side routing. */
31
31
  modelId?: string;
@@ -1,5 +1,10 @@
1
1
  import React from "react";
2
2
  import type { Source } from "../api/chatbot-types";
3
+ export declare function getRouteHint(sourcePath: string): {
4
+ label: string;
5
+ path: string;
6
+ } | null;
7
+ export declare function formatDocTitle(source: Source): string;
3
8
  export interface GroundedSourcesProps {
4
9
  sources: Source[];
5
10
  /** If true, hides the "Inspect Sources" toggle button and details list */
@@ -31,9 +31,9 @@ export interface EmbeddedChatbotProps {
31
31
  disableSuggestions?: boolean;
32
32
  /** Initial welcome message to trigger on mount */
33
33
  initialMessage?: string;
34
- /** If true, hides the "Inspect Sources" toggle button and drawer in grounded sources */
34
+ /** Hide inline previews and the source list's inspection controls. */
35
35
  hideInspectSources?: boolean;
36
- /** Whether to show grounded sources (default: true) */
36
+ /** Whether to show grounded sources (default: false) */
37
37
  showGroundedSources?: boolean;
38
38
  modelId?: string;
39
39
  }
@@ -0,0 +1,4 @@
1
+ export declare function useCopyText(): {
2
+ status: "idle" | "copying" | "copied" | "failed";
3
+ copy: (text: string) => Promise<void>;
4
+ };
@@ -0,0 +1,6 @@
1
+ export declare function useResponseSound(): {
2
+ soundEnabled: boolean;
3
+ toggleSound: () => void;
4
+ prepareSound: () => void;
5
+ playSound: () => void;
6
+ };
@@ -6,5 +6,5 @@ export { ChatbotWidget, type ChatbotWidgetProps } from "./widget/ChatbotWidget";
6
6
  export { EmbeddedChatbot, type EmbeddedChatbotProps } from "./embedded/EmbeddedChatbot";
7
7
  export { chatApi, createChatApi, buildApiUrl, resolveApiBaseUrl, type ChatApiClient, } from "./api/chatbot-api";
8
8
  export { ColorPalette } from "./config/colors";
9
- export type { ChatUserContext, ChatAccessContext, ChatMessage, Suggestion, Ticket, Source, ToolCall, TokenUsage, ChatRole, MessageStatus, ModelOption, ModelCatalog, } from "./api/chatbot-types";
9
+ export type { ChatUserContext, ChatAccessContext, ChatMessage, Suggestion, Ticket, Source, ToolCall, TokenUsage, ChatRole, MessageStatus, MessageFeedback, ModelOption, ModelCatalog, } from "./api/chatbot-types";
10
10
  export type { EnvStage } from "../components/EnvBadge";
@@ -30,9 +30,9 @@ export interface ChatbotWidgetProps {
30
30
  disableSuggestions?: boolean;
31
31
  /** Initial welcome message to trigger on mount */
32
32
  initialMessage?: string;
33
- /** If true, hides the "Inspect Sources" toggle button and drawer in grounded sources */
33
+ /** Hide inline previews and the source list's inspection controls. */
34
34
  hideInspectSources?: boolean;
35
- /** Whether to show grounded sources (default: true) */
35
+ /** Whether to show grounded sources (default: false) */
36
36
  showGroundedSources?: boolean;
37
37
  modelId?: string;
38
38
  }
@@ -0,0 +1,52 @@
1
+ import { type ComponentProps } from "react";
2
+ import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
3
+ import { type ButtonProps } from "../ui/button";
4
+ import { HoverCard, HoverCardContent } from "../ui/hover-card";
5
+ export type InlineCitationProps = ComponentProps<"span">;
6
+ export declare function InlineCitation({ className, ...props }: InlineCitationProps): import("react").JSX.Element;
7
+ export type InlineCitationTextProps = ComponentProps<"span">;
8
+ export declare function InlineCitationText(props: InlineCitationTextProps): import("react").JSX.Element;
9
+ export type InlineCitationCardProps = ComponentProps<typeof HoverCard> & {
10
+ openDelay?: number;
11
+ closeDelay?: number;
12
+ };
13
+ export declare function InlineCitationCard({ handle, onOpenChange, openDelay, closeDelay, ...props }: InlineCitationCardProps): import("react").JSX.Element;
14
+ export type InlineCitationCardTriggerProps = Omit<ButtonProps, "render"> & {
15
+ sources: string[];
16
+ delay?: number;
17
+ closeDelay?: number;
18
+ };
19
+ export declare function InlineCitationCardTrigger({ sources, delay, closeDelay, id, children, onClick, ...props }: InlineCitationCardTriggerProps): import("react").JSX.Element;
20
+ export type InlineCitationCardBodyProps = ComponentProps<typeof HoverCardContent>;
21
+ export declare function InlineCitationCardBody({ ref, onBlur, ...props }: InlineCitationCardBodyProps): import("react").JSX.Element;
22
+ type EmblaApi = NonNullable<UseEmblaCarouselType[1]>;
23
+ type EmblaOptions = NonNullable<Parameters<typeof useEmblaCarousel>[0]>;
24
+ type EmblaPlugins = NonNullable<Parameters<typeof useEmblaCarousel>[1]>;
25
+ export type InlineCitationCarouselProps = ComponentProps<"div"> & {
26
+ opts?: EmblaOptions;
27
+ plugins?: EmblaPlugins;
28
+ orientation?: "horizontal" | "vertical";
29
+ setApi?: (api: EmblaApi) => void;
30
+ };
31
+ export declare function InlineCitationCarousel({ opts, plugins, orientation, setApi, className, ...props }: InlineCitationCarouselProps): import("react").JSX.Element;
32
+ export type InlineCitationCarouselContentProps = ComponentProps<"div">;
33
+ export declare function InlineCitationCarouselContent({ className, ...props }: InlineCitationCarouselContentProps): import("react").JSX.Element;
34
+ export type InlineCitationCarouselItemProps = ComponentProps<"div">;
35
+ export declare function InlineCitationCarouselItem({ className, ...props }: InlineCitationCarouselItemProps): import("react").JSX.Element;
36
+ export type InlineCitationCarouselHeaderProps = ComponentProps<"div">;
37
+ export declare function InlineCitationCarouselHeader({ className, ...props }: InlineCitationCarouselHeaderProps): import("react").JSX.Element;
38
+ export type InlineCitationCarouselIndexProps = ComponentProps<"div">;
39
+ export declare function InlineCitationCarouselIndex({ children, ...props }: InlineCitationCarouselIndexProps): import("react").JSX.Element;
40
+ export type InlineCitationCarouselPrevProps = ButtonProps;
41
+ export declare function InlineCitationCarouselPrev(props: InlineCitationCarouselPrevProps): import("react").JSX.Element;
42
+ export type InlineCitationCarouselNextProps = ButtonProps;
43
+ export declare function InlineCitationCarouselNext(props: InlineCitationCarouselNextProps): import("react").JSX.Element;
44
+ export type InlineCitationSourceProps = ComponentProps<"div"> & {
45
+ title?: string;
46
+ url?: string;
47
+ description?: string;
48
+ };
49
+ export declare function InlineCitationSource({ title, url, description, className, children, ...props }: InlineCitationSourceProps): import("react").JSX.Element;
50
+ export type InlineCitationQuoteProps = ComponentProps<"blockquote">;
51
+ export declare function InlineCitationQuote({ className, ...props }: InlineCitationQuoteProps): import("react").JSX.Element;
52
+ export {};
@@ -0,0 +1,21 @@
1
+ import { type ComponentProps, type ReactNode } from "react";
2
+ import { TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger } from "../ui/trace";
3
+ export declare function useReasoning(): {
4
+ isStreaming: boolean;
5
+ isOpen: boolean;
6
+ setIsOpen: (open: boolean) => void;
7
+ duration?: number;
8
+ };
9
+ export type ReasoningProps = ComponentProps<typeof TraceCollapsible> & {
10
+ isStreaming?: boolean;
11
+ duration?: number;
12
+ };
13
+ export declare function Reasoning({ isStreaming, open, defaultOpen, onOpenChange, duration, className, ...props }: ReasoningProps): import("react").JSX.Element;
14
+ export type ReasoningTriggerProps = ComponentProps<typeof TraceCollapsibleTrigger> & {
15
+ getThinkingMessage?: (isStreaming: boolean, duration?: number) => ReactNode;
16
+ icon?: ReactNode;
17
+ description?: ReactNode;
18
+ };
19
+ export declare function ReasoningTrigger({ getThinkingMessage, children, icon, description, ...props }: ReasoningTriggerProps): import("react").JSX.Element;
20
+ export type ReasoningContentProps = ComponentProps<typeof TraceCollapsibleContent>;
21
+ export declare function ReasoningContent({ children, className, ...props }: ReasoningContentProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import type { ComponentProps } from "react";
2
+ import { type ButtonProps } from "../ui/button";
3
+ export type SuggestionsProps = ComponentProps<"div">;
4
+ export declare function Suggestions({ className, ...props }: SuggestionsProps): import("react").JSX.Element;
5
+ export type SuggestionProps = Omit<ButtonProps, "onClick"> & {
6
+ suggestion: string;
7
+ onClick?: (suggestion: string) => void;
8
+ };
9
+ export declare function Suggestion({ suggestion, onClick, children, className, variant, size, ...props }: SuggestionProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { ComponentProps } from "react";
2
+ export declare function Bubble({ align, variant, className, ...props }: ComponentProps<"div"> & {
3
+ align?: "start" | "end";
4
+ variant?: "muted" | "destructive";
5
+ }): import("react").JSX.Element;
6
+ export declare function BubbleContent({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ export declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "link" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
5
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export type ButtonProps = ButtonPrimitive.Props & VariantProps<typeof buttonVariants>;
8
+ export declare function Button({ className, variant, size, ...props }: ButtonProps): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { PreviewCard } from "@base-ui/react/preview-card";
2
+ export declare const createHoverCardHandle: typeof PreviewCard.createHandle;
3
+ export declare function HoverCard(props: PreviewCard.Root.Props): import("react").JSX.Element;
4
+ export declare function HoverCardTrigger(props: PreviewCard.Trigger.Props): import("react").JSX.Element;
5
+ export declare function HoverCardContent({ className, side, sideOffset, align, alignOffset, ...props }: PreviewCard.Popup.Props & Pick<PreviewCard.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { ComponentProps } from "react";
2
+ export declare function InputGroup({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
3
+ export declare function InputGroupTextarea({ className, ...props }: ComponentProps<"textarea">): import("react").JSX.Element;
4
+ export declare function InputGroupAddon({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
5
+ export declare function InputGroupButton({ className, ...props }: ComponentProps<"button">): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { ComponentProps } from "react";
2
+ export declare function Marker({ className, variant, ...props }: ComponentProps<"div"> & {
3
+ variant?: "default" | "border" | "separator";
4
+ }): import("react").JSX.Element;
5
+ export declare function MarkerIcon({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
6
+ export declare function MarkerContent({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { ComponentProps } from "react";
2
+ export declare function Message({ align, className, ...props }: ComponentProps<"div"> & {
3
+ align?: "start" | "end";
4
+ }): import("react").JSX.Element;
5
+ export declare function MessageAvatar({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
6
+ export declare function MessageContent({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
7
+ export declare function MessageHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
8
+ export declare function MessageFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import type { ComponentProps } from "react";
2
+ import { Collapsible } from "@base-ui/react/collapsible";
3
+ export declare function Trace({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
4
+ export declare function TraceLine({ className, status, ...props }: ComponentProps<"span"> & {
5
+ status?: "running" | "error" | "pending";
6
+ }): import("react").JSX.Element;
7
+ export declare function TraceIcon({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
8
+ export declare function TraceTitle({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
9
+ export declare function TraceDescription({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
10
+ export declare function TraceCollapsible(props: Omit<Collapsible.Root.Props, "className" | "onOpenChange"> & {
11
+ className?: string;
12
+ onOpenChange?: (open: boolean) => void;
13
+ }): import("react").JSX.Element;
14
+ export declare function TraceCollapsibleTrigger({ children, className, ...props }: Omit<Collapsible.Trigger.Props, "className"> & {
15
+ className?: string;
16
+ }): import("react").JSX.Element;
17
+ export declare function TraceCollapsibleContent({ className, ...props }: Omit<Collapsible.Panel.Props, "className"> & {
18
+ className?: string;
19
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function safeHref(value: string): string | undefined;