@aintela/chat 0.4.36 → 0.5.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 (68) hide show
  1. package/dist/components.js +7039 -7001
  2. package/dist/components.js.map +1 -1
  3. package/dist/hooks.js +1 -1
  4. package/dist/httpArtifactService-EEhF_mp9.js +1744 -0
  5. package/dist/httpArtifactService-EEhF_mp9.js.map +1 -0
  6. package/dist/{httpSessionService-CUujaUo6.js → httpSessionService-wBby4ggl.js} +51 -53
  7. package/dist/httpSessionService-wBby4ggl.js.map +1 -0
  8. package/dist/index.js +232 -227
  9. package/dist/models.js +1 -1
  10. package/dist/{serializer-DX-yGa_k.js → serializer-CC-nM3ig.js} +497 -498
  11. package/dist/serializer-CC-nM3ig.js.map +1 -0
  12. package/dist/services.js +12 -10
  13. package/dist/src/components/AiChat/ChatPane/CurrentMessage.d.ts +9 -9
  14. package/dist/src/components/AiChat/ChatPane/Message.d.ts +1 -3
  15. package/dist/src/components/AiChat/ChatPane/MessageAgent.d.ts +9 -8
  16. package/dist/src/components/AiChat/ChatPane/MessageScope.d.ts +32 -0
  17. package/dist/src/components/AiChat/ChatPane/MessageUser.d.ts +0 -1
  18. package/dist/src/components/AiChat/ChatPane/StickyQuestionHeader.d.ts +0 -1
  19. package/dist/src/components/AiChat/ChatPane/groupParts.d.ts +32 -0
  20. package/dist/src/components/AiChat/ChatPane/parts/ConnectionOutagePart.d.ts +9 -0
  21. package/dist/src/components/AiChat/ChatPane/parts/types.d.ts +6 -4
  22. package/dist/src/components/AiChat/ChatPane/reasoningHeadlines.d.ts +12 -8
  23. package/dist/src/components/AiChat/sessionStateManagerService.d.ts +36 -35
  24. package/dist/src/components/AiChat/stateConfiguration.d.ts +18 -0
  25. package/dist/src/components/index.d.ts +6 -2
  26. package/dist/src/interfaces/index.d.ts +0 -1
  27. package/dist/src/models/Interaction.d.ts +0 -9
  28. package/dist/src/models/InteractionPart.d.ts +4 -3
  29. package/dist/src/models/Notification.d.ts +7 -1
  30. package/dist/src/models/ServerEvent.d.ts +4 -0
  31. package/dist/src/models/index.d.ts +1 -1
  32. package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +28 -108
  33. package/dist/src/services/WebSocketConnection/closeCodes.d.ts +24 -0
  34. package/dist/src/services/WebSocketConnection/streamStats.d.ts +41 -0
  35. package/dist/src/services/WebSocketConnection/streamStats.test.d.ts +1 -0
  36. package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +15 -12
  37. package/dist/src/services/eventBusService.d.ts +28 -67
  38. package/dist/src/services/index.d.ts +2 -1
  39. package/dist/src/services/interaction/reduceInteraction.d.ts +28 -0
  40. package/dist/src/services/interactionService.d.ts +15 -32
  41. package/dist/src/services/interactionService.invariants.test.d.ts +1 -0
  42. package/dist/src/services/servers/AgentGatewayService.d.ts +3 -182
  43. package/dist/src/services/servers/AgentGatewayWSAsync.d.ts +145 -46
  44. package/dist/src/services/servers/connectionSupervisor.d.ts +173 -0
  45. package/dist/src/services/servers/connectionSupervisor.test.d.ts +1 -0
  46. package/dist/src/services/servers/connectionSupervisor.wire.test.d.ts +0 -0
  47. package/dist/src/services/servers/gatewayErrorClosesTurn.test.d.ts +1 -0
  48. package/dist/src/services/servers/gatewayFixes.test.d.ts +1 -0
  49. package/dist/src/services/servers/throttledEmit.test.d.ts +1 -0
  50. package/dist/src/services/servers/throttledEmitter.d.ts +38 -0
  51. package/dist/src/services/streamPipeline.characterization.test.d.ts +1 -0
  52. package/dist/src/services/wire/decodeFrame.d.ts +21 -0
  53. package/dist/src/services/wire/decodeFrame.test.d.ts +1 -0
  54. package/dist/tests/bench/streamPipeline.bench.d.ts +1 -0
  55. package/dist/tests/fakes/fakeRawWebSocket.d.ts +2 -0
  56. package/dist/tests/fakes/fakeWebSocket.d.ts +4 -3
  57. package/dist/tests/fakes/makeGateway.d.ts +7 -0
  58. package/dist/tests/wire/journey.d.ts +47 -0
  59. package/dist/{useChatSessions-BXYvvd4S.js → useChatSessions-C6sYF4U6.js} +2 -2
  60. package/dist/{useChatSessions-BXYvvd4S.js.map → useChatSessions-C6sYF4U6.js.map} +1 -1
  61. package/package.json +2 -1
  62. package/dist/httpArtifactService-GdGsaFKS.js +0 -1979
  63. package/dist/httpArtifactService-GdGsaFKS.js.map +0 -1
  64. package/dist/httpSessionService-CUujaUo6.js.map +0 -1
  65. package/dist/serializer-DX-yGa_k.js.map +0 -1
  66. package/dist/src/interfaces/IHeartbeatPort.d.ts +0 -4
  67. /package/dist/src/components/AiChat/{sessionStateManagerService.idle.test.d.ts → ChatPane/groupParts.test.d.ts} +0 -0
  68. /package/dist/src/{services/interactionServiceGrouping.test.d.ts → components/AiChat/ChatPane/parts/connectionOutagePart.test.d.ts} +0 -0
@@ -1,15 +1,15 @@
1
1
  var qt = Object.defineProperty;
2
- var Qt = (s, t, i) => t in s ? qt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[t] = i;
3
- var c = (s, t) => qt(s, "name", { value: t, configurable: !0 });
4
- var e = (s, t, i) => Qt(s, typeof t != "symbol" ? t + "" : t, i);
5
- import Nt from "@mui/icons-material/Psychology";
6
- import z from "@mui/icons-material/FlashOn";
7
- import Et from "@mui/icons-material/RocketLaunch";
2
+ var Qt = (s, t, o) => t in s ? qt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : s[t] = o;
3
+ var p = (s, t) => qt(s, "name", { value: t, configurable: !0 });
4
+ var e = (s, t, o) => Qt(s, typeof t != "symbol" ? t + "" : t, o);
5
+ import Rt from "@mui/icons-material/Psychology";
6
+ import L from "@mui/icons-material/FlashOn";
7
+ import vt from "@mui/icons-material/RocketLaunch";
8
8
  import Zt from "@mui/icons-material/GeneratingTokensOutlined";
