@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.
Files changed (82) hide show
  1. package/dist/replay-AiChatProvider-BWL86hXh.js +6 -0
  2. package/dist/{replay-AiChatProvider-BZUzXfD-.js → replay-AiChatProvider-CY3b_ggu.js} +376 -376
  3. package/dist/{replay-AiChatSqliteDBStorage-CTVtufnx.js → replay-AiChatSqliteDBStorage-BtV53vvj.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-JpKE0iGm.js → replay-AiChatSqliteDBStorage-CjzLqUwK.js} +6 -6
  5. package/dist/{replay-AiPanel-DkR-vZTK.js → replay-AiPanel-B3HBaMPh.js} +706 -709
  6. package/dist/replay-AiPanel-BzaoPsXZ.js +742 -0
  7. package/dist/replay-FileWatcher-BFtAqsmL.js +1 -0
  8. package/dist/replay-FileWatcher-d1_qKRfS.js +364 -0
  9. package/dist/{replay-HistorySqliteDBStorage-CtF6-vY8.js → replay-HistorySqliteDBStorage-Bi5vBQ2T.js} +2 -2
  10. package/dist/replay-SemanticSearchService-CTWesmRy.js +1 -0
  11. package/dist/{replay-SemanticSearchService-CSsOmkV_.js → replay-SemanticSearchService-DcR4Q6w6.js} +27 -31
  12. package/dist/{replay-SqliteDBStorage-DpAEbsAQ.js → replay-SqliteDBStorage-BeDAsnlF.js} +1 -1
  13. package/dist/{replay-SqliteDBStorage-BSMAgfUS.js → replay-SqliteDBStorage-BlVDbZhU.js} +49 -49
  14. package/dist/{replay-StepContextSqliteDBStorage-BfAAKDwA.js → replay-StepContextSqliteDBStorage-BkB2NM27.js} +2 -2
  15. package/dist/replay-TauriFileSystemAdapter-B_VaAUfL.js +1 -0
  16. package/dist/replay-TauriFileSystemAdapter-Cu-Q6QS_.js +108 -0
  17. package/dist/replay-TauriRootStorage-Cidjagk-.js +1 -0
  18. package/dist/{replay-TauriRootStorage-g9zf2-FS.js → replay-TauriRootStorage-DVeU3RvV.js} +213 -210
  19. package/dist/{replay-agent-loop-be2meQsN.js → replay-agent-loop-B42P9R-q.js} +1 -1
  20. package/dist/{replay-agent-loop-ClVUvt0C.js → replay-agent-loop-DweKWrQp.js} +5 -5
  21. package/dist/{replay-ai-chat-mappers-JOZvaHV_.js → replay-ai-chat-mappers-Cno0s3T8.js} +1 -1
  22. package/dist/{replay-ai-chat-mappers-CwvRub6i.js → replay-ai-chat-mappers-DusPRQPG.js} +3 -3
  23. package/dist/{replay-ai-message-parts.schema-E9u9-nqr.js → replay-ai-message-parts.schema-DKLf0SiG.js} +1 -1
  24. package/dist/{replay-create-model-rzGPB8KT.js → replay-create-model-CeSlm24x.js} +4 -4
  25. package/dist/{replay-create-model-CJ3dsZg8.js → replay-create-model-DdPq1CIm.js} +3 -3
  26. package/dist/{replay-db-CW7044b2.js → replay-db-Bj8Qpvpw.js} +1 -1
  27. package/dist/{replay-db-zC1KPTH0.js → replay-db-he8XQjrM.js} +1 -1
  28. package/dist/{replay-external-resolver-BDPRz7Xd.js → replay-external-resolver-BRs5F07f.js} +7 -7
  29. package/dist/{replay-external-resolver-Dty0CDYE.js → replay-external-resolver-gQ0egbx7.js} +1 -1
  30. package/dist/{replay-history.schema-5ce6X0R1.js → replay-history.schema-B0lLwmdG.js} +3 -3
  31. package/dist/replay-index-B1qPs-GR.js +4 -0
  32. package/dist/replay-index-C2b91LJZ.js +7013 -0
  33. package/dist/{replay-index--hMZLQs8.js → replay-index-CA6OI1Qg.js} +1 -1
  34. package/dist/replay-index-CYphcClc.js +1 -0
  35. package/dist/{replay-index-F4GEOEUz.js → replay-index-DRb3mixV.js} +65311 -63618
  36. package/dist/replay-index-Dtxwps1s.js +574 -0
  37. package/dist/replay-index-NgGicGfR.js +1 -0
  38. package/dist/{replay-index-DZN7KzbY.js → replay-index-uF3nFq_Y.js} +1 -1
  39. package/dist/{replay-indexes-CfsvVMi_.js → replay-indexes-B3PJtgeh.js} +43 -43
  40. package/dist/replay-lint-C2hyYWRS.js +177 -0
  41. package/dist/{replay-lint-9YeYgRBU.js → replay-lint-gY_wyYPJ.js} +17581 -21140
  42. package/dist/{replay-lint-graphql-Dba0twW-.js → replay-lint-graphql-BA9t8-Ua.js} +1 -1
  43. package/dist/{replay-lint-graphql-BelJUl9-.js → replay-lint-graphql-DDrnrINc.js} +1 -1
  44. package/dist/replay-periodic-revalidation-BbAt74oL.js +21 -0
  45. package/dist/replay-periodic-revalidation-kmD2RQn1.js +1 -0
  46. package/dist/replay-resolve-BJ_AY-Mn.js +47 -0
  47. package/dist/{replay-resolve-RxCCaHXw.js → replay-resolve-_V8uYdTK.js} +470 -468
  48. package/dist/replay-respect-run-CLLZoRh1.js +8392 -0
  49. package/dist/replay-respect-run-qOz91QPQ.js +82 -0
  50. package/dist/replay-step-context.schema-BOprzd6Z.js +21 -0
  51. package/dist/{replay-tauri-path-hGM_JYax.js → replay-tauri-path-lH8t5rdX.js} +1 -1
  52. package/dist/replay-tauri-path-twTA2lKs.js +22 -0
  53. package/dist/replay-useAiChatQueries-BIqM2KQW.js +215 -0
  54. package/dist/{replay-useAiChatQueries-DD84oZan.js → replay-useAiChatQueries-yCsYY1j2.js} +1583 -1371
  55. package/dist/{replay-validate-key-xk-9xmJ6.js → replay-validate-key-Bh41yY9h.js} +2 -2
  56. package/dist/{replay-validate-key-PS5qrafQ.js → replay-validate-key-_oaOw5Jy.js} +1 -1
  57. package/dist/replay.cjs +1 -1
  58. package/dist/replay.d.ts +10 -3
  59. package/dist/replay.js +14 -14
  60. package/package.json +20 -13
  61. package/dist/replay-AiChatProvider-Dllh11wo.js +0 -6
  62. package/dist/replay-AiPanel-DruBN19L.js +0 -742
  63. package/dist/replay-FileWatcher-D3W6TGFC.js +0 -1
  64. package/dist/replay-FileWatcher-v7Qw29PS.js +0 -343
  65. package/dist/replay-SemanticSearchService-Dfx2W4Za.js +0 -1
  66. package/dist/replay-TauriFileSystemAdapter-BLPH1Vx3.js +0 -1
  67. package/dist/replay-TauriFileSystemAdapter-Ddq9xfo1.js +0 -99
  68. package/dist/replay-TauriRootStorage-l_sNXRNW.js +0 -1
  69. package/dist/replay-index-5UkXwLrd.js +0 -504
  70. package/dist/replay-index-9h4E2FR8.js +0 -1
  71. package/dist/replay-index-B7GU_aMu.js +0 -25
  72. package/dist/replay-index-DbWKCsKW.js +0 -6906
  73. package/dist/replay-index-ko78Z8QX.js +0 -1
  74. package/dist/replay-lint-DK6LCpO2.js +0 -184
  75. package/dist/replay-periodic-revalidation-BoyLQHtg.js +0 -1
  76. package/dist/replay-periodic-revalidation-Dsp-n7ui.js +0 -21
  77. package/dist/replay-resolve-CRBvIGPM.js +0 -47
  78. package/dist/replay-respect-run-BP5Q5L8N.js +0 -78
  79. package/dist/replay-respect-run-CRGPD-UQ.js +0 -8200
  80. package/dist/replay-step-context.schema-DBk4jufr.js +0 -21
  81. package/dist/replay-tauri-path-BmHpvlYp.js +0 -22
  82. 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 R, useCallback as f, useSyncExternalStore as re, useEffect as b, useMemo as w, useState as z } from "react";
