@rpcbase/agents-sdk 0.2.0 → 0.4.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 (79) hide show
  1. package/dist/agents-sdk.css +1 -1
  2. package/dist/api/chat/handler.d.ts.map +1 -1
  3. package/dist/api/chat/messages/handler.d.ts.map +1 -1
  4. package/dist/api/chat/messages/trailing/handler.d.ts.map +1 -1
  5. package/dist/api/chat/runtimeConfig.d.ts +11 -0
  6. package/dist/api/chat/runtimeConfig.d.ts.map +1 -1
  7. package/dist/api/chatDb.d.ts +35 -1
  8. package/dist/api/chatDb.d.ts.map +1 -1
  9. package/dist/api/chatStore.d.ts +11 -2
  10. package/dist/api/chatStore.d.ts.map +1 -1
  11. package/dist/api/session/current/handler.d.ts +4 -0
  12. package/dist/api/session/current/handler.d.ts.map +1 -0
  13. package/dist/api/session/current/index.d.ts +11 -0
  14. package/dist/api/session/current/index.d.ts.map +1 -0
  15. package/dist/{chatDb-CpCFaAxK.js → chatDb-CcAjAGX7.js} +76 -61
  16. package/dist/{chatDb-hVHCr0j0.js → chatDb-DfmUbQT2.js} +76 -61
  17. package/dist/client-routes.browser.js +9 -8
  18. package/dist/client-routes.js +9 -8
  19. package/dist/components/chat.d.ts.map +1 -1
  20. package/dist/components/multimodal-input.d.ts.map +1 -1
  21. package/dist/components/sidebar-history.d.ts.map +1 -1
  22. package/dist/{data-stream-handler-DMKVEvOY.js → data-stream-handler-D9R15ZTc.js} +100 -87
  23. package/dist/{data-stream-handler-6o0tw3-M.js → data-stream-handler-eapMI8kQ.js} +107 -94
  24. package/dist/{handler-CwGQ3dV4.js → handler-B6kVyUoS.js} +1 -1
  25. package/dist/{handler-B3iF4jS4.js → handler-BKT8Hl0a.js} +1 -1
  26. package/dist/{handler-CzKTKfwA.js → handler-BLG0AYVC.js} +1 -1
  27. package/dist/handler-BQZNf9EG.js +21 -0
  28. package/dist/{handler-Bb3YEDwz.js → handler-BUvspcpX.js} +1 -1
  29. package/dist/handler-BdCGoVUM.js +21 -0
  30. package/dist/{handler-CZ-GUuYr.js → handler-BeWk8pDD.js} +1 -1
  31. package/dist/{handler-BcbiHqzs.js → handler-BgRhcxRI.js} +418 -274
  32. package/dist/handler-BgY0anAs.js +19 -0
  33. package/dist/{handler-BU60I9Tt.js → handler-BqHuBA6Q.js} +1 -1
  34. package/dist/{handler-C2MJfgeU.js → handler-CEk1hut1.js} +1 -1
  35. package/dist/{handler-DRk4qlh0.js → handler-CGV7uuUA.js} +1 -1
  36. package/dist/{handler-DBFa5_B9.js → handler-CKmHOFMG.js} +1 -1
  37. package/dist/{handler-ImeP5Thm.js → handler-ClWOGjB_.js} +455 -311
  38. package/dist/{handler-Dmw-3E9n.js → handler-PkV1nrcU.js} +1 -1
  39. package/dist/handler-dVlpopfq.js +21 -0
  40. package/dist/handler-klwfX3CY.js +21 -0
  41. package/dist/handler-mbDBRYl8.js +19 -0
  42. package/dist/index.browser.js +1 -1
  43. package/dist/index.js +1 -1
  44. package/dist/lib/ai/openai-reasoning.d.ts +1 -1
  45. package/dist/lib/ai/openai-reasoning.d.ts.map +1 -1
  46. package/dist/lib/db/schema.d.ts +29 -0
  47. package/dist/lib/db/schema.d.ts.map +1 -1
  48. package/dist/loaders/chatLoader.d.ts +1 -0
  49. package/dist/loaders/chatLoader.d.ts.map +1 -1
  50. package/dist/models/RBAgentsChatThread.d.ts +3 -0
  51. package/dist/models/RBAgentsChatThread.d.ts.map +1 -1
  52. package/dist/models/RBAgentsUsageEvent.d.ts +45 -0
  53. package/dist/models/RBAgentsUsageEvent.d.ts.map +1 -0
  54. package/dist/models/index.browser.d.ts +4 -0
  55. package/dist/models/index.browser.d.ts.map +1 -1
  56. package/dist/models/index.d.ts +34 -0
  57. package/dist/models/index.d.ts.map +1 -1
  58. package/dist/models.browser.js +35 -3
  59. package/dist/models.js +204 -4
  60. package/dist/{openai-reasoning-ARz6ZvZ_.js → openai-reasoning-CLjhz1V1.js} +1 -1
  61. package/dist/{openai-reasoning-jbPa-xup.js → openai-reasoning-kFq60GX9.js} +1 -1
  62. package/dist/pages/ChatPage.d.ts.map +1 -1
  63. package/dist/routes.browser.js +12 -11
  64. package/dist/routes.js +12 -11
  65. package/dist/runtime.d.ts +2 -2
  66. package/dist/runtime.d.ts.map +1 -1
  67. package/dist/runtime.js +1 -1
  68. package/dist/tailwind-source.js +1 -1
  69. package/package.json +1 -1
  70. package/dist/handler-B4PUL3Fm.js +0 -21
  71. package/dist/handler-DAjf6ro0.js +0 -19
  72. package/dist/handler-DN-H4zmz.js +0 -19
  73. package/dist/handler-Df8dOV-8.js +0 -21
  74. /package/dist/{handler-CxfBBYhN.js → handler-BdEE0--D.js} +0 -0
  75. /package/dist/{handler-CzHg9puj.js → handler-BdXUC9Rg.js} +0 -0
  76. /package/dist/{handler-_UsjVWVA.js → handler-D74Wi6e9.js} +0 -0
  77. /package/dist/{handler-Ct7ZyGSn.js → handler-D752oOcY.js} +0 -0
  78. /package/dist/{handler-CSLr0jTM.js → handler-hV65_Dui.js} +0 -0
  79. /package/dist/{handler-oJ8qxBLd.js → handler-jpHBMoww.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { i as e, n as t, r as n, t as r } from "./models-CF61gMjU.js";
2
- import { i, n as a, r as o, t as s } from "./openai-reasoning-jbPa-xup.js";
2
+ import { i, n as a, r as o, t as s } from "./openai-reasoning-CLjhz1V1.js";
3
3
  import * as c from "react";
4
4
  import l, { Children as u, Component as d, Fragment as f, createContext as p, createElement as m, forwardRef as h, isValidElement as g, memo as _, useCallback as v, useContext as y, useDebugValue as b, useEffect as x, useEffectEvent as S, useId as C, useImperativeHandle as w, useInsertionEffect as T, useLayoutEffect as E, useMemo as D, useRef as O, useState as k, useSyncExternalStore as A, useSyncExternalStore as j } from "react";
5
5
  import { Link as M, Outlet as N, useLocation as P, useNavigate as F, useRevalidator as I, useRouteLoaderData as L, useSearchParams as R } from "@rpcbase/router";
@@ -40150,7 +40150,10 @@ function Lg() {
40150
40150
  });
