@maggioli-rd/aicore-agent-chat 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -14
- package/dist/aicore-agent-chat.js +141 -48
- package/dist/aicore-agent-chat.js.map +1 -1
- package/dist/bundle/a2ui-C-LAbJcp.js +87 -0
- package/dist/bundle/backstage-Bfl3Tyo5.js +86 -0
- package/dist/chunks/{a2ui-BLaPxJ9N.js → a2ui-Da_YceSP.js} +4 -4
- package/dist/chunks/{a2ui-BLaPxJ9N.js.map → a2ui-Da_YceSP.js.map} +1 -1
- package/dist/chunks/backstage-TkKENlNl.js +1008 -0
- package/dist/chunks/backstage-TkKENlNl.js.map +1 -0
- package/dist/chunks/{core-Db3hnKpM.js → core-4PRAI1Mt.js} +60 -5
- package/dist/chunks/core-4PRAI1Mt.js.map +1 -0
- package/dist/chunks/{rich-C2iN_5zh.js → rich-CdNA4NuG.js} +4 -4
- package/dist/chunks/rich-CdNA4NuG.js.map +1 -0
- package/dist/chunks/{src-Blgo9nVC.js → src-PkQozp4M.js} +369 -82
- package/dist/chunks/src-PkQozp4M.js.map +1 -0
- package/dist/chunks/{vega-BkX1Fjq6.js → vega-B07F6TI4.js} +2 -2
- package/dist/chunks/{vega-BkX1Fjq6.js.map → vega-B07F6TI4.js.map} +1 -1
- package/dist/core.js +1 -1
- package/dist/define.js +3 -3
- package/dist/index.js +3 -3
- package/dist/types/core/session.d.ts +31 -0
- package/dist/types/element/backstage/index.d.ts +10 -0
- package/dist/types/element/backstage/log.d.ts +13 -0
- package/dist/types/element/backstage/map.d.ts +12 -0
- package/dist/types/element/backstage/timing.d.ts +51 -0
- package/dist/types/element/i18n.d.ts +48 -4
- package/dist/types/element/icons.d.ts +3 -0
- package/dist/types/element/index.d.ts +15 -5
- package/dist/types/element/rich/index.d.ts +6 -0
- package/dist/types/element/styles.d.ts +1 -1
- package/dist/types/element/team.d.ts +14 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/jsx.d.ts +1 -1
- package/package.json +2 -2
- package/dist/bundle/a2ui-C3GhjTrJ.js +0 -113
- package/dist/chunks/core-Db3hnKpM.js.map +0 -1
- package/dist/chunks/rich-C2iN_5zh.js.map +0 -1
- package/dist/chunks/src-Blgo9nVC.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as keepDrawings, o as
|
|
1
|
+
import { E as isRecord, m as turnErrorText, n as CHAT_CHANGE, s as AICORE_EVENTS, t as AicoreChatSession } from "./core-4PRAI1Mt.js";
|
|
2
|
+
import { a as keepDrawings, o as lazy, r as enhance, s as updateInterfaces, t as disposeDrawings } from "./rich-CdNA4NuG.js";
|
|
3
3
|
import { a as sanitizeHtml, s as trustedHtml } from "./sanitize-COLQzplk.js";
|
|
4
4
|
import { Marked } from "marked";
|
|
5
5
|
// src/element/markdown.ts
|
|
@@ -106,8 +106,6 @@ var it = {
|
|
|
106
106
|
deleteConversation: (title) => `Elimina «${title}»`,
|
|
107
107
|
confirmDelete: (title) => `Eliminare la conversazione «${title}»?`,
|
|
108
108
|
confirmDeleteShort: "Elimina?",
|
|
109
|
-
ask: (agent) => `Chiedi a ${agent}`,
|
|
110
|
-
askGeneric: "Come posso esserti utile?",
|
|
111
109
|
noAgent: "Nessun agente indicato.",
|
|
112
110
|
notConnected: "Chat non configurata.",
|
|
113
111
|
placeholder: "Scrivi un messaggio",
|
|
@@ -130,7 +128,6 @@ var it = {
|
|
|
130
128
|
interrupted: "Risposta interrotta.",
|
|
131
129
|
turnFailed: "L'agente non è riuscito a rispondere.",
|
|
132
130
|
trace: (id) => `Traccia ${id}`,
|
|
133
|
-
disclaimer: "Le risposte sono generate da un'intelligenza artificiale e possono contenere errori: verifica sempre le informazioni.",
|
|
134
131
|
dismiss: "Chiudi",
|
|
135
132
|
you: "Tu",
|
|
136
133
|
agent: "Agente",
|
|
@@ -148,7 +145,6 @@ var it = {
|
|
|
148
145
|
retryIn: (seconds) => `Riprova tra ${seconds} s.`,
|
|
149
146
|
developer: "Sviluppatore",
|
|
150
147
|
requests: "Richieste",
|
|
151
|
-
events: (tokens) => `Eventi dell'ultimo turno · ${tokens} token`,
|
|
152
148
|
lastError: "Ultimo errore",
|
|
153
149
|
renewed: "token rinnovato",
|
|
154
150
|
publishedVersion: "Versione pubblicata",
|
|
@@ -165,7 +161,61 @@ var it = {
|
|
|
165
161
|
close: "Chiudi",
|
|
166
162
|
a2uiAction: (action) => `Azione ${action}`,
|
|
167
163
|
yes: "sì",
|
|
168
|
-
no: "no"
|
|
164
|
+
no: "no",
|
|
165
|
+
backstage: "Dietro le quinte",
|
|
166
|
+
backstageToggle: "Mostra o nascondi Dietro le quinte",
|
|
167
|
+
backstageLog: "Registro",
|
|
168
|
+
backstageMap: "Mappa",
|
|
169
|
+
backstageViews: "Vista di Dietro le quinte",
|
|
170
|
+
noEvents: "Nessun evento: compaiono dopo il primo messaggio.",
|
|
171
|
+
turnHeader: (turn, time) => `Turno ${turn} · ${time}`,
|
|
172
|
+
modelWait: "in attesa del modello",
|
|
173
|
+
turnDone: (duration) => `Turno concluso in ${duration}`,
|
|
174
|
+
turnStopped: (duration) => `Turno interrotto dopo ${duration}`,
|
|
175
|
+
turnCanceled: "Turno interrotto",
|
|
176
|
+
tools: "Strumenti",
|
|
177
|
+
modelTime: "Attesa del modello",
|
|
178
|
+
modelCalls: "Chiamate al modello",
|
|
179
|
+
answerTime: "Risposta",
|
|
180
|
+
inputTokens: "Token in ingresso",
|
|
181
|
+
outputTokens: "Token in uscita",
|
|
182
|
+
fromCache: (count) => `${count} dalla cache`,
|
|
183
|
+
mainAgent: "Agente principale",
|
|
184
|
+
limitReached: (limit) => `Limite raggiunto: ${limit}`,
|
|
185
|
+
limitNames: {
|
|
186
|
+
iterazioni: "iterazioni",
|
|
187
|
+
timeout: "tempo",
|
|
188
|
+
deleghe: "deleghe"
|
|
189
|
+
},
|
|
190
|
+
limitHint: "Puoi alzarlo in Configurazione › Limiti per risposta.",
|
|
191
|
+
calls: "chiama",
|
|
192
|
+
answers: "risponde a",
|
|
193
|
+
expand: "Espandi",
|
|
194
|
+
collapse: "Comprimi",
|
|
195
|
+
memberKinds: {
|
|
196
|
+
orchestrator: "Agente principale",
|
|
197
|
+
subagent: "Sottoagente",
|
|
198
|
+
platform_agent: "Agente pubblicato",
|
|
199
|
+
external_a2a: "Agente esterno A2A",
|
|
200
|
+
extra: "Non nella versione mostrata"
|
|
201
|
+
},
|
|
202
|
+
noTurn: "Nessun turno: la mappa si accende al primo messaggio.",
|
|
203
|
+
turnRunning: (turn, clock) => `Turno ${turn} · ${clock}`,
|
|
204
|
+
turnEnded: (turn) => `Turno ${turn} · concluso`,
|
|
205
|
+
turnInterrupted: (turn) => `Turno ${turn} · interrotto`,
|
|
206
|
+
teamAtWork: (used, total) => `${used} ${used === 1 ? "membro" : "membri"} su ${total} al lavoro`,
|
|
207
|
+
delegations: (count) => `${count} ${count === 1 ? "delega" : "deleghe"}`,
|
|
208
|
+
toolCalls: (count) => `${count} ${count === 1 ? "chiamata" : "chiamate"} a strumenti`,
|
|
209
|
+
statusFailed: "Turno interrotto",
|
|
210
|
+
statusWaiting: (names) => `Attende ${names}`,
|
|
211
|
+
statusTool: (names) => `Usa ${names}`,
|
|
212
|
+
statusExternal: "Al lavoro, all’esterno",
|
|
213
|
+
statusWriting: "Scrive la risposta",
|
|
214
|
+
statusThinking: "Ragiona",
|
|
215
|
+
statusDoneOnce: (duration) => `Fatto in ${duration}`,
|
|
216
|
+
statusDoneTimes: (times, duration) => `Fatto ${times} volte · ${duration}`,
|
|
217
|
+
statusUnused: "Non usato in questo turno",
|
|
218
|
+
and: "e"
|
|
169
219
|
};
|
|
170
220
|
var en = {
|
|
171
221
|
locale: "en-GB",
|
|
@@ -183,8 +233,6 @@ var en = {
|
|
|
183
233
|
deleteConversation: (title) => `Delete “${title}”`,
|
|
184
234
|
confirmDelete: (title) => `Delete the conversation “${title}”?`,
|
|
185
235
|
confirmDeleteShort: "Delete?",
|
|
186
|
-
ask: (agent) => `Ask ${agent}`,
|
|
187
|
-
askGeneric: "How can I help?",
|
|
188
236
|
noAgent: "No agent set.",
|
|
189
237
|
notConnected: "Chat not configured.",
|
|
190
238
|
placeholder: "Write a message",
|
|
@@ -207,7 +255,6 @@ var en = {
|
|
|
207
255
|
interrupted: "Answer stopped.",
|
|
208
256
|
turnFailed: "The agent could not answer.",
|
|
209
257
|
trace: (id) => `Trace ${id}`,
|
|
210
|
-
disclaimer: "Answers are generated by AI and may contain mistakes: always check the information.",
|
|
211
258
|
dismiss: "Dismiss",
|
|
212
259
|
you: "You",
|
|
213
260
|
agent: "Agent",
|
|
@@ -225,7 +272,6 @@ var en = {
|
|
|
225
272
|
retryIn: (seconds) => `Try again in ${seconds} s.`,
|
|
226
273
|
developer: "Developer",
|
|
227
274
|
requests: "Requests",
|
|
228
|
-
events: (tokens) => `Events of the last turn · ${tokens} tokens`,
|
|
229
275
|
lastError: "Last error",
|
|
230
276
|
renewed: "token renewed",
|
|
231
277
|
publishedVersion: "Published version",
|
|
@@ -242,7 +288,61 @@ var en = {
|
|
|
242
288
|
close: "Close",
|
|
243
289
|
a2uiAction: (action) => `Action ${action}`,
|
|
244
290
|
yes: "yes",
|
|
245
|
-
no: "no"
|
|
291
|
+
no: "no",
|
|
292
|
+
backstage: "Behind the scenes",
|
|
293
|
+
backstageToggle: "Show or hide Behind the scenes",
|
|
294
|
+
backstageLog: "Log",
|
|
295
|
+
backstageMap: "Map",
|
|
296
|
+
backstageViews: "Behind the scenes view",
|
|
297
|
+
noEvents: "No events: they appear after the first message.",
|
|
298
|
+
turnHeader: (turn, time) => `Turn ${turn} · ${time}`,
|
|
299
|
+
modelWait: "waiting for the model",
|
|
300
|
+
turnDone: (duration) => `Turn ended in ${duration}`,
|
|
301
|
+
turnStopped: (duration) => `Turn stopped after ${duration}`,
|
|
302
|
+
turnCanceled: "Turn stopped",
|
|
303
|
+
tools: "Tools",
|
|
304
|
+
modelTime: "Waiting for the model",
|
|
305
|
+
modelCalls: "Model calls",
|
|
306
|
+
answerTime: "Answer",
|
|
307
|
+
inputTokens: "Input tokens",
|
|
308
|
+
outputTokens: "Output tokens",
|
|
309
|
+
fromCache: (count) => `${count} from cache`,
|
|
310
|
+
mainAgent: "Main agent",
|
|
311
|
+
limitReached: (limit) => `Limit reached: ${limit}`,
|
|
312
|
+
limitNames: {
|
|
313
|
+
iterazioni: "iterations",
|
|
314
|
+
timeout: "time",
|
|
315
|
+
deleghe: "delegations"
|
|
316
|
+
},
|
|
317
|
+
limitHint: "You can raise it in Configuration › Limits per answer.",
|
|
318
|
+
calls: "calls",
|
|
319
|
+
answers: "answers",
|
|
320
|
+
expand: "Expand",
|
|
321
|
+
collapse: "Collapse",
|
|
322
|
+
memberKinds: {
|
|
323
|
+
orchestrator: "Main agent",
|
|
324
|
+
subagent: "Subagent",
|
|
325
|
+
platform_agent: "Published agent",
|
|
326
|
+
external_a2a: "External A2A agent",
|
|
327
|
+
extra: "Not in the version shown"
|
|
328
|
+
},
|
|
329
|
+
noTurn: "No turn: the map lights up at the first message.",
|
|
330
|
+
turnRunning: (turn, clock) => `Turn ${turn} · ${clock}`,
|
|
331
|
+
turnEnded: (turn) => `Turn ${turn} · ended`,
|
|
332
|
+
turnInterrupted: (turn) => `Turn ${turn} · stopped`,
|
|
333
|
+
teamAtWork: (used, total) => `${used} of ${total} ${total === 1 ? "member" : "members"} at work`,
|
|
334
|
+
delegations: (count) => `${count} ${count === 1 ? "delegation" : "delegations"}`,
|
|
335
|
+
toolCalls: (count) => `${count} tool ${count === 1 ? "call" : "calls"}`,
|
|
336
|
+
statusFailed: "Turn stopped",
|
|
337
|
+
statusWaiting: (names) => `Waiting for ${names}`,
|
|
338
|
+
statusTool: (names) => `Using ${names}`,
|
|
339
|
+
statusExternal: "At work, outside",
|
|
340
|
+
statusWriting: "Writing the answer",
|
|
341
|
+
statusThinking: "Thinking",
|
|
342
|
+
statusDoneOnce: (duration) => `Done in ${duration}`,
|
|
343
|
+
statusDoneTimes: (times, duration) => `Done ${times} times · ${duration}`,
|
|
344
|
+
statusUnused: "Not used in this turn",
|
|
345
|
+
and: "and"
|
|
246
346
|
};
|
|
247
347
|
/** The language the element speaks for `lang`: Italian for `it…` or no
|
|
248
348
|
* language at all, English for any other language. */
|
|
@@ -270,6 +370,8 @@ function stringsOf(lang, overrides) {
|
|
|
270
370
|
// src/element/icons.ts
|
|
271
371
|
var PATHS = {
|
|
272
372
|
add: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",
|
|
373
|
+
arrowUp: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z",
|
|
374
|
+
sparkles: "M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12l-5.5-2.5zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25L19 15z",
|
|
273
375
|
delete: "M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z",
|
|
274
376
|
send: "M2.01 21 23 12 2.01 3 2 10l15 2-15 2z",
|
|
275
377
|
stop: "M6 6h12v12H6z",
|
|
@@ -280,6 +382,7 @@ var PATHS = {
|
|
|
280
382
|
thumbDown: "M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm0 12-4.34 4.34L12 14H3v-2l3-7h9v10zm4-12h4v12h-4z",
|
|
281
383
|
close: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",
|
|
282
384
|
menu: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z",
|
|
385
|
+
panel: "M16 20H2V4h14v16zm2-12h4V4h-4v4zm0 12h4v-4h-4v4zm0-6h4v-4h-4v4z",
|
|
283
386
|
edit: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"
|
|
284
387
|
};
|
|
285
388
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
@@ -550,7 +653,7 @@ button:focus-visible, summary:focus-visible {
|
|
|
550
653
|
min-block-size: 0;
|
|
551
654
|
padding: 16px 12px;
|
|
552
655
|
border-inline-end: 1px solid var(--_border);
|
|
553
|
-
background: var(--
|
|
656
|
+
background: var(--_raised);
|
|
554
657
|
}
|
|
555
658
|
.main {
|
|
556
659
|
display: flex;
|
|
@@ -575,6 +678,65 @@ button:focus-visible, summary:focus-visible {
|
|
|
575
678
|
.rail-toggle { display: inline-flex; }
|
|
576
679
|
}
|
|
577
680
|
|
|
681
|
+
/* «Dietro le quinte» (the backstage attribute): a third column on a wide host, floating
|
|
682
|
+
over the chat on a narrower one, as the rail does. */
|
|
683
|
+
.layout.backstage-open {
|
|
684
|
+
grid-template-columns: minmax(200px, 260px) minmax(0, 1fr) minmax(300px, 400px);
|
|
685
|
+
}
|
|
686
|
+
.backstage {
|
|
687
|
+
display: flex;
|
|
688
|
+
flex-direction: column;
|
|
689
|
+
min-block-size: 0;
|
|
690
|
+
border-inline-start: 1px solid var(--_border);
|
|
691
|
+
background: var(--_bg);
|
|
692
|
+
}
|
|
693
|
+
.backstage-header {
|
|
694
|
+
display: flex;
|
|
695
|
+
align-items: center;
|
|
696
|
+
gap: 8px;
|
|
697
|
+
min-block-size: 60px;
|
|
698
|
+
padding: 8px 12px 8px 20px;
|
|
699
|
+
border-block-end: 1px solid var(--_border);
|
|
700
|
+
}
|
|
701
|
+
.backstage-title { margin: 0; font-size: 1em; font-weight: 600; }
|
|
702
|
+
.backstage-views {
|
|
703
|
+
display: inline-flex;
|
|
704
|
+
gap: 2px;
|
|
705
|
+
padding: 3px;
|
|
706
|
+
border-radius: 999px;
|
|
707
|
+
background: var(--_raised);
|
|
708
|
+
}
|
|
709
|
+
.backstage-view {
|
|
710
|
+
padding: 4px 12px;
|
|
711
|
+
border-radius: 999px;
|
|
712
|
+
color: var(--_muted);
|
|
713
|
+
font-size: calc(var(--_fs) * 13 / 15);
|
|
714
|
+
font-weight: 600;
|
|
715
|
+
}
|
|
716
|
+
.backstage-view[aria-pressed="true"] {
|
|
717
|
+
background: var(--_bg);
|
|
718
|
+
color: var(--_fg);
|
|
719
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
|
|
720
|
+
}
|
|
721
|
+
.backstage-header .icon-button { margin-inline-start: auto; }
|
|
722
|
+
.backstage-body { flex: 1; min-block-size: 0; overflow-y: auto; padding: 16px 20px; }
|
|
723
|
+
@container (max-width: 1100px) {
|
|
724
|
+
.layout.backstage-open {
|
|
725
|
+
grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
|
|
726
|
+
}
|
|
727
|
+
.backstage {
|
|
728
|
+
position: absolute;
|
|
729
|
+
inset-block: 0;
|
|
730
|
+
inset-inline-end: 0;
|
|
731
|
+
z-index: 2;
|
|
732
|
+
inline-size: min(400px, 90%);
|
|
733
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
@container (max-width: 720px) {
|
|
737
|
+
.layout.backstage-open { grid-template-columns: minmax(0, 1fr); }
|
|
738
|
+
}
|
|
739
|
+
|
|
578
740
|
/* ---- rail -------------------------------------------------------------- */
|
|
579
741
|
|
|
580
742
|
.new-conversation {
|
|
@@ -582,6 +744,7 @@ button:focus-visible, summary:focus-visible {
|
|
|
582
744
|
align-items: center;
|
|
583
745
|
justify-content: center;
|
|
584
746
|
gap: 8px;
|
|
747
|
+
min-block-size: 44px;
|
|
585
748
|
padding: 8px 12px;
|
|
586
749
|
border-radius: var(--_radius-sm);
|
|
587
750
|
background: var(--_accent);
|
|
@@ -653,16 +816,17 @@ button:focus-visible, summary:focus-visible {
|
|
|
653
816
|
display: flex;
|
|
654
817
|
align-items: center;
|
|
655
818
|
gap: 8px;
|
|
656
|
-
min-block-size:
|
|
657
|
-
padding: 8px 16px;
|
|
819
|
+
min-block-size: 60px;
|
|
820
|
+
padding: 8px 16px 8px 20px;
|
|
658
821
|
border-block-end: 1px solid var(--_border);
|
|
659
822
|
}
|
|
660
|
-
.
|
|
661
|
-
|
|
662
|
-
|
|
823
|
+
.conversation-title {
|
|
824
|
+
flex: 1;
|
|
825
|
+
min-inline-size: 0;
|
|
826
|
+
margin: 0;
|
|
663
827
|
overflow: hidden;
|
|
664
|
-
|
|
665
|
-
font-
|
|
828
|
+
font-size: calc(var(--_fs) * 17 / 15);
|
|
829
|
+
font-weight: 600;
|
|
666
830
|
text-overflow: ellipsis;
|
|
667
831
|
white-space: nowrap;
|
|
668
832
|
}
|
|
@@ -687,22 +851,44 @@ button:focus-visible, summary:focus-visible {
|
|
|
687
851
|
.thread {
|
|
688
852
|
display: flex;
|
|
689
853
|
flex-direction: column;
|
|
854
|
+
min-block-size: 100%;
|
|
690
855
|
gap: 20px;
|
|
691
856
|
max-inline-size: 760px;
|
|
692
857
|
margin-inline: auto;
|
|
693
858
|
padding: 20px 16px;
|
|
694
859
|
}
|
|
860
|
+
/* Prova's empty conversation: in the middle, the AI's sparkles in their
|
|
861
|
+
circle, the agent's name, its description. */
|
|
695
862
|
.empty {
|
|
696
863
|
display: flex;
|
|
864
|
+
flex: 1;
|
|
697
865
|
flex-direction: column;
|
|
698
866
|
align-items: center;
|
|
699
867
|
justify-content: center;
|
|
700
868
|
gap: 8px;
|
|
701
|
-
min-block-size: 40%;
|
|
702
869
|
padding: 32px 16px;
|
|
703
870
|
text-align: center;
|
|
704
871
|
}
|
|
705
|
-
.empty-
|
|
872
|
+
.empty-icon {
|
|
873
|
+
display: inline-flex;
|
|
874
|
+
align-items: center;
|
|
875
|
+
justify-content: center;
|
|
876
|
+
inline-size: 48px;
|
|
877
|
+
block-size: 48px;
|
|
878
|
+
margin-block-end: 4px;
|
|
879
|
+
border-radius: 50%;
|
|
880
|
+
background: var(--_accent-soft);
|
|
881
|
+
color: var(--_accent-fg);
|
|
882
|
+
}
|
|
883
|
+
.empty-icon .icon { inline-size: 24px; block-size: 24px; }
|
|
884
|
+
.empty-title {
|
|
885
|
+
margin: 0;
|
|
886
|
+
font-size: calc(var(--_fs) * 26 / 15);
|
|
887
|
+
font-weight: 700;
|
|
888
|
+
letter-spacing: -0.01em;
|
|
889
|
+
line-height: 1.2;
|
|
890
|
+
}
|
|
891
|
+
.empty-detail { max-inline-size: 560px; margin: 0; }
|
|
706
892
|
|
|
707
893
|
.message { display: flex; flex-direction: column; gap: 6px; }
|
|
708
894
|
.message.user { align-items: flex-end; }
|
|
@@ -822,6 +1008,8 @@ button:focus-visible, summary:focus-visible {
|
|
|
822
1008
|
|
|
823
1009
|
/* ---- composer ---------------------------------------------------------- */
|
|
824
1010
|
|
|
1011
|
+
/* Prova's composer: a card floating over the conversation, «+» to attach in
|
|
1012
|
+
a tinted square, the round send button with its arrow. */
|
|
825
1013
|
.composer {
|
|
826
1014
|
display: flex;
|
|
827
1015
|
flex-direction: column;
|
|
@@ -829,23 +1017,32 @@ button:focus-visible, summary:focus-visible {
|
|
|
829
1017
|
max-inline-size: 792px;
|
|
830
1018
|
inline-size: 100%;
|
|
831
1019
|
margin-inline: auto;
|
|
832
|
-
padding: 8px 16px
|
|
1020
|
+
padding: 8px 16px 20px;
|
|
833
1021
|
}
|
|
834
1022
|
.box {
|
|
835
1023
|
display: flex;
|
|
836
1024
|
align-items: flex-end;
|
|
837
|
-
gap:
|
|
838
|
-
padding:
|
|
1025
|
+
gap: 8px;
|
|
1026
|
+
padding: 8px;
|
|
839
1027
|
border: 1px solid var(--_border);
|
|
840
1028
|
border-radius: var(--_radius);
|
|
841
1029
|
background: var(--_bg);
|
|
1030
|
+
box-shadow: 0 2px 12px rgb(0 0 0 / 0.08);
|
|
842
1031
|
}
|
|
1032
|
+
.box .attach {
|
|
1033
|
+
inline-size: 40px;
|
|
1034
|
+
block-size: 40px;
|
|
1035
|
+
border-radius: var(--_radius-sm);
|
|
1036
|
+
background: var(--_accent-soft);
|
|
1037
|
+
color: var(--_accent-fg);
|
|
1038
|
+
}
|
|
1039
|
+
.box .attach:not(:disabled):hover { background: var(--_accent-soft); color: var(--_accent-fg); filter: brightness(0.96); }
|
|
843
1040
|
.box:focus-within { border-color: var(--_accent); box-shadow: 0 0 0 1px var(--_accent); }
|
|
844
1041
|
textarea {
|
|
845
1042
|
flex: 1;
|
|
846
|
-
min-block-size:
|
|
1043
|
+
min-block-size: 40px;
|
|
847
1044
|
max-block-size: 200px;
|
|
848
|
-
padding:
|
|
1045
|
+
padding: 9px 4px;
|
|
849
1046
|
border: 0;
|
|
850
1047
|
outline: none;
|
|
851
1048
|
resize: none;
|
|
@@ -858,14 +1055,13 @@ textarea {
|
|
|
858
1055
|
display: inline-flex;
|
|
859
1056
|
align-items: center;
|
|
860
1057
|
justify-content: center;
|
|
861
|
-
inline-size:
|
|
862
|
-
block-size:
|
|
1058
|
+
inline-size: 40px;
|
|
1059
|
+
block-size: 40px;
|
|
863
1060
|
border-radius: var(--_radius-sm);
|
|
864
1061
|
background: var(--_accent);
|
|
865
1062
|
color: var(--_on-accent);
|
|
866
1063
|
}
|
|
867
1064
|
.send:not(:disabled):hover { background: var(--_accent-hover); }
|
|
868
|
-
.footnote { margin: 0; color: var(--_muted); font-size: calc(var(--_fs) * 12 / 15); text-align: center; }
|
|
869
1065
|
|
|
870
1066
|
/* ---- developer --------------------------------------------------------- */
|
|
871
1067
|
|
|
@@ -887,6 +1083,8 @@ textarea {
|
|
|
887
1083
|
`;
|
|
888
1084
|
// src/element/index.ts
|
|
889
1085
|
var AICORE_AGENT_CHAT_TAG = "aicore-agent-chat";
|
|
1086
|
+
/** «Dietro le quinte»'s chunk: loaded when the panel first opens. */
|
|
1087
|
+
var backstage = lazy(() => import("./backstage-TkKENlNl.js"));
|
|
890
1088
|
/** What AI-CORE reads from a conversation's files. */
|
|
891
1089
|
var ACCEPT = ".pdf,.docx,.txt,.md,.html,.xlsx,.epub";
|
|
892
1090
|
/** The client's events the element re-dispatches as they are. Its own
|
|
@@ -901,6 +1099,8 @@ var PREVIEW_CHARS = 160;
|
|
|
901
1099
|
/** The streamed answer is re-rendered at most this often, in ms: its markdown
|
|
902
1100
|
* is parsed whole each time, so every frame would grow with the answer. */
|
|
903
1101
|
var LIVE_MS = 100;
|
|
1102
|
+
/** From this width «Dietro le quinte» is a column of its own (styles.ts). */
|
|
1103
|
+
var BACKSTAGE_COLUMN_PX = 1100;
|
|
904
1104
|
/** How close to the bottom the transcript still follows new text, in px. */
|
|
905
1105
|
var STICK_PX = 48;
|
|
906
1106
|
/** How long the delete button waits for its second click, in ms. */
|
|
@@ -915,7 +1115,8 @@ var UPGRADED = [
|
|
|
915
1115
|
"conversation",
|
|
916
1116
|
"developer",
|
|
917
1117
|
"copyAnswer",
|
|
918
|
-
"
|
|
1118
|
+
"backstage",
|
|
1119
|
+
"team"
|
|
919
1120
|
];
|
|
920
1121
|
var Base = typeof HTMLElement === "undefined" ? class {} : HTMLElement;
|
|
921
1122
|
var sheet;
|
|
@@ -965,23 +1166,6 @@ function sourcePlace(t, source) {
|
|
|
965
1166
|
if (source.part != null) return t.part(source.part);
|
|
966
1167
|
return "";
|
|
967
1168
|
}
|
|
968
|
-
function eventLine(event, start) {
|
|
969
|
-
const offset = start === null ? "" : `+${((event.at - start) / 1e3).toFixed(1)}s`;
|
|
970
|
-
const fields = isRecord(event.data) ? event.data : {};
|
|
971
|
-
let preview = typeof fields.name === "string" ? `${typeof fields.node === "string" ? `${fields.node} → ` : ""}${fields.name}` : "";
|
|
972
|
-
if (!preview) try {
|
|
973
|
-
preview = JSON.stringify(event.data) ?? "";
|
|
974
|
-
} catch {
|
|
975
|
-
preview = "";
|
|
976
|
-
}
|
|
977
|
-
if (preview.length > PREVIEW_CHARS) preview = `${preview.slice(0, PREVIEW_CHARS)}…`;
|
|
978
|
-
return [
|
|
979
|
-
offset,
|
|
980
|
-
event.kind,
|
|
981
|
-
event.id ? `#${event.id}` : "",
|
|
982
|
-
preview
|
|
983
|
-
].filter(Boolean).join(" ");
|
|
984
|
-
}
|
|
985
1169
|
/** The user rated an answer and nothing else changed in it. */
|
|
986
1170
|
function onlyRatingChanged(before, after) {
|
|
987
1171
|
if (before.role !== "assistant" || after.role !== "assistant") return false;
|
|
@@ -1003,8 +1187,9 @@ function setRating(node, rating) {
|
|
|
1003
1187
|
* workspace, sent as `X-Tenant`), `conversation` (to open), `lang` (`it`,
|
|
1004
1188
|
* `en`; else the page's language). What the console's Prova chat does not
|
|
1005
1189
|
* have is off unless the host sets its boolean attribute: `developer`
|
|
1006
|
-
* (
|
|
1007
|
-
* each answer)
|
|
1190
|
+
* (API, tenant, agent version, last error, requests), `copy-answer` (a copy
|
|
1191
|
+
* button under each answer), `backstage` («Dietro le quinte», the turns'
|
|
1192
|
+
* events, as the console shows them).
|
|
1008
1193
|
* Properties: `getToken({ retry })`, `strings` (text overrides), `context`
|
|
1009
1194
|
* (the page's data, sent with every message), `state`.
|
|
1010
1195
|
* Events (bubbling, composed): `aicore-conversation`, `aicore-turn`,
|
|
@@ -1019,7 +1204,7 @@ var AicoreAgentChat = class extends Base {
|
|
|
1019
1204
|
"lang",
|
|
1020
1205
|
"developer",
|
|
1021
1206
|
"copy-answer",
|
|
1022
|
-
"
|
|
1207
|
+
"backstage"
|
|
1023
1208
|
];
|
|
1024
1209
|
#getToken = null;
|
|
1025
1210
|
#overrides = null;
|
|
@@ -1046,11 +1231,17 @@ var AicoreAgentChat = class extends Base {
|
|
|
1046
1231
|
#liveTurn = null;
|
|
1047
1232
|
#liveAt = 0;
|
|
1048
1233
|
#liveTimer = false;
|
|
1049
|
-
#eventsHeading = null;
|
|
1050
1234
|
#pendingAgent = false;
|
|
1051
1235
|
#pendingConversation = false;
|
|
1052
1236
|
#targetQueued = false;
|
|
1053
1237
|
#railOpen = false;
|
|
1238
|
+
/** «Dietro le quinte» shown, with `backstage`. At first, open as in Prova
|
|
1239
|
+
* when the element is wide enough for a third column; then as the user
|
|
1240
|
+
* leaves it. */
|
|
1241
|
+
#backstageOpen = true;
|
|
1242
|
+
#backstageChosen = false;
|
|
1243
|
+
#backstageView = "log";
|
|
1244
|
+
#team = null;
|
|
1054
1245
|
#stick = true;
|
|
1055
1246
|
#ui;
|
|
1056
1247
|
constructor() {
|
|
@@ -1071,12 +1262,36 @@ var AicoreAgentChat = class extends Base {
|
|
|
1071
1262
|
}, newButton, railStatus, conversations);
|
|
1072
1263
|
const railToggle = iconButton("menu", "", { "data-action": "toggle-rail" });
|
|
1073
1264
|
railToggle.classList.add("rail-toggle");
|
|
1074
|
-
const
|
|
1075
|
-
const
|
|
1265
|
+
const title = h("h2", { class: "conversation-title" });
|
|
1266
|
+
const backstageToggle = iconButton("panel", "", {
|
|
1267
|
+
"data-action": "toggle-backstage",
|
|
1268
|
+
"aria-pressed": "true"
|
|
1269
|
+
}, "backstage-toggle");
|
|
1076
1270
|
const header = h("header", {
|
|
1077
1271
|
class: "header",
|
|
1078
1272
|
part: "header"
|
|
1079
|
-
}, railToggle,
|
|
1273
|
+
}, railToggle, title, backstageToggle);
|
|
1274
|
+
const backstageTitle = h("h2", { class: "backstage-title" });
|
|
1275
|
+
const viewButton = (view) => h("button", {
|
|
1276
|
+
class: "backstage-view",
|
|
1277
|
+
attrs: {
|
|
1278
|
+
type: "button",
|
|
1279
|
+
"data-action": "backstage-view",
|
|
1280
|
+
"data-view": view
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
const backstageLog = viewButton("log");
|
|
1284
|
+
const backstageMap = viewButton("map");
|
|
1285
|
+
const backstageViews = h("div", {
|
|
1286
|
+
class: "backstage-views",
|
|
1287
|
+
attrs: { role: "group" }
|
|
1288
|
+
}, backstageLog, backstageMap);
|
|
1289
|
+
const backstageClose = iconButton("close", "", { "data-action": "toggle-backstage" });
|
|
1290
|
+
const backstageBody = h("div", { class: "backstage-body" });
|
|
1291
|
+
const backstage = h("aside", {
|
|
1292
|
+
class: "backstage",
|
|
1293
|
+
part: "backstage"
|
|
1294
|
+
}, h("div", { class: "backstage-header" }, backstageTitle, backstageViews, backstageClose), backstageBody);
|
|
1080
1295
|
const bannerTitle = h("strong");
|
|
1081
1296
|
const bannerDetail = h("span", { class: "small" });
|
|
1082
1297
|
const dismiss = iconButton("close", "", { "data-action": "dismiss" });
|
|
@@ -1087,7 +1302,8 @@ var AicoreAgentChat = class extends Base {
|
|
|
1087
1302
|
}, h("div", { class: "banner-text" }, bannerTitle, bannerDetail), dismiss);
|
|
1088
1303
|
banner.hidden = true;
|
|
1089
1304
|
const emptyTitle = h("p", { class: "empty-title" });
|
|
1090
|
-
const
|
|
1305
|
+
const emptyDetail = h("p", { class: "empty-detail muted" });
|
|
1306
|
+
const empty = h("div", { class: "empty" }, h("span", { class: "empty-icon" }, icon("sparkles")), emptyTitle, emptyDetail);
|
|
1091
1307
|
const loading = h("p", { class: "status" });
|
|
1092
1308
|
const messages = h("div", { class: "messages" });
|
|
1093
1309
|
const liveAnswer = h("div", { class: "answer markdown" });
|
|
@@ -1117,7 +1333,7 @@ var AicoreAgentChat = class extends Base {
|
|
|
1117
1333
|
accept: ACCEPT
|
|
1118
1334
|
} });
|
|
1119
1335
|
fileInput.hidden = true;
|
|
1120
|
-
const attach = iconButton("
|
|
1336
|
+
const attach = iconButton("add", "", { "data-action": "attach" }, "attach");
|
|
1121
1337
|
const input = h("textarea", {
|
|
1122
1338
|
part: "input",
|
|
1123
1339
|
attrs: { rows: "1" }
|
|
@@ -1126,7 +1342,7 @@ var AicoreAgentChat = class extends Base {
|
|
|
1126
1342
|
class: "send",
|
|
1127
1343
|
part: "send",
|
|
1128
1344
|
attrs: { type: "submit" }
|
|
1129
|
-
}, icon("
|
|
1345
|
+
}, icon("arrowUp"));
|
|
1130
1346
|
const stop = h("button", {
|
|
1131
1347
|
class: "send",
|
|
1132
1348
|
part: "stop",
|
|
@@ -1135,18 +1351,17 @@ var AicoreAgentChat = class extends Base {
|
|
|
1135
1351
|
"data-action": "stop"
|
|
1136
1352
|
}
|
|
1137
1353
|
}, icon("stop"));
|
|
1138
|
-
const footnote = h("p", { class: "footnote" });
|
|
1139
1354
|
const composer = h("form", {
|
|
1140
1355
|
class: "composer",
|
|
1141
1356
|
part: "composer"
|
|
1142
|
-
}, files, h("div", { class: "box" }, attach, input, send, stop),
|
|
1357
|
+
}, files, h("div", { class: "box" }, attach, input, send, stop), fileInput);
|
|
1143
1358
|
const developerSummary = h("summary");
|
|
1144
1359
|
const developerBody = h("div");
|
|
1145
1360
|
const developer = h("details", {
|
|
1146
1361
|
class: "developer",
|
|
1147
1362
|
part: "developer"
|
|
1148
1363
|
}, developerSummary, developerBody);
|
|
1149
|
-
const layout = h("div", { class: "layout" }, rail, h("section", { class: "main" }, header, banner, transcript, composer, developer));
|
|
1364
|
+
const layout = h("div", { class: "layout" }, rail, h("section", { class: "main" }, header, banner, transcript, composer, developer), backstage);
|
|
1150
1365
|
const shared = styleSheet();
|
|
1151
1366
|
if (shared) root.adoptedStyleSheets = [shared];
|
|
1152
1367
|
else root.append(h("style", { text: STYLES }));
|
|
@@ -1158,9 +1373,16 @@ var AicoreAgentChat = class extends Base {
|
|
|
1158
1373
|
railStatus,
|
|
1159
1374
|
conversations,
|
|
1160
1375
|
railToggle,
|
|
1161
|
-
|
|
1162
|
-
agentDescription,
|
|
1376
|
+
title,
|
|
1163
1377
|
banner,
|
|
1378
|
+
backstageToggle,
|
|
1379
|
+
backstage,
|
|
1380
|
+
backstageTitle,
|
|
1381
|
+
backstageViews,
|
|
1382
|
+
backstageLog,
|
|
1383
|
+
backstageMap,
|
|
1384
|
+
backstageClose,
|
|
1385
|
+
backstageBody,
|
|
1164
1386
|
bannerTitle,
|
|
1165
1387
|
bannerDetail,
|
|
1166
1388
|
dismiss,
|
|
@@ -1168,6 +1390,7 @@ var AicoreAgentChat = class extends Base {
|
|
|
1168
1390
|
thread,
|
|
1169
1391
|
empty,
|
|
1170
1392
|
emptyTitle,
|
|
1393
|
+
emptyDetail,
|
|
1171
1394
|
loading,
|
|
1172
1395
|
messages,
|
|
1173
1396
|
live,
|
|
@@ -1179,7 +1402,6 @@ var AicoreAgentChat = class extends Base {
|
|
|
1179
1402
|
input,
|
|
1180
1403
|
send,
|
|
1181
1404
|
stop,
|
|
1182
|
-
footnote,
|
|
1183
1405
|
developer,
|
|
1184
1406
|
developerSummary,
|
|
1185
1407
|
developerBody
|
|
@@ -1255,6 +1477,18 @@ var AicoreAgentChat = class extends Base {
|
|
|
1255
1477
|
this.#contextChanged = true;
|
|
1256
1478
|
this.#scheduleRender();
|
|
1257
1479
|
}
|
|
1480
|
+
/** The agent's team, for «Dietro le quinte › Mappa» (with `backstage`):
|
|
1481
|
+
* the main agent and its members, as the agent's configuration has them,
|
|
1482
|
+
* which the user's token does not read. Without it the panel shows the
|
|
1483
|
+
* Registro only. */
|
|
1484
|
+
get team() {
|
|
1485
|
+
return this.#team;
|
|
1486
|
+
}
|
|
1487
|
+
set team(value) {
|
|
1488
|
+
this.#team = Array.isArray(value) ? value : null;
|
|
1489
|
+
if (!this.#team) this.#backstageView = "log";
|
|
1490
|
+
this.#scheduleRender(true);
|
|
1491
|
+
}
|
|
1258
1492
|
get baseUrl() {
|
|
1259
1493
|
return this.getAttribute("base-url");
|
|
1260
1494
|
}
|
|
@@ -1293,12 +1527,14 @@ var AicoreAgentChat = class extends Base {
|
|
|
1293
1527
|
set copyAnswer(value) {
|
|
1294
1528
|
this.toggleAttribute("copy-answer", Boolean(value));
|
|
1295
1529
|
}
|
|
1296
|
-
/**
|
|
1297
|
-
|
|
1298
|
-
|
|
1530
|
+
/** «Dietro le quinte»: the side panel with the turns' events, as the
|
|
1531
|
+
* console's Prova shows it. Not a developer tool, but off by default: the
|
|
1532
|
+
* AI-CORE console sets it, other hosts do not. */
|
|
1533
|
+
get backstage() {
|
|
1534
|
+
return this.hasAttribute("backstage");
|
|
1299
1535
|
}
|
|
1300
|
-
set
|
|
1301
|
-
this.toggleAttribute("
|
|
1536
|
+
set backstage(value) {
|
|
1537
|
+
this.toggleAttribute("backstage", Boolean(value));
|
|
1302
1538
|
}
|
|
1303
1539
|
/** The chat's current state (read-only), or null until it is configured. */
|
|
1304
1540
|
get state() {
|
|
@@ -1462,6 +1698,15 @@ var AicoreAgentChat = class extends Base {
|
|
|
1462
1698
|
case "toggle-rail":
|
|
1463
1699
|
this.#railOpen = !this.#railOpen;
|
|
1464
1700
|
break;
|
|
1701
|
+
case "backstage-view":
|
|
1702
|
+
this.#backstageView = target.dataset.view === "map" ? "map" : "log";
|
|
1703
|
+
this.#scheduleRender(true);
|
|
1704
|
+
break;
|
|
1705
|
+
case "toggle-backstage":
|
|
1706
|
+
this.#backstageOpen = !this.#backstageOpen;
|
|
1707
|
+
this.#backstageChosen = true;
|
|
1708
|
+
this.#scheduleRender(true);
|
|
1709
|
+
break;
|
|
1465
1710
|
case "dismiss":
|
|
1466
1711
|
session?.dismissError();
|
|
1467
1712
|
break;
|
|
@@ -1648,7 +1893,7 @@ var AicoreAgentChat = class extends Base {
|
|
|
1648
1893
|
const changed = (...keys) => prev === null || state === null || keys.some((k) => prev[k] !== state[k]);
|
|
1649
1894
|
if (prev === null) this.#renderStatic(t);
|
|
1650
1895
|
if (busyChanged || changed("conversations", "activeId", "conversationsLoading", "conversationsFailed", "agentId")) this.#renderRail(t, state, busy);
|
|
1651
|
-
if (changed("agent", "agentId")) this.#renderHeader(t, state);
|
|
1896
|
+
if (changed("agent", "agentId", "activeId", "conversations")) this.#renderHeader(t, state);
|
|
1652
1897
|
if (changed("error")) this.#renderBanner(t, state);
|
|
1653
1898
|
if (changed("messages", "loadingHistory", "agent")) this.#renderMessages(t, state, prev === null || changed("agent"));
|
|
1654
1899
|
if (busyChanged || changed("messages", "files", "uploading", "agentId")) {
|
|
@@ -1659,6 +1904,7 @@ var AicoreAgentChat = class extends Base {
|
|
|
1659
1904
|
});
|
|
1660
1905
|
}
|
|
1661
1906
|
this.#renderLive(t, state, prev === null);
|
|
1907
|
+
if (prev === null || changed("log", "turn")) this.#renderBackstage(t, state);
|
|
1662
1908
|
this.#renderEmpty(t, state);
|
|
1663
1909
|
if (busyChanged || changed("files", "agentId")) this.#renderComposer(t, state, busy);
|
|
1664
1910
|
const developer = this.hasAttribute("developer");
|
|
@@ -1666,7 +1912,6 @@ var AicoreAgentChat = class extends Base {
|
|
|
1666
1912
|
const contextChanged = this.#contextChanged;
|
|
1667
1913
|
this.#contextChanged = false;
|
|
1668
1914
|
if (developer && (contextChanged || changed("requests", "events", "error", "agent", "activeId"))) this.#renderDeveloper(t, state);
|
|
1669
|
-
else if (developer && changed("tokens") && this.#eventsHeading && state) this.#eventsHeading.textContent = t.events(state.tokens);
|
|
1670
1915
|
this.#ui.layout.classList.toggle("rail-open", this.#railOpen);
|
|
1671
1916
|
if (this.#stick) this.#ui.transcript.scrollTop = this.#ui.transcript.scrollHeight;
|
|
1672
1917
|
}
|
|
@@ -1674,20 +1919,24 @@ var AicoreAgentChat = class extends Base {
|
|
|
1674
1919
|
const ui = this.#ui;
|
|
1675
1920
|
ui.rail.setAttribute("aria-label", t.conversations);
|
|
1676
1921
|
ui.newButton.replaceChildren(icon("add"), t.newConversation);
|
|
1922
|
+
ui.backstageTitle.textContent = t.backstage;
|
|
1923
|
+
ui.backstageLog.textContent = t.backstageLog;
|
|
1924
|
+
ui.backstageMap.textContent = t.backstageMap;
|
|
1925
|
+
ui.backstageViews.setAttribute("aria-label", t.backstageViews);
|
|
1677
1926
|
for (const [button, label] of [
|
|
1678
1927
|
[ui.railToggle, t.conversations],
|
|
1679
1928
|
[ui.dismiss, t.dismiss],
|
|
1680
1929
|
[ui.attach, t.attach],
|
|
1681
1930
|
[ui.send, t.send],
|
|
1682
|
-
[ui.stop, t.stop]
|
|
1931
|
+
[ui.stop, t.stop],
|
|
1932
|
+
[ui.backstageToggle, t.backstageToggle],
|
|
1933
|
+
[ui.backstageClose, t.backstageToggle]
|
|
1683
1934
|
]) {
|
|
1684
1935
|
button.setAttribute("aria-label", label);
|
|
1685
1936
|
button.title = label;
|
|
1686
1937
|
}
|
|
1687
1938
|
ui.input.placeholder = t.placeholder;
|
|
1688
1939
|
ui.input.setAttribute("aria-label", t.placeholder);
|
|
1689
|
-
ui.footnote.textContent = t.disclaimer;
|
|
1690
|
-
ui.footnote.hidden = !t.disclaimer || this.hasAttribute("no-disclaimer");
|
|
1691
1940
|
ui.loading.textContent = t.loadingHistory;
|
|
1692
1941
|
ui.developerSummary.textContent = t.developer;
|
|
1693
1942
|
}
|
|
@@ -1762,10 +2011,9 @@ var AicoreAgentChat = class extends Base {
|
|
|
1762
2011
|
return item;
|
|
1763
2012
|
}
|
|
1764
2013
|
#renderHeader(t, state) {
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1767
|
-
ui.
|
|
1768
|
-
ui.agentDescription.hidden = !state?.agent?.description;
|
|
2014
|
+
const active = state?.activeId ?? null;
|
|
2015
|
+
const conversation = active ? state?.conversations.find((c) => c.id === active) : void 0;
|
|
2016
|
+
this.#ui.title.textContent = !state?.agentId ? "" : active === null ? t.newConversation : (conversation?.title ?? "") || t.untitled;
|
|
1769
2017
|
}
|
|
1770
2018
|
#renderBanner(t, state) {
|
|
1771
2019
|
const ui = this.#ui;
|
|
@@ -1920,12 +2168,52 @@ var AicoreAgentChat = class extends Base {
|
|
|
1920
2168
|
ui.liveAnswer.hidden = !turn.text;
|
|
1921
2169
|
setMarkdown(ui.liveAnswer, turn.text, this.#rich(true, true));
|
|
1922
2170
|
}
|
|
2171
|
+
/** «Dietro le quinte», with `backstage` and while open. */
|
|
2172
|
+
#renderBackstage(t, state) {
|
|
2173
|
+
const ui = this.#ui;
|
|
2174
|
+
const on = this.hasAttribute("backstage");
|
|
2175
|
+
if (on && !this.#backstageChosen) {
|
|
2176
|
+
const width = this.getBoundingClientRect().width;
|
|
2177
|
+
this.#backstageOpen = width === 0 || width > BACKSTAGE_COLUMN_PX;
|
|
2178
|
+
}
|
|
2179
|
+
const open = on && this.#backstageOpen;
|
|
2180
|
+
ui.backstageToggle.hidden = !on;
|
|
2181
|
+
ui.backstageToggle.setAttribute("aria-pressed", String(open));
|
|
2182
|
+
ui.backstage.hidden = !open;
|
|
2183
|
+
ui.layout.classList.toggle("backstage-open", open);
|
|
2184
|
+
const team = this.#team;
|
|
2185
|
+
const view = team ? this.#backstageView : "log";
|
|
2186
|
+
ui.backstageMap.hidden = !team;
|
|
2187
|
+
ui.backstageLog.setAttribute("aria-pressed", String(view === "log"));
|
|
2188
|
+
ui.backstageMap.setAttribute("aria-pressed", String(view === "map"));
|
|
2189
|
+
if (!open || !state) return;
|
|
2190
|
+
const turn = state.turn;
|
|
2191
|
+
const input = {
|
|
2192
|
+
view,
|
|
2193
|
+
team,
|
|
2194
|
+
agentName: state.agent?.name ?? state.agentId ?? "",
|
|
2195
|
+
working: turn !== null,
|
|
2196
|
+
log: state.log,
|
|
2197
|
+
live: turn && state.turnStartedAt !== null ? {
|
|
2198
|
+
label: turn.activity ?? t.thinking,
|
|
2199
|
+
since: state.turnStartedAt
|
|
2200
|
+
} : null,
|
|
2201
|
+
strings: t,
|
|
2202
|
+
locale: t.locale
|
|
2203
|
+
};
|
|
2204
|
+
const ready = backstage.get();
|
|
2205
|
+
if (ready) ready.drawBackstage(ui.backstageBody, input);
|
|
2206
|
+
else backstage.load().then(() => this.#scheduleRender(true), () => void 0);
|
|
2207
|
+
}
|
|
1923
2208
|
#renderEmpty(t, state) {
|
|
1924
2209
|
const ui = this.#ui;
|
|
1925
2210
|
const empty = state === null || !state.loadingHistory && state.messages.length === 0 && !state.turn;
|
|
1926
2211
|
ui.empty.hidden = !empty;
|
|
1927
2212
|
if (!empty) return;
|
|
1928
|
-
ui.emptyTitle.textContent = state === null ? t.notConnected : !state.agentId ? t.noAgent : state.agent
|
|
2213
|
+
ui.emptyTitle.textContent = state === null ? t.notConnected : !state.agentId ? t.noAgent : state.agent?.name ?? "";
|
|
2214
|
+
const detail = state?.agentId ? state.agent?.description ?? "" : "";
|
|
2215
|
+
ui.emptyDetail.textContent = detail;
|
|
2216
|
+
ui.emptyDetail.hidden = !detail;
|
|
1929
2217
|
}
|
|
1930
2218
|
#renderComposer(t, state, busy) {
|
|
1931
2219
|
const ui = this.#ui;
|
|
@@ -1991,8 +2279,7 @@ var AicoreAgentChat = class extends Base {
|
|
|
1991
2279
|
["error_description", error.authDescription ?? t.none],
|
|
1992
2280
|
["X-Request-Id", error.requestId ?? t.none]
|
|
1993
2281
|
]));
|
|
1994
|
-
|
|
1995
|
-
parts.push(this.#eventsHeading, h("ol", { class: "log" }, ...[...state.events].reverse().map((e) => h("li", { text: eventLine(e, state.turnStartedAt) }))), h("h4", { text: t.requests }), h("ol", { class: "log" }, ...state.requests.map((r) => h("li", {
|
|
2282
|
+
parts.push(h("h4", { text: t.requests }), h("ol", { class: "log" }, ...state.requests.map((r) => h("li", {
|
|
1996
2283
|
class: r.status === 0 || r.status >= 400 ? "bad" : "",
|
|
1997
2284
|
text: `${r.status} ${r.method} ${r.path} · ${r.durationMs} ms` + (r.retriedWithFreshToken ? ` · ${t.renewed}` : "") + (r.requestId ? ` · ${r.requestId}` : "")
|
|
1998
2285
|
}))));
|
|
@@ -2006,4 +2293,4 @@ function defineAicoreAgentChat(tag = AICORE_AGENT_CHAT_TAG) {
|
|
|
2006
2293
|
}
|
|
2007
2294
|
export { parseA2uiMessages as a, setMarkdown as c, formatA2uiAction as i, AicoreAgentChat as n, sentValuesOf as o, defineAicoreAgentChat as r, surfaceIdsOf as s, AICORE_AGENT_CHAT_TAG as t };
|
|
2008
2295
|
|
|
2009
|
-
//# sourceMappingURL=src-
|
|
2296
|
+
//# sourceMappingURL=src-PkQozp4M.js.map
|