@fencyai/react 0.1.139 → 0.1.141
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/README.md +22 -5
- package/dist/hooks/useAgentTasks/index.d.ts.map +1 -1
- package/dist/index.js +129 -121
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
# `@fencyai/react`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The official React SDK for [Fency.ai](https://fency.ai).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For more information, visit [docs.fency.ai](https://docs.fency.ai).
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { loadFency } from '@fencyai/js'
|
|
11
|
+
import { FencyProvider } from '@fencyai/react'
|
|
12
|
+
|
|
13
|
+
const fency = loadFency({ publishableKey: 'pk_your_publishable_key' })
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
export default function App() {
|
|
16
|
+
return (
|
|
17
|
+
<FencyProvider
|
|
18
|
+
fency={fency}
|
|
19
|
+
fetchCreateStreamClientToken={async () => {
|
|
20
|
+
const res = await fetch('/api/fency-token')
|
|
21
|
+
return res.json()
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
{/* your app */}
|
|
25
|
+
</FencyProvider>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
11
28
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAgentTasks/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAYnE,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAgentTasks/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAYnE,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,KAAG,aA8QzD,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -19,14 +19,14 @@ function re(e) {
|
|
|
19
19
|
return function(o) {
|
|
20
20
|
t === void 0 ? (t = o, n = 0, r = -1) : t = ae(t, o);
|
|
21
21
|
const l = t.length;
|
|
22
|
-
let
|
|
22
|
+
let m = 0;
|
|
23
23
|
for (; n < l; ) {
|
|
24
|
-
s && (t[n] === 10 && (
|
|
24
|
+
s && (t[n] === 10 && (m = ++n), s = !1);
|
|
25
25
|
let a = -1;
|
|
26
26
|
for (; n < l && a === -1; ++n)
|
|
27
27
|
switch (t[n]) {
|
|
28
28
|
case 58:
|
|
29
|
-
r === -1 && (r = n -
|
|
29
|
+
r === -1 && (r = n - m);
|
|
30
30
|
break;
|
|
31
31
|
case 13:
|
|
32
32
|
s = !0;
|
|
@@ -36,9 +36,9 @@ function re(e) {
|
|
|
36
36
|
}
|
|
37
37
|
if (a === -1)
|
|
38
38
|
break;
|
|
39
|
-
e(t.subarray(
|
|
39
|
+
e(t.subarray(m, a), r), m = n, r = -1;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
m === l ? t = void 0 : m !== 0 && (t = t.subarray(m), n -= m);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
function oe(e, t, n) {
|
|
@@ -48,8 +48,8 @@ function oe(e, t, n) {
|
|
|
48
48
|
if (o.length === 0)
|
|
49
49
|
n == null || n(r), r = O();
|
|
50
50
|
else if (l > 0) {
|
|
51
|
-
const
|
|
52
|
-
switch (
|
|
51
|
+
const m = s.decode(o.subarray(0, l)), a = l + (o[l + 1] === 32 ? 2 : 1), c = s.decode(o.subarray(a));
|
|
52
|
+
switch (m) {
|
|
53
53
|
case "data":
|
|
54
54
|
r.data = r.data ? r.data + `
|
|
55
55
|
` + c : c;
|
|
@@ -61,8 +61,8 @@ function oe(e, t, n) {
|
|
|
61
61
|
e(r.id = c);
|
|
62
62
|
break;
|
|
63
63
|
case "retry":
|
|
64
|
-
const
|
|
65
|
-
isNaN(
|
|
64
|
+
const y = parseInt(c, 10);
|
|
65
|
+
isNaN(y) || t(r.retry = y);
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -90,40 +90,40 @@ var ie = function(e, t) {
|
|
|
90
90
|
};
|
|
91
91
|
const F = "text/event-stream", se = 1e3, L = "last-event-id";
|
|
92
92
|
function le(e, t) {
|
|
93
|
-
var { signal: n, headers: r, onopen: s, onmessage: d, onclose: o, onerror: l, openWhenHidden:
|
|
94
|
-
return new Promise((
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
let
|
|
93
|
+
var { signal: n, headers: r, onopen: s, onmessage: d, onclose: o, onerror: l, openWhenHidden: m, fetch: a } = t, c = ie(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
|
+
return new Promise((y, g) => {
|
|
95
|
+
const h = Object.assign({}, r);
|
|
96
|
+
h.accept || (h.accept = F);
|
|
97
|
+
let u;
|
|
98
98
|
function p() {
|
|
99
|
-
|
|
99
|
+
u.abort(), document.hidden || E();
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
let
|
|
101
|
+
m || document.addEventListener("visibilitychange", p);
|
|
102
|
+
let f = se, S = 0;
|
|
103
103
|
function k() {
|
|
104
|
-
document.removeEventListener("visibilitychange", p), window.clearTimeout(S),
|
|
104
|
+
document.removeEventListener("visibilitychange", p), window.clearTimeout(S), u.abort();
|
|
105
105
|
}
|
|
106
106
|
n == null || n.addEventListener("abort", () => {
|
|
107
|
-
k(),
|
|
107
|
+
k(), y();
|
|
108
108
|
});
|
|
109
109
|
const P = a ?? window.fetch, M = s ?? ce;
|
|
110
110
|
async function E() {
|
|
111
111
|
var D;
|
|
112
|
-
|
|
112
|
+
u = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const I = await P(e, Object.assign(Object.assign({}, c), { headers:
|
|
114
|
+
const I = await P(e, Object.assign(Object.assign({}, c), { headers: h, signal: u.signal }));
|
|
115
115
|
await M(I), await ne(I.body, re(oe((b) => {
|
|
116
|
-
b ?
|
|
116
|
+
b ? h[L] = b : delete h[L];
|
|
117
117
|
}, (b) => {
|
|
118
|
-
|
|
119
|
-
}, d))), o == null || o(), k(),
|
|
118
|
+
f = b;
|
|
119
|
+
}, d))), o == null || o(), k(), y();
|
|
120
120
|
} catch (I) {
|
|
121
|
-
if (!
|
|
121
|
+
if (!u.signal.aborted)
|
|
122
122
|
try {
|
|
123
|
-
const b = (D = l == null ? void 0 : l(I)) !== null && D !== void 0 ? D :
|
|
123
|
+
const b = (D = l == null ? void 0 : l(I)) !== null && D !== void 0 ? D : f;
|
|
124
124
|
window.clearTimeout(S), S = window.setTimeout(E, b);
|
|
125
125
|
} catch (b) {
|
|
126
|
-
k(),
|
|
126
|
+
k(), g(b);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -219,27 +219,27 @@ const me = 12e4, ge = (e) => {
|
|
|
219
219
|
function Ge({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
|
|
220
220
|
const [r, s] = C(
|
|
221
221
|
null
|
|
222
|
-
), [d, o] = C(!0), [l,
|
|
222
|
+
), [d, o] = C(!0), [l, m] = C(null), [a, c] = C([]), y = A(null), g = A(null);
|
|
223
223
|
w(() => {
|
|
224
|
-
e.then((
|
|
225
|
-
s(
|
|
226
|
-
}).catch((
|
|
227
|
-
|
|
224
|
+
e.then((f) => {
|
|
225
|
+
s(f), o(!1);
|
|
226
|
+
}).catch((f) => {
|
|
227
|
+
m(f), o(!1);
|
|
228
228
|
});
|
|
229
229
|
}, [e]), w(() => {
|
|
230
|
-
r && !
|
|
230
|
+
r && !g.current && (g.current = new ue(r));
|
|
231
231
|
}, [r]), w(() => {
|
|
232
|
-
|
|
232
|
+
g.current && g.current.updateStreams(a);
|
|
233
233
|
}, [a]), w(() => () => {
|
|
234
|
-
var
|
|
235
|
-
(
|
|
234
|
+
var f;
|
|
235
|
+
(f = g.current) == null || f.cleanup();
|
|
236
236
|
}, []);
|
|
237
|
-
const
|
|
238
|
-
async (
|
|
239
|
-
if (
|
|
240
|
-
return
|
|
237
|
+
const h = _(
|
|
238
|
+
async (f = 3e4) => {
|
|
239
|
+
if (y.current)
|
|
240
|
+
return y.current;
|
|
241
241
|
const S = Date.now(), k = a.length > 0 ? a[a.length - 1] : null;
|
|
242
|
-
if (k && S - k.createdAt <
|
|
242
|
+
if (k && S - k.createdAt < f)
|
|
243
243
|
return k.stream;
|
|
244
244
|
const P = (async () => {
|
|
245
245
|
if (!r)
|
|
@@ -257,11 +257,11 @@ function Ge({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
|
|
|
257
257
|
return c((I) => {
|
|
258
258
|
const b = [...I, D];
|
|
259
259
|
return ge(b);
|
|
260
|
-
}),
|
|
260
|
+
}), y.current = null, E.stream;
|
|
261
261
|
} else
|
|
262
|
-
throw
|
|
262
|
+
throw y.current = null, new Error("Failed to create stream");
|
|
263
263
|
})();
|
|
264
|
-
return
|
|
264
|
+
return y.current = P, P;
|
|
265
265
|
},
|
|
266
266
|
[r, a]
|
|
267
267
|
);
|
|
@@ -272,14 +272,14 @@ function Ge({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
|
|
|
272
272
|
] });
|
|
273
273
|
if (!r)
|
|
274
274
|
return null;
|
|
275
|
-
const
|
|
275
|
+
const u = a.length > 0 ? a[a.length - 1] : null, p = {
|
|
276
276
|
fency: r,
|
|
277
277
|
loading: d,
|
|
278
278
|
error: l,
|
|
279
279
|
activeStreams: a,
|
|
280
|
-
latestStream:
|
|
281
|
-
eventManager:
|
|
282
|
-
getOrCreateStream:
|
|
280
|
+
latestStream: u,
|
|
281
|
+
eventManager: g.current,
|
|
282
|
+
getOrCreateStream: h
|
|
283
283
|
};
|
|
284
284
|
return /* @__PURE__ */ i(H.Provider, { value: p, children: n });
|
|
285
285
|
}
|
|
@@ -317,26 +317,26 @@ const ye = (e) => {
|
|
|
317
317
|
return w(() => {
|
|
318
318
|
if (!t.eventManager) return;
|
|
319
319
|
const o = {
|
|
320
|
-
onMessage: (
|
|
321
|
-
var
|
|
322
|
-
const c = ye(
|
|
320
|
+
onMessage: (m, a) => {
|
|
321
|
+
var y, g, h;
|
|
322
|
+
const c = ye(m);
|
|
323
323
|
if (c)
|
|
324
324
|
switch (c.type) {
|
|
325
325
|
case "STREAM_TIMEOUT":
|
|
326
|
-
(
|
|
326
|
+
(y = e == null ? void 0 : e.onStreamTimeout) == null || y.call(e, c);
|
|
327
327
|
break;
|
|
328
328
|
case "STREAM_NOT_FOUND":
|
|
329
|
-
(
|
|
329
|
+
(g = e == null ? void 0 : e.onStreamNotFound) == null || g.call(e, c);
|
|
330
330
|
break;
|
|
331
331
|
case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
|
|
332
|
-
(
|
|
332
|
+
(h = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || h.call(e, c);
|
|
333
333
|
break;
|
|
334
334
|
}
|
|
335
335
|
},
|
|
336
|
-
onError: (
|
|
336
|
+
onError: (m) => {
|
|
337
337
|
var a;
|
|
338
338
|
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
|
|
339
|
-
streamId:
|
|
339
|
+
streamId: m,
|
|
340
340
|
error: {
|
|
341
341
|
code: "UnknownError",
|
|
342
342
|
message: "Unknown error in useStream"
|
|
@@ -371,42 +371,50 @@ const ye = (e) => {
|
|
|
371
371
|
}, Je = (e) => {
|
|
372
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
|
|
374
|
+
var g;
|
|
375
375
|
if (!s.current.has(a.agentTaskId)) return;
|
|
376
376
|
const c = a.data;
|
|
377
377
|
if (c.taskType === "StreamingChatCompletion" && c.eventType === "Completed" || c.taskType === "StructuredChatCompletion" && c.eventType === "Completed" || c.taskType === "MemoryChatCompletion" && c.eventType === "Completed") {
|
|
378
|
-
|
|
378
|
+
r(
|
|
379
|
+
(u) => u.map(
|
|
380
|
+
(p) => {
|
|
381
|
+
var f;
|
|
382
|
+
return ((f = p.confirmedData) == null ? void 0 : f.taskId) === a.agentTaskId ? { ...p, loading: !1 } : p;
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
);
|
|
386
|
+
const h = d.current.get(
|
|
379
387
|
a.agentTaskId
|
|
380
388
|
);
|
|
381
|
-
|
|
389
|
+
h && (d.current.delete(a.agentTaskId), h(c));
|
|
382
390
|
return;
|
|
383
391
|
}
|
|
384
|
-
(
|
|
385
|
-
(
|
|
392
|
+
(g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, a), r(
|
|
393
|
+
(h) => h.map((u) => {
|
|
386
394
|
var S;
|
|
387
|
-
if (((S =
|
|
388
|
-
return
|
|
389
|
-
const
|
|
395
|
+
if (((S = u.confirmedData) == null ? void 0 : S.taskId) !== a.agentTaskId)
|
|
396
|
+
return u;
|
|
397
|
+
const f = u.progressItems.some(
|
|
390
398
|
(k) => k.progressItemId === a.progressItemId
|
|
391
|
-
) ?
|
|
399
|
+
) ? u.progressItems.map(
|
|
392
400
|
(k) => k.progressItemId === a.progressItemId ? a : k
|
|
393
|
-
) : [...
|
|
394
|
-
return { ...
|
|
401
|
+
) : [...u.progressItems, a];
|
|
402
|
+
return { ...u, progressItems: f };
|
|
395
403
|
})
|
|
396
404
|
);
|
|
397
405
|
},
|
|
398
406
|
onStreamError: (a) => {
|
|
399
407
|
var c;
|
|
400
|
-
(c = e == null ? void 0 : e.onStreamError) == null || c.call(e, a), r((
|
|
401
|
-
const
|
|
402
|
-
return
|
|
403
|
-
...
|
|
408
|
+
(c = e == null ? void 0 : e.onStreamError) == null || c.call(e, a), r((y) => {
|
|
409
|
+
const g = y.find((h) => h.streamId === a.streamId);
|
|
410
|
+
return g ? [
|
|
411
|
+
...y.filter((h) => h.streamId !== a.streamId),
|
|
404
412
|
{
|
|
405
|
-
...
|
|
413
|
+
...g,
|
|
406
414
|
loading: !1,
|
|
407
415
|
error: a.error
|
|
408
416
|
}
|
|
409
|
-
] :
|
|
417
|
+
] : y;
|
|
410
418
|
});
|
|
411
419
|
},
|
|
412
420
|
onStreamNotFound: (a) => {
|
|
@@ -419,13 +427,13 @@ const ye = (e) => {
|
|
|
419
427
|
}
|
|
420
428
|
}), l = _(
|
|
421
429
|
async (a, c) => {
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
430
|
+
const y = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = await o();
|
|
431
|
+
if (g.type === "success") {
|
|
424
432
|
r([
|
|
425
433
|
...n,
|
|
426
434
|
{
|
|
427
|
-
taskKey:
|
|
428
|
-
streamId:
|
|
435
|
+
taskKey: y,
|
|
436
|
+
streamId: g.stream.id,
|
|
429
437
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
430
438
|
confirmedData: null,
|
|
431
439
|
error: null,
|
|
@@ -435,11 +443,11 @@ const ye = (e) => {
|
|
|
435
443
|
loadingText: c == null ? void 0 : c.loadingText
|
|
436
444
|
}
|
|
437
445
|
]);
|
|
438
|
-
const { clientToken:
|
|
446
|
+
const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(a.type), u = await Y({
|
|
439
447
|
pk: t.fency.publishableKey,
|
|
440
448
|
baseUrl: t.fency.baseUrl,
|
|
441
|
-
clientToken:
|
|
442
|
-
streamToken:
|
|
449
|
+
clientToken: h,
|
|
450
|
+
streamToken: g.stream.token,
|
|
443
451
|
request: {
|
|
444
452
|
streamingChatCompletionTask: a.type === "StreamingChatCompletion" ? {
|
|
445
453
|
messages: a.messages,
|
|
@@ -459,50 +467,50 @@ const ye = (e) => {
|
|
|
459
467
|
} : void 0
|
|
460
468
|
}
|
|
461
469
|
});
|
|
462
|
-
if (
|
|
470
|
+
if (u.type === "success" && u.agentTask) {
|
|
463
471
|
s.current.add(
|
|
464
|
-
|
|
465
|
-
), r((
|
|
466
|
-
...
|
|
472
|
+
u.agentTask.id
|
|
473
|
+
), r((f) => [
|
|
474
|
+
...f.filter((S) => S.taskKey !== y),
|
|
467
475
|
{
|
|
468
|
-
taskKey:
|
|
469
|
-
streamId:
|
|
476
|
+
taskKey: y,
|
|
477
|
+
streamId: g.stream.id,
|
|
470
478
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
471
|
-
taskId:
|
|
472
|
-
createdAt:
|
|
479
|
+
taskId: u.agentTask.id,
|
|
480
|
+
createdAt: u.agentTask.createdAt,
|
|
473
481
|
error: null,
|
|
474
482
|
params: a,
|
|
475
483
|
progressItems: [],
|
|
476
484
|
loading: !0,
|
|
477
485
|
loadingText: c == null ? void 0 : c.loadingText,
|
|
478
486
|
confirmedData: {
|
|
479
|
-
taskId:
|
|
480
|
-
createdAt:
|
|
487
|
+
taskId: u.agentTask.id,
|
|
488
|
+
createdAt: u.agentTask.createdAt
|
|
481
489
|
}
|
|
482
490
|
}
|
|
483
491
|
]);
|
|
484
|
-
const p = await new Promise((
|
|
492
|
+
const p = await new Promise((f) => {
|
|
485
493
|
d.current.set(
|
|
486
|
-
|
|
487
|
-
|
|
494
|
+
u.agentTask.id,
|
|
495
|
+
f
|
|
488
496
|
);
|
|
489
497
|
});
|
|
490
498
|
return {
|
|
491
499
|
type: "success",
|
|
492
|
-
streamId:
|
|
493
|
-
agentTaskId:
|
|
500
|
+
streamId: g.stream.id,
|
|
501
|
+
agentTaskId: u.agentTask.id,
|
|
494
502
|
response: p
|
|
495
503
|
};
|
|
496
504
|
} else {
|
|
497
|
-
if (
|
|
505
|
+
if (u.type === "error")
|
|
498
506
|
return r((p) => [
|
|
499
|
-
...p.filter((
|
|
507
|
+
...p.filter((f) => f.taskKey !== y),
|
|
500
508
|
{
|
|
501
|
-
taskKey:
|
|
509
|
+
taskKey: y,
|
|
502
510
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
503
|
-
streamId:
|
|
511
|
+
streamId: g.stream.id,
|
|
504
512
|
params: a,
|
|
505
|
-
error:
|
|
513
|
+
error: u.error,
|
|
506
514
|
progressItems: [],
|
|
507
515
|
loading: !1,
|
|
508
516
|
loadingText: c == null ? void 0 : c.loadingText,
|
|
@@ -510,19 +518,19 @@ const ye = (e) => {
|
|
|
510
518
|
}
|
|
511
519
|
]), {
|
|
512
520
|
type: "error",
|
|
513
|
-
error:
|
|
521
|
+
error: u.error
|
|
514
522
|
};
|
|
515
523
|
{
|
|
516
524
|
const p = {
|
|
517
525
|
message: "No response received",
|
|
518
526
|
code: "UnknownError"
|
|
519
527
|
};
|
|
520
|
-
return r((
|
|
521
|
-
...
|
|
528
|
+
return r((f) => [
|
|
529
|
+
...f.filter((S) => S.taskKey !== y),
|
|
522
530
|
{
|
|
523
|
-
taskKey:
|
|
531
|
+
taskKey: y,
|
|
524
532
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
525
|
-
streamId:
|
|
533
|
+
streamId: g.stream.id,
|
|
526
534
|
error: p,
|
|
527
535
|
params: a,
|
|
528
536
|
progressItems: [],
|
|
@@ -537,10 +545,10 @@ const ye = (e) => {
|
|
|
537
545
|
}
|
|
538
546
|
}
|
|
539
547
|
} else
|
|
540
|
-
return console.error(
|
|
548
|
+
return console.error(g.error), g;
|
|
541
549
|
},
|
|
542
550
|
[t, n, o]
|
|
543
|
-
),
|
|
551
|
+
), m = $(() => {
|
|
544
552
|
if (n.length !== 0)
|
|
545
553
|
return [...n].sort((a, c) => new Date(c.triggeredAt).getTime() - new Date(a.triggeredAt).getTime())[0];
|
|
546
554
|
}, [n]);
|
|
@@ -549,7 +557,7 @@ const ye = (e) => {
|
|
|
549
557
|
}, []), {
|
|
550
558
|
agentTasks: n,
|
|
551
559
|
createAgentTask: l,
|
|
552
|
-
latest:
|
|
560
|
+
latest: m
|
|
553
561
|
};
|
|
554
562
|
};
|
|
555
563
|
function Te(e) {
|
|
@@ -577,17 +585,17 @@ function R({
|
|
|
577
585
|
className: d,
|
|
578
586
|
startOnView: o = !1,
|
|
579
587
|
once: l = !1,
|
|
580
|
-
inViewMargin:
|
|
588
|
+
inViewMargin: m,
|
|
581
589
|
spread: a = 2,
|
|
582
590
|
color: c = "#999",
|
|
583
|
-
shimmerColor:
|
|
584
|
-
direction:
|
|
591
|
+
shimmerColor: y = "#000",
|
|
592
|
+
direction: g = "fromBottom"
|
|
585
593
|
}) {
|
|
586
|
-
const
|
|
594
|
+
const h = A(null), u = Z(h, { once: l, margin: m }), p = $(() => e.length * a, [e, a]), f = !o || u, S = g === "fromBottom" ? "100% center" : "-100% center", k = g === "fromBottom" ? "0% center" : "200% center";
|
|
587
595
|
return /* @__PURE__ */ i(
|
|
588
596
|
T.span,
|
|
589
597
|
{
|
|
590
|
-
ref:
|
|
598
|
+
ref: h,
|
|
591
599
|
className: d,
|
|
592
600
|
style: {
|
|
593
601
|
position: "relative",
|
|
@@ -600,7 +608,7 @@ function R({
|
|
|
600
608
|
backgroundRepeat: "no-repeat, padding-box",
|
|
601
609
|
"--spread": `${p}px`,
|
|
602
610
|
"--base-color": c,
|
|
603
|
-
"--shimmer-color":
|
|
611
|
+
"--shimmer-color": y,
|
|
604
612
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
605
613
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
606
614
|
},
|
|
@@ -608,7 +616,7 @@ function R({
|
|
|
608
616
|
backgroundPosition: S,
|
|
609
617
|
opacity: 0
|
|
610
618
|
},
|
|
611
|
-
animate:
|
|
619
|
+
animate: f ? {
|
|
612
620
|
backgroundPosition: k,
|
|
613
621
|
opacity: 1
|
|
614
622
|
} : {},
|
|
@@ -1085,7 +1093,7 @@ const Me = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ v("div", { s
|
|
|
1085
1093
|
onSourceClick: n,
|
|
1086
1094
|
t: r
|
|
1087
1095
|
}) => {
|
|
1088
|
-
const [s, d] = C(!1), o = !!n, l = e.pageNumbers ?? [],
|
|
1096
|
+
const [s, d] = C(!1), o = !!n, l = e.pageNumbers ?? [], m = Ie(l, r);
|
|
1089
1097
|
return /* @__PURE__ */ v(
|
|
1090
1098
|
T.div,
|
|
1091
1099
|
{
|
|
@@ -1109,7 +1117,7 @@ const Me = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ v("div", { s
|
|
|
1109
1117
|
},
|
|
1110
1118
|
children: [
|
|
1111
1119
|
/* @__PURE__ */ i("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1112
|
-
|
|
1120
|
+
m && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: m })
|
|
1113
1121
|
]
|
|
1114
1122
|
}
|
|
1115
1123
|
);
|
|
@@ -1184,7 +1192,7 @@ function Re({
|
|
|
1184
1192
|
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;
|
|
1185
1193
|
}
|
|
1186
1194
|
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,
|
|
1195
|
+
const [s, d] = C(!1), o = e.eventType === "ExploreMemoryResult" ? e.result : void 0, l = o != null && o.length > z, m = o != null ? s || !l ? o : `${o.slice(0, z)}...` : void 0, a = l;
|
|
1188
1196
|
return /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: /* @__PURE__ */ v(
|
|
1189
1197
|
T.div,
|
|
1190
1198
|
{
|
|
@@ -1239,7 +1247,7 @@ const z = 80, Fe = ({ data: e, completed: t, isLatest: n = !1, t: r }) => {
|
|
|
1239
1247
|
children: e.memoryTitle
|
|
1240
1248
|
}
|
|
1241
1249
|
),
|
|
1242
|
-
|
|
1250
|
+
m != null && /* @__PURE__ */ i(
|
|
1243
1251
|
"span",
|
|
1244
1252
|
{
|
|
1245
1253
|
style: {
|
|
@@ -1248,7 +1256,7 @@ const z = 80, Fe = ({ data: e, completed: t, isLatest: n = !1, t: r }) => {
|
|
|
1248
1256
|
lineHeight: 1.4,
|
|
1249
1257
|
whiteSpace: s ? "pre-wrap" : void 0
|
|
1250
1258
|
},
|
|
1251
|
-
children:
|
|
1259
|
+
children: m
|
|
1252
1260
|
}
|
|
1253
1261
|
),
|
|
1254
1262
|
a && /* @__PURE__ */ i(
|
|
@@ -1335,7 +1343,7 @@ const Be = ({ data: e, t }) => {
|
|
|
1335
1343
|
gap: 8
|
|
1336
1344
|
},
|
|
1337
1345
|
children: e.chunks.map((o, l) => {
|
|
1338
|
-
const
|
|
1346
|
+
const m = o.pageNumbers ?? [], a = Oe(m, t);
|
|
1339
1347
|
return /* @__PURE__ */ v(
|
|
1340
1348
|
"div",
|
|
1341
1349
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fencyai/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.141",
|
|
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.
|
|
40
|
+
"@fencyai/js": "^0.1.141",
|
|
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.
|
|
56
|
+
"@fencyai/js": "^0.1.141",
|
|
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": "
|
|
69
|
+
"gitHead": "e804ae011e8043f2af463abe3f28cccf1d1148af"
|
|
70
70
|
}
|