@redocly/replay 0.28.0-next.9 → 0.28.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 (61) hide show
  1. package/dist/{replay-AiChatProvider-B_f9Wn8a.js → replay-AiChatProvider-BRqjyy2W.js} +2 -2
  2. package/dist/{replay-AiChatProvider-DuTK5g1N.js → replay-AiChatProvider-DUVoLgY2.js} +138 -140
  3. package/dist/{replay-AiChatSqliteDBStorage-cXsRIQfJ.js → replay-AiChatSqliteDBStorage-0evx56pl.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-CHfMo6M6.js → replay-AiChatSqliteDBStorage-C5AnRloD.js} +1 -1
  5. package/dist/{replay-AiPanel-CGbGwIMX.js → replay-AiPanel-CMjVD12K.js} +50 -50
  6. package/dist/{replay-AiPanel-C_C52r20.js → replay-AiPanel-PVgJioX3.js} +2 -2
  7. package/dist/replay-FileWatcher-CFYprlWN.js +364 -0
  8. package/dist/replay-FileWatcher-DGLwO5Kd.js +1 -0
  9. package/dist/{replay-SemanticSearchService-BLF1oOOu.js → replay-SemanticSearchService-Bh5xYa91.js} +15 -15
  10. package/dist/{replay-SemanticSearchService-DTc0oxN4.js → replay-SemanticSearchService-CulKCCNl.js} +1 -1
  11. package/dist/{replay-SqliteDBStorage-DF9kKplR.js → replay-SqliteDBStorage-Bz0muHEk.js} +1 -1
  12. package/dist/{replay-SqliteDBStorage-B_kyJ0a3.js → replay-SqliteDBStorage-CVHRAsPD.js} +1 -1
  13. package/dist/replay-TauriFileSystemAdapter-B163-f2D.js +108 -0
  14. package/dist/replay-TauriFileSystemAdapter-D4bOmvzP.js +1 -0
  15. package/dist/{replay-TauriRootStorage-Den8gI4S.js → replay-TauriRootStorage-2MPQE-3f.js} +192 -188
  16. package/dist/replay-TauriRootStorage-CjWUrnWz.js +1 -0
  17. package/dist/{replay-agent-loop-B8Mjb8DU.js → replay-agent-loop-BgYyBo9e.js} +3 -3
  18. package/dist/{replay-agent-loop-Z_nrrmg_.js → replay-agent-loop-DYDFXAZj.js} +1 -1
  19. package/dist/{replay-ai-chat-mappers-D7e8buTk.js → replay-ai-chat-mappers-BEwNRQPV.js} +1 -1
  20. package/dist/{replay-ai-chat-mappers-aJ_VMb6Z.js → replay-ai-chat-mappers-CMtNqQHX.js} +1 -1
  21. package/dist/{replay-create-model-Bw20x80b.js → replay-create-model-B2ZsGTjs.js} +3 -3
  22. package/dist/{replay-create-model-Be3vPVDb.js → replay-create-model-DPxfOEfv.js} +4 -4
  23. package/dist/{replay-db-BQXljNM0.js → replay-db-C9iqyMet.js} +1 -1
  24. package/dist/{replay-db-BmZNrdZM.js → replay-db-D4-LmLRk.js} +1 -1
  25. package/dist/{replay-external-resolver-BQvSDNfH.js → replay-external-resolver-BXgVrfzk.js} +2 -2
  26. package/dist/{replay-external-resolver-BLzbbtnT.js → replay-external-resolver-CTUbNZGW.js} +1 -1
  27. package/dist/{replay-index-BCz452N6.js → replay-index-4TEahAPK.js} +21604 -21055
  28. package/dist/{replay-index-C0kvTxxm.js → replay-index-B4U7iZuq.js} +41 -41
  29. package/dist/{replay-index-DAIwC3ls.js → replay-index-B8O3wYqo.js} +1 -1
  30. package/dist/{replay-index-C7y4K4Cr.js → replay-index-Bdg7noSD.js} +1 -1
  31. package/dist/replay-index-CG9VN2JQ.js +4 -0
  32. package/dist/{replay-index-B-uZhXHj.js → replay-index-DcC173cC.js} +1 -1
  33. package/dist/{replay-index-DYtXcqDk.js → replay-index-Nz5obVS5.js} +1131 -1131
  34. package/dist/{replay-index-wBHsAQEV.js → replay-index-q63USe25.js} +1 -1
  35. package/dist/{replay-lint-BzkTeXqI.js → replay-lint-4XFKTmSY.js} +97 -97
  36. package/dist/{replay-lint-graphql-BZF2eLiZ.js → replay-lint-graphql-BsBWkZ6L.js} +1 -1
  37. package/dist/{replay-lint-graphql-BDBGJSir.js → replay-lint-graphql-De2eDZnT.js} +1 -1
  38. package/dist/{replay-lint-CqDMOMQt.js → replay-lint-s7ylMBWz.js} +6100 -6063
  39. package/dist/{replay-periodic-revalidation-C7SkB1vs.js → replay-periodic-revalidation-BMFP7f-u.js} +1 -1
  40. package/dist/{replay-periodic-revalidation-orCv_JoF.js → replay-periodic-revalidation-DJbblUef.js} +1 -1
  41. package/dist/{replay-resolve-DZMWoig2.js → replay-resolve-BtNxNrKo.js} +1 -1
  42. package/dist/{replay-resolve-0e5f8I7b.js → replay-resolve-BueEsOnR.js} +1 -1
  43. package/dist/{replay-respect-run-ChP63WzG.js → replay-respect-run-B_dJjlti.js} +1 -1
  44. package/dist/{replay-respect-run-CLW3wGhx.js → replay-respect-run-Dfpbcsns.js} +3 -3
  45. package/dist/{replay-tauri-path-DBt1dqkG.js → replay-tauri-path-Bht3XIt7.js} +1 -1
  46. package/dist/{replay-tauri-path-DvLF4Z8f.js → replay-tauri-path-CiuYXh_j.js} +2 -2
  47. package/dist/replay-useAiChatQueries-02CRdEPJ.js +215 -0
  48. package/dist/{replay-useAiChatQueries-S6v5duiJ.js → replay-useAiChatQueries-D2hh5omV.js} +994 -945
  49. package/dist/{replay-validate-key-CNl7BV_v.js → replay-validate-key-ALwOF1Ux.js} +1 -1
  50. package/dist/{replay-validate-key-CMJODIH6.js → replay-validate-key-B7fbWbfv.js} +2 -2
  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-FileWatcher-DEOB0_DG.js +0 -1
  56. package/dist/replay-FileWatcher-Z6eygcBI.js +0 -359
  57. package/dist/replay-TauriFileSystemAdapter-CwSMakdJ.js +0 -1
  58. package/dist/replay-TauriFileSystemAdapter-DcFBYSUW.js +0 -99
  59. package/dist/replay-TauriRootStorage-DEGEIJrz.js +0 -1
  60. package/dist/replay-index-gM6vL6iT.js +0 -4
  61. 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-4TEahAPK.js";
