@plaisolutions/react 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PlaiChat } from "@plaisolutions/client";
1
+ import { HttpStatusError, PlaiChat } from "@plaisolutions/client";
2
2
  import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { Bot, Brain, Check, CheckCircle2, ChevronDown, CircleX, Copy, Database, File, FileText, Globe, LoaderCircle, MessageSquare, Minus, Plug, Plus, RotateCcw, ThumbsDown, ThumbsUp, Workflow, XCircle } from "lucide-react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -30,6 +30,9 @@ function useChat(options) {
30
30
  const actions = useMemo(() => ({
31
31
  sendMessage: chat.sendMessage.bind(chat),
32
32
  rateMessage: chat.rateMessage.bind(chat),
33
+ getMemoryProposal: chat.getMemoryProposal.bind(chat),
34
+ acceptMemoryProposal: chat.acceptMemoryProposal.bind(chat),
35
+ rejectMemoryProposal: chat.rejectMemoryProposal.bind(chat),
33
36
  getResourceDownloadUrl: chat.getResourceDownloadUrl.bind(chat),
34
37
  resendMessage: chat.resendMessage.bind(chat),
35
38
  transcribeAudio: chat.transcribeAudio.bind(chat),
@@ -49,6 +52,1058 @@ function useChat(options) {
49
52
  };
50
53
  }
51
54
 
55
+ //#endregion
56
+ //#region src/components/internal/tool-locale.ts
57
+ const SUPPORTED_TOOL_LOCALES = new Set([
58
+ "ca",
59
+ "da",
60
+ "de",
61
+ "en",
62
+ "es",
63
+ "fr",
64
+ "it",
65
+ "no",
66
+ "pt",
67
+ "sv"
68
+ ]);
69
+ function getCurrentLocale$1() {
70
+ if (typeof document !== "undefined" && document.documentElement.lang) return document.documentElement.lang;
71
+ return typeof navigator === "undefined" ? "en" : navigator.language;
72
+ }
73
+ function getSupportedToolLocale(locale) {
74
+ const language = (locale ?? getCurrentLocale$1()).trim().toLowerCase().split(/[-_]/)[0];
75
+ const normalizedLanguage = language === "nb" || language === "nn" ? "no" : language;
76
+ return SUPPORTED_TOOL_LOCALES.has(normalizedLanguage) ? normalizedLanguage : "en";
77
+ }
78
+
79
+ //#endregion
80
+ //#region src/components/internal/ui-copy.ts
81
+ const ENGLISH_COPY = {
82
+ close: "Close",
83
+ pending: "pending",
84
+ error: "error",
85
+ completed: "completed",
86
+ status: "Status",
87
+ result: "Result",
88
+ errorDetails: "Error details",
89
+ input: "Input",
90
+ output: "Output",
91
+ type: "Type",
92
+ generatedFiles: "Generated files",
93
+ file: "file",
94
+ files: "files",
95
+ resource: "Resource",
96
+ resources: "Resources",
97
+ datasourceResources: "Datasource resources",
98
+ view: "View",
99
+ openingResource: "Opening resource…",
100
+ resourceOpenFailed: "Unable to open resource. Try again.",
101
+ searching: "Searching…",
102
+ searchResults: "Search results",
103
+ searchingForSources: "Searching for sources…",
104
+ noSourcesReturned: "No sources returned.",
105
+ agent: "Agent",
106
+ agentInvocationResult: "Agent invocation result",
107
+ agentId: "Agent ID",
108
+ executionId: "Execution ID",
109
+ threadId: "Thread ID",
110
+ prompt: "Prompt",
111
+ openConversation: "Open conversation",
112
+ workflow: "Workflow",
113
+ workflowDispatch: "Workflow dispatch",
114
+ workflowDispatchResult: "Workflow dispatch result",
115
+ workflowId: "Workflow ID",
116
+ mcpTool: "MCP tool",
117
+ mcpToolResult: "MCP tool result",
118
+ tool: "Tool",
119
+ server: "Server",
120
+ officeDocuments: "Office documents",
121
+ creatingDocuments: "Creating documents…",
122
+ noFilesGenerated: "No files were generated.",
123
+ httpRequest: "HTTP request",
124
+ httpResponse: "HTTP response",
125
+ requestUrl: "Request URL",
126
+ responseUrl: "Response URL",
127
+ contentType: "Content type",
128
+ response: "Response",
129
+ responseHeaders: "Response headers",
130
+ externalDatasource: "External datasource",
131
+ externalDatasourceResult: "External datasource result",
132
+ sqlQuery: "SQL query",
133
+ queryResults: "Query results",
134
+ noDataToDisplay: "No data to display.",
135
+ property: "Property",
136
+ value: "Value",
137
+ browser: "Browser",
138
+ browserResult: "Browser result",
139
+ expandBrowserResult: "Expand browser result",
140
+ collapseBrowserResult: "Collapse browser result",
141
+ credit: "credit",
142
+ credits: "credits",
143
+ email: "Email",
144
+ subject: "Subject",
145
+ to: "To",
146
+ noRecipientsProvided: "No recipients provided.",
147
+ body: "Body",
148
+ delivery: "Delivery",
149
+ recipients: "Recipients",
150
+ provider: "Provider",
151
+ messageId: "Message ID",
152
+ rawStatus: "Raw status",
153
+ typeMessage: "Type a message...",
154
+ send: "Send",
155
+ stop: "Stop",
156
+ attachFile: "Attach file",
157
+ removeFile: "Remove file",
158
+ uploading: "Uploading",
159
+ processingUpload: "Processing upload",
160
+ uploadFailed: "Upload failed",
161
+ thinking: "Thinking…",
162
+ thoughtProcess: "Thought process",
163
+ collapse: "Collapse",
164
+ expand: "Expand",
165
+ thinkingInProgress: "Thinking in progress",
166
+ thinkingComplete: "Thinking complete",
167
+ uploadedImage: "Uploaded image",
168
+ document: "Document",
169
+ readMore: "Read more",
170
+ readLess: "Read less",
171
+ copy: "Copy",
172
+ copied: "Copied",
173
+ retryResponse: "Retry response",
174
+ ratePositively: "Rate positively",
175
+ rateNegatively: "Rate negatively",
176
+ voiceInput: "Voice input",
177
+ stopRecording: "Stop recording",
178
+ cancelRecording: "Cancel recording",
179
+ requestingMicrophoneAccess: "Requesting microphone access...",
180
+ transcribing: "Transcribing..."
181
+ };
182
+ const TRANSLATIONS = {
183
+ ca: {
184
+ close: "Tanca",
185
+ pending: "pendent",
186
+ error: "error",
187
+ completed: "completat",
188
+ status: "Estat",
189
+ result: "Resultat",
190
+ errorDetails: "Detalls de l’error",
191
+ input: "Entrada",
192
+ output: "Sortida",
193
+ type: "Tipus",
194
+ generatedFiles: "Fitxers generats",
195
+ file: "fitxer",
196
+ files: "fitxers",
197
+ resource: "Recurs",
198
+ resources: "Recursos",
199
+ datasourceResources: "Recursos de la font de dades",
200
+ view: "Mostra",
201
+ openingResource: "Obrint el recurs…",
202
+ resourceOpenFailed: "No s’ha pogut obrir el recurs. Torna-ho a provar.",
203
+ searching: "Cercant…",
204
+ searchResults: "Resultats de cerca",
205
+ searchingForSources: "Cercant fonts…",
206
+ noSourcesReturned: "No s’han trobat fonts.",
207
+ agent: "Agent",
208
+ agentInvocationResult: "Resultat de la invocació de l’agent",
209
+ agentId: "ID de l’agent",
210
+ executionId: "ID d’execució",
211
+ threadId: "ID de la conversa",
212
+ prompt: "Instrucció",
213
+ openConversation: "Obre la conversa",
214
+ workflow: "Flux de treball",
215
+ workflowDispatch: "Execució del flux de treball",
216
+ workflowDispatchResult: "Resultat del flux de treball",
217
+ workflowId: "ID del flux de treball",
218
+ mcpTool: "Eina MCP",
219
+ mcpToolResult: "Resultat de l’eina MCP",
220
+ tool: "Eina",
221
+ server: "Servidor",
222
+ officeDocuments: "Documents d’Office",
223
+ creatingDocuments: "Creant documents…",
224
+ noFilesGenerated: "No s’han generat fitxers.",
225
+ httpRequest: "Sol·licitud HTTP",
226
+ httpResponse: "Resposta HTTP",
227
+ requestUrl: "URL de la sol·licitud",
228
+ responseUrl: "URL de la resposta",
229
+ contentType: "Tipus de contingut",
230
+ response: "Resposta",
231
+ responseHeaders: "Capçaleres de la resposta",
232
+ externalDatasource: "Font de dades externa",
233
+ externalDatasourceResult: "Resultat de la font de dades externa",
234
+ sqlQuery: "Consulta SQL",
235
+ queryResults: "Resultats de la consulta",
236
+ noDataToDisplay: "No hi ha dades per mostrar.",
237
+ property: "Propietat",
238
+ value: "Valor",
239
+ browser: "Navegador",
240
+ browserResult: "Resultat del navegador",
241
+ expandBrowserResult: "Desplega el resultat del navegador",
242
+ collapseBrowserResult: "Plega el resultat del navegador",
243
+ credit: "crèdit",
244
+ credits: "crèdits",
245
+ email: "Correu electrònic",
246
+ subject: "Assumpte",
247
+ to: "Per a",
248
+ noRecipientsProvided: "No s’han indicat destinataris.",
249
+ body: "Cos",
250
+ delivery: "Lliurament",
251
+ recipients: "Destinataris",
252
+ provider: "Proveïdor",
253
+ messageId: "ID del missatge",
254
+ rawStatus: "Estat original",
255
+ typeMessage: "Escriu un missatge...",
256
+ send: "Envia",
257
+ stop: "Atura",
258
+ attachFile: "Adjunta un fitxer",
259
+ removeFile: "Elimina el fitxer",
260
+ uploading: "Pujant",
261
+ processingUpload: "Processant el fitxer",
262
+ uploadFailed: "No s’ha pogut pujar el fitxer",
263
+ thinking: "Pensant…",
264
+ thoughtProcess: "Procés de raonament",
265
+ collapse: "Plega",
266
+ expand: "Desplega",
267
+ thinkingInProgress: "Pensant",
268
+ thinkingComplete: "Raonament completat",
269
+ uploadedImage: "Imatge pujada",
270
+ document: "Document",
271
+ readMore: "Llegeix més",
272
+ readLess: "Llegeix menys",
273
+ copy: "Copia",
274
+ copied: "Copiat",
275
+ retryResponse: "Torna a provar la resposta",
276
+ ratePositively: "Valora positivament",
277
+ rateNegatively: "Valora negativament",
278
+ voiceInput: "Entrada de veu",
279
+ stopRecording: "Atura la gravació",
280
+ cancelRecording: "Cancel·la la gravació",
281
+ requestingMicrophoneAccess: "Sol·licitant accés al micròfon...",
282
+ transcribing: "Transcrivint..."
283
+ },
284
+ da: {
285
+ close: "Luk",
286
+ pending: "afventer",
287
+ error: "fejl",
288
+ completed: "fuldført",
289
+ status: "Status",
290
+ result: "Resultat",
291
+ errorDetails: "Fejldetaljer",
292
+ input: "Input",
293
+ output: "Output",
294
+ type: "Type",
295
+ generatedFiles: "Genererede filer",
296
+ file: "fil",
297
+ files: "filer",
298
+ resource: "Ressource",
299
+ resources: "Ressourcer",
300
+ datasourceResources: "Datakildens ressourcer",
301
+ view: "Vis",
302
+ openingResource: "Åbner ressource…",
303
+ resourceOpenFailed: "Ressourcen kunne ikke åbnes. Prøv igen.",
304
+ searching: "Søger…",
305
+ searchResults: "Søgeresultater",
306
+ searchingForSources: "Søger efter kilder…",
307
+ noSourcesReturned: "Ingen kilder fundet.",
308
+ agent: "Agent",
309
+ agentInvocationResult: "Resultat af agentkald",
310
+ agentId: "Agent-id",
311
+ executionId: "Udførelses-id",
312
+ threadId: "Samtale-id",
313
+ prompt: "Instruktion",
314
+ openConversation: "Åbn samtale",
315
+ workflow: "Arbejdsgang",
316
+ workflowDispatch: "Udførelse af arbejdsgang",
317
+ workflowDispatchResult: "Resultat af arbejdsgang",
318
+ workflowId: "Arbejdsgangs-id",
319
+ mcpTool: "MCP-værktøj",
320
+ mcpToolResult: "Resultat fra MCP-værktøj",
321
+ tool: "Værktøj",
322
+ server: "Server",
323
+ officeDocuments: "Office-dokumenter",
324
+ creatingDocuments: "Opretter dokumenter…",
325
+ noFilesGenerated: "Ingen filer blev genereret.",
326
+ httpRequest: "HTTP-anmodning",
327
+ httpResponse: "HTTP-svar",
328
+ requestUrl: "Anmodnings-URL",
329
+ responseUrl: "Svar-URL",
330
+ contentType: "Indholdstype",
331
+ response: "Svar",
332
+ responseHeaders: "Svarheadere",
333
+ externalDatasource: "Ekstern datakilde",
334
+ externalDatasourceResult: "Resultat fra ekstern datakilde",
335
+ sqlQuery: "SQL-forespørgsel",
336
+ queryResults: "Forespørgselsresultater",
337
+ noDataToDisplay: "Ingen data at vise.",
338
+ property: "Egenskab",
339
+ value: "Værdi",
340
+ browser: "Browser",
341
+ browserResult: "Browserresultat",
342
+ expandBrowserResult: "Udvid browserresultat",
343
+ collapseBrowserResult: "Skjul browserresultat",
344
+ credit: "kredit",
345
+ credits: "kreditter",
346
+ email: "E-mail",
347
+ subject: "Emne",
348
+ to: "Til",
349
+ noRecipientsProvided: "Ingen modtagere angivet.",
350
+ body: "Indhold",
351
+ delivery: "Levering",
352
+ recipients: "Modtagere",
353
+ provider: "Udbyder",
354
+ messageId: "Besked-id",
355
+ rawStatus: "Oprindelig status",
356
+ typeMessage: "Skriv en besked...",
357
+ send: "Send",
358
+ stop: "Stop",
359
+ attachFile: "Vedhæft fil",
360
+ removeFile: "Fjern fil",
361
+ uploading: "Uploader",
362
+ processingUpload: "Behandler fil",
363
+ uploadFailed: "Upload mislykkedes",
364
+ thinking: "Tænker…",
365
+ thoughtProcess: "Tankeproces",
366
+ collapse: "Skjul",
367
+ expand: "Udvid",
368
+ thinkingInProgress: "Tænker",
369
+ thinkingComplete: "Tænkning afsluttet",
370
+ uploadedImage: "Uploadet billede",
371
+ document: "Dokument",
372
+ readMore: "Læs mere",
373
+ readLess: "Læs mindre",
374
+ copy: "Kopiér",
375
+ copied: "Kopieret",
376
+ retryResponse: "Prøv svaret igen",
377
+ ratePositively: "Bedøm positivt",
378
+ rateNegatively: "Bedøm negativt",
379
+ voiceInput: "Stemmeinput",
380
+ stopRecording: "Stop optagelse",
381
+ cancelRecording: "Annuller optagelse",
382
+ requestingMicrophoneAccess: "Anmoder om adgang til mikrofon...",
383
+ transcribing: "Transskriberer..."
384
+ },
385
+ de: {
386
+ close: "Schließen",
387
+ pending: "ausstehend",
388
+ error: "Fehler",
389
+ completed: "abgeschlossen",
390
+ status: "Status",
391
+ result: "Ergebnis",
392
+ errorDetails: "Fehlerdetails",
393
+ input: "Eingabe",
394
+ output: "Ausgabe",
395
+ type: "Typ",
396
+ generatedFiles: "Erstellte Dateien",
397
+ file: "Datei",
398
+ files: "Dateien",
399
+ resource: "Ressource",
400
+ resources: "Ressourcen",
401
+ datasourceResources: "Ressourcen der Datenquelle",
402
+ view: "Anzeigen",
403
+ openingResource: "Ressource wird geöffnet…",
404
+ resourceOpenFailed: "Ressource konnte nicht geöffnet werden. Erneut versuchen.",
405
+ searching: "Suche läuft…",
406
+ searchResults: "Suchergebnisse",
407
+ searchingForSources: "Quellen werden gesucht…",
408
+ noSourcesReturned: "Keine Quellen gefunden.",
409
+ agent: "Agent",
410
+ agentInvocationResult: "Ergebnis des Agentenaufrufs",
411
+ agentId: "Agenten-ID",
412
+ executionId: "Ausführungs-ID",
413
+ threadId: "Konversations-ID",
414
+ prompt: "Anweisung",
415
+ openConversation: "Konversation öffnen",
416
+ workflow: "Workflow",
417
+ workflowDispatch: "Workflow-Ausführung",
418
+ workflowDispatchResult: "Ergebnis der Workflow-Ausführung",
419
+ workflowId: "Workflow-ID",
420
+ mcpTool: "MCP-Tool",
421
+ mcpToolResult: "Ergebnis des MCP-Tools",
422
+ tool: "Tool",
423
+ server: "Server",
424
+ officeDocuments: "Office-Dokumente",
425
+ creatingDocuments: "Dokumente werden erstellt…",
426
+ noFilesGenerated: "Es wurden keine Dateien erstellt.",
427
+ httpRequest: "HTTP-Anfrage",
428
+ httpResponse: "HTTP-Antwort",
429
+ requestUrl: "Anfrage-URL",
430
+ responseUrl: "Antwort-URL",
431
+ contentType: "Inhaltstyp",
432
+ response: "Antwort",
433
+ responseHeaders: "Antwort-Header",
434
+ externalDatasource: "Externe Datenquelle",
435
+ externalDatasourceResult: "Ergebnis der externen Datenquelle",
436
+ sqlQuery: "SQL-Abfrage",
437
+ queryResults: "Abfrageergebnisse",
438
+ noDataToDisplay: "Keine Daten zum Anzeigen.",
439
+ property: "Eigenschaft",
440
+ value: "Wert",
441
+ browser: "Browser",
442
+ browserResult: "Browser-Ergebnis",
443
+ expandBrowserResult: "Browser-Ergebnis erweitern",
444
+ collapseBrowserResult: "Browser-Ergebnis einklappen",
445
+ credit: "Guthabenpunkt",
446
+ credits: "Guthabenpunkte",
447
+ email: "E-Mail",
448
+ subject: "Betreff",
449
+ to: "An",
450
+ noRecipientsProvided: "Keine Empfänger angegeben.",
451
+ body: "Nachrichtentext",
452
+ delivery: "Zustellung",
453
+ recipients: "Empfänger",
454
+ provider: "Anbieter",
455
+ messageId: "Nachrichten-ID",
456
+ rawStatus: "Ursprünglicher Status",
457
+ typeMessage: "Nachricht eingeben...",
458
+ send: "Senden",
459
+ stop: "Stoppen",
460
+ attachFile: "Datei anhängen",
461
+ removeFile: "Datei entfernen",
462
+ uploading: "Wird hochgeladen",
463
+ processingUpload: "Datei wird verarbeitet",
464
+ uploadFailed: "Hochladen fehlgeschlagen",
465
+ thinking: "Denkt nach…",
466
+ thoughtProcess: "Denkprozess",
467
+ collapse: "Einklappen",
468
+ expand: "Erweitern",
469
+ thinkingInProgress: "Denkt nach",
470
+ thinkingComplete: "Denken abgeschlossen",
471
+ uploadedImage: "Hochgeladenes Bild",
472
+ document: "Dokument",
473
+ readMore: "Mehr lesen",
474
+ readLess: "Weniger lesen",
475
+ copy: "Kopieren",
476
+ copied: "Kopiert",
477
+ retryResponse: "Antwort erneut versuchen",
478
+ ratePositively: "Positiv bewerten",
479
+ rateNegatively: "Negativ bewerten",
480
+ voiceInput: "Spracheingabe",
481
+ stopRecording: "Aufnahme stoppen",
482
+ cancelRecording: "Aufnahme abbrechen",
483
+ requestingMicrophoneAccess: "Mikrofonzugriff wird angefordert...",
484
+ transcribing: "Wird transkribiert..."
485
+ },
486
+ en: {},
487
+ es: {
488
+ close: "Cerrar",
489
+ pending: "pendiente",
490
+ error: "error",
491
+ completed: "completado",
492
+ status: "Estado",
493
+ result: "Resultado",
494
+ errorDetails: "Detalles del error",
495
+ input: "Entrada",
496
+ output: "Salida",
497
+ type: "Tipo",
498
+ generatedFiles: "Archivos generados",
499
+ file: "archivo",
500
+ files: "archivos",
501
+ resource: "Recurso",
502
+ resources: "Recursos",
503
+ datasourceResources: "Recursos de la fuente de datos",
504
+ view: "Ver",
505
+ openingResource: "Abriendo recurso…",
506
+ resourceOpenFailed: "No se pudo abrir el recurso. Inténtalo de nuevo.",
507
+ searching: "Buscando…",
508
+ searchResults: "Resultados de búsqueda",
509
+ searchingForSources: "Buscando fuentes…",
510
+ noSourcesReturned: "No se encontraron fuentes.",
511
+ agent: "Agente",
512
+ agentInvocationResult: "Resultado de la invocación del agente",
513
+ agentId: "ID del agente",
514
+ executionId: "ID de ejecución",
515
+ threadId: "ID de conversación",
516
+ prompt: "Instrucción",
517
+ openConversation: "Abrir conversación",
518
+ workflow: "Flujo de trabajo",
519
+ workflowDispatch: "Ejecución del flujo de trabajo",
520
+ workflowDispatchResult: "Resultado del flujo de trabajo",
521
+ workflowId: "ID del flujo de trabajo",
522
+ mcpTool: "Herramienta MCP",
523
+ mcpToolResult: "Resultado de la herramienta MCP",
524
+ tool: "Herramienta",
525
+ server: "Servidor",
526
+ officeDocuments: "Documentos de Office",
527
+ creatingDocuments: "Creando documentos…",
528
+ noFilesGenerated: "No se generaron archivos.",
529
+ httpRequest: "Solicitud HTTP",
530
+ httpResponse: "Respuesta HTTP",
531
+ requestUrl: "URL de la solicitud",
532
+ responseUrl: "URL de la respuesta",
533
+ contentType: "Tipo de contenido",
534
+ response: "Respuesta",
535
+ responseHeaders: "Encabezados de respuesta",
536
+ externalDatasource: "Fuente de datos externa",
537
+ externalDatasourceResult: "Resultado de la fuente de datos externa",
538
+ sqlQuery: "Consulta SQL",
539
+ queryResults: "Resultados de la consulta",
540
+ noDataToDisplay: "No hay datos que mostrar.",
541
+ property: "Propiedad",
542
+ value: "Valor",
543
+ browser: "Navegador",
544
+ browserResult: "Resultado del navegador",
545
+ expandBrowserResult: "Expandir resultado del navegador",
546
+ collapseBrowserResult: "Contraer resultado del navegador",
547
+ credit: "crédito",
548
+ credits: "créditos",
549
+ email: "Correo electrónico",
550
+ subject: "Asunto",
551
+ to: "Para",
552
+ noRecipientsProvided: "No se indicaron destinatarios.",
553
+ body: "Cuerpo",
554
+ delivery: "Entrega",
555
+ recipients: "Destinatarios",
556
+ provider: "Proveedor",
557
+ messageId: "ID del mensaje",
558
+ rawStatus: "Estado original",
559
+ typeMessage: "Escribe un mensaje...",
560
+ send: "Enviar",
561
+ stop: "Detener",
562
+ attachFile: "Adjuntar archivo",
563
+ removeFile: "Quitar archivo",
564
+ uploading: "Subiendo",
565
+ processingUpload: "Procesando archivo",
566
+ uploadFailed: "Error al subir el archivo",
567
+ thinking: "Pensando…",
568
+ thoughtProcess: "Proceso de razonamiento",
569
+ collapse: "Contraer",
570
+ expand: "Expandir",
571
+ thinkingInProgress: "Pensando",
572
+ thinkingComplete: "Pensamiento completado",
573
+ uploadedImage: "Imagen subida",
574
+ document: "Documento",
575
+ readMore: "Leer más",
576
+ readLess: "Leer menos",
577
+ copy: "Copiar",
578
+ copied: "Copiado",
579
+ retryResponse: "Reintentar respuesta",
580
+ ratePositively: "Valorar positivamente",
581
+ rateNegatively: "Valorar negativamente",
582
+ voiceInput: "Entrada de voz",
583
+ stopRecording: "Detener grabación",
584
+ cancelRecording: "Cancelar grabación",
585
+ requestingMicrophoneAccess: "Solicitando acceso al micrófono...",
586
+ transcribing: "Transcribiendo..."
587
+ },
588
+ fr: {
589
+ close: "Fermer",
590
+ pending: "en attente",
591
+ error: "erreur",
592
+ completed: "terminé",
593
+ status: "Statut",
594
+ result: "Résultat",
595
+ errorDetails: "Détails de l’erreur",
596
+ input: "Entrée",
597
+ output: "Sortie",
598
+ type: "Type",
599
+ generatedFiles: "Fichiers générés",
600
+ file: "fichier",
601
+ files: "fichiers",
602
+ resource: "Ressource",
603
+ resources: "Ressources",
604
+ datasourceResources: "Ressources de la source de données",
605
+ view: "Voir",
606
+ openingResource: "Ouverture de la ressource…",
607
+ resourceOpenFailed: "Impossible d’ouvrir la ressource. Réessayez.",
608
+ searching: "Recherche…",
609
+ searchResults: "Résultats de recherche",
610
+ searchingForSources: "Recherche de sources…",
611
+ noSourcesReturned: "Aucune source trouvée.",
612
+ agent: "Agent",
613
+ agentInvocationResult: "Résultat de l’exécution de l’agent",
614
+ agentId: "ID de l’agent",
615
+ executionId: "ID d’exécution",
616
+ threadId: "ID de la conversation",
617
+ prompt: "Instruction",
618
+ openConversation: "Ouvrir la conversation",
619
+ workflow: "Flux de travail",
620
+ workflowDispatch: "Exécution du flux de travail",
621
+ workflowDispatchResult: "Résultat du flux de travail",
622
+ workflowId: "ID du flux de travail",
623
+ mcpTool: "Outil MCP",
624
+ mcpToolResult: "Résultat de l’outil MCP",
625
+ tool: "Outil",
626
+ server: "Serveur",
627
+ officeDocuments: "Documents Office",
628
+ creatingDocuments: "Création des documents…",
629
+ noFilesGenerated: "Aucun fichier n’a été généré.",
630
+ httpRequest: "Requête HTTP",
631
+ httpResponse: "Réponse HTTP",
632
+ requestUrl: "URL de la requête",
633
+ responseUrl: "URL de la réponse",
634
+ contentType: "Type de contenu",
635
+ response: "Réponse",
636
+ responseHeaders: "En-têtes de réponse",
637
+ externalDatasource: "Source de données externe",
638
+ externalDatasourceResult: "Résultat de la source de données externe",
639
+ sqlQuery: "Requête SQL",
640
+ queryResults: "Résultats de la requête",
641
+ noDataToDisplay: "Aucune donnée à afficher.",
642
+ property: "Propriété",
643
+ value: "Valeur",
644
+ browser: "Navigateur",
645
+ browserResult: "Résultat du navigateur",
646
+ expandBrowserResult: "Développer le résultat du navigateur",
647
+ collapseBrowserResult: "Réduire le résultat du navigateur",
648
+ credit: "crédit",
649
+ credits: "crédits",
650
+ email: "E-mail",
651
+ subject: "Objet",
652
+ to: "À",
653
+ noRecipientsProvided: "Aucun destinataire indiqué.",
654
+ body: "Corps du message",
655
+ delivery: "Envoi",
656
+ recipients: "Destinataires",
657
+ provider: "Fournisseur",
658
+ messageId: "ID du message",
659
+ rawStatus: "Statut brut",
660
+ typeMessage: "Saisissez un message...",
661
+ send: "Envoyer",
662
+ stop: "Arrêter",
663
+ attachFile: "Joindre un fichier",
664
+ removeFile: "Supprimer le fichier",
665
+ uploading: "Téléversement",
666
+ processingUpload: "Traitement du fichier",
667
+ uploadFailed: "Échec du téléversement",
668
+ thinking: "Réflexion…",
669
+ thoughtProcess: "Processus de réflexion",
670
+ collapse: "Réduire",
671
+ expand: "Développer",
672
+ thinkingInProgress: "Réflexion en cours",
673
+ thinkingComplete: "Réflexion terminée",
674
+ uploadedImage: "Image téléversée",
675
+ document: "Document",
676
+ readMore: "Lire la suite",
677
+ readLess: "Lire moins",
678
+ copy: "Copier",
679
+ copied: "Copié",
680
+ retryResponse: "Réessayer la réponse",
681
+ ratePositively: "Évaluer positivement",
682
+ rateNegatively: "Évaluer négativement",
683
+ voiceInput: "Saisie vocale",
684
+ stopRecording: "Arrêter l’enregistrement",
685
+ cancelRecording: "Annuler l’enregistrement",
686
+ requestingMicrophoneAccess: "Demande d’accès au microphone...",
687
+ transcribing: "Transcription en cours..."
688
+ },
689
+ it: {
690
+ close: "Chiudi",
691
+ pending: "in attesa",
692
+ error: "errore",
693
+ completed: "completato",
694
+ status: "Stato",
695
+ result: "Risultato",
696
+ errorDetails: "Dettagli dell’errore",
697
+ input: "Input",
698
+ output: "Output",
699
+ type: "Tipo",
700
+ generatedFiles: "File generati",
701
+ file: "file",
702
+ files: "file",
703
+ resource: "Risorsa",
704
+ resources: "Risorse",
705
+ datasourceResources: "Risorse della fonte dati",
706
+ view: "Visualizza",
707
+ openingResource: "Apertura della risorsa…",
708
+ resourceOpenFailed: "Impossibile aprire la risorsa. Riprova.",
709
+ searching: "Ricerca…",
710
+ searchResults: "Risultati della ricerca",
711
+ searchingForSources: "Ricerca delle fonti…",
712
+ noSourcesReturned: "Nessuna fonte trovata.",
713
+ agent: "Agente",
714
+ agentInvocationResult: "Risultato dell’esecuzione dell’agente",
715
+ agentId: "ID dell’agente",
716
+ executionId: "ID esecuzione",
717
+ threadId: "ID conversazione",
718
+ prompt: "Istruzione",
719
+ openConversation: "Apri conversazione",
720
+ workflow: "Flusso di lavoro",
721
+ workflowDispatch: "Esecuzione del flusso di lavoro",
722
+ workflowDispatchResult: "Risultato del flusso di lavoro",
723
+ workflowId: "ID del flusso di lavoro",
724
+ mcpTool: "Strumento MCP",
725
+ mcpToolResult: "Risultato dello strumento MCP",
726
+ tool: "Strumento",
727
+ server: "Server",
728
+ officeDocuments: "Documenti Office",
729
+ creatingDocuments: "Creazione dei documenti…",
730
+ noFilesGenerated: "Nessun file generato.",
731
+ httpRequest: "Richiesta HTTP",
732
+ httpResponse: "Risposta HTTP",
733
+ requestUrl: "URL della richiesta",
734
+ responseUrl: "URL della risposta",
735
+ contentType: "Tipo di contenuto",
736
+ response: "Risposta",
737
+ responseHeaders: "Intestazioni della risposta",
738
+ externalDatasource: "Fonte dati esterna",
739
+ externalDatasourceResult: "Risultato della fonte dati esterna",
740
+ sqlQuery: "Query SQL",
741
+ queryResults: "Risultati della query",
742
+ noDataToDisplay: "Nessun dato da visualizzare.",
743
+ property: "Proprietà",
744
+ value: "Valore",
745
+ browser: "Browser",
746
+ browserResult: "Risultato del browser",
747
+ expandBrowserResult: "Espandi il risultato del browser",
748
+ collapseBrowserResult: "Comprimi il risultato del browser",
749
+ credit: "credito",
750
+ credits: "crediti",
751
+ email: "Email",
752
+ subject: "Oggetto",
753
+ to: "A",
754
+ noRecipientsProvided: "Nessun destinatario indicato.",
755
+ body: "Corpo",
756
+ delivery: "Invio",
757
+ recipients: "Destinatari",
758
+ provider: "Fornitore",
759
+ messageId: "ID messaggio",
760
+ rawStatus: "Stato originale",
761
+ typeMessage: "Scrivi un messaggio...",
762
+ send: "Invia",
763
+ stop: "Interrompi",
764
+ attachFile: "Allega un file",
765
+ removeFile: "Rimuovi il file",
766
+ uploading: "Caricamento",
767
+ processingUpload: "Elaborazione del file",
768
+ uploadFailed: "Caricamento non riuscito",
769
+ thinking: "Riflessione…",
770
+ thoughtProcess: "Processo di ragionamento",
771
+ collapse: "Comprimi",
772
+ expand: "Espandi",
773
+ thinkingInProgress: "Riflessione in corso",
774
+ thinkingComplete: "Riflessione completata",
775
+ uploadedImage: "Immagine caricata",
776
+ document: "Documento",
777
+ readMore: "Leggi di più",
778
+ readLess: "Leggi meno",
779
+ copy: "Copia",
780
+ copied: "Copiato",
781
+ retryResponse: "Riprova la risposta",
782
+ ratePositively: "Valuta positivamente",
783
+ rateNegatively: "Valuta negativamente",
784
+ voiceInput: "Input vocale",
785
+ stopRecording: "Interrompi la registrazione",
786
+ cancelRecording: "Annulla la registrazione",
787
+ requestingMicrophoneAccess: "Richiesta di accesso al microfono...",
788
+ transcribing: "Trascrizione in corso..."
789
+ },
790
+ no: {
791
+ close: "Lukk",
792
+ pending: "venter",
793
+ error: "feil",
794
+ completed: "fullført",
795
+ status: "Status",
796
+ result: "Resultat",
797
+ errorDetails: "Feildetaljer",
798
+ input: "Inndata",
799
+ output: "Utdata",
800
+ type: "Type",
801
+ generatedFiles: "Genererte filer",
802
+ file: "fil",
803
+ files: "filer",
804
+ resource: "Ressurs",
805
+ resources: "Ressurser",
806
+ datasourceResources: "Datakildens ressurser",
807
+ view: "Vis",
808
+ openingResource: "Åpner ressurs…",
809
+ resourceOpenFailed: "Kunne ikke åpne ressursen. Prøv igjen.",
810
+ searching: "Søker…",
811
+ searchResults: "Søkeresultater",
812
+ searchingForSources: "Søker etter kilder…",
813
+ noSourcesReturned: "Ingen kilder funnet.",
814
+ agent: "Agent",
815
+ agentInvocationResult: "Resultat fra agentkall",
816
+ agentId: "Agent-ID",
817
+ executionId: "Kjørings-ID",
818
+ threadId: "Samtale-ID",
819
+ prompt: "Instruksjon",
820
+ openConversation: "Åpne samtale",
821
+ workflow: "Arbeidsflyt",
822
+ workflowDispatch: "Kjøring av arbeidsflyt",
823
+ workflowDispatchResult: "Resultat fra arbeidsflyten",
824
+ workflowId: "Arbeidsflyt-ID",
825
+ mcpTool: "MCP-verktøy",
826
+ mcpToolResult: "Resultat fra MCP-verktøyet",
827
+ tool: "Verktøy",
828
+ server: "Server",
829
+ officeDocuments: "Office-dokumenter",
830
+ creatingDocuments: "Oppretter dokumenter…",
831
+ noFilesGenerated: "Ingen filer ble generert.",
832
+ httpRequest: "HTTP-forespørsel",
833
+ httpResponse: "HTTP-svar",
834
+ requestUrl: "Forespørsels-URL",
835
+ responseUrl: "Svar-URL",
836
+ contentType: "Innholdstype",
837
+ response: "Svar",
838
+ responseHeaders: "Svarhoder",
839
+ externalDatasource: "Ekstern datakilde",
840
+ externalDatasourceResult: "Resultat fra ekstern datakilde",
841
+ sqlQuery: "SQL-spørring",
842
+ queryResults: "Spørringsresultater",
843
+ noDataToDisplay: "Ingen data å vise.",
844
+ property: "Egenskap",
845
+ value: "Verdi",
846
+ browser: "Nettleser",
847
+ browserResult: "Nettleserresultat",
848
+ expandBrowserResult: "Utvid nettleserresultat",
849
+ collapseBrowserResult: "Skjul nettleserresultat",
850
+ credit: "kreditt",
851
+ credits: "kreditter",
852
+ email: "E-post",
853
+ subject: "Emne",
854
+ to: "Til",
855
+ noRecipientsProvided: "Ingen mottakere oppgitt.",
856
+ body: "Innhold",
857
+ delivery: "Levering",
858
+ recipients: "Mottakere",
859
+ provider: "Leverandør",
860
+ messageId: "Meldings-ID",
861
+ rawStatus: "Opprinnelig status",
862
+ typeMessage: "Skriv en melding...",
863
+ send: "Send",
864
+ stop: "Stopp",
865
+ attachFile: "Legg ved fil",
866
+ removeFile: "Fjern fil",
867
+ uploading: "Laster opp",
868
+ processingUpload: "Behandler fil",
869
+ uploadFailed: "Opplasting mislyktes",
870
+ thinking: "Tenker…",
871
+ thoughtProcess: "Tankeprosess",
872
+ collapse: "Skjul",
873
+ expand: "Utvid",
874
+ thinkingInProgress: "Tenker",
875
+ thinkingComplete: "Tenkingen er ferdig",
876
+ uploadedImage: "Opplastet bilde",
877
+ document: "Dokument",
878
+ readMore: "Les mer",
879
+ readLess: "Les mindre",
880
+ copy: "Kopier",
881
+ copied: "Kopiert",
882
+ retryResponse: "Prøv svaret på nytt",
883
+ ratePositively: "Vurder positivt",
884
+ rateNegatively: "Vurder negativt",
885
+ voiceInput: "Taleinndata",
886
+ stopRecording: "Stopp opptak",
887
+ cancelRecording: "Avbryt opptak",
888
+ requestingMicrophoneAccess: "Ber om tilgang til mikrofonen...",
889
+ transcribing: "Transkriberer..."
890
+ },
891
+ pt: {
892
+ close: "Fechar",
893
+ pending: "pendente",
894
+ error: "erro",
895
+ completed: "concluído",
896
+ status: "Estado",
897
+ result: "Resultado",
898
+ errorDetails: "Detalhes do erro",
899
+ input: "Entrada",
900
+ output: "Saída",
901
+ type: "Tipo",
902
+ generatedFiles: "Ficheiros gerados",
903
+ file: "ficheiro",
904
+ files: "ficheiros",
905
+ resource: "Recurso",
906
+ resources: "Recursos",
907
+ datasourceResources: "Recursos da fonte de dados",
908
+ view: "Ver",
909
+ openingResource: "A abrir o recurso…",
910
+ resourceOpenFailed: "Não foi possível abrir o recurso. Tente novamente.",
911
+ searching: "A pesquisar…",
912
+ searchResults: "Resultados da pesquisa",
913
+ searchingForSources: "A pesquisar fontes…",
914
+ noSourcesReturned: "Não foram encontradas fontes.",
915
+ agent: "Agente",
916
+ agentInvocationResult: "Resultado da execução do agente",
917
+ agentId: "ID do agente",
918
+ executionId: "ID de execução",
919
+ threadId: "ID da conversa",
920
+ prompt: "Instrução",
921
+ openConversation: "Abrir conversa",
922
+ workflow: "Fluxo de trabalho",
923
+ workflowDispatch: "Execução do fluxo de trabalho",
924
+ workflowDispatchResult: "Resultado do fluxo de trabalho",
925
+ workflowId: "ID do fluxo de trabalho",
926
+ mcpTool: "Ferramenta MCP",
927
+ mcpToolResult: "Resultado da ferramenta MCP",
928
+ tool: "Ferramenta",
929
+ server: "Servidor",
930
+ officeDocuments: "Documentos do Office",
931
+ creatingDocuments: "A criar documentos…",
932
+ noFilesGenerated: "Não foram gerados ficheiros.",
933
+ httpRequest: "Pedido HTTP",
934
+ httpResponse: "Resposta HTTP",
935
+ requestUrl: "URL do pedido",
936
+ responseUrl: "URL da resposta",
937
+ contentType: "Tipo de conteúdo",
938
+ response: "Resposta",
939
+ responseHeaders: "Cabeçalhos da resposta",
940
+ externalDatasource: "Fonte de dados externa",
941
+ externalDatasourceResult: "Resultado da fonte de dados externa",
942
+ sqlQuery: "Consulta SQL",
943
+ queryResults: "Resultados da consulta",
944
+ noDataToDisplay: "Não há dados para apresentar.",
945
+ property: "Propriedade",
946
+ value: "Valor",
947
+ browser: "Navegador",
948
+ browserResult: "Resultado do navegador",
949
+ expandBrowserResult: "Expandir resultado do navegador",
950
+ collapseBrowserResult: "Recolher resultado do navegador",
951
+ credit: "crédito",
952
+ credits: "créditos",
953
+ email: "E-mail",
954
+ subject: "Assunto",
955
+ to: "Para",
956
+ noRecipientsProvided: "Não foram indicados destinatários.",
957
+ body: "Corpo",
958
+ delivery: "Entrega",
959
+ recipients: "Destinatários",
960
+ provider: "Fornecedor",
961
+ messageId: "ID da mensagem",
962
+ rawStatus: "Estado original",
963
+ typeMessage: "Escreva uma mensagem...",
964
+ send: "Enviar",
965
+ stop: "Parar",
966
+ attachFile: "Anexar ficheiro",
967
+ removeFile: "Remover ficheiro",
968
+ uploading: "A carregar",
969
+ processingUpload: "A processar o ficheiro",
970
+ uploadFailed: "Falha ao carregar o ficheiro",
971
+ thinking: "A pensar…",
972
+ thoughtProcess: "Processo de raciocínio",
973
+ collapse: "Recolher",
974
+ expand: "Expandir",
975
+ thinkingInProgress: "Raciocínio em curso",
976
+ thinkingComplete: "Raciocínio concluído",
977
+ uploadedImage: "Imagem carregada",
978
+ document: "Documento",
979
+ readMore: "Ler mais",
980
+ readLess: "Ler menos",
981
+ copy: "Copiar",
982
+ copied: "Copiado",
983
+ retryResponse: "Tentar novamente a resposta",
984
+ ratePositively: "Avaliar positivamente",
985
+ rateNegatively: "Avaliar negativamente",
986
+ voiceInput: "Entrada de voz",
987
+ stopRecording: "Parar gravação",
988
+ cancelRecording: "Cancelar gravação",
989
+ requestingMicrophoneAccess: "A pedir acesso ao microfone...",
990
+ transcribing: "A transcrever..."
991
+ },
992
+ sv: {
993
+ close: "Stäng",
994
+ pending: "väntar",
995
+ error: "fel",
996
+ completed: "slutförd",
997
+ status: "Status",
998
+ result: "Resultat",
999
+ errorDetails: "Feldetaljer",
1000
+ input: "Indata",
1001
+ output: "Utdata",
1002
+ type: "Typ",
1003
+ generatedFiles: "Genererade filer",
1004
+ file: "fil",
1005
+ files: "filer",
1006
+ resource: "Resurs",
1007
+ resources: "Resurser",
1008
+ datasourceResources: "Datakällans resurser",
1009
+ view: "Visa",
1010
+ openingResource: "Öppnar resurs…",
1011
+ resourceOpenFailed: "Det gick inte att öppna resursen. Försök igen.",
1012
+ searching: "Söker…",
1013
+ searchResults: "Sökresultat",
1014
+ searchingForSources: "Söker efter källor…",
1015
+ noSourcesReturned: "Inga källor hittades.",
1016
+ agent: "Agent",
1017
+ agentInvocationResult: "Resultat från agentanrop",
1018
+ agentId: "Agent-ID",
1019
+ executionId: "Körnings-ID",
1020
+ threadId: "Konversations-ID",
1021
+ prompt: "Instruktion",
1022
+ openConversation: "Öppna konversation",
1023
+ workflow: "Arbetsflöde",
1024
+ workflowDispatch: "Körning av arbetsflöde",
1025
+ workflowDispatchResult: "Resultat från arbetsflödet",
1026
+ workflowId: "Arbetsflödes-ID",
1027
+ mcpTool: "MCP-verktyg",
1028
+ mcpToolResult: "Resultat från MCP-verktyget",
1029
+ tool: "Verktyg",
1030
+ server: "Server",
1031
+ officeDocuments: "Office-dokument",
1032
+ creatingDocuments: "Skapar dokument…",
1033
+ noFilesGenerated: "Inga filer genererades.",
1034
+ httpRequest: "HTTP-begäran",
1035
+ httpResponse: "HTTP-svar",
1036
+ requestUrl: "Begärans URL",
1037
+ responseUrl: "Svarets URL",
1038
+ contentType: "Innehållstyp",
1039
+ response: "Svar",
1040
+ responseHeaders: "Svarsrubriker",
1041
+ externalDatasource: "Extern datakälla",
1042
+ externalDatasourceResult: "Resultat från extern datakälla",
1043
+ sqlQuery: "SQL-fråga",
1044
+ queryResults: "Frågeresultat",
1045
+ noDataToDisplay: "Inga data att visa.",
1046
+ property: "Egenskap",
1047
+ value: "Värde",
1048
+ browser: "Webbläsare",
1049
+ browserResult: "Webbläsarresultat",
1050
+ expandBrowserResult: "Expandera webbläsarresultat",
1051
+ collapseBrowserResult: "Dölj webbläsarresultat",
1052
+ credit: "kredit",
1053
+ credits: "krediter",
1054
+ email: "E-post",
1055
+ subject: "Ämne",
1056
+ to: "Till",
1057
+ noRecipientsProvided: "Inga mottagare angavs.",
1058
+ body: "Meddelande",
1059
+ delivery: "Leverans",
1060
+ recipients: "Mottagare",
1061
+ provider: "Leverantör",
1062
+ messageId: "Meddelande-ID",
1063
+ rawStatus: "Ursprunglig status",
1064
+ typeMessage: "Skriv ett meddelande...",
1065
+ send: "Skicka",
1066
+ stop: "Stoppa",
1067
+ attachFile: "Bifoga fil",
1068
+ removeFile: "Ta bort fil",
1069
+ uploading: "Laddar upp",
1070
+ processingUpload: "Behandlar fil",
1071
+ uploadFailed: "Uppladdningen misslyckades",
1072
+ thinking: "Tänker…",
1073
+ thoughtProcess: "Tankeprocess",
1074
+ collapse: "Dölj",
1075
+ expand: "Expandera",
1076
+ thinkingInProgress: "Tänker",
1077
+ thinkingComplete: "Tänkandet klart",
1078
+ uploadedImage: "Uppladdad bild",
1079
+ document: "Dokument",
1080
+ readMore: "Läs mer",
1081
+ readLess: "Läs mindre",
1082
+ copy: "Kopiera",
1083
+ copied: "Kopierat",
1084
+ retryResponse: "Försök med svaret igen",
1085
+ ratePositively: "Betygsätt positivt",
1086
+ rateNegatively: "Betygsätt negativt",
1087
+ voiceInput: "Röstinmatning",
1088
+ stopRecording: "Stoppa inspelning",
1089
+ cancelRecording: "Avbryt inspelning",
1090
+ requestingMicrophoneAccess: "Begär åtkomst till mikrofonen...",
1091
+ transcribing: "Transkriberar..."
1092
+ }
1093
+ };
1094
+ function getUiCopy(locale) {
1095
+ return {
1096
+ ...ENGLISH_COPY,
1097
+ ...TRANSLATIONS[getSupportedToolLocale(locale)]
1098
+ };
1099
+ }
1100
+ function getUiStatusLabel(status, copy) {
1101
+ if (status === "pending") return copy.pending;
1102
+ if (status === "error") return copy.error;
1103
+ if (status === "completed") return copy.completed;
1104
+ return status;
1105
+ }
1106
+
52
1107
  //#endregion
53
1108
  //#region src/components/datasource-tool-result-card.tsx
54
1109
  function DatasourceIcon() {
@@ -84,7 +1139,8 @@ function DatasourceIcon() {
84
1139
  ]
85
1140
  });
86
1141
  }
