@redocly/replay 0.28.0-next.9 → 0.28.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-B_f9Wn8a.js → replay-AiChatProvider-BRqjyy2W.js} +2 -2
- package/dist/{replay-AiChatProvider-DuTK5g1N.js → replay-AiChatProvider-DUVoLgY2.js} +138 -140
- package/dist/{replay-AiChatSqliteDBStorage-cXsRIQfJ.js → replay-AiChatSqliteDBStorage-0evx56pl.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-CHfMo6M6.js → replay-AiChatSqliteDBStorage-C5AnRloD.js} +1 -1
- package/dist/{replay-AiPanel-CGbGwIMX.js → replay-AiPanel-CMjVD12K.js} +50 -50
- package/dist/{replay-AiPanel-C_C52r20.js → replay-AiPanel-PVgJioX3.js} +2 -2
- package/dist/replay-FileWatcher-CFYprlWN.js +364 -0
- package/dist/replay-FileWatcher-DGLwO5Kd.js +1 -0
- package/dist/{replay-SemanticSearchService-BLF1oOOu.js → replay-SemanticSearchService-Bh5xYa91.js} +15 -15
- package/dist/{replay-SemanticSearchService-DTc0oxN4.js → replay-SemanticSearchService-CulKCCNl.js} +1 -1
- package/dist/{replay-SqliteDBStorage-DF9kKplR.js → replay-SqliteDBStorage-Bz0muHEk.js} +1 -1
- package/dist/{replay-SqliteDBStorage-B_kyJ0a3.js → replay-SqliteDBStorage-CVHRAsPD.js} +1 -1
- package/dist/replay-TauriFileSystemAdapter-B163-f2D.js +108 -0
- package/dist/replay-TauriFileSystemAdapter-D4bOmvzP.js +1 -0
- package/dist/{replay-TauriRootStorage-Den8gI4S.js → replay-TauriRootStorage-2MPQE-3f.js} +192 -188
- package/dist/replay-TauriRootStorage-CjWUrnWz.js +1 -0
- package/dist/{replay-agent-loop-B8Mjb8DU.js → replay-agent-loop-BgYyBo9e.js} +3 -3
- package/dist/{replay-agent-loop-Z_nrrmg_.js → replay-agent-loop-DYDFXAZj.js} +1 -1
- package/dist/{replay-ai-chat-mappers-D7e8buTk.js → replay-ai-chat-mappers-BEwNRQPV.js} +1 -1
- package/dist/{replay-ai-chat-mappers-aJ_VMb6Z.js → replay-ai-chat-mappers-CMtNqQHX.js} +1 -1
- package/dist/{replay-create-model-Bw20x80b.js → replay-create-model-B2ZsGTjs.js} +3 -3
- package/dist/{replay-create-model-Be3vPVDb.js → replay-create-model-DPxfOEfv.js} +4 -4
- package/dist/{replay-db-BQXljNM0.js → replay-db-C9iqyMet.js} +1 -1
- package/dist/{replay-db-BmZNrdZM.js → replay-db-D4-LmLRk.js} +1 -1
- package/dist/{replay-external-resolver-BQvSDNfH.js → replay-external-resolver-BXgVrfzk.js} +2 -2
- package/dist/{replay-external-resolver-BLzbbtnT.js → replay-external-resolver-CTUbNZGW.js} +1 -1
- package/dist/{replay-index-BCz452N6.js → replay-index-4TEahAPK.js} +21604 -21055
- package/dist/{replay-index-C0kvTxxm.js → replay-index-B4U7iZuq.js} +41 -41
- package/dist/{replay-index-DAIwC3ls.js → replay-index-B8O3wYqo.js} +1 -1
- package/dist/{replay-index-C7y4K4Cr.js → replay-index-Bdg7noSD.js} +1 -1
- package/dist/replay-index-CG9VN2JQ.js +4 -0
- package/dist/{replay-index-B-uZhXHj.js → replay-index-DcC173cC.js} +1 -1
- package/dist/{replay-index-DYtXcqDk.js → replay-index-Nz5obVS5.js} +1131 -1131
- package/dist/{replay-index-wBHsAQEV.js → replay-index-q63USe25.js} +1 -1
- package/dist/{replay-lint-BzkTeXqI.js → replay-lint-4XFKTmSY.js} +97 -97
- package/dist/{replay-lint-graphql-BZF2eLiZ.js → replay-lint-graphql-BsBWkZ6L.js} +1 -1
- package/dist/{replay-lint-graphql-BDBGJSir.js → replay-lint-graphql-De2eDZnT.js} +1 -1
- package/dist/{replay-lint-CqDMOMQt.js → replay-lint-s7ylMBWz.js} +6100 -6063
- package/dist/{replay-periodic-revalidation-C7SkB1vs.js → replay-periodic-revalidation-BMFP7f-u.js} +1 -1
- package/dist/{replay-periodic-revalidation-orCv_JoF.js → replay-periodic-revalidation-DJbblUef.js} +1 -1
- package/dist/{replay-resolve-DZMWoig2.js → replay-resolve-BtNxNrKo.js} +1 -1
- package/dist/{replay-resolve-0e5f8I7b.js → replay-resolve-BueEsOnR.js} +1 -1
- package/dist/{replay-respect-run-ChP63WzG.js → replay-respect-run-B_dJjlti.js} +1 -1
- package/dist/{replay-respect-run-CLW3wGhx.js → replay-respect-run-Dfpbcsns.js} +3 -3
- package/dist/{replay-tauri-path-DBt1dqkG.js → replay-tauri-path-Bht3XIt7.js} +1 -1
- package/dist/{replay-tauri-path-DvLF4Z8f.js → replay-tauri-path-CiuYXh_j.js} +2 -2
- package/dist/replay-useAiChatQueries-02CRdEPJ.js +215 -0
- package/dist/{replay-useAiChatQueries-S6v5duiJ.js → replay-useAiChatQueries-D2hh5omV.js} +994 -945
- package/dist/{replay-validate-key-CNl7BV_v.js → replay-validate-key-ALwOF1Ux.js} +1 -1
- package/dist/{replay-validate-key-CMJODIH6.js → replay-validate-key-B7fbWbfv.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +5 -0
- package/dist/replay.js +8 -8
- package/package.json +5 -5
- package/dist/replay-FileWatcher-DEOB0_DG.js +0 -1
- package/dist/replay-FileWatcher-Z6eygcBI.js +0 -359
- package/dist/replay-TauriFileSystemAdapter-CwSMakdJ.js +0 -1
- package/dist/replay-TauriFileSystemAdapter-DcFBYSUW.js +0 -99
- package/dist/replay-TauriRootStorage-DEGEIJrz.js +0 -1
- package/dist/replay-index-gM6vL6iT.js +0 -4
- package/dist/replay-useAiChatQueries-Bypgnkwa.js +0 -215
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as te } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as W, useCallback as f, useSyncExternalStore as re, useEffect as
|
|
3
|
-
import {
|
|
4
|
-
import { A as
|
|
5
|
-
import { AgentLoop as tt } from "./replay-agent-loop-
|
|
6
|
-
import { s as nt } from "./replay-db-
|
|
7
|
-
import { r as st, g as rt, a as ot, o as at, s as it, w as lt, m as ct, b as ut, u as dt, c as ht, d as pt, e as ft, f as gt, h as mt, i as vt, A as wt, j as Ct, k as It } from "./replay-useAiChatQueries-
|
|
2
|
+
import { useRef as W, useCallback as f, useSyncExternalStore as re, useEffect as R, useMemo as I, useState as z } from "react";
|
|
3
|
+
import { a0 as S, a1 as ce, K as _e, a2 as Re, a3 as $e, a4 as $, a5 as Pe, a6 as xe, c as De, a7 as We, a8 as Be, a as Oe, a9 as Ue, aa as Fe, ab as Le, ac as je, ad as fe, ae as Ne, af as Ke, ag as qe, ah as Ae, ai as se, aj as ue, ak as Te, al as Qe, am as Ve, an as Ge, ao as ye, z as ge, B as He, R as ne, ap as ze, aq as ae, ar as Ye, as as Je } from "./replay-index-4TEahAPK.js";
|
|
4
|
+
import { A as Xe, D as Ze, l as et } from "./replay-create-model-DPxfOEfv.js";
|
|
5
|
+
import { AgentLoop as tt } from "./replay-agent-loop-BgYyBo9e.js";
|
|
6
|
+
import { s as nt } from "./replay-db-D4-LmLRk.js";
|
|
7
|
+
import { r as st, g as rt, a as ot, o as at, s as it, w as lt, m as ct, b as ut, u as dt, c as ht, d as pt, e as ft, f as gt, h as mt, i as vt, A as wt, j as Ct, k as It } from "./replay-useAiChatQueries-D2hh5omV.js";
|
|
8
8
|
import { useQueryClient as de, useMutation as he } from "@tanstack/react-query";
|
|
9
|
-
import { d as Se, g as me } from "./replay-ai-chat-mappers-
|
|
9
|
+
import { d as Se, g as me } from "./replay-ai-chat-mappers-BEwNRQPV.js";
|
|
10
10
|
class At {
|
|
11
11
|
handlers = /* @__PURE__ */ new Map();
|
|
12
12
|
middlewares;
|
|
@@ -128,10 +128,10 @@ function St() {
|
|
|
128
128
|
let s, o = 0;
|
|
129
129
|
return function(...a) {
|
|
130
130
|
clearTimeout(s);
|
|
131
|
-
const i = Date.now(),
|
|
132
|
-
|
|
131
|
+
const i = Date.now(), h = i - o, u = n - h;
|
|
132
|
+
u <= 0 ? (o = i, t.apply(this, a)) : s = setTimeout(() => {
|
|
133
133
|
o = Date.now(), t.apply(this, a);
|
|
134
|
-
},
|
|
134
|
+
}, u);
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
return oe = e, oe;
|
|
@@ -141,65 +141,65 @@ const bt = /* @__PURE__ */ _e(kt);
|
|
|
141
141
|
var be = (e, t, n) => {
|
|
142
142
|
if (!t.has(e))
|
|
143
143
|
throw TypeError("Cannot " + n);
|
|
144
|
-
},
|
|
144
|
+
}, c = (e, t, n) => (be(e, t, "read from private field"), n ? n.call(e) : t.get(e)), T = (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
|
-
},
|
|
148
|
+
}, _ = (e, t, n, s) => (be(e, t, "write to private field"), t.set(e, n), n);
|
|
149
149
|
function Mt(e, t) {
|
|
150
150
|
return t != null ? bt(e, t) : e;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var C, Z, ee, V, G, H, F, ie, le, Et = class {
|
|
153
153
|
constructor(e = []) {
|
|
154
|
-
T(this,
|
|
155
|
-
|
|
154
|
+
T(this, C, void 0), T(this, Z, "ready"), T(this, ee, void 0), T(this, V, /* @__PURE__ */ new Set()), T(this, G, /* @__PURE__ */ new Set()), T(this, H, /* @__PURE__ */ new Set()), this.pushMessage = (t) => {
|
|
155
|
+
_(this, C, c(this, C).concat(t)), c(this, F).call(this);
|
|
156
156
|
}, this.popMessage = () => {
|
|
157
|
-
|
|
157
|
+
_(this, C, c(this, C).slice(0, -1)), c(this, F).call(this);
|
|
158
158
|
}, this.replaceMessage = (t, n) => {
|
|
159
|
-
|
|
160
|
-
...
|
|
159
|
+
_(this, C, [
|
|
160
|
+
...c(this, C).slice(0, t),
|
|
161
161
|
// We deep clone the message here to ensure the new React Compiler (currently in RC) detects deeply nested parts/metadata changes:
|
|
162
162
|
this.snapshot(n),
|
|
163
|
-
...
|
|
164
|
-
]),
|
|
163
|
+
...c(this, C).slice(t + 1)
|
|
164
|
+
]), c(this, F).call(this);
|
|
165
165
|
}, this.snapshot = (t) => structuredClone(t), this["~registerMessagesCallback"] = (t, n) => {
|
|
166
166
|
const s = n ? Mt(t, n) : t;
|
|
167
|
-
return
|
|
168
|
-
|
|
167
|
+
return c(this, V).add(s), () => {
|
|
168
|
+
c(this, V).delete(s);
|
|
169
169
|
};
|
|
170
|
-
}, this["~registerStatusCallback"] = (t) => (
|
|
171
|
-
|
|
172
|
-
}), this["~registerErrorCallback"] = (t) => (
|
|
173
|
-
|
|
170
|
+
}, this["~registerStatusCallback"] = (t) => (c(this, G).add(t), () => {
|
|
171
|
+
c(this, G).delete(t);
|
|
172
|
+
}), this["~registerErrorCallback"] = (t) => (c(this, H).add(t), () => {
|
|
173
|
+
c(this, H).delete(t);
|
|
174
174
|
}), T(this, F, () => {
|
|
175
|
-
|
|
175
|
+
c(this, V).forEach((t) => t());
|
|
176
176
|
}), T(this, ie, () => {
|
|
177
|
-
|
|
177
|
+
c(this, G).forEach((t) => t());
|
|
178
178
|
}), T(this, le, () => {
|
|
179
|
-
|
|
180
|
-
}),
|
|
179
|
+
c(this, H).forEach((t) => t());
|
|
180
|
+
}), _(this, C, e);
|
|
181
181
|
}
|
|
182
182
|
get status() {
|
|
183
|
-
return
|
|
183
|
+
return c(this, Z);
|
|
184
184
|
}
|
|
185
185
|
set status(e) {
|
|
186
|
-
|
|
186
|
+
_(this, Z, e), c(this, ie).call(this);
|
|
187
187
|
}
|
|
188
188
|
get error() {
|
|
189
|
-
return
|
|
189
|
+
return c(this, ee);
|
|
190
190
|
}
|
|
191
191
|
set error(e) {
|
|
192
|
-
|
|
192
|
+
_(this, ee, e), c(this, le).call(this);
|
|
193
193
|
}
|
|
194
194
|
get messages() {
|
|
195
|
-
return
|
|
195
|
+
return c(this, C);
|
|
196
196
|
}
|
|
197
197
|
set messages(e) {
|
|
198
|
-
|
|
198
|
+
_(this, C, [...e]), c(this, F).call(this);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
C = /* @__PURE__ */ new WeakMap();
|
|
202
|
+
Z = /* @__PURE__ */ new WeakMap();
|
|
203
203
|
ee = /* @__PURE__ */ new WeakMap();
|
|
204
204
|
V = /* @__PURE__ */ new WeakMap();
|
|
205
205
|
G = /* @__PURE__ */ new WeakMap();
|
|
@@ -207,10 +207,10 @@ H = /* @__PURE__ */ new WeakMap();
|
|
|
207
207
|
F = /* @__PURE__ */ new WeakMap();
|
|
208
208
|
ie = /* @__PURE__ */ new WeakMap();
|
|
209
209
|
le = /* @__PURE__ */ new WeakMap();
|
|
210
|
-
var L, we = class extends
|
|
210
|
+
var L, we = class extends Xe {
|
|
211
211
|
constructor({ messages: e, ...t }) {
|
|
212
212
|
const n = new Et(e);
|
|
213
|
-
super({ ...t, state: n }), T(this, L, void 0), this["~registerMessagesCallback"] = (s, o) =>
|
|
213
|
+
super({ ...t, state: n }), T(this, L, void 0), this["~registerMessagesCallback"] = (s, o) => c(this, L)["~registerMessagesCallback"](s, o), this["~registerStatusCallback"] = (s) => c(this, L)["~registerStatusCallback"](s), this["~registerErrorCallback"] = (s) => c(this, L)["~registerErrorCallback"](s), _(this, L, n);
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
L = /* @__PURE__ */ new WeakMap();
|
|
@@ -266,37 +266,37 @@ function _t({
|
|
|
266
266
|
// `chatRef.current.id` is required to trigger re-subscription when the chat ID changes
|
|
267
267
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
268
268
|
[e, r.current.id]
|
|
269
|
-
),
|
|
269
|
+
), h = re(
|
|
270
270
|
i,
|
|
271
271
|
() => r.current.messages,
|
|
272
272
|
() => r.current.messages
|
|
273
|
-
),
|
|
273
|
+
), u = re(
|
|
274
274
|
r.current["~registerStatusCallback"],
|
|
275
275
|
() => r.current.status,
|
|
276
276
|
() => r.current.status
|
|
277
|
-
),
|
|
277
|
+
), v = re(
|
|
278
278
|
r.current["~registerErrorCallback"],
|
|
279
279
|
() => r.current.error,
|
|
280
280
|
() => r.current.error
|
|
281
|
-
),
|
|
281
|
+
), w = f(
|
|
282
282
|
(l) => {
|
|
283
283
|
typeof l == "function" && (l = l(r.current.messages)), r.current.messages = l;
|
|
284
284
|
},
|
|
285
285
|
[r]
|
|
286
286
|
);
|
|
287
|
-
return
|
|
287
|
+
return R(() => {
|
|
288
288
|
t && r.current.resumeStream();
|
|
289
289
|
}, [t, r]), {
|
|
290
290
|
id: r.current.id,
|
|
291
|
-
messages:
|
|
292
|
-
setMessages:
|
|
291
|
+
messages: h,
|
|
292
|
+
setMessages: w,
|
|
293
293
|
sendMessage: r.current.sendMessage,
|
|
294
294
|
regenerate: r.current.regenerate,
|
|
295
295
|
clearError: r.current.clearError,
|
|
296
296
|
stop: r.current.stop,
|
|
297
|
-
error:
|
|
297
|
+
error: v,
|
|
298
298
|
resumeStream: r.current.resumeStream,
|
|
299
|
-
status:
|
|
299
|
+
status: u,
|
|
300
300
|
/**
|
|
301
301
|
* @deprecated Use `addToolOutput` instead.
|
|
302
302
|
*/
|
|
@@ -471,7 +471,7 @@ function Jt(e, t, n, s) {
|
|
|
471
471
|
const { collectionId: r } = t.data;
|
|
472
472
|
return {
|
|
473
473
|
...o,
|
|
474
|
-
label:
|
|
474
|
+
label: Xt(e, r) ?? r,
|
|
475
475
|
collectionId: r
|
|
476
476
|
};
|
|
477
477
|
}
|
|
@@ -480,10 +480,10 @@ function Jt(e, t, n, s) {
|
|
|
480
480
|
return { ...o, label: a, collectionId: r, workflowId: a };
|
|
481
481
|
}
|
|
482
482
|
case $.WorkflowRun: {
|
|
483
|
-
const { collectionId: r, workflowId: a, historyId: i, label:
|
|
483
|
+
const { collectionId: r, workflowId: a, historyId: i, label: h } = t.data;
|
|
484
484
|
return {
|
|
485
485
|
...o,
|
|
486
|
-
label:
|
|
486
|
+
label: h ?? `${a} run`,
|
|
487
487
|
collectionId: r,
|
|
488
488
|
workflowId: a,
|
|
489
489
|
isHistory: i != null
|
|
@@ -493,7 +493,7 @@ function Jt(e, t, n, s) {
|
|
|
493
493
|
const r = t.data;
|
|
494
494
|
return {
|
|
495
495
|
...o,
|
|
496
|
-
label:
|
|
496
|
+
label: Zt(r),
|
|
497
497
|
collectionId: r.collectionId,
|
|
498
498
|
workflowId: r.workflowId,
|
|
499
499
|
stepId: r.stepId,
|
|
@@ -504,10 +504,10 @@ function Jt(e, t, n, s) {
|
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function Xt(e, t) {
|
|
508
508
|
return e.find((n) => n.id === t)?.info.title;
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function Zt(e) {
|
|
511
511
|
if (e.stepId)
|
|
512
512
|
return e.stepId;
|
|
513
513
|
if (e.draftStep) {
|
|
@@ -531,7 +531,7 @@ function en(e) {
|
|
|
531
531
|
}
|
|
532
532
|
function tn() {
|
|
533
533
|
const e = Le(), { tab: t } = je(), n = t?.data ?? null;
|
|
534
|
-
return
|
|
534
|
+
return I(() => {
|
|
535
535
|
if (!n)
|
|
536
536
|
return null;
|
|
537
537
|
switch (n.type) {
|
|
@@ -593,7 +593,7 @@ function sn() {
|
|
|
593
593
|
}
|
|
594
594
|
function rn() {
|
|
595
595
|
const { getApiOperation: e } = qe(), t = Ae();
|
|
596
|
-
return
|
|
596
|
+
return I(
|
|
597
597
|
() => ({
|
|
598
598
|
getApiOperation: e,
|
|
599
599
|
...t
|
|
@@ -602,15 +602,15 @@ function rn() {
|
|
|
602
602
|
);
|
|
603
603
|
}
|
|
604
604
|
function on(e) {
|
|
605
|
-
const { convertOperationToReplayValue: t } = se(), n = tn(), s = rn(), o = ue(), r = Te(), { attachApiToCollection: a } = Qe(), { handleCloseByDataId: i } = Ae(),
|
|
606
|
-
return
|
|
607
|
-
const
|
|
605
|
+
const { convertOperationToReplayValue: t } = se(), n = tn(), s = rn(), o = ue(), r = Te(), { attachApiToCollection: a } = Qe(), { handleCloseByDataId: i } = Ae(), h = Ve(), u = W(n);
|
|
606
|
+
return u.current = n, { tools: I(() => {
|
|
607
|
+
const w = new At({
|
|
608
608
|
middlewares: [sn()]
|
|
609
609
|
});
|
|
610
|
-
return st(
|
|
610
|
+
return st(w, {
|
|
611
611
|
[gt.name]: void 0,
|
|
612
612
|
[ft.name]: { settings: o, store: r },
|
|
613
|
-
[pt.name]: { store: r, runWorkflow:
|
|
613
|
+
[pt.name]: { store: r, runWorkflow: h },
|
|
614
614
|
[ht.name]: { store: r },
|
|
615
615
|
[dt.name]: { store: r },
|
|
616
616
|
[ut.name]: {
|
|
@@ -624,53 +624,53 @@ function on(e) {
|
|
|
624
624
|
[it.name]: { store: r },
|
|
625
625
|
[at.name]: { store: r, context: s },
|
|
626
626
|
[ot.name]: {
|
|
627
|
-
getActiveTabDetailedData: () =>
|
|
627
|
+
getActiveTabDetailedData: () => u.current
|
|
628
628
|
},
|
|
629
629
|
[rt.name]: { store: r }
|
|
630
|
-
}),
|
|
630
|
+
}), w.getToolSet();
|
|
631
631
|
}, [
|
|
632
632
|
a,
|
|
633
633
|
t,
|
|
634
634
|
i,
|
|
635
635
|
e,
|
|
636
636
|
s,
|
|
637
|
-
|
|
637
|
+
h,
|
|
638
638
|
o,
|
|
639
639
|
r
|
|
640
640
|
]) };
|
|
641
641
|
}
|
|
642
642
|
function an(e) {
|
|
643
|
-
const { children: t, chatId: n, model: s, initialMessages: o, onChatFinish: r, onChatMessagesUpdated: a } = e, i = ue(), { getReuniteAuth:
|
|
644
|
-
|
|
645
|
-
const g =
|
|
643
|
+
const { children: t, chatId: n, model: s, initialMessages: o, onChatFinish: r, onChatMessagesUpdated: a } = e, i = ue(), { getReuniteAuth: h } = se(), { tools: u } = on(s), { sendEvent: v } = Ge(), w = W(u), l = W(s), { isOpen: p, openPanel: d, closePanel: P } = ye(), x = W(void 0), j = Te();
|
|
644
|
+
w.current = u, l.current = s;
|
|
645
|
+
const g = I(() => {
|
|
646
646
|
x.current?.end();
|
|
647
|
-
const
|
|
648
|
-
x.current =
|
|
649
|
-
const
|
|
647
|
+
const M = ge.getTracer("replay-ai-chat").startSpan("ai.chat.session", { attributes: { conversation_id: n } });
|
|
648
|
+
x.current = M;
|
|
649
|
+
const E = ge.setSpan(He.active(), M);
|
|
650
650
|
return new tt({
|
|
651
651
|
activeConversationId: n,
|
|
652
652
|
model: l.current,
|
|
653
|
-
tools:
|
|
654
|
-
sendEvent:
|
|
655
|
-
parentCtx:
|
|
653
|
+
tools: w.current,
|
|
654
|
+
sendEvent: v,
|
|
655
|
+
parentCtx: E,
|
|
656
656
|
getActiveStateMessage: () => qt(en(j))
|
|
657
657
|
});
|
|
658
|
-
}, [n,
|
|
659
|
-
|
|
660
|
-
const B =
|
|
658
|
+
}, [n, v, j]);
|
|
659
|
+
R(() => () => x.current?.end(), []);
|
|
660
|
+
const B = I(() => {
|
|
661
661
|
if (g)
|
|
662
|
-
return new
|
|
662
|
+
return new Ze({ agent: g.getAgent() });
|
|
663
663
|
}, [g]);
|
|
664
|
-
|
|
664
|
+
R(() => {
|
|
665
665
|
g.setModel(s);
|
|
666
|
-
}, [g, s]),
|
|
667
|
-
g.registerTools(
|
|
668
|
-
}, [g,
|
|
666
|
+
}, [g, s]), R(() => {
|
|
667
|
+
g.registerTools(u);
|
|
668
|
+
}, [g, u]);
|
|
669
669
|
const {
|
|
670
|
-
messages:
|
|
670
|
+
messages: k,
|
|
671
671
|
setMessages: D,
|
|
672
672
|
sendMessage: N,
|
|
673
|
-
status:
|
|
673
|
+
status: b,
|
|
674
674
|
error: Y,
|
|
675
675
|
stop: O,
|
|
676
676
|
addToolApprovalResponse: K
|
|
@@ -679,20 +679,20 @@ function an(e) {
|
|
|
679
679
|
messages: o,
|
|
680
680
|
transport: B,
|
|
681
681
|
sendAutomaticallyWhen: et,
|
|
682
|
-
onFinish(
|
|
682
|
+
onFinish(M) {
|
|
683
683
|
if (!r || !g) return;
|
|
684
|
-
r({ agentLoop: g, chat: this },
|
|
684
|
+
r({ agentLoop: g, chat: this }, M);
|
|
685
685
|
}
|
|
686
|
-
}), y =
|
|
686
|
+
}), y = I(() => b === "streaming" || b === "submitted", [b]), q = f(() => {
|
|
687
687
|
i.aiEnabled === !0 && d();
|
|
688
688
|
}, [d, i.aiEnabled]), Q = f(() => {
|
|
689
689
|
P();
|
|
690
690
|
}, [P]), J = f(
|
|
691
|
-
async (
|
|
692
|
-
const
|
|
693
|
-
if (!(!
|
|
691
|
+
async (M) => {
|
|
692
|
+
const E = M.trim();
|
|
693
|
+
if (!(!E || !B)) {
|
|
694
694
|
if (s.provider === ne) {
|
|
695
|
-
const A = await
|
|
695
|
+
const A = await h?.();
|
|
696
696
|
A?.baseUrl && A?.accessToken && g.setModel({
|
|
697
697
|
provider: ne,
|
|
698
698
|
baseUrl: A.baseUrl,
|
|
@@ -701,29 +701,29 @@ function an(e) {
|
|
|
701
701
|
}
|
|
702
702
|
D(
|
|
703
703
|
(A) => mt(A) ? vt(A) : A
|
|
704
|
-
), N({ text:
|
|
704
|
+
), N({ text: E });
|
|
705
705
|
}
|
|
706
706
|
},
|
|
707
|
-
[g,
|
|
707
|
+
[g, h, s.provider, N, D, B]
|
|
708
708
|
), m = f(() => {
|
|
709
709
|
y && O();
|
|
710
710
|
}, [y, O]);
|
|
711
|
-
|
|
711
|
+
R(() => () => {
|
|
712
712
|
O();
|
|
713
713
|
}, [n, O]);
|
|
714
714
|
const U = f(
|
|
715
|
-
(
|
|
716
|
-
const
|
|
717
|
-
for (const
|
|
718
|
-
pe[
|
|
715
|
+
(M) => {
|
|
716
|
+
const E = M(k), A = E.map((X) => X.message), pe = [...k];
|
|
717
|
+
for (const X of E)
|
|
718
|
+
pe[X.index] = X.message;
|
|
719
719
|
D(pe), a?.(A);
|
|
720
720
|
},
|
|
721
|
-
[
|
|
722
|
-
), Me =
|
|
721
|
+
[k, a, D]
|
|
722
|
+
), Me = I(
|
|
723
723
|
() => ({
|
|
724
|
-
messages:
|
|
724
|
+
messages: k,
|
|
725
725
|
isStreaming: y,
|
|
726
|
-
chatStatus:
|
|
726
|
+
chatStatus: b,
|
|
727
727
|
chatError: Y,
|
|
728
728
|
sendMessage: J,
|
|
729
729
|
updateMessages: U,
|
|
@@ -734,13 +734,13 @@ function an(e) {
|
|
|
734
734
|
K,
|
|
735
735
|
Y,
|
|
736
736
|
y,
|
|
737
|
-
|
|
737
|
+
k,
|
|
738
738
|
J,
|
|
739
|
-
|
|
739
|
+
b,
|
|
740
740
|
m,
|
|
741
741
|
U
|
|
742
742
|
]
|
|
743
|
-
), Ee =
|
|
743
|
+
), Ee = I(
|
|
744
744
|
() => ({
|
|
745
745
|
isOpen: p,
|
|
746
746
|
openPanel: q,
|
|
@@ -820,7 +820,7 @@ function pn({ chatId: e, model: t }) {
|
|
|
820
820
|
);
|
|
821
821
|
}
|
|
822
822
|
function fn(e) {
|
|
823
|
-
return
|
|
823
|
+
return I(() => {
|
|
824
824
|
const t = [ae];
|
|
825
825
|
if (e) {
|
|
826
826
|
for (const [n, s] of Object.entries(e))
|
|
@@ -855,14 +855,14 @@ function gn(e, t) {
|
|
|
855
855
|
}
|
|
856
856
|
function mn(e, t) {
|
|
857
857
|
const [n, s] = z(() => Ie(e, t)), o = W(t);
|
|
858
|
-
o.current = t,
|
|
858
|
+
o.current = t, R(() => {
|
|
859
859
|
s(Ie(e, o.current));
|
|
860
860
|
}, [e]);
|
|
861
861
|
const r = f(
|
|
862
862
|
(a) => {
|
|
863
863
|
s((i) => {
|
|
864
|
-
const
|
|
865
|
-
return gn(e,
|
|
864
|
+
const h = a instanceof Function ? a(i) : a;
|
|
865
|
+
return gn(e, h), h;
|
|
866
866
|
});
|
|
867
867
|
},
|
|
868
868
|
[e]
|
|
@@ -874,31 +874,29 @@ function wn(e) {
|
|
|
874
874
|
const { availableModels: t, aiProviders: n, reuniteAuth: s } = e, [o, r] = mn(
|
|
875
875
|
vn,
|
|
876
876
|
ae.id
|
|
877
|
-
);
|
|
878
|
-
return
|
|
879
|
-
|
|
880
|
-
}, [t, o, r]), { model: w(() => {
|
|
881
|
-
const i = {
|
|
877
|
+
), a = t.some((h) => h.id === o) ? o : ae.id;
|
|
878
|
+
return { model: I(() => {
|
|
879
|
+
const h = {
|
|
882
880
|
provider: ne,
|
|
883
881
|
baseUrl: s.baseUrl,
|
|
884
882
|
accessToken: s.accessToken
|
|
885
|
-
},
|
|
886
|
-
if (!
|
|
887
|
-
return
|
|
888
|
-
const
|
|
889
|
-
return !
|
|
890
|
-
provider:
|
|
891
|
-
modelId:
|
|
892
|
-
apiKey:
|
|
883
|
+
}, u = t.find((w) => w.id === a);
|
|
884
|
+
if (!u || u.provider === ne)
|
|
885
|
+
return h;
|
|
886
|
+
const v = n?.[u.provider];
|
|
887
|
+
return !v || !v.apiKey || !v.enabled ? h : {
|
|
888
|
+
provider: u.provider,
|
|
889
|
+
modelId: u.id,
|
|
890
|
+
apiKey: v.apiKey
|
|
893
891
|
};
|
|
894
|
-
}, [
|
|
892
|
+
}, [a, t, n, s]), selectedModelId: a, selectModel: r };
|
|
895
893
|
}
|
|
896
894
|
function Cn() {
|
|
897
895
|
const [e, t] = z({
|
|
898
896
|
baseUrl: "",
|
|
899
897
|
accessToken: ""
|
|
900
898
|
}), { getReuniteAuth: n } = se();
|
|
901
|
-
return
|
|
899
|
+
return R(() => {
|
|
902
900
|
let s = !1;
|
|
903
901
|
async function o() {
|
|
904
902
|
const r = await n?.();
|
|
@@ -918,24 +916,24 @@ function Cn() {
|
|
|
918
916
|
}, [n]), e;
|
|
919
917
|
}
|
|
920
918
|
function _n(e) {
|
|
921
|
-
const { children: t } = e, [n, s] = z(me), [o, r] = z(n), [a, i] = z(null),
|
|
919
|
+
const { children: t } = e, [n, s] = z(me), [o, r] = z(n), [a, i] = z(null), h = ue(), u = se(), { openPanel: v } = ye(), w = o !== n, l = f(() => {
|
|
922
920
|
const m = me();
|
|
923
921
|
r(m), s(m);
|
|
924
922
|
}, []), p = f((m) => {
|
|
925
923
|
r(m);
|
|
926
|
-
}, []), { data: d } = It(o), P = Cn(), x = fn(
|
|
924
|
+
}, []), { data: d } = It(o), P = Cn(), x = fn(u.aiProviders), { selectedModelId: j, model: g, selectModel: B } = wn({
|
|
927
925
|
availableModels: x,
|
|
928
|
-
aiProviders:
|
|
926
|
+
aiProviders: u.aiProviders,
|
|
929
927
|
reuniteAuth: P
|
|
930
|
-
}),
|
|
928
|
+
}), k = yt(), D = hn({ chatId: n, model: g }), N = pn({ chatId: n, model: g }), b = dn({
|
|
931
929
|
chatId: n,
|
|
932
930
|
model: g,
|
|
933
931
|
existingTitle: d?.title
|
|
934
932
|
}), Y = f(
|
|
935
933
|
(m, U) => {
|
|
936
|
-
U.isAbort || (D(m, U),
|
|
934
|
+
U.isAbort || (D(m, U), b(m, U));
|
|
937
935
|
},
|
|
938
|
-
[D,
|
|
936
|
+
[D, b]
|
|
939
937
|
), O = f(
|
|
940
938
|
(...m) => {
|
|
941
939
|
N(...m);
|
|
@@ -943,30 +941,30 @@ function _n(e) {
|
|
|
943
941
|
[N]
|
|
944
942
|
), K = f(
|
|
945
943
|
(m) => {
|
|
946
|
-
(o === m || n === m) && l(),
|
|
944
|
+
(o === m || n === m) && l(), k.mutate(m);
|
|
947
945
|
},
|
|
948
|
-
[l, n,
|
|
946
|
+
[l, n, k, o]
|
|
949
947
|
), y = d?.id;
|
|
950
|
-
|
|
948
|
+
R(() => {
|
|
951
949
|
y && y !== n && s(y);
|
|
952
950
|
}, [y, o, n]);
|
|
953
951
|
const q = f(() => {
|
|
954
952
|
i(null);
|
|
955
953
|
}, []), Q = f(
|
|
956
954
|
(m) => {
|
|
957
|
-
|
|
955
|
+
h.aiEnabled && (l(), i(m), v());
|
|
958
956
|
},
|
|
959
|
-
[
|
|
960
|
-
), J =
|
|
957
|
+
[v, l, h.aiEnabled]
|
|
958
|
+
), J = I(
|
|
961
959
|
() => ({
|
|
962
960
|
chatId: n,
|
|
963
961
|
model: g,
|
|
964
962
|
availableModels: x,
|
|
965
963
|
selectedModelId: j,
|
|
966
964
|
selectModel: B,
|
|
967
|
-
onSettingsOpen:
|
|
965
|
+
onSettingsOpen: u.onSettingsOpen,
|
|
968
966
|
title: d?.title ?? Ye.title,
|
|
969
|
-
isLoading:
|
|
967
|
+
isLoading: w,
|
|
970
968
|
selectChat: p,
|
|
971
969
|
removeChat: K,
|
|
972
970
|
createNewChat: l,
|
|
@@ -979,7 +977,7 @@ function _n(e) {
|
|
|
979
977
|
x,
|
|
980
978
|
d?.title,
|
|
981
979
|
g,
|
|
982
|
-
|
|
980
|
+
w,
|
|
983
981
|
p,
|
|
984
982
|
K,
|
|
985
983
|
l,
|
|
@@ -988,7 +986,7 @@ function _n(e) {
|
|
|
988
986
|
q,
|
|
989
987
|
j,
|
|
990
988
|
B,
|
|
991
|
-
|
|
989
|
+
u.onSettingsOpen
|
|
992
990
|
]
|
|
993
991
|
);
|
|
994
992
|
return /* @__PURE__ */ te(Je.Provider, { value: J, children: /* @__PURE__ */ te(
|
package/dist/{replay-AiChatSqliteDBStorage-cXsRIQfJ.js → replay-AiChatSqliteDBStorage-0evx56pl.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./replay-history.schema-B0lLwmdG.js";
|
|
2
2
|
import "./replay-step-context.schema-BOprzd6Z.js";
|
|
3
3
|
import { a as h, b as r, c as n } from "./replay-ai-message-parts.schema-DKLf0SiG.js";
|
|
4
|
-
import { c, a as u, b as m } from "./replay-ai-chat-mappers-
|
|
4
|
+
import { c, a as u, b as m } from "./replay-ai-chat-mappers-BEwNRQPV.js";
|
|
5
5
|
import { b as l, e, c as b } from "./replay-indexes-B3PJtgeh.js";
|
|
6
6
|
const g = {
|
|
7
7
|
orderBy: [l(r.createdAt), l(r.indexWithinInsertBatch)],
|
package/dist/{replay-AiChatSqliteDBStorage-CHfMo6M6.js → replay-AiChatSqliteDBStorage-C5AnRloD.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-CMtNqQHX.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;
|