@8wave/ai-elements 0.98.0 → 0.99.0-beta.1

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 (76) hide show
  1. package/README.md +24 -5
  2. package/dist/_chunks/{PkToolShowForm-BNV4Ja6g.js → PkToolShowForm-dFuoqTPs.js} +84 -80
  3. package/dist/_chunks/PkToolShowForm-dFuoqTPs.js.map +1 -0
  4. package/dist/ai-elements.es.js +3153 -2982
  5. package/dist/ai-elements.es.js.map +1 -1
  6. package/dist-vue/PkChatbot.js +1 -1
  7. package/dist-vue/PkChatbotMessages.js +1 -1
  8. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  9. package/dist-vue/PkChatbotSteps.js +1 -1
  10. package/dist-vue/PkChatbotViewChat.js +1 -1
  11. package/dist-vue/PkChatbotViewConversations.js +1 -1
  12. package/dist-vue/PkChatbotViewFiles.js +1 -1
  13. package/dist-vue/PkChatbotViewProfile.js +1 -1
  14. package/dist-vue/_chunks/{PkChatbot-DHkhT0Jf.js → PkChatbot-BlG1WlAO.js} +7 -7
  15. package/dist-vue/_chunks/{PkChatbot-DHkhT0Jf.js.map → PkChatbot-BlG1WlAO.js.map} +1 -1
  16. package/dist-vue/_chunks/PkChatbotMessages-BrufA7o1.js +752 -0
  17. package/dist-vue/_chunks/PkChatbotMessages-BrufA7o1.js.map +1 -0
  18. package/dist-vue/_chunks/{PkChatbotStepToolDetail-ldThv0t5.js → PkChatbotStepToolDetail-BVI72gyx.js} +2 -2
  19. package/dist-vue/_chunks/{PkChatbotStepToolDetail-ldThv0t5.js.map → PkChatbotStepToolDetail-BVI72gyx.js.map} +1 -1
  20. package/dist-vue/_chunks/PkChatbotSteps-Dv9NkYER.js +172 -0
  21. package/dist-vue/_chunks/{PkChatbotSteps-BpqdFhsG.js.map → PkChatbotSteps-Dv9NkYER.js.map} +1 -1
  22. package/dist-vue/_chunks/{PkChatbotViewChat-C08TsXiL.js → PkChatbotViewChat-CAqvbbfN.js} +66 -66
  23. package/dist-vue/_chunks/PkChatbotViewChat-CAqvbbfN.js.map +1 -0
  24. package/dist-vue/_chunks/{PkChatbotViewConversations-BQZi5kSC.js → PkChatbotViewConversations-Cq41H-tc.js} +2 -2
  25. package/dist-vue/_chunks/{PkChatbotViewConversations-BQZi5kSC.js.map → PkChatbotViewConversations-Cq41H-tc.js.map} +1 -1
  26. package/dist-vue/_chunks/{PkChatbotViewFiles-TLKE_tRw.js → PkChatbotViewFiles-DNuzmBJc.js} +2 -2
  27. package/dist-vue/_chunks/{PkChatbotViewFiles-TLKE_tRw.js.map → PkChatbotViewFiles-DNuzmBJc.js.map} +1 -1
  28. package/dist-vue/_chunks/{PkChatbotViewProfile-B6ANZY96.js → PkChatbotViewProfile-C0BXIY2N.js} +2 -2
  29. package/dist-vue/_chunks/{PkChatbotViewProfile-B6ANZY96.js.map → PkChatbotViewProfile-C0BXIY2N.js.map} +1 -1
  30. package/dist-vue/_chunks/{PkToolShowForm-C-mWyeka.js → PkToolShowForm-CQuX08lk.js} +62 -58
  31. package/dist-vue/_chunks/PkToolShowForm-CQuX08lk.js.map +1 -0
  32. package/dist-vue/_chunks/{createChatbotApiClient-BOBdBxmf.js → createChatbotApiClient-BMZltBLh.js} +367 -363
  33. package/dist-vue/_chunks/createChatbotApiClient-BMZltBLh.js.map +1 -0
  34. package/dist-vue/_chunks/{useChatbotStore-BJ-EDmND.js → useChatbotStore-DZiorgLW.js} +113 -103
  35. package/dist-vue/_chunks/{useChatbotStore-BJ-EDmND.js.map → useChatbotStore-DZiorgLW.js.map} +1 -1
  36. package/dist-vue/_chunks/{utils-BMa8jwJS.js → utils-Cru8TJxe.js} +48 -30
  37. package/dist-vue/_chunks/utils-Cru8TJxe.js.map +1 -0
  38. package/dist-vue/api.js +1 -1
  39. package/dist-vue/composables.js +3 -3
  40. package/dist-vue/index.js +4351 -4041
  41. package/dist-vue/index.js.map +1 -1
  42. package/dist-vue/locales.js +16 -0
  43. package/dist-vue/packages/components/src/PkCheckboxField.d.ts +45 -0
  44. package/dist-vue/packages/components/src/PkEditorRepeater.d.ts +2 -2
  45. package/dist-vue/packages/components/src/PkPwaInstallPrompt.d.ts +4 -0
  46. package/dist-vue/packages/components/src/PkPwaOfflineNotice.d.ts +4 -0
  47. package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +11 -2
  48. package/dist-vue/packages/components/src/chat/PkChatbotMessages.d.ts +24 -2
  49. package/dist-vue/packages/components/src/chat/PkToolApprovalBadge.d.ts +4 -0
  50. package/dist-vue/packages/components/src/chat/PkToolApprovalCard.d.ts +35 -0
  51. package/dist-vue/packages/components/src/chat/PkToolApprovalPreviewMessage.d.ts +11 -0
  52. package/dist-vue/packages/components/src/chat/index.d.ts +2 -1
  53. package/dist-vue/packages/components/src/chat/toolApprovalPreviews.d.ts +12 -0
  54. package/dist-vue/packages/components/src/chat/toolComponentMap.d.ts +5 -3
  55. package/dist-vue/packages/components/src/chat/useChatScroll.d.ts +6 -0
  56. package/dist-vue/packages/components/src/chat/utils.d.ts +13 -0
  57. package/dist-vue/packages/components/src/index.d.ts +4 -1
  58. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +34 -1
  59. package/dist-vue/packages/models/src/schema/Agent.d.ts +48 -0
  60. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +6 -0
  61. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +6 -0
  62. package/dist-vue/style.css +1 -1
  63. package/package.json +1 -1
  64. package/dist/_chunks/PkToolRequestConfirm-FQ9nDFXy.js +0 -48
  65. package/dist/_chunks/PkToolRequestConfirm-FQ9nDFXy.js.map +0 -1
  66. package/dist/_chunks/PkToolShowForm-BNV4Ja6g.js.map +0 -1
  67. package/dist-vue/_chunks/PkChatbotMessages-B4qfTNOJ.js +0 -630
  68. package/dist-vue/_chunks/PkChatbotMessages-B4qfTNOJ.js.map +0 -1
  69. package/dist-vue/_chunks/PkChatbotSteps-BpqdFhsG.js +0 -172
  70. package/dist-vue/_chunks/PkChatbotViewChat-C08TsXiL.js.map +0 -1
  71. package/dist-vue/_chunks/PkToolRequestConfirm-CQNa3seA.js +0 -48
  72. package/dist-vue/_chunks/PkToolRequestConfirm-CQNa3seA.js.map +0 -1
  73. package/dist-vue/_chunks/PkToolShowForm-C-mWyeka.js.map +0 -1
  74. package/dist-vue/_chunks/createChatbotApiClient-BOBdBxmf.js.map +0 -1
  75. package/dist-vue/_chunks/utils-BMa8jwJS.js.map +0 -1
  76. package/dist-vue/packages/components/src/chat/PkToolRequestConfirm.d.ts +0 -11
