@fencyai/react 0.1.166 → 0.1.167
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/agent-task/AgentTaskProgress.d.ts +21 -0
- package/dist/agent-task/AgentTaskProgress.d.ts.map +1 -1
- package/dist/agent-task/translations.d.ts +2 -2
- package/dist/agent-task/translations.d.ts.map +1 -1
- package/dist/hooks/useAgentTasks/index.d.ts +21 -0
- package/dist/hooks/useAgentTasks/index.d.ts.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +281 -275
- package/dist/provider/StreamEventManager.d.ts +1 -1
- package/dist/provider/StreamEventManager.d.ts.map +1 -1
- package/dist/types/UseAgentTasks.d.ts +10 -1
- package/dist/types/UseAgentTasks.d.ts.map +1 -1
- package/dist/types/UseAgentTasksProps.d.ts +17 -3
- package/dist/types/UseAgentTasksProps.d.ts.map +1 -1
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as p, jsx as o, Fragment as E } from "react/jsx-runtime";
|
|
2
2
|
import { createStream as se, isStreamTimeoutEvent as le, isStreamNotFoundEvent as ce, isAgentTaskProgressItemUpdatedEvent as de, createAgentTask as me } from "@fencyai/js";
|
|
3
|
-
import { createContext as ue, useState as
|
|
3
|
+
import { createContext as ue, useState as C, useRef as F, useEffect as R, useCallback as W, useContext as ye, useMemo as P } from "react";
|
|
4
4
|
import { useInView as pe, motion as b, AnimatePresence as re } from "motion/react";
|
|
5
5
|
import ge from "react-markdown";
|
|
6
6
|
import { Prism as ne } from "react-syntax-highlighter";
|
|
@@ -61,8 +61,8 @@ function Se(e, r, t) {
|
|
|
61
61
|
e(n.id = a);
|
|
62
62
|
break;
|
|
63
63
|
case "retry":
|
|
64
|
-
const
|
|
65
|
-
isNaN(
|
|
64
|
+
const u = parseInt(a, 10);
|
|
65
|
+
isNaN(u) || r(n.retry = u);
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -91,43 +91,43 @@ var ke = function(e, r) {
|
|
|
91
91
|
const G = "text/event-stream", be = 1e3, J = "last-event-id";
|
|
92
92
|
function ve(e, r) {
|
|
93
93
|
var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: i } = r, a = ke(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
|
-
return new Promise((
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
let
|
|
94
|
+
return new Promise((u, y) => {
|
|
95
|
+
const g = Object.assign({}, n);
|
|
96
|
+
g.accept || (g.accept = G);
|
|
97
|
+
let h;
|
|
98
98
|
function k() {
|
|
99
|
-
|
|
99
|
+
h.abort(), document.hidden || M();
|
|
100
100
|
}
|
|
101
101
|
m || document.addEventListener("visibilitychange", k);
|
|
102
|
-
let
|
|
103
|
-
function
|
|
104
|
-
document.removeEventListener("visibilitychange", k), window.clearTimeout(
|
|
102
|
+
let f = be, x = 0;
|
|
103
|
+
function S() {
|
|
104
|
+
document.removeEventListener("visibilitychange", k), window.clearTimeout(x), h.abort();
|
|
105
105
|
}
|
|
106
106
|
t == null || t.addEventListener("abort", () => {
|
|
107
|
-
|
|
107
|
+
S(), u();
|
|
108
108
|
});
|
|
109
|
-
const
|
|
110
|
-
async function
|
|
109
|
+
const w = i ?? window.fetch, v = l ?? Ce;
|
|
110
|
+
async function M() {
|
|
111
111
|
var z;
|
|
112
|
-
|
|
112
|
+
h = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const D = await
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
}, (
|
|
118
|
-
|
|
119
|
-
}, c))), s == null || s(),
|
|
114
|
+
const D = await w(e, Object.assign(Object.assign({}, a), { headers: g, signal: h.signal }));
|
|
115
|
+
await v(D), await fe(D.body, xe(Se((A) => {
|
|
116
|
+
A ? g[J] = A : delete g[J];
|
|
117
|
+
}, (A) => {
|
|
118
|
+
f = A;
|
|
119
|
+
}, c))), s == null || s(), S(), u();
|
|
120
120
|
} catch (D) {
|
|
121
|
-
if (!
|
|
121
|
+
if (!h.signal.aborted)
|
|
122
122
|
try {
|
|
123
|
-
const
|
|
124
|
-
window.clearTimeout(
|
|
125
|
-
} catch (
|
|
126
|
-
|
|
123
|
+
const A = (z = d == null ? void 0 : d(D)) !== null && z !== void 0 ? z : f;
|
|
124
|
+
window.clearTimeout(x), x = window.setTimeout(M, A);
|
|
125
|
+
} catch (A) {
|
|
126
|
+
S(), y(A);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
M();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
function Ce(e) {
|
|
@@ -220,59 +220,59 @@ const Me = 48e4, Ae = 3e5, Y = (e) => {
|
|
|
220
220
|
return e.filter((t) => r - t.createdAt < Me);
|
|
221
221
|
};
|
|
222
222
|
function Dr({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
|
|
223
|
-
const [n, l] =
|
|
223
|
+
const [n, l] = C(
|
|
224
224
|
null
|
|
225
|
-
), [c, s] =
|
|
226
|
-
|
|
227
|
-
e.then((
|
|
228
|
-
l(
|
|
229
|
-
}).catch((
|
|
230
|
-
m(
|
|
225
|
+
), [c, s] = C(!0), [d, m] = C(null), [i, a] = C([]), u = F(null), y = F(null);
|
|
226
|
+
R(() => {
|
|
227
|
+
e.then((f) => {
|
|
228
|
+
l(f), s(!1);
|
|
229
|
+
}).catch((f) => {
|
|
230
|
+
m(f), s(!1);
|
|
231
231
|
});
|
|
232
|
-
}, [e]),
|
|
233
|
-
n && !
|
|
234
|
-
}, [n]),
|
|
235
|
-
|
|
236
|
-
}, [i]),
|
|
237
|
-
var
|
|
238
|
-
(
|
|
239
|
-
}, []),
|
|
240
|
-
const
|
|
241
|
-
a((
|
|
242
|
-
const
|
|
243
|
-
return
|
|
232
|
+
}, [e]), R(() => {
|
|
233
|
+
n && !y.current && (y.current = new Ee(n));
|
|
234
|
+
}, [n]), R(() => {
|
|
235
|
+
y.current && y.current.updateStreams(i);
|
|
236
|
+
}, [i]), R(() => () => {
|
|
237
|
+
var f;
|
|
238
|
+
(f = y.current) == null || f.cleanup();
|
|
239
|
+
}, []), R(() => {
|
|
240
|
+
const f = setInterval(() => {
|
|
241
|
+
a((x) => {
|
|
242
|
+
const S = Y(x);
|
|
243
|
+
return S.length !== x.length ? S : x;
|
|
244
244
|
});
|
|
245
245
|
}, 6e4);
|
|
246
|
-
return () => clearInterval(
|
|
246
|
+
return () => clearInterval(f);
|
|
247
247
|
}, []);
|
|
248
|
-
const
|
|
249
|
-
async (
|
|
250
|
-
if (
|
|
251
|
-
return
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
return
|
|
255
|
-
const
|
|
248
|
+
const g = W(
|
|
249
|
+
async (f = Ae) => {
|
|
250
|
+
if (u.current)
|
|
251
|
+
return u.current;
|
|
252
|
+
const x = Date.now(), S = i.length > 0 ? i[i.length - 1] : null;
|
|
253
|
+
if (S && x - S.createdAt < f)
|
|
254
|
+
return S.stream;
|
|
255
|
+
const w = (async () => {
|
|
256
256
|
if (!n)
|
|
257
257
|
throw new Error("Fency instance not initialized");
|
|
258
|
-
const
|
|
258
|
+
const v = await r(), M = await se({
|
|
259
259
|
pk: n.publishableKey,
|
|
260
260
|
baseUrl: n.baseUrl,
|
|
261
|
-
clientToken: (
|
|
261
|
+
clientToken: (v == null ? void 0 : v.clientToken) ?? ""
|
|
262
262
|
});
|
|
263
|
-
if (
|
|
263
|
+
if (M.type === "success") {
|
|
264
264
|
const z = {
|
|
265
|
-
stream:
|
|
265
|
+
stream: M.stream,
|
|
266
266
|
createdAt: Date.now()
|
|
267
267
|
};
|
|
268
268
|
return a((D) => {
|
|
269
|
-
const
|
|
270
|
-
return Y(
|
|
271
|
-
}),
|
|
269
|
+
const A = [...D, z];
|
|
270
|
+
return Y(A);
|
|
271
|
+
}), u.current = null, M.stream;
|
|
272
272
|
} else
|
|
273
|
-
throw
|
|
273
|
+
throw u.current = null, new Error("Failed to create stream");
|
|
274
274
|
})();
|
|
275
|
-
return
|
|
275
|
+
return u.current = w, w;
|
|
276
276
|
},
|
|
277
277
|
[n, i]
|
|
278
278
|
);
|
|
@@ -283,14 +283,14 @@ function Dr({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
|
|
|
283
283
|
] });
|
|
284
284
|
if (!n)
|
|
285
285
|
return null;
|
|
286
|
-
const
|
|
286
|
+
const h = i.length > 0 ? i[i.length - 1] : null, k = {
|
|
287
287
|
fency: n,
|
|
288
288
|
loading: c,
|
|
289
289
|
error: d,
|
|
290
290
|
activeStreams: i,
|
|
291
|
-
latestStream:
|
|
292
|
-
eventManager:
|
|
293
|
-
getOrCreateStream:
|
|
291
|
+
latestStream: h,
|
|
292
|
+
eventManager: y.current,
|
|
293
|
+
getOrCreateStream: g
|
|
294
294
|
};
|
|
295
295
|
return /* @__PURE__ */ o(te.Provider, { value: k, children: t });
|
|
296
296
|
}
|
|
@@ -324,23 +324,23 @@ const Re = (e) => {
|
|
|
324
324
|
createdAt: e.createdAt,
|
|
325
325
|
data: JSON.parse(e.data)
|
|
326
326
|
}), ze = (e) => {
|
|
327
|
-
const r = oe(), [t, n] =
|
|
328
|
-
return
|
|
327
|
+
const r = oe(), [t, n] = C(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
328
|
+
return R(() => {
|
|
329
329
|
if (!r.eventManager) return;
|
|
330
330
|
const s = {
|
|
331
331
|
onMessage: (m, i) => {
|
|
332
|
-
var
|
|
332
|
+
var u, y, g;
|
|
333
333
|
const a = Re(m);
|
|
334
334
|
if (a)
|
|
335
335
|
switch (a.type) {
|
|
336
336
|
case "STREAM_TIMEOUT":
|
|
337
|
-
(
|
|
337
|
+
(u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, a);
|
|
338
338
|
break;
|
|
339
339
|
case "STREAM_NOT_FOUND":
|
|
340
|
-
(
|
|
340
|
+
(y = e == null ? void 0 : e.onStreamNotFound) == null || y.call(e, a);
|
|
341
341
|
break;
|
|
342
342
|
case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
|
|
343
|
-
(
|
|
343
|
+
(g = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || g.call(e, a);
|
|
344
344
|
break;
|
|
345
345
|
}
|
|
346
346
|
},
|
|
@@ -380,59 +380,59 @@ const Re = (e) => {
|
|
|
380
380
|
stream: t
|
|
381
381
|
};
|
|
382
382
|
}, Lr = (e) => {
|
|
383
|
-
const r = oe(), [t, n] =
|
|
383
|
+
const r = oe(), [t, n] = C([]), l = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), { createStream: s } = ze({
|
|
384
384
|
onAgentTaskProgressItemUpdated: (i) => {
|
|
385
|
-
var
|
|
385
|
+
var y;
|
|
386
386
|
if (!l.current.has(i.agentTaskId)) return;
|
|
387
387
|
const a = i.data;
|
|
388
388
|
if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChat" && a.eventType === "Completed" || a.taskType === "MemorySearch" && a.eventType === "Completed") {
|
|
389
|
-
const
|
|
389
|
+
const g = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
|
|
390
390
|
n(
|
|
391
|
-
|
|
392
|
-
var
|
|
393
|
-
if (((
|
|
394
|
-
return
|
|
395
|
-
const
|
|
396
|
-
(
|
|
397
|
-
) ?
|
|
398
|
-
(
|
|
399
|
-
) : [...
|
|
391
|
+
g ? (k) => k.map((f) => {
|
|
392
|
+
var w;
|
|
393
|
+
if (((w = f.confirmedData) == null ? void 0 : w.taskId) !== i.agentTaskId)
|
|
394
|
+
return f;
|
|
395
|
+
const S = f.progressItems.some(
|
|
396
|
+
(v) => v.progressItemId === i.progressItemId
|
|
397
|
+
) ? f.progressItems.map(
|
|
398
|
+
(v) => v.progressItemId === i.progressItemId ? i : v
|
|
399
|
+
) : [...f.progressItems, i];
|
|
400
400
|
return {
|
|
401
|
-
...
|
|
402
|
-
progressItems:
|
|
401
|
+
...f,
|
|
402
|
+
progressItems: S,
|
|
403
403
|
loading: !1
|
|
404
404
|
};
|
|
405
405
|
}) : (k) => k.map(
|
|
406
|
-
(
|
|
407
|
-
var
|
|
408
|
-
return ((
|
|
406
|
+
(f) => {
|
|
407
|
+
var x;
|
|
408
|
+
return ((x = f.confirmedData) == null ? void 0 : x.taskId) === i.agentTaskId ? { ...f, loading: !1 } : f;
|
|
409
409
|
}
|
|
410
410
|
)
|
|
411
411
|
);
|
|
412
|
-
const
|
|
412
|
+
const h = c.current.get(
|
|
413
413
|
i.agentTaskId
|
|
414
414
|
);
|
|
415
|
-
|
|
415
|
+
h && (c.current.delete(i.agentTaskId), h(a));
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
(
|
|
419
|
-
(
|
|
420
|
-
var
|
|
421
|
-
if (((
|
|
422
|
-
return
|
|
423
|
-
const
|
|
424
|
-
(
|
|
425
|
-
) ?
|
|
426
|
-
(
|
|
427
|
-
) : [...
|
|
428
|
-
return { ...
|
|
418
|
+
(y = e.onAgentTaskProgressItemUpdated) == null || y.call(e, i), n(
|
|
419
|
+
(g) => g.map((h) => {
|
|
420
|
+
var x;
|
|
421
|
+
if (((x = h.confirmedData) == null ? void 0 : x.taskId) !== i.agentTaskId)
|
|
422
|
+
return h;
|
|
423
|
+
const f = h.progressItems.some(
|
|
424
|
+
(S) => S.progressItemId === i.progressItemId
|
|
425
|
+
) ? h.progressItems.map(
|
|
426
|
+
(S) => S.progressItemId === i.progressItemId ? i : S
|
|
427
|
+
) : [...h.progressItems, i];
|
|
428
|
+
return { ...h, progressItems: f };
|
|
429
429
|
})
|
|
430
430
|
);
|
|
431
431
|
},
|
|
432
432
|
onStreamError: (i) => {
|
|
433
433
|
var a;
|
|
434
434
|
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, i), n(
|
|
435
|
-
(
|
|
435
|
+
(u) => u.map((y) => y.streamId !== i.streamId || !y.loading ? y : { ...y, loading: !1, error: i.error })
|
|
436
436
|
);
|
|
437
437
|
},
|
|
438
438
|
onStreamNotFound: (i) => {
|
|
@@ -446,12 +446,17 @@ const Re = (e) => {
|
|
|
446
446
|
}), d = W(
|
|
447
447
|
async (i, a) => {
|
|
448
448
|
var h;
|
|
449
|
-
const
|
|
450
|
-
if (
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
449
|
+
const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, y = (a == null ? void 0 : a.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
|
|
450
|
+
if (y === void 0)
|
|
451
|
+
throw new Error(
|
|
452
|
+
"fetchCreateAgentTaskClientToken must be provided either in useAgentTasks props or in createAgentTask options"
|
|
453
|
+
);
|
|
454
|
+
const g = await s();
|
|
455
|
+
if (g.type === "success") {
|
|
456
|
+
const k = (/* @__PURE__ */ new Date()).toISOString(), f = {
|
|
457
|
+
taskKey: u,
|
|
458
|
+
streamId: g.stream.id,
|
|
459
|
+
triggeredAt: k,
|
|
455
460
|
confirmedData: null,
|
|
456
461
|
error: null,
|
|
457
462
|
params: i,
|
|
@@ -459,12 +464,12 @@ const Re = (e) => {
|
|
|
459
464
|
loading: !0,
|
|
460
465
|
loadingText: a == null ? void 0 : a.loadingText
|
|
461
466
|
};
|
|
462
|
-
n((
|
|
463
|
-
const { clientToken: x } = await
|
|
467
|
+
n((w) => [...w, f]), (h = a == null ? void 0 : a.onTaskRegistered) == null || h.call(a, f);
|
|
468
|
+
const { clientToken: x } = await y(), S = await me({
|
|
464
469
|
pk: r.fency.publishableKey,
|
|
465
470
|
baseUrl: r.fency.baseUrl,
|
|
466
471
|
clientToken: x,
|
|
467
|
-
streamToken:
|
|
472
|
+
streamToken: g.stream.token,
|
|
468
473
|
request: {
|
|
469
474
|
streamingChatCompletionTask: i.type === "StreamingChatCompletion" ? {
|
|
470
475
|
messages: i.messages,
|
|
@@ -494,50 +499,50 @@ const Re = (e) => {
|
|
|
494
499
|
} : void 0
|
|
495
500
|
}
|
|
496
501
|
});
|
|
497
|
-
if (
|
|
502
|
+
if (S.type === "success" && S.agentTask) {
|
|
498
503
|
l.current.add(
|
|
499
|
-
|
|
500
|
-
), n((
|
|
501
|
-
...
|
|
504
|
+
S.agentTask.id
|
|
505
|
+
), n((v) => [
|
|
506
|
+
...v.filter((M) => M.taskKey !== u),
|
|
502
507
|
{
|
|
503
|
-
taskKey:
|
|
504
|
-
streamId:
|
|
508
|
+
taskKey: u,
|
|
509
|
+
streamId: g.stream.id,
|
|
505
510
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
506
|
-
taskId:
|
|
507
|
-
createdAt:
|
|
511
|
+
taskId: S.agentTask.id,
|
|
512
|
+
createdAt: S.agentTask.createdAt,
|
|
508
513
|
error: null,
|
|
509
514
|
params: i,
|
|
510
515
|
progressItems: [],
|
|
511
516
|
loading: !0,
|
|
512
517
|
loadingText: a == null ? void 0 : a.loadingText,
|
|
513
518
|
confirmedData: {
|
|
514
|
-
taskId:
|
|
515
|
-
createdAt:
|
|
519
|
+
taskId: S.agentTask.id,
|
|
520
|
+
createdAt: S.agentTask.createdAt
|
|
516
521
|
}
|
|
517
522
|
}
|
|
518
523
|
]);
|
|
519
|
-
const
|
|
524
|
+
const w = await new Promise((v) => {
|
|
520
525
|
c.current.set(
|
|
521
|
-
|
|
522
|
-
|
|
526
|
+
S.agentTask.id,
|
|
527
|
+
v
|
|
523
528
|
);
|
|
524
529
|
});
|
|
525
530
|
return {
|
|
526
531
|
type: "success",
|
|
527
|
-
streamId:
|
|
528
|
-
agentTaskId:
|
|
529
|
-
response:
|
|
532
|
+
streamId: g.stream.id,
|
|
533
|
+
agentTaskId: S.agentTask.id,
|
|
534
|
+
response: w
|
|
530
535
|
};
|
|
531
536
|
} else {
|
|
532
|
-
if (
|
|
533
|
-
return n((
|
|
534
|
-
...
|
|
537
|
+
if (S.type === "error")
|
|
538
|
+
return n((w) => [
|
|
539
|
+
...w.filter((v) => v.taskKey !== u),
|
|
535
540
|
{
|
|
536
|
-
taskKey:
|
|
541
|
+
taskKey: u,
|
|
537
542
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
538
|
-
streamId:
|
|
543
|
+
streamId: g.stream.id,
|
|
539
544
|
params: i,
|
|
540
|
-
error:
|
|
545
|
+
error: S.error,
|
|
541
546
|
progressItems: [],
|
|
542
547
|
loading: !1,
|
|
543
548
|
loadingText: a == null ? void 0 : a.loadingText,
|
|
@@ -545,20 +550,20 @@ const Re = (e) => {
|
|
|
545
550
|
}
|
|
546
551
|
]), {
|
|
547
552
|
type: "error",
|
|
548
|
-
error:
|
|
553
|
+
error: S.error
|
|
549
554
|
};
|
|
550
555
|
{
|
|
551
|
-
const
|
|
556
|
+
const w = {
|
|
552
557
|
message: "No response received",
|
|
553
558
|
code: "UnknownError"
|
|
554
559
|
};
|
|
555
|
-
return n((
|
|
556
|
-
...
|
|
560
|
+
return n((v) => [
|
|
561
|
+
...v.filter((M) => M.taskKey !== u),
|
|
557
562
|
{
|
|
558
|
-
taskKey:
|
|
563
|
+
taskKey: u,
|
|
559
564
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
560
|
-
streamId:
|
|
561
|
-
error:
|
|
565
|
+
streamId: g.stream.id,
|
|
566
|
+
error: w,
|
|
562
567
|
params: i,
|
|
563
568
|
progressItems: [],
|
|
564
569
|
loading: !1,
|
|
@@ -567,19 +572,19 @@ const Re = (e) => {
|
|
|
567
572
|
}
|
|
568
573
|
]), {
|
|
569
574
|
type: "error",
|
|
570
|
-
error:
|
|
575
|
+
error: w
|
|
571
576
|
};
|
|
572
577
|
}
|
|
573
578
|
}
|
|
574
579
|
} else
|
|
575
|
-
return console.error(
|
|
580
|
+
return console.error(g.error), g;
|
|
576
581
|
},
|
|
577
582
|
[r, s, e.fetchCreateAgentTaskClientToken]
|
|
578
583
|
), m = P(() => {
|
|
579
584
|
if (t.length !== 0)
|
|
580
585
|
return [...t].sort((i, a) => new Date(a.triggeredAt).getTime() - new Date(i.triggeredAt).getTime())[0];
|
|
581
586
|
}, [t]);
|
|
582
|
-
return
|
|
587
|
+
return R(() => () => {
|
|
583
588
|
l.current.clear(), c.current.clear();
|
|
584
589
|
}, []), {
|
|
585
590
|
agentTasks: t,
|
|
@@ -615,14 +620,14 @@ function I({
|
|
|
615
620
|
inViewMargin: m,
|
|
616
621
|
spread: i = 2,
|
|
617
622
|
color: a = "#999",
|
|
618
|
-
shimmerColor:
|
|
619
|
-
direction:
|
|
623
|
+
shimmerColor: u = "#000",
|
|
624
|
+
direction: y = "fromBottom"
|
|
620
625
|
}) {
|
|
621
|
-
const
|
|
626
|
+
const g = F(null), h = pe(g, { once: d, margin: m }), k = P(() => e.length * i, [e, i]), f = !s || h, x = y === "fromBottom" ? "100% center" : "-100% center", S = y === "fromBottom" ? "0% center" : "200% center";
|
|
622
627
|
return /* @__PURE__ */ o(
|
|
623
628
|
b.span,
|
|
624
629
|
{
|
|
625
|
-
ref:
|
|
630
|
+
ref: g,
|
|
626
631
|
className: c,
|
|
627
632
|
style: {
|
|
628
633
|
position: "relative",
|
|
@@ -635,16 +640,16 @@ function I({
|
|
|
635
640
|
backgroundRepeat: "no-repeat, padding-box",
|
|
636
641
|
"--spread": `${k}px`,
|
|
637
642
|
"--base-color": a,
|
|
638
|
-
"--shimmer-color":
|
|
643
|
+
"--shimmer-color": u,
|
|
639
644
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
640
645
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
641
646
|
},
|
|
642
647
|
initial: {
|
|
643
|
-
backgroundPosition:
|
|
648
|
+
backgroundPosition: x,
|
|
644
649
|
opacity: 0
|
|
645
650
|
},
|
|
646
|
-
animate:
|
|
647
|
-
backgroundPosition:
|
|
651
|
+
animate: f ? {
|
|
652
|
+
backgroundPosition: S,
|
|
648
653
|
opacity: 1
|
|
649
654
|
} : {},
|
|
650
655
|
transition: {
|
|
@@ -1068,7 +1073,7 @@ const Be = ({ progressViewItems: e, t: r }) => {
|
|
|
1068
1073
|
function He(e) {
|
|
1069
1074
|
return $e[e];
|
|
1070
1075
|
}
|
|
1071
|
-
function
|
|
1076
|
+
function T(e, r) {
|
|
1072
1077
|
return Object.entries(r).reduce(
|
|
1073
1078
|
(t, [n, l]) => t.replace(`{${n}}`, String(l)),
|
|
1074
1079
|
e
|
|
@@ -1083,10 +1088,10 @@ function Q(e, r) {
|
|
|
1083
1088
|
return t.join(", ");
|
|
1084
1089
|
}
|
|
1085
1090
|
const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1086
|
-
const [l, c] =
|
|
1091
|
+
const [l, c] = C(!1), d = (e.memories ?? []).map((f) => f.memoryTitle), m = d.length > 0, i = m && d.length > $, a = i && !l ? d.slice(0, $) : d, u = d.length - $, y = !i || l, g = `${n.searchingFor}'${e.queryDescription}'`, h = m ? `${n.searchingIn}${Q(
|
|
1087
1092
|
a,
|
|
1088
|
-
|
|
1089
|
-
)}` : "", k = m ? `${
|
|
1093
|
+
y ? n.and : void 0
|
|
1094
|
+
)}` : "", k = m ? `${g}${h}` : `${n.searchingPrefix}${e.queryDescription}`;
|
|
1090
1095
|
return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
|
|
1091
1096
|
/* @__PURE__ */ o(
|
|
1092
1097
|
b.div,
|
|
@@ -1112,7 +1117,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1112
1117
|
e.queryDescription,
|
|
1113
1118
|
"'"
|
|
1114
1119
|
] }),
|
|
1115
|
-
|
|
1120
|
+
h
|
|
1116
1121
|
] }) : `${n.searchingPrefix}${e.queryDescription}` }),
|
|
1117
1122
|
i && !l && /* @__PURE__ */ p(E, { children: [
|
|
1118
1123
|
" ",
|
|
@@ -1132,8 +1137,8 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1132
1137
|
textDecoration: "underline",
|
|
1133
1138
|
fontFamily: "inherit"
|
|
1134
1139
|
},
|
|
1135
|
-
children:
|
|
1136
|
-
n:
|
|
1140
|
+
children: T(n.moreMemories, {
|
|
1141
|
+
n: u
|
|
1137
1142
|
})
|
|
1138
1143
|
}
|
|
1139
1144
|
)
|
|
@@ -1172,14 +1177,14 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1172
1177
|
marginTop: "4px",
|
|
1173
1178
|
fontStyle: "italic"
|
|
1174
1179
|
},
|
|
1175
|
-
children:
|
|
1180
|
+
children: T(n.tookSeconds, { n: t })
|
|
1176
1181
|
}
|
|
1177
1182
|
)
|
|
1178
1183
|
] });
|
|
1179
1184
|
}, H = 5, Ge = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1180
|
-
const [l, c] =
|
|
1185
|
+
const [l, c] = C(!1), s = e.titles, d = s.length > 0, m = d && s.length > H, i = m && !l ? s.slice(0, H) : s, a = s.length - H, u = !m || l, y = d ? `${n.findingMemoriesIn}${Q(
|
|
1181
1186
|
i,
|
|
1182
|
-
|
|
1187
|
+
u ? n.and : void 0
|
|
1183
1188
|
)}` : n.findingMemories;
|
|
1184
1189
|
return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
|
|
1185
1190
|
/* @__PURE__ */ o(
|
|
@@ -1194,14 +1199,14 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1194
1199
|
children: r && !t && !m ? /* @__PURE__ */ o(
|
|
1195
1200
|
I,
|
|
1196
1201
|
{
|
|
1197
|
-
text:
|
|
1202
|
+
text: y,
|
|
1198
1203
|
duration: 2.5,
|
|
1199
1204
|
repeat: !0,
|
|
1200
1205
|
color: "#999",
|
|
1201
1206
|
shimmerColor: "#000"
|
|
1202
1207
|
}
|
|
1203
1208
|
) : /* @__PURE__ */ p(E, { children: [
|
|
1204
|
-
/* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1209
|
+
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: y }),
|
|
1205
1210
|
m && !l && /* @__PURE__ */ p(E, { children: [
|
|
1206
1211
|
" ",
|
|
1207
1212
|
/* @__PURE__ */ o(
|
|
@@ -1220,7 +1225,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1220
1225
|
textDecoration: "underline",
|
|
1221
1226
|
fontFamily: "inherit"
|
|
1222
1227
|
},
|
|
1223
|
-
children:
|
|
1228
|
+
children: T(n.moreMemories, {
|
|
1224
1229
|
n: a
|
|
1225
1230
|
})
|
|
1226
1231
|
}
|
|
@@ -1260,12 +1265,12 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1260
1265
|
marginTop: "4px",
|
|
1261
1266
|
fontStyle: "italic"
|
|
1262
1267
|
},
|
|
1263
|
-
children:
|
|
1268
|
+
children: T(n.tookSeconds, { n: t })
|
|
1264
1269
|
}
|
|
1265
1270
|
)
|
|
1266
1271
|
] });
|
|
1267
1272
|
}, _ = 5, Qe = ({ data: e, t: r }) => {
|
|
1268
|
-
const [t, n] =
|
|
1273
|
+
const [t, n] = C(!1), c = e.memories.map((g) => g.memoryTitle), s = c.length > 0, d = s && c.length > _, m = d && !t ? c.slice(0, _) : c, i = c.length - _, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, y = s ? `${u}${Q(
|
|
1269
1274
|
m,
|
|
1270
1275
|
a ? r.and : void 0
|
|
1271
1276
|
)}` : r.memoriesFound;
|
|
@@ -1277,7 +1282,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1277
1282
|
animate: { opacity: 1, y: 0 },
|
|
1278
1283
|
transition: { duration: 0.3, delay: 0 },
|
|
1279
1284
|
children: /* @__PURE__ */ p(E, { children: [
|
|
1280
|
-
/* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1285
|
+
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: y }),
|
|
1281
1286
|
d && !t && /* @__PURE__ */ p(E, { children: [
|
|
1282
1287
|
" ",
|
|
1283
1288
|
/* @__PURE__ */ o(
|
|
@@ -1296,7 +1301,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1296
1301
|
textDecoration: "underline",
|
|
1297
1302
|
fontFamily: "inherit"
|
|
1298
1303
|
},
|
|
1299
|
-
children:
|
|
1304
|
+
children: T(r.moreMemories, {
|
|
1300
1305
|
n: i
|
|
1301
1306
|
})
|
|
1302
1307
|
}
|
|
@@ -1363,7 +1368,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1363
1368
|
marginTop: "4px",
|
|
1364
1369
|
fontStyle: "italic"
|
|
1365
1370
|
},
|
|
1366
|
-
children:
|
|
1371
|
+
children: T(t.tookSeconds, { n: r })
|
|
1367
1372
|
}
|
|
1368
1373
|
)
|
|
1369
1374
|
] });
|
|
@@ -1371,17 +1376,17 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1371
1376
|
function je(e, r) {
|
|
1372
1377
|
if (e.length === 0) return "";
|
|
1373
1378
|
if (e.length === 1)
|
|
1374
|
-
return
|
|
1379
|
+
return T(r.pageSingle, { n: e[0] });
|
|
1375
1380
|
if (e.length === 2)
|
|
1376
|
-
return
|
|
1381
|
+
return T(r.pageTwo, {
|
|
1377
1382
|
a: e[0],
|
|
1378
1383
|
b: e[1]
|
|
1379
1384
|
});
|
|
1380
1385
|
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1381
|
-
return
|
|
1386
|
+
return T(r.pageMultiple, { list: n, n: t });
|
|
1382
1387
|
}
|
|
1383
1388
|
const qe = ({ data: e, onSourceClick: r, t }) => {
|
|
1384
|
-
const [n, l] =
|
|
1389
|
+
const [n, l] = C(null);
|
|
1385
1390
|
return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
|
|
1386
1391
|
/* @__PURE__ */ o(
|
|
1387
1392
|
b.div,
|
|
@@ -1421,7 +1426,7 @@ const qe = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1421
1426
|
onSourceClick: l,
|
|
1422
1427
|
t: c
|
|
1423
1428
|
}) => {
|
|
1424
|
-
const [s, d] =
|
|
1429
|
+
const [s, d] = C(!1), m = !!l, i = t === e.memoryId, a = e.pageNumbers ?? [], u = je(a, c);
|
|
1425
1430
|
return /* @__PURE__ */ p(
|
|
1426
1431
|
b.div,
|
|
1427
1432
|
{
|
|
@@ -1482,7 +1487,7 @@ const qe = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1482
1487
|
]
|
|
1483
1488
|
}
|
|
1484
1489
|
),
|
|
1485
|
-
|
|
1490
|
+
u && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: u })
|
|
1486
1491
|
]
|
|
1487
1492
|
}
|
|
1488
1493
|
);
|
|
@@ -1562,7 +1567,7 @@ function Xe({
|
|
|
1562
1567
|
completed: r,
|
|
1563
1568
|
t
|
|
1564
1569
|
}) {
|
|
1565
|
-
const [n, l] =
|
|
1570
|
+
const [n, l] = C(!1), c = e.result ?? e.error, s = c != null && c.length > ee, d = c != null ? n || !s ? c : `${c.slice(0, ee)}...` : void 0, m = s, i = e.error != null;
|
|
1566
1571
|
return /* @__PURE__ */ p(
|
|
1567
1572
|
b.div,
|
|
1568
1573
|
{
|
|
@@ -1679,16 +1684,16 @@ function j(e) {
|
|
|
1679
1684
|
function q(e, r) {
|
|
1680
1685
|
if (e.length === 0) return "";
|
|
1681
1686
|
if (e.length === 1)
|
|
1682
|
-
return
|
|
1687
|
+
return T(r.memorySearchPagesSingle, {
|
|
1683
1688
|
n: e[0]
|
|
1684
1689
|
});
|
|
1685
1690
|
if (e.length === 2)
|
|
1686
|
-
return
|
|
1691
|
+
return T(r.memorySearchPagesTwo, {
|
|
1687
1692
|
a: e[0],
|
|
1688
1693
|
b: e[1]
|
|
1689
1694
|
});
|
|
1690
1695
|
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1691
|
-
return
|
|
1696
|
+
return T(r.memorySearchPagesMultiple, {
|
|
1692
1697
|
list: n,
|
|
1693
1698
|
n: t
|
|
1694
1699
|
});
|
|
@@ -1711,7 +1716,7 @@ function er(e, r) {
|
|
|
1711
1716
|
let t = 0, n = 0;
|
|
1712
1717
|
for (const s of e)
|
|
1713
1718
|
t += ae(s), s.matchingChunkScore > n && (n = s.matchingChunkScore);
|
|
1714
|
-
const l = t === 1 ? r.chunkFound :
|
|
1719
|
+
const l = t === 1 ? r.chunkFound : T(r.chunksFound, { n: t }), c = T(r.scoreLabel, {
|
|
1715
1720
|
n: n.toFixed(2)
|
|
1716
1721
|
});
|
|
1717
1722
|
return `${l} - ${c}`;
|
|
@@ -1737,7 +1742,7 @@ function nr({
|
|
|
1737
1742
|
onSearchResultClick: r,
|
|
1738
1743
|
t
|
|
1739
1744
|
}) {
|
|
1740
|
-
const [n, l] =
|
|
1745
|
+
const [n, l] = C(null), c = !!r;
|
|
1741
1746
|
return /* @__PURE__ */ o(
|
|
1742
1747
|
"div",
|
|
1743
1748
|
{
|
|
@@ -1754,19 +1759,19 @@ function nr({
|
|
|
1754
1759
|
s.chunks
|
|
1755
1760
|
), i = [
|
|
1756
1761
|
V(s),
|
|
1757
|
-
|
|
1762
|
+
T(t.scoreLabel, {
|
|
1758
1763
|
n: s.matchingChunkScore.toFixed(2)
|
|
1759
1764
|
}),
|
|
1760
1765
|
m.length > 0 ? q(m, t) : t.pagesNotAvailable
|
|
1761
1766
|
].filter(
|
|
1762
|
-
(
|
|
1767
|
+
(g) => g != null && g !== ""
|
|
1763
1768
|
), a = {
|
|
1764
1769
|
memoryId: s.memoryId,
|
|
1765
1770
|
memoryTitle: s.memoryTitle,
|
|
1766
1771
|
memoryTypeId: s.memoryTypeId,
|
|
1767
1772
|
memoryTypeName: s.memoryTypeName,
|
|
1768
1773
|
pageNumbers: m
|
|
1769
|
-
},
|
|
1774
|
+
}, u = `${s.memoryId}-${d}`, y = n === u;
|
|
1770
1775
|
return /* @__PURE__ */ p(
|
|
1771
1776
|
"div",
|
|
1772
1777
|
{
|
|
@@ -1824,10 +1829,10 @@ function nr({
|
|
|
1824
1829
|
"button",
|
|
1825
1830
|
{
|
|
1826
1831
|
type: "button",
|
|
1827
|
-
"aria-busy":
|
|
1828
|
-
disabled:
|
|
1832
|
+
"aria-busy": y,
|
|
1833
|
+
disabled: y,
|
|
1829
1834
|
onClick: async () => {
|
|
1830
|
-
l(
|
|
1835
|
+
l(u);
|
|
1831
1836
|
try {
|
|
1832
1837
|
await r(
|
|
1833
1838
|
a
|
|
@@ -1846,14 +1851,14 @@ function nr({
|
|
|
1846
1851
|
background: "#eff6ff",
|
|
1847
1852
|
border: "1px solid #bfdbfe",
|
|
1848
1853
|
borderRadius: 6,
|
|
1849
|
-
cursor:
|
|
1854
|
+
cursor: y ? "wait" : "pointer",
|
|
1850
1855
|
fontFamily: "inherit",
|
|
1851
1856
|
display: "inline-flex",
|
|
1852
1857
|
alignItems: "center",
|
|
1853
1858
|
gap: 8
|
|
1854
1859
|
},
|
|
1855
1860
|
children: [
|
|
1856
|
-
|
|
1861
|
+
y && /* @__PURE__ */ o(
|
|
1857
1862
|
"span",
|
|
1858
1863
|
{
|
|
1859
1864
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
@@ -1866,7 +1871,7 @@ function nr({
|
|
|
1866
1871
|
)
|
|
1867
1872
|
]
|
|
1868
1873
|
},
|
|
1869
|
-
|
|
1874
|
+
u
|
|
1870
1875
|
);
|
|
1871
1876
|
})
|
|
1872
1877
|
}
|
|
@@ -1994,7 +1999,7 @@ function tr({
|
|
|
1994
1999
|
);
|
|
1995
2000
|
}
|
|
1996
2001
|
function or(e, r) {
|
|
1997
|
-
return e === 1 ? r.chunkFound :
|
|
2002
|
+
return e === 1 ? r.chunkFound : T(r.chunksFound, { n: e });
|
|
1998
2003
|
}
|
|
1999
2004
|
const ir = ({
|
|
2000
2005
|
data: e,
|
|
@@ -2002,16 +2007,16 @@ const ir = ({
|
|
|
2002
2007
|
t
|
|
2003
2008
|
}) => {
|
|
2004
2009
|
const n = e.items, l = n.reduce(
|
|
2005
|
-
(
|
|
2010
|
+
(y, g) => y + ae(g),
|
|
2006
2011
|
0
|
|
2007
|
-
), c = new Set(n.map((
|
|
2008
|
-
d((
|
|
2009
|
-
...
|
|
2010
|
-
[
|
|
2012
|
+
), c = new Set(n.map((y) => y.memoryId)).size, [s, d] = C({}), m = W((y) => {
|
|
2013
|
+
d((g) => ({
|
|
2014
|
+
...g,
|
|
2015
|
+
[y]: !g[y]
|
|
2011
2016
|
}));
|
|
2012
|
-
}, []), i = P(() => rr(n), [n]), a = c === 1 ? t.memoryChatChunkResultsInOneMemory :
|
|
2017
|
+
}, []), i = P(() => rr(n), [n]), a = c === 1 ? t.memoryChatChunkResultsInOneMemory : T(t.memoryChatChunkResultsInMemories, {
|
|
2013
2018
|
n: c
|
|
2014
|
-
}),
|
|
2019
|
+
}), u = `${or(l, t)} ${a}`;
|
|
2015
2020
|
return n.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
|
|
2016
2021
|
"div",
|
|
2017
2022
|
{
|
|
@@ -2023,16 +2028,16 @@ const ir = ({
|
|
|
2023
2028
|
children: t.memorySearchExploreNoResults
|
|
2024
2029
|
}
|
|
2025
2030
|
) }) : /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
|
|
2026
|
-
i.map((
|
|
2031
|
+
i.map((y) => /* @__PURE__ */ o(
|
|
2027
2032
|
tr,
|
|
2028
2033
|
{
|
|
2029
|
-
group:
|
|
2034
|
+
group: y,
|
|
2030
2035
|
t,
|
|
2031
|
-
expanded: s[
|
|
2032
|
-
onToggle: () => m(
|
|
2036
|
+
expanded: s[y.memoryId] === !0,
|
|
2037
|
+
onToggle: () => m(y.memoryId),
|
|
2033
2038
|
onSearchResultClick: r
|
|
2034
2039
|
},
|
|
2035
|
-
|
|
2040
|
+
y.memoryId
|
|
2036
2041
|
)),
|
|
2037
2042
|
/* @__PURE__ */ o(
|
|
2038
2043
|
"div",
|
|
@@ -2043,7 +2048,7 @@ const ir = ({
|
|
|
2043
2048
|
marginTop: "4px",
|
|
2044
2049
|
fontStyle: "italic"
|
|
2045
2050
|
},
|
|
2046
|
-
children:
|
|
2051
|
+
children: u
|
|
2047
2052
|
}
|
|
2048
2053
|
)
|
|
2049
2054
|
] });
|
|
@@ -2052,7 +2057,7 @@ function ar({ item: e }) {
|
|
|
2052
2057
|
return e.error != null ? /* @__PURE__ */ o(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
2053
2058
|
}
|
|
2054
2059
|
function sr(e, r) {
|
|
2055
|
-
return
|
|
2060
|
+
return T(r.searchingInMemoriesOfType, {
|
|
2056
2061
|
name: e.memoryTypeName
|
|
2057
2062
|
});
|
|
2058
2063
|
}
|
|
@@ -2113,14 +2118,14 @@ function lr({
|
|
|
2113
2118
|
shimmerColor: "#000"
|
|
2114
2119
|
}
|
|
2115
2120
|
) : c }),
|
|
2116
|
-
n && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ?
|
|
2121
|
+
n && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? T(
|
|
2117
2122
|
r.memorySearchTypeResultSummaryOne,
|
|
2118
2123
|
{
|
|
2119
2124
|
score: e.result.highestChunkScore.toFixed(
|
|
2120
2125
|
2
|
|
2121
2126
|
)
|
|
2122
2127
|
}
|
|
2123
|
-
) :
|
|
2128
|
+
) : T(
|
|
2124
2129
|
r.memorySearchTypeResultSummary,
|
|
2125
2130
|
{
|
|
2126
2131
|
count: e.result.numberOfChunks,
|
|
@@ -2172,7 +2177,7 @@ const cr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
2172
2177
|
marginTop: "4px",
|
|
2173
2178
|
fontStyle: "italic"
|
|
2174
2179
|
},
|
|
2175
|
-
children:
|
|
2180
|
+
children: T(n.tookSeconds, { n: t })
|
|
2176
2181
|
}
|
|
2177
2182
|
)
|
|
2178
2183
|
] });
|
|
@@ -2201,14 +2206,14 @@ function gr({
|
|
|
2201
2206
|
t: r,
|
|
2202
2207
|
isActiveRow: t
|
|
2203
2208
|
}) {
|
|
2204
|
-
const n = ur(e), l = yr(e), c = e.reasoning, s = c != null && c.length > 0, d =
|
|
2205
|
-
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2209
|
+
const n = ur(e), l = yr(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [m, i] = C(!1), a = n && t, u = l === 2 && t && !N(e);
|
|
2210
|
+
R(() => {
|
|
2211
|
+
const h = d.current;
|
|
2212
|
+
h != null && l === 1 && s && (h.scrollTop = h.scrollHeight);
|
|
2208
2213
|
}, [c, l, s]);
|
|
2209
|
-
const
|
|
2214
|
+
const y = T(r.searchingInMemoriesOfType, {
|
|
2210
2215
|
name: e.memoryTypeName
|
|
2211
|
-
}),
|
|
2216
|
+
}), g = !n && l === 3;
|
|
2212
2217
|
return /* @__PURE__ */ p(
|
|
2213
2218
|
b.div,
|
|
2214
2219
|
{
|
|
@@ -2221,7 +2226,7 @@ function gr({
|
|
|
2221
2226
|
borderBottom: "1px solid #eee",
|
|
2222
2227
|
display: "flex",
|
|
2223
2228
|
flexDirection: "row",
|
|
2224
|
-
alignItems:
|
|
2229
|
+
alignItems: g ? "flex-start" : "center",
|
|
2225
2230
|
gap: "10px",
|
|
2226
2231
|
minWidth: 0
|
|
2227
2232
|
},
|
|
@@ -2235,7 +2240,7 @@ function gr({
|
|
|
2235
2240
|
justifyContent: "center",
|
|
2236
2241
|
flexShrink: 0,
|
|
2237
2242
|
width: 32,
|
|
2238
|
-
...
|
|
2243
|
+
...g ? { paddingTop: 2 } : {}
|
|
2239
2244
|
},
|
|
2240
2245
|
children: /* @__PURE__ */ o(pr, { phase: n ? 1 : l })
|
|
2241
2246
|
}
|
|
@@ -2254,7 +2259,7 @@ function gr({
|
|
|
2254
2259
|
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ o(
|
|
2255
2260
|
I,
|
|
2256
2261
|
{
|
|
2257
|
-
text:
|
|
2262
|
+
text: y,
|
|
2258
2263
|
duration: 2.5,
|
|
2259
2264
|
repeat: !0,
|
|
2260
2265
|
color: "#999",
|
|
@@ -2307,7 +2312,7 @@ function gr({
|
|
|
2307
2312
|
}
|
|
2308
2313
|
)
|
|
2309
2314
|
] }),
|
|
2310
|
-
l === 2 &&
|
|
2315
|
+
l === 2 && u && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
|
|
2311
2316
|
I,
|
|
2312
2317
|
{
|
|
2313
2318
|
text: r.memorySearchGeneratingQueriesPending,
|
|
@@ -2340,7 +2345,7 @@ function gr({
|
|
|
2340
2345
|
flexDirection: "column",
|
|
2341
2346
|
gap: 6
|
|
2342
2347
|
},
|
|
2343
|
-
children: e.queries.map((
|
|
2348
|
+
children: e.queries.map((h, k) => /* @__PURE__ */ o(
|
|
2344
2349
|
"div",
|
|
2345
2350
|
{
|
|
2346
2351
|
style: {
|
|
@@ -2349,7 +2354,7 @@ function gr({
|
|
|
2349
2354
|
lineHeight: 1.5,
|
|
2350
2355
|
wordBreak: "break-word"
|
|
2351
2356
|
},
|
|
2352
|
-
children:
|
|
2357
|
+
children: h.query
|
|
2353
2358
|
},
|
|
2354
2359
|
k
|
|
2355
2360
|
))
|
|
@@ -2361,7 +2366,7 @@ function gr({
|
|
|
2361
2366
|
"button",
|
|
2362
2367
|
{
|
|
2363
2368
|
type: "button",
|
|
2364
|
-
onClick: () => i((
|
|
2369
|
+
onClick: () => i((h) => !h),
|
|
2365
2370
|
style: {
|
|
2366
2371
|
alignSelf: "flex-start",
|
|
2367
2372
|
border: "none",
|
|
@@ -2435,7 +2440,7 @@ const hr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
2435
2440
|
marginTop: "4px",
|
|
2436
2441
|
fontStyle: "italic"
|
|
2437
2442
|
},
|
|
2438
|
-
children:
|
|
2443
|
+
children: T(n.tookSeconds, { n: t })
|
|
2439
2444
|
}
|
|
2440
2445
|
)
|
|
2441
2446
|
] });
|
|
@@ -2457,7 +2462,7 @@ function xr(e, r) {
|
|
|
2457
2462
|
shimmerColor: "#000"
|
|
2458
2463
|
}
|
|
2459
2464
|
) });
|
|
2460
|
-
const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound :
|
|
2465
|
+
const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : T(r.chunksFound, { n: t.numberOfChunks }), l = T(r.scoreLabel, {
|
|
2461
2466
|
n: t.highestChunkScore.toFixed(2)
|
|
2462
2467
|
});
|
|
2463
2468
|
return /* @__PURE__ */ p("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
|
|
@@ -2472,7 +2477,7 @@ function Sr({
|
|
|
2472
2477
|
onExploreQueryResultClick: t,
|
|
2473
2478
|
t: n
|
|
2474
2479
|
}) {
|
|
2475
|
-
const [l, c] =
|
|
2480
|
+
const [l, c] = C(null);
|
|
2476
2481
|
if (e.length === 0)
|
|
2477
2482
|
return /* @__PURE__ */ o(
|
|
2478
2483
|
"div",
|
|
@@ -2500,22 +2505,22 @@ function Sr({
|
|
|
2500
2505
|
children: e.map((d, m) => {
|
|
2501
2506
|
const i = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = K(
|
|
2502
2507
|
d.chunks
|
|
2503
|
-
),
|
|
2508
|
+
), u = [
|
|
2504
2509
|
V(d),
|
|
2505
|
-
|
|
2510
|
+
T(n.scoreLabel, {
|
|
2506
2511
|
n: d.matchingChunkScore.toFixed(2)
|
|
2507
2512
|
}),
|
|
2508
2513
|
a.length > 0 ? q(a, n) : n.pagesNotAvailable
|
|
2509
2514
|
].filter(
|
|
2510
2515
|
(k) => k != null && k !== ""
|
|
2511
|
-
),
|
|
2516
|
+
), y = {
|
|
2512
2517
|
memoryId: d.memoryId,
|
|
2513
2518
|
memoryTitle: d.memoryTitle,
|
|
2514
2519
|
pageNumbers: a,
|
|
2515
2520
|
memoryTypeId: r.memoryTypeId,
|
|
2516
2521
|
memoryTypeName: r.memoryTypeName,
|
|
2517
2522
|
query: r.query
|
|
2518
|
-
},
|
|
2523
|
+
}, g = `${r.query}::${d.memoryId}::${m}`, h = l === g;
|
|
2519
2524
|
return /* @__PURE__ */ p(
|
|
2520
2525
|
"div",
|
|
2521
2526
|
{
|
|
@@ -2576,7 +2581,7 @@ function Sr({
|
|
|
2576
2581
|
color: "#94a3b8",
|
|
2577
2582
|
lineHeight: 1.35
|
|
2578
2583
|
},
|
|
2579
|
-
children:
|
|
2584
|
+
children: u.join(" · ")
|
|
2580
2585
|
}
|
|
2581
2586
|
)
|
|
2582
2587
|
]
|
|
@@ -2586,13 +2591,13 @@ function Sr({
|
|
|
2586
2591
|
"button",
|
|
2587
2592
|
{
|
|
2588
2593
|
type: "button",
|
|
2589
|
-
"aria-busy":
|
|
2590
|
-
disabled:
|
|
2594
|
+
"aria-busy": h,
|
|
2595
|
+
disabled: h,
|
|
2591
2596
|
onClick: async () => {
|
|
2592
|
-
c(
|
|
2597
|
+
c(g);
|
|
2593
2598
|
try {
|
|
2594
2599
|
await t(
|
|
2595
|
-
|
|
2600
|
+
y
|
|
2596
2601
|
);
|
|
2597
2602
|
} finally {
|
|
2598
2603
|
c(null);
|
|
@@ -2608,14 +2613,14 @@ function Sr({
|
|
|
2608
2613
|
background: "#eff6ff",
|
|
2609
2614
|
border: "1px solid #bfdbfe",
|
|
2610
2615
|
borderRadius: 6,
|
|
2611
|
-
cursor:
|
|
2616
|
+
cursor: h ? "wait" : "pointer",
|
|
2612
2617
|
fontFamily: "inherit",
|
|
2613
2618
|
display: "inline-flex",
|
|
2614
2619
|
alignItems: "center",
|
|
2615
2620
|
gap: 8
|
|
2616
2621
|
},
|
|
2617
2622
|
children: [
|
|
2618
|
-
|
|
2623
|
+
h && /* @__PURE__ */ o(
|
|
2619
2624
|
"span",
|
|
2620
2625
|
{
|
|
2621
2626
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
@@ -2706,14 +2711,14 @@ function kr({
|
|
|
2706
2711
|
fontSize: 12,
|
|
2707
2712
|
color: "#888"
|
|
2708
2713
|
},
|
|
2709
|
-
children:
|
|
2714
|
+
children: T(r.memorySearchExploreQueryTypeLabel, {
|
|
2710
2715
|
name: e.memoryTypeName
|
|
2711
2716
|
})
|
|
2712
2717
|
}
|
|
2713
2718
|
),
|
|
2714
2719
|
e.items.map(({ item: i, flatIndex: a }) => {
|
|
2715
|
-
var
|
|
2716
|
-
const
|
|
2720
|
+
var f;
|
|
2721
|
+
const u = i.result != null, y = i.error != null, g = a === t && n && !u && !y, h = l[a] === !0, k = ((f = i.result) == null ? void 0 : f.items) ?? [];
|
|
2717
2722
|
return /* @__PURE__ */ p(
|
|
2718
2723
|
"div",
|
|
2719
2724
|
{
|
|
@@ -2747,7 +2752,7 @@ function kr({
|
|
|
2747
2752
|
flex: "1 1 12rem",
|
|
2748
2753
|
minWidth: 0
|
|
2749
2754
|
},
|
|
2750
|
-
children:
|
|
2755
|
+
children: g ? /* @__PURE__ */ o(
|
|
2751
2756
|
I,
|
|
2752
2757
|
{
|
|
2753
2758
|
text: i.query,
|
|
@@ -2771,7 +2776,7 @@ function kr({
|
|
|
2771
2776
|
},
|
|
2772
2777
|
children: [
|
|
2773
2778
|
xr(i, r),
|
|
2774
|
-
|
|
2779
|
+
u && /* @__PURE__ */ o(
|
|
2775
2780
|
"button",
|
|
2776
2781
|
{
|
|
2777
2782
|
type: "button",
|
|
@@ -2786,7 +2791,7 @@ function kr({
|
|
|
2786
2791
|
textDecoration: "underline",
|
|
2787
2792
|
fontFamily: "inherit"
|
|
2788
2793
|
},
|
|
2789
|
-
children:
|
|
2794
|
+
children: h ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2790
2795
|
}
|
|
2791
2796
|
)
|
|
2792
2797
|
]
|
|
@@ -2795,7 +2800,7 @@ function kr({
|
|
|
2795
2800
|
]
|
|
2796
2801
|
}
|
|
2797
2802
|
),
|
|
2798
|
-
|
|
2803
|
+
u && h && /* @__PURE__ */ o(
|
|
2799
2804
|
Sr,
|
|
2800
2805
|
{
|
|
2801
2806
|
items: k,
|
|
@@ -2823,17 +2828,17 @@ const br = ({
|
|
|
2823
2828
|
onExploreQueryResultClick: n,
|
|
2824
2829
|
t: l
|
|
2825
2830
|
}) => {
|
|
2826
|
-
const [c, s] =
|
|
2831
|
+
const [c, s] = C(
|
|
2827
2832
|
{}
|
|
2828
2833
|
), d = W((a) => {
|
|
2829
|
-
s((
|
|
2830
|
-
...
|
|
2831
|
-
[a]: !
|
|
2834
|
+
s((u) => ({
|
|
2835
|
+
...u,
|
|
2836
|
+
[a]: !u[a]
|
|
2832
2837
|
}));
|
|
2833
2838
|
}, []), m = P(() => {
|
|
2834
2839
|
let a = -1;
|
|
2835
|
-
return e.queries.forEach((
|
|
2836
|
-
|
|
2840
|
+
return e.queries.forEach((u, y) => {
|
|
2841
|
+
u.result == null && u.error == null && (a = y);
|
|
2837
2842
|
}), a;
|
|
2838
2843
|
}, [e.queries]), i = P(
|
|
2839
2844
|
() => Tr(e.queries),
|
|
@@ -2871,12 +2876,12 @@ const br = ({
|
|
|
2871
2876
|
marginTop: "4px",
|
|
2872
2877
|
fontStyle: "italic"
|
|
2873
2878
|
},
|
|
2874
|
-
children:
|
|
2879
|
+
children: T(l.tookSeconds, { n: t })
|
|
2875
2880
|
}
|
|
2876
2881
|
)
|
|
2877
2882
|
] });
|
|
2878
2883
|
}, vr = ({ data: e, onSearchResultClick: r, t }) => {
|
|
2879
|
-
const n = e.response.items, l = !!r, [c, s] =
|
|
2884
|
+
const n = e.response.items, l = !!r, [c, s] = C(null);
|
|
2880
2885
|
return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
|
|
2881
2886
|
/* @__PURE__ */ o(
|
|
2882
2887
|
b.div,
|
|
@@ -2904,21 +2909,21 @@ const br = ({
|
|
|
2904
2909
|
children: n.map((d, m) => {
|
|
2905
2910
|
const i = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = K(
|
|
2906
2911
|
d.chunks
|
|
2907
|
-
),
|
|
2912
|
+
), u = [
|
|
2908
2913
|
V(d),
|
|
2909
|
-
|
|
2914
|
+
T(t.scoreLabel, {
|
|
2910
2915
|
n: d.matchingChunkScore.toFixed(2)
|
|
2911
2916
|
}),
|
|
2912
2917
|
a.length > 0 ? q(a, t) : t.pagesNotAvailable
|
|
2913
2918
|
].filter(
|
|
2914
2919
|
(k) => k != null && k !== ""
|
|
2915
|
-
),
|
|
2920
|
+
), y = {
|
|
2916
2921
|
memoryId: d.memoryId,
|
|
2917
2922
|
memoryTitle: d.memoryTitle,
|
|
2918
2923
|
memoryTypeId: d.memoryTypeId,
|
|
2919
2924
|
memoryTypeName: d.memoryTypeName,
|
|
2920
2925
|
pageNumbers: a
|
|
2921
|
-
},
|
|
2926
|
+
}, g = `${d.memoryId}-${m}`, h = c === g;
|
|
2922
2927
|
return /* @__PURE__ */ p(
|
|
2923
2928
|
b.div,
|
|
2924
2929
|
{
|
|
@@ -2980,7 +2985,7 @@ const br = ({
|
|
|
2980
2985
|
color: "#94a3b8",
|
|
2981
2986
|
lineHeight: 1.35
|
|
2982
2987
|
},
|
|
2983
|
-
children:
|
|
2988
|
+
children: u.join(" · ")
|
|
2984
2989
|
}
|
|
2985
2990
|
)
|
|
2986
2991
|
]
|
|
@@ -2990,12 +2995,12 @@ const br = ({
|
|
|
2990
2995
|
"button",
|
|
2991
2996
|
{
|
|
2992
2997
|
type: "button",
|
|
2993
|
-
"aria-busy":
|
|
2994
|
-
disabled:
|
|
2998
|
+
"aria-busy": h,
|
|
2999
|
+
disabled: h,
|
|
2995
3000
|
onClick: async () => {
|
|
2996
|
-
s(
|
|
3001
|
+
s(g);
|
|
2997
3002
|
try {
|
|
2998
|
-
await r(
|
|
3003
|
+
await r(y);
|
|
2999
3004
|
} finally {
|
|
3000
3005
|
s(null);
|
|
3001
3006
|
}
|
|
@@ -3010,14 +3015,14 @@ const br = ({
|
|
|
3010
3015
|
background: "#eff6ff",
|
|
3011
3016
|
border: "1px solid #bfdbfe",
|
|
3012
3017
|
borderRadius: 6,
|
|
3013
|
-
cursor:
|
|
3018
|
+
cursor: h ? "wait" : "pointer",
|
|
3014
3019
|
fontFamily: "inherit",
|
|
3015
3020
|
display: "inline-flex",
|
|
3016
3021
|
alignItems: "center",
|
|
3017
3022
|
gap: 8
|
|
3018
3023
|
},
|
|
3019
3024
|
children: [
|
|
3020
|
-
|
|
3025
|
+
h && /* @__PURE__ */ o(
|
|
3021
3026
|
"span",
|
|
3022
3027
|
{
|
|
3023
3028
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
@@ -3067,8 +3072,8 @@ const br = ({
|
|
|
3067
3072
|
onSearchResultClick: l,
|
|
3068
3073
|
onExploreQueryResultClick: c
|
|
3069
3074
|
}) => {
|
|
3070
|
-
const s =
|
|
3071
|
-
|
|
3075
|
+
const s = F(null);
|
|
3076
|
+
R(() => {
|
|
3072
3077
|
s.current && (s.current.scrollTop = s.current.scrollHeight);
|
|
3073
3078
|
}, [e.length]);
|
|
3074
3079
|
const d = (i) => {
|
|
@@ -3208,15 +3213,15 @@ const br = ({
|
|
|
3208
3213
|
}
|
|
3209
3214
|
) });
|
|
3210
3215
|
const m = e.filter((i, a) => {
|
|
3211
|
-
const
|
|
3212
|
-
return
|
|
3213
|
-
(
|
|
3214
|
-
) :
|
|
3215
|
-
(
|
|
3216
|
-
) :
|
|
3217
|
-
(
|
|
3218
|
-
) :
|
|
3219
|
-
(
|
|
3216
|
+
const u = i.item.data;
|
|
3217
|
+
return u.taskType === "MemoryChat" && u.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
|
|
3218
|
+
(x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ExploreMemories"
|
|
3219
|
+
) : u.taskType === "MemorySearch" && u.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
|
|
3220
|
+
(x) => x.item.data.taskType === "MemorySearch" && x.item.data.eventType === "GeneratingQueries"
|
|
3221
|
+
) : u.taskType === "MemorySearch" && u.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
|
|
3222
|
+
(x) => x.item.data.taskType === "MemorySearch" && x.item.data.eventType === "ExploreQueries"
|
|
3223
|
+
) : u.taskType === "MemoryChat" && u.eventType === "ChunkResults" ? !e.slice(a + 1).some(
|
|
3224
|
+
(x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ChunkResults"
|
|
3220
3225
|
) : !0;
|
|
3221
3226
|
});
|
|
3222
3227
|
return /* @__PURE__ */ o("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ o(re, { children: m.map((i, a) => /* @__PURE__ */ o(
|
|
@@ -3266,6 +3271,7 @@ export {
|
|
|
3266
3271
|
L as Checkmark,
|
|
3267
3272
|
Dr as FencyProvider,
|
|
3268
3273
|
vr as MemorySearchCompletedResults,
|
|
3274
|
+
Ee as StreamEventManager,
|
|
3269
3275
|
U as XMark,
|
|
3270
3276
|
Lr as useAgentTasks
|
|
3271
3277
|
};
|