@copilotkitnext/web-inspector 1.51.4-next.7 → 1.51.4-next.8

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.umd.js CHANGED
@@ -54,12 +54,20 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
54
54
  */function Id(t,e){void 0===e&&(e=!1);var a=Ed.get(t.object);Rd(a.value,t.object,t.patches,"",e),t.patches.length&&Vd(a.value,t.patches);var h=t.patches;return h.length>0&&(t.patches=[],t.callback&&t.callback(h)),h}function Rd(t,e,a,h,r){if(e!==t){"function"==typeof e.toJSON&&(e=e.toJSON());for(var i=vd(e),n=vd(t),d=!1,o=n.length-1;o>=0;o--){var s=t[c=n[o]];if(!ud(e,c)||void 0===e[c]&&void 0!==s&&!1===Array.isArray(e))Array.isArray(t)===Array.isArray(e)?(r&&a.push({op:"test",path:h+"/"+xd(c),value:md(s)}),a.push({op:"remove",path:h+"/"+xd(c)}),d=!0):(r&&a.push({op:"test",path:h,value:t}),a.push({op:"replace",path:h,value:e}));else{var p=e[c];"object"==typeof s&&null!=s&&"object"==typeof p&&null!=p&&Array.isArray(s)===Array.isArray(p)?Rd(s,p,a,h+"/"+xd(c),r):s!==p&&(r&&a.push({op:"test",path:h+"/"+xd(c),value:md(s)}),a.push({op:"replace",path:h+"/"+xd(c),value:md(p)}))}}if(d||i.length!=n.length)for(o=0;o<i.length;o++){var c;ud(t,c=i[o])||void 0===e[c]||a.push({op:"add",path:h+"/"+xd(c),value:md(e[c])})}}}var Nd=Object.freeze({__proto__:null,compare:function(t,e,a){void 0===a&&(a=!1);var h=[];return Rd(t,e,h,"",a),h},generate:Id,observe:function(t,e){var a,h=function(t){return Ed.get(t)}(t);if(h){var r=function(t,e){return t.observers.get(e)}(h,e);a=r&&r.observer}else h=new Pd(t),Ed.set(t,h);if(a)return a;if(a={},h.value=md(t),e){a.callback=e,a.next=null;var i=function(){Id(a)},n=function(){clearTimeout(a.next),a.next=setTimeout(i)};"undefined"!=typeof window&&(window.addEventListener("mouseup",n),window.addEventListener("keyup",n),window.addEventListener("mousedown",n),window.addEventListener("keydown",n),window.addEventListener("change",n))}return a.patches=[],a.object=t,a.unobserve=function(){Id(a),clearTimeout(a.next),function(t,e){t.observers.delete(e.callback)}(h,a),"undefined"!=typeof window&&(window.removeEventListener("mouseup",n),window.removeEventListener("keyup",n),window.removeEventListener("mousedown",n),window.removeEventListener("keydown",n),window.removeEventListener("change",n))},h.observers.set(e,new $d(e,a)),a},unobserve:function(t,e){e.unobserve()}});Object.assign({},Od,Nd,{JsonPatchError:bd,deepClone:md,escapePathComponent:xd,unescapePathComponent:yd});var Zd=$n(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),Dd=$n(["LangGraphInterruptEvent","PredictState","Exit"]);On("type",[Ln({type:Pn(Zd.enum.TextMessageStart),messageId:_n(),parentMessageId:_n().optional(),role:_n().optional()}),Ln({type:Pn(Zd.enum.TextMessageContent),messageId:_n(),content:_n()}),Ln({type:Pn(Zd.enum.TextMessageEnd),messageId:_n()}),Ln({type:Pn(Zd.enum.ActionExecutionStart),actionExecutionId:_n(),actionName:_n(),parentMessageId:_n().optional()}),Ln({type:Pn(Zd.enum.ActionExecutionArgs),actionExecutionId:_n(),args:_n()}),Ln({type:Pn(Zd.enum.ActionExecutionEnd),actionExecutionId:_n()}),Ln({type:Pn(Zd.enum.ActionExecutionResult),actionName:_n(),actionExecutionId:_n(),result:_n()}),Ln({type:Pn(Zd.enum.AgentStateMessage),threadId:_n(),agentName:_n(),nodeName:_n(),runId:_n(),active:Hn(),role:_n(),state:_n(),running:Hn()}),Ln({type:Pn(Zd.enum.MetaEvent),name:Dd,value:Vn()}),Ln({type:Pn(Zd.enum.RunError),message:_n(),code:_n().optional()})]),Ln({id:_n(),role:_n(),content:_n(),parentMessageId:_n().optional()}),Ln({id:_n(),name:_n(),arguments:Vn(),parentMessageId:_n().optional()}),Ln({id:_n(),result:Vn(),actionExecutionId:_n(),actionName:_n()});var Fd,Bd,Ud={},jd={};function qd(){return Fd||(Fd=1,t=jd,Object.defineProperty(t,"__esModule",{value:!0}),t.Allow=t.ALL=t.COLLECTION=t.ATOM=t.SPECIAL=t.INF=t._INFINITY=t.INFINITY=t.NAN=t.BOOL=t.NULL=t.OBJ=t.ARR=t.NUM=t.STR=void 0,t.STR=1,t.NUM=2,t.ARR=4,t.OBJ=8,t.NULL=16,t.BOOL=32,t.NAN=64,t.INFINITY=128,t._INFINITY=256,t.INF=t.INFINITY|t._INFINITY,t.SPECIAL=t.NULL|t.BOOL|t.INF|t.NAN,t.ATOM=t.STR|t.NUM|t.SPECIAL,t.COLLECTION=t.ARR|t.OBJ,t.ALL=t.ATOM|t.COLLECTION,t.Allow={STR:t.STR,NUM:t.NUM,ARR:t.ARR,OBJ:t.OBJ,NULL:t.NULL,BOOL:t.BOOL,NAN:t.NAN,INFINITY:t.INFINITY,_INFINITY:t._INFINITY,INF:t.INF,SPECIAL:t.SPECIAL,ATOM:t.ATOM,COLLECTION:t.COLLECTION,ALL:t.ALL},t.default=t.Allow),jd;var t}Bd||(Bd=1,function(t){var e=Ud&&Ud.__createBinding||(Object.create?function(t,e,a,h){void 0===h&&(h=a);var r=Object.getOwnPropertyDescriptor(e,a);r&&!("get"in r?!e.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return e[a]}}),Object.defineProperty(t,h,r)}:function(t,e,a,h){void 0===h&&(h=a),t[h]=e[a]}),a=Ud&&Ud.__exportStar||function(t,a){for(var h in t)"default"===h||Object.prototype.hasOwnProperty.call(a,h)||e(a,t,h)};Object.defineProperty(t,"__esModule",{value:!0}),t.Allow=t.MalformedJSON=t.PartialJSON=t.parseJSON=t.parse=void 0;const h=qd();Object.defineProperty(t,"Allow",{enumerable:!0,get:function(){return h.Allow}}),a(qd(),t);class r extends Error{}t.PartialJSON=r;class i extends Error{}function n(t,e=h.Allow.ALL){if("string"!=typeof t)throw new TypeError("expecting str, got "+typeof t);if(!t.trim())throw new Error(`${t} is empty`);return d(t.trim(),e)}t.MalformedJSON=i,t.parseJSON=n;const d=(t,e)=>{const a=t.length;let n=0;const d=t=>{throw new r(`${t} at position ${n}`)},o=t=>{throw new i(`${t} at position ${n}`)},s=()=>(u(),n>=a&&d("Unexpected end of input"),'"'===t[n]?p():"{"===t[n]?c():"["===t[n]?l():"null"===t.substring(n,n+4)||h.Allow.NULL&e&&a-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):"true"===t.substring(n,n+4)||h.Allow.BOOL&e&&a-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):"false"===t.substring(n,n+5)||h.Allow.BOOL&e&&a-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):"Infinity"===t.substring(n,n+8)||h.Allow.INFINITY&e&&a-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):"-Infinity"===t.substring(n,n+9)||h.Allow._INFINITY&e&&1<a-n&&a-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):"NaN"===t.substring(n,n+3)||h.Allow.NAN&e&&a-n<3&&"NaN".startsWith(t.substring(n))?(n+=3,NaN):M()),p=()=>{const r=n;let i=!1;for(n++;n<a&&('"'!==t[n]||i&&"\\"===t[n-1]);)i="\\"===t[n]&&!i,n++;if('"'==t.charAt(n))try{return JSON.parse(t.substring(r,++n-Number(i)))}catch(t){o(String(t))}else if(h.Allow.STR&e)try{return JSON.parse(t.substring(r,n-Number(i))+'"')}catch(e){return JSON.parse(t.substring(r,t.lastIndexOf("\\"))+'"')}d("Unterminated string literal")},c=()=>{n++,u();const r={};try{for(;"}"!==t[n];){if(u(),n>=a&&h.Allow.OBJ&e)return r;const i=p();u(),n++;try{const t=s();r[i]=t}catch(t){if(h.Allow.OBJ&e)return r;throw t}u(),","===t[n]&&n++}}catch(t){if(h.Allow.OBJ&e)return r;d("Expected '}' at end of object")}return n++,r},l=()=>{n++;const a=[];try{for(;"]"!==t[n];)a.push(s()),u(),","===t[n]&&n++}catch(t){if(h.Allow.ARR&e)return a;d("Expected ']' at end of array")}return n++,a},M=()=>{if(0===n){"-"===t&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(a){if(h.Allow.NUM&e)try{return JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch(t){}o(String(a))}}const r=n;for("-"===t[n]&&n++;t[n]&&-1===",]}".indexOf(t[n]);)n++;n!=a||h.Allow.NUM&e||d("Unterminated number literal");try{return JSON.parse(t.substring(r,n))}catch(e){"-"===t.substring(r,n)&&d("Not sure what '-' is");try{return JSON.parse(t.substring(r,t.lastIndexOf("e")))}catch(t){o(String(t))}}},u=()=>{for(;n<a&&" \n\r\t".includes(t[n]);)n++};return s()},o=n;t.parse=o}(Ud)),new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Gd=(t=>(t.Disconnected="disconnected",t.Connected="connected",t.Connecting="connecting",t.Error="error",t))(Gd||{});function Wd(t,e,a,h){const r=Math.max(h,a.width-t.size.width-h),i=Math.max(h,a.height-t.size.height-h);return{x:Jd(e.x,h,r),y:Jd(e.y,h,i)}}function Xd(t,e,a){t.position=Wd(t,t.position,e,a)}function Kd(t,e,a){const h=t.position.x+t.size.width/2,r=t.position.y+t.size.height/2,i=h<e.width/2?"left":"right",n=r<e.height/2?"top":"bottom";t.anchor={horizontal:i,vertical:n};const d=Math.max(a,e.width-t.size.width-a),o=Math.max(a,e.height-t.size.height-a);t.anchorOffset={x:Jd("left"===i?t.position.x:e.width-t.position.x-t.size.width,a,d),y:Jd("top"===n?t.position.y:e.height-t.position.y-t.size.height,a,o)}}function Jd(t,e,a){return Math.min(Math.max(e,t),a)}function Yd(t){if("undefined"==typeof window)return null;const e=window.localStorage.getItem(t);if(e)try{const t=JSON.parse(e);if(t&&"object"==typeof t)return t}catch(t){}if("undefined"!=typeof document){const e=`${t}=`,a=document.cookie.split("; ").find(t=>t.startsWith(e));if(a){const t=a.substring(e.length);try{const e=JSON.parse(decodeURIComponent(t));if(e&&"object"==typeof e)return e}catch(t){return null}}}return null}function Qd(t){if(!t||"object"!=typeof t)return!1;const e=t;return!("left"!==e.horizontal&&"right"!==e.horizontal||"top"!==e.vertical&&"bottom"!==e.vertical)}function to(t){if(!t||"object"!=typeof t)return!1;const e=t;return eo(e.x)&&eo(e.y)}function eo(t){return"number"==typeof t&&Number.isFinite(t)}const ao="cpk-web-inspector",ho=16,ro=200,io="cpk:inspector:state",no="cpk:inspector:announcements",oo={width:48,height:48},so={width:840,height:560},po=["RUN_STARTED","RUN_FINISHED","RUN_ERROR","TEXT_MESSAGE_START","TEXT_MESSAGE_CONTENT","TEXT_MESSAGE_END","TOOL_CALL_START","TOOL_CALL_ARGS","TOOL_CALL_END","TOOL_CALL_RESULT","STATE_SNAPSHOT","STATE_DELTA","MESSAGES_SNAPSHOT","RAW_EVENT","CUSTOM_EVENT"];class co extends e.LitElement{constructor(){super(...arguments),this._core=null,this.coreSubscriber=null,this.coreUnsubscribe=null,this.runtimeStatus=null,this.coreProperties={},this.lastCoreError=null,this.agentSubscriptions=new Map,this.agentEvents=new Map,this.agentMessages=new Map,this.agentStates=new Map,this.flattenedEvents=[],this.eventCounter=0,this.contextStore={},this.pointerId=null,this.dragStart=null,this.dragOffset={x:0,y:0},this.isDragging=!1,this.pointerContext=null,this.isOpen=!1,this.draggedDuringInteraction=!1,this.ignoreNextButtonClick=!1,this.selectedMenu="ag-ui-events",this.contextMenuOpen=!1,this.dockMode="floating",this.previousBodyMargins=null,this.transitionTimeoutId=null,this.pendingSelectedContext=null,this.autoAttachCore=!0,this.attemptedAutoAttach=!1,this.cachedTools=[],this.toolSignature="",this.eventFilterText="",this.eventTypeFilter="all",this.announcementMarkdown=null,this.announcementHtml=null,this.announcementTimestamp=null,this.announcementPreviewText=null,this.hasUnseenAnnouncement=!1,this.announcementLoaded=!1,this.announcementLoadError=null,this.announcementPromise=null,this.showAnnouncementPreview=!0,this.contextState={button:{position:{x:ho,y:ho},size:{...oo},anchor:{horizontal:"right",vertical:"top"},anchorOffset:{x:ho,y:ho}},window:{position:{x:ho,y:ho},size:{...so},anchor:{horizontal:"right",vertical:"top"},anchorOffset:{x:ho,y:ho}}},this.hasCustomPosition={button:!1,window:!1},this.resizePointerId=null,this.resizeStart=null,this.resizeInitialSize=null,this.isResizing=!1,this.menuItems=[{key:"ag-ui-events",label:"AG-UI Events",icon:"Zap"},{key:"agents",label:"Agent",icon:"Bot"},{key:"frontend-tools",label:"Frontend Tools",icon:"Hammer"},{key:"agent-context",label:"Context",icon:"FileText"}],this.handlePointerDown=t=>{var e;if("floating"!==this.dockMode&&this.isOpen)return;const a=t.currentTarget,h="window"===(null==a?void 0:a.dataset.dragContext)?"window":"button",r=t.target;if("window"===h&&(null==r?void 0:r.closest("button")))return;this.pointerContext=h,this.measureContext(h),t.preventDefault(),this.pointerId=t.pointerId,this.dragStart={x:t.clientX,y:t.clientY};const i=this.contextState[h];this.dragOffset={x:t.clientX-i.position.x,y:t.clientY-i.position.y},this.isDragging=!1,this.draggedDuringInteraction=!1,this.ignoreNextButtonClick=!1,null===(e=null==a?void 0:a.setPointerCapture)||void 0===e||e.call(a,this.pointerId)},this.handlePointerMove=t=>{if(this.pointerId!==t.pointerId||!this.dragStart||!this.pointerContext)return;const e=Math.hypot(t.clientX-this.dragStart.x,t.clientY-this.dragStart.y);if(!this.isDragging&&e<6)return;t.preventDefault(),this.setDragging(!0),this.draggedDuringInteraction=!0;const a={x:t.clientX-this.dragOffset.x,y:t.clientY-this.dragOffset.y},h=this.constrainToViewport(a,this.pointerContext);this.contextState[this.pointerContext].position=h,this.updateHostTransform(this.pointerContext)},this.handlePointerUp=t=>{var e;if(this.pointerId!==t.pointerId)return;const a=t.currentTarget;(null==a?void 0:a.hasPointerCapture(this.pointerId))&&a.releasePointerCapture(this.pointerId);const h=null!==(e=this.pointerContext)&&void 0!==e?e:this.activeContext;this.isDragging&&this.pointerContext?(t.preventDefault(),this.setDragging(!1),"window"===this.pointerContext?(this.updateAnchorFromPosition(this.pointerContext),this.hasCustomPosition.window=!0,this.applyAnchorPosition(this.pointerContext)):"button"===this.pointerContext&&(this.snapButtonToCorner(),this.hasCustomPosition.button=!0,this.draggedDuringInteraction&&(this.ignoreNextButtonClick=!0))):"button"!==h||this.isOpen||this.draggedDuringInteraction||this.openInspector(),this.resetPointerTracking()},this.handlePointerCancel=t=>{if(this.pointerId!==t.pointerId)return;const e=t.currentTarget;(null==e?void 0:e.hasPointerCapture(this.pointerId))&&e.releasePointerCapture(this.pointerId),this.resetPointerTracking()},this.handleButtonClick=t=>{if(!this.isDragging)return this.ignoreNextButtonClick?(t.preventDefault(),void(this.ignoreNextButtonClick=!1)):void(this.isOpen||(t.preventDefault(),this.openInspector()));t.preventDefault()},this.handleClosePointerDown=t=>{t.stopPropagation(),t.preventDefault()},this.handleCloseClick=()=>{this.closeInspector()},this.handleResizePointerDown=t=>{var e;t.stopPropagation(),t.preventDefault(),this.hasCustomPosition.window=!0,this.isResizing=!0,this.resizePointerId=t.pointerId,this.resizeStart={x:t.clientX,y:t.clientY},this.resizeInitialSize={...this.contextState.window.size},document.body&&"floating"!==this.dockMode&&(document.body.style.transition="");const a=t.currentTarget;null===(e=null==a?void 0:a.setPointerCapture)||void 0===e||e.call(a,t.pointerId)},this.handleResizePointerMove=t=>{if(!this.isResizing||this.resizePointerId!==t.pointerId||!this.resizeStart||!this.resizeInitialSize)return;t.preventDefault();const e=t.clientX-this.resizeStart.x,a=t.clientY-this.resizeStart.y,h=this.contextState.window;"docked-left"===this.dockMode?(h.size=this.clampWindowSize({width:this.resizeInitialSize.width+e,height:h.size.height}),document.body&&(document.body.style.marginLeft=`${h.size.width}px`)):(h.size=this.clampWindowSize({width:this.resizeInitialSize.width+e,height:this.resizeInitialSize.height+a}),this.keepPositionWithinViewport("window"),this.updateAnchorFromPosition("window")),this.requestUpdate(),this.updateHostTransform("window")},this.handleResizePointerUp=t=>{if(this.resizePointerId!==t.pointerId)return;const e=t.currentTarget;(null==e?void 0:e.hasPointerCapture(this.resizePointerId))&&e.releasePointerCapture(this.resizePointerId),"floating"===this.dockMode&&(this.updateAnchorFromPosition("window"),this.applyAnchorPosition("window")),this.persistState(),this.resetResizeTracking()},this.handleResizePointerCancel=t=>{if(this.resizePointerId!==t.pointerId)return;const e=t.currentTarget;(null==e?void 0:e.hasPointerCapture(this.resizePointerId))&&e.releasePointerCapture(this.resizePointerId),"floating"===this.dockMode&&(this.updateAnchorFromPosition("window"),this.applyAnchorPosition("window")),this.persistState(),this.resetResizeTracking()},this.handleResize=()=>{this.measureContext("button"),this.applyAnchorPosition("button"),this.measureContext("window"),this.hasCustomPosition.window?this.applyAnchorPosition("window"):this.centerContext("window"),this.updateHostTransform()},this.contextOptions=[{key:"all-agents",label:"All Agents"}],this.selectedContext="all-agents",this.expandedRows=new Set,this.copiedEvents=new Set,this.expandedTools=new Set,this.expandedContextItems=new Set,this.copiedContextItems=new Set,this.handleClearEvents=()=>{"all-agents"===this.selectedContext?(this.agentEvents.clear(),this.flattenedEvents=[]):(this.agentEvents.delete(this.selectedContext),this.flattenedEvents=this.flattenedEvents.filter(t=>t.agentId!==this.selectedContext)),this.expandedRows.clear(),this.copiedEvents.clear(),this.requestUpdate()},this.handleGlobalPointerDown=t=>{if(!this.contextMenuOpen)return;t.composedPath().some(t=>{var e;return t instanceof HTMLElement&&"true"===(null===(e=t.dataset)||void 0===e?void 0:e.contextDropdownRoot)})||(this.contextMenuOpen=!1,this.requestUpdate())},this.handleDismissAnnouncement=()=>{this.markAnnouncementSeen()}}get core(){return this._core}set core(t){const e=this._core;e!==t&&(this.detachFromCore(),this._core=null!=t?t:null,this.requestUpdate("core",e),this._core&&this.attachToCore(this._core))}attachToCore(t){this.runtimeStatus=t.runtimeConnectionStatus,this.coreProperties=t.properties,this.lastCoreError=null,this.coreSubscriber={onRuntimeConnectionStatusChanged:({status:t})=>{this.runtimeStatus=t,this.requestUpdate()},onPropertiesChanged:({properties:t})=>{this.coreProperties=t,this.requestUpdate()},onError:({code:t,error:e})=>{this.lastCoreError={code:t,message:e.message},this.requestUpdate()},onAgentsChanged:({agents:t})=>{this.processAgentsChanged(t)},onContextChanged:({context:t})=>{this.contextStore=this.normalizeContextStore(t),this.requestUpdate()}},this.coreUnsubscribe=t.subscribe(this.coreSubscriber).unsubscribe,this.processAgentsChanged(t.agents),t.context&&(this.contextStore=this.normalizeContextStore(t.context))}detachFromCore(){this.coreUnsubscribe&&(this.coreUnsubscribe(),this.coreUnsubscribe=null),this.coreSubscriber=null,this.runtimeStatus=null,this.lastCoreError=null,this.coreProperties={},this.cachedTools=[],this.toolSignature="",this.teardownAgentSubscriptions()}teardownAgentSubscriptions(){for(const t of this.agentSubscriptions.values())t();this.agentSubscriptions.clear(),this.agentEvents.clear(),this.agentMessages.clear(),this.agentStates.clear(),this.flattenedEvents=[],this.eventCounter=0}processAgentsChanged(t){const e=new Set;for(const a of Object.values(t))(null==a?void 0:a.agentId)&&(e.add(a.agentId),this.subscribeToAgent(a));for(const t of Array.from(this.agentSubscriptions.keys()))e.has(t)||(this.unsubscribeFromAgent(t),this.agentEvents.delete(t),this.agentMessages.delete(t),this.agentStates.delete(t));this.updateContextOptions(e),this.refreshToolsSnapshot(),this.requestUpdate()}refreshToolsSnapshot(){if(!this._core)return void(this.cachedTools.length>0&&(this.cachedTools=[],this.toolSignature="",this.requestUpdate()));const t=this.extractToolsFromAgents(),e=JSON.stringify(t.map(t=>({agentId:t.agentId,name:t.name,type:t.type,hasDescription:Boolean(t.description),hasParameters:Boolean(t.parameters)})));e!==this.toolSignature&&(this.toolSignature=e,this.cachedTools=t,this.requestUpdate())}tryAutoAttachCore(){var t;if(this.attemptedAutoAttach||this._core||!this.autoAttachCore||"undefined"==typeof window)return;this.attemptedAutoAttach=!0;const e=window,a=[e.__COPILOTKIT_CORE__,null===(t=e.copilotkit)||void 0===t?void 0:t.core,e.copilotkitCore].find(t=>!!t&&"object"==typeof t);a&&(this.core=a)}subscribeToAgent(t){if(!t.agentId)return;const e=t.agentId;this.unsubscribeFromAgent(e);const a={onRunStartedEvent:({event:t})=>{this.recordAgentEvent(e,"RUN_STARTED",t)},onRunFinishedEvent:({event:t,result:a})=>{this.recordAgentEvent(e,"RUN_FINISHED",{event:t,result:a})},onRunErrorEvent:({event:t})=>{this.recordAgentEvent(e,"RUN_ERROR",t)},onTextMessageStartEvent:({event:t})=>{this.recordAgentEvent(e,"TEXT_MESSAGE_START",t)},onTextMessageContentEvent:({event:t,textMessageBuffer:a})=>{this.recordAgentEvent(e,"TEXT_MESSAGE_CONTENT",{event:t,textMessageBuffer:a})},onTextMessageEndEvent:({event:t,textMessageBuffer:a})=>{this.recordAgentEvent(e,"TEXT_MESSAGE_END",{event:t,textMessageBuffer:a})},onToolCallStartEvent:({event:t})=>{this.recordAgentEvent(e,"TOOL_CALL_START",t)},onToolCallArgsEvent:({event:t,toolCallBuffer:a,toolCallName:h,partialToolCallArgs:r})=>{this.recordAgentEvent(e,"TOOL_CALL_ARGS",{event:t,toolCallBuffer:a,toolCallName:h,partialToolCallArgs:r})},onToolCallEndEvent:({event:t,toolCallArgs:a,toolCallName:h})=>{this.recordAgentEvent(e,"TOOL_CALL_END",{event:t,toolCallArgs:a,toolCallName:h})},onToolCallResultEvent:({event:t})=>{this.recordAgentEvent(e,"TOOL_CALL_RESULT",t)},onStateSnapshotEvent:({event:a})=>{this.recordAgentEvent(e,"STATE_SNAPSHOT",a),this.syncAgentState(t)},onStateDeltaEvent:({event:a})=>{this.recordAgentEvent(e,"STATE_DELTA",a),this.syncAgentState(t)},onMessagesSnapshotEvent:({event:a})=>{this.recordAgentEvent(e,"MESSAGES_SNAPSHOT",a),this.syncAgentMessages(t)},onMessagesChanged:()=>{this.syncAgentMessages(t)},onRawEvent:({event:t})=>{this.recordAgentEvent(e,"RAW_EVENT",t)},onCustomEvent:({event:t})=>{this.recordAgentEvent(e,"CUSTOM_EVENT",t)}},{unsubscribe:h}=t.subscribe(a);this.agentSubscriptions.set(e,h),this.syncAgentMessages(t),this.syncAgentState(t),this.agentEvents.has(e)||this.agentEvents.set(e,[])}unsubscribeFromAgent(t){const e=this.agentSubscriptions.get(t);e&&(e(),this.agentSubscriptions.delete(t))}recordAgentEvent(t,e,a){var h;const r=`${t}:${++this.eventCounter}`,i=this.normalizeEventPayload(e,a),n={id:r,agentId:t,type:e,timestamp:Date.now(),payload:i},d=[n,...null!==(h=this.agentEvents.get(t))&&void 0!==h?h:[]].slice(0,200);this.agentEvents.set(t,d),this.flattenedEvents=[n,...this.flattenedEvents].slice(0,500),this.refreshToolsSnapshot(),this.requestUpdate()}syncAgentMessages(t){if(!(null==t?void 0:t.agentId))return;const e=this.normalizeAgentMessages(t.messages);e?this.agentMessages.set(t.agentId,e):this.agentMessages.delete(t.agentId),this.requestUpdate()}syncAgentState(t){if(!(null==t?void 0:t.agentId))return;const e=t.state;null==e?this.agentStates.delete(t.agentId):this.agentStates.set(t.agentId,this.sanitizeForLogging(e)),this.requestUpdate()}updateContextOptions(t){const e=[{key:"all-agents",label:"All Agents"},...Array.from(t).sort((t,e)=>t.localeCompare(e)).map(t=>({key:t,label:t}))];(this.contextOptions.length!==e.length||this.contextOptions.some((t,a)=>{var h;return t.key!==(null===(h=e[a])||void 0===h?void 0:h.key)}))&&(this.contextOptions=e);const a=this.pendingSelectedContext;if(a){"all-agents"===a||t.has(a)?(this.selectedContext!==a&&(this.selectedContext=a,this.expandedRows.clear()),this.pendingSelectedContext=null):t.size>0&&(this.pendingSelectedContext=null)}if(!e.some(t=>t.key===this.selectedContext)&&null===this.pendingSelectedContext){let e="all-agents";t.has("default")?e="default":t.size>0&&(e=Array.from(t).sort((t,e)=>t.localeCompare(e))[0]),this.selectedContext!==e&&(this.selectedContext=e,this.expandedRows.clear(),this.persistState())}}getEventsForSelectedContext(){var t;return"all-agents"===this.selectedContext?this.flattenedEvents:null!==(t=this.agentEvents.get(this.selectedContext))&&void 0!==t?t:[]}filterEvents(t){const e=this.eventFilterText.trim().toLowerCase();return t.filter(t=>{if("all"!==this.eventTypeFilter&&t.type!==this.eventTypeFilter)return!1;if(!e)return!0;const a=this.stringifyPayload(t.payload,!1).toLowerCase();return t.type.toLowerCase().includes(e)||t.agentId.toLowerCase().includes(e)||a.includes(e)})}getLatestStateForAgent(t){var e;if(this.agentStates.has(t)){const e=this.agentStates.get(t);return void 0===e?null:e}const a=(null!==(e=this.agentEvents.get(t))&&void 0!==e?e:[]).find(t=>"STATE_SNAPSHOT"===t.type);return a?a.payload:null}getLatestMessagesForAgent(t){const e=this.agentMessages.get(t);return null!=e?e:null}getAgentStatus(t){var e;const a=null!==(e=this.agentEvents.get(t))&&void 0!==e?e:[];if(0===a.length)return"idle";const h=a.find(t=>"RUN_STARTED"===t.type||"RUN_FINISHED"===t.type||"RUN_ERROR"===t.type);if(!h)return"idle";if("RUN_ERROR"===h.type)return"error";if("RUN_STARTED"===h.type){const t=a.find(t=>"RUN_FINISHED"===t.type&&t.timestamp>h.timestamp);return t?"idle":"running"}return"idle"}getAgentStats(t){var e,a,h,r;const i=null!==(e=this.agentEvents.get(t))&&void 0!==e?e:[],n=this.agentMessages.get(t),d=n?n.reduce((t,e)=>{var a,h;return t+(null!==(h=null===(a=e.toolCalls)||void 0===a?void 0:a.length)&&void 0!==h?h:0)},0):i.filter(t=>"TOOL_CALL_END"===t.type).length,o=null!==(a=null==n?void 0:n.length)&&void 0!==a?a:0;return{totalEvents:i.length,lastActivity:null!==(r=null===(h=i[0])||void 0===h?void 0:h.timestamp)&&void 0!==r?r:null,messages:o,toolCalls:d,errors:i.filter(t=>"RUN_ERROR"===t.type).length}}renderToolCallDetails(t){return Array.isArray(t)&&0!==t.length?e.html`
55
55
  <div class="mt-2 space-y-2">
56
56
  ${t.map((t,a)=>{var h,r,i,n;const d=null!==(i=null!==(r=null===(h=t.function)||void 0===h?void 0:h.name)&&void 0!==r?r:t.toolName)&&void 0!==i?i:"Unknown function",o="string"==typeof(null==t?void 0:t.id)?t.id:`tool-call-${a+1}`,s=this.formatToolCallArguments(null===(n=t.function)||void 0===n?void 0:n.arguments);return e.html`
57
- <div class="rounded-md border border-gray-200 bg-gray-50 p-3 text-xs text-gray-700">
58
- <div class="flex flex-wrap items-center justify-between gap-1 font-medium text-gray-900">
57
+ <div
58
+ class="rounded-md border border-gray-200 bg-gray-50 p-3 text-xs text-gray-700"
59
+ >
60
+ <div
61
+ class="flex flex-wrap items-center justify-between gap-1 font-medium text-gray-900"
62
+ >
59
63
  <span>${d}</span>
60
64
  <span class="text-[10px] text-gray-500">ID: ${o}</span>
61
65
  </div>
62
- ${s?e.html`<pre class="mt-2 overflow-auto rounded bg-white p-2 text-[11px] leading-relaxed text-gray-800">${s}</pre>`:e.nothing}
66
+ ${s?e.html`<pre
67
+ class="mt-2 overflow-auto rounded bg-white p-2 text-[11px] leading-relaxed text-gray-800"
68
+ >
69
+ ${s}</pre
70
+ >`:e.nothing}
63
71
  </div>
64
72
  `})}
65
73
  </div>
@@ -77,10 +85,17 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
77
85
  @click=${this.handleButtonClick}
78
86
  >
79
87
  ${this.renderAnnouncementPreview()}
80
- <img src=${"a1f6528fccd26dea.svg"} alt="Inspector logo" class="h-5 w-auto" loading="lazy" />
88
+ <img
89
+ src=${"a1f6528fccd26dea.svg"}
90
+ alt="Inspector logo"
91
+ class="h-5 w-auto"
92
+ loading="lazy"
93
+ />
81
94
  </button>
82
95
  `}renderWindow(){const t=this.contextState.window,a="floating"!==this.dockMode,h=this.hasAttribute("data-transitioning"),r=a?this.getDockedWindowStyles():{width:`${Math.round(t.size.width)}px`,height:`${Math.round(t.size.height)}px`,minWidth:"600px",minHeight:"200px"},i=this.contextOptions.length>0,n=i?this.renderContextDropdown():e.nothing,d=this.getCoreStatusSummary(),o=i?n:e.html`
83
- <div class="flex items-center gap-2 rounded-md border border-dashed border-gray-200 px-2 py-1 text-xs text-gray-400">
96
+ <div
97
+ class="flex items-center gap-2 rounded-md border border-dashed border-gray-200 px-2 py-1 text-xs text-gray-400"
98
+ >
84
99
  <span>${this.renderIcon("Bot")}</span>
85
100
  <span class="truncate">No agents available</span>
86
101
  </div>
@@ -102,7 +117,9 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
102
117
  @pointercancel=${this.handleResizePointerCancel}
103
118
  ></div>
104
119
  `:e.nothing}
105
- <div class="flex flex-1 flex-col overflow-hidden bg-white text-gray-800">
120
+ <div
121
+ class="flex flex-1 flex-col overflow-hidden bg-white text-gray-800"
122
+ >
106
123
  <div
107
124
  class="drag-handle relative z-30 flex flex-col border-b border-gray-200 bg-white/95 backdrop-blur-sm ${a?"":this.isDragging&&"window"===this.pointerContext?"cursor-grabbing":"cursor-grab"}"
108
125
  data-drag-context="window"
@@ -113,12 +130,15 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
113
130
  >
114
131
  <div class="flex flex-wrap items-center gap-3 px-4 py-3">
115
132
  <div class="flex items-center min-w-0">
116
- <img src=${"7a3b31978162670a.svg"} alt="Inspector logo" class="h-6 w-auto" loading="lazy" />
133
+ <img
134
+ src=${"7a3b31978162670a.svg"}
135
+ alt="Inspector logo"
136
+ class="h-6 w-auto"
137
+ loading="lazy"
138
+ />
117
139
  </div>
118
140
  <div class="ml-auto flex min-w-0 items-center gap-2">
119
- <div class="min-w-[160px] max-w-xs">
120
- ${o}
121
- </div>
141
+ <div class="min-w-[160px] max-w-xs">${o}</div>
122
142
  <div class="flex items-center gap-1">
123
143
  ${this.renderDockControls()}
124
144
  <button
@@ -133,7 +153,9 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
133
153
  </div>
134
154
  </div>
135
155
  </div>
136
- <div class="flex flex-wrap items-center gap-2 border-t border-gray-100 px-3 py-2 text-xs">
156
+ <div
157
+ class="flex flex-wrap items-center gap-2 border-t border-gray-100 px-3 py-2 text-xs"
158
+ >
137
159
  ${this.menuItems.map(({key:t,label:a,icon:h})=>{const r=this.selectedMenu===t,i=["inline-flex items-center gap-2 rounded-md px-3 py-2 transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-300",r?"bg-gray-900 text-white shadow-sm":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"].join(" ");return e.html`
138
160
  <button
139
161
  type="button"
@@ -141,7 +163,9 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
141
163
  aria-pressed=${r}
142
164
  @click=${()=>this.handleMenuSelect(t)}
143
165
  >
144
- <span class="text-gray-400 ${r?"text-white":""}">
166
+ <span
167
+ class="text-gray-400 ${r?"text-white":""}"
168
+ >
145
169
  ${this.renderIcon(h)}
146
170
  </span>
147
171
  <span>${a}</span>
@@ -149,27 +173,30 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
149
173
  `})}
150
174
  </div>
151
175
  </div>
152
- <div class="flex flex-1 flex-col overflow-hidden">
153
- <div class="flex-1 overflow-auto">
154
- ${this.renderAnnouncementPanel()}
155
- ${this.renderCoreWarningBanner()}
156
- ${this.renderMainContent()}
157
- <slot></slot>
158
- </div>
159
- <div class="border-t border-gray-200 bg-gray-50 px-4 py-2">
160
- <div
161
- class="flex items-center gap-2 rounded-md px-3 py-2 text-xs ${d.tone} w-full overflow-hidden my-1"
162
- title=${d.description}
176
+ <div class="flex flex-1 flex-col overflow-hidden">
177
+ <div class="flex-1 overflow-auto">
178
+ ${this.renderAnnouncementPanel()}
179
+ ${this.renderCoreWarningBanner()} ${this.renderMainContent()}
180
+ <slot></slot>
181
+ </div>
182
+ <div class="border-t border-gray-200 bg-gray-50 px-4 py-2">
183
+ <div
184
+ class="flex items-center gap-2 rounded-md px-3 py-2 text-xs ${d.tone} w-full overflow-hidden my-1"
185
+ title=${d.description}
186
+ >
187
+ <span
188
+ class="flex h-6 w-6 items-center justify-center rounded bg-white/60"
189
+ >
190
+ ${this.renderIcon("Activity")}
191
+ </span>
192
+ <span class="font-medium">${d.label}</span>
193
+ <span class="truncate text-[11px] opacity-80"
194
+ >${d.description}</span
163
195
  >
164
- <span class="flex h-6 w-6 items-center justify-center rounded bg-white/60">
165
- ${this.renderIcon("Activity")}
166
- </span>
167
- <span class="font-medium">${d.label}</span>
168
- <span class="truncate text-[11px] opacity-80">${d.description}</span>
169
- </div>
170
196
  </div>
171
197
  </div>
172
198
  </div>
199
+ </div>
173
200
  <div
174
201
  class="resize-handle pointer-events-auto absolute bottom-1 right-1 flex h-5 w-5 cursor-nwse-resize items-center justify-center text-gray-400 transition hover:text-gray-600"
175
202
  role="presentation"
@@ -213,33 +240,52 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
213
240
  ${this.renderIcon("Maximize2")}
214
241
  </button>
215
242
  `}getDockedWindowStyles(){return"docked-left"===this.dockMode?{position:"fixed",top:"0",left:"0",bottom:"0",width:`${Math.round(this.contextState.window.size.width)}px`,height:"100vh",minWidth:"420px",borderRadius:"0"}:{width:`${Math.round(this.contextState.window.size.width)}px`,height:`${Math.round(this.contextState.window.size.height)}px`,minWidth:"600px",minHeight:"200px"}}handleDockClick(t){this.setDockMode(t)}serializeAttributes(t){return Object.entries(t).filter(([t,e])=>"key"!==t&&null!=e&&""!==e).map(([t,e])=>`${t}="${String(e).replace(/"/g,"&quot;")}"`).join(" ")}sanitizeForLogging(t,e=0,a=new WeakSet){if(void 0===t)return"[undefined]";if(null===t||"number"==typeof t||"boolean"==typeof t)return t;if("string"==typeof t)return t;if("bigint"==typeof t||"symbol"==typeof t||"function"==typeof t)return String(t);if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return e>=4?"[Truncated depth]":t.map(t=>this.sanitizeForLogging(t,e+1,a));if("object"==typeof t){if(a.has(t))return"[Circular]";if(a.add(t),e>=4)return"[Truncated depth]";const h={};for(const[r,i]of Object.entries(t))h[r]=this.sanitizeForLogging(i,e+1,a);return h}return String(t)}normalizeEventPayload(t,e){if(e&&"object"==typeof e&&"event"in e){const{event:t,...a}=e,h=0===Object.keys(a).length?t:{event:t,...a};return this.sanitizeForLogging(h)}return this.sanitizeForLogging(e)}normalizeMessageContent(t){if("string"==typeof t)return t;if(t&&"object"==typeof t&&"text"in t){const e=t.text;if("string"==typeof e)return e}if(null==t)return"";if("object"==typeof t)try{return JSON.stringify(this.sanitizeForLogging(t))}catch(t){return""}return String(t)}normalizeToolCalls(t){return Array.isArray(t)?t.map(t=>{if(!t||"object"!=typeof t)return null;const e=t,a=e.function,h="string"==typeof(null==a?void 0:a.name)?a.name:"string"==typeof e.toolName?e.toolName:void 0,r=a&&"arguments"in a?a.arguments:e.arguments,i={id:"string"==typeof e.id?e.id:void 0,toolName:"string"==typeof e.toolName?e.toolName:h,status:"string"==typeof e.status?e.status:void 0};return h&&(i.function={name:h,arguments:this.sanitizeForLogging(r)}),i}).filter(t=>Boolean(t)):[]}normalizeAgentMessage(t){if(!t||"object"!=typeof t)return null;const e=t,a="string"==typeof e.role?e.role:"unknown",h=this.normalizeMessageContent(e.content),r=this.normalizeToolCalls(e.toolCalls);return{id:"string"==typeof e.id?e.id:void 0,role:a,contentText:h,contentRaw:void 0!==e.content?this.sanitizeForLogging(e.content):void 0,toolCalls:r}}normalizeAgentMessages(t){if(!Array.isArray(t))return null;return t.map(t=>this.normalizeAgentMessage(t)).filter(t=>null!==t)}normalizeContextStore(t){if(!t||"object"!=typeof t)return{};const e={};for(const[a,h]of Object.entries(t))if(h&&"object"==typeof h&&"value"in h){const t=h,r="string"==typeof t.description&&t.description.trim().length>0?t.description:void 0;e[a]={description:r,value:t.value}}else e[a]={value:h};return e}getSelectedMenu(){const t=this.menuItems.find(t=>t.key===this.selectedMenu);return null!=t?t:this.menuItems[0]}renderCoreWarningBanner(){return this._core?e.nothing:e.html`
216
- <div class="mx-4 my-3 flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800">
217
- <span class="mt-0.5 shrink-0 text-amber-600">${this.renderIcon("AlertTriangle")}</span>
243
+ <div
244
+ class="mx-4 my-3 flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800"
245
+ >
246
+ <span class="mt-0.5 shrink-0 text-amber-600"
247
+ >${this.renderIcon("AlertTriangle")}</span
248
+ >
218
249
  <div class="space-y-1">
219
- <div class="font-semibold text-amber-900">CopilotKit core not attached</div>
250
+ <div class="font-semibold text-amber-900">
251
+ CopilotKit core not attached
252
+ </div>
220
253
  <p class="text-[11px] leading-snug text-amber-800">
221
- Pass a live <code>CopilotKitCore</code> instance to <code>&lt;cpk-web-inspector&gt;</code> or expose it on
254
+ Pass a live <code>CopilotKitCore</code> instance to
255
+ <code>&lt;cpk-web-inspector&gt;</code> or expose it on
222
256
  <code>window.__COPILOTKIT_CORE__</code> for auto-attach.
223
257
  </p>
224
258
  </div>
225
259
  </div>
226
260
  `}getCoreStatusSummary(){var t,e;if(!this._core)return{label:"Core not attached",tone:"border border-amber-200 bg-amber-50 text-amber-800",description:"Pass a CopilotKitCore instance to <cpk-web-inspector> or enable auto-attach."};const a=null!==(t=this.runtimeStatus)&&void 0!==t?t:Gd.Disconnected,h=null===(e=this.lastCoreError)||void 0===e?void 0:e.message;return a===Gd.Error?{label:"Runtime error",tone:"border border-rose-200 bg-rose-50 text-rose-700",description:null!=h?h:"CopilotKit runtime reported an error."}:a===Gd.Connecting?{label:"Connecting",tone:"border border-amber-200 bg-amber-50 text-amber-800",description:"Waiting for CopilotKit runtime to finish connecting."}:a===Gd.Connected?{label:"Connected",tone:"border border-emerald-200 bg-emerald-50 text-emerald-700",description:"Live runtime connection established."}:{label:"Disconnected",tone:"border border-gray-200 bg-gray-50 text-gray-700",description:null!=h?h:"Waiting for CopilotKit runtime to connect."}}renderMainContent(){return"ag-ui-events"===this.selectedMenu?this.renderEventsTable():"agents"===this.selectedMenu?this.renderAgentsView():"frontend-tools"===this.selectedMenu?this.renderToolsView():"agent-context"===this.selectedMenu?this.renderContextView():e.nothing}renderEventsTable(){const t=this.getEventsForSelectedContext(),a=this.filterEvents(t),h="all-agents"===this.selectedContext?"all agents":`agent ${this.selectedContext}`;return 0===t.length?e.html`
227
- <div class="flex h-full items-center justify-center px-4 py-8 text-center">
261
+ <div
262
+ class="flex h-full items-center justify-center px-4 py-8 text-center"
263
+ >
228
264
  <div class="max-w-md">
229
- <div class="mb-3 flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8">
265
+ <div
266
+ class="mb-3 flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8"
267
+ >
230
268
  ${this.renderIcon("Zap")}
231
269
  </div>
232
270
  <p class="text-sm text-gray-600">No events yet</p>
233
- <p class="mt-2 text-xs text-gray-500">Trigger an agent run to see live activity.</p>
271
+ <p class="mt-2 text-xs text-gray-500">
272
+ Trigger an agent run to see live activity.
273
+ </p>
234
274
  </div>
235
275
  </div>
236
276
  `:0===a.length?e.html`
237
- <div class="flex h-full items-center justify-center px-4 py-8 text-center">
277
+ <div
278
+ class="flex h-full items-center justify-center px-4 py-8 text-center"
279
+ >
238
280
  <div class="max-w-md space-y-3">
239
- <div class="flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8">
281
+ <div
282
+ class="flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8"
283
+ >
240
284
  ${this.renderIcon("Filter")}
241
285
  </div>
242
- <p class="text-sm text-gray-600">No events match the current filters.</p>
286
+ <p class="text-sm text-gray-600">
287
+ No events match the current filters.
288
+ </p>
243
289
  <div>
244
290
  <button
245
291
  type="button"
@@ -254,7 +300,9 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
254
300
  </div>
255
301
  `:e.html`
256
302
  <div class="flex h-full flex-col">
257
- <div class="flex flex-col gap-1.5 border-b border-gray-200 bg-white px-4 py-2.5">
303
+ <div
304
+ class="flex flex-col gap-1.5 border-b border-gray-200 bg-white px-4 py-2.5"
305
+ >
258
306
  <div class="flex flex-wrap items-center gap-2">
259
307
  <div class="relative min-w-[200px] flex-1">
260
308
  <input
@@ -271,7 +319,9 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
271
319
  @change=${this.handleEventTypeChange}
272
320
  >
273
321
  <option value="all">All event types</option>
274
- ${po.map(t=>e.html`<option value=${t}>${t.toLowerCase().replace(/_/g," ")}</option>`)}
322
+ ${po.map(t=>e.html`<option value=${t}>
323
+ ${t.toLowerCase().replace(/_/g," ")}
324
+ </option>`)}
275
325
  </select>
276
326
  <div class="flex items-center gap-1 text-[11px]">
277
327
  <button
@@ -310,23 +360,32 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
310
360
  </div>
311
361
  </div>
312
362
  <div class="text-[11px] text-gray-500">
313
- Showing ${a.length} of ${t.length}${"all-agents"===this.selectedContext?"":` for ${h}`}
363
+ Showing ${a.length} of
364
+ ${t.length}${"all-agents"===this.selectedContext?"":` for ${h}`}
314
365
  </div>
315
366
  </div>
316
367
  <div class="relative h-full w-full overflow-y-auto overflow-x-hidden">
317
368
  <table class="w-full table-fixed border-collapse text-xs box-border">
318
369
  <thead class="sticky top-0 z-10">
319
370
  <tr class="bg-white">
320
- <th class="border-b border-gray-200 bg-white px-3 py-2 text-left font-medium text-gray-900">
371
+ <th
372
+ class="border-b border-gray-200 bg-white px-3 py-2 text-left font-medium text-gray-900"
373
+ >
321
374
  Agent
322
375
  </th>
323
- <th class="border-b border-gray-200 bg-white px-3 py-2 text-left font-medium text-gray-900">
376
+ <th
377
+ class="border-b border-gray-200 bg-white px-3 py-2 text-left font-medium text-gray-900"
378
+ >
324
379
  Time
325
380
  </th>
326
- <th class="border-b border-gray-200 bg-white px-3 py-2 text-left font-medium text-gray-900">
381
+ <th
382
+ class="border-b border-gray-200 bg-white px-3 py-2 text-left font-medium text-gray-900"
383
+ >
327
384
  Event Type
328
385
  </th>
329
- <th class="border-b border-gray-200 bg-white px-3 py-2 text-left font-medium text-gray-900">
386
+ <th
387
+ class="border-b border-gray-200 bg-white px-3 py-2 text-left font-medium text-gray-900"
388
+ >
330
389
  AG-UI Event
331
390
  </th>
332
391
  </tr>
@@ -337,10 +396,16 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
337
396
  class="${h} cursor-pointer transition hover:bg-blue-50/50"
338
397
  @click=${()=>this.toggleRowExpansion(t.id)}
339
398
  >
340
- <td class="border-l border-r border-b border-gray-200 px-3 py-2">
341
- <span class="font-mono text-[11px] text-gray-600">${t.agentId}</span>
399
+ <td
400
+ class="border-l border-r border-b border-gray-200 px-3 py-2"
401
+ >
402
+ <span class="font-mono text-[11px] text-gray-600"
403
+ >${t.agentId}</span
404
+ >
342
405
  </td>
343
- <td class="border-r border-b border-gray-200 px-3 py-2 font-mono text-[11px] text-gray-600">
406
+ <td
407
+ class="border-r border-b border-gray-200 px-3 py-2 font-mono text-[11px] text-gray-600"
408
+ >
344
409
  <span title=${new Date(t.timestamp).toLocaleString()}>
345
410
  ${new Date(t.timestamp).toLocaleTimeString()}
346
411
  </span>
@@ -348,10 +413,16 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
348
413
  <td class="border-r border-b border-gray-200 px-3 py-2">
349
414
  <span class=${r}>${t.type}</span>
350
415
  </td>
351
- <td class="border-r border-b border-gray-200 px-3 py-2 font-mono text-[10px] text-gray-600 ${o?"":"truncate max-w-xs"}">
416
+ <td
417
+ class="border-r border-b border-gray-200 px-3 py-2 font-mono text-[10px] text-gray-600 ${o?"":"truncate max-w-xs"}"
418
+ >
352
419
  ${o?e.html`
353
420
  <div class="group relative">
354
- <pre class="m-0 whitespace-pre-wrap break-words text-[10px] font-mono text-gray-600">${d}</pre>
421
+ <pre
422
+ class="m-0 whitespace-pre-wrap break-words text-[10px] font-mono text-gray-600"
423
+ >
424
+ ${d}</pre
425
+ >
355
426
  <button
356
427
  class="absolute right-0 top-0 cursor-pointer rounded px-2 py-1 text-[10px] opacity-0 transition group-hover:opacity-100 ${this.copiedEvents.has(t.id)?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600 hover:bg-gray-200 hover:text-gray-900"}"
357
428
  @click=${e=>{e.stopPropagation(),this.copyToClipboard(d,t.id)}}
@@ -368,13 +439,19 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
368
439
  </div>
369
440
  </div>
370
441
  `}handleEventFilterInput(t){var e;const a=t.target;this.eventFilterText=null!==(e=null==a?void 0:a.value)&&void 0!==e?e:"",this.requestUpdate()}handleEventTypeChange(t){const e=t.target,a=null==e?void 0:e.value;a&&(this.eventTypeFilter=a,this.requestUpdate())}resetEventFilters(){this.eventFilterText="",this.eventTypeFilter="all",this.requestUpdate()}exportEvents(t){try{const e=JSON.stringify(t,null,2),a=new Blob([e],{type:"application/json"}),h=URL.createObjectURL(a),r=document.createElement("a");r.href=h,r.download=`copilotkit-events-${Date.now()}.json`,r.click(),URL.revokeObjectURL(h)}catch(t){console.error("Failed to export events",t)}}renderAgentsView(){if("all-agents"===this.selectedContext)return e.html`
371
- <div class="flex h-full items-center justify-center px-4 py-8 text-center">
442
+ <div
443
+ class="flex h-full items-center justify-center px-4 py-8 text-center"
444
+ >
372
445
  <div class="max-w-md">
373
- <div class="mb-3 flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8">
446
+ <div
447
+ class="mb-3 flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8"
448
+ >
374
449
  ${this.renderIcon("Bot")}
375
450
  </div>
376
451
  <p class="text-sm text-gray-600">No agent selected</p>
377
- <p class="mt-2 text-xs text-gray-500">Select an agent from the dropdown above to view details.</p>
452
+ <p class="mt-2 text-xs text-gray-500">
453
+ Select an agent from the dropdown above to view details.
454
+ </p>
378
455
  </div>
379
456
  </div>
380
457
  `;const t=this.selectedContext,a=this.getAgentStatus(t),h=this.getAgentStats(t),r=this.getLatestStateForAgent(t),i=this.getLatestMessagesForAgent(t);return e.html`
@@ -383,18 +460,27 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
383
460
  <div class="rounded-lg border border-gray-200 bg-white p-4">
384
461
  <div class="flex items-start justify-between mb-4">
385
462
  <div class="flex items-center gap-3">
386
- <div class="flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 text-blue-600">
463
+ <div
464
+ class="flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 text-blue-600"
465
+ >
387
466
  ${this.renderIcon("Bot")}
388
467
  </div>
389
468
  <div>
390
469
  <h3 class="font-semibold text-sm text-gray-900">${t}</h3>
391
- <span class="inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium ${{running:"bg-emerald-50 text-emerald-700",idle:"bg-gray-100 text-gray-600",error:"bg-rose-50 text-rose-700"}[a]} relative -translate-y-[2px]">
392
- <span class="h-1.5 w-1.5 rounded-full ${"running"===a?"bg-emerald-500 animate-pulse":"error"===a?"bg-rose-500":"bg-gray-400"}"></span>
470
+ <span
471
+ class="inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium ${{running:"bg-emerald-50 text-emerald-700",idle:"bg-gray-100 text-gray-600",error:"bg-rose-50 text-rose-700"}[a]} relative -translate-y-[2px]"
472
+ >
473
+ <span
474
+ class="h-1.5 w-1.5 rounded-full ${"running"===a?"bg-emerald-500 animate-pulse":"error"===a?"bg-rose-500":"bg-gray-400"}"
475
+ ></span>
393
476
  ${a.charAt(0).toUpperCase()+a.slice(1)}
394
477
  </span>
395
478
  </div>
396
479
  </div>
397
- ${h.lastActivity?e.html`<span class="text-xs text-gray-500">Last activity: ${new Date(h.lastActivity).toLocaleTimeString()}</span>`:e.nothing}
480
+ ${h.lastActivity?e.html`<span class="text-xs text-gray-500"
481
+ >Last activity:
482
+ ${new Date(h.lastActivity).toLocaleTimeString()}</span
483
+ >`:e.nothing}
398
484
  </div>
399
485
  <div class="grid grid-cols-2 gap-4 md:grid-cols-4">
400
486
  <button
@@ -403,20 +489,36 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
403
489
  @click=${()=>this.handleMenuSelect("ag-ui-events")}
404
490
  title="View all events in AG-UI Events"
405
491
  >
406
- <div class="truncate whitespace-nowrap text-xs text-gray-600">Total Events</div>
407
- <div class="text-lg font-semibold text-gray-900">${h.totalEvents}</div>
492
+ <div class="truncate whitespace-nowrap text-xs text-gray-600">
493
+ Total Events
494
+ </div>
495
+ <div class="text-lg font-semibold text-gray-900">
496
+ ${h.totalEvents}
497
+ </div>
408
498
  </button>
409
499
  <div class="rounded-md bg-gray-50 px-3 py-2 overflow-hidden">
410
- <div class="truncate whitespace-nowrap text-xs text-gray-600">Messages</div>
411
- <div class="text-lg font-semibold text-gray-900">${h.messages}</div>
500
+ <div class="truncate whitespace-nowrap text-xs text-gray-600">
501
+ Messages
502
+ </div>
503
+ <div class="text-lg font-semibold text-gray-900">
504
+ ${h.messages}
505
+ </div>
412
506
  </div>
413
507
  <div class="rounded-md bg-gray-50 px-3 py-2 overflow-hidden">
414
- <div class="truncate whitespace-nowrap text-xs text-gray-600">Tool Calls</div>
415
- <div class="text-lg font-semibold text-gray-900">${h.toolCalls}</div>
508
+ <div class="truncate whitespace-nowrap text-xs text-gray-600">
509
+ Tool Calls
510
+ </div>
511
+ <div class="text-lg font-semibold text-gray-900">
512
+ ${h.toolCalls}
513
+ </div>
416
514
  </div>
417
515
  <div class="rounded-md bg-gray-50 px-3 py-2 overflow-hidden">
418
- <div class="truncate whitespace-nowrap text-xs text-gray-600">Errors</div>
419
- <div class="text-lg font-semibold text-gray-900">${h.errors}</div>
516
+ <div class="truncate whitespace-nowrap text-xs text-gray-600">
517
+ Errors
518
+ </div>
519
+ <div class="text-lg font-semibold text-gray-900">
520
+ ${h.errors}
521
+ </div>
420
522
  </div>
421
523
  </div>
422
524
  </div>
@@ -428,11 +530,17 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
428
530
  </div>
429
531
  <div class="overflow-auto p-4">
430
532
  ${this.hasRenderableState(r)?e.html`
431
- <pre class="overflow-auto rounded-md bg-gray-50 p-3 text-xs text-gray-800 max-h-64"><code>${this.formatStateForDisplay(r)}</code></pre>
533
+ <pre
534
+ class="overflow-auto rounded-md bg-gray-50 p-3 text-xs text-gray-800 max-h-64"
535
+ ><code>${this.formatStateForDisplay(r)}</code></pre>
432
536
  `:e.html`
433
- <div class="flex h-40 items-center justify-center text-xs text-gray-500">
537
+ <div
538
+ class="flex h-40 items-center justify-center text-xs text-gray-500"
539
+ >
434
540
  <div class="flex items-center gap-2 text-gray-500">
435
- <span class="text-lg text-gray-400">${this.renderIcon("Database")}</span>
541
+ <span class="text-lg text-gray-400"
542
+ >${this.renderIcon("Database")}</span
543
+ >
436
544
  <span>State is empty</span>
437
545
  </div>
438
546
  </div>
@@ -443,27 +551,47 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
443
551
  <!-- Current Messages Section -->
444
552
  <div class="rounded-lg border border-gray-200 bg-white">
445
553
  <div class="border-b border-gray-200 px-4 py-3">
446
- <h4 class="text-sm font-semibold text-gray-900">Current Messages</h4>
554
+ <h4 class="text-sm font-semibold text-gray-900">
555
+ Current Messages
556
+ </h4>
447
557
  </div>
448
558
  <div class="overflow-auto">
449
559
  ${i&&i.length>0?e.html`
450
560
  <table class="w-full text-xs">
451
561
  <thead class="bg-gray-50">
452
562
  <tr>
453
- <th class="px-4 py-2 text-left font-medium text-gray-700">Role</th>
454
- <th class="px-4 py-2 text-left font-medium text-gray-700">Content</th>
563
+ <th
564
+ class="px-4 py-2 text-left font-medium text-gray-700"
565
+ >
566
+ Role
567
+ </th>
568
+ <th
569
+ class="px-4 py-2 text-left font-medium text-gray-700"
570
+ >
571
+ Content
572
+ </th>
455
573
  </tr>
456
574
  </thead>
457
575
  <tbody class="divide-y divide-gray-200">
458
576
  ${i.map(t=>{var a,h;const r=t.role||"unknown",i={user:"bg-blue-100 text-blue-800",assistant:"bg-green-100 text-green-800",system:"bg-gray-100 text-gray-800",tool:"bg-amber-100 text-amber-800",unknown:"bg-gray-100 text-gray-600"},n=null!==(a=t.contentText)&&void 0!==a?a:"",d=null!==(h=t.toolCalls)&&void 0!==h?h:[],o=n.trim().length>0,s=d.length>0?"Invoked tool call":"—";return e.html`
459
577
  <tr>
460
578
  <td class="px-4 py-2 align-top">
461
- <span class="inline-flex rounded px-2 py-0.5 text-[10px] font-medium ${i[r]||i.unknown}">
579
+ <span
580
+ class="inline-flex rounded px-2 py-0.5 text-[10px] font-medium ${i[r]||i.unknown}"
581
+ >
462
582
  ${r}
463
583
  </span>
464
584
  </td>
465
585
  <td class="px-4 py-2">
466
- ${o?e.html`<div class="max-w-2xl whitespace-pre-wrap break-words text-gray-700">${n}</div>`:e.html`<div class="text-xs italic text-gray-400">${s}</div>`}
586
+ ${o?e.html`<div
587
+ class="max-w-2xl whitespace-pre-wrap break-words text-gray-700"
588
+ >
589
+ ${n}
590
+ </div>`:e.html`<div
591
+ class="text-xs italic text-gray-400"
592
+ >
593
+ ${s}
594
+ </div>`}
467
595
  ${"assistant"===r&&d.length>0?this.renderToolCallDetails(d):e.nothing}
468
596
  </td>
469
597
  </tr>
@@ -471,9 +599,13 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
471
599
  </tbody>
472
600
  </table>
473
601
  `:e.html`
474
- <div class="flex h-40 items-center justify-center text-xs text-gray-500">
602
+ <div
603
+ class="flex h-40 items-center justify-center text-xs text-gray-500"
604
+ >
475
605
  <div class="flex items-center gap-2 text-gray-500">
476
- <span class="text-lg text-gray-400">${this.renderIcon("MessageSquare")}</span>
606
+ <span class="text-lg text-gray-400"
607
+ >${this.renderIcon("MessageSquare")}</span
608
+ >
477
609
  <span>No messages available</span>
478
610
  </div>
479
611
  </div>
@@ -482,14 +614,19 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
482
614
  </div>
483
615
  </div>
484
616
  `}renderContextDropdown(){var t,a;const h="agents"===this.selectedMenu?this.contextOptions.filter(t=>"all-agents"!==t.key):this.contextOptions,r=null!==(a=null===(t=h.find(t=>t.key===this.selectedContext))||void 0===t?void 0:t.label)&&void 0!==a?a:"";return e.html`
485
- <div class="relative z-40 min-w-0 flex-1" data-context-dropdown-root="true">
617
+ <div
618
+ class="relative z-40 min-w-0 flex-1"
619
+ data-context-dropdown-root="true"
620
+ >
486
621
  <button
487
622
  type="button"
488
623
  class="relative z-40 flex w-full min-w-0 max-w-[240px] items-center gap-1.5 rounded-md border border-gray-200 px-2 py-1 text-xs font-medium text-gray-700 transition hover:border-gray-300 hover:bg-gray-50"
489
624
  @pointerdown=${this.handleContextDropdownToggle}
490
625
  >
491
626
  <span class="truncate flex-1 text-left">${r}</span>
492
- <span class="shrink-0 text-gray-400">${this.renderIcon("ChevronDown")}</span>
627
+ <span class="shrink-0 text-gray-400"
628
+ >${this.renderIcon("ChevronDown")}</span
629
+ >
493
630
  </button>
494
631
  ${this.contextMenuOpen?e.html`
495
632
  <div
@@ -503,25 +640,39 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
503
640
  data-context-dropdown-root="true"
504
641
  @click=${()=>this.handleContextOptionSelect(t.key)}
505
642
  >
506
- <span class="truncate ${t.key===this.selectedContext?"text-gray-900 font-medium":"text-gray-600"}">${t.label}</span>
507
- ${t.key===this.selectedContext?e.html`<span class="text-gray-500">${this.renderIcon("Check")}</span>`:e.nothing}
643
+ <span
644
+ class="truncate ${t.key===this.selectedContext?"text-gray-900 font-medium":"text-gray-600"}"
645
+ >${t.label}</span
646
+ >
647
+ ${t.key===this.selectedContext?e.html`<span class="text-gray-500"
648
+ >${this.renderIcon("Check")}</span
649
+ >`:e.nothing}
508
650
  </button>
509
651
  `)}
510
652
  </div>
511
653
  `:e.nothing}
512
654
  </div>
513
655
  `}handleMenuSelect(t){if(this.menuItems.some(e=>e.key===t)){if(this.selectedMenu=t,"agents"===t&&"all-agents"===this.selectedContext){const t=this.contextOptions.filter(t=>"all-agents"!==t.key);if(t.length>0){const e=t.find(t=>"default"===t.key);this.selectedContext=e?e.key:t[0].key}}this.contextMenuOpen=!1,this.persistState(),this.requestUpdate()}}handleContextDropdownToggle(t){t.preventDefault(),t.stopPropagation(),this.contextMenuOpen=!this.contextMenuOpen,this.requestUpdate()}handleContextOptionSelect(t){this.contextOptions.some(e=>e.key===t)&&(this.selectedContext!==t&&(this.selectedContext=t,this.expandedRows.clear()),this.contextMenuOpen=!1,this.persistState(),this.requestUpdate())}renderToolsView(){if(!this._core)return e.html`
514
- <div class="flex h-full items-center justify-center px-4 py-8 text-xs text-gray-500">
656
+ <div
657
+ class="flex h-full items-center justify-center px-4 py-8 text-xs text-gray-500"
658
+ >
515
659
  No core instance available
516
660
  </div>
517
661
  `;this.refreshToolsSnapshot();const t=this.cachedTools;if(0===t.length)return e.html`
518
- <div class="flex h-full items-center justify-center px-4 py-8 text-center">
662
+ <div
663
+ class="flex h-full items-center justify-center px-4 py-8 text-center"
664
+ >
519
665
  <div class="max-w-md">
520
- <div class="mb-3 flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8">
666
+ <div
667
+ class="mb-3 flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8"
668
+ >
521
669
  ${this.renderIcon("Hammer")}
522
670
  </div>
523
671
  <p class="text-sm text-gray-600">No tools available</p>
524
- <p class="mt-2 text-xs text-gray-500">Tools will appear here once agents are configured with tool handlers or renderers.</p>
672
+ <p class="mt-2 text-xs text-gray-500">
673
+ Tools will appear here once agents are configured with tool
674
+ handlers or renderers.
675
+ </p>
525
676
  </div>
526
677
  </div>
527
678
  `;const a="all-agents"===this.selectedContext?t:t.filter(t=>!t.agentId||t.agentId===this.selectedContext);return e.html`
@@ -542,8 +693,12 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
542
693
  <div class="flex items-start justify-between gap-3">
543
694
  <div class="flex-1 min-w-0">
544
695
  <div class="flex items-center gap-2 mb-1">
545
- <span class="font-mono text-sm font-semibold text-gray-900">${t.name}</span>
546
- <span class="inline-flex items-center rounded-sm border px-1.5 py-0.5 text-[10px] font-medium ${{handler:"bg-blue-50 text-blue-700 border-blue-200",renderer:"bg-purple-50 text-purple-700 border-purple-200"}[t.type]}">
696
+ <span class="font-mono text-sm font-semibold text-gray-900"
697
+ >${t.name}</span
698
+ >
699
+ <span
700
+ class="inline-flex items-center rounded-sm border px-1.5 py-0.5 text-[10px] font-medium ${{handler:"bg-blue-50 text-blue-700 border-blue-200",renderer:"bg-purple-50 text-purple-700 border-purple-200"}[t.type]}"
701
+ >
547
702
  ${t.type}
548
703
  </span>
549
704
  </div>
@@ -554,12 +709,19 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
554
709
  </span>
555
710
  ${h.properties.length>0?e.html`
556
711
  <span class="text-gray-300">•</span>
557
- <span>${h.properties.length} parameter${1!==h.properties.length?"s":""}</span>
712
+ <span
713
+ >${h.properties.length}
714
+ parameter${1!==h.properties.length?"s":""}</span
715
+ >
558
716
  `:e.nothing}
559
717
  </div>
560
- ${t.description?e.html`<p class="mt-2 text-xs text-gray-600">${t.description}</p>`:e.nothing}
718
+ ${t.description?e.html`<p class="mt-2 text-xs text-gray-600">
719
+ ${t.description}
720
+ </p>`:e.nothing}
561
721
  </div>
562
- <span class="shrink-0 text-gray-400 transition ${a?"rotate-180":""}">
722
+ <span
723
+ class="shrink-0 text-gray-400 transition ${a?"rotate-180":""}"
724
+ >
563
725
  ${this.renderIcon("ChevronDown")}
564
726
  </span>
565
727
  </div>
@@ -568,39 +730,71 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
568
730
  ${a?e.html`
569
731
  <div class="border-t border-gray-200 bg-gray-50/50 px-4 py-3">
570
732
  ${h.properties.length>0?e.html`
571
- <h5 class="mb-3 text-xs font-semibold text-gray-700">Parameters</h5>
733
+ <h5 class="mb-3 text-xs font-semibold text-gray-700">
734
+ Parameters
735
+ </h5>
572
736
  <div class="space-y-3">
573
737
  ${h.properties.map(t=>e.html`
574
- <div class="rounded-md border border-gray-200 bg-white p-3">
575
- <div class="flex items-start justify-between gap-2 mb-1">
576
- <span class="font-mono text-xs font-medium text-gray-900">${t.name}</span>
577
- <div class="flex items-center gap-1.5 shrink-0">
578
- ${t.required?e.html`<span class="text-[9px] rounded border border-rose-200 bg-rose-50 px-1 py-0.5 font-medium text-rose-700">required</span>`:e.html`<span class="text-[9px] rounded border border-gray-200 bg-gray-50 px-1 py-0.5 font-medium text-gray-600">optional</span>`}
579
- ${t.type?e.html`<span class="text-[9px] rounded border border-gray-200 bg-gray-50 px-1 py-0.5 font-mono text-gray-600">${t.type}</span>`:e.nothing}
738
+ <div
739
+ class="rounded-md border border-gray-200 bg-white p-3"
740
+ >
741
+ <div
742
+ class="flex items-start justify-between gap-2 mb-1"
743
+ >
744
+ <span
745
+ class="font-mono text-xs font-medium text-gray-900"
746
+ >${t.name}</span
747
+ >
748
+ <div class="flex items-center gap-1.5 shrink-0">
749
+ ${t.required?e.html`<span
750
+ class="text-[9px] rounded border border-rose-200 bg-rose-50 px-1 py-0.5 font-medium text-rose-700"
751
+ >required</span
752
+ >`:e.html`<span
753
+ class="text-[9px] rounded border border-gray-200 bg-gray-50 px-1 py-0.5 font-medium text-gray-600"
754
+ >optional</span
755
+ >`}
756
+ ${t.type?e.html`<span
757
+ class="text-[9px] rounded border border-gray-200 bg-gray-50 px-1 py-0.5 font-mono text-gray-600"
758
+ >${t.type}</span
759
+ >`:e.nothing}
760
+ </div>
580
761
  </div>
581
- </div>
582
- ${t.description?e.html`<p class="mt-1 text-xs text-gray-600">${t.description}</p>`:e.nothing}
583
- ${void 0!==t.defaultValue?e.html`
584
- <div class="mt-2 flex items-center gap-1.5 text-[10px] text-gray-500">
585
- <span>Default:</span>
586
- <code class="rounded bg-gray-100 px-1 py-0.5 font-mono">${JSON.stringify(t.defaultValue)}</code>
587
- </div>
588
- `:e.nothing}
589
- ${t.enum&&t.enum.length>0?e.html`
590
- <div class="mt-2">
591
- <span class="text-[10px] text-gray-500">Allowed values:</span>
592
- <div class="mt-1 flex flex-wrap gap-1">
593
- ${t.enum.map(t=>e.html`
594
- <code class="rounded border border-gray-200 bg-gray-50 px-1.5 py-0.5 text-[10px] font-mono text-gray-700">${JSON.stringify(t)}</code>
595
- `)}
762
+ ${t.description?e.html`<p class="mt-1 text-xs text-gray-600">
763
+ ${t.description}
764
+ </p>`:e.nothing}
765
+ ${void 0!==t.defaultValue?e.html`
766
+ <div
767
+ class="mt-2 flex items-center gap-1.5 text-[10px] text-gray-500"
768
+ >
769
+ <span>Default:</span>
770
+ <code
771
+ class="rounded bg-gray-100 px-1 py-0.5 font-mono"
772
+ >${JSON.stringify(t.defaultValue)}</code
773
+ >
774
+ </div>
775
+ `:e.nothing}
776
+ ${t.enum&&t.enum.length>0?e.html`
777
+ <div class="mt-2">
778
+ <span class="text-[10px] text-gray-500"
779
+ >Allowed values:</span
780
+ >
781
+ <div class="mt-1 flex flex-wrap gap-1">
782
+ ${t.enum.map(t=>e.html`
783
+ <code
784
+ class="rounded border border-gray-200 bg-gray-50 px-1.5 py-0.5 text-[10px] font-mono text-gray-700"
785
+ >${JSON.stringify(t)}</code
786
+ >
787
+ `)}
788
+ </div>
596
789
  </div>
597
- </div>
598
- `:e.nothing}
599
- </div>
600
- `)}
790
+ `:e.nothing}
791
+ </div>
792
+ `)}
601
793
  </div>
602
794
  `:e.html`
603
- <div class="flex items-center justify-center py-4 text-xs text-gray-500">
795
+ <div
796
+ class="flex items-center justify-center py-4 text-xs text-gray-500"
797
+ >
604
798
  <span>No parameters defined</span>
605
799
  </div>
606
800
  `}
@@ -608,13 +802,19 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
608
802
  `:e.nothing}
609
803
  </div>
610
804
  `}extractSchemaInfo(t){const e={properties:[]};if(!t||"object"!=typeof t)return e;const a=t._def;if(a&&"object"==typeof a){if("ZodObject"===a.typeName){const t=a.shape,h="function"==typeof t?t():t;if(!h||"object"!=typeof h)return e;const r=new Set;"strict"!==a.unknownKeys&&a.catchall||Object.keys(h||{}).forEach(t=>{const e=h[t];(null==e?void 0:e._def)&&!this.isZodOptional(e)&&r.add(t)});for(const[t,a]of Object.entries(h||{})){const h=this.extractZodFieldInfo(a);e.properties.push({name:t,type:h.type,description:h.description,required:r.has(t),defaultValue:h.defaultValue,enum:h.enum})}}}else if("object"===t.type&&t.properties){const a=t.properties,h=new Set(Array.isArray(t.required)?t.required:[]);for(const[t,r]of Object.entries(null!=a?a:{})){const a=r;e.properties.push({name:t,type:a.type,description:"string"==typeof a.description?a.description:void 0,required:h.has(t),defaultValue:a.default,enum:Array.isArray(a.enum)?a.enum:void 0})}}return e}isZodOptional(t){const e=t;if(!(null==e?void 0:e._def))return!1;const a=e._def;return"ZodOptional"===a.typeName||"ZodNullable"===a.typeName||void 0!==a.defaultValue}extractZodFieldInfo(t){var e;const a={},h=t;if(!(null==h?void 0:h._def))return a;let r=h,i=r._def;for(;("ZodOptional"===i.typeName||"ZodNullable"===i.typeName||"ZodDefault"===i.typeName)&&("ZodDefault"===i.typeName&&void 0!==i.defaultValue&&(a.defaultValue="function"==typeof i.defaultValue?i.defaultValue():i.defaultValue),r=null!==(e=i.innerType)&&void 0!==e?e:r,null==r?void 0:r._def);)i=r._def;a.description="string"==typeof i.description?i.description:void 0;const n="string"==typeof i.typeName?i.typeName:void 0;return a.type=n?{ZodString:"string",ZodNumber:"number",ZodBoolean:"boolean",ZodArray:"array",ZodObject:"object",ZodEnum:"enum",ZodLiteral:"literal",ZodUnion:"union",ZodAny:"any",ZodUnknown:"unknown"}[n]||n.replace("Zod","").toLowerCase():void 0,"ZodEnum"===n&&Array.isArray(i.values)?a.enum=i.values:"ZodLiteral"===n&&void 0!==i.value&&(a.enum=[i.value]),a}toggleToolExpansion(t){this.expandedTools.has(t)?this.expandedTools.delete(t):this.expandedTools.add(t),this.requestUpdate()}renderContextView(){const t=Object.entries(this.contextStore);return 0===t.length?e.html`
611
- <div class="flex h-full items-center justify-center px-4 py-8 text-center">
805
+ <div
806
+ class="flex h-full items-center justify-center px-4 py-8 text-center"
807
+ >
612
808
  <div class="max-w-md">
613
- <div class="mb-3 flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8">
809
+ <div
810
+ class="mb-3 flex justify-center text-gray-300 [&>svg]:!h-8 [&>svg]:!w-8"
811
+ >
614
812
  ${this.renderIcon("FileText")}
615
813
  </div>
616
814
  <p class="text-sm text-gray-600">No context available</p>
617
- <p class="mt-2 text-xs text-gray-500">Context will appear here once added to CopilotKit.</p>
815
+ <p class="mt-2 text-xs text-gray-500">
816
+ Context will appear here once added to CopilotKit.
817
+ </p>
618
818
  </div>
619
819
  </div>
620
820
  `:e.html`
@@ -636,14 +836,20 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
636
836
  <div class="flex-1 min-w-0">
637
837
  <p class="text-sm font-medium text-gray-900 mb-1">${d}</p>
638
838
  <div class="flex items-center gap-2 text-xs text-gray-500">
639
- <span class="font-mono truncate inline-block align-middle" style="max-width: 180px;">${t}</span>
839
+ <span
840
+ class="font-mono truncate inline-block align-middle"
841
+ style="max-width: 180px;"
842
+ >${t}</span
843
+ >
640
844
  ${n?e.html`
641
845
  <span class="text-gray-300">•</span>
642
846
  <span class="truncate">${i}</span>
643
847
  `:e.nothing}
644
848
  </div>
645
849
  </div>
646
- <span class="shrink-0 text-gray-400 transition ${r?"rotate-180":""}">
850
+ <span
851
+ class="shrink-0 text-gray-400 transition ${r?"rotate-180":""}"
852
+ >
647
853
  ${this.renderIcon("ChevronDown")}
648
854
  </span>
649
855
  </div>
@@ -653,11 +859,16 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
653
859
  <div class="border-t border-gray-200 bg-gray-50/50 px-4 py-3">
654
860
  <div class="mb-3">
655
861
  <h5 class="mb-1 text-xs font-semibold text-gray-700">ID</h5>
656
- <code class="block rounded bg-white border border-gray-200 px-2 py-1 text-[10px] font-mono text-gray-600">${t}</code>
862
+ <code
863
+ class="block rounded bg-white border border-gray-200 px-2 py-1 text-[10px] font-mono text-gray-600"
864
+ >${t}</code
865
+ >
657
866
  </div>
658
867
  ${n?e.html`
659
868
  <div class="mb-2 flex items-center justify-between gap-2">
660
- <h5 class="text-xs font-semibold text-gray-700">Value</h5>
869
+ <h5 class="text-xs font-semibold text-gray-700">
870
+ Value
871
+ </h5>
661
872
  <button
662
873
  class="flex items-center gap-1 rounded-md border border-gray-200 bg-white px-2 py-1 text-[10px] font-medium text-gray-700 transition hover:bg-gray-50"
663
874
  type="button"
@@ -666,43 +877,75 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
666
877
  ${this.copiedContextItems.has(t)?"Copied":"Copy JSON"}
667
878
  </button>
668
879
  </div>
669
- <div class="rounded-md border border-gray-200 bg-white p-3">
670
- <pre class="overflow-auto text-xs text-gray-800 max-h-96"><code>${this.formatContextValue(a.value)}</code></pre>
880
+ <div
881
+ class="rounded-md border border-gray-200 bg-white p-3"
882
+ >
883
+ <pre
884
+ class="overflow-auto text-xs text-gray-800 max-h-96"
885
+ ><code>${this.formatContextValue(a.value)}</code></pre>
671
886
  </div>
672
887
  `:e.html`
673
- <div class="flex items-center justify-center py-4 text-xs text-gray-500">
888
+ <div
889
+ class="flex items-center justify-center py-4 text-xs text-gray-500"
890
+ >
674
891
  <span>No value available</span>
675
892
  </div>
676
893
  `}
677
894
  </div>
678
895
  `:e.nothing}
679
896
  </div>
680
- `}getContextValuePreview(t){if(null==t)return"—";if("string"==typeof t)return t.length>50?`${t.substring(0,50)}...`:t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t))return`Array(${t.length})`;if("object"==typeof t){const e=Object.keys(t);return`Object with ${e.length} key${1!==e.length?"s":""}`}return"function"==typeof t?"Function":String(t)}formatContextValue(t){if(void 0===t)return"undefined";if(null===t)return"null";if("function"==typeof t)return t.toString();try{return JSON.stringify(t,null,2)}catch(e){return String(t)}}async copyContextValue(t,e){var a;if("undefined"==typeof navigator||!(null===(a=navigator.clipboard)||void 0===a?void 0:a.writeText))return void console.warn("Clipboard API is not available in this environment.");const h=this.formatContextValue(t);try{await navigator.clipboard.writeText(h),this.copiedContextItems.add(e),this.requestUpdate(),setTimeout(()=>{this.copiedContextItems.delete(e),this.requestUpdate()},1500)}catch(t){console.error("Failed to copy context value:",t)}}toggleContextExpansion(t){this.expandedContextItems.has(t)?this.expandedContextItems.delete(t):this.expandedContextItems.add(t),this.requestUpdate()}toggleRowExpansion(t){const e=window.getSelection();e&&e.toString().length>0||(this.expandedRows.has(t)?this.expandedRows.delete(t):this.expandedRows.add(t),this.requestUpdate())}renderAnnouncementPanel(){if(!this.isOpen)return e.nothing;if(this.ensureAnnouncementLoading(),!this.hasUnseenAnnouncement)return e.nothing;if(!this.announcementLoaded&&!this.announcementMarkdown)return e.html`<div class="mx-4 my-3 rounded-xl border border-slate-200 bg-white px-4 py-3 text-sm text-slate-800 shadow-[0_12px_30px_rgba(15,23,42,0.12)]">
897
+ `}getContextValuePreview(t){if(null==t)return"—";if("string"==typeof t)return t.length>50?`${t.substring(0,50)}...`:t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t))return`Array(${t.length})`;if("object"==typeof t){const e=Object.keys(t);return`Object with ${e.length} key${1!==e.length?"s":""}`}return"function"==typeof t?"Function":String(t)}formatContextValue(t){if(void 0===t)return"undefined";if(null===t)return"null";if("function"==typeof t)return t.toString();try{return JSON.stringify(t,null,2)}catch(e){return String(t)}}async copyContextValue(t,e){var a;if("undefined"==typeof navigator||!(null===(a=navigator.clipboard)||void 0===a?void 0:a.writeText))return void console.warn("Clipboard API is not available in this environment.");const h=this.formatContextValue(t);try{await navigator.clipboard.writeText(h),this.copiedContextItems.add(e),this.requestUpdate(),setTimeout(()=>{this.copiedContextItems.delete(e),this.requestUpdate()},1500)}catch(t){console.error("Failed to copy context value:",t)}}toggleContextExpansion(t){this.expandedContextItems.has(t)?this.expandedContextItems.delete(t):this.expandedContextItems.add(t),this.requestUpdate()}toggleRowExpansion(t){const e=window.getSelection();e&&e.toString().length>0||(this.expandedRows.has(t)?this.expandedRows.delete(t):this.expandedRows.add(t),this.requestUpdate())}renderAnnouncementPanel(){if(!this.isOpen)return e.nothing;if(this.ensureAnnouncementLoading(),!this.hasUnseenAnnouncement)return e.nothing;if(!this.announcementLoaded&&!this.announcementMarkdown)return e.html`<div
898
+ class="mx-4 my-3 rounded-xl border border-slate-200 bg-white px-4 py-3 text-sm text-slate-800 shadow-[0_12px_30px_rgba(15,23,42,0.12)]"
899
+ >
681
900
  <div class="flex items-center gap-2 font-semibold">
682
- <span class="inline-flex h-6 w-6 items-center justify-center rounded-md bg-slate-900 text-white shadow-sm">
901
+ <span
902
+ class="inline-flex h-6 w-6 items-center justify-center rounded-md bg-slate-900 text-white shadow-sm"
903
+ >
683
904
  ${this.renderIcon("Megaphone")}
684
905
  </span>
685
906
  <span>Loading latest announcement…</span>
686
907
  </div>
687
- </div>`;if(this.announcementLoadError)return e.html`<div class="mx-4 my-3 rounded-xl border border-rose-200 bg-rose-50 px-4 py-3 text-sm text-rose-900 shadow-[0_12px_30px_rgba(15,23,42,0.12)]">
908
+ </div>`;if(this.announcementLoadError)return e.html`<div
909
+ class="mx-4 my-3 rounded-xl border border-rose-200 bg-rose-50 px-4 py-3 text-sm text-rose-900 shadow-[0_12px_30px_rgba(15,23,42,0.12)]"
910
+ >
688
911
  <div class="flex items-center gap-2 font-semibold">
689
- <span class="inline-flex h-6 w-6 items-center justify-center rounded-md bg-rose-600 text-white shadow-sm">
912
+ <span
913
+ class="inline-flex h-6 w-6 items-center justify-center rounded-md bg-rose-600 text-white shadow-sm"
914
+ >
690
915
  ${this.renderIcon("Megaphone")}
691
916
  </span>
692
917
  <span>Announcement unavailable</span>
693
918
  </div>
694
- <p class="mt-2 text-xs text-rose-800">We couldn’t load the latest notice. Please try opening the inspector again.</p>
695
- </div>`;if(!this.announcementMarkdown)return e.nothing;const t=this.announcementHtml?G(this.announcementHtml):e.html`<pre class="whitespace-pre-wrap text-sm text-gray-900">${this.announcementMarkdown}</pre>`;return e.html`<div class="mx-4 my-3 rounded-xl border border-slate-200 bg-white px-4 py-4 shadow-[0_12px_30px_rgba(15,23,42,0.12)]">
696
- <div class="mb-3 flex items-center gap-2 text-sm font-semibold text-slate-900">
697
- <span class="inline-flex h-7 w-7 items-center justify-center rounded-md bg-slate-900 text-white shadow-sm">
919
+ <p class="mt-2 text-xs text-rose-800">
920
+ We couldn’t load the latest notice. Please try opening the inspector
921
+ again.
922
+ </p>
923
+ </div>`;if(!this.announcementMarkdown)return e.nothing;const t=this.announcementHtml?G(this.announcementHtml):e.html`<pre class="whitespace-pre-wrap text-sm text-gray-900">
924
+ ${this.announcementMarkdown}</pre
925
+ >`;return e.html`<div
926
+ class="mx-4 my-3 rounded-xl border border-slate-200 bg-white px-4 py-4 shadow-[0_12px_30px_rgba(15,23,42,0.12)]"
927
+ >
928
+ <div
929
+ class="mb-3 flex items-center gap-2 text-sm font-semibold text-slate-900"
930
+ >
931
+ <span
932
+ class="inline-flex h-7 w-7 items-center justify-center rounded-md bg-slate-900 text-white shadow-sm"
933
+ >
698
934
  ${this.renderIcon("Megaphone")}
699
935
  </span>
700
936
  <span>Announcement</span>
701
- <button class="announcement-dismiss ml-auto" type="button" @click=${this.handleDismissAnnouncement} aria-label="Dismiss announcement">
937
+ <button
938
+ class="announcement-dismiss ml-auto"
939
+ type="button"
940
+ @click=${this.handleDismissAnnouncement}
941
+ aria-label="Dismiss announcement"
942
+ >
702
943
  Dismiss
703
944
  </button>
704
945
  </div>
705
- <div class="announcement-content text-sm leading-relaxed text-gray-900">${t}</div>
946
+ <div class="announcement-content text-sm leading-relaxed text-gray-900">
947
+ ${t}
948
+ </div>
706
949
  </div>`}ensureAnnouncementLoading(){this.announcementPromise||"undefined"==typeof window||"undefined"==typeof fetch||(this.announcementPromise=this.fetchAnnouncement())}renderAnnouncementPreview(){if(!this.hasUnseenAnnouncement||!this.showAnnouncementPreview||!this.announcementPreviewText)return e.nothing;const t="left"===this.contextState.button.anchor.horizontal?"right":"left";return e.html`<div
707
950
  class="announcement-preview"
708
951
  data-side=${t}
@@ -736,7 +979,9 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
736
979
  }
737
980
 
738
981
  .inspector-window[data-transitioning="true"] {
739
- transition: width 300ms ease, height 300ms ease;
982
+ transition:
983
+ width 300ms ease,
984
+ height 300ms ease;
740
985
  }
741
986
 
742
987
  .inspector-window[data-docked="true"] {
@@ -781,7 +1026,9 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
781
1026
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
782
1027
  opacity: 0;
783
1028
  pointer-events: none;
784
- transition: opacity 120ms ease, transform 120ms ease;
1029
+ transition:
1030
+ opacity 120ms ease,
1031
+ transform 120ms ease;
785
1032
  z-index: 4000;
786
1033
  }
787
1034
 
@@ -853,7 +1100,9 @@ var cd,ld=(cd=function(t,e){return cd=Object.setPrototypeOf||{__proto__:[]}insta
853
1100
  border-radius: 8px;
854
1101
  border: 1px solid rgba(148, 163, 184, 0.5);
855
1102
  background: rgba(248, 250, 252, 0.9);
856
- transition: background 120ms ease, color 120ms ease;
1103
+ transition:
1104
+ background 120ms ease,
1105
+ color 120ms ease;
857
1106
  }
858
1107
 
859
1108
  .announcement-dismiss:hover {