@fencyai/react 0.1.130 → 0.1.131

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AgentTaskProgress.d.ts","sourceRoot":"","sources":["../../src/agent-task/AgentTaskProgress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAM9C,MAAM,WAAW,sBAAsB;IACnC,SAAS,EAAE,SAAS,CAAA;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC3B,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7C;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAmB9D,CAAA"}
1
+ {"version":3,"file":"AgentTaskProgress.d.ts","sourceRoot":"","sources":["../../src/agent-task/AgentTaskProgress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAM9C,MAAM,WAAW,sBAAsB;IACnC,SAAS,EAAE,SAAS,CAAA;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC3B,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7C;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAkB9D,CAAA"}
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsxs as C, jsx as i } from "react/jsx-runtime";
2
2
  import { createStream as K, isStreamTimeoutEvent as _, isStreamNotFoundEvent as J, isAgentTaskProgressItemUpdatedEvent as V, createAgentTask as q } from "@fencyai/js";
3
- import { createContext as G, useState as k, useRef as E, useEffect as w, useCallback as U, useContext as X, useMemo as W } from "react";
4
- import { useInView as Q, motion as T, AnimatePresence as $ } from "motion/react";
3
+ import { createContext as G, useState as k, useRef as E, useEffect as w, useCallback as L, useContext as X, useMemo as U } from "react";
4
+ import { useInView as Q, motion as T, AnimatePresence as W } from "motion/react";
5
5
  import Y from "react-markdown";
6
- import { Prism as N } from "react-syntax-highlighter";
6
+ import { Prism as $ } from "react-syntax-highlighter";
7
7
  import Z from "remark-gfm";
