@promptbook/utils 0.112.0-30 → 0.112.0-32

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 (57) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/src/_packages/components.index.d.ts +6 -0
  3. package/esm/src/_packages/types.index.d.ts +6 -0
  4. package/esm/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +11 -0
  5. package/esm/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +8 -0
  6. package/esm/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +33 -0
  7. package/esm/src/book-2.0/agent-source/createTeamToolName.d.ts +7 -7
  8. package/esm/src/book-components/Chat/Chat/ChatActionsBar.d.ts +5 -0
  9. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +17 -1
  10. package/esm/src/book-components/Chat/Chat/ChatMessageItem.test.d.ts +1 -1
  11. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +14 -0
  12. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +290 -0
  13. package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +16 -0
  14. package/esm/src/book-components/Chat/Chat/renderAdvancedToolCallDetails.d.ts +4 -0
  15. package/esm/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +9 -0
  16. package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -1
  17. package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.test.d.ts +2 -0
  18. package/esm/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +18 -0
  19. package/esm/src/book-components/Chat/hooks/useChatCompleteNotification.test.d.ts +2 -0
  20. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +77 -1
  21. package/esm/src/book-components/Chat/utils/formatToolCallDateTime.d.ts +37 -0
  22. package/esm/src/book-components/Chat/utils/formatToolCallLocalTime.d.ts +11 -0
  23. package/esm/src/book-components/Chat/utils/formatToolCallTranslationTemplate.d.ts +10 -0
  24. package/esm/src/book-components/Chat/utils/getChatMessageTimingDisplay.d.ts +5 -1
  25. package/esm/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +26 -1
  26. package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +26 -3
  27. package/esm/src/utils/toolCalls/mergeToolCalls.d.ts +1 -1
  28. package/esm/src/version.d.ts +1 -1
  29. package/package.json +1 -1
  30. package/umd/index.umd.js +1 -1
  31. package/umd/src/_packages/components.index.d.ts +6 -0
  32. package/umd/src/_packages/types.index.d.ts +6 -0
  33. package/umd/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +11 -0
  34. package/umd/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +8 -0
  35. package/umd/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +33 -0
  36. package/umd/src/book-2.0/agent-source/createTeamToolName.d.ts +7 -7
  37. package/umd/src/book-components/Chat/Chat/ChatActionsBar.d.ts +5 -0
  38. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +17 -1
  39. package/umd/src/book-components/Chat/Chat/ChatMessageItem.test.d.ts +1 -1
  40. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +14 -0
  41. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +290 -0
  42. package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +16 -0
  43. package/umd/src/book-components/Chat/Chat/renderAdvancedToolCallDetails.d.ts +4 -0
  44. package/umd/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +9 -0
  45. package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -1
  46. package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.test.d.ts +2 -0
  47. package/umd/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +18 -0
  48. package/umd/src/book-components/Chat/hooks/useChatCompleteNotification.test.d.ts +2 -0
  49. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +77 -1
  50. package/umd/src/book-components/Chat/utils/formatToolCallDateTime.d.ts +37 -0
  51. package/umd/src/book-components/Chat/utils/formatToolCallLocalTime.d.ts +11 -0
  52. package/umd/src/book-components/Chat/utils/formatToolCallTranslationTemplate.d.ts +10 -0
  53. package/umd/src/book-components/Chat/utils/getChatMessageTimingDisplay.d.ts +5 -1
  54. package/umd/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +26 -1
  55. package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +26 -3
  56. package/umd/src/utils/toolCalls/mergeToolCalls.d.ts +1 -1
  57. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
18
18
  * @generated
19
19
  * @see https://github.com/webgptorg/promptbook
20
20
  */