@@ -1,5 +1,5 @@
1
1
  import { C as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, n as d, o as f, p, r as m, v as h, w as ee, y as g } from "./schemas-DnUKIqgi.js";
2
- import { t as te } from "./createChatbotApiClient-BOBdBxmf.js";
2
+ import { t as te } from "./createChatbotApiClient-BMZltBLh.js";
3
3
  import { t as ne } from "./src-8QXYVWIx.js";
4
4
  import { n as re } from "./message-RohfrdWS.js";
5
5
  import { a as _, i as v, n as y, r as b, t as x } from "./ZodError-BoB_0oSl.js";
@@ -5602,6 +5602,12 @@ var Ci = class {
5602
5602
  }
5603
5603
  };
5604
5604
  function Ei({ messages: e }) {
5605
+ let t = e[e.length - 1];
5606
+ if (!t || t.role !== "assistant") return !1;
5607
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(gi);
5608
+ return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" || e.state === "output-error" || e.state === "approval-responded");
5609
+ }
5610
+ function Di({ messages: e }) {
5605
5611
  let t = e[e.length - 1];
5606
5612
  if (!t || t.role !== "assistant") return !1;
5607
5613
  let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(gi).filter((e) => !e.providerExecuted);
@@ -5609,31 +5615,31 @@ function Ei({ messages: e }) {
5609
5615
  }
5610
5616
  //#endregion
5611
5617
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.40_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
5612
- var Di = /* @__PURE__ */ new WeakMap(), Oi = 0;
5613
- function ki(e) {
5618
+ var Oi = /* @__PURE__ */ new WeakMap(), ki = 0;
5619
+ function Ai(e) {
5614
5620
  if (!e.length) return "";
5615
5621
  for (var t = "arg", n = 0; n < e.length; ++n) {
5616
5622
  var r = void 0;
5617
- e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : Di.has(e[n]) ? r = Di.get(e[n]) : (r = Oi, Di.set(e[n], Oi++)), t += "@" + r;
5623
+ e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : Oi.has(e[n]) ? r = Oi.get(e[n]) : (r = ki, Oi.set(e[n], ki++)), t += "@" + r;
5618
5624
  }
5619
5625
  return t;
5620
5626
  }
5621
5627
  //#endregion
5622
5628
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.40_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
5623
- function Ai(e) {
5629
+ function ji(e) {
5624
5630
  if (typeof e == "function") try {
5625
5631
  e = e();
5626
5632
  } catch {
5627
5633
  e = "";
5628
5634
  }
5629
- return e = Array.isArray(e) ? ki(e) : String(e || ""), e;
5635
+ return e = Array.isArray(e) ? Ai(e) : String(e || ""), e;
5630
5636
  }
5631
- var ji = function() {
5637
+ var Mi = function() {
5632
5638
  function e(e) {
5633
5639
  e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
5634
5640
  }
5635
5641
  return e.prototype.serializeKey = function(e) {
5636
- return Ai(e);
5642
+ return ji(e);
5637
5643
  }, e.prototype.get = function(e) {
5638
5644
  var t = this.serializeKey(e);
5639
5645
  return this.items.get(t);
@@ -5655,15 +5661,15 @@ var ji = function() {
5655
5661
  }();
5656
5662
  //#endregion
5657
5663
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.40_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
5658
- function Mi() {
5664
+ function Ni() {
5659
5665
  return navigator.onLine === void 0 || navigator.onLine;
5660
5666
  }
5661
- function Ni() {
5667
+ function Pi() {
5662
5668
  return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
5663
5669
  }
5664
- var Pi = {
5665
- isOnline: Mi,
5666
- isDocumentVisible: Ni,
5670
+ var Fi = {
5671
+ isOnline: Ni,
5672
+ isDocumentVisible: Pi,
5667
5673
  fetcher: function(e) {
5668
5674
  return fetch(e).then(function(e) {
5669
5675
  return e.json();
@@ -5674,7 +5680,7 @@ var Pi = {
5674
5680
  for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
5675
5681
  return e;
5676
5682
  }, $.apply(this, arguments);
5677
- }, Fi = function(e, t, n, r) {
5683
+ }, Ii = function(e, t, n, r) {
5678
5684
  function i(e) {
5679
5685
  return e instanceof n ? e : new n(function(t) {
5680
5686
  t(e);
@@ -5700,7 +5706,7 @@ var Pi = {
5700
5706
  }
5701
5707
  c((r = r.apply(e, t || [])).next());
5702
5708
  });
5703
- }, Ii = function(e, t) {
5709
+ }, Li = function(e, t) {
5704
5710
  var n = {
5705
5711
  label: 0,
5706
5712
  sent: function() {
@@ -5773,7 +5779,7 @@ var Pi = {
5773
5779
  done: !0
5774
5780
  };
5775
5781
  }
5776
- }, Li = function(e, t) {
5782
+ }, Ri = function(e, t) {
5777
5783
  var n = typeof Symbol == "function" && e[Symbol.iterator];
5778
5784
  if (!n) return e;
5779
5785
  var r = n.call(e), i, a = [], o;
@@ -5789,11 +5795,11 @@ var Pi = {
5789
5795
  }
5790
5796
  }
5791
5797
  return a;
5792
- }, Ri = function(e, t, n) {
5798
+ }, zi = function(e, t, n) {
5793
5799
  if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
5794
5800
  return e.concat(a || Array.prototype.slice.call(t));
5795
- }, zi = new ji(), Bi = new ji(), Vi = new ji(), Hi = {
5796
- cache: zi,
5801
+ }, Bi = new Mi(), Vi = new Mi(), Hi = new Mi(), Ui = {
5802
+ cache: Bi,
5797
5803
  refreshInterval: 0,
5798
5804
  ttl: 0,
5799
5805
  serverTTL: 1e3,
@@ -5803,15 +5809,15 @@ var Pi = {
5803
5809
  shouldRetryOnError: !0,
5804
5810
  errorRetryInterval: 5e3,
5805
5811
  errorRetryCount: 5,
5806
- fetcher: Pi.fetcher,
5807
- isOnline: Pi.isOnline,
5808
- isDocumentVisible: Pi.isDocumentVisible
5812
+ fetcher: Fi.fetcher,
5813
+ isOnline: Fi.isOnline,
5814
+ isDocumentVisible: Fi.isDocumentVisible
5809
5815
  };
5810
- function Ui(e, t, n) {
5811
- var r = Bi.get(e);
5812
- r ? r.data.push(t) : Bi.set(e, [t], n > 0 ? n + 5e3 : n);
5813
- }
5814
5816
  function Wi(e, t, n) {
5817
+ var r = Vi.get(e);
5818
+ r ? r.data.push(t) : Vi.set(e, [t], n > 0 ? n + 5e3 : n);
5819
+ }
5820
+ function Gi(e, t, n) {
5815
5821
  if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
5816
5822
  var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
5817
5823
  setTimeout(function() {
@@ -5822,17 +5828,17 @@ function Wi(e, t, n) {
5822
5828
  }, i);
5823
5829
  }
5824
5830
  }
5825
- function Gi(e) {
5831
+ function Ki(e) {
5826
5832
  var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
5827
- return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Hi.shouldRetryOnError;
5833
+ return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Ui.shouldRetryOnError;
5828
5834
  }
5829
- var Ki = function(e, t, n, r) {
5830
- return n === void 0 && (n = zi), r === void 0 && (r = Hi.ttl), Fi(void 0, void 0, void 0, function() {
5835
+ var qi = function(e, t, n, r) {
5836
+ return n === void 0 && (n = Bi), r === void 0 && (r = Ui.ttl), Ii(void 0, void 0, void 0, function() {
5831
5837
  var i, a, o, s, c, l, u;
5832
- return Ii(this, function(d) {
5838
+ return Li(this, function(d) {
5833
5839
  switch (d.label) {
5834
5840
  case 0:
5835
- if (!Ji(t)) return [3, 5];
5841
+ if (!Yi(t)) return [3, 5];
5836
5842
  d.label = 1;
5837
5843
  case 1: return d.trys.push([
5838
5844
  1,
@@ -5854,7 +5860,7 @@ var Ki = function(e, t, n, r) {
5854
5860
  } catch (e) {
5855
5861
  console.error("swrv(mutate): failed to set cache", e);
5856
5862
  }
5857
- return l = Bi.get(e), l && l.data.length && (u = l.data.filter(function(t) {
5863
+ return l = Vi.get(e), l && l.data.length && (u = l.data.filter(function(t) {
5858
5864
  return t.key === e;
5859
5865
  }), u.forEach(function(e, t) {
5860
5866
  c.data !== void 0 && (e.data = c.data), e.error = c.error, e.isValidating = c.isValidating, e.isLoading = c.isValidating, t !== u.length - 1 && delete u[t];
@@ -5863,9 +5869,9 @@ var Ki = function(e, t, n, r) {
5863
5869
  });
5864
5870
  });
5865
5871
  };
5866
- function qi() {
5872
+ function Ji() {
5867
5873
  for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
5868
- var r, i, a = $({}, Hi), o = !1, s = !1;
5874
+ var r, i, a = $({}, Ui), o = !1, s = !1;
5869
5875
  if (!ae()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
5870
5876
  var c = typeof window > "u" || typeof document > "u";
5871
5877
  t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
@@ -5880,32 +5886,32 @@ function qi() {
5880
5886
  key: null
5881
5887
  });
5882
5888
  var f = function(t, n) {
5883
- return Fi(e, void 0, void 0, function() {
5889
+ return Ii(e, void 0, void 0, function() {
5884
5890
  var e, r, s, c, p, m, h, ee = this;
5885
- return Ii(this, function(g) {
5891
+ return Li(this, function(g) {
5886
5892
  switch (g.label) {
5887
5893
  case 0: return e = d.data === void 0, r = u.value, r ? (s = a.cache.get(r), c = s && s.data, d.isValidating = !0, d.isLoading = !c, c && (d.data = c.data, d.error = c.error), p = t || i, !p || !a.isDocumentVisible() && !e || n?.forceRevalidate !== void 0 && !n?.forceRevalidate || s && (m = !!(Date.now() - s.createdAt >= a.dedupingInterval || n?.forceRevalidate), !m) ? (d.isValidating = !1, d.isLoading = !1, [2]) : (h = function() {
5888
- return Fi(ee, void 0, void 0, function() {
5894
+ return Ii(ee, void 0, void 0, function() {
5889
5895
  var e, t, i, s, c, u;
5890
- return Ii(this, function(m) {
5896
+ return Li(this, function(m) {
5891
5897
  switch (m.label) {
5892
- case 0: return e = Vi.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, Ri([], Li(t), !1)), Vi.set(r, i, a.dedupingInterval), [4, Ki(r, i, a.cache, l)]);
5898
+ case 0: return e = Hi.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, zi([], Ri(t), !1)), Hi.set(r, i, a.dedupingInterval), [4, qi(r, i, a.cache, l)]);
5893
5899
  case 1: return m.sent(), [3, 4];
5894
- case 2: return [4, Ki(r, e.data, a.cache, l)];
5900
+ case 2: return [4, qi(r, e.data, a.cache, l)];
5895
5901
  case 3: m.sent(), m.label = 4;
5896
- case 4: return d.isValidating = !1, d.isLoading = !1, Vi.delete(r), d.error !== void 0 && (s = Gi({
5902
+ case 4: return d.isValidating = !1, d.isLoading = !1, Hi.delete(r), d.error !== void 0 && (s = Ki({
5897
5903
  shouldRetry: a.shouldRetryOnError,
5898
5904
  error: d.error
5899
- }), c = Gi({
5905
+ }), c = Ki({
5900
5906
  shouldRetry: !n || n.shouldRetryOnError,
5901
5907
  error: d.error
5902
- }), u = !o && s && c, u && Wi(f, n ? n.errorRetryCount : 1, a)), [2];
5908
+ }), u = !o && s && c, u && Gi(f, n ? n.errorRetryCount : 1, a)), [2];
5903
5909
  }
5904
5910
  });
5905
5911
  });
5906
5912
  }, c && a.revalidateDebounce ? (setTimeout(function() {
5907
- return Fi(ee, void 0, void 0, function() {
5908
- return Ii(this, function(e) {
5913
+ return Ii(ee, void 0, void 0, function() {
5914
+ return Li(this, function(e) {
5909
5915
  switch (e.label) {
5910
5916
  case 0: return o ? [3, 2] : [4, h()];
5911
5917
  case 1: e.sent(), e.label = 2;
@@ -5921,16 +5927,16 @@ function qi() {
5921
5927
  });
5922
5928
  });
5923
5929
  }, p = function() {
5924
- return Fi(e, void 0, void 0, function() {
5925
- return Ii(this, function(e) {
5930
+ return Ii(e, void 0, void 0, function() {
5931
+ return Li(this, function(e) {
5926
5932
  return [2, f(null, { shouldRetryOnError: !1 })];
5927
5933
  });
5928
5934
  });
5929
5935
  }, m = null;
5930
5936
  if (!c) {
5931
5937
  var h = function() {
5932
- return Fi(e, void 0, void 0, function() {
5933
- return Ii(this, function(e) {
5938
+ return Ii(e, void 0, void 0, function() {
5939
+ return Li(this, function(e) {
5934
5940
  switch (e.label) {
5935
5941
  case 0: return !d.error && a.isOnline() ? [4, f()] : [3, 2];
5936
5942
  case 1: return e.sent(), [3, 3];
@@ -5944,28 +5950,28 @@ function qi() {
5944
5950
  }
5945
5951
  C(function() {
5946
5952
  o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
5947
- var e = Bi.get(u.value);
5953
+ var e = Vi.get(u.value);
5948
5954
  e && (e.data = e.data.filter(function(e) {
5949
5955
  return e !== d;
5950
5956
  }));
5951
5957
  });
5952
5958
  try {
5953
5959
  le(u, function(e) {
5954
- oe(u) || (u.value = e), d.key = e, d.isValidating = !!e, Ui(u.value, d, l), !c && !s && u.value && f(), s = !1;
5960
+ oe(u) || (u.value = e), d.key = e, d.isValidating = !!e, Wi(u.value, d, l), !c && !s && u.value && f(), s = !1;
5955
5961
  }, { immediate: !0 });
5956
5962
  } catch {}
5957
5963
  return $($({}, ce(d)), { mutate: function(e, t) {
5958
5964
  return f(e, $($({}, t), { forceRevalidate: !0 }));
5959
5965
  } });
5960
5966
  }
5961
- function Ji(e) {
5967
+ function Yi(e) {
5962
5968
  return typeof e == "object" && !!e && typeof e.then == "function";
5963
5969
  }
5964
5970
  //#endregion
5965
5971
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.40_typescript@6.0.3_/node_modules/swrv/esm/index.js
5966
- var Yi = qi;
5967
- Yi.default, Yi.default;
5968
- var Xi = class {
5972
+ var Xi = Ji;
5973
+ Xi.default, Xi.default;
5974
+ var Zi = class {
5969
5975
  constructor(e) {
5970
5976
  this.statusRef = w("ready"), this.errorRef = w(void 0), this.pushMessage = (e) => {
5971
5977
  this.messagesRef.value = [...this.messagesRef.value, e];
@@ -5993,17 +5999,17 @@ var Xi = class {
5993
5999
  set error(e) {
5994
6000
  this.errorRef.value = e;
5995
6001
  }
5996
- }, Zi = class extends Ti {
6002
+ }, Qi = class extends Ti {
5997
6003
  constructor({ messages: e, ...t }) {
5998
6004
  super({
5999
6005
  ...t,
6000
- state: new Xi(e)
6006
+ state: new Zi(e)
6001
6007
  });
6002
6008
  }
6003
6009
  };
6004
6010
  //#endregion
6005
6011
  //#region ../../packages/composable/src/chatbot/useChatbotStore.ts
6006
- function Qi(e) {
6012
+ function $i(e) {
6007
6013
  return T(`chatbot-${e}`, () => {
6008
6014
  let { t, te: n, locale: r } = de({ useScope: "global" }), i = w(""), a = w(), o = w(e), s = w(), c = w(), l = w(), u = w(), d = w(), f = w(), p = w(), m = w(), h = w(), ee = w(), g = w(), _ = w(), v = w(), y = w(), b = w(), x = w(!1), ae = fe(), oe = S(() => {
6009
6015
  let e = u.value?.theme;
@@ -6042,7 +6048,7 @@ function Qi(e) {
6042
6048
  baseUrl: i.value,
6043
6049
  basePath: a.value,
6044
6050
  headers: () => p.value
6045
- })), ye = w(null), O = S(() => new Zi({
6051
+ })), ye = w(null), O = S(() => new Qi({
6046
6052
  id: T.value,
6047
6053
  transport: new wi({
6048
6054
  api: D.value.getChatEndpoint(o.value, C.value ? "reasoning" : "chat"),
@@ -6075,7 +6081,7 @@ function Qi(e) {
6075
6081
  onToolCall: ({ toolCall: e }) => {
6076
6082
  ne.log("Tool call:", e);
6077
6083
  },
6078
- sendAutomaticallyWhen: Ei,
6084
+ sendAutomaticallyWhen: (e) => Di(e) || Ei(e),
6079
6085
  onError: E,
6080
6086
  onFinish: () => {
6081
6087
  let e = T.value;
@@ -6221,10 +6227,10 @@ function Qi(e) {
6221
6227
  });
6222
6228
  function He(e = !1) {
6223
6229
  for (let t of N.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
6224
- N.value = [], Ze.value = null;
6230
+ N.value = [], Qe.value = null;
6225
6231
  }
6226
6232
  async function Ue() {
6227
- return P.value = "", await Ve(), T.value = sn(), O.value.clearError(), he.value = void 0, ge.value = !1, He(!0), ct("chat"), T.value;
6233
+ return P.value = "", await Ve(), T.value = sn(), O.value.clearError(), he.value = void 0, ge.value = !1, He(!0), lt("chat"), T.value;
6228
6234
  }
6229
6235
  async function We(e) {
6230
6236
  O.value.status !== "ready" && (P.value = "", await Ve()), await O.value.regenerate(e);
@@ -6241,20 +6247,23 @@ function Qi(e) {
6241
6247
  }
6242
6248
  O.value.addToolOutput(e);
6243
6249
  }
6244
- let Ke = S(() => O.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), qe = S(() => g.value?.maxFilesPerMessage ?? 5), Je = S(() => g.value?.maxFilesPerChat ?? 20), Ye = S(() => Math.max(0, Math.min(qe.value - N.value.length, Je.value - Ke.value - N.value.length))), Xe = S(() => Ye.value <= 0), Ze = w(null), Qe = () => {
6245
- Ze.value = null;
6250
+ function Ke(e) {
6251
+ O.value.addToolApprovalResponse(e);
6252
+ }
6253
+ let qe = S(() => O.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Je = S(() => g.value?.maxFilesPerMessage ?? 5), Ye = S(() => g.value?.maxFilesPerChat ?? 20), Xe = S(() => Math.max(0, Math.min(Je.value - N.value.length, Ye.value - qe.value - N.value.length))), Ze = S(() => Xe.value <= 0), Qe = w(null), $e = () => {
6254
+ Qe.value = null;
6246
6255
  };
6247
- le(Xe, (e) => {
6248
- e || (Ze.value = null);
6256
+ le(Ze, (e) => {
6257
+ e || (Qe.value = null);
6249
6258
  });
6250
- async function $e(e) {
6251
- if (Xe.value) {
6252
- Ze.value = Je.value - Ke.value - N.value.length <= qe.value - N.value.length ? {
6259
+ async function et(e) {
6260
+ if (Ze.value) {
6261
+ Qe.value = Ye.value - qe.value - N.value.length <= Je.value - N.value.length ? {
6253
6262
  reason: "per-chat",
6254
- max: Je.value
6263
+ max: Ye.value
6255
6264
  } : {
6256
6265
  reason: "per-message",
6257
- max: qe.value
6266
+ max: Je.value
6258
6267
  };
6259
6268
  return;
6260
6269
  }
@@ -6281,7 +6290,7 @@ function Qi(e) {
6281
6290
  } : e);
6282
6291
  }
6283
6292
  }
6284
- async function et(e, t) {
6293
+ async function tt(e, t) {
6285
6294
  let { userQuestion: n, assistantMessage: r } = z(e);
6286
6295
  R(await D.value.submitMessageFeedback({
6287
6296
  messageId: e.id,
@@ -6292,16 +6301,16 @@ function Qi(e) {
6292
6301
  assistantMessage: r
6293
6302
  }));
6294
6303
  }
6295
- async function tt(e) {
6296
- await et(e, "upvote");
6297
- }
6298
6304
  async function nt(e) {
6299
- await et(e, "downvote");
6305
+ await tt(e, "upvote");
6306
+ }
6307
+ async function rt(e) {
6308
+ await tt(e, "downvote");
6300
6309
  }
6301
- function rt(e) {
6310
+ function it(e) {
6302
6311
  Ae.value = !1, je.value = void 0, Oe.value = e;
6303
6312
  }
6304
- async function it(e) {
6313
+ async function at(e) {
6305
6314
  if (Oe.value) try {
6306
6315
  ke.value = !0, Ae.value = !1, je.value = void 0;
6307
6316
  let { userQuestion: t, assistantMessage: n } = z(Oe.value);
@@ -6319,7 +6328,7 @@ function Qi(e) {
6319
6328
  ke.value = !1;
6320
6329
  }
6321
6330
  }
6322
- async function at(e) {
6331
+ async function ot(e) {
6323
6332
  try {
6324
6333
  Me.value = !0, M.value = !1, Ne.value = void 0, await D.value.submitLead({
6325
6334
  agentId: o.value,
@@ -6332,29 +6341,29 @@ function Qi(e) {
6332
6341
  Me.value = !1;
6333
6342
  }
6334
6343
  }
6335
- async function ot(e, t) {
6344
+ async function st(e, t) {
6336
6345
  let n = await D.value.updateChatTitle(o.value, e, t);
6337
6346
  k.value = k.value.map((t) => t.id === e ? {
6338
6347
  ...t,
6339
6348
  title: n.title
6340
6349
  } : t);
6341
6350
  }
6342
- async function st(e) {
6351
+ async function ct(e) {
6343
6352
  await D.value.deleteChat(o.value, e), k.value = k.value.filter((t) => t.id !== e), T.value === e && await Ue();
6344
6353
  }
6345
- function ct(e) {
6354
+ function lt(e) {
6346
6355
  De.value = e;
6347
6356
  }
6348
- let lt;
6349
- function ut(e) {
6357
+ let ut;
6358
+ function dt(e) {
6350
6359
  let t = () => D.value.getChat(o.value, e).then((e) => e !== null);
6351
6360
  return t().catch(() => t().catch(() => !1));
6352
6361
  }
6353
6362
  return le(l, async (e) => {
6354
- if (!e || e === lt) return;
6355
- let t = lt;
6356
- if (lt = e, t === void 0) return;
6357
- let n = T.value, r = !C.value && await ut(n);
6363
+ if (!e || e === ut) return;
6364
+ let t = ut;
6365
+ if (ut = e, t === void 0) return;
6366
+ let n = T.value, r = !C.value && await dt(n);
6358
6367
  if (!(l.value !== e || T.value !== n)) {
6359
6368
  if (r) {
6360
6369
  I(o.value);
@@ -6393,8 +6402,8 @@ function Qi(e) {
6393
6402
  isLoadingChatFiles: Ee,
6394
6403
  input: Pe,
6395
6404
  pendingAttachments: N,
6396
- isAttachmentLimitReached: Xe,
6397
- fileLimitError: Ze,
6405
+ isAttachmentLimitReached: Ze,
6406
+ fileLimitError: Qe,
6398
6407
  localChatId: T,
6399
6408
  isConversationBlocked: ge,
6400
6409
  inputMessagePlaceholder: we,
@@ -6420,21 +6429,22 @@ function Qi(e) {
6420
6429
  startNewChat: Ue,
6421
6430
  regenerate: We,
6422
6431
  addToolOutput: Ge,
6423
- handleFileSelect: $e,
6424
- clearFileLimitError: Qe,
6432
+ addToolApprovalResponse: Ke,
6433
+ handleFileSelect: et,
6434
+ clearFileLimitError: $e,
6425
6435
  clearPendingAttachments: He,
6426
- onUpvote: tt,
6427
- onDownvote: nt,
6428
- onFeedback: rt,
6429
- onFeedbackSubmit: it,
6430
- onLeadSubmit: at,
6431
- navigate: ct,
6432
- renameChatTitle: ot,
6433
- deleteChat: st
6436
+ onUpvote: nt,
6437
+ onDownvote: rt,
6438
+ onFeedback: it,
6439
+ onFeedbackSubmit: at,
6440
+ onLeadSubmit: ot,
6441
+ navigate: lt,
6442
+ renameChatTitle: st,
6443
+ deleteChat: ct
6434
6444
  };
6435
6445
  })();
6436
6446
  }
6437
6447
  //#endregion
6438
- export { sn as i, Zi as n, wi as r, Qi as t };
6448
+ export { sn as i, Qi as n, wi as r, $i as t };
6439
6449
 
6440
- //# sourceMappingURL=useChatbotStore-BJ-EDmND.js.map
6450
+ //# sourceMappingURL=useChatbotStore-DZiorgLW.js.map