@redocly/replay 0.28.0-next.5 → 0.28.0-next.6
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-BtDAvnSq.js → replay-AiChatProvider-Bj2P_hdU.js} +371 -369
- package/dist/replay-AiChatProvider-GeumgtIo.js +6 -0
- package/dist/{replay-AiChatSqliteDBStorage-CjD_0sid.js → replay-AiChatSqliteDBStorage-0M2Ejnzu.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-DYTBtCdW.js → replay-AiChatSqliteDBStorage-BWJl1qdO.js} +1 -1
- package/dist/{replay-AiPanel-Wn4vI4q5.js → replay-AiPanel-DfOpKMDQ.js} +709 -712
- package/dist/replay-AiPanel-ON_QfwBN.js +742 -0
- package/dist/replay-FileWatcher-04GlEkra.js +360 -0
- package/dist/replay-FileWatcher-B-T0jz_R.js +1 -0
- package/dist/{replay-SemanticSearchService-Dn-s19V3.js → replay-SemanticSearchService-BQgdj2wy.js} +1 -1
- package/dist/{replay-SemanticSearchService-B1_4MZ3a.js → replay-SemanticSearchService-CPIb_cUk.js} +7 -7
- package/dist/{replay-SqliteDBStorage-BqOim0Il.js → replay-SqliteDBStorage-Bt2xXqei.js} +1 -1
- package/dist/{replay-SqliteDBStorage-CRZ9Yx8K.js → replay-SqliteDBStorage-vehgvWXZ.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-Bf-9oAkV.js → replay-TauriFileSystemAdapter-D2yxrS6Q.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-GrD1Q2jS.js → replay-TauriFileSystemAdapter-YLdtT-Xp.js} +1 -1
- package/dist/{replay-TauriRootStorage-Cnd9-u0R.js → replay-TauriRootStorage-BE6RmQfE.js} +162 -165
- package/dist/replay-TauriRootStorage-DcENVsBJ.js +1 -0
- package/dist/{replay-agent-loop-DcduWdVY.js → replay-agent-loop-CvopOugZ.js} +13 -13
- package/dist/{replay-agent-loop-phR7X6HJ.js → replay-agent-loop-UwDSVh-4.js} +1 -1
- package/dist/{replay-ai-chat-mappers-f7OYwce2.js → replay-ai-chat-mappers-B7fm-v_w.js} +1 -1
- package/dist/{replay-ai-chat-mappers-DMgobD7q.js → replay-ai-chat-mappers-yKBypIXh.js} +1 -1
- package/dist/{replay-create-model-B9_RKhPf.js → replay-create-model-CHahxEJy.js} +3 -3
- package/dist/{replay-create-model-WcGwy1Px.js → replay-create-model-CyBZMAWB.js} +4 -4
- package/dist/{replay-db-BB9biJ4Q.js → replay-db-CifZMdnr.js} +5 -5
- package/dist/{replay-db-DcpyTo8s.js → replay-db-EWL-uAt-.js} +1 -1
- package/dist/{replay-external-resolver-TFD8mr_P.js → replay-external-resolver-D5fSfJEm.js} +1 -1
- package/dist/{replay-external-resolver-CKJWptWf.js → replay-external-resolver-G11iwLVZ.js} +2 -2
- package/dist/{replay-index-DuIF4QBl.js → replay-index-B2NUTBd8.js} +1 -1
- package/dist/{replay-index-DF6wNUHn.js → replay-index-B3MQaIS-.js} +1 -1
- package/dist/replay-index-Coy4kD_x.js +7009 -0
- package/dist/{replay-index-DofofQ3T.js → replay-index-CqRiEj9e.js} +1 -1
- package/dist/{replay-index-D38KWo5d.js → replay-index-D0mbH_TN.js} +1 -1
- package/dist/{replay-index-UbqSETNf.js → replay-index-DDqKE6bs.js} +5 -5
- package/dist/{replay-index-qMSGJKzU.js → replay-index-DrI9ZFwH.js} +2 -2
- package/dist/{replay-index-CFhkrdmJ.js → replay-index-Dx8O3ZoA.js} +62045 -61139
- package/dist/{replay-lint-BaFfhDsl.js → replay-lint-BiOcDIDr.js} +3 -3
- package/dist/{replay-lint-j1iYeM_X.js → replay-lint-CAo2fuiZ.js} +3 -3
- package/dist/{replay-lint-graphql-DXko1yrv.js → replay-lint-graphql-DAa8UNRg.js} +1 -1
- package/dist/{replay-lint-graphql-zL0ESnHi.js → replay-lint-graphql-DzI2rUbR.js} +1 -1
- package/dist/replay-periodic-revalidation-D18ihfUc.js +1 -0
- package/dist/replay-periodic-revalidation-w7mrtjYg.js +22 -0
- package/dist/{replay-resolve-DxQZdksO.js → replay-resolve-CojDRP37.js} +1 -1
- package/dist/{replay-resolve-B-AmJx0p.js → replay-resolve-DgAthAfi.js} +1 -1
- package/dist/{replay-respect-run-BAuRPVQY.js → replay-respect-run-3ukV7LMg.js} +1 -1
- package/dist/{replay-respect-run-CPQGLg0r.js → replay-respect-run-DNvB8rLX.js} +3 -3
- package/dist/replay-tauri-path-DM8PdMK8.js +22 -0
- package/dist/{replay-tauri-path-Cj6Zgicf.js → replay-tauri-path-kr9DtxLs.js} +1 -1
- package/dist/{replay-useAiChatQueries-pptRWb9k.js → replay-useAiChatQueries-BULoKr4E.js} +1564 -1395
- package/dist/replay-useAiChatQueries-BdjsFz1P.js +215 -0
- package/dist/{replay-validate-key-D4j7fXFM.js → replay-validate-key-CGmguj5X.js} +1 -1
- package/dist/{replay-validate-key-DjGy6Q75.js → replay-validate-key-DzseOR5a.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +3 -3
- package/dist/replay.js +10 -10
- package/package.json +3 -5
- package/dist/replay-AiChatProvider-DiHC9TUm.js +0 -6
- package/dist/replay-AiPanel-CFbxD8SJ.js +0 -742
- package/dist/replay-FileWatcher-Boh7I024.js +0 -352
- package/dist/replay-FileWatcher-Cq4DUrxe.js +0 -1
- package/dist/replay-TauriRootStorage-BkPcSPgu.js +0 -1
- package/dist/replay-index-PZuRF5JU.js +0 -6982
- package/dist/replay-periodic-revalidation-BoyLQHtg.js +0 -1
- package/dist/replay-periodic-revalidation-Dsp-n7ui.js +0 -21
- package/dist/replay-tauri-path-D82YK1cm.js +0 -22
- package/dist/replay-useAiChatQueries-CH48wBvJ.js +0 -215
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as te } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
import { A as
|
|
5
|
-
import { AgentLoop as
|
|
6
|
-
import { s as
|
|
7
|
-
import { r as
|
|
2
|
+
import { useRef as W, useCallback as f, useSyncExternalStore as re, useEffect as k, useMemo as w, useState as z } from "react";
|
|
3
|
+
import { k as S, A as ce, g as _e, I as Re, T as $e, m as $, n as Pe, o as xe, h as De, p as We, q as Be, j as Oe, s as Ue, u as Fe, v as Le, w as je, x as fe, z as Ne, B as Ke, C as qe, E as Ae, F as se, G as ue, H as Te, J as Qe, K as Ve, L as Ge, N as ye, O as ge, Q as He, U as ne, V as ze, W as ae, X as Ye, Y as Je } from "./replay-index-Dx8O3ZoA.js";
|
|
4
|
+
import { A as Xe, D as Ze, l as et } from "./replay-create-model-CyBZMAWB.js";
|
|
5
|
+
import { AgentLoop as tt } from "./replay-agent-loop-CvopOugZ.js";
|
|
6
|
+
import { s as nt } from "./replay-db-CifZMdnr.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-BULoKr4E.js";
|
|
8
8
|
import { useQueryClient as de, useMutation as he } from "@tanstack/react-query";
|
|
9
|
-
import { b as
|
|
10
|
-
class
|
|
9
|
+
import { b as Se, g as me } from "./replay-ai-chat-mappers-yKBypIXh.js";
|
|
10
|
+
class At {
|
|
11
11
|
handlers = /* @__PURE__ */ new Map();
|
|
12
12
|
middlewares;
|
|
13
13
|
constructor(t) {
|
|
@@ -59,7 +59,7 @@ function ke() {
|
|
|
59
59
|
const e = de();
|
|
60
60
|
return he({
|
|
61
61
|
async mutationFn(t) {
|
|
62
|
-
const n =
|
|
62
|
+
const n = Se(t);
|
|
63
63
|
await ce.getInstance().upsert(n);
|
|
64
64
|
},
|
|
65
65
|
onSuccess() {
|
|
@@ -70,13 +70,13 @@ function ke() {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Tt(e) {
|
|
74
74
|
const t = de(), n = S.detailTitle(e ?? "");
|
|
75
75
|
return he({
|
|
76
76
|
mutationKey: n,
|
|
77
77
|
async mutationFn(s) {
|
|
78
78
|
if (t.isMutating({ mutationKey: n, exact: !0 }) > 1) return;
|
|
79
|
-
const o =
|
|
79
|
+
const o = Se(s);
|
|
80
80
|
await ce.getInstance().upsert(o);
|
|
81
81
|
},
|
|
82
82
|
onSuccess() {
|
|
@@ -87,7 +87,7 @@ function gt(e) {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function yt() {
|
|
91
91
|
const e = de();
|
|
92
92
|
return he({
|
|
93
93
|
async mutationFn(t) {
|
|
@@ -119,7 +119,7 @@ function mt() {
|
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
var oe, ve;
|
|
122
|
-
function
|
|
122
|
+
function St() {
|
|
123
123
|
if (ve) return oe;
|
|
124
124
|
ve = 1;
|
|
125
125
|
function e(t, n) {
|
|
@@ -128,74 +128,74 @@ function vt() {
|
|
|
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(), c = i - o, h = n - c;
|
|
132
|
+
h <= 0 ? (o = i, t.apply(this, a)) : s = setTimeout(() => {
|
|
133
133
|
o = Date.now(), t.apply(this, a);
|
|
134
|
-
},
|
|
134
|
+
}, h);
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
return oe = e, oe;
|
|
138
138
|
}
|
|
139
|
-
var
|
|
140
|
-
const
|
|
141
|
-
var
|
|
139
|
+
var kt = /* @__PURE__ */ St();
|
|
140
|
+
const bt = /* @__PURE__ */ _e(kt);
|
|
141
|
+
var be = (e, t, n) => {
|
|
142
142
|
if (!t.has(e))
|
|
143
143
|
throw TypeError("Cannot " + n);
|
|
144
|
-
},
|
|
144
|
+
}, u = (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
|
-
},
|
|
149
|
-
function
|
|
150
|
-
return t != null ?
|
|
148
|
+
}, R = (e, t, n, s) => (be(e, t, "write to private field"), t.set(e, n), n);
|
|
149
|
+
function Et(e, t) {
|
|
150
|
+
return t != null ? bt(e, t) : e;
|
|
151
151
|
}
|
|
152
|
-
var v, Z, ee, V, G, H,
|
|
152
|
+
var v, Z, ee, V, G, H, F, ie, le, Mt = class {
|
|
153
153
|
constructor(e = []) {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
T(this, v, 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
|
+
R(this, v, u(this, v).concat(t)), u(this, F).call(this);
|
|
156
156
|
}, this.popMessage = () => {
|
|
157
|
-
|
|
157
|
+
R(this, v, u(this, v).slice(0, -1)), u(this, F).call(this);
|
|
158
158
|
}, this.replaceMessage = (t, n) => {
|
|
159
|
-
|
|
160
|
-
...
|
|
159
|
+
R(this, v, [
|
|
160
|
+
...u(this, v).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
|
+
...u(this, v).slice(t + 1)
|
|
164
|
+
]), u(this, F).call(this);
|
|
165
165
|
}, this.snapshot = (t) => structuredClone(t), this["~registerMessagesCallback"] = (t, n) => {
|
|
166
|
-
const s = n ?
|
|
167
|
-
return
|
|
168
|
-
|
|
166
|
+
const s = n ? Et(t, n) : t;
|
|
167
|
+
return u(this, V).add(s), () => {
|
|
168
|
+
u(this, V).delete(s);
|
|
169
169
|
};
|
|
170
|
-
}, this["~registerStatusCallback"] = (t) => (
|
|
171
|
-
|
|
172
|
-
}), this["~registerErrorCallback"] = (t) => (
|
|
173
|
-
|
|
174
|
-
}),
|
|
175
|
-
|
|
176
|
-
}),
|
|
177
|
-
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
}),
|
|
170
|
+
}, this["~registerStatusCallback"] = (t) => (u(this, G).add(t), () => {
|
|
171
|
+
u(this, G).delete(t);
|
|
172
|
+
}), this["~registerErrorCallback"] = (t) => (u(this, H).add(t), () => {
|
|
173
|
+
u(this, H).delete(t);
|
|
174
|
+
}), T(this, F, () => {
|
|
175
|
+
u(this, V).forEach((t) => t());
|
|
176
|
+
}), T(this, ie, () => {
|
|
177
|
+
u(this, G).forEach((t) => t());
|
|
178
|
+
}), T(this, le, () => {
|
|
179
|
+
u(this, H).forEach((t) => t());
|
|
180
|
+
}), R(this, v, e);
|
|
181
181
|
}
|
|
182
182
|
get status() {
|
|
183
|
-
return
|
|
183
|
+
return u(this, Z);
|
|
184
184
|
}
|
|
185
185
|
set status(e) {
|
|
186
|
-
|
|
186
|
+
R(this, Z, e), u(this, ie).call(this);
|
|
187
187
|
}
|
|
188
188
|
get error() {
|
|
189
|
-
return
|
|
189
|
+
return u(this, ee);
|
|
190
190
|
}
|
|
191
191
|
set error(e) {
|
|
192
|
-
|
|
192
|
+
R(this, ee, e), u(this, le).call(this);
|
|
193
193
|
}
|
|
194
194
|
get messages() {
|
|
195
|
-
return
|
|
195
|
+
return u(this, v);
|
|
196
196
|
}
|
|
197
197
|
set messages(e) {
|
|
198
|
-
|
|
198
|
+
R(this, v, [...e]), u(this, F).call(this);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
v = /* @__PURE__ */ new WeakMap();
|
|
@@ -204,22 +204,22 @@ ee = /* @__PURE__ */ new WeakMap();
|
|
|
204
204
|
V = /* @__PURE__ */ new WeakMap();
|
|
205
205
|
G = /* @__PURE__ */ new WeakMap();
|
|
206
206
|
H = /* @__PURE__ */ new WeakMap();
|
|
207
|
-
|
|
207
|
+
F = /* @__PURE__ */ new WeakMap();
|
|
208
208
|
ie = /* @__PURE__ */ new WeakMap();
|
|
209
209
|
le = /* @__PURE__ */ new WeakMap();
|
|
210
|
-
var
|
|
210
|
+
var L, we = class extends Xe {
|
|
211
211
|
constructor({ messages: e, ...t }) {
|
|
212
|
-
const n = new
|
|
213
|
-
super({ ...t, state: n }),
|
|
212
|
+
const n = new Mt(e);
|
|
213
|
+
super({ ...t, state: n }), T(this, L, void 0), this["~registerMessagesCallback"] = (s, o) => u(this, L)["~registerMessagesCallback"](s, o), this["~registerStatusCallback"] = (s) => u(this, L)["~registerStatusCallback"](s), this["~registerErrorCallback"] = (s) => u(this, L)["~registerErrorCallback"](s), R(this, L, n);
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
|
-
|
|
217
|
-
function
|
|
216
|
+
L = /* @__PURE__ */ new WeakMap();
|
|
217
|
+
function _t({
|
|
218
218
|
experimental_throttle: e,
|
|
219
219
|
resume: t = !1,
|
|
220
220
|
...n
|
|
221
221
|
} = {}) {
|
|
222
|
-
const s =
|
|
222
|
+
const s = W(
|
|
223
223
|
"chat" in n ? {} : {
|
|
224
224
|
onToolCall: n.onToolCall,
|
|
225
225
|
onData: n.onData,
|
|
@@ -237,40 +237,40 @@ function At({
|
|
|
237
237
|
});
|
|
238
238
|
const o = {
|
|
239
239
|
...n,
|
|
240
|
-
onToolCall: (
|
|
241
|
-
var p,
|
|
242
|
-
return (
|
|
240
|
+
onToolCall: (l) => {
|
|
241
|
+
var p, d;
|
|
242
|
+
return (d = (p = s.current).onToolCall) == null ? void 0 : d.call(p, l);
|
|
243
243
|
},
|
|
244
|
-
onData: (
|
|
245
|
-
var p,
|
|
246
|
-
return (
|
|
244
|
+
onData: (l) => {
|
|
245
|
+
var p, d;
|
|
246
|
+
return (d = (p = s.current).onData) == null ? void 0 : d.call(p, l);
|
|
247
247
|
},
|
|
248
|
-
onFinish: (
|
|
249
|
-
var p,
|
|
250
|
-
return (
|
|
248
|
+
onFinish: (l) => {
|
|
249
|
+
var p, d;
|
|
250
|
+
return (d = (p = s.current).onFinish) == null ? void 0 : d.call(p, l);
|
|
251
251
|
},
|
|
252
|
-
onError: (
|
|
253
|
-
var p,
|
|
254
|
-
return (
|
|
252
|
+
onError: (l) => {
|
|
253
|
+
var p, d;
|
|
254
|
+
return (d = (p = s.current).onError) == null ? void 0 : d.call(p, l);
|
|
255
255
|
},
|
|
256
|
-
sendAutomaticallyWhen: (
|
|
257
|
-
var p,
|
|
258
|
-
return (
|
|
256
|
+
sendAutomaticallyWhen: (l) => {
|
|
257
|
+
var p, d, P;
|
|
258
|
+
return (P = (d = (p = s.current).sendAutomaticallyWhen) == null ? void 0 : d.call(p, l)) != null ? P : !1;
|
|
259
259
|
}
|
|
260
|
-
}, r =
|
|
260
|
+
}, r = W(
|
|
261
261
|
"chat" in n ? n.chat : new we(o)
|
|
262
262
|
);
|
|
263
263
|
("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 we(o));
|
|
264
264
|
const i = f(
|
|
265
|
-
(
|
|
265
|
+
(l) => r.current["~registerMessagesCallback"](l, e),
|
|
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
|
+
), c = re(
|
|
270
270
|
i,
|
|
271
271
|
() => r.current.messages,
|
|
272
272
|
() => r.current.messages
|
|
273
|
-
),
|
|
273
|
+
), h = re(
|
|
274
274
|
r.current["~registerStatusCallback"],
|
|
275
275
|
() => r.current.status,
|
|
276
276
|
() => r.current.status
|
|
@@ -279,16 +279,16 @@ function At({
|
|
|
279
279
|
() => r.current.error,
|
|
280
280
|
() => r.current.error
|
|
281
281
|
), I = f(
|
|
282
|
-
(
|
|
283
|
-
typeof
|
|
282
|
+
(l) => {
|
|
283
|
+
typeof l == "function" && (l = l(r.current.messages)), r.current.messages = l;
|
|
284
284
|
},
|
|
285
285
|
[r]
|
|
286
286
|
);
|
|
287
|
-
return
|
|
287
|
+
return k(() => {
|
|
288
288
|
t && r.current.resumeStream();
|
|
289
289
|
}, [t, r]), {
|
|
290
290
|
id: r.current.id,
|
|
291
|
-
messages:
|
|
291
|
+
messages: c,
|
|
292
292
|
setMessages: I,
|
|
293
293
|
sendMessage: r.current.sendMessage,
|
|
294
294
|
regenerate: r.current.regenerate,
|
|
@@ -296,7 +296,7 @@ function At({
|
|
|
296
296
|
stop: r.current.stop,
|
|
297
297
|
error: C,
|
|
298
298
|
resumeStream: r.current.resumeStream,
|
|
299
|
-
status:
|
|
299
|
+
status: h,
|
|
300
300
|
/**
|
|
301
301
|
* @deprecated Use `addToolOutput` instead.
|
|
302
302
|
*/
|
|
@@ -305,15 +305,15 @@ function At({
|
|
|
305
305
|
addToolApprovalResponse: r.current.addToolApprovalResponse
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
const
|
|
309
|
-
function
|
|
308
|
+
const Rt = 20;
|
|
309
|
+
function $t(e) {
|
|
310
310
|
if (e.length === 0)
|
|
311
311
|
return "No OpenAPI specs loaded.";
|
|
312
|
-
const t = e.slice(0,
|
|
312
|
+
const t = e.slice(0, Rt), n = t.map(Pt), s = e.length - t.length;
|
|
313
313
|
return s > 0 && n.push(` …and ${s} more API(s) not shown.`), [`Loaded APIs (${e.length}):`, ...n].join(`
|
|
314
314
|
`);
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function Pt(e) {
|
|
317
317
|
return [
|
|
318
318
|
` apiId="${e.apiId}"`,
|
|
319
319
|
`title="${e.title}"`,
|
|
@@ -321,23 +321,23 @@ function bt(e) {
|
|
|
321
321
|
e.primaryServer ? `server="${e.primaryServer}"` : null
|
|
322
322
|
].filter(Boolean).join(" ");
|
|
323
323
|
}
|
|
324
|
-
const
|
|
325
|
-
function
|
|
324
|
+
const xt = 30;
|
|
325
|
+
function Dt(e) {
|
|
326
326
|
if (e.length === 0)
|
|
327
327
|
return "No Arazzo collections loaded.";
|
|
328
328
|
const t = [`Arazzo collections (${e.length}):`];
|
|
329
|
-
let n =
|
|
329
|
+
let n = xt, s = 0, o = 0;
|
|
330
330
|
for (const a of e) {
|
|
331
331
|
if (n <= 0) {
|
|
332
332
|
s += a.workflows.length, o++;
|
|
333
333
|
continue;
|
|
334
334
|
}
|
|
335
|
-
if (t.push(
|
|
335
|
+
if (t.push(Wt(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--;
|
|
339
339
|
for (const i of a.workflows)
|
|
340
|
-
n > 0 ? (t.push(` ${
|
|
340
|
+
n > 0 ? (t.push(` ${Bt(i)}`), n--) : s++;
|
|
341
341
|
} else
|
|
342
342
|
s += a.workflows.length;
|
|
343
343
|
}
|
|
@@ -348,43 +348,43 @@ function Et(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 Wt(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
|
}
|
|
355
|
-
function
|
|
355
|
+
function Bt(e) {
|
|
356
356
|
const t = `id="${e.workflowId}"`, n = e.summary ? `label="${e.summary}"` : null, s = `[${e.stepCount} step${e.stepCount !== 1 ? "s" : ""}]`;
|
|
357
357
|
return [t, n, s].filter(Boolean).join(" ");
|
|
358
358
|
}
|
|
359
|
-
const
|
|
360
|
-
function
|
|
359
|
+
const Ot = 20;
|
|
360
|
+
function Ut(e) {
|
|
361
361
|
if (e.length === 0)
|
|
362
362
|
return "No environments configured.";
|
|
363
|
-
const t = e.slice(0,
|
|
363
|
+
const t = e.slice(0, Ot), n = t.map(Ft), s = e.length - t.length;
|
|
364
364
|
return s > 0 && n.push(` …and ${s} more environment(s) not shown.`), [`Environments (${e.length}); * marks the active environment:`, ...n].join(
|
|
365
365
|
`
|
|
366
366
|
`
|
|
367
367
|
);
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function Ft(e) {
|
|
370
370
|
return [
|
|
371
371
|
`${e.isActive ? "*" : " "} name="${e.name}"`,
|
|
372
372
|
`inputs=${e.inputCount}`,
|
|
373
373
|
`servers=${e.serverCount}`
|
|
374
374
|
].join(" ");
|
|
375
375
|
}
|
|
376
|
-
const
|
|
377
|
-
function
|
|
376
|
+
const Lt = 30;
|
|
377
|
+
function jt(e) {
|
|
378
378
|
if (e.length === 0)
|
|
379
379
|
return "No tabs are open.";
|
|
380
|
-
const t = e.slice(0,
|
|
380
|
+
const t = e.slice(0, Lt), n = t.map(Nt), s = e.length - t.length;
|
|
381
381
|
return s > 0 && n.push(` …and ${s} more tab(s) not shown.`), [
|
|
382
382
|
`Open tabs (${e.length}), listed by tabIndex; * marks the active (focused) tab:`,
|
|
383
383
|
...n
|
|
384
384
|
].join(`
|
|
385
385
|
`);
|
|
386
386
|
}
|
|
387
|
-
function
|
|
387
|
+
function Nt(e) {
|
|
388
388
|
const t = [
|
|
389
389
|
e.collectionId ? `collectionId="${e.collectionId}"` : null,
|
|
390
390
|
e.workflowId ? `workflowId="${e.workflowId}"` : null,
|
|
@@ -403,26 +403,26 @@ function Wt(e) {
|
|
|
403
403
|
n.length > 0 ? `(${n.join(", ")})` : null
|
|
404
404
|
].filter(Boolean).join(" ");
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
function
|
|
406
|
+
const Kt = "Auto-attached snapshot of the user's current Replay UI state. Generated by Replay before each step; not written by the user. It is a shallow summary — use tools to read detailed tab contents when needed.";
|
|
407
|
+
function qt(e) {
|
|
408
408
|
const t = `
|
|
409
409
|
`.repeat(2), n = [
|
|
410
|
-
|
|
410
|
+
Kt,
|
|
411
411
|
t,
|
|
412
|
-
|
|
412
|
+
jt(e.tabs),
|
|
413
413
|
t,
|
|
414
|
-
|
|
414
|
+
$t(e.apis),
|
|
415
415
|
t,
|
|
416
|
-
|
|
416
|
+
Dt(e.collections),
|
|
417
417
|
t,
|
|
418
|
-
|
|
418
|
+
Ut(e.environments)
|
|
419
419
|
].join("");
|
|
420
|
-
return
|
|
420
|
+
return nt("active_state", n);
|
|
421
421
|
}
|
|
422
|
-
function
|
|
423
|
-
return e.
|
|
422
|
+
function Qt(e) {
|
|
423
|
+
return e.map(Vt);
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function Vt(e) {
|
|
426
426
|
return {
|
|
427
427
|
apiId: e.id,
|
|
428
428
|
title: e.info?.title ?? "Untitled API",
|
|
@@ -430,10 +430,10 @@ function Ft(e) {
|
|
|
430
430
|
primaryServer: e.servers?.[0]?.url
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
|
-
function
|
|
434
|
-
return e.
|
|
433
|
+
function Gt(e) {
|
|
434
|
+
return e.map(Ht);
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function Ht(e) {
|
|
437
437
|
const t = (e.workflows ?? []).map((s) => ({
|
|
438
438
|
workflowId: s.workflowId,
|
|
439
439
|
summary: s.summary,
|
|
@@ -446,22 +446,20 @@ function jt(e) {
|
|
|
446
446
|
sourceApiIds: n
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
|
-
function
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
serverCount: s.servers.length
|
|
449
|
+
function zt(e, t) {
|
|
450
|
+
return e.filter((n) => n.state !== Re.Draft).map((n) => ({
|
|
451
|
+
name: n.name,
|
|
452
|
+
isActive: n.name === t,
|
|
453
|
+
inputCount: n.inputs.length,
|
|
454
|
+
serverCount: n.servers.length
|
|
456
455
|
}));
|
|
457
456
|
}
|
|
458
|
-
function
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
(s, o) => qt(e, s, o, o === n)
|
|
457
|
+
function Yt(e, t, n) {
|
|
458
|
+
return e.map(
|
|
459
|
+
(s, o) => Jt(n, s, o, o === t)
|
|
462
460
|
);
|
|
463
461
|
}
|
|
464
|
-
function
|
|
462
|
+
function Jt(e, t, n, s) {
|
|
465
463
|
const o = {
|
|
466
464
|
tabIndex: n,
|
|
467
465
|
type: t.data.type,
|
|
@@ -469,33 +467,33 @@ function qt(e, t, n, s) {
|
|
|
469
467
|
isPreview: t.state === $e.Preview
|
|
470
468
|
};
|
|
471
469
|
switch (t.data.type) {
|
|
472
|
-
case
|
|
470
|
+
case $.Collection: {
|
|
473
471
|
const { collectionId: r } = t.data;
|
|
474
472
|
return {
|
|
475
473
|
...o,
|
|
476
|
-
label:
|
|
474
|
+
label: Xt(e, r) ?? r,
|
|
477
475
|
collectionId: r
|
|
478
476
|
};
|
|
479
477
|
}
|
|
480
|
-
case
|
|
478
|
+
case $.Workflow: {
|
|
481
479
|
const { collectionId: r, workflowId: a } = t.data;
|
|
482
480
|
return { ...o, label: a, collectionId: r, workflowId: a };
|
|
483
481
|
}
|
|
484
|
-
case
|
|
485
|
-
const { collectionId: r, workflowId: a, historyId: i, label:
|
|
482
|
+
case $.WorkflowRun: {
|
|
483
|
+
const { collectionId: r, workflowId: a, historyId: i, label: c } = t.data;
|
|
486
484
|
return {
|
|
487
485
|
...o,
|
|
488
|
-
label:
|
|
486
|
+
label: c ?? `${a} run`,
|
|
489
487
|
collectionId: r,
|
|
490
488
|
workflowId: a,
|
|
491
489
|
isHistory: i != null
|
|
492
490
|
};
|
|
493
491
|
}
|
|
494
|
-
case
|
|
492
|
+
case $.Step: {
|
|
495
493
|
const r = t.data;
|
|
496
494
|
return {
|
|
497
495
|
...o,
|
|
498
|
-
label:
|
|
496
|
+
label: Zt(r),
|
|
499
497
|
collectionId: r.collectionId,
|
|
500
498
|
workflowId: r.workflowId,
|
|
501
499
|
stepId: r.stepId,
|
|
@@ -506,71 +504,75 @@ function qt(e, t, n, s) {
|
|
|
506
504
|
}
|
|
507
505
|
}
|
|
508
506
|
}
|
|
509
|
-
function
|
|
510
|
-
return e.
|
|
507
|
+
function Xt(e, t) {
|
|
508
|
+
return e.find((n) => n.id === t)?.info.title;
|
|
511
509
|
}
|
|
512
|
-
function
|
|
510
|
+
function Zt(e) {
|
|
513
511
|
if (e.stepId)
|
|
514
512
|
return e.stepId;
|
|
515
513
|
if (e.draftStep) {
|
|
516
|
-
const t = [Pe(e.draftStep),
|
|
514
|
+
const t = [Pe(e.draftStep), xe(e.draftStep)].filter(Boolean).join(" ");
|
|
517
515
|
if (t)
|
|
518
516
|
return t;
|
|
519
517
|
}
|
|
520
518
|
return "New Request";
|
|
521
519
|
}
|
|
522
|
-
function
|
|
520
|
+
function en(e) {
|
|
521
|
+
const t = e.get(De);
|
|
523
522
|
return {
|
|
524
|
-
tabs:
|
|
525
|
-
apis:
|
|
526
|
-
collections:
|
|
527
|
-
environments:
|
|
523
|
+
tabs: Yt(e.get(Fe), e.get(Ue), t),
|
|
524
|
+
apis: Qt(e.get(Oe)),
|
|
525
|
+
collections: Gt(t),
|
|
526
|
+
environments: zt(
|
|
527
|
+
e.get(Be),
|
|
528
|
+
e.get(We)
|
|
529
|
+
)
|
|
528
530
|
};
|
|
529
531
|
}
|
|
530
|
-
function
|
|
531
|
-
const
|
|
532
|
+
function tn() {
|
|
533
|
+
const e = Le(), { tab: t } = je(), n = t?.data ?? null;
|
|
532
534
|
return w(() => {
|
|
533
|
-
if (!
|
|
535
|
+
if (!n)
|
|
534
536
|
return null;
|
|
535
|
-
switch (
|
|
536
|
-
case
|
|
537
|
-
const
|
|
537
|
+
switch (n.type) {
|
|
538
|
+
case $.Collection:
|
|
539
|
+
const o = Ke(e, n.collectionId);
|
|
538
540
|
return {
|
|
539
|
-
...
|
|
540
|
-
collection:
|
|
541
|
+
...n,
|
|
542
|
+
collection: o
|
|
541
543
|
};
|
|
542
|
-
case
|
|
543
|
-
const
|
|
544
|
-
collectionId:
|
|
545
|
-
workflowId:
|
|
544
|
+
case $.Workflow:
|
|
545
|
+
const r = fe(e, {
|
|
546
|
+
collectionId: n.collectionId,
|
|
547
|
+
workflowId: n.workflowId
|
|
546
548
|
});
|
|
547
549
|
return {
|
|
548
|
-
...
|
|
549
|
-
workflow:
|
|
550
|
+
...n,
|
|
551
|
+
workflow: r
|
|
550
552
|
};
|
|
551
|
-
case
|
|
552
|
-
const
|
|
553
|
-
collectionId:
|
|
554
|
-
workflowId:
|
|
555
|
-
stepId:
|
|
553
|
+
case $.Step:
|
|
554
|
+
const a = Ne(e, {
|
|
555
|
+
collectionId: n.collectionId,
|
|
556
|
+
workflowId: n.workflowId,
|
|
557
|
+
stepId: n.stepId
|
|
556
558
|
});
|
|
557
559
|
return {
|
|
558
|
-
...
|
|
559
|
-
step:
|
|
560
|
+
...n,
|
|
561
|
+
step: a
|
|
560
562
|
};
|
|
561
|
-
case
|
|
562
|
-
const
|
|
563
|
-
collectionId:
|
|
564
|
-
workflowId:
|
|
563
|
+
case $.WorkflowRun:
|
|
564
|
+
const i = fe(e, {
|
|
565
|
+
collectionId: n.collectionId,
|
|
566
|
+
workflowId: n.workflowId
|
|
565
567
|
});
|
|
566
568
|
return {
|
|
567
|
-
...
|
|
568
|
-
workflow:
|
|
569
|
+
...n,
|
|
570
|
+
workflow: i
|
|
569
571
|
};
|
|
570
572
|
}
|
|
571
|
-
}, [
|
|
573
|
+
}, [n, e]);
|
|
572
574
|
}
|
|
573
|
-
function
|
|
575
|
+
function nn(e) {
|
|
574
576
|
if (!e || typeof e != "object" || !("changes" in e) || !Array.isArray(e.changes))
|
|
575
577
|
return e;
|
|
576
578
|
const t = e.changes.filter(
|
|
@@ -586,11 +588,11 @@ function zt(e) {
|
|
|
586
588
|
}
|
|
587
589
|
};
|
|
588
590
|
}
|
|
589
|
-
function
|
|
590
|
-
return (e, t) => (n, s) => t(
|
|
591
|
+
function sn() {
|
|
592
|
+
return (e, t) => (n, s) => t(nn(n), s);
|
|
591
593
|
}
|
|
592
|
-
function
|
|
593
|
-
const { getApiOperation: e } =
|
|
594
|
+
function rn() {
|
|
595
|
+
const { getApiOperation: e } = qe(), t = Ae();
|
|
594
596
|
return w(
|
|
595
597
|
() => ({
|
|
596
598
|
getApiOperation: e,
|
|
@@ -599,32 +601,32 @@ function Jt() {
|
|
|
599
601
|
[e, t]
|
|
600
602
|
);
|
|
601
603
|
}
|
|
602
|
-
function
|
|
603
|
-
const { convertOperationToReplayValue: t } = se(), n =
|
|
604
|
-
return
|
|
605
|
-
const I = new
|
|
606
|
-
middlewares: [
|
|
604
|
+
function on(e) {
|
|
605
|
+
const { convertOperationToReplayValue: t } = se(), n = tn(), s = rn(), o = ue(), r = Te(), { attachApiToCollection: a } = Qe(), { handleCloseByDataId: i } = Ae(), c = Ve(), h = W(n);
|
|
606
|
+
return h.current = n, { tools: w(() => {
|
|
607
|
+
const I = new At({
|
|
608
|
+
middlewares: [sn()]
|
|
607
609
|
});
|
|
608
|
-
return
|
|
609
|
-
[
|
|
610
|
-
[
|
|
611
|
-
[
|
|
612
|
-
[
|
|
613
|
-
[
|
|
614
|
-
[
|
|
610
|
+
return st(I, {
|
|
611
|
+
[gt.name]: void 0,
|
|
612
|
+
[ft.name]: { settings: o, store: r },
|
|
613
|
+
[pt.name]: { store: r, runWorkflow: c },
|
|
614
|
+
[ht.name]: { store: r },
|
|
615
|
+
[dt.name]: { store: r },
|
|
616
|
+
[ut.name]: {
|
|
615
617
|
store: r,
|
|
616
618
|
attachApiToCollection: a,
|
|
617
619
|
handleCloseByDataId: i,
|
|
618
620
|
convertOperationToReplayValue: t
|
|
619
621
|
},
|
|
620
|
-
[
|
|
621
|
-
[
|
|
622
|
-
[
|
|
623
|
-
[
|
|
624
|
-
[
|
|
625
|
-
getActiveTabDetailedData: () =>
|
|
622
|
+
[ct.name]: { store: r },
|
|
623
|
+
[lt.name]: { model: e },
|
|
624
|
+
[it.name]: { store: r },
|
|
625
|
+
[at.name]: { store: r, context: s },
|
|
626
|
+
[ot.name]: {
|
|
627
|
+
getActiveTabDetailedData: () => h.current
|
|
626
628
|
},
|
|
627
|
-
[
|
|
629
|
+
[rt.name]: { store: r }
|
|
628
630
|
}), I.getToolSet();
|
|
629
631
|
}, [
|
|
630
632
|
a,
|
|
@@ -632,134 +634,134 @@ function Xt(e) {
|
|
|
632
634
|
i,
|
|
633
635
|
e,
|
|
634
636
|
s,
|
|
635
|
-
|
|
637
|
+
c,
|
|
636
638
|
o,
|
|
637
639
|
r
|
|
638
640
|
]) };
|
|
639
641
|
}
|
|
640
|
-
function
|
|
641
|
-
const { children: t, chatId: n, model: s, initialMessages: o, onChatFinish: r, onChatMessagesUpdated: a } = e, i = ue(), { getReuniteAuth:
|
|
642
|
-
I.current =
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
const
|
|
648
|
-
return new
|
|
642
|
+
function an(e) {
|
|
643
|
+
const { children: t, chatId: n, model: s, initialMessages: o, onChatFinish: r, onChatMessagesUpdated: a } = e, i = ue(), { getReuniteAuth: c } = se(), { tools: h } = on(s), { sendEvent: C } = Ge(), I = W(h), l = W(s), { isOpen: p, openPanel: d, closePanel: P } = ye(), x = W(void 0), j = Te();
|
|
644
|
+
I.current = h, l.current = s;
|
|
645
|
+
const g = w(() => {
|
|
646
|
+
x.current?.end();
|
|
647
|
+
const M = ge.getTracer("replay-ai-chat").startSpan("ai.chat.session", { attributes: { conversation_id: n } });
|
|
648
|
+
x.current = M;
|
|
649
|
+
const _ = ge.setSpan(He.active(), M);
|
|
650
|
+
return new tt({
|
|
649
651
|
activeConversationId: n,
|
|
650
|
-
model:
|
|
652
|
+
model: l.current,
|
|
651
653
|
tools: I.current,
|
|
652
654
|
sendEvent: C,
|
|
653
|
-
parentCtx:
|
|
654
|
-
getActiveStateMessage: () =>
|
|
655
|
+
parentCtx: _,
|
|
656
|
+
getActiveStateMessage: () => qt(en(j))
|
|
655
657
|
});
|
|
656
|
-
}, [n, C]);
|
|
657
|
-
|
|
658
|
-
const
|
|
659
|
-
if (
|
|
660
|
-
return new
|
|
661
|
-
}, [
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
}, [
|
|
665
|
-
|
|
666
|
-
}, [
|
|
658
|
+
}, [n, C, j]);
|
|
659
|
+
k(() => () => x.current?.end(), []);
|
|
660
|
+
const B = w(() => {
|
|
661
|
+
if (g)
|
|
662
|
+
return new Ze({ agent: g.getAgent() });
|
|
663
|
+
}, [g]);
|
|
664
|
+
k(() => {
|
|
665
|
+
g.setModel(s);
|
|
666
|
+
}, [g, s]), k(() => {
|
|
667
|
+
g.registerTools(h);
|
|
668
|
+
}, [g, h]);
|
|
667
669
|
const {
|
|
668
|
-
messages:
|
|
670
|
+
messages: b,
|
|
669
671
|
setMessages: D,
|
|
670
|
-
sendMessage:
|
|
671
|
-
status:
|
|
672
|
+
sendMessage: N,
|
|
673
|
+
status: E,
|
|
672
674
|
error: Y,
|
|
673
|
-
stop:
|
|
674
|
-
addToolApprovalResponse:
|
|
675
|
-
} =
|
|
675
|
+
stop: O,
|
|
676
|
+
addToolApprovalResponse: K
|
|
677
|
+
} = _t({
|
|
676
678
|
id: n,
|
|
677
679
|
messages: o,
|
|
678
|
-
transport:
|
|
679
|
-
sendAutomaticallyWhen:
|
|
680
|
-
onFinish(
|
|
681
|
-
if (!r || !
|
|
682
|
-
r({ agentLoop:
|
|
680
|
+
transport: B,
|
|
681
|
+
sendAutomaticallyWhen: et,
|
|
682
|
+
onFinish(M) {
|
|
683
|
+
if (!r || !g) return;
|
|
684
|
+
r({ agentLoop: g, chat: this }, M);
|
|
683
685
|
}
|
|
684
|
-
}),
|
|
685
|
-
i.aiEnabled
|
|
686
|
-
}, [
|
|
687
|
-
|
|
688
|
-
}, [
|
|
689
|
-
async (
|
|
690
|
-
const
|
|
691
|
-
if (!(!
|
|
686
|
+
}), y = w(() => E === "streaming" || E === "submitted", [E]), q = f(() => {
|
|
687
|
+
i.aiEnabled === !0 && d();
|
|
688
|
+
}, [d, i.aiEnabled]), Q = f(() => {
|
|
689
|
+
P();
|
|
690
|
+
}, [P]), J = f(
|
|
691
|
+
async (M) => {
|
|
692
|
+
const _ = M.trim();
|
|
693
|
+
if (!(!_ || !B)) {
|
|
692
694
|
if (s.provider === ne) {
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
+
const A = await c?.();
|
|
696
|
+
A?.baseUrl && A?.accessToken && g.setModel({
|
|
695
697
|
provider: ne,
|
|
696
|
-
baseUrl:
|
|
697
|
-
accessToken:
|
|
698
|
+
baseUrl: A.baseUrl,
|
|
699
|
+
accessToken: A.accessToken
|
|
698
700
|
});
|
|
699
701
|
}
|
|
700
702
|
D(
|
|
701
|
-
(
|
|
702
|
-
),
|
|
703
|
+
(A) => mt(A) ? vt(A) : A
|
|
704
|
+
), N({ text: _ });
|
|
703
705
|
}
|
|
704
706
|
},
|
|
705
|
-
[
|
|
706
|
-
),
|
|
707
|
-
|
|
708
|
-
}, [
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
}, [n,
|
|
712
|
-
const
|
|
713
|
-
(
|
|
714
|
-
const
|
|
715
|
-
for (const X of
|
|
716
|
-
|
|
717
|
-
D(
|
|
707
|
+
[g, c, s.provider, N, D, B]
|
|
708
|
+
), m = f(() => {
|
|
709
|
+
y && O();
|
|
710
|
+
}, [y, O]);
|
|
711
|
+
k(() => () => {
|
|
712
|
+
O();
|
|
713
|
+
}, [n, O]);
|
|
714
|
+
const U = f(
|
|
715
|
+
(M) => {
|
|
716
|
+
const _ = M(b), A = _.map((X) => X.message), pe = [...b];
|
|
717
|
+
for (const X of _)
|
|
718
|
+
pe[X.index] = X.message;
|
|
719
|
+
D(pe), a?.(A);
|
|
718
720
|
},
|
|
719
|
-
[
|
|
720
|
-
),
|
|
721
|
+
[b, a, D]
|
|
722
|
+
), Ee = w(
|
|
721
723
|
() => ({
|
|
722
|
-
messages:
|
|
723
|
-
isStreaming:
|
|
724
|
-
chatStatus:
|
|
724
|
+
messages: b,
|
|
725
|
+
isStreaming: y,
|
|
726
|
+
chatStatus: E,
|
|
725
727
|
chatError: Y,
|
|
726
|
-
sendMessage:
|
|
727
|
-
updateMessages:
|
|
728
|
-
stopGeneration:
|
|
729
|
-
addToolApprovalResponse:
|
|
728
|
+
sendMessage: J,
|
|
729
|
+
updateMessages: U,
|
|
730
|
+
stopGeneration: m,
|
|
731
|
+
addToolApprovalResponse: K
|
|
730
732
|
}),
|
|
731
733
|
[
|
|
732
|
-
|
|
734
|
+
K,
|
|
733
735
|
Y,
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
736
|
+
y,
|
|
737
|
+
b,
|
|
738
|
+
J,
|
|
739
|
+
E,
|
|
740
|
+
m,
|
|
741
|
+
U
|
|
740
742
|
]
|
|
741
|
-
),
|
|
743
|
+
), Me = w(
|
|
742
744
|
() => ({
|
|
743
745
|
isOpen: p,
|
|
744
|
-
openPanel:
|
|
745
|
-
closePanel:
|
|
746
|
+
openPanel: q,
|
|
747
|
+
closePanel: Q
|
|
746
748
|
}),
|
|
747
|
-
[p,
|
|
749
|
+
[p, q, Q]
|
|
748
750
|
);
|
|
749
|
-
return /* @__PURE__ */ te(
|
|
751
|
+
return /* @__PURE__ */ te(wt.Provider, { value: Ee, children: /* @__PURE__ */ te(ze.Provider, { value: Me, children: t }) });
|
|
750
752
|
}
|
|
751
|
-
function
|
|
753
|
+
function ln(e) {
|
|
752
754
|
return e.slice(-2);
|
|
753
755
|
}
|
|
754
|
-
function
|
|
756
|
+
function cn(e, t) {
|
|
755
757
|
return !!(e || t < 1);
|
|
756
758
|
}
|
|
757
|
-
function
|
|
759
|
+
function un(e) {
|
|
758
760
|
return f(
|
|
759
761
|
async (t, n) => {
|
|
760
|
-
if (
|
|
762
|
+
if (cn(e, n.messages.length))
|
|
761
763
|
return null;
|
|
762
|
-
const s = n.messages[0], o =
|
|
764
|
+
const s = n.messages[0], o = Ct(s.parts);
|
|
763
765
|
try {
|
|
764
766
|
return (await t.agentLoop.generateTitle(o)).trim();
|
|
765
767
|
} catch (r) {
|
|
@@ -769,12 +771,12 @@ function nn(e) {
|
|
|
769
771
|
[e]
|
|
770
772
|
);
|
|
771
773
|
}
|
|
772
|
-
function
|
|
774
|
+
function dn({
|
|
773
775
|
chatId: e,
|
|
774
776
|
model: t,
|
|
775
777
|
existingTitle: n
|
|
776
778
|
}) {
|
|
777
|
-
const { mutate: s } =
|
|
779
|
+
const { mutate: s } = Tt(e), o = un(n);
|
|
778
780
|
return f(
|
|
779
781
|
async (...r) => {
|
|
780
782
|
const a = await o(...r);
|
|
@@ -788,11 +790,11 @@ function sn({
|
|
|
788
790
|
[o, t, e, s]
|
|
789
791
|
);
|
|
790
792
|
}
|
|
791
|
-
function
|
|
793
|
+
function hn({ chatId: e, model: t }) {
|
|
792
794
|
const { mutate: n } = ke();
|
|
793
795
|
return f(
|
|
794
796
|
(s, o) => {
|
|
795
|
-
const r =
|
|
797
|
+
const r = ln(
|
|
796
798
|
o.messages
|
|
797
799
|
);
|
|
798
800
|
n({
|
|
@@ -804,7 +806,7 @@ function rn({ chatId: e, model: t }) {
|
|
|
804
806
|
[t, e, n]
|
|
805
807
|
);
|
|
806
808
|
}
|
|
807
|
-
function
|
|
809
|
+
function pn({ chatId: e, model: t }) {
|
|
808
810
|
const { mutate: n } = ke();
|
|
809
811
|
return f(
|
|
810
812
|
(s) => {
|
|
@@ -817,7 +819,7 @@ function on({ chatId: e, model: t }) {
|
|
|
817
819
|
[t, e, n]
|
|
818
820
|
);
|
|
819
821
|
}
|
|
820
|
-
function
|
|
822
|
+
function fn(e) {
|
|
821
823
|
return w(() => {
|
|
822
824
|
const t = [ae];
|
|
823
825
|
if (e) {
|
|
@@ -844,59 +846,59 @@ function Ie(e, t) {
|
|
|
844
846
|
return Ce(t);
|
|
845
847
|
}
|
|
846
848
|
}
|
|
847
|
-
function
|
|
849
|
+
function gn(e, t) {
|
|
848
850
|
try {
|
|
849
851
|
globalThis.localStorage.setItem(e, t);
|
|
850
852
|
} catch {
|
|
851
853
|
console.error("Failed to write to localStorage", { key: e, value: t });
|
|
852
854
|
}
|
|
853
855
|
}
|
|
854
|
-
function
|
|
855
|
-
const [n, s] = z(() => Ie(e, t)), o =
|
|
856
|
-
o.current = t,
|
|
856
|
+
function mn(e, t) {
|
|
857
|
+
const [n, s] = z(() => Ie(e, t)), o = W(t);
|
|
858
|
+
o.current = t, k(() => {
|
|
857
859
|
s(Ie(e, o.current));
|
|
858
860
|
}, [e]);
|
|
859
861
|
const r = f(
|
|
860
862
|
(a) => {
|
|
861
863
|
s((i) => {
|
|
862
|
-
const
|
|
863
|
-
return
|
|
864
|
+
const c = a instanceof Function ? a(i) : a;
|
|
865
|
+
return gn(e, c), c;
|
|
864
866
|
});
|
|
865
867
|
},
|
|
866
868
|
[e]
|
|
867
869
|
);
|
|
868
870
|
return [n, r];
|
|
869
871
|
}
|
|
870
|
-
const
|
|
871
|
-
function
|
|
872
|
-
const { availableModels: t, aiProviders: n, reuniteAuth: s } = e, [o, r] =
|
|
873
|
-
|
|
872
|
+
const vn = "replay:ai:selectedModelId";
|
|
873
|
+
function wn(e) {
|
|
874
|
+
const { availableModels: t, aiProviders: n, reuniteAuth: s } = e, [o, r] = mn(
|
|
875
|
+
vn,
|
|
874
876
|
ae.id
|
|
875
877
|
);
|
|
876
|
-
return
|
|
877
|
-
t.find((
|
|
878
|
+
return k(() => {
|
|
879
|
+
t.find((c) => c.id === o) || r(ae.id);
|
|
878
880
|
}, [t, o, r]), { model: w(() => {
|
|
879
881
|
const i = {
|
|
880
882
|
provider: ne,
|
|
881
883
|
baseUrl: s.baseUrl,
|
|
882
884
|
accessToken: s.accessToken
|
|
883
|
-
},
|
|
884
|
-
if (!
|
|
885
|
+
}, c = t.find((C) => C.id === o);
|
|
886
|
+
if (!c || c.provider === ne)
|
|
885
887
|
return i;
|
|
886
|
-
const
|
|
887
|
-
return !
|
|
888
|
-
provider:
|
|
889
|
-
modelId:
|
|
890
|
-
apiKey:
|
|
888
|
+
const h = n?.[c.provider];
|
|
889
|
+
return !h || !h.apiKey || !h.enabled ? i : {
|
|
890
|
+
provider: c.provider,
|
|
891
|
+
modelId: c.id,
|
|
892
|
+
apiKey: h.apiKey
|
|
891
893
|
};
|
|
892
894
|
}, [o, t, n, s]), selectedModelId: o, selectModel: r };
|
|
893
895
|
}
|
|
894
|
-
function
|
|
896
|
+
function Cn() {
|
|
895
897
|
const [e, t] = z({
|
|
896
898
|
baseUrl: "",
|
|
897
899
|
accessToken: ""
|
|
898
900
|
}), { getReuniteAuth: n } = se();
|
|
899
|
-
return
|
|
901
|
+
return k(() => {
|
|
900
902
|
let s = !1;
|
|
901
903
|
async function o() {
|
|
902
904
|
const r = await n?.();
|
|
@@ -915,92 +917,92 @@ function hn() {
|
|
|
915
917
|
};
|
|
916
918
|
}, [n]), e;
|
|
917
919
|
}
|
|
918
|
-
function
|
|
919
|
-
const { children: t } = e, [n, s] = z(me), [o, r] = z(n), [a, i] = z(null),
|
|
920
|
-
const
|
|
921
|
-
r(
|
|
922
|
-
}, []), p = f((
|
|
923
|
-
r(
|
|
924
|
-
}, []), { data:
|
|
925
|
-
availableModels:
|
|
926
|
-
aiProviders:
|
|
927
|
-
reuniteAuth:
|
|
928
|
-
}),
|
|
920
|
+
function _n(e) {
|
|
921
|
+
const { children: t } = e, [n, s] = z(me), [o, r] = z(n), [a, i] = z(null), c = ue(), h = se(), { openPanel: C } = ye(), I = o !== n, l = f(() => {
|
|
922
|
+
const m = me();
|
|
923
|
+
r(m), s(m);
|
|
924
|
+
}, []), p = f((m) => {
|
|
925
|
+
r(m);
|
|
926
|
+
}, []), { data: d } = It(o), P = Cn(), x = fn(h.aiProviders), { selectedModelId: j, model: g, selectModel: B } = wn({
|
|
927
|
+
availableModels: x,
|
|
928
|
+
aiProviders: h.aiProviders,
|
|
929
|
+
reuniteAuth: P
|
|
930
|
+
}), b = yt(), D = hn({ chatId: n, model: g }), N = pn({ chatId: n, model: g }), E = dn({
|
|
929
931
|
chatId: n,
|
|
930
|
-
model:
|
|
931
|
-
existingTitle:
|
|
932
|
-
}),
|
|
933
|
-
(
|
|
934
|
-
|
|
932
|
+
model: g,
|
|
933
|
+
existingTitle: d?.title
|
|
934
|
+
}), Y = f(
|
|
935
|
+
(m, U) => {
|
|
936
|
+
U.isAbort || (D(m, U), E(m, U));
|
|
935
937
|
},
|
|
936
|
-
[
|
|
937
|
-
),
|
|
938
|
-
(...
|
|
939
|
-
|
|
938
|
+
[D, E]
|
|
939
|
+
), O = f(
|
|
940
|
+
(...m) => {
|
|
941
|
+
N(...m);
|
|
940
942
|
},
|
|
941
|
-
[
|
|
942
|
-
),
|
|
943
|
-
(
|
|
944
|
-
(o ===
|
|
943
|
+
[N]
|
|
944
|
+
), K = f(
|
|
945
|
+
(m) => {
|
|
946
|
+
(o === m || n === m) && l(), b.mutate(m);
|
|
945
947
|
},
|
|
946
|
-
[
|
|
947
|
-
),
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
}, [
|
|
951
|
-
const
|
|
948
|
+
[l, n, b, o]
|
|
949
|
+
), y = d?.id;
|
|
950
|
+
k(() => {
|
|
951
|
+
y && y !== n && s(y);
|
|
952
|
+
}, [y, o, n]);
|
|
953
|
+
const q = f(() => {
|
|
952
954
|
i(null);
|
|
953
955
|
}, []), Q = f(
|
|
954
|
-
(
|
|
955
|
-
|
|
956
|
+
(m) => {
|
|
957
|
+
c.aiEnabled && (l(), i(m), C());
|
|
956
958
|
},
|
|
957
|
-
[C,
|
|
959
|
+
[C, l, c.aiEnabled]
|
|
958
960
|
), J = w(
|
|
959
961
|
() => ({
|
|
960
962
|
chatId: n,
|
|
961
|
-
model:
|
|
962
|
-
availableModels:
|
|
963
|
-
selectedModelId:
|
|
964
|
-
selectModel:
|
|
965
|
-
onSettingsOpen:
|
|
966
|
-
title:
|
|
963
|
+
model: g,
|
|
964
|
+
availableModels: x,
|
|
965
|
+
selectedModelId: j,
|
|
966
|
+
selectModel: B,
|
|
967
|
+
onSettingsOpen: h.onSettingsOpen,
|
|
968
|
+
title: d?.title ?? Ye.title,
|
|
967
969
|
isLoading: I,
|
|
968
970
|
selectChat: p,
|
|
969
|
-
removeChat:
|
|
970
|
-
createNewChat:
|
|
971
|
+
removeChat: K,
|
|
972
|
+
createNewChat: l,
|
|
971
973
|
openAiChatWithPresetInput: Q,
|
|
972
974
|
pendingComposerPreset: a,
|
|
973
|
-
clearPendingComposerPreset:
|
|
975
|
+
clearPendingComposerPreset: q
|
|
974
976
|
}),
|
|
975
977
|
[
|
|
976
978
|
n,
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
979
|
+
x,
|
|
980
|
+
d?.title,
|
|
981
|
+
g,
|
|
980
982
|
I,
|
|
981
983
|
p,
|
|
982
|
-
|
|
983
|
-
|
|
984
|
+
K,
|
|
985
|
+
l,
|
|
984
986
|
Q,
|
|
985
987
|
a,
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
988
|
+
q,
|
|
989
|
+
j,
|
|
990
|
+
B,
|
|
991
|
+
h.onSettingsOpen
|
|
990
992
|
]
|
|
991
993
|
);
|
|
992
|
-
return /* @__PURE__ */ te(
|
|
993
|
-
|
|
994
|
+
return /* @__PURE__ */ te(Je.Provider, { value: J, children: /* @__PURE__ */ te(
|
|
995
|
+
an,
|
|
994
996
|
{
|
|
995
997
|
chatId: n,
|
|
996
|
-
model:
|
|
997
|
-
initialMessages:
|
|
998
|
-
onChatFinish:
|
|
999
|
-
onChatMessagesUpdated:
|
|
998
|
+
model: g,
|
|
999
|
+
initialMessages: d?.messages,
|
|
1000
|
+
onChatFinish: Y,
|
|
1001
|
+
onChatMessagesUpdated: O,
|
|
1000
1002
|
children: t
|
|
1001
1003
|
}
|
|
1002
1004
|
) });
|
|
1003
1005
|
}
|
|
1004
1006
|
export {
|
|
1005
|
-
|
|
1007
|
+
_n as AiChatProvider
|
|
1006
1008
|
};
|