3
- import { f as S, A as ce, g as Re, I as xe, T as $e, h as x, j as Pe, k as De, u as Te, m as We, o as Be, p as Oe, q as Ue, s as Ae, v as se, w as ue, x as ye, z as Fe, B as Le, C as Se, D as ge, E as je, F as ne, G as Ne, H as ae, J as Ke, K as qe } from "./replay-index-F4GEOEUz.js";
4
- import { A as Qe, D as Ve, l as Ge } from "./replay-create-model-rzGPB8KT.js";
5
- import { AgentLoop as He } from "./replay-agent-loop-ClVUvt0C.js";
6
- import { s as ze } from "./replay-db-zC1KPTH0.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-DD84oZan.js";
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 { b as be, g as me } from "./replay-ai-chat-mappers-CwvRub6i.js";
10
- class ft {
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 = 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,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(), l = i - o, u = n - l;
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 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
+ }, 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) => (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
+ }, _ = (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 v, Z, ee, V, G, H, j, ie, le, Tt = class {
152
+ var C, Z, ee, V, G, H, F, ie, le, Et = 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, 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, v, d(this, v).slice(0, -1)), d(this, j).call(this);
157
+ _(this, C, c(this, C).slice(0, -1)), c(this, F).call(this);
158
158
  }, this.replaceMessage = (t, n) => {
159
- _(this, v, [
160
- ...d(this, v).slice(0, t),
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
- ...d(this, v).slice(t + 1)
164
- ]), d(this, j).call(this);
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 ? It(t, n) : t;
167
- return d(this, V).add(s), () => {
168
- d(this, V).delete(s);
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) => (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) => (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 d(this, Z);
183
+ return c(this, Z);
184
184
  }
185
185
  set status(e) {
186
- _(this, Z, e), d(this, ie).call(this);
186
+ _(this, Z, e), c(this, ie).call(this);
187
187
  }
188
188
  get error() {
189
- return d(this, ee);
189
+ return c(this, ee);
190
190
  }
191
191
  set error(e) {
192
- _(this, ee, e), d(this, le).call(this);
192
+ _(this, ee, e), c(this, le).call(this);
193
193
  }
194
194
  get messages() {
195
- return d(this, v);
195
+ return c(this, C);
196
196
  }
197
197
  set messages(e) {
198
- _(this, v, [...e]), d(this, j).call(this);
198
+ _(this, C, [...e]), c(this, F).call(this);
199
199
  }
200
200
  };
