@opentiny/tiny-robot-chat 0.5.2-alpha.8 → 0.5.2-alpha.9

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.
package/dist/index.js CHANGED
@@ -1,84 +1,84 @@
1
- import { defineComponent as J, shallowRef as q, computed as h, watch as ue, onUnmounted as Ne, openBlock as I, createBlock as W, unref as y, createCommentVNode as B, ref as me, toValue as G, createElementBlock as F, createElementVNode as V, resolveDynamicComponent as Ce, normalizeClass as X, createVNode as U, renderSlot as k, toDisplayString as Q, createTextVNode as Ie, mergeProps as N, Fragment as Ae, renderList as Qe, withCtx as E, createSlots as z, normalizeProps as D, guardReactiveProps as j, h as be, nextTick as He, useSlots as Xe, watchEffect as xe, reactive as _e } from "vue";
2
- import { useScroll as et, useEventListener as tt, useResizeObserver as ot, useMutationObserver as nt, useBreakpoints as st, useWindowSize as at } from "@vueuse/core";
3
- import { TrIconButton as ae, TrHistory as lt, TrMcpServerPicker as rt, TrDropdownMenu as it, TrSender as dt, TrLayout as ge, BubbleRenderers as ut, useAutoScroll as ct, TrWelcome as Te, TrPrompts as Me, TrBubbleProvider as ft, TrBubbleList as vt } from "@opentiny/tiny-robot";
4
- import { IconArrowDown as mt, IconAi as le, IconCollapseLeft as he, IconNewSession as pe, IconCollapseRight as Ve, IconPlugin as bt, IconSearch as gt, IconThink as ht, IconAtom as pt, IconUser as yt, IconClose as Ct } from "@opentiny/tiny-robot-svgs";
5
- import { sseStreamToGenerator as At, toolPlugin as wt, useConversation as St } from "@opentiny/tiny-robot-kit";
6
- import { Client as kt } from "@modelcontextprotocol/sdk/client";
7
- import { StreamableHTTPClientTransport as Et } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
8
- const Ot = /* @__PURE__ */ J({
1
+ import { defineComponent as Z, shallowRef as K, computed as h, watch as ue, onUnmounted as tt, openBlock as P, createBlock as W, unref as p, createCommentVNode as U, ref as ge, toValue as z, createElementBlock as F, createElementVNode as B, resolveDynamicComponent as we, normalizeClass as _, createVNode as D, renderSlot as C, toDisplayString as H, createTextVNode as Be, mergeProps as N, Fragment as Se, renderList as nt, withCtx as S, createSlots as J, normalizeProps as q, guardReactiveProps as j, h as he, nextTick as ot, useSlots as st, watchEffect as at, reactive as lt } from "vue";
2
+ import { useScroll as rt, useEventListener as it, useResizeObserver as dt, useMutationObserver as ut, useBreakpoints as ct, useWindowSize as ft } from "@vueuse/core";
3
+ import { TrIconButton as ae, TrHistory as vt, TrDropdownMenu as mt, TrSender as bt, TrLayout as pe, BubbleRenderers as gt, useAutoScroll as ht, TrWelcome as Pe, TrPrompts as Le, TrBubbleProvider as pt, TrBubbleList as yt, TrMcpServerPicker as At } from "@opentiny/tiny-robot";
4
+ import { IconArrowDown as Ct, IconAi as le, IconCollapseLeft as ye, IconNewSession as Ae, IconCollapseRight as Ue, IconPlugin as wt, IconSearch as St, IconThink as kt, IconAtom as Et, IconUser as Ot, IconClose as Rt } from "@opentiny/tiny-robot-svgs";
5
+ import { sseStreamToGenerator as Tt, toolPlugin as Mt, useConversation as Pt } from "@opentiny/tiny-robot-kit";
6
+ import { Client as Lt } from "@modelcontextprotocol/sdk/client";
7
+ import { StreamableHTTPClientTransport as $t } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
8
+ const It = /* @__PURE__ */ Z({
9
9
  __name: "ScrollToBottom",
10
10
  props: {
11
11
  target: {}
12
12
  },
13
13
  setup(e) {
14
- const t = e, n = q(0), { y: o, measure: u } = et(() => t.target, {
14
+ const t = e, o = K(0), { y: n, measure: c } = rt(() => t.target, {
15
15
  behavior: "smooth",
16
16
  observe: !0
17
- }), m = h(() => n.value > 80);
18
- function d() {
19
- const A = t.target;
20
- n.value = A ? A.scrollHeight - A.clientHeight - A.scrollTop : 0;
17
+ }), v = h(() => o.value > 80);
18
+ function b() {
19
+ const y = t.target;
20
+ o.value = y ? y.scrollHeight - y.clientHeight - y.scrollTop : 0;
21
21
  }
22
22
  let a;
23
- function l() {
23
+ function r() {
24
24
  a === void 0 && (a = requestAnimationFrame(() => {
25
- a = void 0, d();
25
+ a = void 0, b();
26
26
  }));
27
27
  }
28
- tt(() => t.target, "scroll", l), ot(() => t.target, l), nt(() => t.target, l, { childList: !0, subtree: !0 }), ue(
28
+ it(() => t.target, "scroll", r), dt(() => t.target, r), ut(() => t.target, r, { childList: !0, subtree: !0 }), ue(
29
29
  () => t.target,
30
- () => l(),
30
+ () => r(),
31
31
  { immediate: !0 }
32
- ), Ne(() => {
32
+ ), tt(() => {
33
33
  a !== void 0 && cancelAnimationFrame(a);
34
34
  });
35
- function b() {
36
- var A;
37
- u(), o.value = ((A = t.target) == null ? void 0 : A.scrollHeight) ?? 0;
35
+ function u() {
36
+ var y;
37
+ c(), n.value = ((y = t.target) == null ? void 0 : y.scrollHeight) ?? 0;
38
38
  }
39
- return (A, c) => m.value ? (I(), W(y(ae), {
39
+ return (y, f) => v.value ? (P(), W(p(ae), {
40
40
  key: 0,
41
41
  class: "tr-chat-scroll-to-bottom",
42
- icon: y(mt),
42
+ icon: p(Ct),
43
43
  rounded: "",
44
44
  size: "36",
45
45
  "svg-size": "18",
46
46
  type: "button",
47
47
  "aria-label": "滚动到底部",
48
- onClick: b
49
- }, null, 8, ["icon"])) : B("", !0);
48
+ onClick: u
49
+ }, null, 8, ["icon"])) : U("", !0);
50
50
  }
51
51
  }), Y = (e, t) => {
52
- const n = e.__vccOpts || e;
53
- for (const [o, u] of t)
54
- n[o] = u;
55
- return n;
56
- }, Tt = /* @__PURE__ */ Y(Ot, [["__scopeId", "data-v-ab8c6a28"]]);
57
- function Mt(e) {
58
- const t = me([]), n = /* @__PURE__ */ new Map();
52
+ const o = e.__vccOpts || e;
53
+ for (const [n, c] of t)
54
+ o[n] = c;
55
+ return o;
56
+ }, Vt = /* @__PURE__ */ Y(It, [["__scopeId", "data-v-ab8c6a28"]]);
57
+ function Bt(e) {
58
+ const t = ge([]), o = /* @__PURE__ */ new Map();
59
59
  return ue(
60
- () => [G(e.conversations), G(e.defaultTitle)],
61
- ([o, u]) => {
62
- const m = /* @__PURE__ */ new Set(), d = [];
63
- for (const a of o ?? []) {
64
- m.add(a.id);
65
- const b = n.get(a.id) ?? { id: a.id, title: a.title || u, raw: a };
66
- for (const A of Object.keys(b))
67
- A !== "raw" && !(A in a) && delete b[A];
68
- Object.assign(b, a, {
60
+ () => [z(e.conversations), z(e.defaultTitle)],
61
+ ([n, c]) => {
62
+ const v = /* @__PURE__ */ new Set(), b = [];
63
+ for (const a of n ?? []) {
64
+ v.add(a.id);
65
+ const u = o.get(a.id) ?? { id: a.id, title: a.title || c, raw: a };
66
+ for (const y of Object.keys(u))
67
+ y !== "raw" && !(y in a) && delete u[y];
68
+ Object.assign(u, a, {
69
69
  id: a.id,
70
- title: a.title || u,
70
+ title: a.title || c,
71
71
  raw: a
72
- }), n.set(a.id, b), d.push(b);
72
+ }), o.set(a.id, u), b.push(u);
73
73
  }
74
- for (const a of n.keys())
75
- m.has(a) || n.delete(a);
76
- t.value = d;
74
+ for (const a of o.keys())
75
+ v.has(a) || o.delete(a);
76
+ t.value = b;
77
77
  },
78
78
  { immediate: !0, deep: !0 }
79
79
  ), t;
80
80
  }
81
- const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "chat-left-aside-brand" }, It = { class: "chat-left-aside-brand__title" }, Vt = { class: "chat-left-aside-action__label" }, Pt = /* @__PURE__ */ J({
81
+ const Ut = { class: "chat-left-aside" }, Ft = ["aria-label"], Wt = { class: "chat-left-aside-brand" }, Dt = { class: "chat-left-aside-brand__title" }, qt = { class: "chat-left-aside-action__label" }, Kt = /* @__PURE__ */ Z({
82
82
  __name: "ChatLeftAside",
83
83
  props: {
84
84
  conversation: {},
@@ -91,232 +91,157 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
91
91
  },
92
92
  emits: ["createConversation", "switchConversation", "renameConversation", "deleteConversation", "historyAction", "open", "close", "toggle"],
93
93
  setup(e, { emit: t }) {
94
- const n = e, o = t, u = Mt({
95
- conversations: () => n.conversation.items,
96
- defaultTitle: () => n.labels.newConversationTitle
97
- }), m = h(() => {
98
- const { menuItems: r, ...i } = n.history;
99
- return i;
100
- }), d = h(() => n.history.menuItems ?? []);
94
+ const o = e, n = t, c = Bt({
95
+ conversations: () => o.conversation.items,
96
+ defaultTitle: () => o.labels.newConversationTitle
97
+ }), v = h(() => {
98
+ const { menuItems: d, ...s } = o.history;
99
+ return s;
100
+ }), b = h(() => o.history.menuItems ?? []);
101
101
  function a() {
102
- o("createConversation");
102
+ n("createConversation");
103
103
  }
104
- function l(r) {
105
- o("switchConversation", r.raw);
104
+ function r(d) {
105
+ n("switchConversation", d.raw);
106
106
  }
107
- function b(r, i) {
108
- o("renameConversation", i.raw, r);
107
+ function u(d, s) {
108
+ n("renameConversation", s.raw, d);
109
109
  }
110
- function A(r, i) {
111
- o("historyAction", r, i.raw);
110
+ function y(d, s) {
111
+ n("historyAction", d, s.raw);
112
112
  }
113
- function c(r) {
114
- return n.conversation.items.find((i) => i.id === r) ?? { id: r, title: n.labels.newConversationTitle };
113
+ function f(d) {
114
+ return o.conversation.items.find((s) => s.id === d) ?? { id: d, title: o.labels.newConversationTitle };
115
115
  }
116
- function f(r) {
117
- o("switchConversation", c(r));
116
+ function m(d) {
117
+ n("switchConversation", f(d));
118
118
  }
119
- function O(r, i) {
120
- o("renameConversation", c(r), i);
119
+ function k(d, s) {
120
+ n("renameConversation", f(d), s);
121
121
  }
122
- function C(r) {
123
- o("deleteConversation", c(r));
122
+ function T(d) {
123
+ n("deleteConversation", f(d));
124
124
  }
125
- function L() {
126
- o("open");
125
+ function E() {
126
+ n("open");
127
127
  }
128
- function T() {
129
- o("close");
128
+ function R() {
129
+ n("close");
130
130
  }
131
- function p() {
132
- o("toggle");
131
+ function I() {
132
+ n("toggle");
133
133
  }
134
- return (r, i) => (I(), F("aside", Rt, [
135
- V("span", {
134
+ return (d, s) => (P(), F("aside", Ut, [
135
+ B("span", {
136
136
  class: "chat-left-aside-logo",
137
137
  "aria-label": e.brand.name || e.labels.newConversationTitle
138
138
  }, [
139
- (I(), W(Ce(e.brand.logo || y(le))))
140
- ], 8, Lt),
141
- V("div", {
142
- class: X(["chat-left-aside-rail", { "is-hidden": !e.isDock || e.isOpen }])
139
+ (P(), W(we(e.brand.logo || p(le))))
140
+ ], 8, Ft),
141
+ B("div", {
142
+ class: _(["chat-left-aside-rail", { "is-hidden": !e.isDock || e.isOpen }])
143
143
  }, [
144
- U(y(ae), {
144
+ D(p(ae), {
145
145
  class: "chat-left-aside-rail__button",
146
- icon: y(he),
146
+ icon: p(ye),
147
147
  size: "32",
148
148
  "svg-size": "20",
149
149
  "aria-label": e.labels.expandConversationList,
150
- onClick: L
150
+ onClick: E
151
151
  }, null, 8, ["icon", "aria-label"]),
152
- U(y(ae), {
152
+ D(p(ae), {
153
153
  class: "chat-left-aside-rail__button",
154
- icon: y(pe),
154
+ icon: p(Ae),
155
155
  size: "32",
156
156
  "svg-size": "20",
157
157
  "aria-label": e.labels.createConversation,
158
158
  onClick: a
159
159
  }, null, 8, ["icon", "aria-label"])
160
160
  ], 2),
161
- V("div", {
162
- class: X(["chat-left-aside-panel", { "is-hidden": !e.isOpen }])
161
+ B("div", {
162
+ class: _(["chat-left-aside-panel", { "is-hidden": !e.isOpen }])
163
163
  }, [
164
- k(r.$slots, "default", {
164
+ C(d.$slots, "default", {
165
165
  conversation: e.conversation,
166
166
  isOpen: e.isOpen,
167
167
  createConversation: a,
168
- switchConversation: f,
169
- renameConversation: O,
170
- deleteConversation: C,
171
- openLeftAside: L,
172
- closeLeftAside: T,
173
- toggleLeftAside: p
168
+ switchConversation: m,
169
+ renameConversation: k,
170
+ deleteConversation: T,
171
+ openLeftAside: E,
172
+ closeLeftAside: R,
173
+ toggleLeftAside: I
174
174
  }, () => [
175
- V("div", $t, [
176
- V("span", It, Q(e.brand.name), 1),
177
- U(y(ae), {
178
- icon: y(Ve),
175
+ B("div", Wt, [
176
+ B("span", Dt, H(e.brand.name), 1),
177
+ D(p(ae), {
178
+ icon: p(Ue),
179
179
  size: "32",
180
180
  "svg-size": "20",
181
181
  type: "button",
182
182
  "aria-label": e.labels.collapseConversationList,
183
- onClick: T
183
+ onClick: R
184
184
  }, null, 8, ["icon", "aria-label"])
185
185
  ]),
186
- V("button", {
186
+ B("button", {
187
187
  class: "chat-left-aside-action",
188
188
  type: "button",
189
189
  onClick: a
190
190
  }, [
191
- V("span", Vt, [
192
- U(y(pe), { "font-size": "20" }),
193
- Ie(" " + Q(e.labels.createConversation), 1)
191
+ B("span", qt, [
192
+ D(p(Ae), { "font-size": "20" }),
193
+ Be(" " + H(e.labels.createConversation), 1)
194
194
  ])
195
195
  ]),
196
- e.showHistory ? (I(), W(y(lt), N({ key: 0 }, m.value, {
196
+ e.showHistory ? (P(), W(p(vt), N({ key: 0 }, v.value, {
197
197
  class: "chat-left-aside-content",
198
- data: [...y(u)],
198
+ data: [...p(c)],
199
199
  selected: e.conversation.activeId ?? void 0,
200
- "menu-items": d.value,
201
- onItemClick: l,
202
- onItemTitleChange: b,
203
- onItemAction: A
204
- }), null, 16, ["data", "selected", "menu-items"])) : B("", !0)
200
+ "menu-items": b.value,
201
+ onItemClick: r,
202
+ onItemTitleChange: u,
203
+ onItemAction: y
204
+ }), null, 16, ["data", "selected", "menu-items"])) : U("", !0)
205
205
  ], !0)
206
206
  ], 2)
207
207
  ]));
208
208
  }
209
- }), Bt = /* @__PURE__ */ Y(Pt, [["__scopeId", "data-v-110b6ae6"]]), Ut = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAyKADAAQAAAABAAAAyAAAAACbWz2VAAAR3UlEQVR4Ae2daaxeQxjHtS6t9qKqUhpb1VLdxFLahiISaWhtV7gqjYiSG0tECb6IIhEhIhLhg4ikpJQI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LFN8fmD17dktSdoRsxWXDV2FcGpowTmUBr+eff16Tp0viO1FJhRZLR0csDV+ywLnQ7u7uWJoUpN1S0iFYEiUqj2yZZZQqQbBSItElkC2dVKQ0zrEk6STyCsy3li1bNn78+EQ7TYgSrHxazssWPle2cuXKfM9oi9J8FeZTY953ItzsEqx8Im5s6bxsrVixooGyosUqovRcbOHj50WeEXgdglVQgfZs4RpZwWeEXI2T91LaM87lR4wYsXHjxr78Al6p8VRXmRarlCxlu4VvqDzxxBMNpAoyJVilwEJlxVZPT0+ioc7OTuwFXXDBBYn0hkT5KqxM0VhWwDfD4O5h7733njhx4syZM3EGtbLWQ2uIYIWmsUD6y1dhIIoKrZsEKzSNBdJfghWIokLrJsEKTWOB9JdgBaKo0LpJsELTWCD9JViBKCq0bhKs0DQWSH8JViCKCq2bBCs0jQXSX4IViKJC6ybBCk1jgfSXYAWiqNC6SbBC01gg/SVYgSgqtG4SrNA0Fkh//wPu1RstRJJwCgAAAABJRU5ErkJggg==", Ft = {
209
+ }), zt = /* @__PURE__ */ Y(Kt, [["__scopeId", "data-v-110b6ae6"]]), jt = {
210
210
  key: 0,
211
211
  class: "tr-chat-mcp-selector"
212
- }, Wt = ["aria-label", "title"], Dt = { class: "tr-chat-mcp-selector__label" }, qt = {
212
+ }, Jt = ["aria-label", "title"], Zt = { class: "tr-chat-mcp-selector__label" }, Gt = {
213
213
  key: 0,
214
214
  class: "tr-chat-mcp-selector__count"
215
- }, Kt = /* @__PURE__ */ J({
215
+ }, Yt = /* @__PURE__ */ Z({
216
216
  __name: "MCPSelector",
217
217
  props: {
218
218
  mcp: {},
219
219
  labels: {}
220
220
  },
221
- emits: ["addServer", "removeServer", "updateServerEnabled", "updateToolEnabled"],
221
+ emits: ["open", "addServer", "removeServer", "updateServerEnabled", "updateToolEnabled"],
222
222
  setup(e, { emit: t }) {
223
- const n = e, o = t, u = q(!1), m = {
224
- type: "drawer",
225
- drawer: {
226
- direction: "right"
227
- }
228
- }, d = h(() => n.mcp.servers ?? []), a = h(() => n.mcp.tools ?? {}), l = h(() => d.value.length > 0), b = h(() => d.value.filter((s) => s.installed && s.enabled).length), A = h(
229
- () => d.value.some((s) => {
230
- var v;
231
- return !!(s.loading || (v = a.value[s.id]) != null && v.some((S) => S.loading));
232
- })
233
- ), c = h(
234
- () => d.value.filter((s) => s.installed).map((s) => C(s, { includeTools: !0 }))
235
- ), f = h(
236
- () => d.value.map((s) => C(s, { includeTools: !1 }))
237
- );
238
- function O(s, v) {
239
- var $;
240
- const S = ($ = s.metadata) == null ? void 0 : $[v];
241
- return typeof S == "string" ? S : void 0;
242
- }
243
- function C(s, v) {
244
- const S = v.includeTools && s.installed ? a.value[s.id] ?? [] : [];
245
- return {
246
- id: s.id,
247
- name: s.name,
248
- icon: O(s, "icon") ?? Ut,
249
- description: s.description ?? "",
250
- enabled: s.enabled,
251
- expanded: !0,
252
- tools: S.map(($) => ({
253
- id: $.id,
254
- name: $.name,
255
- description: $.description ?? "",
256
- enabled: $.enabled
257
- })),
258
- addState: s.loading ? "loading" : s.installed ? "added" : "idle",
259
- category: O(s, "category")
260
- };
261
- }
262
- function L(s) {
263
- return d.value.find((v) => v.id === s);
264
- }
265
- function T(s) {
266
- const v = L(s.id);
267
- !v || v.installed || v.loading || o("addServer", { id: s.id });
268
- }
269
- function p(s) {
270
- const v = L(s.id);
271
- !v || !v.installed || v.loading || o("removeServer", { id: s.id });
272
- }
273
- function r(s, v) {
274
- const S = L(s.id);
275
- !S || !S.installed || S.loading || S.enabled === v || o("updateServerEnabled", { id: s.id, enabled: v });
276
- }
277
- function i(s, v, S) {
278
- var P;
279
- const $ = L(s.id), w = (P = a.value[s.id]) == null ? void 0 : P.find((Z) => Z.id === v);
280
- !$ || !$.installed || !w || w.loading || w.enabled === S || o("updateToolEnabled", { serverId: s.id, toolId: v, enabled: S });
281
- }
282
- return (s, v) => l.value ? (I(), F("div", Ft, [
283
- V("button", {
284
- class: X(["tr-chat-mcp-selector__button", { "tr-chat-mcp-selector__button--active": b.value > 0 }]),
223
+ const o = e, n = t, c = h(() => o.mcp.servers ?? []), v = h(() => c.value.length > 0), b = h(() => c.value.filter((a) => a.installed && a.enabled).length);
224
+ return (a, r) => v.value ? (P(), F("div", jt, [
225
+ B("button", {
226
+ class: _(["tr-chat-mcp-selector__button", { "tr-chat-mcp-selector__button--active": b.value > 0 }]),
285
227
  type: "button",
286
228
  "aria-label": e.labels.mcp,
287
229
  title: e.labels.mcp,
288
- onClick: v[0] || (v[0] = (S) => u.value = !0)
230
+ onClick: r[0] || (r[0] = (u) => n("open"))
289
231
  }, [
290
- U(y(bt), {
232
+ D(p(wt), {
291
233
  size: 16,
292
234
  class: "tr-chat-mcp-selector__icon"
293
235
  }),
294
- V("span", Dt, Q(e.labels.mcp), 1),
295
- b.value > 0 ? (I(), F("span", qt, Q(b.value), 1)) : B("", !0)
296
- ], 10, Wt),
297
- U(y(rt), {
298
- visible: u.value,
299
- "onUpdate:visible": v[1] || (v[1] = (S) => u.value = S),
300
- "active-count": b.value,
301
- "popup-config": m,
302
- "installed-plugins": c.value,
303
- "market-plugins": f.value,
304
- loading: A.value,
305
- "market-loading": !1,
306
- "show-custom-add-button": !1,
307
- "allow-plugin-delete": !0,
308
- "allow-tool-toggle": !0,
309
- onPluginToggle: r,
310
- onPluginAdd: T,
311
- onPluginDelete: p,
312
- onToolToggle: i
313
- }, null, 8, ["visible", "active-count", "installed-plugins", "market-plugins", "loading"])
314
- ])) : B("", !0);
236
+ B("span", Zt, H(e.labels.mcp), 1),
237
+ b.value > 0 ? (P(), F("span", Gt, H(b.value), 1)) : U("", !0)
238
+ ], 10, Jt)
239
+ ])) : U("", !0);
315
240
  }
316
- }), zt = /* @__PURE__ */ Y(Kt, [["__scopeId", "data-v-6c32c620"]]), jt = ["low", "medium", "high", "max"], re = ["thinking", "search"], Jt = {
241
+ }), Nt = /* @__PURE__ */ Y(Yt, [["__scopeId", "data-v-4a5340bf"]]), Ht = ["low", "medium", "high", "max"], re = ["thinking", "search"], Qt = {
317
242
  key: 0,
318
243
  class: "tr-chat-model-features"
319
- }, Zt = ["disabled", "aria-label", "title", "onClick"], Gt = { class: "tr-chat-model-features__label" }, Yt = /* @__PURE__ */ J({
244
+ }, Xt = ["disabled", "aria-label", "title", "onClick"], xt = { class: "tr-chat-model-features__label" }, _t = /* @__PURE__ */ Z({
320
245
  __name: "ModelFeatures",
321
246
  props: {
322
247
  model: {},
@@ -324,56 +249,56 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
324
249
  },
325
250
  emits: ["updateFeature"],
326
251
  setup(e, { emit: t }) {
327
- const n = e, o = t, u = {
252
+ const o = e, n = t, c = {
328
253
  thinking: "thinkingFeature",
329
254
  search: "searchFeature"
330
- }, m = {
331
- thinking: ht,
332
- search: gt
333
- }, d = h(
334
- () => re.map((f) => ({
335
- id: f,
336
- label: n.labels[u[f]],
337
- icon: m[f]
255
+ }, v = {
256
+ thinking: kt,
257
+ search: St
258
+ }, b = h(
259
+ () => re.map((m) => ({
260
+ id: m,
261
+ label: o.labels[c[m]],
262
+ icon: v[m]
338
263
  }))
339
- ), a = h(() => new Set(n.model.pendingFeatureIds ?? [])), l = h(() => {
340
- var f;
341
- return (f = n.model.options) == null ? void 0 : f.find((O) => O.id === n.model.selectedId);
342
- }), b = h(
343
- () => d.value.filter((f) => {
344
- var O, C;
345
- return (C = (O = l.value) == null ? void 0 : O.capabilities) == null ? void 0 : C[f.id];
264
+ ), a = h(() => new Set(o.model.pendingFeatureIds ?? [])), r = h(() => {
265
+ var m;
266
+ return (m = o.model.options) == null ? void 0 : m.find((k) => k.id === o.model.selectedId);
267
+ }), u = h(
268
+ () => b.value.filter((m) => {
269
+ var k, T;
270
+ return (T = (k = r.value) == null ? void 0 : k.capabilities) == null ? void 0 : T[m.id];
346
271
  })
347
272
  );
348
- function A(f) {
349
- return a.value.has(f);
350
- }
351
- function c(f) {
352
- var O;
353
- A(f) || o("updateFeature", { id: f, enabled: !((O = n.model.features) != null && O[f]) });
354
- }
355
- return (f, O) => b.value.length ? (I(), F("div", Jt, [
356
- (I(!0), F(Ae, null, Qe(b.value, (C) => {
357
- var L;
358
- return I(), F("button", {
359
- key: C.id,
360
- class: X(["tr-chat-model-features__button", { "tr-chat-model-features__button--active": (L = e.model.features) == null ? void 0 : L[C.id] }]),
273
+ function y(m) {
274
+ return a.value.has(m);
275
+ }
276
+ function f(m) {
277
+ var k;
278
+ y(m) || n("updateFeature", { id: m, enabled: !((k = o.model.features) != null && k[m]) });
279
+ }
280
+ return (m, k) => u.value.length ? (P(), F("div", Qt, [
281
+ (P(!0), F(Se, null, nt(u.value, (T) => {
282
+ var E;
283
+ return P(), F("button", {
284
+ key: T.id,
285
+ class: _(["tr-chat-model-features__button", { "tr-chat-model-features__button--active": (E = e.model.features) == null ? void 0 : E[T.id] }]),
361
286
  type: "button",
362
- disabled: A(C.id),
363
- "aria-label": C.label,
364
- title: C.label,
365
- onClick: (T) => c(C.id)
287
+ disabled: y(T.id),
288
+ "aria-label": T.label,
289
+ title: T.label,
290
+ onClick: (R) => f(T.id)
366
291
  }, [
367
- (I(), W(Ce(C.icon), {
292
+ (P(), W(we(T.icon), {
368
293
  size: 16,
369
294
  class: "tr-chat-model-features__icon"
370
295
  })),
371
- V("span", Gt, Q(C.label), 1)
372
- ], 10, Zt);
296
+ B("span", xt, H(T.label), 1)
297
+ ], 10, Xt);
373
298
  }), 128))
374
- ])) : B("", !0);
299
+ ])) : U("", !0);
375
300
  }
376
- }), Nt = /* @__PURE__ */ Y(Yt, [["__scopeId", "data-v-e63ed58d"]]), Qt = ["disabled", "aria-label", "title"], Ht = { class: "tr-chat-model-selector__label" }, Xt = /* @__PURE__ */ J({
301
+ }), en = /* @__PURE__ */ Y(_t, [["__scopeId", "data-v-e63ed58d"]]), tn = ["disabled", "aria-label", "title"], nn = { class: "tr-chat-model-selector__label" }, on = /* @__PURE__ */ Z({
377
302
  __name: "ModelSelector",
378
303
  props: {
379
304
  model: {},
@@ -381,47 +306,47 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
381
306
  },
382
307
  emits: ["selectModel"],
383
308
  setup(e, { emit: t }) {
384
- const n = e, o = t, u = h(() => n.model.options ?? []), m = h(() => u.value.find((l) => l.id === n.model.selectedId)), d = h(
385
- () => u.value.map((l) => ({
386
- id: l.id,
387
- text: l.label
309
+ const o = e, n = t, c = h(() => o.model.options ?? []), v = h(() => c.value.find((r) => r.id === o.model.selectedId)), b = h(
310
+ () => c.value.map((r) => ({
311
+ id: r.id,
312
+ text: r.label
388
313
  }))
389
314
  );
390
- function a(l) {
391
- n.model.selecting || l.id === n.model.selectedId || o("selectModel", { id: l.id });
315
+ function a(r) {
316
+ o.model.selecting || r.id === o.model.selectedId || n("selectModel", { id: r.id });
392
317
  }
393
- return (l, b) => u.value.length ? (I(), W(y(it), {
318
+ return (r, u) => c.value.length ? (P(), W(p(mt), {
394
319
  key: 0,
395
320
  class: "tr-chat-model-selector__menu",
396
- items: d.value,
321
+ items: b.value,
397
322
  trigger: "click",
398
323
  onItemClick: a
399
324
  }, {
400
- trigger: E(() => {
401
- var A, c, f;
325
+ trigger: S(() => {
326
+ var y, f, m;
402
327
  return [
403
- V("button", {
328
+ B("button", {
404
329
  class: "tr-chat-model-selector__button",
405
330
  type: "button",
406
331
  disabled: e.model.selecting,
407
- "aria-label": ((A = m.value) == null ? void 0 : A.label) || e.labels.selectModel,
408
- title: ((c = m.value) == null ? void 0 : c.label) || e.labels.selectModel
332
+ "aria-label": ((y = v.value) == null ? void 0 : y.label) || e.labels.selectModel,
333
+ title: ((f = v.value) == null ? void 0 : f.label) || e.labels.selectModel
409
334
  }, [
410
- U(y(pt), {
335
+ D(p(Et), {
411
336
  size: 16,
412
337
  class: "tr-chat-model-selector__icon"
413
338
  }),
414
- V("span", Ht, Q(((f = m.value) == null ? void 0 : f.label) || e.labels.selectModel), 1)
415
- ], 8, Qt)
339
+ B("span", nn, H(((m = v.value) == null ? void 0 : m.label) || e.labels.selectModel), 1)
340
+ ], 8, tn)
416
341
  ];
417
342
  }),
418
343
  _: 1
419
- }, 8, ["items"])) : B("", !0);
344
+ }, 8, ["items"])) : U("", !0);
420
345
  }
421
- }), xt = /* @__PURE__ */ Y(Xt, [["__scopeId", "data-v-173603c5"]]), _t = { class: "chat-footer" }, eo = {
346
+ }), sn = /* @__PURE__ */ Y(on, [["__scopeId", "data-v-173603c5"]]), an = { class: "chat-footer" }, ln = {
422
347
  key: 0,
423
348
  class: "model-actions"
424
- }, to = /* @__PURE__ */ J({
349
+ }, rn = /* @__PURE__ */ Z({
425
350
  __name: "ChatComposer",
426
351
  props: {
427
352
  sender: {},
@@ -431,99 +356,103 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
431
356
  model: {},
432
357
  mcp: {}
433
358
  },
434
- emits: ["submit", "cancel", "clear", "update:value", "modelSelect", "modelFeatureChange", "mcpAddServer", "mcpRemoveServer", "mcpServerEnabledChange", "mcpToolEnabledChange"],
359
+ emits: ["submit", "cancel", "clear", "update:value", "openMcpPanel", "modelSelect", "modelFeatureChange", "mcpAddServer", "mcpRemoveServer", "mcpServerEnabledChange", "mcpToolEnabledChange"],
435
360
  setup(e, { emit: t }) {
436
- const n = e, o = t, u = h(() => {
437
- var C;
361
+ const o = e, n = t, c = h(() => {
362
+ var E;
438
363
  return {
439
364
  mode: "multiple",
440
365
  clearable: !0,
441
- placeholder: n.sender.loading ? n.labels.composerLoadingPlaceholder : n.labels.composerPlaceholder,
366
+ placeholder: o.sender.loading ? o.labels.composerLoadingPlaceholder : o.labels.composerPlaceholder,
442
367
  showWordLimit: !0,
443
368
  maxLength: 1e3,
444
- ...n.senderOptions,
369
+ ...o.senderOptions,
445
370
  defaultActions: {
446
- ...n.senderOptions.defaultActions,
371
+ ...o.senderOptions.defaultActions,
447
372
  submit: {
448
- ...(C = n.senderOptions.defaultActions) == null ? void 0 : C.submit,
449
- disabled: n.sender.submitDisabled
373
+ ...(E = o.senderOptions.defaultActions) == null ? void 0 : E.submit,
374
+ disabled: o.sender.submitDisabled
450
375
  }
451
376
  },
452
- modelValue: n.value,
453
- loading: n.sender.loading,
454
- disabled: n.sender.disabled
377
+ modelValue: o.value,
378
+ loading: o.sender.loading,
379
+ disabled: o.sender.disabled
455
380
  };
456
381
  });
457
- function m(C) {
458
- o("update:value", C);
382
+ function v(E) {
383
+ n("update:value", E);
459
384
  }
460
- function d(C, L) {
461
- o("submit", { text: C, structuredData: L });
385
+ function b() {
386
+ n("openMcpPanel");
462
387
  }
463
- function a() {
464
- o("clear");
388
+ function a(E, R) {
389
+ n("submit", { text: E, structuredData: R });
465
390
  }
466
- function l(C) {
467
- o("modelSelect", C);
391
+ function r() {
392
+ n("clear");
468
393
  }
469
- function b(C) {
470
- o("modelFeatureChange", C);
394
+ function u(E) {
395
+ n("modelSelect", E);
471
396
  }
472
- function A(C) {
473
- o("mcpAddServer", C);
397
+ function y(E) {
398
+ n("modelFeatureChange", E);
474
399
  }
475
- function c(C) {
476
- o("mcpRemoveServer", C);
400
+ function f(E) {
401
+ n("mcpAddServer", E);
477
402
  }
478
- function f(C) {
479
- o("mcpServerEnabledChange", C);
403
+ function m(E) {
404
+ n("mcpRemoveServer", E);
480
405
  }
481
- function O(C) {
482
- o("mcpToolEnabledChange", C);
406
+ function k(E) {
407
+ n("mcpServerEnabledChange", E);
483
408
  }
484
- return (C, L) => (I(), F("div", _t, [
485
- k(C.$slots, "composer-before", {}, void 0, !0),
486
- k(C.$slots, "default", {}, () => [
487
- U(y(dt), N(u.value, {
488
- "onUpdate:modelValue": m,
489
- onSubmit: d,
490
- onCancel: L[0] || (L[0] = (T) => o("cancel")),
491
- onClear: a
492
- }), z({ _: 2 }, [
493
- C.$slots["sender-footer"] || e.model || e.mcp ? {
409
+ function T(E) {
410
+ n("mcpToolEnabledChange", E);
411
+ }
412
+ return (E, R) => (P(), F("div", an, [
413
+ C(E.$slots, "composer-before", {}, void 0, !0),
414
+ C(E.$slots, "default", {}, () => [
415
+ D(p(bt), N(c.value, {
416
+ "onUpdate:modelValue": v,
417
+ onSubmit: a,
418
+ onCancel: R[0] || (R[0] = (I) => n("cancel")),
419
+ onClear: r
420
+ }), J({ _: 2 }, [
421
+ E.$slots["sender-footer"] || e.model || e.mcp ? {
494
422
  name: "footer",
495
- fn: E(() => [
496
- e.model || e.mcp ? (I(), F("div", eo, [
497
- e.mcp ? (I(), W(zt, {
423
+ fn: S(() => [
424
+ e.model || e.mcp ? (P(), F("div", ln, [
425
+ e.model ? (P(), W(en, {
498
426
  key: 0,
499
- mcp: e.mcp,
427
+ model: e.model,
500
428
  labels: e.labels,
501
- onAddServer: A,
502
- onRemoveServer: c,
503
- onUpdateServerEnabled: f,
504
- onUpdateToolEnabled: O
505
- }, null, 8, ["mcp", "labels"])) : B("", !0),
506
- e.model ? (I(), W(xt, {
429
+ onUpdateFeature: y
430
+ }, null, 8, ["model", "labels"])) : U("", !0),
431
+ e.model ? (P(), W(sn, {
507
432
  key: 1,
508
433
  model: e.model,
509
434
  labels: e.labels,
510
- onSelectModel: l
511
- }, null, 8, ["model", "labels"])) : B("", !0),
512
- e.model ? (I(), W(Nt, {
435
+ onSelectModel: u
436
+ }, null, 8, ["model", "labels"])) : U("", !0),
437
+ e.mcp ? (P(), W(Nt, {
513
438
  key: 2,
514
- model: e.model,
439
+ mcp: e.mcp,
440
+ onOpen: b,
515
441
  labels: e.labels,
516
- onUpdateFeature: b
517
- }, null, 8, ["model", "labels"])) : B("", !0)
518
- ])) : B("", !0),
519
- k(C.$slots, "sender-footer", {}, void 0, !0)
442
+ onAddServer: f,
443
+ onRemoveServer: m,
444
+ onUpdateServerEnabled: k,
445
+ onUpdateToolEnabled: T
446
+ }, null, 8, ["mcp", "labels"])) : U("", !0)
447
+ ])) : U("", !0),
448
+ C(E.$slots, "sender-footer", {}, void 0, !0)
520
449
  ]),
521
450
  key: "0"
522
451
  } : void 0,
523
- C.$slots["sender-footer-right"] ? {
452
+ E.$slots["sender-footer-right"] ? {
524
453
  name: "footer-right",
525
- fn: E(() => [
526
- k(C.$slots, "sender-footer-right", {}, void 0, !0)
454
+ fn: S(() => [
455
+ C(E.$slots, "sender-footer-right", {}, void 0, !0)
527
456
  ]),
528
457
  key: "1"
529
458
  } : void 0
@@ -531,7 +460,7 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
531
460
  ], !0)
532
461
  ]));
533
462
  }
534
- }), oo = /* @__PURE__ */ Y(to, [["__scopeId", "data-v-88ebb4ad"]]), Re = /* @__PURE__ */ J({
463
+ }), dn = /* @__PURE__ */ Y(rn, [["__scopeId", "data-v-beded133"]]), $e = /* @__PURE__ */ Z({
535
464
  __name: "ChatComposerHost",
536
465
  props: {
537
466
  sender: {},
@@ -541,77 +470,78 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
541
470
  model: {},
542
471
  mcp: {}
543
472
  },
544
- emits: ["submit", "cancel", "clear", "update:value", "modelSelect", "modelFeatureChange", "mcpAddServer", "mcpRemoveServer", "mcpServerEnabledChange", "mcpToolEnabledChange"],
473
+ emits: ["submit", "cancel", "clear", "update:value", "openMcpPanel", "modelSelect", "modelFeatureChange", "mcpAddServer", "mcpRemoveServer", "mcpServerEnabledChange", "mcpToolEnabledChange"],
545
474
  setup(e, { emit: t }) {
546
- const n = e, o = t;
547
- function u(a) {
548
- o("update:value", a);
549
- }
550
- function m(a) {
551
- o("submit", a);
552
- }
553
- const d = h(() => ({
554
- value: n.value,
555
- loading: n.sender.loading,
556
- disabled: n.sender.disabled,
557
- submitDisabled: n.sender.submitDisabled,
558
- setInputValue: u,
559
- submit: m,
560
- cancel: () => o("cancel"),
561
- clear: () => o("clear")
475
+ const o = e, n = t;
476
+ function c(a) {
477
+ n("update:value", a);
478
+ }
479
+ function v(a) {
480
+ n("submit", a);
481
+ }
482
+ const b = h(() => ({
483
+ value: o.value,
484
+ loading: o.sender.loading,
485
+ disabled: o.sender.disabled,
486
+ submitDisabled: o.sender.submitDisabled,
487
+ setInputValue: c,
488
+ submit: v,
489
+ cancel: () => n("cancel"),
490
+ clear: () => n("clear")
562
491
  }));
563
- return (a, l) => (I(), W(oo, {
564
- sender: n.sender,
565
- value: n.value,
566
- "sender-options": n.senderOptions,
567
- labels: n.labels,
568
- model: n.model,
569
- mcp: n.mcp,
570
- onSubmit: l[0] || (l[0] = (b) => o("submit", b)),
571
- onCancel: l[1] || (l[1] = (b) => o("cancel")),
572
- onClear: l[2] || (l[2] = (b) => o("clear")),
573
- "onUpdate:value": l[3] || (l[3] = (b) => o("update:value", b)),
574
- onModelSelect: l[4] || (l[4] = (b) => o("modelSelect", b)),
575
- onModelFeatureChange: l[5] || (l[5] = (b) => o("modelFeatureChange", b)),
576
- onMcpAddServer: l[6] || (l[6] = (b) => o("mcpAddServer", b)),
577
- onMcpRemoveServer: l[7] || (l[7] = (b) => o("mcpRemoveServer", b)),
578
- onMcpServerEnabledChange: l[8] || (l[8] = (b) => o("mcpServerEnabledChange", b)),
579
- onMcpToolEnabledChange: l[9] || (l[9] = (b) => o("mcpToolEnabledChange", b))
580
- }, z({ _: 2 }, [
492
+ return (a, r) => (P(), W(dn, {
493
+ sender: o.sender,
494
+ value: o.value,
495
+ "sender-options": o.senderOptions,
496
+ labels: o.labels,
497
+ model: o.model,
498
+ mcp: o.mcp,
499
+ onSubmit: r[0] || (r[0] = (u) => n("submit", u)),
500
+ onCancel: r[1] || (r[1] = (u) => n("cancel")),
501
+ onClear: r[2] || (r[2] = (u) => n("clear")),
502
+ "onUpdate:value": r[3] || (r[3] = (u) => n("update:value", u)),
503
+ onOpenMcpPanel: r[4] || (r[4] = (u) => n("openMcpPanel")),
504
+ onModelSelect: r[5] || (r[5] = (u) => n("modelSelect", u)),
505
+ onModelFeatureChange: r[6] || (r[6] = (u) => n("modelFeatureChange", u)),
506
+ onMcpAddServer: r[7] || (r[7] = (u) => n("mcpAddServer", u)),
507
+ onMcpRemoveServer: r[8] || (r[8] = (u) => n("mcpRemoveServer", u)),
508
+ onMcpServerEnabledChange: r[9] || (r[9] = (u) => n("mcpServerEnabledChange", u)),
509
+ onMcpToolEnabledChange: r[10] || (r[10] = (u) => n("mcpToolEnabledChange", u))
510
+ }, J({ _: 2 }, [
581
511
  a.$slots["composer-before"] ? {
582
512
  name: "composer-before",
583
- fn: E(() => [
584
- k(a.$slots, "composer-before", D(j(d.value)))
513
+ fn: S(() => [
514
+ C(a.$slots, "composer-before", q(j(b.value)))
585
515
  ]),
586
516
  key: "0"
587
517
  } : void 0,
588
518
  a.$slots["layout-footer"] ? {
589
519
  name: "default",
590
- fn: E(() => [
591
- k(a.$slots, "layout-footer", D(j(d.value)))
520
+ fn: S(() => [
521
+ C(a.$slots, "layout-footer", q(j(b.value)))
592
522
  ]),
593
523
  key: "1"
594
524
  } : void 0,
595
525
  a.$slots["sender-footer"] ? {
596
526
  name: "sender-footer",
597
- fn: E(() => [
598
- k(a.$slots, "sender-footer")
527
+ fn: S(() => [
528
+ C(a.$slots, "sender-footer")
599
529
  ]),
600
530
  key: "2"
601
531
  } : void 0,
602
532
  a.$slots["sender-footer-right"] ? {
603
533
  name: "sender-footer-right",
604
- fn: E(() => [
605
- k(a.$slots, "sender-footer-right")
534
+ fn: S(() => [
535
+ C(a.$slots, "sender-footer-right")
606
536
  ]),
607
537
  key: "3"
608
538
  } : void 0
609
539
  ]), 1032, ["sender", "value", "sender-options", "labels", "model", "mcp"]));
610
540
  }
611
- }), no = {
541
+ }), un = {
612
542
  key: 0,
613
543
  class: "chat-notice"
614
- }, so = { class: "chat-header" }, ao = { class: "chat-header__aside-cell" }, lo = ["aria-label"], ro = { class: "chat-header__title" }, io = { class: "chat-header__actions" }, uo = ["aria-label", "title"], co = ["aria-label"], fo = /* @__PURE__ */ J({
544
+ }, cn = { class: "chat-header" }, fn = { class: "chat-header__aside-cell" }, vn = ["aria-label"], mn = { class: "chat-header__title" }, bn = { class: "chat-header__actions" }, gn = ["aria-label", "title"], hn = ["aria-label"], pn = /* @__PURE__ */ Z({
615
545
  __name: "ChatHeader",
616
546
  props: {
617
547
  title: {},
@@ -626,57 +556,57 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
626
556
  },
627
557
  emits: ["createConversation", "openLeftAside", "closeLeftAside", "toggleLeftAside", "openRightAside"],
628
558
  setup(e, { emit: t }) {
629
- const n = t;
630
- function o() {
631
- n("createConversation");
559
+ const o = t;
560
+ function n() {
561
+ o("createConversation");
632
562
  }
633
- function u() {
634
- n("openLeftAside");
563
+ function c() {
564
+ o("openLeftAside");
635
565
  }
636
- function m() {
637
- n("closeLeftAside");
566
+ function v() {
567
+ o("closeLeftAside");
638
568
  }
639
- function d() {
640
- n("toggleLeftAside");
569
+ function b() {
570
+ o("toggleLeftAside");
641
571
  }
642
572
  function a() {
643
- n("openRightAside");
573
+ o("openRightAside");
644
574
  }
645
- return (l, b) => (I(), F(Ae, null, [
646
- l.$slots.notice ? (I(), F("div", no, [
647
- k(l.$slots, "notice", {}, void 0, !0)
648
- ])) : B("", !0),
649
- k(l.$slots, "default", {
575
+ return (r, u) => (P(), F(Se, null, [
576
+ r.$slots.notice ? (P(), F("div", un, [
577
+ C(r.$slots, "notice", {}, void 0, !0)
578
+ ])) : U("", !0),
579
+ C(r.$slots, "default", {
650
580
  title: e.title,
651
581
  isEmpty: e.isEmpty,
652
582
  conversation: e.conversation,
653
- createConversation: o,
583
+ createConversation: n,
654
584
  isLeftAsideOpen: e.isLeftAsideOpen,
655
- openLeftAside: u,
656
- closeLeftAside: m,
657
- toggleLeftAside: d,
585
+ openLeftAside: c,
586
+ closeLeftAside: v,
587
+ toggleLeftAside: b,
658
588
  openRightAside: a
659
589
  }, () => [
660
- V("header", so, [
661
- V("div", ao, [
662
- e.isLeftAsideVisible && e.isLeftAsideDrawer ? (I(), W(y(ge).AsideToggle, {
590
+ B("header", cn, [
591
+ B("div", fn, [
592
+ e.isLeftAsideVisible && e.isLeftAsideDrawer ? (P(), W(p(pe).AsideToggle, {
663
593
  key: 0,
664
594
  side: "left"
665
595
  }, {
666
- default: E(({ isOpen: A }) => [
667
- V("span", {
596
+ default: S(({ isOpen: y }) => [
597
+ B("span", {
668
598
  class: "chat-header__aside-toggle",
669
- "aria-label": A ? e.labels.collapseConversationList : e.labels.expandConversationList
599
+ "aria-label": y ? e.labels.collapseConversationList : e.labels.expandConversationList
670
600
  }, [
671
- (I(), W(Ce(A ? y(Ve) : y(he)), { size: 20 }))
672
- ], 8, lo)
601
+ (P(), W(we(y ? p(Ue) : p(ye)), { size: 20 }))
602
+ ], 8, vn)
673
603
  ]),
674
604
  _: 1
675
- })) : B("", !0)
605
+ })) : U("", !0)
676
606
  ]),
677
- V("h3", ro, Q(e.title), 1),
678
- V("div", io, [
679
- e.isRightAsideVisible && !e.isRightAsideOpen ? (I(), F("button", {
607
+ B("h3", mn, H(e.title), 1),
608
+ B("div", bn, [
609
+ e.isRightAsideVisible && !e.isRightAsideOpen ? (P(), F("button", {
680
610
  key: 0,
681
611
  class: "chat-header__aside-action",
682
612
  type: "button",
@@ -684,26 +614,26 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
684
614
  title: e.labels.openRightAside,
685
615
  onClick: a
686
616
  }, [
687
- U(y(he), { size: 18 })
688
- ], 8, uo)) : B("", !0),
689
- !e.isEmpty || !e.isLeftAsideVisible ? (I(), F("button", {
617
+ D(p(ye), { size: 18 })
618
+ ], 8, gn)) : U("", !0),
619
+ !e.isEmpty || !e.isLeftAsideVisible ? (P(), F("button", {
690
620
  key: 1,
691
- class: X(["chat-header__new", { "chat-header__new--visible": !e.isLeftAsideVisible }]),
621
+ class: _(["chat-header__new", { "chat-header__new--visible": !e.isLeftAsideVisible }]),
692
622
  type: "button",
693
623
  "aria-label": e.labels.createConversation,
694
- onClick: o
624
+ onClick: n
695
625
  }, [
696
- U(y(pe), { size: 20 })
697
- ], 10, co)) : B("", !0)
626
+ D(p(Ae), { size: 20 })
627
+ ], 10, hn)) : U("", !0)
698
628
  ])
699
629
  ])
700
630
  ], !0)
701
631
  ], 64));
702
632
  }
703
- }), vo = /* @__PURE__ */ Y(fo, [["__scopeId", "data-v-616b4d3a"]]), mo = {
633
+ }), yn = /* @__PURE__ */ Y(pn, [["__scopeId", "data-v-616b4d3a"]]), An = {
704
634
  key: 0,
705
635
  class: "chat-welcome-content"
706
- }, bo = /* @__PURE__ */ J({
636
+ }, Cn = /* @__PURE__ */ Z({
707
637
  __name: "ChatMessages",
708
638
  props: {
709
639
  messages: {},
@@ -717,151 +647,151 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
717
647
  },
718
648
  emits: ["promptClick", "bubbleStateChange", "bubbleEvent"],
719
649
  setup(e, { emit: t }) {
720
- const n = e, o = t, u = be(le, { style: { fontSize: "28px" } }), m = be(yt, { style: { fontSize: "28px" } }), d = {
650
+ const o = e, n = t, c = he(le, { style: { fontSize: "28px" } }), v = he(Ot, { style: { fontSize: "28px" } }), b = {
721
651
  assistant: {
722
652
  placement: "start",
723
- avatar: u
653
+ avatar: c
724
654
  },
725
655
  user: {
726
656
  placement: "end",
727
- avatar: m
657
+ avatar: v
728
658
  },
729
659
  system: {
730
660
  hidden: !0
731
661
  }
732
- }, a = h(() => n.messages.length === 0), l = h(() => n.messages.at(-1)), b = h(() => n.messages.map((s) => ({ ...s }))), A = h(() => n.options.autoScroll ?? !0), c = h(() => ({
733
- fallbackContentRenderer: ut.Markdown,
734
- ...n.options.bubbleProvider
735
- })), f = h(() => {
736
- const s = n.options.bubbleList, v = {
737
- ...d,
662
+ }, a = h(() => o.messages.length === 0), r = h(() => o.messages.at(-1)), u = h(() => o.messages.map((l) => ({ ...l }))), y = h(() => o.options.autoScroll ?? !0), f = h(() => ({
663
+ fallbackContentRenderer: gt.Markdown,
664
+ ...o.options.bubbleProvider
665
+ })), m = h(() => {
666
+ const l = o.options.bubbleList, i = {
667
+ ...b,
738
668
  ...Object.fromEntries(
739
- Object.entries(s.roleConfigs ?? {}).map(([S, $]) => [
740
- S,
669
+ Object.entries(l.roleConfigs ?? {}).map(([A, M]) => [
670
+ A,
741
671
  {
742
- ...d[S],
743
- ...$
672
+ ...b[A],
673
+ ...M
744
674
  }
745
675
  ])
746
676
  )
747
677
  };
748
678
  return {
749
- ...s,
750
- roleConfigs: v,
679
+ ...l,
680
+ roleConfigs: i,
751
681
  autoScroll: !1
752
682
  };
753
- }), O = h(() => n.welcome === !1 ? null : n.welcome), C = h(() => n.prompts === !1 ? {
683
+ }), k = h(() => o.welcome === !1 ? null : o.welcome), T = h(() => o.prompts === !1 ? {
754
684
  items: []
755
685
  } : {
756
- ...n.prompts,
757
- items: [...n.prompts.items ?? []]
758
- }), L = h(() => n.prompts !== !1 && C.value.items.length > 0), { scrollToBottom: T } = ct(
759
- () => n.scrollTarget,
686
+ ...o.prompts,
687
+ items: [...o.prompts.items ?? []]
688
+ }), E = h(() => o.prompts !== !1 && T.value.items.length > 0), { scrollToBottom: R } = ht(
689
+ () => o.scrollTarget,
760
690
  () => {
761
- var s, v;
762
- return A.value ? [n.messages.length, (s = l.value) == null ? void 0 : s.content, (v = l.value) == null ? void 0 : v.reasoning_content] : null;
691
+ var l, i;
692
+ return y.value ? [o.messages.length, (l = r.value) == null ? void 0 : l.content, (i = r.value) == null ? void 0 : i.reasoning_content] : null;
763
693
  }
764
694
  );
765
695
  ue(
766
696
  () => {
767
- var s;
768
- return (s = l.value) == null ? void 0 : s.role;
697
+ var l;
698
+ return (l = r.value) == null ? void 0 : l.role;
769
699
  },
770
- async (s) => {
771
- A.value && s === "user" && (await He(), T("smooth"));
700
+ async (l) => {
701
+ y.value && l === "user" && (await ot(), R("smooth"));
772
702
  }
773
703
  );
774
- function p(s, v) {
775
- v.disabled || o("promptClick", s, v);
704
+ function I(l, i) {
705
+ i.disabled || n("promptClick", l, i);
776
706
  }
777
- function r(s) {
778
- o("bubbleStateChange", s);
707
+ function d(l) {
708
+ n("bubbleStateChange", l);
779
709
  }
780
- function i(s) {
781
- o("bubbleEvent", s);
710
+ function s(l) {
711
+ n("bubbleEvent", l);
782
712
  }
783
- return (s, v) => (I(), F("div", {
784
- class: X(["chat-panel-content chat-panel-content--main", {
713
+ return (l, i) => (P(), F("div", {
714
+ class: _(["chat-panel-content chat-panel-content--main", {
785
715
  "is-message-state": !a.value
786
716
  }])
787
717
  }, [
788
- k(s.$slots, "default", {}, () => [
789
- a.value ? (I(), F("div", {
718
+ C(l.$slots, "default", {}, () => [
719
+ a.value ? (P(), F("div", {
790
720
  key: 0,
791
- class: X(["chat-empty-content", {
792
- "chat-empty-content--centered": n.centerEmptyState || n.centerWelcomeComposer
721
+ class: _(["chat-empty-content", {
722
+ "chat-empty-content--centered": o.centerEmptyState || o.centerWelcomeComposer
793
723
  }])
794
724
  }, [
795
- s.$slots["welcome-composer"] ? (I(), F("div", mo, [
796
- O.value ? (I(), W(y(Te), D(N({ key: 0 }, O.value)), {
797
- footer: E(() => [
798
- k(s.$slots, "welcome-footer", {}, void 0, !0),
799
- k(s.$slots, "welcome-composer", {}, void 0, !0)
725
+ l.$slots["welcome-composer"] ? (P(), F("div", An, [
726
+ k.value ? (P(), W(p(Pe), q(N({ key: 0 }, k.value)), {
727
+ footer: S(() => [
728
+ C(l.$slots, "welcome-footer", {}, void 0, !0),
729
+ C(l.$slots, "welcome-composer", {}, void 0, !0)
800
730
  ]),
801
731
  _: 3
802
- }, 16)) : B("", !0),
803
- L.value ? (I(), W(y(Me), N({ key: 1 }, C.value, { onItemClick: p }), z({ _: 2 }, [
804
- s.$slots["prompts-footer"] ? {
732
+ }, 16)) : U("", !0),
733
+ E.value ? (P(), W(p(Le), N({ key: 1 }, T.value, { onItemClick: I }), J({ _: 2 }, [
734
+ l.$slots["prompts-footer"] ? {
805
735
  name: "footer",
806
- fn: E(() => [
807
- k(s.$slots, "prompts-footer", {}, void 0, !0)
736
+ fn: S(() => [
737
+ C(l.$slots, "prompts-footer", {}, void 0, !0)
808
738
  ]),
809
739
  key: "0"
810
740
  } : void 0
811
- ]), 1040)) : B("", !0)
812
- ])) : (I(), F(Ae, { key: 1 }, [
813
- O.value ? (I(), W(y(Te), D(N({ key: 0 }, O.value)), z({ _: 2 }, [
814
- s.$slots["welcome-footer"] ? {
741
+ ]), 1040)) : U("", !0)
742
+ ])) : (P(), F(Se, { key: 1 }, [
743
+ k.value ? (P(), W(p(Pe), q(N({ key: 0 }, k.value)), J({ _: 2 }, [
744
+ l.$slots["welcome-footer"] ? {
815
745
  name: "footer",
816
- fn: E(() => [
817
- k(s.$slots, "welcome-footer", {}, void 0, !0)
746
+ fn: S(() => [
747
+ C(l.$slots, "welcome-footer", {}, void 0, !0)
818
748
  ]),
819
749
  key: "0"
820
750
  } : void 0
821
- ]), 1040)) : B("", !0),
822
- L.value ? (I(), W(y(Me), N({ key: 1 }, C.value, { onItemClick: p }), z({ _: 2 }, [
823
- s.$slots["prompts-footer"] ? {
751
+ ]), 1040)) : U("", !0),
752
+ E.value ? (P(), W(p(Le), N({ key: 1 }, T.value, { onItemClick: I }), J({ _: 2 }, [
753
+ l.$slots["prompts-footer"] ? {
824
754
  name: "footer",
825
- fn: E(() => [
826
- k(s.$slots, "prompts-footer", {}, void 0, !0)
755
+ fn: S(() => [
756
+ C(l.$slots, "prompts-footer", {}, void 0, !0)
827
757
  ]),
828
758
  key: "0"
829
759
  } : void 0
830
- ]), 1040)) : B("", !0)
760
+ ]), 1040)) : U("", !0)
831
761
  ], 64))
832
- ], 2)) : (I(), W(y(ft), D(N({ key: 1 }, c.value)), {
833
- default: E(() => [
834
- U(y(vt), N(f.value, {
762
+ ], 2)) : (P(), W(p(pt), q(N({ key: 1 }, f.value)), {
763
+ default: S(() => [
764
+ D(p(yt), N(m.value, {
835
765
  class: "tr-chat-messages__bubble-list",
836
- messages: b.value,
837
- onStateChange: r,
838
- onBubbleEvent: i
839
- }), z({ _: 2 }, [
840
- s.$slots["bubble-prefix"] ? {
766
+ messages: u.value,
767
+ onStateChange: d,
768
+ onBubbleEvent: s
769
+ }), J({ _: 2 }, [
770
+ l.$slots["bubble-prefix"] ? {
841
771
  name: "prefix",
842
- fn: E(() => [
843
- k(s.$slots, "bubble-prefix", {}, void 0, !0)
772
+ fn: S(() => [
773
+ C(l.$slots, "bubble-prefix", {}, void 0, !0)
844
774
  ]),
845
775
  key: "0"
846
776
  } : void 0,
847
- s.$slots["bubble-suffix"] ? {
777
+ l.$slots["bubble-suffix"] ? {
848
778
  name: "suffix",
849
- fn: E(() => [
850
- k(s.$slots, "bubble-suffix", {}, void 0, !0)
779
+ fn: S(() => [
780
+ C(l.$slots, "bubble-suffix", {}, void 0, !0)
851
781
  ]),
852
782
  key: "1"
853
783
  } : void 0,
854
- s.$slots["bubble-after"] ? {
784
+ l.$slots["bubble-after"] ? {
855
785
  name: "after",
856
- fn: E(() => [
857
- k(s.$slots, "bubble-after", {}, void 0, !0)
786
+ fn: S(() => [
787
+ C(l.$slots, "bubble-after", {}, void 0, !0)
858
788
  ]),
859
789
  key: "2"
860
790
  } : void 0,
861
- s.$slots["bubble-content-footer"] ? {
791
+ l.$slots["bubble-content-footer"] ? {
862
792
  name: "content-footer",
863
- fn: E(() => [
864
- k(s.$slots, "bubble-content-footer", {}, void 0, !0)
793
+ fn: S(() => [
794
+ C(l.$slots, "bubble-content-footer", {}, void 0, !0)
865
795
  ]),
866
796
  key: "3"
867
797
  } : void 0
@@ -872,7 +802,7 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
872
802
  ], !0)
873
803
  ], 2));
874
804
  }
875
- }), go = /* @__PURE__ */ Y(bo, [["__scopeId", "data-v-d0b8924e"]]), ho = { class: "chat-right-aside" }, po = { class: "chat-right-aside__header" }, yo = ["aria-label", "title"], Co = { class: "chat-right-aside__body" }, Ao = /* @__PURE__ */ J({
805
+ }), wn = /* @__PURE__ */ Y(Cn, [["__scopeId", "data-v-d0b8924e"]]), Sn = { class: "chat-right-aside" }, kn = { class: "chat-right-aside__header" }, En = ["aria-label", "title"], On = { class: "chat-right-aside__body" }, Rn = /* @__PURE__ */ Z({
876
806
  __name: "ChatRightAside",
877
807
  props: {
878
808
  showClose: { type: Boolean, default: !0 },
@@ -880,97 +810,206 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
880
810
  },
881
811
  emits: ["close"],
882
812
  setup(e, { emit: t }) {
883
- const n = t;
884
- return (o, u) => (I(), F("section", ho, [
885
- V("header", po, [
886
- k(o.$slots, "title", {}, void 0, !0),
887
- e.showClose ? (I(), F("button", {
813
+ const o = t;
814
+ return (n, c) => (P(), F("section", Sn, [
815
+ B("header", kn, [
816
+ C(n.$slots, "title", {}, void 0, !0),
817
+ e.showClose ? (P(), F("button", {
888
818
  key: 0,
889
819
  class: "chat-right-aside__close",
890
820
  type: "button",
891
821
  "aria-label": e.labels.closeRightAside,
892
822
  title: e.labels.closeRightAside,
893
- onClick: u[0] || (u[0] = (m) => n("close"))
823
+ onClick: c[0] || (c[0] = (v) => o("close"))
894
824
  }, [
895
- U(y(Ct), { class: "chat-right-aside__close-icon" })
896
- ], 8, yo)) : B("", !0)
825
+ D(p(Rt), { class: "chat-right-aside__close-icon" })
826
+ ], 8, En)) : U("", !0)
897
827
  ]),
898
- V("div", Co, [
899
- k(o.$slots, "default", {}, void 0, !0)
828
+ B("div", On, [
829
+ C(n.$slots, "default", {}, void 0, !0)
900
830
  ])
901
831
  ]));
902
832
  }
903
- }), wo = /* @__PURE__ */ Y(Ao, [["__scopeId", "data-v-1013d8c6"]]);
833
+ }), Tn = /* @__PURE__ */ Y(Rn, [["__scopeId", "data-v-1013d8c6"]]), Mn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAyKADAAQAAAABAAAAyAAAAACbWz2VAAAR3UlEQVR4Ae2daaxeQxjHtS6t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ZdiXC2hpkW/p9ZIpZBuxUTxq4gLVZCILujcBYC3zW742KIdishHoKVEEhLFN8fmD17dktSdoRsxWXDV2FcGpowTmUBr+eff16Tp0viO1FJhRZLR0csDV+ywLnQ7u7uWJoUpN1S0iFYEiUqj2yZZZQqQbBSItElkC2dVKQ0zrEk6STyCsy3li1bNn78+EQ7TYgSrHxazssWPle2cuXKfM9oi9J8FeZTY953ItzsEqx8Im5s6bxsrVixooGyosUqovRcbOHj50WeEXgdglVQgfZs4RpZwWeEXI2T91LaM87lR4wYsXHjxr78Al6p8VRXmRarlCxlu4VvqDzxxBMNpAoyJVilwEJlxVZPT0+ioc7OTuwFXXDBBYn0hkT5KqxM0VhWwDfD4O5h7733njhx4syZM3EGtbLWQ2uIYIWmsUD6y1dhIIoKrZsEKzSNBdJfghWIokLrJsEKTWOB9JdgBaKo0LpJsELTWCD9JViBKCq0bhKs0DQWSH8JViCKCq2bBCs0jQXSX4IViKJC6ybBCk1jgfSXYAWiqNC6SbBC01gg/SVYgSgqtG4SrNA0Fkh//wPu1RstRJJwCgAAAABJRU5ErkJggg==", Pn = { class: "chat-mcp-panel" }, Ln = /* @__PURE__ */ Z({
834
+ __name: "ChatMcpPanel",
835
+ props: {
836
+ mcp: {},
837
+ labels: {}
838
+ },
839
+ emits: ["close", "addServer", "removeServer", "updateServerEnabled", "updateToolEnabled"],
840
+ setup(e, { emit: t }) {
841
+ const o = e, n = t, c = h({
842
+ get: () => !0,
843
+ set: (s) => {
844
+ s || n("close");
845
+ }
846
+ }), v = h(() => o.mcp.servers ?? []), b = h(() => o.mcp.tools ?? {}), a = h(() => v.value.filter((s) => s.installed && s.enabled).length), r = h(
847
+ () => v.value.some((s) => {
848
+ var l;
849
+ return !!(s.loading || (l = b.value[s.id]) != null && l.some((i) => i.loading));
850
+ })
851
+ ), u = h(
852
+ () => v.value.filter((s) => s.installed).map((s) => k(s, !0))
853
+ ), y = h(() => v.value.map((s) => k(s, !1))), f = {
854
+ position: "static",
855
+ top: "auto",
856
+ right: "auto",
857
+ bottom: "auto",
858
+ left: "auto",
859
+ transform: "none",
860
+ zIndex: "auto",
861
+ width: "100%",
862
+ maxWidth: "none",
863
+ height: "100%",
864
+ minHeight: "0"
865
+ };
866
+ function m(s, l) {
867
+ var A;
868
+ const i = (A = s.metadata) == null ? void 0 : A[l];
869
+ return typeof i == "string" ? i : void 0;
870
+ }
871
+ function k(s, l) {
872
+ const i = l && s.installed ? b.value[s.id] ?? [] : [];
873
+ return {
874
+ id: s.id,
875
+ name: s.name,
876
+ icon: m(s, "icon") ?? Mn,
877
+ description: s.description ?? "",
878
+ enabled: s.enabled,
879
+ expanded: !0,
880
+ tools: i.map((A) => ({
881
+ id: A.id,
882
+ name: A.name,
883
+ description: A.description ?? "",
884
+ enabled: A.enabled
885
+ })),
886
+ addState: s.loading ? "loading" : s.installed ? "added" : "idle",
887
+ category: m(s, "category")
888
+ };
889
+ }
890
+ function T(s) {
891
+ return v.value.find((l) => l.id === s);
892
+ }
893
+ function E(s) {
894
+ const l = T(s.id);
895
+ !l || l.installed || l.loading || n("addServer", { id: s.id });
896
+ }
897
+ function R(s) {
898
+ const l = T(s.id);
899
+ !l || !l.installed || l.loading || n("removeServer", { id: s.id });
900
+ }
901
+ function I(s, l) {
902
+ const i = T(s.id);
903
+ !i || !i.installed || i.loading || i.enabled === l || n("updateServerEnabled", { id: s.id, enabled: l });
904
+ }
905
+ function d(s, l, i) {
906
+ var $;
907
+ const A = T(s.id), M = ($ = b.value[s.id]) == null ? void 0 : $.find((V) => V.id === l);
908
+ !A || !A.installed || !M || M.loading || M.enabled === i || n("updateToolEnabled", { serverId: s.id, toolId: l, enabled: i });
909
+ }
910
+ return (s, l) => (P(), F("div", Pn, [
911
+ D(p(At), {
912
+ visible: c.value,
913
+ "onUpdate:visible": l[0] || (l[0] = (i) => c.value = i),
914
+ style: f,
915
+ "active-count": a.value,
916
+ "installed-plugins": u.value,
917
+ "market-plugins": y.value,
918
+ loading: r.value,
919
+ "market-loading": !1,
920
+ title: e.labels.mcp,
921
+ "show-custom-add-button": !1,
922
+ "allow-plugin-delete": !0,
923
+ "allow-tool-toggle": !0,
924
+ onPluginToggle: I,
925
+ onPluginAdd: E,
926
+ onPluginDelete: R,
927
+ onToolToggle: d
928
+ }, null, 8, ["visible", "active-count", "installed-plugins", "market-plugins", "loading", "title"])
929
+ ]));
930
+ }
931
+ }), $n = /* @__PURE__ */ Y(Ln, [["__scopeId", "data-v-5fd73b95"]]);
904
932
  function se(e, t) {
905
933
  return typeof e == "number" ? e : t;
906
934
  }
907
- function So(e) {
908
- const t = G(e.leftAside), n = G(e.rightAside), o = q(t !== !1 ? (t == null ? void 0 : t.open) ?? (t == null ? void 0 : t.defaultOpen) ?? !1 : !1), u = q(
909
- n !== !1 ? (n == null ? void 0 : n.open) ?? (n == null ? void 0 : n.defaultOpen) ?? !1 : !1
910
- ), m = h(() => G(e.isMobileViewport)), d = h(() => G(e.viewportWidth)), a = h(() => G(e.leftAside)), l = h(() => G(e.rightAside)), b = h(() => {
911
- const p = a.value;
912
- return p !== !1 ? (p == null ? void 0 : p.open) ?? o.value : !1;
913
- }), A = h(() => {
914
- const p = l.value;
915
- return p !== !1 ? (p == null ? void 0 : p.open) ?? u.value : !1;
916
- }), c = h(
935
+ function In(e) {
936
+ const t = z(e.leftAside), o = z(e.rightAside), n = z(e.rightAsidePanel), c = K(t !== !1 ? (t == null ? void 0 : t.open) ?? (t == null ? void 0 : t.defaultOpen) ?? !1 : !1), v = K(
937
+ o !== !1 ? (o == null ? void 0 : o.open) ?? (o == null ? void 0 : o.defaultOpen) ?? !1 : !1
938
+ ), b = K(n), a = h(() => z(e.isMobileViewport)), r = h(() => z(e.viewportWidth)), u = h(() => z(e.leftAside)), y = h(() => z(e.rightAside)), f = h(() => {
939
+ const i = u.value;
940
+ return i !== !1 ? (i == null ? void 0 : i.open) ?? c.value : !1;
941
+ }), m = h(() => {
942
+ const i = y.value;
943
+ return i !== !1 ? (i == null ? void 0 : i.open) ?? v.value : !1;
944
+ }), k = h(() => {
945
+ const i = z(e.rightAsidePanel);
946
+ return i !== void 0 ? i : b.value;
947
+ }), T = h(
917
948
  () => {
918
- var p;
919
- return m.value ? "drawer" : a.value !== !1 ? (p = a.value) == null ? void 0 : p.mode : "dock";
949
+ var i;
950
+ return a.value ? "drawer" : u.value !== !1 ? (i = u.value) == null ? void 0 : i.mode : "dock";
920
951
  }
921
- ), f = h(
952
+ ), E = h(
922
953
  () => {
923
- var p;
924
- return m.value ? "drawer" : l.value !== !1 ? (p = l.value) == null ? void 0 : p.mode : "dock";
954
+ var i;
955
+ return a.value ? "drawer" : y.value !== !1 ? (i = y.value) == null ? void 0 : i.mode : "dock";
925
956
  }
926
- ), O = h(() => {
927
- const p = a.value, r = se(p !== !1 ? p == null ? void 0 : p.width : void 0, 300);
957
+ ), R = h(() => {
958
+ const i = u.value, A = se(i !== !1 ? i == null ? void 0 : i.width : void 0, 300);
928
959
  return {
929
- mode: c.value,
930
- open: b.value,
931
- expandedWidth: m.value && d.value > 0 ? Math.min(r, Math.floor(d.value * 0.86)) : r,
932
- collapsedWidth: m.value || p === !1 ? 0 : se(p == null ? void 0 : p.collapsedWidth, 56),
960
+ mode: T.value,
961
+ open: f.value,
962
+ expandedWidth: a.value && r.value > 0 ? Math.min(A, Math.floor(r.value * 0.86)) : A,
963
+ collapsedWidth: a.value || i === !1 ? 0 : se(i == null ? void 0 : i.collapsedWidth, 56),
933
964
  collapseEffect: "overlay"
934
965
  };
935
- }), C = h(() => {
936
- const p = l.value, r = m.value && d.value > 0 ? d.value : void 0;
966
+ }), I = h(() => {
967
+ const i = y.value, A = a.value && r.value > 0 ? r.value : void 0;
937
968
  return {
938
- mode: f.value,
939
- open: A.value,
940
- expandedWidth: r ?? se(p !== !1 ? p == null ? void 0 : p.width : void 0, 320),
941
- minExpandedWidth: r,
942
- maxExpandedWidth: r,
943
- collapsedWidth: m.value || p === !1 ? 0 : se(p == null ? void 0 : p.collapsedWidth, 0),
969
+ mode: E.value,
970
+ open: m.value,
971
+ expandedWidth: A ?? se(i !== !1 ? i == null ? void 0 : i.width : void 0, 320),
972
+ minExpandedWidth: A,
973
+ maxExpandedWidth: A,
974
+ collapsedWidth: a.value || i === !1 ? 0 : se(i == null ? void 0 : i.collapsedWidth, 0),
944
975
  collapseEffect: "overlay"
945
976
  };
946
977
  });
947
- function L(p, r = "user") {
948
- var i;
949
- b.value !== p && (a.value !== !1 && ((i = a.value) == null ? void 0 : i.open) === void 0 && (o.value = p), e.onLeftOpenChange({ open: p, source: r }));
978
+ function d(i, A = "user") {
979
+ var M;
980
+ f.value !== i && (u.value !== !1 && ((M = u.value) == null ? void 0 : M.open) === void 0 && (c.value = i), e.onLeftOpenChange({ open: i, source: A }));
981
+ }
982
+ function s(i, A = "user") {
983
+ var M;
984
+ m.value !== i && (y.value !== !1 && ((M = y.value) == null ? void 0 : M.open) === void 0 && (v.value = i), e.onRightOpenChange({ open: i, source: A }));
950
985
  }
951
- function T(p, r = "user") {
952
- var i;
953
- A.value !== p && (l.value !== !1 && ((i = l.value) == null ? void 0 : i.open) === void 0 && (u.value = p), e.onRightOpenChange({ open: p, source: r }));
986
+ function l(i) {
987
+ var A;
988
+ z(e.rightAsidePanel) === void 0 && (b.value = i), (A = e.onRightAsidePanelChange) == null || A.call(e, i);
954
989
  }
955
- return ue(m, (p) => {
956
- p && (L(!1, "viewport"), T(!1, "viewport"));
990
+ return ue(a, (i) => {
991
+ i && (d(!1, "viewport"), s(!1, "viewport"));
957
992
  }), {
958
- leftAsideOptions: O,
959
- rightAsideOptions: C,
960
- resolvedLeftAsideOpen: b,
961
- resolvedRightAsideOpen: A,
962
- isLeftAsideDock: h(() => c.value === "dock"),
963
- isLeftAsideDrawer: h(() => c.value === "drawer"),
964
- openLeftAside: () => L(!0),
965
- closeLeftAside: () => L(!1),
966
- toggleLeftAside: () => L(!b.value),
967
- closeRightAside: () => T(!1),
968
- openRightAside: () => T(!0),
969
- handleLeftAsideOpenChange: (p) => L(p.open),
970
- handleRightAsideOpenChange: (p) => T(p.open)
993
+ leftAsideOptions: R,
994
+ rightAsideOptions: I,
995
+ resolvedLeftAsideOpen: f,
996
+ resolvedRightAsideOpen: m,
997
+ resolvedRightAsidePanel: k,
998
+ isLeftAsideDock: h(() => T.value === "dock"),
999
+ isLeftAsideDrawer: h(() => T.value === "drawer"),
1000
+ openLeftAside: () => d(!0),
1001
+ closeLeftAside: () => d(!1),
1002
+ toggleLeftAside: () => d(!f.value),
1003
+ closeRightAside: () => s(!1),
1004
+ openRightAside: (i) => {
1005
+ i !== void 0 && l(i), s(!0);
1006
+ },
1007
+ setRightAsidePanel: l,
1008
+ handleLeftAsideOpenChange: (i) => d(i.open),
1009
+ handleRightAsideOpenChange: (i) => s(i.open)
971
1010
  };
972
1011
  }
973
- function ko() {
1012
+ function Vn() {
974
1013
  return {
975
1014
  newConversationTitle: "新对话",
976
1015
  createConversation: "新建会话",
@@ -991,8 +1030,8 @@ function ko() {
991
1030
  closeRightAside: "关闭详情"
992
1031
  };
993
1032
  }
994
- function Eo() {
995
- const e = ko();
1033
+ function Bn() {
1034
+ const e = Vn();
996
1035
  return {
997
1036
  layout: {
998
1037
  surface: {
@@ -1038,7 +1077,7 @@ function Eo() {
1038
1077
  title: e.welcomeTitle,
1039
1078
  description: e.welcomeDescription,
1040
1079
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1041
- icon: be(le, { style: { fontSize: "40px" } })
1080
+ icon: he(le, { style: { fontSize: "40px" } })
1042
1081
  },
1043
1082
  prompts: {
1044
1083
  items: []
@@ -1053,7 +1092,7 @@ function Eo() {
1053
1092
  mcp: {}
1054
1093
  };
1055
1094
  }
1056
- function Oo(e) {
1095
+ function Un(e) {
1057
1096
  return {
1058
1097
  conversation: {
1059
1098
  items: [],
@@ -1072,69 +1111,69 @@ function Oo(e) {
1072
1111
  mcp: void 0
1073
1112
  };
1074
1113
  }
1075
- function To(e, t) {
1076
- var o, u, m, d, a, l, b;
1077
- const n = Oo(t);
1114
+ function Fn(e, t) {
1115
+ var n, c, v, b, a, r, u;
1116
+ const o = Un(t);
1078
1117
  return {
1079
1118
  conversation: {
1080
- items: ((o = e == null ? void 0 : e.conversation) == null ? void 0 : o.items) ?? n.conversation.items,
1081
- activeId: ((u = e == null ? void 0 : e.conversation) == null ? void 0 : u.activeId) ?? n.conversation.activeId,
1082
- title: ((m = e == null ? void 0 : e.conversation) == null ? void 0 : m.title) ?? n.conversation.title
1119
+ items: ((n = e == null ? void 0 : e.conversation) == null ? void 0 : n.items) ?? o.conversation.items,
1120
+ activeId: ((c = e == null ? void 0 : e.conversation) == null ? void 0 : c.activeId) ?? o.conversation.activeId,
1121
+ title: ((v = e == null ? void 0 : e.conversation) == null ? void 0 : v.title) ?? o.conversation.title
1083
1122
  },
1084
1123
  bubble: {
1085
- messages: ((d = e == null ? void 0 : e.bubble) == null ? void 0 : d.messages) ?? n.bubble.messages
1124
+ messages: ((b = e == null ? void 0 : e.bubble) == null ? void 0 : b.messages) ?? o.bubble.messages
1086
1125
  },
1087
1126
  sender: {
1088
- loading: ((a = e == null ? void 0 : e.sender) == null ? void 0 : a.loading) ?? n.sender.loading,
1089
- disabled: ((l = e == null ? void 0 : e.sender) == null ? void 0 : l.disabled) ?? n.sender.disabled,
1090
- submitDisabled: ((b = e == null ? void 0 : e.sender) == null ? void 0 : b.submitDisabled) ?? n.sender.submitDisabled
1127
+ loading: ((a = e == null ? void 0 : e.sender) == null ? void 0 : a.loading) ?? o.sender.loading,
1128
+ disabled: ((r = e == null ? void 0 : e.sender) == null ? void 0 : r.disabled) ?? o.sender.disabled,
1129
+ submitDisabled: ((u = e == null ? void 0 : e.sender) == null ? void 0 : u.submitDisabled) ?? o.sender.submitDisabled
1091
1130
  },
1092
1131
  request: e == null ? void 0 : e.request,
1093
- model: (e == null ? void 0 : e.model) ?? n.model,
1094
- mcp: (e == null ? void 0 : e.mcp) ?? n.mcp
1132
+ model: (e == null ? void 0 : e.model) ?? o.model,
1133
+ mcp: (e == null ? void 0 : e.mcp) ?? o.mcp
1095
1134
  };
1096
1135
  }
1097
- function Mo(e) {
1098
- const t = Eo(), n = Ro(t.labels, e == null ? void 0 : e.labels);
1136
+ function Wn(e) {
1137
+ const t = Bn(), o = Dn(t.labels, e == null ? void 0 : e.labels);
1099
1138
  return {
1100
- layout: Lo(t.layout, e == null ? void 0 : e.layout),
1101
- brand: Vo(t.brand, e == null ? void 0 : e.brand),
1102
- labels: n,
1139
+ layout: qn(t.layout, e == null ? void 0 : e.layout),
1140
+ brand: jn(t.brand, e == null ? void 0 : e.brand),
1141
+ labels: o,
1103
1142
  header: (e == null ? void 0 : e.header) !== !1,
1104
- history: Po(t.history, e == null ? void 0 : e.history, n),
1105
- bubble: Bo(t.bubble, e == null ? void 0 : e.bubble),
1106
- welcome: Uo(t.welcome, e == null ? void 0 : e.welcome, n),
1107
- prompts: Fo(t.prompts, e == null ? void 0 : e.prompts),
1108
- sender: Wo(t.sender, e == null ? void 0 : e.sender),
1109
- model: Do(e == null ? void 0 : e.model),
1110
- mcp: qo(e == null ? void 0 : e.mcp)
1143
+ history: Jn(t.history, e == null ? void 0 : e.history, o),
1144
+ bubble: Zn(t.bubble, e == null ? void 0 : e.bubble),
1145
+ welcome: Gn(t.welcome, e == null ? void 0 : e.welcome, o),
1146
+ prompts: Yn(t.prompts, e == null ? void 0 : e.prompts),
1147
+ sender: Nn(t.sender, e == null ? void 0 : e.sender),
1148
+ model: Hn(e == null ? void 0 : e.model),
1149
+ mcp: Qn(e == null ? void 0 : e.mcp)
1111
1150
  };
1112
1151
  }
1113
- function Ro(e, t) {
1152
+ function Dn(e, t) {
1114
1153
  return {
1115
1154
  ...e,
1116
- ...H(t)
1155
+ ...X(t)
1117
1156
  };
1118
1157
  }
1119
- function Lo(e, t) {
1120
- var n, o, u;
1158
+ function qn(e, t) {
1159
+ var o, n, c;
1121
1160
  return {
1122
1161
  surface: {
1123
- mode: ((n = t == null ? void 0 : t.surface) == null ? void 0 : n.mode) ?? e.surface.mode,
1124
- floatingOptions: (o = t == null ? void 0 : t.surface) == null ? void 0 : o.floatingOptions
1162
+ mode: ((o = t == null ? void 0 : t.surface) == null ? void 0 : o.mode) ?? e.surface.mode,
1163
+ floatingOptions: (n = t == null ? void 0 : t.surface) == null ? void 0 : n.floatingOptions
1125
1164
  },
1126
1165
  emptyState: (t == null ? void 0 : t.emptyState) ?? e.emptyState,
1127
1166
  composer: {
1128
- welcome: ((u = t == null ? void 0 : t.composer) == null ? void 0 : u.welcome) ?? e.composer.welcome
1167
+ welcome: ((c = t == null ? void 0 : t.composer) == null ? void 0 : c.welcome) ?? e.composer.welcome
1129
1168
  },
1130
1169
  contentMaxWidth: (t == null ? void 0 : t.contentMaxWidth) ?? e.contentMaxWidth,
1131
1170
  panelPadding: (t == null ? void 0 : t.panelPadding) ?? e.panelPadding,
1132
1171
  panelGap: (t == null ? void 0 : t.panelGap) ?? e.panelGap,
1133
- leftAside: $o(e.leftAside, t == null ? void 0 : t.leftAside),
1134
- rightAside: Io(t == null ? void 0 : t.rightAside)
1172
+ leftAside: Kn(e.leftAside, t == null ? void 0 : t.leftAside),
1173
+ rightAside: zn(t == null ? void 0 : t.rightAside)
1135
1174
  };
1136
1175
  }
1137
- function $o(e, t) {
1176
+ function Kn(e, t) {
1138
1177
  return t === !1 ? !1 : {
1139
1178
  mode: (t == null ? void 0 : t.mode) ?? e.mode,
1140
1179
  width: (t == null ? void 0 : t.width) ?? e.width,
@@ -1143,7 +1182,7 @@ function $o(e, t) {
1143
1182
  defaultOpen: (t == null ? void 0 : t.defaultOpen) ?? e.defaultOpen
1144
1183
  };
1145
1184
  }
1146
- function Io(e) {
1185
+ function zn(e) {
1147
1186
  return e === !1 || !e ? !1 : {
1148
1187
  open: e == null ? void 0 : e.open,
1149
1188
  mode: (e == null ? void 0 : e.mode) ?? "dock",
@@ -1153,96 +1192,96 @@ function Io(e) {
1153
1192
  showClose: (e == null ? void 0 : e.showClose) ?? !0
1154
1193
  };
1155
1194
  }
1156
- function Vo(e, t) {
1195
+ function jn(e, t) {
1157
1196
  return {
1158
1197
  ...e,
1159
- ...H(t)
1198
+ ...X(t)
1160
1199
  };
1161
1200
  }
1162
- function Po(e, t, n) {
1201
+ function Jn(e, t, o) {
1163
1202
  if (t === !1)
1164
1203
  return !1;
1165
- const o = {
1204
+ const n = {
1166
1205
  ...e,
1167
1206
  menuItems: [
1168
- { id: "rename", text: n.renameConversation },
1169
- { id: "delete", text: n.deleteConversation }
1207
+ { id: "rename", text: o.renameConversation },
1208
+ { id: "delete", text: o.deleteConversation }
1170
1209
  ]
1171
1210
  };
1172
1211
  return {
1173
- ...o,
1174
- ...H(t),
1175
- menuItems: t != null && t.menuItems ? [...t.menuItems] : [...o.menuItems]
1212
+ ...n,
1213
+ ...X(t),
1214
+ menuItems: t != null && t.menuItems ? [...t.menuItems] : [...n.menuItems]
1176
1215
  };
1177
1216
  }
1178
- function Bo(e, t) {
1179
- var n, o;
1217
+ function Zn(e, t) {
1218
+ var o, n;
1180
1219
  return {
1181
1220
  ...e,
1182
- ...H(t),
1221
+ ...X(t),
1183
1222
  autoScroll: (t == null ? void 0 : t.autoScroll) ?? e.autoScroll,
1184
1223
  bubbleProvider: (t == null ? void 0 : t.bubbleProvider) ?? e.bubbleProvider,
1185
1224
  bubbleList: {
1186
1225
  ...e.bubbleList,
1187
- ...H(t == null ? void 0 : t.bubbleList),
1226
+ ...X(t == null ? void 0 : t.bubbleList),
1188
1227
  roleConfigs: {
1189
- ...(n = e.bubbleList) == null ? void 0 : n.roleConfigs,
1190
- ...Ko((o = t == null ? void 0 : t.bubbleList) == null ? void 0 : o.roleConfigs)
1228
+ ...(o = e.bubbleList) == null ? void 0 : o.roleConfigs,
1229
+ ...Xn((n = t == null ? void 0 : t.bubbleList) == null ? void 0 : n.roleConfigs)
1191
1230
  }
1192
1231
  }
1193
1232
  };
1194
1233
  }
1195
- function Uo(e, t, n) {
1234
+ function Gn(e, t, o) {
1196
1235
  if (t === !1)
1197
1236
  return !1;
1198
- const o = {
1237
+ const n = {
1199
1238
  ...e,
1200
- title: n.welcomeTitle,
1201
- description: n.welcomeDescription
1239
+ title: o.welcomeTitle,
1240
+ description: o.welcomeDescription
1202
1241
  };
1203
1242
  return {
1204
- ...o,
1205
- ...H(t),
1206
- title: (t == null ? void 0 : t.title) ?? o.title,
1207
- description: (t == null ? void 0 : t.description) ?? o.description
1243
+ ...n,
1244
+ ...X(t),
1245
+ title: (t == null ? void 0 : t.title) ?? n.title,
1246
+ description: (t == null ? void 0 : t.description) ?? n.description
1208
1247
  };
1209
1248
  }
1210
- function Fo(e, t) {
1249
+ function Yn(e, t) {
1211
1250
  return t === !1 ? !1 : {
1212
1251
  ...e,
1213
- ...H(t),
1252
+ ...X(t),
1214
1253
  items: [...(t == null ? void 0 : t.items) ?? e.items]
1215
1254
  };
1216
1255
  }
1217
- function Wo(e, t) {
1256
+ function Nn(e, t) {
1218
1257
  return t === !1 ? !1 : {
1219
1258
  ...e,
1220
- ...H(t)
1259
+ ...X(t)
1221
1260
  };
1222
1261
  }
1223
- function Do(e) {
1262
+ function Hn(e) {
1224
1263
  return e === !1 ? !1 : e ?? {};
1225
1264
  }
1226
- function qo(e) {
1265
+ function Qn(e) {
1227
1266
  return e === !1 ? !1 : e ?? {};
1228
1267
  }
1229
- function H(e) {
1268
+ function X(e) {
1230
1269
  const t = {};
1231
1270
  if (!e)
1232
1271
  return t;
1233
- for (const n of Object.keys(e))
1234
- e[n] !== void 0 && (t[n] = e[n]);
1272
+ for (const o of Object.keys(e))
1273
+ e[o] !== void 0 && (t[o] = e[o]);
1235
1274
  return t;
1236
1275
  }
1237
- function Ko(e) {
1276
+ function Xn(e) {
1238
1277
  const t = {};
1239
1278
  if (!e)
1240
1279
  return t;
1241
- for (const [n, o] of Object.entries(e))
1242
- o !== void 0 && (t[n] = o);
1280
+ for (const [o, n] of Object.entries(e))
1281
+ n !== void 0 && (t[o] = n);
1243
1282
  return t;
1244
1283
  }
1245
- function zo(e) {
1284
+ function xn(e) {
1246
1285
  if (e instanceof Error)
1247
1286
  return e.message || String(e);
1248
1287
  if (typeof e == "string")
@@ -1257,225 +1296,240 @@ function zo(e) {
1257
1296
  }
1258
1297
  return String(e);
1259
1298
  }
1260
- const jo = { class: "chat-panel-content chat-panel-content--header" }, Jo = { class: "chat-panel" }, Zo = {
1299
+ const _n = { class: "chat-panel-content chat-panel-content--header" }, eo = { class: "chat-panel" }, to = {
1261
1300
  key: 0,
1262
1301
  class: "chat-request-error",
1263
1302
  role: "alert"
1264
- }, Go = { class: "chat-scroll-actions" }, Yo = {
1303
+ }, no = { class: "chat-scroll-actions" }, oo = {
1265
1304
  key: 0,
1266
1305
  class: "chat-panel-content chat-panel-content--footer"
1267
- }, No = { class: "chat-right-aside-title" }, Qo = /* @__PURE__ */ J({
1306
+ }, so = {
1307
+ key: 1,
1308
+ class: "chat-right-aside-title"
1309
+ }, ao = /* @__PURE__ */ Z({
1268
1310
  __name: "ChatUI",
1269
1311
  props: {
1270
1312
  data: {},
1271
1313
  ui: {},
1272
1314
  inputValue: {},
1273
1315
  defaultInputValue: {},
1274
- floatingState: {}
1316
+ floatingState: {},
1317
+ rightAsidePanel: {}
1275
1318
  },
1276
- emits: ["update:floating-state", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end", "update:inputValue", "submit", "cancel", "clear", "create-conversation", "switch-conversation", "rename-conversation", "delete-conversation", "history-action", "prompt-click", "bubble-state-change", "bubble-event", "model-select", "model-feature-change", "mcp-add-server", "mcp-remove-server", "mcp-server-enabled-change", "mcp-tool-enabled-change", "left-aside-open-change", "right-aside-open-change"],
1319
+ emits: ["update:floating-state", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end", "update:inputValue", "submit", "cancel", "clear", "create-conversation", "switch-conversation", "rename-conversation", "delete-conversation", "history-action", "prompt-click", "bubble-state-change", "bubble-event", "model-select", "model-feature-change", "mcp-add-server", "mcp-remove-server", "mcp-server-enabled-change", "mcp-tool-enabled-change", "left-aside-open-change", "right-aside-open-change", "update:right-aside-panel"],
1277
1320
  setup(e, { emit: t }) {
1278
- const n = e, o = t, u = Xe(), m = n.inputValue !== void 0, d = q(n.inputValue ?? n.defaultInputValue ?? ""), a = q(null), b = st({
1321
+ const o = e, n = t, c = st(), v = o.inputValue !== void 0, b = K(o.inputValue ?? o.defaultInputValue ?? ""), a = K(null), u = ct({
1279
1322
  mobile: 0,
1280
1323
  desktop: 960
1281
- }).smaller("desktop"), { width: A } = at(), c = h(() => Mo(n.ui)), f = h(() => To(n.data, c.value.labels)), O = h(() => m ? n.inputValue ?? "" : d.value), C = h(() => c.value.header !== !1), L = h(() => c.value.layout.leftAside), T = h(() => c.value.layout.rightAside), p = h(
1282
- () => c.value.history === !1 ? { menuItems: [] } : c.value.history
1283
- ), r = h(
1284
- () => c.value.sender === !1 ? void 0 : c.value.sender
1285
- ), i = h(() => c.value.model === !1 ? void 0 : f.value.model), s = h(() => c.value.mcp === !1 ? void 0 : f.value.mcp), v = h(() => c.value.sender !== !1), S = h(() => L.value !== !1), $ = h(() => T.value !== !1), w = So({
1286
- leftAside: L,
1287
- rightAside: T,
1288
- isMobileViewport: b,
1289
- viewportWidth: A,
1290
- onLeftOpenChange: (g) => o("left-aside-open-change", g),
1291
- onRightOpenChange: (g) => o("right-aside-open-change", g)
1292
- }), P = h(
1293
- () => c.value.bubble.bubbleList.roleConfigs ?? { system: { hidden: !0 } }
1294
- ), Z = h(
1295
- () => f.value.bubble.messages.filter((g) => !Ke(g.role))
1296
- ), K = h(() => Z.value.length === 0), x = !!u["layout-main"], ee = h(() => K.value && c.value.layout.emptyState === "center"), ce = h(
1297
- () => K.value && r.value !== void 0 && c.value.welcome !== !1 && c.value.layout.composer.welcome === "center" && !x
1298
- ), te = h(() => {
1324
+ }).smaller("desktop"), { width: y } = ft(), f = h(() => Wn(o.ui)), m = h(() => Fn(o.data, f.value.labels)), k = h(() => v ? o.inputValue ?? "" : b.value), T = h(() => f.value.header !== !1), E = h(() => f.value.layout.leftAside), R = h(() => f.value.layout.rightAside), I = !!c["layout-right-aside"], d = !!c["layout-right-aside-content"], s = h(
1325
+ () => f.value.history === !1 ? { menuItems: [] } : f.value.history
1326
+ ), l = h(
1327
+ () => f.value.sender === !1 ? void 0 : f.value.sender
1328
+ ), i = h(() => f.value.model === !1 ? void 0 : m.value.model), A = h(() => f.value.mcp === !1 ? void 0 : m.value.mcp), M = h(() => {
1329
+ var g, w;
1330
+ return (((w = (g = A.value) == null ? void 0 : g.servers) == null ? void 0 : w.length) ?? 0) > 0;
1331
+ }), $ = h(() => I || d || M.value), V = h(() => R.value), x = h(() => f.value.sender !== !1), G = h(() => E.value !== !1), Q = h(() => $.value && V.value !== !1), L = In({
1332
+ leftAside: E,
1333
+ rightAside: V,
1334
+ rightAsidePanel: () => o.rightAsidePanel,
1335
+ isMobileViewport: u,
1336
+ viewportWidth: y,
1337
+ onLeftOpenChange: (g) => n("left-aside-open-change", g),
1338
+ onRightOpenChange: (g) => n("right-aside-open-change", g),
1339
+ onRightAsidePanelChange: (g) => n("update:right-aside-panel", g)
1340
+ }), ze = h(
1341
+ () => L.resolvedRightAsidePanel.value ?? (M.value ? "mcp" : void 0)
1342
+ ), je = h(
1343
+ () => f.value.bubble.bubbleList.roleConfigs ?? { system: { hidden: !0 } }
1344
+ ), ce = h(
1345
+ () => m.value.bubble.messages.filter((g) => !Ne(g.role))
1346
+ ), te = h(() => ce.value.length === 0), Je = !!c["layout-main"], Ze = h(() => te.value && f.value.layout.emptyState === "center"), fe = h(
1347
+ () => te.value && l.value !== void 0 && f.value.welcome !== !1 && f.value.layout.composer.welcome === "center" && !Je
1348
+ ), ne = h(() => {
1299
1349
  var g;
1300
- return (g = f.value.request) == null ? void 0 : g.error;
1301
- }), De = h(() => ({
1350
+ return (g = m.value.request) == null ? void 0 : g.error;
1351
+ }), Ge = h(() => ({
1302
1352
  containerType: "inline-size",
1303
1353
  "--tr-layout-left-aside-bg": "var(--tr-chat-ui-left-aside-bg, var(--tr-container-bg-default))",
1304
1354
  "--tr-layout-right-aside-bg": "var(--tr-chat-ui-right-aside-bg, var(--tr-container-bg-default))",
1305
1355
  "--tr-layout-header-bg": "var(--tr-chat-ui-header-bg, var(--tr-container-bg-default))",
1306
1356
  "--tr-layout-main-bg": "var(--tr-chat-ui-main-bg, var(--tr-container-bg-default))",
1307
1357
  "--tr-layout-footer-bg": "var(--tr-chat-ui-footer-bg, var(--tr-container-bg-default))",
1308
- "--tr-chat-ui-content-max-width": fe(c.value.layout.contentMaxWidth),
1309
- "--tr-chat-ui-panel-padding": fe(c.value.layout.panelPadding),
1310
- "--tr-chat-ui-panel-gap": fe(c.value.layout.panelGap)
1311
- })), qe = h(() => {
1312
- const g = c.value.layout, M = {
1313
- leftAside: S.value ? w.leftAsideOptions.value : void 0,
1314
- rightAside: $.value ? w.rightAsideOptions.value : void 0
1358
+ "--tr-chat-ui-content-max-width": ve(f.value.layout.contentMaxWidth),
1359
+ "--tr-chat-ui-panel-padding": ve(f.value.layout.panelPadding),
1360
+ "--tr-chat-ui-panel-gap": ve(f.value.layout.panelGap)
1361
+ })), Ye = h(() => {
1362
+ const g = f.value.layout, w = {
1363
+ leftAside: G.value ? L.leftAsideOptions.value : void 0,
1364
+ rightAside: Q.value ? L.rightAsideOptions.value : void 0
1315
1365
  };
1316
1366
  return g.surface.mode === "floating" ? {
1317
- ...M,
1367
+ ...w,
1318
1368
  mode: "floating",
1319
- floatingState: n.floatingState,
1369
+ floatingState: o.floatingState,
1320
1370
  floatingOptions: g.surface.floatingOptions
1321
1371
  } : {
1322
- ...M,
1372
+ ...w,
1323
1373
  mode: "normal"
1324
1374
  };
1325
1375
  });
1326
- function fe(g) {
1376
+ function ve(g) {
1327
1377
  return typeof g == "number" ? `${g}px` : g;
1328
1378
  }
1329
- function Ke(g) {
1330
- var M;
1331
- return g ? !!((M = P.value[g]) != null && M.hidden) : !1;
1379
+ function Ne(g) {
1380
+ var w;
1381
+ return g ? !!((w = je.value[g]) != null && w.hidden) : !1;
1332
1382
  }
1333
1383
  function oe() {
1334
- o("create-conversation"), w.isLeftAsideDrawer.value && w.closeLeftAside();
1384
+ n("create-conversation"), L.isLeftAsideDrawer.value && L.closeLeftAside();
1385
+ }
1386
+ function ke(g) {
1387
+ n("switch-conversation", { id: g.id }), L.isLeftAsideDrawer.value && L.closeLeftAside();
1335
1388
  }
1336
- function we(g) {
1337
- o("switch-conversation", { id: g.id }), w.isLeftAsideDrawer.value && w.closeLeftAside();
1389
+ function Ee(g, w) {
1390
+ n("rename-conversation", { id: g.id, title: w });
1338
1391
  }
1339
- function Se(g, M) {
1340
- o("rename-conversation", { id: g.id, title: M });
1392
+ function He(g, w) {
1393
+ n("history-action", { action: g, conversation: w });
1341
1394
  }
1342
- function ze(g, M) {
1343
- o("history-action", { action: g, conversation: M });
1395
+ function Qe(g) {
1396
+ n("delete-conversation", { id: g.id });
1344
1397
  }
1345
- function je(g) {
1346
- o("delete-conversation", { id: g.id });
1398
+ function Xe(g, w) {
1399
+ n("prompt-click", { event: g, item: w });
1347
1400
  }
1348
- function Je(g, M) {
1349
- ne(M.label), o("prompt-click", { event: g, item: M });
1401
+ function Oe(g) {
1402
+ n("submit", g);
1350
1403
  }
1351
- function ke(g) {
1352
- o("submit", g);
1404
+ function Re() {
1405
+ n("cancel");
1353
1406
  }
1354
- function Ee() {
1355
- o("cancel");
1407
+ function Te() {
1408
+ me(""), n("clear");
1356
1409
  }
1357
- function Oe() {
1358
- ne(""), o("clear");
1410
+ function Me() {
1411
+ M.value && L.openRightAside("mcp");
1359
1412
  }
1360
- function ne(g) {
1361
- m || (d.value = g), o("update:inputValue", g);
1413
+ function me(g) {
1414
+ v || (b.value = g), n("update:inputValue", g);
1362
1415
  }
1363
- function Ze(g) {
1364
- o("bubble-state-change", g);
1416
+ function xe(g) {
1417
+ n("bubble-state-change", g);
1365
1418
  }
1366
- function Ge(g) {
1367
- o("bubble-event", g);
1419
+ function _e(g) {
1420
+ n("bubble-event", g);
1368
1421
  }
1369
- return (g, M) => (I(), W(y(ge), N(qe.value, {
1422
+ return (g, w) => (P(), W(p(pe), N(Ye.value, {
1370
1423
  class: "tr-chat-ui",
1371
- style: De.value,
1372
- onLeftAsideOpenChange: y(w).handleLeftAsideOpenChange,
1373
- onRightAsideOpenChange: y(w).handleRightAsideOpenChange,
1374
- "onUpdate:floatingState": M[12] || (M[12] = (R) => o("update:floating-state", R)),
1375
- onFloatingDragStart: M[13] || (M[13] = (R) => o("floating-drag-start", R)),
1376
- onFloatingDrag: M[14] || (M[14] = (R) => o("floating-drag", R)),
1377
- onFloatingDragEnd: M[15] || (M[15] = (R) => o("floating-drag-end", R)),
1378
- onFloatingResizeStart: M[16] || (M[16] = (R) => o("floating-resize-start", R)),
1379
- onFloatingResize: M[17] || (M[17] = (R) => o("floating-resize", R)),
1380
- onFloatingResizeEnd: M[18] || (M[18] = (R) => o("floating-resize-end", R))
1381
- }), z({
1382
- main: E(() => [
1383
- V("section", Jo, [
1384
- V("div", {
1424
+ style: Ge.value,
1425
+ onLeftAsideOpenChange: p(L).handleLeftAsideOpenChange,
1426
+ onRightAsideOpenChange: p(L).handleRightAsideOpenChange,
1427
+ "onUpdate:floatingState": w[16] || (w[16] = (O) => n("update:floating-state", O)),
1428
+ onFloatingDragStart: w[17] || (w[17] = (O) => n("floating-drag-start", O)),
1429
+ onFloatingDrag: w[18] || (w[18] = (O) => n("floating-drag", O)),
1430
+ onFloatingDragEnd: w[19] || (w[19] = (O) => n("floating-drag-end", O)),
1431
+ onFloatingResizeStart: w[20] || (w[20] = (O) => n("floating-resize-start", O)),
1432
+ onFloatingResize: w[21] || (w[21] = (O) => n("floating-resize", O)),
1433
+ onFloatingResizeEnd: w[22] || (w[22] = (O) => n("floating-resize-end", O))
1434
+ }), J({
1435
+ main: S(() => [
1436
+ B("section", eo, [
1437
+ B("div", {
1385
1438
  ref_key: "scrollTarget",
1386
1439
  ref: a,
1387
1440
  class: "chat-main-scroll-host"
1388
1441
  }, [
1389
- te.value !== void 0 && te.value !== null ? (I(), F("div", Zo, [
1390
- k(g.$slots, "request-error", { error: te.value }, () => [
1391
- Ie(Q(y(zo)(te.value)), 1)
1442
+ ne.value !== void 0 && ne.value !== null ? (P(), F("div", to, [
1443
+ C(g.$slots, "request-error", { error: ne.value }, () => [
1444
+ Be(H(p(xn)(ne.value)), 1)
1392
1445
  ], !0)
1393
- ])) : B("", !0),
1394
- U(go, {
1395
- messages: Z.value,
1446
+ ])) : U("", !0),
1447
+ D(wn, {
1448
+ messages: ce.value,
1396
1449
  "scroll-target": a.value,
1397
- options: c.value.bubble,
1398
- welcome: c.value.welcome,
1399
- prompts: c.value.prompts,
1400
- labels: c.value.labels,
1401
- "center-empty-state": ee.value,
1402
- "center-welcome-composer": ce.value,
1403
- onPromptClick: Je,
1404
- onBubbleStateChange: Ze,
1405
- onBubbleEvent: Ge
1406
- }, z({ _: 2 }, [
1450
+ options: f.value.bubble,
1451
+ welcome: f.value.welcome,
1452
+ prompts: f.value.prompts,
1453
+ labels: f.value.labels,
1454
+ "center-empty-state": Ze.value,
1455
+ "center-welcome-composer": fe.value,
1456
+ onPromptClick: Xe,
1457
+ onBubbleStateChange: xe,
1458
+ onBubbleEvent: _e
1459
+ }, J({ _: 2 }, [
1407
1460
  g.$slots["layout-main"] ? {
1408
1461
  name: "default",
1409
- fn: E(() => [
1410
- k(g.$slots, "layout-main", {
1411
- messages: Z.value,
1412
- request: f.value.request,
1413
- conversation: f.value.conversation
1462
+ fn: S(() => [
1463
+ C(g.$slots, "layout-main", {
1464
+ messages: ce.value,
1465
+ request: m.value.request,
1466
+ conversation: m.value.conversation
1414
1467
  }, void 0, !0)
1415
1468
  ]),
1416
1469
  key: "0"
1417
1470
  } : void 0,
1418
1471
  g.$slots["welcome-footer"] ? {
1419
1472
  name: "welcome-footer",
1420
- fn: E(() => [
1421
- k(g.$slots, "welcome-footer", {}, void 0, !0)
1473
+ fn: S(() => [
1474
+ C(g.$slots, "welcome-footer", {}, void 0, !0)
1422
1475
  ]),
1423
1476
  key: "1"
1424
1477
  } : void 0,
1425
1478
  g.$slots["prompts-footer"] ? {
1426
1479
  name: "prompts-footer",
1427
- fn: E(() => [
1428
- k(g.$slots, "prompts-footer", {}, void 0, !0)
1480
+ fn: S(() => [
1481
+ C(g.$slots, "prompts-footer", {}, void 0, !0)
1429
1482
  ]),
1430
1483
  key: "2"
1431
1484
  } : void 0,
1432
- ce.value && r.value ? {
1485
+ fe.value && l.value ? {
1433
1486
  name: "welcome-composer",
1434
- fn: E(() => [
1435
- U(Re, {
1487
+ fn: S(() => [
1488
+ D($e, {
1436
1489
  class: "chat-welcome-composer",
1437
- sender: f.value.sender,
1438
- value: O.value,
1439
- "sender-options": r.value,
1440
- labels: c.value.labels,
1490
+ sender: m.value.sender,
1491
+ value: k.value,
1492
+ "sender-options": l.value,
1493
+ labels: f.value.labels,
1441
1494
  model: i.value,
1442
- mcp: s.value,
1443
- onSubmit: ke,
1444
- onCancel: Ee,
1445
- onClear: Oe,
1446
- "onUpdate:value": ne,
1447
- onModelSelect: M[0] || (M[0] = (R) => o("model-select", R)),
1448
- onModelFeatureChange: M[1] || (M[1] = (R) => o("model-feature-change", R)),
1449
- onMcpAddServer: M[2] || (M[2] = (R) => o("mcp-add-server", R)),
1450
- onMcpRemoveServer: M[3] || (M[3] = (R) => o("mcp-remove-server", R)),
1451
- onMcpServerEnabledChange: M[4] || (M[4] = (R) => o("mcp-server-enabled-change", R)),
1452
- onMcpToolEnabledChange: M[5] || (M[5] = (R) => o("mcp-tool-enabled-change", R))
1453
- }, z({ _: 2 }, [
1495
+ mcp: A.value,
1496
+ onSubmit: Oe,
1497
+ onCancel: Re,
1498
+ onClear: Te,
1499
+ "onUpdate:value": me,
1500
+ onModelSelect: w[0] || (w[0] = (O) => n("model-select", O)),
1501
+ onModelFeatureChange: w[1] || (w[1] = (O) => n("model-feature-change", O)),
1502
+ onOpenMcpPanel: Me,
1503
+ onMcpAddServer: w[2] || (w[2] = (O) => n("mcp-add-server", O)),
1504
+ onMcpRemoveServer: w[3] || (w[3] = (O) => n("mcp-remove-server", O)),
1505
+ onMcpServerEnabledChange: w[4] || (w[4] = (O) => n("mcp-server-enabled-change", O)),
1506
+ onMcpToolEnabledChange: w[5] || (w[5] = (O) => n("mcp-tool-enabled-change", O))
1507
+ }, J({ _: 2 }, [
1454
1508
  g.$slots["composer-before"] ? {
1455
1509
  name: "composer-before",
1456
- fn: E((R) => [
1457
- k(g.$slots, "composer-before", D(j(R)), void 0, !0)
1510
+ fn: S((O) => [
1511
+ C(g.$slots, "composer-before", q(j(O)), void 0, !0)
1458
1512
  ]),
1459
1513
  key: "0"
1460
1514
  } : void 0,
1461
1515
  g.$slots["layout-footer"] ? {
1462
1516
  name: "layout-footer",
1463
- fn: E((R) => [
1464
- k(g.$slots, "layout-footer", D(j(R)), void 0, !0)
1517
+ fn: S((O) => [
1518
+ C(g.$slots, "layout-footer", q(j(O)), void 0, !0)
1465
1519
  ]),
1466
1520
  key: "1"
1467
1521
  } : void 0,
1468
1522
  g.$slots["sender-footer"] ? {
1469
1523
  name: "sender-footer",
1470
- fn: E(() => [
1471
- k(g.$slots, "sender-footer", {}, void 0, !0)
1524
+ fn: S(() => [
1525
+ C(g.$slots, "sender-footer", {}, void 0, !0)
1472
1526
  ]),
1473
1527
  key: "2"
1474
1528
  } : void 0,
1475
1529
  g.$slots["sender-footer-right"] ? {
1476
1530
  name: "sender-footer-right",
1477
- fn: E(() => [
1478
- k(g.$slots, "sender-footer-right", {}, void 0, !0)
1531
+ fn: S(() => [
1532
+ C(g.$slots, "sender-footer-right", {}, void 0, !0)
1479
1533
  ]),
1480
1534
  key: "3"
1481
1535
  } : void 0
@@ -1485,75 +1539,75 @@ const jo = { class: "chat-panel-content chat-panel-content--header" }, Jo = { cl
1485
1539
  } : void 0,
1486
1540
  g.$slots["bubble-prefix"] ? {
1487
1541
  name: "bubble-prefix",
1488
- fn: E(() => [
1489
- k(g.$slots, "bubble-prefix", {}, void 0, !0)
1542
+ fn: S(() => [
1543
+ C(g.$slots, "bubble-prefix", {}, void 0, !0)
1490
1544
  ]),
1491
1545
  key: "4"
1492
1546
  } : void 0,
1493
1547
  g.$slots["bubble-suffix"] ? {
1494
1548
  name: "bubble-suffix",
1495
- fn: E(() => [
1496
- k(g.$slots, "bubble-suffix", {}, void 0, !0)
1549
+ fn: S(() => [
1550
+ C(g.$slots, "bubble-suffix", {}, void 0, !0)
1497
1551
  ]),
1498
1552
  key: "5"
1499
1553
  } : void 0,
1500
1554
  g.$slots["bubble-after"] ? {
1501
1555
  name: "bubble-after",
1502
- fn: E(() => [
1503
- k(g.$slots, "bubble-after", {}, void 0, !0)
1556
+ fn: S(() => [
1557
+ C(g.$slots, "bubble-after", {}, void 0, !0)
1504
1558
  ]),
1505
1559
  key: "6"
1506
1560
  } : void 0,
1507
1561
  g.$slots["bubble-content-footer"] ? {
1508
1562
  name: "bubble-content-footer",
1509
- fn: E(() => [
1510
- k(g.$slots, "bubble-content-footer", {}, void 0, !0)
1563
+ fn: S(() => [
1564
+ C(g.$slots, "bubble-content-footer", {}, void 0, !0)
1511
1565
  ]),
1512
1566
  key: "7"
1513
1567
  } : void 0
1514
1568
  ]), 1032, ["messages", "scroll-target", "options", "welcome", "prompts", "labels", "center-empty-state", "center-welcome-composer"])
1515
1569
  ], 512)
1516
1570
  ]),
1517
- V("div", Go, [
1518
- U(Tt, { target: a.value }, null, 8, ["target"])
1571
+ B("div", no, [
1572
+ D(Vt, { target: a.value }, null, 8, ["target"])
1519
1573
  ]),
1520
- U(y(ge).ProxyScrollbar, { "scroll-target": a.value }, null, 8, ["scroll-target"])
1574
+ D(p(pe).ProxyScrollbar, { "scroll-target": a.value }, null, 8, ["scroll-target"])
1521
1575
  ]),
1522
1576
  _: 2
1523
1577
  }, [
1524
- S.value ? {
1578
+ G.value ? {
1525
1579
  name: "left-aside",
1526
- fn: E(() => [
1527
- U(Bt, {
1528
- conversation: f.value.conversation,
1529
- history: p.value,
1530
- brand: c.value.brand,
1531
- labels: c.value.labels,
1532
- "is-open": y(w).resolvedLeftAsideOpen.value,
1533
- "is-dock": y(w).isLeftAsideDock.value,
1534
- "show-history": c.value.history !== !1,
1580
+ fn: S(() => [
1581
+ D(zt, {
1582
+ conversation: m.value.conversation,
1583
+ history: s.value,
1584
+ brand: f.value.brand,
1585
+ labels: f.value.labels,
1586
+ "is-open": p(L).resolvedLeftAsideOpen.value,
1587
+ "is-dock": p(L).isLeftAsideDock.value,
1588
+ "show-history": f.value.history !== !1,
1535
1589
  onCreateConversation: oe,
1536
- onSwitchConversation: we,
1537
- onRenameConversation: Se,
1538
- onDeleteConversation: je,
1539
- onHistoryAction: ze,
1540
- onOpen: y(w).openLeftAside,
1541
- onClose: y(w).closeLeftAside,
1542
- onToggle: y(w).toggleLeftAside
1543
- }, z({ _: 2 }, [
1590
+ onSwitchConversation: ke,
1591
+ onRenameConversation: Ee,
1592
+ onDeleteConversation: Qe,
1593
+ onHistoryAction: He,
1594
+ onOpen: p(L).openLeftAside,
1595
+ onClose: p(L).closeLeftAside,
1596
+ onToggle: p(L).toggleLeftAside
1597
+ }, J({ _: 2 }, [
1544
1598
  g.$slots["layout-left-aside"] ? {
1545
1599
  name: "default",
1546
- fn: E(() => [
1547
- k(g.$slots, "layout-left-aside", {
1548
- conversation: f.value.conversation,
1549
- isOpen: y(w).resolvedLeftAsideOpen.value,
1600
+ fn: S(() => [
1601
+ C(g.$slots, "layout-left-aside", {
1602
+ conversation: m.value.conversation,
1603
+ isOpen: p(L).resolvedLeftAsideOpen.value,
1550
1604
  createConversation: oe,
1551
- switchConversation: (R) => we({ id: R }),
1552
- renameConversation: (R, Ye) => Se({ id: R }, Ye),
1553
- deleteConversation: (R) => o("delete-conversation", { id: R }),
1554
- openLeftAside: y(w).openLeftAside,
1555
- closeLeftAside: y(w).closeLeftAside,
1556
- toggleLeftAside: y(w).toggleLeftAside
1605
+ switchConversation: (O) => ke({ id: O }),
1606
+ renameConversation: (O, et) => Ee({ id: O }, et),
1607
+ deleteConversation: (O) => n("delete-conversation", { id: O }),
1608
+ openLeftAside: p(L).openLeftAside,
1609
+ closeLeftAside: p(L).closeLeftAside,
1610
+ toggleLeftAside: p(L).toggleLeftAside
1557
1611
  }, void 0, !0)
1558
1612
  ]),
1559
1613
  key: "0"
@@ -1562,47 +1616,47 @@ const jo = { class: "chat-panel-content chat-panel-content--header" }, Jo = { cl
1562
1616
  ]),
1563
1617
  key: "0"
1564
1618
  } : void 0,
1565
- C.value ? {
1619
+ T.value ? {
1566
1620
  name: "header",
1567
- fn: E(() => [
1568
- V("div", jo, [
1569
- U(vo, {
1570
- title: f.value.conversation.title,
1571
- "is-empty": K.value,
1572
- conversation: f.value.conversation,
1573
- "is-left-aside-visible": S.value,
1574
- "is-left-aside-drawer": y(w).isLeftAsideDrawer.value,
1575
- "is-left-aside-open": y(w).resolvedLeftAsideOpen.value,
1576
- "is-right-aside-visible": $.value,
1577
- "is-right-aside-open": y(w).resolvedRightAsideOpen.value,
1578
- labels: c.value.labels,
1621
+ fn: S(() => [
1622
+ B("div", _n, [
1623
+ D(yn, {
1624
+ title: m.value.conversation.title,
1625
+ "is-empty": te.value,
1626
+ conversation: m.value.conversation,
1627
+ "is-left-aside-visible": G.value,
1628
+ "is-left-aside-drawer": p(L).isLeftAsideDrawer.value,
1629
+ "is-left-aside-open": p(L).resolvedLeftAsideOpen.value,
1630
+ "is-right-aside-visible": Q.value,
1631
+ "is-right-aside-open": p(L).resolvedRightAsideOpen.value,
1632
+ labels: f.value.labels,
1579
1633
  onCreateConversation: oe,
1580
- onOpenLeftAside: y(w).openLeftAside,
1581
- onCloseLeftAside: y(w).closeLeftAside,
1582
- onToggleLeftAside: y(w).toggleLeftAside,
1583
- onOpenRightAside: y(w).openRightAside
1584
- }, z({ _: 2 }, [
1634
+ onOpenLeftAside: p(L).openLeftAside,
1635
+ onCloseLeftAside: p(L).closeLeftAside,
1636
+ onToggleLeftAside: p(L).toggleLeftAside,
1637
+ onOpenRightAside: p(L).openRightAside
1638
+ }, J({ _: 2 }, [
1585
1639
  g.$slots["header-notice"] ? {
1586
1640
  name: "notice",
1587
- fn: E(() => [
1588
- k(g.$slots, "header-notice", {}, void 0, !0)
1641
+ fn: S(() => [
1642
+ C(g.$slots, "header-notice", {}, void 0, !0)
1589
1643
  ]),
1590
1644
  key: "0"
1591
1645
  } : void 0,
1592
1646
  g.$slots["layout-header"] ? {
1593
1647
  name: "default",
1594
- fn: E(() => [
1595
- k(g.$slots, "layout-header", {
1596
- title: f.value.conversation.title,
1597
- isEmpty: K.value,
1598
- conversation: f.value.conversation,
1648
+ fn: S(() => [
1649
+ C(g.$slots, "layout-header", {
1650
+ title: m.value.conversation.title,
1651
+ isEmpty: te.value,
1652
+ conversation: m.value.conversation,
1599
1653
  createConversation: oe,
1600
- isLeftAsideOpen: y(w).resolvedLeftAsideOpen.value,
1601
- openLeftAside: y(w).openLeftAside,
1602
- closeLeftAside: y(w).closeLeftAside,
1603
- toggleLeftAside: y(w).toggleLeftAside,
1604
- openRightAside: y(w).openRightAside,
1605
- closeRightAside: y(w).closeRightAside
1654
+ isLeftAsideOpen: p(L).resolvedLeftAsideOpen.value,
1655
+ openLeftAside: p(L).openLeftAside,
1656
+ closeLeftAside: p(L).closeLeftAside,
1657
+ toggleLeftAside: p(L).toggleLeftAside,
1658
+ openRightAside: p(L).openRightAside,
1659
+ closeRightAside: p(L).closeRightAside
1606
1660
  }, void 0, !0)
1607
1661
  ]),
1608
1662
  key: "1"
@@ -1612,53 +1666,54 @@ const jo = { class: "chat-panel-content chat-panel-content--header" }, Jo = { cl
1612
1666
  ]),
1613
1667
  key: "1"
1614
1668
  } : void 0,
1615
- v.value && r.value ? {
1669
+ x.value && l.value ? {
1616
1670
  name: "footer",
1617
- fn: E(() => [
1618
- ce.value ? B("", !0) : (I(), F("div", Yo, [
1619
- U(Re, {
1620
- sender: f.value.sender,
1621
- value: O.value,
1622
- "sender-options": r.value,
1623
- labels: c.value.labels,
1671
+ fn: S(() => [
1672
+ fe.value ? U("", !0) : (P(), F("div", oo, [
1673
+ D($e, {
1674
+ sender: m.value.sender,
1675
+ value: k.value,
1676
+ "sender-options": l.value,
1677
+ labels: f.value.labels,
1624
1678
  model: i.value,
1625
- mcp: s.value,
1626
- onSubmit: ke,
1627
- onCancel: Ee,
1628
- onClear: Oe,
1629
- "onUpdate:value": ne,
1630
- onModelSelect: M[6] || (M[6] = (R) => o("model-select", R)),
1631
- onModelFeatureChange: M[7] || (M[7] = (R) => o("model-feature-change", R)),
1632
- onMcpAddServer: M[8] || (M[8] = (R) => o("mcp-add-server", R)),
1633
- onMcpRemoveServer: M[9] || (M[9] = (R) => o("mcp-remove-server", R)),
1634
- onMcpServerEnabledChange: M[10] || (M[10] = (R) => o("mcp-server-enabled-change", R)),
1635
- onMcpToolEnabledChange: M[11] || (M[11] = (R) => o("mcp-tool-enabled-change", R))
1636
- }, z({ _: 2 }, [
1679
+ mcp: A.value,
1680
+ onSubmit: Oe,
1681
+ onCancel: Re,
1682
+ onClear: Te,
1683
+ "onUpdate:value": me,
1684
+ onModelSelect: w[6] || (w[6] = (O) => n("model-select", O)),
1685
+ onModelFeatureChange: w[7] || (w[7] = (O) => n("model-feature-change", O)),
1686
+ onOpenMcpPanel: Me,
1687
+ onMcpAddServer: w[8] || (w[8] = (O) => n("mcp-add-server", O)),
1688
+ onMcpRemoveServer: w[9] || (w[9] = (O) => n("mcp-remove-server", O)),
1689
+ onMcpServerEnabledChange: w[10] || (w[10] = (O) => n("mcp-server-enabled-change", O)),
1690
+ onMcpToolEnabledChange: w[11] || (w[11] = (O) => n("mcp-tool-enabled-change", O))
1691
+ }, J({ _: 2 }, [
1637
1692
  g.$slots["composer-before"] ? {
1638
1693
  name: "composer-before",
1639
- fn: E((R) => [
1640
- k(g.$slots, "composer-before", D(j(R)), void 0, !0)
1694
+ fn: S((O) => [
1695
+ C(g.$slots, "composer-before", q(j(O)), void 0, !0)
1641
1696
  ]),
1642
1697
  key: "0"
1643
1698
  } : void 0,
1644
1699
  g.$slots["layout-footer"] ? {
1645
1700
  name: "layout-footer",
1646
- fn: E((R) => [
1647
- k(g.$slots, "layout-footer", D(j(R)), void 0, !0)
1701
+ fn: S((O) => [
1702
+ C(g.$slots, "layout-footer", q(j(O)), void 0, !0)
1648
1703
  ]),
1649
1704
  key: "1"
1650
1705
  } : void 0,
1651
1706
  g.$slots["sender-footer"] ? {
1652
1707
  name: "sender-footer",
1653
- fn: E(() => [
1654
- k(g.$slots, "sender-footer", {}, void 0, !0)
1708
+ fn: S(() => [
1709
+ C(g.$slots, "sender-footer", {}, void 0, !0)
1655
1710
  ]),
1656
1711
  key: "2"
1657
1712
  } : void 0,
1658
1713
  g.$slots["sender-footer-right"] ? {
1659
1714
  name: "sender-footer-right",
1660
- fn: E(() => [
1661
- k(g.$slots, "sender-footer-right", {}, void 0, !0)
1715
+ fn: S(() => [
1716
+ C(g.$slots, "sender-footer-right", {}, void 0, !0)
1662
1717
  ]),
1663
1718
  key: "3"
1664
1719
  } : void 0
@@ -1667,382 +1722,408 @@ const jo = { class: "chat-panel-content chat-panel-content--header" }, Jo = { cl
1667
1722
  ]),
1668
1723
  key: "2"
1669
1724
  } : void 0,
1670
- $.value ? {
1725
+ Q.value ? {
1671
1726
  name: "right-aside",
1672
- fn: E(() => [
1673
- U(wo, {
1674
- "show-close": T.value !== !1 ? T.value.showClose : !0,
1675
- labels: c.value.labels,
1676
- onClose: y(w).closeRightAside
1727
+ fn: S(() => [
1728
+ p(I) ? C(g.$slots, "layout-right-aside", {
1729
+ panel: ze.value,
1730
+ openRightAside: p(L).openRightAside,
1731
+ closeRightAside: p(L).closeRightAside,
1732
+ isRightAsideOpen: p(L).resolvedRightAsideOpen.value
1733
+ }, void 0, !0, 0) : p(d) ? (P(), W(Tn, {
1734
+ key: 1,
1735
+ "show-close": V.value !== !1 ? V.value.showClose : !0,
1736
+ labels: f.value.labels,
1737
+ onClose: p(L).closeRightAside
1677
1738
  }, {
1678
- title: E(() => [
1679
- k(g.$slots, "layout-right-aside-title", {}, () => [
1680
- V("h2", No, Q(c.value.labels.rightAsideTitle), 1)
1681
- ], !0)
1739
+ title: S(() => [
1740
+ g.$slots["layout-right-aside-title"] ? C(g.$slots, "layout-right-aside-title", {}, void 0, !0, 0) : (P(), F("h2", so, H(f.value.labels.rightAsideTitle), 1))
1682
1741
  ]),
1683
- default: E(() => [
1684
- k(g.$slots, "layout-right-aside", {}, void 0, !0)
1742
+ default: S(() => [
1743
+ C(g.$slots, "layout-right-aside-content", {}, void 0, !0)
1685
1744
  ]),
1686
1745
  _: 3
1687
- }, 8, ["show-close", "labels", "onClose"])
1746
+ }, 8, ["show-close", "labels", "onClose"])) : M.value && A.value ? (P(), W($n, {
1747
+ key: 2,
1748
+ mcp: A.value,
1749
+ labels: f.value.labels,
1750
+ onClose: p(L).closeRightAside,
1751
+ onAddServer: w[12] || (w[12] = (O) => n("mcp-add-server", O)),
1752
+ onRemoveServer: w[13] || (w[13] = (O) => n("mcp-remove-server", O)),
1753
+ onUpdateServerEnabled: w[14] || (w[14] = (O) => n("mcp-server-enabled-change", O)),
1754
+ onUpdateToolEnabled: w[15] || (w[15] = (O) => n("mcp-tool-enabled-change", O))
1755
+ }, null, 8, ["mcp", "labels", "onClose"])) : U("", !0)
1688
1756
  ]),
1689
1757
  key: "3"
1690
1758
  } : void 0
1691
1759
  ]), 1040, ["style", "onLeftAsideOpenChange", "onRightAsideOpenChange"]));
1692
1760
  }
1693
- }), Ho = /* @__PURE__ */ Y(Qo, [["__scopeId", "data-v-b37c2cd2"]]);
1694
- function Xo(e) {
1695
- const t = q("");
1696
- function n(u) {
1697
- t.value = u;
1761
+ }), lo = /* @__PURE__ */ Y(ao, [["__scopeId", "data-v-ce27d8ee"]]);
1762
+ function ro(e) {
1763
+ const t = K("");
1764
+ function o(c) {
1765
+ t.value = c;
1698
1766
  }
1699
- async function o(u) {
1700
- const m = u.text.trim();
1701
- if (!m)
1767
+ async function n(c) {
1768
+ const v = c.text.trim();
1769
+ if (!v)
1702
1770
  return !1;
1703
- const d = u.text;
1771
+ const b = c.text;
1704
1772
  try {
1705
1773
  t.value = "", await Promise.resolve();
1706
1774
  const a = await e.send({
1707
- ...u,
1708
- text: m
1775
+ ...c,
1776
+ text: v
1709
1777
  });
1710
- return !a && t.value === "" && (t.value = d), a;
1778
+ return !a && t.value === "" && (t.value = b), a;
1711
1779
  } catch (a) {
1712
- throw t.value === "" && (t.value = d), a;
1780
+ throw t.value === "" && (t.value = b), a;
1713
1781
  }
1714
1782
  }
1715
1783
  return {
1716
1784
  inputValue: t,
1717
- setInputValue: n,
1718
- send: o,
1785
+ setInputValue: o,
1786
+ send: n,
1719
1787
  abort: e.abort
1720
1788
  };
1721
1789
  }
1722
- function xo(e) {
1723
- const t = h(() => G(e.runtime)), n = h(() => t.value.activeConversation.value), o = q(!1), u = q(/* @__PURE__ */ new Set()), m = q(/* @__PURE__ */ new Set()), d = q(/* @__PURE__ */ new Set()), a = Xo({
1724
- send: async (i) => await c("send", i, () => t.value.actions.send(i)) ?? !1
1725
- }), l = h(() => {
1726
- var P, Z;
1727
- const i = n.value, s = t.value.composer.model, v = t.value.composer.mcp, S = {};
1728
- for (const [K, x] of Object.entries((v == null ? void 0 : v.tools.value) ?? {}))
1729
- x && (S[K] = x.map(
1730
- (ee) => ({
1731
- ...ee,
1732
- loading: d.value.has(A(K, ee.id))
1790
+ function io(e) {
1791
+ const t = h(() => z(e.runtime)), o = h(() => t.value.activeConversation.value), n = K(!1), c = K(/* @__PURE__ */ new Set()), v = K(/* @__PURE__ */ new Set()), b = K(/* @__PURE__ */ new Set()), a = ro({
1792
+ send: async (s) => await f("send", s, () => t.value.actions.send(s)) ?? !1
1793
+ }), r = h(() => {
1794
+ var V, x;
1795
+ const s = o.value, l = t.value.composer.model, i = t.value.composer.mcp, A = {};
1796
+ for (const [G, Q] of Object.entries((i == null ? void 0 : i.tools.value) ?? {}))
1797
+ Q && (A[G] = Q.map(
1798
+ (L) => ({
1799
+ ...L,
1800
+ loading: b.value.has(y(G, L.id))
1733
1801
  })
1734
1802
  ));
1735
- const $ = s ? {
1736
- options: s.options.value,
1737
- selectedId: s.selectedId.value,
1738
- features: s.features.value,
1739
- selecting: o.value,
1740
- pendingFeatureIds: [...u.value]
1741
- } : void 0, w = v ? {
1742
- servers: v.servers.value.map(
1743
- (K) => ({
1744
- ...K,
1745
- loading: !!(K.loading || m.value.has(K.id))
1803
+ const M = l ? {
1804
+ options: l.options.value,
1805
+ selectedId: l.selectedId.value,
1806
+ features: l.features.value,
1807
+ selecting: n.value,
1808
+ pendingFeatureIds: [...c.value]
1809
+ } : void 0, $ = i ? {
1810
+ servers: i.servers.value.map(
1811
+ (G) => ({
1812
+ ...G,
1813
+ loading: !!(G.loading || v.value.has(G.id))
1746
1814
  })
1747
1815
  ),
1748
- tools: S
1816
+ tools: A
1749
1817
  } : void 0;
1750
1818
  return {
1751
1819
  conversation: {
1752
1820
  items: t.value.conversations.value,
1753
- activeId: (i == null ? void 0 : i.id) ?? null,
1754
- title: G(e.title) || (i == null ? void 0 : i.title)
1821
+ activeId: (s == null ? void 0 : s.id) ?? null,
1822
+ title: z(e.title) || (s == null ? void 0 : s.title)
1755
1823
  },
1756
- bubble: { messages: (i == null ? void 0 : i.messages) ?? [] },
1824
+ bubble: { messages: (s == null ? void 0 : s.messages) ?? [] },
1757
1825
  sender: {
1758
- loading: (i == null ? void 0 : i.requestState) === "processing",
1759
- disabled: !!((P = t.value.composer.disabled) != null && P.value),
1760
- submitDisabled: !!((Z = t.value.composer.submitDisabled) != null && Z.value)
1826
+ loading: (s == null ? void 0 : s.requestState) === "processing",
1827
+ disabled: !!((V = t.value.composer.disabled) != null && V.value),
1828
+ submitDisabled: !!((x = t.value.composer.submitDisabled) != null && x.value)
1761
1829
  },
1762
- request: i ? {
1763
- state: i.requestState,
1764
- processingState: i.processingState,
1765
- error: i.lastError ?? void 0
1830
+ request: s ? {
1831
+ state: s.requestState,
1832
+ processingState: s.processingState,
1833
+ error: s.lastError ?? void 0
1766
1834
  } : void 0,
1767
- model: $,
1768
- mcp: w
1835
+ model: M,
1836
+ mcp: $
1769
1837
  };
1770
1838
  });
1771
- function b(i, s, v) {
1772
- const S = new Set(i.value);
1773
- v ? S.add(s) : S.delete(s), i.value = S;
1839
+ function u(s, l, i) {
1840
+ const A = new Set(s.value);
1841
+ i ? A.add(l) : A.delete(l), s.value = A;
1774
1842
  }
1775
- function A(i, s) {
1776
- return `${i}:${s}`;
1843
+ function y(s, l) {
1844
+ return `${s}:${l}`;
1777
1845
  }
1778
- async function c(i, s, v) {
1846
+ async function f(s, l, i) {
1779
1847
  try {
1780
- return await v();
1781
- } catch (S) {
1782
- e.onActionError({ action: i, payload: s, error: S });
1848
+ return await i();
1849
+ } catch (A) {
1850
+ e.onActionError({ action: s, payload: l, error: A });
1783
1851
  return;
1784
1852
  }
1785
1853
  }
1786
- async function f(i, s, v) {
1787
- if (!i.value.has(s)) {
1788
- b(i, s, !0);
1854
+ async function m(s, l, i) {
1855
+ if (!s.value.has(l)) {
1856
+ u(s, l, !0);
1789
1857
  try {
1790
- await v();
1858
+ await i();
1791
1859
  } finally {
1792
- b(i, s, !1);
1860
+ u(s, l, !1);
1793
1861
  }
1794
1862
  }
1795
1863
  }
1796
- async function O(i) {
1797
- const s = t.value.composer.model;
1798
- if (!(!s || s.selectedId.value === i || o.value)) {
1799
- o.value = !0;
1864
+ async function k(s) {
1865
+ const l = t.value.composer.model;
1866
+ if (!(!l || l.selectedId.value === s || n.value)) {
1867
+ n.value = !0;
1800
1868
  try {
1801
- await c("select-model", { id: i }, () => s.select(i));
1869
+ await f("select-model", { id: s }, () => l.select(s));
1802
1870
  } finally {
1803
- o.value = !1;
1871
+ n.value = !1;
1804
1872
  }
1805
1873
  }
1806
1874
  }
1807
- async function C(i, s) {
1808
- const v = t.value.composer.model;
1809
- !v || v.features.value[i] === s || await f(
1810
- u,
1811
- i,
1812
- () => c("set-model-feature", { id: i, enabled: s }, () => v.setFeature(i, s))
1875
+ async function T(s, l) {
1876
+ const i = t.value.composer.model;
1877
+ !i || i.features.value[s] === l || await m(
1878
+ c,
1879
+ s,
1880
+ () => f("set-model-feature", { id: s, enabled: l }, () => i.setFeature(s, l))
1813
1881
  );
1814
1882
  }
1815
- async function L(i) {
1816
- const s = t.value.composer.mcp;
1817
- s && await f(m, i, () => c("add-mcp-server", { id: i }, () => s.addServer(i)));
1883
+ async function E(s) {
1884
+ const l = t.value.composer.mcp;
1885
+ l && await m(v, s, () => f("add-mcp-server", { id: s }, () => l.addServer(s)));
1818
1886
  }
1819
- async function T(i) {
1820
- const s = t.value.composer.mcp;
1821
- s && await f(
1822
- m,
1823
- i,
1824
- () => c("remove-mcp-server", { id: i }, () => s.removeServer(i))
1887
+ async function R(s) {
1888
+ const l = t.value.composer.mcp;
1889
+ l && await m(
1890
+ v,
1891
+ s,
1892
+ () => f("remove-mcp-server", { id: s }, () => l.removeServer(s))
1825
1893
  );
1826
1894
  }
1827
- async function p(i, s) {
1828
- const v = t.value.composer.mcp, S = v == null ? void 0 : v.servers.value.find(($) => $.id === i);
1829
- v && S && S.enabled !== s && await f(
1830
- m,
1831
- i,
1832
- () => c("set-mcp-server-enabled", { id: i, enabled: s }, () => v.setServerEnabled(i, s))
1895
+ async function I(s, l) {
1896
+ const i = t.value.composer.mcp, A = i == null ? void 0 : i.servers.value.find((M) => M.id === s);
1897
+ i && A && A.enabled !== l && await m(
1898
+ v,
1899
+ s,
1900
+ () => f("set-mcp-server-enabled", { id: s, enabled: l }, () => i.setServerEnabled(s, l))
1833
1901
  );
1834
1902
  }
1835
- async function r(i, s, v) {
1836
- var P;
1837
- const S = t.value.composer.mcp, $ = (P = S == null ? void 0 : S.tools.value[i]) == null ? void 0 : P.find((Z) => Z.id === s), w = A(i, s);
1838
- S && $ && $.enabled !== v && await f(
1839
- d,
1840
- w,
1841
- () => c(
1903
+ async function d(s, l, i) {
1904
+ var V;
1905
+ const A = t.value.composer.mcp, M = (V = A == null ? void 0 : A.tools.value[s]) == null ? void 0 : V.find((x) => x.id === l), $ = y(s, l);
1906
+ A && M && M.enabled !== i && await m(
1907
+ b,
1908
+ $,
1909
+ () => f(
1842
1910
  "set-mcp-tool-enabled",
1843
- { serverId: i, toolId: s, enabled: v },
1844
- () => S.setToolEnabled(i, s, v)
1911
+ { serverId: s, toolId: l, enabled: i },
1912
+ () => A.setToolEnabled(s, l, i)
1845
1913
  )
1846
1914
  );
1847
1915
  }
1848
1916
  return {
1849
- data: l,
1917
+ data: r,
1850
1918
  inputValue: a.inputValue,
1851
1919
  setInputValue: a.setInputValue,
1852
- send: (i) => a.send(i),
1853
- abort: () => c("abort", void 0, () => {
1854
- var i, s;
1855
- return (s = (i = t.value.actions).abort) == null ? void 0 : s.call(i);
1920
+ send: (s) => a.send(s),
1921
+ abort: () => f("abort", void 0, () => {
1922
+ var s, l;
1923
+ return (l = (s = t.value.actions).abort) == null ? void 0 : l.call(s);
1856
1924
  }),
1857
- createConversation: () => c("create-conversation", void 0, () => t.value.actions.createConversation()),
1858
- switchConversation: (i) => c("switch-conversation", { id: i }, () => t.value.actions.switchConversation(i)),
1859
- renameConversation: (i, s) => c("rename-conversation", { id: i, title: s }, () => t.value.actions.renameConversation(i, s)),
1860
- deleteConversation: (i) => c("delete-conversation", { id: i }, () => t.value.actions.deleteConversation(i)),
1861
- selectModel: O,
1862
- setModelFeature: C,
1863
- addMcpServer: L,
1864
- removeMcpServer: T,
1865
- setMcpServerEnabled: p,
1866
- setMcpToolEnabled: r
1925
+ createConversation: () => f("create-conversation", void 0, () => t.value.actions.createConversation()),
1926
+ switchConversation: (s) => f("switch-conversation", { id: s }, () => t.value.actions.switchConversation(s)),
1927
+ renameConversation: (s, l) => f("rename-conversation", { id: s, title: l }, () => t.value.actions.renameConversation(s, l)),
1928
+ deleteConversation: (s) => f("delete-conversation", { id: s }, () => t.value.actions.deleteConversation(s)),
1929
+ selectModel: k,
1930
+ setModelFeature: T,
1931
+ addMcpServer: E,
1932
+ removeMcpServer: R,
1933
+ setMcpServerEnabled: I,
1934
+ setMcpToolEnabled: d
1867
1935
  };
1868
1936
  }
1869
- const Tn = /* @__PURE__ */ J({
1937
+ const Fo = /* @__PURE__ */ Z({
1870
1938
  __name: "Chat",
1871
1939
  props: {
1872
1940
  runtime: {},
1873
1941
  ui: {},
1874
1942
  title: {},
1875
- floatingState: {}
1943
+ floatingState: {},
1944
+ rightAsidePanel: {}
1876
1945
  },
1877
- emits: ["update:floating-state", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end", "runtime-action-error", "history-action", "prompt-click", "bubble-state-change", "bubble-event", "left-aside-open-change", "right-aside-open-change"],
1878
- setup(e, { emit: t }) {
1879
- const n = e, o = t, u = xo({
1946
+ emits: ["update:floating-state", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end", "runtime-action-error", "history-action", "prompt-click", "bubble-state-change", "bubble-event", "left-aside-open-change", "right-aside-open-change", "update:right-aside-panel"],
1947
+ setup(e, { expose: t, emit: o }) {
1948
+ const n = e, c = o, v = io({
1880
1949
  runtime: () => n.runtime,
1881
1950
  title: () => n.title,
1882
- onActionError: (d) => o("runtime-action-error", d)
1951
+ onActionError: (a) => c("runtime-action-error", a)
1883
1952
  });
1884
- function m(d) {
1885
- if (d.action.id === "delete") {
1886
- u.deleteConversation(d.conversation.id);
1953
+ t({
1954
+ send: v.send
1955
+ });
1956
+ function b(a) {
1957
+ if (a.action.id === "delete") {
1958
+ v.deleteConversation(a.conversation.id);
1887
1959
  return;
1888
1960
  }
1889
- o("history-action", d);
1961
+ c("history-action", a);
1890
1962
  }
1891
- return (d, a) => (I(), W(Ho, {
1892
- data: y(u).data.value,
1963
+ return (a, r) => (P(), W(lo, {
1964
+ data: p(v).data.value,
1893
1965
  ui: n.ui,
1894
1966
  "floating-state": n.floatingState,
1895
- "input-value": y(u).inputValue.value,
1896
- onCreateConversation: y(u).createConversation,
1897
- onSwitchConversation: a[0] || (a[0] = ({ id: l }) => y(u).switchConversation(l)),
1898
- onRenameConversation: a[1] || (a[1] = ({ id: l, title: b }) => y(u).renameConversation(l, b)),
1899
- onDeleteConversation: a[2] || (a[2] = ({ id: l }) => y(u).deleteConversation(l)),
1900
- onHistoryAction: m,
1901
- onPromptClick: a[3] || (a[3] = (l) => o("prompt-click", l)),
1902
- onBubbleStateChange: a[4] || (a[4] = (l) => o("bubble-state-change", l)),
1903
- onBubbleEvent: a[5] || (a[5] = (l) => o("bubble-event", l)),
1904
- onLeftAsideOpenChange: a[6] || (a[6] = (l) => o("left-aside-open-change", l)),
1905
- onRightAsideOpenChange: a[7] || (a[7] = (l) => o("right-aside-open-change", l)),
1906
- "onUpdate:floatingState": a[8] || (a[8] = (l) => o("update:floating-state", l)),
1907
- onFloatingDragStart: a[9] || (a[9] = (l) => o("floating-drag-start", l)),
1908
- onFloatingDrag: a[10] || (a[10] = (l) => o("floating-drag", l)),
1909
- onFloatingDragEnd: a[11] || (a[11] = (l) => o("floating-drag-end", l)),
1910
- onFloatingResizeStart: a[12] || (a[12] = (l) => o("floating-resize-start", l)),
1911
- onFloatingResize: a[13] || (a[13] = (l) => o("floating-resize", l)),
1912
- onFloatingResizeEnd: a[14] || (a[14] = (l) => o("floating-resize-end", l)),
1913
- onSubmit: y(u).send,
1914
- onCancel: y(u).abort,
1915
- onClear: a[15] || (a[15] = () => y(u).setInputValue("")),
1916
- "onUpdate:inputValue": y(u).setInputValue,
1917
- onModelSelect: a[16] || (a[16] = ({ id: l }) => y(u).selectModel(l)),
1918
- onModelFeatureChange: a[17] || (a[17] = ({ id: l, enabled: b }) => y(u).setModelFeature(l, b)),
1919
- onMcpAddServer: a[18] || (a[18] = ({ id: l }) => y(u).addMcpServer(l)),
1920
- onMcpRemoveServer: a[19] || (a[19] = ({ id: l }) => y(u).removeMcpServer(l)),
1921
- onMcpServerEnabledChange: a[20] || (a[20] = ({ id: l, enabled: b }) => y(u).setMcpServerEnabled(l, b)),
1922
- onMcpToolEnabledChange: a[21] || (a[21] = ({ serverId: l, toolId: b, enabled: A }) => y(u).setMcpToolEnabled(l, b, A))
1923
- }, z({ _: 2 }, [
1924
- d.$slots["layout-header"] ? {
1967
+ "right-aside-panel": n.rightAsidePanel,
1968
+ "input-value": p(v).inputValue.value,
1969
+ onCreateConversation: p(v).createConversation,
1970
+ onSwitchConversation: r[0] || (r[0] = ({ id: u }) => p(v).switchConversation(u)),
1971
+ onRenameConversation: r[1] || (r[1] = ({ id: u, title: y }) => p(v).renameConversation(u, y)),
1972
+ onDeleteConversation: r[2] || (r[2] = ({ id: u }) => p(v).deleteConversation(u)),
1973
+ onHistoryAction: b,
1974
+ onPromptClick: r[3] || (r[3] = (u) => c("prompt-click", u)),
1975
+ onBubbleStateChange: r[4] || (r[4] = (u) => c("bubble-state-change", u)),
1976
+ onBubbleEvent: r[5] || (r[5] = (u) => c("bubble-event", u)),
1977
+ onLeftAsideOpenChange: r[6] || (r[6] = (u) => c("left-aside-open-change", u)),
1978
+ onRightAsideOpenChange: r[7] || (r[7] = (u) => c("right-aside-open-change", u)),
1979
+ "onUpdate:rightAsidePanel": r[8] || (r[8] = (u) => c("update:right-aside-panel", u)),
1980
+ "onUpdate:floatingState": r[9] || (r[9] = (u) => c("update:floating-state", u)),
1981
+ onFloatingDragStart: r[10] || (r[10] = (u) => c("floating-drag-start", u)),
1982
+ onFloatingDrag: r[11] || (r[11] = (u) => c("floating-drag", u)),
1983
+ onFloatingDragEnd: r[12] || (r[12] = (u) => c("floating-drag-end", u)),
1984
+ onFloatingResizeStart: r[13] || (r[13] = (u) => c("floating-resize-start", u)),
1985
+ onFloatingResize: r[14] || (r[14] = (u) => c("floating-resize", u)),
1986
+ onFloatingResizeEnd: r[15] || (r[15] = (u) => c("floating-resize-end", u)),
1987
+ onSubmit: p(v).send,
1988
+ onCancel: p(v).abort,
1989
+ onClear: r[16] || (r[16] = () => p(v).setInputValue("")),
1990
+ "onUpdate:inputValue": p(v).setInputValue,
1991
+ onModelSelect: r[17] || (r[17] = ({ id: u }) => p(v).selectModel(u)),
1992
+ onModelFeatureChange: r[18] || (r[18] = ({ id: u, enabled: y }) => p(v).setModelFeature(u, y)),
1993
+ onMcpAddServer: r[19] || (r[19] = ({ id: u }) => p(v).addMcpServer(u)),
1994
+ onMcpRemoveServer: r[20] || (r[20] = ({ id: u }) => p(v).removeMcpServer(u)),
1995
+ onMcpServerEnabledChange: r[21] || (r[21] = ({ id: u, enabled: y }) => p(v).setMcpServerEnabled(u, y)),
1996
+ onMcpToolEnabledChange: r[22] || (r[22] = ({ serverId: u, toolId: y, enabled: f }) => p(v).setMcpToolEnabled(u, y, f))
1997
+ }, J({ _: 2 }, [
1998
+ a.$slots["layout-header"] ? {
1925
1999
  name: "layout-header",
1926
- fn: E((l) => [
1927
- k(d.$slots, "layout-header", D(j(l)))
2000
+ fn: S((u) => [
2001
+ C(a.$slots, "layout-header", q(j(u)))
1928
2002
  ]),
1929
2003
  key: "0"
1930
2004
  } : void 0,
1931
- d.$slots["layout-left-aside"] ? {
2005
+ a.$slots["layout-left-aside"] ? {
1932
2006
  name: "layout-left-aside",
1933
- fn: E((l) => [
1934
- k(d.$slots, "layout-left-aside", D(j(l)))
2007
+ fn: S((u) => [
2008
+ C(a.$slots, "layout-left-aside", q(j(u)))
1935
2009
  ]),
1936
2010
  key: "1"
1937
2011
  } : void 0,
1938
- d.$slots["layout-right-aside"] ? {
2012
+ a.$slots["layout-right-aside"] ? {
1939
2013
  name: "layout-right-aside",
1940
- fn: E(() => [
1941
- k(d.$slots, "layout-right-aside")
2014
+ fn: S((u) => [
2015
+ C(a.$slots, "layout-right-aside", q(j(u)))
1942
2016
  ]),
1943
2017
  key: "2"
1944
2018
  } : void 0,
1945
- d.$slots["layout-right-aside-title"] ? {
1946
- name: "layout-right-aside-title",
1947
- fn: E(() => [
1948
- k(d.$slots, "layout-right-aside-title")
2019
+ a.$slots["layout-right-aside-content"] ? {
2020
+ name: "layout-right-aside-content",
2021
+ fn: S(() => [
2022
+ C(a.$slots, "layout-right-aside-content")
1949
2023
  ]),
1950
2024
  key: "3"
1951
2025
  } : void 0,
1952
- d.$slots["layout-main"] ? {
1953
- name: "layout-main",
1954
- fn: E((l) => [
1955
- k(d.$slots, "layout-main", D(j(l)))
2026
+ a.$slots["layout-right-aside-title"] ? {
2027
+ name: "layout-right-aside-title",
2028
+ fn: S(() => [
2029
+ C(a.$slots, "layout-right-aside-title")
1956
2030
  ]),
1957
2031
  key: "4"
1958
2032
  } : void 0,
1959
- d.$slots["layout-footer"] ? {
1960
- name: "layout-footer",
1961
- fn: E((l) => [
1962
- k(d.$slots, "layout-footer", D(j(l)))
2033
+ a.$slots["layout-main"] ? {
2034
+ name: "layout-main",
2035
+ fn: S((u) => [
2036
+ C(a.$slots, "layout-main", q(j(u)))
1963
2037
  ]),
1964
2038
  key: "5"
1965
2039
  } : void 0,
1966
- d.$slots["composer-before"] ? {
1967
- name: "composer-before",
1968
- fn: E((l) => [
1969
- k(d.$slots, "composer-before", D(j(l)))
2040
+ a.$slots["layout-footer"] ? {
2041
+ name: "layout-footer",
2042
+ fn: S((u) => [
2043
+ C(a.$slots, "layout-footer", q(j(u)))
1970
2044
  ]),
1971
2045
  key: "6"
1972
2046
  } : void 0,
1973
- d.$slots["header-notice"] ? {
1974
- name: "header-notice",
1975
- fn: E(() => [
1976
- k(d.$slots, "header-notice")
2047
+ a.$slots["composer-before"] ? {
2048
+ name: "composer-before",
2049
+ fn: S((u) => [
2050
+ C(a.$slots, "composer-before", q(j(u)))
1977
2051
  ]),
1978
2052
  key: "7"
1979
2053
  } : void 0,
1980
- d.$slots["request-error"] ? {
1981
- name: "request-error",
1982
- fn: E((l) => [
1983
- k(d.$slots, "request-error", D(j(l)))
2054
+ a.$slots["header-notice"] ? {
2055
+ name: "header-notice",
2056
+ fn: S(() => [
2057
+ C(a.$slots, "header-notice")
1984
2058
  ]),
1985
2059
  key: "8"
1986
2060
  } : void 0,
1987
- d.$slots["welcome-footer"] ? {
1988
- name: "welcome-footer",
1989
- fn: E(() => [
1990
- k(d.$slots, "welcome-footer")
2061
+ a.$slots["request-error"] ? {
2062
+ name: "request-error",
2063
+ fn: S((u) => [
2064
+ C(a.$slots, "request-error", q(j(u)))
1991
2065
  ]),
1992
2066
  key: "9"
1993
2067
  } : void 0,
1994
- d.$slots["prompts-footer"] ? {
1995
- name: "prompts-footer",
1996
- fn: E(() => [
1997
- k(d.$slots, "prompts-footer")
2068
+ a.$slots["welcome-footer"] ? {
2069
+ name: "welcome-footer",
2070
+ fn: S(() => [
2071
+ C(a.$slots, "welcome-footer")
1998
2072
  ]),
1999
2073
  key: "10"
2000
2074
  } : void 0,
2001
- d.$slots["bubble-prefix"] ? {
2002
- name: "bubble-prefix",
2003
- fn: E(() => [
2004
- k(d.$slots, "bubble-prefix")
2075
+ a.$slots["prompts-footer"] ? {
2076
+ name: "prompts-footer",
2077
+ fn: S(() => [
2078
+ C(a.$slots, "prompts-footer")
2005
2079
  ]),
2006
2080
  key: "11"
2007
2081
  } : void 0,
2008
- d.$slots["bubble-suffix"] ? {
2009
- name: "bubble-suffix",
2010
- fn: E(() => [
2011
- k(d.$slots, "bubble-suffix")
2082
+ a.$slots["bubble-prefix"] ? {
2083
+ name: "bubble-prefix",
2084
+ fn: S(() => [
2085
+ C(a.$slots, "bubble-prefix")
2012
2086
  ]),
2013
2087
  key: "12"
2014
2088
  } : void 0,
2015
- d.$slots["bubble-after"] ? {
2016
- name: "bubble-after",
2017
- fn: E(() => [
2018
- k(d.$slots, "bubble-after")
2089
+ a.$slots["bubble-suffix"] ? {
2090
+ name: "bubble-suffix",
2091
+ fn: S(() => [
2092
+ C(a.$slots, "bubble-suffix")
2019
2093
  ]),
2020
2094
  key: "13"
2021
2095
  } : void 0,
2022
- d.$slots["bubble-content-footer"] ? {
2023
- name: "bubble-content-footer",
2024
- fn: E(() => [
2025
- k(d.$slots, "bubble-content-footer")
2096
+ a.$slots["bubble-after"] ? {
2097
+ name: "bubble-after",
2098
+ fn: S(() => [
2099
+ C(a.$slots, "bubble-after")
2026
2100
  ]),
2027
2101
  key: "14"
2028
2102
  } : void 0,
2029
- d.$slots["sender-footer"] ? {
2030
- name: "sender-footer",
2031
- fn: E(() => [
2032
- k(d.$slots, "sender-footer")
2103
+ a.$slots["bubble-content-footer"] ? {
2104
+ name: "bubble-content-footer",
2105
+ fn: S(() => [
2106
+ C(a.$slots, "bubble-content-footer")
2033
2107
  ]),
2034
2108
  key: "15"
2035
2109
  } : void 0,
2036
- d.$slots["sender-footer-right"] ? {
2037
- name: "sender-footer-right",
2038
- fn: E(() => [
2039
- k(d.$slots, "sender-footer-right")
2110
+ a.$slots["sender-footer"] ? {
2111
+ name: "sender-footer",
2112
+ fn: S(() => [
2113
+ C(a.$slots, "sender-footer")
2040
2114
  ]),
2041
2115
  key: "16"
2116
+ } : void 0,
2117
+ a.$slots["sender-footer-right"] ? {
2118
+ name: "sender-footer-right",
2119
+ fn: S(() => [
2120
+ C(a.$slots, "sender-footer-right")
2121
+ ]),
2122
+ key: "17"
2042
2123
  } : void 0
2043
- ]), 1032, ["data", "ui", "floating-state", "input-value", "onCreateConversation", "onSubmit", "onCancel", "onUpdate:inputValue"]));
2124
+ ]), 1032, ["data", "ui", "floating-state", "right-aside-panel", "input-value", "onCreateConversation", "onSubmit", "onCancel", "onUpdate:inputValue"]));
2044
2125
  }
2045
- }), Pe = "run_config_metadata", ie = "run_config_context";
2126
+ }), Fe = "run_config_metadata", ie = "run_config_context";
2046
2127
  function de(e) {
2047
2128
  if (e)
2048
2129
  return {
@@ -2052,323 +2133,323 @@ function de(e) {
2052
2133
  mcp: e.mcp ? {
2053
2134
  serverIds: [...e.mcp.serverIds],
2054
2135
  toolIds: Object.fromEntries(
2055
- Object.entries(e.mcp.toolIds).map(([t, n]) => [t, [...n]])
2136
+ Object.entries(e.mcp.toolIds).map(([t, o]) => [t, [...o]])
2056
2137
  )
2057
2138
  } : void 0
2058
2139
  };
2059
2140
  }
2060
- function Be(e) {
2141
+ function We(e) {
2061
2142
  return (e == null ? void 0 : e.servers.value.filter((t) => t.installed && t.enabled)) ?? [];
2062
2143
  }
2063
- function Ue(e) {
2064
- return e ? Be(e).every(
2144
+ function De(e) {
2145
+ return e ? We(e).every(
2065
2146
  (t) => !t.loading && Object.prototype.hasOwnProperty.call(e.tools.value, t.id)
2066
2147
  ) : !0;
2067
2148
  }
2068
- function _o(e) {
2149
+ function uo(e) {
2069
2150
  if (e === void 0)
2070
2151
  return;
2071
- const t = Be(e);
2072
- if (!(t.length === 0 || !Ue(e)))
2152
+ const t = We(e);
2153
+ if (!(t.length === 0 || !De(e)))
2073
2154
  return {
2074
- serverIds: t.map((n) => n.id),
2155
+ serverIds: t.map((o) => o.id),
2075
2156
  toolIds: Object.fromEntries(
2076
- t.map((n) => [
2077
- n.id,
2078
- (e.tools.value[n.id] ?? []).filter((o) => o.enabled).map((o) => o.id)
2157
+ t.map((o) => [
2158
+ o.id,
2159
+ (e.tools.value[o.id] ?? []).filter((n) => n.enabled).map((n) => n.id)
2079
2160
  ])
2080
2161
  )
2081
2162
  };
2082
2163
  }
2083
- function en(e) {
2084
- var u, m;
2085
- const t = e.model, n = (m = (u = e.model) == null ? void 0 : u.reasoning) == null ? void 0 : m.value, o = _o(e.mcp);
2086
- if (!(!t && !n && !o))
2164
+ function co(e) {
2165
+ var c, v;
2166
+ const t = e.model, o = (v = (c = e.model) == null ? void 0 : c.reasoning) == null ? void 0 : v.value, n = uo(e.mcp);
2167
+ if (!(!t && !o && !n))
2087
2168
  return de({
2088
2169
  modelId: (t == null ? void 0 : t.selectedId.value) ?? void 0,
2089
2170
  features: t ? { ...t.features.value } : void 0,
2090
- reasoning: n,
2091
- mcp: o
2171
+ reasoning: o,
2172
+ mcp: n
2092
2173
  });
2093
2174
  }
2094
- function _(e) {
2175
+ function ee(e) {
2095
2176
  return !!e && typeof e == "object" && !Array.isArray(e);
2096
2177
  }
2097
- function tn(e) {
2098
- if (!_(e) || !Array.isArray(e.serverIds) || !_(e.toolIds) || !e.serverIds.every((u) => typeof u == "string" && u.length > 0))
2178
+ function fo(e) {
2179
+ if (!ee(e) || !Array.isArray(e.serverIds) || !ee(e.toolIds) || !e.serverIds.every((c) => typeof c == "string" && c.length > 0))
2099
2180
  return;
2100
- const t = e.serverIds, n = new Set(t);
2101
- if (n.size !== t.length)
2181
+ const t = e.serverIds, o = new Set(t);
2182
+ if (o.size !== t.length)
2102
2183
  return;
2103
- const o = Object.entries(e.toolIds);
2104
- if (!(o.length !== t.length || !o.every(
2105
- ([u, m]) => n.has(u) && Array.isArray(m) && m.every((d) => typeof d == "string" && d.length > 0) && new Set(m).size === m.length
2106
- )) && !t.some((u) => !Object.prototype.hasOwnProperty.call(e.toolIds, u)))
2184
+ const n = Object.entries(e.toolIds);
2185
+ if (!(n.length !== t.length || !n.every(
2186
+ ([c, v]) => o.has(c) && Array.isArray(v) && v.every((b) => typeof b == "string" && b.length > 0) && new Set(v).size === v.length
2187
+ )) && !t.some((c) => !Object.prototype.hasOwnProperty.call(e.toolIds, c)))
2107
2188
  return {
2108
2189
  serverIds: [...t],
2109
- toolIds: Object.fromEntries(o.map(([u, m]) => [u, [...m]]))
2190
+ toolIds: Object.fromEntries(n.map(([c, v]) => [c, [...v]]))
2110
2191
  };
2111
2192
  }
2112
- function on(e) {
2113
- var u;
2114
- const t = (u = e == null ? void 0 : e.metadata) == null ? void 0 : u[Pe];
2115
- if (!_(t) || t.modelId !== void 0 && typeof t.modelId != "string" || t.features !== void 0 && (!_(t.features) || Object.values(t.features).some((m) => typeof m != "boolean")))
2193
+ function vo(e) {
2194
+ var c;
2195
+ const t = (c = e == null ? void 0 : e.metadata) == null ? void 0 : c[Fe];
2196
+ if (!ee(t) || t.modelId !== void 0 && typeof t.modelId != "string" || t.features !== void 0 && (!ee(t.features) || Object.values(t.features).some((v) => typeof v != "boolean")))
2116
2197
  return;
2117
- let n;
2198
+ let o;
2118
2199
  if (t.reasoning !== void 0) {
2119
- if (!_(t.reasoning) || typeof t.reasoning.enabled != "boolean" || t.reasoning.effort !== void 0 && (typeof t.reasoning.effort != "string" || !jt.includes(t.reasoning.effort)))
2200
+ if (!ee(t.reasoning) || typeof t.reasoning.enabled != "boolean" || t.reasoning.effort !== void 0 && (typeof t.reasoning.effort != "string" || !Ht.includes(t.reasoning.effort)))
2120
2201
  return;
2121
- n = {
2202
+ o = {
2122
2203
  enabled: t.reasoning.enabled,
2123
2204
  effort: t.reasoning.effort
2124
2205
  };
2125
2206
  }
2126
- const o = t.mcp === void 0 ? void 0 : tn(t.mcp);
2127
- if (!(t.mcp !== void 0 && !o))
2207
+ const n = t.mcp === void 0 ? void 0 : fo(t.mcp);
2208
+ if (!(t.mcp !== void 0 && !n))
2128
2209
  return de({
2129
2210
  modelId: t.modelId,
2130
2211
  features: t.features,
2131
- reasoning: n,
2132
- mcp: o
2212
+ reasoning: o,
2213
+ mcp: n
2133
2214
  });
2134
2215
  }
2135
- const Fe = "新对话";
2136
- function We(e) {
2137
- return e.trim().slice(0, 20) || Fe;
2216
+ const qe = "新对话";
2217
+ function Ke(e) {
2218
+ return e.trim().slice(0, 20) || qe;
2138
2219
  }
2139
- function nn(e) {
2140
- return e || Fe;
2220
+ function mo(e) {
2221
+ return e || qe;
2141
2222
  }
2142
- const Le = (e) => ({
2223
+ const Ie = (e) => ({
2143
2224
  id: e.id,
2144
- title: nn(e.title),
2225
+ title: mo(e.title),
2145
2226
  createdAt: e.createdAt,
2146
2227
  updatedAt: e.updatedAt,
2147
2228
  metadata: e.metadata
2148
2229
  });
2149
- function sn(e) {
2150
- const { conversation: t, lastError: n, titleGenerator: o, send: u, composer: m } = e, d = q({}), a = o ?? We, l = h(() => t.activeConversation.value), b = h(() => t.conversations.value.map(Le)), A = h(() => {
2151
- const T = l.value;
2152
- return T ? {
2153
- ...Le(T),
2154
- messages: T.engine.messages.value,
2155
- requestState: T.engine.requestState.value,
2156
- processingState: T.engine.processingState.value,
2157
- lastError: d.value[T.id] ?? null
2230
+ function bo(e) {
2231
+ const { conversation: t, lastError: o, titleGenerator: n, send: c, composer: v } = e, b = K({}), a = n ?? Ke, r = h(() => t.activeConversation.value), u = h(() => t.conversations.value.map(Ie)), y = h(() => {
2232
+ const R = r.value;
2233
+ return R ? {
2234
+ ...Ie(R),
2235
+ messages: R.engine.messages.value,
2236
+ requestState: R.engine.requestState.value,
2237
+ processingState: R.engine.processingState.value,
2238
+ lastError: b.value[R.id] ?? null
2158
2239
  } : null;
2159
2240
  });
2160
- n && xe(() => {
2161
- var T;
2162
- n.value = ((T = A.value) == null ? void 0 : T.lastError) ?? null;
2241
+ o && at(() => {
2242
+ var R;
2243
+ o.value = ((R = y.value) == null ? void 0 : R.lastError) ?? null;
2163
2244
  });
2164
- const c = m ?? {}, f = h(
2245
+ const f = v ?? {}, m = h(
2165
2246
  () => {
2166
- var T;
2167
- return !!((T = c.submitDisabled) != null && T.value) || !Ue(c.mcp);
2168
- }
2169
- ), O = {
2170
- ...c,
2171
- submitDisabled: f
2172
- }, C = u ?? (async (T) => {
2173
- const p = T.text.trim();
2174
- if (!p)
2247
+ var R;
2248
+ return !!((R = f.submitDisabled) != null && R.value) || !De(f.mcp);
2249
+ }
2250
+ ), k = {
2251
+ ...f,
2252
+ submitDisabled: m
2253
+ }, T = c ?? (async (R) => {
2254
+ const I = R.text.trim();
2255
+ if (!I)
2175
2256
  return;
2176
- let r = l.value;
2177
- r ? r.title || t.updateConversationTitle(r.id, a(p)) : r = t.createConversation({ title: a(p) });
2178
- const i = Math.floor(Date.now() / 1e3);
2179
- await r.engine.send({
2257
+ let d = r.value;
2258
+ d ? d.title || t.updateConversationTitle(d.id, a(I)) : d = t.createConversation({ title: a(I) });
2259
+ const s = Math.floor(Date.now() / 1e3);
2260
+ await d.engine.send({
2180
2261
  role: "user",
2181
- content: p,
2262
+ content: I,
2182
2263
  metadata: {
2183
- createdAt: i,
2184
- updatedAt: i,
2185
- ...T.runConfig ? {
2186
- [Pe]: de(T.runConfig)
2264
+ createdAt: s,
2265
+ updatedAt: s,
2266
+ ...R.runConfig ? {
2267
+ [Fe]: de(R.runConfig)
2187
2268
  } : {}
2188
2269
  }
2189
2270
  });
2190
2271
  });
2191
- async function L(T) {
2192
- var s, v, S, $;
2193
- const p = T.text.trim();
2194
- if (!p || (s = O.disabled) != null && s.value || (v = O.submitDisabled) != null && v.value)
2272
+ async function E(R) {
2273
+ var l, i, A, M;
2274
+ const I = R.text.trim();
2275
+ if (!I || (l = k.disabled) != null && l.value || (i = k.submitDisabled) != null && i.value)
2195
2276
  return !1;
2196
- let r = ((S = t.activeConversation.value) == null ? void 0 : S.id) ?? null;
2197
- const i = {
2198
- ...T,
2199
- text: p,
2200
- runConfig: de(en(O))
2277
+ let d = ((A = t.activeConversation.value) == null ? void 0 : A.id) ?? null;
2278
+ const s = {
2279
+ ...R,
2280
+ text: I,
2281
+ runConfig: de(co(k))
2201
2282
  };
2202
2283
  try {
2203
- const w = Promise.resolve(C(i));
2204
- return r = (($ = t.activeConversation.value) == null ? void 0 : $.id) ?? r, r && (d.value = {
2205
- ...d.value,
2206
- [r]: null
2207
- }), await w, !0;
2208
- } catch (w) {
2209
- throw r && (d.value = {
2210
- ...d.value,
2211
- [r]: w
2212
- }), w;
2284
+ const $ = Promise.resolve(T(s));
2285
+ return d = ((M = t.activeConversation.value) == null ? void 0 : M.id) ?? d, d && (b.value = {
2286
+ ...b.value,
2287
+ [d]: null
2288
+ }), await $, !0;
2289
+ } catch ($) {
2290
+ throw d && (b.value = {
2291
+ ...b.value,
2292
+ [d]: $
2293
+ }), $;
2213
2294
  }
2214
2295
  }
2215
2296
  return {
2216
- conversations: b,
2217
- activeConversation: A,
2218
- composer: O,
2297
+ conversations: u,
2298
+ activeConversation: y,
2299
+ composer: k,
2219
2300
  actions: {
2220
- send: L,
2301
+ send: E,
2221
2302
  abort: async () => {
2222
2303
  await t.abortActiveRequest();
2223
2304
  },
2224
- createConversation: (T) => {
2225
- t.createConversation(T);
2305
+ createConversation: (R) => {
2306
+ t.createConversation(R);
2226
2307
  },
2227
- switchConversation: async (T) => {
2228
- await t.switchConversation(T);
2308
+ switchConversation: async (R) => {
2309
+ await t.switchConversation(R);
2229
2310
  },
2230
- renameConversation: (T, p) => {
2231
- t.updateConversationTitle(T, p);
2311
+ renameConversation: (R, I) => {
2312
+ t.updateConversationTitle(R, I);
2232
2313
  },
2233
- deleteConversation: async (T) => {
2234
- await t.deleteConversation(T);
2235
- const { [T]: p, ...r } = d.value;
2236
- d.value = r;
2314
+ deleteConversation: async (R) => {
2315
+ await t.deleteConversation(R);
2316
+ const { [R]: I, ...d } = b.value;
2317
+ b.value = d;
2237
2318
  }
2238
2319
  }
2239
2320
  };
2240
2321
  }
2241
- function an(e) {
2242
- var l, b, A;
2243
- const t = q(((l = e[0]) == null ? void 0 : l.id) ?? null), n = q(((A = (b = e[0]) == null ? void 0 : b.reasoning) == null ? void 0 : A.defaultEffort) ?? "high"), o = _e({}), u = h(() => e.find((c) => c.id === t.value));
2244
- function m(c) {
2245
- return e.find((f) => f.id === c);
2322
+ function go(e) {
2323
+ var r, u, y;
2324
+ const t = K(((r = e[0]) == null ? void 0 : r.id) ?? null), o = K(((y = (u = e[0]) == null ? void 0 : u.reasoning) == null ? void 0 : y.defaultEffort) ?? "high"), n = lt({}), c = h(() => e.find((f) => f.id === t.value));
2325
+ function v(f) {
2326
+ return e.find((m) => m.id === f);
2246
2327
  }
2247
- function d(c) {
2248
- var O, C, L, T, p;
2249
- const f = c ? m(c) : void 0;
2250
- re.forEach((r) => {
2251
- var i;
2252
- (i = f == null ? void 0 : f.capabilities) != null && i[r] || (o[r] = !1);
2253
- }), (C = (O = f == null ? void 0 : f.reasoning) == null ? void 0 : O.efforts) != null && C.includes(n.value) || (n.value = ((L = f == null ? void 0 : f.reasoning) == null ? void 0 : L.defaultEffort) ?? ((p = (T = f == null ? void 0 : f.reasoning) == null ? void 0 : T.efforts) == null ? void 0 : p[0]) ?? "high");
2328
+ function b(f) {
2329
+ var k, T, E, R, I;
2330
+ const m = f ? v(f) : void 0;
2331
+ re.forEach((d) => {
2332
+ var s;
2333
+ (s = m == null ? void 0 : m.capabilities) != null && s[d] || (n[d] = !1);
2334
+ }), (T = (k = m == null ? void 0 : m.reasoning) == null ? void 0 : k.efforts) != null && T.includes(o.value) || (o.value = ((E = m == null ? void 0 : m.reasoning) == null ? void 0 : E.defaultEffort) ?? ((I = (R = m == null ? void 0 : m.reasoning) == null ? void 0 : R.efforts) == null ? void 0 : I[0]) ?? "high");
2254
2335
  }
2255
2336
  return {
2256
2337
  model: {
2257
2338
  options: h(
2258
- () => e.map(({ id: c, label: f, capabilities: O }) => ({
2259
- id: c,
2260
- label: f,
2261
- capabilities: O
2339
+ () => e.map(({ id: f, label: m, capabilities: k }) => ({
2340
+ id: f,
2341
+ label: m,
2342
+ capabilities: k
2262
2343
  }))
2263
2344
  ),
2264
2345
  selectedId: h(() => t.value),
2265
2346
  features: h(
2266
2347
  () => Object.fromEntries(
2267
- re.map((c) => {
2268
- var f, O;
2348
+ re.map((f) => {
2349
+ var m, k;
2269
2350
  return [
2270
- c,
2271
- !!((O = (f = u.value) == null ? void 0 : f.capabilities) != null && O[c] && o[c])
2351
+ f,
2352
+ !!((k = (m = c.value) == null ? void 0 : m.capabilities) != null && k[f] && n[f])
2272
2353
  ];
2273
2354
  })
2274
2355
  )
2275
2356
  ),
2276
2357
  reasoning: h(() => {
2277
- var O, C, L;
2278
- const c = u.value, f = !!((O = c == null ? void 0 : c.capabilities) != null && O.thinking && o.thinking);
2358
+ var k, T, E;
2359
+ const f = c.value, m = !!((k = f == null ? void 0 : f.capabilities) != null && k.thinking && n.thinking);
2279
2360
  return {
2280
- enabled: f,
2281
- effort: f && ((L = (C = c == null ? void 0 : c.reasoning) == null ? void 0 : C.efforts) != null && L.includes(n.value)) ? n.value : void 0
2361
+ enabled: m,
2362
+ effort: m && ((E = (T = f == null ? void 0 : f.reasoning) == null ? void 0 : T.efforts) != null && E.includes(o.value)) ? o.value : void 0
2282
2363
  };
2283
2364
  }),
2284
- select(c) {
2285
- if (c !== null && !m(c))
2286
- throw new Error(`Unknown model: ${c}`);
2287
- t.value = c, d(c);
2365
+ select(f) {
2366
+ if (f !== null && !v(f))
2367
+ throw new Error(`Unknown model: ${f}`);
2368
+ t.value = f, b(f);
2288
2369
  },
2289
- setFeature(c, f) {
2290
- var O, C, L;
2291
- if (f) {
2292
- if (!Object.prototype.hasOwnProperty.call(((O = u.value) == null ? void 0 : O.capabilities) ?? {}, c))
2293
- throw new Error(`Unknown model feature: ${c}`);
2294
- if (!((L = (C = u.value) == null ? void 0 : C.capabilities) != null && L[c]))
2295
- throw new Error(`Current model does not support ${c}`);
2370
+ setFeature(f, m) {
2371
+ var k, T, E;
2372
+ if (m) {
2373
+ if (!Object.prototype.hasOwnProperty.call(((k = c.value) == null ? void 0 : k.capabilities) ?? {}, f))
2374
+ throw new Error(`Unknown model feature: ${f}`);
2375
+ if (!((E = (T = c.value) == null ? void 0 : T.capabilities) != null && E[f]))
2376
+ throw new Error(`Current model does not support ${f}`);
2296
2377
  }
2297
- o[c] = f;
2378
+ n[f] = m;
2298
2379
  }
2299
2380
  },
2300
- selectedModel: u,
2301
- resolveModel: m
2381
+ selectedModel: c,
2382
+ resolveModel: v
2302
2383
  };
2303
2384
  }
2304
- const ye = "__chat_provider_model_id";
2305
- function ln(e) {
2385
+ const Ce = "__chat_provider_model_id";
2386
+ function ho(e) {
2306
2387
  return {
2307
2388
  name: "chat-provider-request",
2308
- onBeforeRequest({ customContext: t, requestBody: n }) {
2309
- var d, a, l;
2310
- const o = t[ie], u = o != null && o.modelId ? e(o.modelId) : null;
2311
- if (o != null && o.modelId && !u)
2312
- throw new Error(`Unknown model for this turn: ${o.modelId}`);
2313
- if (!u || !o)
2389
+ onBeforeRequest({ customContext: t, requestBody: o }) {
2390
+ var b, a, r;
2391
+ const n = t[ie], c = n != null && n.modelId ? e(n.modelId) : null;
2392
+ if (n != null && n.modelId && !c)
2393
+ throw new Error(`Unknown model for this turn: ${n.modelId}`);
2394
+ if (!c || !n)
2314
2395
  return;
2315
- n[ye] = u.id;
2316
- const m = o;
2317
- re.forEach((b) => {
2318
- var O, C, L, T;
2319
- const A = (O = u.featureBody) == null ? void 0 : O[b];
2320
- if (!A) return;
2321
- const f = (b === "thinking" ? ((C = m.reasoning) == null ? void 0 : C.enabled) ?? ((L = m.features) == null ? void 0 : L.thinking) : (T = m.features) == null ? void 0 : T[b]) ? A.enabled : A.disabled;
2322
- f && Object.assign(n, f);
2323
- }), (d = o == null ? void 0 : o.reasoning) != null && d.effort && ((a = u.reasoning) != null && a.effortParam) && ((l = u.reasoning.efforts) != null && l.includes(o.reasoning.effort)) && Object.assign(n, {
2324
- [u.reasoning.effortParam]: o.reasoning.effort
2396
+ o[Ce] = c.id;
2397
+ const v = n;
2398
+ re.forEach((u) => {
2399
+ var k, T, E, R;
2400
+ const y = (k = c.featureBody) == null ? void 0 : k[u];
2401
+ if (!y) return;
2402
+ const m = (u === "thinking" ? ((T = v.reasoning) == null ? void 0 : T.enabled) ?? ((E = v.features) == null ? void 0 : E.thinking) : (R = v.features) == null ? void 0 : R[u]) ? y.enabled : y.disabled;
2403
+ m && Object.assign(o, m);
2404
+ }), (b = n == null ? void 0 : n.reasoning) != null && b.effort && ((a = c.reasoning) != null && a.effortParam) && ((r = c.reasoning.efforts) != null && r.includes(n.reasoning.effort)) && Object.assign(o, {
2405
+ [c.reasoning.effortParam]: n.reasoning.effort
2325
2406
  });
2326
2407
  }
2327
2408
  };
2328
2409
  }
2329
- function rn(e) {
2330
- return async (t, n) => {
2331
- const o = t[ye];
2332
- if (typeof o != "string" || !o)
2410
+ function po(e) {
2411
+ return async (t, o) => {
2412
+ const n = t[Ce];
2413
+ if (typeof n != "string" || !n)
2333
2414
  throw new Error("No model selected for this turn.");
2334
- const u = e(o);
2335
- if (!u)
2336
- throw new Error(`Unknown model for this turn: ${o}`);
2337
- const m = { ...t };
2338
- delete m[ye];
2339
- const d = u.timeout, a = d === void 0 ? void 0 : new AbortController(), l = a ? setTimeout(() => a.abort(new Error(`Provider request timed out after ${d}ms.`)), d) : void 0, b = a ? AbortSignal.any([n, a.signal]) : n, A = {
2415
+ const c = e(n);
2416
+ if (!c)
2417
+ throw new Error(`Unknown model for this turn: ${n}`);
2418
+ const v = { ...t };
2419
+ delete v[Ce];
2420
+ const b = c.timeout, a = b === void 0 ? void 0 : new AbortController(), r = a ? setTimeout(() => a.abort(new Error(`Provider request timed out after ${b}ms.`)), b) : void 0, u = a ? AbortSignal.any([o, a.signal]) : o, y = {
2340
2421
  "Content-Type": "application/json",
2341
- ...u.headers
2342
- }, c = Object.keys(A).some((f) => f.toLowerCase() === "authorization");
2343
- u.apiKey && !c && (A.Authorization = `Bearer ${u.apiKey}`);
2422
+ ...c.headers
2423
+ }, f = Object.keys(y).some((m) => m.toLowerCase() === "authorization");
2424
+ c.apiKey && !f && (y.Authorization = `Bearer ${c.apiKey}`);
2344
2425
  try {
2345
- const f = await fetch(u.apiUrl, {
2426
+ const m = await fetch(c.apiUrl, {
2346
2427
  method: "POST",
2347
- headers: A,
2428
+ headers: y,
2348
2429
  body: JSON.stringify({
2349
- ...m,
2350
- model: u.id,
2430
+ ...v,
2431
+ model: c.id,
2351
2432
  stream: !0
2352
2433
  }),
2353
- signal: b
2434
+ signal: u
2354
2435
  });
2355
- if (!f.ok) {
2356
- const O = await f.text().catch(() => "");
2357
- throw new Error(`HTTP ${f.status}: ${f.statusText}${O ? ` - ${O}` : ""}`);
2436
+ if (!m.ok) {
2437
+ const k = await m.text().catch(() => "");
2438
+ throw new Error(`HTTP ${m.status}: ${m.statusText}${k ? ` - ${k}` : ""}`);
2358
2439
  }
2359
2440
  return async function* () {
2360
2441
  try {
2361
- yield* At(f, { signal: b });
2442
+ yield* Tt(m, { signal: u });
2362
2443
  } finally {
2363
- l !== void 0 && clearTimeout(l);
2444
+ r !== void 0 && clearTimeout(r);
2364
2445
  }
2365
2446
  }();
2366
- } catch (f) {
2367
- throw l !== void 0 && clearTimeout(l), f;
2447
+ } catch (m) {
2448
+ throw r !== void 0 && clearTimeout(r), m;
2368
2449
  }
2369
2450
  };
2370
2451
  }
2371
- const dn = {
2452
+ const yo = {
2372
2453
  openai: {
2373
2454
  label: "OpenAI",
2374
2455
  apiUrl: "https://api.openai.com/v1"
@@ -2416,327 +2497,327 @@ const dn = {
2416
2497
  }
2417
2498
  }
2418
2499
  };
2419
- function un(e) {
2500
+ function Ao(e) {
2420
2501
  const t = e.trim().replace(/\/+$/, "");
2421
2502
  return t.endsWith("/chat/completions") ? t : `${t}/chat/completions`;
2422
2503
  }
2423
- function cn(e) {
2504
+ function Co(e) {
2424
2505
  const t = /* @__PURE__ */ new Set();
2425
- return e.flatMap((n) => {
2426
- const o = dn[n.type];
2427
- if (!o)
2428
- throw new Error(`Unknown provider type: ${String(n.type)}`);
2429
- const u = n.label ?? o.label, m = un(n.apiUrl ?? o.apiUrl);
2430
- return n.models.map((d) => {
2431
- if (t.has(d.id))
2432
- throw new Error(`Duplicate model id: ${d.id}`);
2433
- return t.add(d.id), {
2434
- ...d,
2435
- providerType: n.type,
2436
- providerLabel: u,
2437
- apiUrl: m,
2438
- apiKey: n.apiKey,
2439
- headers: n.headers,
2440
- timeout: n.timeout,
2506
+ return e.flatMap((o) => {
2507
+ const n = yo[o.type];
2508
+ if (!n)
2509
+ throw new Error(`Unknown provider type: ${String(o.type)}`);
2510
+ const c = o.label ?? n.label, v = Ao(o.apiUrl ?? n.apiUrl);
2511
+ return o.models.map((b) => {
2512
+ if (t.has(b.id))
2513
+ throw new Error(`Duplicate model id: ${b.id}`);
2514
+ return t.add(b.id), {
2515
+ ...b,
2516
+ providerType: o.type,
2517
+ providerLabel: c,
2518
+ apiUrl: v,
2519
+ apiKey: o.apiKey,
2520
+ headers: o.headers,
2521
+ timeout: o.timeout,
2441
2522
  featureBody: {
2442
- ...o.featureBody,
2443
- ...d.featureBody
2523
+ ...n.featureBody,
2524
+ ...b.featureBody
2444
2525
  },
2445
- reasoning: d.reasoning ?? o.reasoning
2526
+ reasoning: b.reasoning ?? n.reasoning
2446
2527
  };
2447
2528
  });
2448
2529
  });
2449
2530
  }
2450
- function fn(e) {
2531
+ function wo(e) {
2451
2532
  return [...e].reverse().find((t) => t.role === "user");
2452
2533
  }
2453
- function vn() {
2534
+ function So() {
2454
2535
  return {
2455
2536
  name: "chat-run-config-context",
2456
2537
  onTurnStart({ currentTurn: e, setCustomContext: t }) {
2457
2538
  t({
2458
- [ie]: on(fn(e))
2539
+ [ie]: vo(wo(e))
2459
2540
  });
2460
2541
  }
2461
2542
  };
2462
2543
  }
2463
- const ve = "__chat_tool_snapshot";
2464
- function mn(e, t) {
2465
- var n;
2466
- for (const o of t.serverIds) {
2467
- const u = (n = t.toolIds[o]) == null ? void 0 : n.find((m) => `${o}__${m}` === e);
2468
- if (u)
2469
- return { serverId: o, toolId: u };
2544
+ const be = "__chat_tool_snapshot";
2545
+ function ko(e, t) {
2546
+ var o;
2547
+ for (const n of t.serverIds) {
2548
+ const c = (o = t.toolIds[n]) == null ? void 0 : o.find((v) => `${n}__${v}` === e);
2549
+ if (c)
2550
+ return { serverId: n, toolId: c };
2470
2551
  }
2471
2552
  return null;
2472
2553
  }
2473
- function bn(e, t) {
2474
- return wt({
2475
- getTools: async ({ customContext: n, setCustomContext: o }) => {
2476
- const u = n[ie], m = u == null ? void 0 : u.mcp;
2477
- if (!m)
2554
+ function Eo(e, t) {
2555
+ return Mt({
2556
+ getTools: async ({ customContext: o, setCustomContext: n }) => {
2557
+ const c = o[ie], v = c == null ? void 0 : c.mcp;
2558
+ if (!v)
2478
2559
  return [];
2479
- const d = m.serverIds.find(
2480
- (l) => !Object.prototype.hasOwnProperty.call(m.toolIds, l)
2560
+ const b = v.serverIds.find(
2561
+ (r) => !Object.prototype.hasOwnProperty.call(v.toolIds, r)
2481
2562
  );
2482
- if (d)
2483
- throw new Error(`Tool selection is missing for this turn: ${d}`);
2484
- let a = n[ve];
2485
- return Array.isArray(a) || (a = (await e(m.serverIds, m.toolIds)).map((l) => ({ ...l })), o({
2486
- [ve]: a
2487
- })), a.map((l) => ({
2563
+ if (b)
2564
+ throw new Error(`Tool selection is missing for this turn: ${b}`);
2565
+ let a = o[be];
2566
+ return Array.isArray(a) || (a = (await e(v.serverIds, v.toolIds)).map((r) => ({ ...r })), n({
2567
+ [be]: a
2568
+ })), a.map((r) => ({
2488
2569
  type: "function",
2489
2570
  function: {
2490
- name: l.name,
2491
- description: l.description ?? "",
2492
- parameters: l.inputSchema ?? { type: "object", properties: {} }
2571
+ name: r.name,
2572
+ description: r.description ?? "",
2573
+ parameters: r.inputSchema ?? { type: "object", properties: {} }
2493
2574
  }
2494
2575
  }));
2495
2576
  },
2496
- callTool: async (n, { customContext: o }) => {
2497
- var f, O;
2498
- const u = o[ie], m = u == null ? void 0 : u.mcp, d = ((f = n.function) == null ? void 0 : f.name) ?? "", a = m ? mn(d, m) : null, l = o[ve], b = Array.isArray(l) ? l.find((C) => C.name === d) : void 0;
2499
- if (!m || !a || !b || b.serverId !== a.serverId || b.id !== a.toolId)
2500
- throw new Error(`Tool is not enabled in this turn: ${d}`);
2501
- const A = (O = n.function) == null ? void 0 : O.arguments;
2502
- let c = {};
2503
- if (A && A.trim())
2577
+ callTool: async (o, { customContext: n }) => {
2578
+ var m, k;
2579
+ const c = n[ie], v = c == null ? void 0 : c.mcp, b = ((m = o.function) == null ? void 0 : m.name) ?? "", a = v ? ko(b, v) : null, r = n[be], u = Array.isArray(r) ? r.find((T) => T.name === b) : void 0;
2580
+ if (!v || !a || !u || u.serverId !== a.serverId || u.id !== a.toolId)
2581
+ throw new Error(`Tool is not enabled in this turn: ${b}`);
2582
+ const y = (k = o.function) == null ? void 0 : k.arguments;
2583
+ let f = {};
2584
+ if (y && y.trim())
2504
2585
  try {
2505
- c = JSON.parse(A);
2586
+ f = JSON.parse(y);
2506
2587
  } catch {
2507
- throw new Error(`Invalid JSON arguments for MCP tool "${d}".`);
2588
+ throw new Error(`Invalid JSON arguments for MCP tool "${b}".`);
2508
2589
  }
2509
- return t(b.serverId, b.originalName, c);
2590
+ return t(u.serverId, u.originalName, f);
2510
2591
  }
2511
2592
  });
2512
2593
  }
2513
- const gn = 3e4;
2514
- function $e(e, t, n) {
2515
- let o;
2516
- const u = new Promise((m, d) => {
2517
- o = setTimeout(() => d(new Error(`MCP ${n} timed out after ${t}ms.`)), t);
2594
+ const Oo = 3e4;
2595
+ function Ve(e, t, o) {
2596
+ let n;
2597
+ const c = new Promise((v, b) => {
2598
+ n = setTimeout(() => b(new Error(`MCP ${o} timed out after ${t}ms.`)), t);
2518
2599
  });
2519
- return Promise.race([e, u]).finally(() => {
2520
- o !== void 0 && clearTimeout(o);
2600
+ return Promise.race([e, c]).finally(() => {
2601
+ n !== void 0 && clearTimeout(n);
2521
2602
  });
2522
2603
  }
2523
- function hn(e, t, n) {
2524
- const o = typeof t.name == "string" && t.name ? t.name : `tool_${n + 1}`;
2604
+ function Ro(e, t, o) {
2605
+ const n = typeof t.name == "string" && t.name ? t.name : `tool_${o + 1}`;
2525
2606
  return {
2526
2607
  serverId: e,
2527
- id: o,
2528
- name: `${e}__${o}`,
2529
- originalName: o,
2608
+ id: n,
2609
+ name: `${e}__${n}`,
2610
+ originalName: n,
2530
2611
  description: t.description,
2531
2612
  inputSchema: typeof t.inputSchema == "object" && t.inputSchema !== null ? t.inputSchema : { type: "object", properties: {} }
2532
2613
  };
2533
2614
  }
2534
- function pn(e, t) {
2535
- var n;
2615
+ function To(e, t) {
2616
+ var o;
2536
2617
  try {
2537
2618
  return new URL(t);
2538
2619
  } catch {
2539
- const o = (n = globalThis.location) == null ? void 0 : n.origin;
2540
- if (!o)
2620
+ const n = (o = globalThis.location) == null ? void 0 : o.origin;
2621
+ if (!n)
2541
2622
  throw new Error(`MCP server "${e}" requires an absolute baseUrl outside a browser environment.`);
2542
- return new URL(t, o);
2623
+ return new URL(t, n);
2543
2624
  }
2544
2625
  }
2545
- function yn(e) {
2626
+ function Mo(e) {
2546
2627
  const t = /* @__PURE__ */ new Map();
2547
- for (const r of e) {
2548
- if (t.has(r.id)) throw new Error(`Duplicate MCP server id: ${r.id}`);
2549
- t.set(r.id, r);
2628
+ for (const d of e) {
2629
+ if (t.has(d.id)) throw new Error(`Duplicate MCP server id: ${d.id}`);
2630
+ t.set(d.id, d);
2550
2631
  }
2551
- const n = me(
2552
- e.map((r) => ({
2553
- id: r.id,
2554
- name: r.name,
2555
- description: r.description,
2556
- installed: r.installed === !0,
2632
+ const o = ge(
2633
+ e.map((d) => ({
2634
+ id: d.id,
2635
+ name: d.name,
2636
+ description: d.description,
2637
+ installed: d.installed === !0,
2557
2638
  enabled: !1,
2558
- metadata: r.icon ? { icon: r.icon } : void 0,
2559
- config: r
2639
+ metadata: d.icon ? { icon: d.icon } : void 0,
2640
+ config: d
2560
2641
  }))
2561
- ), o = me({}), u = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
2562
- function l(r) {
2563
- const i = n.value.find((s) => s.id === r);
2564
- if (!i) throw new Error(`Unknown MCP server: ${r}`);
2565
- return i;
2642
+ ), n = ge({}), c = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
2643
+ function r(d) {
2644
+ const s = o.value.find((l) => l.id === d);
2645
+ if (!s) throw new Error(`Unknown MCP server: ${d}`);
2646
+ return s;
2566
2647
  }
2567
- function b(r) {
2568
- const i = { ...o.value };
2569
- delete i[r], o.value = i, u.delete(r), d.delete(r), m.delete(r), a.set(r, (a.get(r) ?? 0) + 1);
2648
+ function u(d) {
2649
+ const s = { ...n.value };
2650
+ delete s[d], n.value = s, c.delete(d), b.delete(d), v.delete(d), a.set(d, (a.get(d) ?? 0) + 1);
2570
2651
  }
2571
- function A(r, i) {
2572
- const s = o.value[r];
2573
- s && (o.value = {
2574
- ...o.value,
2575
- [r]: s.map((v) => ({ ...v, enabled: i }))
2652
+ function y(d, s) {
2653
+ const l = n.value[d];
2654
+ l && (n.value = {
2655
+ ...n.value,
2656
+ [d]: l.map((i) => ({ ...i, enabled: s }))
2576
2657
  });
2577
2658
  }
2578
- async function c(r, i) {
2579
- var w;
2580
- const s = t.get(r);
2581
- if (!s) throw new Error(`Unknown MCP server: ${r}`);
2582
- (w = s.validate) == null || w.call(s, r);
2583
- const v = new kt({ name: `tiny-robot-chat-${r}`, version: "1.0.0" }), S = new Et(pn(r, s.baseUrl), {
2584
- requestInit: { headers: s.headers }
2585
- }), $ = s.timeout ?? gn;
2659
+ async function f(d, s) {
2660
+ var $;
2661
+ const l = t.get(d);
2662
+ if (!l) throw new Error(`Unknown MCP server: ${d}`);
2663
+ ($ = l.validate) == null || $.call(l, d);
2664
+ const i = new Lt({ name: `tiny-robot-chat-${d}`, version: "1.0.0" }), A = new $t(To(d, l.baseUrl), {
2665
+ requestInit: { headers: l.headers }
2666
+ }), M = l.timeout ?? Oo;
2586
2667
  try {
2587
- return await $e(v.connect(S), $, "connect"), await $e(i(v), $, "request");
2668
+ return await Ve(i.connect(A), M, "connect"), await Ve(s(i), M, "request");
2588
2669
  } finally {
2589
- await v.close().catch(() => {
2670
+ await i.close().catch(() => {
2590
2671
  });
2591
2672
  }
2592
2673
  }
2593
- async function f(r, i = !1) {
2594
- const s = u.get(r);
2595
- if (!i && s) return s;
2596
- const v = a.get(r) ?? 0, S = m.get(r);
2597
- if ((S == null ? void 0 : S.generation) === v) return S.task;
2598
- const $ = c(r, async (P) => (await P.listTools()).tools.map((K, x) => hn(r, K, x))), w = { generation: v, task: $ };
2599
- m.set(r, w);
2674
+ async function m(d, s = !1) {
2675
+ const l = c.get(d);
2676
+ if (!s && l) return l;
2677
+ const i = a.get(d) ?? 0, A = v.get(d);
2678
+ if ((A == null ? void 0 : A.generation) === i) return A.task;
2679
+ const M = f(d, async (V) => (await V.listTools()).tools.map((G, Q) => Ro(d, G, Q))), $ = { generation: i, task: M };
2680
+ v.set(d, $);
2600
2681
  try {
2601
- const P = await $;
2602
- return (a.get(r) ?? 0) === v && u.set(r, P), P;
2682
+ const V = await M;
2683
+ return (a.get(d) ?? 0) === i && c.set(d, V), V;
2603
2684
  } finally {
2604
- m.get(r) === w && m.delete(r);
2685
+ v.get(d) === $ && v.delete(d);
2605
2686
  }
2606
2687
  }
2607
- async function O(r, i = !0) {
2608
- const s = d.get(r);
2609
- if (s) {
2610
- await s;
2688
+ async function k(d, s = !0) {
2689
+ const l = b.get(d);
2690
+ if (l) {
2691
+ await l;
2611
2692
  return;
2612
2693
  }
2613
- const v = C(r, i);
2614
- d.set(r, v);
2694
+ const i = T(d, s);
2695
+ b.set(d, i);
2615
2696
  try {
2616
- await v;
2697
+ await i;
2617
2698
  } finally {
2618
- d.get(r) === v && d.delete(r);
2699
+ b.get(d) === i && b.delete(d);
2619
2700
  }
2620
2701
  }
2621
- async function C(r, i) {
2622
- const s = l(r);
2623
- if (!s.installed) throw new Error(`MCP server is not installed: ${r}`);
2624
- const v = a.get(r) ?? 0, S = s;
2625
- let $ = !1;
2626
- s.loading = !0, s.error = void 0;
2702
+ async function T(d, s) {
2703
+ const l = r(d);
2704
+ if (!l.installed) throw new Error(`MCP server is not installed: ${d}`);
2705
+ const i = a.get(d) ?? 0, A = l;
2706
+ let M = !1;
2707
+ l.loading = !0, l.error = void 0;
2627
2708
  try {
2628
- const w = await f(r, !0);
2629
- if (!S.installed || (a.get(r) ?? 0) !== v) return;
2630
- o.value = {
2631
- ...o.value,
2632
- [r]: w.map((P) => ({
2633
- id: P.id,
2634
- name: P.originalName,
2635
- description: P.description,
2636
- enabled: S.enabled && i
2709
+ const $ = await m(d, !0);
2710
+ if (!A.installed || (a.get(d) ?? 0) !== i) return;
2711
+ n.value = {
2712
+ ...n.value,
2713
+ [d]: $.map((V) => ({
2714
+ id: V.id,
2715
+ name: V.originalName,
2716
+ description: V.description,
2717
+ enabled: A.enabled && s
2637
2718
  }))
2638
2719
  };
2639
- } catch (w) {
2640
- throw (a.get(r) ?? 0) === v && (S.enabled = !1, S.error = w, $ = !0, b(r)), w;
2720
+ } catch ($) {
2721
+ throw (a.get(d) ?? 0) === i && (A.enabled = !1, A.error = $, M = !0, u(d)), $;
2641
2722
  } finally {
2642
- ((a.get(r) ?? 0) === v || $) && (S.loading = void 0);
2723
+ ((a.get(d) ?? 0) === i || M) && (A.loading = void 0);
2643
2724
  }
2644
2725
  }
2645
- const L = {
2646
- servers: h(() => n.value.map(({ config: r, ...i }) => ({ ...i }))),
2726
+ const E = {
2727
+ servers: h(() => o.value.map(({ config: d, ...s }) => ({ ...s }))),
2647
2728
  tools: h(
2648
- () => Object.fromEntries(Object.entries(o.value).map(([r, i]) => [r, i.map((s) => ({ ...s }))]))
2729
+ () => Object.fromEntries(Object.entries(n.value).map(([d, s]) => [d, s.map((l) => ({ ...l }))]))
2649
2730
  ),
2650
- async addServer(r) {
2651
- const i = l(r);
2652
- if (i.installed = !0, i.enabled = !0, o.value[r]) {
2653
- A(r, !0);
2731
+ async addServer(d) {
2732
+ const s = r(d);
2733
+ if (s.installed = !0, s.enabled = !0, n.value[d]) {
2734
+ y(d, !0);
2654
2735
  return;
2655
2736
  }
2656
- await O(r), A(r, !0);
2737
+ await k(d), y(d, !0);
2657
2738
  },
2658
- removeServer(r) {
2659
- const i = l(r);
2660
- i.installed = !1, i.enabled = !1, i.loading = void 0, i.error = void 0, b(r);
2739
+ removeServer(d) {
2740
+ const s = r(d);
2741
+ s.installed = !1, s.enabled = !1, s.loading = void 0, s.error = void 0, u(d);
2661
2742
  },
2662
- async setServerEnabled(r, i) {
2663
- const s = l(r);
2664
- if (i && !s.installed) throw new Error(`MCP server is not installed: ${r}`);
2665
- if (s.enabled = i, s.error = void 0, i) {
2666
- if (o.value[r]) {
2667
- A(r, !0);
2743
+ async setServerEnabled(d, s) {
2744
+ const l = r(d);
2745
+ if (s && !l.installed) throw new Error(`MCP server is not installed: ${d}`);
2746
+ if (l.enabled = s, l.error = void 0, s) {
2747
+ if (n.value[d]) {
2748
+ y(d, !0);
2668
2749
  return;
2669
2750
  }
2670
- await O(r), A(r, !0);
2751
+ await k(d), y(d, !0);
2671
2752
  } else
2672
- A(r, !1);
2753
+ y(d, !1);
2673
2754
  },
2674
- setToolEnabled(r, i, s) {
2675
- const v = l(r), S = o.value[r];
2676
- if (!v.installed) throw new Error(`MCP server is not installed: ${r}`);
2677
- if (!S) throw new Error(`MCP tools are not loaded: ${r}`);
2678
- if (!S.some((w) => w.id === i)) throw new Error(`Unknown MCP tool: ${r}/${i}`);
2679
- const $ = S.map((w) => w.id === i ? { ...w, enabled: s } : w);
2680
- o.value = {
2681
- ...o.value,
2682
- [r]: $
2683
- }, s ? v.enabled = !0 : $.some((w) => w.enabled) || (v.enabled = !1);
2755
+ setToolEnabled(d, s, l) {
2756
+ const i = r(d), A = n.value[d];
2757
+ if (!i.installed) throw new Error(`MCP server is not installed: ${d}`);
2758
+ if (!A) throw new Error(`MCP tools are not loaded: ${d}`);
2759
+ if (!A.some(($) => $.id === s)) throw new Error(`Unknown MCP tool: ${d}/${s}`);
2760
+ const M = A.map(($) => $.id === s ? { ...$, enabled: l } : $);
2761
+ n.value = {
2762
+ ...n.value,
2763
+ [d]: M
2764
+ }, l ? i.enabled = !0 : M.some(($) => $.enabled) || (i.enabled = !1);
2684
2765
  }
2685
2766
  };
2686
- for (const r of n.value)
2687
- r.installed && O(r.id, !1).catch(() => {
2767
+ for (const d of o.value)
2768
+ d.installed && k(d.id, !1).catch(() => {
2688
2769
  });
2689
- return { runtime: L, listTools: async (r, i) => {
2690
- const s = [];
2691
- for (const v of r) {
2692
- if (!Object.prototype.hasOwnProperty.call(i, v))
2693
- throw new Error(`MCP tool selection is missing for this turn: ${v}`);
2694
- const S = u.get(v) ?? await f(v), $ = i[v];
2695
- if ($.length === 0) continue;
2696
- const w = S.filter((P) => $.includes(P.id));
2697
- if (w.length !== $.length)
2698
- throw new Error(`MCP tools selected for this turn no longer exist on "${v}".`);
2699
- s.push(...w);
2700
- }
2701
- return s;
2702
- }, callTool: (r, i, s) => c(r, (v) => v.callTool({ name: i, arguments: s })) };
2770
+ return { runtime: E, listTools: async (d, s) => {
2771
+ const l = [];
2772
+ for (const i of d) {
2773
+ if (!Object.prototype.hasOwnProperty.call(s, i))
2774
+ throw new Error(`MCP tool selection is missing for this turn: ${i}`);
2775
+ const A = c.get(i) ?? await m(i), M = s[i];
2776
+ if (M.length === 0) continue;
2777
+ const $ = A.filter((V) => M.includes(V.id));
2778
+ if ($.length !== M.length)
2779
+ throw new Error(`MCP tools selected for this turn no longer exist on "${i}".`);
2780
+ l.push(...$);
2781
+ }
2782
+ return l;
2783
+ }, callTool: (d, s, l) => f(d, (i) => i.callTool({ name: s, arguments: l })) };
2703
2784
  }
2704
- function Mn(e) {
2705
- var f;
2706
- const t = e.conversation ?? {}, n = e.titleGenerator ?? We, o = t.useMessageOptions, u = o == null ? void 0 : o.responseProvider;
2785
+ function Wo(e) {
2786
+ var m;
2787
+ const t = e.conversation ?? {}, o = e.titleGenerator ?? Ke, n = t.useMessageOptions, c = n == null ? void 0 : n.responseProvider;
2707
2788
  if (e.mcp !== void 0 && e.mcpServers !== void 0)
2708
2789
  throw new Error("useLocalChatRuntime: mcp and mcpServers cannot be configured at the same time.");
2709
- if ((f = e.modelProviders) != null && f.length && u)
2790
+ if ((m = e.modelProviders) != null && m.length && c)
2710
2791
  throw new Error("useLocalChatRuntime: modelProviders and responseProvider cannot be configured at the same time.");
2711
- const m = e.modelProviders ? cn(e.modelProviders) : [], d = m.length > 0 ? an(m) : null, a = e.mcpServers !== void 0 ? yn(e.mcpServers) : e.mcp, l = e.composer ?? {}, b = [vn()];
2712
- d && b.push(ln(d.resolveModel)), a && b.push(bn(a.listTools, a.callTool));
2713
- const A = {
2714
- ...o,
2715
- plugins: [...b, ...(o == null ? void 0 : o.plugins) ?? []],
2716
- responseProvider: d ? rn(d.resolveModel) : u
2792
+ const v = e.modelProviders ? Co(e.modelProviders) : [], b = v.length > 0 ? go(v) : null, a = e.mcpServers !== void 0 ? Mo(e.mcpServers) : e.mcp, r = e.composer ?? {}, u = [So()];
2793
+ b && u.push(ho(b.resolveModel)), a && u.push(Eo(a.listTools, a.callTool));
2794
+ const y = {
2795
+ ...n,
2796
+ plugins: [...u, ...(n == null ? void 0 : n.plugins) ?? []],
2797
+ responseProvider: b ? po(b.resolveModel) : c
2717
2798
  };
2718
- if (!A.responseProvider)
2799
+ if (!y.responseProvider)
2719
2800
  throw new Error("useLocalChatRuntime requires conversation.useMessageOptions.responseProvider or modelProviders.");
2720
- const c = St({
2801
+ const f = Pt({
2721
2802
  autoSaveMessages: !0,
2722
2803
  ...t,
2723
- useMessageOptions: A
2804
+ useMessageOptions: y
2724
2805
  });
2725
- return sn({
2726
- conversation: c,
2727
- titleGenerator: n,
2806
+ return bo({
2807
+ conversation: f,
2808
+ titleGenerator: o,
2728
2809
  composer: {
2729
- ...l,
2730
- model: d == null ? void 0 : d.model,
2810
+ ...r,
2811
+ model: b == null ? void 0 : b.model,
2731
2812
  mcp: a == null ? void 0 : a.runtime
2732
2813
  }
2733
2814
  });
2734
2815
  }
2735
2816
  export {
2736
- Tn as TrChat,
2737
- Ho as TrChatUI,
2738
- Mt as useChatHistoryItems,
2739
- xo as useChatRuntimeAdapter,
2740
- sn as useKitChatRuntime,
2741
- Mn as useLocalChatRuntime
2817
+ Fo as TrChat,
2818
+ lo as TrChatUI,
2819
+ Bt as useChatHistoryItems,
2820
+ io as useChatRuntimeAdapter,
2821
+ bo as useKitChatRuntime,
2822
+ Wo as useLocalChatRuntime
2742
2823
  };