@redocly/replay 0.28.0-next.9 → 0.29.0-next.0

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 (62) hide show
  1. package/dist/replay-AiChatProvider-DUQ2hsZo.js +6 -0
  2. package/dist/{replay-AiChatProvider-DuTK5g1N.js → replay-AiChatProvider-DWj4kzZG.js} +182 -180
  3. package/dist/{replay-AiChatSqliteDBStorage-CHfMo6M6.js → replay-AiChatSqliteDBStorage-AwkpaRF3.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-cXsRIQfJ.js → replay-AiChatSqliteDBStorage-C-QR82Oo.js} +1 -1
  5. package/dist/{replay-AiPanel-CGbGwIMX.js → replay-AiPanel-DkUjsiBN.js} +50 -50
  6. package/dist/{replay-AiPanel-C_C52r20.js → replay-AiPanel-jffKz76q.js} +2 -2
  7. package/dist/replay-FileWatcher-BuLGLLQr.js +1 -0
  8. package/dist/replay-FileWatcher-DUvCC-PY.js +365 -0
  9. package/dist/{replay-SemanticSearchService-BLF1oOOu.js → replay-SemanticSearchService-CHkdWIcG.js} +15 -15
  10. package/dist/{replay-SemanticSearchService-DTc0oxN4.js → replay-SemanticSearchService-VF6AneJg.js} +1 -1
  11. package/dist/{replay-SqliteDBStorage-B_kyJ0a3.js → replay-SqliteDBStorage-CSYBSOEO.js} +1 -1
  12. package/dist/{replay-SqliteDBStorage-DF9kKplR.js → replay-SqliteDBStorage-EbVgsvZY.js} +1 -1
  13. package/dist/replay-TauriFileSystemAdapter-C2Vhu3Ay.js +108 -0
  14. package/dist/replay-TauriFileSystemAdapter-ZLQv2Jpa.js +1 -0
  15. package/dist/{replay-TauriRootStorage-Den8gI4S.js → replay-TauriRootStorage-Bqoz3cld.js} +192 -188
  16. package/dist/replay-TauriRootStorage-D8DYLi8t.js +1 -0
  17. package/dist/{replay-agent-loop-Z_nrrmg_.js → replay-agent-loop-Bm9BCm02.js} +1 -1
  18. package/dist/{replay-agent-loop-B8Mjb8DU.js → replay-agent-loop-De5Qyhy9.js} +3 -3
  19. package/dist/{replay-ai-chat-mappers-D7e8buTk.js → replay-ai-chat-mappers-lYbHE7LU.js} +1 -1
  20. package/dist/{replay-ai-chat-mappers-aJ_VMb6Z.js → replay-ai-chat-mappers-y3wFVHQe.js} +1 -1
  21. package/dist/{replay-create-model-Be3vPVDb.js → replay-create-model-BR_hDMYz.js} +4 -4
  22. package/dist/{replay-create-model-Bw20x80b.js → replay-create-model-DeyX2a2A.js} +3 -3
  23. package/dist/{replay-db-BQXljNM0.js → replay-db-8Yfdu1EO.js} +1 -1
  24. package/dist/{replay-db-BmZNrdZM.js → replay-db-CmLId87t.js} +1 -1
  25. package/dist/{replay-external-resolver-BQvSDNfH.js → replay-external-resolver-BL-garqK.js} +2 -2
  26. package/dist/{replay-external-resolver-BLzbbtnT.js → replay-external-resolver-CkqL8AKf.js} +1 -1
  27. package/dist/replay-index-49ub7kjO.js +4 -0
  28. package/dist/{replay-index-C7y4K4Cr.js → replay-index-B2_OwIzz.js} +1 -1
  29. package/dist/{replay-index-C0kvTxxm.js → replay-index-BAD7NmvH.js} +41 -41
  30. package/dist/{replay-index-BCz452N6.js → replay-index-BDcjQnps.js} +22286 -21701
  31. package/dist/{replay-index-DAIwC3ls.js → replay-index-BfiTbks9.js} +1 -1
  32. package/dist/{replay-index-B-uZhXHj.js → replay-index-CDhdpEsv.js} +1 -1
  33. package/dist/{replay-index-DYtXcqDk.js → replay-index-DTg-X2sJ.js} +1150 -1149
  34. package/dist/{replay-index-wBHsAQEV.js → replay-index-DorMJxDL.js} +1 -1
  35. package/dist/{replay-lint-CqDMOMQt.js → replay-lint-BTpTdc1d.js} +6100 -6063
  36. package/dist/{replay-lint-BzkTeXqI.js → replay-lint-DvPtwqB_.js} +97 -97
  37. package/dist/{replay-lint-graphql-BDBGJSir.js → replay-lint-graphql-B9_N8uLm.js} +1 -1
  38. package/dist/{replay-lint-graphql-BZF2eLiZ.js → replay-lint-graphql-BE8DlHWF.js} +1 -1
  39. package/dist/{replay-periodic-revalidation-C7SkB1vs.js → replay-periodic-revalidation-Dk5I6zpL.js} +1 -1
  40. package/dist/{replay-periodic-revalidation-orCv_JoF.js → replay-periodic-revalidation-QN1Nzs5P.js} +1 -1
  41. package/dist/{replay-resolve-0e5f8I7b.js → replay-resolve-Bu8MUbb4.js} +1 -1
  42. package/dist/{replay-resolve-DZMWoig2.js → replay-resolve-CiT66v_T.js} +1 -1
  43. package/dist/{replay-respect-run-ChP63WzG.js → replay-respect-run-_H2BVClG.js} +1 -1
  44. package/dist/{replay-respect-run-CLW3wGhx.js → replay-respect-run-vyQ9167I.js} +3 -3
  45. package/dist/{replay-tauri-path-DBt1dqkG.js → replay-tauri-path-C2_c3UUW.js} +1 -1
  46. package/dist/{replay-tauri-path-DvLF4Z8f.js → replay-tauri-path-nSR1IXTa.js} +2 -2
  47. package/dist/{replay-useAiChatQueries-S6v5duiJ.js → replay-useAiChatQueries-Di7srepQ.js} +994 -945
  48. package/dist/replay-useAiChatQueries-Z3RHPc9x.js +215 -0
  49. package/dist/{replay-validate-key-CMJODIH6.js → replay-validate-key-DCjaZPTw.js} +2 -2
  50. package/dist/{replay-validate-key-CNl7BV_v.js → replay-validate-key-DTrKCzzp.js} +1 -1
  51. package/dist/replay.cjs +1 -1
  52. package/dist/replay.d.ts +5 -0
  53. package/dist/replay.js +8 -8
  54. package/package.json +5 -5
  55. package/dist/replay-AiChatProvider-B_f9Wn8a.js +0 -6
  56. package/dist/replay-FileWatcher-DEOB0_DG.js +0 -1
  57. package/dist/replay-FileWatcher-Z6eygcBI.js +0 -359
  58. package/dist/replay-TauriFileSystemAdapter-CwSMakdJ.js +0 -1
  59. package/dist/replay-TauriFileSystemAdapter-DcFBYSUW.js +0 -99
  60. package/dist/replay-TauriRootStorage-DEGEIJrz.js +0 -1
  61. package/dist/replay-index-gM6vL6iT.js +0 -4
  62. package/dist/replay-useAiChatQueries-Bypgnkwa.js +0 -215
