@fencyai/react 0.1.163 → 0.1.164

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,23 +1,23 @@
1
- import { jsxs as y, jsx as i, Fragment as I } from "react/jsx-runtime";
2
- import { createStream as ie, isStreamTimeoutEvent as ae, isStreamNotFoundEvent as se, isAgentTaskProgressItemUpdatedEvent as le, createAgentTask as ce } from "@fencyai/js";
3
- import { createContext as de, useState as v, useRef as F, useEffect as A, useCallback as G, useContext as me, useMemo as D } from "react";
4
- import { useInView as ue, motion as b, AnimatePresence as X } from "motion/react";
5
- import ye from "react-markdown";
6
- import { Prism as J } from "react-syntax-highlighter";
7
- import ge from "remark-gfm";
8
- import './assets/index.css';const Y = de(
1
+ import { jsxs as g, jsx as i, Fragment as I } from "react/jsx-runtime";
2
+ import { createStream as ae, isStreamTimeoutEvent as se, isStreamNotFoundEvent as le, isAgentTaskProgressItemUpdatedEvent as ce, createAgentTask as de } from "@fencyai/js";
3
+ import { createContext as me, useState as v, useRef as F, useEffect as A, useCallback as G, useContext as ue, useMemo as D } from "react";
4
+ import { useInView as ye, motion as b, AnimatePresence as J } from "motion/react";
5
+ import ge from "react-markdown";
6
+ import { Prism as Y } from "react-syntax-highlighter";
7
+ import pe from "remark-gfm";
8
+ import './assets/index.css';const Z = me(
9
9
  void 0
10
10
  );
11
- async function pe(e, r) {
11
+ async function he(e, r) {
12
12
  const t = e.getReader();
13
13
  let n;
14
14
  for (; !(n = await t.read()).done; )
15
15
  r(n.value);
16
16
  }
17
- function he(e) {
17
+ function fe(e) {
18
18
  let r, t, n, l = !1;
19
19
  return function(s) {
20
- r === void 0 ? (r = s, t = 0, n = -1) : r = Se(r, s);
20
+ r === void 0 ? (r = s, t = 0, n = -1) : r = xe(r, s);
21
21
  const d = r.length;
22
22
  let m = 0;
23
23
  for (; t < d; ) {
@@ -41,12 +41,12 @@ function he(e) {
41
41
  m === d ? r = void 0 : m !== 0 && (r = r.subarray(m), t -= m);
42
42
  };
43
43
  }
44
- function fe(e, r, t) {
45
- let n = q();
44
+ function Se(e, r, t) {
45
+ let n = j();
46
46
  const l = new TextDecoder();
47
47
  return function(s, d) {
48
48
  if (s.length === 0)
49
- t == null || t(n), n = q();
49
+ t == null || t(n), n = j();
50
50
  else if (d > 0) {
51
51
  const m = l.decode(s.subarray(0, d)), o = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(o));
52
52
  switch (m) {
@@ -68,11 +68,11 @@ function fe(e, r, t) {
68
68
  }
69
69
  };
70
70
  }
71
- function Se(e, r) {
71
+ function xe(e, r) {
72
72
  const t = new Uint8Array(e.length + r.length);
73
73
  return t.set(e), t.set(r, e.length), t;
74
74
  }
75
- function q() {
75
+ function j() {
76
76
  return {
77
77
  data: "",
78
78
  event: "",
@@ -80,7 +80,7 @@ function q() {
80
80
  retry: void 0
81
81
  };
82
82
  }
83
- var xe = function(e, r) {
83
+ var Te = function(e, r) {
84
84
  var t = {};
85
85
  for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
86
86
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
@@ -88,32 +88,32 @@ var xe = function(e, r) {
88
88
  r.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (t[n[l]] = e[n[l]]);
89
89
  return t;
90
90
  };
91
- const _ = "text/event-stream", Te = 1e3, U = "last-event-id";
92
- function ke(e, r) {
93
- var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a = xe(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
- return new Promise((u, g) => {
91
+ const _ = "text/event-stream", ke = 1e3, q = "last-event-id";
92
+ function be(e, r) {
93
+ var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a = Te(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
+ return new Promise((u, y) => {
95
95
  const f = Object.assign({}, n);
96
96
  f.accept || (f.accept = _);
97
97
  let p;
98
- function S() {
98
+ function x() {
99
99
  p.abort(), document.hidden || R();
100
100
  }
101
- m || document.addEventListener("visibilitychange", S);
102
- let h = Te, T = 0;
101
+ m || document.addEventListener("visibilitychange", x);
102
+ let h = ke, S = 0;
103
103
  function k() {
104
- document.removeEventListener("visibilitychange", S), window.clearTimeout(T), p.abort();
104
+ document.removeEventListener("visibilitychange", x), window.clearTimeout(S), p.abort();
105
105
  }
106
106
  t == null || t.addEventListener("abort", () => {
107
107
  k(), u();
108
108
  });
109
- const C = o ?? window.fetch, E = l ?? be;
109
+ const C = o ?? window.fetch, E = l ?? ve;
110
110
  async function R() {
111
111
  var L;
112
112
  p = new AbortController();
113
113
  try {
114
114
  const P = await C(e, Object.assign(Object.assign({}, a), { headers: f, signal: p.signal }));
115
- await E(P), await pe(P.body, he(fe((M) => {
116
- M ? f[U] = M : delete f[U];
115
+ await E(P), await he(P.body, fe(Se((M) => {
116
+ M ? f[q] = M : delete f[q];
117
117
  }, (M) => {
118
118
  h = M;
119
119
  }, c))), s == null || s(), k(), u();
@@ -121,27 +121,30 @@ function ke(e, r) {
121
121
  if (!p.signal.aborted)
122
122
  try {
123
123
  const M = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : h;
124
- window.clearTimeout(T), T = window.setTimeout(R, M);
124
+ window.clearTimeout(S), S = window.setTimeout(R, M);
125
125
  } catch (M) {
126
- k(), g(M);
126
+ k(), y(M);
127
127
  }
128
128
  }
129
129
  }
130
130
  R();
131
131
  });
132
132
  }
133
- function be(e) {
133
+ function ve(e) {
134
134
  const r = e.headers.get("content-type");
135
135
  if (!(r != null && r.startsWith(_)))
136
136
  throw new Error(`Expected content-type to be ${_}, Actual: ${r}`);
137
137
  }
138
- function ve(e) {
138
+ function Ce(e) {
139
139
  const r = atob(e), t = new Uint8Array(r.length);
140
140
  for (let n = 0; n < r.length; n++)
141
141
  t[n] = r.charCodeAt(n);
142
142
  return new TextDecoder("utf-8").decode(t);
143
143
  }
144
- class Ce {
144
+ function Ee(e) {
145
+ return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
146
+ }
147
+ class we {
145
148
  constructor(r) {
146
149
  this.eventSources = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.fency = r;
147
150
  }
@@ -166,21 +169,21 @@ class Ce {
166
169
  "X-Fency-Publishable-Key": this.fency.publishableKey,
167
170
  "X-Fency-Stream-Token": r.stream.token
168
171
  };
169
- ke(l, {
172
+ be(l, {
170
173
  headers: c,
171
174
  signal: n.signal,
172
- async onopen(s) {
175
+ onopen: async (s) => {
173
176
  if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
174
- throw new Error(`Client error ${s.status}`);
177
+ throw this.eventSources.delete(t), new Error(`Client error ${s.status}`);
175
178
  },
176
179
  onmessage: (s) => {
177
180
  if (s.data) {
178
- const d = ve(s.data);
181
+ const d = Ce(s.data);
179
182
  this.broadcast(d, t);
180
183
  }
181
184
  },
182
185
  onerror: (s) => {
183
- throw console.error("EventSource error for stream", t, ":", s), this.broadcastError(t), s;
186
+ throw console.error("EventSource error for stream", t, ":", s), this.eventSources.delete(t), this.broadcastError(t, Ee(s)), s;
184
187
  },
185
188
  onclose() {
186
189
  }
@@ -200,9 +203,9 @@ class Ce {
200
203
  n.onMessage(r, t);
201
204
  });
202
205
  }
203
- broadcastError(r) {
204
- this.subscribers.forEach((t) => {
205
- t.onError(r);
206
+ broadcastError(r, t) {
207
+ this.subscribers.forEach((n) => {
208
+ n.onError(r, t);
206
209
  });
207
210
  }
208
211
  /**
@@ -212,14 +215,14 @@ class Ce {
212
215
  this.eventSources.forEach((r) => r.abort()), this.eventSources.clear(), this.subscribers.clear();
213
216
  }
214
217
  }
215
- const Ee = 12e4, we = (e) => {
218
+ const Ie = 48e4, Me = 3e5, K = (e) => {
216
219
  const r = Date.now();
217
- return e.filter((t) => r - t.createdAt < Ee);
220
+ return e.filter((t) => r - t.createdAt < Ie);
218
221
  };
219
- function Ir({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
222
+ function Ar({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
220
223
  const [n, l] = v(
221
224
  null
222
- ), [c, s] = v(!0), [d, m] = v(null), [o, a] = v([]), u = F(null), g = F(null);
225
+ ), [c, s] = v(!0), [d, m] = v(null), [o, a] = v([]), u = F(null), y = F(null);
223
226
  A(() => {
224
227
  e.then((h) => {
225
228
  l(h), s(!1);
@@ -227,24 +230,32 @@ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
227
230
  m(h), s(!1);
228
231
  });
229
232
  }, [e]), A(() => {
230
- n && !g.current && (g.current = new Ce(n));
233
+ n && !y.current && (y.current = new we(n));
231
234
  }, [n]), A(() => {
232
- g.current && g.current.updateStreams(o);
235
+ y.current && y.current.updateStreams(o);
233
236
  }, [o]), A(() => () => {
234
237
  var h;
235
- (h = g.current) == null || h.cleanup();
238
+ (h = y.current) == null || h.cleanup();
239
+ }, []), A(() => {
240
+ const h = setInterval(() => {
241
+ a((S) => {
242
+ const k = K(S);
243
+ return k.length !== S.length ? k : S;
244
+ });
245
+ }, 6e4);
246
+ return () => clearInterval(h);
236
247
  }, []);
237
248
  const f = G(
238
- async (h = 3e4) => {
249
+ async (h = Me) => {
239
250
  if (u.current)
240
251
  return u.current;
241
- const T = Date.now(), k = o.length > 0 ? o[o.length - 1] : null;
242
- if (k && T - k.createdAt < h)
252
+ const S = Date.now(), k = o.length > 0 ? o[o.length - 1] : null;
253
+ if (k && S - k.createdAt < h)
243
254
  return k.stream;
244
255
  const C = (async () => {
245
256
  if (!n)
246
257
  throw new Error("Fency instance not initialized");
247
- const E = await r(), R = await ie({
258
+ const E = await r(), R = await ae({
248
259
  pk: n.publishableKey,
249
260
  baseUrl: n.baseUrl,
250
261
  clientToken: (E == null ? void 0 : E.clientToken) ?? ""
@@ -256,7 +267,7 @@ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
256
267
  };
257
268
  return a((P) => {
258
269
  const M = [...P, L];
259
- return we(M);
270
+ return K(M);
260
271
  }), u.current = null, R.stream;
261
272
  } else
262
273
  throw u.current = null, new Error("Failed to create stream");
@@ -266,45 +277,45 @@ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
266
277
  [n, o]
267
278
  );
268
279
  if (d)
269
- return /* @__PURE__ */ y("div", { children: [
280
+ return /* @__PURE__ */ g("div", { children: [
270
281
  "Fency error: ",
271
282
  d.message
272
283
  ] });
273
284
  if (!n)
274
285
  return null;
275
- const p = o.length > 0 ? o[o.length - 1] : null, S = {
286
+ const p = o.length > 0 ? o[o.length - 1] : null, x = {
276
287
  fency: n,
277
288
  loading: c,
278
289
  error: d,
279
290
  activeStreams: o,
280
291
  latestStream: p,
281
- eventManager: g.current,
292
+ eventManager: y.current,
282
293
  getOrCreateStream: f
283
294
  };
284
- return /* @__PURE__ */ i(Y.Provider, { value: S, children: t });
295
+ return /* @__PURE__ */ i(Z.Provider, { value: x, children: t });
285
296
  }
286
- function Z() {
287
- const e = me(Y);
297
+ function ee() {
298
+ const e = ue(Z);
288
299
  if (e === void 0)
289
300
  throw new Error("useFencyContext must be used within a FencyProvider");
290
301
  return e;
291
302
  }
292
- const Ie = (e) => {
303
+ const Ae = (e) => {
293
304
  try {
294
305
  const r = JSON.parse(e);
295
- return Me(r);
306
+ return Fe(r);
296
307
  } catch (r) {
297
308
  return console.error("Error parsing message:", r), null;
298
309
  }
299
- }, Me = (e) => ae(e) ? Ae(e) : se(e) ? Fe(e) : le(e) ? Re(e) : null, Ae = (e) => ({
310
+ }, Fe = (e) => se(e) ? Re(e) : le(e) ? Pe(e) : ce(e) ? De(e) : null, Re = (e) => ({
300
311
  type: "STREAM_TIMEOUT",
301
312
  streamId: e.streamId,
302
313
  timestamp: e.timestamp
303
- }), Fe = (e) => ({
314
+ }), Pe = (e) => ({
304
315
  type: "STREAM_NOT_FOUND",
305
316
  streamId: e.streamId,
306
317
  timestamp: e.timestamp
307
- }), Re = (e) => ({
318
+ }), De = (e) => ({
308
319
  type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
309
320
  streamId: e.streamId,
310
321
  agentTaskId: e.agentTaskId,
@@ -312,34 +323,34 @@ const Ie = (e) => {
312
323
  timestamp: e.timestamp,
313
324
  createdAt: e.createdAt,
314
325
  data: JSON.parse(e.data)
315
- }), Pe = (e) => {
316
- const r = Z(), [t, n] = v(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
326
+ }), Le = (e) => {
327
+ const r = ee(), [t, n] = v(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
317
328
  return A(() => {
318
329
  if (!r.eventManager) return;
319
330
  const s = {
320
331
  onMessage: (m, o) => {
321
- var u, g, f;
322
- const a = Ie(m);
332
+ var u, y, f;
333
+ const a = Ae(m);
323
334
  if (a)
324
335
  switch (a.type) {
325
336
  case "STREAM_TIMEOUT":
326
337
  (u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, a);
327
338
  break;
328
339
  case "STREAM_NOT_FOUND":
329
- (g = e == null ? void 0 : e.onStreamNotFound) == null || g.call(e, a);
340
+ (y = e == null ? void 0 : e.onStreamNotFound) == null || y.call(e, a);
330
341
  break;
331
342
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
332
343
  (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, a);
333
344
  break;
334
345
  }
335
346
  },
336
- onError: (m) => {
337
- var o;
338
- (o = e == null ? void 0 : e.onStreamError) == null || o.call(e, {
347
+ onError: (m, o) => {
348
+ var a;
349
+ (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
339
350
  streamId: m,
340
351
  error: {
341
352
  code: "UnknownError",
342
- message: "Unknown error in useStream"
353
+ message: o ?? "Unknown error in useStream"
343
354
  }
344
355
  });
345
356
  }
@@ -351,7 +362,7 @@ const Ie = (e) => {
351
362
  }, [r.eventManager, e]), {
352
363
  createStream: async () => {
353
364
  try {
354
- const s = await r.getOrCreateStream(3e4);
365
+ const s = await r.getOrCreateStream();
355
366
  return n(s), {
356
367
  type: "success",
357
368
  stream: s
@@ -368,16 +379,16 @@ const Ie = (e) => {
368
379
  },
369
380
  stream: t
370
381
  };
371
- }, Mr = (e) => {
372
- const r = Z(), [t, n] = v([]), l = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), { createStream: s } = Pe({
382
+ }, Fr = (e) => {
383
+ const r = ee(), [t, n] = v([]), l = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), { createStream: s } = Le({
373
384
  onAgentTaskProgressItemUpdated: (o) => {
374
- var g;
385
+ var y;
375
386
  if (!l.current.has(o.agentTaskId)) return;
376
387
  const a = o.data;
377
388
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChat" && a.eventType === "Completed" || a.taskType === "MemorySearch" && a.eventType === "Completed") {
378
389
  const f = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
379
390
  n(
380
- f ? (S) => S.map((h) => {
391
+ f ? (x) => x.map((h) => {
381
392
  var C;
382
393
  if (((C = h.confirmedData) == null ? void 0 : C.taskId) !== o.agentTaskId)
383
394
  return h;
@@ -391,10 +402,10 @@ const Ie = (e) => {
391
402
  progressItems: k,
392
403
  loading: !1
393
404
  };
394
- }) : (S) => S.map(
405
+ }) : (x) => x.map(
395
406
  (h) => {
396
- var T;
397
- return ((T = h.confirmedData) == null ? void 0 : T.taskId) === o.agentTaskId ? { ...h, loading: !1 } : h;
407
+ var S;
408
+ return ((S = h.confirmedData) == null ? void 0 : S.taskId) === o.agentTaskId ? { ...h, loading: !1 } : h;
398
409
  }
399
410
  )
400
411
  );
@@ -404,10 +415,10 @@ const Ie = (e) => {
404
415
  p && (c.current.delete(o.agentTaskId), p(a));
405
416
  return;
406
417
  }
407
- (g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, o), n(
418
+ (y = e.onAgentTaskProgressItemUpdated) == null || y.call(e, o), n(
408
419
  (f) => f.map((p) => {
409
- var T;
410
- if (((T = p.confirmedData) == null ? void 0 : T.taskId) !== o.agentTaskId)
420
+ var S;
421
+ if (((S = p.confirmedData) == null ? void 0 : S.taskId) !== o.agentTaskId)
411
422
  return p;
412
423
  const h = p.progressItems.some(
413
424
  (k) => k.progressItemId === o.progressItemId
@@ -420,17 +431,9 @@ const Ie = (e) => {
420
431
  },
421
432
  onStreamError: (o) => {
422
433
  var a;
423
- (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), n((u) => {
424
- const g = u.find((f) => f.streamId === o.streamId);
425
- return g ? [
426
- ...u.filter((f) => f.streamId !== o.streamId),
427
- {
428
- ...g,
429
- loading: !1,
430
- error: o.error
431
- }
432
- ] : u;
433
- });
434
+ (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), n(
435
+ (u) => u.map((y) => y.streamId !== o.streamId || !y.loading ? y : { ...y, loading: !1, error: o.error })
436
+ );
434
437
  },
435
438
  onStreamNotFound: (o) => {
436
439
  var a;
@@ -443,11 +446,11 @@ const Ie = (e) => {
443
446
  }), d = G(
444
447
  async (o, a) => {
445
448
  var f;
446
- const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = await s();
447
- if (g.type === "success") {
448
- const p = (/* @__PURE__ */ new Date()).toISOString(), S = {
449
+ const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, y = await s();
450
+ if (y.type === "success") {
451
+ const p = (/* @__PURE__ */ new Date()).toISOString(), x = {
449
452
  taskKey: u,
450
- streamId: g.stream.id,
453
+ streamId: y.stream.id,
451
454
  triggeredAt: p,
452
455
  confirmedData: null,
453
456
  error: null,
@@ -456,12 +459,12 @@ const Ie = (e) => {
456
459
  loading: !0,
457
460
  loadingText: a == null ? void 0 : a.loadingText
458
461
  };
459
- n((k) => [...k, S]), (f = a == null ? void 0 : a.onTaskRegistered) == null || f.call(a, S);
460
- const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(o.type), T = await ce({
462
+ n((k) => [...k, x]), (f = a == null ? void 0 : a.onTaskRegistered) == null || f.call(a, x);
463
+ const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(o.type), S = await de({
461
464
  pk: r.fency.publishableKey,
462
465
  baseUrl: r.fency.baseUrl,
463
466
  clientToken: h,
464
- streamToken: g.stream.token,
467
+ streamToken: y.stream.token,
465
468
  request: {
466
469
  streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
467
470
  messages: o.messages,
@@ -491,50 +494,50 @@ const Ie = (e) => {
491
494
  } : void 0
492
495
  }
493
496
  });
494
- if (T.type === "success" && T.agentTask) {
497
+ if (S.type === "success" && S.agentTask) {
495
498
  l.current.add(
496
- T.agentTask.id
499
+ S.agentTask.id
497
500
  ), n((C) => [
498
501
  ...C.filter((E) => E.taskKey !== u),
499
502
  {
500
503
  taskKey: u,
501
- streamId: g.stream.id,
504
+ streamId: y.stream.id,
502
505
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
503
- taskId: T.agentTask.id,
504
- createdAt: T.agentTask.createdAt,
506
+ taskId: S.agentTask.id,
507
+ createdAt: S.agentTask.createdAt,
505
508
  error: null,
506
509
  params: o,
507
510
  progressItems: [],
508
511
  loading: !0,
509
512
  loadingText: a == null ? void 0 : a.loadingText,
510
513
  confirmedData: {
511
- taskId: T.agentTask.id,
512
- createdAt: T.agentTask.createdAt
514
+ taskId: S.agentTask.id,
515
+ createdAt: S.agentTask.createdAt
513
516
  }
514
517
  }
515
518
  ]);
516
519
  const k = await new Promise((C) => {
517
520
  c.current.set(
518
- T.agentTask.id,
521
+ S.agentTask.id,
519
522
  C
520
523
  );
521
524
  });
522
525
  return {
523
526
  type: "success",
524
- streamId: g.stream.id,
525
- agentTaskId: T.agentTask.id,
527
+ streamId: y.stream.id,
528
+ agentTaskId: S.agentTask.id,
526
529
  response: k
527
530
  };
528
531
  } else {
529
- if (T.type === "error")
532
+ if (S.type === "error")
530
533
  return n((k) => [
531
534
  ...k.filter((C) => C.taskKey !== u),
532
535
  {
533
536
  taskKey: u,
534
537
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
535
- streamId: g.stream.id,
538
+ streamId: y.stream.id,
536
539
  params: o,
537
- error: T.error,
540
+ error: S.error,
538
541
  progressItems: [],
539
542
  loading: !1,
540
543
  loadingText: a == null ? void 0 : a.loadingText,
@@ -542,7 +545,7 @@ const Ie = (e) => {
542
545
  }
543
546
  ]), {
544
547
  type: "error",
545
- error: T.error
548
+ error: S.error
546
549
  };
547
550
  {
548
551
  const k = {
@@ -554,7 +557,7 @@ const Ie = (e) => {
554
557
  {
555
558
  taskKey: u,
556
559
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
557
- streamId: g.stream.id,
560
+ streamId: y.stream.id,
558
561
  error: k,
559
562
  params: o,
560
563
  progressItems: [],
@@ -569,7 +572,7 @@ const Ie = (e) => {
569
572
  }
570
573
  }
571
574
  } else
572
- return console.error(g.error), g;
575
+ return console.error(y.error), y;
573
576
  },
574
577
  [r, s, e.fetchCreateAgentTaskClientToken]
575
578
  ), m = D(() => {
@@ -584,7 +587,7 @@ const Ie = (e) => {
584
587
  latest: m
585
588
  };
586
589
  };
587
- function De(e) {
590
+ function ze(e) {
588
591
  return e.progressItems.map((r, t) => {
589
592
  const n = e.progressItems[t + 1], l = n != null;
590
593
  let c;
@@ -613,9 +616,9 @@ function w({
613
616
  spread: o = 2,
614
617
  color: a = "#999",
615
618
  shimmerColor: u = "#000",
616
- direction: g = "fromBottom"
619
+ direction: y = "fromBottom"
617
620
  }) {
618
- const f = F(null), p = ue(f, { once: d, margin: m }), S = D(() => e.length * o, [e, o]), h = !s || p, T = g === "fromBottom" ? "100% center" : "-100% center", k = g === "fromBottom" ? "0% center" : "200% center";
621
+ const f = F(null), p = ye(f, { once: d, margin: m }), x = D(() => e.length * o, [e, o]), h = !s || p, S = y === "fromBottom" ? "100% center" : "-100% center", k = y === "fromBottom" ? "0% center" : "200% center";
619
622
  return /* @__PURE__ */ i(
620
623
  b.span,
621
624
  {
@@ -630,14 +633,14 @@ function w({
630
633
  color: "transparent",
631
634
  WebkitTextFillColor: "transparent",
632
635
  backgroundRepeat: "no-repeat, padding-box",
633
- "--spread": `${S}px`,
636
+ "--spread": `${x}px`,
634
637
  "--base-color": a,
635
638
  "--shimmer-color": u,
636
639
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
637
640
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
638
641
  },
639
642
  initial: {
640
- backgroundPosition: T,
643
+ backgroundPosition: S,
641
644
  opacity: 0
642
645
  },
643
646
  animate: h ? {
@@ -661,7 +664,7 @@ function w({
661
664
  }
662
665
  );
663
666
  }
664
- function Le(e, r) {
667
+ function Oe(e, r) {
665
668
  const t = e.item.data;
666
669
  if (t.eventType === "Error" && "message" in t)
667
670
  return r.error;
@@ -705,11 +708,11 @@ function Le(e, r) {
705
708
  }
706
709
  return r.processing;
707
710
  }
708
- const ze = ({ progressViewItems: e, t: r }) => {
711
+ const Ne = ({ progressViewItems: e, t: r }) => {
709
712
  const t = e[e.length - 1];
710
713
  if (!t) return null;
711
- const n = Le(t, r);
712
- return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(X, { mode: "wait", children: /* @__PURE__ */ i(
714
+ const n = Oe(t, r);
715
+ return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(J, { mode: "wait", children: /* @__PURE__ */ i(
713
716
  b.div,
714
717
  {
715
718
  initial: { opacity: 0, y: 10 },
@@ -737,7 +740,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
737
740
  },
738
741
  t.item.progressItemId
739
742
  ) }) });
740
- }, ee = {
743
+ }, re = {
741
744
  'code[class*="language-"]': {
742
745
  color: "#f8f8f2",
743
746
  background: "none",
@@ -888,7 +891,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
888
891
  italic: {
889
892
  fontStyle: "italic"
890
893
  }
891
- }, K = ({
894
+ }, V = ({
892
895
  text: e
893
896
  }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
894
897
  b.div,
@@ -898,22 +901,22 @@ const ze = ({ progressViewItems: e, t: r }) => {
898
901
  animate: { opacity: 1, y: 0 },
899
902
  transition: { duration: 0.3, delay: 0 },
900
903
  children: /* @__PURE__ */ i(
901
- ye,
904
+ ge,
902
905
  {
903
- remarkPlugins: [ge],
906
+ remarkPlugins: [pe],
904
907
  components: {
905
908
  code(r) {
906
909
  const { children: t, className: n, node: l, ref: c, ...s } = r, d = /language-(\w+)/.exec(n || "");
907
910
  return d ? (
908
911
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
909
912
  /* @__PURE__ */ i(
910
- J,
913
+ Y,
911
914
  {
912
915
  ...s,
913
916
  PreTag: "div",
914
917
  children: String(t).replace(/\n$/, ""),
915
918
  language: d[1],
916
- style: ee
919
+ style: re
917
920
  }
918
921
  )
919
922
  ) : /* @__PURE__ */ i("code", { ...s, className: n, children: String(t) });
@@ -923,7 +926,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
923
926
  }
924
927
  )
925
928
  }
926
- ) }), Oe = ({ data: e }) => {
929
+ ) }), Be = ({ data: e }) => {
927
930
  const r = JSON.stringify(
928
931
  JSON.parse(e.response.jsonResponse),
929
932
  null,
@@ -935,10 +938,10 @@ const ze = ({ progressViewItems: e, t: r }) => {
935
938
  initial: { opacity: 0, y: -10 },
936
939
  animate: { opacity: 1, y: 0 },
937
940
  transition: { duration: 0.3, delay: 0 },
938
- children: /* @__PURE__ */ i(J, { language: "json", style: ee, PreTag: "div", children: r })
941
+ children: /* @__PURE__ */ i(Y, { language: "json", style: re, PreTag: "div", children: r })
939
942
  }
940
943
  ) });
941
- }, Ne = {
944
+ }, We = {
942
945
  en: {
943
946
  error: "Error",
944
947
  streaming: "Streaming...",
@@ -1058,10 +1061,10 @@ const ze = ({ progressViewItems: e, t: r }) => {
1058
1061
  memorySearchExploreNoResults: "Ingen resultater funnet"
1059
1062
  }
1060
1063
  };
1061
- function Be(e) {
1062
- return Ne[e];
1064
+ function $e(e) {
1065
+ return We[e];
1063
1066
  }
1064
- function x(e, r) {
1067
+ function T(e, r) {
1065
1068
  return Object.entries(r).reduce(
1066
1069
  (t, [n, l]) => t.replace(`{${n}}`, String(l)),
1067
1070
  e
@@ -1075,12 +1078,12 @@ function Q(e, r) {
1075
1078
  }
1076
1079
  return t.join(", ");
1077
1080
  }
1078
- const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1079
- const [l, c] = v(!1), d = (e.memories ?? []).map((h) => h.memoryTitle), m = d.length > 0, o = m && d.length > W, a = o && !l ? d.slice(0, W) : d, u = d.length - W, g = !o || l, f = `${n.searchingFor}'${e.queryDescription}'`, p = m ? `${n.searchingIn}${Q(
1081
+ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1082
+ const [l, c] = v(!1), d = (e.memories ?? []).map((h) => h.memoryTitle), m = d.length > 0, o = m && d.length > W, a = o && !l ? d.slice(0, W) : d, u = d.length - W, y = !o || l, f = `${n.searchingFor}'${e.queryDescription}'`, p = m ? `${n.searchingIn}${Q(
1080
1083
  a,
1081
- g ? n.and : void 0
1082
- )}` : "", S = m ? `${f}${p}` : `${n.searchingPrefix}${e.queryDescription}`;
1083
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1084
+ y ? n.and : void 0
1085
+ )}` : "", x = m ? `${f}${p}` : `${n.searchingPrefix}${e.queryDescription}`;
1086
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1084
1087
  /* @__PURE__ */ i(
1085
1088
  b.div,
1086
1089
  {
@@ -1091,23 +1094,23 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1091
1094
  children: r && !t && !o ? /* @__PURE__ */ i(
1092
1095
  w,
1093
1096
  {
1094
- text: S,
1097
+ text: x,
1095
1098
  duration: 2.5,
1096
1099
  repeat: !0,
1097
1100
  color: "#999",
1098
1101
  shimmerColor: "#000"
1099
1102
  }
1100
- ) : /* @__PURE__ */ y(I, { children: [
1101
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ y(I, { children: [
1103
+ ) : /* @__PURE__ */ g(I, { children: [
1104
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ g(I, { children: [
1102
1105
  n.searchingFor,
1103
- /* @__PURE__ */ y("span", { style: { fontWeight: 600 }, children: [
1106
+ /* @__PURE__ */ g("span", { style: { fontWeight: 600 }, children: [
1104
1107
  "'",
1105
1108
  e.queryDescription,
1106
1109
  "'"
1107
1110
  ] }),
1108
1111
  p
1109
1112
  ] }) : `${n.searchingPrefix}${e.queryDescription}` }),
1110
- o && !l && /* @__PURE__ */ y(I, { children: [
1113
+ o && !l && /* @__PURE__ */ g(I, { children: [
1111
1114
  " ",
1112
1115
  /* @__PURE__ */ i(
1113
1116
  "button",
@@ -1125,13 +1128,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1125
1128
  textDecoration: "underline",
1126
1129
  fontFamily: "inherit"
1127
1130
  },
1128
- children: x(n.moreMemories, {
1131
+ children: T(n.moreMemories, {
1129
1132
  n: u
1130
1133
  })
1131
1134
  }
1132
1135
  )
1133
1136
  ] }),
1134
- o && l && /* @__PURE__ */ y(I, { children: [
1137
+ o && l && /* @__PURE__ */ g(I, { children: [
1135
1138
  " ",
1136
1139
  /* @__PURE__ */ i(
1137
1140
  "button",
@@ -1165,16 +1168,16 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1165
1168
  marginTop: "4px",
1166
1169
  fontStyle: "italic"
1167
1170
  },
1168
- children: x(n.tookSeconds, { n: t })
1171
+ children: T(n.tookSeconds, { n: t })
1169
1172
  }
1170
1173
  )
1171
1174
  ] });
1172
- }, $ = 5, $e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1173
- const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > $, o = m && !l ? s.slice(0, $) : s, a = s.length - $, u = !m || l, g = d ? `${n.findingMemoriesIn}${Q(
1175
+ }, $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1176
+ const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > $, o = m && !l ? s.slice(0, $) : s, a = s.length - $, u = !m || l, y = d ? `${n.findingMemoriesIn}${Q(
1174
1177
  o,
1175
1178
  u ? n.and : void 0
1176
1179
  )}` : n.findingMemories;
1177
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1180
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1178
1181
  /* @__PURE__ */ i(
1179
1182
  b.div,
1180
1183
  {
@@ -1187,15 +1190,15 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1187
1190
  children: r && !t && !m ? /* @__PURE__ */ i(
1188
1191
  w,
1189
1192
  {
1190
- text: g,
1193
+ text: y,
1191
1194
  duration: 2.5,
1192
1195
  repeat: !0,
1193
1196
  color: "#999",
1194
1197
  shimmerColor: "#000"
1195
1198
  }
1196
- ) : /* @__PURE__ */ y(I, { children: [
1197
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: g }),
1198
- m && !l && /* @__PURE__ */ y(I, { children: [
1199
+ ) : /* @__PURE__ */ g(I, { children: [
1200
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
1201
+ m && !l && /* @__PURE__ */ g(I, { children: [
1199
1202
  " ",
1200
1203
  /* @__PURE__ */ i(
1201
1204
  "button",
@@ -1213,13 +1216,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1213
1216
  textDecoration: "underline",
1214
1217
  fontFamily: "inherit"
1215
1218
  },
1216
- children: x(n.moreMemories, {
1219
+ children: T(n.moreMemories, {
1217
1220
  n: a
1218
1221
  })
1219
1222
  }
1220
1223
  )
1221
1224
  ] }),
1222
- m && l && /* @__PURE__ */ y(I, { children: [
1225
+ m && l && /* @__PURE__ */ g(I, { children: [
1223
1226
  " ",
1224
1227
  /* @__PURE__ */ i(
1225
1228
  "button",
@@ -1253,12 +1256,12 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1253
1256
  marginTop: "4px",
1254
1257
  fontStyle: "italic"
1255
1258
  },
1256
- children: x(n.tookSeconds, { n: t })
1259
+ children: T(n.tookSeconds, { n: t })
1257
1260
  }
1258
1261
  )
1259
1262
  ] });
1260
- }, H = 5, He = ({ data: e, t: r }) => {
1261
- const [t, n] = v(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !t ? c.slice(0, H) : c, o = c.length - H, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, g = s ? `${u}${Q(
1263
+ }, H = 5, Ge = ({ data: e, t: r }) => {
1264
+ const [t, n] = v(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !t ? c.slice(0, H) : c, o = c.length - H, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, y = s ? `${u}${Q(
1262
1265
  m,
1263
1266
  a ? r.and : void 0
1264
1267
  )}` : r.memoriesFound;
@@ -1269,9 +1272,9 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1269
1272
  initial: { opacity: 0, y: -10 },
1270
1273
  animate: { opacity: 1, y: 0 },
1271
1274
  transition: { duration: 0.3, delay: 0 },
1272
- children: /* @__PURE__ */ y(I, { children: [
1273
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: g }),
1274
- d && !t && /* @__PURE__ */ y(I, { children: [
1275
+ children: /* @__PURE__ */ g(I, { children: [
1276
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
1277
+ d && !t && /* @__PURE__ */ g(I, { children: [
1275
1278
  " ",
1276
1279
  /* @__PURE__ */ i(
1277
1280
  "button",
@@ -1289,13 +1292,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1289
1292
  textDecoration: "underline",
1290
1293
  fontFamily: "inherit"
1291
1294
  },
1292
- children: x(r.moreMemories, {
1295
+ children: T(r.moreMemories, {
1293
1296
  n: o
1294
1297
  })
1295
1298
  }
1296
1299
  )
1297
1300
  ] }),
1298
- d && t && /* @__PURE__ */ y(I, { children: [
1301
+ d && t && /* @__PURE__ */ g(I, { children: [
1299
1302
  " ",
1300
1303
  /* @__PURE__ */ i(
1301
1304
  "button",
@@ -1320,9 +1323,9 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1320
1323
  ] })
1321
1324
  }
1322
1325
  ) });
1323
- }, _e = ({ isLatest: e = !1, durationSeconds: r, t }) => {
1326
+ }, Qe = ({ isLatest: e = !1, durationSeconds: r, t }) => {
1324
1327
  const n = t.addingSources;
1325
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1328
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1326
1329
  /* @__PURE__ */ i(
1327
1330
  b.div,
1328
1331
  {
@@ -1356,26 +1359,26 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1356
1359
  marginTop: "4px",
1357
1360
  fontStyle: "italic"
1358
1361
  },
1359
- children: x(t.tookSeconds, { n: r })
1362
+ children: T(t.tookSeconds, { n: r })
1360
1363
  }
1361
1364
  )
1362
1365
  ] });
1363
1366
  };
1364
- function Ge(e, r) {
1367
+ function Ue(e, r) {
1365
1368
  if (e.length === 0) return "";
1366
1369
  if (e.length === 1)
1367
- return x(r.pageSingle, { n: e[0] });
1370
+ return T(r.pageSingle, { n: e[0] });
1368
1371
  if (e.length === 2)
1369
- return x(r.pageTwo, {
1372
+ return T(r.pageTwo, {
1370
1373
  a: e[0],
1371
1374
  b: e[1]
1372
1375
  });
1373
1376
  const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1374
- return x(r.pageMultiple, { list: n, n: t });
1377
+ return T(r.pageMultiple, { list: n, n: t });
1375
1378
  }
1376
- const Qe = ({ data: e, onSourceClick: r, t }) => {
1379
+ const je = ({ data: e, onSourceClick: r, t }) => {
1377
1380
  const [n, l] = v(null);
1378
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1381
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1379
1382
  /* @__PURE__ */ i(
1380
1383
  b.div,
1381
1384
  {
@@ -1394,7 +1397,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
1394
1397
  }
1395
1398
  ),
1396
1399
  /* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ i(
1397
- je,
1400
+ qe,
1398
1401
  {
1399
1402
  source: c,
1400
1403
  index: s,
@@ -1406,7 +1409,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
1406
1409
  c.memoryId
1407
1410
  )) })
1408
1411
  ] });
1409
- }, je = ({
1412
+ }, qe = ({
1410
1413
  source: e,
1411
1414
  index: r,
1412
1415
  loadingMemoryId: t,
@@ -1414,8 +1417,8 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
1414
1417
  onSourceClick: l,
1415
1418
  t: c
1416
1419
  }) => {
1417
- const [s, d] = v(!1), m = !!l, o = t === e.memoryId, a = e.pageNumbers ?? [], u = Ge(a, c);
1418
- return /* @__PURE__ */ y(
1420
+ const [s, d] = v(!1), m = !!l, o = t === e.memoryId, a = e.pageNumbers ?? [], u = Ue(a, c);
1421
+ return /* @__PURE__ */ g(
1419
1422
  b.div,
1420
1423
  {
1421
1424
  "aria-busy": o,
@@ -1452,7 +1455,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
1452
1455
  pointerEvents: o ? "none" : void 0
1453
1456
  },
1454
1457
  children: [
1455
- /* @__PURE__ */ y(
1458
+ /* @__PURE__ */ g(
1456
1459
  "span",
1457
1460
  {
1458
1461
  style: {
@@ -1498,7 +1501,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
1498
1501
  }
1499
1502
  }
1500
1503
  );
1501
- }, j = ({
1504
+ }, U = ({
1502
1505
  color: e = "#333",
1503
1506
  size: r = 32,
1504
1507
  lineWidth: t = 2
@@ -1511,7 +1514,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
1511
1514
  height: n,
1512
1515
  backgroundColor: e
1513
1516
  };
1514
- return /* @__PURE__ */ y(
1517
+ return /* @__PURE__ */ g(
1515
1518
  "span",
1516
1519
  {
1517
1520
  style: {
@@ -1543,20 +1546,20 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
1543
1546
  }
1544
1547
  );
1545
1548
  };
1546
- function qe({
1549
+ function Ke({
1547
1550
  memory: e,
1548
1551
  completed: r
1549
1552
  }) {
1550
- return e.error != null ? /* @__PURE__ */ i(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1553
+ return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1551
1554
  }
1552
- const V = 80;
1553
- function Ue({
1555
+ const X = 80;
1556
+ function Ve({
1554
1557
  memory: e,
1555
1558
  completed: r,
1556
1559
  t
1557
1560
  }) {
1558
- const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > V, d = c != null ? n || !s ? c : `${c.slice(0, V)}...` : void 0, m = s, o = e.error != null;
1559
- return /* @__PURE__ */ y(
1561
+ const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > X, d = c != null ? n || !s ? c : `${c.slice(0, X)}...` : void 0, m = s, o = e.error != null;
1562
+ return /* @__PURE__ */ g(
1560
1563
  b.div,
1561
1564
  {
1562
1565
  initial: { opacity: 0 },
@@ -1585,10 +1588,10 @@ function Ue({
1585
1588
  flexShrink: 0,
1586
1589
  width: 32
1587
1590
  },
1588
- children: /* @__PURE__ */ i(qe, { memory: e, completed: r })
1591
+ children: /* @__PURE__ */ i(Ke, { memory: e, completed: r })
1589
1592
  }
1590
1593
  ),
1591
- /* @__PURE__ */ y(
1594
+ /* @__PURE__ */ g(
1592
1595
  "div",
1593
1596
  {
1594
1597
  style: {
@@ -1635,8 +1638,8 @@ function Ue({
1635
1638
  }
1636
1639
  );
1637
1640
  }
1638
- const Ke = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ i(
1639
- Ue,
1641
+ const Xe = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ i(
1642
+ Ve,
1640
1643
  {
1641
1644
  memory: n,
1642
1645
  completed: r,
@@ -1644,25 +1647,25 @@ const Ke = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: {
1644
1647
  },
1645
1648
  n.memoryId
1646
1649
  )) });
1647
- function Ve(e, r) {
1650
+ function Je(e, r) {
1648
1651
  if (e.length === 0) return "";
1649
1652
  if (e.length === 1)
1650
- return x(r.pageSingle, { n: e[0] });
1653
+ return T(r.pageSingle, { n: e[0] });
1651
1654
  if (e.length === 2)
1652
- return x(r.pageTwo, {
1655
+ return T(r.pageTwo, {
1653
1656
  a: e[0],
1654
1657
  b: e[1]
1655
1658
  });
1656
1659
  const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1657
- return x(r.pageMultiple, { list: n, n: t });
1660
+ return T(r.pageMultiple, { list: n, n: t });
1658
1661
  }
1659
- function Xe(e, r) {
1660
- return e === 1 ? r.chunkFound : x(r.chunksFound, { n: e });
1662
+ function Ye(e, r) {
1663
+ return e === 1 ? r.chunkFound : T(r.chunksFound, { n: e });
1661
1664
  }
1662
- const Je = ({ data: e, t: r }) => {
1665
+ const Ze = ({ data: e, t: r }) => {
1663
1666
  const [t, n] = v(!1), l = e.chunks.length, c = l > 0;
1664
- return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1665
- /* @__PURE__ */ y(
1667
+ return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
1668
+ /* @__PURE__ */ g(
1666
1669
  b.div,
1667
1670
  {
1668
1671
  initial: { opacity: 0 },
@@ -1680,7 +1683,7 @@ const Je = ({ data: e, t: r }) => {
1680
1683
  },
1681
1684
  children: [
1682
1685
  /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1683
- /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: Xe(l, r) }),
1686
+ /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: Ye(l, r) }),
1684
1687
  c && /* @__PURE__ */ i(
1685
1688
  "span",
1686
1689
  {
@@ -1710,8 +1713,8 @@ const Je = ({ data: e, t: r }) => {
1710
1713
  gap: 8
1711
1714
  },
1712
1715
  children: e.chunks.map((s, d) => {
1713
- const m = s.pageNumbers ?? [], o = Ve(m, r);
1714
- return /* @__PURE__ */ y(
1716
+ const m = s.pageNumbers ?? [], o = Je(m, r);
1717
+ return /* @__PURE__ */ g(
1715
1718
  "div",
1716
1719
  {
1717
1720
  style: {
@@ -1734,7 +1737,7 @@ const Je = ({ data: e, t: r }) => {
1734
1737
  children: s.content
1735
1738
  }
1736
1739
  ),
1737
- /* @__PURE__ */ y(
1740
+ /* @__PURE__ */ g(
1738
1741
  "div",
1739
1742
  {
1740
1743
  style: {
@@ -1745,7 +1748,7 @@ const Je = ({ data: e, t: r }) => {
1745
1748
  },
1746
1749
  children: [
1747
1750
  o && /* @__PURE__ */ i("span", { children: o }),
1748
- /* @__PURE__ */ i("span", { children: x(r.scoreLabel, {
1751
+ /* @__PURE__ */ i("span", { children: T(r.scoreLabel, {
1749
1752
  n: s.score
1750
1753
  }) })
1751
1754
  ]
@@ -1760,21 +1763,21 @@ const Je = ({ data: e, t: r }) => {
1760
1763
  )
1761
1764
  ] });
1762
1765
  };
1763
- function Ye({ item: e }) {
1764
- return e.error != null ? /* @__PURE__ */ i(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1766
+ function er({ item: e }) {
1767
+ return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1765
1768
  }
1766
- function Ze(e, r) {
1767
- return x(r.searchingInMemoriesOfType, {
1769
+ function rr(e, r) {
1770
+ return T(r.searchingInMemoriesOfType, {
1768
1771
  name: e.memoryTypeName
1769
1772
  });
1770
1773
  }
1771
- function er({
1774
+ function nr({
1772
1775
  item: e,
1773
1776
  t: r,
1774
1777
  showShimmerForPrimary: t
1775
1778
  }) {
1776
- const n = e.result != null, l = e.error != null, c = Ze(e, r);
1777
- return /* @__PURE__ */ y(
1779
+ const n = e.result != null, l = e.error != null, c = rr(e, r);
1780
+ return /* @__PURE__ */ g(
1778
1781
  b.div,
1779
1782
  {
1780
1783
  initial: { opacity: 0 },
@@ -1801,10 +1804,10 @@ function er({
1801
1804
  flexShrink: 0,
1802
1805
  width: 32
1803
1806
  },
1804
- children: /* @__PURE__ */ i(Ye, { item: e })
1807
+ children: /* @__PURE__ */ i(er, { item: e })
1805
1808
  }
1806
1809
  ),
1807
- /* @__PURE__ */ y(
1810
+ /* @__PURE__ */ g(
1808
1811
  "div",
1809
1812
  {
1810
1813
  style: {
@@ -1825,14 +1828,14 @@ function er({
1825
1828
  shimmerColor: "#000"
1826
1829
  }
1827
1830
  ) : c }),
1828
- n && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? x(
1831
+ n && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? T(
1829
1832
  r.memorySearchTypeResultSummaryOne,
1830
1833
  {
1831
1834
  score: e.result.highestChunkScore.toFixed(
1832
1835
  2
1833
1836
  )
1834
1837
  }
1835
- ) : x(
1838
+ ) : T(
1836
1839
  r.memorySearchTypeResultSummary,
1837
1840
  {
1838
1841
  count: e.result.numberOfChunks,
@@ -1849,14 +1852,14 @@ function er({
1849
1852
  }
1850
1853
  );
1851
1854
  }
1852
- const rr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1855
+ const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1853
1856
  const l = D(() => {
1854
1857
  let c = -1;
1855
1858
  return e.memoryTypes.forEach((s, d) => {
1856
1859
  s.result == null && s.error == null && (c = d);
1857
1860
  }), c;
1858
1861
  }, [e.memoryTypes]);
1859
- return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1862
+ return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
1860
1863
  r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
1861
1864
  w,
1862
1865
  {
@@ -1867,7 +1870,7 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1867
1870
  shimmerColor: "#000"
1868
1871
  }
1869
1872
  ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
1870
- er,
1873
+ nr,
1871
1874
  {
1872
1875
  item: c,
1873
1876
  t: n,
@@ -1884,44 +1887,44 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1884
1887
  marginTop: "4px",
1885
1888
  fontStyle: "italic"
1886
1889
  },
1887
- children: x(n.tookSeconds, { n: t })
1890
+ children: T(n.tookSeconds, { n: t })
1888
1891
  }
1889
1892
  )
1890
1893
  ] });
1891
- }, N = 12, B = 1.45, nr = Math.ceil(
1894
+ }, N = 12, B = 1.45, or = Math.ceil(
1892
1895
  N * B
1893
- ), tr = Math.ceil(
1896
+ ), ir = Math.ceil(
1894
1897
  5 * N * B
1895
1898
  );
1896
1899
  function O(e) {
1897
1900
  return e.queries != null && e.queries.length > 0;
1898
1901
  }
1899
- function or(e) {
1902
+ function ar(e) {
1900
1903
  const r = e.reasoning;
1901
1904
  return (r == null || r === "") && !O(e);
1902
1905
  }
1903
- function ir(e) {
1906
+ function sr(e) {
1904
1907
  if (O(e)) return 3;
1905
1908
  const r = e.reasoning;
1906
1909
  return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
1907
1910
  }
1908
- function ar({ phase: e }) {
1911
+ function lr({ phase: e }) {
1909
1912
  return e === 3 ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1910
1913
  }
1911
- function sr({
1914
+ function cr({
1912
1915
  item: e,
1913
1916
  t: r,
1914
1917
  isActiveRow: t
1915
1918
  }) {
1916
- const n = or(e), l = ir(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [m, o] = v(!1), a = n && t, u = l === 2 && t && !O(e);
1919
+ const n = ar(e), l = sr(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [m, o] = v(!1), a = n && t, u = l === 2 && t && !O(e);
1917
1920
  A(() => {
1918
1921
  const p = d.current;
1919
1922
  p != null && l === 1 && s && (p.scrollTop = p.scrollHeight);
1920
1923
  }, [c, l, s]);
1921
- const g = x(r.searchingInMemoriesOfType, {
1924
+ const y = T(r.searchingInMemoriesOfType, {
1922
1925
  name: e.memoryTypeName
1923
1926
  }), f = !n && l === 3;
1924
- return /* @__PURE__ */ y(
1927
+ return /* @__PURE__ */ g(
1925
1928
  b.div,
1926
1929
  {
1927
1930
  initial: { opacity: 0 },
@@ -1949,10 +1952,10 @@ function sr({
1949
1952
  width: 32,
1950
1953
  ...f ? { paddingTop: 2 } : {}
1951
1954
  },
1952
- children: /* @__PURE__ */ i(ar, { phase: n ? 1 : l })
1955
+ children: /* @__PURE__ */ i(lr, { phase: n ? 1 : l })
1953
1956
  }
1954
1957
  ),
1955
- /* @__PURE__ */ y(
1958
+ /* @__PURE__ */ g(
1956
1959
  "div",
1957
1960
  {
1958
1961
  style: {
@@ -1966,14 +1969,14 @@ function sr({
1966
1969
  /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ i(
1967
1970
  w,
1968
1971
  {
1969
- text: g,
1972
+ text: y,
1970
1973
  duration: 2.5,
1971
1974
  repeat: !0,
1972
1975
  color: "#999",
1973
1976
  shimmerColor: "#000"
1974
1977
  }
1975
1978
  ) : e.memoryTypeName }),
1976
- l === 1 && s && !O(e) && /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
1979
+ l === 1 && s && !O(e) && /* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
1977
1980
  /* @__PURE__ */ i(
1978
1981
  "span",
1979
1982
  {
@@ -2002,8 +2005,8 @@ function sr({
2002
2005
  ref: d,
2003
2006
  className: "memory-search-generating-reasoning-viewport",
2004
2007
  style: {
2005
- minHeight: nr,
2006
- maxHeight: tr,
2008
+ minHeight: or,
2009
+ maxHeight: ir,
2007
2010
  height: "auto",
2008
2011
  overflowY: "auto",
2009
2012
  overflowX: "hidden",
@@ -2029,8 +2032,8 @@ function sr({
2029
2032
  shimmerColor: "#000"
2030
2033
  }
2031
2034
  ) }),
2032
- l === 3 && /* @__PURE__ */ y(I, { children: [
2033
- /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
2035
+ l === 3 && /* @__PURE__ */ g(I, { children: [
2036
+ /* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
2034
2037
  /* @__PURE__ */ i(
2035
2038
  "span",
2036
2039
  {
@@ -2052,7 +2055,7 @@ function sr({
2052
2055
  flexDirection: "column",
2053
2056
  gap: 6
2054
2057
  },
2055
- children: e.queries.map((p, S) => /* @__PURE__ */ i(
2058
+ children: e.queries.map((p, x) => /* @__PURE__ */ i(
2056
2059
  "div",
2057
2060
  {
2058
2061
  style: {
@@ -2063,12 +2066,12 @@ function sr({
2063
2066
  },
2064
2067
  children: p.query
2065
2068
  },
2066
- S
2069
+ x
2067
2070
  ))
2068
2071
  }
2069
2072
  )
2070
2073
  ] }),
2071
- s && /* @__PURE__ */ y(I, { children: [
2074
+ s && /* @__PURE__ */ g(I, { children: [
2072
2075
  /* @__PURE__ */ i(
2073
2076
  "button",
2074
2077
  {
@@ -2112,14 +2115,14 @@ function sr({
2112
2115
  }
2113
2116
  );
2114
2117
  }
2115
- const lr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2118
+ const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2116
2119
  const l = D(() => {
2117
2120
  let c = -1;
2118
2121
  return e.memoryTypes.forEach((s, d) => {
2119
2122
  O(s) || (c = d);
2120
2123
  }), c;
2121
2124
  }, [e.memoryTypes]);
2122
- return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2125
+ return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
2123
2126
  r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
2124
2127
  w,
2125
2128
  {
@@ -2130,7 +2133,7 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2130
2133
  shimmerColor: "#000"
2131
2134
  }
2132
2135
  ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
2133
- sr,
2136
+ cr,
2134
2137
  {
2135
2138
  item: c,
2136
2139
  t: n,
@@ -2147,21 +2150,21 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2147
2150
  marginTop: "4px",
2148
2151
  fontStyle: "italic"
2149
2152
  },
2150
- children: x(n.tookSeconds, { n: t })
2153
+ children: T(n.tookSeconds, { n: t })
2151
2154
  }
2152
2155
  )
2153
2156
  ] });
2154
2157
  };
2155
- function cr(e, r) {
2158
+ function mr(e, r) {
2156
2159
  const t = Math.min(e.length, r.length);
2157
2160
  for (let n = t; n >= 0; n--)
2158
2161
  if (e.slice(-n) === r.slice(0, n)) return n;
2159
2162
  return 0;
2160
2163
  }
2161
- const dr = `
2164
+ const ur = `
2162
2165
 
2163
2166
  `;
2164
- function re(e) {
2167
+ function ne(e) {
2165
2168
  var t, n;
2166
2169
  if (e.length === 0) return "";
2167
2170
  let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
@@ -2172,43 +2175,43 @@ function re(e) {
2172
2175
  r = c;
2173
2176
  continue;
2174
2177
  }
2175
- const s = cr(r, c);
2176
- s === 0 ? r += dr + c : r += c.slice(s);
2178
+ const s = mr(r, c);
2179
+ s === 0 ? r += ur + c : r += c.slice(s);
2177
2180
  }
2178
2181
  return r;
2179
2182
  }
2180
- function ne(e, r) {
2183
+ function te(e, r) {
2181
2184
  if (e.length === 0) return "";
2182
2185
  if (e.length === 1)
2183
- return x(r.memorySearchPagesSingle, {
2186
+ return T(r.memorySearchPagesSingle, {
2184
2187
  n: e[0]
2185
2188
  });
2186
2189
  if (e.length === 2)
2187
- return x(r.memorySearchPagesTwo, {
2190
+ return T(r.memorySearchPagesTwo, {
2188
2191
  a: e[0],
2189
2192
  b: e[1]
2190
2193
  });
2191
2194
  const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
2192
- return x(r.memorySearchPagesMultiple, {
2195
+ return T(r.memorySearchPagesMultiple, {
2193
2196
  list: n,
2194
2197
  n: t
2195
2198
  });
2196
2199
  }
2197
- function te(e) {
2200
+ function oe(e) {
2198
2201
  const r = /* @__PURE__ */ new Set();
2199
2202
  for (const t of e)
2200
2203
  for (const n of t.pageNumbers) r.add(n);
2201
2204
  return [...r].sort((t, n) => t - n);
2202
2205
  }
2203
- function oe(e) {
2206
+ function ie(e) {
2204
2207
  const r = e.memoryTypeName.trim();
2205
2208
  if (r !== "") return r;
2206
2209
  if (e.memoryTypeId !== "") return e.memoryTypeId;
2207
2210
  }
2208
- function mr(e) {
2209
- return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ i(j, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 });
2211
+ function yr(e) {
2212
+ return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 });
2210
2213
  }
2211
- function ur(e, r) {
2214
+ function gr(e, r) {
2212
2215
  if (e.error != null)
2213
2216
  return /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
2214
2217
  if (e.result == null)
@@ -2222,16 +2225,16 @@ function ur(e, r) {
2222
2225
  shimmerColor: "#000"
2223
2226
  }
2224
2227
  ) });
2225
- const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : x(r.chunksFound, { n: t.numberOfChunks }), l = x(r.scoreLabel, {
2228
+ const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : T(r.chunksFound, { n: t.numberOfChunks }), l = T(r.scoreLabel, {
2226
2229
  n: t.highestChunkScore.toFixed(2)
2227
2230
  });
2228
- return /* @__PURE__ */ y("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
2231
+ return /* @__PURE__ */ g("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
2229
2232
  n,
2230
2233
  " · ",
2231
2234
  l
2232
2235
  ] });
2233
2236
  }
2234
- function yr({
2237
+ function pr({
2235
2238
  items: e,
2236
2239
  queryRow: r,
2237
2240
  onExploreQueryResultClick: t,
@@ -2263,17 +2266,17 @@ function yr({
2263
2266
  borderTop: "1px solid #f0f0f0"
2264
2267
  },
2265
2268
  children: e.map((d, m) => {
2266
- const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = te(
2269
+ const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
2267
2270
  d.chunks
2268
2271
  ), u = [
2269
- oe(d),
2270
- x(n.scoreLabel, {
2272
+ ie(d),
2273
+ T(n.scoreLabel, {
2271
2274
  n: d.matchingChunkScore.toFixed(2)
2272
2275
  }),
2273
- a.length > 0 ? ne(a, n) : n.pagesNotAvailable
2276
+ a.length > 0 ? te(a, n) : n.pagesNotAvailable
2274
2277
  ].filter(
2275
- (S) => S != null && S !== ""
2276
- ), g = {
2278
+ (x) => x != null && x !== ""
2279
+ ), y = {
2277
2280
  memoryId: d.memoryId,
2278
2281
  memoryTitle: d.memoryTitle,
2279
2282
  pageNumbers: a,
@@ -2281,7 +2284,7 @@ function yr({
2281
2284
  memoryTypeName: r.memoryTypeName,
2282
2285
  query: r.query
2283
2286
  }, f = `${r.query}::${d.memoryId}::${m}`, p = l === f;
2284
- return /* @__PURE__ */ y(
2287
+ return /* @__PURE__ */ g(
2285
2288
  "div",
2286
2289
  {
2287
2290
  style: {
@@ -2295,7 +2298,7 @@ function yr({
2295
2298
  minWidth: 0
2296
2299
  },
2297
2300
  children: [
2298
- /* @__PURE__ */ y(
2301
+ /* @__PURE__ */ g(
2299
2302
  "div",
2300
2303
  {
2301
2304
  style: {
@@ -2327,7 +2330,7 @@ function yr({
2327
2330
  whiteSpace: "pre-wrap",
2328
2331
  wordBreak: "break-word"
2329
2332
  },
2330
- children: re(
2333
+ children: ne(
2331
2334
  d.chunks
2332
2335
  )
2333
2336
  }
@@ -2347,7 +2350,7 @@ function yr({
2347
2350
  ]
2348
2351
  }
2349
2352
  ),
2350
- s && /* @__PURE__ */ y(
2353
+ s && /* @__PURE__ */ g(
2351
2354
  "button",
2352
2355
  {
2353
2356
  type: "button",
@@ -2357,7 +2360,7 @@ function yr({
2357
2360
  c(f);
2358
2361
  try {
2359
2362
  await t(
2360
- g
2363
+ y
2361
2364
  );
2362
2365
  } finally {
2363
2366
  c(null);
@@ -2399,7 +2402,7 @@ function yr({
2399
2402
  }
2400
2403
  );
2401
2404
  }
2402
- function gr(e) {
2405
+ function hr(e) {
2403
2406
  const r = [], t = /* @__PURE__ */ new Map();
2404
2407
  return e.forEach((n, l) => {
2405
2408
  let c = t.get(n.memoryTypeId);
@@ -2410,7 +2413,7 @@ function gr(e) {
2410
2413
  }, t.set(n.memoryTypeId, c)), c.items.push({ item: n, flatIndex: l });
2411
2414
  }), r.map((n) => t.get(n));
2412
2415
  }
2413
- function pr({
2416
+ function fr({
2414
2417
  group: e,
2415
2418
  t: r,
2416
2419
  lastInFlightIndex: t,
@@ -2422,7 +2425,7 @@ function pr({
2422
2425
  const d = e.items.map((o) => o.item), m = d.some(
2423
2426
  (o) => o.result == null && o.error == null
2424
2427
  );
2425
- return /* @__PURE__ */ y(
2428
+ return /* @__PURE__ */ g(
2426
2429
  b.div,
2427
2430
  {
2428
2431
  initial: { opacity: 0 },
@@ -2450,10 +2453,10 @@ function pr({
2450
2453
  width: 32,
2451
2454
  ...m ? {} : { paddingTop: 2 }
2452
2455
  },
2453
- children: mr(d)
2456
+ children: yr(d)
2454
2457
  }
2455
2458
  ),
2456
- /* @__PURE__ */ y(
2459
+ /* @__PURE__ */ g(
2457
2460
  "div",
2458
2461
  {
2459
2462
  style: {
@@ -2471,15 +2474,15 @@ function pr({
2471
2474
  fontSize: 12,
2472
2475
  color: "#888"
2473
2476
  },
2474
- children: x(r.memorySearchExploreQueryTypeLabel, {
2477
+ children: T(r.memorySearchExploreQueryTypeLabel, {
2475
2478
  name: e.memoryTypeName
2476
2479
  })
2477
2480
  }
2478
2481
  ),
2479
2482
  e.items.map(({ item: o, flatIndex: a }) => {
2480
2483
  var h;
2481
- const u = o.result != null, g = o.error != null, f = a === t && n && !u && !g, p = l[a] === !0, S = ((h = o.result) == null ? void 0 : h.items) ?? [];
2482
- return /* @__PURE__ */ y(
2484
+ const u = o.result != null, y = o.error != null, f = a === t && n && !u && !y, p = l[a] === !0, x = ((h = o.result) == null ? void 0 : h.items) ?? [];
2485
+ return /* @__PURE__ */ g(
2483
2486
  "div",
2484
2487
  {
2485
2488
  style: {
@@ -2489,7 +2492,7 @@ function pr({
2489
2492
  minWidth: 0
2490
2493
  },
2491
2494
  children: [
2492
- /* @__PURE__ */ y(
2495
+ /* @__PURE__ */ g(
2493
2496
  "div",
2494
2497
  {
2495
2498
  style: {
@@ -2524,7 +2527,7 @@ function pr({
2524
2527
  ) : o.query
2525
2528
  }
2526
2529
  ),
2527
- /* @__PURE__ */ y(
2530
+ /* @__PURE__ */ g(
2528
2531
  "div",
2529
2532
  {
2530
2533
  style: {
@@ -2535,7 +2538,7 @@ function pr({
2535
2538
  flexShrink: 0
2536
2539
  },
2537
2540
  children: [
2538
- ur(o, r),
2541
+ gr(o, r),
2539
2542
  u && /* @__PURE__ */ i(
2540
2543
  "button",
2541
2544
  {
@@ -2561,9 +2564,9 @@ function pr({
2561
2564
  }
2562
2565
  ),
2563
2566
  u && p && /* @__PURE__ */ i(
2564
- yr,
2567
+ pr,
2565
2568
  {
2566
- items: S,
2569
+ items: x,
2567
2570
  queryRow: o,
2568
2571
  onExploreQueryResultClick: s,
2569
2572
  t: r
@@ -2581,7 +2584,7 @@ function pr({
2581
2584
  }
2582
2585
  );
2583
2586
  }
2584
- const hr = ({
2587
+ const Sr = ({
2585
2588
  data: e,
2586
2589
  isLatest: r = !1,
2587
2590
  durationSeconds: t,
@@ -2597,14 +2600,14 @@ const hr = ({
2597
2600
  }));
2598
2601
  }, []), m = D(() => {
2599
2602
  let a = -1;
2600
- return e.queries.forEach((u, g) => {
2601
- u.result == null && u.error == null && (a = g);
2603
+ return e.queries.forEach((u, y) => {
2604
+ u.result == null && u.error == null && (a = y);
2602
2605
  }), a;
2603
2606
  }, [e.queries]), o = D(
2604
- () => gr(e.queries),
2607
+ () => hr(e.queries),
2605
2608
  [e.queries]
2606
2609
  );
2607
- return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2610
+ return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
2608
2611
  r && !t && e.queries.length === 0 ? /* @__PURE__ */ i(
2609
2612
  w,
2610
2613
  {
@@ -2615,7 +2618,7 @@ const hr = ({
2615
2618
  shimmerColor: "#000"
2616
2619
  }
2617
2620
  ) : o.map((a) => /* @__PURE__ */ i(
2618
- pr,
2621
+ fr,
2619
2622
  {
2620
2623
  group: a,
2621
2624
  t: l,
@@ -2636,13 +2639,13 @@ const hr = ({
2636
2639
  marginTop: "4px",
2637
2640
  fontStyle: "italic"
2638
2641
  },
2639
- children: x(l.tookSeconds, { n: t })
2642
+ children: T(l.tookSeconds, { n: t })
2640
2643
  }
2641
2644
  )
2642
2645
  ] });
2643
- }, fr = ({ data: e, onSearchResultClick: r, t }) => {
2646
+ }, xr = ({ data: e, onSearchResultClick: r, t }) => {
2644
2647
  const n = e.response.items, l = !!r, [c, s] = v(null);
2645
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
2648
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
2646
2649
  /* @__PURE__ */ i(
2647
2650
  b.div,
2648
2651
  {
@@ -2667,24 +2670,24 @@ const hr = ({
2667
2670
  gap: 0
2668
2671
  },
2669
2672
  children: n.map((d, m) => {
2670
- const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = te(
2673
+ const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
2671
2674
  d.chunks
2672
2675
  ), u = [
2673
- oe(d),
2674
- x(t.scoreLabel, {
2676
+ ie(d),
2677
+ T(t.scoreLabel, {
2675
2678
  n: d.matchingChunkScore.toFixed(2)
2676
2679
  }),
2677
- a.length > 0 ? ne(a, t) : t.pagesNotAvailable
2680
+ a.length > 0 ? te(a, t) : t.pagesNotAvailable
2678
2681
  ].filter(
2679
- (S) => S != null && S !== ""
2680
- ), g = {
2682
+ (x) => x != null && x !== ""
2683
+ ), y = {
2681
2684
  memoryId: d.memoryId,
2682
2685
  memoryTitle: d.memoryTitle,
2683
2686
  memoryTypeId: d.memoryTypeId,
2684
2687
  memoryTypeName: d.memoryTypeName,
2685
2688
  pageNumbers: a
2686
2689
  }, f = `${d.memoryId}-${m}`, p = c === f;
2687
- return /* @__PURE__ */ y(
2690
+ return /* @__PURE__ */ g(
2688
2691
  b.div,
2689
2692
  {
2690
2693
  initial: { opacity: 0 },
@@ -2701,7 +2704,7 @@ const hr = ({
2701
2704
  minWidth: 0
2702
2705
  },
2703
2706
  children: [
2704
- /* @__PURE__ */ y(
2707
+ /* @__PURE__ */ g(
2705
2708
  "div",
2706
2709
  {
2707
2710
  style: {
@@ -2733,7 +2736,7 @@ const hr = ({
2733
2736
  whiteSpace: "pre-wrap",
2734
2737
  wordBreak: "break-word"
2735
2738
  },
2736
- children: re(d.chunks)
2739
+ children: ne(d.chunks)
2737
2740
  }
2738
2741
  ),
2739
2742
  /* @__PURE__ */ i(
@@ -2751,7 +2754,7 @@ const hr = ({
2751
2754
  ]
2752
2755
  }
2753
2756
  ),
2754
- l && /* @__PURE__ */ y(
2757
+ l && /* @__PURE__ */ g(
2755
2758
  "button",
2756
2759
  {
2757
2760
  type: "button",
@@ -2760,7 +2763,7 @@ const hr = ({
2760
2763
  onClick: async () => {
2761
2764
  s(f);
2762
2765
  try {
2763
- await r(g);
2766
+ await r(y);
2764
2767
  } finally {
2765
2768
  s(null);
2766
2769
  }
@@ -2801,7 +2804,7 @@ const hr = ({
2801
2804
  }
2802
2805
  )
2803
2806
  ] });
2804
- }, Sr = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
2807
+ }, Tr = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
2805
2808
  b.div,
2806
2809
  {
2807
2810
  initial: { opacity: 0, y: -10 },
@@ -2824,7 +2827,7 @@ const hr = ({
2824
2827
  }
2825
2828
  )
2826
2829
  }
2827
- ) }), xr = ({
2830
+ ) }), kr = ({
2828
2831
  progressViewItems: e,
2829
2832
  loadingText: r,
2830
2833
  t,
@@ -2839,16 +2842,16 @@ const hr = ({
2839
2842
  const d = (o) => {
2840
2843
  const a = o.item.data;
2841
2844
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Text")
2842
- return /* @__PURE__ */ i(K, { text: a.text });
2845
+ return /* @__PURE__ */ i(V, { text: a.text });
2843
2846
  if (a.taskType === "StructuredChatCompletion" && a.eventType === "Completed")
2844
- return /* @__PURE__ */ i(Oe, { data: a });
2847
+ return /* @__PURE__ */ i(Be, { data: a });
2845
2848
  if (a.taskType === "MemoryChat")
2846
2849
  switch (a.eventType) {
2847
2850
  case "Text":
2848
- return /* @__PURE__ */ i(K, { text: a.text });
2851
+ return /* @__PURE__ */ i(V, { text: a.text });
2849
2852
  case "FindMemories":
2850
2853
  return /* @__PURE__ */ i(
2851
- $e,
2854
+ _e,
2852
2855
  {
2853
2856
  data: a,
2854
2857
  isLatest: o.isLatest,
@@ -2858,7 +2861,7 @@ const hr = ({
2858
2861
  );
2859
2862
  case "FindMemoriesResult":
2860
2863
  return /* @__PURE__ */ i(
2861
- He,
2864
+ Ge,
2862
2865
  {
2863
2866
  data: a,
2864
2867
  t
@@ -2866,7 +2869,7 @@ const hr = ({
2866
2869
  );
2867
2870
  case "Search":
2868
2871
  return /* @__PURE__ */ i(
2869
- We,
2872
+ He,
2870
2873
  {
2871
2874
  data: a,
2872
2875
  isLatest: o.isLatest,
@@ -2876,7 +2879,7 @@ const hr = ({
2876
2879
  );
2877
2880
  case "FindSources":
2878
2881
  return /* @__PURE__ */ i(
2879
- _e,
2882
+ Qe,
2880
2883
  {
2881
2884
  data: a,
2882
2885
  isLatest: o.isLatest,
@@ -2886,7 +2889,7 @@ const hr = ({
2886
2889
  );
2887
2890
  case "SourcesResult":
2888
2891
  return /* @__PURE__ */ i(
2889
- Qe,
2892
+ je,
2890
2893
  {
2891
2894
  data: a,
2892
2895
  onSourceClick: n,
@@ -2895,7 +2898,7 @@ const hr = ({
2895
2898
  );
2896
2899
  case "ExploreMemories":
2897
2900
  return /* @__PURE__ */ i(
2898
- Ke,
2901
+ Xe,
2899
2902
  {
2900
2903
  data: a,
2901
2904
  completed: o.completed,
@@ -2904,7 +2907,7 @@ const hr = ({
2904
2907
  }
2905
2908
  );
2906
2909
  case "ChunkResult":
2907
- return /* @__PURE__ */ i(Je, { data: a, t });
2910
+ return /* @__PURE__ */ i(Ze, { data: a, t });
2908
2911
  case "Completed":
2909
2912
  return null;
2910
2913
  }
@@ -2912,7 +2915,7 @@ const hr = ({
2912
2915
  switch (a.eventType) {
2913
2916
  case "GeneratingQueries":
2914
2917
  return /* @__PURE__ */ i(
2915
- lr,
2918
+ dr,
2916
2919
  {
2917
2920
  data: a,
2918
2921
  isLatest: o.isLatest,
@@ -2922,7 +2925,7 @@ const hr = ({
2922
2925
  );
2923
2926
  case "ExploreQueries":
2924
2927
  return /* @__PURE__ */ i(
2925
- hr,
2928
+ Sr,
2926
2929
  {
2927
2930
  data: a,
2928
2931
  isLatest: o.isLatest,
@@ -2933,7 +2936,7 @@ const hr = ({
2933
2936
  );
2934
2937
  case "SearchMemoryTypes":
2935
2938
  return /* @__PURE__ */ i(
2936
- rr,
2939
+ tr,
2937
2940
  {
2938
2941
  data: a,
2939
2942
  isLatest: o.isLatest,
@@ -2943,7 +2946,7 @@ const hr = ({
2943
2946
  );
2944
2947
  case "Completed":
2945
2948
  return /* @__PURE__ */ i(
2946
- fr,
2949
+ xr,
2947
2950
  {
2948
2951
  data: a,
2949
2952
  onSearchResultClick: l,
@@ -2951,7 +2954,7 @@ const hr = ({
2951
2954
  }
2952
2955
  );
2953
2956
  }
2954
- return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(Sr, { message: a.message }) : null;
2957
+ return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(Tr, { message: a.message }) : null;
2955
2958
  };
2956
2959
  if (e.length === 0)
2957
2960
  return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
@@ -2975,7 +2978,7 @@ const hr = ({
2975
2978
  (h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "ExploreQueries"
2976
2979
  ) : !0;
2977
2980
  });
2978
- return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(X, { children: m.map((o, a) => /* @__PURE__ */ i(
2981
+ return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(J, { children: m.map((o, a) => /* @__PURE__ */ i(
2979
2982
  b.div,
2980
2983
  {
2981
2984
  id: `agent-task-progress-item-${o.item.progressItemId}`,
@@ -2990,7 +2993,7 @@ const hr = ({
2990
2993
  },
2991
2994
  o.item.progressItemId
2992
2995
  )) }) });
2993
- }, Ar = ({
2996
+ }, Rr = ({
2994
2997
  agentTask: e,
2995
2998
  mode: r = "verbose",
2996
2999
  language: t,
@@ -2998,15 +3001,15 @@ const hr = ({
2998
3001
  onSearchResultClick: l,
2999
3002
  onExploreQueryResultClick: c
3000
3003
  }) => {
3001
- const s = De(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : t ?? "en", m = Be(d);
3004
+ const s = ze(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : t ?? "en", m = $e(d);
3002
3005
  return r === "simple" ? /* @__PURE__ */ i(
3003
- ze,
3006
+ Ne,
3004
3007
  {
3005
3008
  progressViewItems: s,
3006
3009
  t: m
3007
3010
  }
3008
3011
  ) : /* @__PURE__ */ i(
3009
- xr,
3012
+ kr,
3010
3013
  {
3011
3014
  progressViewItems: s,
3012
3015
  loadingText: e.loadingText,
@@ -3018,10 +3021,10 @@ const hr = ({
3018
3021
  );
3019
3022
  };
3020
3023
  export {
3021
- Ar as AgentTaskProgress,
3024
+ Rr as AgentTaskProgress,
3022
3025
  z as Checkmark,
3023
- Ir as FencyProvider,
3024
- fr as MemorySearchCompletedResults,
3025
- j as XMark,
3026
- Mr as useAgentTasks
3026
+ Ar as FencyProvider,
3027
+ xr as MemorySearchCompletedResults,
3028
+ U as XMark,
3029
+ Fr as useAgentTasks
3027
3030
  };