@maggioli-rd/aicore-agent-chat 1.2.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.
Files changed (146) hide show
  1. package/README.md +36 -18
  2. package/dist/aicore-agent-chat.js +164 -53
  3. package/dist/aicore-agent-chat.js.map +1 -1
  4. package/dist/bundle/a2ui-C-LAbJcp.js +87 -0
  5. package/dist/bundle/abnfDiagram-S7VZAUFO-DxkzIS8G.js +1 -0
  6. package/dist/bundle/architecture-WOLXFQ4H-BXMyXdT1.js +1 -0
  7. package/dist/bundle/architectureDiagram-YGSQEFNW-BmsDn6Ho.js +36 -0
  8. package/dist/bundle/backstage-Bfl3Tyo5.js +86 -0
  9. package/dist/bundle/blockDiagram-APKKGZFW-bG_MVPzT.js +140 -0
  10. package/dist/bundle/bpmnIcons-APHXDYXF-C0jbCElo.js +1 -0
  11. package/dist/bundle/c4Diagram-KJ2TOQU5-BVad-wQe.js +38 -0
  12. package/dist/bundle/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  13. package/dist/bundle/chunk-5VM5RSS4-CwNG0iBi.js +15 -0
  14. package/dist/bundle/chunk-6MUBBAK2-CeH4cZO-.js +2 -0
  15. package/dist/bundle/chunk-AXFCVDMN-D0Vqm50X.js +62 -0
  16. package/dist/bundle/chunk-BG4553SI-DUBI9JbR.js +127 -0
  17. package/dist/bundle/chunk-DQASFODM-DBWVlIjs.js +10 -0
  18. package/dist/bundle/chunk-DUW6YSOI-ChybIQ82.js +1 -0
  19. package/dist/bundle/chunk-HFQBQIA3-D2xPptW8.js +1 -0
  20. package/dist/bundle/chunk-J5ZVWO5B-DHB__t6z.js +1 -0
  21. package/dist/bundle/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  22. package/dist/bundle/chunk-KQLB2F66-BRGnyo9e.js +1 -0
  23. package/dist/bundle/chunk-KS47KZWR-DV3Gxewa.js +1 -0
  24. package/dist/bundle/chunk-LEVMRMFU-BdDTT4pw.js +1 -0
  25. package/dist/bundle/chunk-M57EVK23-BRqFqW5o.js +1 -0
  26. package/dist/bundle/chunk-NGNAAXSQ-DreF1ykJ.js +214 -0
  27. package/dist/bundle/chunk-OY52VR5R-BamrP8d_.js +88 -0
  28. package/dist/bundle/chunk-QB3YPZ4I-BqUUL29j.js +213 -0
  29. package/dist/bundle/chunk-R3KSYZAL-gmtEjdKU.js +1 -0
  30. package/dist/bundle/chunk-STOXU5M4-DdqxXfKq.js +72 -0
  31. package/dist/bundle/chunk-TU62E6Q5-B4GgWjUW.js +1 -0
  32. package/dist/bundle/chunk-X4PVCEUW-BcN5Aq5G.js +1 -0
  33. package/dist/bundle/chunk-XXDRQBXY-BIvjAdC_.js +1 -0
  34. package/dist/bundle/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  35. package/dist/bundle/classDiagram-v2-L25IHNXF-Dw7so3mk.js +217 -0
  36. package/dist/bundle/cose-bilkent-JH36ORCC-DUvnuVrm.js +1 -0
  37. package/dist/bundle/cynefin-EF2NZ3EQ-CcVPiRLN.js +1 -0
  38. package/dist/bundle/cynefinDiagram-L36ESFBY-eO6Z3Kvn.js +62 -0
  39. package/dist/bundle/cytoscape.esm-CsT4DLSP.js +321 -0
  40. package/dist/bundle/d3-hierarchy-i5r04UUG.js +1 -0
  41. package/dist/bundle/d3-scale-BEO6F4Sh.js +1 -0
  42. package/dist/bundle/d3-scale-chromatic-DhHjp77O.js +1 -0
  43. package/dist/bundle/d3-selection-CBFxn8wf.js +1 -0
  44. package/dist/bundle/d3-shape-v1Y4qR5e.js +1 -0
  45. package/dist/bundle/dagre-SPEB5RXH-ByBZqBaT.js +4 -0
  46. package/dist/bundle/diagram-3B7GL73J-BkQkIpxz.js +200 -0
  47. package/dist/bundle/diagram-DNEMPZML-DYthXzRv.js +24 -0
  48. package/dist/bundle/diagram-L3MUGCDN-D4DIzfHH.js +41 -0
  49. package/dist/bundle/diagram-LA4NIPWU-C2P-hZD1.js +24 -0
  50. package/dist/bundle/diagram-MHCOC4E2-BwauFnTV.js +3 -0
  51. package/dist/bundle/diagram-XPFHEONP-DC_v3Llc.js +30 -0
  52. package/dist/bundle/dist-CwuaKeLF.js +1 -0
  53. package/dist/bundle/ebnfDiagram-UZSYDL2S-CmwGlC8L.js +1 -0
  54. package/dist/bundle/elk-XV6XMXQE-CTlty3p3.js +27 -0
  55. package/dist/bundle/erDiagram-EYBAPDEH-Bu6phvJH.js +99 -0
  56. package/dist/bundle/eventmodeling-K75KTNOO-B1q0nOJE.js +1 -0
  57. package/dist/bundle/flowDiagram-MALGAFMO-D9D_AzXh.js +1 -0
  58. package/dist/bundle/ganttDiagram-23REXITY-COK7rxO4.js +292 -0
  59. package/dist/bundle/gitGraph-VSP46ZUC-DS7S_jKI.js +1 -0
  60. package/dist/bundle/gitGraphDiagram-STJD7YCW-DhVK8Hqh.js +106 -0
  61. package/dist/bundle/graphlib-Bgy7WbC7.js +1 -0
  62. package/dist/bundle/info-OHQRW6UA-BjEWvFlW.js +1 -0
  63. package/dist/bundle/infoDiagram-KBXO4MBG-Dg3zWdHP.js +2 -0
  64. package/dist/bundle/ishikawaDiagram-M35NCXHK-C2g8ghrV.js +70 -0
  65. package/dist/bundle/journeyDiagram-OPLOXDXO-DMZkL-i1.js +139 -0
  66. package/dist/bundle/kanban-definition-BZKZHSQY-Dr43IiJD.js +89 -0
  67. package/dist/bundle/katex-rAoShGnF.js +257 -0
  68. package/dist/bundle/math-Cx-Q-b8s.js +262 -0
  69. package/dist/bundle/mermaid-DaDuEHir.js +43 -0
  70. package/dist/bundle/mermaid-parser.core-Bv_Zx_ZE.js +6 -0
  71. package/dist/bundle/mindmap-definition-I2QAS2VK-BXCWJ_1R.js +98 -0
  72. package/dist/bundle/packet-JDAUHWVQ-CgB2qE5t.js +1 -0
  73. package/dist/bundle/pegDiagram-FD4XPPHP-CR58gOgF.js +1 -0
  74. package/dist/bundle/pie-XZMESJXO-CvXWTfIG.js +1 -0
  75. package/dist/bundle/pieDiagram-J4AKIIQI-D0GhbNJg.js +39 -0
  76. package/dist/bundle/quadrantDiagram-XTYBLID2-BKBEdwvC.js +7 -0
  77. package/dist/bundle/radar-ABXABTNO-8V_xx_AB.js +1 -0
  78. package/dist/bundle/railroad-I3PHUGI6-Bvb0GUva.js +1 -0
  79. package/dist/bundle/railroad-abnf-LNEFI6M7-D8xGcObq.js +1 -0
  80. package/dist/bundle/railroad-ebnf-DWYD2UWJ-Ch8wBawI.js +1 -0
  81. package/dist/bundle/railroad-peg-JR7BVNR7-CGndbjed.js +1 -0
  82. package/dist/bundle/railroadDiagram-MRQ6NCDL-DvqHkO2C.js +1 -0
  83. package/dist/bundle/requirementDiagram-Y7LWUY3S-bCLAM9sl.js +84 -0
  84. package/dist/bundle/rolldown-runtime-BNaE-Ejt.js +1 -0
  85. package/dist/bundle/rough.esm-Dy-Kn_BL.js +1 -0
  86. package/dist/bundle/sankeyDiagram-WGJFYUXA-8ehuPvHQ.js +40 -0
  87. package/dist/bundle/sequenceDiagram-5NDRBG5M-Cdg1YzMw.js +169 -0
  88. package/dist/bundle/sizeCapture-INFHLROL-Ct7XApxm.js +1 -0
  89. package/dist/bundle/stateDiagram-v2-FJ4FJNEA-B69v2YYC.js +291 -0
  90. package/dist/bundle/swimlanes-UMQ2AFYF-C_qI6rnK.js +1 -0
  91. package/dist/bundle/swimlanesDiagram-OMPLPG4O-CS11qSCX.js +8 -0
  92. package/dist/bundle/timeline-definition-SEUHKTQE-BCU0-H8D.js +120 -0
  93. package/dist/bundle/treeView-D4JQ5SDB-CpjURS-c.js +1 -0
  94. package/dist/bundle/treemap-SAJKECNS-CFFTaiIN.js +1 -0
  95. package/dist/bundle/usecaseDiagram-AFA6YXN4-46V1jsea.js +476 -0
  96. package/dist/bundle/vega-eBn1AexV.js +33 -0
  97. package/dist/bundle/vennDiagram-NNMJR3RB-q4Q4x2Q6.js +34 -0
  98. package/dist/bundle/wardley-7MLQ67FV-DhnATL7b.js +1 -0
  99. package/dist/bundle/wardleyDiagram-S7YFUSEH-BHIufnZW.js +78 -0
  100. package/dist/bundle/xychartDiagram-GGNKY7IX-CxAjpN3O.js +7 -0
  101. package/dist/chunks/a2ui-Da_YceSP.js +961 -0
  102. package/dist/chunks/a2ui-Da_YceSP.js.map +1 -0
  103. package/dist/chunks/backstage-TkKENlNl.js +1008 -0
  104. package/dist/chunks/backstage-TkKENlNl.js.map +1 -0
  105. package/dist/chunks/{core-Db3hnKpM.js → core-4PRAI1Mt.js} +60 -5
  106. package/dist/chunks/core-4PRAI1Mt.js.map +1 -0
  107. package/dist/chunks/math-D5IXRTov.js +86 -0
  108. package/dist/chunks/math-D5IXRTov.js.map +1 -0
  109. package/dist/chunks/mermaid-j9RNkOnL.js +197 -0
  110. package/dist/chunks/mermaid-j9RNkOnL.js.map +1 -0
  111. package/dist/chunks/rich-CdNA4NuG.js +156 -0
  112. package/dist/chunks/rich-CdNA4NuG.js.map +1 -0
  113. package/dist/chunks/sanitize-COLQzplk.js +240 -0
  114. package/dist/chunks/sanitize-COLQzplk.js.map +1 -0
  115. package/dist/chunks/{src-CYXMXds2.js → src-PkQozp4M.js} +725 -146
  116. package/dist/chunks/src-PkQozp4M.js.map +1 -0
  117. package/dist/chunks/vega-B07F6TI4.js +301 -0
  118. package/dist/chunks/vega-B07F6TI4.js.map +1 -0
  119. package/dist/core.js +1 -1
  120. package/dist/define.js +3 -3
  121. package/dist/index.js +3 -3
  122. package/dist/types/core/session.d.ts +31 -0
  123. package/dist/types/element/backstage/index.d.ts +10 -0
  124. package/dist/types/element/backstage/log.d.ts +13 -0
  125. package/dist/types/element/backstage/map.d.ts +12 -0
  126. package/dist/types/element/backstage/timing.d.ts +51 -0
  127. package/dist/types/element/i18n.d.ts +69 -6
  128. package/dist/types/element/icons.d.ts +3 -0
  129. package/dist/types/element/index.d.ts +15 -5
  130. package/dist/types/element/markdown.d.ts +6 -3
  131. package/dist/types/element/rich/a2ui-format.d.ts +45 -0
  132. package/dist/types/element/rich/a2ui-icons.d.ts +1 -0
  133. package/dist/types/element/rich/a2ui-views.d.ts +37 -0
  134. package/dist/types/element/rich/a2ui.d.ts +2 -0
  135. package/dist/types/element/rich/index.d.ts +72 -0
  136. package/dist/types/element/rich/math.d.ts +4 -0
  137. package/dist/types/element/rich/mermaid.d.ts +2 -0
  138. package/dist/types/element/rich/vega.d.ts +2 -0
  139. package/dist/types/element/sanitize.d.ts +34 -0
  140. package/dist/types/element/styles.d.ts +1 -1
  141. package/dist/types/element/team.d.ts +14 -0
  142. package/dist/types/index.d.ts +1 -0
  143. package/dist/types/jsx.d.ts +1 -1
  144. package/package.json +9 -3
  145. package/dist/chunks/core-Db3hnKpM.js.map +0 -1
  146. package/dist/chunks/src-CYXMXds2.js.map +0 -1
