@promptbook/javascript 0.112.0-31 → 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.
- package/esm/index.es.js +1 -1
- package/esm/src/_packages/components.index.d.ts +6 -0
- package/esm/src/_packages/types.index.d.ts +6 -0
- package/esm/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +11 -0
- package/esm/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +8 -0
- package/esm/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +33 -0
- package/esm/src/book-2.0/agent-source/createTeamToolName.d.ts +7 -7
- package/esm/src/book-components/Chat/Chat/ChatActionsBar.d.ts +5 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +17 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.test.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +14 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +290 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +16 -0
- package/esm/src/book-components/Chat/Chat/renderAdvancedToolCallDetails.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +9 -0
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -1
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.test.d.ts +2 -0
- package/esm/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +18 -0
- package/esm/src/book-components/Chat/hooks/useChatCompleteNotification.test.d.ts +2 -0
- package/esm/src/book-components/Chat/types/ChatMessage.d.ts +77 -1
- package/esm/src/book-components/Chat/utils/formatToolCallDateTime.d.ts +37 -0
- package/esm/src/book-components/Chat/utils/formatToolCallLocalTime.d.ts +11 -0
- package/esm/src/book-components/Chat/utils/formatToolCallTranslationTemplate.d.ts +10 -0
- package/esm/src/book-components/Chat/utils/getChatMessageTimingDisplay.d.ts +5 -1
- package/esm/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +26 -1
- package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +26 -3
- package/esm/src/utils/toolCalls/mergeToolCalls.d.ts +1 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +1 -1
- package/umd/src/_packages/components.index.d.ts +6 -0
- package/umd/src/_packages/types.index.d.ts +6 -0
- package/umd/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +11 -0
- package/umd/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +8 -0
- package/umd/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +33 -0
- package/umd/src/book-2.0/agent-source/createTeamToolName.d.ts +7 -7
- package/umd/src/book-components/Chat/Chat/ChatActionsBar.d.ts +5 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +17 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.test.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +14 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +290 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +16 -0
- package/umd/src/book-components/Chat/Chat/renderAdvancedToolCallDetails.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +9 -0
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -1
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.test.d.ts +2 -0
- package/umd/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +18 -0
- package/umd/src/book-components/Chat/hooks/useChatCompleteNotification.test.d.ts +2 -0
- package/umd/src/book-components/Chat/types/ChatMessage.d.ts +77 -1
- package/umd/src/book-components/Chat/utils/formatToolCallDateTime.d.ts +37 -0
- package/umd/src/book-components/Chat/utils/formatToolCallLocalTime.d.ts +11 -0
- package/umd/src/book-components/Chat/utils/formatToolCallTranslationTemplate.d.ts +10 -0
- package/umd/src/book-components/Chat/utils/getChatMessageTimingDisplay.d.ts +5 -1
- package/umd/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +26 -1
- package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +26 -3
- package/umd/src/utils/toolCalls/mergeToolCalls.d.ts +1 -1
- package/umd/src/version.d.ts +1 -1
|
@@ -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
|
|
13
|
+
export declare const MarkdownContent: import("react").NamedExoticComponent<MarkdownContentProps>;
|
|
13
14
|
export {};
|
|
14
15
|
/**
|
|
15
16
|
* TODO: !!! Split into multiple files
|
|
@@ -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;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Message } from '../../../types/Message';
|
|
2
|
+
import type { LlmToolDefinition } from '../../../types/LlmToolDefinition';
|
|
3
|
+
import type { ChatModelRequirements } from '../../../types/ModelRequirements';
|
|
2
4
|
import type { ToolCall } from '../../../types/ToolCall';
|
|
3
|
-
import type {
|
|
5
|
+
import type { TODO_object } from '../../../utils/organization/TODO_object';
|
|
6
|
+
import type { id, Parameters, string_date_iso8601, string_markdown, string_prompt, string_title } from '../../../types/typeAliases';
|
|
4
7
|
export type ChatToolCall = ToolCall;
|
|
5
8
|
/**
|
|
6
9
|
* One item in a user-facing progress card shown while assistant response is still running.
|
|
@@ -52,6 +55,63 @@ export type ChatProgressCard = {
|
|
|
52
55
|
*/
|
|
53
56
|
readonly isVisible?: boolean;
|
|
54
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Serializable prompt snapshot stored alongside one assistant message for debugging and inspection.
|
|
60
|
+
*/
|
|
61
|
+
type ChatMessagePrompt = {
|
|
62
|
+
/**
|
|
63
|
+
* Human-readable label used for the prompt execution.
|
|
64
|
+
*/
|
|
65
|
+
readonly title: string_title;
|
|
66
|
+
/**
|
|
67
|
+
* User-facing chat content submitted into the prompt pipeline.
|
|
68
|
+
*/
|
|
69
|
+
readonly content: string_prompt;
|
|
70
|
+
/**
|
|
71
|
+
* Resolved prompt parameters passed into the agent turn.
|
|
72
|
+
*/
|
|
73
|
+
readonly parameters: Parameters;
|
|
74
|
+
/**
|
|
75
|
+
* Chat-model requirements used when the turn was executed.
|
|
76
|
+
*/
|
|
77
|
+
readonly modelRequirements: ChatModelRequirements;
|
|
78
|
+
/**
|
|
79
|
+
* Prior thread history provided to the prompt.
|
|
80
|
+
*/
|
|
81
|
+
readonly thread?: ReadonlyArray<ChatMessage>;
|
|
82
|
+
/**
|
|
83
|
+
* Attachments submitted with the user turn.
|
|
84
|
+
*/
|
|
85
|
+
readonly attachments?: ReadonlyArray<{
|
|
86
|
+
name: string;
|
|
87
|
+
type: string;
|
|
88
|
+
url: string;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Runtime tools explicitly passed on the chat prompt object.
|
|
92
|
+
*/
|
|
93
|
+
readonly tools?: ReadonlyArray<LlmToolDefinition>;
|
|
94
|
+
/**
|
|
95
|
+
* Full list of tools available to the model for this turn.
|
|
96
|
+
*/
|
|
97
|
+
readonly availableTools?: ReadonlyArray<LlmToolDefinition>;
|
|
98
|
+
/**
|
|
99
|
+
* Tool calls associated with the generated message, duplicated here for raw prompt inspection.
|
|
100
|
+
*/
|
|
101
|
+
readonly toolCalls?: ReadonlyArray<ChatToolCall>;
|
|
102
|
+
/**
|
|
103
|
+
* Completed tool calls associated with the generated message, duplicated here for raw prompt inspection.
|
|
104
|
+
*/
|
|
105
|
+
readonly completedToolCalls?: ReadonlyArray<ChatToolCall>;
|
|
106
|
+
/**
|
|
107
|
+
* Provider-facing prompt text after agent/runtime preparation, when available.
|
|
108
|
+
*/
|
|
109
|
+
readonly rawPromptContent?: string_prompt;
|
|
110
|
+
/**
|
|
111
|
+
* Provider-facing raw request payload, when available.
|
|
112
|
+
*/
|
|
113
|
+
readonly rawRequest?: TODO_object | null;
|
|
114
|
+
};
|
|
55
115
|
/**
|
|
56
116
|
* Represents a single message within a chat interface.
|
|
57
117
|
*
|
|
@@ -165,7 +225,23 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
165
225
|
* Optional structured progress-card payload shown while a response is still in progress.
|
|
166
226
|
*/
|
|
167
227
|
readonly progressCard?: ChatProgressCard;
|
|
228
|
+
/**
|
|
229
|
+
* Optional list of tools that were available to the model when generating this message.
|
|
230
|
+
*
|
|
231
|
+
* This field is populated by the server from the exact tool definitions passed to the LLM
|
|
232
|
+
* request so developers can inspect what capabilities the model had access to during
|
|
233
|
+
* each conversation turn.
|
|
234
|
+
*/
|
|
235
|
+
readonly availableTools?: ReadonlyArray<LlmToolDefinition>;
|
|
236
|
+
/**
|
|
237
|
+
* Optional prompt snapshot from which this message was generated.
|
|
238
|
+
*
|
|
239
|
+
* Intended for advanced/raw inspection so developers can see the exact chat prompt,
|
|
240
|
+
* resolved parameters, tool availability, and provider payload associated with one turn.
|
|
241
|
+
*/
|
|
242
|
+
readonly prompt?: ChatMessagePrompt;
|
|
168
243
|
};
|
|
244
|
+
export {};
|
|
169
245
|
/**
|
|
170
246
|
* TODO: Make all fields readonly
|
|
171
247
|
* TODO: Delete `expectedAnswer` from ChatMessage
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale-aware date/time labels derived from one tool-call timestamp.
|
|
3
|
+
*
|
|
4
|
+
* @private utility of `<Chat/>`
|
|
5
|
+
*/
|
|
6
|
+
type ToolCallDateTimeLabels = {
|
|
7
|
+
/**
|
|
8
|
+
* Primary local time label shown in chips and clock panels.
|
|
9
|
+
*/
|
|
10
|
+
readonly localTimeLabel: string;
|
|
11
|
+
/**
|
|
12
|
+
* Local calendar date label shown under the primary time.
|
|
13
|
+
*/
|
|
14
|
+
readonly localDateLabel: string;
|
|
15
|
+
/**
|
|
16
|
+
* Exact local timestamp label used in detail sections.
|
|
17
|
+
*/
|
|
18
|
+
readonly localDateTimeLabel: string;
|
|
19
|
+
/**
|
|
20
|
+
* Relative label such as `in 5 minutes` or `2 minutes ago`.
|
|
21
|
+
*/
|
|
22
|
+
readonly relativeTimeLabel: string | null;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Formats one tool-call timestamp into shared locale-aware labels.
|
|
26
|
+
*
|
|
27
|
+
* @param date - Timestamp to format.
|
|
28
|
+
* @param options - Optional locale and relative-time reference point.
|
|
29
|
+
* @returns Shared labels consumed by tool-call chips and modals.
|
|
30
|
+
*
|
|
31
|
+
* @private utility of `<Chat/>`
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatToolCallDateTime(date: Date, options?: {
|
|
34
|
+
locale?: string;
|
|
35
|
+
currentDate?: Date;
|
|
36
|
+
}): ToolCallDateTimeLabels;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a Date as a locale-aware short time string (e.g. "5:30 PM" or "17:30").
|
|
3
|
+
*
|
|
4
|
+
* @param date - Date to format.
|
|
5
|
+
* @param locale - Optional BCP-47 locale string (e.g. `"en"`, `"cs"`).
|
|
6
|
+
* When omitted the browser/OS default locale is used.
|
|
7
|
+
* @returns Formatted time string such as `"5:30 PM"` or `"17:30"`.
|
|
8
|
+
*
|
|
9
|
+
* @private utility of `<Chat/>`
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatToolCallLocalTime(date: Date, locale?: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies `{placeholder}` values to one tool-call translation template.
|
|
3
|
+
*
|
|
4
|
+
* @param template - Template from the host application or fallback copy.
|
|
5
|
+
* @param variables - Placeholder values keyed by variable name.
|
|
6
|
+
* @returns Formatted string ready for rendering.
|
|
7
|
+
*
|
|
8
|
+
* @private utility of `<Chat/>`
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatToolCallTranslationTemplate(template: string, variables: Record<string, string | number>): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'moment/locale/cs';
|
|
1
2
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
2
3
|
/**
|
|
3
4
|
* Display-ready timestamp values for a chat message.
|
|
@@ -21,6 +22,9 @@ export type ChatMessageTimingDisplay = {
|
|
|
21
22
|
/**
|
|
22
23
|
* Builds display-ready timestamp and duration labels for a chat message.
|
|
23
24
|
*
|
|
25
|
+
* @param message - Message with optional timestamp metadata.
|
|
26
|
+
* @param locale - Optional moment locale used for formatting.
|
|
27
|
+
*
|
|
24
28
|
* @private utility of `<Chat/>` component
|
|
25
29
|
*/
|
|
26
|
-
export declare function getChatMessageTimingDisplay(message: ChatMessage): ChatMessageTimingDisplay | null;
|
|
30
|
+
export declare function getChatMessageTimingDisplay(message: ChatMessage, locale?: string): ChatMessageTimingDisplay | null;
|
|
@@ -15,6 +15,25 @@ export type ToolCallChipletInfo = {
|
|
|
15
15
|
*/
|
|
16
16
|
agentData?: AgentChipData;
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Optional user-facing title overrides for technical tool names.
|
|
20
|
+
*
|
|
21
|
+
* @private utility of `<Chat/>`
|
|
22
|
+
*/
|
|
23
|
+
type ToolCallTitleOverrides = Readonly<Record<string, string>>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional localized labels used for user-facing chip text.
|
|
26
|
+
*
|
|
27
|
+
* @private utility of `<Chat/>`
|
|
28
|
+
*/
|
|
29
|
+
type ToolCallChipTranslations = {
|
|
30
|
+
readonly toolCallTimeChipLabel?: string;
|
|
31
|
+
readonly toolCallTimeoutChipLabel?: string;
|
|
32
|
+
readonly toolCallTimeoutChipCancelledLabel?: string;
|
|
33
|
+
readonly toolCallTimeoutChipInactiveLabel?: string;
|
|
34
|
+
readonly toolCallTimeoutChipUpdatedLabel?: string;
|
|
35
|
+
readonly toolCallTimeoutChipFallbackLabel?: string;
|
|
36
|
+
};
|
|
18
37
|
/**
|
|
19
38
|
* Builds display text for a tool call chiplet.
|
|
20
39
|
*
|
|
@@ -35,6 +54,12 @@ export declare const TOOL_TITLES: Record<string, {
|
|
|
35
54
|
/**
|
|
36
55
|
* Gets the chiplet information including text and agent data (for team tools).
|
|
37
56
|
*
|
|
57
|
+
* @param toolCall - Tool call to build chiplet info for.
|
|
58
|
+
* @param locale - Optional BCP-47 locale string used to format time labels.
|
|
59
|
+
* @param titleOverrides - Optional localized titles keyed by tool name.
|
|
60
|
+
* @param chipTranslations - Optional localized chip templates for time-related tools.
|
|
61
|
+
*
|
|
38
62
|
* @private [🧠] Maybe public?
|
|
39
63
|
*/
|
|
40
|
-
export declare function getToolCallChipletInfo(toolCall: ToolCall): ToolCallChipletInfo;
|
|
64
|
+
export declare function getToolCallChipletInfo(toolCall: ToolCall, locale?: string, titleOverrides?: ToolCallTitleOverrides, chipTranslations?: ToolCallChipTranslations): ToolCallChipletInfo;
|
|
65
|
+
export {};
|