@pagelines/sdk 1.0.878 → 1.0.879

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +68 -68
  2. package/dist/BotProvider.js +777 -0
  3. package/dist/BotProvider.js.map +1 -0
  4. package/dist/{AgentWidgetInline.js → BotWidgetInline.js} +8 -8
  5. package/dist/BotWidgetInline.js.map +1 -0
  6. package/dist/{AgentWidgetModal.js → BotWidgetModal.js} +7 -7
  7. package/dist/BotWidgetModal.js.map +1 -0
  8. package/dist/{AgentWrap.js → BotWrap.js} +1174 -1145
  9. package/dist/BotWrap.js.map +1 -0
  10. package/dist/{agent/AgentController.d.ts → bot/BotController.d.ts} +35 -18
  11. package/dist/bot/index.d.ts +14 -0
  12. package/dist/{agent → bot}/schema.d.ts +6 -6
  13. package/dist/{agent/ui/AgentAvatar.vue.d.ts → bot/ui/BotAvatar.vue.d.ts} +6 -6
  14. package/dist/{agent/ui/AgentChat.vue.d.ts → bot/ui/BotChat.vue.d.ts} +5 -5
  15. package/dist/{agent/ui/AgentProvider.vue.d.ts → bot/ui/BotProvider.vue.d.ts} +3 -3
  16. package/dist/{agent/ui/AgentWrap.vue.d.ts → bot/ui/BotWrap.vue.d.ts} +3 -4
  17. package/dist/{agent/ui/ElAgentAbout.vue.d.ts → bot/ui/ElBotAbout.vue.d.ts} +2 -2
  18. package/dist/{agent/ui/ElAgentChat.vue.d.ts → bot/ui/ElBotChat.vue.d.ts} +5 -5
  19. package/dist/{agent/ui/ElAgentChatPreview.vue.d.ts → bot/ui/ElBotChatPreview.vue.d.ts} +1 -1
  20. package/dist/{agent/ui/ElAgentHeader.vue.d.ts → bot/ui/ElBotHeader.vue.d.ts} +2 -2
  21. package/dist/{agent/ui/ElAgentModeSidebar.vue.d.ts → bot/ui/ElBotModeSidebar.vue.d.ts} +2 -2
  22. package/dist/{agent/ui/ElAgentSidebar.vue.d.ts → bot/ui/ElBotSidebar.vue.d.ts} +2 -2
  23. package/dist/bot/ui/ElCreateBot.vue.d.ts +12 -0
  24. package/dist/{agent → bot}/ui/ElModeHeader.vue.d.ts +2 -2
  25. package/dist/{agent → bot}/ui/ElProvisioningStatus.vue.d.ts +1 -1
  26. package/dist/{agent → bot}/ui/VoiceMode.vue.d.ts +4 -4
  27. package/dist/{agent → bot}/utils.d.ts +5 -5
  28. package/dist/{agent → bot}/voice/provider.d.ts +2 -2
  29. package/dist/{agent → bot}/voice/providers/livekit/provider.d.ts +4 -4
  30. package/dist/{agent → bot}/voice/voice-session-client.d.ts +1 -1
  31. package/dist/{agent → bot}/work-journal.d.ts +1 -1
  32. package/dist/{agent.js → bot.js} +83 -80
  33. package/dist/bot.js.map +1 -0
  34. package/dist/clients/BillingClient.d.ts +1 -1
  35. package/dist/clients/BotClient.d.ts +26 -0
  36. package/dist/clients/ChatClient.d.ts +6 -5
  37. package/dist/clients/ComputerClient.d.ts +16 -0
  38. package/dist/clients/UserClient.d.ts +4 -7
  39. package/dist/clients/types.d.ts +7 -2
  40. package/dist/contract/build.d.ts +1 -2
  41. package/dist/index.d.ts +3 -2
  42. package/dist/provider.js +1 -1
  43. package/dist/provider.js.map +1 -1
  44. package/dist/provider2.js +14 -14
  45. package/dist/provider2.js.map +1 -1
  46. package/dist/sdk.css +1 -1
  47. package/dist/sdk.js +4 -4
  48. package/dist/sdkClient.d.ts +33 -376
  49. package/dist/sdkClient.js +168 -170
  50. package/dist/sdkClient.js.map +1 -1
  51. package/dist/useWidgetState.js +9 -9
  52. package/dist/useWidgetState.js.map +1 -1
  53. package/dist/widget/PLWidget.d.ts +6 -6
  54. package/dist/widget/composables/useWidgetState.d.ts +3 -402
  55. package/dist/widget/index.d.ts +2 -2
  56. package/dist/widget/mode.d.ts +2 -2
  57. package/dist/widget/ui/{AgentWidgetInline.vue.d.ts → BotWidgetInline.vue.d.ts} +2 -2
  58. package/dist/widget/ui/{AgentWidgetModal.vue.d.ts → BotWidgetModal.vue.d.ts} +2 -2
  59. package/dist/widget/ui/{AgentWidgetPopup.vue.d.ts → BotWidgetPopup.vue.d.ts} +4 -4
  60. package/dist/widget.js +206 -206
  61. package/dist/widget.js.map +1 -1
  62. package/package.json +5 -5
  63. package/dist/AgentProvider.js +0 -764
  64. package/dist/AgentProvider.js.map +0 -1
  65. package/dist/AgentWidgetInline.js.map +0 -1
  66. package/dist/AgentWidgetModal.js.map +0 -1
  67. package/dist/AgentWrap.js.map +0 -1
  68. package/dist/agent/index.d.ts +0 -14
  69. package/dist/agent/ui/ElCreateAgent.vue.d.ts +0 -277
  70. package/dist/agent.js.map +0 -1
  71. package/dist/clients/AgentClient.d.ts +0 -48
  72. /package/dist/{agent → bot}/VoiceRecorderController.d.ts +0 -0
  73. /package/dist/{agent/ui/AgentInputEmail.vue.d.ts → bot/ui/BotInputEmail.vue.d.ts} +0 -0
  74. /package/dist/{agent/ui/AgentInputOneTimeCode.vue.d.ts → bot/ui/BotInputOneTimeCode.vue.d.ts} +0 -0
  75. /package/dist/{agent/ui/AgentSidebarClose.vue.d.ts → bot/ui/BotSidebarClose.vue.d.ts} +0 -0
  76. /package/dist/{agent/ui/AgentToolActivityGroup.vue.d.ts → bot/ui/BotToolActivityGroup.vue.d.ts} +0 -0
  77. /package/dist/{agent/ui/AgentWidget.vue.d.ts → bot/ui/BotWidget.vue.d.ts} +0 -0
  78. /package/dist/{agent → bot}/ui/ChatCardBlock.vue.d.ts +0 -0
  79. /package/dist/{agent → bot}/ui/ChatRichText.vue.d.ts +0 -0
  80. /package/dist/{agent → bot}/ui/ChatScroller.vue.d.ts +0 -0
  81. /package/dist/{agent → bot}/ui/ChatVisualBlock.vue.d.ts +0 -0
  82. /package/dist/{agent → bot}/ui/ElAuthGate.vue.d.ts +0 -0
  83. /package/dist/{agent → bot}/ui/ElAuthPanel.vue.d.ts +0 -0
  84. /package/dist/{agent/ui/ElAgentButton.vue.d.ts → bot/ui/ElBotButton.vue.d.ts} +0 -0
  85. /package/dist/{agent → bot}/ui/ElSidebar.vue.d.ts +0 -0
  86. /package/dist/{agent → bot}/ui/VoiceHistogramController.d.ts +0 -0
  87. /package/dist/{agent → bot}/ui/chat-diagram-layout.d.ts +0 -0
  88. /package/dist/{agent → bot}/ui/chat-visual-format.d.ts +0 -0
  89. /package/dist/{agent → bot}/ui/voice-mode-presentation.d.ts +0 -0
  90. /package/dist/{agent → bot}/voice/voice-error-copy.d.ts +0 -0
  91. /package/dist/{agent → bot}/voice/voice-work-state.d.ts +0 -0
  92. /package/dist/widget/ui/{AgentWidgetOnboard.vue.d.ts → BotWidgetOnboard.vue.d.ts} +0 -0