21
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-30';
21
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-32';
22
22
  /**
23
23
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
24
24
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -17,7 +17,10 @@ import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChat
17
17
  import { Chat } from '../book-components/Chat/Chat/Chat';
18
18
  import type { ChatFeedbackResponse } from '../book-components/Chat/Chat/ChatProps';
19
19
  import type { ChatFeedbackMode } from '../book-components/Chat/Chat/ChatProps';
20
+ import type { ChatVisualMode } from '../book-components/Chat/Chat/ChatProps';
20
21
  import type { ChatFeedbackTranslations } from '../book-components/Chat/Chat/ChatProps';
22
+ import type { ChatUiTranslations } from '../book-components/Chat/Chat/ChatProps';
23
+ import type { ChatTimingTranslations } from '../book-components/Chat/Chat/ChatProps';
21
24
  import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
22
25
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
23
26
  import { ChatSoundToggle } from '../book-components/Chat/Chat/ChatSoundToggle';
@@ -95,7 +98,10 @@ export type { AgentChatProps };
95
98
  export { Chat };
96
99
  export type { ChatFeedbackResponse };
97
100
  export type { ChatFeedbackMode };
101
+ export type { ChatVisualMode };
98
102
  export type { ChatFeedbackTranslations };
103
+ export type { ChatUiTranslations };
104
+ export type { ChatTimingTranslations };
99
105
  export type { ChatSoundSystem };
100
106
  export type { ChatProps };
101
107
  export { ChatSoundToggle };
@@ -18,7 +18,10 @@ import type { AgentChipData } from '../book-components/Chat/AgentChip/AgentChip'
18
18
  import type { AgentChipProps } from '../book-components/Chat/AgentChip/AgentChip';
19
19
  import type { ChatFeedbackResponse } from '../book-components/Chat/Chat/ChatProps';
20
20
  import type { ChatFeedbackMode } from '../book-components/Chat/Chat/ChatProps';
21
+ import type { ChatVisualMode } from '../book-components/Chat/Chat/ChatProps';
21
22
  import type { ChatFeedbackTranslations } from '../book-components/Chat/Chat/ChatProps';
23
+ import type { ChatUiTranslations } from '../book-components/Chat/Chat/ChatProps';
24
+ import type { ChatTimingTranslations } from '../book-components/Chat/Chat/ChatProps';
22
25
  import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
23
26
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
24
27
  import type { ChatSoundToggleProps } from '../book-components/Chat/Chat/ChatSoundToggle';
@@ -443,7 +446,10 @@ export type { AgentChipData };
443
446
  export type { AgentChipProps };
444
447
  export type { ChatFeedbackResponse };
445
448
  export type { ChatFeedbackMode };
449
+ export type { ChatVisualMode };
446
450
  export type { ChatFeedbackTranslations };
451
+ export type { ChatUiTranslations };
452
+ export type { ChatTimingTranslations };
447
453
  export type { ChatSoundSystem };
448
454
  export type { ChatProps };
449
455
  export type { ChatSoundToggleProps };
@@ -1,4 +1,5 @@
1
1
  import type { BookCommitment } from '../../commitments/_base/BookCommitment';
2
+ import type { TeammateProfile } from './TeammateProfileResolver';
2
3
  /**
3
4
  * Resolves compact agent references that appear inside FROM, IMPORT, and TEAM commitments.
4
5
  *
@@ -15,4 +16,14 @@ export type AgentReferenceResolver = {
15
16
  * @param content - Original payload of the commitment
16
17
  */
17
18
  resolveCommitmentContent(commitmentType: BookCommitment, content: string): Promise<string>;
19
+ /**
20
+ * Optional: returns the actual human-readable name and description for a teammate agent URL.
21
+ *
22
+ * When implemented, this enriches TEAM tool definitions with the agent's real name and
23
+ * persona description instead of technical IDs derived from the URL path.
24
+ *
25
+ * @param url - Canonical teammate URL from the resolved TEAM commitment content.
26
+ * @returns Agent profile or `null` when the URL is not resolvable locally.
27
+ */
28
+ resolveTeammateProfile?: (url: string) => Promise<TeammateProfile | null>;
18
29
  };
@@ -1,5 +1,6 @@
1
1
  import type { AgentReferenceResolver } from './AgentReferenceResolver';
2
2
  import type { InlineKnowledgeSourceUploader } from '../../utils/knowledge/inlineKnowledgeSource';
3
+ import type { TeammateProfileResolver } from './TeammateProfileResolver';
3
4
  /**
4
5
  * Options for `createAgentModelRequirements` and `createAgentModelRequirementsWithCommitments`.
5
6
  *
@@ -14,4 +15,11 @@ export type CreateAgentModelRequirementsOptions = {
14
15
  * Optional hook used to upload inline knowledge files before finalizing the requirements.
15
16
  */