40151
40151
  }
40152
40152
  function Rg(e = "") {
40153
- let t = e.trim(), n = le("RBAgentsChatThread", { userId: t }, {
40153
+ let t = e.trim(), n = le("RBAgentsChatThread", {
40154
+ userId: t,
40155
+ deletedAt: null
40156
+ }, {
40154
40157
  ...Fg,
40155
40158
  enabled: !!t
40156
40159
  }), [r, i] = k(null), [a, o] = k(!1);
@@ -40297,7 +40300,7 @@ function Bg({ historyState: e, onActiveChatTitleChange: t }) {
40297
40300
  })] }) }) }), /* @__PURE__ */ B(gf, {
40298
40301
  onOpenChange: w,
40299
40302
  open: C,
40300
- children: /* @__PURE__ */ V(bf, { children: [/* @__PURE__ */ V(xf, { children: [/* @__PURE__ */ B(Cf, { children: "Are you absolutely sure?" }), /* @__PURE__ */ B(wf, { children: "This action cannot be undone. This will permanently delete your chat and remove it from our servers." })] }), /* @__PURE__ */ V(Sf, { children: [/* @__PURE__ */ B(Ef, { children: "Cancel" }), /* @__PURE__ */ B(Tf, {
40303
+ children: /* @__PURE__ */ V(bf, { children: [/* @__PURE__ */ V(xf, { children: [/* @__PURE__ */ B(Cf, { children: "Are you absolutely sure?" }), /* @__PURE__ */ B(wf, { children: "This action cannot be undone. This will hide the chat from your history." })] }), /* @__PURE__ */ V(Sf, { children: [/* @__PURE__ */ B(Ef, { children: "Cancel" }), /* @__PURE__ */ B(Tf, {
40301
40304
  onClick: T,
40302
40305
  children: "Continue"
40303
40306
  })] })] })
@@ -50854,7 +50857,7 @@ var GF = new TM({
50854
50857
  //#endregion
50855
50858
  //#region src/components/artifact-actions.tsx
50856
50859
  function KF({ artifact: e, handleVersionChange: t, currentVersionIndex: n, isCurrentVersion: r, mode: i, metadata: a, setMetadata: o }) {
50857
- let [s, c] = k(!1), l = bV.find((t) => t.kind === e.kind);
50860
+ let [s, c] = k(!1), l = xV.find((t) => t.kind === e.kind);
50858
50861
  if (!l) throw Error("Artifact definition not found!");
50859
50862
  let u = {
50860
50863
  content: e.content,
@@ -52944,7 +52947,7 @@ var LL = _(FL, IL), RL = ep, zL = Sd, BL = c.forwardRef(({ className: e, ...t },
52944
52947
  let { resolvedTheme: r, theme: i } = hf();
52945
52948
  return /* @__PURE__ */ B(qu, {
52946
52949
  ref: n,
52947
- className: W("agents-sdk fixed inset-0 z-50 bg-foreground/50 data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0", e),
52950
+ className: W("agents-sdk fixed inset-0 z-50 bg-foreground/50 opacity-0 transition-opacity duration-150 data-open:opacity-100 data-closed:opacity-0 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0", e),
52948
52951
  "data-agents-sdk-resolved-theme": r,
52949
52952
  "data-agents-sdk-theme": i,
52950
52953
  ...t
@@ -52969,7 +52972,7 @@ var UL = c.forwardRef(({ className: e, children: t, ...n }, r) => {
52969
52972
  let { resolvedTheme: i, theme: a } = hf();
52970
52973
  return /* @__PURE__ */ V(zL, { children: [/* @__PURE__ */ B(BL, {}), /* @__PURE__ */ V(yd, {
52971
52974
  ref: r,
52972
- className: W("agents-sdk fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 sm:rounded-lg", e),
52975
+ className: W("agents-sdk fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 opacity-0 shadow-lg transition-opacity duration-200 data-open:opacity-100 data-closed:opacity-0 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 sm:rounded-lg", e),
52973
52976
  "data-agents-sdk-resolved-theme": i,
52974
52977
  "data-agents-sdk-theme": a,
52975
52978
  ...n,
@@ -55627,35 +55630,43 @@ var XB = _(YB, (e, t) => e.chatId === t.chatId);
55627
55630
  function ZB(e, t) {
55628
55631
  document.cookie = `${e}=${encodeURIComponent(t)}; path=/; max-age=31536000`;
55629
55632
  }
55630
- var QB = (e) => e.replace(/[^a-zA-Z0-9_-]/g, "_") || "default", $B = 40, eV = 232;
55633
+ var QB = (e) => e.replace(/[^a-zA-Z0-9_-]/g, "_") || "default", $B = 40, eV = 9;
55631
55634
  function tV(e) {
55632
55635
  let t = e?.firstElementChild;
55633
55636
  return t instanceof HTMLElement ? t : null;
55634
55637
  }
55635
- function nV(e, t) {
55638
+ function nV(e) {
55639
+ let t = window.getComputedStyle(e), n = Number.parseFloat(t.lineHeight), r = Number.parseFloat(t.paddingTop), i = Number.parseFloat(t.paddingBottom), a = Number.isFinite(n) ? n : 24, o = Number.isFinite(r) ? r : 0, s = Number.isFinite(i) ? i : 0;
55640
+ return {
55641
+ minHeight: Math.max(a + o + s, $B),
55642
+ maxHeight: a * eV + o + s
55643
+ };
55644
+ }
55645
+ function rV(e, t) {
55636
55646
  if (!e) return;
55637
55647
  e.style.height = "auto";
55638
- let n = e.scrollHeight, r = Math.max(n, $B), i = Math.min(r, eV), a = tV(t.scrollArea);
55639
- if (e.style.height = `${r}px`, e.style.overflowY = "hidden", t.setScrollAreaHeight((e) => e === i ? e : i), a) {
55640
- if (r <= eV) {
55641
- a.scrollTop = 0;
55648
+ let { minHeight: n, maxHeight: r } = nV(e), i = e.scrollHeight, a = Math.max(i, n), o = Math.min(a, r), s = tV(t.scrollArea);
55649
+ if (e.style.height = `${a}px`, e.style.overflowY = "hidden", t.setScrollAreaHeight((e) => e === o ? e : o), s) {
55650
+ if (a <= r) {
55651
+ s.scrollTop = 0;
55642
55652
  return;
55643
55653
  }
55644
55654
  e.selectionEnd >= e.value.length && requestAnimationFrame(() => {
55645
- a.scrollTop = a.scrollHeight;
55655
+ s.scrollTop = s.scrollHeight;
55646
55656
  });
55647
55657
  }
55648
55658
  }
55649
- function rV(e, t) {
55659
+ function iV(e, t) {
55650
55660
  if (!e) return;
55651
- e.style.height = `${$B}px`, e.style.overflowY = "hidden", t.setScrollAreaHeight($B);
55652
- let n = tV(t.scrollArea);
55653
- n && (n.scrollTop = 0);
55661
+ let { minHeight: n } = nV(e);
55662
+ e.style.height = `${n}px`, e.style.overflowY = "hidden", t.setScrollAreaHeight(n);
55663
+ let r = tV(t.scrollArea);
55664
+ r && (r.scrollTop = 0);
55654
55665
  }
55655
- function iV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments: a, setAttachments: o, messages: c, setMessages: l, sendMessage: u, className: d, selectedModelId: f, onModelChange: p, openaiReasoningEffort: m = s, onOpenAIReasoningEffortChange: h }) {
55666
+ function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments: a, setAttachments: o, messages: c, setMessages: l, sendMessage: u, className: d, selectedModelId: f, onModelChange: p, openaiReasoningEffort: m = s, onOpenAIReasoningEffortChange: h }) {
55656
55667
  let g = O(null), _ = O(null), [y, b] = k($B), { width: S } = vM(), { getChatPath: C } = lt();
55657
55668
  x(() => {
55658
- nV(g.current, {
55669
+ rV(g.current, {
55659
55670
  scrollArea: _.current,
55660
55671
  setScrollAreaHeight: b
55661
55672
  });
@@ -55676,7 +55687,7 @@ function iV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
55676
55687
  E(t);
55677
55688
  }, [t, E]);
55678
55689
  let D = (e) => {
55679
- n(e.target.value), nV(e.currentTarget, {
55690
+ n(e.target.value), rV(e.currentTarget, {
55680
55691
  scrollArea: _.current,
55681
55692
  setScrollAreaHeight: b
55682
55693
  });
@@ -55693,7 +55704,7 @@ function iV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
55693
55704
  type: "text",
55694
55705
  text: t
55695
55706
  }]
55696
- }), o([]), E(""), n(""), rV(g.current, {
55707
+ }), o([]), E(""), n(""), iV(g.current, {
55697
55708
  scrollArea: _.current,
55698
55709
  setScrollAreaHeight: b
55699
55710
  }), S && S > 768 && g.current?.focus();
@@ -55865,18 +55876,18 @@ function iV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
55865
55876
  children: [/* @__PURE__ */ V(KB, {
55866
55877
  className: "gap-0 sm:gap-0.5",
55867
55878
  children: [
55868
- /* @__PURE__ */ B(sV, {
55879
+ /* @__PURE__ */ B(cV, {
55869
55880
  fileInputRef: A,
55870
55881
  selectedModelId: f,
55871
55882
  status: r
55872
55883
  }),
55873
- /* @__PURE__ */ B(lV, {
55884
+ /* @__PURE__ */ B(uV, {
55874
55885
  focusTargetRef: g,
55875
55886
  idScope: e,
55876
55887
  onModelChange: p,
55877
55888
  selectedModelId: f
55878
55889
  }),
55879
- /* @__PURE__ */ B(dV, {
55890
+ /* @__PURE__ */ B(fV, {
55880
55891
  disabled: r !== "ready",
55881
55892
  idScope: e,
55882
55893
  onChange: h,
@@ -55884,7 +55895,7 @@ function iV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
55884
55895
  value: m
55885
55896
  })
55886
55897
  ]
55887
- }), r === "submitted" || r === "streaming" ? /* @__PURE__ */ B(pV, {
55898
+ }), r === "submitted" || r === "streaming" ? /* @__PURE__ */ B(mV, {
55888
55899
  setMessages: l,
55889
55900
  stop: i
55890
55901
  }) : /* @__PURE__ */ B(qB, {
@@ -55900,8 +55911,8 @@ function iV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
55900
55911
  ]
55901
55912
  });
55902
55913
  }
55903
- var aV = _(iV, (e, t) => !(e.input !== t.input || e.status !== t.status || !_e(e.attachments, t.attachments) || e.selectedModelId !== t.selectedModelId || e.openaiReasoningEffort !== t.openaiReasoningEffort));
55904
- function oV({ fileInputRef: e, status: t, selectedModelId: n }) {
55914
+ var oV = _(aV, (e, t) => !(e.input !== t.input || e.status !== t.status || !_e(e.attachments, t.attachments) || e.selectedModelId !== t.selectedModelId || e.openaiReasoningEffort !== t.openaiReasoningEffort));
55915
+ function sV({ fileInputRef: e, status: t, selectedModelId: n }) {
55905
55916
  let r = n.includes("reasoning") || n.includes("think");
55906
55917
  return /* @__PURE__ */ B(lf, {
55907
55918
  className: "aspect-square h-8 rounded-lg p-1 transition-colors hover:bg-accent",
@@ -55920,8 +55931,8 @@ function oV({ fileInputRef: e, status: t, selectedModelId: n }) {
55920
55931
  })
55921
55932
  });
55922
55933
  }
55923
- var sV = _(oV);
55924
- function cV({ focusTargetRef: t, idScope: r, selectedModelId: i, onModelChange: a }) {
55934
+ var cV = _(sV);
55935
+ function lV({ focusTargetRef: t, idScope: r, selectedModelId: i, onModelChange: a }) {
55925
55936
  let [o, s] = k(!1), c = O(!1), l = QB(r), u = n.find((e) => e.id === i) ?? n.find((e) => e.id === "openai/gpt-5.4-mini") ?? n[0], [d] = u.id.split("/"), f = {
55926
55937
  anthropic: "Anthropic",
55927
55938
  openai: "OpenAI",
@@ -55965,20 +55976,21 @@ function cV({ focusTargetRef: t, idScope: r, selectedModelId: i, onModelChange:
55965
55976
  })]
55966
55977
  });
55967
55978
  }
55968
- var lV = _(cV), uV = (e, t) => t.includes(e);
55969
- function dV({ idScope: e, selectedModelId: t, value: n, onChange: r, disabled: c }) {
55970
- let l = i(t), u = o(t), d = n === "default" || uV(n, u) ? n : s, f = a(t);
55979
+ var uV = _(lV), dV = (e, t) => t.includes(e);
55980
+ function fV({ idScope: e, selectedModelId: t, value: n, onChange: r, disabled: s }) {
55981
+ let c = i(t), l = o(t), u = a(t), d = u && dV(u, l) ? u : l[0], f = dV(n, l) ? n : d ?? "default";
55971
55982
  return x(() => {
55972
- !l || !r || d === n || r(d);
55983
+ !c || !r || dV(n, l) || r(d ?? "default");
55973
55984
  }, [
55974
- r,
55975
- d,
55976
55985
  l,
55986
+ d,
55987
+ r,
55988
+ c,
55977
55989
  n
55978
- ]), !l || !r ? null : /* @__PURE__ */ V(DB, {
55979
- disabled: c,
55990
+ ]), !c || !r || f === "default" ? null : /* @__PURE__ */ V(DB, {
55991
+ disabled: s,
55980
55992
  onValueChange: (e) => r(e),
55981
- value: d,
55993
+ value: f,
55982
55994
  children: [/* @__PURE__ */ B(kB, {
55983
55995
  className: "h-8 w-[180px] gap-1 border-0 bg-transparent px-2 text-xs hover:bg-accent focus:ring-0 focus:ring-offset-0",
55984
55996
  id: `agents-sdk-reasoning-effort-${QB(e)}`,
@@ -55989,16 +56001,13 @@ function dV({ idScope: e, selectedModelId: t, value: n, onChange: r, disabled: c
55989
56001
  children: /* @__PURE__ */ B(OB, { placeholder: "Reasoning" })
55990
56002
  })]
55991
56003
  })
55992
- }), /* @__PURE__ */ V(MB, { children: [/* @__PURE__ */ B(PB, {
55993
- value: s,
55994
- children: /* @__PURE__ */ B("span", { children: f ? `Reasoning: Default (${f})` : "Reasoning: Default" })
55995
- }), u.map((e) => /* @__PURE__ */ B(PB, {
56004
+ }), /* @__PURE__ */ B(MB, { children: l.map((e) => /* @__PURE__ */ B(PB, {
55996
56005
  value: e,
55997
56006
  children: /* @__PURE__ */ B("span", { children: `Reasoning: ${e}` })
55998
- }, e))] })]
56007
+ }, e)) })]
55999
56008
  });
56000
56009
  }
56001
- function fV({ stop: e, setMessages: t }) {
56010
+ function pV({ stop: e, setMessages: t }) {
56002
56011
  return /* @__PURE__ */ B(lf, {
56003
56012
  className: "size-8 rounded-full bg-primary p-1 text-primary-foreground transition-colors duration-200 hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground",
56004
56013
  "data-testid": "stop-button",
@@ -56008,7 +56017,7 @@ function fV({ stop: e, setMessages: t }) {
56008
56017
  children: /* @__PURE__ */ B(bt, { size: 14 })
56009
56018
  });
56010
56019
  }
56011
- var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedTool: r, isToolbarVisible: i, setIsToolbarVisible: a, isAnimating: o, sendMessage: s, onClick: c }) => {
56020
+ var mV = _(pV), hV = ({ description: e, icon: t, selectedTool: n, setSelectedTool: r, isToolbarVisible: i, setIsToolbarVisible: a, isAnimating: o, sendMessage: s, onClick: c }) => {
56012
56021
  let [l, u] = k(!1);
56013
56022
  x(() => {
56014
56023
  n !== e && u(!1);
@@ -56066,14 +56075,14 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56066
56075
  children: e
56067
56076
  })]
56068
56077
  });
56069
- }, hV = [...[
56078
+ }, gV = [...[
56070
56079
  ,
56071
56080
  ,
56072
56081
  ,
56073
56082
  ,
56074
56083
  ,
56075
56084
  ,
56076
- ]].map((e) => Ye(5)), gV = ({ setSelectedTool: e, sendMessage: t, isAnimating: n }) => {
56085
+ ]].map((e) => Ye(5)), _V = ({ setSelectedTool: e, sendMessage: t, isAnimating: n }) => {
56077
56086
  let r = [
56078
56087
  "Elementary",
56079
56088
  "Middle School",
@@ -56089,7 +56098,7 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56089
56098
  return () => e();
56090
56099
  }, [a]), /* @__PURE__ */ V("div", {
56091
56100
  className: "relative flex flex-col items-center justify-end",
56092
- children: [hV.map((e) => /* @__PURE__ */ B(Dj.div, {
56101
+ children: [gV.map((e) => /* @__PURE__ */ B(Dj.div, {
56093
56102
  animate: { opacity: 1 },
56094
56103
  className: "flex size-[40px] flex-row items-center justify-center",
56095
56104
  exit: { opacity: 0 },
@@ -56141,7 +56150,7 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56141
56150
  })]
56142
56151
  }) })]
56143
56152
  });
56144
- }, _V = ({ isToolbarVisible: e, selectedTool: t, setSelectedTool: n, sendMessage: r, isAnimating: i, setIsToolbarVisible: a, tools: o }) => {
56153
+ }, vV = ({ isToolbarVisible: e, selectedTool: t, setSelectedTool: n, sendMessage: r, isAnimating: i, setIsToolbarVisible: a, tools: o }) => {
56145
56154
  let [s, ...c] = o;
56146
56155
  return /* @__PURE__ */ V(Dj.div, {
56147
56156
  animate: {
@@ -56157,7 +56166,7 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56157
56166
  opacity: 0,
56158
56167
  scale: .95
56159
56168
  },
56160
- children: [/* @__PURE__ */ B(Pk, { children: e && c.map((e) => /* @__PURE__ */ B(mV, {
56169
+ children: [/* @__PURE__ */ B(Pk, { children: e && c.map((e) => /* @__PURE__ */ B(hV, {
56161
56170
  description: e.description,
56162
56171
  icon: e.icon,
56163
56172
  isAnimating: i,
@@ -56165,7 +56174,7 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56165
56174
  selectedTool: t,
56166
56175
  sendMessage: r,
56167
56176
  setSelectedTool: n
56168
- }, e.description)) }), /* @__PURE__ */ B(mV, {
56177
+ }, e.description)) }), /* @__PURE__ */ B(hV, {
56169
56178
  description: s.description,
56170
56179
  icon: s.icon,
56171
56180
  isAnimating: i,
@@ -56177,7 +56186,7 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56177
56186
  setSelectedTool: n
56178
56187
  })]
56179
56188
  });
56180
- }, vV = _(({ isToolbarVisible: e, setIsToolbarVisible: t, sendMessage: n, status: r, stop: i, setMessages: a, artifactKind: o }) => {
56189
+ }, yV = _(({ isToolbarVisible: e, setIsToolbarVisible: t, sendMessage: n, status: r, stop: i, setMessages: a, artifactKind: o }) => {
56181
56190
  let s = O(null), c = O(null), [l, u] = k(null), [d, f] = k(!1);
56182
56191
  gM(s, () => {
56183
56192
  t(!1), u(null);
@@ -56194,7 +56203,7 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56194
56203
  }, []), x(() => {
56195
56204
  r === "streaming" && t(!1);
56196
56205
  }, [r, t]);
56197
- let h = bV.find((e) => e.kind === o);
56206
+ let h = xV.find((e) => e.kind === o);
56198
56207
  if (!h) throw Error("Artifact definition not found!");
56199
56208
  let g = h.toolbar;
56200
56209
  return g.length === 0 ? null : /* @__PURE__ */ B(mm, {
@@ -56256,11 +56265,11 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56256
56265
  i(), a((e) => e);
56257
56266
  },
56258
56267
  children: /* @__PURE__ */ B(bt, {})
56259
- }, "stop-icon") : l === "adjust-reading-level" ? /* @__PURE__ */ B(gV, {
56268
+ }, "stop-icon") : l === "adjust-reading-level" ? /* @__PURE__ */ B(_V, {
56260
56269
  isAnimating: d,
56261
56270
  sendMessage: n,
56262
56271
  setSelectedTool: u
56263
- }, "reading-level-selector") : /* @__PURE__ */ B(_V, {
56272
+ }, "reading-level-selector") : /* @__PURE__ */ B(vV, {
56264
56273
  isAnimating: d,
56265
56274
  isToolbarVisible: e,
56266
56275
  selectedTool: l,
@@ -56271,7 +56280,7 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56271
56280
  }, "tools")
56272
56281
  })
56273
56282
  });
56274
- }, (e, t) => !(e.status !== t.status || e.isToolbarVisible !== t.isToolbarVisible || e.artifactKind !== t.artifactKind)), yV = ({ handleVersionChange: e, documents: t, currentVersionIndex: n }) => {
56283
+ }, (e, t) => !(e.status !== t.status || e.isToolbarVisible !== t.isToolbarVisible || e.artifactKind !== t.artifactKind)), bV = ({ handleVersionChange: e, documents: t, currentVersionIndex: n }) => {
56275
56284
  let { artifact: r } = Xy(), { width: i } = vM(), a = i < 768, { mutate: o } = $_(), [s, c] = k(!1);
56276
56285
  if (t) return /* @__PURE__ */ V(Dj.div, {
56277
56286
  animate: { y: 0 },
@@ -56306,13 +56315,13 @@ var pV = _(fV), mV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
56306
56315
  })]
56307
56316
  })]
56308
56317
  });
56309
- }, bV = [
56318
+ }, xV = [
56310
56319
  GF,
56311
56320
  OM,
56312
56321
  AM,
56313
56322
  XP
56314
56323
  ];
56315
- function xV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, status: i, stop: a, attachments: o, setAttachments: s, sendMessage: c, messages: l, setMessages: u, regenerate: d, votes: f, isReadonly: p, selectedModelId: m }) {
56324
+ function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, status: i, stop: a, attachments: o, setAttachments: s, sendMessage: c, messages: l, setMessages: u, regenerate: d, votes: f, isReadonly: p, selectedModelId: m }) {
56316
56325
  let { artifact: h, setArtifact: g, metadata: _, setMetadata: y } = Xy(), { data: b, isLoading: S, mutate: C } = gv(h.documentId !== "init" && h.status !== "streaming" ? `/api/rb/agents/document?id=${h.documentId}` : null, ef), [w, T] = k("edit"), [E, D] = k(null), [O, A] = k(-1);
56317
56326
  x(() => {
56318
56327
  if (b && b.length > 0) {
@@ -56360,7 +56369,7 @@ function xV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
56360
56369
  }
56361
56370
  let R = (e) => {
56362
56371
  b && (e === "latest" && (A(b.length - 1), T("edit")), e === "toggle" && T((e) => e === "edit" ? "diff" : "edit"), e === "prev" ? O > 0 && A((e) => e - 1) : e === "next" && O < b.length - 1 && A((e) => e + 1));
56363
- }, [z, ee] = k(!1), te = b && b.length > 0 ? O === b.length - 1 : !0, ne = ym(), re = bV.find((e) => e.kind === h.kind);
56372
+ }, [z, ee] = k(!1), te = b && b.length > 0 ? O === b.length - 1 : !0, ne = ym(), re = xV.find((e) => e.kind === h.kind);
56364
56373
  if (!re) throw Error("Artifact definition not found!");
56365
56374
  return x(() => {
56366
56375
  h.documentId !== "init" && re.initialize && re.initialize({
@@ -56423,7 +56432,7 @@ function xV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
56423
56432
  votes: f
56424
56433
  }), /* @__PURE__ */ B("div", {
56425
56434
  className: "relative flex w-full flex-row items-end gap-2 px-4 pb-4",
56426
- children: /* @__PURE__ */ B(aV, {
56435
+ children: /* @__PURE__ */ B(oV, {
56427
56436
  attachments: o,
56428
56437
  chatId: t,
56429
56438
  className: "bg-background dark:bg-muted",
@@ -56519,7 +56528,7 @@ function xV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
56519
56528
  status: h.status,
56520
56529
  suggestions: [],
56521
56530
  title: h.title
56522
- }), /* @__PURE__ */ B(Pk, { children: te && /* @__PURE__ */ B(vV, {
56531
+ }), /* @__PURE__ */ B(Pk, { children: te && /* @__PURE__ */ B(yV, {
56523
56532
  artifactKind: h.kind,
56524
56533
  isToolbarVisible: z,
56525
56534
  sendMessage: c,
@@ -56529,7 +56538,7 @@ function xV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
56529
56538
  stop: a
56530
56539
  }) })]
56531
56540
  }),
56532
- /* @__PURE__ */ B(Pk, { children: !te && /* @__PURE__ */ B(yV, {
56541
+ /* @__PURE__ */ B(Pk, { children: !te && /* @__PURE__ */ B(bV, {
56533
56542
  currentVersionIndex: O,
56534
56543
  documents: b,
56535
56544
  handleVersionChange: R
@@ -56538,7 +56547,7 @@ function xV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
56538
56547
  })]
56539
56548
  }) });
56540
56549
  }
56541
- var SV = _(xV, (e, t) => !(e.status !== t.status || !_e(e.votes, t.votes) || e.input !== t.input || !_e(e.messages, t.messages.length))), CV = () => /* @__PURE__ */ V("div", {
56550
+ var CV = _(SV, (e, t) => !(e.status !== t.status || !_e(e.votes, t.votes) || e.input !== t.input || !_e(e.messages, t.messages.length))), wV = () => /* @__PURE__ */ V("div", {
56542
56551
  className: "mx-auto mt-4 flex size-full max-w-3xl flex-col justify-center px-4 md:mt-16 md:px-8",
56543
56552
  children: [/* @__PURE__ */ B(Dj.div, {
56544
56553
  animate: {
@@ -56576,7 +56585,7 @@ var SV = _(xV, (e, t) => !(e.status !== t.status || !_e(e.votes, t.votes) || e.i
56576
56585
  }, "overview");
56577
56586
  //#endregion
56578
56587
  //#region src/components/messages.tsx
56579
- function wV({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i, setMessages: a, regenerate: o, isReadonly: s, selectedModelId: c }) {
56588
+ function TV({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i, setMessages: a, regenerate: o, isReadonly: s, selectedModelId: c }) {
56580
56589
  let l = i.at(-1), u = (e) => e === "dynamic-tool" || e.startsWith("tool-"), d = l?.role === "assistant" && (l.parts?.some((e) => e.type === "text" ? !!e.text?.trim() : e.type === "reasoning" ? kL(e) : !!u(e.type)) ?? !1), f = n === "submitted" || n === "streaming" && l?.role === "assistant" && !d, p = n === "streaming" && l?.role === "assistant" && !d, { containerRef: m, endRef: h, isAtBottom: g, scrollToBottom: _, hasSentMessage: v } = ZF({ status: n });
56581
56590
  return mt(), /* @__PURE__ */ V("div", {
56582
56591
  className: "relative flex-1",
@@ -56586,7 +56595,7 @@ function wV({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messag
56586
56595
  children: /* @__PURE__ */ V("div", {
56587
56596
  className: "mx-auto flex min-w-0 max-w-4xl flex-col gap-4 px-2 pt-[60px] pb-4 md:gap-6 md:px-4",
56588
56597
  children: [
56589
- i.length === 0 && /* @__PURE__ */ B(CV, {}),
56598
+ i.length === 0 && /* @__PURE__ */ B(wV, {}),
56590
56599
  i.map((c, l) => p && l === i.length - 1 && c.role === "assistant" ? null : /* @__PURE__ */ B(NL, {
56591
56600
  addToolApprovalResponse: e,
56592
56601
  chatId: t,
@@ -56614,15 +56623,17 @@ function wV({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messag
56614
56623
  })]
56615
56624
  });
56616
56625
  }
56617
- var TV = wV, EV = (e) => e?.parts?.some((e) => {
56626
+ var EV = TV, DV = (e) => e?.parts?.some((e) => {
56618
56627
  let t = e.state;
56619
56628
  return t === "approval-responded" || t === "output-denied";
56620
- }) ?? !1, DV = (e) => `agents-sdk:chat:${e}:stream`, OV = (e) => !!(e && typeof e == "object" && !Array.isArray(e));
56621
- function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, autoResume: c }) {
56622
- let { setDataStream: l } = mt(), { getChatPath: u } = lt(), d = t.has(a) ? a : r, [f, p] = k(""), [m, h] = k(d), g = O(m), [_, v] = k(s), y = O(_);
56629
+ }) ?? !1, OV = (e) => `agents-sdk:chat:${e}:stream`, kV = (e) => !!(e && typeof e == "object" && !Array.isArray(e)), AV = (e) => a(e) ?? "default";
56630
+ function jV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, autoResume: s }) {
56631
+ let { setDataStream: c } = mt(), { getChatPath: l } = lt(), u = t.has(a) ? a : r, d = AV(u), [f, p] = k(""), [m, h] = k(u), g = O(m), [_, v] = k(d), y = O(_);
56623
56632
  x(() => {
56624
56633
  g.current = m;
56625
56634
  }, [m]), x(() => {
56635
+ h(u), v(AV(u));
56636
+ }, [e, u]), x(() => {
56626
56637
  y.current = _;
56627
56638
  }, [_]);
56628
56639
  let { messages: b, setMessages: S, sendMessage: C, status: w, stop: T, regenerate: E, resumeStream: D, addToolApprovalResponse: A } = qy({
@@ -56635,15 +56646,15 @@ function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
56635
56646
  api: "/api/rb/agents/chat",
56636
56647
  fetch: tf,
56637
56648
  prepareSendMessagesRequest(e) {
56638
- let t = e.messages.at(-1), n = e.messages.at(-2), r = Zd(e.headers, Yd()), a = t?.role !== "user" || t?.role === "user" && EV(n);
56649
+ let t = g.current, n = y.current, r = e.messages.at(-1), a = e.messages.at(-2), o = Zd(e.headers, Yd()), s = r?.role !== "user" || r?.role === "user" && DV(a);
56639
56650
  return {
56640
- ...r ? { headers: r } : {},
56651
+ ...o ? { headers: o } : {},
56641
56652
  body: {
56642
56653
  id: e.id,
56643
- ...a ? { messages: e.messages } : { message: t },
56644
- selectedChatModel: g.current,
56645
- ...i(g.current) && y.current !== "default" ? {
56646
- openaiReasoningEffort: y.current,
56654
+ ...s ? { messages: e.messages } : { message: r },
56655
+ selectedChatModel: t,
56656
+ ...i(t) && n !== "default" ? {
56657
+ openaiReasoningEffort: n,
56647
56658
  openaiReasoningSummary: "detailed"
56648
56659
  } : {},
56649
56660
  ...e.body
@@ -56656,7 +56667,7 @@ function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
56656
56667
  }
56657
56668
  }),
56658
56669
  onData: (e) => {
56659
- l((t) => t ? [...t, e] : []);
56670
+ c((t) => t ? [...t, e] : []);
56660
56671
  },
56661
56672
  onError: (e) => {
56662
56673
  if (e instanceof Vd) {
@@ -56670,17 +56681,17 @@ function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
56670
56681
  se.error("Something went wrong. Please try again.");
56671
56682
  }
56672
56683
  }), j = O(null), M = O("");
56673
- x(() => ce(DV(e), (t) => {
56674
- if (!OV(t) || t.chatId !== e) return;
56684
+ x(() => ce(OV(e), (t) => {
56685
+ if (!kV(t) || t.chatId !== e) return;
56675
56686
  let n = t.message;
56676
- if (OV(n)) {
56687
+ if (kV(n)) {
56677
56688
  let e = typeof n.id == "string" ? n.id : null, t = typeof n.role == "string" ? n.role : null, r = Array.isArray(n.parts) ? n.parts : null;
56678
56689
  if (e && t && r) {
56679
56690
  let i = {
56680
56691
  id: e,
56681
56692
  role: t,
56682
56693
  parts: r,
56683
- metadata: OV(n.metadata) ? n.metadata : { createdAt: (/* @__PURE__ */ new Date()).toISOString() }
56694
+ metadata: kV(n.metadata) ? n.metadata : { createdAt: (/* @__PURE__ */ new Date()).toISOString() }
56684
56695
  };
56685
56696
  S((t) => {
56686
56697
  let n = t.findIndex((t) => t.id === e);
@@ -56693,12 +56704,12 @@ function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
56693
56704
  return;
56694
56705
  }
56695
56706
  let r = t.part;
56696
- if (!OV(r)) return;
56707
+ if (!kV(r)) return;
56697
56708
  if (r.type === "start" && typeof r.messageId == "string") {
56698
56709
  j.current = r.messageId, M.current = "";
56699
56710
  return;
56700
56711
  }
56701
- if (typeof r.type == "string" && r.type.startsWith("data-") && l((e) => e ? [...e, r] : []), r.type !== "text-delta" || typeof r.delta != "string") return;
56712
+ if (typeof r.type == "string" && r.type.startsWith("data-") && c((e) => e ? [...e, r] : []), r.type !== "text-delta" || typeof r.delta != "string") return;
56702
56713
  let i = j.current;
56703
56714
  if (!i) return;
56704
56715
  M.current += r.delta;
@@ -56717,7 +56728,7 @@ function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
56717
56728
  });
56718
56729
  }), [
56719
56730
  e,
56720
- l,
56731
+ c,
56721
56732
  S
56722
56733
  ]);
56723
56734
  let [N] = R(), P = N.get("query"), [F, I] = k(!1);
@@ -56733,18 +56744,18 @@ function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
56733
56744
  let t = new URLSearchParams(window.location.search);
56734
56745
  t.delete("query");
56735
56746
  let n = t.toString();
56736
- window.history.replaceState({}, "", `${u(e)}${n ? `?${n}` : ""}`);
56747
+ window.history.replaceState({}, "", `${l(e)}${n ? `?${n}` : ""}`);
56737
56748
  }
56738
56749
  }, [
56739
56750
  P,
56740
56751
  C,
56741
56752
  F,
56742
56753
  e,
56743
- u
56754
+ l
56744
56755
  ]);
56745
56756
  let { data: L } = gv(b.length >= 2 ? `/api/rb/agents/vote?chatId=${e}` : null, ef), [z, ee] = k([]), H = Yy((e) => e.isVisible);
56746
56757
  return Zy({
56747
- autoResume: c,
56758
+ autoResume: s,
56748
56759
  initialMessages: n,
56749
56760
  resumeStream: D,
56750
56761
  setMessages: S
@@ -56752,25 +56763,27 @@ function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
56752
56763
  className: "relative flex h-full min-h-0 min-w-0 overflow-hidden bg-background",
56753
56764
  children: [/* @__PURE__ */ V("div", {
56754
56765
  className: "overscroll-behavior-contain flex h-full min-h-0 min-w-0 flex-1 touch-pan-y flex-col bg-background",
56755
- children: [/* @__PURE__ */ B(TV, {
56766
+ children: [/* @__PURE__ */ B(EV, {
56756
56767
  addToolApprovalResponse: A,
56757
56768
  chatId: e,
56758
56769
  isArtifactVisible: H,
56759
56770
  isReadonly: o,
56760
56771
  messages: b,
56761
56772
  regenerate: E,
56762
- selectedModelId: d,
56773
+ selectedModelId: u,
56763
56774
  setMessages: S,
56764
56775
  status: w,
56765
56776
  votes: L
56766
56777
  }), /* @__PURE__ */ B("div", {
56767
56778
  className: "sticky bottom-0 z-1 mx-auto flex w-full max-w-4xl gap-2 border-t-0 bg-background px-2 pb-3 md:px-4 md:pb-4",
56768
- children: !o && /* @__PURE__ */ B(aV, {
56779
+ children: !o && /* @__PURE__ */ B(oV, {
56769
56780
  attachments: z,
56770
56781
  chatId: e,
56771
56782
  input: f,
56772
56783
  messages: b,
56773
- onModelChange: h,
56784
+ onModelChange: (e) => {
56785
+ h(e), v(AV(e));
56786
+ },
56774
56787
  onOpenAIReasoningEffortChange: v,
56775
56788
  openaiReasoningEffort: _,
56776
56789
  selectedModelId: m,
@@ -56782,7 +56795,7 @@ function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
56782
56795
  stop: T
56783
56796
  })
56784
56797
  })]
56785
- }), /* @__PURE__ */ B(SV, {
56798
+ }), /* @__PURE__ */ B(CV, {
56786
56799
  addToolApprovalResponse: A,
56787
56800
  attachments: z,
56788
56801
  chatId: e,
@@ -56803,7 +56816,7 @@ function kV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
56803
56816
  }
56804
56817
  //#endregion
56805
56818
  //#region src/components/data-stream-handler.tsx
56806
- function AV() {
56819
+ function MV() {
56807
56820
  let { dataStream: e, setDataStream: t } = mt(), { artifact: n, setArtifact: r, setMetadata: i } = Xy();
56808
56821
  return x(() => {
56809
56822
  if (!e?.length) return;
@@ -56811,7 +56824,7 @@ function AV() {
56811
56824
  t([]);
56812
56825
  for (let e of a) {
56813
56826
  if (e.type === "data-chat-title") continue;
56814
- let t = bV.find((e) => e.kind === n.kind);
56827
+ let t = xV.find((e) => e.kind === n.kind);
56815
56828
  t?.onStreamPart && t.onStreamPart({
56816
56829
  streamPart: e,
56817
56830
  setArtifact: r,
@@ -56859,4 +56872,4 @@ function AV() {
56859
56872
  ]), null;
56860
56873
  }
56861
56874
  //#endregion
56862
- export { zg as a, Xd as c, ct as d, dt as f, rt as g, lt as h, Kg as i, Jd as l, G as m, kV as n, of as o, ut as p, Ug as r, Yd as s, AV as t, pt as u };
56875
+ export { zg as a, Xd as c, ct as d, dt as f, rt as g, lt as h, Kg as i, Jd as l, G as m, jV as n, of as o, ut as p, Ug as r, Yd as s, MV as t, pt as u };
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./apiErrors-mOJbPi7h.js";
2
- import { m as t, r as n, s as r } from "./chatDb-hVHCr0j0.js";
2
+ import { m as t, r as n, s as r } from "./chatDb-DfmUbQT2.js";
3
3
  import { z as i } from "zod";
4
4
  //#region src/api/document/index.ts
5
5
  var a = "/api/rb/agents/document";
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./apiErrors-CFUx-UrE.js";
2
- import { d as t, y as n } from "./chatDb-CpCFaAxK.js";
2
+ import { d as t, x as n } from "./chatDb-CcAjAGX7.js";
3
3
  import { z as r } from "zod";
4
4
  //#region src/api/vote/index.ts
5
5
  var i = "/api/rb/agents/vote";
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./apiErrors-CFUx-UrE.js";
2
- import { u as t } from "./chatDb-CpCFaAxK.js";
2
+ import { u as t } from "./chatDb-CcAjAGX7.js";
3
3
  import { z as n } from "zod";
4
4
  //#region src/api/suggestions/index.ts
5
5
  var r = "/api/rb/agents/suggestions";
@@ -0,0 +1,21 @@
1
+ import { t as e } from "./apiErrors-mOJbPi7h.js";
2
+ import { a as t, c as n, i as r } from "./chatDb-DfmUbQT2.js";
3
+ import { z as i } from "zod";
4
+ //#region src/api/chat/messages/trailing/index.ts
5
+ var a = "/api/rb/agents/chat/messages/trailing";
6
+ i.object({ id: i.string() }), i.any();
7
+ //#endregion
8
+ //#region src/api/chat/messages/trailing/handler.ts
9
+ var o = async (i, a) => {
10
+ let o = i?.id;
11
+ if (typeof o != "string" || o.trim() === "") return e(a, "bad_request:api", "Parameter id is required.");
12
+ let s = await n(a, o.trim());
13
+ return s ? await t(a, s.chatId) ? (await r(a, {
14
+ chatId: s.chatId,
15
+ timestamp: s.createdAt
16
+ }), { ok: !0 }) : e(a, "not_found:chat") : e(a, "not_found:chat", "Message not found.");
17
+ }, s = (e) => {
18
+ e.post(a, o);
19
+ };
20
+ //#endregion
21
+ export { s as default };
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./chatCtx-BsPi6PAE.js";
2
2
  import { t } from "./apiErrors-mOJbPi7h.js";
3
- import { o as n, t as r } from "./chatDb-hVHCr0j0.js";
3
+ import { o as n, t as r } from "./chatDb-DfmUbQT2.js";
4
4
  import { z as i } from "zod";
5
5
  //#region src/api/history/index.ts
6
6
  var a = "/api/rb/agents/history";