87
- function DatasourceToolResultCardContent({ title, description, type, icon, resourceCount }) {
1142
+ function DatasourceToolResultCardContent({ title, description, type, icon, resourceCount, locale }) {
1143
+ const copy = getUiCopy(locale);
88
1144
  return /* @__PURE__ */ jsxs(Fragment, { children: [
89
1145
  /* @__PURE__ */ jsxs("header", {
90
1146
  className: "flex items-center gap-3",
@@ -110,7 +1166,7 @@ function DatasourceToolResultCardContent({ title, description, type, icon, resou
110
1166
  children: [
111
1167
  resourceCount,
112
1168
  " ",
113
- resourceCount === 1 ? "Recurso" : "Recursos"
1169
+ resourceCount === 1 ? copy.resource : copy.resources
114
1170
  ]
115
1171
  })
116
1172
  ] });
@@ -131,7 +1187,7 @@ function joinClasses(...classes) {
131
1187
 
132
1188
  //#endregion
133
1189
  //#region src/components/resource-card.tsx
134
- function ResourceCardContent({ icon, type, title, description }) {
1190
+ function ResourceCardContent({ icon, type, title, description, variant = "card" }) {
135
1191
  const heading = type ?? title;
136
1192
  const bodyTitle = type ? title : description;
137
1193
  const bodyDescription = type ? description : void 0;
@@ -153,7 +1209,7 @@ function ResourceCardContent({ icon, type, title, description }) {
153
1209
  })]
154
1210
  }),
155
1211
  bodyTitle ? /* @__PURE__ */ jsx("p", {
156
- className: "mt-2 line-clamp-2 text-sm font-medium leading-5",
1212
+ className: joinClasses("mt-2 text-sm font-medium leading-5", variant === "card" && type ? "truncate" : "line-clamp-2"),
157
1213
  children: bodyTitle
158
1214
  }) : null,
159
1215
  bodyDescription ? /* @__PURE__ */ jsx("p", {
@@ -163,7 +1219,8 @@ function ResourceCardContent({ icon, type, title, description }) {
163
1219
  ] });
164
1220
  }
165
1221
  function ResourceCard(props) {
166
- const { className: customClassName, variant = "card", resourceId, requiresDownloadUrl = false, getResourceDownloadUrl,...contentProps } = props;
1222
+ const { className: customClassName, variant = "card", resourceId, requiresDownloadUrl = false, getResourceDownloadUrl, locale,...contentProps } = props;
1223
+ const copy = getUiCopy(locale);
167
1224
  const [downloadState, setDownloadState] = useState("idle");
168
1225
  const abortControllerRef = useRef(null);
169
1226
  const className = joinClasses("block rounded-lg bg-neutral-100 p-4 text-left text-neutral-950", variant === "card" ? "min-h-[183px] w-[186px] max-w-full" : "w-full", customClassName);
@@ -208,30 +1265,39 @@ function ResourceCard(props) {
208
1265
  disabled: downloadState === "loading",
209
1266
  "aria-busy": downloadState === "loading",
210
1267
  children: [
211
- /* @__PURE__ */ jsx(ResourceCardContent, { ...contentProps }),
1268
+ /* @__PURE__ */ jsx(ResourceCardContent, {
1269
+ ...contentProps,
1270
+ variant
1271
+ }),
212
1272
  downloadState === "loading" ? /* @__PURE__ */ jsx("span", {
213
1273
  className: "mt-2 block text-xs text-neutral-600",
214
1274
  "aria-live": "polite",
215
- children: "Opening resource…"
1275
+ children: copy.openingResource
216
1276
  }) : null,
217
1277
  downloadState === "error" ? /* @__PURE__ */ jsx("span", {
218
1278
  className: "mt-2 block text-xs text-red-700",
219
1279
  role: "alert",
220
- children: "Unable to open resource. Try again."
1280
+ children: copy.resourceOpenFailed
221
1281
  }) : null
222
1282
  ]
223
1283
  });
224
1284
  if (!contentProps.url) return /* @__PURE__ */ jsx("article", {
225
1285
  "aria-label": `${contentProps.title}: ${contentProps.description}`,
226
1286
  className,
227
- children: /* @__PURE__ */ jsx(ResourceCardContent, { ...contentProps })
1287
+ children: /* @__PURE__ */ jsx(ResourceCardContent, {
1288
+ ...contentProps,
1289
+ variant
1290
+ })
228
1291
  });
229
1292
  return /* @__PURE__ */ jsx("a", {
230
1293
  href: contentProps.url,
231
1294
  target: "_blank",
232
1295
  rel: "noreferrer noopener",
233
1296
  className: interactiveClassName,
234
- children: /* @__PURE__ */ jsx(ResourceCardContent, { ...contentProps })
1297
+ children: /* @__PURE__ */ jsx(ResourceCardContent, {
1298
+ ...contentProps,
1299
+ variant
1300
+ })
235
1301
  });
236
1302
  }
237
1303
 
@@ -461,7 +1527,7 @@ function getSideClasses(side) {
461
1527
  if (side === "bottom") return "inset-x-0 bottom-0 max-h-[85vh] w-full border-t";
462
1528
  return "inset-y-0 right-0 h-full w-full max-w-lg border-l";
463
1529
  }
464
- const SheetContent = forwardRef(function SheetContent$1({ children, className, side = "right", showCloseButton = true, closeLabel = "Close", onCancel, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy,...props }, forwardedRef) {
1530
+ const SheetContent = forwardRef(function SheetContent$1({ children, className, side = "right", showCloseButton = true, closeLabel, locale, onCancel, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy,...props }, forwardedRef) {
465
1531
  const { open, setOpen, triggerRef, contentId, labelledBy, describedBy } = useSheetContext("SheetContent");
466
1532
  const [present, setPresent] = useState(open);
467
1533
  const dialogRef = useRef(null);
@@ -524,7 +1590,7 @@ const SheetContent = forwardRef(function SheetContent$1({ children, className, s
524
1590
  if (event.currentTarget === event.target && !open) setPresent(false);
525
1591
  },
526
1592
  children: [showCloseButton ? /* @__PURE__ */ jsx(SheetClose, {
527
- "aria-label": closeLabel,
1593
+ "aria-label": closeLabel ?? getUiCopy(locale).close,
528
1594
  className: "absolute right-4 top-2 rounded-sm p-1 text-neutral-500 transition-colors hover:bg-neutral-100 hover:text-neutral-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950",
529
1595
  children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
530
1596
  }) : null, children]
@@ -585,7 +1651,8 @@ const SheetDescription = forwardRef(function SheetDescription$1({ className, id,
585
1651
 
586
1652
  //#endregion
587
1653
  //#region src/components/datasource-folder-card.tsx
588
- function DatasourceFolderCard({ icon, title, description, type, url, resources, variant = "card" }) {
1654
+ function DatasourceFolderCard({ icon, title, description, type, url, resources, variant = "card", locale }) {
1655
+ const copy = getUiCopy(locale);
589
1656
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
590
1657
  "aria-label": `${type}: ${title}`,
591
1658
  className: `${variant === "card" ? "min-h-[183px] w-[186px] max-w-full" : "w-full"} rounded-lg bg-neutral-100 p-4 text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950`,
@@ -594,10 +1661,11 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
594
1661
  title,
595
1662
  description,
596
1663
  type,
597
- resourceCount: resources.length
1664
+ resourceCount: resources.length,
1665
+ locale
598
1666
  })
599
1667
  }), /* @__PURE__ */ jsxs(SheetContent, {
600
- closeLabel: "Cerrar",
1668
+ locale,
601
1669
  children: [/* @__PURE__ */ jsxs(SheetHeader, {
602
1670
  className: "pr-10",
603
1671
  children: [
@@ -621,15 +1689,15 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
621
1689
  target: "_blank",
622
1690
  rel: "noreferrer noopener",
623
1691
  className: "text-xs font-medium text-neutral-700 underline underline-offset-2",
624
- children: "View"
1692
+ children: copy.view
625
1693
  }) : null
626
1694
  ]
627
1695
  }), /* @__PURE__ */ jsxs("section", {
628
1696
  className: "mt-5",
629
- "aria-label": "Recursos",
1697
+ "aria-label": copy.resources,
630
1698
  children: [/* @__PURE__ */ jsx("h3", {
631
1699
  className: "text-xs font-medium leading-4",
632
- children: "Ver"
1700
+ children: copy.view
633
1701
  }), /* @__PURE__ */ jsx("div", {
634
1702
  className: "mt-7 space-y-3",
635
1703
  children: resources.map((resource, index) => /* @__PURE__ */ jsx(ResourceCard, {
@@ -646,7 +1714,7 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
646
1714
  function normalizeLocale(locale) {
647
1715
  return locale?.trim().toLowerCase();
648
1716
  }
649
- function getCurrentLocale$1() {
1717
+ function getCurrentLocale() {
650
1718
  if (typeof document !== "undefined" && document.documentElement.lang) return document.documentElement.lang;
651
1719
  if (typeof navigator !== "undefined") return navigator.language || navigator.userLanguage;
652
1720
  }
@@ -666,7 +1734,7 @@ function getTranslation(translations, locale) {
666
1734
  function getLocalizedOpenGraphValue(container, field, locale) {
667
1735
  const opengraph = container.extra_info?.opengraph;
668
1736
  if (!opengraph) return void 0;
669
- for (const candidate of getLocaleCandidates(locale ?? getCurrentLocale$1())) {
1737
+ for (const candidate of getLocaleCandidates(locale ?? getCurrentLocale())) {
670
1738
  const translated = getTranslation(opengraph.translations, candidate)?.[field];
671
1739
  if (hasStringValue(translated)) return translated.trim();
672
1740
  }
@@ -766,7 +1834,8 @@ function toResourceCardProps(resource, locale, getResourceDownloadUrl) {
766
1834
  url: requiresDownloadUrl ? null : getResourceUrl(resource, locale),
767
1835
  resourceId: resource.id,
768
1836
  getResourceDownloadUrl: requiresDownloadUrl ? getResourceDownloadUrl : void 0,
769
- requiresDownloadUrl
1837
+ requiresDownloadUrl,
1838
+ locale
770
1839
  };
771
1840
  }
772
1841
  function toFolderCardProps(folder, group, locale, getResourceDownloadUrl) {
@@ -778,7 +1847,8 @@ function toFolderCardProps(folder, group, locale, getResourceDownloadUrl) {
778
1847
  description: getLocalizedOpenGraphValue(folder, "description", locale) ?? readString(folder.extra_info, "description") ?? readString(folder.extra_info, "summary") ?? datasource?.description ?? datasource?.summary ?? "",
779
1848
  type,
780
1849
  url: getLocalizedOpenGraphValue(folder, "url", locale),
781
- resources: group.map((resource) => toResourceCardProps(resource, locale, getResourceDownloadUrl))
1850
+ resources: group.map((resource) => toResourceCardProps(resource, locale, getResourceDownloadUrl)),
1851
+ locale
782
1852
  };
783
1853
  }
784
1854
  function isDatasourceResource(value) {
@@ -832,33 +1902,72 @@ function DatasourceResourceCardView({ card, variant = "card" }) {
832
1902
  function DatasourceToolResources({ resources, locale, className, getResourceDownloadUrl }) {
833
1903
  const cards = getDatasourceResourceCards(resources, locale, getResourceDownloadUrl);
834
1904
  return /* @__PURE__ */ jsx("section", {
835
- "aria-label": "Recursos de la fuente de datos",
1905
+ "aria-label": getUiCopy(locale).datasourceResources,
836
1906
  className: joinClasses("flex flex-wrap gap-3", className),
837
1907
  children: cards.map((card) => /* @__PURE__ */ jsx(DatasourceResourceCardView, { card }, card.key))
838
1908
  });
839
1909
  }
840
1910
 
841
1911
  //#endregion
842
- //#region src/components/internal/tool-locale.ts
843
- const SUPPORTED_TOOL_LOCALES = new Set([
844
- "ca",
845
- "da",
846
- "de",
847
- "en",
848
- "es",
849
- "fr",
850
- "it",
851
- "no",
852
- "pt",
853
- "sv"
854
- ]);
855
- function getCurrentLocale() {
856
- return typeof navigator === "undefined" ? "en" : navigator.language;
857
- }
858
- function getSupportedToolLocale(locale) {
859
- const language = (locale ?? getCurrentLocale()).trim().toLowerCase().split(/[-_]/)[0];
860
- const normalizedLanguage = language === "nb" || language === "nn" ? "no" : language;
861
- return SUPPORTED_TOOL_LOCALES.has(normalizedLanguage) ? normalizedLanguage : "en";
1912
+ //#region src/components/internal/source-results-copy.ts
1913
+ const ENGLISH_SOURCE_RESULTS_COPY = {
1914
+ webSearchTitle: "Internet search results",
1915
+ singularSource: "source",
1916
+ pluralSources: "sources"
1917
+ };
1918
+ const SOURCE_RESULTS_COPY = {
1919
+ en: {},
1920
+ es: {
1921
+ webSearchTitle: "Resultados de búsqueda en Internet",
1922
+ singularSource: "fuente",
1923
+ pluralSources: "fuentes"
1924
+ },
1925
+ ca: {
1926
+ webSearchTitle: "Resultats de cerca a Internet",
1927
+ singularSource: "font",
1928
+ pluralSources: "fonts"
1929
+ },
1930
+ fr: {
1931
+ webSearchTitle: "Résultats de recherche sur Internet",
1932
+ singularSource: "source",
1933
+ pluralSources: "sources"
1934
+ },
1935
+ it: {
1936
+ webSearchTitle: "Risultati della ricerca su Internet",
1937
+ singularSource: "fonte",
1938
+ pluralSources: "fonti"
1939
+ },
1940
+ de: {
1941
+ webSearchTitle: "Ergebnisse der Internetsuche",
1942
+ singularSource: "Quelle",
1943
+ pluralSources: "Quellen"
1944
+ },
1945
+ da: {
1946
+ webSearchTitle: "Resultater fra internetsøgning",
1947
+ singularSource: "kilde",
1948
+ pluralSources: "kilder"
1949
+ },
1950
+ sv: {
1951
+ webSearchTitle: "Resultat från internetsökning",
1952
+ singularSource: "källa",
1953
+ pluralSources: "källor"
1954
+ },
1955
+ no: {
1956
+ webSearchTitle: "Resultater fra internettsøk",
1957
+ singularSource: "kilde",
1958
+ pluralSources: "kilder"
1959
+ },
1960
+ pt: {
1961
+ webSearchTitle: "Resultados da pesquisa na Internet",
1962
+ singularSource: "fonte",
1963
+ pluralSources: "fontes"
1964
+ }
1965
+ };
1966
+ function getSourceResultsCopy(locale) {
1967
+ return {
1968
+ ...ENGLISH_SOURCE_RESULTS_COPY,
1969
+ ...SOURCE_RESULTS_COPY[getSupportedToolLocale(locale)]
1970
+ };
862
1971
  }
863
1972
 
864
1973
  //#endregion
@@ -978,12 +2087,15 @@ function WebSearchResultItem({ result }) {
978
2087
  })
979
2088
  });
980
2089
  }
981
- function ToolResultWebSearchCard({ part, className }) {
2090
+ function ToolResultWebSearchCard({ part, locale, className }) {
982
2091
  const searchResults = getWebSearchResults(part);
2092
+ if (part.state === "completed" && searchResults.length === 0) return null;
983
2093
  const errorDetails = formatToolErrorDetails(part.errorDetails);
984
- const sourceLabel = searchResults.length === 1 ? "source" : "sources";
2094
+ const copy = getSourceResultsCopy(locale);
2095
+ const uiCopy = getUiCopy(locale);
2096
+ const sourceLabel = searchResults.length === 1 ? copy.singularSource : copy.pluralSources;
985
2097
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
986
- "aria-label": `Web: Internet search results, ${searchResults.length} ${sourceLabel}`,
2098
+ "aria-label": `Web: ${copy.webSearchTitle}, ${searchResults.length} ${sourceLabel}`,
987
2099
  className: joinClasses("plai-tool-result-web-search-card min-h-[183px] w-[186px] rounded-lg bg-neutral-100 p-4 text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
988
2100
  children: [
989
2101
  /* @__PURE__ */ jsxs("header", {
@@ -998,45 +2110,47 @@ function ToolResultWebSearchCard({ part, className }) {
998
2110
  }),
999
2111
  /* @__PURE__ */ jsx("h3", {
1000
2112
  className: "mt-3 line-clamp-2 text-sm font-normal leading-5",
1001
- children: "Internet search results"
2113
+ children: copy.webSearchTitle
1002
2114
  }),
1003
2115
  /* @__PURE__ */ jsx("p", {
1004
2116
  className: "mt-2 text-xs leading-4 text-neutral-600",
1005
- children: part.state === "pending" ? "Searching…" : `${searchResults.length} ${sourceLabel}`
2117
+ children: part.state === "pending" ? uiCopy.searching : `${searchResults.length} ${sourceLabel}`
1006
2118
  })
1007
2119
  ]
1008
2120
  }), /* @__PURE__ */ jsxs(SheetContent, {
1009
- closeLabel: "Close",
2121
+ locale,
1010
2122
  children: [/* @__PURE__ */ jsx(SheetHeader, {
1011
2123
  className: "pr-10",
1012
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "Internet search results" })
2124
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.webSearchTitle })
1013
2125
  }), /* @__PURE__ */ jsx(ToolResultWebSearchResults, {
1014
2126
  part,
1015
2127
  searchResults,
1016
2128
  errorDetails,
2129
+ locale,
1017
2130
  className: "mt-5"
1018
2131
  })]
1019
2132
  })] });
1020
2133
  }
1021
- function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(part), errorDetails = formatToolErrorDetails(part.errorDetails), className }) {
2134
+ function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(part), errorDetails = formatToolErrorDetails(part.errorDetails), locale, className }) {
2135
+ const copy = getUiCopy(locale);
1022
2136
  return /* @__PURE__ */ jsxs("section", {
1023
2137
  className,
1024
- "aria-label": "Search results",
2138
+ "aria-label": copy.searchResults,
1025
2139
  children: [searchResults.length > 0 ? /* @__PURE__ */ jsx("div", {
1026
2140
  className: "space-y-3",
1027
2141
  children: searchResults.map((result, index) => /* @__PURE__ */ jsx(WebSearchResultItem, { result }, `${result.url}-${index}`))
1028
2142
  }) : part.state === "pending" ? /* @__PURE__ */ jsx("p", {
1029
2143
  className: "text-sm text-neutral-600",
1030
- children: "Searching for sources…"
2144
+ children: copy.searchingForSources
1031
2145
  }) : /* @__PURE__ */ jsx("p", {
1032
2146
  className: "text-sm text-neutral-600",
1033
- children: "No sources returned."
2147
+ children: copy.noSourcesReturned
1034
2148
  }), errorDetails ? /* @__PURE__ */ jsxs("p", {
1035
2149
  className: "mt-4 rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
1036
2150
  children: [
1037
- /* @__PURE__ */ jsx("span", {
2151
+ /* @__PURE__ */ jsxs("span", {
1038
2152
  className: "font-semibold",
1039
- children: "Error details:"
2153
+ children: [copy.errorDetails, ":"]
1040
2154
  }),
1041
2155
  " ",
1042
2156
  errorDetails
@@ -1047,18 +2161,6 @@ function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(
1047
2161
 
1048
2162
  //#endregion
1049
2163
  //#region src/components/aggregated-source-results.tsx
1050
- const SOURCE_LABELS = {
1051
- en: ["source", "sources"],
1052
- es: ["fuente", "fuentes"],
1053
- ca: ["font", "fonts"],
1054
- fr: ["source", "sources"],
1055
- it: ["fonte", "fonti"],
1056
- de: ["Quelle", "Quellen"],
1057
- da: ["kilde", "kilder"],
1058
- sv: ["källa", "källor"],
1059
- no: ["kilde", "kilder"],
1060
- pt: ["fonte", "fontes"]
1061
- };
1062
2164
  function isCompletedSourceToolPart(part) {
1063
2165
  return part.type === "tool-call" && part.state === "completed" && (part.toolType === "datasource" || part.toolType === "perplexity" || part.toolType === "firecrawl_search");
1064
2166
  }
@@ -1072,19 +2174,22 @@ function getAggregatedCards(parts, locale, getResourceDownloadUrl) {
1072
2174
  key: `${part.id}-${card.key}`,
1073
2175
  card
1074
2176
  })));
1075
- const webCards = parts.filter((part) => part.toolType === "perplexity" || part.toolType === "firecrawl_search").map((part) => ({
2177
+ const webCards = parts.filter((part) => part.toolType === "perplexity" || part.toolType === "firecrawl_search").filter((part) => getWebSearchResults(part).length > 0).map((part) => ({
1076
2178
  kind: "web",
1077
2179
  key: part.id,
1078
2180
  part
1079
2181
  }));
1080
2182
  return [...datasourceCards, ...webCards];
1081
2183
  }
1082
- function SourceCard({ source, variant = "card" }) {
2184
+ function SourceCard({ source, locale, variant = "card" }) {
1083
2185
  if (source.kind === "datasource") return /* @__PURE__ */ jsx(DatasourceResourceCardView, {
1084
2186
  card: source.card,
1085
2187
  variant
1086
2188
  });
1087
- if (variant === "card") return /* @__PURE__ */ jsx(ToolResultWebSearchCard, { part: source.part });
2189
+ if (variant === "card") return /* @__PURE__ */ jsx(ToolResultWebSearchCard, {
2190
+ part: source.part,
2191
+ locale
2192
+ });
1088
2193
  return /* @__PURE__ */ jsxs("section", {
1089
2194
  className: "rounded-lg bg-neutral-100 p-4",
1090
2195
  children: [/* @__PURE__ */ jsxs("header", {
@@ -1094,9 +2199,12 @@ function SourceCard({ source, variant = "card" }) {
1094
2199
  "aria-hidden": "true"
1095
2200
  }), /* @__PURE__ */ jsx("h3", {
1096
2201
  className: "text-sm font-medium",
1097
- children: "Internet search results"
2202
+ children: getSourceResultsCopy(locale).webSearchTitle
1098
2203
  })]
1099
- }), /* @__PURE__ */ jsx(ToolResultWebSearchResults, { part: source.part })]
2204
+ }), /* @__PURE__ */ jsx(ToolResultWebSearchResults, {
2205
+ part: source.part,
2206
+ locale
2207
+ })]
1100
2208
  });
1101
2209
  }
1102
2210
  function getTotalSourceCount(cards) {
@@ -1109,13 +2217,16 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
1109
2217
  const visibleCards = cards.slice(0, visibleLimit);
1110
2218
  const overflowCount = cards.length - visibleCards.length;
1111
2219
  const totalSourceCount = getTotalSourceCount(cards);
1112
- const [singularSource, pluralSources] = SOURCE_LABELS[getSupportedToolLocale(locale)];
2220
+ const { singularSource, pluralSources } = getSourceResultsCopy(locale);
1113
2221
  const overflowLabel = overflowCount === 1 ? singularSource : pluralSources;
1114
2222
  const totalLabel = totalSourceCount === 1 ? singularSource : pluralSources;
1115
2223
  return /* @__PURE__ */ jsxs("section", {
1116
2224
  "aria-label": pluralSources,
1117
2225
  className: joinClasses("flex flex-wrap gap-3", className),
1118
- children: [visibleCards.map((source) => /* @__PURE__ */ jsx(SourceCard, { source }, source.key)), overflowCount > 0 ? /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
2226
+ children: [visibleCards.map((source) => /* @__PURE__ */ jsx(SourceCard, {
2227
+ source,
2228
+ locale
2229
+ }, source.key)), overflowCount > 0 ? /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
1119
2230
  "aria-label": `+${overflowCount} ${overflowLabel}`,
1120
2231
  className: "flex min-h-[183px] w-[186px] max-w-full flex-col justify-center rounded-lg bg-neutral-100 p-4 text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950",
1121
2232
  children: [/* @__PURE__ */ jsxs("span", {
@@ -1126,7 +2237,7 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
1126
2237
  children: overflowLabel
1127
2238
  })]
1128
2239
  }), /* @__PURE__ */ jsxs(SheetContent, {
1129
- closeLabel: "Close",
2240
+ locale,
1130
2241
  children: [/* @__PURE__ */ jsx(SheetHeader, {
1131
2242
  className: "pr-10",
1132
2243
  children: /* @__PURE__ */ jsxs(SheetTitle, { children: [
@@ -1138,6 +2249,7 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
1138
2249
  className: "mt-5 space-y-3",
1139
2250
  children: cards.map((source) => /* @__PURE__ */ jsx(SourceCard, {
1140
2251
  source,
2252
+ locale,
1141
2253
  variant: "list"
1142
2254
  }, `sheet-${source.key}`))
1143
2255
  })]
@@ -1145,6 +2257,357 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
1145
2257
  });
1146
2258
  }
1147
2259
 
2260
+ //#endregion
2261
+ //#region src/components/memory-proposal-card.tsx
2262
+ const COPY = {
2263
+ en: {
2264
+ title: "Memory proposal",
2265
+ user: "Personal memory",
2266
+ project: "Project learning",
2267
+ create: "Create",
2268
+ update: "Update",
2269
+ delete: "Delete",
2270
+ previous: "Previous content",
2271
+ proposed: "Proposed content",
2272
+ accept: "Accept",
2273
+ reject: "Reject",
2274
+ review: "Sent for admin review",
2275
+ unavailable: "This proposal cannot be resolved here",
2276
+ accepted: "Accepted",
2277
+ rejected: "Rejected",
2278
+ expired: "Expired",
2279
+ conflicted: "Could not be applied because the memory changed",
2280
+ conflictError: "The memory changed. The latest status has been loaded.",
2281
+ expiredError: "This proposal is no longer available.",
2282
+ permissionError: "You no longer have permission to resolve this proposal.",
2283
+ genericError: "The proposal could not be resolved."
2284
+ },
2285
+ es: {
2286
+ title: "Propuesta de memoria",
2287
+ user: "Memoria personal",
2288
+ project: "Aprendizaje del proyecto",
2289
+ create: "Crear",
2290
+ update: "Actualizar",
2291
+ delete: "Eliminar",
2292
+ previous: "Contenido anterior",
2293
+ proposed: "Contenido propuesto",
2294
+ accept: "Aceptar",
2295
+ reject: "Rechazar",
2296
+ review: "Enviado para revisión de un administrador",
2297
+ unavailable: "Esta propuesta no se puede resolver aquí",
2298
+ accepted: "Aceptada",
2299
+ rejected: "Rechazada",
2300
+ expired: "Caducada",
2301
+ conflicted: "No se pudo aplicar porque la memoria cambió",
2302
+ conflictError: "La memoria cambió. Se ha cargado el estado más reciente.",
2303
+ expiredError: "Esta propuesta ya no está disponible.",
2304
+ permissionError: "Ya no tienes permiso para resolver esta propuesta.",
2305
+ genericError: "No se pudo resolver la propuesta."
2306
+ },
2307
+ ca: {
2308
+ title: "Proposta de memòria",
2309
+ user: "Memòria personal",
2310
+ project: "Aprenentatge del projecte",
2311
+ create: "Crear",
2312
+ update: "Actualitzar",
2313
+ delete: "Eliminar",
2314
+ previous: "Contingut anterior",
2315
+ proposed: "Contingut proposat",
2316
+ accept: "Acceptar",
2317
+ reject: "Rebutjar",
2318
+ review: "Enviat per a revisió d'un administrador",
2319
+ unavailable: "Aquesta proposta no es pot resoldre aquí",
2320
+ accepted: "Acceptada",
2321
+ rejected: "Rebutjada",
2322
+ expired: "Caducada",
2323
+ conflicted: "No s'ha pogut aplicar perquè la memòria ha canviat",
2324
+ conflictError: "La memòria ha canviat. S'ha carregat l'estat més recent.",
2325
+ expiredError: "Aquesta proposta ja no està disponible.",
2326
+ permissionError: "Ja no tens permís per resoldre aquesta proposta.",
2327
+ genericError: "No s'ha pogut resoldre la proposta."
2328
+ },
2329
+ da: {
2330
+ title: "Hukommelsesforslag",
2331
+ user: "Personlig hukommelse",
2332
+ project: "Projektlæring",
2333
+ create: "Opret",
2334
+ update: "Opdater",
2335
+ delete: "Slet",
2336
+ previous: "Tidligere indhold",
2337
+ proposed: "Foreslået indhold",
2338
+ accept: "Acceptér",
2339
+ reject: "Afvis",
2340
+ review: "Sendt til administratorgennemgang",
2341
+ unavailable: "Forslaget kan ikke behandles her",
2342
+ accepted: "Accepteret",
2343
+ rejected: "Afvist",
2344
+ expired: "Udløbet",
2345
+ conflicted: "Kunne ikke anvendes, fordi hukommelsen blev ændret",
2346
+ conflictError: "Hukommelsen blev ændret. Den seneste status er indlæst.",
2347
+ expiredError: "Forslaget er ikke længere tilgængeligt.",
2348
+ permissionError: "Du har ikke længere tilladelse til at behandle forslaget.",
2349
+ genericError: "Forslaget kunne ikke behandles."
2350
+ },
2351
+ de: {
2352
+ title: "Speichervorschlag",
2353
+ user: "Persönliche Erinnerung",
2354
+ project: "Projektwissen",
2355
+ create: "Erstellen",
2356
+ update: "Aktualisieren",
2357
+ delete: "Löschen",
2358
+ previous: "Vorheriger Inhalt",
2359
+ proposed: "Vorgeschlagener Inhalt",
2360
+ accept: "Akzeptieren",
2361
+ reject: "Ablehnen",
2362
+ review: "Zur Administratorprüfung gesendet",
2363
+ unavailable: "Dieser Vorschlag kann hier nicht bearbeitet werden",
2364
+ accepted: "Akzeptiert",
2365
+ rejected: "Abgelehnt",
2366
+ expired: "Abgelaufen",
2367
+ conflicted: "Nicht angewendet, da sich die Erinnerung geändert hat",
2368
+ conflictError: "Die Erinnerung hat sich geändert. Der aktuelle Status wurde geladen.",
2369
+ expiredError: "Dieser Vorschlag ist nicht mehr verfügbar.",
2370
+ permissionError: "Sie dürfen diesen Vorschlag nicht mehr bearbeiten.",
2371
+ genericError: "Der Vorschlag konnte nicht bearbeitet werden."
2372
+ },
2373
+ fr: {
2374
+ title: "Proposition de mémoire",
2375
+ user: "Mémoire personnelle",
2376
+ project: "Apprentissage du projet",
2377
+ create: "Créer",
2378
+ update: "Modifier",
2379
+ delete: "Supprimer",
2380
+ previous: "Contenu précédent",
2381
+ proposed: "Contenu proposé",
2382
+ accept: "Accepter",
2383
+ reject: "Refuser",
2384
+ review: "Envoyé à un administrateur pour examen",
2385
+ unavailable: "Cette proposition ne peut pas être traitée ici",
2386
+ accepted: "Acceptée",
2387
+ rejected: "Refusée",
2388
+ expired: "Expirée",
2389
+ conflicted: "Impossible à appliquer car la mémoire a changé",
2390
+ conflictError: "La mémoire a changé. Le dernier état a été chargé.",
2391
+ expiredError: "Cette proposition n'est plus disponible.",
2392
+ permissionError: "Vous n'avez plus l'autorisation de traiter cette proposition.",
2393
+ genericError: "La proposition n'a pas pu être traitée."
2394
+ },
2395
+ it: {
2396
+ title: "Proposta di memoria",
2397
+ user: "Memoria personale",
2398
+ project: "Apprendimento del progetto",
2399
+ create: "Crea",
2400
+ update: "Aggiorna",
2401
+ delete: "Elimina",
2402
+ previous: "Contenuto precedente",
2403
+ proposed: "Contenuto proposto",
2404
+ accept: "Accetta",
2405
+ reject: "Rifiuta",
2406
+ review: "Inviata alla revisione di un amministratore",
2407
+ unavailable: "Questa proposta non può essere gestita qui",
2408
+ accepted: "Accettata",
2409
+ rejected: "Rifiutata",
2410
+ expired: "Scaduta",
2411
+ conflicted: "Non applicata perché la memoria è cambiata",
2412
+ conflictError: "La memoria è cambiata. È stato caricato lo stato più recente.",
2413
+ expiredError: "Questa proposta non è più disponibile.",
2414
+ permissionError: "Non hai più il permesso di gestire questa proposta.",
2415
+ genericError: "Impossibile gestire la proposta."
2416
+ },
2417
+ no: {
2418
+ title: "Minneforslag",
2419
+ user: "Personlig minne",
2420
+ project: "Prosjektlæring",
2421
+ create: "Opprett",
2422
+ update: "Oppdater",
2423
+ delete: "Slett",
2424
+ previous: "Tidligere innhold",
2425
+ proposed: "Foreslått innhold",
2426
+ accept: "Godta",
2427
+ reject: "Avvis",
2428
+ review: "Sendt til administratorgjennomgang",
2429
+ unavailable: "Forslaget kan ikke behandles her",
2430
+ accepted: "Godtatt",
2431
+ rejected: "Avvist",
2432
+ expired: "Utløpt",
2433
+ conflicted: "Kunne ikke brukes fordi minnet ble endret",
2434
+ conflictError: "Minnet ble endret. Den nyeste statusen er lastet inn.",
2435
+ expiredError: "Forslaget er ikke lenger tilgjengelig.",
2436
+ permissionError: "Du har ikke lenger tillatelse til å behandle forslaget.",
2437
+ genericError: "Forslaget kunne ikke behandles."
2438
+ },
2439
+ pt: {
2440
+ title: "Proposta de memória",
2441
+ user: "Memória pessoal",
2442
+ project: "Aprendizagem do projeto",
2443
+ create: "Criar",
2444
+ update: "Atualizar",
2445
+ delete: "Eliminar",
2446
+ previous: "Conteúdo anterior",
2447
+ proposed: "Conteúdo proposto",
2448
+ accept: "Aceitar",
2449
+ reject: "Rejeitar",
2450
+ review: "Enviado para revisão de um administrador",
2451
+ unavailable: "Esta proposta não pode ser resolvida aqui",
2452
+ accepted: "Aceite",
2453
+ rejected: "Rejeitada",
2454
+ expired: "Expirada",
2455
+ conflicted: "Não aplicada porque a memória foi alterada",
2456
+ conflictError: "A memória foi alterada. O estado mais recente foi carregado.",
2457
+ expiredError: "Esta proposta já não está disponível.",
2458
+ permissionError: "Já não tem permissão para resolver esta proposta.",
2459
+ genericError: "Não foi possível resolver a proposta."
2460
+ },
2461
+ sv: {
2462
+ title: "Minnesförslag",
2463
+ user: "Personligt minne",
2464
+ project: "Projektlärdom",
2465
+ create: "Skapa",
2466
+ update: "Uppdatera",
2467
+ delete: "Ta bort",
2468
+ previous: "Tidigare innehåll",
2469
+ proposed: "Föreslaget innehåll",
2470
+ accept: "Godkänn",
2471
+ reject: "Avvisa",
2472
+ review: "Skickat för administratörsgranskning",
2473
+ unavailable: "Förslaget kan inte hanteras här",
2474
+ accepted: "Godkänt",
2475
+ rejected: "Avvisat",
2476
+ expired: "Utgånget",
2477
+ conflicted: "Kunde inte tillämpas eftersom minnet ändrades",
2478
+ conflictError: "Minnet ändrades. Den senaste statusen har lästs in.",
2479
+ expiredError: "Förslaget är inte längre tillgängligt.",
2480
+ permissionError: "Du har inte längre behörighet att hantera förslaget.",
2481
+ genericError: "Förslaget kunde inte hanteras."
2482
+ }
2483
+ };
2484
+ const REDACTED = "[redacted]";
2485
+ function MemoryProposalCard({ proposal: initial, actions, activeAgentId, locale, className }) {
2486
+ const copy = COPY[getSupportedToolLocale(locale)];
2487
+ const [proposal, setProposal] = useState(initial);
2488
+ const [resolving, setResolving] = useState(false);
2489
+ const [error, setError] = useState(null);
2490
+ useEffect(() => setProposal((current) => mergeProposal(current, initial)), [initial]);
2491
+ async function resolve(accept) {
2492
+ if (resolving) return;
2493
+ setResolving(true);
2494
+ setError(null);
2495
+ try {
2496
+ const next = accept ? await actions.acceptMemoryProposal({ proposalId: proposal.id }) : await actions.rejectMemoryProposal({ proposalId: proposal.id });
2497
+ setProposal((current) => mergeProposal(current, next));
2498
+ } catch (cause) {
2499
+ const status = cause instanceof HttpStatusError ? cause.status : 0;
2500
+ setError(status === 409 ? copy.conflictError : status === 410 ? copy.expiredError : status === 401 || status === 403 ? copy.permissionError : copy.genericError);
2501
+ try {
2502
+ const latest = await actions.getMemoryProposal({ proposalId: proposal.id });
2503
+ setProposal((current) => mergeProposal(current, latest));
2504
+ } catch {}
2505
+ } finally {
2506
+ setResolving(false);
2507
+ }
2508
+ }
2509
+ const canResolve = proposal.status === "PENDING" && proposal.can_resolve === true && proposal.agent_id === activeAgentId;
2510
+ const statusCopy = proposal.status === "ACCEPTED" ? copy.accepted : proposal.status === "REJECTED" ? copy.rejected : proposal.status === "EXPIRED" ? copy.expired : proposal.status === "CONFLICTED" ? copy.conflicted : null;
2511
+ const operation = proposal.operation === "CREATE" ? copy.create : proposal.operation === "UPDATE" ? copy.update : copy.delete;
2512
+ return /* @__PURE__ */ jsxs("section", {
2513
+ className: joinClasses("space-y-3 rounded-lg border border-emerald-200 bg-emerald-50/30 p-4 text-left", className),
2514
+ "data-memory-proposal-id": proposal.id,
2515
+ children: [
2516
+ /* @__PURE__ */ jsxs("header", {
2517
+ className: "space-y-2",
2518
+ children: [/* @__PURE__ */ jsxs("h4", {
2519
+ className: "flex items-center gap-2 text-sm font-semibold text-slate-900",
2520
+ children: [/* @__PURE__ */ jsx(Brain, { className: "size-4" }), copy.title]
2521
+ }), /* @__PURE__ */ jsxs("div", {
2522
+ className: "flex flex-wrap gap-2 text-xs",
2523
+ children: [
2524
+ /* @__PURE__ */ jsx("span", {
2525
+ className: "rounded-full border border-slate-300 bg-white px-2 py-0.5",
2526
+ children: proposal.scope === "USER" ? copy.user : copy.project
2527
+ }),
2528
+ /* @__PURE__ */ jsx("span", {
2529
+ className: "rounded-full bg-slate-100 px-2 py-0.5",
2530
+ children: operation
2531
+ }),
2532
+ /* @__PURE__ */ jsx("span", {
2533
+ className: "rounded-full bg-slate-100 px-2 py-0.5",
2534
+ children: formatCategory(proposal.category)
2535
+ })
2536
+ ]
2537
+ })]
2538
+ }),
2539
+ proposal.previous_content && proposal.previous_content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
2540
+ className: "rounded-md bg-slate-100 p-3 text-sm",
2541
+ children: [/* @__PURE__ */ jsx("span", {
2542
+ className: "mb-1 block text-xs font-medium text-slate-500",
2543
+ children: copy.previous
2544
+ }), /* @__PURE__ */ jsx("p", {
2545
+ className: "whitespace-pre-wrap break-words",
2546
+ children: proposal.previous_content
2547
+ })]
2548
+ }) : null,
2549
+ proposal.content && proposal.content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
2550
+ className: "text-sm",
2551
+ children: [/* @__PURE__ */ jsx("span", {
2552
+ className: "mb-1 block text-xs font-medium text-slate-500",
2553
+ children: copy.proposed
2554
+ }), /* @__PURE__ */ jsx("p", {
2555
+ className: "whitespace-pre-wrap break-words",
2556
+ children: proposal.content
2557
+ })]
2558
+ }) : null,
2559
+ canResolve ? /* @__PURE__ */ jsxs("div", {
2560
+ className: "flex gap-2",
2561
+ children: [/* @__PURE__ */ jsxs("button", {
2562
+ type: "button",
2563
+ disabled: resolving,
2564
+ onClick: () => void resolve(true),
2565
+ className: "inline-flex items-center rounded-md bg-slate-900 px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50",
2566
+ children: [resolving ? /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 size-3 animate-spin" }) : null, copy.accept]
2567
+ }), /* @__PURE__ */ jsx("button", {
2568
+ type: "button",
2569
+ disabled: resolving,
2570
+ onClick: () => void resolve(false),
2571
+ className: "rounded-md border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium disabled:opacity-50",
2572
+ children: copy.reject
2573
+ })]
2574
+ }) : null,
2575
+ proposal.status === "PENDING" && !canResolve ? /* @__PURE__ */ jsx("p", {
2576
+ className: "text-xs font-medium text-slate-500",
2577
+ children: proposal.scope === "PROJECT" ? copy.review : copy.unavailable
2578
+ }) : null,
2579
+ proposal.status === "ACCEPTED" && statusCopy ? /* @__PURE__ */ jsxs("span", {
2580
+ className: "inline-flex items-center gap-1.5 rounded-full border bg-white px-3 py-1 text-xs font-medium text-slate-900 shadow-sm",
2581
+ children: [statusCopy, /* @__PURE__ */ jsx(Check, {
2582
+ className: "size-3.5 stroke-[2.5] text-emerald-600",
2583
+ "aria-hidden": "true"
2584
+ })]
2585
+ }) : null,
2586
+ statusCopy && proposal.status !== "ACCEPTED" ? /* @__PURE__ */ jsx("p", {
2587
+ className: "text-xs font-medium text-slate-500",
2588
+ children: statusCopy
2589
+ }) : null,
2590
+ error ? /* @__PURE__ */ jsx("p", {
2591
+ className: "text-xs text-red-600",
2592
+ children: error
2593
+ }) : null
2594
+ ]
2595
+ });
2596
+ }
2597
+ function mergeProposal(current, incoming) {
2598
+ if (current.id !== incoming.id) return incoming;
2599
+ return {
2600
+ ...incoming,
2601
+ content: incoming.content === REDACTED ? current.content : incoming.content,
2602
+ previous_content: incoming.previous_content === REDACTED ? current.previous_content : incoming.previous_content,
2603
+ rationale: incoming.rationale === REDACTED ? current.rationale : incoming.rationale
2604
+ };
2605
+ }
2606
+ function formatCategory(category) {
2607
+ const value = category.replaceAll("_", " ").toLowerCase();
2608
+ return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
2609
+ }
2610
+
1148
2611
  //#endregion
1149
2612
  //#region src/components/tool-error.tsx
1150
2613
  const TOOL_ERROR_TRANSLATIONS = {
@@ -1255,262 +2718,42 @@ function ToolError({ part, locale, defaultOpen = false, className,...props }) {
1255
2718
  className: joinClasses("size-4 shrink-0 transition-transform motion-reduce:transition-none", isOpen ? "rotate-180" : void 0),
1256
2719
  "aria-hidden": "true"
1257
2720
  })
1258
- ]
1259
- }), isOpen ? /* @__PURE__ */ jsxs("div", {
1260
- id: contentId,
1261
- className: "mt-2 space-y-3 border-l-2 border-rose-200 pl-3",
1262
- children: [
1263
- /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
1264
- className: "mb-2 text-xs font-semibold text-neutral-700",
1265
- children: copy.input
1266
- }), /* @__PURE__ */ jsx("pre", {
1267
- className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
1268
- children: formatJson$1(part.input)
1269
- })] }),
1270
- /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
1271
- className: "mb-2 text-xs font-semibold text-neutral-700",
1272
- children: copy.output
1273
- }), /* @__PURE__ */ jsx("pre", {
1274
- className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
1275
- children: part.result === void 0 ? copy.noOutput : formatJson$1(part.result)
1276
- })] }),
1277
- errorDetails ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
1278
- className: "mb-2 text-xs font-semibold text-rose-700",
1279
- children: copy.details
1280
- }), /* @__PURE__ */ jsx("p", {
1281
- className: "whitespace-pre-wrap text-xs leading-5 text-rose-700",
1282
- children: errorDetails
1283
- })] }) : null
1284
- ]
1285
- }) : null]
1286
- });
1287
- }
1288
-
1289
- //#endregion
1290
- //#region src/components/tool-result-email-send-card.tsx
1291
- function formatStatus$1(status) {
1292
- if (status === "pending") return "pending";
1293
- if (status === "error") return "error";
1294
- return "completed";
1295
- }
1296
- function asObject(value) {
1297
- if (!value || typeof value !== "object" || Array.isArray(value)) return null;
1298
- return value;
1299
- }
1300
- function toStringOrNull$1(value) {
1301
- return typeof value === "string" && value.trim().length > 0 ? value : null;
1302
- }
1303
- function toNumberOrNull(value) {
1304
- return typeof value === "number" && Number.isFinite(value) ? value : null;
1305
- }
1306
- function parseEmailSendInput(part) {
1307
- const input = asObject(part.input);
1308
- if (!input) return {
1309
- to: [],
1310
- subject: null,
1311
- text: null
1312
- };
1313
- return {
1314
- to: Array.isArray(input.to) ? input.to.filter((item) => typeof item === "string") : [],
1315
- subject: toStringOrNull$1(input.subject),
1316
- text: toStringOrNull$1(input.text)
1317
- };
1318
- }
1319
- function parseEmailSendResult(part) {
1320
- const initial = {
1321
- status: null,
1322
- recipientsCount: null,
1323
- subject: null,
1324
- receiptProvider: null,
1325
- receiptMessageId: null,
1326
- receiptRawStatus: null,
1327
- raw: null
1328
- };
1329
- if (part.result === void 0 || part.result === null) return initial;
1330
- let resultObject = asObject(part.result);
1331
- let raw = null;
1332
- if (!resultObject && typeof part.result === "string") try {
1333
- resultObject = asObject(JSON.parse(part.result));
1334
- } catch {
1335
- raw = part.result;
1336
- }
1337
- if (!resultObject) return {
1338
- ...initial,
1339
- raw
1340
- };
1341
- const receipt = asObject(resultObject.receipt);
1342
- return {
1343
- status: toStringOrNull$1(resultObject.status),
1344
- recipientsCount: toNumberOrNull(resultObject.recipients_count),
1345
- subject: toStringOrNull$1(resultObject.subject),
1346
- receiptProvider: receipt ? toStringOrNull$1(receipt.provider) : null,
1347
- receiptMessageId: receipt ? toStringOrNull$1(receipt.message_id) : null,
1348
- receiptRawStatus: receipt ? toStringOrNull$1(receipt.raw_status) : null,
1349
- raw
1350
- };
1351
- }
1352
- function ToolResultEmailSendCard({ part, className }) {
1353
- const [isExpanded, setIsExpanded] = useState(false);
1354
- const emailInput = parseEmailSendInput(part);
1355
- const emailResult = parseEmailSendResult(part);
1356
- const errorDetails = formatToolErrorDetails(part.errorDetails);
1357
- const statusClass = part.state === "error" ? "border-rose-200 bg-rose-50 text-rose-800" : part.state === "pending" ? "border-amber-200 bg-amber-50 text-amber-800" : "border-emerald-200 bg-emerald-50 text-emerald-800";
1358
- return /* @__PURE__ */ jsxs("section", {
1359
- className: joinClasses("space-y-4 rounded-lg border border-slate-200 bg-slate-50 p-3", className),
1360
- "data-tool-call-id": part.id,
1361
- "data-tool-call-state": part.state,
1362
- children: [
1363
- /* @__PURE__ */ jsxs("header", {
1364
- className: "flex items-center justify-between gap-2",
1365
- children: [/* @__PURE__ */ jsx("h4", {
1366
- className: "text-sm font-semibold text-slate-900",
1367
- children: "Email"
1368
- }), /* @__PURE__ */ jsxs("div", {
1369
- className: "flex items-center gap-2",
1370
- children: [/* @__PURE__ */ jsx("span", {
1371
- className: joinClasses("rounded-full border px-2 py-0.5 text-xs font-medium", statusClass),
1372
- children: formatStatus$1(part.state)
1373
- }), /* @__PURE__ */ jsx("button", {
1374
- type: "button",
1375
- "aria-expanded": isExpanded,
1376
- "aria-controls": `tool-email-details-${part.id}`,
1377
- className: "inline-flex h-6 w-6 items-center justify-center rounded border border-slate-300 bg-white text-xs text-slate-700 hover:bg-slate-100",
1378
- onClick: () => setIsExpanded((previous) => !previous),
1379
- children: /* @__PURE__ */ jsx("span", {
1380
- className: "inline-block",
1381
- children: isExpanded ? "^" : "v"
1382
- })
1383
- })]
1384
- })]
1385
- }),
1386
- emailInput.subject ? /* @__PURE__ */ jsxs("div", {
1387
- className: "space-y-1",
1388
- children: [/* @__PURE__ */ jsx("p", {
1389
- className: "text-xs font-semibold text-slate-600",
1390
- children: "Subject"
1391
- }), /* @__PURE__ */ jsx("p", {
1392
- className: "text-sm text-slate-900",
1393
- children: emailInput.subject
1394
- })]
1395
- }) : null,
1396
- /* @__PURE__ */ jsxs("div", {
1397
- className: "space-y-1",
1398
- children: [/* @__PURE__ */ jsx("p", {
1399
- className: "text-xs font-semibold text-slate-600",
1400
- children: "To"
1401
- }), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
1402
- className: "flex flex-wrap gap-2",
1403
- children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
1404
- className: "rounded-full border border-slate-300 bg-slate-100 px-2 py-0.5 text-xs text-slate-700",
1405
- children: recipient
1406
- }, recipient))
1407
- }) : /* @__PURE__ */ jsx("p", {
1408
- className: "text-sm text-slate-500",
1409
- children: "No recipients provided."
1410
- })]
1411
- }),
1412
- /* @__PURE__ */ jsxs("div", {
1413
- id: `tool-email-details-${part.id}`,
1414
- "data-testid": "email-send-details",
1415
- className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
1416
- children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
1417
- className: "space-y-1",
1418
- children: [/* @__PURE__ */ jsx("p", {
1419
- className: "text-xs font-semibold text-slate-600",
1420
- children: "Body"
1421
- }), /* @__PURE__ */ jsx("p", {
1422
- className: "whitespace-pre-wrap rounded border border-slate-200 bg-slate-50 p-2 text-sm text-slate-700",
1423
- children: emailInput.text
1424
- })]
1425
- }) : null, part.result !== void 0 ? /* @__PURE__ */ jsxs("div", {
1426
- className: "space-y-2 rounded border border-slate-200 bg-white p-3",
1427
- children: [
1428
- /* @__PURE__ */ jsx("p", {
1429
- className: "text-xs font-semibold uppercase tracking-wide text-slate-500",
1430
- children: "Delivery"
1431
- }),
1432
- emailResult.status ? /* @__PURE__ */ jsxs("p", {
1433
- className: "text-sm text-slate-700",
1434
- children: [
1435
- /* @__PURE__ */ jsx("span", {
1436
- className: "font-semibold text-slate-900",
1437
- children: "Status:"
1438
- }),
1439
- " ",
1440
- emailResult.status
1441
- ]
1442
- }) : null,
1443
- emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
1444
- className: "text-sm text-slate-700",
1445
- children: [
1446
- /* @__PURE__ */ jsx("span", {
1447
- className: "font-semibold text-slate-900",
1448
- children: "Recipients:"
1449
- }),
1450
- " ",
1451
- emailResult.recipientsCount
1452
- ]
1453
- }) : null,
1454
- emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
1455
- className: "text-sm text-slate-700",
1456
- children: [
1457
- /* @__PURE__ */ jsx("span", {
1458
- className: "font-semibold text-slate-900",
1459
- children: "Provider:"
1460
- }),
1461
- " ",
1462
- emailResult.receiptProvider
1463
- ]
1464
- }) : null,
1465
- emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
1466
- className: "break-all text-sm text-slate-700",
1467
- children: [
1468
- /* @__PURE__ */ jsx("span", {
1469
- className: "font-semibold text-slate-900",
1470
- children: "Message ID:"
1471
- }),
1472
- " ",
1473
- emailResult.receiptMessageId
1474
- ]
1475
- }) : null,
1476
- emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
1477
- className: "text-sm text-slate-700",
1478
- children: [
1479
- /* @__PURE__ */ jsx("span", {
1480
- className: "font-semibold text-slate-900",
1481
- children: "Raw status:"
1482
- }),
1483
- " ",
1484
- emailResult.receiptRawStatus
1485
- ]
1486
- }) : null,
1487
- emailResult.raw ? /* @__PURE__ */ jsx("p", {
1488
- className: "whitespace-pre-wrap text-sm text-slate-700",
1489
- children: emailResult.raw
1490
- }) : null
1491
- ]
1492
- }) : null]
1493
- }),
1494
- errorDetails ? /* @__PURE__ */ jsxs("p", {
1495
- className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
1496
- children: [
1497
- /* @__PURE__ */ jsx("span", {
1498
- className: "font-semibold",
1499
- children: "Error details:"
1500
- }),
1501
- " ",
1502
- errorDetails
1503
- ]
1504
- }) : null
1505
- ]
2721
+ ]
2722
+ }), isOpen ? /* @__PURE__ */ jsxs("div", {
2723
+ id: contentId,
2724
+ className: "mt-2 space-y-3 border-l-2 border-rose-200 pl-3",
2725
+ children: [
2726
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
2727
+ className: "mb-2 text-xs font-semibold text-neutral-700",
2728
+ children: copy.input
2729
+ }), /* @__PURE__ */ jsx("pre", {
2730
+ className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
2731
+ children: formatJson$1(part.input)
2732
+ })] }),
2733
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
2734
+ className: "mb-2 text-xs font-semibold text-neutral-700",
2735
+ children: copy.output
2736
+ }), /* @__PURE__ */ jsx("pre", {
2737
+ className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
2738
+ children: part.result === void 0 ? copy.noOutput : formatJson$1(part.result)
2739
+ })] }),
2740
+ errorDetails ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
2741
+ className: "mb-2 text-xs font-semibold text-rose-700",
2742
+ children: copy.details
2743
+ }), /* @__PURE__ */ jsx("p", {
2744
+ className: "whitespace-pre-wrap text-xs leading-5 text-rose-700",
2745
+ children: errorDetails
2746
+ })] }) : null
2747
+ ]
2748
+ }) : null]
1506
2749
  });
