@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.
Files changed (64) hide show
  1. package/dist/{replay-AiChatProvider-BtDAvnSq.js → replay-AiChatProvider-Bj2P_hdU.js} +371 -369
  2. package/dist/replay-AiChatProvider-GeumgtIo.js +6 -0
  3. package/dist/{replay-AiChatSqliteDBStorage-CjD_0sid.js → replay-AiChatSqliteDBStorage-0M2Ejnzu.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-DYTBtCdW.js → replay-AiChatSqliteDBStorage-BWJl1qdO.js} +1 -1
  5. package/dist/{replay-AiPanel-Wn4vI4q5.js → replay-AiPanel-DfOpKMDQ.js} +709 -712
  6. package/dist/replay-AiPanel-ON_QfwBN.js +742 -0
  7. package/dist/replay-FileWatcher-04GlEkra.js +360 -0
  8. package/dist/replay-FileWatcher-B-T0jz_R.js +1 -0
  9. package/dist/{replay-SemanticSearchService-Dn-s19V3.js → replay-SemanticSearchService-BQgdj2wy.js} +1 -1
  10. package/dist/{replay-SemanticSearchService-B1_4MZ3a.js → replay-SemanticSearchService-CPIb_cUk.js} +7 -7
  11. package/dist/{replay-SqliteDBStorage-BqOim0Il.js → replay-SqliteDBStorage-Bt2xXqei.js} +1 -1
  12. package/dist/{replay-SqliteDBStorage-CRZ9Yx8K.js → replay-SqliteDBStorage-vehgvWXZ.js} +1 -1
  13. package/dist/{replay-TauriFileSystemAdapter-Bf-9oAkV.js → replay-TauriFileSystemAdapter-D2yxrS6Q.js} +1 -1
  14. package/dist/{replay-TauriFileSystemAdapter-GrD1Q2jS.js → replay-TauriFileSystemAdapter-YLdtT-Xp.js} +1 -1
  15. package/dist/{replay-TauriRootStorage-Cnd9-u0R.js → replay-TauriRootStorage-BE6RmQfE.js} +162 -165
  16. package/dist/replay-TauriRootStorage-DcENVsBJ.js +1 -0
  17. package/dist/{replay-agent-loop-DcduWdVY.js → replay-agent-loop-CvopOugZ.js} +13 -13
  18. package/dist/{replay-agent-loop-phR7X6HJ.js → replay-agent-loop-UwDSVh-4.js} +1 -1
  19. package/dist/{replay-ai-chat-mappers-f7OYwce2.js → replay-ai-chat-mappers-B7fm-v_w.js} +1 -1
  20. package/dist/{replay-ai-chat-mappers-DMgobD7q.js → replay-ai-chat-mappers-yKBypIXh.js} +1 -1
  21. package/dist/{replay-create-model-B9_RKhPf.js → replay-create-model-CHahxEJy.js} +3 -3
  22. package/dist/{replay-create-model-WcGwy1Px.js → replay-create-model-CyBZMAWB.js} +4 -4
  23. package/dist/{replay-db-BB9biJ4Q.js → replay-db-CifZMdnr.js} +5 -5
  24. package/dist/{replay-db-DcpyTo8s.js → replay-db-EWL-uAt-.js} +1 -1
  25. package/dist/{replay-external-resolver-TFD8mr_P.js → replay-external-resolver-D5fSfJEm.js} +1 -1
  26. package/dist/{replay-external-resolver-CKJWptWf.js → replay-external-resolver-G11iwLVZ.js} +2 -2
  27. package/dist/{replay-index-DuIF4QBl.js → replay-index-B2NUTBd8.js} +1 -1
  28. package/dist/{replay-index-DF6wNUHn.js → replay-index-B3MQaIS-.js} +1 -1
  29. package/dist/replay-index-Coy4kD_x.js +7009 -0
  30. package/dist/{replay-index-DofofQ3T.js → replay-index-CqRiEj9e.js} +1 -1
  31. package/dist/{replay-index-D38KWo5d.js → replay-index-D0mbH_TN.js} +1 -1
  32. package/dist/{replay-index-UbqSETNf.js → replay-index-DDqKE6bs.js} +5 -5
  33. package/dist/{replay-index-qMSGJKzU.js → replay-index-DrI9ZFwH.js} +2 -2
  34. package/dist/{replay-index-CFhkrdmJ.js → replay-index-Dx8O3ZoA.js} +62045 -61139
  35. package/dist/{replay-lint-BaFfhDsl.js → replay-lint-BiOcDIDr.js} +3 -3
  36. package/dist/{replay-lint-j1iYeM_X.js → replay-lint-CAo2fuiZ.js} +3 -3
  37. package/dist/{replay-lint-graphql-DXko1yrv.js → replay-lint-graphql-DAa8UNRg.js} +1 -1
  38. package/dist/{replay-lint-graphql-zL0ESnHi.js → replay-lint-graphql-DzI2rUbR.js} +1 -1
  39. package/dist/replay-periodic-revalidation-D18ihfUc.js +1 -0
  40. package/dist/replay-periodic-revalidation-w7mrtjYg.js +22 -0
  41. package/dist/{replay-resolve-DxQZdksO.js → replay-resolve-CojDRP37.js} +1 -1
  42. package/dist/{replay-resolve-B-AmJx0p.js → replay-resolve-DgAthAfi.js} +1 -1
  43. package/dist/{replay-respect-run-BAuRPVQY.js → replay-respect-run-3ukV7LMg.js} +1 -1
  44. package/dist/{replay-respect-run-CPQGLg0r.js → replay-respect-run-DNvB8rLX.js} +3 -3
  45. package/dist/replay-tauri-path-DM8PdMK8.js +22 -0
  46. package/dist/{replay-tauri-path-Cj6Zgicf.js → replay-tauri-path-kr9DtxLs.js} +1 -1
  47. package/dist/{replay-useAiChatQueries-pptRWb9k.js → replay-useAiChatQueries-BULoKr4E.js} +1564 -1395
  48. package/dist/replay-useAiChatQueries-BdjsFz1P.js +215 -0
  49. package/dist/{replay-validate-key-D4j7fXFM.js → replay-validate-key-CGmguj5X.js} +1 -1
  50. package/dist/{replay-validate-key-DjGy6Q75.js → replay-validate-key-DzseOR5a.js} +2 -2
  51. package/dist/replay.cjs +1 -1
  52. package/dist/replay.d.ts +3 -3
  53. package/dist/replay.js +10 -10
  54. package/package.json +3 -5
  55. package/dist/replay-AiChatProvider-DiHC9TUm.js +0 -6
  56. package/dist/replay-AiPanel-CFbxD8SJ.js +0 -742
  57. package/dist/replay-FileWatcher-Boh7I024.js +0 -352
  58. package/dist/replay-FileWatcher-Cq4DUrxe.js +0 -1
  59. package/dist/replay-TauriRootStorage-BkPcSPgu.js +0 -1
  60. package/dist/replay-index-PZuRF5JU.js +0 -6982
  61. package/dist/replay-periodic-revalidation-BoyLQHtg.js +0 -1
  62. package/dist/replay-periodic-revalidation-Dsp-n7ui.js +0 -21
  63. package/dist/replay-tauri-path-D82YK1cm.js +0 -22
  64. 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 R, useCallback as f, useSyncExternalStore as re, useEffect as b, useMemo as w, useState as z } from "react";