@@ -1,764 +0,0 @@
1
- import "./rolldown-runtime.js";
2
- import { SOCIAL_PLATFORMS as e } from "./constants.js";
3
- import { a as t, c as n, d as r, f as i, h as a, l as o, n as s, o as c, p as l, s as u, t as d, u as f } from "./AgentWrap.js";
4
- import { getColorSchemeOklch as ee } from "@pagelines/core";
5
- import { Fragment as p, Transition as m, TransitionGroup as h, computed as g, createBlock as _, createCommentVNode as v, createElementBlock as y, createElementVNode as b, createSlots as x, createTextVNode as S, createVNode as C, defineComponent as w, guardReactiveProps as T, mergeProps as E, normalizeClass as D, normalizeProps as O, normalizeStyle as k, onMounted as A, onUnmounted as te, openBlock as j, ref as M, renderList as N, renderSlot as P, shallowRef as ne, toDisplayString as F, unref as I, watch as L, withCtx as R, withKeys as z, withModifiers as B } from "vue";
6
- //#endregion
7
- //#region ui/EffectTransitionList.vue
8
- var V = /* @__PURE__ */ w({
9
- __name: "EffectTransitionList",
10
- props: {
11
- disabled: {
12
- type: Boolean,
13
- default: !1
14
- },
15
- mode: { default: "block" }
16
- },
17
- setup(e) {
18
- return (t, n) => (j(), _(h, { name: e.disabled ? "" : "nlist" }, {
19
- default: R(() => [P(t.$slots, "default")]),
20
- _: 3
21
- }, 8, ["name"]));
22
- }
23
- }), H = ["data-test-mode"], U = { class: "w-full max-w-xs space-y-12" }, W = {
24
- key: 0,
25
- class: "text-xs text-theme-400 text-center"
26
- }, G = { class: "text-base font-light text-white text-center" }, K = { class: "space-y-6 relative" }, q = {
27
- key: "email-field",
28
- class: "w-full"
29
- }, J = {
30
- key: "code-field",
31
- class: "w-full"
32
- }, Y = /* @__PURE__ */ w({
33
- __name: "ElAuthGate",
34
- props: { sdk: {} },
35
- setup(e) {
36
- let t = M({
37
- email: "",
38
- code: ""
39
- }), r = M("email"), i = M(!1), a = {
40
- email: {
41
- title: "Enter Your Email",
42
- button: {
43
- label: "Continue",
44
- disabled: () => !t.value.email || i.value
45
- },
46
- action: async () => {
47
- if (!i.value) {
48
- i.value = !0;
49
- try {
50
- await e.sdk.auth.requestAuthCode({ email: t.value.email }) && (r.value = "code");
51
- } finally {
52
- i.value = !1;
53
- }
54
- }
55
- }
56
- },
57
- code: {
58
- title: "Enter Verification Code",
59
- button: {
60
- label: "Verify",
61
- disabled: () => t.value.code.length !== 6 || i.value
62
- },
63
- action: async () => {
64
- if (!i.value) {
65
- i.value = !0;
66
- try {
67
- await e.sdk.auth.loginWithCode({
68
- email: t.value.email,
69
- code: t.value.code
70
- });
71
- } finally {
72
- i.value = !1;
73
- }
74
- }
75
- }
76
- }
77
- }, o = g(() => a[r.value]);
78
- return L(() => e.sdk.activeUser.value, (e) => {
79
- e && r.value === "code" && console.log("[ElAuthGate] Authentication successful", { email: e.email });
80
- }), (i, a) => (j(), y("div", {
81
- "data-test": "auth-form",
82
- "data-test-mode": r.value,
83
- class: "flex flex-col items-center justify-center h-full p-6"
84
- }, [b("div", U, [
85
- e.sdk.error.value ? (j(), y("p", W, F(e.sdk.error.value), 1)) : v("", !0),
86
- b("h3", G, F(o.value.title), 1),
87
- b("div", K, [C(V, null, {
88
- default: R(() => [r.value === "email" ? (j(), y("div", q, [C(u, {
89
- modelValue: t.value.email,
90
- "onUpdate:modelValue": a[0] || (a[0] = (e) => t.value.email = e),
91
- "data-test": "auth-email-input",
92
- onKeyup: z(o.value.action, ["enter"])
93
- }, null, 8, ["modelValue", "onKeyup"])])) : (j(), y("div", J, [C(c, {
94
- modelValue: t.value.code,
95
- "onUpdate:modelValue": a[1] || (a[1] = (e) => t.value.code = e),
96
- length: 6,
97
- "focus-first": !0,
98
- "data-test": "auth-code-input",
99
- onAutoSubmit: o.value.action
100
- }, null, 8, ["modelValue", "onAutoSubmit"])])), (j(), y("div", {
101
- key: o.value.button.label,
102
- class: "space-y-4 w-full"
103
- }, [C(n, {
104
- theme: "primary",
105
- size: "md",
106
- class: "w-full",
107
- "data-test": "auth-submit",
108
- loading: e.sdk.loading.value,
109
- disabled: o.value.button.disabled() || e.sdk.loading.value,
110
- onClick: o.value.action
111
- }, {
112
- default: R(() => [S(F(o.value.button.label), 1)]),
113
- _: 1
114
- }, 8, [
115
- "loading",
116
- "disabled",
117
- "onClick"
118
- ]), r.value === "code" ? (j(), y("button", {
119
- key: 0,
120
- class: "w-full text-xs text-white/50 hover:text-white/70 transition-colors py-2",
121
- onClick: a[2] || (a[2] = (e) => r.value = "email")
122
- }, " Change Email ")) : v("", !0)]))]),
123
- _: 1
124
- })])
125
- ])], 8, H));
126
- }
127
- }), re = { class: "flex-1 flex flex-col min-h-0 py-6 space-y-6 h-full overflow-scroll [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden relative" }, X = { class: "flex-1 space-y-6 pb-12" }, ie = {
128
- key: 0,
129
- class: "text-sm bg-white/10 backdrop-blur-sm rounded-2xl p-4 border border-white/20 space-y-3"
130
- }, ae = ["innerHTML"], oe = {
131
- key: 1,
132
- class: "bg-white/5 backdrop-blur-sm rounded-2xl p-4 border border-white/10"
133
- }, se = { class: "text-sm text-white/70 leading-relaxed" }, ce = {
134
- key: 2,
135
- class: "space-y-3"
136
- }, le = ["href"], ue = {
137
- key: 3,
138
- class: "space-y-3"
139
- }, de = { class: "grid grid-cols-2 gap-3" }, fe = ["href"], pe = /* @__PURE__ */ w({
140
- __name: "ElAgentAbout",
141
- props: {
142
- agent: {},
143
- isOnline: {
144
- type: Boolean,
145
- default: !1
146
- }
147
- },
148
- setup(n) {
149
- return (r, i) => (j(), y("div", re, [C(t, {
150
- agent: n.agent,
151
- "is-online": n.isOnline
152
- }, null, 8, ["agent", "is-online"]), b("div", X, [
153
- n.agent.summary.value ? (j(), y("div", ie, [i[0] || (i[0] = b("h3", { class: "font-medium text-white/50" }, " About ", -1)), b("div", {
154
- class: "text-white/70 leading-relaxed",
155
- innerHTML: n.agent.summary.value
156
- }, null, 8, ae)])) : v("", !0),
157
- n.agent.entityType.value === "company" ? (j(), y("div", oe, [i[1] || (i[1] = b("h3", { class: "text-sm font-medium text-white/90 mb-2" }, " Company Info ", -1)), b("p", se, " This is a company agent representing " + F(n.agent.name.value) + ". ", 1)])) : v("", !0),
158
- n.agent.email.value ? (j(), y("div", ce, [i[3] || (i[3] = b("h3", { class: "text-sm font-medium text-white/90" }, " Contact ", -1)), b("a", {
159
- href: `mailto:${n.agent.email.value}`,
160
- target: "_blank",
161
- rel: "noopener noreferrer",
162
- class: "relative inline-flex items-center justify-center gap-2 rounded-full px-4 py-2 font-medium transition-colors duration-200 focus:outline-none active:opacity-80 cursor-pointer bg-white/5 hover:bg-white/10 border border-white/10 text-white/80 text-sm justify-start h-10 w-full"
163
- }, [...i[2] || (i[2] = [b("span", { class: "i-heroicons-envelope flex items-center size-[1.1em] mt-[-.07em]" }, null, -1), S(" Email ", -1)])], 8, le)])) : v("", !0),
164
- n.agent.accounts.value && n.agent.accounts.value.length > 0 ? (j(), y("div", ue, [i[4] || (i[4] = b("h3", { class: "text-sm font-medium text-white/90" }, " Links ", -1)), b("div", de, [(j(!0), y(p, null, N(n.agent.accounts.value, (t) => (j(), y("a", {
165
- key: `${t.platform}-${t.handle}`,
166
- href: I(e)[t.platform].getUrl(t.handle),
167
- target: "_blank",
168
- rel: "noopener noreferrer",
169
- class: "relative inline-flex items-center justify-center gap-2 rounded-full px-4 py-2 font-medium transition-colors duration-200 focus:outline-none active:opacity-80 cursor-pointer bg-white/10 hover:bg-white/20 border border-white/20 text-white/80 text-sm"
170
- }, [b("span", { class: D(["flex items-center size-[1.1em] mt-[-.07em]", I(e)[t.platform].icon]) }, null, 2), S(" " + F(I(e)[t.platform].label), 1)], 8, fe))), 128))])])) : v("", !0)
171
- ])]));
172
- }
173
- }), me = { class: "flex flex-col items-center text-center gap-4" }, he = { class: "relative flex-shrink-0" }, ge = { class: "w-20 h-20 sm:w-24 sm:h-24 rounded-full overflow-hidden border-4 border-white" }, _e = ["src", "alt"], ve = { class: "absolute top-1.5 right-1.5" }, ye = {
174
- key: 1,
175
- class: "size-4 bg-theme-400 rounded-full ring-2 ring-white"
176
- }, be = { class: "min-w-0" }, xe = { class: "text-3xl font-light text-white mb-2 truncate" }, Se = { class: "text-base font-light text-white/60 line-clamp-1" }, Ce = /* @__PURE__ */ w({
177
- __name: "ElAgentHeader",
178
- props: {
179
- agent: {},
180
- isOnline: {
181
- type: Boolean,
182
- default: !1
183
- }
184
- },
185
- setup(e) {
186
- return (t, n) => (j(), y("div", me, [b("div", he, [b("div", ge, [b("img", {
187
- src: e.agent.avatarUrl.value,
188
- alt: e.agent.displayName.value,
189
- class: "w-full h-full object-cover",
190
- onError: n[0] || (n[0] = (...e) => I(f) && I(f)(...e))
191
- }, null, 40, _e)]), b("div", ve, [e.isOnline ? (j(), y(p, { key: 0 }, [n[1] || (n[1] = b("div", {
192
- class: "size-4 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
193
- style: { "animation-duration": "3s" }
194
- }, null, -1)), n[2] || (n[2] = b("div", { class: "size-4 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))], 64)) : (j(), y("div", ye))])]), b("div", be, [b("h1", xe, F(e.agent.displayName.value), 1), b("p", Se, F(e.agent.title.value), 1)])]));
195
- }
196
- }), we = { class: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[28px] h-[28px] overflow-hidden" }, Te = /* @__PURE__ */ w({
197
- name: "SelfSidebarClose",
198
- __name: "AgentSidebarClose",
199
- emits: ["click"],
200
- setup(e) {
201
- let t = M(!1);
202
- return A(() => {
203
- setTimeout(() => {
204
- t.value = !0;
205
- }, 100);
206
- }), (e, n) => (j(), y("a", {
207
- class: "close block cursor-pointer w-[60px] h-[60px] rounded-full transition-all duration-1000 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-110 active:scale-90 hover:rotate-90",
208
- onClick: n[0] || (n[0] = (t) => e.$emit("click", t))
209
- }, [n[1] || (n[1] = b("span", { class: "absolute inset-0 rounded-full transition-all" }, null, -1)), b("span", we, [b("span", {
210
- class: D(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]", t.value ? "translate-y-0 translate-x-0 rotate-45" : "translate-y-[30px] -translate-x-[30px] rotate-0"]),
211
- style: {
212
- "background-color": "currentColor",
213
- "transition-delay": "0.15s"
214
- }
215
- }, null, 2), b("span", {
216
- class: D(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]", t.value ? "translate-y-0 translate-x-0 -rotate-45" : "-translate-y-[30px] -translate-x-[30px] rotate-0"]),
217
- style: {
218
- "background-color": "currentColor",
219
- "transition-delay": "0.45s"
220
- }
221
- }, null, 2)])]));
222
- }
223
- }), Ee = {
224
- key: 0,
225
- class: "px-9 pt-12 pb-4"
226
- }, De = { class: "text-base font-medium text-theme-400" }, Oe = {
227
- key: 1,
228
- class: "px-4 pb-8 border-b border-white/10"
229
- }, ke = ["disabled", "onClick"], Ae = { class: "flex items-center gap-3" }, je = { class: "flex-1" }, Me = {
230
- key: 0,
231
- class: "text-xs text-white/50 mt-0.5"
232
- }, Ne = { class: "p-6" }, Z = /* @__PURE__ */ w({
233
- name: "ElSidebar",
234
- inheritAttrs: !1,
235
- __name: "ElSidebar",
236
- props: {
237
- modelValue: { type: Boolean },
238
- items: {},
239
- position: {},
240
- title: {},
241
- widthClasses: {}
242
- },
243
- emits: ["update:modelValue"],
244
- setup(e, { emit: t }) {
245
- let n = e, r = t, i = n.position || "left", a = n.widthClasses || "w-[80%] max-w-[300px]", o = g({
246
- get: () => n.modelValue,
247
- set: (e) => r("update:modelValue", e)
248
- }), s = g(() => n.items.filter((e) => !e.isHidden));
249
- function handleItemClick(e) {
250
- e.isDisabled || (e.onClick ? e.onClick({
251
- item: e,
252
- event: new MouseEvent("click")
253
- }) : e.href && (e.href.includes("http") ? window.open(e.href, e.target || "_self")?.focus() : window.location.href = e.href), o.value = !1);
254
- }
255
- let c = g(() => i === "left" ? {
256
- enter: "-translate-x-full",
257
- leave: "-translate-x-full",
258
- position: "justify-start",
259
- closeButton: "-right-16"
260
- } : {
261
- enter: "translate-x-full",
262
- leave: "translate-x-full",
263
- position: "justify-end",
264
- closeButton: "-left-16"
265
- });
266
- return (t, n) => (j(), y(p, null, [C(m, {
267
- "enter-active-class": "transition-opacity duration-300 ease-out",
268
- "leave-active-class": "transition-opacity duration-200 ease-in",
269
- "enter-from-class": "opacity-0",
270
- "enter-to-class": "opacity-100",
271
- "leave-from-class": "opacity-100",
272
- "leave-to-class": "opacity-0"
273
- }, {
274
- default: R(() => [o.value ? (j(), y("div", {
275
- key: 0,
276
- class: "absolute inset-0 z-40 bg-black/50 backdrop-blur-sm",
277
- onClick: n[0] || (n[0] = (e) => o.value = !1)
278
- })) : v("", !0)]),
279
- _: 1
280
- }), C(m, {
281
- "enter-active-class": "transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)]",
282
- "leave-active-class": "transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]",
283
- "enter-from-class": c.value.enter,
284
- "enter-to-class": "translate-x-0",
285
- "leave-from-class": "translate-x-0",
286
- "leave-to-class": c.value.leave
287
- }, {
288
- default: R(() => [o.value ? (j(), y("div", {
289
- key: 0,
290
- class: D(["absolute inset-0 z-50 flex", c.value.position]),
291
- onClick: n[3] || (n[3] = (e) => o.value = !1)
292
- }, [b("div", {
293
- class: D(["relative h-full shadow-2xl bg-black/30 backdrop-blur-xl flex flex-col justify-center", I(a)]),
294
- onClick: n[2] || (n[2] = B(() => {}, ["stop"]))
295
- }, [
296
- C(Te, {
297
- class: D(["absolute top-4 z-10 text-white", c.value.closeButton]),
298
- onClick: n[1] || (n[1] = (e) => o.value = !1)
299
- }, null, 8, ["class"]),
300
- e.title ? (j(), y("div", Ee, [b("h3", De, F(e.title), 1)])) : v("", !0),
301
- t.$slots.header ? (j(), y("div", Oe, [P(t.$slots, "header")])) : v("", !0),
302
- b("div", { class: D(["flex-1 p-6 space-y-2 overflow-y-auto", {
303
- "pt-6": !e.title && !t.$slots.header,
304
- "pt-4": e.title || t.$slots.header
305
- }]) }, [C(h, {
306
- "enter-active-class": "transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]",
307
- "leave-active-class": "transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)]",
308
- "enter-from-class": I(i) === "left" ? "-translate-x-4 opacity-0" : "translate-x-4 opacity-0",
309
- "enter-to-class": "translate-x-0 opacity-100",
310
- "leave-from-class": "translate-x-0 opacity-100",
311
- "leave-to-class": I(i) === "left" ? "-translate-x-4 opacity-0" : "translate-x-4 opacity-0"
312
- }, {
313
- default: R(() => [(j(!0), y(p, null, N(s.value, (e, t) => (j(), y("button", {
314
- key: e.key || e.label || t,
315
- style: k({ transitionDelay: `${t * 40}ms` }),
316
- class: D(["cursor-pointer w-full text-left p-3 rounded-xl transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group", [e.isActive ? "bg-primary-500/20 border border-primary-500/40" : "hover:bg-white/10", e.isDisabled && "opacity-50 cursor-not-allowed"]]),
317
- disabled: e.isDisabled,
318
- onClick: (t) => handleItemClick(e)
319
- }, [b("div", Ae, [e.icon?.src ? (j(), y("i", {
320
- key: 0,
321
- class: D(["size-5 flex-shrink-0 transition-transform duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group-hover:scale-110", [e.icon.src, e.isActive ? "text-primary-400" : "text-white/70 group-hover:text-white"]])
322
- }, null, 2)) : v("", !0), b("div", je, [b("div", { class: D(["font-medium text-sm", e.isActive ? "text-primary-300" : "text-white"]) }, F(e.label), 3), e.subLabel ? (j(), y("div", Me, F(e.subLabel), 1)) : v("", !0)])])], 14, ke))), 128))]),
323
- _: 1
324
- }, 8, ["enter-from-class", "leave-to-class"])], 2),
325
- b("div", Ne, [P(t.$slots, "footer")])
326
- ], 2)], 2)) : v("", !0)]),
327
- _: 3
328
- }, 8, ["enter-from-class", "leave-to-class"])], 64));
329
- }
330
- }), Pe = /* @__PURE__ */ w({
331
- name: "AgentModeSidebar",
332
- __name: "ElAgentModeSidebar",
333
- props: {
334
- modelValue: { type: Boolean },
335
- chatController: {}
336
- },
337
- emits: ["update:modelValue"],
338
- setup(e, { emit: t }) {
339
- let n = e, r = t, i = g({
340
- get: () => n.modelValue,
341
- set: (e) => r("update:modelValue", e)
342
- }), a = g(() => n.chatController?.agentMode?.value ?? "self"), o = g(() => l.map((e) => ({
343
- key: e.mode,
344
- icon: { src: e.icon },
345
- label: e.label,
346
- isActive: a.value === e.mode,
347
- onClick: () => {
348
- n.chatController?.setMode(e.mode);
349
- }
350
- })));
351
- return (e, t) => (j(), _(Z, {
352
- modelValue: i.value,
353
- "onUpdate:modelValue": t[0] || (t[0] = (e) => i.value = e),
354
- items: o.value,
355
- position: "right",
356
- title: "Mode",
357
- "width-classes": "w-[80%] max-w-[255px]"
358
- }, null, 8, ["modelValue", "items"]));
359
- }
360
- }), Fe = /* @__PURE__ */ w({
361
- name: "AgentSidebar",
362
- __name: "ElAgentSidebar",
363
- props: {
364
- modelValue: { type: Boolean },
365
- agent: {},
366
- sdk: {},
367
- title: {}
368
- },
369
- emits: ["update:modelValue"],
370
- setup(e, { emit: t }) {
371
- let n = e, r = t, i = g({
372
- get: () => n.modelValue,
373
- set: (e) => r("update:modelValue", e)
374
- }), a = g(() => {
375
- let e = [
376
- {
377
- key: "share",
378
- icon: { src: "i-tabler-share" },
379
- label: "Share this assistant",
380
- onClick: () => {
381
- let e = `${window.location.origin}/@${n.agent.handle.value || n.agent.agentId.value}`;
382
- navigator.clipboard.writeText(e).catch((e) => {
383
- console.error("ElAgentSidebar: clipboard.writeText rejected", e);
384
- });
385
- }
386
- },
387
- {
388
- key: "profile",
389
- icon: { src: "i-tabler-user" },
390
- label: "View full profile",
391
- onClick: () => {
392
- window.open(`/@${n.agent.handle.value || n.agent.agentId.value}`, "_blank");
393
- }
394
- },
395
- {
396
- key: "create",
397
- icon: { src: "i-tabler-sparkles" },
398
- label: "Create your own",
399
- onClick: () => {
400
- window.open("/auth", "_blank");
401
- }
402
- }
403
- ];
404
- return n.sdk.activeUser.value && e.push({
405
- key: "logout",
406
- icon: { src: "i-tabler-logout" },
407
- label: "Logout",
408
- onClick: async () => {
409
- await n.sdk.auth.logout();
410
- }
411
- }), e;
412
- });
413
- return (t, n) => (j(), _(Z, {
414
- modelValue: i.value,
415
- "onUpdate:modelValue": n[0] || (n[0] = (e) => i.value = e),
416
- items: a.value,
417
- position: "left",
418
- title: e.title || "Menu"
419
- }, null, 8, [
420
- "modelValue",
421
- "items",
422
- "title"
423
- ]));
424
- }
425
- }), Ie = {
426
- key: 0,
427
- class: "absolute inset-0 flex items-center justify-center bg-gradient-to-br from-theme-800 to-theme-950 rounded-3xl z-10"
428
- }, Le = ["data-quality"], Re = {
429
- key: 0,
430
- class: "flex flex-1 items-center gap-3 pl-2"
431
- }, ze = ["src", "alt"], Be = { class: "text-sm font-medium text-white/90" }, Ve = {
432
- key: 1,
433
- class: "flex justify-end"
434
- }, He = { class: "text-sm" }, Q = {
435
- key: 0,
436
- class: "flex-1 basis-0 flex justify-end"
437
- }, Ue = {
438
- key: 0,
439
- class: "h-full pb-12 flex-1 flex flex-col relative z-20 min-h-0 px-4 @[480px]/agent:px-6 max-w-md mx-auto w-full"
440
- }, We = { class: "flex-1 basis-0 flex flex-col justify-start pt-8 gap-7" }, Ge = {
441
- key: 0,
442
- class: "flex items-center justify-center gap-3"
443
- }, Ke = ["href"], qe = {
444
- key: 1,
445
- class: "flex-1 flex flex-col relative z-20 min-h-0 w-full gap-4 px-4"
446
- }, Je = { class: "max-w-md mx-auto" }, Ye = {
447
- key: 2,
448
- class: "flex-1 flex flex-col relative z-20 min-h-0 w-full px-4 @[480px]/agent:px-6"
449
- }, Xe = { class: "flex-1 min-h-0 max-w-md mx-auto w-full" }, Ze = {
450
- key: 2,
451
- class: "bg-gradient-to-br from-theme-800 to-theme-950 text-white flex items-center justify-center h-full p-8"
452
- }, Qe = { class: "text-center max-w-md space-y-4" }, $e = { class: "text-sm text-white/70 leading-relaxed" }, et = {
453
- key: 3,
454
- class: "bg-white/10 backdrop-blur-sm text-white/70 flex items-center justify-center h-full"
455
- }, $ = /* @__PURE__ */ w({
456
- __name: "AgentChat",
457
- props: {
458
- sdk: {},
459
- agent: {},
460
- context: {},
461
- firstMessage: {},
462
- buttonText: {},
463
- buttonIcon: {},
464
- hasClose: {
465
- type: Boolean,
466
- default: !1
467
- },
468
- isActive: {
469
- type: Boolean,
470
- default: !0
471
- },
472
- loading: {
473
- type: Boolean,
474
- default: !1
475
- },
476
- theme: { default: "green" },
477
- requireAuth: {
478
- type: Boolean,
479
- default: !1
480
- },
481
- chatOnly: {
482
- type: Boolean,
483
- default: !1
484
- },
485
- bare: {
486
- type: Boolean,
487
- default: !1
488
- },
489
- emptyStateMessage: {},
490
- createVoiceClientFn: { type: Function }
491
- },
492
- emits: [
493
- "close",
494
- "error",
495
- "turnStarted",
496
- "turnCompleted"
497
- ],
498
- setup(c, { emit: u }) {
499
- let d = u, f = ne(), m = M(!1), h = M(!1), w = M(), E = M(), z = g(() => f.value?.agentMode?.value ?? "self"), V = g(() => f.value?.textState.value.isConnected ?? !1), H = g(() => c.sdk.activeUser.value !== void 0), U = g(() => l.find((e) => e.mode === z.value));
500
- function createChatController() {
501
- f.value && f.value.destroy();
502
- try {
503
- f.value = new i({
504
- sdk: c.sdk,
505
- agent: c.agent,
506
- context: c.context,
507
- firstMessage: c.firstMessage,
508
- ...c.createVoiceClientFn ? { createVoiceClientFn: c.createVoiceClientFn } : {},
509
- onTurnStarted: () => d("turnStarted"),
510
- onTurnCompleted: (e) => d("turnCompleted", e)
511
- });
512
- } catch (e) {
513
- throw console.error("AgentChatController creation failed:", e), e;
514
- }
515
- }
516
- try {
517
- createChatController();
518
- } catch (e) {
519
- let t = e instanceof Error ? e.message : "Couldn't initialize your assistant";
520
- w.value = t, d("error", t);
521
- }
522
- function applyTheme(e) {
523
- if (!E.value) return;
524
- let t = ee(e);
525
- Object.entries(t).forEach(([e, t]) => {
526
- E.value.style.setProperty(`--primary-${e}`, t);
527
- });
528
- }
529
- A(() => {
530
- try {
531
- applyTheme(c.theme), c.chatOnly && f.value && f.value.setMode("chat");
532
- } catch (e) {
533
- let t = e instanceof Error ? e.message : "Couldn't initialize your assistant";
534
- w.value = t, d("error", t);
535
- }
536
- }), te(() => {
537
- f.value && f.value.destroy();
538
- }), L(() => c.theme, (e) => {
539
- applyTheme(e);
540
- }), L(() => c.sdk.activeUser.value, (e, t) => {
541
- t && !e && f.value && f.value.setMode("self");
542
- });
543
- let W = g(() => !!(c.agent.cover.value?.src && c.agent.cover.value?.quality === "low") || !!(c.agent.avatar.value?.src && c.agent.avatar.value?.quality === "low")), G = g(() => {
544
- let e = [W.value ? "backdrop-blur-sm" : ""];
545
- return W.value && z.value === "self" ? e.push("from-black/80 via-black/60 to-black/80") : z.value === "self" ? e.push("from-black/70 via-black/50 to-black/80") : e.push("from-black/90 via-black/90 to-black/100"), e.join(" ");
546
- }), K = {
547
- phone: "i-heroicons-phone",
548
- calendar: "i-heroicons-calendar",
549
- question: "i-heroicons-question-mark-circle",
550
- message: "i-heroicons-chat-bubble-left-right",
551
- sparkles: "i-heroicons-sparkles"
552
- }, q = g(() => r({
553
- template: c.buttonText || "Talk to {name}",
554
- agent: c.agent.toConfig()
555
- })), J = g(() => K[c.buttonIcon || "phone"] || K.phone);
556
- return (r, i) => (j(), y("div", {
557
- ref_key: "rootElement",
558
- ref: E,
559
- key: I(o)(c.agent.toConfig()),
560
- class: "pagelines-sdk @container/agent pagelines-agent w-full h-full overflow-hidden relative",
561
- "data-test": "agent-chat"
562
- }, [
563
- c.loading ? (j(), y("div", Ie, [C(a, { class: "text-white size-8" })])) : c.agent && !w.value ? (j(), y("div", {
564
- key: 1,
565
- class: D(["absolute inset-0", c.bare ? "" : "bg-cover bg-center bg-no-repeat"]),
566
- style: k(c.bare ? void 0 : { backgroundImage: `url(${I(o)(c.agent.toConfig())})` }),
567
- "data-quality": c.agent.avatar.value?.quality || "none"
568
- }, [c.bare ? v("", !0) : (j(), y("div", {
569
- key: 0,
570
- class: D(["absolute inset-0 bg-gradient-to-br z-0", G.value])
571
- }, null, 2)), b("div", { class: D(["relative z-10 flex flex-col h-full transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] will-change-transform", c.isActive ? "opacity-100 translate-y-0" : "opacity-0 translate-y-2"]) }, [!c.bare || c.hasClose ? (j(), y("div", {
572
- key: 0,
573
- class: D(["relative z-30 p-2", !c.bare && z.value !== "self" ? "backdrop-blur-lg" : ""])
574
- }, [c.chatOnly ? (j(), y("div", {
575
- key: 0,
576
- class: D(["flex items-center", c.bare ? "justify-end" : ""])
577
- }, [c.bare ? v("", !0) : (j(), y("div", Re, [b("img", {
578
- src: I(o)(c.agent.toConfig()),
579
- alt: c.agent.displayName.value,
580
- class: "size-8 rounded-full object-cover"
581
- }, null, 8, ze), b("span", Be, F(c.agent.displayName.value), 1)])), c.hasClose ? (j(), y("div", Ve, [b("button", {
582
- class: D(["flex cursor-pointer items-center rounded-2xl p-3 transition-colors", c.bare ? "text-theme-500 hover:bg-theme-50" : "text-white/70 hover:bg-white/10"]),
583
- onClick: i[0] || (i[0] = B((e) => d("close", "button"), ["stop"]))
584
- }, [...i[7] || (i[7] = [b("i", { class: "size-6 i-tabler-x" }, null, -1)])], 2)])) : v("", !0)], 2)) : (j(), y("div", {
585
- key: 1,
586
- class: D(["flex items-center", c.hasClose ? "" : "justify-between"])
587
- }, [
588
- b("div", { class: D(c.hasClose ? "flex-1 basis-0" : "") }, [b("button", {
589
- class: "cursor-pointer p-2 flex items-center gap-2 rounded-2xl text-white/70 hover:bg-white/10 transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-105 active:scale-95",
590
- onClick: i[1] || (i[1] = (e) => m.value = !0)
591
- }, [...i[8] || (i[8] = [b("i", { class: "i-tabler-menu size-7" }, null, -1)])])], 2),
592
- b("button", {
593
- class: D(["flex items-center gap-2 px-3.5 py-3 rounded-2xl text-white/90 hover:bg-white/10 transition-all cursor-pointer flex-grow-0", { "bg-white/10": h.value }]),
594
- onClick: i[2] || (i[2] = (e) => h.value = !0)
595
- }, [
596
- b("i", { class: D([U.value?.icon, "size-4 opacity-60"]) }, null, 2),
597
- b("span", He, F(U.value?.label), 1),
598
- i[9] || (i[9] = b("i", { class: "i-tabler-chevron-down size-4" }, null, -1))
599
- ], 2),
600
- c.hasClose ? (j(), y("div", Q, [b("button", {
601
- class: "cursor-pointer flex items-center p-3 rounded-2xl text-white/70 hover:bg-white/10 transition-colors",
602
- onClick: i[3] || (i[3] = B((e) => d("close", "button"), ["stop"]))
603
- }, [...i[10] || (i[10] = [b("i", { class: "size-6 i-tabler-x" }, null, -1)])])])) : v("", !0)
604
- ], 2))], 2)) : v("", !0), c.chatOnly ? (j(), y("div", {
605
- key: 1,
606
- class: D(["relative z-20 flex min-h-0 w-full flex-1 flex-col", c.bare ? "" : "px-4"])
607
- }, [b("div", { class: D(["min-h-0 w-full flex-1", c.bare ? "" : "mx-auto max-w-md"]) }, [C(s, {
608
- "chat-controller": f.value,
609
- agent: c.agent,
610
- scope: H.value ? "private" : "public",
611
- "empty-state-message": c.emptyStateMessage,
612
- variant: c.bare ? "light" : "dark",
613
- "show-header": !c.bare,
614
- centered: c.bare
615
- }, x({ _: 2 }, [r.$slots["empty-heading"] ? {
616
- name: "empty-heading",
617
- fn: R((e) => [P(r.$slots, "empty-heading", O(T(e)))]),
618
- key: "0"
619
- } : void 0]), 1032, [
620
- "chat-controller",
621
- "agent",
622
- "scope",
623
- "empty-state-message",
624
- "variant",
625
- "show-header",
626
- "centered"
627
- ])], 2)], 2)) : (j(), y(p, { key: 2 }, [z.value === "self" ? (j(), y("div", Ue, [
628
- i[11] || (i[11] = b("div", { class: "flex-1 basis-0 mb-12" }, null, -1)),
629
- C(Ce, {
630
- agent: c.agent,
631
- "is-online": V.value
632
- }, null, 8, ["agent", "is-online"]),
633
- b("div", We, [C(n, {
634
- theme: "primary",
635
- size: "lg",
636
- class: "w-full",
637
- icon: J.value,
638
- "data-test": "voice-button",
639
- onClick: i[4] || (i[4] = (e) => f.value?.setMode("talk"))
640
- }, {
641
- default: R(() => [S(F(q.value), 1)]),
642
- _: 1
643
- }, 8, ["icon"]), c.agent.accounts.value && c.agent.accounts.value.length > 0 ? (j(), y("div", Ge, [(j(!0), y(p, null, N((c.agent.accounts.value || []).filter((t) => I(e)[t.platform]), (t) => (j(), y("a", {
644
- key: `${t.platform}-${t.handle}`,
645
- href: I(e)[t.platform].getUrl(t.handle),
646
- target: "_blank",
647
- class: "size-12 rounded-full text-white/60 hover:text-white hover:bg-white/5 border border-white/0 hover:border-white/10 flex items-center justify-center transition-all duration-200 hover:scale-105"
648
- }, [b("i", { class: D([I(e)[t.platform].icon, "size-5"]) }, null, 2)], 8, Ke))), 128))])) : v("", !0)])
649
- ])) : z.value === "talk" ? (j(), y("div", qe, [c.requireAuth && !H.value ? (j(), _(Y, {
650
- key: 0,
651
- sdk: c.sdk
652
- }, null, 8, ["sdk"])) : (j(), y(p, { key: 1 }, [b("div", null, [b("div", Je, [C(t, {
653
- agent: c.agent,
654
- "is-online": V.value
655
- }, null, 8, ["agent", "is-online"])])]), C(s, {
656
- "chat-controller": f.value,
657
- agent: c.agent
658
- }, null, 8, ["chat-controller", "agent"])], 64))])) : (j(), y("div", Ye, [b("div", Xe, [z.value === "chat" ? (j(), y(p, { key: 0 }, [c.requireAuth && !H.value ? (j(), _(Y, {
659
- key: 0,
660
- sdk: c.sdk
661
- }, null, 8, ["sdk"])) : (j(), _(s, {
662
- key: 1,
663
- "chat-controller": f.value,
664
- agent: c.agent,
665
- "show-header": ""
666
- }, null, 8, ["chat-controller", "agent"]))], 64)) : z.value === "info" ? (j(), _(pe, {
667
- key: 1,
668
- agent: c.agent,
669
- "is-online": V.value
670
- }, null, 8, ["agent", "is-online"])) : v("", !0)])]))], 64))], 2)], 14, Le)) : w.value ? (j(), y("div", Ze, [b("div", Qe, [
671
- i[12] || (i[12] = b("div", { class: "flex justify-center" }, [b("div", { class: "rounded-full bg-red-500/20 flex items-center justify-center size-10" }, [b("i", { class: "i-tabler-alert-circle size-6 text-red-400" })])], -1)),
672
- i[13] || (i[13] = b("h3", { class: "text-lg font-medium" }, " Agent Error ", -1)),
673
- b("p", $e, F(w.value), 1)
674
- ])])) : (j(), y("div", et, " Couldn't load your assistant. Please try again later. ")),
675
- c.chatOnly ? v("", !0) : (j(), _(Fe, {
676
- key: 4,
677
- modelValue: m.value,
678
- "onUpdate:modelValue": i[5] || (i[5] = (e) => m.value = e),
679
- agent: c.agent,
680
- sdk: c.sdk,
681
- title: c.agent.displayName.value,
682
- "data-test": "agent-sidebar"
683
- }, null, 8, [
684
- "modelValue",
685
- "agent",
686
- "sdk",
687
- "title"
688
- ])),
689
- c.chatOnly ? v("", !0) : (j(), _(Pe, {
690
- key: 5,
691
- modelValue: h.value,
692
- "onUpdate:modelValue": i[6] || (i[6] = (e) => h.value = e),
693
- "chat-controller": f.value,
694
- "data-test": "agent-mode-sidebar"
695
- }, null, 8, ["modelValue", "chat-controller"]))
696
- ]));
697
- }
698
- }), tt = /* @__PURE__ */ w({
699
- __name: "AgentProvider",
700
- props: {
701
- sdk: {},
702
- agent: {},
703
- handle: {},
704
- context: {},
705
- clientContext: {},
706
- firstMessage: {},
707
- buttonText: {},
708
- buttonIcon: {},
709
- hasClose: { type: Boolean },
710
- chatOnly: { type: Boolean },
711
- bare: { type: Boolean },
712
- apiBase: {},
713
- emptyStateMessage: {}
714
- },
715
- emits: [
716
- "close",
717
- "error",
718
- "turnStarted",
719
- "turnCompleted"
720
- ],
721
- setup(e, { emit: t }) {
722
- let n = e, r = t;
723
- return (e, t) => (j(), _(d, E(n, { class: "agent-provider size-full relative" }), {
724
- default: R((i) => [C($, {
725
- sdk: i.sdk,
726
- agent: i.agent,
727
- context: i.context,
728
- "first-message": i.firstMessage,
729
- "button-text": n.buttonText,
730
- "button-icon": n.buttonIcon,
731
- "has-close": n.hasClose,
732
- "chat-only": n.chatOnly,
733
- bare: n.bare,
734
- "empty-state-message": n.emptyStateMessage,
735
- "is-active": !0,
736
- class: "size-full",
737
- onClose: t[0] || (t[0] = (e) => r("close", e)),
738
- onError: t[1] || (t[1] = (e) => r("error", e)),
739
- onTurnStarted: t[2] || (t[2] = (e) => r("turnStarted")),
740
- onTurnCompleted: t[3] || (t[3] = (e) => r("turnCompleted", e))
741
- }, x({ _: 2 }, [e.$slots["empty-heading"] ? {
742
- name: "empty-heading",
743
- fn: R((t) => [P(e.$slots, "empty-heading", O(T(t)))]),
744
- key: "0"
745
- } : void 0]), 1032, [
746
- "sdk",
747
- "agent",
748
- "context",
749
- "first-message",
750
- "button-text",
751
- "button-icon",
752
- "has-close",
753
- "chat-only",
754
- "bare",
755
- "empty-state-message"
756
- ])]),
757
- _: 3
758
- }, 16));
759
- }
760
- });
761
- //#endregion
762
- export { $ as n, tt as t };
763
-
764
- //# sourceMappingURL=AgentProvider.js.map