16
17
  readonly inlineKnowledgeSourceUploader?: InlineKnowledgeSourceUploader;
18
+ /**
19
+ * Optional resolver that provides actual agent names and descriptions for teammate URLs.
20
+ *
21
+ * When provided, TEAM tools are created with the agent's real human-readable name and
22
+ * persona description rather than technical IDs derived from URL path segments.
23
+ */
24
+ readonly teammateProfileResolver?: TeammateProfileResolver;
17
25
  };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Profile data for a teammate agent resolved from its source or backend.
3
+ *
4
+ * @private internal type for TEAM commitment profile enrichment
5
+ */
6
+ export type TeammateProfile = {
7
+ /**
8
+ * The human-readable name of the agent.
9
+ */
10
+ readonly agentName: string;
11
+ /**
12
+ * Short description of what the agent does, from its PERSONA commitment.
13
+ */
14
+ readonly personaDescription: string | null;
15
+ };
16
+ /**
17
+ * Resolves profile data for teammate agents referenced in TEAM commitments.
18
+ *
19
+ * Implementations are expected to return the actual human-readable name and
20
+ * description of each teammate agent identified by URL, so TEAM tools can be
21
+ * created with meaningful labels and descriptions rather than technical IDs.
22
+ *
23
+ * @private internal type for TEAM commitment profile enrichment
24
+ */
25
+ export type TeammateProfileResolver = {
26
+ /**
27
+ * Returns profile data for the given teammate agent URL.
28
+ *
29
+ * @param url - Canonical teammate URL from the resolved TEAM commitment content.
30
+ * @returns Teammate profile or `null` when the URL cannot be resolved locally.
31
+ */
32
+ resolveTeammateProfile(url: string): Promise<TeammateProfile | null>;
33
+ };
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Builds a deterministic TEAM tool name from teammate identity.
2
+ * Builds a deterministic TEAM tool name from the teammate label.
3
3
  *
4
- * The readable part is based on teammate label while the hash suffix
5
- * keeps uniqueness and stable mapping for the underlying teammate URL.
4
+ * The tool name is derived solely from the human-readable label so that it
5
+ * remains stable and predictable regardless of internal technical identifiers.
6
6
  *
7
- * @param teammateUrl - Canonical teammate URL used at runtime.
8
- * @param teammateLabel - Human-readable teammate label.
9
- * @returns Deterministic TEAM tool name.
7
+ * @param _teammateUrl - Canonical teammate URL (kept for API compatibility, not used).
8
+ * @param teammateLabel - Human-readable teammate label used as the basis for the name.
9
+ * @returns TEAM tool name derived from the label.
10
10
  * @private internal utility of TEAM commitments and chat UI mapping
11
11
  */
12
- export declare function createTeamToolName(teammateUrl: string, teammateLabel?: string): string;
12
+ export declare function createTeamToolName(_teammateUrl: string, teammateLabel?: string): string;
@@ -3,6 +3,7 @@ import type { Promisable } from 'type-fest';
3
3
  import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
4
4
  import type { ChatMessage } from '../types/ChatMessage';
5
5
  import type { ChatParticipant } from '../types/ChatParticipant';
6
+ import type { ChatUiTranslations } from './ChatProps';
6
7
  /**
7
8
  * Props for the Chat actions toolbar.
8
9
  *
@@ -25,6 +26,10 @@ export type ChatActionsBarProps = {
25
26
  * Disables action interactions while scroll is active.
26
27
  */
27
28
  shouldDisableActions: boolean;
29
+ /**
30
+ * Optional localized labels for Chat UI strings such as button labels.
31
+ */
32
+ chatUiTranslations?: ChatUiTranslations;
28
33
  onButtonClick: (handler?: (event: MouseEvent<HTMLButtonElement>) => void) => (event: MouseEvent<HTMLButtonElement>) => void;
29
34
  };
30
35
  /**
@@ -9,7 +9,7 @@ import type { ChatProps } from './ChatProps';
9
9
  *
10
10
  * @private props for internal subcomponent
11
11
  */