@@ -0,0 +1,301 @@
1
+ import { o as sanitizeNode } from "./sanitize-COLQzplk.js";
2
+ import { n as disposers } from "./rich-CdNA4NuG.js";
3
+ import { View, loader, parse } from "vega";
4
+ import { expressionInterpreter } from "vega-interpreter";
5
+ import { compile } from "vega-lite";
6
+ // src/element/rich/vega.ts
7
+ var ITALIAN_NUMBERS = {
8
+ decimal: ",",
9
+ thousands: ".",
10
+ grouping: [3],
11
+ currency: ["€ ", ""]
12
+ };
13
+ var ITALIAN_TIME = {
14
+ dateTime: "%A %e %B %Y, %X",
15
+ date: "%d/%m/%Y",
16
+ time: "%H:%M:%S",
17
+ periods: ["", ""],
18
+ days: [
19
+ "domenica",
20
+ "lunedì",
21
+ "martedì",
22
+ "mercoledì",
23
+ "giovedì",
24
+ "venerdì",
25
+ "sabato"
26
+ ],
27
+ shortDays: [
28
+ "dom",
29
+ "lun",
30
+ "mar",
31
+ "mer",
32
+ "gio",
33
+ "ven",
34
+ "sab"
35
+ ],
36
+ months: [
37
+ "gennaio",
38
+ "febbraio",
39
+ "marzo",
40
+ "aprile",
41
+ "maggio",
42
+ "giugno",
43
+ "luglio",
44
+ "agosto",
45
+ "settembre",
46
+ "ottobre",
47
+ "novembre",
48
+ "dicembre"
49
+ ],
50
+ shortMonths: [
51
+ "gen",
52
+ "feb",
53
+ "mar",
54
+ "apr",
55
+ "mag",
56
+ "giu",
57
+ "lug",
58
+ "ago",
59
+ "set",
60
+ "ott",
61
+ "nov",
62
+ "dic"
63
+ ]
64
+ };
65
+ /** The View's own locale, as the console's tables format: 2.000.000, 0,25,
66
+ * "lun 5". Set per View, never as Vega's default: the host may use Vega too.
67
+ * The View takes the definitions and builds the formatters (its typings say
68
+ * otherwise). */
69
+ function localeOf(lang) {
70
+ if (lang !== "it") return void 0;
71
+ return {
72
+ number: ITALIAN_NUMBERS,
73
+ time: ITALIAN_TIME
74
+ };
75
+ }
76
+ /** The console's chart theme. Passed to `compile`, which bakes it in. */
77
+ function configOf(t, font) {
78
+ return {
79
+ background: "transparent",
80
+ view: { stroke: "transparent" },
81
+ range: {
82
+ category: t.category,
83
+ ordinal: t.ordinal,
84
+ ramp: t.ramp,
85
+ heatmap: t.ramp
86
+ },
87
+ mark: { color: t.category[0] },
88
+ bar: { cornerRadiusEnd: 2 },
89
+ line: {
90
+ strokeWidth: 2.5,
91
+ strokeCap: "round",
92
+ strokeJoin: "round"
93
+ },
94
+ point: {
95
+ size: 50,
96
+ filled: true
97
+ },
98
+ area: { opacity: .65 },
99
+ geoshape: {
100
+ stroke: t.geoStroke,
101
+ strokeWidth: .8
102
+ },
103
+ axis: {
104
+ domainColor: t.muted,
105
+ ticks: false,
106
+ labelPadding: 6,
107
+ gridColor: t.rule,
108
+ gridOpacity: t.gridOpacity,
109
+ labelColor: t.muted,
110
+ labelFont: font,
111
+ labelFontSize: 12,
112
+ titleColor: t.ink,
113
+ titleFont: font
114
+ },
115
+ axisQuantitative: { tickCount: 5 },
116
+ axisY: { domain: false },
117
+ legend: {
118
+ labelColor: t.muted,
119
+ labelFont: font,
120
+ labelFontSize: 12,
121
+ titleColor: t.ink,
122
+ titleFont: font
123
+ },
124
+ title: {
125
+ color: t.ink,
126
+ font
127
+ },
128
+ text: {
129
+ color: t.ink,
130
+ font
131
+ },
132
+ rule: { color: t.muted }
133
+ };
134
+ }
135
+ var DARK = {
136
+ ink: "#FCFCFC",
137
+ muted: "#D3D3D3",
138
+ rule: "#404040",
139
+ geoStroke: "#404040",
140
+ gridOpacity: .6,
141
+ category: [
142
+ "#6E94DC",
143
+ "#A47EF8",
144
+ "#33C178",
145
+ "#F2B500",
146
+ "#F68E88",
147
+ "#3FB7E3",
148
+ "#F5A05A",
149
+ "#4FD1C5"
150
+ ],
151
+ ramp: [
152
+ "#0A1E45",
153
+ "#0446C3",
154
+ "#2467E7",
155
+ "#4A7EE0",
156
+ "#94ACDA",
157
+ "#BECADE",
158
+ "#E4E6EB"
159
+ ],
160
+ ordinal: [
161
+ "#BECADE",
162
+ "#6E94DC",
163
+ "#0446C3"
164
+ ]
165
+ };
166
+ var LIGHT = {
167
+ ink: "#050505",
168
+ muted: "#494949",
169
+ rule: "#DBDBDB",
170
+ geoStroke: "#C4C4C4",
171
+ gridOpacity: .7,
172
+ category: [
173
+ "#2467E7",
174
+ "#7E49F5",
175
+ "#008039",
176
+ "#8E6A00",
177
+ "#C44041",
178
+ "#0077A4",
179
+ "#C2410C",
180
+ "#0F766E"
181
+ ],
182
+ ramp: [
183
+ "#ECEDF0",
184
+ "#DCE0E7",
185
+ "#BAC5DB",
186
+ "#94ACDA",
187
+ "#4A7EE0",
188
+ "#2467E7",
189
+ "#052867"
190
+ ],
191
+ ordinal: [
192
+ "#052867",
193
+ "#2467E7",
194
+ "#94ACDA"
195
+ ]
196
+ };
197
+ /** A loader that loads nothing: data, images and links of a spec are
198
+ * refused before any request. Vega only warns when data does not load and
199
+ * draws an empty chart: a spec that asks for data or an image calls
200
+ * `onRefused`, to show its source instead. A link just does not open. */
201
+ function refusingLoader(onRefused) {
202
+ const refuse = (_uri, options) => {
203
+ if (options?.context !== "href") onRefused();
204
+ return Promise.reject(/* @__PURE__ */ new Error("Le risorse esterne non sono ammesse."));
205
+ };
206
+ const base = loader();
207
+ base.sanitize = refuse;
208
+ base.load = refuse;
209
+ base.http = () => refuse();
210
+ base.file = () => refuse();
211
+ return base;
212
+ }
213
+ /** A logger that reports Vega's errors (logged, never thrown) to `onError`
214
+ * and says nothing on the console. */
215
+ function quietLogger(onError) {
216
+ let level = 0;
217
+ const logger = {
218
+ level(value) {
219
+ if (value === void 0) return level;
220
+ level = value;
221
+ return logger;
222
+ },
223
+ error() {
224
+ onError();
225
+ return logger;
226
+ },
227
+ warn: () => logger,
228
+ info: () => logger,
229
+ debug: () => logger
230
+ };
231
+ return logger;
232
+ }
233
+ /** Specs that failed, so a re-render of the answer does not try them again. */
234
+ var failed = /* @__PURE__ */ new Set();
235
+ var LIMIT = 64;
236
+ function fail(key) {
237
+ failed.add(key);
238
+ if (failed.size > LIMIT) failed.delete(failed.values().next().value);
239
+ }
240
+ function sourceBlock(source) {
241
+ const pre = document.createElement("pre");
242
+ const code = document.createElement("code");
243
+ code.className = "language-vega-lite";
244
+ code.textContent = `${source}\n`;
245
+ pre.append(code);
246
+ return pre;
247
+ }
248
+ function draw(source, env) {
249
+ const key = `${env.dark}\n${env.font}\n${env.lang}\n${source}`;
250
+ if (failed.has(key)) return null;
251
+ let spec;
252
+ try {
253
+ const parsed = JSON.parse(source);
254
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
255
+ spec = parsed;
256
+ } catch {
257
+ return null;
258
+ }
259
+ let runtime;
260
+ try {
261
+ const config = configOf(env.dark ? DARK : LIGHT, env.font);
262
+ runtime = parse(compile(spec, { config }).spec, void 0, { ast: true });
263
+ } catch {
264
+ fail(key);
265
+ return null;
266
+ }
267
+ const box = document.createElement("div");
268
+ box.className = "chart";
269
+ let view = null;
270
+ let broken = false;
271
+ const breakDown = () => {
272
+ if (broken) return;
273
+ broken = true;
274
+ fail(key);
275
+ view?.finalize();
276
+ if (box.parentNode) box.replaceWith(sourceBlock(source));
277
+ };
278
+ disposers.set(box, () => view?.finalize());
279
+ try {
280
+ const formats = localeOf(env.lang);
281
+ view = new View(runtime, {
282
+ expr: expressionInterpreter,
283
+ renderer: "svg",
284
+ container: box,
285
+ hover: true,
286
+ loader: refusingLoader(breakDown),
287
+ logger: quietLogger(breakDown),
288
+ ...formats ? { locale: formats } : {}
289
+ });
290
+ view.runAsync().then(() => {
291
+ const svg = box.querySelector("svg");
292
+ if (svg) sanitizeNode(svg);
293
+ }, breakDown);
294
+ } catch {
295
+ breakDown();
296
+ }
297
+ return broken ? null : box;
298
+ }
299
+ export { draw };
300
+
301
+ //# sourceMappingURL=vega-B07F6TI4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vega-B07F6TI4.js","names":["vegaLoader"],"sources":["../../src/element/rich/vega.ts"],"sourcesContent":["import {\n type Loader,\n type LoggerInterface,\n loader as vegaLoader,\n parse,\n View,\n type ViewOptions,\n} from \"vega\";\nimport { expressionInterpreter } from \"vega-interpreter\";\nimport { compile, type Config, type TopLevelSpec } from \"vega-lite\";\n\nimport { sanitizeNode } from \"../sanitize\";\nimport { disposers, type Env } from \"./index\";\n\n// ```vega-lite fences, drawn as the console draws them (ui/chart.tsx,\n// lib/vega.ts): compiled with the console's two themes, run by a View of\n// our own so that an error Vega only logs still turns the chart back into\n// its source. A spec that is not JSON (a fence still streaming) or that Vega\n// refuses stays as source.\n//\n// A spec is declarative, but it can still reach out: `data.url`, an image\n// mark, an `href` channel. Here the loader refuses every URL, so a chart\n// draws only the data written in it, loads nothing and opens nothing (an\n// answer's URL can carry the conversation out). Expressions run on Vega's\n// interpreter, not `new Function`, so a CSP without `'unsafe-eval'` is fine;\n// the View draws with DOM calls and sets styles through CSSOM, and what it\n// drew goes through the sanitization of every drawing.\n\nconst ITALIAN_NUMBERS = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€ \", \"\"],\n};\n\nconst ITALIAN_TIME = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\n \"domenica\",\n \"lunedì\",\n \"martedì\",\n \"mercoledì\",\n \"giovedì\",\n \"venerdì\",\n \"sabato\",\n ],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mer\", \"gio\", \"ven\", \"sab\"],\n months: [\n \"gennaio\",\n \"febbraio\",\n \"marzo\",\n \"aprile\",\n \"maggio\",\n \"giugno\",\n \"luglio\",\n \"agosto\",\n \"settembre\",\n \"ottobre\",\n \"novembre\",\n \"dicembre\",\n ],\n shortMonths: [\n \"gen\",\n \"feb\",\n \"mar\",\n \"apr\",\n \"mag\",\n \"giu\",\n \"lug\",\n \"ago\",\n \"set\",\n \"ott\",\n \"nov\",\n \"dic\",\n ],\n};\n\n/** The View's own locale, as the console's tables format: 2.000.000, 0,25,\n * \"lun 5\". Set per View, never as Vega's default: the host may use Vega too.\n * The View takes the definitions and builds the formatters (its typings say\n * otherwise). */\nfunction localeOf(lang: string): ViewOptions[\"locale\"] {\n if (lang !== \"it\") return undefined;\n return {\n number: ITALIAN_NUMBERS,\n time: ITALIAN_TIME,\n } as unknown as ViewOptions[\"locale\"];\n}\n\ninterface Tokens {\n ink: string;\n muted: string;\n rule: string;\n geoStroke: string;\n gridOpacity: number;\n category: string[];\n ramp: string[];\n ordinal: string[];\n}\n\n/** The console's chart theme. Passed to `compile`, which bakes it in. */\nfunction configOf(t: Tokens, font: string): Config {\n return {\n background: \"transparent\",\n view: { stroke: \"transparent\" },\n range: {\n category: t.category,\n ordinal: t.ordinal,\n ramp: t.ramp,\n heatmap: t.ramp,\n },\n mark: { color: t.category[0] },\n bar: { cornerRadiusEnd: 2 },\n line: { strokeWidth: 2.5, strokeCap: \"round\", strokeJoin: \"round\" },\n point: { size: 50, filled: true },\n area: { opacity: 0.65 },\n geoshape: { stroke: t.geoStroke, strokeWidth: 0.8 },\n axis: {\n domainColor: t.muted,\n ticks: false,\n labelPadding: 6,\n gridColor: t.rule,\n gridOpacity: t.gridOpacity,\n labelColor: t.muted,\n labelFont: font,\n labelFontSize: 12,\n titleColor: t.ink,\n titleFont: font,\n },\n axisQuantitative: { tickCount: 5 },\n axisY: { domain: false },\n legend: {\n labelColor: t.muted,\n labelFont: font,\n labelFontSize: 12,\n titleColor: t.ink,\n titleFont: font,\n },\n title: { color: t.ink, font },\n text: { color: t.ink, font },\n rule: { color: t.muted },\n };\n}\n\nconst DARK: Tokens = {\n ink: \"#FCFCFC\",\n muted: \"#D3D3D3\",\n rule: \"#404040\",\n geoStroke: \"#404040\",\n gridOpacity: 0.6,\n category: [\n \"#6E94DC\",\n \"#A47EF8\",\n \"#33C178\",\n \"#F2B500\",\n \"#F68E88\",\n \"#3FB7E3\",\n \"#F5A05A\",\n \"#4FD1C5\",\n ],\n ramp: [\n \"#0A1E45\",\n \"#0446C3\",\n \"#2467E7\",\n \"#4A7EE0\",\n \"#94ACDA\",\n \"#BECADE\",\n \"#E4E6EB\",\n ],\n ordinal: [\"#BECADE\", \"#6E94DC\", \"#0446C3\"],\n};\n\nconst LIGHT: Tokens = {\n ink: \"#050505\",\n muted: \"#494949\",\n rule: \"#DBDBDB\",\n geoStroke: \"#C4C4C4\",\n gridOpacity: 0.7,\n category: [\n \"#2467E7\",\n \"#7E49F5\",\n \"#008039\",\n \"#8E6A00\",\n \"#C44041\",\n \"#0077A4\",\n \"#C2410C\",\n \"#0F766E\",\n ],\n ramp: [\n \"#ECEDF0\",\n \"#DCE0E7\",\n \"#BAC5DB\",\n \"#94ACDA\",\n \"#4A7EE0\",\n \"#2467E7\",\n \"#052867\",\n ],\n ordinal: [\"#052867\", \"#2467E7\", \"#94ACDA\"],\n};\n\n/** A loader that loads nothing: data, images and links of a spec are\n * refused before any request. Vega only warns when data does not load and\n * draws an empty chart: a spec that asks for data or an image calls\n * `onRefused`, to show its source instead. A link just does not open. */\nfunction refusingLoader(onRefused: () => void): Loader {\n const refuse = (_uri?: string, options?: { context?: string }) => {\n if (options?.context !== \"href\") onRefused();\n return Promise.reject(new Error(\"Le risorse esterne non sono ammesse.\"));\n };\n const base = vegaLoader();\n base.sanitize = refuse;\n base.load = refuse;\n base.http = () => refuse();\n base.file = () => refuse();\n return base;\n}\n\n/** A logger that reports Vega's errors (logged, never thrown) to `onError`\n * and says nothing on the console. */\nfunction quietLogger(onError: () => void): LoggerInterface {\n let level = 0;\n const logger = {\n level(value?: number) {\n if (value === undefined) return level;\n level = value;\n return logger;\n },\n error() {\n onError();\n return logger;\n },\n warn: () => logger,\n info: () => logger,\n debug: () => logger,\n };\n return logger;\n}\n\n/** Specs that failed, so a re-render of the answer does not try them again. */\nconst failed = new Set<string>();\nconst LIMIT = 64;\n\nfunction fail(key: string): void {\n failed.add(key);\n if (failed.size > LIMIT) failed.delete(failed.values().next().value!);\n}\n\nfunction sourceBlock(source: string): Element {\n const pre = document.createElement(\"pre\");\n const code = document.createElement(\"code\");\n code.className = \"language-vega-lite\";\n code.textContent = `${source}\\n`;\n pre.append(code);\n return pre;\n}\n\nexport function draw(source: string, env: Env): Element | null {\n const key = `${env.dark}\\n${env.font}\\n${env.lang}\\n${source}`;\n if (failed.has(key)) return null;\n let spec: TopLevelSpec;\n try {\n const parsed: unknown = JSON.parse(source);\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed))\n return null;\n spec = parsed as TopLevelSpec;\n } catch {\n // Not JSON yet: a fence still streaming, as a rule. Not remembered.\n return null;\n }\n\n let runtime;\n try {\n const config = configOf(env.dark ? DARK : LIGHT, env.font);\n runtime = parse(compile(spec, { config }).spec, undefined, { ast: true });\n } catch {\n fail(key);\n return null;\n }\n\n const box = document.createElement(\"div\");\n box.className = \"chart\";\n let view: View | null = null;\n let broken = false;\n const breakDown = () => {\n if (broken) return;\n broken = true;\n fail(key);\n view?.finalize();\n // Back to the source, where the chart was.\n if (box.parentNode) box.replaceWith(sourceBlock(source));\n };\n disposers.set(box, () => view?.finalize());\n\n try {\n const formats = localeOf(env.lang);\n view = new View(runtime, {\n expr: expressionInterpreter,\n renderer: \"svg\",\n container: box,\n hover: true,\n loader: refusingLoader(breakDown),\n logger: quietLogger(breakDown),\n ...(formats ? { locale: formats } : {}),\n });\n view.runAsync().then(() => {\n const svg = box.querySelector(\"svg\");\n if (svg) sanitizeNode(svg);\n }, breakDown);\n } catch {\n breakDown();\n }\n // A spec that asks for data at once has broken down already: never placed.\n return broken ? null : box;\n}\n"],"mappings":";;;;;;AA4BA,IAAM,kBAAkB;CACtB,SAAS;CACT,WAAW;CACX,UAAU,CAAC,CAAC;CACZ,UAAU,CAAC,MAAM,EAAE;AACrB;AAEA,IAAM,eAAe;CACnB,UAAU;CACV,MAAM;CACN,MAAM;CACN,SAAS,CAAC,IAAI,EAAE;CAChB,MAAM;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,WAAW;EAAC;EAAO;EAAO;EAAO;EAAO;EAAO;EAAO;CAAK;CAC3D,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;;AAMA,SAAS,SAAS,MAAqC;CACrD,IAAI,SAAS,MAAM,OAAO,KAAA;CAC1B,OAAO;EACL,QAAQ;EACR,MAAM;CACR;AACF;;AAcA,SAAS,SAAS,GAAW,MAAsB;CACjD,OAAO;EACL,YAAY;EACZ,MAAM,EAAE,QAAQ,cAAc;EAC9B,OAAO;GACL,UAAU,EAAE;GACZ,SAAS,EAAE;GACX,MAAM,EAAE;GACR,SAAS,EAAE;EACb;EACA,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG;EAC7B,KAAK,EAAE,iBAAiB,EAAE;EAC1B,MAAM;GAAE,aAAa;GAAK,WAAW;GAAS,YAAY;EAAQ;EAClE,OAAO;GAAE,MAAM;GAAI,QAAQ;EAAK;EAChC,MAAM,EAAE,SAAS,IAAK;EACtB,UAAU;GAAE,QAAQ,EAAE;GAAW,aAAa;EAAI;EAClD,MAAM;GACJ,aAAa,EAAE;GACf,OAAO;GACP,cAAc;GACd,WAAW,EAAE;GACb,aAAa,EAAE;GACf,YAAY,EAAE;GACd,WAAW;GACX,eAAe;GACf,YAAY,EAAE;GACd,WAAW;EACb;EACA,kBAAkB,EAAE,WAAW,EAAE;EACjC,OAAO,EAAE,QAAQ,MAAM;EACvB,QAAQ;GACN,YAAY,EAAE;GACd,WAAW;GACX,eAAe;GACf,YAAY,EAAE;GACd,WAAW;EACb;EACA,OAAO;GAAE,OAAO,EAAE;GAAK;EAAK;EAC5B,MAAM;GAAE,OAAO,EAAE;GAAK;EAAK;EAC3B,MAAM,EAAE,OAAO,EAAE,MAAM;CACzB;AACF;AAEA,IAAM,OAAe;CACnB,KAAK;CACL,OAAO;CACP,MAAM;CACN,WAAW;CACX,aAAa;CACb,UAAU;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,MAAM;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,SAAS;EAAC;EAAW;EAAW;CAAS;AAC3C;AAEA,IAAM,QAAgB;CACpB,KAAK;CACL,OAAO;CACP,MAAM;CACN,WAAW;CACX,aAAa;CACb,UAAU;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,MAAM;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,SAAS;EAAC;EAAW;EAAW;CAAS;AAC3C;;;;;AAMA,SAAS,eAAe,WAA+B;CACrD,MAAM,UAAU,MAAe,YAAmC;EAChE,IAAI,SAAS,YAAY,QAAQ,UAAU;EAC3C,OAAO,QAAQ,uBAAO,IAAI,MAAM,sCAAsC,CAAC;CACzE;CACA,MAAM,OAAOA,OAAW;CACxB,KAAK,WAAW;CAChB,KAAK,OAAO;CACZ,KAAK,aAAa,OAAO;CACzB,KAAK,aAAa,OAAO;CACzB,OAAO;AACT;;;AAIA,SAAS,YAAY,SAAsC;CACzD,IAAI,QAAQ;CACZ,MAAM,SAAS;EACb,MAAM,OAAgB;GACpB,IAAI,UAAU,KAAA,GAAW,OAAO;GAChC,QAAQ;GACR,OAAO;EACT;EACA,QAAQ;GACN,QAAQ;GACR,OAAO;EACT;EACA,YAAY;EACZ,YAAY;EACZ,aAAa;CACf;CACA,OAAO;AACT;;AAGA,IAAM,yBAAS,IAAI,IAAY;AAC/B,IAAM,QAAQ;AAEd,SAAS,KAAK,KAAmB;CAC/B,OAAO,IAAI,GAAG;CACd,IAAI,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAM;AACtE;AAEA,SAAS,YAAY,QAAyB;CAC5C,MAAM,MAAM,SAAS,cAAc,KAAK;CACxC,MAAM,OAAO,SAAS,cAAc,MAAM;CAC1C,KAAK,YAAY;CACjB,KAAK,cAAc,GAAG,OAAO;CAC7B,IAAI,OAAO,IAAI;CACf,OAAO;AACT;AAEA,SAAgB,KAAK,QAAgB,KAA0B;CAC7D,MAAM,MAAM,GAAG,IAAI,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK,IAAI;CACtD,IAAI,OAAO,IAAI,GAAG,GAAG,OAAO;CAC5B,IAAI;CACJ,IAAI;EACF,MAAM,SAAkB,KAAK,MAAM,MAAM;EACzC,IAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,MAAM,QAAQ,MAAM,GACvE,OAAO;EACT,OAAO;CACT,QAAQ;EAEN,OAAO;CACT;CAEA,IAAI;CACJ,IAAI;EACF,MAAM,SAAS,SAAS,IAAI,OAAO,OAAO,OAAO,IAAI,IAAI;EACzD,UAAU,MAAM,QAAQ,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,KAAA,GAAW,EAAE,KAAK,KAAK,CAAC;CAC1E,QAAQ;EACN,KAAK,GAAG;EACR,OAAO;CACT;CAEA,MAAM,MAAM,SAAS,cAAc,KAAK;CACxC,IAAI,YAAY;CAChB,IAAI,OAAoB;CACxB,IAAI,SAAS;CACb,MAAM,kBAAkB;EACtB,IAAI,QAAQ;EACZ,SAAS;EACT,KAAK,GAAG;EACR,MAAM,SAAS;EAEf,IAAI,IAAI,YAAY,IAAI,YAAY,YAAY,MAAM,CAAC;CACzD;CACA,UAAU,IAAI,WAAW,MAAM,SAAS,CAAC;CAEzC,IAAI;EACF,MAAM,UAAU,SAAS,IAAI,IAAI;EACjC,OAAO,IAAI,KAAK,SAAS;GACvB,MAAM;GACN,UAAU;GACV,WAAW;GACX,OAAO;GACP,QAAQ,eAAe,SAAS;GAChC,QAAQ,YAAY,SAAS;GAC7B,GAAI,UAAU,EAAE,QAAQ,QAAQ,IAAI,CAAC;EACvC,CAAC;EACD,KAAK,SAAS,CAAC,CAAC,WAAW;GACzB,MAAM,MAAM,IAAI,cAAc,KAAK;GACnC,IAAI,KAAK,aAAa,GAAG;EAC3B,GAAG,SAAS;CACd,QAAQ;EACN,UAAU;CACZ;CAEA,OAAO,SAAS,OAAO;AACzB"}
package/dist/core.js CHANGED
@@ -1 +1 @@
1
- export { o as AICORE_EVENTS, s as AicoreChatClient, t as AicoreChatSession, v as AicoreError, n as CHAT_CHANGE, u as EMPTY_TURN, m as EXPIRY_SKEW_MS, r as RATING_DOWN, i as RATING_UP, h as TokenCache, d as answerOf, c as apiBaseOf, g as decodeJwtClaims, y as errorFromResponse, f as foldTurn, b as isAbortError, x as isInvalidToken, _ as jwtExpiry, S as kindOf, a as messagesFromHistory, C as parseBearerChallenge, l as randomId, w as toAicoreError, p as turnErrorText } from "./chunks/core-Db3hnKpM.js";
1
+ export { s as AICORE_EVENTS, c as AicoreChatClient, t as AicoreChatSession, y as AicoreError, n as CHAT_CHANGE, d as EMPTY_TURN, h as EXPIRY_SKEW_MS, r as RATING_DOWN, i as RATING_UP, g as TokenCache, f as answerOf, l as apiBaseOf, _ as decodeJwtClaims, b as errorFromResponse, p as foldTurn, x as isAbortError, S as isInvalidToken, v as jwtExpiry, C as kindOf, a as messagesFromHistory, w as parseBearerChallenge, u as randomId, o as serverMsOf, T as toAicoreError, m as turnErrorText } from "./chunks/core-4PRAI1Mt.js";
package/dist/define.js CHANGED
@@ -1,7 +1,7 @@
1
- import { C as parseBearerChallenge, S as kindOf, _ as jwtExpiry, a as messagesFromHistory, b as isAbortError, c as apiBaseOf, d as answerOf, f as foldTurn, g as decodeJwtClaims, h as TokenCache, i as RATING_UP, l as randomId, m as EXPIRY_SKEW_MS, n as CHAT_CHANGE, o as AICORE_EVENTS, p as turnErrorText, r as RATING_DOWN, s as AicoreChatClient, t as AicoreChatSession, u as EMPTY_TURN, v as AicoreError, w as toAicoreError, x as isInvalidToken, y as errorFromResponse } from "./chunks/core-Db3hnKpM.js";
2
- import { n as AicoreAgentChat, r as defineAicoreAgentChat, t as AICORE_AGENT_CHAT_TAG } from "./chunks/src-CYXMXds2.js";
1
+ import { C as kindOf, S as isInvalidToken, T as toAicoreError, _ as decodeJwtClaims, a as messagesFromHistory, b as errorFromResponse, c as AicoreChatClient, d as EMPTY_TURN, f as answerOf, g as TokenCache, h as EXPIRY_SKEW_MS, i as RATING_UP, l as apiBaseOf, m as turnErrorText, n as CHAT_CHANGE, o as serverMsOf, p as foldTurn, r as RATING_DOWN, s as AICORE_EVENTS, t as AicoreChatSession, u as randomId, v as jwtExpiry, w as parseBearerChallenge, x as isAbortError, y as AicoreError } from "./chunks/core-4PRAI1Mt.js";
2
+ import { n as AicoreAgentChat, r as defineAicoreAgentChat, t as AICORE_AGENT_CHAT_TAG } from "./chunks/src-PkQozp4M.js";
3
3
  // src/define.ts
