site-operator 0.1.3 → 0.1.4

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 CHANGED
@@ -8,6 +8,8 @@ export declare class AgentChat extends LitElement {
8
8
  backendUrl: string;
9
9
  appName: string;
10
10
  agentAvatar: string;
11
+ disclaimer: string;
12
+ emptyText: string;
11
13
  interceptor: boolean;
12
14
  private _historyOpen;
13
15
  private _inspectorOpen;
@@ -1007,7 +1007,7 @@ var ChatMessage = class extends i {
1007
1007
  __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
1008
  var ChatThread = class extends i {
1009
1009
  constructor(...x) {
1010
- super(...x), this.messages = [], this.isRunning = !1, this.agentAvatar = "";
1010
+ super(...x), this.messages = [], this.isRunning = !1, this.agentAvatar = "", this.emptyText = "";
1011
1011
  }
1012
1012
  static #e = this.styles = styles$4;
1013
1013
  updated(x) {
@@ -1023,7 +1023,7 @@ var ChatThread = class extends i {
1023
1023
  return this.messages.length === 0 ? b`
1024
1024
  <div class="empty-state">
1025
1025
  ${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">¿Cómo puedo ayudarte hoy?</p>
1026
+ <p class="empty-text">${this.emptyText}</p>
1027
1027
  </div>
1028
1028
  ` : b`
1029
1029
  <div class="messages-list">
@@ -1039,7 +1039,7 @@ var ChatThread = class extends i {
1039
1039
  `;
1040
1040
  }
1041
1041
  };
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);
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), __decorate([n({ type: String })], ChatThread.prototype, "emptyText", void 0), ChatThread = __decorate([t("agent-chat-thread")], ChatThread);
1043
1043
  const styles$3 = i$1`
1044
1044
  :host {
1045
1045
  display: block;
@@ -1118,7 +1118,7 @@ const styles$3 = i$1`
1118
1118
  `;
1119
1119
  var ChatComposer = class extends i {
1120
1120
  constructor(...x) {
1121
- super(...x), this.isRunning = !1, this._value = "";
1121
+ super(...x), this.isRunning = !1, this.disclaimer = "", this._value = "";
1122
1122
  }
1123
1123
  static #e = this.styles = styles$3;
1124
1124
  _handleInput(x) {
@@ -1158,12 +1158,12 @@ var ChatComposer = class extends i {
1158
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}">${ArrowUpIcon}</button>`}
1159
1159
  </div>
1160
1160
  <p class="disclaimer">
1161
- Agent puede cometer errores. Verifica la información importante.
1161
+ ${this.disclaimer}
1162
1162
  </p>
1163
1163
  `;
1164
1164
  }
1165
1165
  };
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);
1166
+ __decorate([n({ type: Boolean })], ChatComposer.prototype, "isRunning", void 0), __decorate([n({ type: String })], ChatComposer.prototype, "disclaimer", 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
1167
  const styles$2 = i$1`