3
- import { h as S, A as ce, g as Re, I as xe, T as $e, j as x, k as Pe, m as De, u as Te, o as We, p as Be, q as Oe, s as Ue, v as Ae, w as se, x as ue, z as ye, B as Fe, C as Le, E as Se, F as ge, G as je, H as ne, J as Ne, K as ae, L as Ke, N as qe } from "./replay-index-CFhkrdmJ.js";
4
- import { A as Qe, D as Ve, l as Ge } from "./replay-create-model-WcGwy1Px.js";
5
- import { AgentLoop as He } from "./replay-agent-loop-DcduWdVY.js";
6
- import { s as ze } from "./replay-db-BB9biJ4Q.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-pptRWb9k.js";
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 be, g as me } from "./replay-ai-chat-mappers-DMgobD7q.js";
10
- class ft {
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 = be(t);
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 gt(e) {
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 = be(s);
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 mt() {
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 vt() {
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(), l = i - o, u = n - l;
132
- u <= 0 ? (o = i, t.apply(this, a)) : s = setTimeout(() => {
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
- }, u);
134
+ }, h);
135
135
  };
136
136
  }
137
137
  return oe = e, oe;
138
138
  }
139
- var wt = /* @__PURE__ */ vt();
140
- const Ct = /* @__PURE__ */ Re(wt);
141
- var Ee = (e, t, n) => {
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
- }, d = (e, t, n) => (Ee(e, t, "read from private field"), n ? n.call(e) : t.get(e)), A = (e, t, n) => {
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
- }, _ = (e, t, n, s) => (Ee(e, t, "write to private field"), t.set(e, n), n);
149
- function It(e, t) {
150
- return t != null ? Ct(e, t) : e;
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, j, ie, le, Tt = class {
152
+ var v, Z, ee, V, G, H, F, ie, le, Mt = class {
153
153
  constructor(e = []) {
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);
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
- _(this, v, d(this, v).slice(0, -1)), d(this, j).call(this);
157
+ R(this, v, u(this, v).slice(0, -1)), u(this, F).call(this);
158
158
  }, this.replaceMessage = (t, n) => {
159
- _(this, v, [
160
- ...d(this, v).slice(0, t),
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
- ...d(this, v).slice(t + 1)
164
- ]), d(this, j).call(this);
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 ? It(t, n) : t;
167
- return d(this, V).add(s), () => {
168
- d(this, V).delete(s);
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) => (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);
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 d(this, Z);
183
+ return u(this, Z);
184
184
  }
185
185
  set status(e) {
186
- _(this, Z, e), d(this, ie).call(this);
186
+ R(this, Z, e), u(this, ie).call(this);
187
187
  }
188
188
  get error() {
189
- return d(this, ee);
189
+ return u(this, ee);
190
190
  }
191
191
  set error(e) {
192
- _(this, ee, e), d(this, le).call(this);
192
+ R(this, ee, e), u(this, le).call(this);
193
193
  }
194
194
  get messages() {
195
- return d(this, v);
195
+ return u(this, v);
196
196
  }
197
197
  set messages(e) {
198
- _(this, v, [...e]), d(this, j).call(this);
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
- j = /* @__PURE__ */ new WeakMap();
207
+ F = /* @__PURE__ */ new WeakMap();
208
208
  ie = /* @__PURE__ */ new WeakMap();
209
209
  le = /* @__PURE__ */ new WeakMap();
210
- var N, we = class extends Qe {
210
+ var L, we = class extends Xe {
211
211
  constructor({ messages: e, ...t }) {
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);
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
- N = /* @__PURE__ */ new WeakMap();
217
- function At({
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 = R(
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: (c) => {
241
- var p, h;
242
- return (h = (p = s.current).onToolCall) == null ? void 0 : h.call(p, c);
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: (c) => {
245
- var p, h;
246
- return (h = (p = s.current).onData) == null ? void 0 : h.call(p, c);
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: (c) => {
249
- var p, h;
250
- return (h = (p = s.current).onFinish) == null ? void 0 : h.call(p, c);
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: (c) => {
253
- var p, h;
254
- return (h = (p = s.current).onError) == null ? void 0 : h.call(p, c);
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: (c) => {
257
- var p, h, $;
258
- return ($ = (h = (p = s.current).sendAutomaticallyWhen) == null ? void 0 : h.call(p, c)) != null ? $ : !1;
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 = 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
- (c) => r.current["~registerMessagesCallback"](c, e),
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
- ), l = re(
269
+ ), c = re(
270
270
  i,
271
271
  () => r.current.messages,
272
272
  () => r.current.messages
273
- ), u = re(
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
- (c) => {
283
- typeof c == "function" && (c = c(r.current.messages)), r.current.messages = c;
282
+ (l) => {
283
+ typeof l == "function" && (l = l(r.current.messages)), r.current.messages = l;
284
284
  },
285
285
  [r]
286
286
  );
287
- return b(() => {
287
+ return k(() => {
288
288
  t && r.current.resumeStream();
289
289
  }, [t, r]), {
290
290
  id: r.current.id,
291
- messages: l,
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: u,
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 yt = 20;
309
- function St(e) {
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, yt), n = t.map(bt), s = e.length - t.length;
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 bt(e) {
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 kt = 30;
325
- function Et(e) {
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 = kt, s = 0, o = 0;
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(Mt(a)), n--, a.workflows.length === 0)
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(` ${_t(i)}`), n--) : s++;
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 Mt(e) {
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 _t(e) {
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 Rt = 20;
360
- function xt(e) {
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, Rt), n = t.map($t), s = e.length - t.length;
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 $t(e) {
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 Pt = 30;
377
- function Dt(e) {
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, Pt), n = t.map(Wt), s = e.length - t.length;
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 Wt(e) {
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 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) {
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
- Bt,
410
+ Kt,
411
411
  t,
412
- Dt(e.tabs),
412
+ jt(e.tabs),
413
413
  t,
414
- St(e.apis),
414
+ $t(e.apis),
415
415
  t,
416
- Et(e.collections),
416
+ Dt(e.collections),
417
417
  t,
418
- xt(e.environments)
418
+ Ut(e.environments)
419
419
  ].join("");
420
- return ze("active_state", n);
420
+ return nt("active_state", n);
421
421
  }
422
- function Ut(e) {
423
- return e.apis.get({ noproxy: !0 }).map(Ft);
422
+ function Qt(e) {
423
+ return e.map(Vt);
424
424
  }
425
- function Ft(e) {
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 Lt(e) {
434
- return e.collections.get({ noproxy: !0 }).map(jt);
433
+ function Gt(e) {
434
+ return e.map(Ht);
435
435
  }
436
- function jt(e) {
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 Nt(e) {
450
- const t = e.environments.get({ noproxy: !0 }), n = e.activeEnvironmentId.get({ noproxy: !0 });
451
- return t.filter((s) => s.state !== xe.Draft).map((s) => ({
452
- name: s.name,
453
- isActive: s.name === n,
454
- inputCount: s.inputs.length,
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 Kt(e) {
459
- const t = e.tabsState.tabs.get({ noproxy: !0 }), n = e.tabsState.activeTabIdx.get({ noproxy: !0 });
460
- return t.map(
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 qt(e, t, n, s) {
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 x.Collection: {
470
+ case $.Collection: {
473
471
  const { collectionId: r } = t.data;
474
472
  return {
475
473
  ...o,
476
- label: Qt(e, r) ?? r,
474
+ label: Xt(e, r) ?? r,
477
475
  collectionId: r
478
476
  };
479
477
  }
480
- case x.Workflow: {
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 x.WorkflowRun: {
485
- const { collectionId: r, workflowId: a, historyId: i, label: l } = t.data;
482
+ case $.WorkflowRun: {
483
+ const { collectionId: r, workflowId: a, historyId: i, label: c } = t.data;
486
484
  return {
487
485
  ...o,
488
- label: l ?? `${a} run`,
486
+ label: c ?? `${a} run`,
489
487
  collectionId: r,
490
488
  workflowId: a,
491
489
  isHistory: i != null
492
490
  };
493
491
  }
494
- case x.Step: {
492
+ case $.Step: {
495
493
  const r = t.data;
496
494
  return {
497
495
  ...o,
498
- label: Vt(r),
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 Qt(e, t) {
510
- return e.collections.find((s) => s.id.get() === t)?.info.title.get();
507
+ function Xt(e, t) {
508
+ return e.find((n) => n.id === t)?.info.title;
511
509
  }
512
- function Vt(e) {
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), De(e.draftStep)].filter(Boolean).join(" ");
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 Gt(e) {
520
+ function en(e) {
521
+ const t = e.get(De);
523
522
  return {
524
- tabs: Kt(e),
525
- apis: Ut(e),
526
- collections: Lt(e),
527
- environments: Nt(e)
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 Ht() {
531
- const { getCollection: e } = Te(), { getWorkflow: t } = We(), { getStep: n } = Be(), { tab: s } = Oe(), o = s?.data.get();
532
+ function tn() {
533
+ const e = Le(), { tab: t } = je(), n = t?.data ?? null;
532
534
  return w(() => {
533
- if (!o)
535
+ if (!n)
534
536
  return null;
535
- switch (o.type) {
536
- case x.Collection:
537
- const a = e(o.collectionId);
537
+ switch (n.type) {
538
+ case $.Collection:
539
+ const o = Ke(e, n.collectionId);
538
540
  return {
539
- ...o,
540
- collection: a ? a.get() : null
541
+ ...n,
542
+ collection: o
541
543
  };
542
- case x.Workflow:
543
- const i = t({
544
- collectionId: o.collectionId,
545
- workflowId: o.workflowId
544
+ case $.Workflow:
545
+ const r = fe(e, {
546
+ collectionId: n.collectionId,
547
+ workflowId: n.workflowId
546
548
  });
547
549
  return {
548
- ...o,
549
- workflow: i ? i.get() : null
550
+ ...n,
551
+ workflow: r
550
552
  };
551
- case x.Step:
552
- const l = n({
553
- collectionId: o.collectionId,
554
- workflowId: o.workflowId,
555
- stepId: o.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
- ...o,
559
- step: l ? l.get() : null
560
+ ...n,
561
+ step: a
560
562
  };
561
- case x.WorkflowRun:
562
- const u = t({
563
- collectionId: o.collectionId,
564
- workflowId: o.workflowId
563
+ case $.WorkflowRun:
564
+ const i = fe(e, {
565
+ collectionId: n.collectionId,
566
+ workflowId: n.workflowId
565
567
  });
566
568
  return {
567
- ...o,
568
- workflow: u ? u.get() : null
569
+ ...n,
570
+ workflow: i
569
571
  };
570
572
  }
571
- }, [o, e, t, n]);
573
+ }, [n, e]);
572
574
  }
573
- function zt(e) {
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 Yt() {
590
- return (e, t) => (n, s) => t(zt(n), s);
591
+ function sn() {
592
+ return (e, t) => (n, s) => t(nn(n), s);
591
593
  }
592
- function Jt() {
593
- const { getApiOperation: e } = Ue(), t = Ae();
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 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()]
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 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 },
613
- [rt.name]: { store: r },
614
- [st.name]: {
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
- [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
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
- [Je.name]: { store: r }
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
- l,
637
+ c,
636
638
  o,
637
639
  r
638
640
  ]) };
639
641
  }
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), K = ye(), y = R(K);
642
- I.current = u, c.current = s, y.current = K;
643
- const m = w(() => {
644
- P.current?.end();
645
- const E = ge.getTracer("replay-ai-chat").startSpan("ai.chat.session", { attributes: { conversation_id: n } });
646
- P.current = E;
647
- const M = ge.setSpan(je.active(), E);
648
- return new He({
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: c.current,
652
+ model: l.current,
651
653
  tools: I.current,
652
654
  sendEvent: C,
653
- parentCtx: M,
654
- getActiveStateMessage: () => Ot(Gt(y.current))
655
+ parentCtx: _,
656
+ getActiveStateMessage: () => qt(en(j))
655
657
  });
656
- }, [n, C]);
657
- b(() => () => P.current?.end(), []);
658
- const F = w(() => {
659
- if (m)
660
- return new Ve({ agent: m.getAgent() });
661
- }, [m]);
662
- b(() => {
663
- m.setModel(s);
664
- }, [m, s]), b(() => {
665
- m.registerTools(u);
666
- }, [m, u]);
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: k,
670
+ messages: b,
669
671
  setMessages: D,
670
- sendMessage: q,
671
- status: W,
672
+ sendMessage: N,
673
+ status: E,
672
674
  error: Y,
673
- stop: B,
674
- addToolApprovalResponse: O
675
- } = At({
675
+ stop: O,
676
+ addToolApprovalResponse: K
677
+ } = _t({
676
678
  id: n,
677
679
  messages: o,
678
- transport: F,
679
- sendAutomaticallyWhen: Ge,
680
- onFinish(E) {
681
- if (!r || !m) return;
682
- r({ agentLoop: m, chat: this }, E);
680
+ transport: B,
681
+ sendAutomaticallyWhen: et,
682
+ onFinish(M) {
683
+ if (!r || !g) return;
684
+ r({ agentLoop: g, chat: this }, M);
683
685
  }
684
- }), U = w(() => W === "streaming" || W === "submitted", [W]), Q = f(() => {
685
- i.aiEnabled.get() === !0 && h();
686
- }, [h, i.aiEnabled]), J = f(() => {
687
- $();
688
- }, [$]), g = f(
689
- async (E) => {
690
- const M = E.trim();
691
- if (!(!M || !F)) {
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 T = await l?.();
694
- T?.baseUrl && T?.accessToken && m.setModel({
695
+ const A = await c?.();
696
+ A?.baseUrl && A?.accessToken && g.setModel({
695
697
  provider: ne,
696
- baseUrl: T.baseUrl,
697
- accessToken: T.accessToken
698
+ baseUrl: A.baseUrl,
699
+ accessToken: A.accessToken
698
700
  });
699
701
  }
700
702
  D(
701
- (T) => ct(T) ? ut(T) : T
702
- ), q({ text: M });
703
+ (A) => mt(A) ? vt(A) : A
704
+ ), N({ text: _ });
703
705
  }
704
706
  },
705
- [m, l, s.provider, q, D, F]
706
- ), L = f(() => {
707
- U && B();
708
- }, [U, B]);
709
- b(() => () => {
710
- B();
711
- }, [n, B]);
712
- const pe = f(
713
- (E) => {
714
- const M = E(k), T = M.map((X) => X.message), fe = [...k];
715
- for (const X of M)
716
- fe[X.index] = X.message;
717
- D(fe), a?.(T);
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
- [k, a, D]
720
- ), Me = w(
721
+ [b, a, D]
722
+ ), Ee = w(
721
723
  () => ({
722
- messages: k,
723
- isStreaming: U,
724
- chatStatus: W,
724
+ messages: b,
725
+ isStreaming: y,
726
+ chatStatus: E,
725
727
  chatError: Y,
726
- sendMessage: g,
727
- updateMessages: pe,
728
- stopGeneration: L,
729
- addToolApprovalResponse: O
728
+ sendMessage: J,
729
+ updateMessages: U,
730
+ stopGeneration: m,
731
+ addToolApprovalResponse: K
730
732
  }),
731
733
  [
732
- O,
734
+ K,
733
735
  Y,
734
- U,
735
- k,
736
- g,
737
- W,
738
- L,
739
- pe
736
+ y,
737
+ b,
738
+ J,
739
+ E,
740
+ m,
741
+ U
740
742
  ]
741
- ), _e = w(
743
+ ), Me = w(
742
744
  () => ({
743
745
  isOpen: p,
744
- openPanel: Q,
745
- closePanel: J
746
+ openPanel: q,
747
+ closePanel: Q
746
748
  }),
747
- [p, Q, J]
749
+ [p, q, Q]
748
750
  );
749
- return /* @__PURE__ */ te(dt.Provider, { value: Me, children: /* @__PURE__ */ te(Ne.Provider, { value: _e, children: t }) });
751
+ return /* @__PURE__ */ te(wt.Provider, { value: Ee, children: /* @__PURE__ */ te(ze.Provider, { value: Me, children: t }) });
750
752
  }
751
- function en(e) {
753
+ function ln(e) {
752
754
  return e.slice(-2);
753
755
  }
754
- function tn(e, t) {
756
+ function cn(e, t) {
755
757
  return !!(e || t < 1);
756
758
  }
757
- function nn(e) {
759
+ function un(e) {
758
760
  return f(
759
761
  async (t, n) => {
760
- if (tn(e, n.messages.length))
762
+ if (cn(e, n.messages.length))
761
763
  return null;
762
- const s = n.messages[0], o = ht(s.parts);
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 sn({
774
+ function dn({
773
775
  chatId: e,
774
776
  model: t,
775
777
  existingTitle: n
776
778
  }) {
777
- const { mutate: s } = gt(e), o = nn(n);
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 rn({ chatId: e, model: t }) {
793
+ function hn({ chatId: e, model: t }) {
792
794
  const { mutate: n } = ke();
793
795
  return f(
794
796
  (s, o) => {
795
- const r = en(
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 on({ chatId: e, model: t }) {
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 an(e) {
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 ln(e, t) {
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 cn(e, t) {
855
- const [n, s] = z(() => Ie(e, t)), o = R(t);
856
- o.current = t, b(() => {
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 l = a instanceof Function ? a(i) : a;
863
- return ln(e, l), l;
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 un = "replay:ai:selectedModelId";
871
- function dn(e) {
872
- const { availableModels: t, aiProviders: n, reuniteAuth: s } = e, [o, r] = cn(
873
- un,
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 b(() => {
877
- t.find((l) => l.id === o) || r(ae.id);
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
- }, l = t.find((C) => C.id === o);
884
- if (!l || l.provider === ne)
885
+ }, c = t.find((C) => C.id === o);
886
+ if (!c || c.provider === ne)
885
887
  return i;
886
- const u = n?.[l.provider];
887
- return !u || !u.apiKey || !u.enabled ? i : {
888
- provider: l.provider,
889
- modelId: l.id,
890
- apiKey: u.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 hn() {
896
+ function Cn() {
895
897
  const [e, t] = z({
896
898
  baseUrl: "",
897
899
  accessToken: ""
898
900
  }), { getReuniteAuth: n } = se();
899
- return b(() => {
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 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(() => {
920
- const g = me();
921
- r(g), s(g);
922
- }, []), p = f((g) => {
923
- r(g);
924
- }, []), { data: h } = pt(o), $ = hn(), P = an(u.aiProviders), { selectedModelId: K, model: y, selectModel: m } = dn({
925
- availableModels: P,
926
- aiProviders: u.aiProviders,
927
- reuniteAuth: $
928
- }), F = mt(), k = rn({ chatId: n, model: y }), D = on({ chatId: n, model: y }), q = sn({
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: y,
931
- existingTitle: h?.title
932
- }), W = f(
933
- (g, L) => {
934
- L.isAbort || (k(g, L), q(g, L));
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
- [k, q]
937
- ), Y = f(
938
- (...g) => {
939
- D(...g);
938
+ [D, E]
939
+ ), O = f(
940
+ (...m) => {
941
+ N(...m);
940
942
  },
941
- [D]
942
- ), B = f(
943
- (g) => {
944
- (o === g || n === g) && c(), F.mutate(g);
943
+ [N]
944
+ ), K = f(
945
+ (m) => {
946
+ (o === m || n === m) && l(), b.mutate(m);
945
947
  },
946
- [c, n, F, o]
947
- ), O = h?.id;
948
- b(() => {
949
- O && O !== n && s(O);
950
- }, [O, o, n]);
951
- const U = f(() => {
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
- (g) => {
955
- l.aiEnabled.get() && (c(), i(g), C());
956
+ (m) => {
957
+ c.aiEnabled && (l(), i(m), C());
956
958
  },
957
- [C, c, l.aiEnabled]
959
+ [C, l, c.aiEnabled]
958
960
  ), J = w(
959
961
  () => ({
960
962
  chatId: n,
961
- model: y,
962
- availableModels: P,
963
- selectedModelId: K,
964
- selectModel: m,
965
- onSettingsOpen: u.onSettingsOpen,
966
- title: h?.title ?? Ke.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: B,
970
- createNewChat: c,
971
+ removeChat: K,
972
+ createNewChat: l,
971
973
  openAiChatWithPresetInput: Q,
972
974
  pendingComposerPreset: a,
973
- clearPendingComposerPreset: U
975
+ clearPendingComposerPreset: q
974
976
  }),
975
977
  [
976
978
  n,
977
- P,
978
- h?.title,
979
- y,
979
+ x,
980
+ d?.title,
981
+ g,
980
982
  I,
981
983
  p,
982
- B,
983
- c,
984
+ K,
985
+ l,
984
986
  Q,
985
987
  a,
986
- U,
987
- K,
988
- m,
989
- u.onSettingsOpen
988
+ q,
989
+ j,
990
+ B,
991
+ h.onSettingsOpen
990
992
  ]
991
993
  );
992
- return /* @__PURE__ */ te(qe.Provider, { value: J, children: /* @__PURE__ */ te(
993
- Zt,
994
+ return /* @__PURE__ */ te(Je.Provider, { value: J, children: /* @__PURE__ */ te(
995
+ an,
994
996
  {
995
997
  chatId: n,
996
- model: y,
997
- initialMessages: h?.messages,
998
- onChatFinish: W,
999
- onChatMessagesUpdated: Y,
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
- An as AiChatProvider
1007
+ _n as AiChatProvider
1006
1008
  };