@paymanai/payman-ask-sdk 2.0.6 → 4.0.1

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/index.d.mts CHANGED
@@ -1,8 +1,7 @@
1
- import * as React$1 from 'react';
1
+ import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { ChatCallbacks as ChatCallbacks$1, BaseChatConfig, MessageDisplay, WorkflowStage, StreamProgress, StreamingStep, UserActionRequest, SessionSummary } from '@paymanai/payman-typescript-ask-sdk';
4
- export { APIConfig, BaseChatConfig, ChunkDisplay, ConversationEntry, ConversationListResponse, MessageDisplay, MessageRole, PageInfo, SessionListResponse, SessionOwner, SessionSummary, StreamEvent, StreamOptions, StreamProgress, StreamingStep, UseChatV2Return, UseVoiceReturn, UserActionRequest, UserActionResult, UserActionState, UserActionType, V2EventProcessorState, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceResult, VoiceState, WorkflowStage, buildFormattedThinking, buildScopeKey, cancelUserAction, createInitialV2State, generateId, listConversations, listSessions, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChatV2, useVoice } from '@paymanai/payman-typescript-ask-sdk';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { MessageDisplay, AgentStage, ChatCallbacks as ChatCallbacks$1, ChatConfig as ChatConfig$1, StreamProgress, StreamingStep, UserActionRequest } from '@paymanai/payman-typescript-ask-sdk';
4
+ export { APIConfig, AgentStage, ChunkDisplay, MessageDisplay, MessageRole, SessionParams, StreamEvent, StreamOptions, StreamProgress, StreamingStep, UseChatV2Return, UseVoiceReturn, UserActionRequest, UserActionResult, UserActionState, UserActionType, V2EventProcessorState, VoiceCallbacks, VoiceConfig, VoicePermissions, VoiceResult, VoiceState, buildFormattedThinking, cancelUserAction, createInitialV2State, generateId, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChatV2, useVoice } from '@paymanai/payman-typescript-ask-sdk';
6
5
  import { ClassValue } from 'clsx';
7
6
 
