@plaisolutions/react 0.12.0 → 0.13.1

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