@fencyai/react 0.1.137 → 0.1.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/agent-task/AgentTaskProgress.d.ts +2 -0
  2. package/dist/agent-task/AgentTaskProgress.d.ts.map +1 -1
  3. package/dist/agent-task/AgentTaskProgressSimple.d.ts +2 -0
  4. package/dist/agent-task/AgentTaskProgressSimple.d.ts.map +1 -1
  5. package/dist/agent-task/AgentTaskProgressVerbose.d.ts +2 -0
  6. package/dist/agent-task/AgentTaskProgressVerbose.d.ts.map +1 -1
  7. package/dist/agent-task/data-types/MemoryChatCompletionChunkResult.d.ts +12 -0
  8. package/dist/agent-task/data-types/MemoryChatCompletionChunkResult.d.ts.map +1 -0
  9. package/dist/agent-task/data-types/MemoryChatCompletionExploreMemory.d.ts +2 -0
  10. package/dist/agent-task/data-types/MemoryChatCompletionExploreMemory.d.ts.map +1 -1
  11. package/dist/agent-task/data-types/MemoryChatCompletionFindSources.d.ts +2 -0
  12. package/dist/agent-task/data-types/MemoryChatCompletionFindSources.d.ts.map +1 -1
  13. package/dist/agent-task/data-types/MemoryChatCompletionSearch.d.ts +2 -0
  14. package/dist/agent-task/data-types/MemoryChatCompletionSearch.d.ts.map +1 -1
  15. package/dist/agent-task/data-types/MemoryChatCompletionSourcesResult.d.ts +2 -0
  16. package/dist/agent-task/data-types/MemoryChatCompletionSourcesResult.d.ts.map +1 -1
  17. package/dist/agent-task/translations.d.ts +32 -0
  18. package/dist/agent-task/translations.d.ts.map +1 -0
  19. package/dist/hooks/useAgentTasks/index.d.ts.map +1 -1
  20. package/dist/index.js +625 -422
  21. package/dist/types/CreateAgentTaskParams.d.ts +4 -1
  22. package/dist/types/CreateAgentTaskParams.d.ts.map +1 -1
  23. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,78 +1,78 @@
