site-operator 0.1.3 → 0.1.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.d.ts +6 -0
- package/dist/site-operator.es.js +94 -27
- package/dist/site-operator.umd.js +101 -54
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,14 @@ export declare class AgentChat extends LitElement {
|
|
|
6
6
|
static styles: CSSResult;
|
|
7
7
|
private _chatController;
|
|
8
8
|
backendUrl: string;
|
|
9
|
+
conversationUrl: string;
|
|
9
10
|
appName: string;
|
|
10
11
|
agentAvatar: string;
|
|
12
|
+
disclaimer: string;
|
|
13
|
+
emptyText: string;
|
|
14
|
+
placeholder: string;
|
|
15
|
+
headerTitle: string;
|
|
16
|
+
hideHeader: boolean;
|
|
11
17
|
interceptor: boolean;
|
|
12
18
|
private _historyOpen;
|
|
13
19
|
private _inspectorOpen;
|
package/dist/site-operator.es.js
CHANGED
|
@@ -735,9 +735,34 @@ var AgentIconButton = class extends i {
|
|
|
735
735
|
}
|
|
736
736
|
};
|
|
737
737
|
__decorate([n()], AgentIconButton.prototype, "tooltip", void 0), AgentIconButton = __decorate([t("agent-icon-button")], AgentIconButton);
|
|
738
|
-
const PlusIcon = b
|
|
739
|
-
|
|
740
|
-
|
|
738
|
+
const PlusIcon = b`
|
|
739
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus">
|
|
740
|
+
<path d="M5 12h14" />
|
|
741
|
+
<path d="M12 5v14" />
|
|
742
|
+
</svg>`, SendIcon = b`
|
|
743
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-send">
|
|
744
|
+
<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z" />
|
|
745
|
+
<path d="m21.854 2.147-10.94 10.939" />
|
|
746
|
+
</svg>`, CopyIcon = b`
|
|
747
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy">
|
|
748
|
+
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
|
|
749
|
+
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
|
|
750
|
+
</svg>`, ReloadIcon = b`
|
|
751
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw">
|
|
752
|
+
<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" />
|
|
753
|
+
<path d="M21 3v5h-5" />
|
|
754
|
+
</svg>`, StopIcon = b`
|
|
755
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square">
|
|
756
|
+
<rect width="18" height="18" x="3" y="3" rx="2" />
|
|
757
|
+
</svg>`, HistoryIcon = b`
|
|
758
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-history">
|
|
759
|
+
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
|
|
760
|
+
<path d="M3 3v5h5" />
|
|
761
|
+
<path d="M12 7v5l4 2" />
|
|
762
|
+
</svg>`, ToolIcon = b`
|
|
763
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-wrench">
|
|
764
|
+
<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z" />
|
|
765
|
+
</svg>`;
|
|
741
766
|
var ChatHeader = class extends i {
|
|
742
767
|
constructor(...x) {
|
|
743
768
|
super(...x), this.title = "Agent Chat";
|
|
@@ -1007,7 +1032,7 @@ var ChatMessage = class extends i {
|
|
|
1007
1032
|
__decorate([n({ type: Object })], ChatMessage.prototype, "message", void 0), __decorate([n({ type: Boolean })], ChatMessage.prototype, "isLast", void 0), __decorate([n({ type: Boolean })], ChatMessage.prototype, "isStreaming", void 0), __decorate([n({ type: String })], ChatMessage.prototype, "agentAvatar", void 0), ChatMessage = __decorate([t("agent-chat-message")], ChatMessage);
|
|
1008
1033
|
var ChatThread = class extends i {
|
|
1009
1034
|
constructor(...x) {
|
|
1010
|
-
super(...x), this.messages = [], this.isRunning = !1, this.agentAvatar = "";
|
|
1035
|
+
super(...x), this.messages = [], this.isRunning = !1, this.agentAvatar = "", this.emptyText = "";
|
|
1011
1036
|
}
|
|
1012
1037
|
static #e = this.styles = styles$4;
|
|
1013
1038
|
updated(x) {
|
|
@@ -1023,7 +1048,7 @@ var ChatThread = class extends i {
|
|
|
1023
1048
|
return this.messages.length === 0 ? b`
|
|
1024
1049
|
<div class="empty-state">
|
|
1025
1050
|
${this.agentAvatar ? b`<img src="${this.agentAvatar}" alt="Agent Avatar" class="empty-avatar-img">` : b`<div class="empty-avatar">SM</div>`}
|
|
1026
|
-
<p class="empty-text"
|
|
1051
|
+
<p class="empty-text">${this.emptyText}</p>
|
|
1027
1052
|
</div>
|
|
1028
1053
|
` : b`
|
|
1029
1054
|
<div class="messages-list">
|
|
@@ -1039,7 +1064,7 @@ var ChatThread = class extends i {
|
|
|
1039
1064
|
`;
|
|
1040
1065
|
}
|
|
1041
1066
|
};
|
|
1042
|
-
__decorate([n({ type: Array })], ChatThread.prototype, "messages", void 0), __decorate([n({ type: Boolean })], ChatThread.prototype, "isRunning", void 0), __decorate([n({ type: String })], ChatThread.prototype, "agentAvatar", void 0), ChatThread = __decorate([t("agent-chat-thread")], ChatThread);
|
|
1067
|
+
__decorate([n({ type: Array })], ChatThread.prototype, "messages", void 0), __decorate([n({ type: Boolean })], ChatThread.prototype, "isRunning", void 0), __decorate([n({ type: String })], ChatThread.prototype, "agentAvatar", void 0), __decorate([n({ type: String })], ChatThread.prototype, "emptyText", void 0), ChatThread = __decorate([t("agent-chat-thread")], ChatThread);
|
|
1043
1068
|
const styles$3 = i$1`
|
|
1044
1069
|
:host {
|
|
1045
1070
|
display: block;
|
|
@@ -1055,7 +1080,7 @@ const styles$3 = i$1`
|
|
|
1055
1080
|
max-width: 48rem; /* max-w-screen-md */
|
|
1056
1081
|
margin: 0 auto;
|
|
1057
1082
|
display: flex;
|
|
1058
|
-
align-items:
|
|
1083
|
+
align-items: center;
|
|
1059
1084
|
background-color: var(--agent-bg-zinc-100, #f4f4f5);
|
|
1060
1085
|
border-radius: var(--agent-radius-3xl, 1.5rem);
|
|
1061
1086
|
padding-left: 0.5rem;
|
|
@@ -1089,17 +1114,28 @@ const styles$3 = i$1`
|
|
|
1089
1114
|
display: flex;
|
|
1090
1115
|
align-items: center;
|
|
1091
1116
|
justify-content: center;
|
|
1092
|
-
width:
|
|
1093
|
-
height:
|
|
1117
|
+
width: 2.25rem;
|
|
1118
|
+
height: 2.25rem;
|
|
1094
1119
|
border-radius: var(--agent-radius-full, 9999px);
|
|
1095
|
-
background-color:
|
|
1096
|
-
|
|
1097
|
-
|
|
1120
|
+
background-color: transparent;
|
|
1121
|
+
border: 1.5px solid transparent;
|
|
1122
|
+
color: var(--agent-text-foreground, #09090b);
|
|
1123
|
+
transition: all 0.2s ease-in-out;
|
|
1098
1124
|
cursor: pointer;
|
|
1099
1125
|
}
|
|
1126
|
+
|
|
1127
|
+
.action-button:hover:not(:disabled) {
|
|
1128
|
+
border-color: #22c55e;
|
|
1129
|
+
color: #22c55e;
|
|
1130
|
+
background-color: #22c55e10;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
.action-button:hover:not(:disabled) svg {
|
|
1134
|
+
fill: #22c55e20; /* Subtle fill for "relleno" feeling */
|
|
1135
|
+
}
|
|
1100
1136
|
|
|
1101
1137
|
.action-button:disabled {
|
|
1102
|
-
opacity: 0.
|
|
1138
|
+
opacity: 0.3;
|
|
1103
1139
|
cursor: not-allowed;
|
|
1104
1140
|
}
|
|
1105
1141
|
|
|
@@ -1118,7 +1154,7 @@ const styles$3 = i$1`
|
|
|
1118
1154
|
`;
|
|
1119
1155
|
var ChatComposer = class extends i {
|
|
1120
1156
|
constructor(...x) {
|
|
1121
|
-
super(...x), this.isRunning = !1, this._value = "";
|
|
1157
|
+
super(...x), this.isRunning = !1, this.disclaimer = "", this.placeholder = "", this._value = "";
|
|
1122
1158
|
}
|
|
1123
1159
|
static #e = this.styles = styles$3;
|
|
1124
1160
|
_handleInput(x) {
|
|
@@ -1147,7 +1183,7 @@ var ChatComposer = class extends i {
|
|
|
1147
1183
|
return b`
|
|
1148
1184
|
<div class="composer-container">
|
|
1149
1185
|
<textarea
|
|
1150
|
-
placeholder="
|
|
1186
|
+
placeholder="${this.placeholder}"
|
|
1151
1187
|
.value="${this._value}"
|
|
1152
1188
|
@input="${this._handleInput}"
|
|
1153
1189
|
@keydown="${this._handleKeyDown}"
|
|
@@ -1155,15 +1191,15 @@ var ChatComposer = class extends i {
|
|
|
1155
1191
|
rows="1"
|
|
1156
1192
|
></textarea>
|
|
1157
1193
|
|
|
1158
|
-
${this.isRunning ? b`<button class="action-button" @click="${this._handleStop}">${StopIcon}</button>` : b`<button class="action-button" ?disabled="${!this._value.trim()}" @click="${this._handleSubmit}">${
|
|
1194
|
+
${this.isRunning ? b`<button class="action-button" @click="${this._handleStop}">${StopIcon}</button>` : b`<button class="action-button" ?disabled="${!this._value.trim()}" @click="${this._handleSubmit}">${SendIcon}</button>`}
|
|
1159
1195
|
</div>
|
|
1160
1196
|
<p class="disclaimer">
|
|
1161
|
-
|
|
1197
|
+
${this.disclaimer}
|
|
1162
1198
|
</p>
|
|
1163
1199
|
`;
|
|
1164
1200
|
}
|
|
1165
1201
|
};
|
|
1166
|
-
__decorate([n({ type: Boolean })], ChatComposer.prototype, "isRunning", void 0), __decorate([r()], ChatComposer.prototype, "_value", void 0), __decorate([e("textarea")], ChatComposer.prototype, "_textarea", void 0), ChatComposer = __decorate([t("agent-chat-composer")], ChatComposer);
|
|
1202
|
+
__decorate([n({ type: Boolean })], ChatComposer.prototype, "isRunning", void 0), __decorate([n({ type: String })], ChatComposer.prototype, "disclaimer", void 0), __decorate([n({ type: String })], ChatComposer.prototype, "placeholder", void 0), __decorate([r()], ChatComposer.prototype, "_value", void 0), __decorate([e("textarea")], ChatComposer.prototype, "_textarea", void 0), ChatComposer = __decorate([t("agent-chat-composer")], ChatComposer);
|
|
1167
1203
|
const styles$2 = i$1`
|
|
1168
1204
|
:host {
|
|
1169
1205
|
display: block;
|
|
@@ -1593,6 +1629,9 @@ const conversationService = new class {
|
|
|
1593
1629
|
constructor() {
|
|
1594
1630
|
this.baseUrl = "http://localhost:8003/api/v2/conversations";
|
|
1595
1631
|
}
|
|
1632
|
+
initialize(x) {
|
|
1633
|
+
this.baseUrl = `${x}/api/v2/conversations`;
|
|
1634
|
+
}
|
|
1596
1635
|
async getConversations() {
|
|
1597
1636
|
let x = await fetch(`${this.baseUrl}`);
|
|
1598
1637
|
if (!x.ok) throw Error(`Failed to fetch conversations: ${x.statusText}`);
|
|
@@ -1632,7 +1671,7 @@ const conversationService = new class {
|
|
|
1632
1671
|
}, this._conversations = [], this._appContext = null, this.subscriber = new ChatSubscriber(this);
|
|
1633
1672
|
}
|
|
1634
1673
|
initialize(j) {
|
|
1635
|
-
this.agent = new HttpAgent({ url: j.backendUrl }), this._appContext = {
|
|
1674
|
+
this.agent = new HttpAgent({ url: j.backendUrl }), j.conversationUrl && conversationService.initialize(j.conversationUrl), this._appContext = {
|
|
1636
1675
|
appName: j.appName,
|
|
1637
1676
|
currentPage: "home",
|
|
1638
1677
|
inspector: j.inspector
|
|
@@ -1795,12 +1834,13 @@ var ChatController = class {
|
|
|
1795
1834
|
const fetchInterceptorService = new FetchInterceptorService();
|
|
1796
1835
|
var AgentChat = class extends i {
|
|
1797
1836
|
constructor(...x) {
|
|
1798
|
-
super(...x), this._chatController = new ChatController(this), this.backendUrl = "http://localhost:8001/ag_ui", this.appName = "Lit-Chat-App", this.agentAvatar = "", this.interceptor = !1, this._historyOpen = !1, this._inspectorOpen = !1, this._inspectorEnabled = !1;
|
|
1837
|
+
super(...x), this._chatController = new ChatController(this), this.backendUrl = "http://localhost:8001/ag_ui", this.conversationUrl = "http://localhost:8003", this.appName = "Lit-Chat-App", this.agentAvatar = "", this.disclaimer = "Agent puede cometer errores. Verifica la información importante.", this.emptyText = "¿Cómo puedo ayudarte hoy?", this.placeholder = "Enviar un mensaje a Agent", this.headerTitle = "Agent", this.hideHeader = !1, this.interceptor = !1, this._historyOpen = !1, this._inspectorOpen = !1, this._inspectorEnabled = !1;
|
|
1799
1838
|
}
|
|
1800
1839
|
static #e = this.styles = styles;
|
|
1801
1840
|
willUpdate(x) {
|
|
1802
|
-
(x.has("backendUrl") || x.has("appName")) && (this._chatController.initialize({
|
|
1841
|
+
(x.has("backendUrl") || x.has("appName") || x.has("conversationUrl")) && (this._chatController.initialize({
|
|
1803
1842
|
backendUrl: this.backendUrl,
|
|
1843
|
+
conversationUrl: this.conversationUrl,
|
|
1804
1844
|
appName: this.appName,
|
|
1805
1845
|
inspector: this.hasAttribute("inspector") || this.inspector
|
|
1806
1846
|
}), this._inspectorEnabled = this.hasAttribute("inspector") || this.inspector), x.has("interceptor") && (this.interceptor ? this.enableFetchInterceptor() : fetchInterceptorService.destroy());
|
|
@@ -1829,10 +1869,13 @@ var AgentChat = class extends i {
|
|
|
1829
1869
|
render() {
|
|
1830
1870
|
return b`
|
|
1831
1871
|
<div class="chat-layout">
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1872
|
+
${this.hideHeader ? "" : b`
|
|
1873
|
+
<agent-chat-header
|
|
1874
|
+
.title="${this.headerTitle}"
|
|
1875
|
+
@new-thread="${this._handleNewThread}"
|
|
1876
|
+
@toggle-history="${this._toggleHistory}"
|
|
1877
|
+
></agent-chat-header>
|
|
1878
|
+
`}
|
|
1836
1879
|
<agent-chat-history-list
|
|
1837
1880
|
.conversations="${this._chatController.conversations}"
|
|
1838
1881
|
?open="${this._historyOpen}"
|
|
@@ -1841,9 +1884,15 @@ var AgentChat = class extends i {
|
|
|
1841
1884
|
<agent-chat-thread
|
|
1842
1885
|
.messages="${this._chatController.thread.messages}"
|
|
1843
1886
|
?isRunning="${this._chatController.thread.isRunning}"
|
|
1844
|
-
.agentAvatar="${this.agentAvatar}"
|
|
1887
|
+
.agentAvatar="${this.agentAvatar}"
|
|
1888
|
+
.emptyText="${this.emptyText}">
|
|
1845
1889
|
</agent-chat-thread>
|
|
1846
|
-
<agent-chat-composer
|
|
1890
|
+
<agent-chat-composer
|
|
1891
|
+
?isRunning="${this._chatController.thread.isRunning}"
|
|
1892
|
+
.disclaimer="${this.disclaimer}"
|
|
1893
|
+
.placeholder="${this.placeholder}"
|
|
1894
|
+
@send="${this._handleSend}">
|
|
1895
|
+
</agent-chat-composer>
|
|
1847
1896
|
|
|
1848
1897
|
${this._inspectorEnabled ? b`
|
|
1849
1898
|
<button class="inspector-toggle" @click="${this._toggleInspector}" title="Inspector">
|
|
@@ -1862,12 +1911,30 @@ __decorate([n({
|
|
|
1862
1911
|
type: String,
|
|
1863
1912
|
attribute: "backend-url"
|
|
1864
1913
|
})], AgentChat.prototype, "backendUrl", void 0), __decorate([n({
|
|
1914
|
+
type: String,
|
|
1915
|
+
attribute: "conversation-url"
|
|
1916
|
+
})], AgentChat.prototype, "conversationUrl", void 0), __decorate([n({
|
|
1865
1917
|
type: String,
|
|
1866
1918
|
attribute: "app-name"
|
|
1867
1919
|
})], AgentChat.prototype, "appName", void 0), __decorate([n({
|
|
1868
1920
|
type: String,
|
|
1869
1921
|
attribute: "agent-avatar"
|
|
1870
1922
|
})], AgentChat.prototype, "agentAvatar", void 0), __decorate([n({
|
|
1923
|
+
type: String,
|
|
1924
|
+
attribute: "disclaimer"
|
|
1925
|
+
})], AgentChat.prototype, "disclaimer", void 0), __decorate([n({
|
|
1926
|
+
type: String,
|
|
1927
|
+
attribute: "empty-text"
|
|
1928
|
+
})], AgentChat.prototype, "emptyText", void 0), __decorate([n({
|
|
1929
|
+
type: String,
|
|
1930
|
+
attribute: "placeholder"
|
|
1931
|
+
})], AgentChat.prototype, "placeholder", void 0), __decorate([n({
|
|
1932
|
+
type: String,
|
|
1933
|
+
attribute: "header-title"
|
|
1934
|
+
})], AgentChat.prototype, "headerTitle", void 0), __decorate([n({
|
|
1935
|
+
type: Boolean,
|
|
1936
|
+
attribute: "hide-header"
|
|
1937
|
+
})], AgentChat.prototype, "hideHeader", void 0), __decorate([n({
|
|
1871
1938
|
type: Boolean,
|
|
1872
1939
|
attribute: "interceptor"
|
|
1873
1940
|
})], AgentChat.prototype, "interceptor", void 0), __decorate([r()], AgentChat.prototype, "_historyOpen", void 0), __decorate([r()], AgentChat.prototype, "_inspectorOpen", void 0), __decorate([r()], AgentChat.prototype, "_inspectorEnabled", void 0), AgentChat = __decorate([t("agent-chat")], AgentChat);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@ag-ui/client`)):typeof define==`function`&&define.amd?define([`exports`,`@ag-ui/client`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.SiteOperator={},e.AgUiClient))})(this,function(e,t){var n=globalThis,r=n.ShadowRoot&&(n.ShadyCSS===void 0||n.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap,o=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(r&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=a.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&a.set(t,e))}return e}toString(){return this.cssText}},s=e=>new o(typeof e==`string`?e:e+``,void 0,i),c=(e,...t)=>new o(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,i),l=(e,t)=>{if(r)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement(`style`),i=n.litNonce;i!==void 0&&t.setAttribute(`nonce`,i),t.textContent=r.cssText,e.appendChild(t)}},u=r?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return s(t)})(e):e,{is:d,defineProperty:ee,getOwnPropertyDescriptor:te,getOwnPropertyNames:ne,getOwnPropertySymbols:re,getPrototypeOf:ie}=Object,f=globalThis,ae=f.trustedTypes,oe=ae?ae.emptyScript:``,se=f.reactiveElementPolyfillSupport,p=(e,t)=>e,m={toAttribute(e,t){switch(t){case Boolean:e=e?oe:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},h=(e,t)=>!d(e,t),
|
|
2
|
-
\f\r]`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@ag-ui/client`)):typeof define==`function`&&define.amd?define([`exports`,`@ag-ui/client`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.SiteOperator={},e.AgUiClient))})(this,function(e,t){var n=globalThis,r=n.ShadowRoot&&(n.ShadyCSS===void 0||n.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap,o=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(r&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=a.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&a.set(t,e))}return e}toString(){return this.cssText}},s=e=>new o(typeof e==`string`?e:e+``,void 0,i),c=(e,...t)=>new o(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,i),l=(e,t)=>{if(r)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement(`style`),i=n.litNonce;i!==void 0&&t.setAttribute(`nonce`,i),t.textContent=r.cssText,e.appendChild(t)}},u=r?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return s(t)})(e):e,{is:d,defineProperty:ee,getOwnPropertyDescriptor:te,getOwnPropertyNames:ne,getOwnPropertySymbols:re,getPrototypeOf:ie}=Object,f=globalThis,ae=f.trustedTypes,oe=ae?ae.emptyScript:``,se=f.reactiveElementPolyfillSupport,p=(e,t)=>e,m={toAttribute(e,t){switch(t){case Boolean:e=e?oe:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},h=(e,t)=>!d(e,t),ce={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:h};Symbol.metadata??=Symbol(`metadata`),f.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ce){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&ee(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=te(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ce}static _$Ei(){if(this.hasOwnProperty(p(`elementProperties`)))return;let e=ie(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(p(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(p(`properties`))){let e=this.properties,t=[...ne(e),...re(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(u(e))}else e!==void 0&&t.push(u(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return l(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?m:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?m:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??h)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};g.elementStyles=[],g.shadowRootOptions={mode:`open`},g[p(`elementProperties`)]=new Map,g[p(`finalized`)]=new Map,se?.({ReactiveElement:g}),(f.reactiveElementVersions??=[]).push(`2.1.2`);var _=globalThis,le=e=>e,v=_.trustedTypes,ue=v?v.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,de=`$lit$`,y=`lit$${Math.random().toFixed(9).slice(2)}$`,fe=`?`+y,pe=`<${fe}>`,b=document,x=()=>b.createComment(``),S=e=>e===null||typeof e!=`object`&&typeof e!=`function`,C=Array.isArray,me=e=>C(e)||typeof e?.[Symbol.iterator]==`function`,w=`[
|
|
2
|
+
\f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,he=/-->/g,ge=/>/g,E=RegExp(`>|${w}(?:([^\\s"'>=/]+)(${w}*=${w}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),_e=/'/g,ve=/"/g,D=/^(?:script|style|textarea|title)$/i,O=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),k=Symbol.for(`lit-noChange`),A=Symbol.for(`lit-nothing`),ye=new WeakMap,j=b.createTreeWalker(b,129);function be(e,t){if(!C(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return ue===void 0?t:ue.createHTML(t)}var xe=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=T;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===T?c[1]===`!--`?o=he:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=E):(D.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=E):o=ge:o===E?c[0]===`>`?(o=i??T,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?E:c[3]===`"`?ve:_e):o===ve||o===_e?o=E:o===he||o===ge?o=T:(o=E,i=void 0);let d=o===E&&e[t+1].startsWith(`/>`)?` `:``;a+=o===T?n+pe:l>=0?(r.push(s),n.slice(0,l)+de+n.slice(l)+y+d):n+y+(l===-2?t:d)}return[be(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},M=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=xe(t,n);if(this.el=e.createElement(l,r),j.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=j.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(de)){let t=u[o++],n=i.getAttribute(e).split(y),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?Ce:r[1]===`?`?we:r[1]===`@`?Te:F}),i.removeAttribute(e)}else e.startsWith(y)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(D.test(i.tagName)){let e=i.textContent.split(y),t=e.length-1;if(t>0){i.textContent=v?v.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],x()),j.nextNode(),c.push({type:2,index:++a});i.append(e[t],x())}}}else if(i.nodeType===8)if(i.data===fe)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(y,e+1))!==-1;)c.push({type:7,index:a}),e+=y.length-1}a++}}static createElement(e,t){let n=b.createElement(`template`);return n.innerHTML=e,n}};function N(e,t,n=e,r){if(t===k)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=S(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=N(e,i._$AS(e,t.values),i,r)),t}var Se=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??b).importNode(t,!0);j.currentNode=r;let i=j.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new P(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Ee(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=j.nextNode(),a++)}return j.currentNode=b,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},P=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=N(this,e,t),S(e)?e===A||e==null||e===``?(this._$AH!==A&&this._$AR(),this._$AH=A):e!==this._$AH&&e!==k&&this._(e):e._$litType$===void 0?e.nodeType===void 0?me(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==A&&S(this._$AH)?this._$AA.nextSibling.data=e:this.T(b.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=M.createElement(be(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Se(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=ye.get(e.strings);return t===void 0&&ye.set(e.strings,t=new M(e)),t}k(t){C(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(x()),this.O(x()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=le(e).nextSibling;le(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},F=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=A,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=A}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=N(this,e,t,0),a=!S(e)||e!==this._$AH&&e!==k,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=N(this,r[n+o],t,o),s===k&&(s=this._$AH[o]),a||=!S(s)||s!==this._$AH[o],s===A?e=A:e!==A&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},Ce=class extends F{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===A?void 0:e}},we=class extends F{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==A)}},Te=class extends F{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=N(this,e,t,0)??A)===k)return;let n=this._$AH,r=e===A&&n!==A||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==A&&(n===A||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ee=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){N(this,e)}},De=_.litHtmlPolyfillSupport;De?.(M,P),(_.litHtmlVersions??=[]).push(`3.3.2`);var Oe=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new P(t.insertBefore(x(),e),e,void 0,n??{})}return i._$AI(e),i},I=globalThis,L=class extends g{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Oe(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return k}};L._$litElement$=!0,L.finalized=!0,I.litElementHydrateSupport?.({LitElement:L});var ke=I.litElementPolyfillSupport;ke?.({LitElement:L}),(I.litElementVersions??=[]).push(`4.2.2`);var R=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},Ae={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:h},je=(e=Ae,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function z(e){return(t,n)=>typeof n==`object`?je(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function B(e){return z({...e,state:!0,attribute:!1})}var Me=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`object`&&Object.defineProperty(e,t,n),n);function Ne(e,t){return(n,r,i)=>{let a=t=>t.renderRoot?.querySelector(e)??null;if(t){let{get:e,set:t}=typeof r==`object`?n:i??(()=>{let e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return Me(n,r,{get(){let n=e.call(this);return n===void 0&&(n=a(this),(n!==null||this.hasUpdated)&&t.call(this,n)),n}})}return Me(n,r,{get(){return a(this)}})}}let Pe=c`
|
|
3
3
|
:host {
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
transform: scale(1.1);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
`,
|
|
57
|
+
`,Fe=c`
|
|
58
58
|
:host {
|
|
59
59
|
display: block;
|
|
60
60
|
border-bottom: 1px solid var(--agent-border-zinc-200, #e4e4e7);
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
display: flex;
|
|
83
83
|
gap: 0.5rem;
|
|
84
84
|
}
|
|
85
|
-
`,
|
|
85
|
+
`,Ie=c`
|
|
86
86
|
:host {
|
|
87
87
|
display: inline-flex;
|
|
88
88
|
}
|
|
@@ -109,23 +109,50 @@
|
|
|
109
109
|
width: 1.25rem;
|
|
110
110
|
height: 1.25rem;
|
|
111
111
|
}
|
|
112
|
-
`;function
|
|
112
|
+
`;function V(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var H=class extends L{constructor(...e){super(...e),this.tooltip=``}static#e=this.styles=Ie;render(){return O`
|
|
113
113
|
<button title="${this.tooltip}" aria-label="${this.tooltip||`Action`}">
|
|
114
114
|
<slot></slot>
|
|
115
115
|
</button>
|
|
116
|
-
`}};
|
|
116
|
+
`}};V([z()],H.prototype,`tooltip`,void 0),H=V([R(`agent-icon-button`)],H);let Le=O`
|
|
117
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus">
|
|
118
|
+
<path d="M5 12h14" />
|
|
119
|
+
<path d="M12 5v14" />
|
|
120
|
+
</svg>`,Re=O`
|
|
121
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-send">
|
|
122
|
+
<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z" />
|
|
123
|
+
<path d="m21.854 2.147-10.94 10.939" />
|
|
124
|
+
</svg>`,ze=O`
|
|
125
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy">
|
|
126
|
+
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
|
|
127
|
+
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
|
|
128
|
+
</svg>`,Be=O`
|
|
129
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw">
|
|
130
|
+
<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" />
|
|
131
|
+
<path d="M21 3v5h-5" />
|
|
132
|
+
</svg>`,Ve=O`
|
|
133
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square">
|
|
134
|
+
<rect width="18" height="18" x="3" y="3" rx="2" />
|
|
135
|
+
</svg>`,He=O`
|
|
136
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-history">
|
|
137
|
+
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
|
|
138
|
+
<path d="M3 3v5h5" />
|
|
139
|
+
<path d="M12 7v5l4 2" />
|
|
140
|
+
</svg>`,Ue=O`
|
|
141
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-wrench">
|
|
142
|
+
<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z" />
|
|
143
|
+
</svg>`;var U=class extends L{constructor(...e){super(...e),this.title=`Agent Chat`}static#e=this.styles=Fe;_handleNewThread(){this.dispatchEvent(new CustomEvent(`new-thread`,{bubbles:!0,composed:!0}))}_handleToggleHistory(){this.dispatchEvent(new CustomEvent(`toggle-history`,{bubbles:!0,composed:!0}))}render(){return O`
|
|
117
144
|
<header class="header">
|
|
118
145
|
<h1>${this.title}</h1>
|
|
119
146
|
<div class="actions">
|
|
120
147
|
<agent-icon-button tooltip="Conversaciones" @click="${this._handleToggleHistory}">
|
|
121
|
-
${
|
|
148
|
+
${He}
|
|
122
149
|
</agent-icon-button>
|
|
123
150
|
<agent-icon-button tooltip="Nuevo Chat" @click="${this._handleNewThread}">
|
|
124
|
-
${
|
|
151
|
+
${Le}
|
|
125
152
|
</agent-icon-button>
|
|
126
153
|
</div>
|
|
127
154
|
</header>
|
|
128
|
-
`}};
|
|
155
|
+
`}};V([z({type:String})],U.prototype,`title`,void 0),U=V([R(`agent-chat-header`)],U);let We=c`
|
|
129
156
|
:host {
|
|
130
157
|
display: block;
|
|
131
158
|
height: 100%;
|
|
@@ -180,7 +207,7 @@
|
|
|
180
207
|
font-size: 1.25rem;
|
|
181
208
|
line-height: 1.75rem;
|
|
182
209
|
}
|
|
183
|
-
`,
|
|
210
|
+
`,Ge=c`
|
|
184
211
|
:host {
|
|
185
212
|
display: block;
|
|
186
213
|
margin: 1rem 0;
|
|
@@ -304,15 +331,15 @@
|
|
|
304
331
|
transform: scale(1);
|
|
305
332
|
}
|
|
306
333
|
}
|
|
307
|
-
`;var
|
|
334
|
+
`;var W=class extends L{constructor(...e){super(...e),this.isLast=!1,this.isStreaming=!1,this.agentAvatar=``}static#e=this.styles=Ge;updated(e){e.has(`message`)&&(this.setAttribute(`role`,this.message.role),this.requestUpdate())}_handleCopy(){navigator.clipboard.writeText(this.message.content)}_handleReload(){this.dispatchEvent(new CustomEvent(`reload-message`,{detail:{id:this.message.id},bubbles:!0,composed:!0}))}render(){let e=this.message.role===`user`;return O`
|
|
308
335
|
<div class="message-container">
|
|
309
|
-
${e?``:
|
|
310
|
-
${this.agentAvatar?
|
|
336
|
+
${e?``:O`
|
|
337
|
+
${this.agentAvatar?O`<img src="${this.agentAvatar}" class="avatar-img" alt="AI">`:O`<div class="avatar">C</div>`}
|
|
311
338
|
`}
|
|
312
339
|
|
|
313
340
|
<div class="content-wrapper">
|
|
314
341
|
<div class="bubble ${this.isStreaming?`streaming`:``}">
|
|
315
|
-
${this.message.isThinking?
|
|
342
|
+
${this.message.isThinking?O`
|
|
316
343
|
<div class="typing-indicator">
|
|
317
344
|
<div class="typing-dot"></div>
|
|
318
345
|
<div class="typing-dot"></div>
|
|
@@ -321,26 +348,26 @@
|
|
|
321
348
|
`:this.message.content}
|
|
322
349
|
</div>
|
|
323
350
|
|
|
324
|
-
${e?``:
|
|
351
|
+
${e?``:O`
|
|
325
352
|
<div class="actions">
|
|
326
353
|
<agent-icon-button tooltip="Copy" @click="${this._handleCopy}">
|
|
327
|
-
${
|
|
354
|
+
${ze}
|
|
328
355
|
</agent-icon-button>
|
|
329
356
|
<agent-icon-button tooltip="Reload" @click="${this._handleReload}">
|
|
330
|
-
${
|
|
357
|
+
${Be}
|
|
331
358
|
</agent-icon-button>
|
|
332
359
|
</div>
|
|
333
360
|
`}
|
|
334
361
|
</div>
|
|
335
362
|
</div>
|
|
336
|
-
`}};
|
|
363
|
+
`}};V([z({type:Object})],W.prototype,`message`,void 0),V([z({type:Boolean})],W.prototype,`isLast`,void 0),V([z({type:Boolean})],W.prototype,`isStreaming`,void 0),V([z({type:String})],W.prototype,`agentAvatar`,void 0),W=V([R(`agent-chat-message`)],W);var G=class extends L{constructor(...e){super(...e),this.messages=[],this.isRunning=!1,this.agentAvatar=``,this.emptyText=``}static#e=this.styles=We;updated(e){e.has(`messages`)&&this.scrollToBottom()}async scrollToBottom(){await this.updateComplete,(this.shadowRoot?.querySelector(`agent-chat-message:last-of-type`))?.scrollIntoView({behavior:`smooth`,block:`end`})}render(){return this.messages.length===0?O`
|
|
337
364
|
<div class="empty-state">
|
|
338
|
-
${this.agentAvatar?
|
|
339
|
-
<p class="empty-text"
|
|
365
|
+
${this.agentAvatar?O`<img src="${this.agentAvatar}" alt="Agent Avatar" class="empty-avatar-img">`:O`<div class="empty-avatar">SM</div>`}
|
|
366
|
+
<p class="empty-text">${this.emptyText}</p>
|
|
340
367
|
</div>
|
|
341
|
-
`:
|
|
368
|
+
`:O`
|
|
342
369
|
<div class="messages-list">
|
|
343
|
-
${this.messages.map((e,t)=>
|
|
370
|
+
${this.messages.map((e,t)=>O`
|
|
344
371
|
<agent-chat-message
|
|
345
372
|
.message=${e}
|
|
346
373
|
.isLast=${t===this.messages.length-1}
|
|
@@ -349,7 +376,7 @@
|
|
|
349
376
|
</agent-chat-message>
|
|
350
377
|
`)}
|
|
351
378
|
</div>
|
|
352
|
-
`}};
|
|
379
|
+
`}};V([z({type:Array})],G.prototype,`messages`,void 0),V([z({type:Boolean})],G.prototype,`isRunning`,void 0),V([z({type:String})],G.prototype,`agentAvatar`,void 0),V([z({type:String})],G.prototype,`emptyText`,void 0),G=V([R(`agent-chat-thread`)],G);let Ke=c`
|
|
353
380
|
:host {
|
|
354
381
|
display: block;
|
|
355
382
|
padding: 1rem;
|
|
@@ -364,7 +391,7 @@
|
|
|
364
391
|
max-width: 48rem; /* max-w-screen-md */
|
|
365
392
|
margin: 0 auto;
|
|
366
393
|
display: flex;
|
|
367
|
-
align-items:
|
|
394
|
+
align-items: center;
|
|
368
395
|
background-color: var(--agent-bg-zinc-100, #f4f4f5);
|
|
369
396
|
border-radius: var(--agent-radius-3xl, 1.5rem);
|
|
370
397
|
padding-left: 0.5rem;
|
|
@@ -398,17 +425,28 @@
|
|
|
398
425
|
display: flex;
|
|
399
426
|
align-items: center;
|
|
400
427
|
justify-content: center;
|
|
401
|
-
width:
|
|
402
|
-
height:
|
|
428
|
+
width: 2.25rem;
|
|
429
|
+
height: 2.25rem;
|
|
403
430
|
border-radius: var(--agent-radius-full, 9999px);
|
|
404
|
-
background-color:
|
|
405
|
-
|
|
406
|
-
|
|
431
|
+
background-color: transparent;
|
|
432
|
+
border: 1.5px solid transparent;
|
|
433
|
+
color: var(--agent-text-foreground, #09090b);
|
|
434
|
+
transition: all 0.2s ease-in-out;
|
|
407
435
|
cursor: pointer;
|
|
408
436
|
}
|
|
437
|
+
|
|
438
|
+
.action-button:hover:not(:disabled) {
|
|
439
|
+
border-color: #22c55e;
|
|
440
|
+
color: #22c55e;
|
|
441
|
+
background-color: #22c55e10;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.action-button:hover:not(:disabled) svg {
|
|
445
|
+
fill: #22c55e20; /* Subtle fill for "relleno" feeling */
|
|
446
|
+
}
|
|
409
447
|
|
|
410
448
|
.action-button:disabled {
|
|
411
|
-
opacity: 0.
|
|
449
|
+
opacity: 0.3;
|
|
412
450
|
cursor: not-allowed;
|
|
413
451
|
}
|
|
414
452
|
|
|
@@ -424,10 +462,10 @@
|
|
|
424
462
|
font-size: 0.75rem;
|
|
425
463
|
padding: 0.5rem;
|
|
426
464
|
}
|
|
427
|
-
`;var
|
|
465
|
+
`;var K=class extends L{constructor(...e){super(...e),this.isRunning=!1,this.disclaimer=``,this.placeholder=``,this._value=``}static#e=this.styles=Ke;_handleInput(e){this._value=e.target.value,this._adjustHeight()}_handleKeyDown(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),this._handleSubmit())}_adjustHeight(){this._textarea&&(this._textarea.style.height=`auto`,this._textarea.style.height=`${Math.min(this._textarea.scrollHeight,160)}px`)}async _handleSubmit(){this._value.trim()&&(this.dispatchEvent(new CustomEvent(`send`,{detail:{content:this._value},bubbles:!0,composed:!0})),this._value=``,await this.updateComplete,this._textarea.style.height=`3rem`)}_handleStop(){this.dispatchEvent(new CustomEvent(`cancel`,{bubbles:!0,composed:!0}))}render(){return O`
|
|
428
466
|
<div class="composer-container">
|
|
429
467
|
<textarea
|
|
430
|
-
placeholder="
|
|
468
|
+
placeholder="${this.placeholder}"
|
|
431
469
|
.value="${this._value}"
|
|
432
470
|
@input="${this._handleInput}"
|
|
433
471
|
@keydown="${this._handleKeyDown}"
|
|
@@ -435,12 +473,12 @@
|
|
|
435
473
|
rows="1"
|
|
436
474
|
></textarea>
|
|
437
475
|
|
|
438
|
-
${this.isRunning?
|
|
476
|
+
${this.isRunning?O`<button class="action-button" @click="${this._handleStop}">${Ve}</button>`:O`<button class="action-button" ?disabled="${!this._value.trim()}" @click="${this._handleSubmit}">${Re}</button>`}
|
|
439
477
|
</div>
|
|
440
478
|
<p class="disclaimer">
|
|
441
|
-
|
|
479
|
+
${this.disclaimer}
|
|
442
480
|
</p>
|
|
443
|
-
`}};
|
|
481
|
+
`}};V([z({type:Boolean})],K.prototype,`isRunning`,void 0),V([z({type:String})],K.prototype,`disclaimer`,void 0),V([z({type:String})],K.prototype,`placeholder`,void 0),V([B()],K.prototype,`_value`,void 0),V([Ne(`textarea`)],K.prototype,`_textarea`,void 0),K=V([R(`agent-chat-composer`)],K);let qe=c`
|
|
444
482
|
:host {
|
|
445
483
|
display: block;
|
|
446
484
|
position: absolute;
|
|
@@ -503,18 +541,18 @@
|
|
|
503
541
|
color: #999;
|
|
504
542
|
font-size: 0.9rem;
|
|
505
543
|
}
|
|
506
|
-
`;var
|
|
544
|
+
`;var q=class extends L{constructor(...e){super(...e),this.conversations=[],this.open=!1}static#e=this.styles=qe;_handleSelect(e){this.dispatchEvent(new CustomEvent(`select-thread`,{detail:{conversation:e},bubbles:!0,composed:!0}))}render(){return O`
|
|
507
545
|
<div class="header">
|
|
508
546
|
Conversaciones
|
|
509
547
|
</div>
|
|
510
548
|
<ul class="list">
|
|
511
|
-
${this.conversations.length===0?
|
|
549
|
+
${this.conversations.length===0?O`<div class="empty-state">No hay conversaciones recientes</div>`:this.conversations.map(e=>O`
|
|
512
550
|
<li class="item" @click="${()=>this._handleSelect(e)}">
|
|
513
551
|
${e.title}
|
|
514
552
|
</li>
|
|
515
553
|
`)}
|
|
516
554
|
</ul>
|
|
517
|
-
`}};
|
|
555
|
+
`}};V([z({type:Array})],q.prototype,`conversations`,void 0),V([z({type:Boolean,reflect:!0})],q.prototype,`open`,void 0),q=V([R(`agent-chat-history-list`)],q);let J=new class extends EventTarget{constructor(...e){super(...e),this._context=null,this._messages=[],this._stream=[]}get context(){return this._context}get messages(){return this._messages}get stream(){return this._stream}setContext(e){this._context=e,this.notify()}setMessages(e){this._messages=[...e],this.notify()}addEvent(e,t){this._stream=[{event:e,content:t,time:new Date().toTimeString().split(` `)[0]},...this._stream].slice(0,100),this.notify()}clearStream(){this._stream=[],this.notify()}notify(){this.dispatchEvent(new CustomEvent(`inspector-change`))}},Je=c`
|
|
518
556
|
:host {
|
|
519
557
|
position: absolute;
|
|
520
558
|
bottom: 60px;
|
|
@@ -644,7 +682,7 @@
|
|
|
644
682
|
.event-content {
|
|
645
683
|
margin-top: 4px;
|
|
646
684
|
}
|
|
647
|
-
`;var
|
|
685
|
+
`;var Y=class extends L{constructor(...e){super(...e),this._activeTab=`stream`,this._context=null,this._messages=[],this._stream=[],this._isDragging=!1,this._currentX=0,this._currentY=0,this._initialX=0,this._initialY=0,this._xOffset=0,this._yOffset=0,this._onInspectorChange=()=>{this._updateData()}}static#e=this.styles=Je;connectedCallback(){super.connectedCallback(),J.addEventListener(`inspector-change`,this._onInspectorChange),this._updateData()}disconnectedCallback(){super.disconnectedCallback(),J.removeEventListener(`inspector-change`,this._onInspectorChange)}_updateData(){this._context=J.context,this._messages=J.messages,this._stream=J.stream,this.requestUpdate()}_handleClose(){this.dispatchEvent(new CustomEvent(`close`))}_dragStart(e){e.type===`touchstart`?(this._initialX=e.touches[0].clientX-this._xOffset,this._initialY=e.touches[0].clientY-this._yOffset):(this._initialX=e.clientX-this._xOffset,this._initialY=e.clientY-this._yOffset),!e.target.closest(`.close-button`)&&(this._isDragging=!0)}_drag(e){this._isDragging&&(e.preventDefault(),e.type===`touchmove`?(this._currentX=e.touches[0].clientX-this._initialX,this._currentY=e.touches[0].clientY-this._initialY):(this._currentX=e.clientX-this._initialX,this._currentY=e.clientY-this._initialY),this._xOffset=this._currentX,this._yOffset=this._currentY,this._setTranslate(this._currentX,this._currentY))}_dragEnd(){this._initialX=this._currentX,this._initialY=this._currentY,this._isDragging=!1}_setTranslate(e,t){this.style.transform=`translate3d(${e}px, ${t}px, 0)`}render(){return O`
|
|
648
686
|
<div class="header"
|
|
649
687
|
@mousedown="${this._dragStart}"
|
|
650
688
|
@touchstart="${this._dragStart}"
|
|
@@ -667,9 +705,9 @@
|
|
|
667
705
|
<div class="content">
|
|
668
706
|
${this._renderContent()}
|
|
669
707
|
</div>
|
|
670
|
-
`}_renderContent(){switch(this._activeTab){case`context`:return
|
|
708
|
+
`}_renderContent(){switch(this._activeTab){case`context`:return O`<pre>${JSON.stringify(this._context,null,2)}</pre>`;case`messages`:return O`<pre>${JSON.stringify(this._messages,null,2)}</pre>`;case`stream`:return O`
|
|
671
709
|
<div class="stream-list">
|
|
672
|
-
${this._stream.map(e=>
|
|
710
|
+
${this._stream.map(e=>O`
|
|
673
711
|
<div class="event-item">
|
|
674
712
|
<div class="event-header">
|
|
675
713
|
<span class="event-name">${e.event}</span>
|
|
@@ -680,14 +718,17 @@
|
|
|
680
718
|
</div>
|
|
681
719
|
</div>
|
|
682
720
|
`)}
|
|
683
|
-
${this._stream.length===0?
|
|
721
|
+
${this._stream.length===0?O`<div style="color: #9ca3af; text-align: center; padding: 20px;">No events yet</div>`:``}
|
|
684
722
|
</div>
|
|
685
|
-
`}}};H([V()],X.prototype,`_activeTab`,void 0),H([V()],X.prototype,`_context`,void 0),H([V()],X.prototype,`_messages`,void 0),H([V()],X.prototype,`_stream`,void 0),X=H([z(`agent-inspector-window`)],X);var Je={thread:`thr`,message:`msg`,toolCall:`tc`,workflow:`wf`,task:`tsk`,attachment:`atc`,sdkHiddenContext:`shcx`};function Ye(e){return`${Je[e]}_${crypto.randomUUID().replace(/-/g,``).slice(0,8)}`}var Xe=class e{constructor(){this._spec=null}static getInstance(){return e._instance||=new e,e._instance}registerPortal(e){console.log(`Registering portal spec`,e),this._spec=e}async executePlan(e){if(!this._spec)return console.warn(`No portal registered. Cannot execute plan.`),{status:`error`,details:`No portal registered`};console.log(`Executing plan:`,e);try{for(let t of e.steps){let e=this._spec.actions[t.action];if(e)console.log(`Executing portal action: ${t.action}`,t.args),await e(t.args);else throw console.warn(`Action ${t.action} not found in portal spec.`),Error(`Action ${t.action} not found`)}return{status:`ok`}}catch(e){return console.error(`Error executing plan:`,e),{status:`error`,details:e.message||e}}}get specs(){return this._spec}};let Z=Xe.getInstance();var Ze=class{constructor(e){this.service=e}onRunStartedEvent(e){Y.addEvent(`onRunStartedEvent`,e.event),this.service.addPlaceholderMessage()}onTextMessageStartEvent(e){Y.addEvent(`onTextMessageStartEvent`,e.event),this.service.prepareMessageForStreaming(e.event.messageId)}onTextMessageContentEvent(e){Y.addEvent(`onTextMessageContentEvent`,e.event);let t=e.event.delta||e.event.content||``;this.service.appendMessageContent(e.event.messageId,t)}onMessagesSnapshotEvent(e){Y.addEvent(`onMessagesSnapshotEvent`,e.event);let t=e.event.messages.map(e=>{let t=``;return t=typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``):JSON.stringify(e.content),{id:e.id,role:e.role,content:t,createdAt:Date.now()}});this.service.setMessages(t),this.service.setMessages(t)}async onToolCallEndEvent(e){if(Y.addEvent(`onToolCallEndEvent`,e.event),e.toolCallName===`executePlan`){console.log(`ChatSubscriber: Received executePlan tool call`,e.toolCallArgs);let t=await Z.executePlan(e.toolCallArgs);console.log(`ChatSubscriber: executePlan result`,t)}}async onClientToolCall(e){Y.addEvent(`onClientToolCall`,e.event),e.toolName===`executePlan`&&(console.log(`ChatSubscriber: Received executePlan client tool call`,e.args),await Z.executePlan(e.args))}};let Qe=new class{constructor(){this.baseUrl=`http://localhost:8003/api/v2/conversations`}async getConversations(){let e=await fetch(`${this.baseUrl}`);if(!e.ok)throw Error(`Failed to fetch conversations: ${e.statusText}`);return e.json()}async createConversation(e){let t={...e,title:e.title||`Nueva conversación`},n=await fetch(this.baseUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`Failed to create conversation: ${n.statusText}`);return n.json()}async updateConversation(e,t){let n=await fetch(`${this.baseUrl}/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`Failed to update conversation: ${n.statusText}`);return n.json()}async deleteConversation(e){let t=await fetch(`${this.baseUrl}/${e}`,{method:`DELETE`});if(!t.ok)throw Error(`Failed to delete conversation: ${t.statusText}`)}},Q=new class extends EventTarget{constructor(){super(),this._thread={id:``,messages:[],isRunning:!1},this._conversations=[],this._appContext=null,this.subscriber=new Ze(this)}initialize(e){this.agent=new t.HttpAgent({url:e.backendUrl}),this._appContext={appName:e.appName,currentPage:`home`,inspector:e.inspector},Y.setContext(this._appContext),Y.setMessages(this._thread.messages)}get thread(){return this._thread}get conversations(){return this._conversations}setAppContext(e){this._appContext=e,Y.setContext(e),this.notify()}async sendMessage(e){if(!this.agent){console.error(`ChatService not initialized. Call initialize() first.`);return}if(!this._thread.id)try{let t=await Qe.createConversation({title:e.slice(0,30)+(e.length>30?`...`:``)});this._thread.id=t.id,this.agent.threadId=this._thread.id}catch(e){console.error(`Failed to create conversation during sendMessage`,e);return}let t={id:Ye(`message`),role:`user`,content:e,createdAt:Date.now()};this._thread.messages=[...this._thread.messages,t],this._thread.isRunning=!0,this.notify();try{this.agent.threadId=this._thread.id,this.agent.addMessage({id:t.id,role:t.role,content:t.content});let e=[{value:new Date().toLocaleString(),description:`Current date and time`}];this._appContext&&e.push({value:JSON.stringify(this._appContext),description:`AgentState`}),this.agent.state=this._appContext,await this.agent.runAgent({context:e},this.subscriber)}catch(e){console.error(`Failed to send message`,e)}finally{this._thread.isRunning=!1,this.notify()}}addPlaceholderMessage(){let e={id:`thinking-placeholder`,role:`assistant`,content:``,createdAt:Date.now(),isThinking:!0};this._thread.messages=[...this._thread.messages,e],this.notify()}prepareMessageForStreaming(e){this._thread.messages=this._thread.messages.map(t=>t.isThinking?{...t,id:e,isThinking:!1}:t),this.notify()}appendMessageContent(e,t){this._thread.messages=this._thread.messages.map(n=>n.id===e?{...n,content:n.content+t}:n),this.notify()}setMessages(e){this._thread.messages=e,this.notify()}async startNewThread(){this._thread={id:``,messages:[],isRunning:!1},this.agent&&(this.agent.threadId=``),this.notify()}async refreshConversations(){try{this._conversations=(await Qe.getConversations()).map(e=>({id:e.id,title:e.title})),this.notify()}catch(e){console.error(`Failed to refresh conversations`,e)}}notify(){Y.setMessages(this._thread.messages),this.dispatchEvent(new CustomEvent(`state-change`))}};var $e=class{constructor(e){this._onStateChange=()=>{this._host.requestUpdate()},this._host=e,this._host.addController(this)}initialize(e){return Q.initialize(e)}hostConnected(){Q.addEventListener(`state-change`,this._onStateChange)}hostDisconnected(){Q.removeEventListener(`state-change`,this._onStateChange)}get thread(){return Q.thread}get conversations(){return Q.conversations}sendMessage(e){return Q.sendMessage(e)}startNewThread(){return Q.startNewThread()}setAppContext(e){return Q.setAppContext(e)}refreshConversations(){return Q.refreshConversations()}},et=class{constructor(){this.originalFetch=window.fetch,this._isEnabled=!1}get isEnabled(){return this._isEnabled}init(){if(this._isEnabled)return;let e=this;window.fetch=async function(t,n){try{let r=new Headers(n?.headers||{});return r.has(`Authorization`)||r.append(`Authorization`,`Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InhmcDRfR0tObWNBMHl3UUNrZ1BXVkJjTHZmRDVfZXZKOWg3bUhGbExBVWMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiIwZWZhNWFhNy04OWRiLTQ5MTYtYmZlNC0wNTM3MjhlZWY2M2QiLCJpc3MiOiJodHRwczovL3NrY290ZXN0LmIyY2xvZ2luLmNvbS8wZGI2ZGJjMy02OTA4LTQ1MTctYTdmMi04MWVhNjg1YTI1ZTIvdjIuMC8iLCJleHAiOjE3NjgzMTEzNjksIm5iZiI6MTc2ODMxMDQ2OSwibmFtZSI6IlZpYW5hIFZlbGFzcXVleiwgSm9zZSBTdGV2ZW4iLCJpZHBfYWNjZXNzX3Rva2VuIjoiZXlKMGVYQWlPaUpLVjFRaUxDSnViMjVqWlNJNkltWkNlRzgzZHpFeExUSnZSMnhMVFZwU1NtcDJlRUV0WkZSdWNWbGpUVmRXUlRVMlRUTlZVemRVZURRaUxDSmhiR2NpT2lKU1V6STFOaUlzSW5nMWRDS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UhkQ1ZKS0JlN1ViZDBPUEpsN21GOVRRRWN4ekc1XzJzZlpsWnFCS0w1dGNkUEdVdWc1MmNQZXRnWGJfTG1kb2xkYWdMZEJEbkdFdyIsInN1YiI6Ijg4MjBkNmI2LTcyNWItNDA0NC1hZGNiLWEzZTE4YTM4ZTRmYyIsImdpdmVuX25hbWUiOiJKb3NlIFN0ZXZlbiIsImZhbWlseV9uYW1lIjoiVmlhbmEgVmVsYXNxdWV6IiwiZW1haWwiOiJqdmlhbmFAc2thbmRpYS5jb20uY28iLCJub25jZSI6IjAxOWJiNzE1LTdlYjMtN2NjNC1iYjY5LTY4ZjUxYzM5NjQxZiIsImF6cCI6IjBlZmE1YWE3LTg5ZGItNDkxNi1iZmU0LTA1MzcyOGVlZjYzZCIsInZlciI6IjEuMCIsImlhdCI6MTc2ODMxMDQ2OX0.cwGadIBQg-do5ttWAJrBHo_JMTQ_AxhfYPZwRIPke5oAKIMxMqgiJ52Uma6NFC1SiUQX1afgkZBP3xsgeSt-aB27J1YgAH3yywZCCdwI88dPejsAOhLz_AdhR9YBndSUEabiau8q3F1D5UNgwaijt-1ziRgzj1ngVzqC3v5EQJ1KM2kP0Am_xXxJkZFTkWpS2Vv7du-vFjabkkMFzVzsksf5PYfoHL4HL7mvrXOjrFPX4KTM2fYAs6qUc274hPvMh-JaU6KbiFAFRFVW6UqhbgZ9FYI_eVEMzlmNG0aQhJ4cy0Iac59J9ZQV-6UvpiFFegIDIrdfqqCguKgCFXe7Tg`),e.originalFetch(t,{...n,headers:r})}catch(e){return Promise.reject(e)}},this._isEnabled=!0,console.log(`Fetch interceptor initialized with test Authorization header (Native implementation).`)}destroy(){this._isEnabled&&(window.fetch=this.originalFetch,this._isEnabled=!1,console.log(`Fetch interceptor destroyed (Native implementation).`))}};let tt=new et;var $=class extends R{constructor(...e){super(...e),this._chatController=new $e(this),this.backendUrl=`http://localhost:8001/ag_ui`,this.appName=`Lit-Chat-App`,this.agentAvatar=``,this.interceptor=!1,this._historyOpen=!1,this._inspectorOpen=!1,this._inspectorEnabled=!1}static#e=this.styles=Ne;willUpdate(e){(e.has(`backendUrl`)||e.has(`appName`))&&(this._chatController.initialize({backendUrl:this.backendUrl,appName:this.appName,inspector:this.hasAttribute(`inspector`)||this.inspector}),this._inspectorEnabled=this.hasAttribute(`inspector`)||this.inspector),e.has(`interceptor`)&&(this.interceptor?this.enableFetchInterceptor():tt.destroy())}enableFetchInterceptor(){console.warn(`Fetch interceptor is only available in development mode.`)}_handleSend(e){this._chatController.sendMessage(e.detail.content)}_handleNewThread(){this._chatController.startNewThread()}setAppContext(e){this._chatController.setAppContext(e)}_toggleHistory(){this._historyOpen=!this._historyOpen,this._historyOpen&&this._chatController.refreshConversations()}_handleSelectThread(e){console.log(`Selected conversation:`,e.detail.conversation),this._historyOpen=!1}_toggleInspector(){this._inspectorOpen=!this._inspectorOpen}render(){return k`
|
|
723
|
+
`}}};V([B()],Y.prototype,`_activeTab`,void 0),V([B()],Y.prototype,`_context`,void 0),V([B()],Y.prototype,`_messages`,void 0),V([B()],Y.prototype,`_stream`,void 0),Y=V([R(`agent-inspector-window`)],Y);var Ye={thread:`thr`,message:`msg`,toolCall:`tc`,workflow:`wf`,task:`tsk`,attachment:`atc`,sdkHiddenContext:`shcx`};function Xe(e){return`${Ye[e]}_${crypto.randomUUID().replace(/-/g,``).slice(0,8)}`}var Ze=class e{constructor(){this._spec=null}static getInstance(){return e._instance||=new e,e._instance}registerPortal(e){console.log(`Registering portal spec`,e),this._spec=e}async executePlan(e){if(!this._spec)return console.warn(`No portal registered. Cannot execute plan.`),{status:`error`,details:`No portal registered`};console.log(`Executing plan:`,e);try{for(let t of e.steps){let e=this._spec.actions[t.action];if(e)console.log(`Executing portal action: ${t.action}`,t.args),await e(t.args);else throw console.warn(`Action ${t.action} not found in portal spec.`),Error(`Action ${t.action} not found`)}return{status:`ok`}}catch(e){return console.error(`Error executing plan:`,e),{status:`error`,details:e.message||e}}}get specs(){return this._spec}};let X=Ze.getInstance();var Qe=class{constructor(e){this.service=e}onRunStartedEvent(e){J.addEvent(`onRunStartedEvent`,e.event),this.service.addPlaceholderMessage()}onTextMessageStartEvent(e){J.addEvent(`onTextMessageStartEvent`,e.event),this.service.prepareMessageForStreaming(e.event.messageId)}onTextMessageContentEvent(e){J.addEvent(`onTextMessageContentEvent`,e.event);let t=e.event.delta||e.event.content||``;this.service.appendMessageContent(e.event.messageId,t)}onMessagesSnapshotEvent(e){J.addEvent(`onMessagesSnapshotEvent`,e.event);let t=e.event.messages.map(e=>{let t=``;return t=typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``):JSON.stringify(e.content),{id:e.id,role:e.role,content:t,createdAt:Date.now()}});this.service.setMessages(t),this.service.setMessages(t)}async onToolCallEndEvent(e){if(J.addEvent(`onToolCallEndEvent`,e.event),e.toolCallName===`executePlan`){console.log(`ChatSubscriber: Received executePlan tool call`,e.toolCallArgs);let t=await X.executePlan(e.toolCallArgs);console.log(`ChatSubscriber: executePlan result`,t)}}async onClientToolCall(e){J.addEvent(`onClientToolCall`,e.event),e.toolName===`executePlan`&&(console.log(`ChatSubscriber: Received executePlan client tool call`,e.args),await X.executePlan(e.args))}};let Z=new class{constructor(){this.baseUrl=`http://localhost:8003/api/v2/conversations`}initialize(e){this.baseUrl=`${e}/api/v2/conversations`}async getConversations(){let e=await fetch(`${this.baseUrl}`);if(!e.ok)throw Error(`Failed to fetch conversations: ${e.statusText}`);return e.json()}async createConversation(e){let t={...e,title:e.title||`Nueva conversación`},n=await fetch(this.baseUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`Failed to create conversation: ${n.statusText}`);return n.json()}async updateConversation(e,t){let n=await fetch(`${this.baseUrl}/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`Failed to update conversation: ${n.statusText}`);return n.json()}async deleteConversation(e){let t=await fetch(`${this.baseUrl}/${e}`,{method:`DELETE`});if(!t.ok)throw Error(`Failed to delete conversation: ${t.statusText}`)}},Q=new class extends EventTarget{constructor(){super(),this._thread={id:``,messages:[],isRunning:!1},this._conversations=[],this._appContext=null,this.subscriber=new Qe(this)}initialize(e){this.agent=new t.HttpAgent({url:e.backendUrl}),e.conversationUrl&&Z.initialize(e.conversationUrl),this._appContext={appName:e.appName,currentPage:`home`,inspector:e.inspector},J.setContext(this._appContext),J.setMessages(this._thread.messages)}get thread(){return this._thread}get conversations(){return this._conversations}setAppContext(e){this._appContext=e,J.setContext(e),this.notify()}async sendMessage(e){if(!this.agent){console.error(`ChatService not initialized. Call initialize() first.`);return}if(!this._thread.id)try{let t=await Z.createConversation({title:e.slice(0,30)+(e.length>30?`...`:``)});this._thread.id=t.id,this.agent.threadId=this._thread.id}catch(e){console.error(`Failed to create conversation during sendMessage`,e);return}let t={id:Xe(`message`),role:`user`,content:e,createdAt:Date.now()};this._thread.messages=[...this._thread.messages,t],this._thread.isRunning=!0,this.notify();try{this.agent.threadId=this._thread.id,this.agent.addMessage({id:t.id,role:t.role,content:t.content});let e=[{value:new Date().toLocaleString(),description:`Current date and time`}];this._appContext&&e.push({value:JSON.stringify(this._appContext),description:`AgentState`}),this.agent.state=this._appContext,await this.agent.runAgent({context:e},this.subscriber)}catch(e){console.error(`Failed to send message`,e)}finally{this._thread.isRunning=!1,this.notify()}}addPlaceholderMessage(){let e={id:`thinking-placeholder`,role:`assistant`,content:``,createdAt:Date.now(),isThinking:!0};this._thread.messages=[...this._thread.messages,e],this.notify()}prepareMessageForStreaming(e){this._thread.messages=this._thread.messages.map(t=>t.isThinking?{...t,id:e,isThinking:!1}:t),this.notify()}appendMessageContent(e,t){this._thread.messages=this._thread.messages.map(n=>n.id===e?{...n,content:n.content+t}:n),this.notify()}setMessages(e){this._thread.messages=e,this.notify()}async startNewThread(){this._thread={id:``,messages:[],isRunning:!1},this.agent&&(this.agent.threadId=``),this.notify()}async refreshConversations(){try{this._conversations=(await Z.getConversations()).map(e=>({id:e.id,title:e.title})),this.notify()}catch(e){console.error(`Failed to refresh conversations`,e)}}notify(){J.setMessages(this._thread.messages),this.dispatchEvent(new CustomEvent(`state-change`))}};var $e=class{constructor(e){this._onStateChange=()=>{this._host.requestUpdate()},this._host=e,this._host.addController(this)}initialize(e){return Q.initialize(e)}hostConnected(){Q.addEventListener(`state-change`,this._onStateChange)}hostDisconnected(){Q.removeEventListener(`state-change`,this._onStateChange)}get thread(){return Q.thread}get conversations(){return Q.conversations}sendMessage(e){return Q.sendMessage(e)}startNewThread(){return Q.startNewThread()}setAppContext(e){return Q.setAppContext(e)}refreshConversations(){return Q.refreshConversations()}},et=class{constructor(){this.originalFetch=window.fetch,this._isEnabled=!1}get isEnabled(){return this._isEnabled}init(){if(this._isEnabled)return;let e=this;window.fetch=async function(t,n){try{let r=new Headers(n?.headers||{});return r.has(`Authorization`)||r.append(`Authorization`,`Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InhmcDRfR0tObWNBMHl3UUNrZ1BXVkJjTHZmRDVfZXZKOWg3bUhGbExBVWMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiIwZWZhNWFhNy04OWRiLTQ5MTYtYmZlNC0wNTM3MjhlZWY2M2QiLCJpc3MiOiJodHRwczovL3NrY290ZXN0LmIyY2xvZ2luLmNvbS8wZGI2ZGJjMy02OTA4LTQ1MTctYTdmMi04MWVhNjg1YTI1ZTIvdjIuMC8iLCJleHAiOjE3NjgzMTEzNjksIm5iZiI6MTc2ODMxMDQ2OSwibmFtZSI6IlZpYW5hIFZlbGFzcXVleiwgSm9zZSBTdGV2ZW4iLCJpZHBfYWNjZXNzX3Rva2VuIjoiZXlKMGVYQWlPaUpLVjFRaUxDSnViMjVqWlNJNkltWkNlRzgzZHpFeExUSnZSMnhMVFZwU1NtcDJlRUV0WkZSdWNWbGpUVmRXUlRVMlRUTlZVemRVZURRaUxDSmhiR2NpT2lKU1V6STFOaUlzSW5nMWRDSTZJbE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1ZKS0JlN1ViZDBPUEpsN21GOVRRRWN4ekc1XzJzZlpsWnFCS0w1dGNkUEdVdWc1MmNQZXRnWGJfTG1kb2xkYWdMZEJEbkdFdyIsInN1YiI6Ijg4MjBkNmI2LTcyNWItNDA0NC1hZGNiLWEzZTE4YTM4ZTRmYyIsImdpdmVuX25hbWUiOiJKb3NlIFN0ZXZlbiIsImZhbWlseV9uYW1lIjoiVmlhbmEgVmVsYXNxdWV6IiwiZW1haWwiOiJqdmlhbmFAc2thbmRpYS5jb20uY28iLCJub25jZSI6IjAxOWJiNzE1LTdlYjMtN2NjNC1iYjY5LTY4ZjUxYzM5NjQxZiIsImF6cCI6IjBlZmE1YWE3LTg5ZGItNDkxNi1iZmU0LTA1MzcyOGVlZjYzZCIsInZlciI6IjEuMCIsImlhdCI6MTc2ODMxMDQ2OX0.cwGadIBQg-do5ttWAJrBHo_JMTQ_AxhfYPZwRIPke5oAKIMxMqgiJ52Uma6NFC1SiUQX1afgkZBP3xsgeSt-aB27J1YgAH3yywZCCdwI88dPejsAOhLz_AdhR9YBndSUEabiau8q3F1D5UNgwaijt-1ziRgzj1ngVzqC3v5EQJ1KM2kP0Am_xXxJkZFTkWpS2Vv7du-vFjabkkMFzVzsksf5PYfoHL4HL7mvrXOjrFPX4KTM2fYAs6qUc274hPvMh-JaU6KbiFAFRFVW6UqhbgZ9FYI_eVEMzlmNG0aQhJ4cy0Iac59J9ZQV-6UvpiFFegIDIrdfqqCguKgCFXe7Tg`),e.originalFetch(t,{...n,headers:r})}catch(e){return Promise.reject(e)}},this._isEnabled=!0,console.log(`Fetch interceptor initialized with test Authorization header (Native implementation).`)}destroy(){this._isEnabled&&(window.fetch=this.originalFetch,this._isEnabled=!1,console.log(`Fetch interceptor destroyed (Native implementation).`))}};let tt=new et;var $=class extends L{constructor(...e){super(...e),this._chatController=new $e(this),this.backendUrl=`http://localhost:8001/ag_ui`,this.conversationUrl=`http://localhost:8003`,this.appName=`Lit-Chat-App`,this.agentAvatar=``,this.disclaimer=`Agent puede cometer errores. Verifica la información importante.`,this.emptyText=`¿Cómo puedo ayudarte hoy?`,this.placeholder=`Enviar un mensaje a Agent`,this.headerTitle=`Agent`,this.hideHeader=!1,this.interceptor=!1,this._historyOpen=!1,this._inspectorOpen=!1,this._inspectorEnabled=!1}static#e=this.styles=Pe;willUpdate(e){(e.has(`backendUrl`)||e.has(`appName`)||e.has(`conversationUrl`))&&(this._chatController.initialize({backendUrl:this.backendUrl,conversationUrl:this.conversationUrl,appName:this.appName,inspector:this.hasAttribute(`inspector`)||this.inspector}),this._inspectorEnabled=this.hasAttribute(`inspector`)||this.inspector),e.has(`interceptor`)&&(this.interceptor?this.enableFetchInterceptor():tt.destroy())}enableFetchInterceptor(){console.warn(`Fetch interceptor is only available in development mode.`)}_handleSend(e){this._chatController.sendMessage(e.detail.content)}_handleNewThread(){this._chatController.startNewThread()}setAppContext(e){this._chatController.setAppContext(e)}_toggleHistory(){this._historyOpen=!this._historyOpen,this._historyOpen&&this._chatController.refreshConversations()}_handleSelectThread(e){console.log(`Selected conversation:`,e.detail.conversation),this._historyOpen=!1}_toggleInspector(){this._inspectorOpen=!this._inspectorOpen}render(){return O`
|
|
686
724
|
<div class="chat-layout">
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
725
|
+
${this.hideHeader?``:O`
|
|
726
|
+
<agent-chat-header
|
|
727
|
+
.title="${this.headerTitle}"
|
|
728
|
+
@new-thread="${this._handleNewThread}"
|
|
729
|
+
@toggle-history="${this._toggleHistory}"
|
|
730
|
+
></agent-chat-header>
|
|
731
|
+
`}
|
|
691
732
|
<agent-chat-history-list
|
|
692
733
|
.conversations="${this._chatController.conversations}"
|
|
693
734
|
?open="${this._historyOpen}"
|
|
@@ -696,18 +737,24 @@
|
|
|
696
737
|
<agent-chat-thread
|
|
697
738
|
.messages="${this._chatController.thread.messages}"
|
|
698
739
|
?isRunning="${this._chatController.thread.isRunning}"
|
|
699
|
-
.agentAvatar="${this.agentAvatar}"
|
|
740
|
+
.agentAvatar="${this.agentAvatar}"
|
|
741
|
+
.emptyText="${this.emptyText}">
|
|
700
742
|
</agent-chat-thread>
|
|
701
|
-
<agent-chat-composer
|
|
702
|
-
|
|
703
|
-
|
|
743
|
+
<agent-chat-composer
|
|
744
|
+
?isRunning="${this._chatController.thread.isRunning}"
|
|
745
|
+
.disclaimer="${this.disclaimer}"
|
|
746
|
+
.placeholder="${this.placeholder}"
|
|
747
|
+
@send="${this._handleSend}">
|
|
748
|
+
</agent-chat-composer>
|
|
749
|
+
|
|
750
|
+
${this._inspectorEnabled?O`
|
|
704
751
|
<button class="inspector-toggle" @click="${this._toggleInspector}" title="Inspector">
|
|
705
|
-
${
|
|
752
|
+
${Ue}
|
|
706
753
|
</button>
|
|
707
754
|
`:``}
|
|
708
755
|
|
|
709
|
-
${this._inspectorOpen?
|
|
756
|
+
${this._inspectorOpen?O`
|
|
710
757
|
<agent-inspector-window @close="${this._toggleInspector}"></agent-inspector-window>
|
|
711
758
|
`:``}
|
|
712
759
|
</div>
|
|
713
|
-
`}};
|
|
760
|
+
`}};V([z({type:String,attribute:`backend-url`})],$.prototype,`backendUrl`,void 0),V([z({type:String,attribute:`conversation-url`})],$.prototype,`conversationUrl`,void 0),V([z({type:String,attribute:`app-name`})],$.prototype,`appName`,void 0),V([z({type:String,attribute:`agent-avatar`})],$.prototype,`agentAvatar`,void 0),V([z({type:String,attribute:`disclaimer`})],$.prototype,`disclaimer`,void 0),V([z({type:String,attribute:`empty-text`})],$.prototype,`emptyText`,void 0),V([z({type:String,attribute:`placeholder`})],$.prototype,`placeholder`,void 0),V([z({type:String,attribute:`header-title`})],$.prototype,`headerTitle`,void 0),V([z({type:Boolean,attribute:`hide-header`})],$.prototype,`hideHeader`,void 0),V([z({type:Boolean,attribute:`interceptor`})],$.prototype,`interceptor`,void 0),V([B()],$.prototype,`_historyOpen`,void 0),V([B()],$.prototype,`_inspectorOpen`,void 0),V([B()],$.prototype,`_inspectorEnabled`,void 0),$=V([R(`agent-chat`)],$);function nt(e,t={}){let n=document.createElement(`agent-chat`);return Object.keys(t).forEach(e=>{e in n&&(n[e]=t[e])}),e.appendChild(n),n}function rt(){}Object.defineProperty(e,`AgentChat`,{enumerable:!0,get:function(){return $}}),e.ChatPortalService=Ze,e.FetchInterceptorService=et,e.chatPortalService=X,e.fetchInterceptorService=tt,e.mount=nt,e.register=rt});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "site-operator",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.9",
|
|
5
5
|
"description": "A framework-agnostic AI chat widget that acts as a copilot for host applications.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "jostvian",
|
|
@@ -61,7 +61,10 @@
|
|
|
61
61
|
]
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"dependencies": {
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@lucide/lab": "^0.1.2",
|
|
66
|
+
"lucide-static": "^0.562.0"
|
|
67
|
+
},
|
|
65
68
|
"peerDependencies": {
|
|
66
69
|
"@ag-ui/client": "^0.0.42"
|
|
67
70
|
},
|