201
- v = /* @__PURE__ */ new WeakMap();
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
- 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 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
- 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,36 +237,36 @@ 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
+ ), 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
- ), C = re(
277
+ ), v = re(
278
278
  r.current["~registerErrorCallback"],
279
279
  () => r.current.error,
280
280
  () => r.current.error
281
- ), I = f(
282
- (c) => {
283
- typeof c == "function" && (c = c(r.current.messages)), r.current.messages = c;
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 b(() => {
287
+ return R(() => {
288
288
  t && r.current.resumeStream();
289
289
  }, [t, r]), {
290
290
  id: r.current.id,
291
- messages: l,
292
- setMessages: I,
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: C,
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 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: h } = t.data;
486
484
  return {
487
485
  ...o,
488
- label: l ?? `${a} run`,
486
+ label: h ?? `${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
- return w(() => {
533
- if (!o)
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 (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,12 +588,12 @@ 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
- return w(
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 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(), h = Ve(), u = W(n);
606
+ return u.current = n, { tools: I(() => {
607
+ const w = 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(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
- [nt.name]: { store: r },
621
- [tt.name]: { model: e },
622
- [et.name]: { store: r },
623
- [Ze.name]: { store: r, context: s },
624
- [Xe.name]: {
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
- [Je.name]: { store: r }
628
- }), I.getToolSet();
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
- l,
637
+ h,
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: 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: c.current,
651
- tools: I.current,
652
- sendEvent: C,
653
- parentCtx: M,
654
- getActiveStateMessage: () => Ot(Gt(y.current))
652
+ model: l.current,
653
+ tools: w.current,
654
+ sendEvent: v,
655
+ parentCtx: E,
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, 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: q,
671
- status: W,
672
+ sendMessage: N,
673
+ status: b,
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 = 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 T = await l?.();
694
- T?.baseUrl && T?.accessToken && m.setModel({
695
+ const A = await h?.();
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: E });
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, 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 = w(
722
+ ), Me = I(
721
723
  () => ({
722
724
  messages: k,
723
- isStreaming: U,
724
- chatStatus: W,
725
+ isStreaming: y,
726
+ chatStatus: b,
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,
736
+ y,
735
737
  k,
736
- g,
737
- W,
738
- L,
739
- pe
738
+ J,
739
+ b,
740
+ m,
741
+ U
740
742
  ]
741
- ), _e = w(
743
+ ), Ee = I(
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: Me, children: /* @__PURE__ */ te(ze.Provider, { value: Ee, 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,8 +819,8 @@ function on({ chatId: e, model: t }) {
817
819
  [t, e, n]
818
820
  );
819
821
  }
820
- function an(e) {
821
- return w(() => {
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 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, 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 l = a instanceof Function ? a(i) : a;
863
- return ln(e, l), l;
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 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
- );
876
- return b(() => {
877
- t.find((l) => l.id === o) || r(ae.id);
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
- }, l = t.find((C) => C.id === o);
884
- if (!l || l.provider === ne)
885
- 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
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
- }, [o, t, n, s]), selectedModelId: o, selectModel: r };
892
+ }, [a, t, n, s]), selectedModelId: a, selectModel: r };
893
893
  }
894
- function hn() {
894
+ function Cn() {
895
895
  const [e, t] = z({
896
896
  baseUrl: "",
897
897
  accessToken: ""
898
898
  }), { getReuniteAuth: n } = se();
899
- return b(() => {
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 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,
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
- }), F = mt(), k = rn({ chatId: n, model: y }), D = on({ chatId: n, model: y }), q = sn({
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: y,
931
- existingTitle: h?.title
932
- }), W = f(
933
- (g, L) => {
934
- L.isAbort || (k(g, L), q(g, L));
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
- [k, q]
937
- ), Y = f(
938
- (...g) => {
939
- D(...g);
936
+ [D, b]
937
+ ), O = f(
938
+ (...m) => {
939
+ N(...m);
940
940
  },
941
- [D]
942
- ), B = f(
943
- (g) => {
944
- (o === g || n === g) && c(), F.mutate(g);
941
+ [N]
942
+ ), K = f(
943
+ (m) => {
944
+ (o === m || n === m) && l(), k.mutate(m);
945
945
  },
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(() => {
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
- (g) => {
955
- l.aiEnabled.get() && (c(), i(g), C());
954
+ (m) => {
955
+ h.aiEnabled && (l(), i(m), v());
956
956
  },
957
- [C, c, l.aiEnabled]
958
- ), J = w(
957
+ [v, l, h.aiEnabled]
958
+ ), J = I(
959
959
  () => ({
960
960
  chatId: n,
961
- model: y,
962
- availableModels: P,
963
- selectedModelId: K,
964
- selectModel: m,
961
+ model: g,
962
+ availableModels: x,
963
+ selectedModelId: j,
964
+ selectModel: B,
965
965
  onSettingsOpen: u.onSettingsOpen,
966
- title: h?.title ?? Ke.title,
967
- isLoading: I,
966
+ title: d?.title ?? Ye.title,
967
+ isLoading: w,
968
968
  selectChat: p,
969
- removeChat: B,
970
- createNewChat: c,
969
+ removeChat: K,
970
+ createNewChat: l,
971
971
  openAiChatWithPresetInput: Q,
972
972
  pendingComposerPreset: a,
973
- clearPendingComposerPreset: U
973
+ clearPendingComposerPreset: q
974
974
  }),
975
975
  [
976
976
  n,
977
- P,
978
- h?.title,
979
- y,
980
- I,
977
+ x,
978
+ d?.title,
979
+ g,
980
+ w,
981
981
  p,
982
- B,
983
- c,
982
+ K,
983
+ l,
984
984
  Q,
985
985
  a,
986
- U,
987
- K,
988
- m,
986
+ q,
987
+ j,
988
+ B,
989
989
  u.onSettingsOpen
990
990
  ]
991
991
  );
992
- return /* @__PURE__ */ te(qe.Provider, { value: J, children: /* @__PURE__ */ te(
993
- Zt,
992
+ return /* @__PURE__ */ te(Je.Provider, { value: J, children: /* @__PURE__ */ te(
993
+ an,
994
994
  {
995
995
  chatId: n,
996
- model: y,
997
- initialMessages: h?.messages,
998
- onChatFinish: W,
999
- onChatMessagesUpdated: Y,
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
- An as AiChatProvider
1005
+ _n as AiChatProvider
1006
1006
  };