@harnessio/ai-chat-core 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,36 +1,36 @@
1
1
  var H = Object.defineProperty;
2
- var J = (a, n, t) => n in a ? H(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
- var u = (a, n, t) => J(a, typeof n != "symbol" ? n + "" : n, t);
4
- import U, { createContext as B, useContext as W, useState as m, useEffect as w, useReducer as z, useCallback as C, useMemo as V } from "react";
2
+ var J = (n, s, t) => s in n ? H(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
3
+ var u = (n, s, t) => J(n, typeof s != "symbol" ? s + "" : s, t);
4
+ import q, { createContext as U, useContext as B, useState as y, useEffect as m, useReducer as V, useCallback as C, useMemo as z } from "react";
5
5
  class G {
6
6
  constructor() {
7
7
  u(this, "plugins", /* @__PURE__ */ new Map());
8
8
  u(this, "renderersByType", /* @__PURE__ */ new Map());
9
9
  }
10
- registerPlugin(n) {
11
- this.plugins.has(n.id), this.plugins.set(n.id, n), n.renderers.forEach((t) => {
10
+ registerPlugin(s) {
11
+ this.plugins.has(s.id), this.plugins.set(s.id, s), s.renderers.forEach((t) => {
12
12
  const e = this.renderersByType.get(t.type) || [];
13
- e.push(t), e.sort((s, r) => ((r == null ? void 0 : r.priority) ?? 0) - ((s == null ? void 0 : s.priority) ?? 0)), this.renderersByType.set(t.type, e);
13
+ e.push(t), e.sort((i, r) => ((r == null ? void 0 : r.priority) ?? 0) - ((i == null ? void 0 : i.priority) ?? 0)), this.renderersByType.set(t.type, e);
14
14
  });
15
15
  }
16
- unregisterPlugin(n) {
17
- const t = this.plugins.get(n);
16
+ unregisterPlugin(s) {
17
+ const t = this.plugins.get(s);
18
18
  return t ? (t.renderers.forEach((e) => {
19
- const r = (this.renderersByType.get(e.type) || []).filter((i) => !t.renderers.includes(i));
19
+ const r = (this.renderersByType.get(e.type) || []).filter((a) => !t.renderers.includes(a));
20
20
  r.length === 0 ? this.renderersByType.delete(e.type) : this.renderersByType.set(e.type, r);
21
- }), this.plugins.delete(n)) : !1;
21
+ }), this.plugins.delete(s)) : !1;
22
22
  }
23
- getPlugin(n) {
24
- return this.plugins.get(n);
23
+ getPlugin(s) {
24
+ return this.plugins.get(s);
25
25
  }
26
26
  getAllPlugins() {
27
27
  return Array.from(this.plugins.values());
28
28
  }
29
- getRenderersByType(n) {
30
- return this.renderersByType.get(n) || [];
29
+ getRenderersByType(s) {
30
+ return this.renderersByType.get(s) || [];
31
31
  }
32
- getBestRendererForType(n) {
33
- return this.getRenderersByType(n)[0];
32
+ getBestRendererForType(s) {
33
+ return this.getRenderersByType(s)[0];
34
34
  }
35
35
  clear() {
36
36
  this.plugins.clear(), this.renderersByType.clear();
@@ -41,36 +41,36 @@ class Y {
41
41
  u(this, "handlers", /* @__PURE__ */ new Map());
42
42
  u(this, "renderers", /* @__PURE__ */ new Map());
43
43
  }
44
- registerHandler(n, t, e = 0) {
45
- const s = this.handlers.get(n) || [], r = { handler: t, priority: e }, i = s.findIndex((o) => o.priority < e);
46
- i === -1 ? s.push(r) : s.splice(i, 0, r), this.handlers.set(n, s);
44
+ registerHandler(s, t, e = 0) {
45
+ const i = this.handlers.get(s) || [], r = { handler: t, priority: e }, a = i.findIndex((o) => o.priority < e);
46
+ a === -1 ? i.push(r) : i.splice(a, 0, r), this.handlers.set(s, i);
47
47
  }
48
- registerRenderer(n, t, e = 0) {
49
- const s = this.renderers.get(n) || [], r = { renderer: t, priority: e }, i = s.findIndex((o) => o.priority < e);
50
- i === -1 ? s.push(r) : s.splice(i, 0, r), this.renderers.set(n, s);
48
+ registerRenderer(s, t, e = 0) {
49
+ const i = this.renderers.get(s) || [], r = { renderer: t, priority: e }, a = i.findIndex((o) => o.priority < e);
50
+ a === -1 ? i.push(r) : i.splice(a, 0, r), this.renderers.set(s, i);
51
51
  }
52
- unregister(n) {
53
- this.handlers.delete(n), this.renderers.delete(n);
52
+ unregister(s) {
53
+ this.handlers.delete(s), this.renderers.delete(s);
54
54
  }
55
- getHandler(n) {
55
+ getHandler(s) {
56
56
  var e;
57
- const t = this.handlers.get(n);
57
+ const t = this.handlers.get(s);
58
58
  return (e = t == null ? void 0 : t[0]) == null ? void 0 : e.handler;
59
59
  }
60
- getRenderer(n) {
60
+ getRenderer(s) {
61
61
  var e;
62
- const t = this.renderers.get(n);
62
+ const t = this.renderers.get(s);
63
63
  return (e = t == null ? void 0 : t[0]) == null ? void 0 : e.renderer;
64
64
  }
65
65
  getStrategy() {
66
66
  return "queue";
67
67
  }
68
- hasHandler(n) {
69
- const t = this.handlers.get(n);
68
+ hasHandler(s) {
69
+ const t = this.handlers.get(s);
70
70
  return t !== void 0 && t.length > 0;
71
71
  }
72
- hasRenderer(n) {
73
- const t = this.renderers.get(n);
72
+ hasRenderer(s) {
73
+ const t = this.renderers.get(s);
74
74
  return t !== void 0 && t.length > 0;
75
75
  }
76
76
  clear() {
@@ -81,27 +81,27 @@ class Y {
81
81
  }
82
82
  }
83
83
  class K {
84
- constructor(n) {
84
+ constructor(s) {
85
85
  u(this, "executions", /* @__PURE__ */ new Map());
86
86
  u(this, "executionQueue", []);
87
87
  u(this, "isProcessing", !1);
88
88
  u(this, "runningByName", /* @__PURE__ */ new Map());
89
89
  u(this, "subscribers", /* @__PURE__ */ new Set());
90
90
  u(this, "getHandler");
91
- this.getHandler = n;
91
+ this.getHandler = s;
92
92
  }
93
- async executeCapability(n, t, e, s, r = "queue") {
94
- if (!this.getHandler(n)) {
95
- console.warn(`No handler registered for capability: ${n}`);
93
+ async executeCapability(s, t, e, i, r = "queue") {
94
+ if (!this.getHandler(s)) {
95
+ console.warn(`No handler registered for capability: ${s}`);
96
96
  return;
97
97
  }
98
98
  const o = {
99
99
  id: t,
100
- name: n,
100
+ name: s,
101
101
  args: e,
102
102
  status: { type: "queued" },
103
103
  timestamp: Date.now(),
104
- messageId: s
104
+ messageId: i
105
105
  };
106
106
  switch (this.executions.set(t, o), this.notifySubscribers(t), r) {
107
107
  case "queue":
@@ -114,64 +114,207 @@ class K {
114
114
  async processQueue() {
115
115
  if (!(this.isProcessing || this.executionQueue.length === 0)) {
116
116
  for (this.isProcessing = !0; this.executionQueue.length > 0; ) {
117
- const n = this.executionQueue.shift(), t = this.executions.get(n);
117
+ const s = this.executionQueue.shift(), t = this.executions.get(s);
118
118
  if (!t) continue;
119
119
  const e = this.getHandler(t.name);
120
120
  if (!e) continue;
121
- t.status = { type: "running" }, this.notifySubscribers(n);
122
- const s = this.runningByName.get(t.name) || [];
123
- s.push(n), this.runningByName.set(t.name, s);
121
+ t.status = { type: "running" }, this.notifySubscribers(s);
122
+ const i = this.runningByName.get(t.name) || [];
123
+ i.push(s), this.runningByName.set(t.name, i);
124
124
  try {
125
125
  const r = await e.execute(t.args, {
126
126
  messageId: t.messageId,
127
- capabilityId: n
127
+ capabilityId: s
128
128
  });
129
129
  t.status = { type: "complete", result: r }, t.result = r;
130
130
  } catch (r) {
131
- const i = r instanceof Error ? r.message : "Unknown error";
132
- t.status = { type: "error", error: i }, t.error = i;
131
+ const a = r instanceof Error ? r.message : "Unknown error";
132
+ t.status = { type: "error", error: a }, t.error = a;
133
133
  } finally {
134
- const r = this.runningByName.get(t.name) || [], i = r.indexOf(n);
135
- i > -1 && r.splice(i, 1), r.length === 0 ? this.runningByName.delete(t.name) : this.runningByName.set(t.name, r), this.notifySubscribers(n);
134
+ const r = this.runningByName.get(t.name) || [], a = r.indexOf(s);
135
+ a > -1 && r.splice(a, 1), r.length === 0 ? this.runningByName.delete(t.name) : this.runningByName.set(t.name, r), this.notifySubscribers(s);
136
136
  }
137
137
  }
138
138
  this.isProcessing = !1;
139
139
  }
140
140
  }
141
- getExecution(n) {
142
- return this.executions.get(n);
141
+ getExecution(s) {
142
+ return this.executions.get(s);
143
143
  }
144
- getExecutionsByMessage(n) {
145
- return Array.from(this.executions.values()).filter((t) => t.messageId === n);
144
+ getExecutionsByMessage(s) {
145
+ return Array.from(this.executions.values()).filter((t) => t.messageId === s);
146
146
  }
147
- subscribe(n) {
148
- return this.subscribers.add(n), () => this.subscribers.delete(n);
147
+ subscribe(s) {
148
+ return this.subscribers.add(s), () => this.subscribers.delete(s);
149
149
  }
150
- notifySubscribers(n) {
151
- this.subscribers.forEach((t) => t(n));
150
+ notifySubscribers(s) {
151
+ this.subscribers.forEach((t) => t(s));
152
152
  }
153
153
  clear() {
154
154
  this.executions.clear(), this.executionQueue = [], this.runningByName.clear();
155
155
  }
156
156
  }
157
- class b {
157
+ class X {
158
+ constructor() {
159
+ u(this, "scopes", /* @__PURE__ */ new Map());
160
+ u(this, "scopeStack", []);
161
+ this.scopes.set("global", {
162
+ mode: "merge",
163
+ actions: /* @__PURE__ */ new Map()
164
+ }), this.scopeStack.push("global");
165
+ }
166
+ /**
167
+ * Activate a scope with the specified mode.
168
+ * This pushes the scope onto the stack, making it active.
169
+ */
170
+ activateScope(s, t = "merge") {
171
+ if (!this.scopes.has(s))
172
+ this.scopes.set(s, {
173
+ mode: t,
174
+ actions: /* @__PURE__ */ new Map()
175
+ });
176
+ else {
177
+ const e = this.scopes.get(s);
178
+ e.mode = t;
179
+ }
180
+ this.scopeStack.includes(s) || this.scopeStack.push(s);
181
+ }
182
+ /**
183
+ * Deactivate a scope, removing it from the stack.
184
+ * This restores the previous scope as active.
185
+ */
186
+ deactivateScope(s) {
187
+ const t = this.scopeStack.indexOf(s);
188
+ t !== -1 && s !== "global" && this.scopeStack.splice(t, 1);
189
+ }
190
+ /**
191
+ * Get the currently active scope (top of stack).
192
+ */
193
+ getActiveScope() {
194
+ return this.scopeStack[this.scopeStack.length - 1] || "global";
195
+ }
196
+ /**
197
+ * Get the full scope stack.
198
+ */
199
+ getScopeStack() {
200
+ return [...this.scopeStack];
201
+ }
202
+ /**
203
+ * Register a quick action in the specified scope.
204
+ */
205
+ register(s, t = "global") {
206
+ const e = s.priority ?? 0;
207
+ this.scopes.has(t) || this.scopes.set(t, {
208
+ mode: "merge",
209
+ actions: /* @__PURE__ */ new Map()
210
+ });
211
+ const i = this.scopes.get(t);
212
+ i.actions.has(s.id) && console.warn(`QuickAction with id "${s.id}" is already registered in scope "${t}". Overwriting.`), i.actions.set(s.id, {
213
+ config: s,
214
+ priority: e
215
+ });
216
+ }
217
+ /**
218
+ * Unregister a quick action from the specified scope.
219
+ */
220
+ unregister(s, t = "global") {
221
+ const e = this.scopes.get(t);
222
+ return e ? e.actions.delete(s) : !1;
223
+ }
224
+ /**
225
+ * Clear all actions in the specified scope.
226
+ */
227
+ clearScope(s) {
228
+ const t = this.scopes.get(s);
229
+ t && t.actions.clear();
230
+ }
231
+ /**
232
+ * Get all visible quick actions based on the active scope and its mode.
233
+ */
234
+ async getVisible(s) {
235
+ const t = this.getActiveScope(), e = this.scopes.get(t);
236
+ if (!e)
237
+ return [];
238
+ const i = e.mode;
239
+ let r = [];
240
+ if (i === "replace")
241
+ r = Array.from(e.actions.values());
242
+ else if (i === "append")
243
+ for (const c of this.scopeStack) {
244
+ const h = this.scopes.get(c);
245
+ h && r.push(...Array.from(h.actions.values()));
246
+ }
247
+ else {
248
+ const c = this.scopes.get("global");
249
+ c && r.push(...Array.from(c.actions.values())), t !== "global" && r.push(...Array.from(e.actions.values()));
250
+ }
251
+ let o = (await Promise.all(
252
+ r.map(async (c) => {
253
+ if (!c.config.condition)
254
+ return { entry: c, visible: !0 };
255
+ try {
256
+ const h = await c.config.condition();
257
+ return { entry: c, visible: h };
258
+ } catch (h) {
259
+ return console.error(`Error evaluating condition for quick action "${c.config.id}":`, h), { entry: c, visible: !1 };
260
+ }
261
+ })
262
+ )).filter((c) => c.visible).map((c) => c.entry);
263
+ return o.sort((c, h) => h.priority - c.priority), s != null && s.scope && (o = o.filter((c) => c.config.scope === s.scope)), o.map((c) => ({
264
+ id: c.config.id,
265
+ label: c.config.label,
266
+ prompt: c.config.prompt,
267
+ icon: c.config.icon,
268
+ description: c.config.description,
269
+ priority: c.config.priority,
270
+ scope: c.config.scope
271
+ }));
272
+ }
273
+ /**
274
+ * Get a single quick action by ID from the specified scope.
275
+ */
276
+ get(s, t = "global") {
277
+ const e = this.scopes.get(t);
278
+ if (!e)
279
+ return;
280
+ const i = e.actions.get(s);
281
+ if (i)
282
+ return {
283
+ id: i.config.id,
284
+ label: i.config.label,
285
+ prompt: i.config.prompt,
286
+ icon: i.config.icon,
287
+ description: i.config.description,
288
+ priority: i.config.priority,
289
+ scope: i.config.scope
290
+ };
291
+ }
292
+ /**
293
+ * Check if a quick action exists in the specified scope.
294
+ */
295
+ has(s, t = "global") {
296
+ const e = this.scopes.get(t);
297
+ return e ? e.actions.has(s) : !1;
298
+ }
299
+ }
300
+ class _ {
158
301
  constructor() {
159
302
  u(this, "_subscriptions", /* @__PURE__ */ new Set());
160
303
  }
161
- subscribe(n) {
162
- return this._subscriptions.add(n), () => {
163
- this._subscriptions.delete(n);
304
+ subscribe(s) {
305
+ return this._subscriptions.add(s), () => {
306
+ this._subscriptions.delete(s);
164
307
  };
165
308
  }
166
309
  notifySubscribers() {
167
- for (const n of this._subscriptions)
168
- n();
310
+ for (const s of this._subscriptions)
311
+ s();
169
312
  }
170
313
  getSubscriberCount() {
171
314
  return this._subscriptions.size;
172
315
  }
173
316
  }
174
- class X extends b {
317
+ class Z extends _ {
175
318
  constructor() {
176
319
  super(...arguments);
177
320
  u(this, "_state", {
@@ -204,14 +347,14 @@ class X extends b {
204
347
  get focusedContentIndex() {
205
348
  return this._state.focusedContentIndex;
206
349
  }
207
- focus(t, e, s, r = "detail") {
350
+ focus(t, e, i, r = "detail") {
208
351
  this._state = {
209
352
  isActive: !0,
210
353
  context: r,
211
354
  focusedContent: t,
212
355
  focusedMessage: e,
213
356
  focusedMessageId: e.id,
214
- focusedContentIndex: s
357
+ focusedContentIndex: i
215
358
  }, this.notifySubscribers();
216
359
  }
217
360
  blur() {
@@ -224,8 +367,8 @@ class X extends b {
224
367
  focusedContentIndex: null
225
368
  }, this.notifySubscribers();
226
369
  }
227
- toggle(t, e, s, r = "detail") {
228
- this._state.isActive && this._state.focusedMessageId === e.id && this._state.focusedContentIndex === s && this._state.context === r ? this.blur() : this.focus(t, e, s, r);
370
+ toggle(t, e, i, r = "detail") {
371
+ this._state.isActive && this._state.focusedMessageId === e.id && this._state.focusedContentIndex === i && this._state.context === r ? this.blur() : this.focus(t, e, i, r);
229
372
  }
230
373
  switchContext(t) {
231
374
  this._state.isActive && this._state.focusedContent && (this._state = {
@@ -235,46 +378,46 @@ class X extends b {
235
378
  }
236
379
  focusNext(t) {
237
380
  if (!this._state.focusedMessageId || !t.length) return;
238
- const e = t.findIndex((i) => i.id === this._state.focusedMessageId);
381
+ const e = t.findIndex((a) => a.id === this._state.focusedMessageId);
239
382
  if (e === -1) return;
240
- const s = t[e], r = this._state.focusedContentIndex ?? 0;
241
- if (r + 1 < s.content.length) {
242
- const i = s.content[r + 1];
243
- this.focus(i, s, r + 1, this._state.context || "detail");
383
+ const i = t[e], r = this._state.focusedContentIndex ?? 0;
384
+ if (r + 1 < i.content.length) {
385
+ const a = i.content[r + 1];
386
+ this.focus(a, i, r + 1, this._state.context || "detail");
244
387
  return;
245
388
  }
246
389
  if (e + 1 < t.length) {
247
- const i = t[e + 1];
248
- i.content.length > 0 && this.focus(i.content[0], i, 0, this._state.context || "detail");
390
+ const a = t[e + 1];
391
+ a.content.length > 0 && this.focus(a.content[0], a, 0, this._state.context || "detail");
249
392
  }
250
393
  }
251
394
  focusPrevious(t) {
252
395
  if (!this._state.focusedMessageId || !t.length) return;
253
- const e = t.findIndex((i) => i.id === this._state.focusedMessageId);
396
+ const e = t.findIndex((a) => a.id === this._state.focusedMessageId);
254
397
  if (e === -1) return;
255
- const s = t[e], r = this._state.focusedContentIndex ?? 0;
398
+ const i = t[e], r = this._state.focusedContentIndex ?? 0;
256
399
  if (r > 0) {
257
- const i = s.content[r - 1];
258
- this.focus(i, s, r - 1, this._state.context || "detail");
400
+ const a = i.content[r - 1];
401
+ this.focus(a, i, r - 1, this._state.context || "detail");
259
402
  return;
260
403
  }
261
404
  if (e > 0) {
262
- const i = t[e - 1];
263
- if (i.content.length > 0) {
264
- const o = i.content.length - 1;
265
- this.focus(i.content[o], i, o, this._state.context || "detail");
405
+ const a = t[e - 1];
406
+ if (a.content.length > 0) {
407
+ const o = a.content.length - 1;
408
+ this.focus(a.content[o], a, o, this._state.context || "detail");
266
409
  }
267
410
  }
268
411
  }
269
412
  }
270
- let Z = 0, tt = 0;
271
- function T() {
272
- return `msg-${Date.now()}-${++Z}`;
413
+ let tt = 0, et = 0;
414
+ function v() {
415
+ return `msg-${Date.now()}-${++tt}`;
273
416
  }
274
- function N() {
275
- return `thread-${Date.now()}-${++tt}`;
417
+ function k() {
418
+ return `thread-${Date.now()}-${++et}`;
276
419
  }
277
- class v extends b {
420
+ class T extends _ {
278
421
  constructor(t) {
279
422
  super();
280
423
  u(this, "_state");
@@ -302,7 +445,7 @@ class v extends b {
302
445
  return super.subscribe(t);
303
446
  }
304
447
  }
305
- class et extends b {
448
+ class st extends _ {
306
449
  constructor() {
307
450
  super(...arguments);
308
451
  u(this, "_text", "");
@@ -330,11 +473,11 @@ class et extends b {
330
473
  this._isSubmitting = t, this.notifySubscribers();
331
474
  }
332
475
  }
333
- class R extends b {
476
+ class R extends _ {
334
477
  constructor(t) {
335
478
  super();
336
479
  u(this, "composer");
337
- this._core = t, this.composer = new et(), this._core.subscribe(() => {
480
+ this._core = t, this.composer = new st(), this._core.subscribe(() => {
338
481
  this.notifySubscribers();
339
482
  });
340
483
  }
@@ -425,11 +568,14 @@ class R extends b {
425
568
  setTitle(t) {
426
569
  this._core.setTitle(t);
427
570
  }
571
+ updateMessageContent(t, e) {
572
+ this._core.updateMessageContent(t, e);
573
+ }
428
574
  subscribe(t) {
429
575
  return super.subscribe(t);
430
576
  }
431
577
  }
432
- class E extends b {
578
+ class M extends _ {
433
579
  constructor(t) {
434
580
  super();
435
581
  u(this, "_messages", []);
@@ -481,12 +627,12 @@ class E extends b {
481
627
  };
482
628
  }
483
629
  updateMessages(t) {
484
- var e, s;
485
- this._messages = t, (s = (e = this.config).onMessagesChange) == null || s.call(e, this._messages), this.notifySubscribers();
630
+ var e, i;
631
+ this._messages = t, (i = (e = this.config).onMessagesChange) == null || i.call(e, this._messages), this.notifySubscribers();
486
632
  }
487
633
  append(t) {
488
634
  const e = {
489
- id: t.id || T(),
635
+ id: t.id || v(),
490
636
  parentId: t.parentId,
491
637
  role: t.role,
492
638
  content: t.content,
@@ -523,14 +669,14 @@ class E extends b {
523
669
  if (this._isRunning)
524
670
  throw new Error("A run is already in progress");
525
671
  this._isWaitingForUser = !1, this._pendingCapability = null, this._isRunning = !0, this._abortController = new AbortController(), this._currentPart = null;
526
- const e = T(), s = {
672
+ const e = v(), i = {
527
673
  id: e,
528
674
  role: "assistant",
529
675
  content: [],
530
676
  status: { type: "running" },
531
677
  timestamp: Date.now()
532
678
  };
533
- this.updateMessages([...this._messages, s]);
679
+ this.updateMessages([...this._messages, i]);
534
680
  try {
535
681
  const r = this.config.streamAdapter.stream({
536
682
  messages: this._messages,
@@ -538,20 +684,20 @@ class E extends b {
538
684
  signal: this._abortController.signal,
539
685
  systemEvent: t
540
686
  });
541
- for await (const i of r) {
687
+ for await (const a of r) {
542
688
  if (this._abortController.signal.aborted)
543
689
  break;
544
- this.handleStreamEvent(e, i.event);
690
+ this.handleStreamEvent(e, a.event);
545
691
  }
546
692
  this.updateMessageStatus(e, { type: "complete" });
547
693
  } catch (r) {
548
694
  if (r instanceof Error && r.name === "AbortError")
549
695
  this.completeStreamingContent(e), this.updateMessageStatus(e, { type: "cancelled" });
550
696
  else {
551
- const i = r instanceof Error ? r.message : "Unknown error";
697
+ const a = r instanceof Error ? r.message : "Unknown error";
552
698
  this.completeStreamingContent(e), this.updateMessageStatus(e, {
553
699
  type: "error",
554
- error: i
700
+ error: a
555
701
  });
556
702
  }
557
703
  } finally {
@@ -562,34 +708,34 @@ class E extends b {
562
708
  if (this._isRunning)
563
709
  throw new Error("A run is already in progress");
564
710
  this._isWaitingForUser = !1, this._pendingCapability = null, this.append(t), this._isRunning = !0, this._abortController = new AbortController(), this._currentPart = null;
565
- const e = T(), s = {
711
+ const e = v(), i = {
566
712
  id: e,
567
713
  role: "assistant",
568
714
  content: [],
569
715
  status: { type: "running" },
570
716
  timestamp: Date.now()
571
717
  };
572
- this.updateMessages([...this._messages, s]);
718
+ this.updateMessages([...this._messages, i]);
573
719
  try {
574
720
  const r = this.config.streamAdapter.stream({
575
721
  messages: this._messages,
576
722
  conversationId: this._conversationId,
577
723
  signal: this._abortController.signal
578
724
  });
579
- for await (const i of r) {
725
+ for await (const a of r) {
580
726
  if (this._abortController.signal.aborted)
581
727
  break;
582
- this.handleStreamEvent(e, i.event);
728
+ this.handleStreamEvent(e, a.event);
583
729
  }
584
730
  this.updateMessageStatus(e, { type: "complete" });
585
731
  } catch (r) {
586
732
  if (r instanceof Error && r.name === "AbortError")
587
733
  this.completeStreamingContent(e), this.updateMessageStatus(e, { type: "cancelled" });
588
734
  else {
589
- const i = r instanceof Error ? r.message : "Unknown error";
735
+ const a = r instanceof Error ? r.message : "Unknown error";
590
736
  this.completeStreamingContent(e), this.updateMessageStatus(e, {
591
737
  type: "error",
592
- error: i
738
+ error: a
593
739
  });
594
740
  }
595
741
  } finally {
@@ -597,9 +743,9 @@ class E extends b {
597
743
  }
598
744
  }
599
745
  handleStreamEvent(t, e) {
600
- const s = this._messages.findIndex((o) => o.id === t);
601
- if (s === -1) return;
602
- const r = this._messages[s];
746
+ const i = this._messages.findIndex((o) => o.id === t);
747
+ if (i === -1) return;
748
+ const r = this._messages[i];
603
749
  if (e.type === "part-start")
604
750
  this.handlePartStart(r, e);
605
751
  else if (e.type === "text-delta" || e.type === "assistant_thought")
@@ -621,15 +767,15 @@ class E extends b {
621
767
  args: o.args
622
768
  };
623
769
  r.content.push(c);
624
- const d = o.artifact;
625
- d && r.content.push({
770
+ const h = o.artifact;
771
+ h && r.content.push({
626
772
  type: "artifact",
627
773
  data: {
628
774
  capabilityName: o.capabilityName,
629
775
  originalArgs: o.args,
630
776
  displayData: {
631
- name: d.displayName,
632
- type: d.displayType
777
+ name: h.displayName,
778
+ type: h.displayType
633
779
  }
634
780
  }
635
781
  }), this.config.capabilityExecutionManager && this.config.capabilityExecutionManager.executeCapability(
@@ -662,15 +808,15 @@ class E extends b {
662
808
  }
663
809
  ];
664
810
  }
665
- const i = [
666
- ...this._messages.slice(0, s),
811
+ const a = [
812
+ ...this._messages.slice(0, i),
667
813
  { ...r, timestamp: Date.now() },
668
- ...this._messages.slice(s + 1)
814
+ ...this._messages.slice(i + 1)
669
815
  ];
670
- this.updateMessages(i);
816
+ this.updateMessages(a);
671
817
  }
672
818
  handlePartStart(t, e) {
673
- const s = t.content.length;
819
+ const i = t.content.length;
674
820
  let r;
675
821
  switch (e.part.type) {
676
822
  case "assistant_thought":
@@ -698,7 +844,7 @@ class E extends b {
698
844
  }
699
845
  t.content = [...t.content, r], this._currentPart = {
700
846
  messageId: t.id,
701
- contentIndex: s,
847
+ contentIndex: i,
702
848
  type: e.part.type,
703
849
  parentId: e.part.parentId
704
850
  };
@@ -708,8 +854,8 @@ class E extends b {
708
854
  console.warn("Received text-delta without part-start");
709
855
  return;
710
856
  }
711
- const s = t.content[this._currentPart.contentIndex];
712
- s.type === "assistant_thought" ? (Array.isArray(s.data) || (s.data = []), e.delta.trim() && s.data.push(e.delta.trim())) : s.data = (s.data || "") + e.delta;
857
+ const i = t.content[this._currentPart.contentIndex];
858
+ i.type === "assistant_thought" ? (Array.isArray(i.data) || (i.data = []), e.delta.trim() && i.data.push(e.delta.trim())) : i.data = (i.data || "") + e.delta;
713
859
  }
714
860
  handlePartFinish() {
715
861
  if (!this._currentPart) {
@@ -718,9 +864,9 @@ class E extends b {
718
864
  }
719
865
  const t = this._messages.findIndex((e) => e.id === this._currentPart.messageId);
720
866
  if (t !== -1) {
721
- const e = this._messages[t], s = e.content[this._currentPart.contentIndex];
722
- if (s) {
723
- s.status = { type: "complete" };
867
+ const e = this._messages[t], i = e.content[this._currentPart.contentIndex];
868
+ if (i) {
869
+ i.status = { type: "complete" };
724
870
  const r = [
725
871
  ...this._messages.slice(0, t),
726
872
  { ...e, timestamp: Date.now() },
@@ -732,32 +878,32 @@ class E extends b {
732
878
  this._currentPart = null;
733
879
  }
734
880
  updateMessageStatus(t, e) {
735
- const s = this._messages.findIndex((i) => i.id === t);
736
- if (s === -1) return;
881
+ const i = this._messages.findIndex((a) => a.id === t);
882
+ if (i === -1) return;
737
883
  const r = [
738
- ...this._messages.slice(0, s),
884
+ ...this._messages.slice(0, i),
739
885
  {
740
- ...this._messages[s],
886
+ ...this._messages[i],
741
887
  status: e
742
888
  },
743
- ...this._messages.slice(s + 1)
889
+ ...this._messages.slice(i + 1)
744
890
  ];
745
891
  this.updateMessages(r);
746
892
  }
747
893
  completeStreamingContent(t) {
748
894
  const e = this._messages.findIndex((c) => c.id === t);
749
895
  if (e === -1) return;
750
- const s = this._messages[e];
751
- if (!s.content.some((c) => {
752
- var d;
753
- return ((d = c.status) == null ? void 0 : d.type) === "streaming";
896
+ const i = this._messages[e];
897
+ if (!i.content.some((c) => {
898
+ var h;
899
+ return ((h = c.status) == null ? void 0 : h.type) === "streaming";
754
900
  })) return;
755
- const i = s.content.map((c) => {
756
- var d;
757
- return ((d = c.status) == null ? void 0 : d.type) === "streaming" ? { ...c, status: { type: "complete" } } : c;
901
+ const a = i.content.map((c) => {
902
+ var h;
903
+ return ((h = c.status) == null ? void 0 : h.type) === "streaming" ? { ...c, status: { type: "complete" } } : c;
758
904
  }), o = [
759
905
  ...this._messages.slice(0, e),
760
- { ...s, content: i, timestamp: Date.now() },
906
+ { ...i, content: a, timestamp: Date.now() },
761
907
  ...this._messages.slice(e + 1)
762
908
  ];
763
909
  this.updateMessages(o);
@@ -777,8 +923,18 @@ class E extends b {
777
923
  setTitle(t) {
778
924
  this._title = t, this.notifySubscribers();
779
925
  }
926
+ updateMessageContent(t, e) {
927
+ const i = this._messages.findIndex((c) => c.id === t);
928
+ if (i === -1) return;
929
+ const r = this._messages[i], a = e(r.content), o = [
930
+ ...this._messages.slice(0, i),
931
+ { ...r, content: a, timestamp: Date.now() },
932
+ ...this._messages.slice(i + 1)
933
+ ];
934
+ this.updateMessages(o);
935
+ }
780
936
  }
781
- class st extends b {
937
+ class it extends _ {
782
938
  constructor(t) {
783
939
  super();
784
940
  u(this, "_mainThreadId");
@@ -789,13 +945,13 @@ class st extends b {
789
945
  u(this, "_searchQuery");
790
946
  u(this, "_abortController", null);
791
947
  u(this, "main");
792
- this.config = t, this._mainThreadId = N();
793
- const e = new E({
948
+ this.config = t, this._mainThreadId = k();
949
+ const e = new M({
794
950
  streamAdapter: t.streamAdapter,
795
951
  capabilityExecutionManager: t.capabilityExecutionManager
796
952
  });
797
953
  this.main = new R(e), this._threads.set(this._mainThreadId, this.main);
798
- const s = {
954
+ const i = {
799
955
  id: this._mainThreadId,
800
956
  title: "New Chat",
801
957
  status: { type: "regular" },
@@ -803,9 +959,9 @@ class st extends b {
803
959
  createdAt: Date.now(),
804
960
  updatedAt: Date.now()
805
961
  };
806
- this._threadStates.set(this._mainThreadId, s);
807
- const r = new v({
808
- state: s,
962
+ this._threadStates.set(this._mainThreadId, i);
963
+ const r = new T({
964
+ state: i,
809
965
  onSwitchTo: this.switchToThread.bind(this),
810
966
  onRename: this.renameThread.bind(this),
811
967
  onDelete: this.deleteThread.bind(this)
@@ -824,8 +980,8 @@ class st extends b {
824
980
  }
825
981
  getState() {
826
982
  const t = [], e = {};
827
- for (const [s, r] of this._threadStates)
828
- e[s] = r, r.status.type === "regular" && t.push(s);
983
+ for (const [i, r] of this._threadStates)
984
+ e[i] = r, r.status.type === "regular" && t.push(i);
829
985
  return {
830
986
  mainThreadId: this._mainThreadId,
831
987
  threads: t,
@@ -835,12 +991,12 @@ class st extends b {
835
991
  };
836
992
  }
837
993
  async switchToThread(t) {
838
- var i, o;
994
+ var a, o;
839
995
  const e = this._threads.get(t);
840
996
  if (!e)
841
997
  throw new Error(`Thread ${t} not found`);
842
- const s = this._threadStates.get(this._mainThreadId);
843
- s && (s.isMain = !1, this._threadStates.set(this._mainThreadId, s), (i = this._threadItems.get(this._mainThreadId)) == null || i.updateState(s)), this._mainThreadId = t;
998
+ const i = this._threadStates.get(this._mainThreadId);
999
+ i && (i.isMain = !1, this._threadStates.set(this._mainThreadId, i), (a = this._threadItems.get(this._mainThreadId)) == null || a.updateState(i)), this._mainThreadId = t;
844
1000
  const r = this._threadStates.get(t);
845
1001
  if (r && (r.isMain = !0, this._threadStates.set(t, r), (o = this._threadItems.get(t)) == null || o.updateState(r), e.setConversationId(r.conversationId), e.setTitle(r.title)), this.config.threadListAdapter && (r != null && r.conversationId)) {
846
1002
  this._isLoading = !0, this.notifySubscribers();
@@ -856,11 +1012,11 @@ class st extends b {
856
1012
  this.notifySubscribers();
857
1013
  }
858
1014
  async switchToNewThread() {
859
- const t = N(), e = new E({
1015
+ const t = k(), e = new M({
860
1016
  streamAdapter: this.config.streamAdapter,
861
1017
  capabilityExecutionManager: this.config.capabilityExecutionManager
862
- }), s = new R(e);
863
- this._threads.set(t, s);
1018
+ }), i = new R(e);
1019
+ this._threads.set(t, i);
864
1020
  const r = {
865
1021
  id: t,
866
1022
  title: "New Chat",
@@ -870,18 +1026,18 @@ class st extends b {
870
1026
  updatedAt: Date.now()
871
1027
  };
872
1028
  this._threadStates.set(t, r);
873
- const i = new v({
1029
+ const a = new T({
874
1030
  state: r,
875
1031
  onSwitchTo: this.switchToThread.bind(this),
876
1032
  onRename: this.renameThread.bind(this),
877
1033
  onDelete: this.deleteThread.bind(this)
878
1034
  });
879
- if (this._threadItems.set(t, i), s.subscribe(() => {
880
- this.syncThreadStateFromRuntime(t, s), this.notifySubscribers();
1035
+ if (this._threadItems.set(t, a), i.subscribe(() => {
1036
+ this.syncThreadStateFromRuntime(t, i), this.notifySubscribers();
881
1037
  }), this.config.threadListAdapter)
882
1038
  try {
883
1039
  const o = await this.config.threadListAdapter.createThread();
884
- r.conversationId = o.conversationId, this._threadStates.set(t, r), i.updateState(r);
1040
+ r.conversationId = o.conversationId, this._threadStates.set(t, r), a.updateState(r);
885
1041
  } catch (o) {
886
1042
  console.error("Failed to create thread:", o);
887
1043
  }
@@ -893,29 +1049,29 @@ class st extends b {
893
1049
  if (this._isLoading)
894
1050
  return [];
895
1051
  if (this._abortController && this._abortController.abort(), this._abortController = new AbortController(), (t == null ? void 0 : t.query) !== void 0 && (this._searchQuery = t.query), t != null && t.replace) {
896
- const e = Array.from(this._threads.keys()).filter((s) => s !== this._mainThreadId);
897
- for (const s of e)
898
- this._threads.delete(s), this._threadItems.delete(s), this._threadStates.delete(s);
1052
+ const e = Array.from(this._threads.keys()).filter((i) => i !== this._mainThreadId);
1053
+ for (const i of e)
1054
+ this._threads.delete(i), this._threadItems.delete(i), this._threadStates.delete(i);
899
1055
  }
900
1056
  this._isLoading = !0, this.notifySubscribers();
901
1057
  try {
902
1058
  const e = await this.config.threadListAdapter.loadThreads(t);
903
- for (const s of e) {
904
- if (this._threadStates.has(s.id))
1059
+ for (const i of e) {
1060
+ if (this._threadStates.has(i.id))
905
1061
  continue;
906
- const r = new E({
1062
+ const r = new M({
907
1063
  streamAdapter: this.config.streamAdapter,
908
1064
  capabilityExecutionManager: this.config.capabilityExecutionManager
909
- }), i = new R(r);
910
- this._threads.set(s.id, i), this._threadStates.set(s.id, s);
911
- const o = new v({
912
- state: s,
1065
+ }), a = new R(r);
1066
+ this._threads.set(i.id, a), this._threadStates.set(i.id, i);
1067
+ const o = new T({
1068
+ state: i,
913
1069
  onSwitchTo: this.switchToThread.bind(this),
914
1070
  onRename: this.renameThread.bind(this),
915
1071
  onDelete: this.deleteThread.bind(this)
916
1072
  });
917
- this._threadItems.set(s.id, o), i.subscribe(() => {
918
- this.syncThreadStateFromRuntime(s.id, i), this.notifySubscribers();
1073
+ this._threadItems.set(i.id, o), a.subscribe(() => {
1074
+ this.syncThreadStateFromRuntime(i.id, a), this.notifySubscribers();
919
1075
  });
920
1076
  }
921
1077
  return e;
@@ -930,18 +1086,18 @@ class st extends b {
930
1086
  */
931
1087
  syncThreadStateFromRuntime(t, e) {
932
1088
  var r;
933
- const s = this._threadStates.get(t);
934
- s && (s.conversationId !== e.conversationId || s.title !== e.title) && (s.conversationId = e.conversationId, s.title = e.title || s.title, s.updatedAt = Date.now(), this._threadStates.set(t, s), (r = this._threadItems.get(t)) == null || r.updateState(s));
1089
+ const i = this._threadStates.get(t);
1090
+ i && (i.conversationId !== e.conversationId || i.title !== e.title) && (i.conversationId = e.conversationId, i.title = e.title || i.title, i.updatedAt = Date.now(), this._threadStates.set(t, i), (r = this._threadItems.get(t)) == null || r.updateState(i));
935
1091
  }
936
1092
  async renameThread(t, e) {
937
1093
  var r;
938
- const s = this._threadStates.get(t);
939
- if (s) {
940
- if (s.title = e, s.updatedAt = Date.now(), this._threadStates.set(t, s), (r = this._threadItems.get(t)) == null || r.updateState(s), this.config.threadListAdapter)
1094
+ const i = this._threadStates.get(t);
1095
+ if (i) {
1096
+ if (i.title = e, i.updatedAt = Date.now(), this._threadStates.set(t, i), (r = this._threadItems.get(t)) == null || r.updateState(i), this.config.threadListAdapter)
941
1097
  try {
942
1098
  await this.config.threadListAdapter.updateThread(t, { title: e });
943
- } catch (i) {
944
- console.error("Failed to rename thread:", i);
1099
+ } catch (a) {
1100
+ console.error("Failed to rename thread:", a);
945
1101
  }
946
1102
  this.notifySubscribers();
947
1103
  }
@@ -950,7 +1106,7 @@ class st extends b {
950
1106
  if (t === this._mainThreadId && this._threads.size === 1)
951
1107
  throw new Error("Cannot delete the last thread");
952
1108
  if (t === this._mainThreadId) {
953
- const e = Array.from(this._threads.keys()).find((s) => s !== t);
1109
+ const e = Array.from(this._threads.keys()).find((i) => i !== t);
954
1110
  e && await this.switchToThread(e);
955
1111
  }
956
1112
  if (this._threads.delete(t), this._threadItems.delete(t), this._threadStates.delete(t), this.config.threadListAdapter)
@@ -962,22 +1118,23 @@ class st extends b {
962
1118
  this.notifySubscribers();
963
1119
  }
964
1120
  }
965
- class mt extends b {
1121
+ class yt extends _ {
966
1122
  constructor(t) {
967
1123
  super();
968
1124
  u(this, "threads");
969
1125
  u(this, "pluginRegistry");
970
1126
  u(this, "capabilityRegistry");
971
1127
  u(this, "capabilityExecutionManager");
1128
+ u(this, "quickActionRegistry");
972
1129
  u(this, "_contentFocusRuntime");
973
1130
  u(this, "_currentThreadUnsubscribe");
974
1131
  this.pluginRegistry = new G(), t.plugins && t.plugins.forEach((e) => {
975
1132
  this.pluginRegistry.registerPlugin(e);
976
- }), this.capabilityRegistry = new Y(), this.capabilityExecutionManager = new K((e) => this.capabilityRegistry.getHandler(e)), this.threads = new st({
1133
+ }), this.capabilityRegistry = new Y(), this.capabilityExecutionManager = new K((e) => this.capabilityRegistry.getHandler(e)), this.quickActionRegistry = new X(), this.threads = new it({
977
1134
  streamAdapter: t.streamAdapter,
978
1135
  threadListAdapter: t.threadListAdapter,
979
1136
  capabilityExecutionManager: this.capabilityExecutionManager
980
- }), this._contentFocusRuntime = new X(), this._contentFocusRuntime.subscribe(() => {
1137
+ }), this._contentFocusRuntime = new Z(), this._contentFocusRuntime.subscribe(() => {
981
1138
  this.notifySubscribers();
982
1139
  }), this.threads.subscribe(() => {
983
1140
  this.subscribeToCurrentThread(), this.notifySubscribers();
@@ -1023,20 +1180,20 @@ class mt extends b {
1023
1180
  autoFocusLastContent(t) {
1024
1181
  var e;
1025
1182
  if (t.length !== 0)
1026
- for (let s = t.length - 1; s >= 0; s--) {
1027
- const r = t[s];
1183
+ for (let i = t.length - 1; i >= 0; i--) {
1184
+ const r = t[i];
1028
1185
  if (r.role === "assistant")
1029
- for (let i = r.content.length - 1; i >= 0; i--) {
1030
- const o = r.content[i], c = this.pluginRegistry.getRenderersByType(o.type);
1186
+ for (let a = r.content.length - 1; a >= 0; a--) {
1187
+ const o = r.content[a], c = this.pluginRegistry.getRenderersByType(o.type);
1031
1188
  if (c.length > 0 && ((e = c[0].capabilities) != null && e.supportsFocus)) {
1032
- this._contentFocusRuntime.isActive && this._contentFocusRuntime.focusedMessageId === r.id && this._contentFocusRuntime.focusedContentIndex === i || this._contentFocusRuntime.focus(o, r, i, "detail");
1189
+ this._contentFocusRuntime.isActive && this._contentFocusRuntime.focusedMessageId === r.id && this._contentFocusRuntime.focusedContentIndex === a || this._contentFocusRuntime.focus(o, r, a, "detail");
1033
1190
  return;
1034
1191
  }
1035
1192
  }
1036
1193
  }
1037
1194
  }
1038
1195
  }
1039
- var M = { exports: {} }, x = {};
1196
+ var E = { exports: {} }, x = {};
1040
1197
  /*
1041
1198
  object-assign
1042
1199
  (c) Sindre Sorhus
@@ -1046,43 +1203,43 @@ var A, D;
1046
1203
  function rt() {
1047
1204
  if (D) return A;
1048
1205
  D = 1;
1049
- var a = Object.getOwnPropertySymbols, n = Object.prototype.hasOwnProperty, t = Object.prototype.propertyIsEnumerable;
1206
+ var n = Object.getOwnPropertySymbols, s = Object.prototype.hasOwnProperty, t = Object.prototype.propertyIsEnumerable;
1050
1207
  function e(r) {
1051
1208
  if (r == null)
1052
1209
  throw new TypeError("Object.assign cannot be called with null or undefined");
1053
1210
  return Object(r);
1054
1211
  }
1055
- function s() {
1212
+ function i() {
1056
1213
  try {
1057
1214
  if (!Object.assign)
1058
1215
  return !1;
1059
1216
  var r = new String("abc");
1060
1217
  if (r[5] = "de", Object.getOwnPropertyNames(r)[0] === "5")
1061
1218
  return !1;
1062
- for (var i = {}, o = 0; o < 10; o++)
1063
- i["_" + String.fromCharCode(o)] = o;
1064
- var c = Object.getOwnPropertyNames(i).map(function(l) {
1065
- return i[l];
1219
+ for (var a = {}, o = 0; o < 10; o++)
1220
+ a["_" + String.fromCharCode(o)] = o;
1221
+ var c = Object.getOwnPropertyNames(a).map(function(l) {
1222
+ return a[l];
1066
1223
  });
1067
1224
  if (c.join("") !== "0123456789")
1068
1225
  return !1;
1069
- var d = {};
1226
+ var h = {};
1070
1227
  return "abcdefghijklmnopqrst".split("").forEach(function(l) {
1071
- d[l] = l;
1072
- }), Object.keys(Object.assign({}, d)).join("") === "abcdefghijklmnopqrst";
1228
+ h[l] = l;
1229
+ }), Object.keys(Object.assign({}, h)).join("") === "abcdefghijklmnopqrst";
1073
1230
  } catch {
1074
1231
  return !1;
1075
1232
  }
1076
1233
  }
1077
- return A = s() ? Object.assign : function(r, i) {
1078
- for (var o, c = e(r), d, l = 1; l < arguments.length; l++) {
1234
+ return A = i() ? Object.assign : function(r, a) {
1235
+ for (var o, c = e(r), h, l = 1; l < arguments.length; l++) {
1079
1236
  o = Object(arguments[l]);
1080
- for (var h in o)
1081
- n.call(o, h) && (c[h] = o[h]);
1082
- if (a) {
1083
- d = a(o);
1084
- for (var g = 0; g < d.length; g++)
1085
- t.call(o, d[g]) && (c[d[g]] = o[d[g]]);
1237
+ for (var d in o)
1238
+ s.call(o, d) && (c[d] = o[d]);
1239
+ if (n) {
1240
+ h = n(o);
1241
+ for (var p = 0; p < h.length; p++)
1242
+ t.call(o, h[p]) && (c[h[p]] = o[h[p]]);
1086
1243
  }
1087
1244
  }
1088
1245
  return c;
@@ -1096,72 +1253,72 @@ function rt() {
1096
1253
  * This source code is licensed under the MIT license found in the
1097
1254
  * LICENSE file in the root directory of this source tree.
1098
1255
  */
1099
- var j;
1256
+ var N;
1100
1257
  function nt() {
1101
- if (j) return x;
1102
- j = 1, rt();
1103
- var a = U, n = 60103;
1258
+ if (N) return x;
1259
+ N = 1, rt();
1260
+ var n = q, s = 60103;
1104
1261
  if (x.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
1105
1262
  var t = Symbol.for;
1106
- n = t("react.element"), x.Fragment = t("react.fragment");
1263
+ s = t("react.element"), x.Fragment = t("react.fragment");
1107
1264
  }
1108
- var e = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = Object.prototype.hasOwnProperty, r = { key: !0, ref: !0, __self: !0, __source: !0 };
1109
- function i(o, c, d) {
1110
- var l, h = {}, g = null, p = null;
1111
- d !== void 0 && (g = "" + d), c.key !== void 0 && (g = "" + c.key), c.ref !== void 0 && (p = c.ref);
1112
- for (l in c) s.call(c, l) && !r.hasOwnProperty(l) && (h[l] = c[l]);
1113
- if (o && o.defaultProps) for (l in c = o.defaultProps, c) h[l] === void 0 && (h[l] = c[l]);
1114
- return { $$typeof: n, type: o, key: g, ref: p, props: h, _owner: e.current };
1265
+ var e = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = Object.prototype.hasOwnProperty, r = { key: !0, ref: !0, __self: !0, __source: !0 };
1266
+ function a(o, c, h) {
1267
+ var l, d = {}, p = null, g = null;
1268
+ h !== void 0 && (p = "" + h), c.key !== void 0 && (p = "" + c.key), c.ref !== void 0 && (g = c.ref);
1269
+ for (l in c) i.call(c, l) && !r.hasOwnProperty(l) && (d[l] = c[l]);
1270
+ if (o && o.defaultProps) for (l in c = o.defaultProps, c) d[l] === void 0 && (d[l] = c[l]);
1271
+ return { $$typeof: s, type: o, key: p, ref: g, props: d, _owner: e.current };
1115
1272
  }
1116
- return x.jsx = i, x.jsxs = i, x;
1273
+ return x.jsx = a, x.jsxs = a, x;
1117
1274
  }
1118
1275
  var O;
1119
- function it() {
1120
- return O || (O = 1, M.exports = nt()), M.exports;
1276
+ function at() {
1277
+ return O || (O = 1, E.exports = nt()), E.exports;
1121
1278
  }
1122
- var S = it();
1123
- const q = B(null);
1124
- function bt({ runtime: a, children: n }) {
1125
- return /* @__PURE__ */ S.jsx(q.Provider, { value: a, children: n });
1279
+ var w = at();
1280
+ const W = U(null);
1281
+ function _t({ runtime: n, children: s }) {
1282
+ return /* @__PURE__ */ w.jsx(W.Provider, { value: n, children: s });
1126
1283
  }
1127
- function at() {
1128
- const a = W(q);
1129
- if (!a)
1284
+ function ot() {
1285
+ const n = B(W);
1286
+ if (!n)
1130
1287
  throw new Error("useAssistantRuntimeContext must be used within AssistantRuntimeProvider");
1131
- return a;
1288
+ return n;
1132
1289
  }
1133
1290
  function f() {
1134
- return at();
1291
+ return ot();
1135
1292
  }
1136
- function _t() {
1137
- const a = f();
1293
+ function St() {
1294
+ const n = f();
1138
1295
  return {
1139
- switchToThread: (n) => a.threads.switchToThread(n),
1140
- switchToNewThread: () => a.threads.switchToNewThread(),
1141
- loadThreads: (n) => a.threads.loadThreads(n),
1142
- renameThread: (n, t) => {
1143
- var e, s;
1144
- return (s = (e = a.threads).renameThread) == null ? void 0 : s.call(e, n, t);
1296
+ switchToThread: (s) => n.threads.switchToThread(s),
1297
+ switchToNewThread: () => n.threads.switchToNewThread(),
1298
+ loadThreads: (s) => n.threads.loadThreads(s),
1299
+ renameThread: (s, t) => {
1300
+ var e, i;
1301
+ return (i = (e = n.threads).renameThread) == null ? void 0 : i.call(e, s, t);
1145
1302
  },
1146
- deleteThread: (n) => {
1303
+ deleteThread: (s) => {
1147
1304
  var t, e;
1148
- return (e = (t = a.threads).deleteThread) == null ? void 0 : e.call(t, n);
1305
+ return (e = (t = n.threads).deleteThread) == null ? void 0 : e.call(t, s);
1149
1306
  }
1150
1307
  };
1151
1308
  }
1152
1309
  function xt() {
1153
- const a = f(), [n, t] = m(a.threads.getState());
1154
- return w(() => a.threads.subscribe(() => {
1155
- t(a.threads.getState());
1156
- }), [a]), n;
1310
+ const n = f(), [s, t] = y(n.threads.getState());
1311
+ return m(() => n.threads.subscribe(() => {
1312
+ t(n.threads.getState());
1313
+ }), [n]), s;
1157
1314
  }
1158
- function ot() {
1159
- const n = f().threads.getMainThread(), [, t] = m({});
1160
- return w(() => n.subscribe(() => {
1315
+ function ct() {
1316
+ const s = f().threads.getMainThread(), [, t] = y({});
1317
+ return m(() => s.subscribe(() => {
1161
1318
  t({});
1162
- }), [n]), n;
1319
+ }), [s]), s;
1163
1320
  }
1164
- var F = { exports: {} }, P = {};
1321
+ var P = { exports: {} }, F = {};
1165
1322
  /**
1166
1323
  * @license React
1167
1324
  * use-sync-external-store-shim.production.js
@@ -1171,87 +1328,87 @@ var F = { exports: {} }, P = {};
1171
1328
  * This source code is licensed under the MIT license found in the
1172
1329
  * LICENSE file in the root directory of this source tree.
1173
1330
  */
1174
- var L;
1175
- function ct() {
1176
- if (L) return P;
1177
- L = 1;
1178
- var a = U;
1179
- function n(h, g) {
1180
- return h === g && (h !== 0 || 1 / h === 1 / g) || h !== h && g !== g;
1181
- }
1182
- var t = typeof Object.is == "function" ? Object.is : n, e = a.useState, s = a.useEffect, r = a.useLayoutEffect, i = a.useDebugValue;
1183
- function o(h, g) {
1184
- var p = g(), _ = e({ inst: { value: p, getSnapshot: g } }), y = _[0].inst, I = _[1];
1331
+ var j;
1332
+ function ut() {
1333
+ if (j) return F;
1334
+ j = 1;
1335
+ var n = q;
1336
+ function s(d, p) {
1337
+ return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
1338
+ }
1339
+ var t = typeof Object.is == "function" ? Object.is : s, e = n.useState, i = n.useEffect, r = n.useLayoutEffect, a = n.useDebugValue;
1340
+ function o(d, p) {
1341
+ var g = p(), S = e({ inst: { value: g, getSnapshot: p } }), b = S[0].inst, I = S[1];
1185
1342
  return r(
1186
1343
  function() {
1187
- y.value = p, y.getSnapshot = g, c(y) && I({ inst: y });
1344
+ b.value = g, b.getSnapshot = p, c(b) && I({ inst: b });
1188
1345
  },
1189
- [h, p, g]
1190
- ), s(
1346
+ [d, g, p]
1347
+ ), i(
1191
1348
  function() {
1192
- return c(y) && I({ inst: y }), h(function() {
1193
- c(y) && I({ inst: y });
1349
+ return c(b) && I({ inst: b }), d(function() {
1350
+ c(b) && I({ inst: b });
1194
1351
  });
1195
1352
  },
1196
- [h]
1197
- ), i(p), p;
1353
+ [d]
1354
+ ), a(g), g;
1198
1355
  }
1199
- function c(h) {
1200
- var g = h.getSnapshot;
1201
- h = h.value;
1356
+ function c(d) {
1357
+ var p = d.getSnapshot;
1358
+ d = d.value;
1202
1359
  try {
1203
- var p = g();
1204
- return !t(h, p);
1360
+ var g = p();
1361
+ return !t(d, g);
1205
1362
  } catch {
1206
1363
  return !0;
1207
1364
  }
1208
1365
  }
1209
- function d(h, g) {
1210
- return g();
1366
+ function h(d, p) {
1367
+ return p();
1211
1368
  }
1212
- var l = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : o;
1213
- return P.useSyncExternalStore = a.useSyncExternalStore !== void 0 ? a.useSyncExternalStore : l, P;
1369
+ var l = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? h : o;
1370
+ return F.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : l, F;
1214
1371
  }
1215
- var k;
1216
- function ut() {
1217
- return k || (k = 1, F.exports = ct()), F.exports;
1372
+ var L;
1373
+ function ht() {
1374
+ return L || (L = 1, P.exports = ut()), P.exports;
1218
1375
  }
1219
- var ht = ut();
1220
- function St() {
1221
- const a = f();
1222
- return ht.useSyncExternalStore(
1223
- (n) => a.subscribe(() => {
1224
- n();
1376
+ var dt = ht();
1377
+ function wt() {
1378
+ const n = f();
1379
+ return dt.useSyncExternalStore(
1380
+ (s) => n.subscribe(() => {
1381
+ s();
1225
1382
  }),
1226
- () => a.thread.messages,
1227
- () => a.thread.messages
1383
+ () => n.thread.messages,
1384
+ () => n.thread.messages
1228
1385
  );
1229
1386
  }
1230
- function wt() {
1231
- const a = ot(), [n, t] = m(""), [e, s] = m(!1);
1387
+ function Ct() {
1388
+ const n = ct(), [s, t] = y(""), [e, i] = y(!1);
1232
1389
  return {
1233
- text: n,
1390
+ text: s,
1234
1391
  setText: t,
1235
1392
  isSubmitting: e,
1236
- send: async (i) => {
1237
- if (i == null || i.preventDefault(), !n.trim() || e) return;
1238
- const o = n;
1239
- t(""), s(!0);
1393
+ send: async (a) => {
1394
+ if (a == null || a.preventDefault(), !s.trim() || e) return;
1395
+ const o = s;
1396
+ t(""), i(!0);
1240
1397
  try {
1241
- await a.send(o);
1398
+ await n.send(o);
1242
1399
  } catch (c) {
1243
1400
  console.error("Failed to send message:", c), t(o);
1244
1401
  } finally {
1245
- s(!1);
1402
+ i(!1);
1246
1403
  }
1247
1404
  },
1248
1405
  clear: () => t(""),
1249
- append: (i) => t((o) => o + i)
1406
+ append: (a) => t((o) => o + a)
1250
1407
  };
1251
1408
  }
1252
- function $(a, n) {
1253
- var r, i, o, c;
1254
- const e = f().pluginRegistry.getBestRendererForType(a);
1409
+ function Q(n, s) {
1410
+ var r, a, o, c;
1411
+ const e = f().pluginRegistry.getBestRendererForType(n);
1255
1412
  if (!e)
1256
1413
  return {
1257
1414
  component: null,
@@ -1260,222 +1417,253 @@ function $(a, n) {
1260
1417
  supportsPreview: !1,
1261
1418
  supportsFullscreen: !1
1262
1419
  };
1263
- const s = n ? (r = e.auxiliary) == null ? void 0 : r[n] : null;
1420
+ const i = s ? (r = e.auxiliary) == null ? void 0 : r[s] : null;
1264
1421
  return {
1265
1422
  component: e.component,
1266
- auxiliaryComponent: s,
1267
- supportsFocus: ((i = e.capabilities) == null ? void 0 : i.supportsFocus) ?? !1,
1423
+ auxiliaryComponent: i,
1424
+ supportsFocus: ((a = e.capabilities) == null ? void 0 : a.supportsFocus) ?? !1,
1268
1425
  supportsPreview: ((o = e.capabilities) == null ? void 0 : o.supportsPreview) ?? !1,
1269
1426
  supportsFullscreen: ((c = e.capabilities) == null ? void 0 : c.supportsFullscreen) ?? !1
1270
1427
  };
1271
1428
  }
1272
- function Ct() {
1273
- const a = f(), [n, t] = m(a.contentFocus.state);
1274
- return w(() => a.contentFocus.subscribe(() => {
1275
- t(a.contentFocus.state);
1276
- }), [a]), {
1277
- ...n,
1278
- focus: (e, s, r, i) => a.contentFocus.focus(e, s, r, i),
1279
- blur: () => a.contentFocus.blur(),
1280
- toggle: (e, s, r, i) => a.contentFocus.toggle(e, s, r, i),
1281
- switchContext: (e) => a.contentFocus.switchContext(e),
1282
- focusNext: () => a.contentFocus.focusNext(a.thread.messages),
1283
- focusPrevious: () => a.contentFocus.focusPrevious(a.thread.messages)
1429
+ function It() {
1430
+ const n = f(), [s, t] = y(n.contentFocus.state);
1431
+ return m(() => n.contentFocus.subscribe(() => {
1432
+ t(n.contentFocus.state);
1433
+ }), [n]), {
1434
+ ...s,
1435
+ focus: (e, i, r, a) => n.contentFocus.focus(e, i, r, a),
1436
+ blur: () => n.contentFocus.blur(),
1437
+ toggle: (e, i, r, a) => n.contentFocus.toggle(e, i, r, a),
1438
+ switchContext: (e) => n.contentFocus.switchContext(e),
1439
+ focusNext: () => n.contentFocus.focusNext(n.thread.messages),
1440
+ focusPrevious: () => n.contentFocus.focusPrevious(n.thread.messages)
1284
1441
  };
1285
1442
  }
1286
- function dt(a) {
1287
- const n = f();
1288
- w(() => {
1289
- const t = a.priority ?? 0;
1290
- return a.execute && n.capabilityRegistry.registerHandler(a.name, { execute: a.execute }, t), a.render && n.capabilityRegistry.registerRenderer(
1291
- a.name,
1443
+ function lt(n) {
1444
+ const s = f();
1445
+ m(() => {
1446
+ const t = n.priority ?? 0;
1447
+ return n.execute && s.capabilityRegistry.registerHandler(n.name, { execute: n.execute }, t), n.render && s.capabilityRegistry.registerRenderer(
1448
+ n.name,
1292
1449
  {
1293
- component: a.render
1450
+ component: n.render
1294
1451
  },
1295
1452
  t
1296
1453
  ), () => {
1297
- n.capabilityRegistry.unregister(a.name);
1454
+ s.capabilityRegistry.unregister(n.name);
1298
1455
  };
1299
- }, [a.name, n]);
1456
+ }, [n.name, s]);
1300
1457
  }
1301
- function lt(a) {
1302
- const n = f(), [t, e] = m(
1303
- () => n.capabilityExecutionManager.getExecution(a)
1304
- ), [, s] = z((r) => r + 1, 0);
1305
- return w(() => {
1306
- const r = n.capabilityExecutionManager.getExecution(a);
1307
- return e(r), n.capabilityExecutionManager.subscribe((o) => {
1308
- if (o === a) {
1309
- const c = n.capabilityExecutionManager.getExecution(a);
1310
- e(c), s();
1458
+ function pt(n) {
1459
+ const s = f(), [t, e] = y(
1460
+ () => s.capabilityExecutionManager.getExecution(n)
1461
+ ), [, i] = V((r) => r + 1, 0);
1462
+ return m(() => {
1463
+ const r = s.capabilityExecutionManager.getExecution(n);
1464
+ return e(r), s.capabilityExecutionManager.subscribe((o) => {
1465
+ if (o === n) {
1466
+ const c = s.capabilityExecutionManager.getExecution(n);
1467
+ e(c), i();
1311
1468
  }
1312
1469
  });
1313
- }, [a, n]), t;
1470
+ }, [n, s]), t;
1314
1471
  }
1315
- const Q = B(void 0);
1316
- function It({ children: a }) {
1317
- const [n, t] = m({}), e = C((c, d) => {
1472
+ const $ = U(void 0);
1473
+ function vt({ children: n }) {
1474
+ const [s, t] = y({}), e = C((c, h) => {
1318
1475
  t((l) => {
1319
- if (d === null) {
1320
- const { [c]: h, ...g } = l;
1321
- return g;
1476
+ if (h === null) {
1477
+ const { [c]: d, ...p } = l;
1478
+ return p;
1322
1479
  }
1323
1480
  return {
1324
1481
  ...l,
1325
- [c]: { id: c, ...d }
1482
+ [c]: { id: c, ...h }
1326
1483
  };
1327
1484
  });
1328
- }, []), s = C((c) => {
1329
- t((d) => {
1330
- const { [c]: l, ...h } = d;
1331
- return h;
1485
+ }, []), i = C((c) => {
1486
+ t((h) => {
1487
+ const { [c]: l, ...d } = h;
1488
+ return d;
1332
1489
  });
1333
- }, []), r = C(() => Object.values(n).reduce(
1334
- (c, d) => {
1335
- const l = Object.entries(d.data).reduce(
1336
- (h, [g, p]) => ({
1337
- ...h,
1338
- [g]: typeof p == "string" ? p : JSON.stringify(p)
1490
+ }, []), r = C(() => Object.values(s).reduce(
1491
+ (c, h) => {
1492
+ const l = Object.entries(h.data).reduce(
1493
+ (d, [p, g]) => ({
1494
+ ...d,
1495
+ [p]: typeof g == "string" ? g : JSON.stringify(g)
1339
1496
  }),
1340
1497
  {}
1341
1498
  );
1342
1499
  return { ...c, ...l };
1343
1500
  },
1344
1501
  {}
1345
- ), [n]), i = C(() => {
1502
+ ), [s]), a = C(() => {
1346
1503
  t({});
1347
- }, []), o = V(
1504
+ }, []), o = z(
1348
1505
  () => ({
1349
- contexts: n,
1506
+ contexts: s,
1350
1507
  setContext: e,
1351
- removeContext: s,
1508
+ removeContext: i,
1352
1509
  getContextData: r,
1353
- clearContexts: i
1510
+ clearContexts: a
1354
1511
  }),
1355
- [n, e, s, r, i]
1512
+ [s, e, i, r, a]
1356
1513
  );
1357
- return /* @__PURE__ */ S.jsx(Q.Provider, { value: o, children: a });
1514
+ return /* @__PURE__ */ w.jsx($.Provider, { value: o, children: n });
1358
1515
  }
1359
1516
  function gt() {
1360
- const a = W(Q);
1361
- if (!a)
1517
+ const n = B($);
1518
+ if (!n)
1362
1519
  throw new Error("useChatContext must be used within a ChatContextProvider");
1363
- return a;
1520
+ return n;
1364
1521
  }
1365
- function Tt(a) {
1366
- const { setContext: n, removeContext: t } = gt(), { id: e = "currentPage", ...s } = a;
1367
- w(() => (n(e, s), () => {
1522
+ function Tt(n) {
1523
+ const { setContext: s, removeContext: t } = gt(), { id: e = "currentPage", ...i } = n;
1524
+ m(() => (s(e, i), () => {
1368
1525
  t(e);
1369
- }), [e, s.displayName, JSON.stringify(s.data), s.priority, s.icon]);
1526
+ }), [e, i.displayName, JSON.stringify(i.data), i.priority, i.icon]);
1527
+ }
1528
+ function Rt(n, s = "merge") {
1529
+ const t = f();
1530
+ m(() => (t.quickActionRegistry.activateScope(n, s), () => {
1531
+ t.quickActionRegistry.deactivateScope(n);
1532
+ }), [n, s, t]);
1370
1533
  }
1371
- function pt({ message: a, content: n }) {
1372
- const t = f(), e = n, s = lt(e.capabilityId), r = t.capabilityRegistry.getRenderer(e.capabilityName);
1373
- if (!r || !s)
1534
+ function Mt(n, s) {
1535
+ const t = f();
1536
+ m(() => {
1537
+ const e = s || t.quickActionRegistry.getActiveScope();
1538
+ return t.quickActionRegistry.register(n, e), () => {
1539
+ t.quickActionRegistry.unregister(n.id, e);
1540
+ };
1541
+ }, [
1542
+ n.id,
1543
+ n.label,
1544
+ n.prompt,
1545
+ n.icon,
1546
+ n.description,
1547
+ n.priority,
1548
+ n.scope,
1549
+ s,
1550
+ t
1551
+ ]);
1552
+ }
1553
+ function Et(n) {
1554
+ const s = f(), [t, e] = y([]);
1555
+ return m(() => (s.quickActionRegistry.getVisible(n).then(e), s.subscribe(() => {
1556
+ s.quickActionRegistry.getVisible(n).then(e);
1557
+ })), [s, n == null ? void 0 : n.scope]), t;
1558
+ }
1559
+ function ft({ message: n, content: s }) {
1560
+ const t = f(), e = s, i = pt(e.capabilityId), r = t.capabilityRegistry.getRenderer(e.capabilityName);
1561
+ if (!r || !i)
1374
1562
  return null;
1375
- const i = r.component;
1376
- return /* @__PURE__ */ S.jsx(
1377
- i,
1563
+ const a = r.component;
1564
+ return /* @__PURE__ */ w.jsx(
1565
+ a,
1378
1566
  {
1379
- capabilityName: s.name,
1380
- capabilityId: s.id,
1381
- args: s.args,
1382
- result: s.result,
1383
- status: s.status,
1384
- message: a
1567
+ capabilityName: i.name,
1568
+ capabilityId: i.id,
1569
+ args: i.args,
1570
+ result: i.result,
1571
+ status: i.status,
1572
+ message: n
1385
1573
  }
1386
1574
  );
1387
1575
  }
1388
- function vt({ message: a, content: n }) {
1389
- const { component: t } = $(n.type);
1390
- if (n.type === "capability")
1391
- return /* @__PURE__ */ S.jsx(pt, { message: a, content: n });
1576
+ function At({ message: n, content: s }) {
1577
+ const { component: t } = Q(s.type);
1578
+ if (s.type === "capability")
1579
+ return /* @__PURE__ */ w.jsx(ft, { message: n, content: s });
1392
1580
  if (!t)
1393
1581
  return null;
1394
1582
  const e = t;
1395
- return /* @__PURE__ */ S.jsx(e, { content: n, message: a });
1583
+ return /* @__PURE__ */ w.jsx(e, { content: s, message: n });
1396
1584
  }
1397
- function Rt({
1398
- message: a,
1399
- content: n,
1585
+ function Pt({
1586
+ message: n,
1587
+ content: s,
1400
1588
  context: t,
1401
1589
  onClose: e,
1402
- onNavigate: s,
1590
+ onNavigate: i,
1403
1591
  onSwitchContext: r
1404
1592
  }) {
1405
- const { auxiliaryComponent: i } = $(n.type, t);
1406
- if (!i)
1593
+ const { auxiliaryComponent: a } = Q(s.type, t);
1594
+ if (!a)
1407
1595
  return null;
1408
- const o = i;
1409
- return /* @__PURE__ */ S.jsx(
1596
+ const o = a;
1597
+ return /* @__PURE__ */ w.jsx(
1410
1598
  o,
1411
1599
  {
1412
- content: n,
1413
- message: a,
1600
+ content: s,
1601
+ message: n,
1414
1602
  context: t,
1415
1603
  onClose: e,
1416
- onNavigate: s,
1604
+ onNavigate: i,
1417
1605
  onSwitchContext: r
1418
1606
  }
1419
1607
  );
1420
1608
  }
1421
- function Et(a) {
1422
- const n = () => (dt(a), null);
1423
- return n.displayName = `Capability(${a.name})`, n;
1609
+ function Ft(n) {
1610
+ const s = () => (lt(n), null);
1611
+ return s.displayName = `Capability(${n.name})`, s;
1424
1612
  }
1425
- class Mt {
1613
+ class kt {
1426
1614
  getAllowedEvents() {
1427
1615
  return null;
1428
1616
  }
1429
- shouldProcessEvent(n) {
1617
+ shouldProcessEvent(s) {
1430
1618
  const t = this.getAllowedEvents();
1431
- return t ? t.includes(n) : !0;
1619
+ return t ? t.includes(s) : !0;
1432
1620
  }
1433
- async *stream(n) {
1434
- const { signal: t } = n, { url: e, options: s } = this.prepareRequest(n), r = await fetch(e, { ...s, signal: t });
1621
+ async *stream(s) {
1622
+ const { signal: t } = s, { url: e, options: i } = this.prepareRequest(s), r = await fetch(e, { ...i, signal: t });
1435
1623
  if (!r.ok)
1436
1624
  throw new Error(`HTTP error! status: ${r.status}`);
1437
1625
  if (!r.body)
1438
1626
  throw new Error("Response body is null");
1439
1627
  yield* this.parseSSEStream(r.body, t);
1440
1628
  }
1441
- async *parseSSEStream(n, t) {
1442
- const e = n.getReader(), s = new TextDecoder();
1443
- let r = "", i = null;
1629
+ async *parseSSEStream(s, t) {
1630
+ const e = s.getReader(), i = new TextDecoder();
1631
+ let r = "", a = null;
1444
1632
  try {
1445
1633
  for (; ; ) {
1446
1634
  const { done: o, value: c } = await e.read();
1447
1635
  if (o || t != null && t.aborted) break;
1448
- r += s.decode(c, { stream: !0 });
1449
- const d = r.split(`
1636
+ r += i.decode(c, { stream: !0 });
1637
+ const h = r.split(`
1450
1638
  `);
1451
- r = d.pop() || "";
1452
- for (const l of d) {
1453
- const h = l.trim();
1454
- if (!h) {
1455
- i = null;
1639
+ r = h.pop() || "";
1640
+ for (const l of h) {
1641
+ const d = l.trim();
1642
+ if (!d) {
1643
+ a = null;
1456
1644
  continue;
1457
1645
  }
1458
- if (h !== ": ping") {
1459
- if (h.startsWith("event:")) {
1460
- i = h.substring(6).trim();
1646
+ if (d !== ": ping") {
1647
+ if (d.startsWith("event:")) {
1648
+ a = d.substring(6).trim();
1461
1649
  continue;
1462
1650
  }
1463
- if (h.startsWith("data:")) {
1464
- const g = h.substring(5).trim();
1465
- if (g === "eof" || h === "eof")
1651
+ if (d.startsWith("data:")) {
1652
+ const p = d.substring(5).trim();
1653
+ if (p === "eof" || d === "eof")
1466
1654
  break;
1467
1655
  try {
1468
- const p = JSON.parse(g);
1469
- if (i && this.shouldProcessEvent(i)) {
1470
- const _ = this.convertEvent({
1471
- event: i,
1472
- data: p
1656
+ const g = JSON.parse(p);
1657
+ if (a && this.shouldProcessEvent(a)) {
1658
+ const S = this.convertEvent({
1659
+ event: a,
1660
+ data: g
1473
1661
  });
1474
- _ && (yield _);
1662
+ S && (yield S);
1475
1663
  }
1476
1664
  } catch {
1477
1665
  }
1478
- i = null;
1666
+ a = null;
1479
1667
  }
1480
1668
  }
1481
1669
  }
@@ -1486,34 +1674,38 @@ class Mt {
1486
1674
  }
1487
1675
  }
1488
1676
  export {
1489
- mt as AssistantRuntime,
1490
- bt as AssistantRuntimeProvider,
1491
- Rt as AuxiliaryRenderer,
1492
- Mt as BaseSSEStreamAdapter,
1677
+ yt as AssistantRuntime,
1678
+ _t as AssistantRuntimeProvider,
1679
+ Pt as AuxiliaryRenderer,
1680
+ kt as BaseSSEStreamAdapter,
1493
1681
  K as CapabilityExecutionManager,
1494
1682
  Y as CapabilityRegistry,
1495
- pt as CapabilityRendererComp,
1496
- It as ChatContextProvider,
1497
- et as ComposerRuntime,
1498
- vt as ContentRenderer,
1683
+ ft as CapabilityRendererComp,
1684
+ vt as ChatContextProvider,
1685
+ st as ComposerRuntime,
1686
+ At as ContentRenderer,
1499
1687
  G as PluginRegistry,
1500
- v as ThreadListItemRuntime,
1501
- st as ThreadListRuntime,
1688
+ X as QuickActionRegistry,
1689
+ T as ThreadListItemRuntime,
1690
+ it as ThreadListRuntime,
1502
1691
  R as ThreadRuntime,
1503
- E as ThreadRuntimeCore,
1504
- T as generateMessageId,
1505
- Et as makeCapability,
1692
+ M as ThreadRuntimeCore,
1693
+ v as generateMessageId,
1694
+ Ft as makeCapability,
1506
1695
  f as useAssistantRuntime,
1507
- dt as useCapability,
1508
- lt as useCapabilityExecution,
1696
+ lt as useCapability,
1697
+ pt as useCapabilityExecution,
1509
1698
  gt as useChatContext,
1510
- wt as useComposer,
1511
- Ct as useContentFocus,
1512
- $ as useContentRenderer,
1513
- ot as useCurrentThread,
1514
- St as useMessages,
1699
+ Ct as useComposer,
1700
+ It as useContentFocus,
1701
+ Q as useContentRenderer,
1702
+ ct as useCurrentThread,
1703
+ wt as useMessages,
1515
1704
  Tt as usePageContext,
1516
- _t as useThreadList,
1705
+ Mt as useQuickAction,
1706
+ Rt as useQuickActionScope,
1707
+ Et as useQuickActions,
1708
+ St as useThreadList,
1517
1709
  xt as useThreadListState
1518
1710
  };
1519
1711
  //# sourceMappingURL=index.js.map