1168
1168
  :host {
1169
1169
  display: block;
@@ -1795,7 +1795,7 @@ var ChatController = class {
1795
1795
  const fetchInterceptorService = new FetchInterceptorService();
1796
1796
  var AgentChat = class extends i {
1797
1797
  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;
1798
+ super(...x), this._chatController = new ChatController(this), this.backendUrl = "http://localhost:8001/ag_ui", 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.interceptor = !1, this._historyOpen = !1, this._inspectorOpen = !1, this._inspectorEnabled = !1;
1799
1799
  }
1800
1800
  static #e = this.styles = styles;
1801
1801
  willUpdate(x) {
@@ -1841,9 +1841,14 @@ var AgentChat = class extends i {
1841
1841
  <agent-chat-thread
1842
1842
  .messages="${this._chatController.thread.messages}"
1843
1843
  ?isRunning="${this._chatController.thread.isRunning}"
1844
- .agentAvatar="${this.agentAvatar}">
1844
+ .agentAvatar="${this.agentAvatar}"
1845
+ .emptyText="${this.emptyText}">
1845
1846
  </agent-chat-thread>
1846
- <agent-chat-composer ?isRunning="${this._chatController.thread.isRunning}" @send="${this._handleSend}"></agent-chat-composer>
1847
+ <agent-chat-composer
1848
+ ?isRunning="${this._chatController.thread.isRunning}"
1849
+ .disclaimer="${this.disclaimer}"
1850
+ @send="${this._handleSend}">
1851
+ </agent-chat-composer>
1847
1852
 
1848
1853
  ${this._inspectorEnabled ? b`
1849
1854
  <button class="inspector-toggle" @click="${this._toggleInspector}" title="Inspector">
@@ -1868,6 +1873,12 @@ __decorate([n({
1868
1873
  type: String,
1869
1874
  attribute: "agent-avatar"
1870
1875
  })], AgentChat.prototype, "agentAvatar", void 0), __decorate([n({
1876
+ type: String,
1877
+ attribute: "disclaimer"
1878
+ })], AgentChat.prototype, "disclaimer", void 0), __decorate([n({
1879
+ type: String,
1880
+ attribute: "empty-text"
1881
+ })], AgentChat.prototype, "emptyText", void 0), __decorate([n({
1871
1882
  type: Boolean,
1872
1883
  attribute: "interceptor"
1873
1884
  })], 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);
@@ -333,10 +333,10 @@
333
333
  `}
334
334
  </div>
335
335
  </div>
336
- `}};H([B({type:Object})],G.prototype,`message`,void 0),H([B({type:Boolean})],G.prototype,`isLast`,void 0),H([B({type:Boolean})],G.prototype,`isStreaming`,void 0),H([B({type:String})],G.prototype,`agentAvatar`,void 0),G=H([z(`agent-chat-message`)],G);var K=class extends R{constructor(...e){super(...e),this.messages=[],this.isRunning=!1,this.agentAvatar=``}static#e=this.styles=Ue;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?k`
336
+ `}};H([B({type:Object})],G.prototype,`message`,void 0),H([B({type:Boolean})],G.prototype,`isLast`,void 0),H([B({type:Boolean})],G.prototype,`isStreaming`,void 0),H([B({type:String})],G.prototype,`agentAvatar`,void 0),G=H([z(`agent-chat-message`)],G);var K=class extends R{constructor(...e){super(...e),this.messages=[],this.isRunning=!1,this.agentAvatar=``,this.emptyText=``}static#e=this.styles=Ue;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?k`
337
337
  <div class="empty-state">
338
338
  ${this.agentAvatar?k`<img src="${this.agentAvatar}" alt="Agent Avatar" class="empty-avatar-img">`:k`<div class="empty-avatar">SM</div>`}
339
- <p class="empty-text">¿Cómo puedo ayudarte hoy?</p>
339
+ <p class="empty-text">${this.emptyText}</p>
340
340
  </div>
341
341
  `:k`
342
342
  <div class="messages-list">
@@ -349,7 +349,7 @@
349
349
  </agent-chat-message>
350
350
  `)}
351
351
  </div>
352
- `}};H([B({type:Array})],K.prototype,`messages`,void 0),H([B({type:Boolean})],K.prototype,`isRunning`,void 0),H([B({type:String})],K.prototype,`agentAvatar`,void 0),K=H([z(`agent-chat-thread`)],K);let Ge=c`
352
+ `}};H([B({type:Array})],K.prototype,`messages`,void 0),H([B({type:Boolean})],K.prototype,`isRunning`,void 0),H([B({type:String})],K.prototype,`agentAvatar`,void 0),H([B({type:String})],K.prototype,`emptyText`,void 0),K=H([z(`agent-chat-thread`)],K);let Ge=c`
353
353
  :host {
354
354
  display: block;
355
355
  padding: 1rem;
@@ -424,7 +424,7 @@
424
424
  font-size: 0.75rem;
425
425
  padding: 0.5rem;
426
426
  }
427
- `;var q=class extends R{constructor(...e){super(...e),this.isRunning=!1,this._value=``}static#e=this.styles=Ge;_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 k`
427
+ `;var q=class extends R{constructor(...e){super(...e),this.isRunning=!1,this.disclaimer=``,this._value=``}static#e=this.styles=Ge;_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 k`
428
428
  <div class="composer-container">
429
429
  <textarea
430
430
  placeholder="Enviar un mensaje a Agent"
@@ -438,9 +438,9 @@
438
438
  ${this.isRunning?k`<button class="action-button" @click="${this._handleStop}">${Be}</button>`:k`<button class="action-button" ?disabled="${!this._value.trim()}" @click="${this._handleSubmit}">${Le}</button>`}
439
439
  </div>
440
440
  <p class="disclaimer">
441
- Agent puede cometer errores. Verifica la información importante.
441
+ ${this.disclaimer}
442
442
  </p>
443
- `}};H([B({type:Boolean})],q.prototype,`isRunning`,void 0),H([V()],q.prototype,`_value`,void 0),H([Me(`textarea`)],q.prototype,`_textarea`,void 0),q=H([z(`agent-chat-composer`)],q);let Ke=c`
443
+ `}};H([B({type:Boolean})],q.prototype,`isRunning`,void 0),H([B({type:String})],q.prototype,`disclaimer`,void 0),H([V()],q.prototype,`_value`,void 0),H([Me(`textarea`)],q.prototype,`_textarea`,void 0),q=H([z(`agent-chat-composer`)],q);let Ke=c`
444
444
  :host {
445
445
  display: block;
446
446
  position: absolute;
@@ -682,7 +682,7 @@
682
682
  `)}
683
683
  ${this._stream.length===0?k`<div style="color: #9ca3af; text-align: center; padding: 20px;">No events yet</div>`:``}
684
684
  </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.eyJhdWQiOiIwZWZhNWFhNy04OWRiLTQ5MTYtYmZlNC0wNTM3MjhlZWY2M2QiLCJpc3MiOiJodHRwczovL3NrY290ZXN0LmIyY2xvZ2luLmNvbS8wZGI2ZGJ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_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`
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.eyJhdWQiOiIwZWZhNWFhNy04OWRiLTQ5MTYtYmZlNC0wNTM3MjhlZWY2M2QiLCJpc3MiOiJodHRwczovL3NrY290ZXN0LmIyY2xvZ2luLmNvbS8wZGI2ZGJjMy02OTA4LTQ1MTctYTdmMi04MWVhNjg1YTI1ZTIvdjIuMC8iLCJleHAiOjE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g`),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.disclaimer=`Agent puede cometer errores. Verifica la información importante.`,this.emptyText=`¿Cómo puedo ayudarte hoy?`,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`
686
686
  <div class="chat-layout">
687
687
  <agent-chat-header
688
688
  @new-thread="${this._handleNewThread}"
@@ -696,9 +696,14 @@
696
696
  <agent-chat-thread
697
697
  .messages="${this._chatController.thread.messages}"
698
698
  ?isRunning="${this._chatController.thread.isRunning}"
699
- .agentAvatar="${this.agentAvatar}">
699
+ .agentAvatar="${this.agentAvatar}"
700
+ .emptyText="${this.emptyText}">
700
701
  </agent-chat-thread>
701
- <agent-chat-composer ?isRunning="${this._chatController.thread.isRunning}" @send="${this._handleSend}"></agent-chat-composer>
702
+ <agent-chat-composer
703
+ ?isRunning="${this._chatController.thread.isRunning}"
704
+ .disclaimer="${this.disclaimer}"
705
+ @send="${this._handleSend}">
706
+ </agent-chat-composer>
702
707
 
703
708
  ${this._inspectorEnabled?k`
704
709
  <button class="inspector-toggle" @click="${this._toggleInspector}" title="Inspector">
@@ -710,4 +715,4 @@
710
715
  <agent-inspector-window @close="${this._toggleInspector}"></agent-inspector-window>
711
716
  `:``}
712
717
  </div>
713
- `}};H([B({type:String,attribute:`backend-url`})],$.prototype,`backendUrl`,void 0),H([B({type:String,attribute:`app-name`})],$.prototype,`appName`,void 0),H([B({type:String,attribute:`agent-avatar`})],$.prototype,`agentAvatar`,void 0),H([B({type:Boolean,attribute:`interceptor`})],$.prototype,`interceptor`,void 0),H([V()],$.prototype,`_historyOpen`,void 0),H([V()],$.prototype,`_inspectorOpen`,void 0),H([V()],$.prototype,`_inspectorEnabled`,void 0),$=H([z(`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=Xe,e.FetchInterceptorService=et,e.chatPortalService=Z,e.fetchInterceptorService=tt,e.mount=nt,e.register=rt});
718
+ `}};H([B({type:String,attribute:`backend-url`})],$.prototype,`backendUrl`,void 0),H([B({type:String,attribute:`app-name`})],$.prototype,`appName`,void 0),H([B({type:String,attribute:`agent-avatar`})],$.prototype,`agentAvatar`,void 0),H([B({type:String,attribute:`disclaimer`})],$.prototype,`disclaimer`,void 0),H([B({type:String,attribute:`empty-text`})],$.prototype,`emptyText`,void 0),H([B({type:Boolean,attribute:`interceptor`})],$.prototype,`interceptor`,void 0),H([V()],$.prototype,`_historyOpen`,void 0),H([V()],$.prototype,`_inspectorOpen`,void 0),H([V()],$.prototype,`_inspectorEnabled`,void 0),$=H([z(`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=Xe,e.FetchInterceptorService=et,e.chatPortalService=Z,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.3",
4
+ "version": "0.1.4",
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",