8
- import './assets/index.css';const j = G(
8
+ import './assets/index.css';const N = G(
9
9
  void 0
10
10
  );
11
11
  async function ee(e, t) {
@@ -42,11 +42,11 @@ function te(e) {
42
42
  };
43
43
  }
44
44
  function re(e, t, n) {
45
- let r = R();
45
+ let r = F();
46
46
  const c = new TextDecoder();
47
47
  return function(o, d) {
48
48
  if (o.length === 0)
49
- n == null || n(r), r = R();
49
+ n == null || n(r), r = F();
50
50
  else if (d > 0) {
51
51
  const y = c.decode(o.subarray(0, d)), a = d + (o[d + 1] === 32 ? 2 : 1), s = c.decode(o.subarray(a));
52
52
  switch (y) {
@@ -72,7 +72,7 @@ function ne(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 F() {
76
76
  return {
77
77
  data: "",
78
78
  event: "",
@@ -88,7 +88,7 @@ var oe = 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", ae = 1e3, z = "last-event-id";
91
+ const O = "text/event-stream", ae = 1e3, R = "last-event-id";
92
92
  function se(e, t) {
93
93
  var { signal: n, headers: r, onopen: c, onmessage: l, onclose: o, onerror: d, openWhenHidden: y, fetch: a } = t, s = oe(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
94
  return new Promise((m, u) => {
@@ -113,7 +113,7 @@ function se(e, t) {
113
113
  try {
114
114
  const I = await P(e, Object.assign(Object.assign({}, s), { headers: f, signal: g.signal }));
115
115
  await A(I), await ee(I.body, te(re((v) => {
116
- v ? f[z] = v : delete f[z];
116
+ v ? f[R] = v : delete f[R];
117
117
  }, (v) => {
118
118
  h = v;
119
119
  }, l))), o == null || o(), b(), m();
@@ -234,7 +234,7 @@ function Le({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
234
234
  var h;
235
235
  (h = u.current) == null || h.cleanup();
236
236
  }, []);
237
- const f = U(
237
+ const f = L(
238
238
  async (h = 3e4) => {
239
239
  if (m.current)
240
240
  return m.current;
@@ -281,10 +281,10 @@ function Le({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
281
281
  eventManager: u.current,
282
282
  getOrCreateStream: f
283
283
  };
284
- return /* @__PURE__ */ i(j.Provider, { value: p, children: n });
284
+ return /* @__PURE__ */ i(N.Provider, { value: p, children: n });
285
285
  }
286
- function F() {
287
- const e = X(j);
286
+ function j() {
287
+ const e = X(N);
288
288
  if (e === void 0)
289
289
  throw new Error("useFencyContext must be used within a FencyProvider");
290
290
  return e;
@@ -313,7 +313,7 @@ const me = (e) => {
313
313
  createdAt: e.createdAt,
314
314
  data: JSON.parse(e.data)
315
315
  }), pe = (e) => {
316
- const t = F(), [n, r] = k(null), c = E(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
316
+ const t = j(), [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 = {
@@ -369,7 +369,7 @@ const me = (e) => {
369
369
  stream: n
370
370
  };
371
371
  }, Ue = (e) => {
372
- const t = F(), [n, r] = k([]), c = E(/* @__PURE__ */ new Set()), l = E(/* @__PURE__ */ new Map()), { createStream: o } = pe({
372
+ const t = j(), [n, r] = k([]), c = E(/* @__PURE__ */ new Set()), l = E(/* @__PURE__ */ new Map()), { createStream: o } = pe({
373
373
  onAgentTaskProgressItemUpdated: (a) => {
374
374
  var u;
375
375
  if (!c.current.has(a.agentTaskId)) return;
@@ -417,7 +417,7 @@ const me = (e) => {
417
417
  var s;
418
418
  (s = e == null ? void 0 : e.onStreamTimeout) == null || s.call(e, a);
419
419
  }
420
- }), d = U(
420
+ }), d = L(
421
421
  async (a, s) => {
422
422
  const m = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, u = await o();
423
423
  if (u.type === "success") {
@@ -537,7 +537,7 @@ const me = (e) => {
537
537
  return console.error(u.error), u;
538
538
  },
539
539
  [t, n, o]
540
- ), y = W(() => {
540
+ ), y = U(() => {
541
541
  if (n.length !== 0)
542
542
  return [...n].sort((a, s) => new Date(s.triggeredAt).getTime() - new Date(a.triggeredAt).getTime())[0];
543
543
  }, [n]);
@@ -580,7 +580,7 @@ function D({
580
580
  shimmerColor: m = "#000",
581
581
  direction: u = "fromBottom"
582
582
  }) {
583
- const f = E(null), g = Q(f, { once: d, margin: y }), p = W(() => e.length * a, [e, a]), h = !o || g, S = u === "fromBottom" ? "100% center" : "-100% center", b = u === "fromBottom" ? "0% center" : "200% center";
583
+ const f = E(null), g = Q(f, { once: d, margin: y }), p = U(() => 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__ */ i(
585
585
  T.span,
586
586
  {
@@ -661,7 +661,7 @@ const ve = ({ progressViewItems: e }) => {
661
661
  const t = e[e.length - 1];
662
662
  if (!t) return null;
663
663
  const n = be(t);
664
- return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i($, { mode: "wait", children: /* @__PURE__ */ i(
664
+ return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(W, { mode: "wait", children: /* @__PURE__ */ i(
665
665
  T.div,
666
666
  {
667
667
  initial: { opacity: 0, y: 10 },
@@ -840,7 +840,7 @@ const ve = ({ progressViewItems: e }) => {
840
840
  italic: {
841
841
  fontStyle: "italic"
842
842
  }
843
- }, B = ({
843
+ }, z = ({
844
844
  text: e
845
845
  }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
846
846
  T.div,
@@ -857,7 +857,7 @@ const ve = ({ progressViewItems: e }) => {
857
857
  code(t) {
858
858
  const { children: n, className: r, node: c, ref: l, ...o } = t, d = /language-(\w+)/.exec(r || "");
859
859
  return d ? /* @__PURE__ */ i(
860
- N,
860
+ $,
861
861
  {
862
862
  ...o,
863
863
  PreTag: "div",
@@ -880,7 +880,7 @@ const ve = ({ progressViewItems: e }) => {
880
880
  initial: { opacity: 0, y: -10 },
881
881
  animate: { opacity: 1, y: 0 },
882
882
  transition: { duration: 0.3, delay: 0 },
883
- children: /* @__PURE__ */ i(N, { language: "json", style: H, PreTag: "div", children: t })
883
+ children: /* @__PURE__ */ i($, { language: "json", style: H, PreTag: "div", children: t })
884
884
  }
885
885
  ) });
886
886
  }, Ce = ({ data: e, isLatest: t = !1, durationSeconds: n }) => {
@@ -1043,8 +1043,8 @@ function Ie({
1043
1043
  }) {
1044
1044
  return e === "ExploreMemoryError" ? /* @__PURE__ */ i("span", { style: { color: "#c62828", fontSize: 14, fontWeight: 600 }, children: "✗" }) : e === "ExploreMemoryResult" ? /* @__PURE__ */ i("span", { style: { color: "#999", fontSize: 14, fontWeight: 600 }, children: "✓" }) : e === "ExploreMemoryStart" && t ? /* @__PURE__ */ i("span", { style: { color: "#999", fontSize: 14, fontWeight: 600 }, children: "✓" }) : null;
1045
1045
  }
1046
- const L = 80, Ae = ({ data: e, completed: t, isLatest: n = !1 }) => {
1047
- const [r, c] = k(!1), l = e.eventType === "ExploreMemoryResult" ? e.result : void 0, o = l != null && l.length > L, d = l != null ? r || !o ? l : `${l.slice(0, L)}...` : void 0, y = o;
1046
+ const B = 80, Ae = ({ data: e, completed: t, isLatest: n = !1 }) => {
1047
+ const [r, c] = k(!1), l = e.eventType === "ExploreMemoryResult" ? e.result : void 0, o = l != null && l.length > B, d = l != null ? r || !o ? l : `${l.slice(0, B)}...` : void 0, y = o;
1048
1048
  if (e.eventType === "ExploreMemoryStart" && !t) {
1049
1049
  const s = `Exploring ${e.memoryTitle}...`;
1050
1050
  return /* @__PURE__ */ i(
@@ -1151,13 +1151,13 @@ const L = 80, Ae = ({ data: e, completed: t, isLatest: n = !1 }) => {
1151
1151
  const c = (l) => {
1152
1152
  const o = l.item.data;
1153
1153
  if (o.taskType === "StreamingChatCompletion" && o.eventType === "Text")
1154
- return /* @__PURE__ */ i(B, { text: o.text });
1154
+ return /* @__PURE__ */ i(z, { text: o.text });
1155
1155
  if (o.taskType === "StructuredChatCompletion" && o.eventType === "Json")
1156
1156
  return /* @__PURE__ */ i(Te, { data: o });
1157
1157
  if (o.taskType === "MemoryChatCompletion")
1158
1158
  switch (o.eventType) {
1159
1159
  case "Text":
1160
- return /* @__PURE__ */ i(B, { text: o.text });
1160
+ return /* @__PURE__ */ i(z, { text: o.text });
1161
1161
  case "Search":
1162
1162
  return /* @__PURE__ */ i(
1163
1163
  Ce,
@@ -1210,7 +1210,7 @@ const L = 80, Ae = ({ data: e, completed: t, isLatest: n = !1 }) => {
1210
1210
  color: "#999",
1211
1211
  shimmerColor: "#000"
1212
1212
  }
1213
- ) }) : /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: r, children: /* @__PURE__ */ i($, { children: e.map((l, o) => /* @__PURE__ */ i(
1213
+ ) }) : /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: r, children: /* @__PURE__ */ i(W, { children: e.map((l, o) => /* @__PURE__ */ i(
1214
1214
  T.div,
1215
1215
  {
1216
1216
  id: `agent-task-progress-item-${l.item.progressItemId}`,
@@ -1230,7 +1230,6 @@ const L = 80, Ae = ({ data: e, completed: t, isLatest: n = !1 }) => {
1230
1230
  mode: t = "verbose",
1231
1231
  onSourceClick: n
1232
1232
  }) => {
1233
- F();
1234
1233
  const r = Se(e);
1235
1234
  return t === "simple" ? /* @__PURE__ */ i(ve, { progressViewItems: r }) : /* @__PURE__ */ i(
1236
1235
  Me,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fencyai/react",
3
- "version": "0.1.130",
3
+ "version": "0.1.131",
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.130",
40
+ "@fencyai/js": "^0.1.131",
41
41
  "@testing-library/react": "^16.3.2",
42
42
  "@types/jest": "^29.5.11",
43
43
  "@types/node": "^20.10.5",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@emotion/is-prop-valid": "^1.3.0",
57
- "@fencyai/js": "^0.1.130",
57
+ "@fencyai/js": "^0.1.131",
58
58
  "@radix-ui/react-popover": "^1.1.15",
59
59
  "motion": "^11.15.0",
60
60
  "react": ">=16.8.0",
@@ -69,5 +69,5 @@
69
69
  "optional": false
70
70
  }
71
71
  },
72
- "gitHead": "2a405d57e2d422611fdbbe06eecce7e82ad2b113"
72
+ "gitHead": "de43772a6bc8a40273f9c3ba29c87e918db90bc6"
73
73
  }