12
- type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'participants'> & {
12
+ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'onQuickMessageButton' | 'participants'> & {
13
13
  message: ChatMessage;
14
14
  participant: ChatParticipant | undefined;
15
15
  isLastMessage: boolean;
@@ -34,6 +34,14 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'pa
34
34
  * Optional localized labels used by feedback controls.
35
35
  */
36
36
  feedbackTranslations?: ChatProps['feedbackTranslations'];
37
+ /**
38
+ * Optional localized labels used by timestamp metadata.
39
+ */
40
+ timingTranslations?: ChatProps['timingTranslations'];
41
+ /**
42
+ * Optional moment locale used to format message timestamps.
43
+ */
44
+ chatLocale?: ChatProps['chatLocale'];
37
45
  /**
38
46
  * Called when the copy button is pressed.
39
47
  */
@@ -56,6 +64,10 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'pa
56
64
  * Optional cached metadata keyed by TEAM tool names to enrich tool call chips.
57
65
  */
58
66
  teamAgentProfiles?: ChatProps['teamAgentProfiles'];
67
+ /**
68
+ * Controls whether assistant replies render as bubbles or article blocks.
69
+ */
70
+ CHAT_VISUAL_MODE?: ChatProps['CHAT_VISUAL_MODE'];
59
71
  /**
60
72
  * Called when a tool call chiplet is clicked.
61
73
  */
@@ -73,6 +85,10 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'pa
73
85
  */
74
86
  isSpeechPlaybackEnabled?: ChatProps['isSpeechPlaybackEnabled'];
75
87
  readonly elevenLabsVoiceId?: ChatProps['elevenLabsVoiceId'];
88
+ /**
89
+ * Optional localized labels for Chat UI elements such as lifecycle badges.
90
+ */
91
+ chatUiTranslations?: ChatProps['chatUiTranslations'];
76
92
  };
77
93
  /**
78
94
  * Metadata for a teammate agent tool.
@@ -1,2 +1,2 @@
1
1
  /** @jest-environment jsdom */
2
- export {};
2
+ import 'moment/locale/cs';
@@ -28,18 +28,32 @@ export type ChatMessageListProps = {
28
28
  * Optional localized labels used by feedback controls.
29
29
  */
30
30
  feedbackTranslations?: ChatProps['feedbackTranslations'];
31
+ /**
32
+ * Optional localized labels used by timestamp metadata.
33
+ */
34
+ timingTranslations?: ChatProps['timingTranslations'];
35
+ /**
36
+ * Optional moment locale used to format message timestamps.
37
+ */
38
+ chatLocale?: ChatProps['chatLocale'];
31
39
  onCopy?: () => void;
32
40
  onMessage?: (messageContent: string) => Promisable<void>;
33
41
  onActionButton?: ChatProps['onActionButton'];
42
+ onQuickMessageButton?: ChatProps['onQuickMessageButton'];
34
43
  onCreateAgent?: (bookContent: string) => void;
35
44
  toolTitles?: Record<string, string>;
36
45
  teammates?: ChatProps['teammates'];
37
46
  teamAgentProfiles?: ChatProps['teamAgentProfiles'];
47
+ CHAT_VISUAL_MODE?: ChatProps['CHAT_VISUAL_MODE'];
38
48
  onToolCallClick?: (toolCall: NonNullable<ChatMessage['toolCalls']>[number]) => void;
39
49
  onCitationClick?: (citation: ParsedCitation) => void;
40
50
  soundSystem?: ChatProps['soundSystem'];
41
51
  isSpeechPlaybackEnabled?: ChatProps['isSpeechPlaybackEnabled'];
42
52
  elevenLabsVoiceId?: ChatProps['elevenLabsVoiceId'];
53
+ /**
54
+ * Optional localized labels for Chat UI elements such as lifecycle badges.
55
+ */
56
+ chatUiTranslations?: ChatProps['chatUiTranslations'];
43
57
  setChatMessagesElement: (element: HTMLDivElement | null) => void;
44
58
  onScroll: (event: UIEvent<HTMLDivElement>) => void;
45
59
  chatMessagesClassName?: string;
@@ -24,6 +24,15 @@ export type ChatFeedbackResponse = {
24
24
  * @public exported from `@promptbook/components`
25
25
  */
26
26
  export type ChatFeedbackMode = 'off' | 'stars' | 'report_issue';
27
+ /**
28
+ * Visual presentation mode used for chat messages.
29
+ *
30
+ * - `BUBBLE_MODE`: user and agent messages render as bubbles.
31
+ * - `ARTICLE_MODE`: user messages stay as bubbles; agent messages render as seamless article blocks.
32
+ *
33
+ * @public exported from `@promptbook/components`
34
+ */
35
+ export type ChatVisualMode = 'BUBBLE_MODE' | 'ARTICLE_MODE';
27
36
  /**
28
37
  * Optional text overrides for feedback UI copy.
29
38
  *
@@ -103,6 +112,257 @@ export type ChatFeedbackTranslations = {
103
112
  */
104
113
  readonly feedbackErrorMessage?: string;
105
114
  };
115
+ /**
116
+ * Optional text overrides for general Chat UI strings such as button labels, lifecycle
117
+ * state badges, tool call modal controls, and the default input placeholder.
118
+ *
119
+ * @public exported from `@promptbook/components`
120
+ */
121
+ export type ChatUiTranslations = {
122
+ /**
123
+ * Default placeholder shown in the message input when no custom placeholder is provided.
124
+ * @default "Write a message..."
125
+ */
126
+ readonly inputPlaceholder?: string;
127
+ /**
128
+ * Label for the "Save" button in the chat actions bar.
129
+ * @default "Save"
130
+ */
131
+ readonly saveButtonLabel?: string;
132
+ /**
133
+ * Label for the "New chat" button in the chat actions bar.
134
+ * @default "New chat"
135
+ */
136
+ readonly newChatButtonLabel?: string;
137
+ /**
138
+ * Lifecycle badge label for messages being sent by the user.
139
+ * @default "Sending"
140
+ */
141
+ readonly lifecycleSending?: string;
142
+ /**
143
+ * Lifecycle badge label for queued messages.
144
+ * @default "Queued"
145
+ */
146
+ readonly lifecycleQueued?: string;
147
+ /**
148
+ * Lifecycle badge label for running messages.
149
+ * @default "Running"
150
+ */
151
+ readonly lifecycleRunning?: string;
152
+ /**
153
+ * Lifecycle badge label for failed messages.
154
+ * @default "Failed"
155
+ */
156
+ readonly lifecycleFailed?: string;
157
+ /**
158
+ * Lifecycle badge label for cancelled messages.
159
+ * @default "Cancelled"
160
+ */
161
+ readonly lifecycleCancelled?: string;
162
+ /**
163
+ * Lifecycle badge label for completed messages.
164
+ * @default "Completed"
165
+ */
166
+ readonly lifecycleCompleted?: string;
167
+ /**
168
+ * Accessible label for the tool call details modal dialog.
169
+ * @default "Tool call details"
170
+ */
171
+ readonly toolCallModalTitle?: string;
172
+ /**
173
+ * Accessible label for the close button in the tool call details modal.
174
+ * @default "Close tool call details"
175
+ */
176
+ readonly toolCallModalCloseLabel?: string;
177
+ /**
178
+ * Label for the "Copy" button in the tool call details modal footer.
179
+ * @default "Copy"
180
+ */
181
+ readonly toolCallModalCopyLabel?: string;
182
+ /**
183
+ * Label for the "Save" button in the tool call details modal footer.
184
+ * @default "Save"
185
+ */
186
+ readonly toolCallModalSaveLabel?: string;
187
+ /**
188
+ * Label for switching to the advanced view in the tool call details modal.
189
+ * @default "Advanced"
190
+ */
191
+ readonly toolCallModalAdvancedLabel?: string;
192
+ /**
193
+ * Label for switching back to the simple view in the tool call details modal.
194
+ * @default "Simple"
195
+ */
196
+ readonly toolCallModalSimpleLabel?: string;
197
+ /**
198
+ * Title shown when a timeout has been successfully scheduled.
199
+ * @default "Timeout scheduled"
200
+ */
201
+ readonly toolCallTimeoutTitle?: string;
202
+ /**
203
+ * Title shown when a timeout has been cancelled.
204
+ * @default "Timeout cancelled"
205
+ */
206
+ readonly toolCallTimeoutCancelledTitle?: string;
207
+ /**
208
+ * Title shown when a timeout status update is received.
209
+ * @default "Timeout update"
210
+ */
211
+ readonly toolCallTimeoutUpdateTitle?: string;
212
+ /**
213
+ * Label for the "Cancel" quick-action button inside the timeout modal.
214
+ * @default "Cancel"
215
+ */
216
+ readonly toolCallTimeoutCancelButton?: string;
217
+ /**
218
+ * Label for the "Snooze" quick-action button inside the timeout modal.
219
+ * @default "Snooze"
220
+ */
221
+ readonly toolCallTimeoutSnoozeButton?: string;
222
+ /**
223
+ * Label for the "View advanced" quick-action button inside the timeout modal.
224
+ * @default "View advanced"
225
+ */
226
+ readonly toolCallTimeoutViewAdvancedButton?: string;
227
+ /**
228
+ * Message shown in the timeout modal when presentation data is still loading.
229
+ * @default "Timeout details are still loading."
230
+ */
231
+ readonly toolCallTimeoutLoadingMessage?: string;
232
+ /**
233
+ * Message shown in the timeout modal when the scheduled time is unavailable.
234
+ * @default "Scheduled time is unavailable."
235
+ */
236
+ readonly toolCallTimeoutUnavailableMessage?: string;
237
+ /**
238
+ * Label prefix for the due date line in the timeout modal (e.g. "Date: 1/1/2025").
239
+ * @default "Date:"
240
+ */
241
+ readonly toolCallTimeoutDateLabel?: string;
242
+ /**
243
+ * Label prefix for the message line in the timeout modal.
244
+ * @default "Message:"
245
+ */
246
+ readonly toolCallTimeoutMessageLabel?: string;
247
+ /**
248
+ * Label prefix for the timezone line in the timeout modal.
249
+ * @default "Timezone:"
250
+ */
251
+ readonly toolCallTimeoutTimezoneLabel?: string;
252
+ /**
253
+ * Template used for timeout chips, for example `"Timeout: {time}"`.
254
+ * @default "Timeout: {time}"
255
+ */
256
+ readonly toolCallTimeoutChipLabel?: string;
257
+ /**
258
+ * Chip text used when a timeout has been cancelled.
259
+ * @default "Timeout cancelled"
260
+ */
261
+ readonly toolCallTimeoutChipCancelledLabel?: string;
262
+ /**
263
+ * Chip text used when a timeout is already inactive.
264
+ * @default "Timeout inactive"
265
+ */
266
+ readonly toolCallTimeoutChipInactiveLabel?: string;
267
+ /**
268
+ * Chip text used when a timeout status update is received.
269
+ * @default "Timeout update"
270
+ */
271
+ readonly toolCallTimeoutChipUpdatedLabel?: string;
272
+ /**
273
+ * Chip text used when no specific timeout time is available yet.
274
+ * @default "Timeout scheduled"
275
+ */
276
+ readonly toolCallTimeoutChipFallbackLabel?: string;
277
+ /**
278
+ * Primary timeout summary template shown in the modal, for example `"Scheduled for {time}."`.
279
+ * @default "Scheduled for {time}."
280
+ */
281
+ readonly toolCallTimeoutPrimaryScheduledLabel?: string;
282
+ /**
283
+ * Secondary timeout summary template shown in the modal, for example `"Will retry in {duration}."`.
284
+ * @default "Will retry in {duration}."
285
+ */
286
+ readonly toolCallTimeoutSecondaryDurationLabel?: string;
287
+ /**
288
+ * Primary timeout summary shown after cancellation.
289
+ * @default "The timeout has been cancelled."
290
+ */
291
+ readonly toolCallTimeoutPrimaryCancelledLabel?: string;
292
+ /**
293
+ * Primary timeout summary shown when the timeout is already inactive.
294
+ * @default "This timeout was already inactive."
295
+ */
296
+ readonly toolCallTimeoutPrimaryInactiveLabel?: string;
297
+ /**
298
+ * Primary timeout summary shown for generic timeout updates.
299
+ * @default "The timeout status has been updated."
300
+ */
301
+ readonly toolCallTimeoutPrimaryUpdatedLabel?: string;
302
+ /**
303
+ * Primary timeout summary shown when only limited data is available.
304
+ * @default "The timeout has been scheduled."
305
+ */
306
+ readonly toolCallTimeoutPrimaryFallbackLabel?: string;
307
+ /**
308
+ * Accessible label for the timeout quick-action button group.
309
+ * @default "Timeout quick actions"
310
+ */
311
+ readonly toolCallTimeoutActionGroupLabel?: string;
312
+ /**
313
+ * Accessible label for the "Cancel" timeout quick action.
314
+ * @default "Cancel timeout"
315
+ */
316
+ readonly toolCallTimeoutCancelAriaLabel?: string;
317
+ /**
318
+ * Accessible label for the "Snooze" timeout quick action.
319
+ * @default "Snooze timeout"
320
+ */
321
+ readonly toolCallTimeoutSnoozeAriaLabel?: string;
322
+ /**
323
+ * Accessible label for the "View advanced" timeout quick action.
324
+ * @default "View advanced timeout details"
325
+ */
326
+ readonly toolCallTimeoutViewAdvancedAriaLabel?: string;
327
+ /**
328
+ * Header title shown in the time-check modal.
329
+ * @default "Time at call"
330
+ */
331
+ readonly toolCallTimeTitle?: string;
332
+ /**
333
+ * Shown in the time modal when the time value is unknown.
334
+ * @default "Unknown time"
335
+ */
336
+ readonly toolCallTimeUnknown?: string;
337
+ /**
338
+ * Label prefix for the exact timestamp line in the time modal.
339
+ * @default "Timestamp of call:"
340
+ */
341
+ readonly toolCallTimeTimestampLabel?: string;
342
+ /**
343
+ * Template used for the time chip, for example `"Time: {time}"`.
344
+ * @default "{time}"
345
+ */
346
+ readonly toolCallTimeChipLabel?: string;
347
+ /**
348
+ * Template shown under the time clock panel for relative context.
349
+ * @default "Called {relative}"
350
+ */
351
+ readonly toolCallTimeRelativeLabel?: string;
352
+ };
353
+ /**
354
+ * Optional text overrides for localized timing metadata rendered next to message timestamps.
355
+ *
356
+ * @public exported from `@promptbook/components`
357
+ */
358
+ export type ChatTimingTranslations = {
359
+ /**
360
+ * Template used for assistant response duration metadata.
361
+ *
362
+ * The `{duration}` placeholder is replaced with the compact duration label.
363
+ */
364
+ readonly answerDurationLabel?: string;
365
+ };
106
366
  /**
107
367
  * Interface for sound system that can be passed to Chat component
108
368
  * This allows the chat to trigger sounds without tight coupling
@@ -179,6 +439,12 @@ export type ChatProps = {
179
439
  * to keep the button available for another attempt.
180
440
  */
181
441
  onActionButton?(code: string): Promisable<void>;
442
+ /**
443
+ * Called when user clicks a quick message button parsed from message markdown.
444
+ *
445
+ * When not provided, quick message buttons fall back to `onMessage`.
446
+ */
447
+ onQuickMessageButton?(messageContent: string): Promisable<void>;
182
448
  /**
183
449
  * Optional callback
184
450
  *
@@ -388,6 +654,21 @@ export type ChatProps = {
388
654
  * Optional localized feedback labels for buttons, modal copy, and status toasts.
389
655
  */
390
656
  readonly feedbackTranslations?: ChatFeedbackTranslations;
657
+ /**
658
+ * Optional localized labels used by timestamp metadata shown under messages.
659
+ */
660
+ readonly timingTranslations?: ChatTimingTranslations;
661
+ /**
662
+ * Optional localized labels for general Chat UI elements such as button labels,
663
+ * lifecycle state badges, tool call modal strings, and the default input placeholder.
664
+ */
665
+ readonly chatUiTranslations?: ChatUiTranslations;
666
+ /**
667
+ * Optional moment locale used when formatting message timestamps.
668
+ *
669
+ * When omitted, the current global moment locale is used.
670
+ */
671
+ readonly chatLocale?: string;
391
672
  /**
392
673
  * Optional callback for handling file uploads
393
674
  * When provided, enables file upload functionality via drag-and-drop and file button
@@ -407,6 +688,15 @@ export type ChatProps = {
407
688
  * Called when a tool call chiplet is clicked.
408
689
  */
409
690
  onToolCallClick?: (toolCall: NonNullable<ChatMessage['toolCalls']>[number]) => void;
691
+ /**
692
+ * Visual presentation mode for chat messages.
693
+ *
694
+ * - `BUBBLE_MODE`: keeps the default bubble appearance for all messages.
695
+ * - `ARTICLE_MODE`: keeps user bubbles while rendering assistant replies as borderless article blocks.
696
+ *
697
+ * @default 'BUBBLE_MODE'
698
+ */
699
+ readonly CHAT_VISUAL_MODE?: ChatVisualMode;
410
700
  /**
411
701
  * Visual style of the chat component
412
702
  */
@@ -25,6 +25,22 @@ export type ChatToolCallModalProps = {
25
25
  * Optional cached team agent metadata keyed by TEAM tool name.
26
26
  */
27
27
  teamAgentProfiles?: Record<string, AgentChipData>;
28
+ /**
29
+ * Optional localized labels for the tool call modal UI elements.
30
+ */
31
+ chatUiTranslations?: import('./ChatProps').ChatUiTranslations;
32
+ /**
33
+ * Optional BCP-47 locale string used to format time labels in the modal.
34
+ * When omitted the browser/OS default locale is used.
35
+ */
36
+ locale?: string;
37
+ /**
38
+ * Optional list of tools that were available to the model during the turn that produced this tool call.
39
+ *
40
+ * When provided, the advanced view includes an "Available tools" payload section so developers can
41
+ * inspect what capabilities the model had access to at the exact moment of the request.
42
+ */
43
+ availableTools?: ChatMessage['availableTools'];
28
44
  };
29
45
  /**
30
46
  * Modal that renders rich tool call details for chat chiplets.
@@ -14,6 +14,10 @@ type AdvancedToolCallDetailsOptions = {
14
14
  * Optional mapping of tool titles.
15
15
  */
16
16
  toolTitles?: Record<string, string>;
17
+ /**
18
+ * Optional list of tools that were available to the model during the turn that produced this tool call.
19
+ */
20
+ availableTools?: ChatMessage['availableTools'];
17
21
  };
18
22
  /**
19
23
  * Renders a technical view with raw tool input/output payloads.
@@ -29,6 +29,15 @@ type ToolCallDetailsOptions = {
29
29
  * Requests switching the modal into advanced technical mode.
30
30
  */
31
31
  onRequestAdvancedView?: () => void;
32
+ /**
33
+ * Optional BCP-47 locale string used to format time labels.
34
+ * When omitted the browser/OS default locale is used.
35
+ */
36
+ locale?: string;
37
+ /**
38
+ * Optional localized label overrides for the tool call modal UI.
39
+ */
40
+ chatUiTranslations?: import('./ChatProps').ChatUiTranslations;
32
41
  };
