@redocly/replay 0.27.0-next.8 → 0.27.0
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/{replay-AiChatProvider-DHIxHTKX.js → replay-AiChatProvider-LQhrLIDL.js} +44 -44
- package/dist/{replay-AiChatProvider-O8HHQobN.js → replay-AiChatProvider-Oms5CFgT.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-DNMrzkJg.js → replay-AiChatSqliteDBStorage-3-p1mthX.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-DjUq9VX3.js → replay-AiChatSqliteDBStorage-GZibdHOQ.js} +1 -1
- package/dist/replay-AiPanel-BvwwBTh1.js +742 -0
- package/dist/{replay-AiPanel-CR815YqV.js → replay-AiPanel-lcDNvgo0.js} +973 -1176
- package/dist/replay-FileWatcher-ClVd_wG0.js +1 -0
- package/dist/replay-FileWatcher-DR-wJLe2.js +343 -0
- package/dist/replay-Observable-D6wKbFwB.js +31 -0
- package/dist/replay-Observable-bjJ6wkRB.js +1 -0
- package/dist/replay-SemanticSearchService-CCqwCRo6.js +1 -0
- package/dist/replay-SemanticSearchService-U1eXQGfF.js +723 -0
- package/dist/{replay-SqliteDBStorage-B3oYWXem.js → replay-SqliteDBStorage-Dn6DoVWW.js} +1 -1
- package/dist/{replay-SqliteDBStorage-CC9kLioX.js → replay-SqliteDBStorage-d_ZK6ScA.js} +1 -1
- package/dist/replay-TauriFileSystemAdapter-CpiUuG3T.js +99 -0
- package/dist/replay-TauriFileSystemAdapter-dwJ0xBYr.js +1 -0
- package/dist/replay-TauriRootStorage-CuVbYMXX.js +605 -0
- package/dist/replay-TauriRootStorage-DhzbAahU.js +1 -0
- package/dist/{replay-agent-loop-CTq5eJ4u.js → replay-agent-loop-BLSu4v_O.js} +1 -1
- package/dist/{replay-agent-loop-CCYOzyHo.js → replay-agent-loop-DgEHdXUt.js} +11 -11
- package/dist/{replay-ai-chat-mappers-C8y5UhCq.js → replay-ai-chat-mappers-BvfcEubB.js} +5 -5
- package/dist/{replay-ai-chat-mappers-B_wovMvG.js → replay-ai-chat-mappers-Dy2kJ7ZG.js} +1 -1
- package/dist/replay-core-BJmXmoC5.js +1 -0
- package/dist/replay-core-B_hiOZZr.js +10 -0
- package/dist/{replay-create-model-C5yvtnXA.js → replay-create-model-DNPFcOIp.js} +579 -578
- package/dist/{replay-create-model-CBCmuEKC.js → replay-create-model-bOIDB-e8.js} +10 -10
- package/dist/{replay-db-CCBQadnT.js → replay-db-BQGv3PGw.js} +1 -1
- package/dist/{replay-db-DfOjLqsq.js → replay-db-CMXZZs9v.js} +1 -1
- package/dist/{replay-external-resolver-BRouROm6.js → replay-external-resolver-mrykFC2h.js} +2 -2
- package/dist/{replay-external-resolver-B6tpqUZt.js → replay-external-resolver-n5OvQMRF.js} +1 -1
- package/dist/replay-index-3lwhSmvi.js +1 -0
- package/dist/{replay-index-BzzBKjHm.js → replay-index-Bc5RHu5L.js} +23771 -25420
- package/dist/replay-index-CFLu-XMV.js +25 -0
- package/dist/{replay-index-Xq6K7XSm.js → replay-index-CHGVyIdG.js} +1 -1
- package/dist/{replay-index-Cpkh9r0X.js → replay-index-CSR_qlua.js} +1 -1
- package/dist/replay-index-CepJ5Z0m.js +6875 -0
- package/dist/{replay-index-Bzttek8l.js → replay-index-CgCGhu4l.js} +6 -6
- package/dist/replay-index-DDjmUXWm.js +1 -0
- package/dist/replay-index-DiSy_1OY.js +21 -0
- package/dist/replay-index-Oct6Dygd.js +1 -0
- package/dist/{replay-index-B_OHqSlS.js → replay-index-QXosJxRc.js} +18 -18
- package/dist/replay-index-jkDlU0Lx.js +32 -0
- package/dist/{replay-lint-gtuMJgII.js → replay-lint-DoHQIATV.js} +122 -122
- package/dist/{replay-lint-DlDmPTBV.js → replay-lint-PWaLESz5.js} +8921 -8880
- package/dist/{replay-lint-graphql-DHOq8lRT.js → replay-lint-graphql-xh8VoAwd.js} +1 -1
- package/dist/{replay-lint-graphql-BQJ00lU4.js → replay-lint-graphql-zO8zunug.js} +1 -1
- package/dist/replay-periodic-revalidation-BoyLQHtg.js +1 -0
- package/dist/replay-periodic-revalidation-Dsp-n7ui.js +21 -0
- package/dist/replay-promise-map-limit-DRDkHc-b.js +1 -0
- package/dist/replay-promise-map-limit-Db_42GvV.js +14 -0
- package/dist/replay-resolve-B0AjmaE9.js +47 -0
- package/dist/{replay-resolve-DsgcWnjC.js → replay-resolve-MVe_8Ube.js} +1364 -1329
- package/dist/{replay-respect-run-7Cwe1_ri.js → replay-respect-run-BJsR4a4m.js} +1 -1
- package/dist/{replay-respect-run-D1zyh-5j.js → replay-respect-run-X4PSO6Fj.js} +3 -3
- package/dist/{replay-tauri-path-BAY3g5sW.js → replay-tauri-path-CkGiQWsb.js} +5 -5
- package/dist/{replay-tauri-path-CaVeI3a-.js → replay-tauri-path-D8FJsoZb.js} +1 -1
- package/dist/replay-useAiChatQueries-BXL-_N2Q.js +215 -0
- package/dist/{replay-useAiChatQueries-CxZNLVje.js → replay-useAiChatQueries-D7sHNAfV.js} +1078 -1022
- package/dist/{replay-validate-key-Cv0mvYDS.js → replay-validate-key-CmzSfORv.js} +1 -1
- package/dist/{replay-validate-key-Di8MCBz7.js → replay-validate-key-CtZEJRP7.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +11 -11
- package/package.json +10 -9
- package/dist/replay-AiPanel-CfYBCkrN.js +0 -868
- package/dist/replay-index-C6SJPGDO.js +0 -23
- package/dist/replay-index-CUs62_1f.js +0 -1
- package/dist/replay-index-Dfnqt_IZ.js +0 -6899
- package/dist/replay-resolve-DqFS69S_.js +0 -47
- package/dist/replay-useAiChatQueries-D99tAUpY.js +0 -215
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as te } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as R, useCallback as f, useSyncExternalStore as re, useEffect as b, useMemo as w, useState as z } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { A as Qe, D as Ve, l as Ge } from "./replay-create-model-
|
|
5
|
-
import { AgentLoop as He } from "./replay-agent-loop-
|
|
6
|
-
import { s as ze } from "./replay-db-
|
|
7
|
-
import { r as Ye, g as Je, a as Xe, o as Ze, s as et, w as tt, m as nt, b as st, u as rt, c as ot, d as at, e as it, f as lt, h as ct, i as ut, A as dt, j as ht, k as pt } from "./replay-useAiChatQueries-
|
|
3
|
+
import { f as S, A as ce, g as Re, I as xe, T as $e, h as x, j as Pe, k as De, u as Te, m as We, o as Be, p as Oe, q as Ue, s as Ae, v as se, w as ue, x as ye, z as Fe, B as Le, C as Se, D as ge, E as je, F as ne, G as Ne, H as ae, J as Ke, K as qe } from "./replay-index-Bc5RHu5L.js";
|
|
4
|
+
import { A as Qe, D as Ve, l as Ge } from "./replay-create-model-DNPFcOIp.js";
|
|
5
|
+
import { AgentLoop as He } from "./replay-agent-loop-DgEHdXUt.js";
|
|
6
|
+
import { s as ze } from "./replay-db-CMXZZs9v.js";
|
|
7
|
+
import { r as Ye, g as Je, a as Xe, o as Ze, s as et, w as tt, m as nt, b as st, u as rt, c as ot, d as at, e as it, f as lt, h as ct, i as ut, A as dt, j as ht, k as pt } from "./replay-useAiChatQueries-D7sHNAfV.js";
|
|
8
8
|
import { useQueryClient as de, useMutation as he } from "@tanstack/react-query";
|
|
9
|
-
import { b as be, g as me } from "./replay-ai-chat-mappers-
|
|
9
|
+
import { b as be, g as me } from "./replay-ai-chat-mappers-BvfcEubB.js";
|
|
10
10
|
class ft {
|
|
11
11
|
handlers = /* @__PURE__ */ new Map();
|
|
12
12
|
middlewares;
|
|
@@ -138,14 +138,14 @@ function vt() {
|
|
|
138
138
|
}
|
|
139
139
|
var wt = /* @__PURE__ */ vt();
|
|
140
140
|
const Ct = /* @__PURE__ */ Re(wt);
|
|
141
|
-
var
|
|
141
|
+
var Ee = (e, t, n) => {
|
|
142
142
|
if (!t.has(e))
|
|
143
143
|
throw TypeError("Cannot " + n);
|
|
144
|
-
}, d = (e, t, n) => (
|
|
144
|
+
}, d = (e, t, n) => (Ee(e, t, "read from private field"), n ? n.call(e) : t.get(e)), A = (e, t, n) => {
|
|
145
145
|
if (t.has(e))
|
|
146
146
|
throw TypeError("Cannot add the same private member more than once");
|
|
147
147
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
148
|
-
}, _ = (e, t, n, s) => (
|
|
148
|
+
}, _ = (e, t, n, s) => (Ee(e, t, "write to private field"), t.set(e, n), n);
|
|
149
149
|
function It(e, t) {
|
|
150
150
|
return t != null ? Ct(e, t) : e;
|
|
151
151
|
}
|
|
@@ -322,7 +322,7 @@ function bt(e) {
|
|
|
322
322
|
].filter(Boolean).join(" ");
|
|
323
323
|
}
|
|
324
324
|
const kt = 30;
|
|
325
|
-
function
|
|
325
|
+
function Et(e) {
|
|
326
326
|
if (e.length === 0)
|
|
327
327
|
return "No Arazzo collections loaded.";
|
|
328
328
|
const t = [`Arazzo collections (${e.length}):`];
|
|
@@ -332,7 +332,7 @@ function Mt(e) {
|
|
|
332
332
|
s += a.workflows.length, o++;
|
|
333
333
|
continue;
|
|
334
334
|
}
|
|
335
|
-
if (t.push(
|
|
335
|
+
if (t.push(Mt(a)), n--, a.workflows.length === 0)
|
|
336
336
|
t.push(" (no workflows)");
|
|
337
337
|
else if (n >= 2) {
|
|
338
338
|
t.push(` workflows (${a.workflows.length}):`), n--;
|
|
@@ -348,7 +348,7 @@ function Mt(e) {
|
|
|
348
348
|
return r.length > 0 && t.push(` …and ${r.join(", plus ")} not shown.`), t.join(`
|
|
349
349
|
`);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Mt(e) {
|
|
352
352
|
const t = e.sourceApiIds.length > 0 ? ` apis=[${e.sourceApiIds.join(", ")}]` : "";
|
|
353
353
|
return ` collectionId="${e.collectionId}" title="${e.title}"${t}`;
|
|
354
354
|
}
|
|
@@ -413,7 +413,7 @@ function Ot(e) {
|
|
|
413
413
|
t,
|
|
414
414
|
St(e.apis),
|
|
415
415
|
t,
|
|
416
|
-
|
|
416
|
+
Et(e.collections),
|
|
417
417
|
t,
|
|
418
418
|
xt(e.environments)
|
|
419
419
|
].join("");
|
|
@@ -455,13 +455,13 @@ function Nt(e) {
|
|
|
455
455
|
serverCount: s.servers.length
|
|
456
456
|
}));
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Kt(e) {
|
|
459
459
|
const t = e.tabsState.tabs.get({ noproxy: !0 }), n = e.tabsState.activeTabIdx.get({ noproxy: !0 });
|
|
460
460
|
return t.map(
|
|
461
|
-
(s, o) =>
|
|
461
|
+
(s, o) => qt(e, s, o, o === n)
|
|
462
462
|
);
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function qt(e, t, n, s) {
|
|
465
465
|
const o = {
|
|
466
466
|
tabIndex: n,
|
|
467
467
|
type: t.data.type,
|
|
@@ -521,7 +521,7 @@ function Vt(e) {
|
|
|
521
521
|
}
|
|
522
522
|
function Gt(e) {
|
|
523
523
|
return {
|
|
524
|
-
tabs:
|
|
524
|
+
tabs: Kt(e),
|
|
525
525
|
apis: Ut(e),
|
|
526
526
|
collections: Lt(e),
|
|
527
527
|
environments: Nt(e)
|
|
@@ -638,19 +638,19 @@ function Xt(e) {
|
|
|
638
638
|
]) };
|
|
639
639
|
}
|
|
640
640
|
function Zt(e) {
|
|
641
|
-
const { children: t, chatId: n, model: s, initialMessages: o, onChatFinish: r, onChatMessagesUpdated: a } = e, i = ue(), { getReuniteAuth: l } = se(), { tools: u } = Xt(s), { sendEvent: C } = Le(), I = R(u), c = R(s), { isOpen: p, openPanel: h, closePanel: $ } = Se(), P = R(void 0),
|
|
642
|
-
I.current = u, c.current = s, y.current =
|
|
641
|
+
const { children: t, chatId: n, model: s, initialMessages: o, onChatFinish: r, onChatMessagesUpdated: a } = e, i = ue(), { getReuniteAuth: l } = se(), { tools: u } = Xt(s), { sendEvent: C } = Le(), I = R(u), c = R(s), { isOpen: p, openPanel: h, closePanel: $ } = Se(), P = R(void 0), K = ye(), y = R(K);
|
|
642
|
+
I.current = u, c.current = s, y.current = K;
|
|
643
643
|
const m = w(() => {
|
|
644
644
|
P.current?.end();
|
|
645
|
-
const
|
|
646
|
-
P.current =
|
|
647
|
-
const
|
|
645
|
+
const E = ge.getTracer("replay-ai-chat").startSpan("ai.chat.session", { attributes: { conversation_id: n } });
|
|
646
|
+
P.current = E;
|
|
647
|
+
const M = ge.setSpan(je.active(), E);
|
|
648
648
|
return new He({
|
|
649
649
|
activeConversationId: n,
|
|
650
650
|
model: c.current,
|
|
651
651
|
tools: I.current,
|
|
652
652
|
sendEvent: C,
|
|
653
|
-
parentCtx:
|
|
653
|
+
parentCtx: M,
|
|
654
654
|
getActiveStateMessage: () => Ot(Gt(y.current))
|
|
655
655
|
});
|
|
656
656
|
}, [n, C]);
|
|
@@ -667,7 +667,7 @@ function Zt(e) {
|
|
|
667
667
|
const {
|
|
668
668
|
messages: k,
|
|
669
669
|
setMessages: D,
|
|
670
|
-
sendMessage:
|
|
670
|
+
sendMessage: q,
|
|
671
671
|
status: W,
|
|
672
672
|
error: Y,
|
|
673
673
|
stop: B,
|
|
@@ -677,18 +677,18 @@ function Zt(e) {
|
|
|
677
677
|
messages: o,
|
|
678
678
|
transport: F,
|
|
679
679
|
sendAutomaticallyWhen: Ge,
|
|
680
|
-
onFinish(
|
|
680
|
+
onFinish(E) {
|
|
681
681
|
if (!r || !m) return;
|
|
682
|
-
r({ agentLoop: m, chat: this },
|
|
682
|
+
r({ agentLoop: m, chat: this }, E);
|
|
683
683
|
}
|
|
684
684
|
}), U = w(() => W === "streaming" || W === "submitted", [W]), Q = f(() => {
|
|
685
685
|
i.aiEnabled.get() === !0 && h();
|
|
686
686
|
}, [h, i.aiEnabled]), J = f(() => {
|
|
687
687
|
$();
|
|
688
688
|
}, [$]), g = f(
|
|
689
|
-
async (
|
|
690
|
-
const
|
|
691
|
-
if (!(!
|
|
689
|
+
async (E) => {
|
|
690
|
+
const M = E.trim();
|
|
691
|
+
if (!(!M || !F)) {
|
|
692
692
|
if (s.provider === ne) {
|
|
693
693
|
const T = await l?.();
|
|
694
694
|
T?.baseUrl && T?.accessToken && m.setModel({
|
|
@@ -699,10 +699,10 @@ function Zt(e) {
|
|
|
699
699
|
}
|
|
700
700
|
D(
|
|
701
701
|
(T) => ct(T) ? ut(T) : T
|
|
702
|
-
),
|
|
702
|
+
), q({ text: M });
|
|
703
703
|
}
|
|
704
704
|
},
|
|
705
|
-
[m, l, s.provider,
|
|
705
|
+
[m, l, s.provider, q, D, F]
|
|
706
706
|
), L = f(() => {
|
|
707
707
|
U && B();
|
|
708
708
|
}, [U, B]);
|
|
@@ -710,14 +710,14 @@ function Zt(e) {
|
|
|
710
710
|
B();
|
|
711
711
|
}, [n, B]);
|
|
712
712
|
const pe = f(
|
|
713
|
-
(
|
|
714
|
-
const
|
|
715
|
-
for (const X of
|
|
713
|
+
(E) => {
|
|
714
|
+
const M = E(k), T = M.map((X) => X.message), fe = [...k];
|
|
715
|
+
for (const X of M)
|
|
716
716
|
fe[X.index] = X.message;
|
|
717
717
|
D(fe), a?.(T);
|
|
718
718
|
},
|
|
719
719
|
[k, a, D]
|
|
720
|
-
),
|
|
720
|
+
), Me = w(
|
|
721
721
|
() => ({
|
|
722
722
|
messages: k,
|
|
723
723
|
isStreaming: U,
|
|
@@ -746,7 +746,7 @@ function Zt(e) {
|
|
|
746
746
|
}),
|
|
747
747
|
[p, Q, J]
|
|
748
748
|
);
|
|
749
|
-
return /* @__PURE__ */ te(dt.Provider, { value:
|
|
749
|
+
return /* @__PURE__ */ te(dt.Provider, { value: Me, children: /* @__PURE__ */ te(Ne.Provider, { value: _e, children: t }) });
|
|
750
750
|
}
|
|
751
751
|
function en(e) {
|
|
752
752
|
return e.slice(-2);
|
|
@@ -921,19 +921,19 @@ function An(e) {
|
|
|
921
921
|
r(g), s(g);
|
|
922
922
|
}, []), p = f((g) => {
|
|
923
923
|
r(g);
|
|
924
|
-
}, []), { data: h } = pt(o), $ = hn(), P = an(u.aiProviders), { selectedModelId:
|
|
924
|
+
}, []), { data: h } = pt(o), $ = hn(), P = an(u.aiProviders), { selectedModelId: K, model: y, selectModel: m } = dn({
|
|
925
925
|
availableModels: P,
|
|
926
926
|
aiProviders: u.aiProviders,
|
|
927
927
|
reuniteAuth: $
|
|
928
|
-
}), F = mt(), k = rn({ chatId: n, model: y }), D = on({ chatId: n, model: y }),
|
|
928
|
+
}), F = mt(), k = rn({ chatId: n, model: y }), D = on({ chatId: n, model: y }), q = sn({
|
|
929
929
|
chatId: n,
|
|
930
930
|
model: y,
|
|
931
931
|
existingTitle: h?.title
|
|
932
932
|
}), W = f(
|
|
933
933
|
(g, L) => {
|
|
934
|
-
L.isAbort || (k(g, L),
|
|
934
|
+
L.isAbort || (k(g, L), q(g, L));
|
|
935
935
|
},
|
|
936
|
-
[k,
|
|
936
|
+
[k, q]
|
|
937
937
|
), Y = f(
|
|
938
938
|
(...g) => {
|
|
939
939
|
D(...g);
|
|
@@ -960,10 +960,10 @@ function An(e) {
|
|
|
960
960
|
chatId: n,
|
|
961
961
|
model: y,
|
|
962
962
|
availableModels: P,
|
|
963
|
-
selectedModelId:
|
|
963
|
+
selectedModelId: K,
|
|
964
964
|
selectModel: m,
|
|
965
965
|
onSettingsOpen: u.onSettingsOpen,
|
|
966
|
-
title: h?.title ??
|
|
966
|
+
title: h?.title ?? Ke.title,
|
|
967
967
|
isLoading: I,
|
|
968
968
|
selectChat: p,
|
|
969
969
|
removeChat: B,
|
|
@@ -984,12 +984,12 @@ function An(e) {
|
|
|
984
984
|
Q,
|
|
985
985
|
a,
|
|
986
986
|
U,
|
|
987
|
-
|
|
987
|
+
K,
|
|
988
988
|
m,
|
|
989
989
|
u.onSettingsOpen
|
|
990
990
|
]
|
|
991
991
|
);
|
|
992
|
-
return /* @__PURE__ */ te(
|
|
992
|
+
return /* @__PURE__ */ te(qe.Provider, { value: J, children: /* @__PURE__ */ te(
|
|
993
993
|
Zt,
|
|
994
994
|
{
|
|
995
995
|
chatId: n,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react/jsx-runtime"),i=require("react"),a=require("./replay-index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react/jsx-runtime"),i=require("react"),a=require("./replay-index-CepJ5Z0m.js"),te=require("./replay-create-model-bOIDB-e8.js"),pe=require("./replay-agent-loop-BLSu4v_O.js"),ge=require("./replay-db-BQGv3PGw.js"),m=require("./replay-useAiChatQueries-BXL-_N2Q.js"),F=require("@tanstack/react-query"),Z=require("./replay-ai-chat-mappers-Dy2kJ7ZG.js");class Ce{handlers=new Map;middlewares;constructor(t){this.middlewares=t?.middlewares??[]}register(t){this.handlers.set(t.name,t)}getToolSet(){const t={};for(const[n,s]of this.handlers)t[n]=this.buildTool(s);return t}buildTool(t){return{...t.definition,execute:this.wrapExecutor(t)}}wrapExecutor(t){const n=(o,r)=>({isError:!0,error:{message:o,details:r}}),s=this.applyMiddlewares(t.name,t.execute);return(o,r)=>{if(r.abortSignal?.aborted)return n("Tool execution was aborted.");try{const l=s(o,r);return typeof l=="object"&&l!==null&&"then"in l?l.then(c=>c,c=>n(c instanceof Error?c.message:"Unknown tool execution error")):l}catch(l){return n(l instanceof Error?l.message:"Unknown tool execution error")}}}applyMiddlewares(t,n){return this.middlewares.length===0?n:this.middlewares.reduceRight((s,o)=>o(t,s),n)}}function ue(){const e=F.useQueryClient();return F.useMutation({async mutationFn(t){const n=Z.buildPersistableUiChat(t);await a.AiChatServiceFactory.getInstance().upsert(n)},onSuccess(){e.invalidateQueries({queryKey:a.aiChatKeys.all()})},onError(t){console.error("Failed to upsert ai chat item:",t)}})}function me(e){const t=F.useQueryClient(),n=a.aiChatKeys.detailTitle(e??"");return F.useMutation({mutationKey:n,async mutationFn(s){if(t.isMutating({mutationKey:n,exact:!0})>1)return;const o=Z.buildPersistableUiChat(s);await a.AiChatServiceFactory.getInstance().upsert(o)},onSuccess(){t.invalidateQueries({queryKey:a.aiChatKeys.all()})},onError(s){console.error("Failed to upsert ai chat item:",s)}})}function ve(){const e=F.useQueryClient();return F.useMutation({async mutationFn(t){await a.AiChatServiceFactory.getInstance().remove(t)},onMutate:async t=>{await e.cancelQueries({queryKey:a.aiChatKeys.all()});const n=e.getQueryData(a.aiChatKeys.all());n&&e.setQueryData(a.aiChatKeys.all(),n.filter(s=>s.id!==t)),e.setQueryData(a.aiChatKeys.detail(t),null),e.setQueriesData({queryKey:a.aiChatKeys.infiniteHistories()},s=>s&&{...s,pages:s.pages.map(o=>({...o,items:o.items.filter(r=>r.id!==t)}))})},onError(t){console.error("Failed to remove ai chat:",t)},onSettled(){e.invalidateQueries({queryKey:a.aiChatKeys.all()})}})}var ee,ae;function we(){if(ae)return ee;ae=1;function e(t,n){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let s,o=0;return function(...l){clearTimeout(s);const c=Date.now(),u=c-o,h=n-u;h<=0?(o=c,t.apply(this,l)):s=setTimeout(()=>{o=Date.now(),t.apply(this,l)},h)}}return ee=e,ee}var Ie=we();const Te=a.getDefaultExportFromCjs(Ie);var de=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},f=(e,t,n)=>(de(e,t,"read from private field"),n?n.call(e):t.get(e)),b=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},M=(e,t,n,s)=>(de(e,t,"write to private field"),t.set(e,n),n);function ye(e,t){return t!=null?Te(e,t):e}var w,Y,J,j,Q,V,B,ne,se,be=class{constructor(e=[]){b(this,w,void 0),b(this,Y,"ready"),b(this,J,void 0),b(this,j,new Set),b(this,Q,new Set),b(this,V,new Set),this.pushMessage=t=>{M(this,w,f(this,w).concat(t)),f(this,B).call(this)},this.popMessage=()=>{M(this,w,f(this,w).slice(0,-1)),f(this,B).call(this)},this.replaceMessage=(t,n)=>{M(this,w,[...f(this,w).slice(0,t),this.snapshot(n),...f(this,w).slice(t+1)]),f(this,B).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,n)=>{const s=n?ye(t,n):t;return f(this,j).add(s),()=>{f(this,j).delete(s)}},this["~registerStatusCallback"]=t=>(f(this,Q).add(t),()=>{f(this,Q).delete(t)}),this["~registerErrorCallback"]=t=>(f(this,V).add(t),()=>{f(this,V).delete(t)}),b(this,B,()=>{f(this,j).forEach(t=>t())}),b(this,ne,()=>{f(this,Q).forEach(t=>t())}),b(this,se,()=>{f(this,V).forEach(t=>t())}),M(this,w,e)}get status(){return f(this,Y)}set status(e){M(this,Y,e),f(this,ne).call(this)}get error(){return f(this,J)}set error(e){M(this,J,e),f(this,se).call(this)}get messages(){return f(this,w)}set messages(e){M(this,w,[...e]),f(this,B).call(this)}};w=new WeakMap;Y=new WeakMap;J=new WeakMap;j=new WeakMap;Q=new WeakMap;V=new WeakMap;B=new WeakMap;ne=new WeakMap;se=new WeakMap;var L,ie=class extends te.AbstractChat{constructor({messages:e,...t}){const n=new be(e);super({...t,state:n}),b(this,L,void 0),this["~registerMessagesCallback"]=(s,o)=>f(this,L)["~registerMessagesCallback"](s,o),this["~registerStatusCallback"]=s=>f(this,L)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>f(this,L)["~registerErrorCallback"](s),M(this,L,n)}};L=new WeakMap;function Se({experimental_throttle:e,resume:t=!1,...n}={}){const s=i.useRef("chat"in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});"chat"in n||(s.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});const o={...n,onToolCall:d=>{var g,p;return(p=(g=s.current).onToolCall)==null?void 0:p.call(g,d)},onData:d=>{var g,p;return(p=(g=s.current).onData)==null?void 0:p.call(g,d)},onFinish:d=>{var g,p;return(p=(g=s.current).onFinish)==null?void 0:p.call(g,d)},onError:d=>{var g,p;return(p=(g=s.current).onError)==null?void 0:p.call(g,d)},sendAutomaticallyWhen:d=>{var g,p,R;return(R=(p=(g=s.current).sendAutomaticallyWhen)==null?void 0:p.call(g,d))!=null?R:!1}},r=i.useRef("chat"in n?n.chat:new ie(o));("chat"in n&&n.chat!==r.current||"id"in n&&n.id!=null&&r.current.id!==n.id)&&(r.current="chat"in n?n.chat:new ie(o));const c=i.useCallback(d=>r.current["~registerMessagesCallback"](d,e),[e,r.current.id]),u=i.useSyncExternalStore(c,()=>r.current.messages,()=>r.current.messages),h=i.useSyncExternalStore(r.current["~registerStatusCallback"],()=>r.current.status,()=>r.current.status),I=i.useSyncExternalStore(r.current["~registerErrorCallback"],()=>r.current.error,()=>r.current.error),T=i.useCallback(d=>{typeof d=="function"&&(d=d(r.current.messages)),r.current.messages=d},[r]);return i.useEffect(()=>{t&&r.current.resumeStream()},[t,r]),{id:r.current.id,messages:u,setMessages:T,sendMessage:r.current.sendMessage,regenerate:r.current.regenerate,clearError:r.current.clearError,stop:r.current.stop,error:I,resumeStream:r.current.resumeStream,status:h,addToolResult:r.current.addToolOutput,addToolOutput:r.current.addToolOutput,addToolApprovalResponse:r.current.addToolApprovalResponse}}const Ae=20;function ke(e){if(e.length===0)return"No OpenAPI specs loaded.";const t=e.slice(0,Ae),n=t.map(Ee),s=e.length-t.length;return s>0&&n.push(` …and ${s} more API(s) not shown.`),[`Loaded APIs (${e.length}):`,...n].join(`
|
|
2
2
|
`)}function Ee(e){return[` apiId="${e.apiId}"`,`title="${e.title}"`,e.version?`version="${e.version}"`:null,e.primaryServer?`server="${e.primaryServer}"`:null].filter(Boolean).join(" ")}const Me=30;function Re(e){if(e.length===0)return"No Arazzo collections loaded.";const t=[`Arazzo collections (${e.length}):`];let n=Me,s=0,o=0;for(const l of e){if(n<=0){s+=l.workflows.length,o++;continue}if(t.push(_e(l)),n--,l.workflows.length===0)t.push(" (no workflows)");else if(n>=2){t.push(` workflows (${l.workflows.length}):`),n--;for(const c of l.workflows)n>0?(t.push(` ${xe(c)}`),n--):s++}else s+=l.workflows.length}const r=[s>0?`${s} more workflow(s)`:null,o>0?`${o} more collection(s)`:null].filter(Boolean);return r.length>0&&t.push(` …and ${r.join(", plus ")} not shown.`),t.join(`
|
|
3
3
|
`)}function _e(e){const t=e.sourceApiIds.length>0?` apis=[${e.sourceApiIds.join(", ")}]`:"";return` collectionId="${e.collectionId}" title="${e.title}"${t}`}function xe(e){const t=`id="${e.workflowId}"`,n=e.summary?`label="${e.summary}"`:null,s=`[${e.stepCount} step${e.stepCount!==1?"s":""}]`;return[t,n,s].filter(Boolean).join(" ")}const Pe=20;function De(e){if(e.length===0)return"No environments configured.";const t=e.slice(0,Pe),n=t.map($e),s=e.length-t.length;return s>0&&n.push(` …and ${s} more environment(s) not shown.`),[`Environments (${e.length}); * marks the active environment:`,...n].join(`
|
|
4
4
|
`)}function $e(e){return[`${e.isActive?"*":" "} name="${e.name}"`,`inputs=${e.inputCount}`,`servers=${e.serverCount}`].join(" ")}const Oe=30;function We(e){if(e.length===0)return"No tabs are open.";const t=e.slice(0,Oe),n=t.map(Ue),s=e.length-t.length;return s>0&&n.push(` …and ${s} more tab(s) not shown.`),[`Open tabs (${e.length}), listed by tabIndex; * marks the active (focused) tab:`,...n].join(`
|
package/dist/{replay-AiChatSqliteDBStorage-DNMrzkJg.js → replay-AiChatSqliteDBStorage-3-p1mthX.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./replay-history.schema-5ce6X0R1.js";
|
|
2
2
|
import "./replay-step-context.schema-DBk4jufr.js";
|
|
3
3
|
import { a as h, b as r, c as n } from "./replay-ai-message-parts.schema-E9u9-nqr.js";
|
|
4
|
-
import { c, a as u, d as m } from "./replay-ai-chat-mappers-
|
|
4
|
+
import { c, a as u, d as m } from "./replay-ai-chat-mappers-BvfcEubB.js";
|
|
5
5
|
import { a as l, e, b as y } from "./replay-indexes-CfsvVMi_.js";
|
|
6
6
|
const g = {
|
|
7
7
|
orderBy: [l(r.createdAt), l(r.indexWithinInsertBatch)],
|
package/dist/{replay-AiChatSqliteDBStorage-DjUq9VX3.js → replay-AiChatSqliteDBStorage-GZibdHOQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./replay-history.schema-miM3Etuf.js");require("./replay-step-context.schema-BuuXkAck.js");const i=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),h=require("./replay-ai-chat-mappers-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./replay-history.schema-miM3Etuf.js");require("./replay-step-context.schema-BuuXkAck.js");const i=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),h=require("./replay-ai-chat-mappers-Dy2kJ7ZG.js"),s=require("./replay-indexes-Dqjl8m6C.js"),c={orderBy:[s.asc(i.aiMessages.createdAt),s.asc(i.aiMessages.indexWithinInsertBatch)],with:{parts:{orderBy:[s.asc(i.aiMessageParts.index)]}}};class g{constructor(e){this.sqliteDB=e}sqliteDB;async findAll(){return await this.initialize(),(await this.db.query.aiChats.findMany({with:{messages:c}})).map(h.convertAiChatRowToUiChat)}async findRecentChatsPage(e){await this.initialize();const a=e.limit+1,r=await this.db.query.aiChats.findMany({orderBy:(d,{desc:o})=>o(d.updatedAt),limit:a,offset:e.offset}),t=r.slice(0,e.limit),n=r.length>e.limit,w=e.offset+t.length;return{items:t.map(d=>{const o={...d,messages:[]};return h.convertAiChatRowToUiChat(o)}),hasMore:n,nextOffset:w}}async findOne(e){await this.initialize();const a=await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,e),with:{messages:c}});return a&&h.convertAiChatRowToUiChat(a)}async upsert(e){await this.initialize();const a=h.convertUiChatToAiChatRow(e);await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,a.id),columns:{id:!0}})?await this.db.update(i.aiChats).set(a).where(s.eq(i.aiChats.id,a.id)):await this.db.insert(i.aiChats).values(a);for(let t=0;t<e.messages.length;t++)await this.upsertMessageRowAndParts(e.id,t,e.messages[t])}async remove(e){await this.initialize(),await this.db.delete(i.aiChats).where(s.eq(i.aiChats.id,e))}async upsertMessageRowAndParts(e,a,r){const t=await this.db.query.aiMessages.findFirst({where:s.and(s.eq(i.aiMessages.aiChatId,e),s.eq(i.aiMessages.uiId,r.id))}),n=h.convertUiMessageToAiChatMessage(e,a,r,t?.id);t?await this.db.update(i.aiMessages).set({...n,indexWithinInsertBatch:t.indexWithinInsertBatch}).where(s.eq(i.aiMessages.id,t.id)):await this.db.insert(i.aiMessages).values(n),await this.db.delete(i.aiMessageParts).where(s.eq(i.aiMessageParts.aiMessageId,n.id)),n.parts.length>0&&await this.db.insert(i.aiMessageParts).values(n.parts)}get db(){return this.sqliteDB.db}async initialize(){await this.sqliteDB.initialize()}}exports.AiChatSqliteDBStorage=g;
|