1
- import { jsxs as C, jsx as s } from "react/jsx-runtime";
2
- import { createStream as K, isStreamTimeoutEvent as G, isStreamNotFoundEvent as J, isAgentTaskProgressItemUpdatedEvent as V, createAgentTask as X } from "@fencyai/js";
3
- import { createContext as q, useState as k, useRef as E, useEffect as w, useCallback as N, useContext as Q, useMemo as _ } from "react";
4
- import { useInView as Y, motion as v, AnimatePresence as z } from "motion/react";
5
- import Z from "react-markdown";
6
- import { Prism as L } from "react-syntax-highlighter";
7
- import ee from "remark-gfm";
8
- import './assets/index.css';const W = q(
1
+ import { jsxs as v, jsx as i } from "react/jsx-runtime";
2
+ import { createStream as G, isStreamTimeoutEvent as J, isStreamNotFoundEvent as V, isAgentTaskProgressItemUpdatedEvent as X, createAgentTask as Y } from "@fencyai/js";
3
+ import { createContext as q, useState as C, useRef as A, useEffect as w, useCallback as _, useContext as Q, useMemo as $ } from "react";
4
+ import { useInView as Z, motion as T, AnimatePresence as W } from "motion/react";
5
+ import ee from "react-markdown";
6
+ import { Prism as j } from "react-syntax-highlighter";
7
+ import te from "remark-gfm";
8
+ import './assets/index.css';const H = q(
9
9
  void 0
10
10
  );
11
- async function te(e, t) {
11
+ async function ne(e, t) {
12
12
  const n = e.getReader();
13
13
  let r;
14
14
  for (; !(r = await n.read()).done; )
15
15
  t(r.value);
16
16
  }
17
17
  function re(e) {
18
- let t, n, r, c = !1;
18
+ let t, n, r, s = !1;
19
19
  return function(o) {
20
- t === void 0 ? (t = o, n = 0, r = -1) : t = oe(t, o);
21
- const d = t.length;
22
- let y = 0;
23
- for (; n < d; ) {
24
- c && (t[n] === 10 && (y = ++n), c = !1);
20
+ t === void 0 ? (t = o, n = 0, r = -1) : t = ae(t, o);
21
+ const l = t.length;
22
+ let u = 0;
23
+ for (; n < l; ) {
24
+ s && (t[n] === 10 && (u = ++n), s = !1);
25
25
  let a = -1;
26
- for (; n < d && a === -1; ++n)
26
+ for (; n < l && a === -1; ++n)
27
27
  switch (t[n]) {
28
28
  case 58:
29
- r === -1 && (r = n - y);
29
+ r === -1 && (r = n - u);
30
30
  break;
31
31
  case 13:
32
- c = !0;
32
+ s = !0;
33
33
  case 10:
34
34
  a = n;
35
35
  break;
36
36
  }
37
37
  if (a === -1)
38
38
  break;
39
- e(t.subarray(y, a), r), y = n, r = -1;
39
+ e(t.subarray(u, a), r), u = n, r = -1;
40
40
  }
41
- y === d ? t = void 0 : y !== 0 && (t = t.subarray(y), n -= y);
41
+ u === l ? t = void 0 : u !== 0 && (t = t.subarray(u), n -= u);
42
42
  };
43
43
  }
44
- function ne(e, t, n) {
45
- let r = R();
46
- const c = new TextDecoder();
47
- return function(o, d) {
44
+ function oe(e, t, n) {
45
+ let r = O();
46
+ const s = new TextDecoder();
47
+ return function(o, l) {
48
48
  if (o.length === 0)
49
- n == null || n(r), r = R();
50
- else if (d > 0) {
51
- const y = c.decode(o.subarray(0, d)), a = d + (o[d + 1] === 32 ? 2 : 1), i = c.decode(o.subarray(a));
52
- switch (y) {
49
+ n == null || n(r), r = O();
50
+ else if (l > 0) {
51
+ const u = s.decode(o.subarray(0, l)), a = l + (o[l + 1] === 32 ? 2 : 1), c = s.decode(o.subarray(a));
52
+ switch (u) {
53
53
  case "data":
54
54
  r.data = r.data ? r.data + `
55
- ` + i : i;
55
+ ` + c : c;
56
56
  break;
57
57
  case "event":
58
- r.event = i;
58
+ r.event = c;
59
59
  break;
60
60
  case "id":
61
- e(r.id = i);
61
+ e(r.id = c);
62
62
  break;
63
63
  case "retry":
64
- const m = parseInt(i, 10);
65
- isNaN(m) || t(r.retry = m);
64
+ const g = parseInt(c, 10);
65
+ isNaN(g) || t(r.retry = g);
66
66
  break;
67
67
  }
68
68
  }
69
69
  };
70
70
  }
71
- function oe(e, t) {
71
+ function ae(e, t) {
72
72
  const n = new Uint8Array(e.length + t.length);
73
73
  return n.set(e), n.set(t, e.length), n;
74
74
  }
75
- function R() {
75
+ function O() {
76
76
  return {
77
77
  data: "",
78
78
  event: "",
@@ -80,68 +80,68 @@ function R() {
80
80
  retry: void 0
81
81
  };
82
82
  }
83
- var ae = function(e, t) {
83
+ var ie = function(e, t) {
84
84
  var n = {};
85
85
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
86
86
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
87
- for (var c = 0, r = Object.getOwnPropertySymbols(e); c < r.length; c++)
88
- t.indexOf(r[c]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[c]) && (n[r[c]] = e[r[c]]);
87
+ for (var s = 0, r = Object.getOwnPropertySymbols(e); s < r.length; s++)
88
+ t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[s]) && (n[r[s]] = e[r[s]]);
89
89
  return n;
90
90
  };
91
- const P = "text/event-stream", se = 1e3, F = "last-event-id";
92
- function ie(e, t) {
93
- var { signal: n, headers: r, onopen: c, onmessage: l, onclose: o, onerror: d, openWhenHidden: y, fetch: a } = t, i = ae(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
- return new Promise((m, u) => {
91
+ const F = "text/event-stream", se = 1e3, L = "last-event-id";
92
+ function le(e, t) {
93
+ var { signal: n, headers: r, onopen: s, onmessage: d, onclose: o, onerror: l, openWhenHidden: u, fetch: a } = t, c = ie(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
+ return new Promise((g, m) => {
95
95
  const f = Object.assign({}, r);
96
- f.accept || (f.accept = P);
97
- let g;
96
+ f.accept || (f.accept = F);
97
+ let y;
98
98
  function p() {
99
- g.abort(), document.hidden || x();
99
+ y.abort(), document.hidden || E();
100
100
  }
101
- y || document.addEventListener("visibilitychange", p);
101
+ u || document.addEventListener("visibilitychange", p);
102
102
  let h = se, S = 0;
103
- function b() {
104
- document.removeEventListener("visibilitychange", p), window.clearTimeout(S), g.abort();
103
+ function k() {
104
+ document.removeEventListener("visibilitychange", p), window.clearTimeout(S), y.abort();
105
105
  }
106
106
  n == null || n.addEventListener("abort", () => {
107
- b(), m();
107
+ k(), g();
108
108
  });
109
- const D = a ?? window.fetch, I = c ?? ce;
110
- async function x() {
111
- var M;
112
- g = new AbortController();
109
+ const P = a ?? window.fetch, M = s ?? ce;
110
+ async function E() {
111
+ var D;
112
+ y = new AbortController();
113
113
  try {
114
- const A = await D(e, Object.assign(Object.assign({}, i), { headers: f, signal: g.signal }));
115
- await I(A), await te(A.body, re(ne((T) => {
116
- T ? f[F] = T : delete f[F];
117
- }, (T) => {
118
- h = T;
119
- }, l))), o == null || o(), b(), m();
120
- } catch (A) {
121
- if (!g.signal.aborted)
114
+ const I = await P(e, Object.assign(Object.assign({}, c), { headers: f, signal: y.signal }));
115
+ await M(I), await ne(I.body, re(oe((b) => {
116
+ b ? f[L] = b : delete f[L];
117
+ }, (b) => {
118
+ h = b;
119
+ }, d))), o == null || o(), k(), g();
120
+ } catch (I) {
121
+ if (!y.signal.aborted)
122
122
  try {
123
- const T = (M = d == null ? void 0 : d(A)) !== null && M !== void 0 ? M : h;
124
- window.clearTimeout(S), S = window.setTimeout(x, T);
125
- } catch (T) {
126
- b(), u(T);
123
+ const b = (D = l == null ? void 0 : l(I)) !== null && D !== void 0 ? D : h;
124
+ window.clearTimeout(S), S = window.setTimeout(E, b);
125
+ } catch (b) {
126
+ k(), m(b);
127
127
  }
128
128
  }
129
129
  }
130
- x();
130
+ E();
131
131
  });
132
132
  }
133
133
  function ce(e) {
134
134
  const t = e.headers.get("content-type");
135
- if (!(t != null && t.startsWith(P)))
136
- throw new Error(`Expected content-type to be ${P}, Actual: ${t}`);
135
+ if (!(t != null && t.startsWith(F)))
136
+ throw new Error(`Expected content-type to be ${F}, Actual: ${t}`);
137
137
  }
138
- function le(e) {
138
+ function de(e) {
139
139
  const t = atob(e), n = new Uint8Array(t.length);
140
140
  for (let r = 0; r < t.length; r++)
141
141
  n[r] = t.charCodeAt(r);
142
142
  return new TextDecoder("utf-8").decode(n);
143
143
  }
144
- class de {
144
+ class ue {
145
145
  constructor(t) {
146
146
  this.eventSources = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.fency = t;
147
147
  }
@@ -151,23 +151,23 @@ class de {
151
151
  */
152
152
  updateStreams(t) {
153
153
  t.forEach((r) => {
154
- const c = r.stream.id;
155
- this.eventSources.has(c) || this.connectStream(r);
154
+ const s = r.stream.id;
155
+ this.eventSources.has(s) || this.connectStream(r);
156
156
  });
157
157
  const n = new Set(t.map((r) => r.stream.id));
158
- this.eventSources.forEach((r, c) => {
159
- n.has(c) || (r.abort(), this.eventSources.delete(c));
158
+ this.eventSources.forEach((r, s) => {
159
+ n.has(s) || (r.abort(), this.eventSources.delete(s));
160
160
  });
161
161
  }
162
162
  connectStream(t) {
163
163
  const n = t.stream.id, r = new AbortController();
164
164
  this.eventSources.set(n, r);
165
- const c = `${this.fency.baseUrl}/sse/streams/${n}`, l = {
165
+ const s = `${this.fency.baseUrl}/sse/streams/${n}`, d = {
166
166
  "X-Fency-Publishable-Key": this.fency.publishableKey,
167
167
  "X-Fency-Stream-Token": t.stream.token
168
168
  };
169
- ie(c, {
170
- headers: l,
169
+ le(s, {
170
+ headers: d,
171
171
  signal: r.signal,
172
172
  async onopen(o) {
173
173
  if (!o.ok && o.status >= 400 && o.status < 500 && o.status !== 429)
@@ -175,8 +175,8 @@ class de {
175
175
  },
176
176
  onmessage: (o) => {
177
177
  if (o.data) {
178
- const d = le(o.data);
179
- this.broadcast(d, n);
178
+ const l = de(o.data);
179
+ this.broadcast(l, n);
180
180
  }
181
181
  },
182
182
  onerror: (o) => {
@@ -212,99 +212,99 @@ class de {
212
212
  this.eventSources.forEach((t) => t.abort()), this.eventSources.clear(), this.subscribers.clear();
213
213
  }
214
214
  }
215
- const ue = 12e4, me = (e) => {
215
+ const me = 12e4, ge = (e) => {
216
216
  const t = Date.now();
217
- return e.filter((n) => t - n.createdAt < ue);
217
+ return e.filter((n) => t - n.createdAt < me);
218
218
  };
219
- function ze({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
220
- const [r, c] = k(
219
+ function Ge({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
220
+ const [r, s] = C(
221
221
  null
222
- ), [l, o] = k(!0), [d, y] = k(null), [a, i] = k([]), m = E(null), u = E(null);
222
+ ), [d, o] = C(!0), [l, u] = C(null), [a, c] = C([]), g = A(null), m = A(null);
223
223
  w(() => {
224
224
  e.then((h) => {
225
- c(h), o(!1);
225
+ s(h), o(!1);
226
226
  }).catch((h) => {
227
- y(h), o(!1);
227
+ u(h), o(!1);
228
228
  });
229
229
  }, [e]), w(() => {
230
- r && !u.current && (u.current = new de(r));
230
+ r && !m.current && (m.current = new ue(r));
231
231
  }, [r]), w(() => {
232
- u.current && u.current.updateStreams(a);
232
+ m.current && m.current.updateStreams(a);
233
233
  }, [a]), w(() => () => {
234
234
  var h;
235
- (h = u.current) == null || h.cleanup();
235
+ (h = m.current) == null || h.cleanup();
236
236
  }, []);
237
- const f = N(
237
+ const f = _(
238
238
  async (h = 3e4) => {
239
- if (m.current)
240
- return m.current;
241
- const S = Date.now(), b = a.length > 0 ? a[a.length - 1] : null;
242
- if (b && S - b.createdAt < h)
243
- return b.stream;
244
- const D = (async () => {
239
+ if (g.current)
240
+ return g.current;
241
+ const S = Date.now(), k = a.length > 0 ? a[a.length - 1] : null;
242
+ if (k && S - k.createdAt < h)
243
+ return k.stream;
244
+ const P = (async () => {
245
245
  if (!r)
246
246
  throw new Error("Fency instance not initialized");
247
- const I = await t(), x = await K({
247
+ const M = await t(), E = await G({
248
248
  pk: r.publishableKey,
249
249
  baseUrl: r.baseUrl,
250
- clientToken: (I == null ? void 0 : I.clientToken) ?? ""
250
+ clientToken: (M == null ? void 0 : M.clientToken) ?? ""
251
251
  });
252
- if (x.type === "success") {
253
- const M = {
254
- stream: x.stream,
252
+ if (E.type === "success") {
253
+ const D = {
254
+ stream: E.stream,
255
255
  createdAt: Date.now()
256
256
  };
257
- return i((A) => {
258
- const T = [...A, M];
259
- return me(T);
260
- }), m.current = null, x.stream;
257
+ return c((I) => {
258
+ const b = [...I, D];
259
+ return ge(b);
260
+ }), g.current = null, E.stream;
261
261
  } else
262
- throw m.current = null, new Error("Failed to create stream");
262
+ throw g.current = null, new Error("Failed to create stream");
263
263
  })();
264
- return m.current = D, D;
264
+ return g.current = P, P;
265
265
  },
266
266
  [r, a]
267
267
  );
268
- if (d)
269
- return /* @__PURE__ */ C("div", { children: [
268
+ if (l)
269
+ return /* @__PURE__ */ v("div", { children: [
270
270
  "Fency error: ",
271
- d.message
271
+ l.message
272
272
  ] });
273
273
  if (!r)
274
274
  return null;
275
- const g = a.length > 0 ? a[a.length - 1] : null, p = {
275
+ const y = a.length > 0 ? a[a.length - 1] : null, p = {
276
276
  fency: r,
277
- loading: l,
278
- error: d,
277
+ loading: d,
278
+ error: l,
279
279
  activeStreams: a,
280
- latestStream: g,
281
- eventManager: u.current,
280
+ latestStream: y,
281
+ eventManager: m.current,
282
282
  getOrCreateStream: f
283
283
  };
284
- return /* @__PURE__ */ s(W.Provider, { value: p, children: n });
284
+ return /* @__PURE__ */ i(H.Provider, { value: p, children: n });
285
285
  }
286
- function H() {
287
- const e = Q(W);
286
+ function N() {
287
+ const e = Q(H);
288
288
  if (e === void 0)
289
289
  throw new Error("useFencyContext must be used within a FencyProvider");
290
290
  return e;
291
291
  }
292
- const ge = (e) => {
292
+ const ye = (e) => {
293
293
  try {
294
294
  const t = JSON.parse(e);
295
- return ye(t);
295
+ return fe(t);
296
296
  } catch (t) {
297
297
  return console.error("Error parsing message:", t), null;
298
298
  }
299
- }, ye = (e) => G(e) ? fe(e) : J(e) ? he(e) : V(e) ? pe(e) : null, fe = (e) => ({
299
+ }, fe = (e) => J(e) ? he(e) : V(e) ? pe(e) : X(e) ? Se(e) : null, he = (e) => ({
300
300
  type: "STREAM_TIMEOUT",
301
301
  streamId: e.streamId,
302
302
  timestamp: e.timestamp
303
- }), he = (e) => ({
303
+ }), pe = (e) => ({
304
304
  type: "STREAM_NOT_FOUND",
305
305
  streamId: e.streamId,
306
306
  timestamp: e.timestamp
307
- }), pe = (e) => ({
307
+ }), Se = (e) => ({
308
308
  type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
309
309
  streamId: e.streamId,
310
310
  agentTaskId: e.agentTaskId,
@@ -312,31 +312,31 @@ const ge = (e) => {
312
312
  timestamp: e.timestamp,
313
313
  createdAt: e.createdAt,
314
314
  data: JSON.parse(e.data)
315
- }), Se = (e) => {
316
- const t = H(), [n, r] = k(null), c = E(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
315
+ }), ke = (e) => {
316
+ const t = N(), [n, r] = C(null), s = A(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
317
317
  return w(() => {
318
318
  if (!t.eventManager) return;
319
319
  const o = {
320
- onMessage: (y, a) => {
321
- var m, u, f;
322
- const i = ge(y);
323
- if (i)
324
- switch (i.type) {
320
+ onMessage: (u, a) => {
321
+ var g, m, f;
322
+ const c = ye(u);
323
+ if (c)
324
+ switch (c.type) {
325
325
  case "STREAM_TIMEOUT":
326
- (m = e == null ? void 0 : e.onStreamTimeout) == null || m.call(e, i);
326
+ (g = e == null ? void 0 : e.onStreamTimeout) == null || g.call(e, c);
327
327
  break;
328
328
  case "STREAM_NOT_FOUND":
329
- (u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, i);
329
+ (m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e, c);
330
330
  break;
331
331
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
332
- (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, i);
332
+ (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, c);
333
333
  break;
334
334
  }
335
335
  },
336
- onError: (y) => {
336
+ onError: (u) => {
337
337
  var a;
338
338
  (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
339
- streamId: y,
339
+ streamId: u,
340
340
  error: {
341
341
  code: "UnknownError",
342
342
  message: "Unknown error in useStream"
@@ -345,7 +345,7 @@ const ge = (e) => {
345
345
  }
346
346
  };
347
347
  return t.eventManager.subscribe(
348
- c.current,
348
+ s.current,
349
349
  o
350
350
  );
351
351
  }, [t.eventManager, e]), {
@@ -368,78 +368,78 @@ const ge = (e) => {
368
368
  },
369
369
  stream: n
370
370
  };
371
- }, Le = (e) => {
372
- const t = H(), [n, r] = k([]), c = E(/* @__PURE__ */ new Set()), l = E(/* @__PURE__ */ new Map()), { createStream: o } = Se({
371
+ }, Je = (e) => {
372
+ const t = N(), [n, r] = C([]), s = A(/* @__PURE__ */ new Set()), d = A(/* @__PURE__ */ new Map()), { createStream: o } = ke({
373
373
  onAgentTaskProgressItemUpdated: (a) => {
374
- var u;
375
- if (!c.current.has(a.agentTaskId)) return;
376
- const i = a.data;
377
- if (i.taskType === "StreamingChatCompletion" && i.eventType === "Completed" || i.taskType === "StructuredChatCompletion" && i.eventType === "Completed" || i.taskType === "MemoryChatCompletion" && i.eventType === "Completed") {
378
- const f = l.current.get(
374
+ var m;
375
+ if (!s.current.has(a.agentTaskId)) return;
376
+ const c = a.data;
377
+ if (c.taskType === "StreamingChatCompletion" && c.eventType === "Completed" || c.taskType === "StructuredChatCompletion" && c.eventType === "Completed" || c.taskType === "MemoryChatCompletion" && c.eventType === "Completed") {
378
+ const f = d.current.get(
379
379
  a.agentTaskId
380
380
  );
381
- f && (l.current.delete(a.agentTaskId), f(i));
381
+ f && (d.current.delete(a.agentTaskId), f(c));
382
382
  return;
383
383
  }
384
- (u = e.onAgentTaskProgressItemUpdated) == null || u.call(e, a), r(
385
- (f) => f.map((g) => {
384
+ (m = e.onAgentTaskProgressItemUpdated) == null || m.call(e, a), r(
385
+ (f) => f.map((y) => {
386
386
  var S;
387
- if (((S = g.confirmedData) == null ? void 0 : S.taskId) !== a.agentTaskId)
388
- return g;
389
- const h = g.progressItems.some(
390
- (b) => b.progressItemId === a.progressItemId
391
- ) ? g.progressItems.map(
392
- (b) => b.progressItemId === a.progressItemId ? a : b
393
- ) : [...g.progressItems, a];
394
- return { ...g, progressItems: h };
387
+ if (((S = y.confirmedData) == null ? void 0 : S.taskId) !== a.agentTaskId)
388
+ return y;
389
+ const h = y.progressItems.some(
390
+ (k) => k.progressItemId === a.progressItemId
391
+ ) ? y.progressItems.map(
392
+ (k) => k.progressItemId === a.progressItemId ? a : k
393
+ ) : [...y.progressItems, a];
394
+ return { ...y, progressItems: h };
395
395
  })
396
396
  );
397
397
  },
398
398
  onStreamError: (a) => {
399
- var i;
400
- (i = e == null ? void 0 : e.onStreamError) == null || i.call(e, a), r((m) => {
401
- const u = m.find((f) => f.streamId === a.streamId);
402
- return u ? [
403
- ...m.filter((f) => f.streamId !== a.streamId),
399
+ var c;
400
+ (c = e == null ? void 0 : e.onStreamError) == null || c.call(e, a), r((g) => {
401
+ const m = g.find((f) => f.streamId === a.streamId);
402
+ return m ? [
403
+ ...g.filter((f) => f.streamId !== a.streamId),
404
404
  {
405
- ...u,
405
+ ...m,
406
406
  loading: !1,
407
407
  error: a.error
408
408
  }
409
- ] : m;
409
+ ] : g;
410
410
  });
411
411
  },
412
412
  onStreamNotFound: (a) => {
413
- var i;
414
- (i = e == null ? void 0 : e.onStreamNotFound) == null || i.call(e, a);
413
+ var c;
414
+ (c = e == null ? void 0 : e.onStreamNotFound) == null || c.call(e, a);
415
415
  },
416
416
  onStreamTimeout: (a) => {
417
- var i;
418
- (i = e == null ? void 0 : e.onStreamTimeout) == null || i.call(e, a);
417
+ var c;
418
+ (c = e == null ? void 0 : e.onStreamTimeout) == null || c.call(e, a);
419
419
  }
420
- }), d = N(
421
- async (a, i) => {
422
- const m = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, u = await o();
423
- if (u.type === "success") {
420
+ }), l = _(
421
+ async (a, c) => {
422
+ const g = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, m = await o();
423
+ if (m.type === "success") {
424
424
  r([
425
425
  ...n,
426
426
  {
427
- taskKey: m,
428
- streamId: u.stream.id,
427
+ taskKey: g,
428
+ streamId: m.stream.id,
429
429
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
430
430
  confirmedData: null,
431
431
  error: null,
432
432
  params: a,
433
433
  progressItems: [],
434
434
  loading: !0,
435
- loadingText: i == null ? void 0 : i.loadingText
435
+ loadingText: c == null ? void 0 : c.loadingText
436
436
  }
437
437
  ]);
438
- const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(a.type), g = await X({
438
+ const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(a.type), y = await Y({
439
439
  pk: t.fency.publishableKey,
440
440
  baseUrl: t.fency.baseUrl,
441
441
  clientToken: f,
442
- streamToken: u.stream.token,
442
+ streamToken: m.stream.token,
443
443
  request: {
444
444
  streamingChatCompletionTask: a.type === "StreamingChatCompletion" ? {
445
445
  messages: a.messages,
@@ -452,62 +452,65 @@ const ge = (e) => {
452
452
  } : void 0,
453
453
  memoryChatCompletionTask: a.type === "MemoryChatCompletion" ? {
454
454
  messages: a.messages,
455
- model: a.model
455
+ model: a.model,
456
+ language: a.language ?? "en",
457
+ chunkLimit: a.chunkLimit ?? 10,
458
+ memoryScanLimit: a.memoryScanLimit ?? 3
456
459
  } : void 0
457
460
  }
458
461
  });
459
- if (g.type === "success" && g.agentTask) {
460
- c.current.add(
461
- g.agentTask.id
462
+ if (y.type === "success" && y.agentTask) {
463
+ s.current.add(
464
+ y.agentTask.id
462
465
  ), r((h) => [
463
- ...h.filter((S) => S.taskKey !== m),
466
+ ...h.filter((S) => S.taskKey !== g),
464
467
  {
465
- taskKey: m,
466
- streamId: u.stream.id,
468
+ taskKey: g,
469
+ streamId: m.stream.id,
467
470
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
468
- taskId: g.agentTask.id,
469
- createdAt: g.agentTask.createdAt,
471
+ taskId: y.agentTask.id,
472
+ createdAt: y.agentTask.createdAt,
470
473
  error: null,
471
474
  params: a,
472
475
  progressItems: [],
473
476
  loading: !0,
474
- loadingText: i == null ? void 0 : i.loadingText,
477
+ loadingText: c == null ? void 0 : c.loadingText,
475
478
  confirmedData: {
476
- taskId: g.agentTask.id,
477
- createdAt: g.agentTask.createdAt
479
+ taskId: y.agentTask.id,
480
+ createdAt: y.agentTask.createdAt
478
481
  }
479
482
  }
480
483
  ]);
481
484
  const p = await new Promise((h) => {
482
- l.current.set(
483
- g.agentTask.id,
485
+ d.current.set(
486
+ y.agentTask.id,
484
487
  h
485
488
  );
486
489
  });
487
490
  return {
488
491
  type: "success",
489
- streamId: u.stream.id,
490
- agentTaskId: g.agentTask.id,
492
+ streamId: m.stream.id,
493
+ agentTaskId: y.agentTask.id,
491
494
  response: p
492
495
  };
493
496
  } else {
494
- if (g.type === "error")
497
+ if (y.type === "error")
495
498
  return r((p) => [
496
- ...p.filter((h) => h.taskKey !== m),
499
+ ...p.filter((h) => h.taskKey !== g),
497
500
  {
498
- taskKey: m,
501
+ taskKey: g,
499
502
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
500
- streamId: u.stream.id,
503
+ streamId: m.stream.id,
501
504
  params: a,
502
- error: g.error,
505
+ error: y.error,
503
506
  progressItems: [],
504
507
  loading: !1,
505
- loadingText: i == null ? void 0 : i.loadingText,
508
+ loadingText: c == null ? void 0 : c.loadingText,
506
509
  confirmedData: null
507
510
  }
508
511
  ]), {
509
512
  type: "error",
510
- error: g.error
513
+ error: y.error
511
514
  };
512
515
  {
513
516
  const p = {
@@ -515,16 +518,16 @@ const ge = (e) => {
515
518
  code: "UnknownError"
516
519
  };
517
520
  return r((h) => [
518
- ...h.filter((S) => S.taskKey !== m),
521
+ ...h.filter((S) => S.taskKey !== g),
519
522
  {
520
- taskKey: m,
523
+ taskKey: g,
521
524
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
522
- streamId: u.stream.id,
525
+ streamId: m.stream.id,
523
526
  error: p,
524
527
  params: a,
525
528
  progressItems: [],
526
529
  loading: !1,
527
- loadingText: i == null ? void 0 : i.loadingText,
530
+ loadingText: c == null ? void 0 : c.loadingText,
528
531
  confirmedData: null
529
532
  }
530
533
  ]), {
@@ -534,58 +537,58 @@ const ge = (e) => {
534
537
  }
535
538
  }
536
539
  } else
537
- return console.error(u.error), u;
540
+ return console.error(m.error), m;
538
541
  },
539
542
  [t, n, o]
540
- ), y = _(() => {
543
+ ), u = $(() => {
541
544
  if (n.length !== 0)
542
- return [...n].sort((a, i) => new Date(i.triggeredAt).getTime() - new Date(a.triggeredAt).getTime())[0];
545
+ return [...n].sort((a, c) => new Date(c.triggeredAt).getTime() - new Date(a.triggeredAt).getTime())[0];
543
546
  }, [n]);
544
547
  return w(() => () => {
545
- c.current.clear(), l.current.clear();
548
+ s.current.clear(), d.current.clear();
546
549
  }, []), {
547
550
  agentTasks: n,
548
- createAgentTask: d,
549
- latest: y
551
+ createAgentTask: l,
552
+ latest: u
550
553
  };
551
554
  };
552
- function be(e) {
555
+ function Te(e) {
553
556
  return e.progressItems.map((t, n) => {
554
- const r = e.progressItems[n + 1], c = r != null;
555
- let l;
557
+ const r = e.progressItems[n + 1], s = r != null;
558
+ let d;
556
559
  if (r != null && r.createdAt) {
557
- const o = new Date(t.createdAt).getTime(), d = new Date(r.createdAt).getTime();
558
- l = Math.round((d - o) / 1e3);
560
+ const o = new Date(t.createdAt).getTime(), l = new Date(r.createdAt).getTime();
561
+ d = Math.round((l - o) / 1e3);
559
562
  }
560
563
  return {
561
564
  item: t,
562
- completed: c,
565
+ completed: s,
563
566
  isLatest: n === e.progressItems.length - 1,
564
- durationSeconds: l
567
+ durationSeconds: d
565
568
  };
566
569
  });
567
570
  }
568
- function O({
571
+ function R({
569
572
  text: e,
570
573
  duration: t = 2,
571
574
  delay: n = 0,
572
575
  repeat: r = !0,
573
- repeatDelay: c = 0.5,
574
- className: l,
576
+ repeatDelay: s = 0.5,
577
+ className: d,
575
578
  startOnView: o = !1,
576
- once: d = !1,
577
- inViewMargin: y,
579
+ once: l = !1,
580
+ inViewMargin: u,
578
581
  spread: a = 2,
579
- color: i = "#999",
580
- shimmerColor: m = "#000",
581
- direction: u = "fromBottom"
582
+ color: c = "#999",
583
+ shimmerColor: g = "#000",
584
+ direction: m = "fromBottom"
582
585
  }) {
583
- const f = E(null), g = Y(f, { once: d, margin: y }), p = _(() => e.length * a, [e, a]), h = !o || g, S = u === "fromBottom" ? "100% center" : "-100% center", b = u === "fromBottom" ? "0% center" : "200% center";
584
- return /* @__PURE__ */ s(
585
- v.span,
586
+ const f = A(null), y = Z(f, { once: l, margin: u }), p = $(() => e.length * a, [e, a]), h = !o || y, S = m === "fromBottom" ? "100% center" : "-100% center", k = m === "fromBottom" ? "0% center" : "200% center";
587
+ return /* @__PURE__ */ i(
588
+ T.span,
586
589
  {
587
590
  ref: f,
588
- className: l,
591
+ className: d,
589
592
  style: {
590
593
  position: "relative",
591
594
  display: "inline-block",
@@ -596,8 +599,8 @@ function O({
596
599
  WebkitTextFillColor: "transparent",
597
600
  backgroundRepeat: "no-repeat, padding-box",
598
601
  "--spread": `${p}px`,
599
- "--base-color": i,
600
- "--shimmer-color": m,
602
+ "--base-color": c,
603
+ "--shimmer-color": g,
601
604
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
602
605
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
603
606
  },
@@ -606,7 +609,7 @@ function O({
606
609
  opacity: 0
607
610
  },
608
611
  animate: h ? {
609
- backgroundPosition: b,
612
+ backgroundPosition: k,
610
613
  opacity: 1
611
614
  } : {},
612
615
  transition: {
@@ -614,7 +617,7 @@ function O({
614
617
  repeat: r ? 1 / 0 : 0,
615
618
  duration: t,
616
619
  delay: n,
617
- repeatDelay: c,
620
+ repeatDelay: s,
618
621
  ease: "linear"
619
622
  },
620
623
  opacity: {
@@ -626,61 +629,63 @@ function O({
626
629
  }
627
630
  );
628
631
  }
629
- function ve(e) {
630
- const t = e.item.data;
631
- if (t.eventType === "Error" && "message" in t)
632
- return "Error";
633
- if (t.taskType === "StreamingChatCompletion") {
634
- if (t.eventType === "Text") return "Streaming...";
635
- if (t.eventType === "Completed") return "Completed";
632
+ function ve(e, t) {
633
+ const n = e.item.data;
634
+ if (n.eventType === "Error" && "message" in n)
635
+ return t.error;
636
+ if (n.taskType === "StreamingChatCompletion") {
637
+ if (n.eventType === "Text") return t.streaming;
638
+ if (n.eventType === "Completed") return t.completed;
636
639
  }
637
- if (t.taskType === "StructuredChatCompletion") {
638
- if (t.eventType === "Json") return "Generating...";
639
- if (t.eventType === "Completed") return "Completed";
640
+ if (n.taskType === "StructuredChatCompletion") {
641
+ if (n.eventType === "Json") return t.generating;
642
+ if (n.eventType === "Completed") return t.completed;
640
643
  }
641
- if (t.taskType === "MemoryChatCompletion")
642
- switch (t.eventType) {
644
+ if (n.taskType === "MemoryChatCompletion")
645
+ switch (n.eventType) {
643
646
  case "Text":
644
- return "Streaming...";
647
+ return t.streaming;
645
648
  case "Search":
646
- return "Searching...";
649
+ return t.searching;
647
650
  case "FindSources":
648
- return "Adding sources...";
651
+ return t.addingSources;
649
652
  case "SourcesResult":
650
- return "Sources added...";
653
+ return t.sourcesAdded;
651
654
  case "ExploreMemoryStart":
652
- return "Exploring memory...";
655
+ return t.exploringMemory;
653
656
  case "ExploreMemoryResult":
654
- return "Memory explored";
657
+ return t.memoryExplored;
655
658
  case "ExploreMemoryError":
656
- return "Memory exploration failed";
659
+ return t.memoryExplorationFailed;
660
+ case "ChunkResult":
661
+ return t.chunksRetrieved;
657
662
  case "Completed":
658
- return "Completed";
663
+ return t.completed;
659
664
  }
660
- return "Processing...";
665
+ return t.processing;
661
666
  }
662
- const Te = ({ progressViewItems: e }) => {
663
- const t = e[e.length - 1];
664
- if (!t) return null;
665
- const n = ve(t);
666
- return /* @__PURE__ */ s("div", { className: "simple-mode-container", children: /* @__PURE__ */ s(z, { mode: "wait", children: /* @__PURE__ */ s(
667
- v.div,
667
+ const be = ({ progressViewItems: e, t }) => {
668
+ const n = e[e.length - 1];
669
+ if (!n) return null;
670
+ const r = ve(n, t);
671
+ return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(W, { mode: "wait", children: /* @__PURE__ */ i(
672
+ T.div,
668
673
  {
669
674
  initial: { opacity: 0, y: 10 },
670
675
  animate: { opacity: 1, y: 0 },
671
676
  exit: { opacity: 0, y: -10 },
672
677
  transition: { duration: 0.3 },
673
- children: t.completed ? /* @__PURE__ */ s(
678
+ children: n.completed ? /* @__PURE__ */ i(
674
679
  "div",
675
680
  {
676
681
  className: "simple-mode-title",
677
682
  style: { color: "#666" },
678
- children: n
683
+ children: r
679
684
  }
680
- ) : /* @__PURE__ */ s(
681
- O,
685
+ ) : /* @__PURE__ */ i(
686
+ R,
682
687
  {
683
- text: n,
688
+ text: r,
684
689
  className: "simple-mode-title",
685
690
  duration: 2.5,
686
691
  repeat: !0,
@@ -689,9 +694,9 @@ const Te = ({ progressViewItems: e }) => {
689
694
  }
690
695
  )
691
696
  },
692
- t.item.progressItemId
697
+ n.item.progressItemId
693
698
  ) }) });
694
- }, j = {
699
+ }, K = {
695
700
  'code[class*="language-"]': {
696
701
  color: "#f8f8f2",
697
702
  background: "none",
@@ -844,55 +849,120 @@ const Te = ({ progressViewItems: e }) => {
844
849
  }
845
850
  }, B = ({
846
851
  text: e
847
- }) => /* @__PURE__ */ s("div", { style: { padding: "16px" }, children: /* @__PURE__ */ s(
848
- v.div,
852
+ }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
853
+ T.div,
849
854
  {
850
855
  className: "fency-markdown-body-raw",
851
856
  initial: { opacity: 0, y: -10 },
852
857
  animate: { opacity: 1, y: 0 },
853
858
  transition: { duration: 0.3, delay: 0 },
854
- children: /* @__PURE__ */ s(
855
- Z,
859
+ children: /* @__PURE__ */ i(
860
+ ee,
856
861
  {
857
- remarkPlugins: [ee],
862
+ remarkPlugins: [te],
858
863
  components: {
859
864
  code(t) {
860
- const { children: n, className: r, node: c, ref: l, ...o } = t, d = /language-(\w+)/.exec(r || "");
861
- return d ? (
865
+ const { children: n, className: r, node: s, ref: d, ...o } = t, l = /language-(\w+)/.exec(r || "");
866
+ return l ? (
862
867
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
863
- /* @__PURE__ */ s(
864
- L,
868
+ /* @__PURE__ */ i(
869
+ j,
865
870
  {
866
871
  ...o,
867
872
  PreTag: "div",
868
873
  children: String(n).replace(/\n$/, ""),
869
- language: d[1],
870
- style: j
874
+ language: l[1],
875
+ style: K
871
876
  }
872
877
  )
873
- ) : /* @__PURE__ */ s("code", { ...o, className: r, children: String(n) });
878
+ ) : /* @__PURE__ */ i("code", { ...o, className: r, children: String(n) });
874
879
  }
875
880
  },
876
881
  children: e
877
882
  }
878
883
  )
879
884
  }
880
- ) }), Ce = ({ data: e }) => {
885
+ ) }), xe = ({ data: e }) => {
881
886
  const t = JSON.stringify(e.json, null, 2);
882
- return /* @__PURE__ */ s("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ s(
883
- v.div,
887
+ return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
888
+ T.div,
884
889
  {
885
890
  initial: { opacity: 0, y: -10 },
886
891
  animate: { opacity: 1, y: 0 },
887
892
  transition: { duration: 0.3, delay: 0 },
888
- children: /* @__PURE__ */ s(L, { language: "json", style: j, PreTag: "div", children: t })
893
+ children: /* @__PURE__ */ i(j, { language: "json", style: K, PreTag: "div", children: t })
889
894
  }
890
895
  ) });
891
- }, ke = ({ data: e, isLatest: t = !1, durationSeconds: n }) => {
892
- const r = `Searching: ${e.queryDescription}`;
893
- return /* @__PURE__ */ C("div", { style: { padding: "16px" }, children: [
894
- /* @__PURE__ */ s(
895
- v.div,
896
+ }, Ce = {
897
+ en: {
898
+ error: "Error",
899
+ streaming: "Streaming...",
900
+ completed: "Completed",
901
+ generating: "Generating...",
902
+ searching: "Searching...",
903
+ addingSources: "Adding sources...",
904
+ sourcesAdded: "Sources added...",
905
+ exploringMemory: "Exploring memory...",
906
+ memoryExplored: "Memory explored",
907
+ memoryExplorationFailed: "Memory exploration failed",
908
+ processing: "Processing...",
909
+ processingYourTask: "Processing your task...",
910
+ searchingPrefix: "Searching: ",
911
+ tookSeconds: "Took {n} seconds",
912
+ sources: "Sources",
913
+ noSources: "No sources",
914
+ pageSingle: "page {n}",
915
+ pageTwo: "pages {a} and {b}",
916
+ pageMultiple: "pages {list} and {n}",
917
+ clickToCollapse: "Click to collapse",
918
+ clickToExpand: "Click to expand",
919
+ chunkFound: "1 chunk found",
920
+ chunksFound: "{n} chunks found",
921
+ chunksRetrieved: "Chunks retrieved",
922
+ scoreLabel: "score: {n}"
923
+ },
924
+ no: {
925
+ error: "Feil",
926
+ streaming: "Strømmer...",
927
+ completed: "Fullført",
928
+ generating: "Genererer...",
929
+ searching: "Søker...",
930
+ addingSources: "Legger til kilder...",
931
+ sourcesAdded: "Kilder lagt til...",
932
+ exploringMemory: "Utforsker minne...",
933
+ memoryExplored: "Minne utforsket",
934
+ memoryExplorationFailed: "Minneutforskning feilet",
935
+ processing: "Behandler...",
936
+ processingYourTask: "Behandler oppgaven din...",
937
+ searchingPrefix: "Søker: ",
938
+ tookSeconds: "Tok {n} sekunder",
939
+ sources: "Kilder",
940
+ noSources: "Ingen kilder",
941
+ pageSingle: "side {n}",
942
+ pageTwo: "side {a} og {b}",
943
+ pageMultiple: "side {list} og {n}",
944
+ clickToCollapse: "Klikk for å skjule",
945
+ clickToExpand: "Klikk for å utvide",
946
+ chunkFound: "1 del funnet",
947
+ chunksFound: "{n} deler funnet",
948
+ chunksRetrieved: "Deler hentet",
949
+ scoreLabel: "poeng: {n}"
950
+ }
951
+ };
952
+ function Ee(e) {
953
+ return Ce[e];
954
+ }
955
+ function x(e, t) {
956
+ return Object.entries(t).reduce(
957
+ (n, [r, s]) => n.replace(`{${r}}`, String(s)),
958
+ e
959
+ );
960
+ }
961
+ const we = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
962
+ const s = `${r.searchingPrefix}${e.queryDescription}`;
963
+ return /* @__PURE__ */ v("div", { style: { padding: "16px" }, children: [
964
+ /* @__PURE__ */ i(
965
+ T.div,
896
966
  {
897
967
  style: {
898
968
  display: "flex",
@@ -903,19 +973,19 @@ const Te = ({ progressViewItems: e }) => {
903
973
  initial: { opacity: 0, y: -10 },
904
974
  animate: { opacity: 1, y: 0 },
905
975
  transition: { duration: 0.3, delay: 0 },
906
- children: t && !n ? /* @__PURE__ */ s(
907
- O,
976
+ children: t && !n ? /* @__PURE__ */ i(
977
+ R,
908
978
  {
909
- text: r,
979
+ text: s,
910
980
  duration: 2.5,
911
981
  repeat: !0,
912
982
  color: "#999",
913
983
  shimmerColor: "#000"
914
984
  }
915
- ) : /* @__PURE__ */ s("span", { style: { color: "#666" }, children: r })
985
+ ) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: s })
916
986
  }
917
987
  ),
918
- n !== void 0 && /* @__PURE__ */ C(
988
+ n !== void 0 && /* @__PURE__ */ i(
919
989
  "div",
920
990
  {
921
991
  style: {
@@ -924,19 +994,15 @@ const Te = ({ progressViewItems: e }) => {
924
994
  marginTop: "4px",
925
995
  fontStyle: "italic"
926
996
  },
927
- children: [
928
- "Took ",
929
- n,
930
- " seconds"
931
- ]
997
+ children: x(r.tookSeconds, { n })
932
998
  }
933
999
  )
934
1000
  ] });
935
- }, xe = ({ isLatest: e = !1, durationSeconds: t }) => {
936
- const n = "Adding sources...";
937
- return /* @__PURE__ */ C("div", { style: { padding: "16px" }, children: [
938
- /* @__PURE__ */ s(
939
- v.div,
1001
+ }, Ae = ({ isLatest: e = !1, durationSeconds: t, t: n }) => {
1002
+ const r = n.addingSources;
1003
+ return /* @__PURE__ */ v("div", { style: { padding: "16px" }, children: [
1004
+ /* @__PURE__ */ i(
1005
+ T.div,
940
1006
  {
941
1007
  style: {
942
1008
  display: "flex",
@@ -947,19 +1013,19 @@ const Te = ({ progressViewItems: e }) => {
947
1013
  initial: { opacity: 0, y: -10 },
948
1014
  animate: { opacity: 1, y: 0 },
949
1015
  transition: { duration: 0.3, delay: 0 },
950
- children: e && !t ? /* @__PURE__ */ s(
951
- O,
1016
+ children: e && !t ? /* @__PURE__ */ i(
1017
+ R,
952
1018
  {
953
- text: n,
1019
+ text: r,
954
1020
  duration: 2.5,
955
1021
  repeat: !0,
956
1022
  color: "#999",
957
1023
  shimmerColor: "#000"
958
1024
  }
959
- ) : /* @__PURE__ */ s("span", { style: { color: "#666" }, children: n })
1025
+ ) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: r })
960
1026
  }
961
1027
  ),
962
- t !== void 0 && /* @__PURE__ */ C(
1028
+ t !== void 0 && /* @__PURE__ */ i(
963
1029
  "div",
964
1030
  {
965
1031
  style: {
@@ -968,17 +1034,26 @@ const Te = ({ progressViewItems: e }) => {
968
1034
  marginTop: "4px",
969
1035
  fontStyle: "italic"
970
1036
  },
971
- children: [
972
- "Took ",
973
- t,
974
- " seconds"
975
- ]
1037
+ children: x(n.tookSeconds, { n: t })
976
1038
  }
977
1039
  )
978
1040
  ] });
979
- }, we = ({ data: e, onSourceClick: t }) => /* @__PURE__ */ C("div", { style: { padding: "16px" }, children: [
980
- /* @__PURE__ */ s(
981
- v.div,
1041
+ };
1042
+ function Ie(e, t) {
1043
+ if (e.length === 0) return "";
1044
+ if (e.length === 1)
1045
+ return x(t.pageSingle, { n: e[0] });
1046
+ if (e.length === 2)
1047
+ return x(t.pageTwo, {
1048
+ a: e[0],
1049
+ b: e[1]
1050
+ });
1051
+ const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
1052
+ return x(t.pageMultiple, { list: r, n });
1053
+ }
1054
+ const Me = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ v("div", { style: { padding: "16px" }, children: [
1055
+ /* @__PURE__ */ i(
1056
+ T.div,
982
1057
  {
983
1058
  style: {
984
1059
  marginBottom: "10px",
@@ -991,38 +1066,35 @@ const Te = ({ progressViewItems: e }) => {
991
1066
  initial: { opacity: 0, y: -10 },
992
1067
  animate: { opacity: 1, y: 0 },
993
1068
  transition: { duration: 0.3, delay: 0 },
994
- children: "Sources"
1069
+ children: n.sources
995
1070
  }
996
1071
  ),
997
- /* @__PURE__ */ s("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ s("span", { style: { fontSize: "13px", color: "#888" }, children: "No sources" }) : e.sources.map((n, r) => /* @__PURE__ */ s(
998
- Ae,
1072
+ /* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: n.noSources }) : e.sources.map((r, s) => /* @__PURE__ */ i(
1073
+ De,
999
1074
  {
1000
- source: n,
1001
- index: r,
1002
- onSourceClick: t
1075
+ source: r,
1076
+ index: s,
1077
+ onSourceClick: t,
1078
+ t: n
1003
1079
  },
1004
- n.memoryId
1080
+ r.memoryId
1005
1081
  )) })
1006
- ] });
1007
- function Ee(e) {
1008
- if (e.length === 0) return "";
1009
- if (e.length === 1) return `page ${e[0]}`;
1010
- if (e.length === 2)
1011
- return `pages ${e[0]} and ${e[1]}`;
1012
- const t = e[e.length - 1];
1013
- return `pages ${e.slice(0, -1).join(", ")} and ${t}`;
1014
- }
1015
- const Ae = ({ source: e, index: t, onSourceClick: n }) => {
1016
- const [r, c] = k(!1), l = !!n, o = e.pageNumbers ?? [], d = Ee(o);
1017
- return /* @__PURE__ */ C(
1018
- v.div,
1082
+ ] }), De = ({
1083
+ source: e,
1084
+ index: t,
1085
+ onSourceClick: n,
1086
+ t: r
1087
+ }) => {
1088
+ const [s, d] = C(!1), o = !!n, l = e.pageNumbers ?? [], u = Ie(l, r);
1089
+ return /* @__PURE__ */ v(
1090
+ T.div,
1019
1091
  {
1020
1092
  initial: { opacity: 0, scale: 0.9 },
1021
1093
  animate: { opacity: 1, scale: 1 },
1022
1094
  transition: { duration: 0.25, delay: t * 0.05 },
1023
- onClick: l ? () => n(e.memoryId) : void 0,
1024
- onMouseEnter: l ? () => c(!0) : void 0,
1025
- onMouseLeave: l ? () => c(!1) : void 0,
1095
+ onClick: o ? () => n(e.memoryId) : void 0,
1096
+ onMouseEnter: o ? () => d(!0) : void 0,
1097
+ onMouseLeave: o ? () => d(!1) : void 0,
1026
1098
  style: {
1027
1099
  display: "inline-flex",
1028
1100
  flexDirection: "column",
@@ -1030,14 +1102,14 @@ const Ae = ({ source: e, index: t, onSourceClick: n }) => {
1030
1102
  padding: "8px 12px",
1031
1103
  borderRadius: "6px",
1032
1104
  border: "1px solid #e0e0e0",
1033
- backgroundColor: r ? "#f5f5f5" : "transparent",
1034
- cursor: l ? "pointer" : "default",
1105
+ backgroundColor: s ? "#f5f5f5" : "transparent",
1106
+ cursor: o ? "pointer" : "default",
1035
1107
  transition: "background-color 0.15s ease",
1036
1108
  userSelect: "none"
1037
1109
  },
1038
1110
  children: [
1039
- /* @__PURE__ */ s("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1040
- d && /* @__PURE__ */ s("span", { style: { fontSize: "12px", color: "#666" }, children: d })
1111
+ /* @__PURE__ */ i("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1112
+ u && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: u })
1041
1113
  ]
1042
1114
  }
1043
1115
  );
@@ -1047,7 +1119,7 @@ const Ae = ({ source: e, index: t, onSourceClick: n }) => {
1047
1119
  borderWidth: n = 7
1048
1120
  }) => {
1049
1121
  const r = t * 0.5;
1050
- return /* @__PURE__ */ s(
1122
+ return /* @__PURE__ */ i(
1051
1123
  "span",
1052
1124
  {
1053
1125
  style: {
@@ -1060,20 +1132,20 @@ const Ae = ({ source: e, index: t, onSourceClick: n }) => {
1060
1132
  }
1061
1133
  }
1062
1134
  );
1063
- }, Ie = ({
1135
+ }, Pe = ({
1064
1136
  color: e = "#333",
1065
1137
  size: t = 32,
1066
1138
  lineWidth: n = 2
1067
1139
  }) => {
1068
- const r = t + 1, c = (t - n) / 2, l = (t - r) / 2, o = {
1140
+ const r = t + 1, s = (t - n) / 2, d = (t - r) / 2, o = {
1069
1141
  position: "absolute",
1070
- left: c,
1071
- top: l,
1142
+ left: s,
1143
+ top: d,
1072
1144
  width: n,
1073
1145
  height: r,
1074
1146
  backgroundColor: e
1075
1147
  };
1076
- return /* @__PURE__ */ C(
1148
+ return /* @__PURE__ */ v(
1077
1149
  "span",
1078
1150
  {
1079
1151
  style: {
@@ -1083,7 +1155,7 @@ const Ae = ({ source: e, index: t, onSourceClick: n }) => {
1083
1155
  height: t
1084
1156
  },
1085
1157
  children: [
1086
- /* @__PURE__ */ s(
1158
+ /* @__PURE__ */ i(
1087
1159
  "span",
1088
1160
  {
1089
1161
  style: {
@@ -1092,7 +1164,7 @@ const Ae = ({ source: e, index: t, onSourceClick: n }) => {
1092
1164
  }
1093
1165
  }
1094
1166
  ),
1095
- /* @__PURE__ */ s(
1167
+ /* @__PURE__ */ i(
1096
1168
  "span",
1097
1169
  {
1098
1170
  style: {
@@ -1105,21 +1177,21 @@ const Ae = ({ source: e, index: t, onSourceClick: n }) => {
1105
1177
  }
1106
1178
  );
1107
1179
  };
1108
- function Me({
1180
+ function Re({
1109
1181
  eventType: e,
1110
1182
  completed: t
1111
1183
  }) {
1112
- return e === "ExploreMemoryError" ? /* @__PURE__ */ s(Ie, { color: "#c62828", size: 15, lineWidth: 2 }) : e === "ExploreMemoryResult" ? /* @__PURE__ */ s(U, { color: "#999", size: 15, borderWidth: 2 }) : e === "ExploreMemoryStart" ? t ? /* @__PURE__ */ s(U, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ s("span", { className: "explore-memory-loader" }) : null;
1184
+ return e === "ExploreMemoryError" ? /* @__PURE__ */ i(Pe, { color: "#c62828", size: 15, lineWidth: 2 }) : e === "ExploreMemoryResult" ? /* @__PURE__ */ i(U, { color: "#999", size: 15, borderWidth: 2 }) : e === "ExploreMemoryStart" ? t ? /* @__PURE__ */ i(U, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : null;
1113
1185
  }
1114
- const $ = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1115
- const [r, c] = k(!1), l = e.eventType === "ExploreMemoryResult" ? e.result : void 0, o = l != null && l.length > $, d = l != null ? r || !o ? l : `${l.slice(0, $)}...` : void 0, y = o;
1116
- return /* @__PURE__ */ s("div", { style: { padding: "10px" }, children: /* @__PURE__ */ C(
1117
- v.div,
1186
+ const z = 80, Fe = ({ data: e, completed: t, isLatest: n = !1, t: r }) => {
1187
+ const [s, d] = C(!1), o = e.eventType === "ExploreMemoryResult" ? e.result : void 0, l = o != null && o.length > z, u = o != null ? s || !l ? o : `${o.slice(0, z)}...` : void 0, a = l;
1188
+ return /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: /* @__PURE__ */ v(
1189
+ T.div,
1118
1190
  {
1119
1191
  initial: { opacity: 0 },
1120
1192
  animate: { opacity: 1 },
1121
1193
  transition: { duration: 0.25 },
1122
- onClick: y ? () => c((a) => !a) : void 0,
1194
+ onClick: a ? () => d((c) => !c) : void 0,
1123
1195
  style: {
1124
1196
  paddingBottom: "12px",
1125
1197
  borderBottom: "1px solid #eee",
@@ -1128,10 +1200,10 @@ const $ = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1128
1200
  alignItems: "center",
1129
1201
  gap: "10px",
1130
1202
  minWidth: 0,
1131
- cursor: y ? "pointer" : "default"
1203
+ cursor: a ? "pointer" : "default"
1132
1204
  },
1133
1205
  children: [
1134
- /* @__PURE__ */ s(
1206
+ /* @__PURE__ */ i(
1135
1207
  "div",
1136
1208
  {
1137
1209
  style: {
@@ -1141,8 +1213,8 @@ const $ = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1141
1213
  flexShrink: 0,
1142
1214
  width: 32
1143
1215
  },
1144
- children: /* @__PURE__ */ s(
1145
- Me,
1216
+ children: /* @__PURE__ */ i(
1217
+ Re,
1146
1218
  {
1147
1219
  eventType: e.eventType,
1148
1220
  completed: t
@@ -1150,7 +1222,7 @@ const $ = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1150
1222
  )
1151
1223
  }
1152
1224
  ),
1153
- /* @__PURE__ */ C(
1225
+ /* @__PURE__ */ v(
1154
1226
  "div",
1155
1227
  {
1156
1228
  style: {
@@ -1160,26 +1232,26 @@ const $ = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1160
1232
  minWidth: 0
1161
1233
  },
1162
1234
  children: [
1163
- /* @__PURE__ */ s(
1235
+ /* @__PURE__ */ i(
1164
1236
  "span",
1165
1237
  {
1166
1238
  style: { fontSize: 13, fontWeight: 500, color: "#333" },
1167
1239
  children: e.memoryTitle
1168
1240
  }
1169
1241
  ),
1170
- d != null && /* @__PURE__ */ s(
1242
+ u != null && /* @__PURE__ */ i(
1171
1243
  "span",
1172
1244
  {
1173
1245
  style: {
1174
1246
  fontSize: 12,
1175
1247
  color: "#666",
1176
1248
  lineHeight: 1.4,
1177
- whiteSpace: r ? "pre-wrap" : void 0
1249
+ whiteSpace: s ? "pre-wrap" : void 0
1178
1250
  },
1179
- children: d
1251
+ children: u
1180
1252
  }
1181
1253
  ),
1182
- y && /* @__PURE__ */ s(
1254
+ a && /* @__PURE__ */ i(
1183
1255
  "span",
1184
1256
  {
1185
1257
  style: {
@@ -1187,7 +1259,7 @@ const $ = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1187
1259
  color: "#999",
1188
1260
  marginTop: 2
1189
1261
  },
1190
- children: r ? "Click to collapse" : "Click to expand"
1262
+ children: s ? r.clickToCollapse : r.clickToExpand
1191
1263
  }
1192
1264
  )
1193
1265
  ]
@@ -1196,8 +1268,124 @@ const $ = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1196
1268
  ]
1197
1269
  }
1198
1270
  ) });
1199
- }, Oe = ({ message: e }) => /* @__PURE__ */ s("div", { style: { padding: "16px" }, children: /* @__PURE__ */ s(
1200
- v.div,
1271
+ };
1272
+ function Oe(e, t) {
1273
+ if (e.length === 0) return "";
1274
+ if (e.length === 1)
1275
+ return x(t.pageSingle, { n: e[0] });
1276
+ if (e.length === 2)
1277
+ return x(t.pageTwo, {
1278
+ a: e[0],
1279
+ b: e[1]
1280
+ });
1281
+ const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
1282
+ return x(t.pageMultiple, { list: r, n });
1283
+ }
1284
+ function Le(e, t) {
1285
+ return e === 1 ? t.chunkFound : x(t.chunksFound, { n: e });
1286
+ }
1287
+ const Be = ({ data: e, t }) => {
1288
+ const [n, r] = C(!1), s = e.chunks.length, d = s > 0;
1289
+ return /* @__PURE__ */ v("div", { style: { padding: "10px" }, children: [
1290
+ /* @__PURE__ */ v(
1291
+ T.div,
1292
+ {
1293
+ initial: { opacity: 0 },
1294
+ animate: { opacity: 1 },
1295
+ transition: { duration: 0.25 },
1296
+ onClick: d ? () => r((o) => !o) : void 0,
1297
+ style: {
1298
+ paddingBottom: n ? "12px" : 0,
1299
+ borderBottom: n ? "1px solid #eee" : void 0,
1300
+ display: "flex",
1301
+ flexDirection: "column",
1302
+ gap: "4px",
1303
+ minWidth: 0,
1304
+ cursor: d ? "pointer" : "default"
1305
+ },
1306
+ children: [
1307
+ /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1308
+ /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: Le(s, t) }),
1309
+ d && /* @__PURE__ */ i(
1310
+ "span",
1311
+ {
1312
+ style: {
1313
+ fontSize: 11,
1314
+ color: "#999",
1315
+ marginTop: 2
1316
+ },
1317
+ children: n ? t.clickToCollapse : t.clickToExpand
1318
+ }
1319
+ )
1320
+ ]
1321
+ }
1322
+ ),
1323
+ n && d && /* @__PURE__ */ i(
1324
+ T.div,
1325
+ {
1326
+ initial: { opacity: 0, height: 0 },
1327
+ animate: { opacity: 1, height: "auto" },
1328
+ transition: { duration: 0.2 },
1329
+ style: {
1330
+ maxHeight: 220,
1331
+ overflowY: "auto",
1332
+ marginTop: 12,
1333
+ display: "flex",
1334
+ flexDirection: "column",
1335
+ gap: 8
1336
+ },
1337
+ children: e.chunks.map((o, l) => {
1338
+ const u = o.pageNumbers ?? [], a = Oe(u, t);
1339
+ return /* @__PURE__ */ v(
1340
+ "div",
1341
+ {
1342
+ style: {
1343
+ padding: "8px 12px",
1344
+ borderRadius: 6,
1345
+ border: "1px solid #e0e0e0",
1346
+ backgroundColor: "#fafafa"
1347
+ },
1348
+ children: [
1349
+ /* @__PURE__ */ i(
1350
+ "span",
1351
+ {
1352
+ style: {
1353
+ fontSize: 12,
1354
+ color: "#333",
1355
+ lineHeight: 1.4,
1356
+ display: "block",
1357
+ marginBottom: 4
1358
+ },
1359
+ children: o.content
1360
+ }
1361
+ ),
1362
+ /* @__PURE__ */ v(
1363
+ "div",
1364
+ {
1365
+ style: {
1366
+ display: "flex",
1367
+ gap: 8,
1368
+ fontSize: 11,
1369
+ color: "#666"
1370
+ },
1371
+ children: [
1372
+ a && /* @__PURE__ */ i("span", { children: a }),
1373
+ /* @__PURE__ */ i("span", { children: x(t.scoreLabel, {
1374
+ n: o.score
1375
+ }) })
1376
+ ]
1377
+ }
1378
+ )
1379
+ ]
1380
+ },
1381
+ l
1382
+ );
1383
+ })
1384
+ }
1385
+ )
1386
+ ] });
1387
+ }, Ue = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1388
+ T.div,
1201
1389
  {
1202
1390
  initial: { opacity: 0, y: -10 },
1203
1391
  animate: { opacity: 1, y: 0 },
@@ -1207,7 +1395,7 @@ const $ = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1207
1395
  alignItems: "flex-start",
1208
1396
  gap: "10px"
1209
1397
  },
1210
- children: /* @__PURE__ */ s(
1398
+ children: /* @__PURE__ */ i(
1211
1399
  "span",
1212
1400
  {
1213
1401
  style: {
@@ -1219,111 +1407,126 @@ const $ = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1219
1407
  }
1220
1408
  )
1221
1409
  }
1222
- ) }), Pe = ({
1410
+ ) }), ze = ({
1223
1411
  progressViewItems: e,
1224
1412
  loadingText: t,
1225
- onSourceClick: n
1413
+ t: n,
1414
+ onSourceClick: r
1226
1415
  }) => {
1227
- const r = E(null);
1416
+ const s = A(null);
1228
1417
  w(() => {
1229
- r.current && (r.current.scrollTop = r.current.scrollHeight);
1418
+ s.current && (s.current.scrollTop = s.current.scrollHeight);
1230
1419
  }, [e.length]);
1231
- const c = (l) => {
1232
- const o = l.item.data;
1233
- if (o.taskType === "StreamingChatCompletion" && o.eventType === "Text")
1234
- return /* @__PURE__ */ s(B, { text: o.text });
1235
- if (o.taskType === "StructuredChatCompletion" && o.eventType === "Json")
1236
- return /* @__PURE__ */ s(Ce, { data: o });
1237
- if (o.taskType === "MemoryChatCompletion")
1238
- switch (o.eventType) {
1420
+ const d = (o) => {
1421
+ const l = o.item.data;
1422
+ if (l.taskType === "StreamingChatCompletion" && l.eventType === "Text")
1423
+ return /* @__PURE__ */ i(B, { text: l.text });
1424
+ if (l.taskType === "StructuredChatCompletion" && l.eventType === "Json")
1425
+ return /* @__PURE__ */ i(xe, { data: l });
1426
+ if (l.taskType === "MemoryChatCompletion")
1427
+ switch (l.eventType) {
1239
1428
  case "Text":
1240
- return /* @__PURE__ */ s(B, { text: o.text });
1429
+ return /* @__PURE__ */ i(B, { text: l.text });
1241
1430
  case "Search":
1242
- return /* @__PURE__ */ s(
1243
- ke,
1431
+ return /* @__PURE__ */ i(
1432
+ we,
1244
1433
  {
1245
- data: o,
1246
- isLatest: l.isLatest,
1247
- durationSeconds: l.durationSeconds
1434
+ data: l,
1435
+ isLatest: o.isLatest,
1436
+ durationSeconds: o.durationSeconds,
1437
+ t: n
1248
1438
  }
1249
1439
  );
1250
1440
  case "FindSources":
1251
- return /* @__PURE__ */ s(
1252
- xe,
1441
+ return /* @__PURE__ */ i(
1442
+ Ae,
1253
1443
  {
1254
- data: o,
1255
- isLatest: l.isLatest,
1256
- durationSeconds: l.durationSeconds
1444
+ data: l,
1445
+ isLatest: o.isLatest,
1446
+ durationSeconds: o.durationSeconds,
1447
+ t: n
1257
1448
  }
1258
1449
  );
1259
1450
  case "SourcesResult":
1260
- return /* @__PURE__ */ s(
1261
- we,
1451
+ return /* @__PURE__ */ i(
1452
+ Me,
1262
1453
  {
1263
- data: o,
1264
- onSourceClick: n
1454
+ data: l,
1455
+ onSourceClick: r,
1456
+ t: n
1265
1457
  }
1266
1458
  );
1267
1459
  case "ExploreMemoryStart":
1268
1460
  case "ExploreMemoryResult":
1269
1461
  case "ExploreMemoryError":
1270
- return /* @__PURE__ */ s(
1271
- De,
1462
+ return /* @__PURE__ */ i(
1463
+ Fe,
1272
1464
  {
1273
- data: o,
1274
- completed: l.completed,
1275
- isLatest: l.isLatest
1465
+ data: l,
1466
+ completed: o.completed,
1467
+ isLatest: o.isLatest,
1468
+ t: n
1276
1469
  }
1277
1470
  );
1471
+ case "ChunkResult":
1472
+ return /* @__PURE__ */ i(Be, { data: l, t: n });
1278
1473
  case "Completed":
1279
1474
  return null;
1280
1475
  }
1281
- return o.taskType === "StreamingChatCompletion" && o.eventType === "Completed" || o.taskType === "StructuredChatCompletion" && o.eventType === "Completed" ? null : o.eventType === "Error" && "message" in o ? /* @__PURE__ */ s(Oe, { message: o.message }) : null;
1476
+ return l.taskType === "StreamingChatCompletion" && l.eventType === "Completed" || l.taskType === "StructuredChatCompletion" && l.eventType === "Completed" ? null : l.eventType === "Error" && "message" in l ? /* @__PURE__ */ i(Ue, { message: l.message }) : null;
1282
1477
  };
1283
- return e.length === 0 ? /* @__PURE__ */ s("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ s(
1284
- O,
1478
+ return e.length === 0 ? /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
1479
+ R,
1285
1480
  {
1286
- text: t ?? "Processing your task...",
1481
+ text: t ?? n.processingYourTask,
1287
1482
  duration: 1.5,
1288
1483
  repeat: !0,
1289
1484
  repeatDelay: 0,
1290
1485
  color: "#999",
1291
1486
  shimmerColor: "#000"
1292
1487
  }
1293
- ) }) : /* @__PURE__ */ s("div", { id: "agent-task-progress-verbose", ref: r, children: /* @__PURE__ */ s(z, { children: e.map((l, o) => /* @__PURE__ */ s(
1294
- v.div,
1488
+ ) }) : /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(W, { children: e.map((o, l) => /* @__PURE__ */ i(
1489
+ T.div,
1295
1490
  {
1296
- id: `agent-task-progress-item-${l.item.progressItemId}`,
1491
+ id: `agent-task-progress-item-${o.item.progressItemId}`,
1297
1492
  initial: { opacity: 0, y: -20 },
1298
1493
  animate: { opacity: 1, y: 0 },
1299
1494
  transition: {
1300
1495
  duration: 0.4,
1301
- delay: o * 0.1,
1496
+ delay: l * 0.1,
1302
1497
  ease: "easeOut"
1303
1498
  },
1304
- children: c(l)
1499
+ children: d(o)
1305
1500
  },
1306
- l.item.progressItemId
1501
+ o.item.progressItemId
1307
1502
  )) }) });
1308
- }, We = ({
1503
+ }, Ve = ({
1309
1504
  agentTask: e,
1310
1505
  mode: t = "verbose",
1311
- onSourceClick: n
1506
+ language: n,
1507
+ onSourceClick: r
1312
1508
  }) => {
1313
- const r = be(e);
1314
- return t === "simple" ? /* @__PURE__ */ s(Te, { progressViewItems: r }) : /* @__PURE__ */ s(
1315
- Pe,
1509
+ const s = Te(e), d = e.params.type === "MemoryChatCompletion" && "language" in e.params ? e.params.language ?? "en" : n ?? "en", o = Ee(d);
1510
+ return t === "simple" ? /* @__PURE__ */ i(
1511
+ be,
1512
+ {
1513
+ progressViewItems: s,
1514
+ t: o
1515
+ }
1516
+ ) : /* @__PURE__ */ i(
1517
+ ze,
1316
1518
  {
1317
- progressViewItems: r,
1519
+ progressViewItems: s,
1318
1520
  loadingText: e.loadingText,
1319
- onSourceClick: n
1521
+ t: o,
1522
+ onSourceClick: r
1320
1523
  }
1321
1524
  );
1322
1525
  };
1323
1526
  export {
1324
- We as AgentTaskProgress,
1527
+ Ve as AgentTaskProgress,
1325
1528
  U as Checkmark,
1326
- ze as FencyProvider,
1327
- Ie as XMark,
1328
- Le as useAgentTasks
1529
+ Ge as FencyProvider,
1530
+ Pe as XMark,
1531
+ Je as useAgentTasks
1329
1532
  };