33
42
  /**
34
43
  * Renders the detail view for a single tool call.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { string_markdown } from '../../../types/typeAliases';
2
3
  type MarkdownContentProps = {
3
4
  content: string_markdown;
@@ -9,7 +10,7 @@ type MarkdownContentProps = {
9
10
  *
10
11
  * @public exported from `@promptbook/components`
11
12
  */
12
- export declare function MarkdownContent(props: MarkdownContentProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare const MarkdownContent: import("react").NamedExoticComponent<MarkdownContentProps>;
13
14
  export {};
14
15
  /**
15
16
  * TODO: !!! Split into multiple files
@@ -0,0 +1,2 @@
1
+ /** @jest-environment jsdom */
2
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { ChatSoundSystem } from '../Chat/ChatProps';
2
+ import type { ChatMessage } from '../types/ChatMessage';
3
+ /**
4
+ * Plays the "message received" sound + vibration exactly once when the last
5
+ * assistant message transitions to a completed / finalized state.
6
+ *
7
+ * Notifications are suppressed for:
8
+ * - Every streaming chunk / intermediate content update
9
+ * - `message_typing` lifecycle events before the message is finalized
10
+ * - Re-renders of an already-notified completed message (idempotent)
11
+ * - User-originated messages
12
+ *
13
+ * @param messages - Current list of chat messages
14
+ * @param soundSystem - Optional sound system instance; no-op when absent
15
+ *
16
+ * @private internal hook of `<Chat/>`
17
+ */
18
+ export declare function useChatCompleteNotification(messages: ReadonlyArray<ChatMessage>, soundSystem: ChatSoundSystem | undefined): void;