1507
2750
  }
1508
2751
 
1509
2752
  //#endregion
1510
2753
  //#region src/components/tool-result-agent-invocation-card.tsx
1511
- function formatAgentName(part) {
2754
+ function formatAgentName(part, fallback) {
1512
2755
  if (part.metadata?.agent_name) return part.metadata.agent_name;
1513
- return part.name.replace(/^invoke_/, "").replace(/[_-]+/g, " ").trim() || "Agent";
2756
+ return part.name.replace(/^invoke_/, "").replace(/[_-]+/g, " ").trim() || fallback;
1514
2757
  }
1515
2758
  function formatOutput(value) {
1516
2759
  if (typeof value === "string") return value;
@@ -1526,9 +2769,10 @@ function getPrompt(value) {
1526
2769
  const prompt = value.input;
1527
2770
  return typeof prompt === "string" && prompt.trim() ? prompt : null;
1528
2771
  }
1529
- function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
2772
+ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }) {
2773
+ const copy = getUiCopy(locale);
1530
2774
  const metadata = part.metadata;
1531
- const agentName = formatAgentName(part);
2775
+ const agentName = formatAgentName(part, copy.agent);
1532
2776
  const output$1 = formatOutput(part.result);
1533
2777
  const prompt = getPrompt(part.input);
1534
2778
  const error = formatToolErrorDetails(part.errorDetails);
@@ -1536,7 +2780,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1536
2780
  const failed = part.state === "error";
1537
2781
  const pending = part.state === "pending";
1538
2782
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
1539
- "aria-label": `Agent: ${agentName}`,
2783
+ "aria-label": `${copy.agent}: ${agentName}`,
1540
2784
  className: joinClasses("w-full rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
1541
2785
  children: /* @__PURE__ */ jsxs("span", {
1542
2786
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -1547,7 +2791,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1547
2791
  }),
1548
2792
  /* @__PURE__ */ jsx("span", {
1549
2793
  className: "shrink-0 font-medium",
1550
- children: "Agent"
2794
+ children: copy.agent
1551
2795
  }),
1552
2796
  /* @__PURE__ */ jsx("span", {
1553
2797
  className: "min-w-0 truncate text-neutral-600",
@@ -1557,7 +2801,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1557
2801
  className: "ml-auto shrink-0",
1558
2802
  children: pending ? /* @__PURE__ */ jsx(LoaderCircle, {
1559
2803
  className: "h-4 w-4 animate-spin text-amber-600",
1560
- "aria-label": "Pending"
2804
+ "aria-label": copy.pending
1561
2805
  }) : failed ? /* @__PURE__ */ jsx(XCircle, {
1562
2806
  className: "h-4 w-4 text-rose-600",
1563
2807
  "aria-hidden": "true"
@@ -1569,38 +2813,38 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1569
2813
  ]
1570
2814
  })
1571
2815
  }), /* @__PURE__ */ jsxs(SheetContent, {
1572
- closeLabel: "Close",
2816
+ locale,
1573
2817
  children: [/* @__PURE__ */ jsx(SheetHeader, {
1574
2818
  className: "pr-10",
1575
2819
  children: /* @__PURE__ */ jsx(SheetTitle, { children: agentName })
1576
2820
  }), /* @__PURE__ */ jsxs("section", {
1577
2821
  className: "mt-6 space-y-4",
1578
- "aria-label": "Agent invocation result",
2822
+ "aria-label": copy.agentInvocationResult,
1579
2823
  children: [
1580
2824
  /* @__PURE__ */ jsxs("dl", {
1581
2825
  className: "grid gap-2 text-sm",
1582
2826
  children: [
1583
2827
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1584
2828
  className: "text-xs text-neutral-500",
1585
- children: "Status"
1586
- }), /* @__PURE__ */ jsx("dd", { children: part.state })] }),
2829
+ children: copy.status
2830
+ }), /* @__PURE__ */ jsx("dd", { children: getUiStatusLabel(part.state, copy) })] }),
1587
2831
  metadata?.agent_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1588