@@ -1,12 +1,12 @@
1
1
  import { jsx as te } from "react/jsx-runtime";
2
- import { useRef as W, useCallback as f, useSyncExternalStore as re, useEffect as k, useMemo as w, useState as z } from "react";
3
- import { Z as S, _ as ce, J as _e, $ as Re, a0 as $e, a1 as $, a2 as Pe, a3 as xe, c as De, a4 as We, a5 as Be, a as Oe, a6 as Ue, a7 as Fe, a8 as Le, a9 as je, aa as fe, ab as Ne, ac as Ke, ad as qe, ae as Ae, af as se, ag as ue, ah as Te, ai as Qe, aj as Ve, ak as Ge, al as ye, y as ge, z as He, R as ne, am as ze, an as ae, ao as Ye, ap as Je } from "./replay-index-BCz452N6.js";
4
- import { A as Ze, D as Xe, l as et } from "./replay-create-model-Be3vPVDb.js";
5
- import { AgentLoop as tt } from "./replay-agent-loop-B8Mjb8DU.js";
6
- import { s as nt } from "./replay-db-BmZNrdZM.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-S6v5duiJ.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-BDcjQnps.js";
4
+ import { A as Xe, D as Ze, l as et } from "./replay-create-model-BR_hDMYz.js";
5
+ import { AgentLoop as tt } from "./replay-agent-loop-De5Qyhy9.js";
6
+ import { s as nt } from "./replay-db-CmLId87t.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-Di7srepQ.js";
8
8
  import { useQueryClient as de, useMutation as he } from "@tanstack/react-query";