4
4
  defineAicoreAgentChat();
5
- export { AICORE_AGENT_CHAT_TAG, AICORE_EVENTS, AicoreAgentChat, AicoreChatClient, AicoreChatSession, AicoreError, CHAT_CHANGE, EMPTY_TURN, EXPIRY_SKEW_MS, RATING_DOWN, RATING_UP, TokenCache, answerOf, apiBaseOf, decodeJwtClaims, defineAicoreAgentChat, errorFromResponse, foldTurn, isAbortError, isInvalidToken, jwtExpiry, kindOf, messagesFromHistory, parseBearerChallenge, randomId, toAicoreError, turnErrorText };
5
+ export { AICORE_AGENT_CHAT_TAG, AICORE_EVENTS, AicoreAgentChat, AicoreChatClient, AicoreChatSession, AicoreError, CHAT_CHANGE, EMPTY_TURN, EXPIRY_SKEW_MS, RATING_DOWN, RATING_UP, TokenCache, answerOf, apiBaseOf, decodeJwtClaims, defineAicoreAgentChat, errorFromResponse, foldTurn, isAbortError, isInvalidToken, jwtExpiry, kindOf, messagesFromHistory, parseBearerChallenge, randomId, serverMsOf, toAicoreError, turnErrorText };
6
6
 