2832
  className: "text-xs text-neutral-500",
1589
- children: "Agent ID"
2833
+ children: copy.agentId
1590
2834
  }), /* @__PURE__ */ jsx("dd", {
1591
2835
  className: "break-all",
1592
2836
  children: metadata.agent_id
1593
2837
  })] }) : null,
1594
2838
  metadata?.tracked_execution_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1595
2839
  className: "text-xs text-neutral-500",
1596
- children: "Execution ID"
2840
+ children: copy.executionId
1597
2841
  }), /* @__PURE__ */ jsx("dd", {
1598
2842
  className: "break-all",
1599
2843
  children: metadata.tracked_execution_id
1600
2844
  })] }) : null,
1601
2845
  threadId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1602
2846
  className: "text-xs text-neutral-500",
1603
- children: "Thread ID"
2847
+ children: copy.threadId
1604
2848
  }), /* @__PURE__ */ jsx("dd", {
1605
2849
  className: "break-all",
1606
2850
  children: threadId
@@ -1609,14 +2853,14 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1609
2853
  }),
1610
2854
  prompt ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
1611
2855
  className: "mb-2 text-sm font-medium",
1612
- children: "Prompt"
2856
+ children: copy.prompt
1613
2857
  }), /* @__PURE__ */ jsx("p", {
1614
2858
  className: "whitespace-pre-wrap rounded-md border border-neutral-200 bg-neutral-50 p-3 text-sm leading-6",
1615
2859
  children: prompt
1616
2860
  })] }) : null,