9
- import { d as Se, g as me } from "./replay-ai-chat-mappers-D7e8buTk.js";
9
+ import { d as Se, g as me } from "./replay-ai-chat-mappers-lYbHE7LU.js";
10
10
  class At {
11
11
  handlers = /* @__PURE__ */ new Map();
12
12
  middlewares;
@@ -39,9 +39,9 @@ class At {
39
39
  try {
40
40
  const a = s(o, r);
41
41
  return typeof a == "object" && a !== null && "then" in a ? a.then(
42
- (i) => i,
43
- (i) => n(
44
- i instanceof Error ? i.message : "Unknown tool execution error"
42
+ (l) => l,
43
+ (l) => n(
44
+ l instanceof Error ? l.message : "Unknown tool execution error"
45
45
  )
46
46
  ) : a;
47
47
  } catch (a) {
@@ -128,10 +128,10 @@ function St() {
128
128
  let s, o = 0;
129
129
  return function(...a) {
130
130
  clearTimeout(s);
131
- const i = Date.now(), c = i - o, h = n - c;
132
- h <= 0 ? (o = i, t.apply(this, a)) : s = setTimeout(() => {
131
+ const l = Date.now(), h = l - o, u = n - h;
132
+ u <= 0 ? (o = l, t.apply(this, a)) : s = setTimeout(() => {
133
133
  o = Date.now(), t.apply(this, a);
134
- }, h);
134
+ }, u);
135
135
  };
136
136
  }
137
137
  return oe = e, oe;
@@ -141,65 +141,65 @@ const bt = /* @__PURE__ */ _e(kt);
141
141
  var be = (e, t, n) => {
142
142
  if (!t.has(e))
143
143
  throw TypeError("Cannot " + n);
144
- }, u = (e, t, n) => (be(e, t, "read from private field"), n ? n.call(e) : t.get(e)), T = (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
- }, R = (e, t, n, s) => (be(e, t, "write to private field"), t.set(e, n), n);
148
+ }, _ = (e, t, n, s) => (be(e, t, "write to private field"), t.set(e, n), n);
149
149
  function Mt(e, t) {
150
150
  return t != null ? bt(e, t) : e;
151
151
  }
152
- var v, X, ee, V, G, H, F, ie, le, Et = class {
152
+ var C, Z, ee, V, G, H, F, ie, le, Et = class {
153
153
  constructor(e = []) {
154
- T(this, v, void 0), T(this, X, "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);
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
- R(this, v, u(this, v).slice(0, -1)), u(this, F).call(this);
157
+ _(this, C, c(this, C).slice(0, -1)), c(this, F).call(this);
158
158
  }, this.replaceMessage = (t, n) => {
159
- R(this, v, [
160
- ...u(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
- ...u(this, v).slice(t + 1)
164
- ]), u(this, F).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
166
  const s = n ? Mt(t, n) : t;
167
- return u(this, V).add(s), () => {
168
- u(this, V).delete(s);
167
+ return c(this, V).add(s), () => {
168
+ c(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);
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
174
  }), T(this, F, () => {
175
- u(this, V).forEach((t) => t());
175
+ c(this, V).forEach((t) => t());
176
176
  }), T(this, ie, () => {
177
- u(this, G).forEach((t) => t());
177
+ c(this, G).forEach((t) => t());
178
178
  }), T(this, le, () => {
179
- u(this, H).forEach((t) => t());
180
- }), R(this, v, e);
179
+ c(this, H).forEach((t) => t());
180
+ }), _(this, C, e);
181
181
  }
182
182
  get status() {
183
- return u(this, X);
183
+ return c(this, Z);
184
184
  }
185
185
  set status(e) {
186
- R(this, X, e), u(this, ie).call(this);
186
+ _(this, Z, e), c(this, ie).call(this);
187
187
  }
188
188
  get error() {
189
- return u(this, ee);
189
+ return c(this, ee);
190
190
  }
191
191
  set error(e) {
192
- R(this, ee, e), u(this, le).call(this);
192
+ _(this, ee, e), c(this, le).call(this);
193
193
  }
194
194
  get messages() {
195
- return u(this, v);
195
+ return c(this, C);
196
196
  }
197
197
  set messages(e) {
198
- R(this, v, [...e]), u(this, F).call(this);
198
+ _(this, C, [...e]), c(this, F).call(this);
199
199
  }
200
200
  };
201
- v = /* @__PURE__ */ new WeakMap();
202
- X = /* @__PURE__ */ new WeakMap();
201
+ C = /* @__PURE__ */ new WeakMap();
202
+ Z = /* @__PURE__ */ new WeakMap();
203
203
  ee = /* @__PURE__ */ new WeakMap();
204
204
  V = /* @__PURE__ */ new WeakMap();
205
205
  G = /* @__PURE__ */ new WeakMap();
@@ -207,10 +207,10 @@ H = /* @__PURE__ */ new WeakMap();
207
207
  F = /* @__PURE__ */ new WeakMap();
208
208
  ie = /* @__PURE__ */ new WeakMap();
209
209
  le = /* @__PURE__ */ new WeakMap();
210
- var L, we = class extends Ze {
210
+ var L, we = class extends Xe {
211
211
  constructor({ messages: e, ...t }) {
212
212
  const n = new Et(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);
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
216
  L = /* @__PURE__ */ new WeakMap();
@@ -237,66 +237,66 @@ function _t({
237
237
  });
238
238
  const o = {
239
239
  ...n,
240
- onToolCall: (l) => {
240
+ onToolCall: (i) => {
241
241
  var p, d;
242
- return (d = (p = s.current).onToolCall) == null ? void 0 : d.call(p, l);
242
+ return (d = (p = s.current).onToolCall) == null ? void 0 : d.call(p, i);
243
243
  },
244
- onData: (l) => {
244
+ onData: (i) => {
245
245
  var p, d;
246
- return (d = (p = s.current).onData) == null ? void 0 : d.call(p, l);
246
+ return (d = (p = s.current).onData) == null ? void 0 : d.call(p, i);
247
247
  },
248
- onFinish: (l) => {
248
+ onFinish: (i) => {
249
249
  var p, d;
250
- return (d = (p = s.current).onFinish) == null ? void 0 : d.call(p, l);
250
+ return (d = (p = s.current).onFinish) == null ? void 0 : d.call(p, i);
251
251
  },
252
- onError: (l) => {
252
+ onError: (i) => {
253
253
  var p, d;
254
- return (d = (p = s.current).onError) == null ? void 0 : d.call(p, l);
254
+ return (d = (p = s.current).onError) == null ? void 0 : d.call(p, i);
255
255
  },
256
- sendAutomaticallyWhen: (l) => {
256
+ sendAutomaticallyWhen: (i) => {
257
257
  var p, d, P;
258
- return (P = (d = (p = s.current).sendAutomaticallyWhen) == null ? void 0 : d.call(p, l)) != null ? P : !1;
258
+ return (P = (d = (p = s.current).sendAutomaticallyWhen) == null ? void 0 : d.call(p, i)) != null ? P : !1;
259
259
  }
260
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
- const i = f(
265
- (l) => r.current["~registerMessagesCallback"](l, e),
264
+ const l = f(
265
+ (i) => r.current["~registerMessagesCallback"](i, 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
- ), c = re(
270
- i,
269
+ ), h = re(
270
+ l,
271
271
  () => r.current.messages,
272
272
  () => r.current.messages
273
- ), h = re(
273
+ ), u = re(
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
- (l) => {
283
- typeof l == "function" && (l = l(r.current.messages)), r.current.messages = l;
281
+ ), w = f(
282
+ (i) => {
283
+ typeof i == "function" && (i = i(r.current.messages)), r.current.messages = i;
284
284
  },
285
285
  [r]
286
286
  );
287
- return k(() => {
287
+ return R(() => {
288
288
  t && r.current.resumeStream();
289
289
  }, [t, r]), {
290
290
  id: r.current.id,
291
- messages: c,
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
- status: h,
299
+ status: u,
300
300
  /**
301
301
  * @deprecated Use `addToolOutput` instead.
302
302
  */
@@ -336,8 +336,8 @@ function Dt(e) {
336
336
  t.push(" (no workflows)");
337
337
  else if (n >= 2) {
338
338
  t.push(` workflows (${a.workflows.length}):`), n--;
339
- for (const i of a.workflows)
340
- n > 0 ? (t.push(` ${Bt(i)}`), n--) : s++;
339
+ for (const l of a.workflows)
340
+ n > 0 ? (t.push(` ${Bt(l)}`), n--) : s++;
341
341
  } else
342
342
  s += a.workflows.length;
343
343
  }
@@ -471,7 +471,7 @@ function Jt(e, t, n, s) {
471
471
  const { collectionId: r } = t.data;
472
472
  return {
473
473
  ...o,
474
- label: Zt(e, r) ?? r,
474
+ label: Xt(e, r) ?? r,
475
475
  collectionId: r
476
476
  };
477
477
  }
@@ -480,20 +480,20 @@ function Jt(e, t, n, s) {
480
480
  return { ...o, label: a, collectionId: r, workflowId: a };
481
481
  }
482
482
  case $.WorkflowRun: {
483
- const { collectionId: r, workflowId: a, historyId: i, label: c } = t.data;
483
+ const { collectionId: r, workflowId: a, historyId: l, label: h } = t.data;
484
484
  return {
485
485
  ...o,
486
- label: c ?? `${a} run`,
486
+ label: h ?? `${a} run`,
487
487
  collectionId: r,
488
488
  workflowId: a,
489
- isHistory: i != null
489
+ isHistory: l != null
490
490
  };
491
491
  }
492
492
  case $.Step: {
493
493
  const r = t.data;
494
494
  return {
495
495
  ...o,
496
- label: Xt(r),
496
+ label: Zt(r),
497
497
  collectionId: r.collectionId,
498
498
  workflowId: r.workflowId,
499
499
  stepId: r.stepId,
@@ -504,10 +504,10 @@ function Jt(e, t, n, s) {
504
504
  }
505
505
  }
506
506
  }
507
- function Zt(e, t) {
507
+ function Xt(e, t) {
508
508
  return e.find((n) => n.id === t)?.info.title;
509
509
  }
510
- function Xt(e) {
510
+ function Zt(e) {
511
511
  if (e.stepId)
512
512
  return e.stepId;
513
513
  if (e.draftStep) {
@@ -531,44 +531,48 @@ function en(e) {
531
531
  }
532
532
  function tn() {
533
533
  const e = Le(), { tab: t } = je(), n = t?.data ?? null;
534
- return w(() => {
534
+ return I(() => {
535
535
  if (!n)
536
536
  return null;
537
537
  switch (n.type) {
538
- case $.Collection:
538
+ case $.Collection: {
539
539
  const o = Ke(e, n.collectionId);
540
540
  return {
541
541
  ...n,
542
542
  collection: o
543
543
  };
544
- case $.Workflow:
545
- const r = fe(e, {
544
+ }
545
+ case $.Workflow: {
546
+ const o = fe(e, {
546
547
  collectionId: n.collectionId,
547
548
  workflowId: n.workflowId
548
549
  });
549
550
  return {
550
551
  ...n,
551
- workflow: r
552
+ workflow: o
552
553
  };
553
- case $.Step:
554
- const a = Ne(e, {
554
+ }
555
+ case $.Step: {
556
+ const o = Ne(e, {
555
557
  collectionId: n.collectionId,
556
558
  workflowId: n.workflowId,
557
559
  stepId: n.stepId
558
560
  });
559
561
  return {
560
562
  ...n,
561
- step: a
563
+ step: o
562
564
  };
563
- case $.WorkflowRun:
564
- const i = fe(e, {
565
+ }
566
+ case $.WorkflowRun: {
567
+ const o = fe(e, {
565
568
  collectionId: n.collectionId,
566
569
  workflowId: n.workflowId
567
570
  });
568
571
  return {
569
572
  ...n,
570
- workflow: i
573
+ workflow: o
571
574
  };
575
+ }
572
576
  }
573
577
  }, [n, e]);
574
578
  }
@@ -593,7 +597,7 @@ function sn() {
593
597
  }
594
598
  function rn() {
595
599
  const { getApiOperation: e } = qe(), t = Ae();
596
- return w(
600
+ return I(
597
601
  () => ({
598
602
  getApiOperation: e,
599
603
  ...t
@@ -602,21 +606,21 @@ function rn() {
602
606
  );
603
607
  }
604
608
  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({
609
+ const { convertOperationToReplayValue: t } = se(), n = tn(), s = rn(), o = ue(), r = Te(), { attachApiToCollection: a } = Qe(), { handleCloseByDataId: l } = Ae(), h = Ve(), u = W(n);
610
+ return u.current = n, { tools: I(() => {
611
+ const w = new At({
608
612
  middlewares: [sn()]
609
613
  });
610
- return st(I, {
614
+ return st(w, {
611
615
  [gt.name]: void 0,
612
616
  [ft.name]: { settings: o, store: r },
613
- [pt.name]: { store: r, runWorkflow: c },
617
+ [pt.name]: { store: r, runWorkflow: h },
614
618
  [ht.name]: { store: r },
615
619
  [dt.name]: { store: r },
616
620
  [ut.name]: {
617
621
  store: r,
618
622
  attachApiToCollection: a,
619
- handleCloseByDataId: i,
623
+ handleCloseByDataId: l,
620
624
  convertOperationToReplayValue: t
621
625
  },
622
626
  [ct.name]: { store: r },
@@ -624,53 +628,53 @@ function on(e) {
624
628
  [it.name]: { store: r },
625
629
  [at.name]: { store: r, context: s },
626
630
  [ot.name]: {
627
- getActiveTabDetailedData: () => h.current
631
+ getActiveTabDetailedData: () => u.current
628
632
  },
629
633
  [rt.name]: { store: r }
630
- }), I.getToolSet();
634
+ }), w.getToolSet();
631
635
  }, [
632
636
  a,
633
637
  t,
634
- i,
638
+ l,
635
639
  e,
636
640
  s,
637
- c,
641
+ h,
638
642
  o,
639
643
  r
640
644
  ]) };
641
645
  }
642
646
  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(() => {
647
+ const { children: t, chatId: n, model: s, initialMessages: o, onChatFinish: r, onChatMessagesUpdated: a } = e, l = ue(), { getReuniteAuth: h } = se(), { tools: u } = on(s), { sendEvent: v } = Ge(), w = W(u), i = W(s), { isOpen: p, openPanel: d, closePanel: P } = ye(), x = W(void 0), j = Te();
648
+ w.current = u, i.current = s;
649
+ const g = I(() => {
646
650
  x.current?.end();
647
- const E = ge.getTracer("replay-ai-chat").startSpan("ai.chat.session", { attributes: { conversation_id: n } });
648
- x.current = E;
649
- const _ = ge.setSpan(He.active(), E);
651
+ const M = ge.getTracer("replay-ai-chat").startSpan("ai.chat.session", { attributes: { conversation_id: n } });
652
+ x.current = M;
653
+ const E = ge.setSpan(He.active(), M);
650
654
  return new tt({
651
655
  activeConversationId: n,
652
- model: l.current,
653
- tools: I.current,
654
- sendEvent: C,
655
- parentCtx: _,
656
+ model: i.current,
657
+ tools: w.current,
658
+ sendEvent: v,
659
+ parentCtx: E,
656
660
  getActiveStateMessage: () => qt(en(j))
657
661
  });
658
- }, [n, C, j]);
659
- k(() => () => x.current?.end(), []);
660
- const B = w(() => {
662
+ }, [n, v, j]);
663
+ R(() => () => x.current?.end(), []);
664
+ const B = I(() => {
661
665
  if (g)
662
- return new Xe({ agent: g.getAgent() });
666
+ return new Ze({ agent: g.getAgent() });
663
667
  }, [g]);
664
- k(() => {
668
+ R(() => {
665
669
  g.setModel(s);
666
- }, [g, s]), k(() => {
667
- g.registerTools(h);
668
- }, [g, h]);
670
+ }, [g, s]), R(() => {
671
+ g.registerTools(u);
672
+ }, [g, u]);
669
673
  const {
670
- messages: b,
674
+ messages: k,
671
675
  setMessages: D,
672
676
  sendMessage: N,
673
- status: M,
677
+ status: b,
674
678
  error: Y,
675
679
  stop: O,
676
680
  addToolApprovalResponse: K
@@ -679,20 +683,20 @@ function an(e) {
679
683
  messages: o,
680
684
  transport: B,
681
685
  sendAutomaticallyWhen: et,
682
- onFinish(E) {
686
+ onFinish(M) {
683
687
  if (!r || !g) return;
684
- r({ agentLoop: g, chat: this }, E);
688
+ r({ agentLoop: g, chat: this }, M);
685
689
  }
686
- }), y = w(() => M === "streaming" || M === "submitted", [M]), q = f(() => {
687
- i.aiEnabled === !0 && d();
688
- }, [d, i.aiEnabled]), Q = f(() => {
690
+ }), y = I(() => b === "streaming" || b === "submitted", [b]), q = f(() => {
691
+ l.aiEnabled === !0 && d();
692
+ }, [d, l.aiEnabled]), Q = f(() => {
689
693
  P();
690
694
  }, [P]), J = f(
691
- async (E) => {
692
- const _ = E.trim();
693
- if (!(!_ || !B)) {
695
+ async (M) => {
696
+ const E = M.trim();
697
+ if (!(!E || !B)) {
694
698
  if (s.provider === ne) {
695
- const A = await c?.();
699
+ const A = await h?.();
696
700
  A?.baseUrl && A?.accessToken && g.setModel({
697
701
  provider: ne,
698
702
  baseUrl: A.baseUrl,
@@ -701,29 +705,29 @@ function an(e) {
701
705
  }
702
706
  D(
703
707
  (A) => mt(A) ? vt(A) : A
704
- ), N({ text: _ });
708
+ ), N({ text: E });
705
709
  }
706
710
  },
707
- [g, c, s.provider, N, D, B]
711
+ [g, h, s.provider, N, D, B]
708
712
  ), m = f(() => {
709
713
  y && O();
710
714
  }, [y, O]);
711
- k(() => () => {
715
+ R(() => () => {
712
716
  O();
713
717
  }, [n, O]);
714
718
  const U = f(
715
- (E) => {
716
- const _ = E(b), A = _.map((Z) => Z.message), pe = [...b];
717
- for (const Z of _)
718
- pe[Z.index] = Z.message;
719
+ (M) => {
720
+ const E = M(k), A = E.map((X) => X.message), pe = [...k];
721
+ for (const X of E)
722
+ pe[X.index] = X.message;
719
723
  D(pe), a?.(A);
720
724
  },
721
- [b, a, D]
722
- ), Me = w(
725
+ [k, a, D]
726
+ ), Me = I(
723
727
  () => ({
724
- messages: b,
728
+ messages: k,
725
729
  isStreaming: y,
726
- chatStatus: M,
730
+ chatStatus: b,
727
731
  chatError: Y,
728
732
  sendMessage: J,
729
733
  updateMessages: U,
@@ -734,13 +738,13 @@ function an(e) {
734
738
  K,
735
739
  Y,
736
740
  y,
737
- b,
741
+ k,
738
742
  J,
739
- M,
743
+ b,
740
744
  m,
741
745
  U
742
746
  ]
743
- ), Ee = w(
747
+ ), Ee = I(
744
748
  () => ({
745
749
  isOpen: p,
746
750
  openPanel: q,
@@ -820,7 +824,7 @@ function pn({ chatId: e, model: t }) {
820
824
  );
821
825
  }
822
826
  function fn(e) {
823
- return w(() => {
827
+ return I(() => {
824
828
  const t = [ae];
825
829
  if (e) {
826
830
  for (const [n, s] of Object.entries(e))
@@ -855,14 +859,14 @@ function gn(e, t) {
855
859
  }
856
860
  function mn(e, t) {
857
861
  const [n, s] = z(() => Ie(e, t)), o = W(t);
858
- o.current = t, k(() => {
862
+ o.current = t, R(() => {
859
863
  s(Ie(e, o.current));
860
864
  }, [e]);
861
865
  const r = f(
862
866
  (a) => {
863
- s((i) => {
864
- const c = a instanceof Function ? a(i) : a;
865
- return gn(e, c), c;
867
+ s((l) => {
868
+ const h = a instanceof Function ? a(l) : a;
869
+ return gn(e, h), h;
866
870
  });
867
871
  },
868
872
  [e]
@@ -874,31 +878,29 @@ function wn(e) {
874
878
  const { availableModels: t, aiProviders: n, reuniteAuth: s } = e, [o, r] = mn(
875
879
  vn,
876
880
  ae.id
877
- );
878
- return k(() => {
879
- t.find((c) => c.id === o) || r(ae.id);
880
- }, [t, o, r]), { model: w(() => {
881
- const i = {
881
+ ), a = t.some((h) => h.id === o) ? o : ae.id;
882
+ return { model: I(() => {
883
+ const h = {
882
884
  provider: ne,
883
885
  baseUrl: s.baseUrl,
884
886
  accessToken: s.accessToken
885
- }, c = t.find((C) => C.id === o);
886
- if (!c || c.provider === ne)
887
- return i;
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
887
+ }, u = t.find((w) => w.id === a);
888
+ if (!u || u.provider === ne)
889
+ return h;
890
+ const v = n?.[u.provider];
891
+ return !v || !v.apiKey || !v.enabled ? h : {
892
+ provider: u.provider,
893
+ modelId: u.id,
894
+ apiKey: v.apiKey
893
895
  };
894
- }, [o, t, n, s]), selectedModelId: o, selectModel: r };
896
+ }, [a, t, n, s]), selectedModelId: a, selectModel: r };
895
897
  }
896
898
  function Cn() {
897
899
  const [e, t] = z({
898
900
  baseUrl: "",
899
901
  accessToken: ""
900
902
  }), { getReuniteAuth: n } = se();
901
- return k(() => {
903
+ return R(() => {
902
904
  let s = !1;
903
905
  async function o() {
904
906
  const r = await n?.();
@@ -918,24 +920,24 @@ function Cn() {
918
920
  }, [n]), e;
919
921
  }
920
922
  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(() => {
923
+ const { children: t } = e, [n, s] = z(me), [o, r] = z(n), [a, l] = z(null), h = ue(), u = se(), { openPanel: v } = ye(), w = o !== n, i = f(() => {
922
924
  const m = me();
923
925
  r(m), s(m);
924
926
  }, []), p = f((m) => {
925
927
  r(m);
926
- }, []), { data: d } = It(o), P = Cn(), x = fn(h.aiProviders), { selectedModelId: j, model: g, selectModel: B } = wn({
928
+ }, []), { data: d } = It(o), P = Cn(), x = fn(u.aiProviders), { selectedModelId: j, model: g, selectModel: B } = wn({
927
929
  availableModels: x,
928
- aiProviders: h.aiProviders,
930
+ aiProviders: u.aiProviders,
929
931
  reuniteAuth: P
930
- }), b = yt(), D = hn({ chatId: n, model: g }), N = pn({ chatId: n, model: g }), M = dn({
932
+ }), k = yt(), D = hn({ chatId: n, model: g }), N = pn({ chatId: n, model: g }), b = dn({
931
933
  chatId: n,
932
934
  model: g,
933
935
  existingTitle: d?.title
934
936
  }), Y = f(
935
937
  (m, U) => {
936
- U.isAbort || (D(m, U), M(m, U));
938
+ U.isAbort || (D(m, U), b(m, U));
937
939
  },
938
- [D, M]
940
+ [D, b]
939
941
  ), O = f(
940
942
  (...m) => {
941
943
  N(...m);
@@ -943,33 +945,33 @@ function _n(e) {
943
945
  [N]
944
946
  ), K = f(
945
947
  (m) => {
946
- (o === m || n === m) && l(), b.mutate(m);
948
+ (o === m || n === m) && i(), k.mutate(m);
947
949
  },
948
- [l, n, b, o]
950
+ [i, n, k, o]
949
951
  ), y = d?.id;
950
- k(() => {
952
+ R(() => {
951
953
  y && y !== n && s(y);
952
954
  }, [y, o, n]);
953
955
  const q = f(() => {
954
- i(null);
956
+ l(null);
955
957
  }, []), Q = f(
956
958
  (m) => {
957
- c.aiEnabled && (l(), i(m), C());
959
+ h.aiEnabled && (i(), l(m), v());
958
960
  },
959
- [C, l, c.aiEnabled]
960
- ), J = w(
961
+ [v, i, h.aiEnabled]
962
+ ), J = I(
961
963
  () => ({
962
964
  chatId: n,
963
965
  model: g,
964
966
  availableModels: x,
965
967
  selectedModelId: j,
966
968
  selectModel: B,
967
- onSettingsOpen: h.onSettingsOpen,
969
+ onSettingsOpen: u.onSettingsOpen,
968
970
  title: d?.title ?? Ye.title,
969
- isLoading: I,
971
+ isLoading: w,
970
972
  selectChat: p,
971
973
  removeChat: K,
972
- createNewChat: l,
974
+ createNewChat: i,
973
975
  openAiChatWithPresetInput: Q,
974
976
  pendingComposerPreset: a,
975
977
  clearPendingComposerPreset: q
@@ -979,16 +981,16 @@ function _n(e) {
979
981
  x,
980
982
  d?.title,
981
983
  g,
982
- I,
984
+ w,
983
985
  p,
984
986
  K,
985
- l,
987
+ i,
986
988
  Q,
987
989
  a,
988
990
  q,
989
991
  j,
990
992
  B,
991
- h.onSettingsOpen
993
+ u.onSettingsOpen
992
994
  ]
993
995
  );
994
996
  return /* @__PURE__ */ te(Je.Provider, { value: J, children: /* @__PURE__ */ te(