4
+ import { A as Xe, D as Ze, l as et } from "./replay-create-model-DPxfOEfv.js";
5
+ import { AgentLoop as tt } from "./replay-agent-loop-BgYyBo9e.js";
6
+ import { s as nt } from "./replay-db-D4-LmLRk.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-D2hh5omV.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-BEwNRQPV.js";
10
10
  class At {
11
11
  handlers = /* @__PURE__ */ new Map();
12
12
  middlewares;
@@ -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 i = Date.now(), h = i - o, u = n - h;
132
+ u <= 0 ? (o = i, 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();
@@ -266,37 +266,37 @@ function _t({
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(
269
+ ), h = re(
270
270
  i,
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(
281
+ ), w = f(
282
282
  (l) => {
283
283
  typeof l == "function" && (l = l(r.current.messages)), r.current.messages = l;
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
  */
@@ -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,10 +480,10 @@ 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: i, 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
489
  isHistory: i != null
@@ -493,7 +493,7 @@ function Jt(e, t, n, s) {
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,7 +531,7 @@ 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) {
@@ -593,7 +593,7 @@ function sn() {
593
593
  }
594
594
  function rn() {
595
595
  const { getApiOperation: e } = qe(), t = Ae();
596
- return w(
596
+ return I(
597
597
  () => ({
598
598
  getApiOperation: e,
599
599
  ...t
@@ -602,15 +602,15 @@ function rn() {
602
602
  );
603
603
  }
604
604
  function on(e) {
605
- const { convertOperationToReplayValue: t } = se(), n = tn(), s = rn(), o = ue(), r = Te(), { attachApiToCollection: a } = Qe(), { handleCloseByDataId: i } = Ae(), c = Ve(), h = W(n);
606
- return h.current = n, { tools: w(() => {
607
- const I = new At({
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
608
  middlewares: [sn()]
609
609
  });
610
- return st(I, {
610
+ return st(w, {
611
611
  [gt.name]: void 0,
612
612
  [ft.name]: { settings: o, store: r },
613
- [pt.name]: { store: r, runWorkflow: c },
613
+ [pt.name]: { store: r, runWorkflow: h },
614
614
  [ht.name]: { store: r },
615
615
  [dt.name]: { store: r },
616
616
  [ut.name]: {
@@ -624,53 +624,53 @@ function on(e) {
624
624
  [it.name]: { store: r },
625
625
  [at.name]: { store: r, context: s },
626
626
  [ot.name]: {
627
- getActiveTabDetailedData: () => h.current
627
+ getActiveTabDetailedData: () => u.current
628
628
  },
629
629
  [rt.name]: { store: r }
630
- }), I.getToolSet();
630
+ }), w.getToolSet();
631
631
  }, [
632
632
  a,
633
633
  t,
634
634
  i,
635
635
  e,
636
636
  s,
637
- c,
637
+ h,
638
638
  o,
639
639
  r
640
640
  ]) };
641
641
  }
642
642
  function an(e) {
643
- const { children: t, chatId: n, model: s, initialMessages: o, onChatFinish: r, onChatMessagesUpdated: a } = e, i = ue(), { getReuniteAuth: c } = se(), { tools: h } = on(s), { sendEvent: C } = Ge(), I = W(h), l = W(s), { isOpen: p, openPanel: d, closePanel: P } = ye(), x = W(void 0), j = Te();
644
- I.current = h, l.current = s;
645
- const g = w(() => {
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
646
  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);
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
650
  return new tt({
651
651
  activeConversationId: n,
652
652
  model: l.current,
653
- tools: I.current,
654
- sendEvent: C,
655
- parentCtx: _,
653
+ tools: w.current,
654
+ sendEvent: v,
655
+ parentCtx: E,
656
656
  getActiveStateMessage: () => qt(en(j))
657
657
  });
658
- }, [n, C, j]);
659
- k(() => () => x.current?.end(), []);
660
- const B = w(() => {
658
+ }, [n, v, j]);
659
+ R(() => () => x.current?.end(), []);
660
+ const B = I(() => {
661
661
  if (g)
662
- return new Xe({ agent: g.getAgent() });
662
+ return new Ze({ agent: g.getAgent() });
663
663
  }, [g]);
664
- k(() => {
664
+ R(() => {
665
665
  g.setModel(s);
666
- }, [g, s]), k(() => {
667
- g.registerTools(h);
668
- }, [g, h]);
666
+ }, [g, s]), R(() => {
667
+ g.registerTools(u);
668
+ }, [g, u]);
669
669
  const {
670
- messages: b,
670
+ messages: k,
671
671
  setMessages: D,
672
672
  sendMessage: N,
673
- status: M,
673
+ status: b,
674
674
  error: Y,
675
675
  stop: O,
676
676
  addToolApprovalResponse: K
@@ -679,20 +679,20 @@ function an(e) {
679
679
  messages: o,
680
680
  transport: B,
681
681
  sendAutomaticallyWhen: et,
682
- onFinish(E) {
682
+ onFinish(M) {
683
683
  if (!r || !g) return;
684
- r({ agentLoop: g, chat: this }, E);
684
+ r({ agentLoop: g, chat: this }, M);
685
685
  }
686
- }), y = w(() => M === "streaming" || M === "submitted", [M]), q = f(() => {
686
+ }), y = I(() => b === "streaming" || b === "submitted", [b]), q = f(() => {
687
687
  i.aiEnabled === !0 && d();
688
688
  }, [d, i.aiEnabled]), Q = f(() => {
689
689
  P();
690
690
  }, [P]), J = f(
691
- async (E) => {
692
- const _ = E.trim();
693
- if (!(!_ || !B)) {
691
+ async (M) => {
692
+ const E = M.trim();
693
+ if (!(!E || !B)) {
694
694
  if (s.provider === ne) {
695
- const A = await c?.();
695
+ const A = await h?.();
696
696
  A?.baseUrl && A?.accessToken && g.setModel({
697
697
  provider: ne,
698
698
  baseUrl: A.baseUrl,
@@ -701,29 +701,29 @@ function an(e) {
701
701
  }
702
702
  D(
703
703
  (A) => mt(A) ? vt(A) : A
704
- ), N({ text: _ });
704
+ ), N({ text: E });
705
705
  }
706
706
  },
707
- [g, c, s.provider, N, D, B]
707
+ [g, h, s.provider, N, D, B]
708
708
  ), m = f(() => {
709
709
  y && O();
710
710
  }, [y, O]);
711
- k(() => () => {
711
+ R(() => () => {
712
712
  O();
713
713
  }, [n, O]);
714
714
  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;
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
719
  D(pe), a?.(A);
720
720
  },
721
- [b, a, D]
722
- ), Me = w(
721
+ [k, a, D]
722
+ ), Me = I(
723
723
  () => ({
724
- messages: b,
724
+ messages: k,
725
725
  isStreaming: y,
726
- chatStatus: M,
726
+ chatStatus: b,
727
727
  chatError: Y,
728
728
  sendMessage: J,
729
729
  updateMessages: U,
@@ -734,13 +734,13 @@ function an(e) {
734
734
  K,
735
735
  Y,
736
736
  y,
737
- b,
737
+ k,
738
738
  J,
739
- M,
739
+ b,
740
740
  m,
741
741
  U
742
742
  ]
743
- ), Ee = w(
743
+ ), Ee = I(
744
744
  () => ({
745
745
  isOpen: p,
746
746
  openPanel: q,
@@ -820,7 +820,7 @@ function pn({ chatId: e, model: t }) {
820
820
  );
821
821
  }
822
822
  function fn(e) {
823
- return w(() => {
823
+ return I(() => {
824
824
  const t = [ae];
825
825
  if (e) {
826
826
  for (const [n, s] of Object.entries(e))
@@ -855,14 +855,14 @@ function gn(e, t) {
855
855
  }
856
856
  function mn(e, t) {
857
857
  const [n, s] = z(() => Ie(e, t)), o = W(t);
858
- o.current = t, k(() => {
858
+ o.current = t, R(() => {
859
859
  s(Ie(e, o.current));
860
860
  }, [e]);
861
861
  const r = f(
862
862
  (a) => {
863
863
  s((i) => {
864
- const c = a instanceof Function ? a(i) : a;
865
- return gn(e, c), c;
864
+ const h = a instanceof Function ? a(i) : a;
865
+ return gn(e, h), h;
866
866
  });
867
867
  },
868
868
  [e]
@@ -874,31 +874,29 @@ function wn(e) {
874
874
  const { availableModels: t, aiProviders: n, reuniteAuth: s } = e, [o, r] = mn(
875
875
  vn,
876
876
  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 = {
877
+ ), a = t.some((h) => h.id === o) ? o : ae.id;
878
+ return { model: I(() => {
879
+ const h = {
882
880
  provider: ne,
883
881
  baseUrl: s.baseUrl,
884
882
  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
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
893
891
  };
894
- }, [o, t, n, s]), selectedModelId: o, selectModel: r };
892
+ }, [a, t, n, s]), selectedModelId: a, selectModel: r };
895
893
  }
896
894
  function Cn() {
897
895
  const [e, t] = z({
898
896
  baseUrl: "",
899
897
  accessToken: ""
900
898
  }), { getReuniteAuth: n } = se();
901
- return k(() => {
899
+ return R(() => {
902
900
  let s = !1;
903
901
  async function o() {
904
902
  const r = await n?.();
@@ -918,24 +916,24 @@ function Cn() {
918
916
  }, [n]), e;
919
917
  }
920
918
  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(() => {
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(() => {
922
920
  const m = me();
923
921
  r(m), s(m);
924
922
  }, []), p = f((m) => {
925
923
  r(m);
926
- }, []), { data: d } = It(o), P = Cn(), x = fn(h.aiProviders), { selectedModelId: j, model: g, selectModel: B } = wn({
924
+ }, []), { data: d } = It(o), P = Cn(), x = fn(u.aiProviders), { selectedModelId: j, model: g, selectModel: B } = wn({
927
925
  availableModels: x,
928
- aiProviders: h.aiProviders,
926
+ aiProviders: u.aiProviders,
929
927
  reuniteAuth: P
930
- }), b = yt(), D = hn({ chatId: n, model: g }), N = pn({ chatId: n, model: g }), M = dn({
928
+ }), k = yt(), D = hn({ chatId: n, model: g }), N = pn({ chatId: n, model: g }), b = dn({
931
929
  chatId: n,
932
930
  model: g,
933
931
  existingTitle: d?.title
934
932
  }), Y = f(
935
933
  (m, U) => {
936
- U.isAbort || (D(m, U), M(m, U));
934
+ U.isAbort || (D(m, U), b(m, U));
937
935
  },
938
- [D, M]
936
+ [D, b]
939
937
  ), O = f(
940
938
  (...m) => {
941
939
  N(...m);
@@ -943,30 +941,30 @@ function _n(e) {
943
941
  [N]
944
942
  ), K = f(
945
943
  (m) => {
946
- (o === m || n === m) && l(), b.mutate(m);
944
+ (o === m || n === m) && l(), k.mutate(m);
947
945
  },
948
- [l, n, b, o]
946
+ [l, n, k, o]
949
947
  ), y = d?.id;
950
- k(() => {
948
+ R(() => {
951
949
  y && y !== n && s(y);
952
950
  }, [y, o, n]);
953
951
  const q = f(() => {
954
952
  i(null);
955
953
  }, []), Q = f(
956
954
  (m) => {
957
- c.aiEnabled && (l(), i(m), C());
955
+ h.aiEnabled && (l(), i(m), v());
958
956
  },
959
- [C, l, c.aiEnabled]
960
- ), J = w(
957
+ [v, l, h.aiEnabled]
958
+ ), J = I(
961
959
  () => ({
962
960
  chatId: n,
963
961
  model: g,
964
962
  availableModels: x,
965
963
  selectedModelId: j,
966
964
  selectModel: B,
967
- onSettingsOpen: h.onSettingsOpen,
965
+ onSettingsOpen: u.onSettingsOpen,
968
966
  title: d?.title ?? Ye.title,
969
- isLoading: I,
967
+ isLoading: w,
970
968
  selectChat: p,
971
969
  removeChat: K,
972
970
  createNewChat: l,
@@ -979,7 +977,7 @@ function _n(e) {
979
977
  x,
980
978
  d?.title,
981
979
  g,
982
- I,
980
+ w,
983
981
  p,
984
982
  K,
985
983
  l,
@@ -988,7 +986,7 @@ function _n(e) {
988
986
  q,
989
987
  j,
990
988
  B,
991
- h.onSettingsOpen
989
+ u.onSettingsOpen
992
990
  ]
993
991
  );
994
992
  return /* @__PURE__ */ te(Je.Provider, { value: J, children: /* @__PURE__ */ te(
@@ -1,7 +1,7 @@
1
1
  import "./replay-history.schema-B0lLwmdG.js";
2
2
  import "./replay-step-context.schema-BOprzd6Z.js";
3
3
  import { a as h, b as r, c as n } from "./replay-ai-message-parts.schema-DKLf0SiG.js";
4
- import { c, a as u, b as m } from "./replay-ai-chat-mappers-D7e8buTk.js";
4
+ import { c, a as u, b as m } from "./replay-ai-chat-mappers-BEwNRQPV.js";
5
5
  import { b as l, e, c as b } from "./replay-indexes-B3PJtgeh.js";
6
6
  const g = {
7
7
  orderBy: [l(r.createdAt), l(r.indexWithinInsertBatch)],
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./replay-history.schema-miM3Etuf.js");require("./replay-step-context.schema-BuuXkAck.js");const i=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),h=require("./replay-ai-chat-mappers-aJ_VMb6Z.js"),s=require("./replay-indexes-Dqjl8m6C.js"),c={orderBy:[s.asc(i.aiMessages.createdAt),s.asc(i.aiMessages.indexWithinInsertBatch)],with:{parts:{orderBy:[s.asc(i.aiMessageParts.index)]}}};class g{constructor(e){this.sqliteDB=e}sqliteDB;async findAll(){return await this.initialize(),(await this.db.query.aiChats.findMany({with:{messages:c}})).map(h.convertAiChatRowToUiChat)}async findRecentChatsPage(e){await this.initialize();const a=e.limit+1,r=await this.db.query.aiChats.findMany({orderBy:(d,{desc:o})=>o(d.updatedAt),limit:a,offset:e.offset}),t=r.slice(0,e.limit),n=r.length>e.limit,w=e.offset+t.length;return{items:t.map(d=>{const o={...d,messages:[]};return h.convertAiChatRowToUiChat(o)}),hasMore:n,nextOffset:w}}async findOne(e){await this.initialize();const a=await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,e),with:{messages:c}});return a&&h.convertAiChatRowToUiChat(a)}async upsert(e){await this.initialize();const a=h.convertUiChatToAiChatRow(e);await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,a.id),columns:{id:!0}})?await this.db.update(i.aiChats).set(a).where(s.eq(i.aiChats.id,a.id)):await this.db.insert(i.aiChats).values(a);for(let t=0;t<e.messages.length;t++)await this.upsertMessageRowAndParts(e.id,t,e.messages[t])}async remove(e){await this.initialize(),await this.db.delete(i.aiChats).where(s.eq(i.aiChats.id,e))}async upsertMessageRowAndParts(e,a,r){const t=await this.db.query.aiMessages.findFirst({where:s.and(s.eq(i.aiMessages.aiChatId,e),s.eq(i.aiMessages.uiId,r.id))}),n=h.convertUiMessageToAiChatMessage(e,a,r,t?.id);t?await this.db.update(i.aiMessages).set({...n,indexWithinInsertBatch:t.indexWithinInsertBatch}).where(s.eq(i.aiMessages.id,t.id)):await this.db.insert(i.aiMessages).values(n),await this.db.delete(i.aiMessageParts).where(s.eq(i.aiMessageParts.aiMessageId,n.id)),n.parts.length>0&&await this.db.insert(i.aiMessageParts).values(n.parts)}get db(){return this.sqliteDB.db}async initialize(){await this.sqliteDB.initialize()}}exports.AiChatSqliteDBStorage=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./replay-history.schema-miM3Etuf.js");require("./replay-step-context.schema-BuuXkAck.js");const i=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),h=require("./replay-ai-chat-mappers-CMtNqQHX.js"),s=require("./replay-indexes-Dqjl8m6C.js"),c={orderBy:[s.asc(i.aiMessages.createdAt),s.asc(i.aiMessages.indexWithinInsertBatch)],with:{parts:{orderBy:[s.asc(i.aiMessageParts.index)]}}};class g{constructor(e){this.sqliteDB=e}sqliteDB;async findAll(){return await this.initialize(),(await this.db.query.aiChats.findMany({with:{messages:c}})).map(h.convertAiChatRowToUiChat)}async findRecentChatsPage(e){await this.initialize();const a=e.limit+1,r=await this.db.query.aiChats.findMany({orderBy:(d,{desc:o})=>o(d.updatedAt),limit:a,offset:e.offset}),t=r.slice(0,e.limit),n=r.length>e.limit,w=e.offset+t.length;return{items:t.map(d=>{const o={...d,messages:[]};return h.convertAiChatRowToUiChat(o)}),hasMore:n,nextOffset:w}}async findOne(e){await this.initialize();const a=await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,e),with:{messages:c}});return a&&h.convertAiChatRowToUiChat(a)}async upsert(e){await this.initialize();const a=h.convertUiChatToAiChatRow(e);await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,a.id),columns:{id:!0}})?await this.db.update(i.aiChats).set(a).where(s.eq(i.aiChats.id,a.id)):await this.db.insert(i.aiChats).values(a);for(let t=0;t<e.messages.length;t++)await this.upsertMessageRowAndParts(e.id,t,e.messages[t])}async remove(e){await this.initialize(),await this.db.delete(i.aiChats).where(s.eq(i.aiChats.id,e))}async upsertMessageRowAndParts(e,a,r){const t=await this.db.query.aiMessages.findFirst({where:s.and(s.eq(i.aiMessages.aiChatId,e),s.eq(i.aiMessages.uiId,r.id))}),n=h.convertUiMessageToAiChatMessage(e,a,r,t?.id);t?await this.db.update(i.aiMessages).set({...n,indexWithinInsertBatch:t.indexWithinInsertBatch}).where(s.eq(i.aiMessages.id,t.id)):await this.db.insert(i.aiMessages).values(n),await this.db.delete(i.aiMessageParts).where(s.eq(i.aiMessageParts.aiMessageId,n.id)),n.parts.length>0&&await this.db.insert(i.aiMessageParts).values(n.parts)}get db(){return this.sqliteDB.db}async initialize(){await this.sqliteDB.initialize()}}exports.AiChatSqliteDBStorage=g;