1617
2861
  output$1 ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
1618
2862
  className: "mb-2 text-sm font-medium",
1619
- children: "Result"
2863
+ children: copy.result
1620
2864
  }), /* @__PURE__ */ jsx("pre", {
1621
2865
  className: "overflow-x-auto whitespace-pre-wrap rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
1622
2866
  children: output$1
@@ -1628,14 +2872,14 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1628
2872
  children: [/* @__PURE__ */ jsx(MessageSquare, {
1629
2873
  className: "h-4 w-4",
1630
2874
  "aria-hidden": "true"
1631
- }), "Open conversation"]
2875
+ }), copy.openConversation]
1632
2876
  }) : null,
1633
2877
  error ? /* @__PURE__ */ jsxs("p", {
1634
2878
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
1635
2879
  children: [
1636
- /* @__PURE__ */ jsx("span", {
2880
+ /* @__PURE__ */ jsxs("span", {
1637
2881
  className: "font-semibold",
1638
- children: "Error details:"
2882
+ children: [copy.errorDetails, ":"]
1639
2883
  }),
1640
2884
  " ",
1641
2885
  error
@@ -1671,7 +2915,8 @@ function getPreview(output$1) {
1671
2915
  if (!output$1) return null;
1672
2916
  return output$1.length > 200 ? `${output$1.slice(0, 200)}…` : output$1;
1673
2917
  }
1674
- function ToolResultBrowserCard({ part, className }) {
2918
+ function ToolResultBrowserCard({ part, className, locale }) {
2919
+ const copy = getUiCopy(locale);
1675
2920
  const [expanded, setExpanded] = useState(false);
1676
2921
  const metadata = part.metadata;
1677
2922
  const preview = getPreview(toOutput(part.result));
@@ -1679,13 +2924,13 @@ function ToolResultBrowserCard({ part, className }) {
1679
2924
  const error = formatToolErrorDetails(part.errorDetails);
1680
2925
  const scraperLabel = metadata?.scraper_type ? SCRAPER_LABELS[metadata.scraper_type] : null;
1681
2926
  const credits = metadata?.scraper_api_tokens ?? metadata?.firecrawl_credits;
1682
- const subtitle = [scraperLabel, typeof credits === "number" ? `${credits} credit${credits === 1 ? "" : "s"}` : null].filter(Boolean).join(" · ");
2927
+ const subtitle = [scraperLabel, typeof credits === "number" ? `${credits} ${credits === 1 ? copy.credit : copy.credits}` : null].filter(Boolean).join(" · ");
1683
2928
  const failed = part.state === "error";
1684
2929
  const pending = part.state === "pending";
1685
2930
  const canExpand = Boolean(preview || error || url);
1686
2931
  return /* @__PURE__ */ jsxs("section", {
1687
2932
  className: joinClasses("overflow-hidden rounded-lg border border-neutral-200 bg-white", className),
1688
- "aria-label": "Browser result",
2933
+ "aria-label": copy.browserResult,
1689
2934
  children: [/* @__PURE__ */ jsxs("div", {
1690
2935
  className: "flex items-center gap-2 px-3 py-2 text-sm",
1691
2936
  children: [
@@ -1695,7 +2940,7 @@ function ToolResultBrowserCard({ part, className }) {
1695
2940
  }),
1696
2941
  /* @__PURE__ */ jsx("span", {
1697
2942
  className: "font-medium text-neutral-800",
1698
- children: "Browser"
2943
+ children: copy.browser
1699
2944
  }),
1700
2945
  subtitle ? /* @__PURE__ */ jsx("span", {
1701
2946
  className: "min-w-0 truncate text-xs text-neutral-500",
@@ -1705,7 +2950,7 @@ function ToolResultBrowserCard({ part, className }) {
1705
2950
  className: "ml-auto flex shrink-0 items-center gap-2",
1706
2951
  children: [pending ? /* @__PURE__ */ jsx(LoaderCircle, {
1707
2952
  className: "h-4 w-4 animate-spin text-amber-600",
1708
- "aria-label": "Pending"
2953
+ "aria-label": copy.pending
1709
2954
  }) : failed ? /* @__PURE__ */ jsx(XCircle, {
1710
2955
  className: "h-4 w-4 text-rose-600",
1711
2956
  "aria-hidden": "true"
@@ -1714,7 +2959,7 @@ function ToolResultBrowserCard({ part, className }) {
1714
2959
  "aria-hidden": "true"
1715
2960
  }), canExpand ? /* @__PURE__ */ jsx("button", {
1716
2961
  type: "button",
1717
- "aria-label": expanded ? "Collapse browser result" : "Expand browser result",
2962
+ "aria-label": expanded ? copy.collapseBrowserResult : copy.expandBrowserResult,
1718
2963
  "aria-expanded": expanded,
1719
2964
  className: "flex h-5 w-5 items-center justify-center rounded text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-neutral-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950",
1720
2965
  onClick: () => setExpanded((value) => !value),
@@ -1745,9 +2990,9 @@ function ToolResultBrowserCard({ part, className }) {
1745
2990
  error ? /* @__PURE__ */ jsxs("p", {
1746
2991
  className: "text-xs text-rose-700",
1747
2992
  children: [
1748
- /* @__PURE__ */ jsx("span", {
2993
+ /* @__PURE__ */ jsxs("span", {
1749
2994
  className: "font-semibold",
1750
- children: "Error details:"
2995
+ children: [copy.errorDetails, ":"]
1751
2996
  }),
1752
2997
  " ",
1753
2998
  error
@@ -1758,6 +3003,223 @@ function ToolResultBrowserCard({ part, className }) {
1758
3003
  });
1759
3004
  }
1760
3005
 
3006
+ //#endregion
3007
+ //#region src/components/tool-result-email-send-card.tsx
3008
+ function asObject(value) {
3009
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
3010
+ return value;
3011
+ }
3012
+ function toStringOrNull$1(value) {
3013
+ return typeof value === "string" && value.trim().length > 0 ? value : null;
3014
+ }
3015
+ function toNumberOrNull(value) {
3016
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
3017
+ }
3018
+ function parseEmailSendInput(part) {
3019
+ const input = asObject(part.input);
3020
+ if (!input) return {
3021
+ to: [],
3022
+ subject: null,
3023
+ text: null
3024
+ };
3025
+ return {
3026
+ to: Array.isArray(input.to) ? input.to.filter((item) => typeof item === "string") : [],
3027
+ subject: toStringOrNull$1(input.subject),
3028
+ text: toStringOrNull$1(input.text)
3029
+ };
3030
+ }
3031
+ function parseEmailSendResult(part) {
3032
+ const initial = {
3033
+ status: null,
3034
+ recipientsCount: null,
3035
+ subject: null,
3036
+ receiptProvider: null,
3037
+ receiptMessageId: null,
3038
+ receiptRawStatus: null,
3039
+ raw: null
3040
+ };
3041
+ if (part.result === void 0 || part.result === null) return initial;
3042
+ let resultObject = asObject(part.result);
3043
+ let raw = null;
3044
+ if (!resultObject && typeof part.result === "string") try {
3045
+ resultObject = asObject(JSON.parse(part.result));
3046
+ } catch {
3047
+ raw = part.result;
3048
+ }
3049
+ if (!resultObject) return {
3050
+ ...initial,
3051
+ raw
3052
+ };
3053
+ const receipt = asObject(resultObject.receipt);
3054
+ return {
3055
+ status: toStringOrNull$1(resultObject.status),
3056
+ recipientsCount: toNumberOrNull(resultObject.recipients_count),
3057
+ subject: toStringOrNull$1(resultObject.subject),
3058
+ receiptProvider: receipt ? toStringOrNull$1(receipt.provider) : null,
3059
+ receiptMessageId: receipt ? toStringOrNull$1(receipt.message_id) : null,
3060
+ receiptRawStatus: receipt ? toStringOrNull$1(receipt.raw_status) : null,
3061
+ raw
3062
+ };
3063
+ }
3064
+ function ToolResultEmailSendCard({ part, className, locale }) {
3065
+ const copy = getUiCopy(locale);
3066
+ const [isExpanded, setIsExpanded] = useState(false);
3067
+ const emailInput = parseEmailSendInput(part);
3068
+ const emailResult = parseEmailSendResult(part);
3069
+ const errorDetails = formatToolErrorDetails(part.errorDetails);
3070
+ const statusClass = part.state === "error" ? "border-rose-200 bg-rose-50 text-rose-800" : part.state === "pending" ? "border-amber-200 bg-amber-50 text-amber-800" : "border-emerald-200 bg-emerald-50 text-emerald-800";
3071
+ return /* @__PURE__ */ jsxs("section", {
3072
+ className: joinClasses("space-y-4 rounded-lg border border-slate-200 bg-slate-50 p-3", className),
3073
+ "data-tool-call-id": part.id,
3074
+ "data-tool-call-state": part.state,
3075
+ children: [
3076
+ /* @__PURE__ */ jsxs("header", {
3077
+ className: "flex items-center justify-between gap-2",
3078
+ children: [/* @__PURE__ */ jsx("h4", {
3079
+ className: "text-sm font-semibold text-slate-900",
3080
+ children: copy.email
3081
+ }), /* @__PURE__ */ jsxs("div", {
3082
+ className: "flex items-center gap-2",
3083
+ children: [/* @__PURE__ */ jsx("span", {
3084
+ className: joinClasses("rounded-full border px-2 py-0.5 text-xs font-medium", statusClass),
3085
+ children: getUiStatusLabel(part.state, copy)
3086
+ }), /* @__PURE__ */ jsx("button", {
3087
+ type: "button",
3088
+ "aria-expanded": isExpanded,
3089
+ "aria-label": isExpanded ? copy.collapse : copy.expand,
3090
+ "aria-controls": `tool-email-details-${part.id}`,
3091
+ className: "inline-flex h-6 w-6 items-center justify-center rounded border border-slate-300 bg-white text-xs text-slate-700 hover:bg-slate-100",
3092
+ onClick: () => setIsExpanded((previous) => !previous),
3093
+ children: /* @__PURE__ */ jsx("span", {
3094
+ className: "inline-block",
3095
+ children: isExpanded ? "^" : "v"
3096
+ })
3097
+ })]
3098
+ })]
3099
+ }),
3100
+ emailInput.subject ? /* @__PURE__ */ jsxs("div", {
3101
+ className: "space-y-1",
3102
+ children: [/* @__PURE__ */ jsx("p", {
3103
+ className: "text-xs font-semibold text-slate-600",
3104
+ children: copy.subject
3105
+ }), /* @__PURE__ */ jsx("p", {
3106
+ className: "text-sm text-slate-900",
3107
+ children: emailInput.subject
3108
+ })]
3109
+ }) : null,
3110
+ /* @__PURE__ */ jsxs("div", {
3111
+ className: "space-y-1",
3112
+ children: [/* @__PURE__ */ jsx("p", {
3113
+ className: "text-xs font-semibold text-slate-600",
3114
+ children: copy.to
3115
+ }), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
3116
+ className: "flex flex-wrap gap-2",
3117
+ children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
3118
+ className: "rounded-full border border-slate-300 bg-slate-100 px-2 py-0.5 text-xs text-slate-700",
3119
+ children: recipient
3120
+ }, recipient))
3121
+ }) : /* @__PURE__ */ jsx("p", {
3122
+ className: "text-sm text-slate-500",
3123
+ children: copy.noRecipientsProvided
3124
+ })]
3125
+ }),
3126
+ /* @__PURE__ */ jsxs("div", {
3127
+ id: `tool-email-details-${part.id}`,
3128
+ "data-testid": "email-send-details",
3129
+ className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
3130
+ children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
3131
+ className: "space-y-1",
3132
+ children: [/* @__PURE__ */ jsx("p", {
3133
+ className: "text-xs font-semibold text-slate-600",
3134
+ children: copy.body
3135
+ }), /* @__PURE__ */ jsx("p", {
3136
+ className: "whitespace-pre-wrap rounded border border-slate-200 bg-slate-50 p-2 text-sm text-slate-700",
3137
+ children: emailInput.text
3138
+ })]
3139
+ }) : null, part.result !== void 0 ? /* @__PURE__ */ jsxs("div", {
3140
+ className: "space-y-2 rounded border border-slate-200 bg-white p-3",
3141
+ children: [
3142
+ /* @__PURE__ */ jsx("p", {
3143
+ className: "text-xs font-semibold uppercase tracking-wide text-slate-500",
3144
+ children: copy.delivery
3145
+ }),
3146
+ emailResult.status ? /* @__PURE__ */ jsxs("p", {
3147
+ className: "text-sm text-slate-700",
3148
+ children: [
3149
+ /* @__PURE__ */ jsxs("span", {
3150
+ className: "font-semibold text-slate-900",
3151
+ children: [copy.status, ":"]
3152
+ }),
3153
+ " ",
3154
+ emailResult.status
3155
+ ]
3156
+ }) : null,
3157
+ emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
3158
+ className: "text-sm text-slate-700",
3159
+ children: [
3160
+ /* @__PURE__ */ jsxs("span", {
3161
+ className: "font-semibold text-slate-900",
3162
+ children: [copy.recipients, ":"]
3163
+ }),
3164
+ " ",
3165
+ emailResult.recipientsCount
3166
+ ]
3167
+ }) : null,
3168
+ emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
3169
+ className: "text-sm text-slate-700",
3170
+ children: [
3171
+ /* @__PURE__ */ jsxs("span", {
3172
+ className: "font-semibold text-slate-900",
3173
+ children: [copy.provider, ":"]
3174
+ }),
3175
+ " ",
3176
+ emailResult.receiptProvider
3177
+ ]
3178
+ }) : null,
3179
+ emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
3180
+ className: "break-all text-sm text-slate-700",
3181
+ children: [
3182
+ /* @__PURE__ */ jsxs("span", {
3183
+ className: "font-semibold text-slate-900",
3184
+ children: [copy.messageId, ":"]
3185
+ }),
3186
+ " ",
3187
+ emailResult.receiptMessageId
3188
+ ]
3189
+ }) : null,
3190
+ emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
3191
+ className: "text-sm text-slate-700",
3192
+ children: [
3193
+ /* @__PURE__ */ jsxs("span", {
3194
+ className: "font-semibold text-slate-900",
3195
+ children: [copy.rawStatus, ":"]
3196
+ }),
3197
+ " ",
3198
+ emailResult.receiptRawStatus
3199
+ ]
3200
+ }) : null,
3201
+ emailResult.raw ? /* @__PURE__ */ jsx("p", {
3202
+ className: "whitespace-pre-wrap text-sm text-slate-700",
3203
+ children: emailResult.raw
3204
+ }) : null
3205
+ ]
3206
+ }) : null]
3207
+ }),
3208
+ errorDetails ? /* @__PURE__ */ jsxs("p", {
3209
+ className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
3210
+ children: [
3211
+ /* @__PURE__ */ jsxs("span", {
3212
+ className: "font-semibold",
3213
+ children: [copy.errorDetails, ":"]
3214
+ }),
3215
+ " ",
3216
+ errorDetails
3217
+ ]
3218
+ }) : null
3219
+ ]
3220
+ });
3221
+ }
3222
+
1761
3223
  //#endregion
1762
3224
  //#region src/components/tool-result-external-datasource-card.tsx
1763
3225
  function isRecord(value) {
@@ -1783,7 +3245,7 @@ function parseJson(value) {
1783
3245
  return null;
1784
3246
  }
1785
3247
  }
1786
- function normalizeTable(value) {
3248
+ function normalizeTable(value, copy) {
1787
3249
  const raw = typeof value === "string" ? parseJson(value) : value;
1788
3250
  if (!raw) return {
1789
3251
  columns: [],
@@ -1812,7 +3274,7 @@ function normalizeTable(value) {
1812
3274
  };
1813
3275
  const columnValues = columns.map((column) => raw[column]);
1814
3276
  if (!columnValues.some(isRecord)) return {
1815
- columns: ["Property", "Value"],
3277
+ columns: [copy.property, copy.value],
1816
3278
  rows: Object.entries(raw)
1817
3279
  };
1818
3280
  return {
@@ -1824,18 +3286,14 @@ function getTableValue(part) {
1824
3286
  if (part.metadata?.json_table !== void 0) return part.metadata.json_table;
1825
3287
  return typeof part.result === "string" ? part.result : null;
1826
3288
  }
1827
- function formatStatus(state) {
1828
- if (state === "pending") return "pending";
1829
- if (state === "error") return "error";
1830
- return "completed";
1831
- }
1832
- function ToolResultExternalDatasourceCard({ part, className }) {
3289
+ function ToolResultExternalDatasourceCard({ part, className, locale }) {
3290
+ const copy = getUiCopy(locale);
1833
3291
  const sqlQuery = toStringOrNull(part.metadata?.sql_query);
1834
- const table = normalizeTable(getTableValue(part));
3292
+ const table = normalizeTable(getTableValue(part), copy);
1835
3293
  const errorDetails = formatToolErrorDetails(part.errorDetails);
1836
3294
  const statusClass = part.state === "error" ? "text-rose-600" : part.state === "pending" ? "text-amber-600" : "text-emerald-600";
1837
3295
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
1838
- "aria-label": `External datasource: ${formatStatus(part.state)}`,
3296
+ "aria-label": `${copy.externalDatasource}: ${getUiStatusLabel(part.state, copy)}`,
1839
3297
  className: joinClasses("w-full overflow-hidden rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
1840
3298
  children: /* @__PURE__ */ jsxs("span", {
1841
3299
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -1846,7 +3304,7 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1846
3304
  }),
1847
3305
  /* @__PURE__ */ jsx("span", {
1848
3306
  className: "truncate font-medium",
1849
- children: "External datasource"
3307
+ children: copy.externalDatasource
1850
3308
  }),
1851
3309
  /* @__PURE__ */ jsx("span", {
1852
3310
  className: joinClasses("ml-auto shrink-0", statusClass),
@@ -1858,19 +3316,19 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1858
3316
  "aria-hidden": "true"
1859
3317
  }) : /* @__PURE__ */ jsx("span", {
1860
3318
  className: "text-xs",
1861
- children: "pending"
3319
+ children: copy.pending
1862
3320
  })
1863
3321
  })
1864
3322
  ]
1865
3323
  })
1866
3324
  }), /* @__PURE__ */ jsxs(SheetContent, {
1867
- closeLabel: "Close",
3325
+ locale,
1868
3326
  children: [/* @__PURE__ */ jsx(SheetHeader, {
1869
3327
  className: "pr-10",
1870
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "External datasource" })
3328
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.externalDatasource })
1871
3329
  }), /* @__PURE__ */ jsxs("section", {
1872
3330
  className: "mt-6 space-y-8",
1873
- "aria-label": "External datasource result",
3331
+ "aria-label": copy.externalDatasourceResult,
1874
3332
  children: [
1875
3333
  sqlQuery ? /* @__PURE__ */ jsxs("div", {
1876
3334
  className: "space-y-2",
@@ -1881,7 +3339,7 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1881
3339
  "aria-hidden": "true"
1882
3340
  }), /* @__PURE__ */ jsx("h3", {
1883
3341
  className: "text-sm font-medium",
1884
- children: "SQL query"
3342
+ children: copy.sqlQuery
1885
3343
  })]
1886
3344
  }), /* @__PURE__ */ jsx("pre", {
1887
3345
  className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5 text-neutral-800",
@@ -1892,7 +3350,7 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1892
3350
  className: "space-y-2",
1893
3351
  children: [/* @__PURE__ */ jsx("h3", {
1894
3352
  className: "text-sm font-medium",
1895
- children: "Query results"
3353
+ children: copy.queryResults
1896
3354
  }), /* @__PURE__ */ jsx("div", {
1897
3355
  className: "overflow-x-auto rounded-md border border-neutral-200",
1898
3356
  children: /* @__PURE__ */ jsxs("table", {
@@ -1919,14 +3377,14 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1919
3377
  })]
1920
3378
  }) : part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
1921
3379
  className: "text-sm text-neutral-600",
1922
- children: "No data to display."
3380
+ children: copy.noDataToDisplay
1923
3381
  }) : null,
1924
3382
  errorDetails ? /* @__PURE__ */ jsxs("p", {
1925
3383
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
1926
3384
  children: [
1927
- /* @__PURE__ */ jsx("span", {
3385
+ /* @__PURE__ */ jsxs("span", {
1928
3386
  className: "font-semibold",
1929
- children: "Error details:"
3387
+ children: [copy.errorDetails, ":"]
1930
3388
  }),
1931
3389
  " ",
1932
3390
  errorDetails
@@ -1948,15 +3406,16 @@ function output(value) {
1948
3406
  return null;
1949
3407
  }
1950
3408
  }
1951
- function ToolResultHttpRequestCard({ part, className }) {
3409
+ function ToolResultHttpRequestCard({ part, className, locale }) {
3410
+ const copy = getUiCopy(locale);
1952
3411
  const metadata = part.metadata;
1953
3412
  const statusCode = metadata?.status_code;
1954
3413
  const failed = part.state === "error" || typeof statusCode === "number" && statusCode >= 400;
1955
3414
  const response = output(part.result);
1956
3415
  const errorDetails = formatToolErrorDetails(part.errorDetails);
1957
- const status = statusCode ? `${statusCode}${metadata?.status_reason ? ` ${metadata.status_reason}` : ""}` : part.state;
3416
+ const status = statusCode ? `${statusCode}${metadata?.status_reason ? ` ${metadata.status_reason}` : ""}` : getUiStatusLabel(part.state, copy);
1958
3417
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
1959
- "aria-label": `HTTP request: ${status}`,
3418
+ "aria-label": `${copy.httpRequest}: ${status}`,
1960
3419
  className: joinClasses("w-full rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
1961
3420
  children: /* @__PURE__ */ jsxs("span", {
1962
3421
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -1986,51 +3445,51 @@ function ToolResultHttpRequestCard({ part, className }) {
1986
3445
  ]
1987
3446
  })
1988
3447
  }), /* @__PURE__ */ jsxs(SheetContent, {
1989
- closeLabel: "Close",
3448
+ locale,
1990
3449
  children: [/* @__PURE__ */ jsx(SheetHeader, {
1991
3450
  className: "pr-10",
1992
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "HTTP request" })
3451
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.httpRequest })
1993
3452
  }), /* @__PURE__ */ jsxs("section", {
1994
3453
  className: "mt-6 space-y-5",
1995
- "aria-label": "HTTP response",
3454
+ "aria-label": copy.httpResponse,
1996
3455
  children: [
1997
3456
  /* @__PURE__ */ jsxs("dl", {
1998
3457
  className: "grid gap-2 text-sm",
1999
3458
  children: [
2000
3459
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2001
3460
  className: "text-xs text-neutral-500",
2002
- children: "Status"
3461
+ children: copy.status
2003
3462
  }), /* @__PURE__ */ jsx("dd", { children: status })] }),
2004
3463
  metadata?.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2005
3464
  className: "text-xs text-neutral-500",
2006
- children: "Request URL"
3465
+ children: copy.requestUrl
2007
3466
  }), /* @__PURE__ */ jsx("dd", {
2008
3467
  className: "break-all",
2009
3468
  children: metadata.url
2010
3469
  })] }) : null,
2011
3470
  metadata?.response_url && metadata.response_url !== metadata.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2012
3471
  className: "text-xs text-neutral-500",
2013
- children: "Response URL"
3472
+ children: copy.responseUrl
2014
3473
  }), /* @__PURE__ */ jsx("dd", {
2015
3474
  className: "break-all",
2016
3475
  children: metadata.response_url
2017
3476
  })] }) : null,
2018
3477
  metadata?.content_type ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2019
3478
  className: "text-xs text-neutral-500",
2020
- children: "Content type"
3479
+ children: copy.contentType
2021
3480
  }), /* @__PURE__ */ jsx("dd", { children: metadata.content_type })] }) : null