8
7
  type UserMessageActionsConfig = {
@@ -18,189 +17,266 @@ type AssistantMessageActionsConfig = {
18
17
  copy?: boolean;
19
18
  /** Show trace action on assistant messages (default: true, still requires callback) */
20
19
  trace?: boolean;
20
+ /** Show thumbs-up feedback button (default: true) */
21
+ thumbsUp?: boolean;
22
+ /** Show thumbs-down feedback button (default: true) */
23
+ thumbsDown?: boolean;
21
24
  };
22
25
  type MessageActionsConfig = {
23
26
  userMessageActions?: UserMessageActionsConfig;
24
27
  assistantMessageActions?: AssistantMessageActionsConfig;
25
28
  };
26
- type ChatAvailability = {
27
- state: "ready";
28
- } | {
29
- state: "readOnly";
30
- } | {
31
- state: "disabled";
32
- reason?: React__default.ReactNode;
29
+ type SlashCommandConfig = {
30
+ /** Slash command token, including the leading slash. Example: /draft-knowledge */
31
+ name: string;
32
+ /** One-line description shown in autocomplete. */
33
+ description: string;
34
+ /** Text inserted into the input. Defaults to `${name} `. */
35
+ insertText?: string;
36
+ /** Show only when at least one permission is present. */
37
+ requiredAnyPermissions?: string[];
33
38
  };
34
- type VoiceOptions = {
35
- /** Default: "en-US" */
36
- lang?: string;
37
- /** Default: true */
38
- interimResults?: boolean;
39
- /** Default: true */
40
- continuous?: boolean;
41
- };
42
- type SessionHistoryOptions = {
43
- /** Desktop sidebar default width in px. Default: 260 */
44
- defaultWidth?: number;
45
- /** Default: 220 */
46
- minWidth?: number;
47
- /** Default: 440 */
48
- maxWidth?: number;
49
- /** Desktop only. Default: false */
50
- defaultCollapsed?: boolean;
51
- /** Page size for listSessions. Default: 20 */
52
- pageSize?: number;
53
- /** localStorage key for width + collapsed. Default: `payman-chat-sidebar:${workflow.id}` */
54
- persistKey?: string;
55
- /** Show a sidebar "New Session" button wired to the chat reset flow. Default: false */
56
- showNewSessionButton?: boolean;
57
- };
58
- type EmptyStatePromptCategory = {
59
- /** Label shown in the category bubble, e.g. "Account". Also used as the accessible name for the prompt group. */
60
- label: string;
61
- /** Optional icon rendered before the label in the category bubble. */
62
- icon?: React__default.ReactNode;
63
- /** Prompt strings; clicking sends the string verbatim. Array order is preserved as render order. */
64
- prompts: string[];
65
- };
66
- type EmptyStateSuggestionsConfig = {
67
- /** Default: true. Pass false to hide bubbles without removing data. */
68
- enabled?: boolean;
69
- /** Optional heading above categories. Falls back to ui.emptyState.text. */
70
- title?: string;
39
+ type ChatConfig = ChatConfig$1 & {
40
+ /** Custom React component to render above the empty state text (e.g. logo, illustration). */
41
+ emptyStateComponent?: React__default.ReactNode;
42
+ /** Enable voice input (default: true) */
43
+ enableVoice?: boolean;
44
+ /** Voice language (default: "en-US") */
45
+ voiceLang?: string;
46
+ /** Voice interim results (default: true) */
47
+ voiceInterimResults?: boolean;
48
+ /** Voice continuous mode (default: true) */
49
+ voiceContinuous?: boolean;
50
+ /** Show a "New Session" reset button inside the input bar (default: false) */
51
+ showResetSession?: boolean;
52
+ /** Show the v2 attachment (+) menu button in the input bar (default: true) */
53
+ showAttachmentButton?: boolean;
54
+ /** Show the v2 "Upload image" attachment option (default: true) */
55
+ showUploadImageButton?: boolean;
56
+ /** Show the v2 "Attach file" attachment option (default: true) */
57
+ showAttachFileButton?: boolean;
58
+ /** Configure which per-message actions are visible in the v2 UI */
59
+ messageActions?: MessageActionsConfig;
60
+ /** Enable slash command autocomplete in the chat input. Default: true. */
61
+ enableSlashCommands?: boolean;
62
+ /** Optional command list. Defaults to Knowledge Vault's /draft-knowledge command. */
63
+ slashCommands?: SlashCommandConfig[];
64
+ /** Current caller permissions used to hide commands they cannot run. */
65
+ commandPermissions?: string[];
66
+ /** Sentry DSN for error monitoring. */
67
+ sentryDsn?: string;
71
68
  /**
72
- * Categories rendered in array order. Apps that need environment-specific
73
- * categories (e.g. internal-only "SIMULATION TOOLS") should filter this
74
- * array on the consumer side the SDK has no notion of dev/prod and will
75
- * render exactly what is passed.
69
+ * UI version to render.
70
+ * 1 = original component set
71
+ * 2 = redesigned chat UI (ChatGPT-style with thinking blocks, inline verification, etc.) default
76
72
  */
77
- categories: EmptyStatePromptCategory[];
78
- };
79
- type ChatUIConfig = {
80
- layout?: "centered" | "full-width";
73
+ uiVersion?: 1 | 2;
81
74
  /**
82
- * Color scheme for the React Native chat surface.
83
- * Web styling continues to follow Tailwind. Default: "light".
75
+ * Speed multiplier for the assistant typing-reveal animation in the v2 UI.
76
+ * 1 = leisurely "human reading" pace
77
+ * 2 = default (snappy but still animated)
78
+ * 4 = near-instant trickle
79
+ * 0.5 = half speed
80
+ * 0 = disable the animation entirely (reveal text instantly as it arrives)
81
+ *
82
+ * Clamped to a minimum of 0.1 when non-zero to avoid division blow-ups.
83
+ * Default: 2.
84
84
  */
85
- theme?: "light" | "dark";
85
+ typingSpeed?: number;
86
86
  /**
87
- * Accent / brand color used by the native chat UI (send button, hero,
88
- * focused border, etc). Defaults to Payman teal `#00858d`.
87
+ * Custom loading animation shown next to the streaming stage label.
88
+ * Accepts any URL that @lottiefiles/dotlottie-react can load — both
89
+ * `.lottie` and `.json` (Lottie format) work. Point this at a
90
+ * LottieFiles free animation, a self-hosted `.lottie` file, or any
91
+ * CDN-hosted URL.
92
+ *
93
+ * When unset the v2 UI falls back to a small 12-point SVG asterisk
94
+ * that spins and pulses — zero-dependency, always works, looks fine.
95
+ * Consumers who want a branded animation (e.g. the Payman logo
96
+ * pulse, a specific LottieFiles loader) set this.
89
97
  */
90
- accent?: string;
91
- agent?: {
92
- /** Default: "Assistant" */
93
- name?: string;
94
- /** Default: true */
95
- showName?: boolean;
96
- };
97
- emptyState?: {
98
- /** Default: "What can I help with?" */
99
- text?: string;
100
- /**
101
- * Small line above the main empty-state text (e.g. "Hi, Mike").
102
- * Native only — web ignores this for now.
103
- */
104
- eyebrow?: string;
105
- /** Default: true */
106
- icon?: boolean;
107
- /** Custom React node rendered above the empty-state text */
108
- content?: React__default.ReactNode;
109
- /** Custom logo element rendered in the empty state (native only). Replaces the default HeroMark. */
110
- logo?: React__default.ReactNode;
111
- /** Optional app-provided prompt bubbles rendered by the SDK. */
112
- suggestions?: EmptyStateSuggestionsConfig;
113
- };
114
- input?: {
115
- /** Default: "Type your message..." */
116
- placeholder?: string;
117
- /** Default: false */
118
- showResetButton?: boolean;
119
- /**
120
- * `true` (default) shows all attachment options, `false` hides the menu entirely.
121
- * Pass an object to toggle individual options.
122
- */
123
- attachments?: boolean | {
124
- uploadImage?: boolean;
125
- attachFile?: boolean;
126
- };
127
- /** `true` enables voice with defaults. Pass an object to customize lang/interim/continuous. */
128
- voice?: boolean | VoiceOptions;
129
- };
130
- messages?: {
131
- /** `true` shows both sides; `false` hides both; pass object for per-role control. */
132
- avatars?: boolean | {
133
- user?: boolean;
134
- assistant?: boolean;
135
- };
136
- /** Default: false */
137
- timestamps?: boolean;
138
- /** Default: true */
139
- streamingDot?: boolean;
140
- actions?: MessageActionsConfig;
141
- };
142
- execution?: {
143
- /** Default: true */
144
- showSteps?: boolean;
145
- /** Default: "Completed in {time}s ({count} steps)" */
146
- completedLabel?: string;
147
- /** Default: "View progress ({count} steps)" */
148
- streamingLabel?: string;
149
- };
150
- /** `true` enables the session-history sidebar with defaults; pass an object to customize. */
151
- sessionHistory?: boolean | SessionHistoryOptions;
152
- };
153
- type ChatConfig = BaseChatConfig & {
154
- availability?: ChatAvailability;
155
- ui?: ChatUIConfig;
156
- observability?: {
157
- sentryDsn?: string;
98
+ loadingAnimation?: {
99
+ /** Fully-qualified URL to a `.lottie` or Lottie `.json` file. */
100
+ src: string;
101
+ /** Rendered size in pixels. Defaults to 18 to match the default SVG spinner. */
102
+ size?: number;
158
103
  };
159
104
  };
160
105
  type ChatCallbacks = ChatCallbacks$1 & {
106
+ /** Called when the session is reset (via SDK reset button or ref.resetSession()) */
161
107
  onResetSession?: () => void;
108
+ /** Called when the v2 "Upload image" attachment option is clicked */
162
109
  onUploadImageClick?: () => void;
110
+ /** Called when the v2 "Attach file" attachment option is clicked */
163
111
  onAttachFileClick?: () => void;
112
+ /** Called when the user gives thumbs-up/down feedback on a message */
113
+ onMessageFeedback?: (data: {
114
+ messageId: string;
115
+ feedback: "up" | "down";
116
+ }) => void;
164
117
  };
165
118
  type PaymanChatRef = {
119
+ /** Clear all messages and reset the session (clears both stores + generates new session ID) */
166
120
  resetSession: () => void;
121
+ /** Clear all messages without resetting session ID */
167
122
  clearMessages: () => void;
123
+ /** Cancel the current streaming operation */
168
124
  cancelStream: () => void;
125
+ /** Get the current session ID */
169
126
  getSessionId: () => string | undefined;
127
+ /** Get all messages */
170
128
  getMessages: () => MessageDisplay[];
171
- /** Replace the active chat with a prior session's history. */
172
- loadSession: (sessionId: string) => Promise<void>;
173
129
  };
174
130
  type PaymanChatProps = {
131
+ /** Chat configuration - includes API config */
175
132
  config: ChatConfig;
133
+ /** Callbacks for events */
176
134
  callbacks?: ChatCallbacks;
135
+ /** Custom class name */
177
136
  className?: string;
137
+ /** Custom style */
178
138
  style?: React__default.CSSProperties;
139
+ /** Custom children to render (e.g., header) */
179
140
  children?: React__default.ReactNode;
180
141
  /** Called when the user scrolls to the top — use to load older messages */
181
142
  onLoadMoreMessages?: () => void;
143
+ /** Show a loading spinner at the top of the list while fetching older messages */
144
+ isLoadingMoreMessages?: boolean;
145
+ /** Whether there are more messages to load (hides the spinner/trigger when false) */
146
+ hasMoreMessages?: boolean;
147
+ };
148
+ type ChatInputProps = {
149
+ /** Input value */
150
+ value: string;
151
+ /** On change handler */
152
+ onChange: (value: string) => void;
153
+ /** On send handler */
154
+ onSend: () => void;
155
+ /** On pause/cancel handler */
156
+ onPause?: () => void;
157
+ /** Disabled state */
158
+ disabled?: boolean;
159
+ /** Placeholder text */
160
+ placeholder?: string;
161
+ /** Is waiting for response */
162
+ isWaitingForResponse?: boolean;
163
+ /** Has selected session */
164
+ hasSelectedSession?: boolean;
165
+ /** Is session params configured */
166
+ isSessionParamsConfigured?: boolean;
167
+ /** On input click handler */
168
+ onClick?: () => void;
169
+ /** Input style variant */
170
+ inputStyle?: "rounded" | "flat";
171
+ /** Layout style */
172
+ layout?: "centered" | "full-width";
173
+ /** Custom class name */
174
+ className?: string;
175
+ /** Enable voice input in the chat input. When false, voice button is hidden. */
176
+ enableVoice?: boolean;
177
+ /** Voice button handler */
178
+ onVoicePress?: () => void;
179
+ /** Is voice available (e.g. speech recognition ready) */
180
+ voiceAvailable?: boolean;
181
+ /** Is currently recording voice */
182
+ isRecording?: boolean;
183
+ /** Recording duration in seconds (for voice bar timer) */
184
+ recordingDurationSeconds?: number;
185
+ /** Confirm voice recording (stop and apply transcript to input) */
186
+ onConfirmRecording?: () => void;
187
+ /** Cancel voice recording (stop without applying transcript) */
188
+ onCancelRecording?: () => void;
189
+ /** Live transcript while recording (used to animate waveforms only when user is talking) */
190
+ transcribedText?: string;
191
+ /** Show a reset/new session button in the input bar */
192
+ showResetSession?: boolean;
193
+ /** Handler called when the reset session button is clicked */
194
+ onResetSession?: () => void;
195
+ /** Show the attachment (+) menu button */
196
+ showAttachmentButton?: boolean;
197
+ /** Show the "Upload image" attachment option */
198
+ showUploadImageButton?: boolean;
199
+ /** Show the "Attach file" attachment option */
200
+ showAttachFileButton?: boolean;
201
+ /** Handler called when the "Upload image" option is clicked */
202
+ onUploadImageClick?: () => void;
203
+ /** Handler called when the "Attach file" option is clicked */
204
+ onAttachFileClick?: () => void;
205
+ };
206
+ type MessageListProps = {
207
+ /** Messages to display */
208
+ messages: MessageDisplay[];
209
+ /** Loading state */
210
+ isLoading?: boolean;
211
+ /** Empty state text */
212
+ emptyStateText?: string;
213
+ /** Show icon in empty state */
214
+ showEmptyStateIcon?: boolean;
215
+ /** Custom React component to render above the empty state text */
216
+ emptyStateComponent?: React__default.ReactNode;
217
+ /** Layout style */
218
+ layout?: "centered" | "full-width";
219
+ /** Show timestamps on messages */
220
+ showTimestamps?: boolean;
221
+ /** Stage */
222
+ stage?: AgentStage;
223
+ /** Animated */
224
+ animated?: boolean;
225
+ /** Show agent name */
226
+ showAgentName?: boolean;
227
+ /** Agent name */
228
+ agentName?: string;
229
+ /** Show avatars */
230
+ showAvatars?: boolean;
231
+ /** Show user avatar only (overrides showAvatars) */
232
+ showUserAvatar?: boolean;
233
+ /** Show assistant avatar only (overrides showAvatars) */
234
+ showAssistantAvatar?: boolean;
235
+ /** Show execution steps */
236
+ showExecutionSteps?: boolean;
237
+ /** Show streaming dot */
238
+ showStreamingDot?: boolean;
239
+ /** Custom streaming steps text */
240
+ streamingStepsText?: string;
241
+ /** Custom completed steps text */
242
+ completedStepsText?: string;
243
+ /** On execution trace click */
244
+ onExecutionTraceClick?: (data: {
245
+ message: MessageDisplay;
246
+ tracingData?: unknown;
247
+ executionId?: string;
248
+ }) => void;
249
+ /** Custom class name */
250
+ className?: string;
251
+ /** Called when the user scrolls to the top — use to load older messages */
252
+ onLoadMoreMessages?: () => void;
253
+ /** Show a loading spinner at the top while fetching older messages */
182
254
  isLoadingMoreMessages?: boolean;
255
+ /** Whether there are more messages to load */
183
256
  hasMoreMessages?: boolean;
184
257
  };
185
258
  type MessageListV2Props = {
259
+ /** Messages to display */
186
260
  messages: MessageDisplay[];
261
+ /** Whether an assistant response is currently streaming */
187
262
  isStreaming?: boolean;
188
- /**
189
- * When true, the messages area shows a centered activity indicator
190
- * instead of the (empty) message list. Used while the conversation
191
- * history for a session is being fetched.
192
- */
193
- isLoadingSession?: boolean;
263
+ /** Edit a user message */
194
264
  onEditUserMessage?: (messageId: string) => void;
265
+ /** Retry a user message */
195
266
  onRetryUserMessage?: (messageId: string) => void;
267
+ /** Open a markdown image */
196
268
  onImageClick?: (src: string, alt: string) => void;
269
+ /** Execution trace click handler */
197
270
  onExecutionTraceClick?: (data: {
198
271
  message: MessageDisplay;
199
272
  tracingData?: unknown;
200
273
  executionId?: string;
201
274
  }) => void;
275
+ /** Which message actions are visible */
202
276
  messageActions?: MessageActionsConfig;
277
+ /** Disable retry/resend actions while the chat is busy */
203
278
  retryDisabled?: boolean;
279
+ /** Current user action card */
204
280
  userAction?: {
205
281
  messageId: string;
206
282
  action: {
@@ -210,157 +286,229 @@ type MessageListV2Props = {
210
286
  payeeName?: string;
211
287
  };
212
288
  status: "pending" | "verifying" | "approved" | "rejected" | "error";
213
- clearOtpTrigger?: number;
214
289
  } | null;
290
+ /** Approve a user action */
215
291
  onApproveAction?: (messageId: string, otp: string) => Promise<void>;
292
+ /** Reject a user action */
216
293
  onRejectAction?: (messageId: string) => Promise<void>;
294
+ /** Resend a user action */
217
295
  onResendAction?: (messageId: string) => Promise<void>;
296
+ /** Called when the user gives thumbs-up/down feedback */
297
+ onMessageFeedback?: (data: {
298
+ messageId: string;
299
+ feedback: "up" | "down";
300
+ }) => void;
301
+ /**
302
+ * Speed multiplier for the typing-reveal animation.
303
+ * 1 = default, 2 = 2x faster, 0.5 = half speed, 0 = instant reveal.
304
+ */
305
+ typingSpeed?: number;
306
+ };
307
+ type MessageRowProps = {
308
+ /** Message to display */
309
+ message: MessageDisplay;
310
+ /** Stage */
311
+ stage?: AgentStage;
312
+ /** Animated */
313
+ animated?: boolean;
314
+ /** Show agent name */
315
+ showAgentName?: boolean;
316
+ /** Agent name */
317
+ agentName?: string;
318
+ /** Show avatars */
319
+ showAvatars?: boolean;
320
+ /** Show user avatar only (overrides showAvatars) */
321
+ showUserAvatar?: boolean;
322
+ /** Show assistant avatar only (overrides showAvatars) */
323
+ showAssistantAvatar?: boolean;
324
+ /** Layout style */
325
+ layout?: "centered" | "full-width";
326
+ /** Show timestamps on messages */
327
+ showTimestamps?: boolean;
328
+ /** Show execution steps */
329
+ showExecutionSteps?: boolean;
330
+ /** Show streaming dot */
331
+ showStreamingDot?: boolean;
332
+ /** Custom streaming steps text */
333
+ streamingStepsText?: string;
334
+ /** Custom completed steps text */
335
+ completedStepsText?: string;
336
+ /** On execution trace click */
337
+ onExecutionTraceClick?: (data: {
338
+ message: MessageDisplay;
339
+ tracingData?: unknown;
340
+ executionId?: string;
341
+ }) => void;
342
+ };
343
+ type UserMessageProps = {
344
+ /** Message to display */
345
+ message: MessageDisplay;
346
+ /** Animated */
347
+ animated?: boolean;
348
+ /** Show avatar */
349
+ showAvatar?: boolean;
350
+ };
351
+ type AgentMessageProps = {
352
+ /** Message to display */
353
+ message: MessageDisplay;
354
+ /** Stage */
355
+ stage?: AgentStage;
356
+ /** Animated */
357
+ animated?: boolean;
358
+ /** Show agent name */
359
+ showAgentName?: boolean;
360
+ /** Agent name */
361
+ agentName?: string;
362
+ /** Show avatar */
363
+ showAvatar?: boolean;
364
+ /** Layout style */
365
+ layout?: "centered" | "full-width";
366
+ /** Show timestamp */
367
+ showTimestamp?: boolean;
368
+ /** Show execution steps */
369
+ showExecutionSteps?: boolean;
370
+ /** Show streaming dot */
371
+ showStreamingDot?: boolean;
372
+ /** Custom streaming steps text */
373
+ streamingStepsText?: string;
374
+ /** Custom completed steps text */
375
+ completedStepsText?: string;
376
+ /** On execution trace click */
377
+ onExecutionTraceClick?: (data: {
378
+ message: MessageDisplay;
379
+ tracingData?: unknown;
380
+ executionId?: string;
381
+ }) => void;
218
382
  };
219
383
  type StreamingMessageProps = {
384
+ /** Streaming content */
220
385
  content: string;
386
+ /** Is currently streaming */
221
387
  isStreaming: boolean;
388
+ /** Current worker */
222
389
  currentWorker?: string;
390
+ /** Current message */
223
391
  currentMessage?: string;
392
+ /** Stream progress */
224
393
  streamProgress: StreamProgress;
394
+ /** "WORKFLOW_FAILED" and "STREAM_NOT_STARTED" show the friendly fallback; HTTP 409 conflicts render the backend message from the error payload. */
225
395
  error?: string;
396
+ /** Streaming steps */
226
397
  steps?: StreamingStep[];
227
398
  };
228
399
  type ChatHeaderProps = {
400
+ /** Session ID */
229
401
  sessionId?: string;
402
+ /** On copy session ID */
230
403
  onCopySessionId?: (sessionId: string) => void;
404
+ /** On load session click */
405
+ onLoadSession?: () => void;
406
+ /** On new session click */
231
407
  onNewSession?: () => void;
408
+ /** On session params click */
409
+ onSessionParamsClick?: () => void;
410
+ /** Show load session button */
411
+ showLoadSession?: boolean;
412
+ /** Show reset session button */
232
413
  showResetSession?: boolean;
233
- /** Render a hamburger button on the left that toggles the session-history sidebar on mobile. */
234
- onToggleSidebar?: () => void;
414
+ /** Show session params button */
415
+ showSessionParams?: boolean;
416
+ /** Show session params tooltip */
417
+ showSessionParamsTooltip?: boolean;
418
+ /** Session params button ref */
419
+ sessionParamsButtonRef?: React__default.RefObject<HTMLButtonElement | null> | undefined;
420
+ /** Custom children */
235
421
  children?: React__default.ReactNode;
422
+ /** Custom class name */
236
423
  className?: string;
237
424
  };
238
425
  type OtpInputProps = {
426
+ /** Current OTP value */
239
427
  value: string;
428
+ /** Called with new OTP value */
240
429
  onChange: (value: string) => void;
430
+ /** Number of digit boxes */
241
431
  maxLength: number;
432
+ /** Disabled state */
242
433
  disabled?: boolean;
434
+ /** Transient error state — triggers red borders + shake */
243
435
  error?: boolean;
244
436
  };
245
437
  type UserActionModalProps = {
438
+ /** Whether the modal is open */
246
439
  isOpen: boolean;
440
+ /** User action request data from the stream */
247
441
  userActionRequest: UserActionRequest | null;
442
+ /** Submit OTP */
248
443
  onApprove: (otp: string) => Promise<void>;
444
+ /** Reject / cancel */
249
445
  onReject: () => Promise<void>;
446
+ /** Resend OTP */
250
447
  onResend: () => Promise<void>;
448
+ /** Increment to externally clear OTP field */
251
449
  clearOtpTrigger: number;
252
450
  };
253
- type Stage = WorkflowStage;
254
451
 
255
- declare const PaymanChat: React$1.ForwardRefExoticComponent<PaymanChatProps & React$1.RefAttributes<PaymanChatRef>>;
452
+ /**
453
+ * PaymanChat — the public component. Delegates to `PaymanChatInner`
454
+ * with a chat hook instance from `useChatV2`. The `config.uiVersion`
455
+ * prop used to gate an older V1 render path; the V1 code has been
456
+ * removed since nothing in the SDK's current consumers (paygent-studio
457
+ * etc.) opted into it. The `uiVersion` prop is still accepted on
458
+ * `ChatConfig` for type compatibility but is now ignored at runtime.
459
+ */
460
+ declare const PaymanChat: React.ForwardRefExoticComponent<PaymanChatProps & React.RefAttributes<PaymanChatRef>>;
256
461
 
257
- type OptimisticSessionActivity = {
258
- key: string;
259
- sessionId: string;
260
- previousSessionId?: string;
261
- lastMessageAt: string;
262
- sessionTitle?: string;
263
- };
264
- type SessionHistorySidebarProps = {
265
- config: BaseChatConfig;
266
- options: SessionHistoryOptions;
267
- activeSessionId?: string;
268
- /** Session id whose conversation history is currently being fetched.
269
- * The matching row renders a small inline spinner next to its title. */
270
- loadingSessionId?: string;
462
+ interface PaymanChatContextValue {
271
463
  /**
272
- * Session ids whose stream completed recently. Each matching row briefly
273
- * renders a check mark on the right of its title — the parent is
274
- * expected to drop the id from the set after a few seconds so the mark
275
- * goes away on its own.
464
+ * Clear all messages and reset the chat
276
465
  */
277
- recentlyCompletedSessionIds?: ReadonlySet<string>;
278
- optimisticActivity?: OptimisticSessionActivity | null;
279
- /** Called when the user clicks a row. */
280
- onSelectSession: (session: SessionSummary) => void;
281
- /** Called by the optional sidebar "New Session" button. */
282
- onNewSession?: () => void;
283
- /** Disabled state for the optional sidebar "New Session" button. */
284
- newSessionDisabled?: boolean;
285
- /** Controlled mobile drawer open state. */
286
- mobileOpen: boolean;
287
- onMobileOpenChange: (open: boolean) => void;
288
- };
289
- declare function SessionHistorySidebar({ config, options, activeSessionId, loadingSessionId, recentlyCompletedSessionIds, optimisticActivity, onSelectSession, onNewSession, newSessionDisabled, mobileOpen, onMobileOpenChange, }: SessionHistorySidebarProps): react_jsx_runtime.JSX.Element;
290
-
291
- declare function ChatHeader({ sessionId, onCopySessionId, onNewSession, showResetSession, onToggleSidebar, children, className, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
292
-
293
- declare function UserActionModal({ isOpen, userActionRequest, onApprove, onReject, onResend, clearOtpTrigger, }: UserActionModalProps): react_jsx_runtime.JSX.Element | null;
294
-
295
- interface FloatingChatProps {
296
- config: ChatConfig;
297
- callbacks?: ChatCallbacks;
298
- buttonPosition?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
299
- buttonSize?: "sm" | "md" | "lg";
300
- buttonColor?: string;
301
- buttonIcon?: React.ReactNode;
302
- buttonIconUrl?: string;
303
- windowWidth?: string | number;
304
- windowHeight?: string | number;
305
- headerTitle?: string;
306
- headerSubtitle?: string;
307
- headerAvatar?: string;
308
- headerColor?: string;
309
- defaultOpen?: boolean;
310
- showNotificationBadge?: boolean;
311
- }
312
- declare function FloatingChat({ config, callbacks, buttonPosition, buttonSize, buttonColor, buttonIcon, buttonIconUrl, windowWidth, windowHeight, headerTitle, headerSubtitle, headerAvatar, headerColor, defaultOpen, showNotificationBadge, }: FloatingChatProps): react_jsx_runtime.JSX.Element;
313
-
314
- interface PaymanChatContextValue {
315
- /** Clear all messages and reset the chat. */
316
466
  resetSession: () => void;
317
- /** Clear all messages without resetting the session id. */
467
+ /**
468
+ * Clear all messages without resetting session ID
469
+ */
318
470
  clearMessages: () => void;
319
- /** Prepend older messages (history pagination). */
471
+ /**
472
+ * Prepend older messages to the top of the list (e.g. from history pagination)
473
+ */
320
474
  prependMessages: (messages: MessageDisplay[]) => void;
321
- /** Cancel the active stream. */
475
+ /**
476
+ * Cancel current streaming operation
477
+ */
322
478
  cancelStream: () => void;
323
- /** Current session id, if any. */
479
+ /**
480
+ * Get current session ID
481
+ */
324
482
  getSessionId: () => string | undefined;
325
- /** All current messages. */
483
+ /**
484
+ * Get all messages
485
+ */
326
486
  getMessages: () => MessageDisplay[];
327
487
  /**
328
- * Replace the active chat with a prior session's conversation history.
329
- * Same call the built-in sidebar uses; exposed for advanced consumers.
488
+ * Check if currently waiting for response
330
489
  */
331
- loadSession: (sessionId: string) => Promise<void>;
332
- /** Whether a stream is currently in flight. */
333
490
  isWaitingForResponse: boolean;
334
491
  }
335
- declare const PaymanChatContext: React$1.Context<PaymanChatContextValue | undefined>;
492
+ declare const PaymanChatContext: React.Context<PaymanChatContextValue | undefined>;
336
493
  /**
337
- * Access PaymanChat controls from a child of `<PaymanChat>`.
494
+ * Hook to access PaymanChat controls from parent components
338
495
  *
339
496
  * @example
340
497
  * ```tsx
341
- * const chat = usePaymanChat();
342
- * chat.loadSession(sessionId);
498
+ * function MyComponent() {
499
+ * const chat = usePaymanChat();
500
+ *
501
+ * return (
502
+ * <>
503
+ * <button onClick={chat.resetSession}>Reset</button>
504
+ * <button onClick={chat.clearMessages}>Clear</button>
505
+ * </>
506
+ * );
507
+ * }
343
508
  * ```
344
509
  */
345
510
  declare function usePaymanChat(): PaymanChatContextValue;
346
511
 
347
- type UseSessionHistoryReturn = {
348
- sessions: SessionSummary[];
349
- isLoading: boolean;
350
- error: Error | null;
351
- hasNext: boolean;
352
- loadMore: () => Promise<void>;
353
- refresh: () => Promise<void>;
354
- width: number;
355
- setWidth: (px: number) => void;
356
- collapsed: boolean;
357
- setCollapsed: (value: boolean | ((prev: boolean) => boolean)) => void;
358
- minWidth: number;
359
- maxWidth: number;
360
- isReady: boolean;
361
- };
362
- declare function useSessionHistory(config: BaseChatConfig, options?: SessionHistoryOptions, optimisticActivity?: OptimisticSessionActivity | null): UseSessionHistoryReturn;
363
-
364
512
  /**
365
513
  * Utility function to merge Tailwind CSS classes
366
514
  */
@@ -374,7 +522,7 @@ declare function formatDate(timestamp: string | Date): string;
374
522
  interface ChatSessionContext {
375
523
  sessionId?: string;
376
524
  sessionOwnerId?: string;
377
- workflowName?: string;
525
+ agentId?: string;
378
526
  executionId?: string;
379
527
  cfRay?: string;
380
528
  route?: string;
@@ -390,12 +538,4 @@ interface ChatSessionContext {
390
538
  */
391
539
  declare function captureSentryError(error: Error | string, context: ChatSessionContext): void;
392
540
 
393
- /**
394
- * Format an ISO timestamp as a human-friendly relative label:
395
- * "just now" / "Nm ago" / "Nh ago" / "Yesterday" / "<day>" (this week) / "Mon D" / "Mon D, YYYY"
396
- *
397
- * No dayjs / date-fns — deliberately ~0 bytes extra.
398
- */
399
- declare function formatRelativeTime(iso: string, now?: Date): string;
400
-
401
- export { type AssistantMessageActionsConfig, type ChatAvailability, type ChatCallbacks, type ChatConfig, ChatHeader, type ChatHeaderProps, type ChatSessionContext, type ChatUIConfig, type EmptyStatePromptCategory, type EmptyStateSuggestionsConfig, FloatingChat, type MessageActionsConfig, type MessageListV2Props, type OtpInputProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type SessionHistoryOptions, SessionHistorySidebar, type Stage, type StreamingMessageProps, UserActionModal, type UserActionModalProps, type UserMessageActionsConfig, type VoiceOptions, captureSentryError, cn, formatDate, formatRelativeTime, usePaymanChat, useSessionHistory };
541
+ export { type AgentMessageProps, type AssistantMessageActionsConfig, type ChatCallbacks, type ChatConfig, type ChatHeaderProps, type ChatInputProps, type ChatSessionContext, type MessageActionsConfig, type MessageListProps, type MessageListV2Props, type MessageRowProps, type OtpInputProps, PaymanChat, PaymanChatContext, type PaymanChatContextValue, type PaymanChatProps, type PaymanChatRef, type SlashCommandConfig, type StreamingMessageProps, type UserActionModalProps, type UserMessageActionsConfig, type UserMessageProps, captureSentryError, cn, formatDate, usePaymanChat };