@redocly/replay 0.27.0-next.5 → 0.27.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-CVvR1kSd.js → replay-AiChatProvider-D7E0a83D.js} +273 -271
- package/dist/replay-AiChatProvider-p9SioFWy.js +6 -0
- package/dist/{replay-AiChatSqliteDBStorage-BFHRKFlk.js → replay-AiChatSqliteDBStorage-CKQJ5VZi.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-DVJ9f2EK.js → replay-AiChatSqliteDBStorage-DgGB1XKW.js} +1 -1
- package/dist/replay-AiPanel-BLkqnlmb.js +849 -0
- package/dist/{replay-AiPanel-CynVcVmm.js → replay-AiPanel-DvOGYsWl.js} +843 -798
- package/dist/{replay-SqliteDBStorage-eRBPh4E8.js → replay-SqliteDBStorage-CNJbZXTw.js} +1 -1
- package/dist/{replay-SqliteDBStorage-CSz7NYH4.js → replay-SqliteDBStorage-D_31Bd3Z.js} +1 -1
- package/dist/{replay-agent-loop-CEZz1kj-.js → replay-agent-loop-DklepPbJ.js} +48 -48
- package/dist/{replay-agent-loop-C60p47KY.js → replay-agent-loop-fKCHgyOD.js} +1 -1
- package/dist/{replay-ai-chat-mappers-Dqg-QVZy.js → replay-ai-chat-mappers-D-vUBq2s.js} +1 -1
- package/dist/{replay-ai-chat-mappers-BAHU6JIc.js → replay-ai-chat-mappers-IWtvE0Nl.js} +1 -1
- package/dist/{replay-create-model-C2NQtDcL.js → replay-create-model-CfrWgdF7.js} +3 -3
- package/dist/{replay-create-model-CUL-l-eX.js → replay-create-model-xGRAIhcu.js} +2 -2
- package/dist/{replay-db-Dw-X2WGx.js → replay-db-BtdwaWh3.js} +17 -17
- package/dist/{replay-db-C4jAfGtc.js → replay-db-XlueEDU-.js} +6 -6
- package/dist/{replay-external-resolver-DAkLV0nr.js → replay-external-resolver-D6VSVDwt.js} +2 -2
- package/dist/{replay-external-resolver-DN_PWq_2.js → replay-external-resolver-Skh0OGde.js} +1 -1
- package/dist/{replay-index-DR1uVBvc.js → replay-index-BEzVYZeb.js} +42 -41
- package/dist/replay-index-BOB__Jm6.js +1 -0
- package/dist/replay-index-C6SJPGDO.js +23 -0
- package/dist/{replay-index-m00jnWFr.js → replay-index-CCvitTKt.js} +1 -1
- package/dist/replay-index-CUs62_1f.js +1 -0
- package/dist/{replay-index-O_Pq5an3.js → replay-index-DXnDNeqk.js} +17747 -17583
- package/dist/{replay-index-BmX1FPBL.js → replay-index-S_wAPmTA.js} +1079 -1079
- package/dist/{replay-index-rRWvC2pp.js → replay-index-fVC8e5y9.js} +1 -1
- package/dist/replay-lint-BCVeL_wb.js +184 -0
- package/dist/{replay-lint-CcVVykW7.js → replay-lint-DjMIgYfF.js} +8246 -8047
- package/dist/{replay-lint-graphql-DlD7bblx.js → replay-lint-graphql-Bltv-T6_.js} +1 -1
- package/dist/{replay-lint-graphql-5cGt2KR_.js → replay-lint-graphql-bkrdHRy7.js} +1 -1
- package/dist/{replay-resolve-Ca3DUbGq.js → replay-resolve-BhcSceq-.js} +919 -908
- package/dist/replay-resolve-CQL6WBG1.js +47 -0
- package/dist/{replay-respect-run-eSRzH2dk.js → replay-respect-run-CecN1j9r.js} +1605 -1555
- package/dist/replay-respect-run-rJm4W93K.js +78 -0
- package/dist/{replay-tauri-path-CKcvIl_h.js → replay-tauri-path--8KtMkGg.js} +1 -1
- package/dist/{replay-tauri-path-C-oxFOHe.js → replay-tauri-path--BfusnkB.js} +2 -2
- package/dist/{replay-useAiChatQueries-CVTxcu2Z.js → replay-useAiChatQueries-B1-NwsZz.js} +69 -48
- package/dist/{replay-useAiChatQueries-vdKvbmp2.js → replay-useAiChatQueries-Btd-PmIH.js} +1096 -977
- package/dist/{replay-validate-key-VkgZoK1f.js → replay-validate-key-Bk0SFd3-.js} +1 -1
- package/dist/{replay-validate-key-CwIopif3.js → replay-validate-key-CYsfegSv.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +35 -5
- package/dist/replay.js +10 -10
- package/package.json +4 -4
- package/dist/replay-AiChatProvider-BGXsZqW2.js +0 -6
- package/dist/replay-AiPanel-qVp_s4gD.js +0 -849
- package/dist/replay-index-DSKZHOXq.js +0 -1
- package/dist/replay-index-DT5gdiBA.js +0 -21
- package/dist/replay-index-qZlgEmbq.js +0 -1
- package/dist/replay-lint-ON47l7Vu.js +0 -184
- package/dist/replay-resolve-BTzo-fSv.js +0 -47
- package/dist/replay-respect-run-BtC2agF9.js +0 -78
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as te } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { a as
|
|
4
|
-
import { A as
|
|
5
|
-
import { AgentLoop as
|
|
6
|
-
import { s as
|
|
7
|
-
import { r as
|
|
2
|
+
import { useRef as R, useCallback as f, useSyncExternalStore as re, useEffect as b, useMemo as w, useState as z } from "react";
|
|
3
|
+
import { a as S, A as ce, g as Re, I as xe, T as $e, b as x, c as Pe, d as De, u as Te, e as We, f as Be, h as Oe, i as Ue, j as Ae, k as se, l as ue, m as ye, n as Fe, o as Le, p as Se, t as ge, q as je, R as ne, r as Ne, s as ae, v as qe, w as Ke } from "./replay-index-DXnDNeqk.js";
|
|
4
|
+
import { A as Qe, D as Ve, l as Ge } from "./replay-create-model-CfrWgdF7.js";
|
|
5
|
+
import { AgentLoop as He } from "./replay-agent-loop-DklepPbJ.js";
|
|
6
|
+
import { s as ze } from "./replay-db-BtdwaWh3.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-Btd-PmIH.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-
|
|
10
|
-
class
|
|
9
|
+
import { b as be, g as me } from "./replay-ai-chat-mappers-IWtvE0Nl.js";
|
|
10
|
+
class ft {
|
|
11
11
|
handlers = /* @__PURE__ */ new Map();
|
|
12
12
|
middlewares;
|
|
13
13
|
constructor(t) {
|
|
@@ -63,15 +63,15 @@ function ke() {
|
|
|
63
63
|
await ce.getInstance().upsert(n);
|
|
64
64
|
},
|
|
65
65
|
onSuccess() {
|
|
66
|
-
e.invalidateQueries({ queryKey:
|
|
66
|
+
e.invalidateQueries({ queryKey: S.all() });
|
|
67
67
|
},
|
|
68
68
|
onError(t) {
|
|
69
69
|
console.error("Failed to upsert ai chat item:", t);
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
const t = de(), n =
|
|
73
|
+
function gt(e) {
|
|
74
|
+
const t = de(), n = S.detailTitle(e ?? "");
|
|
75
75
|
return he({
|
|
76
76
|
mutationKey: n,
|
|
77
77
|
async mutationFn(s) {
|
|
@@ -80,27 +80,27 @@ function pt(e) {
|
|
|
80
80
|
await ce.getInstance().upsert(o);
|
|
81
81
|
},
|
|
82
82
|
onSuccess() {
|
|
83
|
-
t.invalidateQueries({ queryKey:
|
|
83
|
+
t.invalidateQueries({ queryKey: S.all() });
|
|
84
84
|
},
|
|
85
85
|
onError(s) {
|
|
86
86
|
console.error("Failed to upsert ai chat item:", s);
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function mt() {
|
|
91
91
|
const e = de();
|
|
92
92
|
return he({
|
|
93
93
|
async mutationFn(t) {
|
|
94
94
|
await ce.getInstance().remove(t);
|
|
95
95
|
},
|
|
96
96
|
onMutate: async (t) => {
|
|
97
|
-
await e.cancelQueries({ queryKey:
|
|
98
|
-
const n = e.getQueryData(
|
|
97
|
+
await e.cancelQueries({ queryKey: S.all() });
|
|
98
|
+
const n = e.getQueryData(S.all());
|
|
99
99
|
n && e.setQueryData(
|
|
100
|
-
|
|
100
|
+
S.all(),
|
|
101
101
|
n.filter((s) => s.id !== t)
|
|
102
|
-
), e.setQueryData(
|
|
103
|
-
{ queryKey:
|
|
102
|
+
), e.setQueryData(S.detail(t), null), e.setQueriesData(
|
|
103
|
+
{ queryKey: S.infiniteHistories() },
|
|
104
104
|
(s) => s && {
|
|
105
105
|
...s,
|
|
106
106
|
pages: s.pages.map((o) => ({
|
|
@@ -114,12 +114,12 @@ function ft() {
|
|
|
114
114
|
console.error("Failed to remove ai chat:", t);
|
|
115
115
|
},
|
|
116
116
|
onSettled() {
|
|
117
|
-
e.invalidateQueries({ queryKey:
|
|
117
|
+
e.invalidateQueries({ queryKey: S.all() });
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
var oe, ve;
|
|
122
|
-
function
|
|
122
|
+
function vt() {
|
|
123
123
|
if (ve) return oe;
|
|
124
124
|
ve = 1;
|
|
125
125
|
function e(t, n) {
|
|
@@ -128,77 +128,77 @@ function gt() {
|
|
|
128
128
|
let s, o = 0;
|
|
129
129
|
return function(...a) {
|
|
130
130
|
clearTimeout(s);
|
|
131
|
-
const i = Date.now(), l = i - o,
|
|
132
|
-
|
|
131
|
+
const i = Date.now(), l = i - o, u = n - l;
|
|
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;
|
|
138
138
|
}
|
|
139
|
-
var
|
|
140
|
-
const
|
|
139
|
+
var wt = /* @__PURE__ */ vt();
|
|
140
|
+
const Ct = /* @__PURE__ */ Re(wt);
|
|
141
141
|
var Me = (e, t, n) => {
|
|
142
142
|
if (!t.has(e))
|
|
143
143
|
throw TypeError("Cannot " + n);
|
|
144
|
-
},
|
|
144
|
+
}, d = (e, t, n) => (Me(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
|
-
},
|
|
149
|
-
function
|
|
150
|
-
return t != null ?
|
|
148
|
+
}, _ = (e, t, n, s) => (Me(e, t, "write to private field"), t.set(e, n), n);
|
|
149
|
+
function It(e, t) {
|
|
150
|
+
return t != null ? Ct(e, t) : e;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var v, Z, ee, V, G, H, j, ie, le, Tt = class {
|
|
153
153
|
constructor(e = []) {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
A(this, v, void 0), A(this, Z, "ready"), A(this, ee, void 0), A(this, V, /* @__PURE__ */ new Set()), A(this, G, /* @__PURE__ */ new Set()), A(this, H, /* @__PURE__ */ new Set()), this.pushMessage = (t) => {
|
|
155
|
+
_(this, v, d(this, v).concat(t)), d(this, j).call(this);
|
|
156
156
|
}, this.popMessage = () => {
|
|
157
|
-
|
|
157
|
+
_(this, v, d(this, v).slice(0, -1)), d(this, j).call(this);
|
|
158
158
|
}, this.replaceMessage = (t, n) => {
|
|
159
|
-
|
|
160
|
-
...
|
|
159
|
+
_(this, v, [
|
|
160
|
+
...d(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
|
+
...d(this, v).slice(t + 1)
|
|
164
|
+
]), d(this, j).call(this);
|
|
165
165
|
}, this.snapshot = (t) => structuredClone(t), this["~registerMessagesCallback"] = (t, n) => {
|
|
166
|
-
const s = n ?
|
|
167
|
-
return
|
|
168
|
-
|
|
166
|
+
const s = n ? It(t, n) : t;
|
|
167
|
+
return d(this, V).add(s), () => {
|
|
168
|
+
d(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) => (d(this, G).add(t), () => {
|
|
171
|
+
d(this, G).delete(t);
|
|
172
|
+
}), this["~registerErrorCallback"] = (t) => (d(this, H).add(t), () => {
|
|
173
|
+
d(this, H).delete(t);
|
|
174
|
+
}), A(this, j, () => {
|
|
175
|
+
d(this, V).forEach((t) => t());
|
|
176
|
+
}), A(this, ie, () => {
|
|
177
|
+
d(this, G).forEach((t) => t());
|
|
178
|
+
}), A(this, le, () => {
|
|
179
|
+
d(this, H).forEach((t) => t());
|
|
180
|
+
}), _(this, v, e);
|
|
181
181
|
}
|
|
182
182
|
get status() {
|
|
183
|
-
return
|
|
183
|
+
return d(this, Z);
|
|
184
184
|
}
|
|
185
185
|
set status(e) {
|
|
186
|
-
|
|
186
|
+
_(this, Z, e), d(this, ie).call(this);
|
|
187
187
|
}
|
|
188
188
|
get error() {
|
|
189
|
-
return
|
|
189
|
+
return d(this, ee);
|
|
190
190
|
}
|
|
191
191
|
set error(e) {
|
|
192
|
-
|
|
192
|
+
_(this, ee, e), d(this, le).call(this);
|
|
193
193
|
}
|
|
194
194
|
get messages() {
|
|
195
|
-
return
|
|
195
|
+
return d(this, v);
|
|
196
196
|
}
|
|
197
197
|
set messages(e) {
|
|
198
|
-
|
|
198
|
+
_(this, v, [...e]), d(this, j).call(this);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
v = /* @__PURE__ */ new WeakMap();
|
|
202
202
|
Z = /* @__PURE__ */ new WeakMap();
|
|
203
203
|
ee = /* @__PURE__ */ new WeakMap();
|
|
204
204
|
V = /* @__PURE__ */ new WeakMap();
|
|
@@ -207,19 +207,19 @@ H = /* @__PURE__ */ new WeakMap();
|
|
|
207
207
|
j = /* @__PURE__ */ new WeakMap();
|
|
208
208
|
ie = /* @__PURE__ */ new WeakMap();
|
|
209
209
|
le = /* @__PURE__ */ new WeakMap();
|
|
210
|
-
var N, we = class extends
|
|
210
|
+
var N, we = class extends Qe {
|
|
211
211
|
constructor({ messages: e, ...t }) {
|
|
212
|
-
const n = new
|
|
213
|
-
super({ ...t, state: n }),
|
|
212
|
+
const n = new Tt(e);
|
|
213
|
+
super({ ...t, state: n }), A(this, N, void 0), this["~registerMessagesCallback"] = (s, o) => d(this, N)["~registerMessagesCallback"](s, o), this["~registerStatusCallback"] = (s) => d(this, N)["~registerStatusCallback"](s), this["~registerErrorCallback"] = (s) => d(this, N)["~registerErrorCallback"](s), _(this, N, n);
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
N = /* @__PURE__ */ new WeakMap();
|
|
217
|
-
function
|
|
217
|
+
function At({
|
|
218
218
|
experimental_throttle: e,
|
|
219
219
|
resume: t = !1,
|
|
220
220
|
...n
|
|
221
221
|
} = {}) {
|
|
222
|
-
const s =
|
|
222
|
+
const s = R(
|
|
223
223
|
"chat" in n ? {} : {
|
|
224
224
|
onToolCall: n.onToolCall,
|
|
225
225
|
onData: n.onData,
|
|
@@ -257,7 +257,7 @@ function It({
|
|
|
257
257
|
var p, h, $;
|
|
258
258
|
return ($ = (h = (p = s.current).sendAutomaticallyWhen) == null ? void 0 : h.call(p, c)) != null ? $ : !1;
|
|
259
259
|
}
|
|
260
|
-
}, r =
|
|
260
|
+
}, r = R(
|
|
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));
|
|
@@ -270,33 +270,33 @@ function It({
|
|
|
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
|
+
), C = re(
|
|
278
278
|
r.current["~registerErrorCallback"],
|
|
279
279
|
() => r.current.error,
|
|
280
280
|
() => r.current.error
|
|
281
|
-
),
|
|
281
|
+
), I = f(
|
|
282
282
|
(c) => {
|
|
283
283
|
typeof c == "function" && (c = c(r.current.messages)), r.current.messages = c;
|
|
284
284
|
},
|
|
285
285
|
[r]
|
|
286
286
|
);
|
|
287
|
-
return
|
|
287
|
+
return b(() => {
|
|
288
288
|
t && r.current.resumeStream();
|
|
289
289
|
}, [t, r]), {
|
|
290
290
|
id: r.current.id,
|
|
291
291
|
messages: l,
|
|
292
|
-
setMessages:
|
|
292
|
+
setMessages: I,
|
|
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: C,
|
|
298
298
|
resumeStream: r.current.resumeStream,
|
|
299
|
-
status:
|
|
299
|
+
status: u,
|
|
300
300
|
/**
|
|
301
301
|
* @deprecated Use `addToolOutput` instead.
|
|
302
302
|
*/
|
|
@@ -305,15 +305,15 @@ function It({
|
|
|
305
305
|
addToolApprovalResponse: r.current.addToolApprovalResponse
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
const
|
|
309
|
-
function
|
|
308
|
+
const yt = 20;
|
|
309
|
+
function St(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, yt), n = t.map(bt), 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 bt(e) {
|
|
317
317
|
return [
|
|
318
318
|
` apiId="${e.apiId}"`,
|
|
319
319
|
`title="${e.title}"`,
|
|
@@ -321,23 +321,23 @@ function yt(e) {
|
|
|
321
321
|
e.primaryServer ? `server="${e.primaryServer}"` : null
|
|
322
322
|
].filter(Boolean).join(" ");
|
|
323
323
|
}
|
|
324
|
-
const
|
|
325
|
-
function
|
|
324
|
+
const kt = 30;
|
|
325
|
+
function Mt(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 = kt, 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(Et(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(` ${_t(i)}`), n--) : s++;
|
|
341
341
|
} else
|
|
342
342
|
s += a.workflows.length;
|
|
343
343
|
}
|
|
@@ -348,43 +348,43 @@ function bt(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 Et(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 _t(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 Rt = 20;
|
|
360
|
+
function xt(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, Rt), n = t.map($t), 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 $t(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 Pt = 30;
|
|
377
|
+
function Dt(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, Pt), n = t.map(Wt), 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 Wt(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 Pt(e) {
|
|
|
403
403
|
n.length > 0 ? `(${n.join(", ")})` : null
|
|
404
404
|
].filter(Boolean).join(" ");
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
function
|
|
406
|
+
const Bt = "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 Ot(e) {
|
|
408
408
|
const t = `
|
|
409
409
|
`.repeat(2), n = [
|
|
410
|
-
|
|
410
|
+
Bt,
|
|
411
411
|
t,
|
|
412
|
-
|
|
412
|
+
Dt(e.tabs),
|
|
413
413
|
t,
|
|
414
|
-
|
|
414
|
+
St(e.apis),
|
|
415
415
|
t,
|
|
416
|
-
|
|
416
|
+
Mt(e.collections),
|
|
417
417
|
t,
|
|
418
|
-
|
|
418
|
+
xt(e.environments)
|
|
419
419
|
].join("");
|
|
420
|
-
return
|
|
421
|
-
}
|
|
422
|
-
function Ot(e) {
|
|
423
|
-
return e.apis.get({ noproxy: !0 }).map(Ut);
|
|
420
|
+
return ze("active_state", n);
|
|
424
421
|
}
|
|
425
422
|
function Ut(e) {
|
|
423
|
+
return e.apis.get({ noproxy: !0 }).map(Ft);
|
|
424
|
+
}
|
|
425
|
+
function Ft(e) {
|
|
426
426
|
return {
|
|
427
427
|
apiId: e.id,
|
|
428
428
|
title: e.info?.title ?? "Untitled API",
|
|
@@ -430,10 +430,10 @@ function Ut(e) {
|
|
|
430
430
|
primaryServer: e.servers?.[0]?.url
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
|
-
function
|
|
434
|
-
return e.collections.get({ noproxy: !0 }).map(
|
|
433
|
+
function Lt(e) {
|
|
434
|
+
return e.collections.get({ noproxy: !0 }).map(jt);
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function jt(e) {
|
|
437
437
|
const t = (e.workflows ?? []).map((s) => ({
|
|
438
438
|
workflowId: s.workflowId,
|
|
439
439
|
summary: s.summary,
|
|
@@ -446,7 +446,7 @@ function Ft(e) {
|
|
|
446
446
|
sourceApiIds: n
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function Nt(e) {
|
|
450
450
|
const t = e.environments.get({ noproxy: !0 }), n = e.activeEnvironmentId.get({ noproxy: !0 });
|
|
451
451
|
return t.filter((s) => s.state !== xe.Draft).map((s) => ({
|
|
452
452
|
name: s.name,
|
|
@@ -455,13 +455,13 @@ function Lt(e) {
|
|
|
455
455
|
serverCount: s.servers.length
|
|
456
456
|
}));
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function qt(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) => Kt(e, s, o, o === n)
|
|
462
462
|
);
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function Kt(e, t, n, s) {
|
|
465
465
|
const o = {
|
|
466
466
|
tabIndex: n,
|
|
467
467
|
type: t.data.type,
|
|
@@ -469,19 +469,19 @@ function Nt(e, t, n, s) {
|
|
|
469
469
|
isPreview: t.state === $e.Preview
|
|
470
470
|
};
|
|
471
471
|
switch (t.data.type) {
|
|
472
|
-
case
|
|
472
|
+
case x.Collection: {
|
|
473
473
|
const { collectionId: r } = t.data;
|
|
474
474
|
return {
|
|
475
475
|
...o,
|
|
476
|
-
label:
|
|
476
|
+
label: Qt(e, r) ?? r,
|
|
477
477
|
collectionId: r
|
|
478
478
|
};
|
|
479
479
|
}
|
|
480
|
-
case
|
|
480
|
+
case x.Workflow: {
|
|
481
481
|
const { collectionId: r, workflowId: a } = t.data;
|
|
482
482
|
return { ...o, label: a, collectionId: r, workflowId: a };
|
|
483
483
|
}
|
|
484
|
-
case
|
|
484
|
+
case x.WorkflowRun: {
|
|
485
485
|
const { collectionId: r, workflowId: a, historyId: i, label: l } = t.data;
|
|
486
486
|
return {
|
|
487
487
|
...o,
|
|
@@ -491,11 +491,11 @@ function Nt(e, t, n, s) {
|
|
|
491
491
|
isHistory: i != null
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
|
-
case
|
|
494
|
+
case x.Step: {
|
|
495
495
|
const r = t.data;
|
|
496
496
|
return {
|
|
497
497
|
...o,
|
|
498
|
-
label:
|
|
498
|
+
label: Vt(r),
|
|
499
499
|
collectionId: r.collectionId,
|
|
500
500
|
workflowId: r.workflowId,
|
|
501
501
|
stepId: r.stepId,
|
|
@@ -506,10 +506,10 @@ function Nt(e, t, n, s) {
|
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function Qt(e, t) {
|
|
510
510
|
return e.collections.find((s) => s.id.get() === t)?.info.title.get();
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function Vt(e) {
|
|
513
513
|
if (e.stepId)
|
|
514
514
|
return e.stepId;
|
|
515
515
|
if (e.draftStep) {
|
|
@@ -519,27 +519,27 @@ function Kt(e) {
|
|
|
519
519
|
}
|
|
520
520
|
return "New Request";
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function Gt(e) {
|
|
523
523
|
return {
|
|
524
|
-
tabs:
|
|
525
|
-
apis:
|
|
526
|
-
collections:
|
|
527
|
-
environments:
|
|
524
|
+
tabs: qt(e),
|
|
525
|
+
apis: Ut(e),
|
|
526
|
+
collections: Lt(e),
|
|
527
|
+
environments: Nt(e)
|
|
528
528
|
};
|
|
529
529
|
}
|
|
530
|
-
function
|
|
531
|
-
const { getCollection: e } = Te(), { getWorkflow: t } = We(), { getStep: n } =
|
|
532
|
-
return
|
|
530
|
+
function Ht() {
|
|
531
|
+
const { getCollection: e } = Te(), { getWorkflow: t } = We(), { getStep: n } = Be(), { tab: s } = Oe(), o = s?.data.get();
|
|
532
|
+
return w(() => {
|
|
533
533
|
if (!o)
|
|
534
534
|
return null;
|
|
535
535
|
switch (o.type) {
|
|
536
|
-
case
|
|
536
|
+
case x.Collection:
|
|
537
537
|
const a = e(o.collectionId);
|
|
538
538
|
return {
|
|
539
539
|
...o,
|
|
540
540
|
collection: a ? a.get() : null
|
|
541
541
|
};
|
|
542
|
-
case
|
|
542
|
+
case x.Workflow:
|
|
543
543
|
const i = t({
|
|
544
544
|
collectionId: o.collectionId,
|
|
545
545
|
workflowId: o.workflowId
|
|
@@ -548,7 +548,7 @@ function Vt() {
|
|
|
548
548
|
...o,
|
|
549
549
|
workflow: i ? i.get() : null
|
|
550
550
|
};
|
|
551
|
-
case
|
|
551
|
+
case x.Step:
|
|
552
552
|
const l = n({
|
|
553
553
|
collectionId: o.collectionId,
|
|
554
554
|
workflowId: o.workflowId,
|
|
@@ -558,19 +558,19 @@ function Vt() {
|
|
|
558
558
|
...o,
|
|
559
559
|
step: l ? l.get() : null
|
|
560
560
|
};
|
|
561
|
-
case
|
|
562
|
-
const
|
|
561
|
+
case x.WorkflowRun:
|
|
562
|
+
const u = t({
|
|
563
563
|
collectionId: o.collectionId,
|
|
564
564
|
workflowId: o.workflowId
|
|
565
565
|
});
|
|
566
566
|
return {
|
|
567
567
|
...o,
|
|
568
|
-
workflow:
|
|
568
|
+
workflow: u ? u.get() : null
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
571
|
}, [o, e, t, n]);
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function zt(e) {
|
|
574
574
|
if (!e || typeof e != "object" || !("changes" in e) || !Array.isArray(e.changes))
|
|
575
575
|
return e;
|
|
576
576
|
const t = e.changes.filter(
|
|
@@ -586,12 +586,12 @@ function Gt(e) {
|
|
|
586
586
|
}
|
|
587
587
|
};
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
return (e, t) => (n, s) => t(
|
|
589
|
+
function Yt() {
|
|
590
|
+
return (e, t) => (n, s) => t(zt(n), s);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
const { getApiOperation: e } =
|
|
594
|
-
return
|
|
592
|
+
function Jt() {
|
|
593
|
+
const { getApiOperation: e } = Ue(), t = Ae();
|
|
594
|
+
return w(
|
|
595
595
|
() => ({
|
|
596
596
|
getApiOperation: e,
|
|
597
597
|
...t
|
|
@@ -599,144 +599,146 @@ function zt() {
|
|
|
599
599
|
[e, t]
|
|
600
600
|
);
|
|
601
601
|
}
|
|
602
|
-
function
|
|
603
|
-
const { convertOperationToReplayValue: t } = se(), n =
|
|
604
|
-
return
|
|
605
|
-
const
|
|
606
|
-
middlewares: [
|
|
602
|
+
function Xt(e) {
|
|
603
|
+
const { convertOperationToReplayValue: t } = se(), n = Ht(), s = Jt(), o = ue(), r = ye(), { attachApiToCollection: a } = Te(), { handleCloseByDataId: i } = Ae(), l = Fe(), u = R(n);
|
|
604
|
+
return u.current = n, { tools: w(() => {
|
|
605
|
+
const I = new ft({
|
|
606
|
+
middlewares: [Yt()]
|
|
607
607
|
});
|
|
608
|
-
return
|
|
609
|
-
[
|
|
610
|
-
[
|
|
608
|
+
return Ye(I, {
|
|
609
|
+
[lt.name]: void 0,
|
|
610
|
+
[it.name]: { store: r, settingsState: o },
|
|
611
|
+
[at.name]: { store: r, runWorkflow: l },
|
|
612
|
+
[ot.name]: { store: r },
|
|
611
613
|
[rt.name]: { store: r },
|
|
612
|
-
[st.name]: {
|
|
613
|
-
[nt.name]: {
|
|
614
|
+
[st.name]: {
|
|
614
615
|
store: r,
|
|
615
616
|
attachApiToCollection: a,
|
|
616
617
|
handleCloseByDataId: i,
|
|
617
618
|
convertOperationToReplayValue: t
|
|
618
619
|
},
|
|
619
|
-
[
|
|
620
|
-
[
|
|
621
|
-
[
|
|
622
|
-
[
|
|
623
|
-
[
|
|
624
|
-
getActiveTabDetailedData: () =>
|
|
620
|
+
[nt.name]: { store: r },
|
|
621
|
+
[tt.name]: { model: e },
|
|
622
|
+
[et.name]: { store: r },
|
|
623
|
+
[Ze.name]: { store: r, context: s },
|
|
624
|
+
[Xe.name]: {
|
|
625
|
+
getActiveTabDetailedData: () => u.current
|
|
625
626
|
},
|
|
626
|
-
[
|
|
627
|
-
}),
|
|
627
|
+
[Je.name]: { store: r }
|
|
628
|
+
}), I.getToolSet();
|
|
628
629
|
}, [
|
|
629
630
|
a,
|
|
630
631
|
t,
|
|
631
632
|
i,
|
|
632
633
|
e,
|
|
633
634
|
s,
|
|
635
|
+
l,
|
|
634
636
|
o,
|
|
635
637
|
r
|
|
636
638
|
]) };
|
|
637
639
|
}
|
|
638
|
-
function
|
|
639
|
-
const { children: t, chatId: n, model: s, initialMessages: o, onChatFinish: r, onChatMessagesUpdated: a } = e, i = ue(), { getReuniteAuth: l } = se(), { tools:
|
|
640
|
-
|
|
641
|
-
const m =
|
|
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), q = ye(), y = R(q);
|
|
642
|
+
I.current = u, c.current = s, y.current = q;
|
|
643
|
+
const m = w(() => {
|
|
642
644
|
P.current?.end();
|
|
643
|
-
const
|
|
644
|
-
P.current =
|
|
645
|
-
const
|
|
646
|
-
return new
|
|
645
|
+
const M = ge.getTracer("replay-ai-chat").startSpan("ai.chat.session", { attributes: { conversation_id: n } });
|
|
646
|
+
P.current = M;
|
|
647
|
+
const E = ge.setSpan(je.active(), M);
|
|
648
|
+
return new He({
|
|
647
649
|
activeConversationId: n,
|
|
648
650
|
model: c.current,
|
|
649
|
-
tools:
|
|
650
|
-
sendEvent:
|
|
651
|
-
parentCtx:
|
|
652
|
-
getActiveStateMessage: () =>
|
|
651
|
+
tools: I.current,
|
|
652
|
+
sendEvent: C,
|
|
653
|
+
parentCtx: E,
|
|
654
|
+
getActiveStateMessage: () => Ot(Gt(y.current))
|
|
653
655
|
});
|
|
654
|
-
}, [n,
|
|
655
|
-
|
|
656
|
-
const F =
|
|
656
|
+
}, [n, C]);
|
|
657
|
+
b(() => () => P.current?.end(), []);
|
|
658
|
+
const F = w(() => {
|
|
657
659
|
if (m)
|
|
658
|
-
return new
|
|
660
|
+
return new Ve({ agent: m.getAgent() });
|
|
659
661
|
}, [m]);
|
|
660
|
-
|
|
662
|
+
b(() => {
|
|
661
663
|
m.setModel(s);
|
|
662
|
-
}, [m, s]),
|
|
663
|
-
m.registerTools(
|
|
664
|
-
}, [m,
|
|
664
|
+
}, [m, s]), b(() => {
|
|
665
|
+
m.registerTools(u);
|
|
666
|
+
}, [m, u]);
|
|
665
667
|
const {
|
|
666
|
-
messages:
|
|
668
|
+
messages: k,
|
|
667
669
|
setMessages: D,
|
|
668
670
|
sendMessage: K,
|
|
669
671
|
status: W,
|
|
670
672
|
error: Y,
|
|
671
|
-
stop:
|
|
672
|
-
addToolApprovalResponse:
|
|
673
|
-
} =
|
|
673
|
+
stop: B,
|
|
674
|
+
addToolApprovalResponse: O
|
|
675
|
+
} = At({
|
|
674
676
|
id: n,
|
|
675
677
|
messages: o,
|
|
676
678
|
transport: F,
|
|
677
|
-
sendAutomaticallyWhen:
|
|
678
|
-
onFinish(
|
|
679
|
+
sendAutomaticallyWhen: Ge,
|
|
680
|
+
onFinish(M) {
|
|
679
681
|
if (!r || !m) return;
|
|
680
|
-
r({ agentLoop: m, chat: this },
|
|
682
|
+
r({ agentLoop: m, chat: this }, M);
|
|
681
683
|
}
|
|
682
|
-
}),
|
|
684
|
+
}), U = w(() => W === "streaming" || W === "submitted", [W]), Q = f(() => {
|
|
683
685
|
i.aiEnabled.get() === !0 && h();
|
|
684
686
|
}, [h, i.aiEnabled]), J = f(() => {
|
|
685
687
|
$();
|
|
686
688
|
}, [$]), g = f(
|
|
687
|
-
async (
|
|
688
|
-
const
|
|
689
|
-
if (!(!
|
|
689
|
+
async (M) => {
|
|
690
|
+
const E = M.trim();
|
|
691
|
+
if (!(!E || !F)) {
|
|
690
692
|
if (s.provider === ne) {
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
+
const T = await l?.();
|
|
694
|
+
T?.baseUrl && T?.accessToken && m.setModel({
|
|
693
695
|
provider: ne,
|
|
694
|
-
baseUrl:
|
|
695
|
-
accessToken:
|
|
696
|
+
baseUrl: T.baseUrl,
|
|
697
|
+
accessToken: T.accessToken
|
|
696
698
|
});
|
|
697
699
|
}
|
|
698
700
|
D(
|
|
699
|
-
(
|
|
700
|
-
), K({ text:
|
|
701
|
+
(T) => ct(T) ? ut(T) : T
|
|
702
|
+
), K({ text: E });
|
|
701
703
|
}
|
|
702
704
|
},
|
|
703
705
|
[m, l, s.provider, K, D, F]
|
|
704
706
|
), L = f(() => {
|
|
705
|
-
|
|
706
|
-
}, [
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
}, [n,
|
|
707
|
+
U && B();
|
|
708
|
+
}, [U, B]);
|
|
709
|
+
b(() => () => {
|
|
710
|
+
B();
|
|
711
|
+
}, [n, B]);
|
|
710
712
|
const pe = f(
|
|
711
|
-
(
|
|
712
|
-
const
|
|
713
|
-
for (const X of
|
|
713
|
+
(M) => {
|
|
714
|
+
const E = M(k), T = E.map((X) => X.message), fe = [...k];
|
|
715
|
+
for (const X of E)
|
|
714
716
|
fe[X.index] = X.message;
|
|
715
|
-
D(fe), a?.(
|
|
717
|
+
D(fe), a?.(T);
|
|
716
718
|
},
|
|
717
|
-
[
|
|
718
|
-
), Ee =
|
|
719
|
+
[k, a, D]
|
|
720
|
+
), Ee = w(
|
|
719
721
|
() => ({
|
|
720
|
-
messages:
|
|
721
|
-
isStreaming:
|
|
722
|
+
messages: k,
|
|
723
|
+
isStreaming: U,
|
|
722
724
|
chatStatus: W,
|
|
723
725
|
chatError: Y,
|
|
724
726
|
sendMessage: g,
|
|
725
727
|
updateMessages: pe,
|
|
726
728
|
stopGeneration: L,
|
|
727
|
-
addToolApprovalResponse:
|
|
729
|
+
addToolApprovalResponse: O
|
|
728
730
|
}),
|
|
729
731
|
[
|
|
730
|
-
|
|
732
|
+
O,
|
|
731
733
|
Y,
|
|
732
|
-
|
|
733
|
-
|
|
734
|
+
U,
|
|
735
|
+
k,
|
|
734
736
|
g,
|
|
735
737
|
W,
|
|
736
738
|
L,
|
|
737
739
|
pe
|
|
738
740
|
]
|
|
739
|
-
), _e =
|
|
741
|
+
), _e = w(
|
|
740
742
|
() => ({
|
|
741
743
|
isOpen: p,
|
|
742
744
|
openPanel: Q,
|
|
@@ -744,20 +746,20 @@ function Jt(e) {
|
|
|
744
746
|
}),
|
|
745
747
|
[p, Q, J]
|
|
746
748
|
);
|
|
747
|
-
return /* @__PURE__ */ te(
|
|
749
|
+
return /* @__PURE__ */ te(dt.Provider, { value: Ee, children: /* @__PURE__ */ te(Ne.Provider, { value: _e, children: t }) });
|
|
748
750
|
}
|
|
749
|
-
function
|
|
751
|
+
function en(e) {
|
|
750
752
|
return e.slice(-2);
|
|
751
753
|
}
|
|
752
|
-
function
|
|
754
|
+
function tn(e, t) {
|
|
753
755
|
return !!(e || t < 1);
|
|
754
756
|
}
|
|
755
|
-
function
|
|
757
|
+
function nn(e) {
|
|
756
758
|
return f(
|
|
757
759
|
async (t, n) => {
|
|
758
|
-
if (
|
|
760
|
+
if (tn(e, n.messages.length))
|
|
759
761
|
return null;
|
|
760
|
-
const s = n.messages[0], o =
|
|
762
|
+
const s = n.messages[0], o = ht(s.parts);
|
|
761
763
|
try {
|
|
762
764
|
return (await t.agentLoop.generateTitle(o)).trim();
|
|
763
765
|
} catch (r) {
|
|
@@ -767,12 +769,12 @@ function en(e) {
|
|
|
767
769
|
[e]
|
|
768
770
|
);
|
|
769
771
|
}
|
|
770
|
-
function
|
|
772
|
+
function sn({
|
|
771
773
|
chatId: e,
|
|
772
774
|
model: t,
|
|
773
775
|
existingTitle: n
|
|
774
776
|
}) {
|
|
775
|
-
const { mutate: s } =
|
|
777
|
+
const { mutate: s } = gt(e), o = nn(n);
|
|
776
778
|
return f(
|
|
777
779
|
async (...r) => {
|
|
778
780
|
const a = await o(...r);
|
|
@@ -786,11 +788,11 @@ function tn({
|
|
|
786
788
|
[o, t, e, s]
|
|
787
789
|
);
|
|
788
790
|
}
|
|
789
|
-
function
|
|
791
|
+
function rn({ chatId: e, model: t }) {
|
|
790
792
|
const { mutate: n } = ke();
|
|
791
793
|
return f(
|
|
792
794
|
(s, o) => {
|
|
793
|
-
const r =
|
|
795
|
+
const r = en(
|
|
794
796
|
o.messages
|
|
795
797
|
);
|
|
796
798
|
n({
|
|
@@ -802,7 +804,7 @@ function nn({ chatId: e, model: t }) {
|
|
|
802
804
|
[t, e, n]
|
|
803
805
|
);
|
|
804
806
|
}
|
|
805
|
-
function
|
|
807
|
+
function on({ chatId: e, model: t }) {
|
|
806
808
|
const { mutate: n } = ke();
|
|
807
809
|
return f(
|
|
808
810
|
(s) => {
|
|
@@ -815,8 +817,8 @@ function sn({ chatId: e, model: t }) {
|
|
|
815
817
|
[t, e, n]
|
|
816
818
|
);
|
|
817
819
|
}
|
|
818
|
-
function
|
|
819
|
-
return
|
|
820
|
+
function an(e) {
|
|
821
|
+
return w(() => {
|
|
820
822
|
const t = [ae];
|
|
821
823
|
if (e) {
|
|
822
824
|
for (const [n, s] of Object.entries(e))
|
|
@@ -842,59 +844,59 @@ function Ie(e, t) {
|
|
|
842
844
|
return Ce(t);
|
|
843
845
|
}
|
|
844
846
|
}
|
|
845
|
-
function
|
|
847
|
+
function ln(e, t) {
|
|
846
848
|
try {
|
|
847
849
|
globalThis.localStorage.setItem(e, t);
|
|
848
850
|
} catch {
|
|
849
851
|
console.error("Failed to write to localStorage", { key: e, value: t });
|
|
850
852
|
}
|
|
851
853
|
}
|
|
852
|
-
function
|
|
853
|
-
const [n, s] = z(() => Ie(e, t)), o =
|
|
854
|
-
o.current = t,
|
|
854
|
+
function cn(e, t) {
|
|
855
|
+
const [n, s] = z(() => Ie(e, t)), o = R(t);
|
|
856
|
+
o.current = t, b(() => {
|
|
855
857
|
s(Ie(e, o.current));
|
|
856
858
|
}, [e]);
|
|
857
859
|
const r = f(
|
|
858
860
|
(a) => {
|
|
859
861
|
s((i) => {
|
|
860
862
|
const l = a instanceof Function ? a(i) : a;
|
|
861
|
-
return
|
|
863
|
+
return ln(e, l), l;
|
|
862
864
|
});
|
|
863
865
|
},
|
|
864
866
|
[e]
|
|
865
867
|
);
|
|
866
868
|
return [n, r];
|
|
867
869
|
}
|
|
868
|
-
const
|
|
869
|
-
function
|
|
870
|
-
const { availableModels: t, aiProviders: n, reuniteAuth: s } = e, [o, r] =
|
|
871
|
-
|
|
870
|
+
const un = "replay:ai:selectedModelId";
|
|
871
|
+
function dn(e) {
|
|
872
|
+
const { availableModels: t, aiProviders: n, reuniteAuth: s } = e, [o, r] = cn(
|
|
873
|
+
un,
|
|
872
874
|
ae.id
|
|
873
875
|
);
|
|
874
|
-
return
|
|
876
|
+
return b(() => {
|
|
875
877
|
t.find((l) => l.id === o) || r(ae.id);
|
|
876
|
-
}, [t, o, r]), { model:
|
|
878
|
+
}, [t, o, r]), { model: w(() => {
|
|
877
879
|
const i = {
|
|
878
880
|
provider: ne,
|
|
879
881
|
baseUrl: s.baseUrl,
|
|
880
882
|
accessToken: s.accessToken
|
|
881
|
-
}, l = t.find((
|
|
883
|
+
}, l = t.find((C) => C.id === o);
|
|
882
884
|
if (!l || l.provider === ne)
|
|
883
885
|
return i;
|
|
884
|
-
const
|
|
885
|
-
return !
|
|
886
|
+
const u = n?.[l.provider];
|
|
887
|
+
return !u || !u.apiKey || !u.enabled ? i : {
|
|
886
888
|
provider: l.provider,
|
|
887
889
|
modelId: l.id,
|
|
888
|
-
apiKey:
|
|
890
|
+
apiKey: u.apiKey
|
|
889
891
|
};
|
|
890
892
|
}, [o, t, n, s]), selectedModelId: o, selectModel: r };
|
|
891
893
|
}
|
|
892
|
-
function
|
|
894
|
+
function hn() {
|
|
893
895
|
const [e, t] = z({
|
|
894
896
|
baseUrl: "",
|
|
895
897
|
accessToken: ""
|
|
896
898
|
}), { getReuniteAuth: n } = se();
|
|
897
|
-
return
|
|
899
|
+
return b(() => {
|
|
898
900
|
let s = !1;
|
|
899
901
|
async function o() {
|
|
900
902
|
const r = await n?.();
|
|
@@ -913,85 +915,85 @@ function un() {
|
|
|
913
915
|
};
|
|
914
916
|
}, [n]), e;
|
|
915
917
|
}
|
|
916
|
-
function
|
|
917
|
-
const { children: t } = e, [n, s] = z(me), [o, r] = z(n), [a, i] = z(null), l = ue(),
|
|
918
|
+
function An(e) {
|
|
919
|
+
const { children: t } = e, [n, s] = z(me), [o, r] = z(n), [a, i] = z(null), l = ue(), u = se(), { openPanel: C } = Se(), I = o !== n, c = f(() => {
|
|
918
920
|
const g = me();
|
|
919
921
|
r(g), s(g);
|
|
920
922
|
}, []), p = f((g) => {
|
|
921
923
|
r(g);
|
|
922
|
-
}, []), { data: h } =
|
|
924
|
+
}, []), { data: h } = pt(o), $ = hn(), P = an(u.aiProviders), { selectedModelId: q, model: y, selectModel: m } = dn({
|
|
923
925
|
availableModels: P,
|
|
924
|
-
aiProviders:
|
|
926
|
+
aiProviders: u.aiProviders,
|
|
925
927
|
reuniteAuth: $
|
|
926
|
-
}), F =
|
|
928
|
+
}), F = mt(), k = rn({ chatId: n, model: y }), D = on({ chatId: n, model: y }), K = sn({
|
|
927
929
|
chatId: n,
|
|
928
|
-
model:
|
|
930
|
+
model: y,
|
|
929
931
|
existingTitle: h?.title
|
|
930
932
|
}), W = f(
|
|
931
933
|
(g, L) => {
|
|
932
|
-
L.isAbort || (
|
|
934
|
+
L.isAbort || (k(g, L), K(g, L));
|
|
933
935
|
},
|
|
934
|
-
[
|
|
936
|
+
[k, K]
|
|
935
937
|
), Y = f(
|
|
936
938
|
(...g) => {
|
|
937
939
|
D(...g);
|
|
938
940
|
},
|
|
939
941
|
[D]
|
|
940
|
-
),
|
|
942
|
+
), B = f(
|
|
941
943
|
(g) => {
|
|
942
944
|
(o === g || n === g) && c(), F.mutate(g);
|
|
943
945
|
},
|
|
944
946
|
[c, n, F, o]
|
|
945
|
-
),
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
}, [
|
|
949
|
-
const
|
|
947
|
+
), O = h?.id;
|
|
948
|
+
b(() => {
|
|
949
|
+
O && O !== n && s(O);
|
|
950
|
+
}, [O, o, n]);
|
|
951
|
+
const U = f(() => {
|
|
950
952
|
i(null);
|
|
951
953
|
}, []), Q = f(
|
|
952
954
|
(g) => {
|
|
953
|
-
l.aiEnabled.get() && (c(), i(g),
|
|
955
|
+
l.aiEnabled.get() && (c(), i(g), C());
|
|
954
956
|
},
|
|
955
|
-
[
|
|
956
|
-
), J =
|
|
957
|
+
[C, c, l.aiEnabled]
|
|
958
|
+
), J = w(
|
|
957
959
|
() => ({
|
|
958
960
|
chatId: n,
|
|
959
|
-
model:
|
|
961
|
+
model: y,
|
|
960
962
|
availableModels: P,
|
|
961
963
|
selectedModelId: q,
|
|
962
964
|
selectModel: m,
|
|
963
|
-
onSettingsOpen:
|
|
964
|
-
title: h?.title ??
|
|
965
|
-
isLoading:
|
|
965
|
+
onSettingsOpen: u.onSettingsOpen,
|
|
966
|
+
title: h?.title ?? qe.title,
|
|
967
|
+
isLoading: I,
|
|
966
968
|
selectChat: p,
|
|
967
|
-
removeChat:
|
|
969
|
+
removeChat: B,
|
|
968
970
|
createNewChat: c,
|
|
969
971
|
openAiChatWithPresetInput: Q,
|
|
970
972
|
pendingComposerPreset: a,
|
|
971
|
-
clearPendingComposerPreset:
|
|
973
|
+
clearPendingComposerPreset: U
|
|
972
974
|
}),
|
|
973
975
|
[
|
|
974
976
|
n,
|
|
975
977
|
P,
|
|
976
978
|
h?.title,
|
|
977
|
-
|
|
978
|
-
|
|
979
|
+
y,
|
|
980
|
+
I,
|
|
979
981
|
p,
|
|
980
|
-
|
|
982
|
+
B,
|
|
981
983
|
c,
|
|
982
984
|
Q,
|
|
983
985
|
a,
|
|
984
|
-
|
|
986
|
+
U,
|
|
985
987
|
q,
|
|
986
988
|
m,
|
|
987
|
-
|
|
989
|
+
u.onSettingsOpen
|
|
988
990
|
]
|
|
989
991
|
);
|
|
990
|
-
return /* @__PURE__ */ te(
|
|
991
|
-
|
|
992
|
+
return /* @__PURE__ */ te(Ke.Provider, { value: J, children: /* @__PURE__ */ te(
|
|
993
|
+
Zt,
|
|
992
994
|
{
|
|
993
995
|
chatId: n,
|
|
994
|
-
model:
|
|
996
|
+
model: y,
|
|
995
997
|
initialMessages: h?.messages,
|
|
996
998
|
onChatFinish: W,
|
|
997
999
|
onChatMessagesUpdated: Y,
|
|
@@ -1000,5 +1002,5 @@ function In(e) {
|
|
|
1000
1002
|
) });
|
|
1001
1003
|
}
|
|
1002
1004
|
export {
|
|
1003
|
-
|
|
1005
|
+
An as AiChatProvider
|
|
1004
1006
|
};
|