@redocly/replay 0.27.0-next.5 → 0.27.0-next.6

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