7
7
  //# sourceMappingURL=define.js.map
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { C as parseBearerChallenge, S as kindOf, _ as jwtExpiry, a as messagesFromHistory, b as isAbortError, c as apiBaseOf, d as answerOf, f as foldTurn, g as decodeJwtClaims, h as TokenCache, i as RATING_UP, l as randomId, m as EXPIRY_SKEW_MS, n as CHAT_CHANGE, o as AICORE_EVENTS, p as turnErrorText, r as RATING_DOWN, s as AicoreChatClient, t as AicoreChatSession, u as EMPTY_TURN, v as AicoreError, w as toAicoreError, x as isInvalidToken, y as errorFromResponse } from "./chunks/core-Db3hnKpM.js";
2
- import { n as AicoreAgentChat, r as defineAicoreAgentChat, t as AICORE_AGENT_CHAT_TAG } from "./chunks/src-CYXMXds2.js";
3
- export { AICORE_AGENT_CHAT_TAG, AICORE_EVENTS, AicoreAgentChat, AicoreChatClient, AicoreChatSession, AicoreError, CHAT_CHANGE, EMPTY_TURN, EXPIRY_SKEW_MS, RATING_DOWN, RATING_UP, TokenCache, answerOf, apiBaseOf, decodeJwtClaims, defineAicoreAgentChat, errorFromResponse, foldTurn, isAbortError, isInvalidToken, jwtExpiry, kindOf, messagesFromHistory, parseBearerChallenge, randomId, toAicoreError, turnErrorText };
1
+ import { C as kindOf, S as isInvalidToken, T as toAicoreError, _ as decodeJwtClaims, a as messagesFromHistory, b as errorFromResponse, c as AicoreChatClient, d as EMPTY_TURN, f as answerOf, g as TokenCache, h as EXPIRY_SKEW_MS, i as RATING_UP, l as apiBaseOf, m as turnErrorText, n as CHAT_CHANGE, o as serverMsOf, p as foldTurn, r as RATING_DOWN, s as AICORE_EVENTS, t as AicoreChatSession, u as randomId, v as jwtExpiry, w as parseBearerChallenge, x as isAbortError, y as AicoreError } from "./chunks/core-4PRAI1Mt.js";
2
+ import { n as AicoreAgentChat, r as defineAicoreAgentChat, t as AICORE_AGENT_CHAT_TAG } from "./chunks/src-PkQozp4M.js";
3
+ export { AICORE_AGENT_CHAT_TAG, AICORE_EVENTS, AicoreAgentChat, AicoreChatClient, AicoreChatSession, AicoreError, CHAT_CHANGE, EMPTY_TURN, EXPIRY_SKEW_MS, RATING_DOWN, RATING_UP, TokenCache, answerOf, apiBaseOf, decodeJwtClaims, defineAicoreAgentChat, errorFromResponse, foldTurn, isAbortError, isInvalidToken, jwtExpiry, kindOf, messagesFromHistory, parseBearerChallenge, randomId, serverMsOf, toAicoreError, turnErrorText };
@@ -24,6 +24,33 @@ export interface TraceEvent {
24
24
  id?: string;
25
25
  data: unknown;
26
26
  }