9
- import Ut from "@mui/icons-material/SortByAlphaOutlined";
10
- import Wt from "@mui/icons-material/AllInclusive";
11
- import { d as It, A as Yt } from "./environmentUtils-VZNTCzEE.js";
12
- import { jsonMember as o, jsonObject as g, AnyT as q, jsonArrayMember as xt, TypedJSON as Lt } from "typedjson";
9
+ import Nt from "@mui/icons-material/SortByAlphaOutlined";
10
+ import Ht from "@mui/icons-material/AllInclusive";
11
+ import { d as bt, A as Yt } from "./environmentUtils-VZNTCzEE.js";
12
+ import { jsonMember as i, jsonObject as g, AnyT as q, jsonArrayMember as xt, TypedJSON as zt } from "typedjson";
13
13
  const me = {
14
14
  ChatEvent: "ChatEvent",
15
15
  ChatResponse: "ChatResponse",
@@ -51,7 +51,7 @@ const me = {
51
51
  NotDefined: "not_defined",
52
52
  Waiting: "waiting",
53
53
  Suspended: "suspended"
54
- }, Xt = /* @__PURE__ */ c((s) => {
54
+ }, Xt = /* @__PURE__ */ p((s) => {
55
55
  switch (s.toLocaleLowerCase()) {
56
56
  case "functioncall":
57
57
  return l.FunctionCall;
@@ -87,7 +87,7 @@ const me = {
87
87
  default:
88
88
  return l.NotDefined;
89
89
  }
90
- }, "GetEventTypeFromDotNetName"), he = {
90
+ }, "GetEventTypeFromDotNetName"), ye = {
91
91
  [l.FunctionCall]: "Executing function call",
92
92
  [l.FunctionResponse]: "Getting response",
93
93
  [l.Video]: "Video",
@@ -99,7 +99,7 @@ const me = {
99
99
  [l.Other]: "Other",
100
100
  [l.Text]: "Text",
101
101
  [l.NotDefined]: "NotDefined"
102
- }, ye = {
102
+ }, he = {
103
103
  Regular: "Regular",
104
104
  Artifact: "Artifact"
105
105
  }, Ce = {
@@ -110,7 +110,7 @@ const me = {
110
110
  Dashboard: "Dashboard",
111
111
  Chart: "Chart",
112
112
  Code: "Code"
113
- }, bt = {
113
+ }, It = {
114
114
  BI_Envision_Agent: "BI_Envision_Agent",
115
115
  BI_Master_Customer_Agent: "BI_Master_Customer_Agent",
116
116
  BI_Dedicated_Customer_Agent: "BI_Dedicated_Customer_Agent",
@@ -119,29 +119,29 @@ const me = {
119
119
  Interactive: "Interactive",
120
120
  Newsletter: "Newsletter"
121
121
  }, xe = {
122
- [bt.BI_Envision_Agent]: {
122
+ [It.BI_Envision_Agent]: {
123
123
  name: "Envision",
124
124
  description: `Analisa dados de vendas globais
125
125
  com insights consolidados de todos os clientes
126
126
  e métricas agregadas do mercado`
127
127
  },
128
- [bt.BI_Master_Customer_Agent]: {
128
+ [It.BI_Master_Customer_Agent]: {
129
129
  name: "Clientes Master",
130
130
  description: `Visão consolidada de todos os clientes
131
131
  com análises comparativas e benchmarks
132
132
  entre diferentes organizações`
133
133
  },
134
- [bt.BI_Dedicated_Customer_Agent]: {
134
+ [It.BI_Dedicated_Customer_Agent]: {
135
135
  name: "Cliente Único",
136
136
  description: `Foco em um cliente específico
137
137
  com análises detalhadas e personalizadas
138
138
  para sua organização`
139
139
  },
140
- [bt.Unknown]: {
140
+ [It.Unknown]: {
141
141
  name: "Não definido",
142
142
  description: "Não definido"
143
143
  }
144
- }, De = {
144
+ }, _e = {
145
145
  FAST: "FAST",
146
146
  BALANCED: "BALANCED",
147
147
  PRO: "PRO",
@@ -170,11 +170,11 @@ para sua organização`
170
170
  ShowGuideDemo: "ShowGuideDemo",
171
171
  uiToolShowcase: "uiToolShowcase",
172
172
  AUTO: "AUTO"
173
- }, _e = {
173
+ }, De = {
174
174
  [T.Claude_Opus_4_6]: {
175
175
  name: "Claude Opus 4.6",
176
176
  description: "Modelo mais avançado da anthropic, no entanto, não tão rápido como o Sonnet",
177
- icon: Wt,
177
+ icon: Ht,
178
178
  contextWindow: "1M tokens",
179
179
  speed: "Moderate",
180
180
  quality: "Highest"
@@ -182,7 +182,7 @@ para sua organização`
182
182
  [T.Claude_Sonnet_4_6]: {
183
183
  name: "Claude Sonnet 4.6",
184
184
  description: "Ótima relação velocidade/qualidade",
185
- icon: Wt,
185
+ icon: Ht,
186
186
  contextWindow: "1M tokens",
187
187
  speed: "Fast",
188
188
  quality: "High"
@@ -192,7 +192,7 @@ para sua organização`
192
192
  description: `Modelo mais avançado
193
193
  Melhor qualidade para tarefas complexas
194
194
  Contexto: 2M tokens`,
195
- icon: Nt,
195
+ icon: Rt,
196
196
  contextWindow: "2M tokens",
197
197
  speed: "Moderate",
198
198
  quality: "Highest"
@@ -202,7 +202,7 @@ Contexto: 2M tokens`,
202
202
  description: `Equilibrio ideal entre velocidade e qualidade
203
203
  Ótimo para a maioria das tarefas
204
204
  Contexto: 1M tokens`,
205
- icon: z,
205
+ icon: L,
206
206
  contextWindow: "1M tokens",
207
207
  speed: "Fast",
208
208
  quality: "High"
@@ -212,7 +212,7 @@ Contexto: 1M tokens`,
212
212
  description: `NOVO: Equilibrio ideal entre velocidade e qualidade
213
213
  Ótimo para a maioria das tarefas
214
214
  Contexto: 1M tokens`,
215
- icon: z,
215
+ icon: L,
216
216
  contextWindow: "1M tokens",
217
217
  speed: "Fast",
218
218
  quality: "High"
@@ -220,7 +220,7 @@ Contexto: 1M tokens`,
220
220
  [T.Gpt_5_1]: {
221
221
  name: "Chat GPT 5.1",
222
222
  description: "Chat GPT 5.1",
223
- icon: Et,
223
+ icon: vt,
224
224
  contextWindow: "200k tokens",
225
225
  speed: "Good",
226
226
  quality: "High"
@@ -228,7 +228,7 @@ Contexto: 1M tokens`,
228
228
  [T.Gpt_5_2]: {
229
229
  name: "Chat GPT 5.2",
230
230
  description: "Chat GPT 5.2",
231
- icon: Et,
231
+ icon: vt,
232
232
  contextWindow: "200k tokens",
233
233
  speed: "Good",
234
234
  quality: "Highest"
@@ -236,7 +236,7 @@ Contexto: 1M tokens`,
236
236
  [T.Gpt_5_5]: {
237
237
  name: "Chat GPT 5.5",
238
238
  description: "A melhor inteligência em escala para fluxos de trabalho de agentes, codificação e profissionais.",
239
- icon: Et,
239
+ icon: vt,
240
240
  contextWindow: "200k tokens",
241
241
  speed: "Good",
242
242
  quality: "Highest"
@@ -244,7 +244,7 @@ Contexto: 1M tokens`,
244
244
  [T.Gpt_5_4_mini]: {
245
245
  name: "Chat GPT 5.4 Mini",
246
246
  description: "Modelo compacto mais robusto da OpenAi até momento para codificação, uso de computadores e subagentes.",
247
- icon: Et,
247
+ icon: vt,
248
248
  contextWindow: "200k tokens",
249
249
  speed: "Fast",
250
250
  quality: "Highest"
@@ -252,7 +252,7 @@ Contexto: 1M tokens`,
252
252
  [T["Glm-5_2"]]: {
253
253
  name: "Z.ai Glm-5",
254
254
  description: "Modelo open weights bem competente da Z.Ai. Apesar de gerar respostas mais longas o modelo é muito capaz.",
255
- icon: Ut,
255
+ icon: Nt,
256
256
  contextWindow: "200k tokens",
257
257
  speed: "Good",
258
258
  quality: "Highest"
@@ -260,7 +260,7 @@ Contexto: 1M tokens`,
260
260
  [T["Glm_4.7"]]: {
261
261
  name: "Z.ai Glm-4.7",
262
262
  description: "",
263
- icon: Ut,
263
+ icon: Nt,
264
264
  contextWindow: "200k tokens",
265
265
  speed: "Fast",
266
266
  quality: "High"
@@ -268,7 +268,7 @@ Contexto: 1M tokens`,
268
268
  [T["Glm_4.7_flash"]]: {
269
269
  name: "Z.ai Glm-4.7",
270
270
  description: "",
271
- icon: Ut,
271
+ icon: Nt,
272
272
  contextWindow: "200k tokens",
273
273
  speed: "Good",
274
274
  quality: "High"
@@ -277,7 +277,7 @@ Contexto: 1M tokens`,
277
277
  name: "DeepSeek Reasoner",
278
278
  description: `Modelo da DeepSeek com modo de raciocínio profundo (thinking mode).
279
279
  Ideal para tarefas complexas que se beneficiam de cadeia de pensamento extensa.`,
280
- icon: Nt,
280
+ icon: Rt,
281
281
  contextWindow: "128k tokens",
282
282
  speed: "Moderate",
283
283
  quality: "Highest"
@@ -286,7 +286,7 @@ Ideal para tarefas complexas que se beneficiam de cadeia de pensamento extensa.`
286
286
  name: "DeepSeek Chat",
287
287
  description: `Modelo de chat rápido da DeepSeek, sem modo de raciocínio.
288
288
  Ótimo equilíbrio entre velocidade e qualidade para uso geral.`,
289
- icon: z,
289
+ icon: L,
290
290
  contextWindow: "128k tokens",
291
291
  speed: "Fast",
292
292
  quality: "High"
@@ -295,7 +295,7 @@ Ideal para tarefas complexas que se beneficiam de cadeia de pensamento extensa.`
295
295
  name: "Kimi K2.6 Pro",
296
296
  description: `Modelo híbrido da Moonshot com modo de raciocínio (thinking) ativado por padrão.
297
297
  Melhor capacidade da família K2 para tarefas complexas.`,
298
- icon: Nt,
298
+ icon: Rt,
299
299
  contextWindow: "256k tokens",
300
300
  speed: "Moderate",
301
301
  quality: "Highest"
@@ -304,7 +304,7 @@ Melhor capacidade da família K2 para tarefas complexas.`,
304
304
  name: "Kimi K2 Turbo",
305
305
  description: `Variante rápida (não-thinking) da Moonshot.
306
306
  Ótima relação velocidade/qualidade para uso geral.`,
307
- icon: z,
307
+ icon: L,
308
308
  contextWindow: "256k tokens",
309
309
  speed: "Fast",
310
310
  quality: "High"
@@ -312,7 +312,7 @@ Melhor capacidade da família K2 para tarefas complexas.`,
312
312
  [T["Qwen3_6-plus"]]: {
313
313
  name: "Qwen 3.6 Plus - Alibaba",
314
314
  description: "Multimodal nativo, context window - 1 milhão de tokens, codificação agentiva",
315
- icon: z,
315
+ icon: L,
316
316
  contextWindow: "1 milhão",
317
317
  speed: "Moderate",
318
318
  quality: "Highest"
@@ -320,7 +320,7 @@ Melhor capacidade da família K2 para tarefas complexas.`,
320
320
  [T["Qwen3_7-max"]]: {
321
321
  name: "Qwen 3.7 Max - Alibaba",
322
322
  description: "Multimodal nativo, context window - 1 milhão de tokens, codificação agentiva",
323
- icon: z,
323
+ icon: L,
324
324
  contextWindow: "1 milhão",
325
325
  speed: "Moderate",
326
326
  quality: "Highest"
@@ -339,8 +339,8 @@ function Fe(s) {
339
339
  const t = s.toLowerCase();
340
340
  return t.startsWith("gemini") || t.startsWith("live") ? "Google" : t.startsWith("claude") ? "Anthropic" : t.startsWith("gpt") ? "OpenAI" : t.startsWith("glm") ? "ZhiPu" : t.startsWith("kimi") ? "Moonshot" : t.startsWith("deepseek") ? "DeepSeek" : "Unknown";
341
341
  }
342
- c(Fe, "getModelVendor");
343
- const we = /* @__PURE__ */ c((s, t) => {
342
+ p(Fe, "getModelVendor");
343
+ const we = /* @__PURE__ */ p((s, t) => {
344
344
  switch (s) {
345
345
  case "Connected":
346
346
  return t.palette.primary.light;
@@ -355,16 +355,16 @@ const we = /* @__PURE__ */ c((s, t) => {
355
355
  default:
356
356
  return t.palette.text.secondary;
357
357
  }
358
- }, "getConnectionStateColor"), U = class U {
358
+ }, "getConnectionStateColor"), N = class N {
359
359
  static replaceFirstTwoTabsPerLine(t) {
360
- const i = /^\s{15}/gm;
361
- return typeof t == "string" ? t.replaceAll(i, (a) => a.substring(15)) : t ?? "";
360
+ const o = /^\s{15}/gm;
361
+ return typeof t == "string" ? t.replaceAll(o, (a) => a.substring(15)) : t ?? "";
362
362
  }
363
363
  static jsonToString(t) {
364
364
  if (t == null) return "";
365
365
  if (typeof t != "object") return String(t);
366
- const i = Array.isArray(t) ? U.isCharArray(t) ? t.join("") : null : U.tryCollapseCharIndexedObject(t);
367
- if (i != null) return i;
366
+ const o = Array.isArray(t) ? N.isCharArray(t) ? t.join("") : null : N.tryCollapseCharIndexedObject(t);
367
+ if (o != null) return o;
368
368
  if (Array.isArray(t))
369
369
  try {
370
370
  return JSON.stringify(t, null, 2);
@@ -372,13 +372,13 @@ const we = /* @__PURE__ */ c((s, t) => {
372
372
  return String(t);
373
373
  }
374
374
  const a = Object.keys(t), r = [];
375
- return a.forEach((p) => {
376
- let d = t[p];
377
- typeof d == "object" && (d = JSON.stringify(t[p], null, 2));
375
+ return a.forEach((c) => {
376
+ let d = t[c];
377
+ typeof d == "object" && (d = JSON.stringify(t[c], null, 2));
378
378
  const f = (d == null ? void 0 : d.toString().indexOf(`
379
379
  `)) > -1 ? `
380
380
  ` : "";
381
- r.push(`${p}:${f}${d}`);
381
+ r.push(`${c}:${f}${d}`);
382
382
  }), r.join(`
383
383
  `);
384
384
  }
@@ -399,14 +399,14 @@ const we = /* @__PURE__ */ c((s, t) => {
399
399
  } catch {
400
400
  return String(t);
401
401
  }
402
- const i = Object.keys(t), a = [];
403
- return i.forEach((r) => {
404
- let p = t == null ? void 0 : t[r];
405
- typeof p == "object" && (p = JSON.stringify(p, null, 2));
406
- const d = (p == null ? void 0 : p.toString().indexOf(`
402
+ const o = Object.keys(t), a = [];
403
+ return o.forEach((r) => {
404
+ let c = t == null ? void 0 : t[r];
405
+ typeof c == "object" && (c = JSON.stringify(c, null, 2));
406
+ const d = (c == null ? void 0 : c.toString().indexOf(`
407
407
  `)) > -1 ? `
408
408
  ` : "";
409
- a.push(`${r}:${d}${p}`);
409
+ a.push(`${r}:${d}${c}`);
410
410
  }), a.join(`
411
411
  `);
412
412
  }
@@ -418,16 +418,16 @@ const we = /* @__PURE__ */ c((s, t) => {
418
418
  * before reading the field. Returns undefined when absent or unparseable.
419
419
  */
420
420
  static uiSlotId(t) {
421
- var p;
422
- let i = (p = t == null ? void 0 : t.functionDetails) == null ? void 0 : p.response;
423
- for (let d = 0; d < 2 && typeof i == "string"; d++)
421
+ var c;
422
+ let o = (c = t == null ? void 0 : t.functionDetails) == null ? void 0 : c.response;
423
+ for (let d = 0; d < 2 && typeof o == "string"; d++)
424
424
  try {
425
- i = JSON.parse(i);
425
+ o = JSON.parse(o);
426
426
  } catch {
427
427
  return;
428
428
  }
429
- if (!i || typeof i != "object") return;
430
- const a = i, r = a.SlotId ?? a.slotId;
429
+ if (!o || typeof o != "object") return;
430
+ const a = o, r = a.SlotId ?? a.slotId;
431
431
  return typeof r == "string" ? r : void 0;
432
432
  }
433
433
  static fromError(t) {
@@ -438,20 +438,18 @@ const we = /* @__PURE__ */ c((s, t) => {
438
438
  author: "main",
439
439
  created: /* @__PURE__ */ new Date(),
440
440
  partial: !1,
441
- isStillWriting: !1,
442
441
  mustPush: !1,
443
442
  textAppendable: !1
444
443
  };
445
444
  }
446
- static fromText(t, i, a) {
445
+ static fromText(t, o, a) {
447
446
  return {
448
447
  text: t,
449
448
  eventType: l.Text,
450
- id: a ?? It(),
449
+ id: a ?? bt(),
451
450
  created: /* @__PURE__ */ new Date(),
452
- author: i ?? "main",
451
+ author: o ?? "main",
453
452
  partial: !1,
454
- isStillWriting: !1,
455
453
  mustPush: !1,
456
454
  textAppendable: !1
457
455
  };
@@ -462,38 +460,37 @@ const we = /* @__PURE__ */ c((s, t) => {
462
460
  * and replayed parts are identical: an `EventType.UserAnswer` carrying functionDetails
463
461
  * {name, args, isUi, status:'Done'} that routes through the uiTool dispatcher/registry.
464
462
  */
465
- static fromUserUi(t, i, a) {
463
+ static fromUserUi(t, o, a) {
466
464
  return {
467
- id: a ?? It(),
465
+ id: a ?? bt(),
468
466
  eventType: l.UserAnswer,
469
467
  author: "user",
470
468
  created: /* @__PURE__ */ new Date(),
471
469
  partial: !1,
472
- isStillWriting: !1,
473
470
  mustPush: !1,
474
471
  textAppendable: !1,
475
472
  functionDetails: {
476
473
  id: "",
477
474
  name: t,
478
- args: i,
475
+ args: o,
479
476
  status: "Done",
480
477
  isUi: !0
481
478
  }
482
479
  };
483
480
  }
484
- static createWaiting(t = !1, i = !0, a, r, p) {
481
+ static createWaiting(t = !1, o = !0, a, r, c) {
485
482
  a || (a = "Waiting");
486
- const d = U.fromText("...", void 0, "waitingpart");
483
+ const d = N.fromText("...", void 0, "waitingpart");
487
484
  return d.eventType = l.Waiting, d.waitingDetails = {
488
485
  startingPoint: r,
489
486
  addTimer: t,
490
- isTimerRunning: i,
487
+ isTimerRunning: o,
491
488
  status: a,
492
- stopPoint: p
489
+ stopPoint: c
493
490
  }, d;
494
491
  }
495
492
  static createSuspended() {
496
- const t = U.fromText("SUSPEND");
493
+ const t = N.fromText("SUSPEND");
497
494
  return t.eventType = l.Suspended, t;
498
495
  }
499
496
  static getPartTextContent(t) {
@@ -502,19 +499,19 @@ const we = /* @__PURE__ */ c((s, t) => {
502
499
  static FlatParts(t) {
503
500
  if (t.length === 0)
504
501
  return;
505
- const i = t.filter((p) => p.eventType == l.Text), a = i.length > 0 ? i[0] : t[0], r = [...new Set(t.map((p) => p.eventType))];
506
- r.length == 1 ? a.eventType = r[0] : i.length > 0 && (a.eventType = l.Text), a.mustPush = !(a.eventType == l.Text || a.eventType == l.Thought || a.eventType == l.NotDefined || a.eventType == l.PartialFunctionCall), a.textAppendable = a.eventType == l.Text || a.eventType == l.Thought || a.eventType == l.PartialFunctionCall;
507
- for (const p of t) {
508
- if (!a.codeExecutionResultDetails && p.codeExecutionResultDetails && (a.codeExecutionResultDetails = p.codeExecutionResultDetails), !a.errorDetails && p.errorDetails && (a.errorDetails = p.errorDetails), !a.executableCodeDetails && p.executableCodeDetails && (a.executableCodeDetails = p.executableCodeDetails), !a.functionDetails && p.functionDetails && (a.functionDetails = p.functionDetails), a.functionDetails && p.functionDetails && p !== a) {
509
- const d = a.functionDetails, f = p.functionDetails;
502
+ const o = t.filter((c) => c.eventType == l.Text), a = o.length > 0 ? o[0] : t[0], r = [...new Set(t.map((c) => c.eventType))];
503
+ r.length == 1 ? a.eventType = r[0] : o.length > 0 && (a.eventType = l.Text), a.mustPush = !(a.eventType == l.Text || a.eventType == l.Thought || a.eventType == l.NotDefined || a.eventType == l.PartialFunctionCall), a.textAppendable = a.eventType == l.Text || a.eventType == l.Thought || a.eventType == l.PartialFunctionCall;
504
+ for (const c of t) {
505
+ if (!a.codeExecutionResultDetails && c.codeExecutionResultDetails && (a.codeExecutionResultDetails = c.codeExecutionResultDetails), !a.errorDetails && c.errorDetails && (a.errorDetails = c.errorDetails), !a.executableCodeDetails && c.executableCodeDetails && (a.executableCodeDetails = c.executableCodeDetails), !a.functionDetails && c.functionDetails && (a.functionDetails = c.functionDetails), a.functionDetails && c.functionDetails && c !== a) {
506
+ const d = a.functionDetails, f = c.functionDetails;
510
507
  !d.askUserComponent && f.askUserComponent && (d.askUserComponent = f.askUserComponent), !d.isUi && f.isUi && (d.isUi = !0), !d.clientOutput && f.clientOutput && (d.clientOutput = f.clientOutput), d.isAskUser = d.isAskUser || f.isAskUser || !!d.askUserComponent;
511
508
  }
512
- !a.rawDetails && p.rawDetails && (a.rawDetails = p.rawDetails), !a.thoughtDetails && p.thoughtDetails && (a.thoughtDetails = p.thoughtDetails), !a.errorDetails && p.errorDetails && (a.errorDetails = p.errorDetails);
509
+ !a.rawDetails && c.rawDetails && (a.rawDetails = c.rawDetails), !a.thoughtDetails && c.thoughtDetails && (a.thoughtDetails = c.thoughtDetails), !a.errorDetails && c.errorDetails && (a.errorDetails = c.errorDetails);
513
510
  }
514
511
  return a;
515
512
  }
516
513
  static isCharArray(t) {
517
- return Array.isArray(t) && t.length > 0 && t.every((i) => typeof i == "string" && i.length === 1);
514
+ return Array.isArray(t) && t.length > 0 && t.every((o) => typeof o == "string" && o.length === 1);
518
515
  }
519
516
  /**
520
517
  * Detects objects like `{0: "a", 1: "b", 2: "c", ...}` — a string that was
@@ -524,25 +521,25 @@ const we = /* @__PURE__ */ c((s, t) => {
524
521
  */
525
522
  static tryCollapseCharIndexedObject(t) {
526
523
  if (t == null || typeof t != "object" || Array.isArray(t)) return null;
527
- const i = Object.keys(t);
528
- if (i.length === 0) return null;
529
- for (let a = 0; a < i.length; a++) {
530
- if (i[a] !== String(a)) return null;
531
- const r = t[i[a]];
524
+ const o = Object.keys(t);
525
+ if (o.length === 0) return null;
526
+ for (let a = 0; a < o.length; a++) {
527
+ if (o[a] !== String(a)) return null;
528
+ const r = t[o[a]];
532
529
  if (typeof r != "string" || r.length !== 1) return null;
533
530
  }
534
- return i.map((a) => t[a]).join("");
531
+ return o.map((a) => t[a]).join("");
535
532
  }
536
533
  static isCodeExecution(t) {
537
534
  return t.eventType === l.CodeExecutionResult || t.eventType === l.ExecutableCode;
538
535
  }
539
536
  };
540
- c(U, "InteractionPartUtils");
541
- let Ot = U;
542
- var jt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, n = /* @__PURE__ */ c((s, t, i, a) => {
543
- for (var r = a > 1 ? void 0 : a ? te(t, i) : t, p = s.length - 1, d; p >= 0; p--)
544
- (d = s[p]) && (r = (a ? d(t, i, r) : d(r)) || r);
545
- return a && r && jt(t, i, r), r;
537
+ p(N, "InteractionPartUtils");
538
+ let Ot = N;
539
+ var jt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, n = /* @__PURE__ */ p((s, t, o, a) => {
540
+ for (var r = a > 1 ? void 0 : a ? te(t, o) : t, c = s.length - 1, d; c >= 0; c--)
541
+ (d = s[c]) && (r = (a ? d(t, o, r) : d(r)) || r);
542
+ return a && r && jt(t, o, r), r;
546
543
  }, "__decorateClass");
547
544
  const C = {
548
545
  // KernelContent derived types
@@ -562,34 +559,34 @@ const C = {
562
559
  StreamingFinalFunctionResultContent: "StreamingFinalFunctionResultContent",
563
560
  StreamingClientOutputContent: "StreamingClientOutputContent"
564
561
  };
565
- var L;
566
- let _t = (L = class {
562
+ var z;
563
+ let Dt = (z = class {
567
564
  constructor() {
568
565
  e(this, "label");
569
566
  }
570
- }, c(L, "AuthorRole"), L);
567
+ }, p(z, "AuthorRole"), z);
571
568
  n([
572
- o(String)
573
- ], _t.prototype, "label", 2);
574
- _t = n([
569
+ i(String)
570
+ ], Dt.prototype, "label", 2);
571
+ Dt = n([
575
572
  g({ name: "AuthorRole" })
576
- ], _t);
573
+ ], Dt);
577
574
  var B;
578
- let yt = (B = class {
575
+ let ht = (B = class {
579
576
  constructor() {
580
577
  e(this, "type");
581
578
  e(this, "fullName");
582
579
  }
583
- }, c(B, "EventTypeInformation"), B);
580
+ }, p(B, "EventTypeInformation"), B);
584
581
  n([
585
- o(String)
586
- ], yt.prototype, "type", 2);
582
+ i(String)
583
+ ], ht.prototype, "type", 2);
587
584
  n([
588
- o(String)
589
- ], yt.prototype, "fullName", 2);
590
- yt = n([
585
+ i(String)
586
+ ], ht.prototype, "fullName", 2);
587
+ ht = n([
591
588
  g({ name: "EventTypeInformation" })
592
- ], yt);
589
+ ], ht);
593
590
  var K;
594
591
  let O = (K = class {
595
592
  constructor() {
@@ -608,24 +605,24 @@ let O = (K = class {
608
605
  id: this.id
609
606
  };
610
607
  }
611
- }, c(K, "LlmArtifact"), K);
608
+ }, p(K, "LlmArtifact"), K);
612
609
  n([
613
- o(String)
610
+ i(String)
614
611
  ], O.prototype, "id", 2);
615
612
  n([
616
- o(String)
613
+ i(String)
617
614
  ], O.prototype, "name", 2);
618
615
  n([
619
- o(String)
616
+ i(String)
620
617
  ], O.prototype, "mimeType", 2);
621
618
  n([
622
- o(String)
619
+ i(String)
623
620
  ], O.prototype, "description", 2);
624
621
  O = n([
625
622
  g({ name: "LlmArtifact" })
626
623
  ], O);
627
624
  var J;
628
- let _ = (J = class {
625
+ let D = (J = class {
629
626
  constructor() {
630
627
  e(this, "mimeType");
631
628
  // InnerContent is ignored (JsonIgnore in C#)
@@ -634,21 +631,21 @@ let _ = (J = class {
634
631
  e(this, "modelId");
635
632
  e(this, "metadata");
636
633
  }
637
- }, c(J, "KernelContent"), J);
634
+ }, p(J, "KernelContent"), J);
638
635
  n([
639
- o(String)
640
- ], _.prototype, "mimeType", 2);
636
+ i(String)
637
+ ], D.prototype, "mimeType", 2);
641
638
  n([
642
- o(String)
643
- ], _.prototype, "modelId", 2);
639
+ i(String)
640
+ ], D.prototype, "modelId", 2);
644
641
  n([
645
- o(q)
646
- ], _.prototype, "metadata", 2);
647
- _ = n([
642
+ i(q)
643
+ ], D.prototype, "metadata", 2);
644
+ D = n([
648
645
  g({ name: "KernelContent" })
649
- ], _);
650
- var $;
651
- let x = ($ = class {
646
+ ], D);
647
+ var V;
648
+ let x = (V = class {
652
649
  constructor() {
653
650
  e(this, "choiceIndex", 0);
654
651
  // InnerContent is ignored (JsonIgnore in C#)
@@ -657,21 +654,21 @@ let x = ($ = class {
657
654
  e(this, "modelId");
658
655
  e(this, "metadata");
659
656
  }
660
- }, c($, "StreamingKernelContent"), $);
657
+ }, p(V, "StreamingKernelContent"), V);
661
658
  n([
662
- o(Number)
659
+ i(Number)
663
660
  ], x.prototype, "choiceIndex", 2);
664
661
  n([
665
- o(String)
662
+ i(String)
666
663
  ], x.prototype, "modelId", 2);
667
664
  n([
668
- o(Object)
665
+ i(Object)
669
666
  ], x.prototype, "metadata", 2);
670
667
  x = n([
671
668
  g({ name: "StreamingKernelContent" })
672
669
  ], x);
673
- var V;
674
- let Ft = (V = class extends _ {
670
+ var $;
671
+ let Ft = ($ = class extends D {
675
672
  constructor() {
676
673
  super();
677
674
  e(this, "text");
@@ -683,74 +680,74 @@ let Ft = (V = class extends _ {
683
680
  toString() {
684
681
  return this.text ?? "";
685
682
  }
686
- }, c(V, "TextContent"), V);
683
+ }, p($, "TextContent"), $);
687
684
  n([
688
- o(String)
685
+ i(String)
689
686
  ], Ft.prototype, "text", 2);
690
687
  Ft = n([
691
688
  g({ name: "TextContent" })
692
689
  ], Ft);
693
690
  var Q;
694
- let R = (Q = class extends x {
691
+ let U = (Q = class extends x {
695
692
  constructor() {
696
693
  super();
697
694
  e(this, "eventName");
698
695
  e(this, "eventData");
699
696
  e(this, "sessionId");
700
697
  }
701
- }, c(Q, "StreamingToolEventContent"), Q);
698
+ }, p(Q, "StreamingToolEventContent"), Q);
702
699
  n([
703
- o(String)
704
- ], R.prototype, "eventName", 2);
700
+ i(String)
701
+ ], U.prototype, "eventName", 2);
705
702
  n([
706
- o(String)
707
- ], R.prototype, "eventData", 2);
703
+ i(String)
704
+ ], U.prototype, "eventData", 2);
708
705
  n([
709
- o(String)
710
- ], R.prototype, "sessionId", 2);
711
- R = n([
706
+ i(String)
707
+ ], U.prototype, "sessionId", 2);
708
+ U = n([
712
709
  g({ name: "StreamingToolEventContent" })
713
- ], R);
710
+ ], U);
714
711
  var Z;
715
- let P = (Z = class extends _ {
712
+ let P = (Z = class extends D {
716
713
  constructor() {
717
714
  super();
718
715
  e(this, "eventName");
719
716
  e(this, "eventData");
720
717
  e(this, "sessionId");
721
718
  }
722
- }, c(Z, "ToolEventContent"), Z);
719
+ }, p(Z, "ToolEventContent"), Z);
723
720
  n([
724
- o(String)
721
+ i(String)
725
722
  ], P.prototype, "eventName", 2);
726
723
  n([
727
- o(String)
724
+ i(String)
728
725
  ], P.prototype, "eventData", 2);
729
726
  n([
730
- o(String)
727
+ i(String)
731
728
  ], P.prototype, "sessionId", 2);
732
729
  P = n([
733
730
  g({ name: "ToolEventContent" })
734
731
  ], P);
735
732
  var Y;
736
- let wt = (Y = class extends _ {
733
+ let wt = (Y = class extends D {
737
734
  constructor() {
738
735
  super(...arguments);
739
736
  e(this, "url");
740
737
  e(this, "dataUri");
741
738
  }
742
- }, c(Y, "ImageContent"), Y);
739
+ }, p(Y, "ImageContent"), Y);
743
740
  n([
744
- o(String)
741
+ i(String)
745
742
  ], wt.prototype, "url", 2);
746
743
  n([
747
- o(String)
744
+ i(String)
748
745
  ], wt.prototype, "dataUri", 2);
749
746
  wt = n([
750
747
  g({ name: "ImageContent" })
751
748
  ], wt);
752
749
  var X;
753
- let E = (X = class extends _ {
750
+ let v = (X = class extends D {
754
751
  constructor() {
755
752
  super(...arguments);
756
753
  e(this, "id");
@@ -760,22 +757,22 @@ let E = (X = class extends _ {
760
757
  // Exception is not serializable - omit jsonMember decorator
761
758
  e(this, "exception");
762
759
  }
763
- }, c(X, "FunctionCallContent"), X);
760
+ }, p(X, "FunctionCallContent"), X);
764
761
  n([
765
- o(String)
766
- ], E.prototype, "id", 2);
762
+ i(String)
763
+ ], v.prototype, "id", 2);
767
764
  n([
768
- o(String)
769
- ], E.prototype, "pluginName", 2);
765
+ i(String)
766
+ ], v.prototype, "pluginName", 2);
770
767
  n([
771
- o(String)
772
- ], E.prototype, "functionName", 2);
768
+ i(String)
769
+ ], v.prototype, "functionName", 2);
773
770
  n([
774
- o(q)
775
- ], E.prototype, "arguments", 2);
776
- E = n([
771
+ i(q)
772
+ ], v.prototype, "arguments", 2);
773
+ v = n([
777
774
  g({ name: "FunctionCallContent" })
778
- ], E);
775
+ ], v);
779
776
  var j;
780
777
  let k = (j = class {
781
778
  constructor() {
@@ -785,28 +782,28 @@ let k = (j = class {
785
782
  e(this, "cancelUi");
786
783
  e(this, "parked");
787
784
  }
788
- }, c(j, "ToolCallPresentation"), j);
785
+ }, p(j, "ToolCallPresentation"), j);
789
786
  n([
790
- o(Boolean)
787
+ i(Boolean)
791
788
  ], k.prototype, "isUi", 2);
792
789
  n([
793
- o(String)
790
+ i(String)
794
791
  ], k.prototype, "askUserComponent", 2);
795
792
  n([
796
- o(String)
793
+ i(String)
797
794
  ], k.prototype, "argsDescription", 2);
798
795
  n([
799
- o(Boolean)
796
+ i(Boolean)
800
797
  ], k.prototype, "cancelUi", 2);
801
798
  n([
802
- o(Boolean)
799
+ i(Boolean)
803
800
  ], k.prototype, "parked", 2);
804
801
  k = n([
805
802
  g({ name: "ToolCallPresentation" })
806
803
  ], k);
807
804
  const ee = "aia:presentation";
808
805
  var tt;
809
- let b = (tt = class extends x {
806
+ let I = (tt = class extends x {
810
807
  constructor() {
811
808
  super(...arguments);
812
809
  e(this, "id");
@@ -814,24 +811,24 @@ let b = (tt = class extends x {
814
811
  e(this, "arguments");
815
812
  e(this, "presentation");
816
813
  }
817
- }, c(tt, "StreamingFinalFunctionCallContent"), tt);
814
+ }, p(tt, "StreamingFinalFunctionCallContent"), tt);
818
815
  n([
819
- o(String, { name: "callId" })
820
- ], b.prototype, "id", 2);
816
+ i(String, { name: "callId" })
817
+ ], I.prototype, "id", 2);
821
818
  n([
822
- o(String, { name: "name" })
823
- ], b.prototype, "functionName", 2);
819
+ i(String, { name: "name" })
820
+ ], I.prototype, "functionName", 2);
824
821
  n([
825
- o(String)
826
- ], b.prototype, "arguments", 2);
822
+ i(String)
823
+ ], I.prototype, "arguments", 2);
827
824
  n([
828
- o(k)
829
- ], b.prototype, "presentation", 2);
830
- b = n([
825
+ i(k)
826
+ ], I.prototype, "presentation", 2);
827
+ I = n([
831
828
  g({ name: "StreamingFinalFunctionCallContent" })
832
- ], b);
829
+ ], I);
833
830
  var et;
834
- let I = (et = class extends _ {
831
+ let b = (et = class extends D {
835
832
  constructor() {
836
833
  super(...arguments);
837
834
  e(this, "id");
@@ -839,24 +836,24 @@ let I = (et = class extends _ {
839
836
  e(this, "functionName");
840
837
  e(this, "result");
841
838
  }
842
- }, c(et, "FunctionResultContent"), et);
839
+ }, p(et, "FunctionResultContent"), et);
843
840
  n([
844
- o(String, { name: "callId" })
845
- ], I.prototype, "id", 2);
841
+ i(String, { name: "callId" })
842
+ ], b.prototype, "id", 2);
846
843
  n([
847
- o(String)
848
- ], I.prototype, "pluginName", 2);
844
+ i(String)
845
+ ], b.prototype, "pluginName", 2);
849
846
  n([
850
- o(String)
851
- ], I.prototype, "functionName", 2);
847
+ i(String)
848
+ ], b.prototype, "functionName", 2);
852
849
  n([
853
- o(q)
854
- ], I.prototype, "result", 2);
855
- I = n([
850
+ i(q)
851
+ ], b.prototype, "result", 2);
852
+ b = n([
856
853
  g({ name: "FunctionResultContent" })
857
- ], I);
854
+ ], b);
858
855
  var nt;
859
- let A = (nt = class extends x {
856
+ let E = (nt = class extends x {
860
857
  constructor() {
861
858
  super(...arguments);
862
859
  e(this, "id");
@@ -866,102 +863,102 @@ let A = (nt = class extends x {
866
863
  e(this, "presentation");
867
864
  e(this, "clientOutput");
868
865
  }
869
- }, c(nt, "StreamingFinalFunctionResultContent"), nt);
866
+ }, p(nt, "StreamingFinalFunctionResultContent"), nt);
870
867
  n([
871
- o(String, { name: "callId" })
872
- ], A.prototype, "id", 2);
868
+ i(String, { name: "callId" })
869
+ ], E.prototype, "id", 2);
873
870
  n([
874
- o(String)
875
- ], A.prototype, "pluginName", 2);
871
+ i(String)
872
+ ], E.prototype, "pluginName", 2);
876
873
  n([
877
- o(String)
878
- ], A.prototype, "functionName", 2);
874
+ i(String)
875
+ ], E.prototype, "functionName", 2);
879
876
  n([
880
- o(q)
881
- ], A.prototype, "result", 2);
877
+ i(q)
878
+ ], E.prototype, "result", 2);
882
879
  n([
883
- o(k)
884
- ], A.prototype, "presentation", 2);
880
+ i(k)
881
+ ], E.prototype, "presentation", 2);
885
882
  n([
886
- o(q)
887
- ], A.prototype, "clientOutput", 2);
888
- A = n([
883
+ i(q)
884
+ ], E.prototype, "clientOutput", 2);
885
+ E = n([
889
886
  g({ name: "StreamingFinalFunctionResultContent" })
890
- ], A);
891
- var it;
892
- let Ct = (it = class extends _ {
887
+ ], E);
888
+ var ot;
889
+ let Ct = (ot = class extends D {
893
890
  constructor() {
894
891
  super(...arguments);
895
892
  e(this, "id");
896
893
  e(this, "data");
897
894
  }
898
- }, c(it, "FunctionClientOutputContent"), it);
895
+ }, p(ot, "FunctionClientOutputContent"), ot);
899
896
  n([
900
- o(String, { name: "callId" })
897
+ i(String, { name: "callId" })
901
898
  ], Ct.prototype, "id", 2);
902
899
  n([
903
- o(q)
900
+ i(q)
904
901
  ], Ct.prototype, "data", 2);
905
902
  Ct = n([
906
903
  g({ name: "FunctionClientOutputContent" })
907
904
  ], Ct);
908
- var ot;
909
- let G = (ot = class extends x {
905
+ var it;
906
+ let G = (it = class extends x {
910
907
  constructor() {
911
908
  super(...arguments);
912
909
  e(this, "id");
913
910
  e(this, "clientOutput");
914
911
  e(this, "presentation");
915
912
  }
916
- }, c(ot, "StreamingClientOutputContent"), ot);
913
+ }, p(it, "StreamingClientOutputContent"), it);
917
914
  n([
918
- o(String, { name: "callId" })
915
+ i(String, { name: "callId" })
919
916
  ], G.prototype, "id", 2);
920
917
  n([
921
- o(q)
918
+ i(q)
922
919
  ], G.prototype, "clientOutput", 2);
923
920
  n([
924
- o(k)
921
+ i(k)
925
922
  ], G.prototype, "presentation", 2);
926
923
  G = n([
927
924
  g({ name: "StreamingClientOutputContent" })
928
925
  ], G);
929
926
  var at;
930
- let St = (at = class extends _ {
927
+ let St = (at = class extends D {
931
928
  constructor() {
932
929
  super(...arguments);
933
930
  e(this, "name");
934
931
  e(this, "args");
935
932
  }
936
- }, c(at, "UserUiContent"), at);
933
+ }, p(at, "UserUiContent"), at);
937
934
  n([
938
- o(String)
935
+ i(String)
939
936
  ], St.prototype, "name", 2);
940
937
  n([
941
- o(String)
938
+ i(String)
942
939
  ], St.prototype, "args", 2);
943
940
  St = n([
944
941
  g({ name: "UserUiContent" })
945
942
  ], St);
946
943
  var rt;
947
- let Tt = (rt = class extends _ {
944
+ let Tt = (rt = class extends D {
948
945
  constructor() {
949
946
  super(...arguments);
950
947
  e(this, "role");
951
948
  e(this, "items");
952
949
  }
953
- }, c(rt, "ChatMessageContent"), rt);
950
+ }, p(rt, "ChatMessageContent"), rt);
954
951
  n([
955
- o(_t)
952
+ i(Dt)
956
953
  ], Tt.prototype, "role", 2);
957
954
  n([
958
- xt(() => _)
955
+ xt(() => D)
959
956
  ], Tt.prototype, "items", 2);
960
957
  Tt = n([
961
958
  g({ name: "ChatMessageContent" })
962
959
  ], Tt);
963
960
  var st;
964
- let N = (st = class extends x {
961
+ let R = (st = class extends x {
965
962
  constructor() {
966
963
  super(...arguments);
967
964
  e(this, "callId");
@@ -969,24 +966,24 @@ let N = (st = class extends x {
969
966
  e(this, "arguments");
970
967
  e(this, "functionCallIndex", 0);
971
968
  }
972
- }, c(st, "StreamingFunctionCallUpdateContent"), st);
969
+ }, p(st, "StreamingFunctionCallUpdateContent"), st);
973
970
  n([
974
- o(String)
975
- ], N.prototype, "callId", 2);
971
+ i(String)
972
+ ], R.prototype, "callId", 2);
976
973
  n([
977
- o(String)
978
- ], N.prototype, "name", 2);
974
+ i(String)
975
+ ], R.prototype, "name", 2);
979
976
  n([
980
- o(String)
981
- ], N.prototype, "arguments", 2);
977
+ i(String)
978
+ ], R.prototype, "arguments", 2);
982
979
  n([
983
- o(Number)
984
- ], N.prototype, "functionCallIndex", 2);
985
- N = n([
980
+ i(Number)
981
+ ], R.prototype, "functionCallIndex", 2);
982
+ R = n([
986
983
  g({ name: "StreamingFunctionCallUpdateContent" })
987
- ], N);
984
+ ], R);
988
985
  var lt;
989
- let kt = (lt = class extends x {
986
+ let At = (lt = class extends x {
990
987
  constructor() {
991
988
  super(...arguments);
992
989
  e(this, "text");
@@ -994,15 +991,15 @@ let kt = (lt = class extends x {
994
991
  // Not decorated with @jsonMember
995
992
  e(this, "encoding");
996
993
  }
997
- }, c(lt, "StreamingTextContent"), lt);
994
+ }, p(lt, "StreamingTextContent"), lt);
998
995
  n([
999
- o(String)
1000
- ], kt.prototype, "text", 2);
1001
- kt = n([
996
+ i(String)
997
+ ], At.prototype, "text", 2);
998
+ At = n([
1002
999
  g({ name: "StreamingTextContent" })
1003
- ], kt);
1004
- var pt;
1005
- let At = (pt = class extends x {
1000
+ ], At);
1001
+ var ct;
1002
+ let kt = (ct = class extends x {
1006
1003
  constructor() {
1007
1004
  super(...arguments);
1008
1005
  e(this, "text");
@@ -1010,26 +1007,26 @@ let At = (pt = class extends x {
1010
1007
  // Not decorated with @jsonMember
1011
1008
  e(this, "encoding");
1012
1009
  }
1013
- }, c(pt, "StreamingReasoningContent"), pt);
1010
+ }, p(ct, "StreamingReasoningContent"), ct);
1014
1011
  n([
1015
- o(String)
1016
- ], At.prototype, "text", 2);
1017
- At = n([
1012
+ i(String)
1013
+ ], kt.prototype, "text", 2);
1014
+ kt = n([
1018
1015
  g({ name: "StreamingReasoningContent" })
1019
- ], At);
1020
- var ct;
1021
- let vt = (ct = class extends x {
1016
+ ], kt);
1017
+ var pt;
1018
+ let Et = (pt = class extends x {
1022
1019
  constructor() {
1023
1020
  super(...arguments);
1024
1021
  e(this, "headline");
1025
1022
  }
1026
- }, c(ct, "StreamingThoughtHighlightContent"), ct);
1023
+ }, p(pt, "StreamingThoughtHighlightContent"), pt);
1027
1024
  n([
1028
- o(String)
1029
- ], vt.prototype, "headline", 2);
1030
- vt = n([
1025
+ i(String)
1026
+ ], Et.prototype, "headline", 2);
1027
+ Et = n([
1031
1028
  g({ name: "StreamingThoughtHighlightContent" })
1032
- ], vt);
1029
+ ], Et);
1033
1030
  var ut;
1034
1031
  let M = (ut = class {
1035
1032
  constructor() {
@@ -1037,21 +1034,21 @@ let M = (ut = class {
1037
1034
  e(this, "description", "");
1038
1035
  e(this, "interactionId", "");
1039
1036
  }
1040
- }, c(ut, "InstructionSummary"), ut);
1037
+ }, p(ut, "InstructionSummary"), ut);
1041
1038
  n([
1042
- o(String)
1039
+ i(String)
1043
1040
  ], M.prototype, "instructionCategory", 2);
1044
1041
  n([
1045
- o(String)
1042
+ i(String)
1046
1043
  ], M.prototype, "description", 2);
1047
1044
  n([
1048
- o(String)
1045
+ i(String)
1049
1046
  ], M.prototype, "interactionId", 2);
1050
1047
  M = n([
1051
1048
  g({ name: "InstructionSummary" })
1052
1049
  ], M);
1053
1050
  var dt;
1054
- let D = (dt = class {
1051
+ let _ = (dt = class {
1055
1052
  constructor() {
1056
1053
  e(this, "size", 0);
1057
1054
  e(this, "originalSize", 0);
@@ -1066,46 +1063,46 @@ let D = (dt = class {
1066
1063
  e(this, "compressionRatio");
1067
1064
  e(this, "newOverallCount");
1068
1065
  }
1069
- }, c(dt, "SessionInformation"), dt);
1066
+ }, p(dt, "SessionInformation"), dt);
1070
1067
  n([
1071
- o(Number)
1072
- ], D.prototype, "size", 2);
1068
+ i(Number)
1069
+ ], _.prototype, "size", 2);
1073
1070
  n([
1074
- o(Number)
1075
- ], D.prototype, "originalSize", 2);
1071
+ i(Number)
1072
+ ], _.prototype, "originalSize", 2);
1076
1073
  n([
1077
- o(Number)
1078
- ], D.prototype, "ratio", 2);
1074
+ i(Number)
1075
+ ], _.prototype, "ratio", 2);
1079
1076
  n([
1080
- o(Number)
1081
- ], D.prototype, "previousRatio", 2);
1077
+ i(Number)
1078
+ ], _.prototype, "previousRatio", 2);
1082
1079
  n([
1083
- o(Number)
1084
- ], D.prototype, "threshold", 2);
1080
+ i(Number)
1081
+ ], _.prototype, "threshold", 2);
1085
1082
  n([
1086
- o(Number)
1087
- ], D.prototype, "maxSize", 2);
1083
+ i(Number)
1084
+ ], _.prototype, "maxSize", 2);
1088
1085
  n([
1089
- o(String)
1090
- ], D.prototype, "id", 2);
1086
+ i(String)
1087
+ ], _.prototype, "id", 2);
1091
1088
  n([
1092
1089
  xt(M)
1093
- ], D.prototype, "instructionSummaries", 2);
1090
+ ], _.prototype, "instructionSummaries", 2);
1094
1091
  n([
1095
- o(Number)
1096
- ], D.prototype, "interactionsCompressed", 2);
1092
+ i(Number)
1093
+ ], _.prototype, "interactionsCompressed", 2);
1097
1094
  n([
1098
- o(Number)
1099
- ], D.prototype, "interactionsRemoved", 2);
1095
+ i(Number)
1096
+ ], _.prototype, "interactionsRemoved", 2);
1100
1097
  n([
1101
- o(Number)
1102
- ], D.prototype, "compressionRatio", 2);
1098
+ i(Number)
1099
+ ], _.prototype, "compressionRatio", 2);
1103
1100
  n([
1104
- o(Number)
1105
- ], D.prototype, "newOverallCount", 2);
1106
- D = n([
1101
+ i(Number)
1102
+ ], _.prototype, "newOverallCount", 2);
1103
+ _ = n([
1107
1104
  g({ name: "SessionInformation" })
1108
- ], D);
1105
+ ], _);
1109
1106
  var mt;
1110
1107
  let S = (mt = class {
1111
1108
  constructor() {
@@ -1128,48 +1125,48 @@ let S = (mt = class {
1128
1125
  e(this, "subAgentName");
1129
1126
  e(this, "text");
1130
1127
  }
1131
- }, c(mt, "LlmEvent"), mt);
1128
+ }, p(mt, "LlmEvent"), mt);
1132
1129
  n([
1133
- o(Number)
1130
+ i(Number)
1134
1131
  ], S.prototype, "timestamp", 2);
1135
1132
  n([
1136
- o(String)
1133
+ i(String)
1137
1134
  ], S.prototype, "mimeType", 2);
1138
1135
  n([
1139
- o(Boolean)
1136
+ i(Boolean)
1140
1137
  ], S.prototype, "partial", 2);
1141
1138
  n([
1142
- o(Boolean)
1139
+ i(Boolean)
1143
1140
  ], S.prototype, "turnComplete", 2);
1144
1141
  n([
1145
- o(Boolean)
1142
+ i(Boolean)
1146
1143
  ], S.prototype, "visible", 2);
1147
1144
  n([
1148
- o(String)
1145
+ i(String)
1149
1146
  ], S.prototype, "serverError", 2);
1150
1147
  n([
1151
- o(String)
1148
+ i(String)
1152
1149
  ], S.prototype, "interactionId", 2);
1153
1150
  n([
1154
- o(D)
1151
+ i(_)
1155
1152
  ], S.prototype, "sessionInformation", 2);
1156
1153
  n([
1157
- o(yt)
1154
+ i(ht)
1158
1155
  ], S.prototype, "eventType", 2);
1159
1156
  n([
1160
1157
  xt(O)
1161
1158
  ], S.prototype, "artifactsGenerated", 2);
1162
1159
  n([
1163
- o(String)
1160
+ i(String)
1164
1161
  ], S.prototype, "author", 2);
1165
1162
  n([
1166
- o(_t)
1163
+ i(Dt)
1167
1164
  ], S.prototype, "role", 2);
1168
1165
  n([
1169
- o(String)
1166
+ i(String)
1170
1167
  ], S.prototype, "command", 2);
1171
1168
  n([
1172
- o(Tt)
1169
+ i(Tt)
1173
1170
  ], S.prototype, "content", 2);
1174
1171
  n([
1175
1172
  xt(() => x)
@@ -1191,42 +1188,42 @@ let F = (gt = class {
1191
1188
  e(this, "partialEventType");
1192
1189
  e(this, "subAgentId");
1193
1190
  }
1194
- }, c(gt, "PartialLlmEvent"), gt);
1191
+ }, p(gt, "PartialLlmEvent"), gt);
1195
1192
  n([
1196
- o(Number, { name: "ts" })
1193
+ i(Number, { name: "ts" })
1197
1194
  ], F.prototype, "timeStamp", 2);
1198
1195
  n([
1199
- o(String, { name: "pt" })
1196
+ i(String, { name: "pt" })
1200
1197
  ], F.prototype, "partialText", 2);
1201
1198
  n([
1202
- o(String, { name: "pr" })
1199
+ i(String, { name: "pr" })
1203
1200
  ], F.prototype, "partialReasoning", 2);
1204
1201
  n([
1205
- o(String, { name: "fn" })
1202
+ i(String, { name: "fn" })
1206
1203
  ], F.prototype, "functionName", 2);
1207
1204
  n([
1208
1205
  xt(() => x)
1209
1206
  ], F.prototype, "streamingParts", 2);
1210
1207
  n([
1211
- o(String, { name: "fid" })
1208
+ i(String, { name: "fid" })
1212
1209
  ], F.prototype, "functionCallId", 2);
1213
1210
  n([
1214
- o(String, { name: "tp" })
1211
+ i(String, { name: "tp" })
1215
1212
  ], F.prototype, "type", 2);
1216
1213
  n([
1217
- o(String, { name: "itid" })
1214
+ i(String, { name: "itid" })
1218
1215
  ], F.prototype, "iteractionId", 2);
1219
1216
  n([
1220
- o(yt)
1217
+ i(ht)
1221
1218
  ], F.prototype, "partialEventType", 2);
1222
1219
  n([
1223
- o(String, { name: "said" })
1220
+ i(String, { name: "said" })
1224
1221
  ], F.prototype, "subAgentId", 2);
1225
1222
  F = n([
1226
1223
  g({ name: "PartialLlmEvent" })
1227
1224
  ], F);
1228
1225
  var ft;
1229
- let w = (ft = class {
1226
+ let A = (ft = class {
1230
1227
  constructor() {
1231
1228
  e(this, "type");
1232
1229
  e(this, "event");
@@ -1237,51 +1234,51 @@ let w = (ft = class {
1237
1234
  e(this, "subAgentName");
1238
1235
  e(this, "seq");
1239
1236
  }
1240
- }, c(ft, "StreamingResponse"), ft);
1237
+ }, p(ft, "StreamingResponse"), ft);
1241
1238
  n([
1242
- o(String)
1243
- ], w.prototype, "type", 2);
1239
+ i(String)
1240
+ ], A.prototype, "type", 2);
1244
1241
  n([
1245
- o(S)
1246
- ], w.prototype, "event", 2);
1242
+ i(S)
1243
+ ], A.prototype, "event", 2);
1247
1244
  n([
1248
- o(String)
1249
- ], w.prototype, "sessionId", 2);
1245
+ i(String)
1246
+ ], A.prototype, "sessionId", 2);
1250
1247
  n([
1251
- o(String)
1252
- ], w.prototype, "accessToken", 2);
1248
+ i(String)
1249
+ ], A.prototype, "accessToken", 2);
1253
1250
  n([
1254
- o(F, { name: "pe" })
1255
- ], w.prototype, "partialEvent", 2);
1251
+ i(F, { name: "pe" })
1252
+ ], A.prototype, "partialEvent", 2);
1256
1253
  n([
1257
- o(String)
1258
- ], w.prototype, "subAgentId", 2);
1254
+ i(String)
1255
+ ], A.prototype, "subAgentId", 2);
1259
1256
  n([
1260
- o(String)
1261
- ], w.prototype, "subAgentName", 2);
1257
+ i(String)
1258
+ ], A.prototype, "subAgentName", 2);
1262
1259
  n([
1263
- o(Number)
1264
- ], w.prototype, "seq", 2);
1265
- w = n([
1260
+ i(Number)
1261
+ ], A.prototype, "seq", 2);
1262
+ A = n([
1266
1263
  g({ name: "StreamingResponse" })
1267
- ], w);
1268
- var ht;
1269
- let Rt = (ht = class {
1264
+ ], A);
1265
+ var yt;
1266
+ let Ut = (yt = class {
1270
1267
  constructor() {
1271
1268
  e(this, "events");
1272
1269
  }
1273
- }, c(ht, "Payload"), ht);
1270
+ }, p(yt, "Payload"), yt);
1274
1271
  n([
1275
1272
  xt(S)
1276
- ], Rt.prototype, "events", 2);
1277
- Rt = n([
1273
+ ], Ut.prototype, "events", 2);
1274
+ Ut = n([
1278
1275
  g({ name: "Payload" })
1279
- ], Rt);
1280
- function Ht(s) {
1276
+ ], Ut);
1277
+ function Wt(s) {
1281
1278
  var r;
1282
1279
  const t = (s == null ? void 0 : s.presentation) ?? ((r = s == null ? void 0 : s.metadata) == null ? void 0 : r[ee]);
1283
1280
  if (!t || typeof t != "object") return { isUi: !1 };
1284
- const i = t, a = /* @__PURE__ */ c((p, d) => i[p] ?? i[d], "pick");
1281
+ const o = t, a = /* @__PURE__ */ p((c, d) => o[c] ?? o[d], "pick");
1285
1282
  return {
1286
1283
  isUi: a("isUi", "IsUi") === !0,
1287
1284
  askUserComponent: a("askUserComponent", "AskUserComponent") || void 0,
@@ -1292,8 +1289,8 @@ function Ht(s) {
1292
1289
  parked: a("parked", "Parked") === !0 || void 0
1293
1290
  };
1294
1291
  }
1295
- c(Ht, "readPresentation");
1296
- const v = class v {
1292
+ p(Wt, "readPresentation");
1293
+ const w = class w {
1297
1294
  constructor(t) {
1298
1295
  e(this, "uniqueId");
1299
1296
  e(this, "mimeType");
@@ -1328,8 +1325,8 @@ const v = class v {
1328
1325
  e(this, "visible", !0);
1329
1326
  this.interactionId = t, this.author = "main";
1330
1327
  }
1331
- static createErrorEvent(t, i) {
1332
- const a = new v(i);
1328
+ static createErrorEvent(t, o) {
1329
+ const a = new w(o);
1333
1330
  a.turn_complete = !0, a.partial = !1, a.parts = [];
1334
1331
  const r = {
1335
1332
  eventType: l.ServerError,
@@ -1340,85 +1337,88 @@ const v = class v {
1340
1337
  author: "main",
1341
1338
  created: /* @__PURE__ */ new Date(),
1342
1339
  partial: !1,
1343
- isStillWriting: !1,
1344
1340
  mustPush: !1,
1345
1341
  textAppendable: !1
1346
1342
  };
1347
1343
  return a.parts.push(r), a;
1348
1344
  }
1349
1345
  static parseFlatPropertiesTypedEvent(t) {
1350
- var a, r, p;
1351
- const i = new v(t.interactionId);
1352
- if (i.serverError = t.serverError, !t.interactionId)
1346
+ var a, r, c;
1347
+ const o = new w(t.interactionId);
1348
+ if (o.serverError = t.serverError, !t.interactionId && !w.carriesServerError(t))
1353
1349
  throw new Error("Interaction ID is required");
1354
- switch (i.model_session_id = "", i.server_session_id = null, i.asyncFinalResponse = t.turnComplete, i.command = (a = t.command) == null ? void 0 : a.toString(), t.sessionInformation && (i.session_information = t.sessionInformation), (!t.author || t.author == "") && console.warn('[ServerEvent] event with no author; defaulting to "main"', {
1350
+ switch (o.model_session_id = "", o.server_session_id = null, o.asyncFinalResponse = t.turnComplete, o.command = (a = t.command) == null ? void 0 : a.toString(), t.sessionInformation && (o.session_information = t.sessionInformation), (!t.author || t.author == "") && console.warn('[ServerEvent] event with no author; defaulting to "main"', {
1355
1351
  interactionId: t.interactionId,
1356
1352
  turnComplete: t.turnComplete
1357
1353
  }), t == null ? void 0 : t.author) {
1358
1354
  case Yt:
1359
- i.author = "tool";
1355
+ o.author = "tool";
1360
1356
  break;
1361
1357
  case "system":
1362
- i.author = "system";
1358
+ o.author = "system";
1363
1359
  break;
1364
1360
  default:
1365
- i.author = "main";
1361
+ o.author = "main";
1366
1362
  }
1367
- return i.mimeType = t.mimeType, i.created = new Date(t.timestamp), i.eventType = l.NotDefined, i.partial = ((p = (r = t.partial) == null ? void 0 : r.toString()) == null ? void 0 : p.toLowerCase()) === "true", i.turn_complete = t.turnComplete, i.visible = t.visible, i.isFinalResponse = t.turnComplete ?? !1, i.artifactsDelta = [], t.artifactsGenerated && t.artifactsGenerated.length > 0 && (i.created = new Date(t.timestamp), i.llmArtifacts = t.artifactsGenerated), i.subAgentId = t.subAgentId, i.subAgentName = t.subAgentName, i;
1363
+ return o.mimeType = t.mimeType, o.created = new Date(t.timestamp), o.eventType = l.NotDefined, o.partial = ((c = (r = t.partial) == null ? void 0 : r.toString()) == null ? void 0 : c.toLowerCase()) === "true", o.turn_complete = t.turnComplete, o.visible = t.visible, o.isFinalResponse = t.turnComplete ?? !1, o.artifactsDelta = [], t.artifactsGenerated && t.artifactsGenerated.length > 0 && (o.created = new Date(t.timestamp), o.llmArtifacts = t.artifactsGenerated), o.subAgentId = t.subAgentId, o.subAgentName = t.subAgentName, o;
1368
1364
  }
1369
1365
  static getPartType(t) {
1370
- return t instanceof Ft ? "TextContent" : t instanceof E ? "FunctionCallContent" : t instanceof I ? "FunctionResultContent" : t instanceof N ? "StreamingFunctionCallUpdateContent" : t instanceof b ? "StreamingFinalFunctionCallContent" : t instanceof A ? "StreamingFinalFunctionResultContent" : t instanceof Ct ? "FunctionClientOutputContent" : t instanceof G ? "StreamingClientOutputContent" : t instanceof St ? "UserUiContent" : t instanceof kt ? "StreamingTextContent" : t instanceof At ? "StreamingReasoningContent" : t instanceof vt ? "StreamingThoughtHighlightContent" : t instanceof P ? "ToolEventContent" : t instanceof R ? "StreamingToolEventContent" : "Unknown";
1366
+ return t instanceof Ft ? "TextContent" : t instanceof v ? "FunctionCallContent" : t instanceof b ? "FunctionResultContent" : t instanceof R ? "StreamingFunctionCallUpdateContent" : t instanceof I ? "StreamingFinalFunctionCallContent" : t instanceof E ? "StreamingFinalFunctionResultContent" : t instanceof Ct ? "FunctionClientOutputContent" : t instanceof G ? "StreamingClientOutputContent" : t instanceof St ? "UserUiContent" : t instanceof At ? "StreamingTextContent" : t instanceof kt ? "StreamingReasoningContent" : t instanceof Et ? "StreamingThoughtHighlightContent" : t instanceof P ? "ToolEventContent" : t instanceof U ? "StreamingToolEventContent" : "Unknown";
1367
+ }
1368
+ /** True when the event holds the SDK's "Server Error" sentinel call (`Event.GetErrorEvent`). */
1369
+ static carriesServerError(t) {
1370
+ var a;
1371
+ return (((a = t.content) == null ? void 0 : a.items) ?? []).some((r) => (r == null ? void 0 : r.id) === w.SERVER_ERROR_CALL_ID);
1371
1372
  }
1372
1373
  static parseFromTypedEvent(t) {
1373
- var p, d, f, W, Pt, Gt, Mt;
1374
- const i = v.parseFlatPropertiesTypedEvent(t);
1375
- if (i.serverError)
1376
- return i.parts.push(Ot.fromError(i.serverError)), i;
1374
+ var c, d, f, H, Pt, Gt, Mt;
1375
+ const o = w.parseFlatPropertiesTypedEvent(t);
1376
+ if (o.serverError)
1377
+ return o.parts.push(Ot.fromError(o.serverError)), o;
1377
1378
  if (!t.content && !t.streamingParts)
1378
- return i;
1379
- i.parts = [];
1380
- const a = [...((p = t.content) == null ? void 0 : p.items) ?? [], ...t.streamingParts ?? []];
1381
- i.eventType = Xt(((d = t.eventType) == null ? void 0 : d.type) ?? "");
1382
- for (const h of a) {
1379
+ return o;
1380
+ o.parts = [];
1381
+ const a = [...((c = t.content) == null ? void 0 : c.items) ?? [], ...t.streamingParts ?? []];
1382
+ o.eventType = Xt(((d = t.eventType) == null ? void 0 : d.type) ?? "");
1383
+ for (const y of a) {
1383
1384
  let u = {
1384
1385
  id: "",
1385
- author: i.author,
1386
- eventType: i.eventType,
1386
+ author: o.author,
1387
+ eventType: o.eventType,
1387
1388
  created: /* @__PURE__ */ new Date(),
1388
- visible: i.visible,
1389
- partial: i.partial,
1390
- isStillWriting: !1,
1389
+ visible: o.visible,
1390
+ partial: o.partial,
1391
1391
  mustPush: !1,
1392
1392
  textAppendable: !1
1393
1393
  };
1394
- const y = v.getPartType(h);
1395
- if (y == C.FunctionCallContent || y == C.FunctionResultContent || y == C.StreamingFinalFunctionCallContent || y == C.StreamingFinalFunctionResultContent) {
1396
- var r = h;
1397
- if (r.id == "Server Error") {
1398
- const m = r.arguments ?? {}, H = typeof m.error == "string" && m.error.trim().length > 0 ? m.error : JSON.stringify(r.arguments);
1394
+ const h = w.getPartType(y);
1395
+ if (h == C.FunctionCallContent || h == C.FunctionResultContent || h == C.StreamingFinalFunctionCallContent || h == C.StreamingFinalFunctionResultContent) {
1396
+ var r = y;
1397
+ if (r.id == w.SERVER_ERROR_CALL_ID) {
1398
+ const m = r.arguments ?? {}, W = typeof m.error == "string" && m.error.trim().length > 0 ? m.error : JSON.stringify(r.arguments);
1399
1399
  u.eventType = l.ServerError, u.errorDetails = {
1400
- errorMessage: H,
1400
+ errorMessage: W,
1401
1401
  stackTrace: typeof m.stackTrace == "string" ? m.stackTrace : void 0
1402
1402
  }, u.functionDetails = void 0;
1403
1403
  } else {
1404
- u.eventType = y == C.FunctionCallContent || y == C.StreamingFinalFunctionCallContent ? l.FunctionCall : l.FunctionResponse;
1404
+ u.eventType = h == C.FunctionCallContent || h == C.StreamingFinalFunctionCallContent ? l.FunctionCall : l.FunctionResponse;
1405
1405
  let m;
1406
1406
  try {
1407
1407
  if (r != null && r.result)
1408
1408
  if (typeof r.result == "object")
1409
1409
  m = r.result;
1410
1410
  else if (typeof r.result == "string") {
1411
- const Dt = JSON.parse(r.result);
1412
- m = typeof Dt == "object" && Dt !== null ? Dt : r.result;
1411
+ const _t = JSON.parse(r.result);
1412
+ m = typeof _t == "object" && _t !== null ? _t : r.result;
1413
1413
  } else
1414
1414
  m = r.result;
1415
- } catch (Dt) {
1416
- console.warn("Parse function error", Dt), m = r == null ? void 0 : r.result;
1415
+ } catch (_t) {
1416
+ console.warn("Parse function error", _t), m = r == null ? void 0 : r.result;
1417
1417
  }
1418
1418
  u.thoughtDetails = {
1419
1419
  text: ""
1420
1420
  };
1421
- const H = Ht(r);
1421
+ const W = Wt(r);
1422
1422
  u.functionDetails = {
1423
1423
  id: (r == null ? void 0 : r.id) ?? "",
1424
1424
  args: r == null ? void 0 : r.arguments,
@@ -1427,40 +1427,40 @@ const v = class v {
1427
1427
  // `start`. Keying on the persisted type alone left every LIVE call `Executing` with no
1428
1428
  // start, and a renderer gating its elapsed timer on `status === 'Executing' && start`
1429
1429
  // showed "running" with no stopwatch (AIA issue 1022). Same for `end` on the result.
1430
- start: y == C.FunctionCallContent || y == C.StreamingFinalFunctionCallContent ? i.created : void 0,
1431
- end: y == C.FunctionResultContent || y == C.StreamingFinalFunctionResultContent ? i.created : void 0,
1430
+ start: h == C.FunctionCallContent || h == C.StreamingFinalFunctionCallContent ? o.created : void 0,
1431
+ end: h == C.FunctionResultContent || h == C.StreamingFinalFunctionResultContent ? o.created : void 0,
1432
1432
  text: JSON.stringify(r == null ? void 0 : r.arguments) ?? "",
1433
1433
  name: (r == null ? void 0 : r.functionName) ?? "",
1434
1434
  status: u.eventType == l.FunctionCall ? "Executing" : "Done",
1435
1435
  response: m,
1436
- isUi: H.isUi,
1437
- argsDescription: H.argsDescription,
1436
+ isUi: W.isUi,
1437
+ argsDescription: W.argsDescription,
1438
1438
  // Client-only payload riding the RESULT event: live top-level `clientOutput`, or
1439
1439
  // metadata.clientOutput on the collapsed/persisted result. Calls leave it undefined.
1440
1440
  // The persisted-replay form also folds in via FunctionClientOutputContent.
1441
1441
  clientOutput: (r == null ? void 0 : r.clientOutput) ?? ((f = r == null ? void 0 : r.metadata) == null ? void 0 : f.clientOutput),
1442
- askUserComponent: H.askUserComponent,
1442
+ askUserComponent: W.askUserComponent,
1443
1443
  // Runtime "don't render" override on a RESULT (CallContext.CancelUiRender).
1444
- cancelUi: H.cancelUi
1444
+ cancelUi: W.cancelUi
1445
1445
  }, u.functionDetails.isAskUser = !!u.functionDetails.askUserComponent, t.text = r == null ? void 0 : r.arguments;
1446
1446
  }
1447
- } else if (y == C.StreamingTextContent)
1448
- u.eventType = l.Text, u.text = (W = h == null ? void 0 : h.text) == null ? void 0 : W.replaceAll("\\n", `
1449
- `), u.textLastChunk = h.text, t.text = u.text;
1450
- else if (y == C.TextContent)
1451
- u.eventType = l.Text, u.text = (Pt = h == null ? void 0 : h.text) == null ? void 0 : Pt.replaceAll("\\n", `
1452
- `), u.textLastChunk = h.text, t.text = u.text;
1453
- else if (y == C.StreamingReasoningContent)
1447
+ } else if (h == C.StreamingTextContent)
1448
+ u.eventType = l.Text, u.text = (H = y == null ? void 0 : y.text) == null ? void 0 : H.replaceAll("\\n", `
1449
+ `), t.text = u.text;
1450
+ else if (h == C.TextContent)
1451
+ u.eventType = l.Text, u.text = (Pt = y == null ? void 0 : y.text) == null ? void 0 : Pt.replaceAll("\\n", `
1452
+ `), t.text = u.text;
1453
+ else if (h == C.StreamingReasoningContent)
1454
1454
  u.eventType = l.Thought, u.thoughtDetails = {
1455
- text: ((Gt = h == null ? void 0 : h.text) == null ? void 0 : Gt.replaceAll("\\n", `
1455
+ text: ((Gt = y == null ? void 0 : y.text) == null ? void 0 : Gt.replaceAll("\\n", `
1456
1456
  `)) ?? ""
1457
- }, u.text = (Mt = h == null ? void 0 : h.text) == null ? void 0 : Mt.replaceAll("\\n", `
1458
- `), u.textLastChunk = h.text, t.text = u.text;
1459
- else if (y == C.StreamingThoughtHighlightContent) {
1460
- const m = (h == null ? void 0 : h.headline) ?? "";
1457
+ }, u.text = (Mt = y == null ? void 0 : y.text) == null ? void 0 : Mt.replaceAll("\\n", `
1458
+ `), t.text = u.text;
1459
+ else if (h == C.StreamingThoughtHighlightContent) {
1460
+ const m = (y == null ? void 0 : y.headline) ?? "";
1461
1461
  u.eventType = l.ThoughtHighlight, u.thoughtDetails = { text: "", headlines: m ? [m] : [] };
1462
- } else if (y == C.StreamingFunctionCallUpdateContent) {
1463
- const m = h;
1462
+ } else if (h == C.StreamingFunctionCallUpdateContent) {
1463
+ const m = y;
1464
1464
  u.eventType = l.PartialFunctionCall, u.text = m.arguments, u.thoughtDetails = {
1465
1465
  text: ""
1466
1466
  }, u.functionDetails = {
@@ -1469,24 +1469,24 @@ const v = class v {
1469
1469
  status: "Composing",
1470
1470
  name: (m == null ? void 0 : m.name) ?? "Unknown"
1471
1471
  }, t.text = u.text;
1472
- } else if (y == C.ToolEventContent || y == C.StreamingToolEventContent) {
1472
+ } else if (h == C.ToolEventContent || h == C.StreamingToolEventContent) {
1473
1473
  u.eventType = l.ToolEvent;
1474
- const m = h;
1474
+ const m = y;
1475
1475
  u.toolDetails = {
1476
1476
  eventName: m.eventName ?? "",
1477
1477
  eventData: m.eventData ?? "",
1478
1478
  sessionId: m.sessionId ?? void 0
1479
1479
  };
1480
- } else if (y == C.FunctionClientOutputContent) {
1481
- const m = h;
1480
+ } else if (h == C.FunctionClientOutputContent) {
1481
+ const m = y;
1482
1482
  u.eventType = l.FunctionClientOutput, u.functionDetails = {
1483
1483
  id: m.id ?? "",
1484
1484
  name: "",
1485
1485
  status: "Done",
1486
1486
  clientOutput: m.data
1487
1487
  };
1488
- } else if (y == C.StreamingClientOutputContent) {
1489
- const m = h;
1488
+ } else if (h == C.StreamingClientOutputContent) {
1489
+ const m = y;
1490
1490
  u.eventType = l.FunctionClientOutput, u.functionDetails = {
1491
1491
  id: m.id ?? "",
1492
1492
  name: "",
@@ -1495,10 +1495,10 @@ const v = class v {
1495
1495
  status: "Executing",
1496
1496
  clientOutput: m.clientOutput,
1497
1497
  // The park signal itself (the reason this event fires even with no prefill).
1498
- parked: Ht(m).parked
1498
+ parked: Wt(m).parked
1499
1499
  };
1500
- } else if (y == C.UserUiContent) {
1501
- const m = h;
1500
+ } else if (h == C.UserUiContent) {
1501
+ const m = y;
1502
1502
  u.eventType = l.UserAnswer, u.author = "user", u.functionDetails = {
1503
1503
  id: "",
1504
1504
  name: m.name ?? "",
@@ -1507,14 +1507,14 @@ const v = class v {
1507
1507
  isUi: !0
1508
1508
  };
1509
1509
  } else {
1510
- u.eventType = l.NotDefined, console.warn(`Got a unmapped event_type:${i.eventType}, data:`, y, h);
1510
+ u.eventType = l.NotDefined, console.warn(`Got a unmapped event_type:${o.eventType}, data:`, h, y);
1511
1511
  continue;
1512
1512
  }
1513
- i.parts.push(u);
1513
+ o.parts.push(u);
1514
1514
  }
1515
- return i;
1515
+ return o;
1516
1516
  }
1517
- static createFromThought(t, i) {
1517
+ static createFromThought(t, o) {
1518
1518
  return {
1519
1519
  author: "main",
1520
1520
  visible: !0,
@@ -1532,7 +1532,7 @@ const v = class v {
1532
1532
  parts: [
1533
1533
  {
1534
1534
  thoughtDetails: {
1535
- text: i
1535
+ text: o
1536
1536
  },
1537
1537
  // ThoughtPart renders `part.text` (via getPartTextContent), so a
1538
1538
  // thought built here with only `thoughtDetails` rendered as an
@@ -1540,12 +1540,11 @@ const v = class v {
1540
1540
  // StreamingReasoningContent — match it, or this factory produces
1541
1541
  // a part the UI cannot show. Only the demo's fake gateway builds
1542
1542
  // thoughts this way, which is why it went unnoticed.
1543
- text: i,
1544
- id: It(),
1543
+ text: o,
1544
+ id: bt(),
1545
1545
  created: /* @__PURE__ */ new Date(),
1546
1546
  eventType: l.Thought,
1547
1547
  author: "main",
1548
- isStillWriting: !1,
1549
1548
  textAppendable: !0,
1550
1549
  partial: !0,
1551
1550
  mustPush: !0
@@ -1553,8 +1552,8 @@ const v = class v {
1553
1552
  ]
1554
1553
  };
1555
1554
  }
1556
- static createFromFunctionName(t, i, a) {
1557
- const r = v.createFromText("", i);
1555
+ static createFromFunctionName(t, o, a) {
1556
+ const r = w.createFromText("", o);
1558
1557
  return r.parts[0].text = void 0, r.parts[0].thoughtDetails = void 0, r.parts[0].textAppendable = !1, r.parts[0].mustPush = !0, r.parts[0].functionDetails = {
1559
1558
  name: t,
1560
1559
  id: "callId",
@@ -1565,13 +1564,13 @@ const v = class v {
1565
1564
  args: a
1566
1565
  }, r;
1567
1566
  }
1568
- static createFromText(t, i, a) {
1567
+ static createFromText(t, o, a) {
1569
1568
  return {
1570
1569
  author: "main",
1571
1570
  visible: !0,
1572
1571
  eventType: l.Text,
1573
1572
  uniqueId: (/* @__PURE__ */ new Date()).getTime().toString(),
1574
- interactionId: i,
1573
+ interactionId: o,
1575
1574
  allEventTypes: [l.Text],
1576
1575
  artifactsDelta: [""],
1577
1576
  model_session_id: "",
@@ -1589,7 +1588,7 @@ const v = class v {
1589
1588
  thoughtDetails: a ? {
1590
1589
  text: a
1591
1590
  } : void 0,
1592
- id: It(),
1591
+ id: bt(),
1593
1592
  created: /* @__PURE__ */ new Date(),
1594
1593
  // Part eventType MUST match the outer event's eventType.
1595
1594
  // Was previously `Thought` here, which made the merger
@@ -1599,7 +1598,6 @@ const v = class v {
1599
1598
  // then "disappear" once the part was reclassified.
1600
1599
  eventType: l.Text,
1601
1600
  author: "main",
1602
- isStillWriting: !1,
1603
1601
  textAppendable: !0,
1604
1602
  partial: !0,
1605
1603
  mustPush: !0,
@@ -1609,166 +1607,167 @@ const v = class v {
1609
1607
  };
1610
1608
  }
1611
1609
  };
1612
- c(v, "ServerEvent");
1613
- let zt = v;
1610
+ p(w, "ServerEvent"), /** The call id the SDK puts on its error sentinel (`Event.ServerErrorIdentification`). */
1611
+ e(w, "SERVER_ERROR_CALL_ID", "Server Error");
1612
+ let Lt = w;
1614
1613
  const Bt = [
1615
1614
  // KernelContent derived types
1616
1615
  Ft,
1617
1616
  wt,
1618
- E,
1617
+ v,
1619
1618
  P,
1620
- I,
1619
+ b,
1621
1620
  Ct,
1622
1621
  St,
1623
1622
  Tt,
1624
1623
  // StreamingKernelContent derived types
1625
- kt,
1626
- N,
1627
1624
  At,
1628
- vt,
1629
1625
  R,
1630
- b,
1631
- A,
1626
+ kt,
1627
+ Et,
1628
+ U,
1629
+ I,
1630
+ E,
1632
1631
  G,
1633
1632
  M
1634
1633
  ];
1635
1634
  function ne(s) {
1636
1635
  return s.name;
1637
1636
  }
1638
- c(ne, "getConstructorName");
1639
- function Kt(s, t, i, a) {
1640
- t.constructor !== i && (s.$type = (a == null ? void 0 : a.name) ?? ne(t.constructor));
1637
+ p(ne, "getConstructorName");
1638
+ function Kt(s, t, o, a) {
1639
+ t.constructor !== o && (s.$type = (a == null ? void 0 : a.name) ?? ne(t.constructor));
1641
1640
  }
1642
- c(Kt, "dotNetTypeEmitter");
1641
+ p(Kt, "dotNetTypeEmitter");
1643
1642
  function Jt(s, t) {
1644
1643
  if (s.$type != null)
1645
1644
  return t.get(s.$type);
1646
1645
  }
1647
- c(Jt, "dotnetTypeResolver");
1648
- function $t() {
1649
- const s = new Lt(S);
1646
+ p(Jt, "dotnetTypeResolver");
1647
+ function Vt() {
1648
+ const s = new zt(S);
1650
1649
  return s.config({
1651
1650
  knownTypes: Bt,
1652
1651
  typeHintEmitter: Kt,
1653
1652
  typeResolver: Jt
1654
1653
  }), s;
1655
1654
  }
1656
- c($t, "createEventSerializer");
1657
- function ie() {
1658
- const s = new Lt(w);
1655
+ p(Vt, "createEventSerializer");
1656
+ function oe() {
1657
+ const s = new zt(A);
1659
1658
  return s.config({
1660
1659
  knownTypes: Bt,
1661
1660
  typeHintEmitter: Kt,
1662
1661
  typeResolver: Jt
1663
1662
  }), s;
1664
1663
  }
1665
- c(ie, "createStreamingResponseSerializer");
1666
- function Vt(s) {
1664
+ p(oe, "createStreamingResponseSerializer");
1665
+ function $t(s) {
1667
1666
  try {
1668
1667
  return JSON.parse(s), s;
1669
1668
  } catch {
1670
- let i = "", a = !1;
1669
+ let o = "", a = !1;
1671
1670
  for (let r = 0; r < s.length; r++) {
1672
- const p = s[r], d = p.charCodeAt(0);
1673
- if (p === "\\" && a && r + 1 < s.length) {
1671
+ const c = s[r], d = c.charCodeAt(0);
1672
+ if (c === "\\" && a && r + 1 < s.length) {
1674
1673
  const f = s[r + 1];
1675
1674
  if (f === '"' || f === "\\" || f === "/" || f === "b" || f === "f" || f === "n" || f === "r" || f === "t") {
1676
- i += p + f, r++;
1675
+ o += c + f, r++;
1677
1676
  continue;
1678
1677
  } else if (f === "u" && r + 5 < s.length) {
1679
- i += s.substring(r, r + 6), r += 5;
1678
+ o += s.substring(r, r + 6), r += 5;
1680
1679
  continue;
1681
1680
  } else {
1682
- i += p;
1681
+ o += c;
1683
1682
  continue;
1684
1683
  }
1685
1684
  }
1686
- if (p === '"') {
1685
+ if (c === '"') {
1687
1686
  let f = 0;
1688
- for (let W = r - 1; W >= 0 && s[W] === "\\"; W--)
1687
+ for (let H = r - 1; H >= 0 && s[H] === "\\"; H--)
1689
1688
  f++;
1690
- f % 2 === 0 && (a = !a), i += p;
1689
+ f % 2 === 0 && (a = !a), o += c;
1691
1690
  continue;
1692
1691
  }
1693
1692
  if (a && d < 32)
1694
- switch (p) {
1693
+ switch (c) {
1695
1694
  case `
1696
1695
  `:
1697
- i += "\\n";
1696
+ o += "\\n";
1698
1697
  break;
1699
1698
  case "\r":
1700
- i += "\\r";
1699
+ o += "\\r";
1701
1700
  break;
1702
1701
  case " ":
1703
- i += "\\t";
1702
+ o += "\\t";
1704
1703
  break;
1705
1704
  case "\f":
1706
- i += "\\f";
1705
+ o += "\\f";
1707
1706
  break;
1708
1707
  case "\b":
1709
- i += "\\b";
1708
+ o += "\\b";
1710
1709
  break;
1711
1710
  default:
1712
1711
  const f = d.toString(16).padStart(4, "0");
1713
- i += `\\u${f}`;
1712
+ o += `\\u${f}`;
1714
1713
  break;
1715
1714
  }
1716
1715
  else
1717
- i += p;
1716
+ o += c;
1718
1717
  }
1719
- return i;
1718
+ return o;
1720
1719
  }
1721
1720
  }
1722
- c(Vt, "sanitizeJsonString");
1723
- function ke(s) {
1724
- const t = Vt(s);
1725
- return ie().parse(t);
1726
- }
1727
- c(ke, "deserializePayload");
1721
+ p($t, "sanitizeJsonString");
1728
1722
  function Ae(s) {
1729
- const t = Vt(s);
1730
- return $t().parse(t);
1723
+ const t = $t(s);
1724
+ return oe().parse(t);
1725
+ }
1726
+ p(Ae, "deserializePayload");
1727
+ function ke(s) {
1728
+ const t = $t(s);
1729
+ return Vt().parse(t);
1731
1730
  }
1732
- c(Ae, "deserializeEvent");
1733
- function ve(s) {
1734
- return $t().stringify(s);
1731
+ p(ke, "deserializeEvent");
1732
+ function Ee(s) {
1733
+ return Vt().stringify(s);
1735
1734
  }
1736
- c(ve, "serializeEvent");
1735
+ p(Ee, "serializeEvent");
1737
1736
  export {
1738
1737
  xe as A,
1739
1738
  fe as C,
1740
1739
  l as E,
1741
- E as F,
1740
+ v as F,
1742
1741
  Xt as G,
1743
1742
  Ot as I,
1744
1743
  S as L,
1745
- _e as M,
1744
+ De as M,
1746
1745
  C as P,
1747
- ye as R,
1748
- zt as S,
1746
+ he as R,
1747
+ Lt as S,
1749
1748
  Ft as T,
1750
1749
  Te as a,
1751
- bt as b,
1750
+ It as b,
1752
1751
  Se as c,
1753
1752
  Ce as d,
1754
1753
  me as e,
1755
1754
  Tt as f,
1756
- he as g,
1757
- I as h,
1755
+ ye as g,
1756
+ b as h,
1758
1757
  T as i,
1759
1758
  ge as j,
1760
- De as k,
1761
- N as l,
1762
- At as m,
1763
- w as n,
1764
- kt as o,
1765
- $t as p,
1766
- ie as q,
1767
- Ae as r,
1768
- ke as s,
1759
+ _e as k,
1760
+ R as l,
1761
+ kt as m,
1762
+ A as n,
1763
+ At as o,
1764
+ Vt as p,
1765
+ oe as q,
1766
+ ke as r,
1767
+ Ae as s,
1769
1768
  we as t,
1770
1769
  Fe as u,
1771
- Vt as v,
1772
- ve as w
1770
+ $t as v,
1771
+ Ee as w
1773
1772
  };
1774
- //# sourceMappingURL=serializer-DX-yGa_k.js.map
1773
+ //# sourceMappingURL=serializer-CC-nM3ig.js.map