@fencyai/react 0.1.135 → 0.1.136

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,11 +1,11 @@
1
- import { jsxs as k, jsx as s } from "react/jsx-runtime";
2
- import { createStream as _, isStreamTimeoutEvent as J, isStreamNotFoundEvent as V, isAgentTaskProgressItemUpdatedEvent as X, createAgentTask as q } from "@fencyai/js";
3
- import { createContext as G, useState as C, useRef as E, useEffect as w, useCallback as z, useContext as Q, useMemo as L } from "react";
4
- import { useInView as Y, motion as v, AnimatePresence as N } from "motion/react";
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
5
  import Z from "react-markdown";
6
- import { Prism as W } from "react-syntax-highlighter";
6
+ import { Prism as L } from "react-syntax-highlighter";
7
7
  import ee from "remark-gfm";
8
- import './assets/index.css';const H = G(
8
+ import './assets/index.css';const W = q(
9
9
  void 0
10
10
  );
11
11
  async function te(e, t) {
@@ -42,11 +42,11 @@ function re(e) {
42
42
  };
43
43
  }
44
44
  function ne(e, t, n) {
45
- let r = F();
45
+ let r = R();
46
46
  const c = new TextDecoder();
47
47
  return function(o, d) {
48
48
  if (o.length === 0)
49
- n == null || n(r), r = F();
49
+ n == null || n(r), r = R();
50
50
  else if (d > 0) {
51
51
  const y = c.decode(o.subarray(0, d)), a = d + (o[d + 1] === 32 ? 2 : 1), i = c.decode(o.subarray(a));
52
52
  switch (y) {
@@ -72,7 +72,7 @@ function oe(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 F() {
75
+ function R() {
76
76
  return {
77
77
  data: "",
78
78
  event: "",
@@ -88,42 +88,42 @@ var ae = function(e, t) {
88
88
  t.indexOf(r[c]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[c]) && (n[r[c]] = e[r[c]]);
89
89
  return n;
90
90
  };
91
- const O = "text/event-stream", se = 1e3, R = "last-event-id";
91
+ const P = "text/event-stream", se = 1e3, F = "last-event-id";
92
92
  function ie(e, t) {
93
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
94
  return new Promise((m, u) => {
95
95
  const f = Object.assign({}, r);
96
- f.accept || (f.accept = O);
96
+ f.accept || (f.accept = P);
97
97
  let g;
98
98
  function p() {
99
99
  g.abort(), document.hidden || x();
100
100
  }
101
101
  y || document.addEventListener("visibilitychange", p);
102
- let h = se, b = 0;
103
- function S() {
104
- document.removeEventListener("visibilitychange", p), window.clearTimeout(b), g.abort();
102
+ let h = se, S = 0;
103
+ function b() {
104
+ document.removeEventListener("visibilitychange", p), window.clearTimeout(S), g.abort();
105
105
  }
106
106
  n == null || n.addEventListener("abort", () => {
107
- S(), m();
107
+ b(), m();
108
108
  });
109
- const D = a ?? window.fetch, A = c ?? ce;
109
+ const D = a ?? window.fetch, I = c ?? ce;
110
110
  async function x() {
111
111
  var M;
112
112
  g = new AbortController();
113
113
  try {
114
- const I = await D(e, Object.assign(Object.assign({}, i), { headers: f, signal: g.signal }));
115
- await A(I), await te(I.body, re(ne((T) => {
116
- T ? f[R] = T : delete f[R];
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
117
  }, (T) => {
118
118
  h = T;
119
- }, l))), o == null || o(), S(), m();
120
- } catch (I) {
119
+ }, l))), o == null || o(), b(), m();
120
+ } catch (A) {
121
121
  if (!g.signal.aborted)
122
122
  try {
123
- const T = (M = d == null ? void 0 : d(I)) !== null && M !== void 0 ? M : h;
124
- window.clearTimeout(b), b = window.setTimeout(x, T);
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
125
  } catch (T) {
126
- S(), u(T);
126
+ b(), u(T);
127
127
  }
128
128
  }
129
129
  }
@@ -132,8 +132,8 @@ function ie(e, t) {
132
132
  }
133
133
  function ce(e) {
134
134
  const t = e.headers.get("content-type");
135
- if (!(t != null && t.startsWith(O)))
136
- throw new Error(`Expected content-type to be ${O}, Actual: ${t}`);
135
+ if (!(t != null && t.startsWith(P)))
136
+ throw new Error(`Expected content-type to be ${P}, Actual: ${t}`);
137
137
  }
138
138
  function le(e) {
139
139
  const t = atob(e), n = new Uint8Array(t.length);
@@ -216,10 +216,10 @@ const ue = 12e4, me = (e) => {
216
216
  const t = Date.now();
217
217
  return e.filter((n) => t - n.createdAt < ue);
218
218
  };
219
- function Ne({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
220
- const [r, c] = C(
219
+ function ze({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
220
+ const [r, c] = k(
221
221
  null
222
- ), [l, o] = C(!0), [d, y] = C(null), [a, i] = C([]), m = E(null), u = E(null);
222
+ ), [l, o] = k(!0), [d, y] = k(null), [a, i] = k([]), m = E(null), u = E(null);
223
223
  w(() => {
224
224
  e.then((h) => {
225
225
  c(h), o(!1);
@@ -234,28 +234,28 @@ function Ne({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
234
234
  var h;
235
235
  (h = u.current) == null || h.cleanup();
236
236
  }, []);
237
- const f = z(
237
+ const f = N(
238
238
  async (h = 3e4) => {
239
239
  if (m.current)
240
240
  return m.current;
241
- const b = Date.now(), S = a.length > 0 ? a[a.length - 1] : null;
242
- if (S && b - S.createdAt < h)
243
- return S.stream;
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
244
  const D = (async () => {
245
245
  if (!r)
246
246
  throw new Error("Fency instance not initialized");
247
- const A = await t(), x = await _({
247
+ const I = await t(), x = await K({
248
248
  pk: r.publishableKey,
249
249
  baseUrl: r.baseUrl,
250
- clientToken: (A == null ? void 0 : A.clientToken) ?? ""
250
+ clientToken: (I == null ? void 0 : I.clientToken) ?? ""
251
251
  });
252
252
  if (x.type === "success") {
253
253
  const M = {
254
254
  stream: x.stream,
255
255
  createdAt: Date.now()
256
256
  };
257
- return i((I) => {
258
- const T = [...I, M];
257
+ return i((A) => {
258
+ const T = [...A, M];
259
259
  return me(T);
260
260
  }), m.current = null, x.stream;
261
261
  } else
@@ -266,7 +266,7 @@ function Ne({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
266
266
  [r, a]
267
267
  );
268
268
  if (d)
269
- return /* @__PURE__ */ k("div", { children: [
269
+ return /* @__PURE__ */ C("div", { children: [
270
270
  "Fency error: ",
271
271
  d.message
272
272
  ] });
@@ -281,10 +281,10 @@ function Ne({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
281
281
  eventManager: u.current,
282
282
  getOrCreateStream: f
283
283
  };
284
- return /* @__PURE__ */ s(H.Provider, { value: p, children: n });
284
+ return /* @__PURE__ */ s(W.Provider, { value: p, children: n });
285
285
  }
286
- function j() {
287
- const e = Q(H);
286
+ function H() {
287
+ const e = Q(W);
288
288
  if (e === void 0)
289
289
  throw new Error("useFencyContext must be used within a FencyProvider");
290
290
  return e;
@@ -296,24 +296,24 @@ const ge = (e) => {
296
296
  } catch (t) {
297
297
  return console.error("Error parsing message:", t), null;
298
298
  }
299
- }, ye = (e) => J(e) ? fe(e) : V(e) ? he(e) : X(e) ? pe(e) : null, fe = (e) => ({
300
- type: "StreamTimeout",
299
+ }, ye = (e) => G(e) ? fe(e) : J(e) ? he(e) : V(e) ? pe(e) : null, fe = (e) => ({
300
+ type: "STREAM_TIMEOUT",
301
301
  streamId: e.streamId,
302
302
  timestamp: e.timestamp
303
303
  }), he = (e) => ({
304
- type: "StreamNotFound",
304
+ type: "STREAM_NOT_FOUND",
305
305
  streamId: e.streamId,
306
306
  timestamp: e.timestamp
307
307
  }), pe = (e) => ({
308
- type: "AgentTaskProgressItemUpdated",
308
+ type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
309
309
  streamId: e.streamId,
310
310
  agentTaskId: e.agentTaskId,
311
311
  progressItemId: e.progressItemId,
312
312
  timestamp: e.timestamp,
313
313
  createdAt: e.createdAt,
314
314
  data: JSON.parse(e.data)
315
- }), be = (e) => {
316
- const t = j(), [n, r] = C(null), c = E(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
315
+ }), Se = (e) => {
316
+ const t = H(), [n, r] = k(null), c = E(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
317
317
  return w(() => {
318
318
  if (!t.eventManager) return;
319
319
  const o = {
@@ -322,13 +322,13 @@ const ge = (e) => {
322
322
  const i = ge(y);
323
323
  if (i)
324
324
  switch (i.type) {
325
- case "StreamTimeout":
325
+ case "STREAM_TIMEOUT":
326
326
  (m = e == null ? void 0 : e.onStreamTimeout) == null || m.call(e, i);
327
327
  break;
328
- case "StreamNotFound":
328
+ case "STREAM_NOT_FOUND":
329
329
  (u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, i);
330
330
  break;
331
- case "AgentTaskProgressItemUpdated":
331
+ case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
332
332
  (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, i);
333
333
  break;
334
334
  }
@@ -368,8 +368,8 @@ const ge = (e) => {
368
368
  },
369
369
  stream: n
370
370
  };
371
- }, We = (e) => {
372
- const t = j(), [n, r] = C([]), c = E(/* @__PURE__ */ new Set()), l = E(/* @__PURE__ */ new Map()), { createStream: o } = be({
371
+ }, Le = (e) => {
372
+ const t = H(), [n, r] = k([]), c = E(/* @__PURE__ */ new Set()), l = E(/* @__PURE__ */ new Map()), { createStream: o } = Se({
373
373
  onAgentTaskProgressItemUpdated: (a) => {
374
374
  var u;
375
375
  if (!c.current.has(a.agentTaskId)) return;
@@ -383,13 +383,13 @@ const ge = (e) => {
383
383
  }
384
384
  (u = e.onAgentTaskProgressItemUpdated) == null || u.call(e, a), r(
385
385
  (f) => f.map((g) => {
386
- var b;
387
- if (((b = g.confirmedData) == null ? void 0 : b.taskId) !== a.agentTaskId)
386
+ var S;
387
+ if (((S = g.confirmedData) == null ? void 0 : S.taskId) !== a.agentTaskId)
388
388
  return g;
389
389
  const h = g.progressItems.some(
390
- (S) => S.progressItemId === a.progressItemId
390
+ (b) => b.progressItemId === a.progressItemId
391
391
  ) ? g.progressItems.map(
392
- (S) => S.progressItemId === a.progressItemId ? a : S
392
+ (b) => b.progressItemId === a.progressItemId ? a : b
393
393
  ) : [...g.progressItems, a];
394
394
  return { ...g, progressItems: h };
395
395
  })
@@ -417,7 +417,7 @@ const ge = (e) => {
417
417
  var i;
418
418
  (i = e == null ? void 0 : e.onStreamTimeout) == null || i.call(e, a);
419
419
  }
420
- }), d = z(
420
+ }), d = N(
421
421
  async (a, i) => {
422
422
  const m = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, u = await o();
423
423
  if (u.type === "success") {
@@ -435,7 +435,7 @@ const ge = (e) => {
435
435
  loadingText: i == null ? void 0 : i.loadingText
436
436
  }
437
437
  ]);
438
- const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(a.type), g = await q({
438
+ const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(a.type), g = await X({
439
439
  pk: t.fency.publishableKey,
440
440
  baseUrl: t.fency.baseUrl,
441
441
  clientToken: f,
@@ -460,7 +460,7 @@ const ge = (e) => {
460
460
  c.current.add(
461
461
  g.agentTask.id
462
462
  ), r((h) => [
463
- ...h.filter((b) => b.taskKey !== m),
463
+ ...h.filter((S) => S.taskKey !== m),
464
464
  {
465
465
  taskKey: m,
466
466
  streamId: u.stream.id,
@@ -515,7 +515,7 @@ const ge = (e) => {
515
515
  code: "UnknownError"
516
516
  };
517
517
  return r((h) => [
518
- ...h.filter((b) => b.taskKey !== m),
518
+ ...h.filter((S) => S.taskKey !== m),
519
519
  {
520
520
  taskKey: m,
521
521
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -537,7 +537,7 @@ const ge = (e) => {
537
537
  return console.error(u.error), u;
538
538
  },
539
539
  [t, n, o]
540
- ), y = L(() => {
540
+ ), y = _(() => {
541
541
  if (n.length !== 0)
542
542
  return [...n].sort((a, i) => new Date(i.triggeredAt).getTime() - new Date(a.triggeredAt).getTime())[0];
543
543
  }, [n]);
@@ -549,7 +549,7 @@ const ge = (e) => {
549
549
  latest: y
550
550
  };
551
551
  };
552
- function Se(e) {
552
+ function be(e) {
553
553
  return e.progressItems.map((t, n) => {
554
554
  const r = e.progressItems[n + 1], c = r != null;
555
555
  let l;
@@ -565,7 +565,7 @@ function Se(e) {
565
565
  };
566
566
  });
567
567
  }
568
- function P({
568
+ function O({
569
569
  text: e,
570
570
  duration: t = 2,
571
571
  delay: n = 0,
@@ -580,7 +580,7 @@ function P({
580
580
  shimmerColor: m = "#000",
581
581
  direction: u = "fromBottom"
582
582
  }) {
583
- const f = E(null), g = Y(f, { once: d, margin: y }), p = L(() => e.length * a, [e, a]), h = !o || g, b = u === "fromBottom" ? "100% center" : "-100% center", S = u === "fromBottom" ? "0% center" : "200% center";
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
584
  return /* @__PURE__ */ s(
585
585
  v.span,
586
586
  {
@@ -602,11 +602,11 @@ function P({
602
602
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
603
603
  },
604
604
  initial: {
605
- backgroundPosition: b,
605
+ backgroundPosition: S,
606
606
  opacity: 0
607
607
  },
608
608
  animate: h ? {
609
- backgroundPosition: S,
609
+ backgroundPosition: b,
610
610
  opacity: 1
611
611
  } : {},
612
612
  transition: {
@@ -663,7 +663,7 @@ const Te = ({ progressViewItems: e }) => {
663
663
  const t = e[e.length - 1];
664
664
  if (!t) return null;
665
665
  const n = ve(t);
666
- return /* @__PURE__ */ s("div", { className: "simple-mode-container", children: /* @__PURE__ */ s(N, { mode: "wait", children: /* @__PURE__ */ s(
666
+ return /* @__PURE__ */ s("div", { className: "simple-mode-container", children: /* @__PURE__ */ s(z, { mode: "wait", children: /* @__PURE__ */ s(
667
667
  v.div,
668
668
  {
669
669
  initial: { opacity: 0, y: 10 },
@@ -678,7 +678,7 @@ const Te = ({ progressViewItems: e }) => {
678
678
  children: n
679
679
  }
680
680
  ) : /* @__PURE__ */ s(
681
- P,
681
+ O,
682
682
  {
683
683
  text: n,
684
684
  className: "simple-mode-title",
@@ -691,7 +691,7 @@ const Te = ({ progressViewItems: e }) => {
691
691
  },
692
692
  t.item.progressItemId
693
693
  ) }) });
694
- }, K = {
694
+ }, j = {
695
695
  'code[class*="language-"]': {
696
696
  color: "#f8f8f2",
697
697
  background: "none",
@@ -861,13 +861,13 @@ const Te = ({ progressViewItems: e }) => {
861
861
  return d ? (
862
862
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
863
863
  /* @__PURE__ */ s(
864
- W,
864
+ L,
865
865
  {
866
866
  ...o,
867
867
  PreTag: "div",
868
868
  children: String(n).replace(/\n$/, ""),
869
869
  language: d[1],
870
- style: K
870
+ style: j
871
871
  }
872
872
  )
873
873
  ) : /* @__PURE__ */ s("code", { ...o, className: r, children: String(n) });
@@ -877,7 +877,7 @@ const Te = ({ progressViewItems: e }) => {
877
877
  }
878
878
  )
879
879
  }
880
- ) }), ke = ({ data: e }) => {
880
+ ) }), Ce = ({ data: e }) => {
881
881
  const t = JSON.stringify(e.json, null, 2);
882
882
  return /* @__PURE__ */ s("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ s(
883
883
  v.div,
@@ -885,12 +885,12 @@ const Te = ({ progressViewItems: e }) => {
885
885
  initial: { opacity: 0, y: -10 },
886
886
  animate: { opacity: 1, y: 0 },
887
887
  transition: { duration: 0.3, delay: 0 },
888
- children: /* @__PURE__ */ s(W, { language: "json", style: K, PreTag: "div", children: t })
888
+ children: /* @__PURE__ */ s(L, { language: "json", style: j, PreTag: "div", children: t })
889
889
  }
890
890
  ) });
891
- }, Ce = ({ data: e, isLatest: t = !1, durationSeconds: n }) => {
891
+ }, ke = ({ data: e, isLatest: t = !1, durationSeconds: n }) => {
892
892
  const r = `Searching: ${e.queryDescription}`;
893
- return /* @__PURE__ */ k("div", { style: { padding: "16px" }, children: [
893
+ return /* @__PURE__ */ C("div", { style: { padding: "16px" }, children: [
894
894
  /* @__PURE__ */ s(
895
895
  v.div,
896
896
  {
@@ -904,7 +904,7 @@ const Te = ({ progressViewItems: e }) => {
904
904
  animate: { opacity: 1, y: 0 },
905
905
  transition: { duration: 0.3, delay: 0 },
906
906
  children: t && !n ? /* @__PURE__ */ s(
907
- P,
907
+ O,
908
908
  {
909
909
  text: r,
910
910
  duration: 2.5,
@@ -915,7 +915,7 @@ const Te = ({ progressViewItems: e }) => {
915
915
  ) : /* @__PURE__ */ s("span", { style: { color: "#666" }, children: r })
916
916
  }
917
917
  ),
918
- n !== void 0 && /* @__PURE__ */ k(
918
+ n !== void 0 && /* @__PURE__ */ C(
919
919
  "div",
920
920
  {
921
921
  style: {
@@ -934,7 +934,7 @@ const Te = ({ progressViewItems: e }) => {
934
934
  ] });
935
935
  }, xe = ({ isLatest: e = !1, durationSeconds: t }) => {
936
936
  const n = "Adding sources...";
937
- return /* @__PURE__ */ k("div", { style: { padding: "16px" }, children: [
937
+ return /* @__PURE__ */ C("div", { style: { padding: "16px" }, children: [
938
938
  /* @__PURE__ */ s(
939
939
  v.div,
940
940
  {
@@ -948,7 +948,7 @@ const Te = ({ progressViewItems: e }) => {
948
948
  animate: { opacity: 1, y: 0 },
949
949
  transition: { duration: 0.3, delay: 0 },
950
950
  children: e && !t ? /* @__PURE__ */ s(
951
- P,
951
+ O,
952
952
  {
953
953
  text: n,
954
954
  duration: 2.5,
@@ -959,7 +959,7 @@ const Te = ({ progressViewItems: e }) => {
959
959
  ) : /* @__PURE__ */ s("span", { style: { color: "#666" }, children: n })
960
960
  }
961
961
  ),
962
- t !== void 0 && /* @__PURE__ */ k(
962
+ t !== void 0 && /* @__PURE__ */ C(
963
963
  "div",
964
964
  {
965
965
  style: {
@@ -976,7 +976,7 @@ const Te = ({ progressViewItems: e }) => {
976
976
  }
977
977
  )
978
978
  ] });
979
- }, we = ({ data: e, onSourceClick: t }) => /* @__PURE__ */ k("div", { style: { padding: "16px" }, children: [
979
+ }, we = ({ data: e, onSourceClick: t }) => /* @__PURE__ */ C("div", { style: { padding: "16px" }, children: [
980
980
  /* @__PURE__ */ s(
981
981
  v.div,
982
982
  {
@@ -995,7 +995,7 @@ const Te = ({ progressViewItems: e }) => {
995
995
  }
996
996
  ),
997
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
- Ie,
998
+ Ae,
999
999
  {
1000
1000
  source: n,
1001
1001
  index: r,
@@ -1012,9 +1012,9 @@ function Ee(e) {
1012
1012
  const t = e[e.length - 1];
1013
1013
  return `pages ${e.slice(0, -1).join(", ")} and ${t}`;
1014
1014
  }
1015
- const Ie = ({ source: e, index: t, onSourceClick: n }) => {
1016
- const [r, c] = C(!1), l = !!n, o = e.pageNumbers ?? [], d = Ee(o);
1017
- return /* @__PURE__ */ k(
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
1018
  v.div,
1019
1019
  {
1020
1020
  initial: { opacity: 0, scale: 0.9 },
@@ -1041,7 +1041,7 @@ const Ie = ({ source: e, index: t, onSourceClick: n }) => {
1041
1041
  ]
1042
1042
  }
1043
1043
  );
1044
- }, $ = ({
1044
+ }, U = ({
1045
1045
  color: e = "#78b13f",
1046
1046
  size: t = 24,
1047
1047
  borderWidth: n = 7
@@ -1060,7 +1060,7 @@ const Ie = ({ source: e, index: t, onSourceClick: n }) => {
1060
1060
  }
1061
1061
  }
1062
1062
  );
1063
- }, Ae = ({
1063
+ }, Ie = ({
1064
1064
  color: e = "#333",
1065
1065
  size: t = 32,
1066
1066
  lineWidth: n = 2
@@ -1073,7 +1073,7 @@ const Ie = ({ source: e, index: t, onSourceClick: n }) => {
1073
1073
  height: r,
1074
1074
  backgroundColor: e
1075
1075
  };
1076
- return /* @__PURE__ */ k(
1076
+ return /* @__PURE__ */ C(
1077
1077
  "span",
1078
1078
  {
1079
1079
  style: {
@@ -1109,11 +1109,11 @@ function Me({
1109
1109
  eventType: e,
1110
1110
  completed: t
1111
1111
  }) {
1112
- return e === "ExploreMemoryError" ? /* @__PURE__ */ s(Ae, { color: "#c62828", size: 18, lineWidth: 3 }) : e === "ExploreMemoryResult" ? /* @__PURE__ */ s($, { color: "#999", size: 20, borderWidth: 3 }) : e === "ExploreMemoryStart" ? t ? /* @__PURE__ */ s($, { color: "#999", size: 20, borderWidth: 3 }) : /* @__PURE__ */ s("span", { className: "explore-memory-loader" }) : null;
1112
+ return e === "ExploreMemoryError" ? /* @__PURE__ */ s(Ie, { color: "#c62828", size: 18, lineWidth: 3 }) : e === "ExploreMemoryResult" ? /* @__PURE__ */ s(U, { color: "#999", size: 20, borderWidth: 3 }) : e === "ExploreMemoryStart" ? t ? /* @__PURE__ */ s(U, { color: "#999", size: 20, borderWidth: 3 }) : /* @__PURE__ */ s("span", { className: "explore-memory-loader" }) : null;
1113
1113
  }
1114
- const U = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1115
- const [r, c] = C(!1), l = e.eventType === "ExploreMemoryResult" ? e.result : void 0, o = l != null && l.length > U, d = l != null ? r || !o ? l : `${l.slice(0, U)}...` : void 0, y = o;
1116
- return /* @__PURE__ */ s("div", { style: { padding: "10px" }, children: /* @__PURE__ */ k(
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
1117
  v.div,
1118
1118
  {
1119
1119
  initial: { opacity: 0 },
@@ -1150,7 +1150,7 @@ const U = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1150
1150
  )
1151
1151
  }
1152
1152
  ),
1153
- /* @__PURE__ */ k(
1153
+ /* @__PURE__ */ C(
1154
1154
  "div",
1155
1155
  {
1156
1156
  style: {
@@ -1196,7 +1196,7 @@ const U = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1196
1196
  ]
1197
1197
  }
1198
1198
  ) });
1199
- }, Pe = ({ message: e }) => /* @__PURE__ */ s("div", { style: { padding: "16px" }, children: /* @__PURE__ */ s(
1199
+ }, Oe = ({ message: e }) => /* @__PURE__ */ s("div", { style: { padding: "16px" }, children: /* @__PURE__ */ s(
1200
1200
  v.div,
1201
1201
  {
1202
1202
  initial: { opacity: 0, y: -10 },
@@ -1219,7 +1219,7 @@ const U = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1219
1219
  }
1220
1220
  )
1221
1221
  }
1222
- ) }), Oe = ({
1222
+ ) }), Pe = ({
1223
1223
  progressViewItems: e,
1224
1224
  loadingText: t,
1225
1225
  onSourceClick: n
@@ -1233,14 +1233,14 @@ const U = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1233
1233
  if (o.taskType === "StreamingChatCompletion" && o.eventType === "Text")
1234
1234
  return /* @__PURE__ */ s(B, { text: o.text });
1235
1235
  if (o.taskType === "StructuredChatCompletion" && o.eventType === "Json")
1236
- return /* @__PURE__ */ s(ke, { data: o });
1236
+ return /* @__PURE__ */ s(Ce, { data: o });
1237
1237
  if (o.taskType === "MemoryChatCompletion")
1238
1238
  switch (o.eventType) {
1239
1239
  case "Text":
1240
1240
  return /* @__PURE__ */ s(B, { text: o.text });
1241
1241
  case "Search":
1242
1242
  return /* @__PURE__ */ s(
1243
- Ce,
1243
+ ke,
1244
1244
  {
1245
1245
  data: o,
1246
1246
  isLatest: l.isLatest,
@@ -1278,10 +1278,10 @@ const U = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1278
1278
  case "Completed":
1279
1279
  return null;
1280
1280
  }
1281
- return o.taskType === "StreamingChatCompletion" && o.eventType === "Completed" || o.taskType === "StructuredChatCompletion" && o.eventType === "Completed" ? null : o.eventType === "Error" && "message" in o ? /* @__PURE__ */ s(Pe, { message: o.message }) : null;
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;
1282
1282
  };
1283
1283
  return e.length === 0 ? /* @__PURE__ */ s("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ s(
1284
- P,
1284
+ O,
1285
1285
  {
1286
1286
  text: t ?? "Processing your task...",
1287
1287
  duration: 1.5,
@@ -1290,7 +1290,7 @@ const U = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1290
1290
  color: "#999",
1291
1291
  shimmerColor: "#000"
1292
1292
  }
1293
- ) }) : /* @__PURE__ */ s("div", { id: "agent-task-progress-verbose", ref: r, children: /* @__PURE__ */ s(N, { children: e.map((l, o) => /* @__PURE__ */ s(
1293
+ ) }) : /* @__PURE__ */ s("div", { id: "agent-task-progress-verbose", ref: r, children: /* @__PURE__ */ s(z, { children: e.map((l, o) => /* @__PURE__ */ s(
1294
1294
  v.div,
1295
1295
  {
1296
1296
  id: `agent-task-progress-item-${l.item.progressItemId}`,
@@ -1305,14 +1305,14 @@ const U = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1305
1305
  },
1306
1306
  l.item.progressItemId
1307
1307
  )) }) });
1308
- }, He = ({
1308
+ }, We = ({
1309
1309
  agentTask: e,
1310
1310
  mode: t = "verbose",
1311
1311
  onSourceClick: n
1312
1312
  }) => {
1313
- const r = Se(e);
1313
+ const r = be(e);
1314
1314
  return t === "simple" ? /* @__PURE__ */ s(Te, { progressViewItems: r }) : /* @__PURE__ */ s(
1315
- Oe,
1315
+ Pe,
1316
1316
  {
1317
1317
  progressViewItems: r,
1318
1318
  loadingText: e.loadingText,
@@ -1321,9 +1321,9 @@ const U = 80, De = ({ data: e, completed: t, isLatest: n = !1 }) => {
1321
1321
  );
1322
1322
  };
1323
1323
  export {
1324
- He as AgentTaskProgress,
1325
- $ as Checkmark,
1326
- Ne as FencyProvider,
1327
- Ae as XMark,
1328
- We as useAgentTasks
1324
+ We as AgentTaskProgress,
1325
+ U as Checkmark,
1326
+ ze as FencyProvider,
1327
+ Ie as XMark,
1328
+ Le as useAgentTasks
1329
1329
  };
@@ -1,16 +1,16 @@
1
1
  import { AgentTaskEventData } from '@fencyai/js';
2
2
  export type StreamTimeout = {
3
- type: 'StreamTimeout';
3
+ type: 'STREAM_TIMEOUT';
4
4
  streamId: string;
5
5
  timestamp: string;
6
6
  };
7
7
  export type StreamNotFound = {
8
- type: 'StreamNotFound';
8
+ type: 'STREAM_NOT_FOUND';
9
9
  streamId: string;
10
10
  timestamp: string;
11
11
  };
12
12
  export type AgentTaskProgressItemUpdated = {
13
- type: 'AgentTaskProgressItemUpdated';
13
+ type: 'AGENT_TASK_PROGRESS_ITEM_UPDATED';
14
14
  streamId: string;
15
15
  agentTaskId: string;
16
16
  progressItemId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"StreamData.d.ts","sourceRoot":"","sources":["../../src/types/StreamData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,eAAe,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,gBAAgB,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACvC,IAAI,EAAE,8BAA8B,CAAA;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,kBAAkB,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,UAAU,GAChB,aAAa,GACb,cAAc,GACd,4BAA4B,CAAA"}
1
+ {"version":3,"file":"StreamData.d.ts","sourceRoot":"","sources":["../../src/types/StreamData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,gBAAgB,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,kBAAkB,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACvC,IAAI,EAAE,kCAAkC,CAAA;IACxC,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,kBAAkB,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,UAAU,GAChB,aAAa,GACb,cAAc,GACd,4BAA4B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fencyai/react",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
4
4
  "description": "> TODO: description",
5
5
  "author": "staklau <steinaageklaussen@gmail.com>",
6
6
  "homepage": "",
@@ -37,7 +37,7 @@
37
37
  "@microsoft/fetch-event-source": "^2.0.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@fencyai/js": "^0.1.135",
40
+ "@fencyai/js": "^0.1.136",
41
41
  "@testing-library/react": "^16.3.2",
42
42
  "@types/jest": "^29.5.11",
43
43
  "@types/node": "^20.10.5",
@@ -53,7 +53,7 @@
53
53
  "vite-plugin-lib-inject-css": "^2.1.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "@fencyai/js": "^0.1.135",
56
+ "@fencyai/js": "^0.1.136",
57
57
  "motion": "^11.15.0",
58
58
  "react": ">=16.8.0",
59
59
  "react-markdown": "^10.1.0",
@@ -66,5 +66,5 @@
66
66
  "optional": false
67
67
  }
68
68
  },
69
- "gitHead": "ede5f960a693aed2555a20a16f1013b1cc167877"
69
+ "gitHead": "329df97e8c3ae4b8faf31cf75a4bd842cd7d61e0"
70
70
  }