27
+ /** An event of a turn, as «Dietro le quinte» lists it. */
28
+ export interface LoggedEvent {
29
+ /** The turn it belongs to: 1 for the first since the conversation opened. */
30
+ turn: number;
31
+ /** When AI-CORE stored it (ms), read from its stream id; when it arrived,
32
+ * for the rare event without one. */
33
+ at: number;
34
+ kind: string;
35
+ data: unknown;
36
+ }
37
+ /** Where a turn of the log began: its first event. */
38
+ export interface TurnStart {
39
+ turn: number;
40
+ at: number;
41
+ }
42
+ /** Every event of the open conversation's turns, `token`s included, since it
43
+ * was opened here: what «Dietro le quinte» shows. Emptied when another
44
+ * conversation opens. `events` grows in place (a long answer has thousands of
45
+ * tokens); `log` is a new object at every change. */
46
+ export interface TurnLog {
47
+ starts: TurnStart[];
48
+ events: LoggedEvent[];
49
+ /** How far the browser's clock is ahead of AI-CORE's (ms): the least delay
50
+ * seen between an event's server time and its arrival. AI-CORE's clock now
51
+ * is `Date.now() - offset`. Null before the first timed event. */
52
+ offset: number | null;
53
+ }
27
54
  export interface ChatState {
28
55
  agentId: string | null;
29
56
  agent: AgentSummary | null;
@@ -46,6 +73,7 @@ export interface ChatState {
46
73
  requests: RequestLogEntry[];
47
74
  events: TraceEvent[];
48
75
  tokens: number;
76
+ log: TurnLog;
49
77
  }
50
78
  export interface SendOptions {
51
79
  /** The data of the page the user is on (the open record, the chosen
@@ -59,6 +87,9 @@ export declare const CHAT_CHANGE = "change";
59
87
  /** The ratings a thumb gives (`PUT …/feedback` takes 0–5). */
60
88
  export declare const RATING_UP = 5;
61
89
  export declare const RATING_DOWN = 1;
90
+ /** `<ms>-<seq>`, a stream entry id: its `ms` is AI-CORE's clock when the event
91
+ * was stored. Null for anything else (a keepalive has no id). */
92
+ export declare function serverMsOf(id: string | undefined): number | null;
62
93
  export declare function messagesFromHistory(items: HistoryMessage[]): ChatMessage[];
63
94
  /**
64
95
  * One agent chat: conversations, history, the streamed turn, attachments,
@@ -0,0 +1,10 @@
1
+ import { type AgentTeam } from "../team";
2
+ import { type LogInput } from "./log";
3
+ export interface BackstageInput extends LogInput {
4
+ view: "log" | "map";
5
+ team: AgentTeam | null;
6
+ agentName: string;
7
+ working: boolean;
8
+ }
9
+ /** Draws the panel's view into `body`. */
10
+ export declare function drawBackstage(body: HTMLElement, input: BackstageInput): void;
@@ -0,0 +1,13 @@
1
+ import { type TurnLog } from "../../core/session";
2
+ import { type Strings } from "../i18n";
3
+ export interface LogInput {
4
+ log: TurnLog;
5
+ /** The turn still running: what it is doing, and since when (client clock). */
6
+ live: {
7
+ label: string;
8
+ since: number;
9
+ } | null;
10
+ strings: Strings;
11
+ locale: string;
12
+ }
13
+ export declare function drawLog(body: HTMLElement, input: LogInput): void;
@@ -0,0 +1,12 @@
1
+ import { type TurnLog } from "../../core/session";
2
+ import { type Strings } from "../i18n";
3
+ import { type AgentTeam } from "../team";
4
+ export interface MapInput {
5
+ team: AgentTeam;
6
+ agentName: string;
7
+ log: TurnLog;
8
+ working: boolean;
9
+ strings: Strings;
10
+ locale: string;
11
+ }
12
+ export declare function drawMap(body: HTMLElement, input: MapInput): void;
@@ -0,0 +1,51 @@
1
+ import { type LoggedEvent, type TurnStart } from "../../core/session";
2
+ /** A pause longer than this between two rows gets a row of its own. */
3
+ export declare const GAP_MS = 2000;
4
+ export type LogRow = {
5
+ kind: "turn";
6
+ turn: number;
7
+ at: number;
8
+ } | {
9
+ kind: "event";
10
+ event: LoggedEvent;
11
+ offset: number;
12
+ duration: number | null;
13
+ } | {
14
+ kind: "gap";
15
+ ms: number;
16
+ model: boolean;
17
+ } | {
18
+ kind: "summary";
19
+ summary: TurnSummary;
20
+ };
21
+ /** `input` includes `cached`, as the provider counts it. */
22
+ export interface TurnTokens {
23
+ input: number;
24
+ cached: number;
25
+ output: number;
26
+ }
27
+ export interface TurnSummary {
28
+ total: number;
29
+ tools: number;
30
+ model: number;
31
+ modelCalls: number;
32
+ /** Ended on a limit or an error instead of an answer, or stopped. */
33
+ interrupted: boolean;
34
+ /** From the turn's `usage` event; absent when AI-CORE sent none. */
35
+ tokens?: TurnTokens;
36
+ }
37
+ export declare function fieldsOf(data: unknown): Record<string, unknown>;
38
+ export declare function nameOf(event: LoggedEvent): string;
39
+ export declare function nodeOf(event: LoggedEvent): string;
40
+ export declare function logRows(events: readonly LoggedEvent[], starts: readonly TurnStart[]): LogRow[];
41
+ /** Numbers as `locale` writes them. */
42
+ export declare function formats(locale: string): {
43
+ count: (n: number) => string;
44
+ /** A duration as people say it: `2,6 s` under a minute, `2 min 30 s` above. */
45
+ duration(ms: number): string;
46
+ /** An offset from the turn's start, as a stopwatch with tenths. */
47
+ offset(ms: number): string;
48
+ /** A running time: `m:ss`. */
49
+ clock(ms: number): string;
50
+ time(at: number): string;
51
+ };
@@ -20,8 +20,6 @@ export interface Strings {
20
20
  confirmDelete: (title: string) => string;
21
21
  /** The delete button's text while it waits for the second click. */
22
22
  confirmDeleteShort: string;
23
- ask: (agent: string) => string;
24
- askGeneric: string;
25
23
  noAgent: string;
26
24
  notConnected: string;
27
25
  placeholder: string;
@@ -45,7 +43,6 @@ export interface Strings {
45
43
  /** A failed turn whose error carries no message. */
46
44
  turnFailed: string;
47
45
  trace: (id: string) => string;
48
- disclaimer: string;
49
46
  dismiss: string;
50
47
  you: string;
51
48
  agent: string;
@@ -53,7 +50,6 @@ export interface Strings {
53
50
  retryIn: (seconds: number) => string;
54
51
  developer: string;
55
52
  requests: string;
56
- events: (tokens: number) => string;
57
53
  lastError: string;
58
54
  renewed: string;
59
55
  publishedVersion: string;
@@ -62,13 +58,80 @@ export interface Strings {
62
58
  /** The developer panel's row with the `context` the next message sends. */
63
59
  context: string;
64
60
  none: string;
61
+ /** An interface (A2UI) in an answer, while the answer still arrives. */
62
+ a2uiPreparing: string;
63
+ /** An interface the renderer refused, shown as its source. */
64
+ a2uiRefused: (reason: string) => string;
65
+ /** The reason, when the renderer gives none. */
66
+ a2uiInvalid: string;
67
+ /** Under an interface whose form was sent. */
68
+ a2uiSent: string;
69
+ /** The title of an interface's dialog. */
70
+ a2uiDetails: string;
71
+ /** The name of an interface's tabs. */
72
+ a2uiTabs: string;
73
+ close: string;
74
+ /** The user's message that answered an interface: the action sent. */
75
+ a2uiAction: (action: string) => string;
76
+ yes: string;
77
+ no: string;
78
+ /** «Dietro le quinte», the panel of the turns' events (`backstage`). */
79
+ backstage: string;
80
+ /** The header button that shows and hides it. */
81
+ backstageToggle: string;
82
+ backstageLog: string;
83
+ backstageMap: string;
84
+ backstageViews: string;
85
+ noEvents: string;
86
+ turnHeader: (turn: number, time: string) => string;
87
+ modelWait: string;
88
+ turnDone: (duration: string) => string;
89
+ turnStopped: (duration: string) => string;
90
+ turnCanceled: string;
91
+ tools: string;
92
+ modelTime: string;
93
+ modelCalls: string;
94
+ answerTime: string;
95
+ inputTokens: string;
96
+ outputTokens: string;
97
+ fromCache: (count: string) => string;
98
+ mainAgent: string;
99
+ limitReached: (limit: string) => string;
100
+ limitNames: Record<string, string>;
101
+ limitHint: string;
102
+ calls: string;
103
+ answers: string;
104
+ expand: string;
105
+ collapse: string;
106
+ /** «Dietro le quinte › Mappa»: the team at work. */
107
+ memberKinds: Record<"orchestrator" | "subagent" | "platform_agent" | "external_a2a" | "extra", string>;
108
+ noTurn: string;
109
+ turnRunning: (turn: number, clock: string) => string;
110
+ turnEnded: (turn: number) => string;
111
+ turnInterrupted: (turn: number) => string;
112
+ teamAtWork: (used: number, total: number) => string;
113
+ delegations: (count: number) => string;
114
+ toolCalls: (count: number) => string;
115
+ statusFailed: string;
116
+ statusWaiting: (names: string) => string;
117
+ statusTool: (names: string) => string;
118
+ statusExternal: string;
119
+ statusWriting: string;
120
+ statusThinking: string;
121
+ statusDoneOnce: (duration: string) => string;
122
+ statusDoneTimes: (times: number, duration: string) => string;
123
+ statusUnused: string;
124
+ /** Joins names: «a, b e c». */
125
+ and: string;
65
126
  }
66
127
  /** The host's replacements for some of the texts (`errors` merges by kind). */
67
128
  export type StringsOverride = Partial<Omit<Strings, "errors">> & {
68
129
  errors?: Partial<Strings["errors"]>;
69
130
  };
70
- /** The built-in texts for `lang`: Italian for `it…` or no language at all,
71
- * English for any other language. */
131
+ /** The language the element speaks for `lang`: Italian for `it…` or no
132
+ * language at all, English for any other language. */
133
+ export declare function languageOf(lang: string | null | undefined): "it" | "en";
134
+ /** The built-in texts for `lang` (see `languageOf`). */
72
135
  export declare function baseStringsOf(lang: string | null | undefined): Strings;
73
136
  /** The texts for `lang`, with the host's overrides on top. */
74
137
  export declare function stringsOf(lang: string | null | undefined, overrides?: StringsOverride | null): Strings;
@@ -1,5 +1,7 @@
1
1
  declare const PATHS: {
2
2
  readonly add: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z";
3
+ readonly arrowUp: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z";
4
+ readonly 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";
3
5
  readonly 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";
4
6
  readonly send: "M2.01 21 23 12 2.01 3 2 10l15 2-15 2z";
5
7
  readonly stop: "M6 6h12v12H6z";
@@ -10,6 +12,7 @@ declare const PATHS: {
10
12
  readonly 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";
11
13
  readonly 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";
12
14
  readonly menu: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z";
15
+ readonly panel: "M16 20H2V4h14v16zm2-12h4V4h-4v4zm0 12h4v-4h-4v4zm0-6h4v-4h-4v4z";
13
16
  readonly 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";
14
17
  };
15
18
  export type IconName = keyof typeof PATHS;