2022
3481
  ]
2023
3482
  }),
2024
3483
  response ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
2025
3484
  className: "mb-2 text-sm font-medium",
2026
- children: "Response"
3485
+ children: copy.response
2027
3486
  }), /* @__PURE__ */ jsx("pre", {
2028
3487
  className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
2029
3488
  children: response
2030
3489
  })] }) : null,
2031
3490
  metadata?.response_headers && Object.keys(metadata.response_headers).length ? /* @__PURE__ */ jsxs("details", { children: [/* @__PURE__ */ jsx("summary", {
2032
3491
  className: "cursor-pointer text-sm font-medium",
2033
- children: "Response headers"
3492
+ children: copy.responseHeaders
2034
3493
  }), /* @__PURE__ */ jsx("pre", {
2035
3494
  className: "mt-2 overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs",
2036
3495
  children: JSON.stringify(metadata.response_headers, null, 2)
@@ -2038,9 +3497,9 @@ function ToolResultHttpRequestCard({ part, className }) {
2038
3497
  errorDetails ? /* @__PURE__ */ jsxs("p", {
2039
3498
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
2040
3499
  children: [
2041
- /* @__PURE__ */ jsx("span", {
3500
+ /* @__PURE__ */ jsxs("span", {
2042
3501
  className: "font-semibold",
2043
- children: "Error details:"
3502
+ children: [copy.errorDetails, ":"]
2044
3503
  }),
2045
3504
  " ",
2046
3505
  errorDetails
@@ -2062,7 +3521,8 @@ function text(value) {
2062
3521
  return null;
2063
3522
  }
2064
3523
  }
2065
- function ToolResultMcpCard({ part, className }) {
3524
+ function ToolResultMcpCard({ part, className, locale }) {
3525
+ const copy = getUiCopy(locale);
2066
3526
  const meta = part.metadata;
2067
3527
  const server = meta?.mcp_server_url ?? meta?.server_name;
2068
3528
  const tool = meta?.mcp_tool_name ?? meta?.tool_name ?? part.name;
@@ -2070,7 +3530,7 @@ function ToolResultMcpCard({ part, className }) {
2070
3530
  const error = formatToolErrorDetails(part.errorDetails);
2071
3531
  const failed = part.state === "error";
2072
3532
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
2073
- "aria-label": `MCP tool: ${tool}`,
3533
+ "aria-label": `${copy.mcpTool}: ${tool}`,
2074
3534
  className: joinClasses("w-full rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
2075
3535
  children: /* @__PURE__ */ jsxs("span", {
2076
3536
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -2100,22 +3560,22 @@ function ToolResultMcpCard({ part, className }) {
2100
3560
  ]
2101
3561
  })
2102
3562
  }), /* @__PURE__ */ jsxs(SheetContent, {
2103
- closeLabel: "Close",
3563
+ locale,
2104
3564
  children: [/* @__PURE__ */ jsx(SheetHeader, {
2105
3565
  className: "pr-10",
2106
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "MCP tool" })
3566
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.mcpTool })
2107
3567
  }), /* @__PURE__ */ jsxs("section", {
2108
3568
  className: "mt-6 space-y-4",
2109
- "aria-label": "MCP tool result",
3569
+ "aria-label": copy.mcpToolResult,
2110
3570
  children: [
2111
3571
  /* @__PURE__ */ jsxs("dl", {
2112
3572
  className: "grid gap-2 text-sm",
2113
3573
  children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2114
3574
  className: "text-xs text-neutral-500",
2115
- children: "Tool"
3575
+ children: copy.tool
2116
3576
  }), /* @__PURE__ */ jsx("dd", { children: tool })] }), server ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2117
3577
  className: "text-xs text-neutral-500",
2118
- children: "Server"
3578
+ children: copy.server
2119
3579
  }), /* @__PURE__ */ jsx("dd", {
2120
3580
  className: "break-all",
2121
3581
  children: server
@@ -2123,7 +3583,7 @@ function ToolResultMcpCard({ part, className }) {
2123
3583
  }),
2124
3584
  result ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
2125
3585
  className: "mb-2 text-sm font-medium",
2126
- children: "Result"
3586
+ children: copy.result
2127
3587
  }), /* @__PURE__ */ jsx("pre", {
2128
3588
  className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
2129
3589
  children: result
@@ -2131,9 +3591,9 @@ function ToolResultMcpCard({ part, className }) {
2131
3591
  error ? /* @__PURE__ */ jsxs("p", {
2132
3592
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
2133
3593
  children: [
2134
- /* @__PURE__ */ jsx("span", {
3594
+ /* @__PURE__ */ jsxs("span", {
2135
3595
  className: "font-semibold",
2136
- children: "Error details:"
3596
+ children: [copy.errorDetails, ":"]
2137
3597
  }),
2138
3598
  " ",
2139
3599
  error
@@ -2172,13 +3632,14 @@ function iconClass(extension) {
2172
3632
  if (["ppt", "pptx"].includes(extension ?? "")) return "text-orange-600";
2173
3633
  return "text-neutral-500";
2174
3634
  }
2175
- function ToolResultOfficeDocumentsCard({ part, className }) {
3635
+ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
3636
+ const copy = getUiCopy(locale);
2176
3637
  const files = getFiles(part);
2177
3638
  const errorDetails = formatToolErrorDetails(part.errorDetails);
2178
- const fileLabel = files.length === 1 ? "file" : "files";
3639
+ const fileLabel = files.length === 1 ? copy.file : copy.files;
2179
3640
  const statusClass = part.state === "error" ? "text-rose-600" : part.state === "pending" ? "text-amber-600" : "text-emerald-600";
2180
3641
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
2181
- "aria-label": `Office documents: ${files.length} ${fileLabel}`,
3642
+ "aria-label": `${copy.officeDocuments}: ${files.length} ${fileLabel}`,
2182
3643
  className: joinClasses("w-full overflow-hidden rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
2183
3644
  children: /* @__PURE__ */ jsxs("span", {
2184
3645
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -2189,11 +3650,11 @@ function ToolResultOfficeDocumentsCard({ part, className }) {
2189
3650
  }),
2190
3651
  /* @__PURE__ */ jsx("span", {
2191
3652
  className: "truncate font-medium",
2192
- children: "Office documents"
3653
+ children: copy.officeDocuments
2193
3654
  }),
2194
3655
  /* @__PURE__ */ jsx("span", {
2195
3656
  className: "truncate text-xs text-neutral-500",
2196
- children: part.state === "pending" ? "pending" : `${files.length} ${fileLabel}`
3657
+ children: part.state === "pending" ? copy.pending : `${files.length} ${fileLabel}`
2197
3658
  }),
2198
3659
  /* @__PURE__ */ jsx("span", {
2199
3660
  className: joinClasses("ml-auto shrink-0", statusClass),
@@ -2208,13 +3669,13 @@ function ToolResultOfficeDocumentsCard({ part, className }) {
2208
3669
  ]
2209
3670
  })
2210
3671
  }), /* @__PURE__ */ jsxs(SheetContent, {
2211
- closeLabel: "Close",
3672
+ locale,
2212
3673
  children: [/* @__PURE__ */ jsx(SheetHeader, {
2213
3674
  className: "pr-10",
2214
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "Office documents" })
3675
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.officeDocuments })
2215
3676
  }), /* @__PURE__ */ jsxs("section", {
2216
3677
  className: "mt-6 space-y-3",
2217
- "aria-label": "Generated files",
3678
+ "aria-label": copy.generatedFiles,
2218
3679
  children: [
2219
3680
  files.map((file) => {
2220
3681
  const extension = getExtension(file);
@@ -2245,18 +3706,18 @@ function ToolResultOfficeDocumentsCard({ part, className }) {
2245
3706
  }),
2246
3707
  files.length === 0 && part.state === "pending" ? /* @__PURE__ */ jsx("p", {
2247
3708
  className: "text-sm text-neutral-600",
2248
- children: "Creating documents…"
3709
+ children: copy.creatingDocuments
2249
3710
  }) : null,
2250
3711
  files.length === 0 && part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
2251
3712
  className: "text-sm text-neutral-600",
2252
- children: "No files were generated."
3713
+ children: copy.noFilesGenerated
2253
3714
  }) : null,
2254
3715
  errorDetails ? /* @__PURE__ */ jsxs("p", {
2255
3716
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
2256
3717
  children: [
2257
- /* @__PURE__ */ jsx("span", {
3718
+ /* @__PURE__ */ jsxs("span", {
2258
3719
  className: "font-semibold",
2259
- children: "Error details:"
3720
+ children: [copy.errorDetails, ":"]
2260
3721
  }),
2261
3722
  " ",
2262
3723
  errorDetails
@@ -2294,15 +3755,16 @@ function formatResult(value) {
2294
3755
  return null;
2295
3756
  }
2296
3757
  }
2297
- function ToolResultWorkflowDispatchCard({ part, className }) {
3758
+ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
3759
+ const copy = getUiCopy(locale);
2298
3760
  const result = parseResult(part.result);
2299
3761
  const workflowName = result.workflowName ?? part.name;
2300
- const status = result.status ?? part.state;
3762
+ const status = getUiStatusLabel(result.status ?? part.state, copy);
2301
3763
  const failed = part.state === "error";
2302
3764
  const output$1 = formatResult(part.result);
2303
3765
  const error = formatToolErrorDetails(part.errorDetails);
2304
3766
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
2305
- "aria-label": `Workflow: ${workflowName}`,
3767
+ "aria-label": `${copy.workflow}: ${workflowName}`,
2306
3768
  className: joinClasses("w-full rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
2307
3769
  children: /* @__PURE__ */ jsxs("span", {
2308
3770
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -2313,7 +3775,7 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
2313
3775
  }),
2314
3776
  /* @__PURE__ */ jsx("span", {
2315
3777
  className: "shrink-0 font-medium",
2316
- children: "Workflow"
3778
+ children: copy.workflow
2317
3779
  }),
2318
3780
  /* @__PURE__ */ jsx("span", {
2319
3781
  className: "min-w-0 truncate text-neutral-600",
@@ -2335,35 +3797,35 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
2335
3797
  ]
2336
3798
  })
2337
3799
  }), /* @__PURE__ */ jsxs(SheetContent, {
2338
- closeLabel: "Close",
3800
+ locale,
2339
3801
  children: [/* @__PURE__ */ jsx(SheetHeader, {
2340
3802
  className: "pr-10",
2341
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "Workflow dispatch" })
3803
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.workflowDispatch })
2342
3804
  }), /* @__PURE__ */ jsxs("section", {
2343
3805
  className: "mt-6 space-y-4",
2344
- "aria-label": "Workflow dispatch result",
3806
+ "aria-label": copy.workflowDispatchResult,
2345
3807
  children: [
2346
3808
  /* @__PURE__ */ jsxs("dl", {
2347
3809
  className: "grid gap-2 text-sm",
2348
3810
  children: [
2349
3811
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2350
3812
  className: "text-xs text-neutral-500",
2351
- children: "Workflow"
3813
+ children: copy.workflow
2352
3814
  }), /* @__PURE__ */ jsx("dd", { children: workflowName })] }),
2353
3815
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2354
3816
  className: "text-xs text-neutral-500",
2355
- children: "Status"
3817
+ children: copy.status
2356
3818
  }), /* @__PURE__ */ jsx("dd", { children: status })] }),
2357
3819
  result.executionId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2358
3820
  className: "text-xs text-neutral-500",
2359
- children: "Execution ID"
3821
+ children: copy.executionId
2360
3822
  }), /* @__PURE__ */ jsx("dd", {
2361
3823
  className: "break-all",
2362
3824
  children: result.executionId
2363
3825
  })] }) : null,
2364
3826
  result.workflowId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2365
3827
  className: "text-xs text-neutral-500",
2366
- children: "Workflow ID"
3828
+ children: copy.workflowId
2367
3829
  }), /* @__PURE__ */ jsx("dd", {
2368
3830
  className: "break-all",
2369
3831
  children: result.workflowId
@@ -2372,7 +3834,7 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
2372
3834
  }),
2373
3835
  output$1 ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
2374
3836
  className: "mb-2 text-sm font-medium",
2375
- children: "Result"
3837
+ children: copy.result
2376
3838
  }), /* @__PURE__ */ jsx("pre", {
2377
3839
  className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
2378
3840
  children: output$1
@@ -2380,9 +3842,9 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
2380
3842
  error ? /* @__PURE__ */ jsxs("p", {
2381
3843
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
2382
3844
  children: [
2383
- /* @__PURE__ */ jsx("span", {
3845
+ /* @__PURE__ */ jsxs("span", {
2384
3846
  className: "font-semibold",
2385
- children: "Error details:"
3847
+ children: [copy.errorDetails, ":"]
2386
3848
  }),
2387
3849
  " ",
2388
3850
  error
@@ -2403,6 +3865,7 @@ const TOOL_USE_ACTIONS = {
2403
3865
  external_datasource: "query",
2404
3866
  firecrawl_search: "web",
2405
3867
  http_request: "request",
3868
+ memory_proposal: "tool",
2406
3869
  mcp_tool: "request",
2407
3870
  office_documents: "documents",
2408
3871
  perplexity: "web",
@@ -2558,7 +4021,19 @@ function getDatasourceResources$1(part) {
2558
4021
  const resources = part.metadata.resources;
2559
4022
  return Array.isArray(resources) ? resources.filter(isDatasourceResource) : [];
2560
4023
  }
2561
- function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAgentThread, getResourceDownloadUrl }) {
4024
+ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAgentThread, getResourceDownloadUrl, memoryProposal }) {
4025
+ const copy = getUiCopy(locale);
4026
+ if (part.toolType === "memory_proposal") {
4027
+ const proposal = part.metadata?.proposal;
4028
+ if (!memoryProposal || !proposal || typeof proposal !== "object") return null;
4029
+ return /* @__PURE__ */ jsx(MemoryProposalCard, {
4030
+ proposal,
4031
+ actions: memoryProposal.actions,
4032
+ activeAgentId: memoryProposal.activeAgentId,
4033
+ locale,
4034
+ className
4035
+ });
4036
+ }
2562
4037
  if (part.state === "pending") return /* @__PURE__ */ jsx(ToolUseIndicator, {
2563
4038
  part,
2564
4039
  locale,
@@ -2573,39 +4048,48 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
2573
4048
  const datasourceResources = getDatasourceResources$1(part);
2574
4049
  if (part.toolType === "email_send") return /* @__PURE__ */ jsx(ToolResultEmailSendCard, {
2575
4050
  part,
4051
+ locale,
2576
4052
  className
2577
4053
  });
2578
4054
  if (part.toolType === "agent_invocation") return /* @__PURE__ */ jsx(ToolResultAgentInvocationCard, {
2579
4055
  part,
4056
+ locale,
2580
4057
  className,
2581
4058
  onOpenThread: onOpenAgentThread
2582
4059
  });
2583
4060
  if (part.toolType === "browser") return /* @__PURE__ */ jsx(ToolResultBrowserCard, {
2584
4061
  part,
4062
+ locale,
2585
4063
  className
2586
4064
  });
2587
4065
  if (part.toolType === "external_datasource") return /* @__PURE__ */ jsx(ToolResultExternalDatasourceCard, {
2588
4066
  part,
4067
+ locale,
2589
4068
  className
2590
4069
  });
2591
4070
  if (part.toolType === "office_documents") return /* @__PURE__ */ jsx(ToolResultOfficeDocumentsCard, {
2592
4071
  part,
4072
+ locale,
2593
4073
  className
2594
4074
  });
2595
4075
  if (part.toolType === "http_request") return /* @__PURE__ */ jsx(ToolResultHttpRequestCard, {
2596
4076
  part,
4077
+ locale,
2597
4078
  className
2598
4079
  });
2599
4080
  if (part.toolType === "mcp_tool") return /* @__PURE__ */ jsx(ToolResultMcpCard, {
2600
4081
  part,
4082
+ locale,
2601
4083
  className
2602
4084
  });
2603
4085
  if (part.toolType === "workflow_dispatch") return /* @__PURE__ */ jsx(ToolResultWorkflowDispatchCard, {
2604
4086
  part,
4087
+ locale,
2605
4088
  className
2606
4089
  });
2607
4090
  if (part.toolType === "perplexity" || part.toolType === "firecrawl_search") return /* @__PURE__ */ jsx(ToolResultWebSearchCard, {
2608
4091
  part,
4092
+ locale,
2609
4093
  className
2610
4094
  });
2611
4095
  if (datasourceResources.length > 0) return /* @__PURE__ */ jsx(DatasourceToolResources, {
@@ -2627,15 +4111,15 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
2627
4111
  children: part.name
2628
4112
  }), /* @__PURE__ */ jsx("span", {
2629
4113
  className: "rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-800",
2630
- children: "completed"
4114
+ children: copy.completed
2631
4115
  })]
2632
4116
  }),
2633
4117
  part.toolType ? /* @__PURE__ */ jsxs("p", {
2634
4118
  className: "text-xs text-slate-600",
2635
4119
  children: [
2636
- /* @__PURE__ */ jsx("span", {
4120
+ /* @__PURE__ */ jsxs("span", {
2637
4121
  className: "font-semibold",
2638
- children: "Type:"
4122
+ children: [copy.type, ":"]
2639
4123
  }),
2640
4124
  " ",
2641
4125
  part.toolType
@@ -2646,7 +4130,7 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
2646
4130
  className: "space-y-2",
2647
4131
  children: [/* @__PURE__ */ jsx("summary", {
2648
4132
  className: "cursor-pointer text-xs font-semibold text-slate-600",
2649
- children: "Input"
4133
+ children: copy.input
2650
4134
  }), /* @__PURE__ */ jsx("pre", {
2651
4135
  className: "overflow-x-auto rounded bg-slate-900 p-2 text-xs text-slate-100",
2652
4136
  children: formatJson(part.input)
@@ -2658,13 +4142,13 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
2658
4142
  children: [
2659
4143
  /* @__PURE__ */ jsx("summary", {
2660
4144
  className: "cursor-pointer text-xs font-semibold text-slate-600",
2661
- children: "Output"
4145
+ children: copy.output
2662
4146
  }),
2663
4147
  officeMediaFiles.length > 0 ? /* @__PURE__ */ jsxs("div", {
2664
4148
  className: "space-y-2 rounded border border-slate-200 bg-white p-3",
2665
4149
  children: [/* @__PURE__ */ jsx("p", {
2666
4150
  className: "text-xs font-semibold text-slate-700",
2667
- children: "Generated files"
4151
+ children: copy.generatedFiles
2668
4152
  }), /* @__PURE__ */ jsx("ul", {
2669
4153
  className: "space-y-1",
2670
4154
  children: officeMediaFiles.map((file) => {
@@ -2694,13 +4178,14 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
2694
4178
 
2695
4179
  //#endregion
2696
4180
  //#region src/components/thinking.tsx
2697
- function Thinking({ part, thinkingLabel = "Thinking…", completedLabel = "Thought process", defaultOpen, className,...props }) {
4181
+ function Thinking({ part, thinkingLabel, completedLabel, locale, defaultOpen, className,...props }) {
4182
+ const copy = getUiCopy(locale);
2698
4183
  const isStreaming = part.state === "streaming";
2699
4184
  const hasContent = Boolean(part.thinking.trim());
2700
4185
  const [isOpen, setIsOpen] = useState(defaultOpen ?? isStreaming);
2701
4186
  const previousState = useRef(part.state);
2702
4187
  const contentId = useId();
2703
- const label = isStreaming ? thinkingLabel : completedLabel;
4188
+ const label = isStreaming ? thinkingLabel ?? copy.thinking : completedLabel ?? copy.thoughtProcess;
2704
4189
  useEffect(() => {
2705
4190
  if (previousState.current === "streaming" && !isStreaming) setIsOpen(false);
2706
4191
  previousState.current = part.state;
@@ -2714,7 +4199,7 @@ function Thinking({ part, thinkingLabel = "Thinking…", completedLabel = "Thoug
2714
4199
  type: "button",
2715
4200
  "aria-controls": hasContent ? contentId : void 0,
2716
4201
  "aria-expanded": hasContent ? isOpen : void 0,
2717
- "aria-label": hasContent ? `${isOpen ? "Collapse" : "Expand"} ${label}` : label,
4202
+ "aria-label": hasContent ? `${isOpen ? copy.collapse : copy.expand} ${label}` : label,
2718
4203
  disabled: !hasContent,
2719
4204
  className: joinClasses("inline-flex items-center gap-2 rounded-md py-1 text-left font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", hasContent ? "cursor-pointer hover:text-neutral-900" : "cursor-default"),
2720
4205
  onClick: () => setIsOpen((value) => !value),
@@ -2736,7 +4221,7 @@ function Thinking({ part, thinkingLabel = "Thinking…", completedLabel = "Thoug
2736
4221
  /* @__PURE__ */ jsx("span", {
2737
4222
  className: "sr-only",
2738
4223
  "aria-live": "polite",
2739
- children: isStreaming ? "Thinking in progress" : "Thinking complete"
4224
+ children: isStreaming ? copy.thinkingInProgress : copy.thinkingComplete
2740
4225
  }),
2741
4226
  hasContent && isOpen ? /* @__PURE__ */ jsx("p", {
2742
4227
  id: contentId,
@@ -2820,7 +4305,8 @@ function getMessageTextClassName(role) {
2820
4305
  function getMessageTextAlignmentClassName(role) {
2821
4306
  return role === "user" ? "text-right" : "text-left";
2822
4307
  }
2823
- function renderPart(part, index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName) {
4308
+ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName) {
4309
+ const copy = getUiCopy(locale);
2824
4310
  if (part.type === "text") {
2825
4311
  if (renderText) return /* @__PURE__ */ jsx("div", { children: renderText(part, {
2826
4312
  message,
@@ -2840,7 +4326,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
2840
4326
  className: "block w-fit rounded-lg border border-slate-200 bg-white p-2",
2841
4327
  children: [/* @__PURE__ */ jsx("img", {
2842
4328
  src: part.url,
2843
- alt: title || "Uploaded image",
4329
+ alt: title || copy.uploadedImage,
2844
4330
  className: "max-h-56 rounded-md object-contain"
2845
4331
  }), title ? /* @__PURE__ */ jsx("p", {
2846
4332
  className: "mt-2 max-w-xs truncate text-xs font-medium text-slate-700",
@@ -2849,7 +4335,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
2849
4335
  }, `image-${index}`);
2850
4336
  }
2851
4337
  if (part.type === "input_file") {
2852
- const fileName = part.metadata?.originalFileName || part.title || getFilenameFromUrl(part.fileUrl) || "Document";
4338
+ const fileName = part.metadata?.originalFileName || part.title || getFilenameFromUrl(part.fileUrl) || copy.document;
2853
4339
  const extension = getDisplayExtension(fileName);
2854
4340
  return /* @__PURE__ */ jsxs("a", {
2855
4341
  href: part.fileUrl,
@@ -2858,7 +4344,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
2858
4344
  className: "flex w-fit items-center gap-3 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-left",
2859
4345
  children: [/* @__PURE__ */ jsx("span", {
2860
4346
  className: "rounded bg-slate-900 px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-white",
2861
- children: extension ?? "File"
4347
+ children: extension ?? copy.file
2862
4348
  }), /* @__PURE__ */ jsxs("div", {
2863
4349
  className: "min-w-0",
2864
4350
  children: [/* @__PURE__ */ jsx("p", {
@@ -2877,7 +4363,8 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
2877
4363
  part,
2878
4364
  locale,
2879
4365
  onOpenAgentThread,
2880
- getResourceDownloadUrl
4366
+ getResourceDownloadUrl,
4367
+ memoryProposal
2881
4368
  }, `tool-${part.id}-${index}`);
2882
4369
  }
2883
4370
  if (part.type === "thinking") {
@@ -2885,7 +4372,8 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
2885
4372
  return /* @__PURE__ */ jsx(Thinking, {
2886
4373
  part,
2887
4374
  thinkingLabel,
2888
- completedLabel: completedThinkingLabel
4375
+ completedLabel: completedThinkingLabel,
4376
+ locale
2889
4377
  }, `thinking-${index}`);
2890
4378
  }
2891
4379
  if (part.type === "guardrail") return /* @__PURE__ */ jsx("p", {
@@ -2933,7 +4421,8 @@ function aggregateSourceToolParts(parts, position) {
2933
4421
  ...remainingParts.slice(insertionIndex)
2934
4422
  ];
2935
4423
  }
2936
- function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD, sourceToolResultsLayout = "aggregated", sourceToolResultsPosition, maxVisibleSourceCards = 3, datasourceToolResultsPosition, onOpenAgentThread, getResourceDownloadUrl, locale, renderText, renderToolCall, renderThinking, isStreaming = false, thinkingLabel, completedThinkingLabel, readMoreLabel = "Read more", readLessLabel = "Read less", className,...props }) {
4424
+ function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD, sourceToolResultsLayout = "aggregated", sourceToolResultsPosition, maxVisibleSourceCards = 3, datasourceToolResultsPosition, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, isStreaming = false, thinkingLabel, completedThinkingLabel, readMoreLabel, readLessLabel, className,...props }) {
4425
+ const copy = getUiCopy(locale);
2937
4426
  const [isExpanded, setIsExpanded] = useState(false);
2938
4427
  const textContent = useMemo(() => message.parts.filter((part) => part.type === "text").map((part) => part.text).join("\n"), [message.parts]);
2939
4428
  const canCollapse = message.role === "user" && message.parts.every((part) => part.type === "text") && textContent.length > collapseThreshold;
@@ -2963,11 +4452,11 @@ function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD,
2963
4452
  locale,
2964
4453
  maxVisible: maxVisibleSourceCards,
2965
4454
  getResourceDownloadUrl
2966
- }, `source-results-${item.index}`) : renderPart(item.part, item.index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName)), canCollapse ? /* @__PURE__ */ jsx("button", {
4455
+ }, `source-results-${item.index}`) : renderPart(item.part, item.index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName)), canCollapse ? /* @__PURE__ */ jsx("button", {
2967
4456
  type: "button",
2968
4457
  className: "text-xs font-medium text-slate-600 hover:text-slate-900",
2969
4458
  onClick: () => setIsExpanded((previous) => !previous),
2970
- children: isExpanded ? readLessLabel : readMoreLabel
4459
+ children: isExpanded ? readLessLabel ?? copy.readLess : readMoreLabel ?? copy.readMore
2971
4460
  }) : null]
2972
4461
  });
2973
4462
  }
@@ -2979,7 +4468,8 @@ function getDatasourceResources(part) {
2979
4468
  const resources = part.metadata?.resources;
2980
4469
  return Array.isArray(resources) ? resources.filter(isDatasourceResource) : [];
2981
4470
  }
2982
- function isRenderableToolPart(part, locale, hasCustomRenderer = false) {
4471
+ function isRenderableToolPart(part, locale, hasCustomRenderer = false, hasMemoryProposalClient = false) {
4472
+ if (part.toolType === "memory_proposal") return hasMemoryProposalClient;
2983
4473
  if (hasCustomRenderer || part.toolType !== "datasource") return true;
2984
4474
  if (part.state !== "completed") return true;
2985
4475
  return getDatasourceResourceCards(getDatasourceResources(part), locale).length > 0;
@@ -2993,7 +4483,7 @@ function withParts(message, parts) {
2993
4483
  function AssistantMessage({ message, avatar, footer, messageClassName, contentClassName, toolResultsClassName, toolPartsClassName, contentPartsClassName, messagePartsProps, className,...props }) {
2994
4484
  const toolParts = message.parts.filter((part) => part.type === "tool-call");
2995
4485
  const contentParts = message.parts.filter((part) => part.type !== "tool-call");
2996
- const renderableToolParts = toolParts.filter((part) => isRenderableToolPart(part, messagePartsProps?.locale, Boolean(messagePartsProps?.renderToolCall)));
4486
+ const renderableToolParts = toolParts.filter((part) => isRenderableToolPart(part, messagePartsProps?.locale, Boolean(messagePartsProps?.renderToolCall), Boolean(messagePartsProps?.memoryProposal)));
2997
4487
  const hasContentRow = contentParts.length > 0 || footer !== void 0;
2998
4488
  return /* @__PURE__ */ jsxs("div", {
2999
4489
  className: joinClasses("plai-assistant-message flex w-full flex-col gap-2", className),
@@ -3115,7 +4605,10 @@ async function writeTextToClipboard(text$1) {
3115
4605
  textarea.remove();
3116
4606
  }
3117
4607
  }
3118
- function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel = "Copy", copiedLabel = "Copied", children, className, disabled, onClick, type = "button",...props }) {
4608
+ function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel, copiedLabel, locale, children, className, disabled, onClick, type = "button",...props }) {
4609
+ const copy = getUiCopy(locale);
4610
+ const resolvedCopyLabel = copyLabel ?? copy.copy;
4611
+ const resolvedCopiedLabel = copiedLabel ?? copy.copied;
3119
4612
  const [isCopied, setIsCopied] = useState(false);
3120
4613
  const [isCopying, setIsCopying] = useState(false);
3121
4614
  const timeoutRef = useRef();
@@ -3146,7 +4639,7 @@ function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel = "Co
3146
4639
  };
3147
4640
  return /* @__PURE__ */ jsxs("button", {
3148
4641
  type,
3149
- "aria-label": isCopied ? copiedLabel : copyLabel,
4642
+ "aria-label": isCopied ? resolvedCopiedLabel : resolvedCopyLabel,
3150
4643
  className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-700 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950 disabled:cursor-not-allowed disabled:opacity-40", className),
3151
4644
  disabled: disabled || isCopying,
3152
4645
  onClick: handleClick,
@@ -3160,7 +4653,7 @@ function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel = "Co
3160
4653
  }), /* @__PURE__ */ jsx("span", {
3161
4654
  className: "sr-only",
3162
4655
  "aria-live": "polite",
3163
- children: isCopied ? copiedLabel : copyLabel
4656
+ children: isCopied ? resolvedCopiedLabel : resolvedCopyLabel
3164
4657
  })]
3165
4658
  });
3166
4659
  }
@@ -3179,9 +4672,9 @@ function ThumbButton({ label, icon, className, type = "button",...props }) {
3179
4672
  })]
3180
4673
  });
3181
4674
  }
3182
- function ThumbUp({ label = "Rate positively",...props }) {
4675
+ function ThumbUp({ label, locale,...props }) {
3183
4676
  return /* @__PURE__ */ jsx(ThumbButton, {
3184
- label,
4677
+ label: label ?? getUiCopy(locale).ratePositively,
3185
4678
  icon: /* @__PURE__ */ jsx(ThumbsUp, {
3186
4679
  className: "size-4",
3187
4680
  "aria-hidden": "true"
@@ -3189,9 +4682,9 @@ function ThumbUp({ label = "Rate positively",...props }) {
3189
4682
  ...props
3190
4683
  });
3191
4684
  }
3192
- function ThumbDown({ label = "Rate negatively",...props }) {
4685
+ function ThumbDown({ label, locale,...props }) {
3193
4686
  return /* @__PURE__ */ jsx(ThumbButton, {
3194
- label,
4687
+ label: label ?? getUiCopy(locale).rateNegatively,
3195
4688
  icon: /* @__PURE__ */ jsx(ThumbsDown, {
3196
4689
  className: "size-4",
3197
4690
  "aria-hidden": "true"
@@ -3202,10 +4695,11 @@ function ThumbDown({ label = "Rate negatively",...props }) {
3202
4695
 
3203
4696
  //#endregion
3204
4697
  //#region src/components/reload.tsx
3205
- function Reload({ label = "Retry response", className, type = "button",...props }) {
4698
+ function Reload({ label, locale, className, type = "button",...props }) {
4699
+ const resolvedLabel = label ?? getUiCopy(locale).retryResponse;
3206
4700
  return /* @__PURE__ */ jsxs("button", {
3207
4701
  type,
3208
- "aria-label": label,
4702
+ "aria-label": resolvedLabel,
3209
4703
  className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-700 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950 disabled:cursor-not-allowed disabled:opacity-40", className),
3210
4704
  ...props,
3211
4705
  children: [/* @__PURE__ */ jsx(RotateCcw, {
@@ -3213,7 +4707,7 @@ function Reload({ label = "Retry response", className, type = "button",...props
3213
4707
  "aria-hidden": "true"
3214
4708
  }), /* @__PURE__ */ jsx("span", {
3215
4709
  className: "sr-only",
3216
- children: label
4710
+ children: resolvedLabel
3217
4711
  })]
3218
4712
  });
3219
4713
  }
@@ -3267,7 +4761,7 @@ function partitionPromptFormFiles(files) {
3267
4761
 
3268
4762
  //#endregion
3269
4763
  //#region src/components/prompt-form/prompt-form-attach-button.tsx
3270
- function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, accept = PROMPT_FORM_FILE_ACCEPT, disabled = false, label = "Attach file",...props }) {
4764
+ function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, locale, accept = PROMPT_FORM_FILE_ACCEPT, disabled = false, label,...props }) {
3271
4765
  const fileInputRef = useRef(null);
3272
4766
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
3273
4767
  ref: fileInputRef,
@@ -3283,7 +4777,7 @@ function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, accept = PROM
3283
4777
  }
3284
4778
  }), /* @__PURE__ */ jsx(PromptFormIconButton, {
3285
4779
  type: "button",
3286
- "aria-label": label,
4780
+ "aria-label": label ?? getUiCopy(locale).attachFile,
3287
4781
  disabled,
3288
4782
  onClick: () => fileInputRef.current?.click(),
3289
4783
  ...props,
@@ -3312,7 +4806,16 @@ function PromptFormIconButton({ className, type = "button",...props }) {
3312
4806
  ...props
3313
4807
  });
3314
4808
  }
3315
- function PromptForm({ value, onValueChange, onSubmit, status = "ready", uploadState, onStop, disabled = false, hasPendingInput = false, clearOnSubmit = true, enabledTools, placeholder = "Type a message...", sendLabel = "Send", stopLabel = "Stop", attachLabel = "Attach file", removeFileLabel = "Remove file", uploadingLabel = "Uploading", processingUploadLabel = "Processing upload", uploadErrorLabel = "Upload failed", enableAttachments = true, files: filesProp, onFilesChange, onInvalidFiles, accept = PROMPT_FORM_FILE_ACCEPT, className, textareaClassName, attachmentsClassName, uploadProgressClassName, maxRows = defaultMaxRows, submitButtonClassName, stopButtonClassName, leftSlot, rightSlot, submitOnEnter = true, onTextareaKeyDown }) {
4809
+ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale, uploadState, onStop, disabled = false, hasPendingInput = false, clearOnSubmit = true, enabledTools, placeholder: placeholderProp, sendLabel: sendLabelProp, stopLabel: stopLabelProp, attachLabel: attachLabelProp, removeFileLabel: removeFileLabelProp, uploadingLabel: uploadingLabelProp, processingUploadLabel: processingUploadLabelProp, uploadErrorLabel: uploadErrorLabelProp, enableAttachments = true, files: filesProp, onFilesChange, onInvalidFiles, accept = PROMPT_FORM_FILE_ACCEPT, className, textareaClassName, attachmentsClassName, uploadProgressClassName, maxRows = defaultMaxRows, submitButtonClassName, stopButtonClassName, leftSlot, rightSlot, submitOnEnter = true, onTextareaKeyDown }) {
4810
+ const copy = getUiCopy(locale);
4811
+ const placeholder = placeholderProp ?? copy.typeMessage;
4812
+ const sendLabel = sendLabelProp ?? copy.send;
4813
+ const stopLabel = stopLabelProp ?? copy.stop;
4814
+ const attachLabel = attachLabelProp ?? copy.attachFile;
4815
+ const removeFileLabel = removeFileLabelProp ?? copy.removeFile;
4816
+ const uploadingLabel = uploadingLabelProp ?? copy.uploading;
4817
+ const processingUploadLabel = processingUploadLabelProp ?? copy.processingUpload;
4818
+ const uploadErrorLabel = uploadErrorLabelProp ?? copy.uploadFailed;
3316
4819
  const textareaRef = useRef(null);
3317
4820
  const [internalFiles, setInternalFiles] = useState([]);
3318
4821
  const [isSubmitting, setIsSubmitting] = useState(false);
@@ -3429,15 +4932,9 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", uploadSt
3429
4932
  children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
3430
4933
  })]
3431
4934
  }, `${file.name}-${file.lastModified}-${index}`))
3432
- }), isUploading && uploadState ? /* @__PURE__ */ jsxs("div", {
3433
- className: "space-y-1.5 px-4 pb-3",
3434
- children: [/* @__PURE__ */ jsxs("div", {
3435
- className: "flex items-center justify-between gap-3 text-xs text-neutral-500",
3436
- children: [/* @__PURE__ */ jsxs("span", {
3437
- className: "truncate",
3438
- children: [uploadState.status === "processing" ? processingUploadLabel : uploadingLabel, uploadState.fileName ? `: ${uploadState.fileName}` : ""]
3439
- }), /* @__PURE__ */ jsxs("span", { children: [Math.round(uploadState.progress), "%"] })]
3440
- }), /* @__PURE__ */ jsx("div", {
4935
+ }), isUploading && uploadState ? /* @__PURE__ */ jsx("div", {
4936
+ className: "px-4 pb-3",
4937
+ children: /* @__PURE__ */ jsx("div", {
3441
4938
  role: "progressbar",
3442
4939
  tabIndex: 0,
3443
4940
  "aria-label": uploadState.status === "processing" ? processingUploadLabel : uploadingLabel,
@@ -3449,7 +4946,7 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", uploadSt
3449
4946
  className: "h-full rounded-full bg-neutral-900 transition-[width] duration-150",
3450
4947
  style: { width: `${uploadState.progress}%` }
3451
4948
  })
3452
- })]
4949
+ })
3453
4950
  }) : uploadState?.status === "error" ? /* @__PURE__ */ jsx("p", {
3454
4951
  className: "px-4 pb-3 text-xs text-red-600",
3455
4952
  children: uploadErrorLabel
@@ -3636,7 +5133,8 @@ function useSpeechToText({ transcribe, onTranscriptionComplete, onTranscriptionE
3636
5133
  async function missingTranscribe() {
3637
5134
  throw new Error("SpeechToTextToggle requires transcribe when no controller is provided.");
3638
5135
  }
3639
- function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscriptionError, transcribe, disabled = false, label = "Voice input", listeningLabel = "Stop recording", cancelLabel = "Cancel recording", requestingLabel = "Requesting microphone access...", loadingLabel = "Transcribing...", cancelOnClickWhileRecording = false, className, onClick,...props }) {
5136
+ function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscriptionError, transcribe, locale, disabled = false, label, listeningLabel, cancelLabel, requestingLabel, loadingLabel, cancelOnClickWhileRecording = false, className, onClick,...props }) {
5137
+ const copy = getUiCopy(locale);
3640
5138
  const internalController = useSpeechToText({
3641
5139
  transcribe: transcribe ?? missingTranscribe,
3642
5140
  onTranscriptionComplete,
@@ -3647,7 +5145,7 @@ function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscripti
3647
5145
  const isListening = speechToText.status === "recording";
3648
5146
  const isTranscribing = speechToText.status === "transcribing";
3649
5147
  const cancelsRecording = isListening && cancelOnClickWhileRecording;
3650
- const ariaLabel = isRequesting ? requestingLabel : isTranscribing ? loadingLabel : cancelsRecording ? cancelLabel : isListening ? listeningLabel : label;
5148
+ const ariaLabel = isRequesting ? requestingLabel ?? copy.requestingMicrophoneAccess : isTranscribing ? loadingLabel ?? copy.transcribing : cancelsRecording ? cancelLabel ?? copy.cancelRecording : isListening ? listeningLabel ?? copy.stopRecording : label ?? copy.voiceInput;
3651
5149
  return /* @__PURE__ */ jsx(PromptFormIconButton, {
3652
5150
  type: "button",
3653
5151
  "aria-label": ariaLabel,
@@ -3684,5 +5182,5 @@ async function dummyTranscribeAudio(_audio, signal) {
3684
5182
  }
3685
5183
 
3686
5184
  //#endregion
3687
- export { AggregatedSourceResults, ArrowUp, AssistantMessage, Clipboard, DatasourceFolderCard, DatasourceToolResources, DatasourceToolResultCard, Loader, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, MessageParts, MessageRoot, Microphone, PROMPT_FORM_FILE_ACCEPT, Paperclip, PromptForm, PromptFormAttachButton, PromptFormIconButton, Reload, ResourceCard, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SpeechToTextToggle, Stop, Thinking, ThumbDown, ThumbUp, ToolError, ToolResultAgentInvocationCard, ToolResultBrowserCard, ToolResultCard, ToolResultExternalDatasourceCard, ToolResultHttpRequestCard, ToolResultMcpCard, ToolResultOfficeDocumentsCard, ToolResultWebSearchCard, ToolResultWorkflowDispatchCard, ToolUseIndicator, UserMessage, X, dummyTranscribeAudio, getLocalizedOpenGraphValue, getResourceDescription, getResourceIcon, getResourceOpenGraphImage, getResourceOpenGraphType, getResourceTitle, getResourceType, getResourceUrl, getToolUseLabel, isAllowedPromptFormFile, partitionPromptFormFiles, useChat, useSpeechToText };
5185
+ export { AggregatedSourceResults, ArrowUp, AssistantMessage, Clipboard, DatasourceFolderCard, DatasourceToolResources, DatasourceToolResultCard, Loader, MemoryProposalCard, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, MessageParts, MessageRoot, Microphone, PROMPT_FORM_FILE_ACCEPT, Paperclip, PromptForm, PromptFormAttachButton, PromptFormIconButton, Reload, ResourceCard, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SpeechToTextToggle, Stop, Thinking, ThumbDown, ThumbUp, ToolError, ToolResultAgentInvocationCard, ToolResultBrowserCard, ToolResultCard, ToolResultExternalDatasourceCard, ToolResultHttpRequestCard, ToolResultMcpCard, ToolResultOfficeDocumentsCard, ToolResultWebSearchCard, ToolResultWorkflowDispatchCard, ToolUseIndicator, UserMessage, X, dummyTranscribeAudio, getLocalizedOpenGraphValue, getResourceDescription, getResourceIcon, getResourceOpenGraphImage, getResourceOpenGraphType, getResourceTitle, getResourceType, getResourceUrl, getToolUseLabel, isAllowedPromptFormFile, partitionPromptFormFiles, useChat, useSpeechToText };
3688
5186
  //# sourceMappingURL=index.js.map