@plaisolutions/react 0.12.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.
@@ -3,6 +3,1058 @@ import { Bot, Brain, Check, CheckCircle2, ChevronDown, CircleX, Copy, Database,
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  import { HttpStatusError } from "@plaisolutions/client";
5
5
 
6
+ //#region src/components/internal/tool-locale.ts
7
+ const SUPPORTED_TOOL_LOCALES = new Set([
8
+ "ca",
9
+ "da",
10
+ "de",
11
+ "en",
12
+ "es",
13
+ "fr",
14
+ "it",
15
+ "no",
16
+ "pt",
17
+ "sv"
18
+ ]);
19
+ function getCurrentLocale$1() {
20
+ if (typeof document !== "undefined" && document.documentElement.lang) return document.documentElement.lang;
21
+ return typeof navigator === "undefined" ? "en" : navigator.language;
22
+ }
23
+ function getSupportedToolLocale(locale) {
24
+ const language = (locale ?? getCurrentLocale$1()).trim().toLowerCase().split(/[-_]/)[0];
25
+ const normalizedLanguage = language === "nb" || language === "nn" ? "no" : language;
26
+ return SUPPORTED_TOOL_LOCALES.has(normalizedLanguage) ? normalizedLanguage : "en";
27
+ }
28
+
29
+ //#endregion
30
+ //#region src/components/internal/ui-copy.ts
31
+ const ENGLISH_COPY = {
32
+ close: "Close",
33
+ pending: "pending",
34
+ error: "error",
35
+ completed: "completed",
36
+ status: "Status",
37
+ result: "Result",
38
+ errorDetails: "Error details",
39
+ input: "Input",
40
+ output: "Output",
41
+ type: "Type",
42
+ generatedFiles: "Generated files",
43
+ file: "file",
44
+ files: "files",
45
+ resource: "Resource",
46
+ resources: "Resources",
47
+ datasourceResources: "Datasource resources",
48
+ view: "View",
49
+ openingResource: "Opening resource…",
50
+ resourceOpenFailed: "Unable to open resource. Try again.",
51
+ searching: "Searching…",
52
+ searchResults: "Search results",
53
+ searchingForSources: "Searching for sources…",
54
+ noSourcesReturned: "No sources returned.",
55
+ agent: "Agent",
56
+ agentInvocationResult: "Agent invocation result",
57
+ agentId: "Agent ID",
58
+ executionId: "Execution ID",
59
+ threadId: "Thread ID",
60
+ prompt: "Prompt",
61
+ openConversation: "Open conversation",
62
+ workflow: "Workflow",
63
+ workflowDispatch: "Workflow dispatch",
64
+ workflowDispatchResult: "Workflow dispatch result",
65
+ workflowId: "Workflow ID",
66
+ mcpTool: "MCP tool",
67
+ mcpToolResult: "MCP tool result",
68
+ tool: "Tool",
69
+ server: "Server",
70
+ officeDocuments: "Office documents",
71
+ creatingDocuments: "Creating documents…",
72
+ noFilesGenerated: "No files were generated.",
73
+ httpRequest: "HTTP request",
74
+ httpResponse: "HTTP response",
75
+ requestUrl: "Request URL",
76
+ responseUrl: "Response URL",
77
+ contentType: "Content type",
78
+ response: "Response",
79
+ responseHeaders: "Response headers",
80
+ externalDatasource: "External datasource",
81
+ externalDatasourceResult: "External datasource result",
82
+ sqlQuery: "SQL query",
83
+ queryResults: "Query results",
84
+ noDataToDisplay: "No data to display.",
85
+ property: "Property",
86
+ value: "Value",
87
+ browser: "Browser",
88
+ browserResult: "Browser result",
89
+ expandBrowserResult: "Expand browser result",
90
+ collapseBrowserResult: "Collapse browser result",
91
+ credit: "credit",
92
+ credits: "credits",
93
+ email: "Email",
94
+ subject: "Subject",
95
+ to: "To",
96
+ noRecipientsProvided: "No recipients provided.",
97
+ body: "Body",
98
+ delivery: "Delivery",
99
+ recipients: "Recipients",
100
+ provider: "Provider",
101
+ messageId: "Message ID",
102
+ rawStatus: "Raw status",
103
+ typeMessage: "Type a message...",
104
+ send: "Send",
105
+ stop: "Stop",
106
+ attachFile: "Attach file",
107
+ removeFile: "Remove file",
108
+ uploading: "Uploading",
109
+ processingUpload: "Processing upload",
110
+ uploadFailed: "Upload failed",
111
+ thinking: "Thinking…",
112
+ thoughtProcess: "Thought process",
113
+ collapse: "Collapse",
114
+ expand: "Expand",
115
+ thinkingInProgress: "Thinking in progress",
116
+ thinkingComplete: "Thinking complete",
117
+ uploadedImage: "Uploaded image",
118
+ document: "Document",
119
+ readMore: "Read more",
120
+ readLess: "Read less",
121
+ copy: "Copy",
122
+ copied: "Copied",
123
+ retryResponse: "Retry response",
124
+ ratePositively: "Rate positively",
125
+ rateNegatively: "Rate negatively",
126
+ voiceInput: "Voice input",
127
+ stopRecording: "Stop recording",
128
+ cancelRecording: "Cancel recording",
129
+ requestingMicrophoneAccess: "Requesting microphone access...",
130
+ transcribing: "Transcribing..."
131
+ };
132
+ const TRANSLATIONS = {
133
+ ca: {
134
+ close: "Tanca",
135
+ pending: "pendent",
136
+ error: "error",
137
+ completed: "completat",
138
+ status: "Estat",
139
+ result: "Resultat",
140
+ errorDetails: "Detalls de l’error",
141
+ input: "Entrada",
142
+ output: "Sortida",
143
+ type: "Tipus",
144
+ generatedFiles: "Fitxers generats",
145
+ file: "fitxer",
146
+ files: "fitxers",
147
+ resource: "Recurs",
148
+ resources: "Recursos",
149
+ datasourceResources: "Recursos de la font de dades",
150
+ view: "Mostra",
151
+ openingResource: "Obrint el recurs…",
152
+ resourceOpenFailed: "No s’ha pogut obrir el recurs. Torna-ho a provar.",
153
+ searching: "Cercant…",
154
+ searchResults: "Resultats de cerca",
155
+ searchingForSources: "Cercant fonts…",
156
+ noSourcesReturned: "No s’han trobat fonts.",
157
+ agent: "Agent",
158
+ agentInvocationResult: "Resultat de la invocació de l’agent",
159
+ agentId: "ID de l’agent",
160
+ executionId: "ID d’execució",
161
+ threadId: "ID de la conversa",
162
+ prompt: "Instrucció",
163
+ openConversation: "Obre la conversa",
164
+ workflow: "Flux de treball",
165
+ workflowDispatch: "Execució del flux de treball",
166
+ workflowDispatchResult: "Resultat del flux de treball",
167
+ workflowId: "ID del flux de treball",
168
+ mcpTool: "Eina MCP",
169
+ mcpToolResult: "Resultat de l’eina MCP",
170
+ tool: "Eina",
171
+ server: "Servidor",
172
+ officeDocuments: "Documents d’Office",
173
+ creatingDocuments: "Creant documents…",
174
+ noFilesGenerated: "No s’han generat fitxers.",
175
+ httpRequest: "Sol·licitud HTTP",
176
+ httpResponse: "Resposta HTTP",
177
+ requestUrl: "URL de la sol·licitud",
178
+ responseUrl: "URL de la resposta",
179
+ contentType: "Tipus de contingut",
180
+ response: "Resposta",
181
+ responseHeaders: "Capçaleres de la resposta",
182
+ externalDatasource: "Font de dades externa",
183
+ externalDatasourceResult: "Resultat de la font de dades externa",
184
+ sqlQuery: "Consulta SQL",
185
+ queryResults: "Resultats de la consulta",
186
+ noDataToDisplay: "No hi ha dades per mostrar.",
187
+ property: "Propietat",
188
+ value: "Valor",
189
+ browser: "Navegador",
190
+ browserResult: "Resultat del navegador",
191
+ expandBrowserResult: "Desplega el resultat del navegador",
192
+ collapseBrowserResult: "Plega el resultat del navegador",
193
+ credit: "crèdit",
194
+ credits: "crèdits",
195
+ email: "Correu electrònic",
196
+ subject: "Assumpte",
197
+ to: "Per a",
198
+ noRecipientsProvided: "No s’han indicat destinataris.",
199
+ body: "Cos",
200
+ delivery: "Lliurament",
201
+ recipients: "Destinataris",
202
+ provider: "Proveïdor",
203
+ messageId: "ID del missatge",
204
+ rawStatus: "Estat original",
205
+ typeMessage: "Escriu un missatge...",
206
+ send: "Envia",
207
+ stop: "Atura",
208
+ attachFile: "Adjunta un fitxer",
209
+ removeFile: "Elimina el fitxer",
210
+ uploading: "Pujant",
211
+ processingUpload: "Processant el fitxer",
212
+ uploadFailed: "No s’ha pogut pujar el fitxer",
213
+ thinking: "Pensant…",
214
+ thoughtProcess: "Procés de raonament",
215
+ collapse: "Plega",
216
+ expand: "Desplega",
217
+ thinkingInProgress: "Pensant",
218
+ thinkingComplete: "Raonament completat",
219
+ uploadedImage: "Imatge pujada",
220
+ document: "Document",
221
+ readMore: "Llegeix més",
222
+ readLess: "Llegeix menys",
223
+ copy: "Copia",
224
+ copied: "Copiat",
225
+ retryResponse: "Torna a provar la resposta",
226
+ ratePositively: "Valora positivament",
227
+ rateNegatively: "Valora negativament",
228
+ voiceInput: "Entrada de veu",
229
+ stopRecording: "Atura la gravació",
230
+ cancelRecording: "Cancel·la la gravació",
231
+ requestingMicrophoneAccess: "Sol·licitant accés al micròfon...",
232
+ transcribing: "Transcrivint..."
233
+ },
234
+ da: {
235
+ close: "Luk",
236
+ pending: "afventer",
237
+ error: "fejl",
238
+ completed: "fuldført",
239
+ status: "Status",
240
+ result: "Resultat",
241
+ errorDetails: "Fejldetaljer",
242
+ input: "Input",
243
+ output: "Output",
244
+ type: "Type",
245
+ generatedFiles: "Genererede filer",
246
+ file: "fil",
247
+ files: "filer",
248
+ resource: "Ressource",
249
+ resources: "Ressourcer",
250
+ datasourceResources: "Datakildens ressourcer",
251
+ view: "Vis",
252
+ openingResource: "Åbner ressource…",
253
+ resourceOpenFailed: "Ressourcen kunne ikke åbnes. Prøv igen.",
254
+ searching: "Søger…",
255
+ searchResults: "Søgeresultater",
256
+ searchingForSources: "Søger efter kilder…",
257
+ noSourcesReturned: "Ingen kilder fundet.",
258
+ agent: "Agent",
259
+ agentInvocationResult: "Resultat af agentkald",
260
+ agentId: "Agent-id",
261
+ executionId: "Udførelses-id",
262
+ threadId: "Samtale-id",
263
+ prompt: "Instruktion",
264
+ openConversation: "Åbn samtale",
265
+ workflow: "Arbejdsgang",
266
+ workflowDispatch: "Udførelse af arbejdsgang",
267
+ workflowDispatchResult: "Resultat af arbejdsgang",
268
+ workflowId: "Arbejdsgangs-id",
269
+ mcpTool: "MCP-værktøj",
270
+ mcpToolResult: "Resultat fra MCP-værktøj",
271
+ tool: "Værktøj",
272
+ server: "Server",
273
+ officeDocuments: "Office-dokumenter",
274
+ creatingDocuments: "Opretter dokumenter…",
275
+ noFilesGenerated: "Ingen filer blev genereret.",
276
+ httpRequest: "HTTP-anmodning",
277
+ httpResponse: "HTTP-svar",
278
+ requestUrl: "Anmodnings-URL",
279
+ responseUrl: "Svar-URL",
280
+ contentType: "Indholdstype",
281
+ response: "Svar",
282
+ responseHeaders: "Svarheadere",
283
+ externalDatasource: "Ekstern datakilde",
284
+ externalDatasourceResult: "Resultat fra ekstern datakilde",
285
+ sqlQuery: "SQL-forespørgsel",
286
+ queryResults: "Forespørgselsresultater",
287
+ noDataToDisplay: "Ingen data at vise.",
288
+ property: "Egenskab",
289
+ value: "Værdi",
290
+ browser: "Browser",
291
+ browserResult: "Browserresultat",
292
+ expandBrowserResult: "Udvid browserresultat",
293
+ collapseBrowserResult: "Skjul browserresultat",
294
+ credit: "kredit",
295
+ credits: "kreditter",
296
+ email: "E-mail",
297
+ subject: "Emne",
298
+ to: "Til",
299
+ noRecipientsProvided: "Ingen modtagere angivet.",
300
+ body: "Indhold",
301
+ delivery: "Levering",
302
+ recipients: "Modtagere",
303
+ provider: "Udbyder",
304
+ messageId: "Besked-id",
305
+ rawStatus: "Oprindelig status",
306
+ typeMessage: "Skriv en besked...",
307
+ send: "Send",
308
+ stop: "Stop",
309
+ attachFile: "Vedhæft fil",
310
+ removeFile: "Fjern fil",
311
+ uploading: "Uploader",
312
+ processingUpload: "Behandler fil",
313
+ uploadFailed: "Upload mislykkedes",
314
+ thinking: "Tænker…",
315
+ thoughtProcess: "Tankeproces",
316
+ collapse: "Skjul",
317
+ expand: "Udvid",
318
+ thinkingInProgress: "Tænker",
319
+ thinkingComplete: "Tænkning afsluttet",
320
+ uploadedImage: "Uploadet billede",
321
+ document: "Dokument",
322
+ readMore: "Læs mere",
323
+ readLess: "Læs mindre",
324
+ copy: "Kopiér",
325
+ copied: "Kopieret",
326
+ retryResponse: "Prøv svaret igen",
327
+ ratePositively: "Bedøm positivt",
328
+ rateNegatively: "Bedøm negativt",
329
+ voiceInput: "Stemmeinput",
330
+ stopRecording: "Stop optagelse",
331
+ cancelRecording: "Annuller optagelse",
332
+ requestingMicrophoneAccess: "Anmoder om adgang til mikrofon...",
333
+ transcribing: "Transskriberer..."
334
+ },
335
+ de: {
336
+ close: "Schließen",
337
+ pending: "ausstehend",
338
+ error: "Fehler",
339
+ completed: "abgeschlossen",
340
+ status: "Status",
341
+ result: "Ergebnis",
342
+ errorDetails: "Fehlerdetails",
343
+ input: "Eingabe",
344
+ output: "Ausgabe",
345
+ type: "Typ",
346
+ generatedFiles: "Erstellte Dateien",
347
+ file: "Datei",
348
+ files: "Dateien",
349
+ resource: "Ressource",
350
+ resources: "Ressourcen",
351
+ datasourceResources: "Ressourcen der Datenquelle",
352
+ view: "Anzeigen",
353
+ openingResource: "Ressource wird geöffnet…",
354
+ resourceOpenFailed: "Ressource konnte nicht geöffnet werden. Erneut versuchen.",
355
+ searching: "Suche läuft…",
356
+ searchResults: "Suchergebnisse",
357
+ searchingForSources: "Quellen werden gesucht…",
358
+ noSourcesReturned: "Keine Quellen gefunden.",
359
+ agent: "Agent",
360
+ agentInvocationResult: "Ergebnis des Agentenaufrufs",
361
+ agentId: "Agenten-ID",
362
+ executionId: "Ausführungs-ID",
363
+ threadId: "Konversations-ID",
364
+ prompt: "Anweisung",
365
+ openConversation: "Konversation öffnen",
366
+ workflow: "Workflow",
367
+ workflowDispatch: "Workflow-Ausführung",
368
+ workflowDispatchResult: "Ergebnis der Workflow-Ausführung",
369
+ workflowId: "Workflow-ID",
370
+ mcpTool: "MCP-Tool",
371
+ mcpToolResult: "Ergebnis des MCP-Tools",
372
+ tool: "Tool",
373
+ server: "Server",
374
+ officeDocuments: "Office-Dokumente",
375
+ creatingDocuments: "Dokumente werden erstellt…",
376
+ noFilesGenerated: "Es wurden keine Dateien erstellt.",
377
+ httpRequest: "HTTP-Anfrage",
378
+ httpResponse: "HTTP-Antwort",
379
+ requestUrl: "Anfrage-URL",
380
+ responseUrl: "Antwort-URL",
381
+ contentType: "Inhaltstyp",
382
+ response: "Antwort",
383
+ responseHeaders: "Antwort-Header",
384
+ externalDatasource: "Externe Datenquelle",
385
+ externalDatasourceResult: "Ergebnis der externen Datenquelle",
386
+ sqlQuery: "SQL-Abfrage",
387
+ queryResults: "Abfrageergebnisse",
388
+ noDataToDisplay: "Keine Daten zum Anzeigen.",
389
+ property: "Eigenschaft",
390
+ value: "Wert",
391
+ browser: "Browser",
392
+ browserResult: "Browser-Ergebnis",
393
+ expandBrowserResult: "Browser-Ergebnis erweitern",
394
+ collapseBrowserResult: "Browser-Ergebnis einklappen",
395
+ credit: "Guthabenpunkt",
396
+ credits: "Guthabenpunkte",
397
+ email: "E-Mail",
398
+ subject: "Betreff",
399
+ to: "An",
400
+ noRecipientsProvided: "Keine Empfänger angegeben.",
401
+ body: "Nachrichtentext",
402
+ delivery: "Zustellung",
403
+ recipients: "Empfänger",
404
+ provider: "Anbieter",
405
+ messageId: "Nachrichten-ID",
406
+ rawStatus: "Ursprünglicher Status",
407
+ typeMessage: "Nachricht eingeben...",
408
+ send: "Senden",
409
+ stop: "Stoppen",
410
+ attachFile: "Datei anhängen",
411
+ removeFile: "Datei entfernen",
412
+ uploading: "Wird hochgeladen",
413
+ processingUpload: "Datei wird verarbeitet",
414
+ uploadFailed: "Hochladen fehlgeschlagen",
415
+ thinking: "Denkt nach…",
416
+ thoughtProcess: "Denkprozess",
417
+ collapse: "Einklappen",
418
+ expand: "Erweitern",
419
+ thinkingInProgress: "Denkt nach",
420
+ thinkingComplete: "Denken abgeschlossen",
421
+ uploadedImage: "Hochgeladenes Bild",
422
+ document: "Dokument",
423
+ readMore: "Mehr lesen",
424
+ readLess: "Weniger lesen",
425
+ copy: "Kopieren",
426
+ copied: "Kopiert",
427
+ retryResponse: "Antwort erneut versuchen",
428
+ ratePositively: "Positiv bewerten",
429
+ rateNegatively: "Negativ bewerten",
430
+ voiceInput: "Spracheingabe",
431
+ stopRecording: "Aufnahme stoppen",
432
+ cancelRecording: "Aufnahme abbrechen",
433
+ requestingMicrophoneAccess: "Mikrofonzugriff wird angefordert...",
434
+ transcribing: "Wird transkribiert..."
435
+ },
436
+ en: {},
437
+ es: {
438
+ close: "Cerrar",
439
+ pending: "pendiente",
440
+ error: "error",
441
+ completed: "completado",
442
+ status: "Estado",
443
+ result: "Resultado",
444
+ errorDetails: "Detalles del error",
445
+ input: "Entrada",
446
+ output: "Salida",
447
+ type: "Tipo",
448
+ generatedFiles: "Archivos generados",
449
+ file: "archivo",
450
+ files: "archivos",
451
+ resource: "Recurso",
452
+ resources: "Recursos",
453
+ datasourceResources: "Recursos de la fuente de datos",
454
+ view: "Ver",
455
+ openingResource: "Abriendo recurso…",
456
+ resourceOpenFailed: "No se pudo abrir el recurso. Inténtalo de nuevo.",
457
+ searching: "Buscando…",
458
+ searchResults: "Resultados de búsqueda",
459
+ searchingForSources: "Buscando fuentes…",
460
+ noSourcesReturned: "No se encontraron fuentes.",
461
+ agent: "Agente",
462
+ agentInvocationResult: "Resultado de la invocación del agente",
463
+ agentId: "ID del agente",
464
+ executionId: "ID de ejecución",
465
+ threadId: "ID de conversación",
466
+ prompt: "Instrucción",
467
+ openConversation: "Abrir conversación",
468
+ workflow: "Flujo de trabajo",
469
+ workflowDispatch: "Ejecución del flujo de trabajo",
470
+ workflowDispatchResult: "Resultado del flujo de trabajo",
471
+ workflowId: "ID del flujo de trabajo",
472
+ mcpTool: "Herramienta MCP",
473
+ mcpToolResult: "Resultado de la herramienta MCP",
474
+ tool: "Herramienta",
475
+ server: "Servidor",
476
+ officeDocuments: "Documentos de Office",
477
+ creatingDocuments: "Creando documentos…",
478
+ noFilesGenerated: "No se generaron archivos.",
479
+ httpRequest: "Solicitud HTTP",
480
+ httpResponse: "Respuesta HTTP",
481
+ requestUrl: "URL de la solicitud",
482
+ responseUrl: "URL de la respuesta",
483
+ contentType: "Tipo de contenido",
484
+ response: "Respuesta",
485
+ responseHeaders: "Encabezados de respuesta",
486
+ externalDatasource: "Fuente de datos externa",
487
+ externalDatasourceResult: "Resultado de la fuente de datos externa",
488
+ sqlQuery: "Consulta SQL",
489
+ queryResults: "Resultados de la consulta",
490
+ noDataToDisplay: "No hay datos que mostrar.",
491
+ property: "Propiedad",
492
+ value: "Valor",
493
+ browser: "Navegador",
494
+ browserResult: "Resultado del navegador",
495
+ expandBrowserResult: "Expandir resultado del navegador",
496
+ collapseBrowserResult: "Contraer resultado del navegador",
497
+ credit: "crédito",
498
+ credits: "créditos",
499
+ email: "Correo electrónico",
500
+ subject: "Asunto",
501
+ to: "Para",
502
+ noRecipientsProvided: "No se indicaron destinatarios.",
503
+ body: "Cuerpo",
504
+ delivery: "Entrega",
505
+ recipients: "Destinatarios",
506
+ provider: "Proveedor",
507
+ messageId: "ID del mensaje",
508
+ rawStatus: "Estado original",
509
+ typeMessage: "Escribe un mensaje...",
510
+ send: "Enviar",
511
+ stop: "Detener",
512
+ attachFile: "Adjuntar archivo",
513
+ removeFile: "Quitar archivo",
514
+ uploading: "Subiendo",
515
+ processingUpload: "Procesando archivo",
516
+ uploadFailed: "Error al subir el archivo",
517
+ thinking: "Pensando…",
518
+ thoughtProcess: "Proceso de razonamiento",
519
+ collapse: "Contraer",
520
+ expand: "Expandir",
521
+ thinkingInProgress: "Pensando",
522
+ thinkingComplete: "Pensamiento completado",
523
+ uploadedImage: "Imagen subida",
524
+ document: "Documento",
525
+ readMore: "Leer más",
526
+ readLess: "Leer menos",
527
+ copy: "Copiar",
528
+ copied: "Copiado",
529
+ retryResponse: "Reintentar respuesta",
530
+ ratePositively: "Valorar positivamente",
531
+ rateNegatively: "Valorar negativamente",
532
+ voiceInput: "Entrada de voz",
533
+ stopRecording: "Detener grabación",
534
+ cancelRecording: "Cancelar grabación",
535
+ requestingMicrophoneAccess: "Solicitando acceso al micrófono...",
536
+ transcribing: "Transcribiendo..."
537
+ },
538
+ fr: {
539
+ close: "Fermer",
540
+ pending: "en attente",
541
+ error: "erreur",
542
+ completed: "terminé",
543
+ status: "Statut",
544
+ result: "Résultat",
545
+ errorDetails: "Détails de l’erreur",
546
+ input: "Entrée",
547
+ output: "Sortie",
548
+ type: "Type",
549
+ generatedFiles: "Fichiers générés",
550
+ file: "fichier",
551
+ files: "fichiers",
552
+ resource: "Ressource",
553
+ resources: "Ressources",
554
+ datasourceResources: "Ressources de la source de données",
555
+ view: "Voir",
556
+ openingResource: "Ouverture de la ressource…",
557
+ resourceOpenFailed: "Impossible d’ouvrir la ressource. Réessayez.",
558
+ searching: "Recherche…",
559
+ searchResults: "Résultats de recherche",
560
+ searchingForSources: "Recherche de sources…",
561
+ noSourcesReturned: "Aucune source trouvée.",
562
+ agent: "Agent",
563
+ agentInvocationResult: "Résultat de l’exécution de l’agent",
564
+ agentId: "ID de l’agent",
565
+ executionId: "ID d’exécution",
566
+ threadId: "ID de la conversation",
567
+ prompt: "Instruction",
568
+ openConversation: "Ouvrir la conversation",
569
+ workflow: "Flux de travail",
570
+ workflowDispatch: "Exécution du flux de travail",
571
+ workflowDispatchResult: "Résultat du flux de travail",
572
+ workflowId: "ID du flux de travail",
573
+ mcpTool: "Outil MCP",
574
+ mcpToolResult: "Résultat de l’outil MCP",
575
+ tool: "Outil",
576
+ server: "Serveur",
577
+ officeDocuments: "Documents Office",
578
+ creatingDocuments: "Création des documents…",
579
+ noFilesGenerated: "Aucun fichier n’a été généré.",
580
+ httpRequest: "Requête HTTP",
581
+ httpResponse: "Réponse HTTP",
582
+ requestUrl: "URL de la requête",
583
+ responseUrl: "URL de la réponse",
584
+ contentType: "Type de contenu",
585
+ response: "Réponse",
586
+ responseHeaders: "En-têtes de réponse",
587
+ externalDatasource: "Source de données externe",
588
+ externalDatasourceResult: "Résultat de la source de données externe",
589
+ sqlQuery: "Requête SQL",
590
+ queryResults: "Résultats de la requête",
591
+ noDataToDisplay: "Aucune donnée à afficher.",
592
+ property: "Propriété",
593
+ value: "Valeur",
594
+ browser: "Navigateur",
595
+ browserResult: "Résultat du navigateur",
596
+ expandBrowserResult: "Développer le résultat du navigateur",
597
+ collapseBrowserResult: "Réduire le résultat du navigateur",
598
+ credit: "crédit",
599
+ credits: "crédits",
600
+ email: "E-mail",
601
+ subject: "Objet",
602
+ to: "À",
603
+ noRecipientsProvided: "Aucun destinataire indiqué.",
604
+ body: "Corps du message",
605
+ delivery: "Envoi",
606
+ recipients: "Destinataires",
607
+ provider: "Fournisseur",
608
+ messageId: "ID du message",
609
+ rawStatus: "Statut brut",
610
+ typeMessage: "Saisissez un message...",
611
+ send: "Envoyer",
612
+ stop: "Arrêter",
613
+ attachFile: "Joindre un fichier",
614
+ removeFile: "Supprimer le fichier",
615
+ uploading: "Téléversement",
616
+ processingUpload: "Traitement du fichier",
617
+ uploadFailed: "Échec du téléversement",
618
+ thinking: "Réflexion…",
619
+ thoughtProcess: "Processus de réflexion",
620
+ collapse: "Réduire",
621
+ expand: "Développer",
622
+ thinkingInProgress: "Réflexion en cours",
623
+ thinkingComplete: "Réflexion terminée",
624
+ uploadedImage: "Image téléversée",
625
+ document: "Document",
626
+ readMore: "Lire la suite",
627
+ readLess: "Lire moins",
628
+ copy: "Copier",
629
+ copied: "Copié",
630
+ retryResponse: "Réessayer la réponse",
631
+ ratePositively: "Évaluer positivement",
632
+ rateNegatively: "Évaluer négativement",
633
+ voiceInput: "Saisie vocale",
634
+ stopRecording: "Arrêter l’enregistrement",
635
+ cancelRecording: "Annuler l’enregistrement",
636
+ requestingMicrophoneAccess: "Demande d’accès au microphone...",
637
+ transcribing: "Transcription en cours..."
638
+ },
639
+ it: {
640
+ close: "Chiudi",
641
+ pending: "in attesa",
642
+ error: "errore",
643
+ completed: "completato",
644
+ status: "Stato",
645
+ result: "Risultato",
646
+ errorDetails: "Dettagli dell’errore",
647
+ input: "Input",
648
+ output: "Output",
649
+ type: "Tipo",
650
+ generatedFiles: "File generati",
651
+ file: "file",
652
+ files: "file",
653
+ resource: "Risorsa",
654
+ resources: "Risorse",
655
+ datasourceResources: "Risorse della fonte dati",
656
+ view: "Visualizza",
657
+ openingResource: "Apertura della risorsa…",
658
+ resourceOpenFailed: "Impossibile aprire la risorsa. Riprova.",
659
+ searching: "Ricerca…",
660
+ searchResults: "Risultati della ricerca",
661
+ searchingForSources: "Ricerca delle fonti…",
662
+ noSourcesReturned: "Nessuna fonte trovata.",
663
+ agent: "Agente",
664
+ agentInvocationResult: "Risultato dell’esecuzione dell’agente",
665
+ agentId: "ID dell’agente",
666
+ executionId: "ID esecuzione",
667
+ threadId: "ID conversazione",
668
+ prompt: "Istruzione",
669
+ openConversation: "Apri conversazione",
670
+ workflow: "Flusso di lavoro",
671
+ workflowDispatch: "Esecuzione del flusso di lavoro",
672
+ workflowDispatchResult: "Risultato del flusso di lavoro",
673
+ workflowId: "ID del flusso di lavoro",
674
+ mcpTool: "Strumento MCP",
675
+ mcpToolResult: "Risultato dello strumento MCP",
676
+ tool: "Strumento",
677
+ server: "Server",
678
+ officeDocuments: "Documenti Office",
679
+ creatingDocuments: "Creazione dei documenti…",
680
+ noFilesGenerated: "Nessun file generato.",
681
+ httpRequest: "Richiesta HTTP",
682
+ httpResponse: "Risposta HTTP",
683
+ requestUrl: "URL della richiesta",
684
+ responseUrl: "URL della risposta",
685
+ contentType: "Tipo di contenuto",
686
+ response: "Risposta",
687
+ responseHeaders: "Intestazioni della risposta",
688
+ externalDatasource: "Fonte dati esterna",
689
+ externalDatasourceResult: "Risultato della fonte dati esterna",
690
+ sqlQuery: "Query SQL",
691
+ queryResults: "Risultati della query",
692
+ noDataToDisplay: "Nessun dato da visualizzare.",
693
+ property: "Proprietà",
694
+ value: "Valore",
695
+ browser: "Browser",
696
+ browserResult: "Risultato del browser",
697
+ expandBrowserResult: "Espandi il risultato del browser",
698
+ collapseBrowserResult: "Comprimi il risultato del browser",
699
+ credit: "credito",
700
+ credits: "crediti",
701
+ email: "Email",
702
+ subject: "Oggetto",
703
+ to: "A",
704
+ noRecipientsProvided: "Nessun destinatario indicato.",
705
+ body: "Corpo",
706
+ delivery: "Invio",
707
+ recipients: "Destinatari",
708
+ provider: "Fornitore",
709
+ messageId: "ID messaggio",
710
+ rawStatus: "Stato originale",
711
+ typeMessage: "Scrivi un messaggio...",
712
+ send: "Invia",
713
+ stop: "Interrompi",
714
+ attachFile: "Allega un file",
715
+ removeFile: "Rimuovi il file",
716
+ uploading: "Caricamento",
717
+ processingUpload: "Elaborazione del file",
718
+ uploadFailed: "Caricamento non riuscito",
719
+ thinking: "Riflessione…",
720
+ thoughtProcess: "Processo di ragionamento",
721
+ collapse: "Comprimi",
722
+ expand: "Espandi",
723
+ thinkingInProgress: "Riflessione in corso",
724
+ thinkingComplete: "Riflessione completata",
725
+ uploadedImage: "Immagine caricata",
726
+ document: "Documento",
727
+ readMore: "Leggi di più",
728
+ readLess: "Leggi meno",
729
+ copy: "Copia",
730
+ copied: "Copiato",
731
+ retryResponse: "Riprova la risposta",
732
+ ratePositively: "Valuta positivamente",
733
+ rateNegatively: "Valuta negativamente",
734
+ voiceInput: "Input vocale",
735
+ stopRecording: "Interrompi la registrazione",
736
+ cancelRecording: "Annulla la registrazione",
737
+ requestingMicrophoneAccess: "Richiesta di accesso al microfono...",
738
+ transcribing: "Trascrizione in corso..."
739
+ },
740
+ no: {
741
+ close: "Lukk",
742
+ pending: "venter",
743
+ error: "feil",
744
+ completed: "fullført",
745
+ status: "Status",
746
+ result: "Resultat",
747
+ errorDetails: "Feildetaljer",
748
+ input: "Inndata",
749
+ output: "Utdata",
750
+ type: "Type",
751
+ generatedFiles: "Genererte filer",
752
+ file: "fil",
753
+ files: "filer",
754
+ resource: "Ressurs",
755
+ resources: "Ressurser",
756
+ datasourceResources: "Datakildens ressurser",
757
+ view: "Vis",
758
+ openingResource: "Åpner ressurs…",
759
+ resourceOpenFailed: "Kunne ikke åpne ressursen. Prøv igjen.",
760
+ searching: "Søker…",
761
+ searchResults: "Søkeresultater",
762
+ searchingForSources: "Søker etter kilder…",
763
+ noSourcesReturned: "Ingen kilder funnet.",
764
+ agent: "Agent",
765
+ agentInvocationResult: "Resultat fra agentkall",
766
+ agentId: "Agent-ID",
767
+ executionId: "Kjørings-ID",
768
+ threadId: "Samtale-ID",
769
+ prompt: "Instruksjon",
770
+ openConversation: "Åpne samtale",
771
+ workflow: "Arbeidsflyt",
772
+ workflowDispatch: "Kjøring av arbeidsflyt",
773
+ workflowDispatchResult: "Resultat fra arbeidsflyten",
774
+ workflowId: "Arbeidsflyt-ID",
775
+ mcpTool: "MCP-verktøy",
776
+ mcpToolResult: "Resultat fra MCP-verktøyet",
777
+ tool: "Verktøy",
778
+ server: "Server",
779
+ officeDocuments: "Office-dokumenter",
780
+ creatingDocuments: "Oppretter dokumenter…",
781
+ noFilesGenerated: "Ingen filer ble generert.",
782
+ httpRequest: "HTTP-forespørsel",
783
+ httpResponse: "HTTP-svar",
784
+ requestUrl: "Forespørsels-URL",
785
+ responseUrl: "Svar-URL",
786
+ contentType: "Innholdstype",
787
+ response: "Svar",
788
+ responseHeaders: "Svarhoder",
789
+ externalDatasource: "Ekstern datakilde",
790
+ externalDatasourceResult: "Resultat fra ekstern datakilde",
791
+ sqlQuery: "SQL-spørring",
792
+ queryResults: "Spørringsresultater",
793
+ noDataToDisplay: "Ingen data å vise.",
794
+ property: "Egenskap",
795
+ value: "Verdi",
796
+ browser: "Nettleser",
797
+ browserResult: "Nettleserresultat",
798
+ expandBrowserResult: "Utvid nettleserresultat",
799
+ collapseBrowserResult: "Skjul nettleserresultat",
800
+ credit: "kreditt",
801
+ credits: "kreditter",
802
+ email: "E-post",
803
+ subject: "Emne",
804
+ to: "Til",
805
+ noRecipientsProvided: "Ingen mottakere oppgitt.",
806
+ body: "Innhold",
807
+ delivery: "Levering",
808
+ recipients: "Mottakere",
809
+ provider: "Leverandør",
810
+ messageId: "Meldings-ID",
811
+ rawStatus: "Opprinnelig status",
812
+ typeMessage: "Skriv en melding...",
813
+ send: "Send",
814
+ stop: "Stopp",
815
+ attachFile: "Legg ved fil",
816
+ removeFile: "Fjern fil",
817
+ uploading: "Laster opp",
818
+ processingUpload: "Behandler fil",
819
+ uploadFailed: "Opplasting mislyktes",
820
+ thinking: "Tenker…",
821
+ thoughtProcess: "Tankeprosess",
822
+ collapse: "Skjul",
823
+ expand: "Utvid",
824
+ thinkingInProgress: "Tenker",
825
+ thinkingComplete: "Tenkingen er ferdig",
826
+ uploadedImage: "Opplastet bilde",
827
+ document: "Dokument",
828
+ readMore: "Les mer",
829
+ readLess: "Les mindre",
830
+ copy: "Kopier",
831
+ copied: "Kopiert",
832
+ retryResponse: "Prøv svaret på nytt",
833
+ ratePositively: "Vurder positivt",
834
+ rateNegatively: "Vurder negativt",
835
+ voiceInput: "Taleinndata",
836
+ stopRecording: "Stopp opptak",
837
+ cancelRecording: "Avbryt opptak",
838
+ requestingMicrophoneAccess: "Ber om tilgang til mikrofonen...",
839
+ transcribing: "Transkriberer..."
840
+ },
841
+ pt: {
842
+ close: "Fechar",
843
+ pending: "pendente",
844
+ error: "erro",
845
+ completed: "concluído",
846
+ status: "Estado",
847
+ result: "Resultado",
848
+ errorDetails: "Detalhes do erro",
849
+ input: "Entrada",
850
+ output: "Saída",
851
+ type: "Tipo",
852
+ generatedFiles: "Ficheiros gerados",
853
+ file: "ficheiro",
854
+ files: "ficheiros",
855
+ resource: "Recurso",
856
+ resources: "Recursos",
857
+ datasourceResources: "Recursos da fonte de dados",
858
+ view: "Ver",
859
+ openingResource: "A abrir o recurso…",
860
+ resourceOpenFailed: "Não foi possível abrir o recurso. Tente novamente.",
861
+ searching: "A pesquisar…",
862
+ searchResults: "Resultados da pesquisa",
863
+ searchingForSources: "A pesquisar fontes…",
864
+ noSourcesReturned: "Não foram encontradas fontes.",
865
+ agent: "Agente",
866
+ agentInvocationResult: "Resultado da execução do agente",
867
+ agentId: "ID do agente",
868
+ executionId: "ID de execução",
869
+ threadId: "ID da conversa",
870
+ prompt: "Instrução",
871
+ openConversation: "Abrir conversa",
872
+ workflow: "Fluxo de trabalho",
873
+ workflowDispatch: "Execução do fluxo de trabalho",
874
+ workflowDispatchResult: "Resultado do fluxo de trabalho",
875
+ workflowId: "ID do fluxo de trabalho",
876
+ mcpTool: "Ferramenta MCP",
877
+ mcpToolResult: "Resultado da ferramenta MCP",
878
+ tool: "Ferramenta",
879
+ server: "Servidor",
880
+ officeDocuments: "Documentos do Office",
881
+ creatingDocuments: "A criar documentos…",
882
+ noFilesGenerated: "Não foram gerados ficheiros.",
883
+ httpRequest: "Pedido HTTP",
884
+ httpResponse: "Resposta HTTP",
885
+ requestUrl: "URL do pedido",
886
+ responseUrl: "URL da resposta",
887
+ contentType: "Tipo de conteúdo",
888
+ response: "Resposta",
889
+ responseHeaders: "Cabeçalhos da resposta",
890
+ externalDatasource: "Fonte de dados externa",
891
+ externalDatasourceResult: "Resultado da fonte de dados externa",
892
+ sqlQuery: "Consulta SQL",
893
+ queryResults: "Resultados da consulta",
894
+ noDataToDisplay: "Não há dados para apresentar.",
895
+ property: "Propriedade",
896
+ value: "Valor",
897
+ browser: "Navegador",
898
+ browserResult: "Resultado do navegador",
899
+ expandBrowserResult: "Expandir resultado do navegador",
900
+ collapseBrowserResult: "Recolher resultado do navegador",
901
+ credit: "crédito",
902
+ credits: "créditos",
903
+ email: "E-mail",
904
+ subject: "Assunto",
905
+ to: "Para",
906
+ noRecipientsProvided: "Não foram indicados destinatários.",
907
+ body: "Corpo",
908
+ delivery: "Entrega",
909
+ recipients: "Destinatários",
910
+ provider: "Fornecedor",
911
+ messageId: "ID da mensagem",
912
+ rawStatus: "Estado original",
913
+ typeMessage: "Escreva uma mensagem...",
914
+ send: "Enviar",
915
+ stop: "Parar",
916
+ attachFile: "Anexar ficheiro",
917
+ removeFile: "Remover ficheiro",
918
+ uploading: "A carregar",
919
+ processingUpload: "A processar o ficheiro",
920
+ uploadFailed: "Falha ao carregar o ficheiro",
921
+ thinking: "A pensar…",
922
+ thoughtProcess: "Processo de raciocínio",
923
+ collapse: "Recolher",
924
+ expand: "Expandir",
925
+ thinkingInProgress: "Raciocínio em curso",
926
+ thinkingComplete: "Raciocínio concluído",
927
+ uploadedImage: "Imagem carregada",
928
+ document: "Documento",
929
+ readMore: "Ler mais",
930
+ readLess: "Ler menos",
931
+ copy: "Copiar",
932
+ copied: "Copiado",
933
+ retryResponse: "Tentar novamente a resposta",
934
+ ratePositively: "Avaliar positivamente",
935
+ rateNegatively: "Avaliar negativamente",
936
+ voiceInput: "Entrada de voz",
937
+ stopRecording: "Parar gravação",
938
+ cancelRecording: "Cancelar gravação",
939
+ requestingMicrophoneAccess: "A pedir acesso ao microfone...",
940
+ transcribing: "A transcrever..."
941
+ },
942
+ sv: {
943
+ close: "Stäng",
944
+ pending: "väntar",
945
+ error: "fel",
946
+ completed: "slutförd",
947
+ status: "Status",
948
+ result: "Resultat",
949
+ errorDetails: "Feldetaljer",
950
+ input: "Indata",
951
+ output: "Utdata",
952
+ type: "Typ",
953
+ generatedFiles: "Genererade filer",
954
+ file: "fil",
955
+ files: "filer",
956
+ resource: "Resurs",
957
+ resources: "Resurser",
958
+ datasourceResources: "Datakällans resurser",
959
+ view: "Visa",
960
+ openingResource: "Öppnar resurs…",
961
+ resourceOpenFailed: "Det gick inte att öppna resursen. Försök igen.",
962
+ searching: "Söker…",
963
+ searchResults: "Sökresultat",
964
+ searchingForSources: "Söker efter källor…",
965
+ noSourcesReturned: "Inga källor hittades.",
966
+ agent: "Agent",
967
+ agentInvocationResult: "Resultat från agentanrop",
968
+ agentId: "Agent-ID",
969
+ executionId: "Körnings-ID",
970
+ threadId: "Konversations-ID",
971
+ prompt: "Instruktion",
972
+ openConversation: "Öppna konversation",
973
+ workflow: "Arbetsflöde",
974
+ workflowDispatch: "Körning av arbetsflöde",
975
+ workflowDispatchResult: "Resultat från arbetsflödet",
976
+ workflowId: "Arbetsflödes-ID",
977
+ mcpTool: "MCP-verktyg",
978
+ mcpToolResult: "Resultat från MCP-verktyget",
979
+ tool: "Verktyg",
980
+ server: "Server",
981
+ officeDocuments: "Office-dokument",
982
+ creatingDocuments: "Skapar dokument…",
983
+ noFilesGenerated: "Inga filer genererades.",
984
+ httpRequest: "HTTP-begäran",
985
+ httpResponse: "HTTP-svar",
986
+ requestUrl: "Begärans URL",
987
+ responseUrl: "Svarets URL",
988
+ contentType: "Innehållstyp",
989
+ response: "Svar",
990
+ responseHeaders: "Svarsrubriker",
991
+ externalDatasource: "Extern datakälla",
992
+ externalDatasourceResult: "Resultat från extern datakälla",
993
+ sqlQuery: "SQL-fråga",
994
+ queryResults: "Frågeresultat",
995
+ noDataToDisplay: "Inga data att visa.",
996
+ property: "Egenskap",
997
+ value: "Värde",
998
+ browser: "Webbläsare",
999
+ browserResult: "Webbläsarresultat",
1000
+ expandBrowserResult: "Expandera webbläsarresultat",
1001
+ collapseBrowserResult: "Dölj webbläsarresultat",
1002
+ credit: "kredit",
1003
+ credits: "krediter",
1004
+ email: "E-post",
1005
+ subject: "Ämne",
1006
+ to: "Till",
1007
+ noRecipientsProvided: "Inga mottagare angavs.",
1008
+ body: "Meddelande",
1009
+ delivery: "Leverans",
1010
+ recipients: "Mottagare",
1011
+ provider: "Leverantör",
1012
+ messageId: "Meddelande-ID",
1013
+ rawStatus: "Ursprunglig status",
1014
+ typeMessage: "Skriv ett meddelande...",
1015
+ send: "Skicka",
1016
+ stop: "Stoppa",
1017
+ attachFile: "Bifoga fil",
1018
+ removeFile: "Ta bort fil",
1019
+ uploading: "Laddar upp",
1020
+ processingUpload: "Behandlar fil",
1021
+ uploadFailed: "Uppladdningen misslyckades",
1022
+ thinking: "Tänker…",
1023
+ thoughtProcess: "Tankeprocess",
1024
+ collapse: "Dölj",
1025
+ expand: "Expandera",
1026
+ thinkingInProgress: "Tänker",
1027
+ thinkingComplete: "Tänkandet klart",
1028
+ uploadedImage: "Uppladdad bild",
1029
+ document: "Dokument",
1030
+ readMore: "Läs mer",
1031
+ readLess: "Läs mindre",
1032
+ copy: "Kopiera",
1033
+ copied: "Kopierat",
1034
+ retryResponse: "Försök med svaret igen",
1035
+ ratePositively: "Betygsätt positivt",
1036
+ rateNegatively: "Betygsätt negativt",
1037
+ voiceInput: "Röstinmatning",
1038
+ stopRecording: "Stoppa inspelning",
1039
+ cancelRecording: "Avbryt inspelning",
1040
+ requestingMicrophoneAccess: "Begär åtkomst till mikrofonen...",
1041
+ transcribing: "Transkriberar..."
1042
+ }
1043
+ };
1044
+ function getUiCopy(locale) {
1045
+ return {
1046
+ ...ENGLISH_COPY,
1047
+ ...TRANSLATIONS[getSupportedToolLocale(locale)]
1048
+ };
1049
+ }
1050
+ function getUiStatusLabel(status, copy) {
1051
+ if (status === "pending") return copy.pending;
1052
+ if (status === "error") return copy.error;
1053
+ if (status === "completed") return copy.completed;
1054
+ return status;
1055
+ }
1056
+
1057
+ //#endregion
6
1058
  //#region src/components/datasource-tool-result-card.tsx
7
1059
  function DatasourceIcon() {
8
1060
  return /* @__PURE__ */ jsxs("svg", {
@@ -37,7 +1089,8 @@ function DatasourceIcon() {
37
1089
  ]
38
1090
  });
39
1091
  }
40
- function DatasourceToolResultCardContent({ title, description, type, icon, resourceCount }) {
1092
+ function DatasourceToolResultCardContent({ title, description, type, icon, resourceCount, locale }) {
1093
+ const copy = getUiCopy(locale);
41
1094
  return /* @__PURE__ */ jsxs(Fragment, { children: [
42
1095
  /* @__PURE__ */ jsxs("header", {
43
1096
  className: "flex items-center gap-3",
@@ -63,7 +1116,7 @@ function DatasourceToolResultCardContent({ title, description, type, icon, resou
63
1116
  children: [
64
1117
  resourceCount,
65
1118
  " ",
66
- resourceCount === 1 ? "Recurso" : "Recursos"
1119
+ resourceCount === 1 ? copy.resource : copy.resources
67
1120
  ]
68
1121
  })
69
1122
  ] });
@@ -84,7 +1137,7 @@ function joinClasses(...classes) {
84
1137
 
85
1138
  //#endregion
86
1139
  //#region src/components/resource-card.tsx
87
- function ResourceCardContent({ icon, type, title, description }) {
1140
+ function ResourceCardContent({ icon, type, title, description, variant = "card" }) {
88
1141
  const heading = type ?? title;
89
1142
  const bodyTitle = type ? title : description;
90
1143
  const bodyDescription = type ? description : void 0;
@@ -106,7 +1159,7 @@ function ResourceCardContent({ icon, type, title, description }) {
106
1159
  })]
107
1160
  }),
108
1161
  bodyTitle ? /* @__PURE__ */ jsx("p", {
109
- className: "mt-2 line-clamp-2 text-sm font-medium leading-5",
1162
+ className: joinClasses("mt-2 text-sm font-medium leading-5", variant === "card" && type ? "truncate" : "line-clamp-2"),
110
1163
  children: bodyTitle
111
1164
  }) : null,
112
1165
  bodyDescription ? /* @__PURE__ */ jsx("p", {
@@ -116,7 +1169,8 @@ function ResourceCardContent({ icon, type, title, description }) {
116
1169
  ] });
117
1170
  }
118
1171
  function ResourceCard(props) {
119
- const { className: customClassName, variant = "card", resourceId, requiresDownloadUrl = false, getResourceDownloadUrl,...contentProps } = props;
1172
+ const { className: customClassName, variant = "card", resourceId, requiresDownloadUrl = false, getResourceDownloadUrl, locale,...contentProps } = props;
1173
+ const copy = getUiCopy(locale);
120
1174
  const [downloadState, setDownloadState] = useState("idle");
121
1175
  const abortControllerRef = useRef(null);
122
1176
  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);
@@ -161,30 +1215,39 @@ function ResourceCard(props) {
161
1215
  disabled: downloadState === "loading",
162
1216
  "aria-busy": downloadState === "loading",
163
1217
  children: [
164
- /* @__PURE__ */ jsx(ResourceCardContent, { ...contentProps }),
1218
+ /* @__PURE__ */ jsx(ResourceCardContent, {
1219
+ ...contentProps,
1220
+ variant
1221
+ }),
165
1222
  downloadState === "loading" ? /* @__PURE__ */ jsx("span", {
166
1223
  className: "mt-2 block text-xs text-neutral-600",
167
1224
  "aria-live": "polite",
168
- children: "Opening resource…"
1225
+ children: copy.openingResource
169
1226
  }) : null,
170
1227
  downloadState === "error" ? /* @__PURE__ */ jsx("span", {
171
1228
  className: "mt-2 block text-xs text-red-700",
172
1229
  role: "alert",
173
- children: "Unable to open resource. Try again."
1230
+ children: copy.resourceOpenFailed
174
1231
  }) : null
175
1232
  ]
176
1233
  });
177
1234
  if (!contentProps.url) return /* @__PURE__ */ jsx("article", {
178
1235
  "aria-label": `${contentProps.title}: ${contentProps.description}`,
179
1236
  className,
180
- children: /* @__PURE__ */ jsx(ResourceCardContent, { ...contentProps })
1237
+ children: /* @__PURE__ */ jsx(ResourceCardContent, {
1238
+ ...contentProps,
1239
+ variant
1240
+ })
181
1241
  });
182
1242
  return /* @__PURE__ */ jsx("a", {
183
1243
  href: contentProps.url,
184
1244
  target: "_blank",
185
1245
  rel: "noreferrer noopener",
186
1246
  className: interactiveClassName,
187
- children: /* @__PURE__ */ jsx(ResourceCardContent, { ...contentProps })
1247
+ children: /* @__PURE__ */ jsx(ResourceCardContent, {
1248
+ ...contentProps,
1249
+ variant
1250
+ })
188
1251
  });
189
1252
  }
190
1253
 
@@ -414,7 +1477,7 @@ function getSideClasses(side) {
414
1477
  if (side === "bottom") return "inset-x-0 bottom-0 max-h-[85vh] w-full border-t";
415
1478
  return "inset-y-0 right-0 h-full w-full max-w-lg border-l";
416
1479
  }
417
- 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) {
1480
+ 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) {
418
1481
  const { open, setOpen, triggerRef, contentId, labelledBy, describedBy } = useSheetContext("SheetContent");
419
1482
  const [present, setPresent] = useState(open);
420
1483
  const dialogRef = useRef(null);
@@ -477,7 +1540,7 @@ const SheetContent = forwardRef(function SheetContent$1({ children, className, s
477
1540
  if (event.currentTarget === event.target && !open) setPresent(false);
478
1541
  },
479
1542
  children: [showCloseButton ? /* @__PURE__ */ jsx(SheetClose, {
480
- "aria-label": closeLabel,
1543
+ "aria-label": closeLabel ?? getUiCopy(locale).close,
481
1544
  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",
482
1545
  children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
483
1546
  }) : null, children]
@@ -538,7 +1601,8 @@ const SheetDescription = forwardRef(function SheetDescription$1({ className, id,
538
1601
 
539
1602
  //#endregion
540
1603
  //#region src/components/datasource-folder-card.tsx
541
- function DatasourceFolderCard({ icon, title, description, type, url, resources, variant = "card" }) {
1604
+ function DatasourceFolderCard({ icon, title, description, type, url, resources, variant = "card", locale }) {
1605
+ const copy = getUiCopy(locale);
542
1606
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
543
1607
  "aria-label": `${type}: ${title}`,
544
1608
  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`,
@@ -547,10 +1611,11 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
547
1611
  title,
548
1612
  description,
549
1613
  type,
550
- resourceCount: resources.length
1614
+ resourceCount: resources.length,
1615
+ locale
551
1616
  })
552
1617
  }), /* @__PURE__ */ jsxs(SheetContent, {
553
- closeLabel: "Cerrar",
1618
+ locale,
554
1619
  children: [/* @__PURE__ */ jsxs(SheetHeader, {
555
1620
  className: "pr-10",
556
1621
  children: [
@@ -574,15 +1639,15 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
574
1639
  target: "_blank",
575
1640
  rel: "noreferrer noopener",
576
1641
  className: "text-xs font-medium text-neutral-700 underline underline-offset-2",
577
- children: "View"
1642
+ children: copy.view
578
1643
  }) : null
579
1644
  ]
580
1645
  }), /* @__PURE__ */ jsxs("section", {
581
1646
  className: "mt-5",
582
- "aria-label": "Recursos",
1647
+ "aria-label": copy.resources,
583
1648
  children: [/* @__PURE__ */ jsx("h3", {
584
1649
  className: "text-xs font-medium leading-4",
585
- children: "Ver"
1650
+ children: copy.view
586
1651
  }), /* @__PURE__ */ jsx("div", {
587
1652
  className: "mt-7 space-y-3",
588
1653
  children: resources.map((resource, index) => /* @__PURE__ */ jsx(ResourceCard, {
@@ -599,7 +1664,7 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
599
1664
  function normalizeLocale(locale) {
600
1665
  return locale?.trim().toLowerCase();
601
1666
  }
602
- function getCurrentLocale$1() {
1667
+ function getCurrentLocale() {
603
1668
  if (typeof document !== "undefined" && document.documentElement.lang) return document.documentElement.lang;
604
1669
  if (typeof navigator !== "undefined") return navigator.language || navigator.userLanguage;
605
1670
  }
@@ -619,7 +1684,7 @@ function getTranslation(translations, locale) {
619
1684
  function getLocalizedOpenGraphValue(container, field, locale) {
620
1685
  const opengraph = container.extra_info?.opengraph;
621
1686
  if (!opengraph) return void 0;
622
- for (const candidate of getLocaleCandidates(locale ?? getCurrentLocale$1())) {
1687
+ for (const candidate of getLocaleCandidates(locale ?? getCurrentLocale())) {
623
1688
  const translated = getTranslation(opengraph.translations, candidate)?.[field];
624
1689
  if (hasStringValue(translated)) return translated.trim();
625
1690
  }
@@ -719,7 +1784,8 @@ function toResourceCardProps(resource, locale, getResourceDownloadUrl) {
719
1784
  url: requiresDownloadUrl ? null : getResourceUrl(resource, locale),
720
1785
  resourceId: resource.id,
721
1786
  getResourceDownloadUrl: requiresDownloadUrl ? getResourceDownloadUrl : void 0,
722
- requiresDownloadUrl
1787
+ requiresDownloadUrl,
1788
+ locale
723
1789
  };
724
1790
  }
725
1791
  function toFolderCardProps(folder, group, locale, getResourceDownloadUrl) {
@@ -731,7 +1797,8 @@ function toFolderCardProps(folder, group, locale, getResourceDownloadUrl) {
731
1797
  description: getLocalizedOpenGraphValue(folder, "description", locale) ?? readString(folder.extra_info, "description") ?? readString(folder.extra_info, "summary") ?? datasource?.description ?? datasource?.summary ?? "",
732
1798
  type,
733
1799
  url: getLocalizedOpenGraphValue(folder, "url", locale),
734
- resources: group.map((resource) => toResourceCardProps(resource, locale, getResourceDownloadUrl))
1800
+ resources: group.map((resource) => toResourceCardProps(resource, locale, getResourceDownloadUrl)),
1801
+ locale
735
1802
  };
736
1803
  }
737
1804
  function isDatasourceResource(value) {
@@ -785,33 +1852,72 @@ function DatasourceResourceCardView({ card, variant = "card" }) {
785
1852
  function DatasourceToolResources({ resources, locale, className, getResourceDownloadUrl }) {
786
1853
  const cards = getDatasourceResourceCards(resources, locale, getResourceDownloadUrl);
787
1854
  return /* @__PURE__ */ jsx("section", {
788
- "aria-label": "Recursos de la fuente de datos",
1855
+ "aria-label": getUiCopy(locale).datasourceResources,
789
1856
  className: joinClasses("flex flex-wrap gap-3", className),
790
1857
  children: cards.map((card) => /* @__PURE__ */ jsx(DatasourceResourceCardView, { card }, card.key))
791
1858
  });
792
1859
  }
793
1860
 
794
1861
  //#endregion
795
- //#region src/components/internal/tool-locale.ts
796
- const SUPPORTED_TOOL_LOCALES = new Set([
797
- "ca",
798
- "da",
799
- "de",
800
- "en",
801
- "es",
802
- "fr",
803
- "it",
804
- "no",
805
- "pt",
806
- "sv"
807
- ]);
808
- function getCurrentLocale() {
809
- return typeof navigator === "undefined" ? "en" : navigator.language;
810
- }
811
- function getSupportedToolLocale(locale) {
812
- const language = (locale ?? getCurrentLocale()).trim().toLowerCase().split(/[-_]/)[0];
813
- const normalizedLanguage = language === "nb" || language === "nn" ? "no" : language;
814
- return SUPPORTED_TOOL_LOCALES.has(normalizedLanguage) ? normalizedLanguage : "en";
1862
+ //#region src/components/internal/source-results-copy.ts
1863
+ const ENGLISH_SOURCE_RESULTS_COPY = {
1864
+ webSearchTitle: "Internet search results",
1865
+ singularSource: "source",
1866
+ pluralSources: "sources"
1867
+ };
1868
+ const SOURCE_RESULTS_COPY = {
1869
+ en: {},
1870
+ es: {
1871
+ webSearchTitle: "Resultados de búsqueda en Internet",
1872
+ singularSource: "fuente",
1873
+ pluralSources: "fuentes"
1874
+ },
1875
+ ca: {
1876
+ webSearchTitle: "Resultats de cerca a Internet",
1877
+ singularSource: "font",
1878
+ pluralSources: "fonts"
1879
+ },
1880
+ fr: {
1881
+ webSearchTitle: "Résultats de recherche sur Internet",
1882
+ singularSource: "source",
1883
+ pluralSources: "sources"
1884
+ },
1885
+ it: {
1886
+ webSearchTitle: "Risultati della ricerca su Internet",
1887
+ singularSource: "fonte",
1888
+ pluralSources: "fonti"
1889
+ },
1890
+ de: {
1891
+ webSearchTitle: "Ergebnisse der Internetsuche",
1892
+ singularSource: "Quelle",
1893
+ pluralSources: "Quellen"
1894
+ },
1895
+ da: {
1896
+ webSearchTitle: "Resultater fra internetsøgning",
1897
+ singularSource: "kilde",
1898
+ pluralSources: "kilder"
1899
+ },
1900
+ sv: {
1901
+ webSearchTitle: "Resultat från internetsökning",
1902
+ singularSource: "källa",
1903
+ pluralSources: "källor"
1904
+ },
1905
+ no: {
1906
+ webSearchTitle: "Resultater fra internettsøk",
1907
+ singularSource: "kilde",
1908
+ pluralSources: "kilder"
1909
+ },
1910
+ pt: {
1911
+ webSearchTitle: "Resultados da pesquisa na Internet",
1912
+ singularSource: "fonte",
1913
+ pluralSources: "fontes"
1914
+ }
1915
+ };
1916
+ function getSourceResultsCopy(locale) {
1917
+ return {
1918
+ ...ENGLISH_SOURCE_RESULTS_COPY,
1919
+ ...SOURCE_RESULTS_COPY[getSupportedToolLocale(locale)]
1920
+ };
815
1921
  }
816
1922
 
817
1923
  //#endregion
@@ -931,12 +2037,15 @@ function WebSearchResultItem({ result }) {
931
2037
  })
932
2038
  });
933
2039
  }
934
- function ToolResultWebSearchCard({ part, className }) {
2040
+ function ToolResultWebSearchCard({ part, locale, className }) {
935
2041
  const searchResults = getWebSearchResults(part);
2042
+ if (part.state === "completed" && searchResults.length === 0) return null;
936
2043
  const errorDetails = formatToolErrorDetails(part.errorDetails);
937
- const sourceLabel = searchResults.length === 1 ? "source" : "sources";
2044
+ const copy = getSourceResultsCopy(locale);
2045
+ const uiCopy = getUiCopy(locale);
2046
+ const sourceLabel = searchResults.length === 1 ? copy.singularSource : copy.pluralSources;
938
2047
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
939
- "aria-label": `Web: Internet search results, ${searchResults.length} ${sourceLabel}`,
2048
+ "aria-label": `Web: ${copy.webSearchTitle}, ${searchResults.length} ${sourceLabel}`,
940
2049
  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),
941
2050
  children: [
942
2051
  /* @__PURE__ */ jsxs("header", {
@@ -951,45 +2060,47 @@ function ToolResultWebSearchCard({ part, className }) {
951
2060
  }),
952
2061
  /* @__PURE__ */ jsx("h3", {
953
2062
  className: "mt-3 line-clamp-2 text-sm font-normal leading-5",
954
- children: "Internet search results"
2063
+ children: copy.webSearchTitle
955
2064
  }),
956
2065
  /* @__PURE__ */ jsx("p", {
957
2066
  className: "mt-2 text-xs leading-4 text-neutral-600",
958
- children: part.state === "pending" ? "Searching…" : `${searchResults.length} ${sourceLabel}`
2067
+ children: part.state === "pending" ? uiCopy.searching : `${searchResults.length} ${sourceLabel}`
959
2068
  })
960
2069
  ]
961
2070
  }), /* @__PURE__ */ jsxs(SheetContent, {
962
- closeLabel: "Close",
2071
+ locale,
963
2072
  children: [/* @__PURE__ */ jsx(SheetHeader, {
964
2073
  className: "pr-10",
965
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "Internet search results" })
2074
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.webSearchTitle })
966
2075
  }), /* @__PURE__ */ jsx(ToolResultWebSearchResults, {
967
2076
  part,
968
2077
  searchResults,
969
2078
  errorDetails,
2079
+ locale,
970
2080
  className: "mt-5"
971
2081
  })]
972
2082
  })] });
973
2083
  }
974
- function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(part), errorDetails = formatToolErrorDetails(part.errorDetails), className }) {
2084
+ function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(part), errorDetails = formatToolErrorDetails(part.errorDetails), locale, className }) {
2085
+ const copy = getUiCopy(locale);
975
2086
  return /* @__PURE__ */ jsxs("section", {
976
2087
  className,
977
- "aria-label": "Search results",
2088
+ "aria-label": copy.searchResults,
978
2089
  children: [searchResults.length > 0 ? /* @__PURE__ */ jsx("div", {
979
2090
  className: "space-y-3",
980
2091
  children: searchResults.map((result, index) => /* @__PURE__ */ jsx(WebSearchResultItem, { result }, `${result.url}-${index}`))
981
2092
  }) : part.state === "pending" ? /* @__PURE__ */ jsx("p", {
982
2093
  className: "text-sm text-neutral-600",
983
- children: "Searching for sources…"
2094
+ children: copy.searchingForSources
984
2095
  }) : /* @__PURE__ */ jsx("p", {
985
2096
  className: "text-sm text-neutral-600",
986
- children: "No sources returned."
2097
+ children: copy.noSourcesReturned
987
2098
  }), errorDetails ? /* @__PURE__ */ jsxs("p", {
988
2099
  className: "mt-4 rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
989
2100
  children: [
990
- /* @__PURE__ */ jsx("span", {
2101
+ /* @__PURE__ */ jsxs("span", {
991
2102
  className: "font-semibold",
992
- children: "Error details:"
2103
+ children: [copy.errorDetails, ":"]
993
2104
  }),
994
2105
  " ",
995
2106
  errorDetails
@@ -1000,18 +2111,6 @@ function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(
1000
2111
 
1001
2112
  //#endregion
1002
2113
  //#region src/components/aggregated-source-results.tsx
1003
- const SOURCE_LABELS = {
1004
- en: ["source", "sources"],
1005
- es: ["fuente", "fuentes"],
1006
- ca: ["font", "fonts"],
1007
- fr: ["source", "sources"],
1008
- it: ["fonte", "fonti"],
1009
- de: ["Quelle", "Quellen"],
1010
- da: ["kilde", "kilder"],
1011
- sv: ["källa", "källor"],
1012
- no: ["kilde", "kilder"],
1013
- pt: ["fonte", "fontes"]
1014
- };
1015
2114
  function isCompletedSourceToolPart(part) {
1016
2115
  return part.type === "tool-call" && part.state === "completed" && (part.toolType === "datasource" || part.toolType === "perplexity" || part.toolType === "firecrawl_search");
1017
2116
  }
@@ -1025,19 +2124,22 @@ function getAggregatedCards(parts, locale, getResourceDownloadUrl) {
1025
2124
  key: `${part.id}-${card.key}`,
1026
2125
  card
1027
2126
  })));
1028
- const webCards = parts.filter((part) => part.toolType === "perplexity" || part.toolType === "firecrawl_search").map((part) => ({
2127
+ const webCards = parts.filter((part) => part.toolType === "perplexity" || part.toolType === "firecrawl_search").filter((part) => getWebSearchResults(part).length > 0).map((part) => ({
1029
2128
  kind: "web",
1030
2129
  key: part.id,
1031
2130
  part
1032
2131
  }));
1033
2132
  return [...datasourceCards, ...webCards];
1034
2133
  }
1035
- function SourceCard({ source, variant = "card" }) {
2134
+ function SourceCard({ source, locale, variant = "card" }) {
1036
2135
  if (source.kind === "datasource") return /* @__PURE__ */ jsx(DatasourceResourceCardView, {
1037
2136
  card: source.card,
1038
2137
  variant
1039
2138
  });
1040
- if (variant === "card") return /* @__PURE__ */ jsx(ToolResultWebSearchCard, { part: source.part });
2139
+ if (variant === "card") return /* @__PURE__ */ jsx(ToolResultWebSearchCard, {
2140
+ part: source.part,
2141
+ locale
2142
+ });
1041
2143
  return /* @__PURE__ */ jsxs("section", {
1042
2144
  className: "rounded-lg bg-neutral-100 p-4",
1043
2145
  children: [/* @__PURE__ */ jsxs("header", {
@@ -1047,9 +2149,12 @@ function SourceCard({ source, variant = "card" }) {
1047
2149
  "aria-hidden": "true"
1048
2150
  }), /* @__PURE__ */ jsx("h3", {
1049
2151
  className: "text-sm font-medium",
1050
- children: "Internet search results"
2152
+ children: getSourceResultsCopy(locale).webSearchTitle
1051
2153
  })]
1052
- }), /* @__PURE__ */ jsx(ToolResultWebSearchResults, { part: source.part })]
2154
+ }), /* @__PURE__ */ jsx(ToolResultWebSearchResults, {
2155
+ part: source.part,
2156
+ locale
2157
+ })]
1053
2158
  });
1054
2159
  }
1055
2160
  function getTotalSourceCount(cards) {
@@ -1062,13 +2167,16 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
1062
2167
  const visibleCards = cards.slice(0, visibleLimit);
1063
2168
  const overflowCount = cards.length - visibleCards.length;
1064
2169
  const totalSourceCount = getTotalSourceCount(cards);
1065
- const [singularSource, pluralSources] = SOURCE_LABELS[getSupportedToolLocale(locale)];
2170
+ const { singularSource, pluralSources } = getSourceResultsCopy(locale);
1066
2171
  const overflowLabel = overflowCount === 1 ? singularSource : pluralSources;
1067
2172
  const totalLabel = totalSourceCount === 1 ? singularSource : pluralSources;
1068
2173
  return /* @__PURE__ */ jsxs("section", {
1069
2174
  "aria-label": pluralSources,
1070
2175
  className: joinClasses("flex flex-wrap gap-3", className),
1071
- children: [visibleCards.map((source) => /* @__PURE__ */ jsx(SourceCard, { source }, source.key)), overflowCount > 0 ? /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
2176
+ children: [visibleCards.map((source) => /* @__PURE__ */ jsx(SourceCard, {
2177
+ source,
2178
+ locale
2179
+ }, source.key)), overflowCount > 0 ? /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
1072
2180
  "aria-label": `+${overflowCount} ${overflowLabel}`,
1073
2181
  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",
1074
2182
  children: [/* @__PURE__ */ jsxs("span", {
@@ -1079,7 +2187,7 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
1079
2187
  children: overflowLabel
1080
2188
  })]
1081
2189
  }), /* @__PURE__ */ jsxs(SheetContent, {
1082
- closeLabel: "Close",
2190
+ locale,
1083
2191
  children: [/* @__PURE__ */ jsx(SheetHeader, {
1084
2192
  className: "pr-10",
1085
2193
  children: /* @__PURE__ */ jsxs(SheetTitle, { children: [
@@ -1091,6 +2199,7 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
1091
2199
  className: "mt-5 space-y-3",
1092
2200
  children: cards.map((source) => /* @__PURE__ */ jsx(SourceCard, {
1093
2201
  source,
2202
+ locale,
1094
2203
  variant: "list"
1095
2204
  }, `sheet-${source.key}`))
1096
2205
  })]
@@ -1099,371 +2208,502 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
1099
2208
  }
1100
2209
 
1101
2210
  //#endregion
1102
- //#region src/components/tool-error.tsx
1103
- const TOOL_ERROR_TRANSLATIONS = {
2211
+ //#region src/components/memory-proposal-card.tsx
2212
+ const COPY = {
1104
2213
  en: {
1105
- summary: "Failed to use tool {{toolName}}",
1106
- input: "Input",
1107
- output: "Output",
1108
- details: "Error details",
1109
- noOutput: "No output available"
2214
+ title: "Memory proposal",
2215
+ user: "Personal memory",
2216
+ project: "Project learning",
2217
+ create: "Create",
2218
+ update: "Update",
2219
+ delete: "Delete",
2220
+ previous: "Previous content",
2221
+ proposed: "Proposed content",
2222
+ accept: "Accept",
2223
+ reject: "Reject",
2224
+ review: "Sent for admin review",
2225
+ unavailable: "This proposal cannot be resolved here",
2226
+ accepted: "Accepted",
2227
+ rejected: "Rejected",
2228
+ expired: "Expired",
2229
+ conflicted: "Could not be applied because the memory changed",
2230
+ conflictError: "The memory changed. The latest status has been loaded.",
2231
+ expiredError: "This proposal is no longer available.",
2232
+ permissionError: "You no longer have permission to resolve this proposal.",
2233
+ genericError: "The proposal could not be resolved."
1110
2234
  },
1111
2235
  es: {
1112
- summary: "Falló al usar la tool {{toolName}}",
1113
- input: "Entrada",
1114
- output: "Salida",
1115
- details: "Detalles del error",
1116
- noOutput: "No hay salida disponible"
2236
+ title: "Propuesta de memoria",
2237
+ user: "Memoria personal",
2238
+ project: "Aprendizaje del proyecto",
2239
+ create: "Crear",
2240
+ update: "Actualizar",
2241
+ delete: "Eliminar",
2242
+ previous: "Contenido anterior",
2243
+ proposed: "Contenido propuesto",
2244
+ accept: "Aceptar",
2245
+ reject: "Rechazar",
2246
+ review: "Enviado para revisión de un administrador",
2247
+ unavailable: "Esta propuesta no se puede resolver aquí",
2248
+ accepted: "Aceptada",
2249
+ rejected: "Rechazada",
2250
+ expired: "Caducada",
2251
+ conflicted: "No se pudo aplicar porque la memoria cambió",
2252
+ conflictError: "La memoria cambió. Se ha cargado el estado más reciente.",
2253
+ expiredError: "Esta propuesta ya no está disponible.",
2254
+ permissionError: "Ya no tienes permiso para resolver esta propuesta.",
2255
+ genericError: "No se pudo resolver la propuesta."
1117
2256
  },
1118
2257
  ca: {
1119
- summary: "No s’ha pogut utilitzar l’eina {{toolName}}",
1120
- input: "Entrada",
1121
- output: "Sortida",
1122
- details: "Detalls de l’error",
1123
- noOutput: "No hi ha cap sortida disponible"
1124
- },
1125
- fr: {
1126
- summary: "Échec de l’utilisation de l’outil {{toolName}}",
1127
- input: "Entrée",
1128
- output: "Sortie",
1129
- details: "Détails de l’erreur",
1130
- noOutput: "Aucune sortie disponible"
1131
- },
1132
- it: {
1133
- summary: "Impossibile utilizzare lo strumento {{toolName}}",
1134
- input: "Input",
1135
- output: "Output",
1136
- details: "Dettagli dell’errore",
1137
- noOutput: "Nessun output disponibile"
1138
- },
1139
- de: {
1140
- summary: "Tool {{toolName}} konnte nicht verwendet werden",
1141
- input: "Eingabe",
1142
- output: "Ausgabe",
1143
- details: "Fehlerdetails",
1144
- noOutput: "Keine Ausgabe verfügbar"
2258
+ title: "Proposta de memòria",
2259
+ user: "Memòria personal",
2260
+ project: "Aprenentatge del projecte",
2261
+ create: "Crear",
2262
+ update: "Actualitzar",
2263
+ delete: "Eliminar",
2264
+ previous: "Contingut anterior",
2265
+ proposed: "Contingut proposat",
2266
+ accept: "Acceptar",
2267
+ reject: "Rebutjar",
2268
+ review: "Enviat per a revisió d'un administrador",
2269
+ unavailable: "Aquesta proposta no es pot resoldre aquí",
2270
+ accepted: "Acceptada",
2271
+ rejected: "Rebutjada",
2272
+ expired: "Caducada",
2273
+ conflicted: "No s'ha pogut aplicar perquè la memòria ha canviat",
2274
+ conflictError: "La memòria ha canviat. S'ha carregat l'estat més recent.",
2275
+ expiredError: "Aquesta proposta ja no està disponible.",
2276
+ permissionError: "Ja no tens permís per resoldre aquesta proposta.",
2277
+ genericError: "No s'ha pogut resoldre la proposta."
1145
2278
  },
1146
2279
  da: {
1147
- summary: "Kunne ikke bruge værktøjet {{toolName}}",
1148
- input: "Input",
1149
- output: "Output",
1150
- details: "Fejldetaljer",
1151
- noOutput: "Intet output tilgængeligt"
1152
- },
1153
- sv: {
1154
- summary: "Det gick inte att använda verktyget {{toolName}}",
1155
- input: "Indata",
1156
- output: "Utdata",
1157
- details: "Feldetaljer",
1158
- noOutput: "Ingen utdata tillgänglig"
2280
+ title: "Hukommelsesforslag",
2281
+ user: "Personlig hukommelse",
2282
+ project: "Projektlæring",
2283
+ create: "Opret",
2284
+ update: "Opdater",
2285
+ delete: "Slet",
2286
+ previous: "Tidligere indhold",
2287
+ proposed: "Foreslået indhold",
2288
+ accept: "Acceptér",
2289
+ reject: "Afvis",
2290
+ review: "Sendt til administratorgennemgang",
2291
+ unavailable: "Forslaget kan ikke behandles her",
2292
+ accepted: "Accepteret",
2293
+ rejected: "Afvist",
2294
+ expired: "Udløbet",
2295
+ conflicted: "Kunne ikke anvendes, fordi hukommelsen blev ændret",
2296
+ conflictError: "Hukommelsen blev ændret. Den seneste status er indlæst.",
2297
+ expiredError: "Forslaget er ikke længere tilgængeligt.",
2298
+ permissionError: "Du har ikke længere tilladelse til at behandle forslaget.",
2299
+ genericError: "Forslaget kunne ikke behandles."
1159
2300
  },
1160
- no: {
1161
- summary: "Kunne ikke bruke verktøyet {{toolName}}",
1162
- input: "Inndata",
1163
- output: "Utdata",
1164
- details: "Feildetaljer",
1165
- noOutput: "Ingen utdata tilgjengelig"
2301
+ de: {
2302
+ title: "Speichervorschlag",
2303
+ user: "Persönliche Erinnerung",
2304
+ project: "Projektwissen",
2305
+ create: "Erstellen",
2306
+ update: "Aktualisieren",
2307
+ delete: "Löschen",
2308
+ previous: "Vorheriger Inhalt",
2309
+ proposed: "Vorgeschlagener Inhalt",
2310
+ accept: "Akzeptieren",
2311
+ reject: "Ablehnen",
2312
+ review: "Zur Administratorprüfung gesendet",
2313
+ unavailable: "Dieser Vorschlag kann hier nicht bearbeitet werden",
2314
+ accepted: "Akzeptiert",
2315
+ rejected: "Abgelehnt",
2316
+ expired: "Abgelaufen",
2317
+ conflicted: "Nicht angewendet, da sich die Erinnerung geändert hat",
2318
+ conflictError: "Die Erinnerung hat sich geändert. Der aktuelle Status wurde geladen.",
2319
+ expiredError: "Dieser Vorschlag ist nicht mehr verfügbar.",
2320
+ permissionError: "Sie dürfen diesen Vorschlag nicht mehr bearbeiten.",
2321
+ genericError: "Der Vorschlag konnte nicht bearbeitet werden."
2322
+ },
2323
+ fr: {
2324
+ title: "Proposition de mémoire",
2325
+ user: "Mémoire personnelle",
2326
+ project: "Apprentissage du projet",
2327
+ create: "Créer",
2328
+ update: "Modifier",
2329
+ delete: "Supprimer",
2330
+ previous: "Contenu précédent",
2331
+ proposed: "Contenu proposé",
2332
+ accept: "Accepter",
2333
+ reject: "Refuser",
2334
+ review: "Envoyé à un administrateur pour examen",
2335
+ unavailable: "Cette proposition ne peut pas être traitée ici",
2336
+ accepted: "Acceptée",
2337
+ rejected: "Refusée",
2338
+ expired: "Expirée",
2339
+ conflicted: "Impossible à appliquer car la mémoire a changé",
2340
+ conflictError: "La mémoire a changé. Le dernier état a été chargé.",
2341
+ expiredError: "Cette proposition n'est plus disponible.",
2342
+ permissionError: "Vous n'avez plus l'autorisation de traiter cette proposition.",
2343
+ genericError: "La proposition n'a pas pu être traitée."
2344
+ },
2345
+ it: {
2346
+ title: "Proposta di memoria",
2347
+ user: "Memoria personale",
2348
+ project: "Apprendimento del progetto",
2349
+ create: "Crea",
2350
+ update: "Aggiorna",
2351
+ delete: "Elimina",
2352
+ previous: "Contenuto precedente",
2353
+ proposed: "Contenuto proposto",
2354
+ accept: "Accetta",
2355
+ reject: "Rifiuta",
2356
+ review: "Inviata alla revisione di un amministratore",
2357
+ unavailable: "Questa proposta non può essere gestita qui",
2358
+ accepted: "Accettata",
2359
+ rejected: "Rifiutata",
2360
+ expired: "Scaduta",
2361
+ conflicted: "Non applicata perché la memoria è cambiata",
2362
+ conflictError: "La memoria è cambiata. È stato caricato lo stato più recente.",
2363
+ expiredError: "Questa proposta non è più disponibile.",
2364
+ permissionError: "Non hai più il permesso di gestire questa proposta.",
2365
+ genericError: "Impossibile gestire la proposta."
2366
+ },
2367
+ no: {
2368
+ title: "Minneforslag",
2369
+ user: "Personlig minne",
2370
+ project: "Prosjektlæring",
2371
+ create: "Opprett",
2372
+ update: "Oppdater",
2373
+ delete: "Slett",
2374
+ previous: "Tidligere innhold",
2375
+ proposed: "Foreslått innhold",
2376
+ accept: "Godta",
2377
+ reject: "Avvis",
2378
+ review: "Sendt til administratorgjennomgang",
2379
+ unavailable: "Forslaget kan ikke behandles her",
2380
+ accepted: "Godtatt",
2381
+ rejected: "Avvist",
2382
+ expired: "Utløpt",
2383
+ conflicted: "Kunne ikke brukes fordi minnet ble endret",
2384
+ conflictError: "Minnet ble endret. Den nyeste statusen er lastet inn.",
2385
+ expiredError: "Forslaget er ikke lenger tilgjengelig.",
2386
+ permissionError: "Du har ikke lenger tillatelse til å behandle forslaget.",
2387
+ genericError: "Forslaget kunne ikke behandles."
1166
2388
  },
1167
2389
  pt: {
1168
- summary: "Falha ao usar a ferramenta {{toolName}}",
1169
- input: "Entrada",
1170
- output: "Saída",
1171
- details: "Detalhes do erro",
1172
- noOutput: "Nenhuma saída disponível"
2390
+ title: "Proposta de memória",
2391
+ user: "Memória pessoal",
2392
+ project: "Aprendizagem do projeto",
2393
+ create: "Criar",
2394
+ update: "Atualizar",
2395
+ delete: "Eliminar",
2396
+ previous: "Conteúdo anterior",
2397
+ proposed: "Conteúdo proposto",
2398
+ accept: "Aceitar",
2399
+ reject: "Rejeitar",
2400
+ review: "Enviado para revisão de um administrador",
2401
+ unavailable: "Esta proposta não pode ser resolvida aqui",
2402
+ accepted: "Aceite",
2403
+ rejected: "Rejeitada",
2404
+ expired: "Expirada",
2405
+ conflicted: "Não aplicada porque a memória foi alterada",
2406
+ conflictError: "A memória foi alterada. O estado mais recente foi carregado.",
2407
+ expiredError: "Esta proposta já não está disponível.",
2408
+ permissionError: "Já não tem permissão para resolver esta proposta.",
2409
+ genericError: "Não foi possível resolver a proposta."
2410
+ },
2411
+ sv: {
2412
+ title: "Minnesförslag",
2413
+ user: "Personligt minne",
2414
+ project: "Projektlärdom",
2415
+ create: "Skapa",
2416
+ update: "Uppdatera",
2417
+ delete: "Ta bort",
2418
+ previous: "Tidigare innehåll",
2419
+ proposed: "Föreslaget innehåll",
2420
+ accept: "Godkänn",
2421
+ reject: "Avvisa",
2422
+ review: "Skickat för administratörsgranskning",
2423
+ unavailable: "Förslaget kan inte hanteras här",
2424
+ accepted: "Godkänt",
2425
+ rejected: "Avvisat",
2426
+ expired: "Utgånget",
2427
+ conflicted: "Kunde inte tillämpas eftersom minnet ändrades",
2428
+ conflictError: "Minnet ändrades. Den senaste statusen har lästs in.",
2429
+ expiredError: "Förslaget är inte längre tillgängligt.",
2430
+ permissionError: "Du har inte längre behörighet att hantera förslaget.",
2431
+ genericError: "Förslaget kunde inte hanteras."
1173
2432
  }
1174
2433
  };
1175
- function formatJson$1(value) {
1176
- return JSON.stringify(value, null, 2) ?? String(value);
1177
- }
1178
- function getToolErrorCopy(part, locale) {
1179
- const copy = TOOL_ERROR_TRANSLATIONS[getSupportedToolLocale(locale)];
1180
- return {
1181
- ...copy,
1182
- summary: copy.summary.replaceAll("{{toolName}}", part.name)
1183
- };
1184
- }
1185
- function ToolError({ part, locale, defaultOpen = false, className,...props }) {
1186
- const [isOpen, setIsOpen] = useState(defaultOpen);
1187
- const contentId = useId();
1188
- const copy = getToolErrorCopy(part, locale);
1189
- const errorDetails = formatToolErrorDetails(part.errorDetails);
1190
- return /* @__PURE__ */ jsxs("section", {
1191
- className: joinClasses("text-sm text-neutral-600", className),
1192
- "data-tool-call-id": part.id,
1193
- "data-tool-call-state": part.state,
1194
- ...props,
1195
- children: [/* @__PURE__ */ jsxs("button", {
1196
- type: "button",
1197
- "aria-controls": contentId,
1198
- "aria-expanded": isOpen,
1199
- className: "inline-flex items-center gap-2 rounded-md py-1 text-left font-medium text-rose-600 transition-colors hover:text-rose-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950",
1200
- onClick: () => setIsOpen((value) => !value),
1201
- children: [
1202
- /* @__PURE__ */ jsx(CircleX, {
1203
- className: "size-4 shrink-0",
1204
- "aria-hidden": "true"
1205
- }),
1206
- /* @__PURE__ */ jsx("span", { children: copy.summary }),
1207
- /* @__PURE__ */ jsx(ChevronDown, {
1208
- className: joinClasses("size-4 shrink-0 transition-transform motion-reduce:transition-none", isOpen ? "rotate-180" : void 0),
1209
- "aria-hidden": "true"
1210
- })
1211
- ]
1212
- }), isOpen ? /* @__PURE__ */ jsxs("div", {
1213
- id: contentId,
1214
- className: "mt-2 space-y-3 border-l-2 border-rose-200 pl-3",
1215
- children: [
1216
- /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
1217
- className: "mb-2 text-xs font-semibold text-neutral-700",
1218
- children: copy.input
1219
- }), /* @__PURE__ */ jsx("pre", {
1220
- className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
1221
- children: formatJson$1(part.input)
1222
- })] }),
1223
- /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
1224
- className: "mb-2 text-xs font-semibold text-neutral-700",
1225
- children: copy.output
1226
- }), /* @__PURE__ */ jsx("pre", {
1227
- className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
1228
- children: part.result === void 0 ? copy.noOutput : formatJson$1(part.result)
1229
- })] }),
1230
- errorDetails ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
1231
- className: "mb-2 text-xs font-semibold text-rose-700",
1232
- children: copy.details
1233
- }), /* @__PURE__ */ jsx("p", {
1234
- className: "whitespace-pre-wrap text-xs leading-5 text-rose-700",
1235
- children: errorDetails
1236
- })] }) : null
1237
- ]
1238
- }) : null]
1239
- });
1240
- }
1241
-
1242
- //#endregion
1243
- //#region src/components/tool-result-email-send-card.tsx
1244
- function formatStatus$1(status) {
1245
- if (status === "pending") return "pending";
1246
- if (status === "error") return "error";
1247
- return "completed";
1248
- }
1249
- function asObject(value) {
1250
- if (!value || typeof value !== "object" || Array.isArray(value)) return null;
1251
- return value;
1252
- }
1253
- function toStringOrNull$1(value) {
1254
- return typeof value === "string" && value.trim().length > 0 ? value : null;
1255
- }
1256
- function toNumberOrNull(value) {
1257
- return typeof value === "number" && Number.isFinite(value) ? value : null;
1258
- }
1259
- function parseEmailSendInput(part) {
1260
- const input = asObject(part.input);
1261
- if (!input) return {
1262
- to: [],
1263
- subject: null,
1264
- text: null
1265
- };
1266
- return {
1267
- to: Array.isArray(input.to) ? input.to.filter((item) => typeof item === "string") : [],
1268
- subject: toStringOrNull$1(input.subject),
1269
- text: toStringOrNull$1(input.text)
1270
- };
1271
- }
1272
- function parseEmailSendResult(part) {
1273
- const initial = {
1274
- status: null,
1275
- recipientsCount: null,
1276
- subject: null,
1277
- receiptProvider: null,
1278
- receiptMessageId: null,
1279
- receiptRawStatus: null,
1280
- raw: null
1281
- };
1282
- if (part.result === void 0 || part.result === null) return initial;
1283
- let resultObject = asObject(part.result);
1284
- let raw = null;
1285
- if (!resultObject && typeof part.result === "string") try {
1286
- resultObject = asObject(JSON.parse(part.result));
1287
- } catch {
1288
- raw = part.result;
2434
+ const REDACTED = "[redacted]";
2435
+ function MemoryProposalCard({ proposal: initial, actions, activeAgentId, locale, className }) {
2436
+ const copy = COPY[getSupportedToolLocale(locale)];
2437
+ const [proposal, setProposal] = useState(initial);
2438
+ const [resolving, setResolving] = useState(false);
2439
+ const [error, setError] = useState(null);
2440
+ useEffect(() => setProposal((current) => mergeProposal(current, initial)), [initial]);
2441
+ async function resolve(accept) {
2442
+ if (resolving) return;
2443
+ setResolving(true);
2444
+ setError(null);
2445
+ try {
2446
+ const next = accept ? await actions.acceptMemoryProposal({ proposalId: proposal.id }) : await actions.rejectMemoryProposal({ proposalId: proposal.id });
2447
+ setProposal((current) => mergeProposal(current, next));
2448
+ } catch (cause) {
2449
+ const status = cause instanceof HttpStatusError ? cause.status : 0;
2450
+ setError(status === 409 ? copy.conflictError : status === 410 ? copy.expiredError : status === 401 || status === 403 ? copy.permissionError : copy.genericError);
2451
+ try {
2452
+ const latest = await actions.getMemoryProposal({ proposalId: proposal.id });
2453
+ setProposal((current) => mergeProposal(current, latest));
2454
+ } catch {}
2455
+ } finally {
2456
+ setResolving(false);
2457
+ }
1289
2458
  }
1290
- if (!resultObject) return {
1291
- ...initial,
1292
- raw
1293
- };
1294
- const receipt = asObject(resultObject.receipt);
1295
- return {
1296
- status: toStringOrNull$1(resultObject.status),
1297
- recipientsCount: toNumberOrNull(resultObject.recipients_count),
1298
- subject: toStringOrNull$1(resultObject.subject),
1299
- receiptProvider: receipt ? toStringOrNull$1(receipt.provider) : null,
1300
- receiptMessageId: receipt ? toStringOrNull$1(receipt.message_id) : null,
1301
- receiptRawStatus: receipt ? toStringOrNull$1(receipt.raw_status) : null,
1302
- raw
1303
- };
1304
- }
1305
- function ToolResultEmailSendCard({ part, className }) {
1306
- const [isExpanded, setIsExpanded] = useState(false);
1307
- const emailInput = parseEmailSendInput(part);
1308
- const emailResult = parseEmailSendResult(part);
1309
- const errorDetails = formatToolErrorDetails(part.errorDetails);
1310
- 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";
2459
+ const canResolve = proposal.status === "PENDING" && proposal.can_resolve === true && proposal.agent_id === activeAgentId;
2460
+ const statusCopy = proposal.status === "ACCEPTED" ? copy.accepted : proposal.status === "REJECTED" ? copy.rejected : proposal.status === "EXPIRED" ? copy.expired : proposal.status === "CONFLICTED" ? copy.conflicted : null;
2461
+ const operation = proposal.operation === "CREATE" ? copy.create : proposal.operation === "UPDATE" ? copy.update : copy.delete;
1311
2462
  return /* @__PURE__ */ jsxs("section", {
1312
- className: joinClasses("space-y-4 rounded-lg border border-slate-200 bg-slate-50 p-3", className),
1313
- "data-tool-call-id": part.id,
1314
- "data-tool-call-state": part.state,
2463
+ className: joinClasses("space-y-3 rounded-lg border border-emerald-200 bg-emerald-50/30 p-4 text-left", className),
2464
+ "data-memory-proposal-id": proposal.id,
1315
2465
  children: [
1316
- /* @__PURE__ */ jsxs("header", {
1317
- className: "flex items-center justify-between gap-2",
1318
- children: [/* @__PURE__ */ jsx("h4", {
1319
- className: "text-sm font-semibold text-slate-900",
1320
- children: "Email"
2466
+ /* @__PURE__ */ jsxs("header", {
2467
+ className: "space-y-2",
2468
+ children: [/* @__PURE__ */ jsxs("h4", {
2469
+ className: "flex items-center gap-2 text-sm font-semibold text-slate-900",
2470
+ children: [/* @__PURE__ */ jsx(Brain, { className: "size-4" }), copy.title]
1321
2471
  }), /* @__PURE__ */ jsxs("div", {
1322
- className: "flex items-center gap-2",
1323
- children: [/* @__PURE__ */ jsx("span", {
1324
- className: joinClasses("rounded-full border px-2 py-0.5 text-xs font-medium", statusClass),
1325
- children: formatStatus$1(part.state)
1326
- }), /* @__PURE__ */ jsx("button", {
1327
- type: "button",
1328
- "aria-expanded": isExpanded,
1329
- "aria-controls": `tool-email-details-${part.id}`,
1330
- 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",
1331
- onClick: () => setIsExpanded((previous) => !previous),
1332
- children: /* @__PURE__ */ jsx("span", {
1333
- className: "inline-block",
1334
- children: isExpanded ? "^" : "v"
2472
+ className: "flex flex-wrap gap-2 text-xs",
2473
+ children: [
2474
+ /* @__PURE__ */ jsx("span", {
2475
+ className: "rounded-full border border-slate-300 bg-white px-2 py-0.5",
2476
+ children: proposal.scope === "USER" ? copy.user : copy.project
2477
+ }),
2478
+ /* @__PURE__ */ jsx("span", {
2479
+ className: "rounded-full bg-slate-100 px-2 py-0.5",
2480
+ children: operation
2481
+ }),
2482
+ /* @__PURE__ */ jsx("span", {
2483
+ className: "rounded-full bg-slate-100 px-2 py-0.5",
2484
+ children: formatCategory(proposal.category)
1335
2485
  })
1336
- })]
2486
+ ]
1337
2487
  })]
1338
2488
  }),
1339
- emailInput.subject ? /* @__PURE__ */ jsxs("div", {
1340
- className: "space-y-1",
1341
- children: [/* @__PURE__ */ jsx("p", {
1342
- className: "text-xs font-semibold text-slate-600",
1343
- children: "Subject"
2489
+ proposal.previous_content && proposal.previous_content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
2490
+ className: "rounded-md bg-slate-100 p-3 text-sm",
2491
+ children: [/* @__PURE__ */ jsx("span", {
2492
+ className: "mb-1 block text-xs font-medium text-slate-500",
2493
+ children: copy.previous
1344
2494
  }), /* @__PURE__ */ jsx("p", {
1345
- className: "text-sm text-slate-900",
1346
- children: emailInput.subject
2495
+ className: "whitespace-pre-wrap break-words",
2496
+ children: proposal.previous_content
1347
2497
  })]
1348
2498
  }) : null,
1349
- /* @__PURE__ */ jsxs("div", {
1350
- className: "space-y-1",
1351
- children: [/* @__PURE__ */ jsx("p", {
1352
- className: "text-xs font-semibold text-slate-600",
1353
- children: "To"
1354
- }), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
1355
- className: "flex flex-wrap gap-2",
1356
- children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
1357
- className: "rounded-full border border-slate-300 bg-slate-100 px-2 py-0.5 text-xs text-slate-700",
1358
- children: recipient
1359
- }, recipient))
1360
- }) : /* @__PURE__ */ jsx("p", {
1361
- className: "text-sm text-slate-500",
1362
- children: "No recipients provided."
2499
+ proposal.content && proposal.content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
2500
+ className: "text-sm",
2501
+ children: [/* @__PURE__ */ jsx("span", {
2502
+ className: "mb-1 block text-xs font-medium text-slate-500",
2503
+ children: copy.proposed
2504
+ }), /* @__PURE__ */ jsx("p", {
2505
+ className: "whitespace-pre-wrap break-words",
2506
+ children: proposal.content
1363
2507
  })]
1364
- }),
1365
- /* @__PURE__ */ jsxs("div", {
1366
- id: `tool-email-details-${part.id}`,
1367
- "data-testid": "email-send-details",
1368
- className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
1369
- children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
1370
- className: "space-y-1",
1371
- children: [/* @__PURE__ */ jsx("p", {
1372
- className: "text-xs font-semibold text-slate-600",
1373
- children: "Body"
1374
- }), /* @__PURE__ */ jsx("p", {
1375
- className: "whitespace-pre-wrap rounded border border-slate-200 bg-slate-50 p-2 text-sm text-slate-700",
1376
- children: emailInput.text
1377
- })]
1378
- }) : null, part.result !== void 0 ? /* @__PURE__ */ jsxs("div", {
1379
- className: "space-y-2 rounded border border-slate-200 bg-white p-3",
1380
- children: [
1381
- /* @__PURE__ */ jsx("p", {
1382
- className: "text-xs font-semibold uppercase tracking-wide text-slate-500",
1383
- children: "Delivery"
1384
- }),
1385
- emailResult.status ? /* @__PURE__ */ jsxs("p", {
1386
- className: "text-sm text-slate-700",
1387
- children: [
1388
- /* @__PURE__ */ jsx("span", {
1389
- className: "font-semibold text-slate-900",
1390
- children: "Status:"
1391
- }),
1392
- " ",
1393
- emailResult.status
1394
- ]
1395
- }) : null,
1396
- emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
1397
- className: "text-sm text-slate-700",
1398
- children: [
1399
- /* @__PURE__ */ jsx("span", {
1400
- className: "font-semibold text-slate-900",
1401
- children: "Recipients:"
1402
- }),
1403
- " ",
1404
- emailResult.recipientsCount
1405
- ]
1406
- }) : null,
1407
- emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
1408
- className: "text-sm text-slate-700",
1409
- children: [
1410
- /* @__PURE__ */ jsx("span", {
1411
- className: "font-semibold text-slate-900",
1412
- children: "Provider:"
1413
- }),
1414
- " ",
1415
- emailResult.receiptProvider
1416
- ]
1417
- }) : null,
1418
- emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
1419
- className: "break-all text-sm text-slate-700",
1420
- children: [
1421
- /* @__PURE__ */ jsx("span", {
1422
- className: "font-semibold text-slate-900",
1423
- children: "Message ID:"
1424
- }),
1425
- " ",
1426
- emailResult.receiptMessageId
1427
- ]
1428
- }) : null,
1429
- emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
1430
- className: "text-sm text-slate-700",
1431
- children: [
1432
- /* @__PURE__ */ jsx("span", {
1433
- className: "font-semibold text-slate-900",
1434
- children: "Raw status:"
1435
- }),
1436
- " ",
1437
- emailResult.receiptRawStatus
1438
- ]
1439
- }) : null,
1440
- emailResult.raw ? /* @__PURE__ */ jsx("p", {
1441
- className: "whitespace-pre-wrap text-sm text-slate-700",
1442
- children: emailResult.raw
1443
- }) : null
1444
- ]
1445
- }) : null]
1446
- }),
1447
- errorDetails ? /* @__PURE__ */ jsxs("p", {
1448
- className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
1449
- children: [
1450
- /* @__PURE__ */ jsx("span", {
1451
- className: "font-semibold",
1452
- children: "Error details:"
1453
- }),
1454
- " ",
1455
- errorDetails
1456
- ]
2508
+ }) : null,
2509
+ canResolve ? /* @__PURE__ */ jsxs("div", {
2510
+ className: "flex gap-2",
2511
+ children: [/* @__PURE__ */ jsxs("button", {
2512
+ type: "button",
2513
+ disabled: resolving,
2514
+ onClick: () => void resolve(true),
2515
+ className: "inline-flex items-center rounded-md bg-slate-900 px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50",
2516
+ children: [resolving ? /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 size-3 animate-spin" }) : null, copy.accept]
2517
+ }), /* @__PURE__ */ jsx("button", {
2518
+ type: "button",
2519
+ disabled: resolving,
2520
+ onClick: () => void resolve(false),
2521
+ className: "rounded-md border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium disabled:opacity-50",
2522
+ children: copy.reject
2523
+ })]
2524
+ }) : null,
2525
+ proposal.status === "PENDING" && !canResolve ? /* @__PURE__ */ jsx("p", {
2526
+ className: "text-xs font-medium text-slate-500",
2527
+ children: proposal.scope === "PROJECT" ? copy.review : copy.unavailable
2528
+ }) : null,
2529
+ proposal.status === "ACCEPTED" && statusCopy ? /* @__PURE__ */ jsxs("span", {
2530
+ 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",
2531
+ children: [statusCopy, /* @__PURE__ */ jsx(Check, {
2532
+ className: "size-3.5 stroke-[2.5] text-emerald-600",
2533
+ "aria-hidden": "true"
2534
+ })]
2535
+ }) : null,
2536
+ statusCopy && proposal.status !== "ACCEPTED" ? /* @__PURE__ */ jsx("p", {
2537
+ className: "text-xs font-medium text-slate-500",
2538
+ children: statusCopy
2539
+ }) : null,
2540
+ error ? /* @__PURE__ */ jsx("p", {
2541
+ className: "text-xs text-red-600",
2542
+ children: error
1457
2543
  }) : null
1458
2544
  ]
1459
2545
  });
1460
2546
  }
2547
+ function mergeProposal(current, incoming) {
2548
+ if (current.id !== incoming.id) return incoming;
2549
+ return {
2550
+ ...incoming,
2551
+ content: incoming.content === REDACTED ? current.content : incoming.content,
2552
+ previous_content: incoming.previous_content === REDACTED ? current.previous_content : incoming.previous_content,
2553
+ rationale: incoming.rationale === REDACTED ? current.rationale : incoming.rationale
2554
+ };
2555
+ }
2556
+ function formatCategory(category) {
2557
+ const value = category.replaceAll("_", " ").toLowerCase();
2558
+ return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
2559
+ }
2560
+
2561
+ //#endregion
2562
+ //#region src/components/tool-error.tsx
2563
+ const TOOL_ERROR_TRANSLATIONS = {
2564
+ en: {
2565
+ summary: "Failed to use tool {{toolName}}",
2566
+ input: "Input",
2567
+ output: "Output",
2568
+ details: "Error details",
2569
+ noOutput: "No output available"
2570
+ },
2571
+ es: {
2572
+ summary: "Falló al usar la tool {{toolName}}",
2573
+ input: "Entrada",
2574
+ output: "Salida",
2575
+ details: "Detalles del error",
2576
+ noOutput: "No hay salida disponible"
2577
+ },
2578
+ ca: {
2579
+ summary: "No s’ha pogut utilitzar l’eina {{toolName}}",
2580
+ input: "Entrada",
2581
+ output: "Sortida",
2582
+ details: "Detalls de l’error",
2583
+ noOutput: "No hi ha cap sortida disponible"
2584
+ },
2585
+ fr: {
2586
+ summary: "Échec de l’utilisation de l’outil {{toolName}}",
2587
+ input: "Entrée",
2588
+ output: "Sortie",
2589
+ details: "Détails de l’erreur",
2590
+ noOutput: "Aucune sortie disponible"
2591
+ },
2592
+ it: {
2593
+ summary: "Impossibile utilizzare lo strumento {{toolName}}",
2594
+ input: "Input",
2595
+ output: "Output",
2596
+ details: "Dettagli dell’errore",
2597
+ noOutput: "Nessun output disponibile"
2598
+ },
2599
+ de: {
2600
+ summary: "Tool {{toolName}} konnte nicht verwendet werden",
2601
+ input: "Eingabe",
2602
+ output: "Ausgabe",
2603
+ details: "Fehlerdetails",
2604
+ noOutput: "Keine Ausgabe verfügbar"
2605
+ },
2606
+ da: {
2607
+ summary: "Kunne ikke bruge værktøjet {{toolName}}",
2608
+ input: "Input",
2609
+ output: "Output",
2610
+ details: "Fejldetaljer",
2611
+ noOutput: "Intet output tilgængeligt"
2612
+ },
2613
+ sv: {
2614
+ summary: "Det gick inte att använda verktyget {{toolName}}",
2615
+ input: "Indata",
2616
+ output: "Utdata",
2617
+ details: "Feldetaljer",
2618
+ noOutput: "Ingen utdata tillgänglig"
2619
+ },
2620
+ no: {
2621
+ summary: "Kunne ikke bruke verktøyet {{toolName}}",
2622
+ input: "Inndata",
2623
+ output: "Utdata",
2624
+ details: "Feildetaljer",
2625
+ noOutput: "Ingen utdata tilgjengelig"
2626
+ },
2627
+ pt: {
2628
+ summary: "Falha ao usar a ferramenta {{toolName}}",
2629
+ input: "Entrada",
2630
+ output: "Saída",
2631
+ details: "Detalhes do erro",
2632
+ noOutput: "Nenhuma saída disponível"
2633
+ }
2634
+ };
2635
+ function formatJson$1(value) {
2636
+ return JSON.stringify(value, null, 2) ?? String(value);
2637
+ }
2638
+ function getToolErrorCopy(part, locale) {
2639
+ const copy = TOOL_ERROR_TRANSLATIONS[getSupportedToolLocale(locale)];
2640
+ return {
2641
+ ...copy,
2642
+ summary: copy.summary.replaceAll("{{toolName}}", part.name)
2643
+ };
2644
+ }
2645
+ function ToolError({ part, locale, defaultOpen = false, className,...props }) {
2646
+ const [isOpen, setIsOpen] = useState(defaultOpen);
2647
+ const contentId = useId();
2648
+ const copy = getToolErrorCopy(part, locale);
2649
+ const errorDetails = formatToolErrorDetails(part.errorDetails);
2650
+ return /* @__PURE__ */ jsxs("section", {
2651
+ className: joinClasses("text-sm text-neutral-600", className),
2652
+ "data-tool-call-id": part.id,
2653
+ "data-tool-call-state": part.state,
2654
+ ...props,
2655
+ children: [/* @__PURE__ */ jsxs("button", {
2656
+ type: "button",
2657
+ "aria-controls": contentId,
2658
+ "aria-expanded": isOpen,
2659
+ className: "inline-flex items-center gap-2 rounded-md py-1 text-left font-medium text-rose-600 transition-colors hover:text-rose-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950",
2660
+ onClick: () => setIsOpen((value) => !value),
2661
+ children: [
2662
+ /* @__PURE__ */ jsx(CircleX, {
2663
+ className: "size-4 shrink-0",
2664
+ "aria-hidden": "true"
2665
+ }),
2666
+ /* @__PURE__ */ jsx("span", { children: copy.summary }),
2667
+ /* @__PURE__ */ jsx(ChevronDown, {
2668
+ className: joinClasses("size-4 shrink-0 transition-transform motion-reduce:transition-none", isOpen ? "rotate-180" : void 0),
2669
+ "aria-hidden": "true"
2670
+ })
2671
+ ]
2672
+ }), isOpen ? /* @__PURE__ */ jsxs("div", {
2673
+ id: contentId,
2674
+ className: "mt-2 space-y-3 border-l-2 border-rose-200 pl-3",
2675
+ children: [
2676
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
2677
+ className: "mb-2 text-xs font-semibold text-neutral-700",
2678
+ children: copy.input
2679
+ }), /* @__PURE__ */ jsx("pre", {
2680
+ className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
2681
+ children: formatJson$1(part.input)
2682
+ })] }),
2683
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
2684
+ className: "mb-2 text-xs font-semibold text-neutral-700",
2685
+ children: copy.output
2686
+ }), /* @__PURE__ */ jsx("pre", {
2687
+ className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
2688
+ children: part.result === void 0 ? copy.noOutput : formatJson$1(part.result)
2689
+ })] }),
2690
+ errorDetails ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
2691
+ className: "mb-2 text-xs font-semibold text-rose-700",
2692
+ children: copy.details
2693
+ }), /* @__PURE__ */ jsx("p", {
2694
+ className: "whitespace-pre-wrap text-xs leading-5 text-rose-700",
2695
+ children: errorDetails
2696
+ })] }) : null
2697
+ ]
2698
+ }) : null]
2699
+ });
2700
+ }
1461
2701
 
1462
2702
  //#endregion
1463
2703
  //#region src/components/tool-result-agent-invocation-card.tsx
1464
- function formatAgentName(part) {
2704
+ function formatAgentName(part, fallback) {
1465
2705
  if (part.metadata?.agent_name) return part.metadata.agent_name;
1466
- return part.name.replace(/^invoke_/, "").replace(/[_-]+/g, " ").trim() || "Agent";
2706
+ return part.name.replace(/^invoke_/, "").replace(/[_-]+/g, " ").trim() || fallback;
1467
2707
  }
1468
2708
  function formatOutput(value) {
1469
2709
  if (typeof value === "string") return value;
@@ -1479,9 +2719,10 @@ function getPrompt(value) {
1479
2719
  const prompt = value.input;
1480
2720
  return typeof prompt === "string" && prompt.trim() ? prompt : null;
1481
2721
  }
1482
- function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
2722
+ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }) {
2723
+ const copy = getUiCopy(locale);
1483
2724
  const metadata = part.metadata;
1484
- const agentName = formatAgentName(part);
2725
+ const agentName = formatAgentName(part, copy.agent);
1485
2726
  const output$1 = formatOutput(part.result);
1486
2727
  const prompt = getPrompt(part.input);
1487
2728
  const error = formatToolErrorDetails(part.errorDetails);
@@ -1489,7 +2730,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1489
2730
  const failed = part.state === "error";
1490
2731
  const pending = part.state === "pending";
1491
2732
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
1492
- "aria-label": `Agent: ${agentName}`,
2733
+ "aria-label": `${copy.agent}: ${agentName}`,
1493
2734
  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),
1494
2735
  children: /* @__PURE__ */ jsxs("span", {
1495
2736
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -1500,7 +2741,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1500
2741
  }),
1501
2742
  /* @__PURE__ */ jsx("span", {
1502
2743
  className: "shrink-0 font-medium",
1503
- children: "Agent"
2744
+ children: copy.agent
1504
2745
  }),
1505
2746
  /* @__PURE__ */ jsx("span", {
1506
2747
  className: "min-w-0 truncate text-neutral-600",
@@ -1510,7 +2751,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1510
2751
  className: "ml-auto shrink-0",
1511
2752
  children: pending ? /* @__PURE__ */ jsx(LoaderCircle, {
1512
2753
  className: "h-4 w-4 animate-spin text-amber-600",
1513
- "aria-label": "Pending"
2754
+ "aria-label": copy.pending
1514
2755
  }) : failed ? /* @__PURE__ */ jsx(XCircle, {
1515
2756
  className: "h-4 w-4 text-rose-600",
1516
2757
  "aria-hidden": "true"
@@ -1522,38 +2763,38 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1522
2763
  ]
1523
2764
  })
1524
2765
  }), /* @__PURE__ */ jsxs(SheetContent, {
1525
- closeLabel: "Close",
2766
+ locale,
1526
2767
  children: [/* @__PURE__ */ jsx(SheetHeader, {
1527
2768
  className: "pr-10",
1528
2769
  children: /* @__PURE__ */ jsx(SheetTitle, { children: agentName })
1529
2770
  }), /* @__PURE__ */ jsxs("section", {
1530
2771
  className: "mt-6 space-y-4",
1531
- "aria-label": "Agent invocation result",
2772
+ "aria-label": copy.agentInvocationResult,
1532
2773
  children: [
1533
2774
  /* @__PURE__ */ jsxs("dl", {
1534
2775
  className: "grid gap-2 text-sm",
1535
2776
  children: [
1536
2777
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1537
2778
  className: "text-xs text-neutral-500",
1538
- children: "Status"
1539
- }), /* @__PURE__ */ jsx("dd", { children: part.state })] }),
2779
+ children: copy.status
2780
+ }), /* @__PURE__ */ jsx("dd", { children: getUiStatusLabel(part.state, copy) })] }),
1540
2781
  metadata?.agent_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1541
2782
  className: "text-xs text-neutral-500",
1542
- children: "Agent ID"
2783
+ children: copy.agentId
1543
2784
  }), /* @__PURE__ */ jsx("dd", {
1544
2785
  className: "break-all",
1545
2786
  children: metadata.agent_id
1546
2787
  })] }) : null,
1547
2788
  metadata?.tracked_execution_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1548
2789
  className: "text-xs text-neutral-500",
1549
- children: "Execution ID"
2790
+ children: copy.executionId
1550
2791
  }), /* @__PURE__ */ jsx("dd", {
1551
2792
  className: "break-all",
1552
2793
  children: metadata.tracked_execution_id
1553
2794
  })] }) : null,
1554
2795
  threadId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1555
2796
  className: "text-xs text-neutral-500",
1556
- children: "Thread ID"
2797
+ children: copy.threadId
1557
2798
  }), /* @__PURE__ */ jsx("dd", {
1558
2799
  className: "break-all",
1559
2800
  children: threadId
@@ -1562,14 +2803,14 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1562
2803
  }),
1563
2804
  prompt ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
1564
2805
  className: "mb-2 text-sm font-medium",
1565
- children: "Prompt"
2806
+ children: copy.prompt
1566
2807
  }), /* @__PURE__ */ jsx("p", {
1567
2808
  className: "whitespace-pre-wrap rounded-md border border-neutral-200 bg-neutral-50 p-3 text-sm leading-6",
1568
2809
  children: prompt
1569
2810
  })] }) : null,
1570
2811
  output$1 ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
1571
2812
  className: "mb-2 text-sm font-medium",
1572
- children: "Result"
2813
+ children: copy.result
1573
2814
  }), /* @__PURE__ */ jsx("pre", {
1574
2815
  className: "overflow-x-auto whitespace-pre-wrap rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
1575
2816
  children: output$1
@@ -1581,14 +2822,14 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
1581
2822
  children: [/* @__PURE__ */ jsx(MessageSquare, {
1582
2823
  className: "h-4 w-4",
1583
2824
  "aria-hidden": "true"
1584
- }), "Open conversation"]
2825
+ }), copy.openConversation]
1585
2826
  }) : null,
1586
2827
  error ? /* @__PURE__ */ jsxs("p", {
1587
2828
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
1588
2829
  children: [
1589
- /* @__PURE__ */ jsx("span", {
2830
+ /* @__PURE__ */ jsxs("span", {
1590
2831
  className: "font-semibold",
1591
- children: "Error details:"
2832
+ children: [copy.errorDetails, ":"]
1592
2833
  }),
1593
2834
  " ",
1594
2835
  error
@@ -1624,7 +2865,8 @@ function getPreview(output$1) {
1624
2865
  if (!output$1) return null;
1625
2866
  return output$1.length > 200 ? `${output$1.slice(0, 200)}…` : output$1;
1626
2867
  }
1627
- function ToolResultBrowserCard({ part, className }) {
2868
+ function ToolResultBrowserCard({ part, className, locale }) {
2869
+ const copy = getUiCopy(locale);
1628
2870
  const [expanded, setExpanded] = useState(false);
1629
2871
  const metadata = part.metadata;
1630
2872
  const preview = getPreview(toOutput(part.result));
@@ -1632,13 +2874,13 @@ function ToolResultBrowserCard({ part, className }) {
1632
2874
  const error = formatToolErrorDetails(part.errorDetails);
1633
2875
  const scraperLabel = metadata?.scraper_type ? SCRAPER_LABELS[metadata.scraper_type] : null;
1634
2876
  const credits = metadata?.scraper_api_tokens ?? metadata?.firecrawl_credits;
1635
- const subtitle = [scraperLabel, typeof credits === "number" ? `${credits} credit${credits === 1 ? "" : "s"}` : null].filter(Boolean).join(" · ");
2877
+ const subtitle = [scraperLabel, typeof credits === "number" ? `${credits} ${credits === 1 ? copy.credit : copy.credits}` : null].filter(Boolean).join(" · ");
1636
2878
  const failed = part.state === "error";
1637
2879
  const pending = part.state === "pending";
1638
2880
  const canExpand = Boolean(preview || error || url);
1639
2881
  return /* @__PURE__ */ jsxs("section", {
1640
2882
  className: joinClasses("overflow-hidden rounded-lg border border-neutral-200 bg-white", className),
1641
- "aria-label": "Browser result",
2883
+ "aria-label": copy.browserResult,
1642
2884
  children: [/* @__PURE__ */ jsxs("div", {
1643
2885
  className: "flex items-center gap-2 px-3 py-2 text-sm",
1644
2886
  children: [
@@ -1648,7 +2890,7 @@ function ToolResultBrowserCard({ part, className }) {
1648
2890
  }),
1649
2891
  /* @__PURE__ */ jsx("span", {
1650
2892
  className: "font-medium text-neutral-800",
1651
- children: "Browser"
2893
+ children: copy.browser
1652
2894
  }),
1653
2895
  subtitle ? /* @__PURE__ */ jsx("span", {
1654
2896
  className: "min-w-0 truncate text-xs text-neutral-500",
@@ -1658,7 +2900,7 @@ function ToolResultBrowserCard({ part, className }) {
1658
2900
  className: "ml-auto flex shrink-0 items-center gap-2",
1659
2901
  children: [pending ? /* @__PURE__ */ jsx(LoaderCircle, {
1660
2902
  className: "h-4 w-4 animate-spin text-amber-600",
1661
- "aria-label": "Pending"
2903
+ "aria-label": copy.pending
1662
2904
  }) : failed ? /* @__PURE__ */ jsx(XCircle, {
1663
2905
  className: "h-4 w-4 text-rose-600",
1664
2906
  "aria-hidden": "true"
@@ -1667,7 +2909,7 @@ function ToolResultBrowserCard({ part, className }) {
1667
2909
  "aria-hidden": "true"
1668
2910
  }), canExpand ? /* @__PURE__ */ jsx("button", {
1669
2911
  type: "button",
1670
- "aria-label": expanded ? "Collapse browser result" : "Expand browser result",
2912
+ "aria-label": expanded ? copy.collapseBrowserResult : copy.expandBrowserResult,
1671
2913
  "aria-expanded": expanded,
1672
2914
  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",
1673
2915
  onClick: () => setExpanded((value) => !value),
@@ -1698,16 +2940,233 @@ function ToolResultBrowserCard({ part, className }) {
1698
2940
  error ? /* @__PURE__ */ jsxs("p", {
1699
2941
  className: "text-xs text-rose-700",
1700
2942
  children: [
1701
- /* @__PURE__ */ jsx("span", {
2943
+ /* @__PURE__ */ jsxs("span", {
1702
2944
  className: "font-semibold",
1703
- children: "Error details:"
2945
+ children: [copy.errorDetails, ":"]
1704
2946
  }),
1705
2947
  " ",
1706
2948
  error
1707
2949
  ]
1708
- }) : null
1709
- ]
1710
- }) : null]
2950
+ }) : null
2951
+ ]
2952
+ }) : null]
2953
+ });
2954
+ }
2955
+
2956
+ //#endregion
2957
+ //#region src/components/tool-result-email-send-card.tsx
2958
+ function asObject(value) {
2959
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
2960
+ return value;
2961
+ }
2962
+ function toStringOrNull$1(value) {
2963
+ return typeof value === "string" && value.trim().length > 0 ? value : null;
2964
+ }
2965
+ function toNumberOrNull(value) {
2966
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
2967
+ }
2968
+ function parseEmailSendInput(part) {
2969
+ const input = asObject(part.input);
2970
+ if (!input) return {
2971
+ to: [],
2972
+ subject: null,
2973
+ text: null
2974
+ };
2975
+ return {
2976
+ to: Array.isArray(input.to) ? input.to.filter((item) => typeof item === "string") : [],
2977
+ subject: toStringOrNull$1(input.subject),
2978
+ text: toStringOrNull$1(input.text)
2979
+ };
2980
+ }
2981
+ function parseEmailSendResult(part) {
2982
+ const initial = {
2983
+ status: null,
2984
+ recipientsCount: null,
2985
+ subject: null,
2986
+ receiptProvider: null,
2987
+ receiptMessageId: null,
2988
+ receiptRawStatus: null,
2989
+ raw: null
2990
+ };
2991
+ if (part.result === void 0 || part.result === null) return initial;
2992
+ let resultObject = asObject(part.result);
2993
+ let raw = null;
2994
+ if (!resultObject && typeof part.result === "string") try {
2995
+ resultObject = asObject(JSON.parse(part.result));
2996
+ } catch {
2997
+ raw = part.result;
2998
+ }
2999
+ if (!resultObject) return {
3000
+ ...initial,
3001
+ raw
3002
+ };
3003
+ const receipt = asObject(resultObject.receipt);
3004
+ return {
3005
+ status: toStringOrNull$1(resultObject.status),
3006
+ recipientsCount: toNumberOrNull(resultObject.recipients_count),
3007
+ subject: toStringOrNull$1(resultObject.subject),
3008
+ receiptProvider: receipt ? toStringOrNull$1(receipt.provider) : null,
3009
+ receiptMessageId: receipt ? toStringOrNull$1(receipt.message_id) : null,
3010
+ receiptRawStatus: receipt ? toStringOrNull$1(receipt.raw_status) : null,
3011
+ raw
3012
+ };
3013
+ }
3014
+ function ToolResultEmailSendCard({ part, className, locale }) {
3015
+ const copy = getUiCopy(locale);
3016
+ const [isExpanded, setIsExpanded] = useState(false);
3017
+ const emailInput = parseEmailSendInput(part);
3018
+ const emailResult = parseEmailSendResult(part);
3019
+ const errorDetails = formatToolErrorDetails(part.errorDetails);
3020
+ 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";
3021
+ return /* @__PURE__ */ jsxs("section", {
3022
+ className: joinClasses("space-y-4 rounded-lg border border-slate-200 bg-slate-50 p-3", className),
3023
+ "data-tool-call-id": part.id,
3024
+ "data-tool-call-state": part.state,
3025
+ children: [
3026
+ /* @__PURE__ */ jsxs("header", {
3027
+ className: "flex items-center justify-between gap-2",
3028
+ children: [/* @__PURE__ */ jsx("h4", {
3029
+ className: "text-sm font-semibold text-slate-900",
3030
+ children: copy.email
3031
+ }), /* @__PURE__ */ jsxs("div", {
3032
+ className: "flex items-center gap-2",
3033
+ children: [/* @__PURE__ */ jsx("span", {
3034
+ className: joinClasses("rounded-full border px-2 py-0.5 text-xs font-medium", statusClass),
3035
+ children: getUiStatusLabel(part.state, copy)
3036
+ }), /* @__PURE__ */ jsx("button", {
3037
+ type: "button",
3038
+ "aria-expanded": isExpanded,
3039
+ "aria-label": isExpanded ? copy.collapse : copy.expand,
3040
+ "aria-controls": `tool-email-details-${part.id}`,
3041
+ 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",
3042
+ onClick: () => setIsExpanded((previous) => !previous),
3043
+ children: /* @__PURE__ */ jsx("span", {
3044
+ className: "inline-block",
3045
+ children: isExpanded ? "^" : "v"
3046
+ })
3047
+ })]
3048
+ })]
3049
+ }),
3050
+ emailInput.subject ? /* @__PURE__ */ jsxs("div", {
3051
+ className: "space-y-1",
3052
+ children: [/* @__PURE__ */ jsx("p", {
3053
+ className: "text-xs font-semibold text-slate-600",
3054
+ children: copy.subject
3055
+ }), /* @__PURE__ */ jsx("p", {
3056
+ className: "text-sm text-slate-900",
3057
+ children: emailInput.subject
3058
+ })]
3059
+ }) : null,
3060
+ /* @__PURE__ */ jsxs("div", {
3061
+ className: "space-y-1",
3062
+ children: [/* @__PURE__ */ jsx("p", {
3063
+ className: "text-xs font-semibold text-slate-600",
3064
+ children: copy.to
3065
+ }), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
3066
+ className: "flex flex-wrap gap-2",
3067
+ children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
3068
+ className: "rounded-full border border-slate-300 bg-slate-100 px-2 py-0.5 text-xs text-slate-700",
3069
+ children: recipient
3070
+ }, recipient))
3071
+ }) : /* @__PURE__ */ jsx("p", {
3072
+ className: "text-sm text-slate-500",
3073
+ children: copy.noRecipientsProvided
3074
+ })]
3075
+ }),
3076
+ /* @__PURE__ */ jsxs("div", {
3077
+ id: `tool-email-details-${part.id}`,
3078
+ "data-testid": "email-send-details",
3079
+ className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
3080
+ children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
3081
+ className: "space-y-1",
3082
+ children: [/* @__PURE__ */ jsx("p", {
3083
+ className: "text-xs font-semibold text-slate-600",
3084
+ children: copy.body
3085
+ }), /* @__PURE__ */ jsx("p", {
3086
+ className: "whitespace-pre-wrap rounded border border-slate-200 bg-slate-50 p-2 text-sm text-slate-700",
3087
+ children: emailInput.text
3088
+ })]
3089
+ }) : null, part.result !== void 0 ? /* @__PURE__ */ jsxs("div", {
3090
+ className: "space-y-2 rounded border border-slate-200 bg-white p-3",
3091
+ children: [
3092
+ /* @__PURE__ */ jsx("p", {
3093
+ className: "text-xs font-semibold uppercase tracking-wide text-slate-500",
3094
+ children: copy.delivery
3095
+ }),
3096
+ emailResult.status ? /* @__PURE__ */ jsxs("p", {
3097
+ className: "text-sm text-slate-700",
3098
+ children: [
3099
+ /* @__PURE__ */ jsxs("span", {
3100
+ className: "font-semibold text-slate-900",
3101
+ children: [copy.status, ":"]
3102
+ }),
3103
+ " ",
3104
+ emailResult.status
3105
+ ]
3106
+ }) : null,
3107
+ emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
3108
+ className: "text-sm text-slate-700",
3109
+ children: [
3110
+ /* @__PURE__ */ jsxs("span", {
3111
+ className: "font-semibold text-slate-900",
3112
+ children: [copy.recipients, ":"]
3113
+ }),
3114
+ " ",
3115
+ emailResult.recipientsCount
3116
+ ]
3117
+ }) : null,
3118
+ emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
3119
+ className: "text-sm text-slate-700",
3120
+ children: [
3121
+ /* @__PURE__ */ jsxs("span", {
3122
+ className: "font-semibold text-slate-900",
3123
+ children: [copy.provider, ":"]
3124
+ }),
3125
+ " ",
3126
+ emailResult.receiptProvider
3127
+ ]
3128
+ }) : null,
3129
+ emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
3130
+ className: "break-all text-sm text-slate-700",
3131
+ children: [
3132
+ /* @__PURE__ */ jsxs("span", {
3133
+ className: "font-semibold text-slate-900",
3134
+ children: [copy.messageId, ":"]
3135
+ }),
3136
+ " ",
3137
+ emailResult.receiptMessageId
3138
+ ]
3139
+ }) : null,
3140
+ emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
3141
+ className: "text-sm text-slate-700",
3142
+ children: [
3143
+ /* @__PURE__ */ jsxs("span", {
3144
+ className: "font-semibold text-slate-900",
3145
+ children: [copy.rawStatus, ":"]
3146
+ }),
3147
+ " ",
3148
+ emailResult.receiptRawStatus
3149
+ ]
3150
+ }) : null,
3151
+ emailResult.raw ? /* @__PURE__ */ jsx("p", {
3152
+ className: "whitespace-pre-wrap text-sm text-slate-700",
3153
+ children: emailResult.raw
3154
+ }) : null
3155
+ ]
3156
+ }) : null]
3157
+ }),
3158
+ errorDetails ? /* @__PURE__ */ jsxs("p", {
3159
+ className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
3160
+ children: [
3161
+ /* @__PURE__ */ jsxs("span", {
3162
+ className: "font-semibold",
3163
+ children: [copy.errorDetails, ":"]
3164
+ }),
3165
+ " ",
3166
+ errorDetails
3167
+ ]
3168
+ }) : null
3169
+ ]
1711
3170
  });
1712
3171
  }
1713
3172
 
@@ -1736,7 +3195,7 @@ function parseJson(value) {
1736
3195
  return null;
1737
3196
  }
1738
3197
  }
1739
- function normalizeTable(value) {
3198
+ function normalizeTable(value, copy) {
1740
3199
  const raw = typeof value === "string" ? parseJson(value) : value;
1741
3200
  if (!raw) return {
1742
3201
  columns: [],
@@ -1765,7 +3224,7 @@ function normalizeTable(value) {
1765
3224
  };
1766
3225
  const columnValues = columns.map((column) => raw[column]);
1767
3226
  if (!columnValues.some(isRecord)) return {
1768
- columns: ["Property", "Value"],
3227
+ columns: [copy.property, copy.value],
1769
3228
  rows: Object.entries(raw)
1770
3229
  };
1771
3230
  return {
@@ -1777,18 +3236,14 @@ function getTableValue(part) {
1777
3236
  if (part.metadata?.json_table !== void 0) return part.metadata.json_table;
1778
3237
  return typeof part.result === "string" ? part.result : null;
1779
3238
  }
1780
- function formatStatus(state) {
1781
- if (state === "pending") return "pending";
1782
- if (state === "error") return "error";
1783
- return "completed";
1784
- }
1785
- function ToolResultExternalDatasourceCard({ part, className }) {
3239
+ function ToolResultExternalDatasourceCard({ part, className, locale }) {
3240
+ const copy = getUiCopy(locale);
1786
3241
  const sqlQuery = toStringOrNull(part.metadata?.sql_query);
1787
- const table = normalizeTable(getTableValue(part));
3242
+ const table = normalizeTable(getTableValue(part), copy);
1788
3243
  const errorDetails = formatToolErrorDetails(part.errorDetails);
1789
3244
  const statusClass = part.state === "error" ? "text-rose-600" : part.state === "pending" ? "text-amber-600" : "text-emerald-600";
1790
3245
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
1791
- "aria-label": `External datasource: ${formatStatus(part.state)}`,
3246
+ "aria-label": `${copy.externalDatasource}: ${getUiStatusLabel(part.state, copy)}`,
1792
3247
  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),
1793
3248
  children: /* @__PURE__ */ jsxs("span", {
1794
3249
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -1799,7 +3254,7 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1799
3254
  }),
1800
3255
  /* @__PURE__ */ jsx("span", {
1801
3256
  className: "truncate font-medium",
1802
- children: "External datasource"
3257
+ children: copy.externalDatasource
1803
3258
  }),
1804
3259
  /* @__PURE__ */ jsx("span", {
1805
3260
  className: joinClasses("ml-auto shrink-0", statusClass),
@@ -1811,19 +3266,19 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1811
3266
  "aria-hidden": "true"
1812
3267
  }) : /* @__PURE__ */ jsx("span", {
1813
3268
  className: "text-xs",
1814
- children: "pending"
3269
+ children: copy.pending
1815
3270
  })
1816
3271
  })
1817
3272
  ]
1818
3273
  })
1819
3274
  }), /* @__PURE__ */ jsxs(SheetContent, {
1820
- closeLabel: "Close",
3275
+ locale,
1821
3276
  children: [/* @__PURE__ */ jsx(SheetHeader, {
1822
3277
  className: "pr-10",
1823
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "External datasource" })
3278
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.externalDatasource })
1824
3279
  }), /* @__PURE__ */ jsxs("section", {
1825
3280
  className: "mt-6 space-y-8",
1826
- "aria-label": "External datasource result",
3281
+ "aria-label": copy.externalDatasourceResult,
1827
3282
  children: [
1828
3283
  sqlQuery ? /* @__PURE__ */ jsxs("div", {
1829
3284
  className: "space-y-2",
@@ -1834,7 +3289,7 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1834
3289
  "aria-hidden": "true"
1835
3290
  }), /* @__PURE__ */ jsx("h3", {
1836
3291
  className: "text-sm font-medium",
1837
- children: "SQL query"
3292
+ children: copy.sqlQuery
1838
3293
  })]
1839
3294
  }), /* @__PURE__ */ jsx("pre", {
1840
3295
  className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5 text-neutral-800",
@@ -1845,7 +3300,7 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1845
3300
  className: "space-y-2",
1846
3301
  children: [/* @__PURE__ */ jsx("h3", {
1847
3302
  className: "text-sm font-medium",
1848
- children: "Query results"
3303
+ children: copy.queryResults
1849
3304
  }), /* @__PURE__ */ jsx("div", {
1850
3305
  className: "overflow-x-auto rounded-md border border-neutral-200",
1851
3306
  children: /* @__PURE__ */ jsxs("table", {
@@ -1872,14 +3327,14 @@ function ToolResultExternalDatasourceCard({ part, className }) {
1872
3327
  })]
1873
3328
  }) : part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
1874
3329
  className: "text-sm text-neutral-600",
1875
- children: "No data to display."
3330
+ children: copy.noDataToDisplay
1876
3331
  }) : null,
1877
3332
  errorDetails ? /* @__PURE__ */ jsxs("p", {
1878
3333
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
1879
3334
  children: [
1880
- /* @__PURE__ */ jsx("span", {
3335
+ /* @__PURE__ */ jsxs("span", {
1881
3336
  className: "font-semibold",
1882
- children: "Error details:"
3337
+ children: [copy.errorDetails, ":"]
1883
3338
  }),
1884
3339
  " ",
1885
3340
  errorDetails
@@ -1901,15 +3356,16 @@ function output(value) {
1901
3356
  return null;
1902
3357
  }
1903
3358
  }
1904
- function ToolResultHttpRequestCard({ part, className }) {
3359
+ function ToolResultHttpRequestCard({ part, className, locale }) {
3360
+ const copy = getUiCopy(locale);
1905
3361
  const metadata = part.metadata;
1906
3362
  const statusCode = metadata?.status_code;
1907
3363
  const failed = part.state === "error" || typeof statusCode === "number" && statusCode >= 400;
1908
3364
  const response = output(part.result);
1909
3365
  const errorDetails = formatToolErrorDetails(part.errorDetails);
1910
- const status = statusCode ? `${statusCode}${metadata?.status_reason ? ` ${metadata.status_reason}` : ""}` : part.state;
3366
+ const status = statusCode ? `${statusCode}${metadata?.status_reason ? ` ${metadata.status_reason}` : ""}` : getUiStatusLabel(part.state, copy);
1911
3367
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
1912
- "aria-label": `HTTP request: ${status}`,
3368
+ "aria-label": `${copy.httpRequest}: ${status}`,
1913
3369
  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),
1914
3370
  children: /* @__PURE__ */ jsxs("span", {
1915
3371
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -1939,51 +3395,51 @@ function ToolResultHttpRequestCard({ part, className }) {
1939
3395
  ]
1940
3396
  })
1941
3397
  }), /* @__PURE__ */ jsxs(SheetContent, {
1942
- closeLabel: "Close",
3398
+ locale,
1943
3399
  children: [/* @__PURE__ */ jsx(SheetHeader, {
1944
3400
  className: "pr-10",
1945
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "HTTP request" })
3401
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.httpRequest })
1946
3402
  }), /* @__PURE__ */ jsxs("section", {
1947
3403
  className: "mt-6 space-y-5",
1948
- "aria-label": "HTTP response",
3404
+ "aria-label": copy.httpResponse,
1949
3405
  children: [
1950
3406
  /* @__PURE__ */ jsxs("dl", {
1951
3407
  className: "grid gap-2 text-sm",
1952
3408
  children: [
1953
3409
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1954
3410
  className: "text-xs text-neutral-500",
1955
- children: "Status"
3411
+ children: copy.status
1956
3412
  }), /* @__PURE__ */ jsx("dd", { children: status })] }),
1957
3413
  metadata?.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1958
3414
  className: "text-xs text-neutral-500",
1959
- children: "Request URL"
3415
+ children: copy.requestUrl
1960
3416
  }), /* @__PURE__ */ jsx("dd", {
1961
3417
  className: "break-all",
1962
3418
  children: metadata.url
1963
3419
  })] }) : null,
1964
3420
  metadata?.response_url && metadata.response_url !== metadata.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1965
3421
  className: "text-xs text-neutral-500",
1966
- children: "Response URL"
3422
+ children: copy.responseUrl
1967
3423
  }), /* @__PURE__ */ jsx("dd", {
1968
3424
  className: "break-all",
1969
3425
  children: metadata.response_url
1970
3426
  })] }) : null,
1971
3427
  metadata?.content_type ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
1972
3428
  className: "text-xs text-neutral-500",
1973
- children: "Content type"
3429
+ children: copy.contentType
1974
3430
  }), /* @__PURE__ */ jsx("dd", { children: metadata.content_type })] }) : null
1975
3431
  ]
1976
3432
  }),
1977
3433
  response ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
1978
3434
  className: "mb-2 text-sm font-medium",
1979
- children: "Response"
3435
+ children: copy.response
1980
3436
  }), /* @__PURE__ */ jsx("pre", {
1981
3437
  className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
1982
3438
  children: response
1983
3439
  })] }) : null,
1984
3440
  metadata?.response_headers && Object.keys(metadata.response_headers).length ? /* @__PURE__ */ jsxs("details", { children: [/* @__PURE__ */ jsx("summary", {
1985
3441
  className: "cursor-pointer text-sm font-medium",
1986
- children: "Response headers"
3442
+ children: copy.responseHeaders
1987
3443
  }), /* @__PURE__ */ jsx("pre", {
1988
3444
  className: "mt-2 overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs",
1989
3445
  children: JSON.stringify(metadata.response_headers, null, 2)
@@ -1991,9 +3447,9 @@ function ToolResultHttpRequestCard({ part, className }) {
1991
3447
  errorDetails ? /* @__PURE__ */ jsxs("p", {
1992
3448
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
1993
3449
  children: [
1994
- /* @__PURE__ */ jsx("span", {
3450
+ /* @__PURE__ */ jsxs("span", {
1995
3451
  className: "font-semibold",
1996
- children: "Error details:"
3452
+ children: [copy.errorDetails, ":"]
1997
3453
  }),
1998
3454
  " ",
1999
3455
  errorDetails
@@ -2015,7 +3471,8 @@ function text(value) {
2015
3471
  return null;
2016
3472
  }
2017
3473
  }
2018
- function ToolResultMcpCard({ part, className }) {
3474
+ function ToolResultMcpCard({ part, className, locale }) {
3475
+ const copy = getUiCopy(locale);
2019
3476
  const meta = part.metadata;
2020
3477
  const server = meta?.mcp_server_url ?? meta?.server_name;
2021
3478
  const tool = meta?.mcp_tool_name ?? meta?.tool_name ?? part.name;
@@ -2023,7 +3480,7 @@ function ToolResultMcpCard({ part, className }) {
2023
3480
  const error = formatToolErrorDetails(part.errorDetails);
2024
3481
  const failed = part.state === "error";
2025
3482
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
2026
- "aria-label": `MCP tool: ${tool}`,
3483
+ "aria-label": `${copy.mcpTool}: ${tool}`,
2027
3484
  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),
2028
3485
  children: /* @__PURE__ */ jsxs("span", {
2029
3486
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -2053,22 +3510,22 @@ function ToolResultMcpCard({ part, className }) {
2053
3510
  ]
2054
3511
  })
2055
3512
  }), /* @__PURE__ */ jsxs(SheetContent, {
2056
- closeLabel: "Close",
3513
+ locale,
2057
3514
  children: [/* @__PURE__ */ jsx(SheetHeader, {
2058
3515
  className: "pr-10",
2059
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "MCP tool" })
3516
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.mcpTool })
2060
3517
  }), /* @__PURE__ */ jsxs("section", {
2061
3518
  className: "mt-6 space-y-4",
2062
- "aria-label": "MCP tool result",
3519
+ "aria-label": copy.mcpToolResult,
2063
3520
  children: [
2064
3521
  /* @__PURE__ */ jsxs("dl", {
2065
3522
  className: "grid gap-2 text-sm",
2066
3523
  children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2067
3524
  className: "text-xs text-neutral-500",
2068
- children: "Tool"
3525
+ children: copy.tool
2069
3526
  }), /* @__PURE__ */ jsx("dd", { children: tool })] }), server ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2070
3527
  className: "text-xs text-neutral-500",
2071
- children: "Server"
3528
+ children: copy.server
2072
3529
  }), /* @__PURE__ */ jsx("dd", {
2073
3530
  className: "break-all",
2074
3531
  children: server
@@ -2076,7 +3533,7 @@ function ToolResultMcpCard({ part, className }) {
2076
3533
  }),
2077
3534
  result ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
2078
3535
  className: "mb-2 text-sm font-medium",
2079
- children: "Result"
3536
+ children: copy.result
2080
3537
  }), /* @__PURE__ */ jsx("pre", {
2081
3538
  className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
2082
3539
  children: result
@@ -2084,9 +3541,9 @@ function ToolResultMcpCard({ part, className }) {
2084
3541
  error ? /* @__PURE__ */ jsxs("p", {
2085
3542
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
2086
3543
  children: [
2087
- /* @__PURE__ */ jsx("span", {
3544
+ /* @__PURE__ */ jsxs("span", {
2088
3545
  className: "font-semibold",
2089
- children: "Error details:"
3546
+ children: [copy.errorDetails, ":"]
2090
3547
  }),
2091
3548
  " ",
2092
3549
  error
@@ -2125,13 +3582,14 @@ function iconClass(extension) {
2125
3582
  if (["ppt", "pptx"].includes(extension ?? "")) return "text-orange-600";
2126
3583
  return "text-neutral-500";
2127
3584
  }
2128
- function ToolResultOfficeDocumentsCard({ part, className }) {
3585
+ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
3586
+ const copy = getUiCopy(locale);
2129
3587
  const files = getFiles(part);
2130
3588
  const errorDetails = formatToolErrorDetails(part.errorDetails);
2131
- const fileLabel = files.length === 1 ? "file" : "files";
3589
+ const fileLabel = files.length === 1 ? copy.file : copy.files;
2132
3590
  const statusClass = part.state === "error" ? "text-rose-600" : part.state === "pending" ? "text-amber-600" : "text-emerald-600";
2133
3591
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
2134
- "aria-label": `Office documents: ${files.length} ${fileLabel}`,
3592
+ "aria-label": `${copy.officeDocuments}: ${files.length} ${fileLabel}`,
2135
3593
  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),
2136
3594
  children: /* @__PURE__ */ jsxs("span", {
2137
3595
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -2142,11 +3600,11 @@ function ToolResultOfficeDocumentsCard({ part, className }) {
2142
3600
  }),
2143
3601
  /* @__PURE__ */ jsx("span", {
2144
3602
  className: "truncate font-medium",
2145
- children: "Office documents"
3603
+ children: copy.officeDocuments
2146
3604
  }),
2147
3605
  /* @__PURE__ */ jsx("span", {
2148
3606
  className: "truncate text-xs text-neutral-500",
2149
- children: part.state === "pending" ? "pending" : `${files.length} ${fileLabel}`
3607
+ children: part.state === "pending" ? copy.pending : `${files.length} ${fileLabel}`
2150
3608
  }),
2151
3609
  /* @__PURE__ */ jsx("span", {
2152
3610
  className: joinClasses("ml-auto shrink-0", statusClass),
@@ -2161,13 +3619,13 @@ function ToolResultOfficeDocumentsCard({ part, className }) {
2161
3619
  ]
2162
3620
  })
2163
3621
  }), /* @__PURE__ */ jsxs(SheetContent, {
2164
- closeLabel: "Close",
3622
+ locale,
2165
3623
  children: [/* @__PURE__ */ jsx(SheetHeader, {
2166
3624
  className: "pr-10",
2167
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "Office documents" })
3625
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.officeDocuments })
2168
3626
  }), /* @__PURE__ */ jsxs("section", {
2169
3627
  className: "mt-6 space-y-3",
2170
- "aria-label": "Generated files",
3628
+ "aria-label": copy.generatedFiles,
2171
3629
  children: [
2172
3630
  files.map((file) => {
2173
3631
  const extension = getExtension(file);
@@ -2198,18 +3656,18 @@ function ToolResultOfficeDocumentsCard({ part, className }) {
2198
3656
  }),
2199
3657
  files.length === 0 && part.state === "pending" ? /* @__PURE__ */ jsx("p", {
2200
3658
  className: "text-sm text-neutral-600",
2201
- children: "Creating documents…"
3659
+ children: copy.creatingDocuments
2202
3660
  }) : null,
2203
3661
  files.length === 0 && part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
2204
3662
  className: "text-sm text-neutral-600",
2205
- children: "No files were generated."
3663
+ children: copy.noFilesGenerated
2206
3664
  }) : null,
2207
3665
  errorDetails ? /* @__PURE__ */ jsxs("p", {
2208
3666
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
2209
3667
  children: [
2210
- /* @__PURE__ */ jsx("span", {
3668
+ /* @__PURE__ */ jsxs("span", {
2211
3669
  className: "font-semibold",
2212
- children: "Error details:"
3670
+ children: [copy.errorDetails, ":"]
2213
3671
  }),
2214
3672
  " ",
2215
3673
  errorDetails
@@ -2247,15 +3705,16 @@ function formatResult(value) {
2247
3705
  return null;
2248
3706
  }
2249
3707
  }
2250
- function ToolResultWorkflowDispatchCard({ part, className }) {
3708
+ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
3709
+ const copy = getUiCopy(locale);
2251
3710
  const result = parseResult(part.result);
2252
3711
  const workflowName = result.workflowName ?? part.name;
2253
- const status = result.status ?? part.state;
3712
+ const status = getUiStatusLabel(result.status ?? part.state, copy);
2254
3713
  const failed = part.state === "error";
2255
3714
  const output$1 = formatResult(part.result);
2256
3715
  const error = formatToolErrorDetails(part.errorDetails);
2257
3716
  return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
2258
- "aria-label": `Workflow: ${workflowName}`,
3717
+ "aria-label": `${copy.workflow}: ${workflowName}`,
2259
3718
  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),
2260
3719
  children: /* @__PURE__ */ jsxs("span", {
2261
3720
  className: "flex items-center gap-2 px-3 py-2 text-sm",
@@ -2266,7 +3725,7 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
2266
3725
  }),
2267
3726
  /* @__PURE__ */ jsx("span", {
2268
3727
  className: "shrink-0 font-medium",
2269
- children: "Workflow"
3728
+ children: copy.workflow
2270
3729
  }),
2271
3730
  /* @__PURE__ */ jsx("span", {
2272
3731
  className: "min-w-0 truncate text-neutral-600",
@@ -2288,35 +3747,35 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
2288
3747
  ]
2289
3748
  })
2290
3749
  }), /* @__PURE__ */ jsxs(SheetContent, {
2291
- closeLabel: "Close",
3750
+ locale,
2292
3751
  children: [/* @__PURE__ */ jsx(SheetHeader, {
2293
3752
  className: "pr-10",
2294
- children: /* @__PURE__ */ jsx(SheetTitle, { children: "Workflow dispatch" })
3753
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.workflowDispatch })
2295
3754
  }), /* @__PURE__ */ jsxs("section", {
2296
3755
  className: "mt-6 space-y-4",
2297
- "aria-label": "Workflow dispatch result",
3756
+ "aria-label": copy.workflowDispatchResult,
2298
3757
  children: [
2299
3758
  /* @__PURE__ */ jsxs("dl", {
2300
3759
  className: "grid gap-2 text-sm",
2301
3760
  children: [
2302
3761
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2303
3762
  className: "text-xs text-neutral-500",
2304
- children: "Workflow"
3763
+ children: copy.workflow
2305
3764
  }), /* @__PURE__ */ jsx("dd", { children: workflowName })] }),
2306
3765
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2307
3766
  className: "text-xs text-neutral-500",
2308
- children: "Status"
3767
+ children: copy.status
2309
3768
  }), /* @__PURE__ */ jsx("dd", { children: status })] }),
2310
3769
  result.executionId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2311
3770
  className: "text-xs text-neutral-500",
2312
- children: "Execution ID"
3771
+ children: copy.executionId
2313
3772
  }), /* @__PURE__ */ jsx("dd", {
2314
3773
  className: "break-all",
2315
3774
  children: result.executionId
2316
3775
  })] }) : null,
2317
3776
  result.workflowId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
2318
3777
  className: "text-xs text-neutral-500",
2319
- children: "Workflow ID"
3778
+ children: copy.workflowId
2320
3779
  }), /* @__PURE__ */ jsx("dd", {
2321
3780
  className: "break-all",
2322
3781
  children: result.workflowId
@@ -2325,7 +3784,7 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
2325
3784
  }),
2326
3785
  output$1 ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
2327
3786
  className: "mb-2 text-sm font-medium",
2328
- children: "Result"
3787
+ children: copy.result
2329
3788
  }), /* @__PURE__ */ jsx("pre", {
2330
3789
  className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
2331
3790
  children: output$1
@@ -2333,9 +3792,9 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
2333
3792
  error ? /* @__PURE__ */ jsxs("p", {
2334
3793
  className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
2335
3794
  children: [
2336
- /* @__PURE__ */ jsx("span", {
3795
+ /* @__PURE__ */ jsxs("span", {
2337
3796
  className: "font-semibold",
2338
- children: "Error details:"
3797
+ children: [copy.errorDetails, ":"]
2339
3798
  }),
2340
3799
  " ",
2341
3800
  error
@@ -2431,419 +3890,68 @@ const TOOL_USE_TRANSLATIONS = {
2431
3890
  web: "Websuche mit {{toolName}}",
2432
3891
  workflow: "Workflow {{toolName}} wird ausgeführt"
2433
3892
  },
2434
- da: {
2435
- agent: "Kører agenten {{toolName}}",
2436
- datasource: "Søger i datakilden {{toolName}}",
2437
- documents: "Arbejder med dokumenter via {{toolName}}",
2438
- email: "Sender e-mail med {{toolName}}",
2439
- query: "Forespørger {{toolName}}",
2440
- request: "Udfører en anmodning med {{toolName}}",
2441
- tool: "Kører {{toolName}}",
2442
- web: "Søger på nettet med {{toolName}}",
2443
- workflow: "Kører workflowet {{toolName}}"
2444
- },
2445
- sv: {
2446
- agent: "Kör agenten {{toolName}}",
2447
- datasource: "Söker i datakällan {{toolName}}",
2448
- documents: "Arbetar med dokument via {{toolName}}",
2449
- email: "Skickar e-post med {{toolName}}",
2450
- query: "Frågar {{toolName}}",
2451
- request: "Kör en begäran med {{toolName}}",
2452
- tool: "Kör {{toolName}}",
2453
- web: "Söker på webben med {{toolName}}",
2454
- workflow: "Kör arbetsflödet {{toolName}}"
2455
- },
2456
- no: {
2457
- agent: "Kjører agenten {{toolName}}",
2458
- datasource: "Søker i datakilden {{toolName}}",
2459
- documents: "Arbeider med dokumenter via {{toolName}}",
2460
- email: "Sender e-post med {{toolName}}",
2461
- query: "Spør {{toolName}}",
2462
- request: "Kjører en forespørsel med {{toolName}}",
2463
- tool: "Kjører {{toolName}}",
2464
- web: "Søker på nettet med {{toolName}}",
2465
- workflow: "Kjører arbeidsflyten {{toolName}}"
2466
- },
2467
- pt: {
2468
- agent: "Executando o agente {{toolName}}",
2469
- datasource: "Pesquisando na fonte de dados {{toolName}}",
2470
- documents: "Trabalhando com documentos usando {{toolName}}",
2471
- email: "Enviando e-mail com {{toolName}}",
2472
- query: "Consultando {{toolName}}",
2473
- request: "Executando um pedido com {{toolName}}",
2474
- tool: "Executando {{toolName}}",
2475
- web: "Pesquisando na web com {{toolName}}",
2476
- workflow: "Executando o fluxo {{toolName}}"
2477
- }
2478
- };
2479
- function getToolUseLabel(part, locale) {
2480
- const action = part.toolType ? TOOL_USE_ACTIONS[part.toolType] ?? "tool" : "tool";
2481
- return TOOL_USE_TRANSLATIONS[getSupportedToolLocale(locale)][action].replaceAll("{{toolName}}", part.name);
2482
- }
2483
- function ToolUseIndicator({ part, locale, className,...props }) {
2484
- const label = getToolUseLabel(part, locale);
2485
- return /* @__PURE__ */ jsx("output", {
2486
- "aria-live": "polite",
2487
- className: joinClasses("block min-h-10 py-2 text-sm", className),
2488
- "data-tool-call-id": part.id,
2489
- "data-tool-call-state": part.state,
2490
- ...props,
2491
- children: /* @__PURE__ */ jsxs("span", {
2492
- className: "plai-tool-use-shimmer",
2493
- children: [label, "…"]
2494
- })
2495
- });
2496
- }
2497
-
2498
- //#endregion
2499
- //#region src/components/memory-proposal-card.tsx
2500
- const COPY = {
2501
- en: {
2502
- title: "Memory proposal",
2503
- user: "Personal memory",
2504
- project: "Project learning",
2505
- create: "Create",
2506
- update: "Update",
2507
- delete: "Delete",
2508
- previous: "Previous content",
2509
- proposed: "Proposed content",
2510
- accept: "Accept",
2511
- reject: "Reject",
2512
- review: "Sent for admin review",
2513
- unavailable: "This proposal cannot be resolved here",
2514
- accepted: "Accepted",
2515
- rejected: "Rejected",
2516
- expired: "Expired",
2517
- conflicted: "Could not be applied because the memory changed",
2518
- conflictError: "The memory changed. The latest status has been loaded.",
2519
- expiredError: "This proposal is no longer available.",
2520
- permissionError: "You no longer have permission to resolve this proposal.",
2521
- genericError: "The proposal could not be resolved."
2522
- },
2523
- es: {
2524
- title: "Propuesta de memoria",
2525
- user: "Memoria personal",
2526
- project: "Aprendizaje del proyecto",
2527
- create: "Crear",
2528
- update: "Actualizar",
2529
- delete: "Eliminar",
2530
- previous: "Contenido anterior",
2531
- proposed: "Contenido propuesto",
2532
- accept: "Aceptar",
2533
- reject: "Rechazar",
2534
- review: "Enviado para revisión de un administrador",
2535
- unavailable: "Esta propuesta no se puede resolver aquí",
2536
- accepted: "Aceptada",
2537
- rejected: "Rechazada",
2538
- expired: "Caducada",
2539
- conflicted: "No se pudo aplicar porque la memoria cambió",
2540
- conflictError: "La memoria cambió. Se ha cargado el estado más reciente.",
2541
- expiredError: "Esta propuesta ya no está disponible.",
2542
- permissionError: "Ya no tienes permiso para resolver esta propuesta.",
2543
- genericError: "No se pudo resolver la propuesta."
2544
- },
2545
- ca: {
2546
- title: "Proposta de memòria",
2547
- user: "Memòria personal",
2548
- project: "Aprenentatge del projecte",
2549
- create: "Crear",
2550
- update: "Actualitzar",
2551
- delete: "Eliminar",
2552
- previous: "Contingut anterior",
2553
- proposed: "Contingut proposat",
2554
- accept: "Acceptar",
2555
- reject: "Rebutjar",
2556
- review: "Enviat per a revisió d'un administrador",
2557
- unavailable: "Aquesta proposta no es pot resoldre aquí",
2558
- accepted: "Acceptada",
2559
- rejected: "Rebutjada",
2560
- expired: "Caducada",
2561
- conflicted: "No s'ha pogut aplicar perquè la memòria ha canviat",
2562
- conflictError: "La memòria ha canviat. S'ha carregat l'estat més recent.",
2563
- expiredError: "Aquesta proposta ja no està disponible.",
2564
- permissionError: "Ja no tens permís per resoldre aquesta proposta.",
2565
- genericError: "No s'ha pogut resoldre la proposta."
2566
- },
2567
- da: {
2568
- title: "Hukommelsesforslag",
2569
- user: "Personlig hukommelse",
2570
- project: "Projektlæring",
2571
- create: "Opret",
2572
- update: "Opdater",
2573
- delete: "Slet",
2574
- previous: "Tidligere indhold",
2575
- proposed: "Foreslået indhold",
2576
- accept: "Acceptér",
2577
- reject: "Afvis",
2578
- review: "Sendt til administratorgennemgang",
2579
- unavailable: "Forslaget kan ikke behandles her",
2580
- accepted: "Accepteret",
2581
- rejected: "Afvist",
2582
- expired: "Udløbet",
2583
- conflicted: "Kunne ikke anvendes, fordi hukommelsen blev ændret",
2584
- conflictError: "Hukommelsen blev ændret. Den seneste status er indlæst.",
2585
- expiredError: "Forslaget er ikke længere tilgængeligt.",
2586
- permissionError: "Du har ikke længere tilladelse til at behandle forslaget.",
2587
- genericError: "Forslaget kunne ikke behandles."
2588
- },
2589
- de: {
2590
- title: "Speichervorschlag",
2591
- user: "Persönliche Erinnerung",
2592
- project: "Projektwissen",
2593
- create: "Erstellen",
2594
- update: "Aktualisieren",
2595
- delete: "Löschen",
2596
- previous: "Vorheriger Inhalt",
2597
- proposed: "Vorgeschlagener Inhalt",
2598
- accept: "Akzeptieren",
2599
- reject: "Ablehnen",
2600
- review: "Zur Administratorprüfung gesendet",
2601
- unavailable: "Dieser Vorschlag kann hier nicht bearbeitet werden",
2602
- accepted: "Akzeptiert",
2603
- rejected: "Abgelehnt",
2604
- expired: "Abgelaufen",
2605
- conflicted: "Nicht angewendet, da sich die Erinnerung geändert hat",
2606
- conflictError: "Die Erinnerung hat sich geändert. Der aktuelle Status wurde geladen.",
2607
- expiredError: "Dieser Vorschlag ist nicht mehr verfügbar.",
2608
- permissionError: "Sie dürfen diesen Vorschlag nicht mehr bearbeiten.",
2609
- genericError: "Der Vorschlag konnte nicht bearbeitet werden."
2610
- },
2611
- fr: {
2612
- title: "Proposition de mémoire",
2613
- user: "Mémoire personnelle",
2614
- project: "Apprentissage du projet",
2615
- create: "Créer",
2616
- update: "Modifier",
2617
- delete: "Supprimer",
2618
- previous: "Contenu précédent",
2619
- proposed: "Contenu proposé",
2620
- accept: "Accepter",
2621
- reject: "Refuser",
2622
- review: "Envoyé à un administrateur pour examen",
2623
- unavailable: "Cette proposition ne peut pas être traitée ici",
2624
- accepted: "Acceptée",
2625
- rejected: "Refusée",
2626
- expired: "Expirée",
2627
- conflicted: "Impossible à appliquer car la mémoire a changé",
2628
- conflictError: "La mémoire a changé. Le dernier état a été chargé.",
2629
- expiredError: "Cette proposition n'est plus disponible.",
2630
- permissionError: "Vous n'avez plus l'autorisation de traiter cette proposition.",
2631
- genericError: "La proposition n'a pas pu être traitée."
2632
- },
2633
- it: {
2634
- title: "Proposta di memoria",
2635
- user: "Memoria personale",
2636
- project: "Apprendimento del progetto",
2637
- create: "Crea",
2638
- update: "Aggiorna",
2639
- delete: "Elimina",
2640
- previous: "Contenuto precedente",
2641
- proposed: "Contenuto proposto",
2642
- accept: "Accetta",
2643
- reject: "Rifiuta",
2644
- review: "Inviata alla revisione di un amministratore",
2645
- unavailable: "Questa proposta non può essere gestita qui",
2646
- accepted: "Accettata",
2647
- rejected: "Rifiutata",
2648
- expired: "Scaduta",
2649
- conflicted: "Non applicata perché la memoria è cambiata",
2650
- conflictError: "La memoria è cambiata. È stato caricato lo stato più recente.",
2651
- expiredError: "Questa proposta non è più disponibile.",
2652
- permissionError: "Non hai più il permesso di gestire questa proposta.",
2653
- genericError: "Impossibile gestire la proposta."
3893
+ da: {
3894
+ agent: "Kører agenten {{toolName}}",
3895
+ datasource: "Søger i datakilden {{toolName}}",
3896
+ documents: "Arbejder med dokumenter via {{toolName}}",
3897
+ email: "Sender e-mail med {{toolName}}",
3898
+ query: "Forespørger {{toolName}}",
3899
+ request: "Udfører en anmodning med {{toolName}}",
3900
+ tool: "Kører {{toolName}}",
3901
+ web: "Søger på nettet med {{toolName}}",
3902
+ workflow: "Kører workflowet {{toolName}}"
3903
+ },
3904
+ sv: {
3905
+ agent: "Kör agenten {{toolName}}",
3906
+ datasource: "Söker i datakällan {{toolName}}",
3907
+ documents: "Arbetar med dokument via {{toolName}}",
3908
+ email: "Skickar e-post med {{toolName}}",
3909
+ query: "Frågar {{toolName}}",
3910
+ request: "Kör en begäran med {{toolName}}",
3911
+ tool: "Kör {{toolName}}",
3912
+ web: "Söker på webben med {{toolName}}",
3913
+ workflow: "Kör arbetsflödet {{toolName}}"
2654
3914
  },
2655
3915
  no: {
2656
- title: "Minneforslag",
2657
- user: "Personlig minne",
2658
- project: "Prosjektlæring",
2659
- create: "Opprett",
2660
- update: "Oppdater",
2661
- delete: "Slett",
2662
- previous: "Tidligere innhold",
2663
- proposed: "Foreslått innhold",
2664
- accept: "Godta",
2665
- reject: "Avvis",
2666
- review: "Sendt til administratorgjennomgang",
2667
- unavailable: "Forslaget kan ikke behandles her",
2668
- accepted: "Godtatt",
2669
- rejected: "Avvist",
2670
- expired: "Utløpt",
2671
- conflicted: "Kunne ikke brukes fordi minnet ble endret",
2672
- conflictError: "Minnet ble endret. Den nyeste statusen er lastet inn.",
2673
- expiredError: "Forslaget er ikke lenger tilgjengelig.",
2674
- permissionError: "Du har ikke lenger tillatelse til å behandle forslaget.",
2675
- genericError: "Forslaget kunne ikke behandles."
3916
+ agent: "Kjører agenten {{toolName}}",
3917
+ datasource: "Søker i datakilden {{toolName}}",
3918
+ documents: "Arbeider med dokumenter via {{toolName}}",
3919
+ email: "Sender e-post med {{toolName}}",
3920
+ query: "Spør {{toolName}}",
3921
+ request: "Kjører en forespørsel med {{toolName}}",
3922
+ tool: "Kjører {{toolName}}",
3923
+ web: "Søker på nettet med {{toolName}}",
3924
+ workflow: "Kjører arbeidsflyten {{toolName}}"
2676
3925
  },
2677
3926
  pt: {
2678
- title: "Proposta de memória",
2679
- user: "Memória pessoal",
2680
- project: "Aprendizagem do projeto",
2681
- create: "Criar",
2682
- update: "Atualizar",
2683
- delete: "Eliminar",
2684
- previous: "Conteúdo anterior",
2685
- proposed: "Conteúdo proposto",
2686
- accept: "Aceitar",
2687
- reject: "Rejeitar",
2688
- review: "Enviado para revisão de um administrador",
2689
- unavailable: "Esta proposta não pode ser resolvida aqui",
2690
- accepted: "Aceite",
2691
- rejected: "Rejeitada",
2692
- expired: "Expirada",
2693
- conflicted: "Não aplicada porque a memória foi alterada",
2694
- conflictError: "A memória foi alterada. O estado mais recente foi carregado.",
2695
- expiredError: "Esta proposta já não está disponível.",
2696
- permissionError: "Já não tem permissão para resolver esta proposta.",
2697
- genericError: "Não foi possível resolver a proposta."
2698
- },
2699
- sv: {
2700
- title: "Minnesförslag",
2701
- user: "Personligt minne",
2702
- project: "Projektlärdom",
2703
- create: "Skapa",
2704
- update: "Uppdatera",
2705
- delete: "Ta bort",
2706
- previous: "Tidigare innehåll",
2707
- proposed: "Föreslaget innehåll",
2708
- accept: "Godkänn",
2709
- reject: "Avvisa",
2710
- review: "Skickat för administratörsgranskning",
2711
- unavailable: "Förslaget kan inte hanteras här",
2712
- accepted: "Godkänt",
2713
- rejected: "Avvisat",
2714
- expired: "Utgånget",
2715
- conflicted: "Kunde inte tillämpas eftersom minnet ändrades",
2716
- conflictError: "Minnet ändrades. Den senaste statusen har lästs in.",
2717
- expiredError: "Förslaget är inte längre tillgängligt.",
2718
- permissionError: "Du har inte längre behörighet att hantera förslaget.",
2719
- genericError: "Förslaget kunde inte hanteras."
3927
+ agent: "Executando o agente {{toolName}}",
3928
+ datasource: "Pesquisando na fonte de dados {{toolName}}",
3929
+ documents: "Trabalhando com documentos usando {{toolName}}",
3930
+ email: "Enviando e-mail com {{toolName}}",
3931
+ query: "Consultando {{toolName}}",
3932
+ request: "Executando um pedido com {{toolName}}",
3933
+ tool: "Executando {{toolName}}",
3934
+ web: "Pesquisando na web com {{toolName}}",
3935
+ workflow: "Executando o fluxo {{toolName}}"
2720
3936
  }
2721
3937
  };
2722
- const REDACTED = "[redacted]";
2723
- function MemoryProposalCard({ proposal: initial, actions, activeAgentId, locale, className }) {
2724
- const copy = COPY[getSupportedToolLocale(locale)];
2725
- const [proposal, setProposal] = useState(initial);
2726
- const [resolving, setResolving] = useState(false);
2727
- const [error, setError] = useState(null);
2728
- useEffect(() => setProposal((current) => mergeProposal(current, initial)), [initial]);
2729
- async function resolve(accept) {
2730
- if (resolving) return;
2731
- setResolving(true);
2732
- setError(null);
2733
- try {
2734
- const next = accept ? await actions.acceptMemoryProposal({ proposalId: proposal.id }) : await actions.rejectMemoryProposal({ proposalId: proposal.id });
2735
- setProposal((current) => mergeProposal(current, next));
2736
- } catch (cause) {
2737
- const status = cause instanceof HttpStatusError ? cause.status : 0;
2738
- setError(status === 409 ? copy.conflictError : status === 410 ? copy.expiredError : status === 401 || status === 403 ? copy.permissionError : copy.genericError);
2739
- try {
2740
- const latest = await actions.getMemoryProposal({ proposalId: proposal.id });
2741
- setProposal((current) => mergeProposal(current, latest));
2742
- } catch {}
2743
- } finally {
2744
- setResolving(false);
2745
- }
2746
- }
2747
- const canResolve = proposal.status === "PENDING" && proposal.can_resolve === true && proposal.agent_id === activeAgentId;
2748
- const statusCopy = proposal.status === "ACCEPTED" ? copy.accepted : proposal.status === "REJECTED" ? copy.rejected : proposal.status === "EXPIRED" ? copy.expired : proposal.status === "CONFLICTED" ? copy.conflicted : null;
2749
- const operation = proposal.operation === "CREATE" ? copy.create : proposal.operation === "UPDATE" ? copy.update : copy.delete;
2750
- return /* @__PURE__ */ jsxs("section", {
2751
- className: joinClasses("space-y-3 rounded-lg border border-emerald-200 bg-emerald-50/30 p-4 text-left", className),
2752
- "data-memory-proposal-id": proposal.id,
2753
- children: [
2754
- /* @__PURE__ */ jsxs("header", {
2755
- className: "space-y-2",
2756
- children: [/* @__PURE__ */ jsxs("h4", {
2757
- className: "flex items-center gap-2 text-sm font-semibold text-slate-900",
2758
- children: [/* @__PURE__ */ jsx(Brain, { className: "size-4" }), copy.title]
2759
- }), /* @__PURE__ */ jsxs("div", {
2760
- className: "flex flex-wrap gap-2 text-xs",
2761
- children: [
2762
- /* @__PURE__ */ jsx("span", {
2763
- className: "rounded-full border border-slate-300 bg-white px-2 py-0.5",
2764
- children: proposal.scope === "USER" ? copy.user : copy.project
2765
- }),
2766
- /* @__PURE__ */ jsx("span", {
2767
- className: "rounded-full bg-slate-100 px-2 py-0.5",
2768
- children: operation
2769
- }),
2770
- /* @__PURE__ */ jsx("span", {
2771
- className: "rounded-full bg-slate-100 px-2 py-0.5",
2772
- children: formatCategory(proposal.category)
2773
- })
2774
- ]
2775
- })]
2776
- }),
2777
- proposal.previous_content && proposal.previous_content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
2778
- className: "rounded-md bg-slate-100 p-3 text-sm",
2779
- children: [/* @__PURE__ */ jsx("span", {
2780
- className: "mb-1 block text-xs font-medium text-slate-500",
2781
- children: copy.previous
2782
- }), /* @__PURE__ */ jsx("p", {
2783
- className: "whitespace-pre-wrap break-words",
2784
- children: proposal.previous_content
2785
- })]
2786
- }) : null,
2787
- proposal.content && proposal.content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
2788
- className: "text-sm",
2789
- children: [/* @__PURE__ */ jsx("span", {
2790
- className: "mb-1 block text-xs font-medium text-slate-500",
2791
- children: copy.proposed
2792
- }), /* @__PURE__ */ jsx("p", {
2793
- className: "whitespace-pre-wrap break-words",
2794
- children: proposal.content
2795
- })]
2796
- }) : null,
2797
- canResolve ? /* @__PURE__ */ jsxs("div", {
2798
- className: "flex gap-2",
2799
- children: [/* @__PURE__ */ jsxs("button", {
2800
- type: "button",
2801
- disabled: resolving,
2802
- onClick: () => void resolve(true),
2803
- className: "inline-flex items-center rounded-md bg-slate-900 px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50",
2804
- children: [resolving ? /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 size-3 animate-spin" }) : null, copy.accept]
2805
- }), /* @__PURE__ */ jsx("button", {
2806
- type: "button",
2807
- disabled: resolving,
2808
- onClick: () => void resolve(false),
2809
- className: "rounded-md border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium disabled:opacity-50",
2810
- children: copy.reject
2811
- })]
2812
- }) : null,
2813
- proposal.status === "PENDING" && !canResolve ? /* @__PURE__ */ jsx("p", {
2814
- className: "text-xs font-medium text-slate-500",
2815
- children: proposal.scope === "PROJECT" ? copy.review : copy.unavailable
2816
- }) : null,
2817
- proposal.status === "ACCEPTED" && statusCopy ? /* @__PURE__ */ jsxs("span", {
2818
- 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",
2819
- children: [statusCopy, /* @__PURE__ */ jsx(Check, {
2820
- className: "size-3.5 stroke-[2.5] text-emerald-600",
2821
- "aria-hidden": "true"
2822
- })]
2823
- }) : null,
2824
- statusCopy && proposal.status !== "ACCEPTED" ? /* @__PURE__ */ jsx("p", {
2825
- className: "text-xs font-medium text-slate-500",
2826
- children: statusCopy
2827
- }) : null,
2828
- error ? /* @__PURE__ */ jsx("p", {
2829
- className: "text-xs text-red-600",
2830
- children: error
2831
- }) : null
2832
- ]
2833
- });
2834
- }
2835
- function mergeProposal(current, incoming) {
2836
- if (current.id !== incoming.id) return incoming;
2837
- return {
2838
- ...incoming,
2839
- content: incoming.content === REDACTED ? current.content : incoming.content,
2840
- previous_content: incoming.previous_content === REDACTED ? current.previous_content : incoming.previous_content,
2841
- rationale: incoming.rationale === REDACTED ? current.rationale : incoming.rationale
2842
- };
3938
+ function getToolUseLabel(part, locale) {
3939
+ const action = part.toolType ? TOOL_USE_ACTIONS[part.toolType] ?? "tool" : "tool";
3940
+ return TOOL_USE_TRANSLATIONS[getSupportedToolLocale(locale)][action].replaceAll("{{toolName}}", part.name);
2843
3941
  }
2844
- function formatCategory(category) {
2845
- const value = category.replaceAll("_", " ").toLowerCase();
2846
- return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
3942
+ function ToolUseIndicator({ part, locale, className,...props }) {
3943
+ const label = getToolUseLabel(part, locale);
3944
+ return /* @__PURE__ */ jsx("output", {
3945
+ "aria-live": "polite",
3946
+ className: joinClasses("block min-h-10 py-2 text-sm", className),
3947
+ "data-tool-call-id": part.id,
3948
+ "data-tool-call-state": part.state,
3949
+ ...props,
3950
+ children: /* @__PURE__ */ jsxs("span", {
3951
+ className: "plai-tool-use-shimmer",
3952
+ children: [label, "…"]
3953
+ })
3954
+ });
2847
3955
  }
2848
3956
 
2849
3957
  //#endregion
@@ -2864,6 +3972,7 @@ function getDatasourceResources$1(part) {
2864
3972
  return Array.isArray(resources) ? resources.filter(isDatasourceResource) : [];
2865
3973
  }
2866
3974
  function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAgentThread, getResourceDownloadUrl, memoryProposal }) {
3975
+ const copy = getUiCopy(locale);
2867
3976
  if (part.toolType === "memory_proposal") {
2868
3977
  const proposal = part.metadata?.proposal;
2869
3978
  if (!memoryProposal || !proposal || typeof proposal !== "object") return null;
@@ -2889,39 +3998,48 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
2889
3998
  const datasourceResources = getDatasourceResources$1(part);
2890
3999
  if (part.toolType === "email_send") return /* @__PURE__ */ jsx(ToolResultEmailSendCard, {
2891
4000
  part,
4001
+ locale,
2892
4002
  className
2893
4003
  });
2894
4004
  if (part.toolType === "agent_invocation") return /* @__PURE__ */ jsx(ToolResultAgentInvocationCard, {
2895
4005
  part,
4006
+ locale,
2896
4007
  className,
2897
4008
  onOpenThread: onOpenAgentThread
2898
4009
  });
2899
4010
  if (part.toolType === "browser") return /* @__PURE__ */ jsx(ToolResultBrowserCard, {
2900
4011
  part,
4012
+ locale,
2901
4013
  className
2902
4014
  });
2903
4015
  if (part.toolType === "external_datasource") return /* @__PURE__ */ jsx(ToolResultExternalDatasourceCard, {
2904
4016
  part,
4017
+ locale,
2905
4018
  className
2906
4019
  });
2907
4020
  if (part.toolType === "office_documents") return /* @__PURE__ */ jsx(ToolResultOfficeDocumentsCard, {
2908
4021
  part,
4022
+ locale,
2909
4023
  className
2910
4024
  });
2911
4025
  if (part.toolType === "http_request") return /* @__PURE__ */ jsx(ToolResultHttpRequestCard, {
2912
4026
  part,
4027
+ locale,
2913
4028
  className
2914
4029
  });
2915
4030
  if (part.toolType === "mcp_tool") return /* @__PURE__ */ jsx(ToolResultMcpCard, {
2916
4031
  part,
4032
+ locale,
2917
4033
  className
2918
4034
  });
2919
4035
  if (part.toolType === "workflow_dispatch") return /* @__PURE__ */ jsx(ToolResultWorkflowDispatchCard, {
2920
4036
  part,
4037
+ locale,
2921
4038
  className
2922
4039
  });
2923
4040
  if (part.toolType === "perplexity" || part.toolType === "firecrawl_search") return /* @__PURE__ */ jsx(ToolResultWebSearchCard, {
2924
4041
  part,
4042
+ locale,
2925
4043
  className
2926
4044
  });
2927
4045
  if (datasourceResources.length > 0) return /* @__PURE__ */ jsx(DatasourceToolResources, {
@@ -2943,15 +4061,15 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
2943
4061
  children: part.name
2944
4062
  }), /* @__PURE__ */ jsx("span", {
2945
4063
  className: "rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-800",
2946
- children: "completed"
4064
+ children: copy.completed
2947
4065
  })]
2948
4066
  }),
2949
4067
  part.toolType ? /* @__PURE__ */ jsxs("p", {
2950
4068
  className: "text-xs text-slate-600",
2951
4069
  children: [
2952
- /* @__PURE__ */ jsx("span", {
4070
+ /* @__PURE__ */ jsxs("span", {
2953
4071
  className: "font-semibold",
2954
- children: "Type:"
4072
+ children: [copy.type, ":"]
2955
4073
  }),
2956
4074
  " ",
2957
4075
  part.toolType
@@ -2962,7 +4080,7 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
2962
4080
  className: "space-y-2",
2963
4081
  children: [/* @__PURE__ */ jsx("summary", {
2964
4082
  className: "cursor-pointer text-xs font-semibold text-slate-600",
2965
- children: "Input"
4083
+ children: copy.input
2966
4084
  }), /* @__PURE__ */ jsx("pre", {
2967
4085
  className: "overflow-x-auto rounded bg-slate-900 p-2 text-xs text-slate-100",
2968
4086
  children: formatJson(part.input)
@@ -2974,13 +4092,13 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
2974
4092
  children: [
2975
4093
  /* @__PURE__ */ jsx("summary", {
2976
4094
  className: "cursor-pointer text-xs font-semibold text-slate-600",
2977
- children: "Output"
4095
+ children: copy.output
2978
4096
  }),
2979
4097
  officeMediaFiles.length > 0 ? /* @__PURE__ */ jsxs("div", {
2980
4098
  className: "space-y-2 rounded border border-slate-200 bg-white p-3",
2981
4099
  children: [/* @__PURE__ */ jsx("p", {
2982
4100
  className: "text-xs font-semibold text-slate-700",
2983
- children: "Generated files"
4101
+ children: copy.generatedFiles
2984
4102
  }), /* @__PURE__ */ jsx("ul", {
2985
4103
  className: "space-y-1",
2986
4104
  children: officeMediaFiles.map((file) => {
@@ -3010,13 +4128,14 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
3010
4128
 
3011
4129
  //#endregion
3012
4130
  //#region src/components/thinking.tsx
3013
- function Thinking({ part, thinkingLabel = "Thinking…", completedLabel = "Thought process", defaultOpen, className,...props }) {
4131
+ function Thinking({ part, thinkingLabel, completedLabel, locale, defaultOpen, className,...props }) {
4132
+ const copy = getUiCopy(locale);
3014
4133
  const isStreaming = part.state === "streaming";
3015
4134
  const hasContent = Boolean(part.thinking.trim());
3016
4135
  const [isOpen, setIsOpen] = useState(defaultOpen ?? isStreaming);
3017
4136
  const previousState = useRef(part.state);
3018
4137
  const contentId = useId();
3019
- const label = isStreaming ? thinkingLabel : completedLabel;
4138
+ const label = isStreaming ? thinkingLabel ?? copy.thinking : completedLabel ?? copy.thoughtProcess;
3020
4139
  useEffect(() => {
3021
4140
  if (previousState.current === "streaming" && !isStreaming) setIsOpen(false);
3022
4141
  previousState.current = part.state;
@@ -3030,7 +4149,7 @@ function Thinking({ part, thinkingLabel = "Thinking…", completedLabel = "Thoug
3030
4149
  type: "button",
3031
4150
  "aria-controls": hasContent ? contentId : void 0,
3032
4151
  "aria-expanded": hasContent ? isOpen : void 0,
3033
- "aria-label": hasContent ? `${isOpen ? "Collapse" : "Expand"} ${label}` : label,
4152
+ "aria-label": hasContent ? `${isOpen ? copy.collapse : copy.expand} ${label}` : label,
3034
4153
  disabled: !hasContent,
3035
4154
  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"),
3036
4155
  onClick: () => setIsOpen((value) => !value),
@@ -3052,7 +4171,7 @@ function Thinking({ part, thinkingLabel = "Thinking…", completedLabel = "Thoug
3052
4171
  /* @__PURE__ */ jsx("span", {
3053
4172
  className: "sr-only",
3054
4173
  "aria-live": "polite",
3055
- children: isStreaming ? "Thinking in progress" : "Thinking complete"
4174
+ children: isStreaming ? copy.thinkingInProgress : copy.thinkingComplete
3056
4175
  }),
3057
4176
  hasContent && isOpen ? /* @__PURE__ */ jsx("p", {
3058
4177
  id: contentId,
@@ -3137,6 +4256,7 @@ function getMessageTextAlignmentClassName(role) {
3137
4256
  return role === "user" ? "text-right" : "text-left";
3138
4257
  }
3139
4258
  function renderPart(part, index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName) {
4259
+ const copy = getUiCopy(locale);
3140
4260
  if (part.type === "text") {
3141
4261
  if (renderText) return /* @__PURE__ */ jsx("div", { children: renderText(part, {
3142
4262
  message,
@@ -3156,7 +4276,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
3156
4276
  className: "block w-fit rounded-lg border border-slate-200 bg-white p-2",
3157
4277
  children: [/* @__PURE__ */ jsx("img", {
3158
4278
  src: part.url,
3159
- alt: title || "Uploaded image",
4279
+ alt: title || copy.uploadedImage,
3160
4280
  className: "max-h-56 rounded-md object-contain"
3161
4281
  }), title ? /* @__PURE__ */ jsx("p", {
3162
4282
  className: "mt-2 max-w-xs truncate text-xs font-medium text-slate-700",
@@ -3165,7 +4285,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
3165
4285
  }, `image-${index}`);
3166
4286
  }
3167
4287
  if (part.type === "input_file") {
3168
- const fileName = part.metadata?.originalFileName || part.title || getFilenameFromUrl(part.fileUrl) || "Document";
4288
+ const fileName = part.metadata?.originalFileName || part.title || getFilenameFromUrl(part.fileUrl) || copy.document;
3169
4289
  const extension = getDisplayExtension(fileName);
3170
4290
  return /* @__PURE__ */ jsxs("a", {
3171
4291
  href: part.fileUrl,
@@ -3174,7 +4294,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
3174
4294
  className: "flex w-fit items-center gap-3 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-left",
3175
4295
  children: [/* @__PURE__ */ jsx("span", {
3176
4296
  className: "rounded bg-slate-900 px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-white",
3177
- children: extension ?? "File"
4297
+ children: extension ?? copy.file
3178
4298
  }), /* @__PURE__ */ jsxs("div", {
3179
4299
  className: "min-w-0",
3180
4300
  children: [/* @__PURE__ */ jsx("p", {
@@ -3202,7 +4322,8 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
3202
4322
  return /* @__PURE__ */ jsx(Thinking, {
3203
4323
  part,
3204
4324
  thinkingLabel,
3205
- completedLabel: completedThinkingLabel
4325
+ completedLabel: completedThinkingLabel,
4326
+ locale
3206
4327
  }, `thinking-${index}`);
3207
4328
  }
3208
4329
  if (part.type === "guardrail") return /* @__PURE__ */ jsx("p", {
@@ -3250,7 +4371,8 @@ function aggregateSourceToolParts(parts, position) {
3250
4371
  ...remainingParts.slice(insertionIndex)
3251
4372
  ];
3252
4373
  }
3253
- 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 = "Read more", readLessLabel = "Read less", className,...props }) {
4374
+ 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 }) {
4375
+ const copy = getUiCopy(locale);
3254
4376
  const [isExpanded, setIsExpanded] = useState(false);
3255
4377
  const textContent = useMemo(() => message.parts.filter((part) => part.type === "text").map((part) => part.text).join("\n"), [message.parts]);
3256
4378
  const canCollapse = message.role === "user" && message.parts.every((part) => part.type === "text") && textContent.length > collapseThreshold;
@@ -3284,7 +4406,7 @@ function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD,
3284
4406
  type: "button",
3285
4407
  className: "text-xs font-medium text-slate-600 hover:text-slate-900",
3286
4408
  onClick: () => setIsExpanded((previous) => !previous),
3287
- children: isExpanded ? readLessLabel : readMoreLabel
4409
+ children: isExpanded ? readLessLabel ?? copy.readLess : readMoreLabel ?? copy.readMore
3288
4410
  }) : null]
3289
4411
  });
3290
4412
  }
@@ -3433,7 +4555,10 @@ async function writeTextToClipboard(text$1) {
3433
4555
  textarea.remove();
3434
4556
  }
3435
4557
  }
3436
- function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel = "Copy", copiedLabel = "Copied", children, className, disabled, onClick, type = "button",...props }) {
4558
+ function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel, copiedLabel, locale, children, className, disabled, onClick, type = "button",...props }) {
4559
+ const copy = getUiCopy(locale);
4560
+ const resolvedCopyLabel = copyLabel ?? copy.copy;
4561
+ const resolvedCopiedLabel = copiedLabel ?? copy.copied;
3437
4562
  const [isCopied, setIsCopied] = useState(false);
3438
4563
  const [isCopying, setIsCopying] = useState(false);
3439
4564
  const timeoutRef = useRef();
@@ -3464,7 +4589,7 @@ function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel = "Co
3464
4589
  };
3465
4590
  return /* @__PURE__ */ jsxs("button", {
3466
4591
  type,
3467
- "aria-label": isCopied ? copiedLabel : copyLabel,
4592
+ "aria-label": isCopied ? resolvedCopiedLabel : resolvedCopyLabel,
3468
4593
  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),
3469
4594
  disabled: disabled || isCopying,
3470
4595
  onClick: handleClick,
@@ -3478,7 +4603,7 @@ function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel = "Co
3478
4603
  }), /* @__PURE__ */ jsx("span", {
3479
4604
  className: "sr-only",
3480
4605
  "aria-live": "polite",
3481
- children: isCopied ? copiedLabel : copyLabel
4606
+ children: isCopied ? resolvedCopiedLabel : resolvedCopyLabel
3482
4607
  })]
3483
4608
  });
3484
4609
  }
@@ -3497,9 +4622,9 @@ function ThumbButton({ label, icon, className, type = "button",...props }) {
3497
4622
  })]
3498
4623
  });
3499
4624
  }
3500
- function ThumbUp({ label = "Rate positively",...props }) {
4625
+ function ThumbUp({ label, locale,...props }) {
3501
4626
  return /* @__PURE__ */ jsx(ThumbButton, {
3502
- label,
4627
+ label: label ?? getUiCopy(locale).ratePositively,
3503
4628
  icon: /* @__PURE__ */ jsx(ThumbsUp, {
3504
4629
  className: "size-4",
3505
4630
  "aria-hidden": "true"
@@ -3507,9 +4632,9 @@ function ThumbUp({ label = "Rate positively",...props }) {
3507
4632
  ...props
3508
4633
  });
3509
4634
  }
3510
- function ThumbDown({ label = "Rate negatively",...props }) {
4635
+ function ThumbDown({ label, locale,...props }) {
3511
4636
  return /* @__PURE__ */ jsx(ThumbButton, {
3512
- label,
4637
+ label: label ?? getUiCopy(locale).rateNegatively,
3513
4638
  icon: /* @__PURE__ */ jsx(ThumbsDown, {
3514
4639
  className: "size-4",
3515
4640
  "aria-hidden": "true"
@@ -3520,10 +4645,11 @@ function ThumbDown({ label = "Rate negatively",...props }) {
3520
4645
 
3521
4646
  //#endregion
3522
4647
  //#region src/components/reload.tsx
3523
- function Reload({ label = "Retry response", className, type = "button",...props }) {
4648
+ function Reload({ label, locale, className, type = "button",...props }) {
4649
+ const resolvedLabel = label ?? getUiCopy(locale).retryResponse;
3524
4650
  return /* @__PURE__ */ jsxs("button", {
3525
4651
  type,
3526
- "aria-label": label,
4652
+ "aria-label": resolvedLabel,
3527
4653
  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),
3528
4654
  ...props,
3529
4655
  children: [/* @__PURE__ */ jsx(RotateCcw, {
@@ -3531,7 +4657,7 @@ function Reload({ label = "Retry response", className, type = "button",...props
3531
4657
  "aria-hidden": "true"
3532
4658
  }), /* @__PURE__ */ jsx("span", {
3533
4659
  className: "sr-only",
3534
- children: label
4660
+ children: resolvedLabel
3535
4661
  })]
3536
4662
  });
3537
4663
  }
@@ -3585,7 +4711,7 @@ function partitionPromptFormFiles(files) {
3585
4711
 
3586
4712
  //#endregion
3587
4713
  //#region src/components/prompt-form/prompt-form-attach-button.tsx
3588
- function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, accept = PROMPT_FORM_FILE_ACCEPT, disabled = false, label = "Attach file",...props }) {
4714
+ function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, locale, accept = PROMPT_FORM_FILE_ACCEPT, disabled = false, label,...props }) {
3589
4715
  const fileInputRef = useRef(null);
3590
4716
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
3591
4717
  ref: fileInputRef,
@@ -3601,7 +4727,7 @@ function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, accept = PROM
3601
4727
  }
3602
4728
  }), /* @__PURE__ */ jsx(PromptFormIconButton, {
3603
4729
  type: "button",
3604
- "aria-label": label,
4730
+ "aria-label": label ?? getUiCopy(locale).attachFile,
3605
4731
  disabled,
3606
4732
  onClick: () => fileInputRef.current?.click(),
3607
4733
  ...props,
@@ -3630,7 +4756,16 @@ function PromptFormIconButton({ className, type = "button",...props }) {
3630
4756
  ...props
3631
4757
  });
3632
4758
  }
3633
- 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 }) {
4759
+ 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 }) {
4760
+ const copy = getUiCopy(locale);
4761
+ const placeholder = placeholderProp ?? copy.typeMessage;
4762
+ const sendLabel = sendLabelProp ?? copy.send;
4763
+ const stopLabel = stopLabelProp ?? copy.stop;
4764
+ const attachLabel = attachLabelProp ?? copy.attachFile;
4765
+ const removeFileLabel = removeFileLabelProp ?? copy.removeFile;
4766
+ const uploadingLabel = uploadingLabelProp ?? copy.uploading;
4767
+ const processingUploadLabel = processingUploadLabelProp ?? copy.processingUpload;
4768
+ const uploadErrorLabel = uploadErrorLabelProp ?? copy.uploadFailed;
3634
4769
  const textareaRef = useRef(null);
3635
4770
  const [internalFiles, setInternalFiles] = useState([]);
3636
4771
  const [isSubmitting, setIsSubmitting] = useState(false);
@@ -3747,15 +4882,9 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", uploadSt
3747
4882
  children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
3748
4883
  })]
3749
4884
  }, `${file.name}-${file.lastModified}-${index}`))
3750
- }), isUploading && uploadState ? /* @__PURE__ */ jsxs("div", {
3751
- className: "space-y-1.5 px-4 pb-3",
3752
- children: [/* @__PURE__ */ jsxs("div", {
3753
- className: "flex items-center justify-between gap-3 text-xs text-neutral-500",
3754
- children: [/* @__PURE__ */ jsxs("span", {
3755
- className: "truncate",
3756
- children: [uploadState.status === "processing" ? processingUploadLabel : uploadingLabel, uploadState.fileName ? `: ${uploadState.fileName}` : ""]
3757
- }), /* @__PURE__ */ jsxs("span", { children: [Math.round(uploadState.progress), "%"] })]
3758
- }), /* @__PURE__ */ jsx("div", {
4885
+ }), isUploading && uploadState ? /* @__PURE__ */ jsx("div", {
4886
+ className: "px-4 pb-3",
4887
+ children: /* @__PURE__ */ jsx("div", {
3759
4888
  role: "progressbar",
3760
4889
  tabIndex: 0,
3761
4890
  "aria-label": uploadState.status === "processing" ? processingUploadLabel : uploadingLabel,
@@ -3767,7 +4896,7 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", uploadSt
3767
4896
  className: "h-full rounded-full bg-neutral-900 transition-[width] duration-150",
3768
4897
  style: { width: `${uploadState.progress}%` }
3769
4898
  })
3770
- })]
4899
+ })
3771
4900
  }) : uploadState?.status === "error" ? /* @__PURE__ */ jsx("p", {
3772
4901
  className: "px-4 pb-3 text-xs text-red-600",
3773
4902
  children: uploadErrorLabel
@@ -3954,7 +5083,8 @@ function useSpeechToText({ transcribe, onTranscriptionComplete, onTranscriptionE
3954
5083
  async function missingTranscribe() {
3955
5084
  throw new Error("SpeechToTextToggle requires transcribe when no controller is provided.");
3956
5085
  }
3957
- 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 }) {
5086
+ function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscriptionError, transcribe, locale, disabled = false, label, listeningLabel, cancelLabel, requestingLabel, loadingLabel, cancelOnClickWhileRecording = false, className, onClick,...props }) {
5087
+ const copy = getUiCopy(locale);
3958
5088
  const internalController = useSpeechToText({
3959
5089
  transcribe: transcribe ?? missingTranscribe,
3960
5090
  onTranscriptionComplete,
@@ -3965,7 +5095,7 @@ function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscripti
3965
5095
  const isListening = speechToText.status === "recording";
3966
5096
  const isTranscribing = speechToText.status === "transcribing";
3967
5097
  const cancelsRecording = isListening && cancelOnClickWhileRecording;
3968
- const ariaLabel = isRequesting ? requestingLabel : isTranscribing ? loadingLabel : cancelsRecording ? cancelLabel : isListening ? listeningLabel : label;
5098
+ const ariaLabel = isRequesting ? requestingLabel ?? copy.requestingMicrophoneAccess : isTranscribing ? loadingLabel ?? copy.transcribing : cancelsRecording ? cancelLabel ?? copy.cancelRecording : isListening ? listeningLabel ?? copy.stopRecording : label ?? copy.voiceInput;
3969
5099
  return /* @__PURE__ */ jsx(PromptFormIconButton, {
3970
5100
  type: "button",
3971
5101
  "aria-label": ariaLabel,