@redocly/replay 0.28.0-next.0 → 0.28.0-next.10
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-BWL86hXh.js +6 -0
- package/dist/{replay-AiChatProvider-BZUzXfD-.js → replay-AiChatProvider-CY3b_ggu.js} +376 -376
- package/dist/{replay-AiChatSqliteDBStorage-CTVtufnx.js → replay-AiChatSqliteDBStorage-BtV53vvj.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-JpKE0iGm.js → replay-AiChatSqliteDBStorage-CjzLqUwK.js} +6 -6
- package/dist/{replay-AiPanel-DkR-vZTK.js → replay-AiPanel-B3HBaMPh.js} +706 -709
- package/dist/replay-AiPanel-BzaoPsXZ.js +742 -0
- package/dist/replay-FileWatcher-BFtAqsmL.js +1 -0
- package/dist/replay-FileWatcher-d1_qKRfS.js +364 -0
- package/dist/{replay-HistorySqliteDBStorage-CtF6-vY8.js → replay-HistorySqliteDBStorage-Bi5vBQ2T.js} +2 -2
- package/dist/replay-SemanticSearchService-CTWesmRy.js +1 -0
- package/dist/{replay-SemanticSearchService-CSsOmkV_.js → replay-SemanticSearchService-DcR4Q6w6.js} +27 -31
- package/dist/{replay-SqliteDBStorage-DpAEbsAQ.js → replay-SqliteDBStorage-BeDAsnlF.js} +1 -1
- package/dist/{replay-SqliteDBStorage-BSMAgfUS.js → replay-SqliteDBStorage-BlVDbZhU.js} +49 -49
- package/dist/{replay-StepContextSqliteDBStorage-BfAAKDwA.js → replay-StepContextSqliteDBStorage-BkB2NM27.js} +2 -2
- package/dist/replay-TauriFileSystemAdapter-B_VaAUfL.js +1 -0
- package/dist/replay-TauriFileSystemAdapter-Cu-Q6QS_.js +108 -0
- package/dist/replay-TauriRootStorage-Cidjagk-.js +1 -0
- package/dist/{replay-TauriRootStorage-g9zf2-FS.js → replay-TauriRootStorage-DVeU3RvV.js} +213 -210
- package/dist/{replay-agent-loop-be2meQsN.js → replay-agent-loop-B42P9R-q.js} +1 -1
- package/dist/{replay-agent-loop-ClVUvt0C.js → replay-agent-loop-DweKWrQp.js} +5 -5
- package/dist/{replay-ai-chat-mappers-JOZvaHV_.js → replay-ai-chat-mappers-Cno0s3T8.js} +1 -1
- package/dist/{replay-ai-chat-mappers-CwvRub6i.js → replay-ai-chat-mappers-DusPRQPG.js} +3 -3
- package/dist/{replay-ai-message-parts.schema-E9u9-nqr.js → replay-ai-message-parts.schema-DKLf0SiG.js} +1 -1
- package/dist/{replay-create-model-rzGPB8KT.js → replay-create-model-CeSlm24x.js} +4 -4
- package/dist/{replay-create-model-CJ3dsZg8.js → replay-create-model-DdPq1CIm.js} +3 -3
- package/dist/{replay-db-CW7044b2.js → replay-db-Bj8Qpvpw.js} +1 -1
- package/dist/{replay-db-zC1KPTH0.js → replay-db-he8XQjrM.js} +1 -1
- package/dist/{replay-external-resolver-BDPRz7Xd.js → replay-external-resolver-BRs5F07f.js} +7 -7
- package/dist/{replay-external-resolver-Dty0CDYE.js → replay-external-resolver-gQ0egbx7.js} +1 -1
- package/dist/{replay-history.schema-5ce6X0R1.js → replay-history.schema-B0lLwmdG.js} +3 -3
- package/dist/replay-index-B1qPs-GR.js +4 -0
- package/dist/replay-index-C2b91LJZ.js +7013 -0
- package/dist/{replay-index--hMZLQs8.js → replay-index-CA6OI1Qg.js} +1 -1
- package/dist/replay-index-CYphcClc.js +1 -0
- package/dist/{replay-index-F4GEOEUz.js → replay-index-DRb3mixV.js} +65311 -63618
- package/dist/replay-index-Dtxwps1s.js +574 -0
- package/dist/replay-index-NgGicGfR.js +1 -0
- package/dist/{replay-index-DZN7KzbY.js → replay-index-uF3nFq_Y.js} +1 -1
- package/dist/{replay-indexes-CfsvVMi_.js → replay-indexes-B3PJtgeh.js} +43 -43
- package/dist/replay-lint-C2hyYWRS.js +177 -0
- package/dist/{replay-lint-9YeYgRBU.js → replay-lint-gY_wyYPJ.js} +17581 -21140
- package/dist/{replay-lint-graphql-Dba0twW-.js → replay-lint-graphql-BA9t8-Ua.js} +1 -1
- package/dist/{replay-lint-graphql-BelJUl9-.js → replay-lint-graphql-DDrnrINc.js} +1 -1
- package/dist/replay-periodic-revalidation-BbAt74oL.js +21 -0
- package/dist/replay-periodic-revalidation-kmD2RQn1.js +1 -0
- package/dist/replay-resolve-BJ_AY-Mn.js +47 -0
- package/dist/{replay-resolve-RxCCaHXw.js → replay-resolve-_V8uYdTK.js} +470 -468
- package/dist/replay-respect-run-CLLZoRh1.js +8392 -0
- package/dist/replay-respect-run-qOz91QPQ.js +82 -0
- package/dist/replay-step-context.schema-BOprzd6Z.js +21 -0
- package/dist/{replay-tauri-path-hGM_JYax.js → replay-tauri-path-lH8t5rdX.js} +1 -1
- package/dist/replay-tauri-path-twTA2lKs.js +22 -0
- package/dist/replay-useAiChatQueries-BIqM2KQW.js +215 -0
- package/dist/{replay-useAiChatQueries-DD84oZan.js → replay-useAiChatQueries-yCsYY1j2.js} +1583 -1371
- package/dist/{replay-validate-key-xk-9xmJ6.js → replay-validate-key-Bh41yY9h.js} +2 -2
- package/dist/{replay-validate-key-PS5qrafQ.js → replay-validate-key-_oaOw5Jy.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +10 -3
- package/dist/replay.js +14 -14
- package/package.json +20 -13
- package/dist/replay-AiChatProvider-Dllh11wo.js +0 -6
- package/dist/replay-AiPanel-DruBN19L.js +0 -742
- package/dist/replay-FileWatcher-D3W6TGFC.js +0 -1
- package/dist/replay-FileWatcher-v7Qw29PS.js +0 -343
- package/dist/replay-SemanticSearchService-Dfx2W4Za.js +0 -1
- package/dist/replay-TauriFileSystemAdapter-BLPH1Vx3.js +0 -1
- package/dist/replay-TauriFileSystemAdapter-Ddq9xfo1.js +0 -99
- package/dist/replay-TauriRootStorage-l_sNXRNW.js +0 -1
- package/dist/replay-index-5UkXwLrd.js +0 -504
- package/dist/replay-index-9h4E2FR8.js +0 -1
- package/dist/replay-index-B7GU_aMu.js +0 -25
- package/dist/replay-index-DbWKCsKW.js +0 -6906
- package/dist/replay-index-ko78Z8QX.js +0 -1
- package/dist/replay-lint-DK6LCpO2.js +0 -184
- package/dist/replay-periodic-revalidation-BoyLQHtg.js +0 -1
- package/dist/replay-periodic-revalidation-Dsp-n7ui.js +0 -21
- package/dist/replay-resolve-CRBvIGPM.js +0 -47
- package/dist/replay-respect-run-BP5Q5L8N.js +0 -78
- package/dist/replay-respect-run-CRGPD-UQ.js +0 -8200
- package/dist/replay-step-context.schema-DBk4jufr.js +0 -21
- package/dist/replay-tauri-path-BmHpvlYp.js +0 -22
- package/dist/replay-useAiChatQueries-KVveua_P.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 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-DRb3mixV.js";
|
|
4
|
+
import { A as Xe, D as Ze, l as et } from "./replay-create-model-CeSlm24x.js";
|
|
5
|
+
import { AgentLoop as tt } from "./replay-agent-loop-DweKWrQp.js";
|
|
6
|
+
import { s as nt } from "./replay-db-he8XQjrM.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-yCsYY1j2.js";
|
|
8
8
|
import { useQueryClient as de, useMutation as he } from "@tanstack/react-query";
|
|
9
|
-
import {
|
|
10
|
-
class
|
|
9
|
+
import { d as Se, g as me } from "./replay-ai-chat-mappers-DusPRQPG.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,7 +128,7 @@ function vt() {
|
|
|
128
128
|
let s, o = 0;
|
|
129
129
|
return function(...a) {
|
|
130
130
|
clearTimeout(s);
|
|
131
|
-
const i = Date.now(),
|
|
131
|
+
const i = Date.now(), h = i - o, u = n - h;
|
|
132
132
|
u <= 0 ? (o = i, t.apply(this, a)) : s = setTimeout(() => {
|
|
133
133
|
o = Date.now(), t.apply(this, a);
|
|
134
134
|
}, u);
|
|
@@ -136,90 +136,90 @@ function vt() {
|
|
|
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
|
+
}, 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
|
-
}, _ = (e, t, n, s) => (
|
|
149
|
-
function
|
|
150
|
-
return t != null ?
|
|
148
|
+
}, _ = (e, t, n, s) => (be(e, t, "write to private field"), t.set(e, n), n);
|
|
149
|
+
function Mt(e, t) {
|
|
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
|
-
|
|
155
|
-
_(this,
|
|
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
|
-
_(this,
|
|
157
|
+
_(this, C, c(this, C).slice(0, -1)), c(this, F).call(this);
|
|
158
158
|
}, this.replaceMessage = (t, n) => {
|
|
159
|
-
_(this,
|
|
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
|
-
const s = n ?
|
|
167
|
-
return
|
|
168
|
-
|
|
166
|
+
const s = n ? Mt(t, n) : t;
|
|
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
|
-
|
|
174
|
-
}),
|
|
175
|
-
|
|
176
|
-
}),
|
|
177
|
-
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
}), _(this,
|
|
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
|
+
}), T(this, F, () => {
|
|
175
|
+
c(this, V).forEach((t) => t());
|
|
176
|
+
}), T(this, ie, () => {
|
|
177
|
+
c(this, G).forEach((t) => t());
|
|
178
|
+
}), T(this, le, () => {
|
|
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
|
-
_(this, Z, e),
|
|
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
|
-
_(this, ee, e),
|
|
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
|
-
_(this,
|
|
198
|
+
_(this, C, [...e]), c(this, F).call(this);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
C = /* @__PURE__ */ new WeakMap();
|
|
202
202
|
Z = /* @__PURE__ */ new WeakMap();
|
|
203
203
|
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 Et(e);
|
|
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
|
-
|
|
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,36 +237,36 @@ 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
|
+
), h = re(
|
|
270
270
|
i,
|
|
271
271
|
() => r.current.messages,
|
|
272
272
|
() => r.current.messages
|
|
@@ -274,27 +274,27 @@ function At({
|
|
|
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
|
-
),
|
|
282
|
-
(
|
|
283
|
-
typeof
|
|
281
|
+
), w = f(
|
|
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 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
299
|
status: u,
|
|
300
300
|
/**
|
|
@@ -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: h } = t.data;
|
|
486
484
|
return {
|
|
487
485
|
...o,
|
|
488
|
-
label:
|
|
486
|
+
label: h ?? `${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
|
-
return
|
|
533
|
-
if (!
|
|
532
|
+
function tn() {
|
|
533
|
+
const e = Le(), { tab: t } = je(), n = t?.data ?? null;
|
|
534
|
+
return I(() => {
|
|
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,12 +588,12 @@ 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
|
-
return
|
|
594
|
+
function rn() {
|
|
595
|
+
const { getApiOperation: e } = qe(), t = Ae();
|
|
596
|
+
return I(
|
|
595
597
|
() => ({
|
|
596
598
|
getApiOperation: e,
|
|
597
599
|
...t
|
|
@@ -599,167 +601,167 @@ function Jt() {
|
|
|
599
601
|
[e, t]
|
|
600
602
|
);
|
|
601
603
|
}
|
|
602
|
-
function
|
|
603
|
-
const { convertOperationToReplayValue: t } = se(), n =
|
|
604
|
-
return u.current = n, { tools:
|
|
605
|
-
const
|
|
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(), h = Ve(), u = W(n);
|
|
606
|
+
return u.current = n, { tools: I(() => {
|
|
607
|
+
const w = new At({
|
|
608
|
+
middlewares: [sn()]
|
|
607
609
|
});
|
|
608
|
-
return
|
|
609
|
-
[
|
|
610
|
-
[
|
|
611
|
-
[
|
|
612
|
-
[
|
|
613
|
-
[
|
|
614
|
-
[
|
|
610
|
+
return st(w, {
|
|
611
|
+
[gt.name]: void 0,
|
|
612
|
+
[ft.name]: { settings: o, store: r },
|
|
613
|
+
[pt.name]: { store: r, runWorkflow: h },
|
|
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
|
-
[
|
|
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]: {
|
|
625
627
|
getActiveTabDetailedData: () => u.current
|
|
626
628
|
},
|
|
627
|
-
[
|
|
628
|
-
}),
|
|
629
|
+
[rt.name]: { store: r }
|
|
630
|
+
}), w.getToolSet();
|
|
629
631
|
}, [
|
|
630
632
|
a,
|
|
631
633
|
t,
|
|
632
634
|
i,
|
|
633
635
|
e,
|
|
634
636
|
s,
|
|
635
|
-
|
|
637
|
+
h,
|
|
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
|
-
|
|
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: 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
|
+
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 E = ge.setSpan(He.active(), M);
|
|
650
|
+
return new tt({
|
|
649
651
|
activeConversationId: n,
|
|
650
|
-
model:
|
|
651
|
-
tools:
|
|
652
|
-
sendEvent:
|
|
653
|
-
parentCtx:
|
|
654
|
-
getActiveStateMessage: () =>
|
|
652
|
+
model: l.current,
|
|
653
|
+
tools: w.current,
|
|
654
|
+
sendEvent: v,
|
|
655
|
+
parentCtx: E,
|
|
656
|
+
getActiveStateMessage: () => qt(en(j))
|
|
655
657
|
});
|
|
656
|
-
}, [n,
|
|
657
|
-
|
|
658
|
-
const
|
|
659
|
-
if (
|
|
660
|
-
return new
|
|
661
|
-
}, [
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
}, [
|
|
665
|
-
|
|
666
|
-
}, [
|
|
658
|
+
}, [n, v, j]);
|
|
659
|
+
R(() => () => x.current?.end(), []);
|
|
660
|
+
const B = I(() => {
|
|
661
|
+
if (g)
|
|
662
|
+
return new Ze({ agent: g.getAgent() });
|
|
663
|
+
}, [g]);
|
|
664
|
+
R(() => {
|
|
665
|
+
g.setModel(s);
|
|
666
|
+
}, [g, s]), R(() => {
|
|
667
|
+
g.registerTools(u);
|
|
668
|
+
}, [g, u]);
|
|
667
669
|
const {
|
|
668
670
|
messages: k,
|
|
669
671
|
setMessages: D,
|
|
670
|
-
sendMessage:
|
|
671
|
-
status:
|
|
672
|
+
sendMessage: N,
|
|
673
|
+
status: b,
|
|
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 = I(() => b === "streaming" || b === "submitted", [b]), q = f(() => {
|
|
687
|
+
i.aiEnabled === !0 && d();
|
|
688
|
+
}, [d, i.aiEnabled]), Q = f(() => {
|
|
689
|
+
P();
|
|
690
|
+
}, [P]), J = f(
|
|
691
|
+
async (M) => {
|
|
692
|
+
const E = M.trim();
|
|
693
|
+
if (!(!E || !B)) {
|
|
692
694
|
if (s.provider === ne) {
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
+
const A = await h?.();
|
|
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: E });
|
|
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, h, s.provider, N, D, B]
|
|
708
|
+
), m = f(() => {
|
|
709
|
+
y && O();
|
|
710
|
+
}, [y, O]);
|
|
711
|
+
R(() => () => {
|
|
712
|
+
O();
|
|
713
|
+
}, [n, O]);
|
|
714
|
+
const U = f(
|
|
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
|
+
D(pe), a?.(A);
|
|
718
720
|
},
|
|
719
721
|
[k, a, D]
|
|
720
|
-
), Me =
|
|
722
|
+
), Me = I(
|
|
721
723
|
() => ({
|
|
722
724
|
messages: k,
|
|
723
|
-
isStreaming:
|
|
724
|
-
chatStatus:
|
|
725
|
+
isStreaming: y,
|
|
726
|
+
chatStatus: b,
|
|
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
|
-
|
|
736
|
+
y,
|
|
735
737
|
k,
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
738
|
+
J,
|
|
739
|
+
b,
|
|
740
|
+
m,
|
|
741
|
+
U
|
|
740
742
|
]
|
|
741
|
-
),
|
|
743
|
+
), Ee = I(
|
|
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: Me, children: /* @__PURE__ */ te(ze.Provider, { value: Ee, 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,8 +819,8 @@ function on({ chatId: e, model: t }) {
|
|
|
817
819
|
[t, e, n]
|
|
818
820
|
);
|
|
819
821
|
}
|
|
820
|
-
function
|
|
821
|
-
return
|
|
822
|
+
function fn(e) {
|
|
823
|
+
return I(() => {
|
|
822
824
|
const t = [ae];
|
|
823
825
|
if (e) {
|
|
824
826
|
for (const [n, s] of Object.entries(e))
|
|
@@ -844,59 +846,57 @@ 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, R(() => {
|
|
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 h = a instanceof Function ? a(i) : a;
|
|
865
|
+
return gn(e, h), h;
|
|
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
|
-
);
|
|
876
|
-
return
|
|
877
|
-
|
|
878
|
-
}, [t, o, r]), { model: w(() => {
|
|
879
|
-
const i = {
|
|
877
|
+
), a = t.some((h) => h.id === o) ? o : ae.id;
|
|
878
|
+
return { model: I(() => {
|
|
879
|
+
const h = {
|
|
880
880
|
provider: ne,
|
|
881
881
|
baseUrl: s.baseUrl,
|
|
882
882
|
accessToken: s.accessToken
|
|
883
|
-
},
|
|
884
|
-
if (!
|
|
885
|
-
return
|
|
886
|
-
const
|
|
887
|
-
return !
|
|
888
|
-
provider:
|
|
889
|
-
modelId:
|
|
890
|
-
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
|
|
891
891
|
};
|
|
892
|
-
}, [
|
|
892
|
+
}, [a, t, n, s]), selectedModelId: a, selectModel: r };
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function Cn() {
|
|
895
895
|
const [e, t] = z({
|
|
896
896
|
baseUrl: "",
|
|
897
897
|
accessToken: ""
|
|
898
898
|
}), { getReuniteAuth: n } = se();
|
|
899
|
-
return
|
|
899
|
+
return R(() => {
|
|
900
900
|
let s = !1;
|
|
901
901
|
async function o() {
|
|
902
902
|
const r = await n?.();
|
|
@@ -915,92 +915,92 @@ function hn() {
|
|
|
915
915
|
};
|
|
916
916
|
}, [n]), e;
|
|
917
917
|
}
|
|
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:
|
|
918
|
+
function _n(e) {
|
|
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(() => {
|
|
920
|
+
const m = me();
|
|
921
|
+
r(m), s(m);
|
|
922
|
+
}, []), p = f((m) => {
|
|
923
|
+
r(m);
|
|
924
|
+
}, []), { data: d } = It(o), P = Cn(), x = fn(u.aiProviders), { selectedModelId: j, model: g, selectModel: B } = wn({
|
|
925
|
+
availableModels: x,
|
|
926
926
|
aiProviders: u.aiProviders,
|
|
927
|
-
reuniteAuth:
|
|
928
|
-
}),
|
|
927
|
+
reuniteAuth: P
|
|
928
|
+
}), k = yt(), D = hn({ chatId: n, model: g }), N = pn({ chatId: n, model: g }), b = dn({
|
|
929
929
|
chatId: n,
|
|
930
|
-
model:
|
|
931
|
-
existingTitle:
|
|
932
|
-
}),
|
|
933
|
-
(
|
|
934
|
-
|
|
930
|
+
model: g,
|
|
931
|
+
existingTitle: d?.title
|
|
932
|
+
}), Y = f(
|
|
933
|
+
(m, U) => {
|
|
934
|
+
U.isAbort || (D(m, U), b(m, U));
|
|
935
935
|
},
|
|
936
|
-
[
|
|
937
|
-
),
|
|
938
|
-
(...
|
|
939
|
-
|
|
936
|
+
[D, b]
|
|
937
|
+
), O = f(
|
|
938
|
+
(...m) => {
|
|
939
|
+
N(...m);
|
|
940
940
|
},
|
|
941
|
-
[
|
|
942
|
-
),
|
|
943
|
-
(
|
|
944
|
-
(o ===
|
|
941
|
+
[N]
|
|
942
|
+
), K = f(
|
|
943
|
+
(m) => {
|
|
944
|
+
(o === m || n === m) && l(), k.mutate(m);
|
|
945
945
|
},
|
|
946
|
-
[
|
|
947
|
-
),
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
}, [
|
|
951
|
-
const
|
|
946
|
+
[l, n, k, o]
|
|
947
|
+
), y = d?.id;
|
|
948
|
+
R(() => {
|
|
949
|
+
y && y !== n && s(y);
|
|
950
|
+
}, [y, o, n]);
|
|
951
|
+
const q = f(() => {
|
|
952
952
|
i(null);
|
|
953
953
|
}, []), Q = f(
|
|
954
|
-
(
|
|
955
|
-
|
|
954
|
+
(m) => {
|
|
955
|
+
h.aiEnabled && (l(), i(m), v());
|
|
956
956
|
},
|
|
957
|
-
[
|
|
958
|
-
), J =
|
|
957
|
+
[v, l, h.aiEnabled]
|
|
958
|
+
), J = I(
|
|
959
959
|
() => ({
|
|
960
960
|
chatId: n,
|
|
961
|
-
model:
|
|
962
|
-
availableModels:
|
|
963
|
-
selectedModelId:
|
|
964
|
-
selectModel:
|
|
961
|
+
model: g,
|
|
962
|
+
availableModels: x,
|
|
963
|
+
selectedModelId: j,
|
|
964
|
+
selectModel: B,
|
|
965
965
|
onSettingsOpen: u.onSettingsOpen,
|
|
966
|
-
title:
|
|
967
|
-
isLoading:
|
|
966
|
+
title: d?.title ?? Ye.title,
|
|
967
|
+
isLoading: w,
|
|
968
968
|
selectChat: p,
|
|
969
|
-
removeChat:
|
|
970
|
-
createNewChat:
|
|
969
|
+
removeChat: K,
|
|
970
|
+
createNewChat: l,
|
|
971
971
|
openAiChatWithPresetInput: Q,
|
|
972
972
|
pendingComposerPreset: a,
|
|
973
|
-
clearPendingComposerPreset:
|
|
973
|
+
clearPendingComposerPreset: q
|
|
974
974
|
}),
|
|
975
975
|
[
|
|
976
976
|
n,
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
977
|
+
x,
|
|
978
|
+
d?.title,
|
|
979
|
+
g,
|
|
980
|
+
w,
|
|
981
981
|
p,
|
|
982
|
-
|
|
983
|
-
|
|
982
|
+
K,
|
|
983
|
+
l,
|
|
984
984
|
Q,
|
|
985
985
|
a,
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
986
|
+
q,
|
|
987
|
+
j,
|
|
988
|
+
B,
|
|
989
989
|
u.onSettingsOpen
|
|
990
990
|
]
|
|
991
991
|
);
|
|
992
|
-
return /* @__PURE__ */ te(
|
|
993
|
-
|
|
992
|
+
return /* @__PURE__ */ te(Je.Provider, { value: J, children: /* @__PURE__ */ te(
|
|
993
|
+
an,
|
|
994
994
|
{
|
|
995
995
|
chatId: n,
|
|
996
|
-
model:
|
|
997
|
-
initialMessages:
|
|
998
|
-
onChatFinish:
|
|
999
|
-
onChatMessagesUpdated:
|
|
996
|
+
model: g,
|
|
997
|
+
initialMessages: d?.messages,
|
|
998
|
+
onChatFinish: Y,
|
|
999
|
+
onChatMessagesUpdated: O,
|
|
1000
1000
|
children: t
|
|
1001
1001
|
}
|
|
1002
1002
|
) });
|
|
1003
1003
|
}
|
|
1004
1004
|
export {
|
|
1005
|
-
|
|
1005
|
+
_n as AiChatProvider
|
|
1006
1006
|
};
|