comisai 1.0.24 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/node_modules/@comis/agent/package.json +1 -1
  2. package/node_modules/@comis/channels/package.json +1 -1
  3. package/node_modules/@comis/cli/package.json +1 -1
  4. package/node_modules/@comis/core/dist/bootstrap.js +5 -0
  5. package/node_modules/@comis/core/dist/config/env-layer.d.ts +31 -0
  6. package/node_modules/@comis/core/dist/config/env-layer.js +41 -0
  7. package/node_modules/@comis/core/dist/config/layered.d.ts +9 -0
  8. package/node_modules/@comis/core/dist/config/layered.js +11 -0
  9. package/node_modules/@comis/core/package.json +1 -1
  10. package/node_modules/@comis/daemon/dist/daemon.js +3 -0
  11. package/node_modules/@comis/daemon/package.json +1 -1
  12. package/node_modules/@comis/gateway/package.json +1 -1
  13. package/node_modules/@comis/infra/package.json +1 -1
  14. package/node_modules/@comis/memory/package.json +1 -1
  15. package/node_modules/@comis/scheduler/package.json +1 -1
  16. package/node_modules/@comis/shared/package.json +1 -1
  17. package/node_modules/@comis/skills/package.json +1 -1
  18. package/node_modules/@comis/web/dist/assets/{agent-detail-BG9MGWWj.js → agent-detail-ru-AhppM.js} +270 -270
  19. package/node_modules/@comis/web/dist/assets/agent-editor-hjwRuFVp.js +2173 -0
  20. package/node_modules/@comis/web/dist/assets/{agent-list-LHCJ4rw2.js → agent-list-6Uotjatr.js} +170 -170
  21. package/node_modules/@comis/web/dist/assets/{approvals-q9VH_IKr.js → approvals-C-K6hN2U.js} +13 -13
  22. package/node_modules/@comis/web/dist/assets/billing-view-CxysXH0p.js +375 -0
  23. package/node_modules/@comis/web/dist/assets/{channel-detail-CaInesJM.js → channel-detail-BBCKtmne.js} +265 -265
  24. package/node_modules/@comis/web/dist/assets/channel-list-FkfeOLBQ.js +323 -0
  25. package/node_modules/@comis/web/dist/assets/{chat-console-CNmzl0JW.js → chat-console-BumBaIgO.js} +243 -246
  26. package/node_modules/@comis/web/dist/assets/{config-editor-DX4ITw6y.js → config-editor-C9BSwHGy.js} +477 -477
  27. package/node_modules/@comis/web/dist/assets/{context-dag-browser-BwiaF5tf.js → context-dag-browser-BHm00mJD.js} +105 -105
  28. package/node_modules/@comis/web/dist/assets/{context-engine-BZ5Am6hA.js → context-engine-BENY3pWE.js} +136 -136
  29. package/node_modules/@comis/web/dist/assets/decorate-BvWYovGE.js +38 -0
  30. package/node_modules/@comis/web/dist/assets/{delivery-view-OfBZof-m.js → delivery-view-BCnkPsAp.js} +134 -134
  31. package/node_modules/@comis/web/dist/assets/{diagnostics-view-YFwCxgr2.js → diagnostics-view-C_jQFG2H.js} +82 -82
  32. package/node_modules/@comis/web/dist/assets/directive-BOYXJ-K-.js +1 -0
  33. package/node_modules/@comis/web/dist/assets/{extract-variables-BM5qyK-s.js → extract-variables-B7-Doo7l.js} +39 -39
  34. package/node_modules/@comis/web/dist/assets/{ic-array-editor-B7m6x7-S.js → ic-array-editor-BLoEyeLS.js} +29 -29
  35. package/node_modules/@comis/web/dist/assets/{ic-breadcrumb-CUMpp3BL.js → ic-breadcrumb-DqN6G3gc.js} +16 -16
  36. package/node_modules/@comis/web/dist/assets/{ic-budget-segment-bar-BtJ6x5mN.js → ic-budget-segment-bar-zLsMzjDO.js} +20 -20
  37. package/node_modules/@comis/web/dist/assets/ic-chat-message-FdQcZsSQ.js +352 -0
  38. package/node_modules/@comis/web/dist/assets/{ic-confirm-dialog-CCDbB04e.js → ic-confirm-dialog-DGlPbV1T.js} +26 -26
  39. package/node_modules/@comis/web/dist/assets/{ic-connection-dot-CnT1b8xr.js → ic-connection-dot-BgYiK2N4.js} +13 -13
  40. package/node_modules/@comis/web/dist/assets/ic-data-table-CKIvr-ag.js +277 -0
  41. package/node_modules/@comis/web/dist/assets/ic-delivery-row-B3YwjjuM.js +67 -0
  42. package/node_modules/@comis/web/dist/assets/{ic-detail-panel-BF83r-if.js → ic-detail-panel-DiCe4hLr.js} +27 -27
  43. package/node_modules/@comis/web/dist/assets/{ic-empty-state-60l2ePhd.js → ic-empty-state-CM3Wbj2f.js} +19 -19
  44. package/node_modules/@comis/web/dist/assets/ic-graph-canvas-ByRjij68.js +359 -0
  45. package/node_modules/@comis/web/dist/assets/ic-icon-BGNCCPpZ.js +33 -0
  46. package/node_modules/@comis/web/dist/assets/{ic-layer-waterfall-COvEYMg5.js → ic-layer-waterfall-WkaFyu-l.js} +18 -18
  47. package/node_modules/@comis/web/dist/assets/ic-relative-time-B3UAnTqg.js +12 -0
  48. package/node_modules/@comis/web/dist/assets/{ic-search-input-CSOxY9g7.js → ic-search-input-B02AGw1i.js} +22 -22
  49. package/node_modules/@comis/web/dist/assets/{ic-select-Ce-Raudx.js → ic-select-BqfZISjw.js} +29 -29
  50. package/node_modules/@comis/web/dist/assets/ic-tabs-yBjkWKJH.js +95 -0
  51. package/node_modules/@comis/web/dist/assets/ic-tag-CvMVQFRR.js +33 -0
  52. package/node_modules/@comis/web/dist/assets/{ic-time-range-picker-CypCT68y.js → ic-time-range-picker-DXbYeBmY.js} +31 -31
  53. package/node_modules/@comis/web/dist/assets/{ic-tool-call-7MaXSsCW.js → ic-tool-call-DMPHsLyx.js} +51 -51
  54. package/node_modules/@comis/web/dist/assets/index-CVEaS9aY.css +2 -0
  55. package/node_modules/@comis/web/dist/assets/index-FLPhHz8p.js +2792 -0
  56. package/node_modules/@comis/web/dist/assets/{mcp-management-BNZPnpDn.js → mcp-management-5jyScQis.js} +209 -209
  57. package/node_modules/@comis/web/dist/assets/{media-config-BBvTYxOX.js → media-config-J9oT9PPs.js} +154 -154
  58. package/node_modules/@comis/web/dist/assets/{media-test-BkK3RCRK.js → media-test-DGTCtM8-.js} +259 -259
  59. package/node_modules/@comis/web/dist/assets/{memory-inspector-1hDGCGat.js → memory-inspector-D5Re9ptG.js} +450 -450
  60. package/node_modules/@comis/web/dist/assets/{message-center-CXefwsUu.js → message-center-cRLK6ZmG.js} +290 -290
  61. package/node_modules/@comis/web/dist/assets/{models-C1qcU_j3.js → models-D5vu07MR.js} +371 -371
  62. package/node_modules/@comis/web/dist/assets/observability-types-D0tkwElU.js +1 -0
  63. package/node_modules/@comis/web/dist/assets/{observe-view-C0VBhX4C.js → observe-view-CalNNEmd.js} +399 -399
  64. package/node_modules/@comis/web/dist/assets/pipeline-builder-DUYDGwZf.js +1495 -0
  65. package/node_modules/@comis/web/dist/assets/{pipeline-history-DkfOQ6SW.js → pipeline-history-BAO8brOe.js} +124 -124
  66. package/node_modules/@comis/web/dist/assets/{pipeline-history-detail-hyHgD0ai.js → pipeline-history-detail-DectIoQt.js} +65 -65
  67. package/node_modules/@comis/web/dist/assets/{pipeline-list-BPW8hV-q.js → pipeline-list-BHlaBKww.js} +227 -227
  68. package/node_modules/@comis/web/dist/assets/{pipeline-monitor-Bip16T7e.js → pipeline-monitor-BhtpNEHf.js} +298 -298
  69. package/node_modules/@comis/web/dist/assets/{scheduler-BGgwKd06.js → scheduler-VafN_8xi.js} +486 -486
  70. package/node_modules/@comis/web/dist/assets/{security-D15st4xx.js → security-QQXMRTlo.js} +389 -389
  71. package/node_modules/@comis/web/dist/assets/{session-detail-SGEYNJ0M.js → session-detail-BpZ_8Yih.js} +294 -294
  72. package/node_modules/@comis/web/dist/assets/session-key-parser-Dkqcj2Ss.js +1 -0
  73. package/node_modules/@comis/web/dist/assets/session-list-DfCm8Cec.js +231 -0
  74. package/node_modules/@comis/web/dist/assets/{setup-wizard-nT0tz9QP.js → setup-wizard-C-z477CG.js} +486 -494
  75. package/node_modules/@comis/web/dist/assets/{skills-D8yVfSUy.js → skills-BCOGPf6s.js} +329 -329
  76. package/node_modules/@comis/web/dist/assets/{subagents-HHXMeHYo.js → subagents-l-auUraL.js} +74 -74
  77. package/node_modules/@comis/web/dist/assets/{workspace-manager-BQlr10iH.js → workspace-manager-DlvBixiq.js} +236 -236
  78. package/node_modules/@comis/web/dist/index.html +3 -2
  79. package/node_modules/@comis/web/package.json +1 -1
  80. package/package.json +15 -15
  81. package/node_modules/@comis/web/dist/assets/agent-editor-C26Q_xCs.js +0 -2173
  82. package/node_modules/@comis/web/dist/assets/billing-view-CtYvBqTE.js +0 -375
  83. package/node_modules/@comis/web/dist/assets/channel-list-B8dj3O9a.js +0 -323
  84. package/node_modules/@comis/web/dist/assets/directive-DoeGSK_T.js +0 -1
  85. package/node_modules/@comis/web/dist/assets/ic-chat-message-CFyDJd0z.js +0 -352
  86. package/node_modules/@comis/web/dist/assets/ic-data-table-CKUNTxHw.js +0 -277
  87. package/node_modules/@comis/web/dist/assets/ic-delivery-row-GP5Fkygs.js +0 -67
  88. package/node_modules/@comis/web/dist/assets/ic-graph-canvas-C8FuSMe1.js +0 -359
  89. package/node_modules/@comis/web/dist/assets/ic-icon-xeGTVhVG.js +0 -33
  90. package/node_modules/@comis/web/dist/assets/ic-relative-time-3FqpjeAI.js +0 -12
  91. package/node_modules/@comis/web/dist/assets/ic-tabs-B7QtM_v8.js +0 -95
  92. package/node_modules/@comis/web/dist/assets/ic-tag-CPPUnDLF.js +0 -33
  93. package/node_modules/@comis/web/dist/assets/index-CEcM1R_C.js +0 -2830
  94. package/node_modules/@comis/web/dist/assets/index-CIJFuItj.css +0 -1
  95. package/node_modules/@comis/web/dist/assets/observability-types-D7jUtSde.js +0 -1
  96. package/node_modules/@comis/web/dist/assets/pipeline-builder-DcUUIrm0.js +0 -1496
  97. package/node_modules/@comis/web/dist/assets/session-key-parser-DPORMVyU.js +0 -1
  98. package/node_modules/@comis/web/dist/assets/session-list-6ybUTxbY.js +0 -231
@@ -1,2830 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-console-CNmzl0JW.js","assets/session-key-parser-DPORMVyU.js","assets/ic-tool-call-7MaXSsCW.js","assets/ic-chat-message-CFyDJd0z.js","assets/directive-DoeGSK_T.js","assets/ic-icon-xeGTVhVG.js","assets/ic-search-input-CSOxY9g7.js","assets/ic-tag-CPPUnDLF.js","assets/ic-relative-time-3FqpjeAI.js","assets/ic-empty-state-60l2ePhd.js","assets/ic-budget-segment-bar-BtJ6x5mN.js","assets/memory-inspector-1hDGCGat.js","assets/ic-data-table-CKUNTxHw.js","assets/ic-detail-panel-BF83r-if.js","assets/ic-confirm-dialog-CCDbB04e.js","assets/agent-list-LHCJ4rw2.js","assets/agent-detail-BG9MGWWj.js","assets/ic-breadcrumb-CUMpp3BL.js","assets/agent-editor-C26Q_xCs.js","assets/ic-array-editor-B7m6x7-S.js","assets/workspace-manager-BQlr10iH.js","assets/skills-D8yVfSUy.js","assets/ic-tabs-B7QtM_v8.js","assets/mcp-management-BNZPnpDn.js","assets/models-C1qcU_j3.js","assets/ic-connection-dot-CnT1b8xr.js","assets/channel-list-B8dj3O9a.js","assets/channel-detail-CaInesJM.js","assets/message-center-CXefwsUu.js","assets/scheduler-BGgwKd06.js","assets/session-list-6ybUTxbY.js","assets/session-detail-SGEYNJ0M.js","assets/ic-layer-waterfall-COvEYMg5.js","assets/observe-view-C0VBhX4C.js","assets/observability-types-D7jUtSde.js","assets/ic-delivery-row-GP5Fkygs.js","assets/context-engine-BZ5Am6hA.js","assets/billing-view-CtYvBqTE.js","assets/ic-time-range-picker-CypCT68y.js","assets/delivery-view-OfBZof-m.js","assets/diagnostics-view-YFwCxgr2.js","assets/subagents-HHXMeHYo.js","assets/security-D15st4xx.js","assets/ic-select-Ce-Raudx.js","assets/config-editor-DX4ITw6y.js","assets/setup-wizard-nT0tz9QP.js","assets/pipeline-list-BPW8hV-q.js","assets/extract-variables-BM5qyK-s.js","assets/pipeline-builder-DcUUIrm0.js","assets/ic-graph-canvas-C8FuSMe1.js","assets/pipeline-monitor-Bip16T7e.js","assets/pipeline-history-DkfOQ6SW.js","assets/pipeline-history-detail-hyHgD0ai.js","assets/context-dag-browser-BwiaF5tf.js","assets/media-test-BkK3RCRK.js"])))=>i.map(i=>d[i]);
2
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const n of a.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&r(n)}).observe(document,{childList:!0,subtree:!0});function i(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=i(s);fetch(s.href,a)}})();const Ct="modulepreload",St=function(t){return"/app/"+t},qe={},b=function(e,i,r){let s=Promise.resolve();if(i&&i.length>0){let c=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const n=document.querySelector("meta[property=csp-nonce]"),l=n?.nonce||n?.getAttribute("nonce");s=c(i.map(d=>{if(d=St(d),d in qe)return;qe[d]=!0;const p=d.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const m=document.createElement("link");if(m.rel=p?"stylesheet":Ct,p||(m.as="script"),m.crossOrigin="",m.href=d,l&&m.setAttribute("nonce",l),document.head.appendChild(m),p)return new Promise((f,T)=>{m.addEventListener("load",f),m.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(n){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=n,window.dispatchEvent(l),!l.defaultPrevented)throw n}return s.then(n=>{for(const l of n||[])l.status==="rejected"&&a(l.reason);return e().catch(a)})};const xe=globalThis,Re=xe.ShadowRoot&&(xe.ShadyCSS===void 0||xe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ze=Symbol(),Fe=new WeakMap;let ht=class{constructor(e,i,r){if(this._$cssResult$=!0,r!==ze)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o;const i=this.t;if(Re&&e===void 0){const r=i!==void 0&&i.length===1;r&&(e=Fe.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Fe.set(i,e))}return e}toString(){return this.cssText}};const Et=t=>new ht(typeof t=="string"?t:t+"",void 0,ze),S=(t,...e)=>{const i=t.length===1?t[0]:e.reduce((r,s,a)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[a+1],t[0]);return new ht(i,t,ze)},At=(t,e)=>{if(Re)t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of e){const r=document.createElement("style"),s=xe.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=i.cssText,t.appendChild(r)}},Ge=Re?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(const r of e.cssRules)i+=r.cssText;return Et(i)})(t):t;const{is:Tt,defineProperty:Ot,getOwnPropertyDescriptor:Pt,getOwnPropertyNames:Dt,getOwnPropertySymbols:It,getPrototypeOf:Rt}=Object,Se=globalThis,We=Se.trustedTypes,zt=We?We.emptyScript:"",Mt=Se.reactiveElementPolyfillSupport,he=(t,e)=>t,ke={toAttribute(t,e){switch(e){case Boolean:t=t?zt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},Me=(t,e)=>!Tt(t,e),Je={attribute:!0,type:String,converter:ke,reflect:!1,useDefault:!1,hasChanged:Me};Symbol.metadata??=Symbol("metadata"),Se.litPropertyMetadata??=new WeakMap;let re=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,i=Je){if(i.state&&(i.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((i=Object.create(i)).wrapped=!0),this.elementProperties.set(e,i),!i.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(e,r,i);s!==void 0&&Ot(this.prototype,e,s)}}static getPropertyDescriptor(e,i,r){const{get:s,set:a}=Pt(this.prototype,e)??{get(){return this[i]},set(n){this[i]=n}};return{get:s,set(n){const l=s?.call(this);a?.call(this,n),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Je}static _$Ei(){if(this.hasOwnProperty(he("elementProperties")))return;const e=Rt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(he("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(he("properties"))){const i=this.properties,r=[...Dt(i),...It(i)];for(const s of r)this.createProperty(s,i[s])}const e=this[Symbol.metadata];if(e!==null){const i=litPropertyMetadata.get(e);if(i!==void 0)for(const[r,s]of i)this.elementProperties.set(r,s)}this._$Eh=new Map;for(const[i,r]of this.elementProperties){const s=this._$Eu(i,r);s!==void 0&&this._$Eh.set(s,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const i=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const s of r)i.unshift(Ge(s))}else e!==void 0&&i.push(Ge(e));return i}static _$Eu(e,i){const r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,i=this.constructor.elementProperties;for(const r of i.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return At(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,i,r){this._$AK(e,r)}_$ET(e,i){const r=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,r);if(s!==void 0&&r.reflect===!0){const a=(r.converter?.toAttribute!==void 0?r.converter:ke).toAttribute(i,r.type);this._$Em=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(e,i){const r=this.constructor,s=r._$Eh.get(e);if(s!==void 0&&this._$Em!==s){const a=r.getPropertyOptions(s),n=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:ke;this._$Em=s;const l=n.fromAttribute(i,a.type);this[s]=l??this._$Ej?.get(s)??l,this._$Em=null}}requestUpdate(e,i,r,s=!1,a){if(e!==void 0){const n=this.constructor;if(s===!1&&(a=this[e]),r??=n.getPropertyOptions(e),!((r.hasChanged??Me)(a,i)||r.useDefault&&r.reflect&&a===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,r))))return;this.C(e,i,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,i,{useDefault:r,reflect:s,wrapped:a},n){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??i??this[e]),a!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(i=void 0),this._$AL.set(e,i)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(i){Promise.reject(i)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[s,a]of this._$Ep)this[s]=a;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[s,a]of r){const{wrapped:n}=a,l=this[s];n!==!0||this._$AL.has(s)||l===void 0||this.C(s,void 0,a,l)}}let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(i)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(i)}willUpdate(e){}_$AE(e){this._$EO?.forEach(i=>i.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(i=>this._$ET(i,this[i])),this._$EM()}updated(e){}firstUpdated(e){}};re.elementStyles=[],re.shadowRootOptions={mode:"open"},re[he("elementProperties")]=new Map,re[he("finalized")]=new Map,Mt?.({ReactiveElement:re}),(Se.reactiveElementVersions??=[]).push("2.1.2");const Le=globalThis,Xe=t=>t,Ce=Le.trustedTypes,Ye=Ce?Ce.createPolicy("lit-html",{createHTML:t=>t}):void 0,ut="$lit$",q=`lit$${Math.random().toFixed(9).slice(2)}$`,vt="?"+q,Lt=`<${vt}>`,X=document,ue=()=>X.createComment(""),ve=t=>t===null||typeof t!="object"&&typeof t!="function",Ue=Array.isArray,Ut=t=>Ue(t)||typeof t?.[Symbol.iterator]=="function",Pe=`[
3
- \f\r]`,de=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ze=/-->/g,Qe=/>/g,G=RegExp(`>|${Pe}(?:([^\\s"'>=/]+)(${Pe}*=${Pe}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),et=/'/g,tt=/"/g,mt=/^(?:script|style|textarea|title)$/i,gt=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),o=gt(1),W=gt(2),ne=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),it=new WeakMap,J=X.createTreeWalker(X,129);function ft(t,e){if(!Ue(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ye!==void 0?Ye.createHTML(e):e}const Nt=(t,e)=>{const i=t.length-1,r=[];let s,a=e===2?"<svg>":e===3?"<math>":"",n=de;for(let l=0;l<i;l++){const c=t[l];let d,p,h=-1,m=0;for(;m<c.length&&(n.lastIndex=m,p=n.exec(c),p!==null);)m=n.lastIndex,n===de?p[1]==="!--"?n=Ze:p[1]!==void 0?n=Qe:p[2]!==void 0?(mt.test(p[2])&&(s=RegExp("</"+p[2],"g")),n=G):p[3]!==void 0&&(n=G):n===G?p[0]===">"?(n=s??de,h=-1):p[1]===void 0?h=-2:(h=n.lastIndex-p[2].length,d=p[1],n=p[3]===void 0?G:p[3]==='"'?tt:et):n===tt||n===et?n=G:n===Ze||n===Qe?n=de:(n=G,s=void 0);const f=n===G&&t[l+1].startsWith("/>")?" ":"";a+=n===de?c+Lt:h>=0?(r.push(d),c.slice(0,h)+ut+c.slice(h)+q+f):c+q+(h===-2?l:f)}return[ft(t,a+(t[i]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class me{constructor({strings:e,_$litType$:i},r){let s;this.parts=[];let a=0,n=0;const l=e.length-1,c=this.parts,[d,p]=Nt(e,i);if(this.el=me.createElement(d,r),J.currentNode=this.el.content,i===2||i===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(s=J.nextNode())!==null&&c.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(const h of s.getAttributeNames())if(h.endsWith(ut)){const m=p[n++],f=s.getAttribute(h).split(q),T=/([.?@])?(.*)/.exec(m);c.push({type:1,index:a,name:T[2],strings:f,ctor:T[1]==="."?Ht:T[1]==="?"?jt:T[1]==="@"?Bt:Ee}),s.removeAttribute(h)}else h.startsWith(q)&&(c.push({type:6,index:a}),s.removeAttribute(h));if(mt.test(s.tagName)){const h=s.textContent.split(q),m=h.length-1;if(m>0){s.textContent=Ce?Ce.emptyScript:"";for(let f=0;f<m;f++)s.append(h[f],ue()),J.nextNode(),c.push({type:2,index:++a});s.append(h[m],ue())}}}else if(s.nodeType===8)if(s.data===vt)c.push({type:2,index:a});else{let h=-1;for(;(h=s.data.indexOf(q,h+1))!==-1;)c.push({type:7,index:a}),h+=q.length-1}a++}}static createElement(e,i){const r=X.createElement("template");return r.innerHTML=e,r}}function ae(t,e,i=t,r){if(e===ne)return e;let s=r!==void 0?i._$Co?.[r]:i._$Cl;const a=ve(e)?void 0:e._$litDirective$;return s?.constructor!==a&&(s?._$AO?.(!1),a===void 0?s=void 0:(s=new a(t),s._$AT(t,i,r)),r!==void 0?(i._$Co??=[])[r]=s:i._$Cl=s),s!==void 0&&(e=ae(t,s._$AS(t,e.values),s,r)),e}class Vt{constructor(e,i){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:i},parts:r}=this._$AD,s=(e?.creationScope??X).importNode(i,!0);J.currentNode=s;let a=J.nextNode(),n=0,l=0,c=r[0];for(;c!==void 0;){if(n===c.index){let d;c.type===2?d=new le(a,a.nextSibling,this,e):c.type===1?d=new c.ctor(a,c.name,c.strings,this,e):c.type===6&&(d=new Kt(a,this,e)),this._$AV.push(d),c=r[++l]}n!==c?.index&&(a=J.nextNode(),n++)}return J.currentNode=X,s}p(e){let i=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,i),i+=r.strings.length-2):r._$AI(e[i])),i++}}class le{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,i,r,s){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=r,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const i=this._$AM;return i!==void 0&&e?.nodeType===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=ae(this,e,i),ve(e)?e===g||e==null||e===""?(this._$AH!==g&&this._$AR(),this._$AH=g):e!==this._$AH&&e!==ne&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ut(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==g&&ve(this._$AH)?this._$AA.nextSibling.data=e:this.T(X.createTextNode(e)),this._$AH=e}$(e){const{values:i,_$litType$:r}=e,s=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=me.createElement(ft(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(i);else{const a=new Vt(s,this),n=a.u(this.options);a.p(i),this.T(n),this._$AH=a}}_$AC(e){let i=it.get(e.strings);return i===void 0&&it.set(e.strings,i=new me(e)),i}k(e){Ue(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let r,s=0;for(const a of e)s===i.length?i.push(r=new le(this.O(ue()),this.O(ue()),this,this.options)):r=i[s],r._$AI(a),s++;s<i.length&&(this._$AR(r&&r._$AB.nextSibling,s),i.length=s)}_$AR(e=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);e!==this._$AB;){const r=Xe(e).nextSibling;Xe(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class Ee{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,i,r,s,a){this.type=1,this._$AH=g,this._$AN=void 0,this.element=e,this.name=i,this._$AM=s,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=g}_$AI(e,i=this,r,s){const a=this.strings;let n=!1;if(a===void 0)e=ae(this,e,i,0),n=!ve(e)||e!==this._$AH&&e!==ne,n&&(this._$AH=e);else{const l=e;let c,d;for(e=a[0],c=0;c<a.length-1;c++)d=ae(this,l[r+c],i,c),d===ne&&(d=this._$AH[c]),n||=!ve(d)||d!==this._$AH[c],d===g?e=g:e!==g&&(e+=(d??"")+a[c+1]),this._$AH[c]=d}n&&!s&&this.j(e)}j(e){e===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Ht extends Ee{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===g?void 0:e}}class jt extends Ee{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==g)}}class Bt extends Ee{constructor(e,i,r,s,a){super(e,i,r,s,a),this.type=5}_$AI(e,i=this){if((e=ae(this,e,i,0)??g)===ne)return;const r=this._$AH,s=e===g&&r!==g||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,a=e!==g&&(r===g||s);s&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Kt{constructor(e,i,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){ae(this,e)}}const fs={I:le},qt=Le.litHtmlPolyfillSupport;qt?.(me,le),(Le.litHtmlVersions??=[]).push("3.3.2");const Ft=(t,e,i)=>{const r=i?.renderBefore??e;let s=r._$litPart$;if(s===void 0){const a=i?.renderBefore??null;r._$litPart$=s=new le(e.insertBefore(ue(),a),a,void 0,i??{})}return s._$AI(t),s};const Ne=globalThis;class x extends re{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ft(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ne}}x._$litElement$=!0,x.finalized=!0,Ne.litElementHydrateSupport?.({LitElement:x});const Gt=Ne.litElementPolyfillSupport;Gt?.({LitElement:x});(Ne.litElementVersions??=[]).push("4.2.2");const A=t=>(e,i)=>{i!==void 0?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};const Wt={attribute:!0,type:String,converter:ke,reflect:!1,hasChanged:Me},Jt=(t=Wt,e,i)=>{const{kind:r,metadata:s}=i;let a=globalThis.litPropertyMetadata.get(s);if(a===void 0&&globalThis.litPropertyMetadata.set(s,a=new Map),r==="setter"&&((t=Object.create(t)).wrapped=!0),a.set(i.name,t),r==="accessor"){const{name:n}=i;return{set(l){const c=e.get.call(this);e.set.call(this,l),this.requestUpdate(n,c,t,!0,l)},init(l){return l!==void 0&&this.C(n,void 0,t,l),l}}}if(r==="setter"){const{name:n}=i;return function(l){const c=this[n];e.call(this,l),this.requestUpdate(n,c,t,!0,l)}}throw Error("Unsupported decorator location: "+r)};function u(t){return(e,i)=>typeof i=="object"?Jt(t,e,i):((r,s,a)=>{const n=s.hasOwnProperty(a);return s.constructor.createProperty(a,r),n?Object.getOwnPropertyDescriptor(s,a):void 0})(t,e,i)}function v(t){return u({...t,state:!0,attribute:!1})}function st(t,e,i){const r={Authorization:`Bearer ${e}`,"Content-Type":"application/json"};async function s(n,l){const c=`${t}${n}`,d=await fetch(c,{...l,headers:{...r,...l?.headers}});if(!d.ok){const p=await d.text(),m=(p.length>200?p.slice(0,200)+"...":p).replace(/https?:\/\/[^\s"')]+/g,"[URL]").replace(/[A-Za-z0-9_-]{20,}/g,"[REDACTED]");throw new Error(`Request failed (${d.status}): ${m}`)}return d.json()}async function a(n,l){const c=`${t}${n}`,d=await fetch(c,{...l,headers:{...r,...l?.headers}});if(!d.ok){const p=await d.text(),m=(p.length>200?p.slice(0,200)+"...":p).replace(/https?:\/\/[^\s"')]+/g,"[URL]").replace(/[A-Za-z0-9_-]{20,}/g,"[REDACTED]");throw new Error(`Request failed (${d.status}): ${m}`)}return d.text()}return{async getAgents(){const n=await s("/api/agents"),l=n.agents??n.routing?.agents??[];return Array.isArray(l)?l:Object.entries(n).map(([c,d])=>({id:c,provider:d.provider??"unknown",model:d.model??"unknown",status:"active"}))},async getChannels(){const n=await s("/api/channels"),l=n.channels??[];return Array.isArray(l)?l:Object.entries(n).map(([c,d])=>({type:d.type??c,name:c,enabled:d.enabled??!1,status:d.enabled?"healthy":"disconnected"}))},async getActivity(n=50){return(await s(`/api/activity?limit=${n}`)).entries??[]},async searchMemory(n,l=10){return(await s(`/api/memory/search?q=${encodeURIComponent(n)}&limit=${l}`)).results??[]},async getMemoryStats(){return s("/api/memory/stats")},async chat(n,l,c){return s("/api/chat",{method:"POST",body:JSON.stringify({message:n,agentId:l,sessionKey:c})})},async getChatHistory(){return(await s("/api/chat/history")).messages??[]},async health(){return(await fetch(`${t}/api/health`)).json()},subscribeEvents(n){const l=`${t}/api/events?token=${encodeURIComponent(e)}`,c=new EventSource(l);c.onmessage=p=>{try{const h=JSON.parse(p.data);n("message",h)}catch{n("message",p.data)}};const d=["message:received","message:sent","message:streaming","session:created","session:expired","audit:event","skill:executed","scheduler:job_completed","scheduler:heartbeat_check","system:error","ping"];for(const p of d)c.addEventListener(p,(h=>{try{const m=h.data?JSON.parse(h.data):{};n(p,m)}catch{n(p,h.data)}}));return c.onerror=()=>{n("error",{message:"SSE connection error"})},()=>{c.close()}},async browseMemory(n){if(i)return i("memory.browse",n);const l=new URLSearchParams;n.offset!==void 0&&l.set("offset",String(n.offset)),n.limit!==void 0&&l.set("limit",String(n.limit)),n.type&&l.set("type",n.type),n.trust&&l.set("trust",n.trust),n.agentId&&l.set("agentId",n.agentId),n.from!==void 0&&l.set("from",String(n.from)),n.to!==void 0&&l.set("to",String(n.to));const c=l.toString();return s(`/api/memory/browse${c?`?${c}`:""}`)},async deleteMemory(n){if(i){await i("memory.delete",{id:n});return}await s(`/api/memory/${encodeURIComponent(n)}`,{method:"DELETE"})},async deleteMemoryBulk(n){return i?i("memory.delete",{ids:n}):s("/api/memory/bulk-delete",{method:"POST",body:JSON.stringify({ids:n})})},async exportMemory(n){return i?i("memory.export",n?{ids:n}:{}):a("/api/memory/export",{method:"POST",body:JSON.stringify({ids:n})})},async listSessions(n){if(i)return((await i("session.list",n??{})).sessions??[]).map(p=>{const h=String(p.sessionKey??p.key??"");let m="unknown";const f=h.split(":");return f[0]==="agent"&&f.length>=3&&(m=f[1]??"unknown"),{key:h,agentId:String(p.agentId??m),channelType:String(p.kind??p.channelType??"unknown"),messageCount:Number(p.messageCount??0),totalTokens:Number(p.totalTokens??0),inputTokens:Number(p.inputTokens??0),outputTokens:Number(p.outputTokens??0),toolCalls:Number(p.toolCalls??0),compactions:Number(p.compactions??0),resetCount:Number(p.resetCount??0),createdAt:Number(p.createdAt??Date.now()),lastActiveAt:Number(p.updatedAt??p.lastActiveAt??Date.now())}});const l=new URLSearchParams;n?.agentId&&l.set("agentId",n.agentId),n?.channelType&&l.set("channelType",n.channelType),n?.search&&l.set("search",n.search);const c=l.toString();return s(`/api/sessions${c?`?${c}`:""}`)},async getSessionDetail(n){return i?i("session.history",{session_key:n}):s(`/api/sessions/${encodeURIComponent(n)}`)},async resetSession(n){if(i){await i("session.reset",{session_key:n});return}await s(`/api/sessions/${encodeURIComponent(n)}/reset`,{method:"POST"})},async compactSession(n){if(i){await i("session.compact",{session_key:n});return}await s(`/api/sessions/${encodeURIComponent(n)}/compact`,{method:"POST"})},async deleteSession(n){if(i){await i("session.delete",{session_key:n});return}await s(`/api/sessions/${encodeURIComponent(n)}`,{method:"DELETE"})},async exportSession(n){return i?i("session.export",{session_key:n}):a(`/api/sessions/${encodeURIComponent(n)}/export`)},async resetSessionsBulk(n){return i?i("session.reset",{keys:n}):s("/api/sessions/bulk-reset",{method:"POST",body:JSON.stringify({keys:n})})},async exportSessionsBulk(n){return i?i("session.export",{keys:n}):a("/api/sessions/bulk-export",{method:"POST",body:JSON.stringify({keys:n})})},async deleteSessionsBulk(n){return i?i("session.delete",{keys:n}):s("/api/sessions/bulk-delete",{method:"POST",body:JSON.stringify({keys:n})})}}}const Xt=[{pattern:"dashboard",view:"ic-dashboard"},{pattern:"agents",view:"ic-agent-list"},{pattern:"agents/:id",view:"ic-agent-detail"},{pattern:"agents/:id/edit",view:"ic-agent-editor"},{pattern:"agents/:id/workspace",view:"ic-workspace-manager"},{pattern:"channels",view:"ic-channel-list"},{pattern:"channels/:type",view:"ic-channel-detail"},{pattern:"messages",view:"ic-message-center"},{pattern:"messages/:type",view:"ic-message-center"},{pattern:"skills",view:"ic-skills-view"},{pattern:"mcp",view:"ic-mcp-management"},{pattern:"chat",view:"ic-chat-console"},{pattern:"chat/:sessionKey",view:"ic-chat-console"},{pattern:"memory",view:"ic-memory-inspector"},{pattern:"sessions",view:"ic-session-list-view"},{pattern:"sessions/:key",view:"ic-session-detail"},{pattern:"scheduler",view:"ic-scheduler-view"},{pattern:"scheduler/:jobId",view:"ic-scheduler-view"},{pattern:"models",view:"ic-models-view"},{pattern:"observe/overview",view:"ic-observe-dashboard"},{pattern:"observe/context",view:"ic-context-engine-view"},{pattern:"observe/billing",view:"ic-billing-view"},{pattern:"observe/delivery",view:"ic-delivery-view"},{pattern:"observe/diagnostics",view:"ic-diagnostics-view"},{pattern:"context",view:"ic-context-dag-browser"},{pattern:"subagents",view:"ic-subagents-view"},{pattern:"media",view:"ic-media-test-view"},{pattern:"media/config",view:"ic-media-config-view"},{pattern:"security",view:"ic-security-view"},{pattern:"approvals",view:"ic-approvals-view"},{pattern:"config",view:"ic-config-editor"},{pattern:"setup",view:"ic-setup-wizard"},{pattern:"pipelines",view:"ic-pipeline-list"},{pattern:"pipelines/new",view:"ic-pipeline-builder"},{pattern:"pipelines/history",view:"ic-pipeline-history"},{pattern:"pipelines/history/:graphId",view:"ic-pipeline-history-detail"},{pattern:"pipelines/:graphId",view:"ic-pipeline-monitor"},{pattern:"pipelines/:graphId/edit",view:"ic-pipeline-builder"}];function Yt(){return Xt.map(t=>{const e=t.pattern.split("/");return{pattern:t.pattern,view:t.view,segments:e,segmentCount:e.length}}).sort((t,e)=>e.segmentCount-t.segmentCount)}const De={view:"ic-dashboard",route:"dashboard",params:{},query:{}};function rt(t,e){const i=t.split("/");for(const r of e){if(i.length!==r.segmentCount)continue;const s={};let a=!0;for(let n=0;n<r.segments.length;n++){const l=r.segments[n],c=i[n];if(l.startsWith(":"))s[l.slice(1)]=c;else if(l!==c){a=!1;break}}if(a)return{view:r.view,route:r.pattern,params:s,query:{}}}return null}const Zt=[{from:"observe",to:"observe/overview"}];function Qt(t,e="dashboard"){const i=Yt();function r(){const a=window.location.hash.replace(/^#\/?/,"");if(!a)return{...De};const n=a.indexOf("?"),l=n>=0?a.slice(0,n):a,c=n>=0?a.slice(n+1):"",d={};if(c)for(const h of c.split("&")){const m=h.indexOf("=");if(m>=0){const f=decodeURIComponent(h.slice(0,m)),T=decodeURIComponent(h.slice(m+1));f&&(d[f]=T)}else h&&(d[decodeURIComponent(h)]="")}for(const h of Zt)if(l===h.from){const m=c?`#/${h.to}?${c}`:`#/${h.to}`;history.replaceState(null,"",m);const f=rt(h.to,i);return f?{...f,query:d}:{...De,query:d}}const p=rt(l,i);return p?{...p,query:d}:{...De,query:d}}function s(){const a=r();t(a)}return{navigate(a){window.location.hash=`#/${a}`},current(){return r()},start(){window.addEventListener("hashchange",s),s()},stop(){window.removeEventListener("hashchange",s)},setQuery(a){const n=r(),l={...n.query,...a},d=Object.entries(l).filter(([,h])=>h!=="").map(([h,m])=>`${encodeURIComponent(h)}=${encodeURIComponent(m)}`).join("&"),p=d?`#/${n.route}?${d}`:`#/${n.route}`;history.replaceState(null,"",p)}}}const Ie=3e4,ei=3e4,ti=1e4,ii=1e3,si=3e4,ri=10;function ni(){let t=null,e="disconnected",i=1,r=0,s=null,a=null,n=null,l="",c="",d=!1;const p=new Map,h=new Set,m=new Set;function f(w){if(e!==w){e=w;for(const D of h)D(w)}}function T(){a!==null&&(clearInterval(a),a=null),n!==null&&(clearTimeout(n),n=null)}function $t(){s!==null&&(clearTimeout(s),s=null)}function Be(w){for(const[D,se]of p)clearTimeout(se.timer),se.reject(new Error(w)),p.delete(D)}function xt(){T(),a=setInterval(()=>{if(t===null||t.readyState!==globalThis.WebSocket.OPEN)return;const w=i++;t.send(JSON.stringify({jsonrpc:"2.0",method:"system.ping",id:w})),n=setTimeout(()=>{p.delete(w),t!==null&&t.close()},ti),p.set(w,{resolve:()=>{n!==null&&(clearTimeout(n),n=null)},reject:()=>{n!==null&&(clearTimeout(n),n=null)},timer:setTimeout(()=>{p.delete(w)},Ie)})},ei)}function kt(){if(d)return;if(r>=ri){f("disconnected");return}f("reconnecting");const w=Math.min(ii*Math.pow(2,r),si);r++,s=setTimeout(()=>{Ke(l,c)},w)}function Ke(w,D){const se=`${w}?token=${encodeURIComponent(D)}`;t=new globalThis.WebSocket(se),t.onopen=()=>{r=0,f("connected"),xt()},t.onmessage=M=>{let C;try{C=JSON.parse(M.data)}catch{return}if(!(C.method==="heartbeat"&&C.id==null)){if(C.method&&C.id==null){console.debug("[rpc] notification received:",C.method);for(const U of m)try{U(C.method,C.params)}catch(Te){console.warn("[rpc] notification handler error:",Te)}return}if(C.id!=null){const U=p.get(C.id);U&&(clearTimeout(U.timer),p.delete(C.id),C.error?U.reject(new Error(`RPC error (${C.error.code}): ${C.error.message}`)):U.resolve(C.result))}}},t.onclose=M=>{if(T(),t=null,M.code>=4e3&&M.code<5e3){Be("Connection rejected: "+(M.reason||"auth error")),f("disconnected");return}d||kt()},t.onerror=()=>{}}return{get status(){return e},connect(w,D){d=!1,l=w,c=D,r=0,Ke(w,D)},disconnect(){d=!0,$t(),T(),Be("Client disconnected"),f("disconnected"),t!==null&&(t.close(),t=null)},call(w,D){return new Promise((se,M)=>{if(t===null||t.readyState!==globalThis.WebSocket.OPEN){M(new Error("Not connected"));return}const C=i++,U=setTimeout(()=>{p.delete(C),M(new Error(`RPC request timed out after ${Ie}ms`))},Ie);p.set(C,{resolve:se,reject:M,timer:U});const Te=JSON.stringify({jsonrpc:"2.0",method:w,...D!==void 0?{params:D}:{},id:C});try{t.send(Te)}catch(Oe){clearTimeout(U),p.delete(C),M(new Error("Send failed: "+(Oe instanceof Error?Oe.message:String(Oe))))}})},onStatusChange(w){return h.add(w),()=>{h.delete(w)}},onNotification(w){return m.add(w),()=>{m.delete(w)}}}}function ai(){let e={...{connectionStatus:"disconnected",pendingApprovals:0,errorCount:0,agentCount:0,channelCount:0,sessionCount:0,systemHealth:null,activeAgents:[],activeChannels:[]}};const i=new Set;function r(){for(const s of i)s()}return{get connectionStatus(){return e.connectionStatus},get pendingApprovals(){return e.pendingApprovals},get errorCount(){return e.errorCount},get agentCount(){return e.agentCount},get channelCount(){return e.channelCount},get sessionCount(){return e.sessionCount},get systemHealth(){return e.systemHealth},get activeAgents(){return e.activeAgents},get activeChannels(){return e.activeChannels},subscribe(s){return i.add(s),()=>{i.delete(s)}},getSnapshot(){return Object.freeze({...e})},update(s){e={...e,...s},r()}}}const oi=["message:received","message:sent","message:streaming","session:created","session:expired","audit:event","skill:executed","skill:rejected","observability:metrics","observability:token_usage","scheduler:job_started","scheduler:job_completed","scheduler:heartbeat_check","scheduler:heartbeat_alert","scheduler:heartbeat_delivered","scheduler:task_extracted","system:error","approval:requested","approval:resolved","graph:started","graph:node_updated","graph:completed","config:patched","diagnostic:channel_health","diagnostic:billing_snapshot","skill:loaded","skill:registry_reset","model:catalog_loaded","observability:reset","channel:registered","channel:deregistered","agent:hot_added","agent:hot_removed","security:injection_detected","security:injection_rate_exceeded","security:memory_tainted","security:warn","secret:accessed","secret:modified","model:fallback_attempt","model:fallback_exhausted","model:auth_cooldown","provider:degraded","provider:recovered","session:sub_agent_spawned","session:sub_agent_completed","session:sub_agent_archived","session:sub_agent_spawn_rejected","session:sub_agent_spawn_started","session:sub_agent_spawn_queued","session:sub_agent_lifecycle_ended","ping"];function li(){let t=null,e=!1;const i=new Map;function r(a){if(!a)return{};try{return JSON.parse(a)}catch{return a}}function s(a,n){const l=i.get(a);if(l)for(const c of l)c(n);document.dispatchEvent(new CustomEvent(a,{detail:n}))}return{get connected(){return e},start(a,n){t!==null&&t.close();const l=`${a}/api/events?token=${encodeURIComponent(n)}`;t=new EventSource(l),t.onopen=()=>{e=!0},t.onerror=()=>{e=!1};for(const c of oi)t.addEventListener(c,(d=>{const p=r(d.data);s(c,p)}));t.onmessage=c=>{const d=r(c.data);s("message",d)}},stop(){t!==null&&(t.close(),t=null),e=!1,i.clear()},addEventListener(a,n){return i.has(a)||i.set(a,new Set),i.get(a).add(n),()=>{const l=i.get(a);l&&(l.delete(n),l.size===0&&i.delete(a))}}}}class ci{constructor(e,i,r,s=3e4){this._timer=null,this._host=e,this._rpcClient=i,this._onData=r,this._intervalMs=s,this._host.addController(this)}hostConnected(){this._poll(),this._timer=setInterval(()=>this._poll(),this._intervalMs)}hostDisconnected(){this._timer!==null&&(clearInterval(this._timer),this._timer=null)}async _poll(){try{const[e,i,r]=await Promise.all([this._rpcClient.call("agent.list"),this._rpcClient.call("channel.list"),this._rpcClient.call("session.list",{})]);this._onData({agents:e.agents.length,channels:i.channels.length,sessions:r.total,agentIds:e.agents,sessionEntries:r.sessions?.slice(0,20)??[]}),this._host.requestUpdate()}catch{}}}const O=S`
5
- :host {
6
- font-family: var(--ic-font-sans);
7
- }
8
-
9
- *,
10
- *::before,
11
- *::after {
12
- box-sizing: border-box;
13
- }
14
-
15
- :host {
16
- color: var(--ic-text);
17
- }
18
- `,j=S`
19
- .focusable:focus-visible,
20
- button:focus-visible,
21
- a:focus-visible,
22
- input:focus-visible,
23
- select:focus-visible,
24
- textarea:focus-visible {
25
- outline: 2px solid var(--ic-accent);
26
- outline-offset: 2px;
27
- }
28
- `,di=S`
29
- .sr-only {
30
- position: absolute;
31
- width: 1px;
32
- height: 1px;
33
- padding: 0;
34
- margin: -1px;
35
- overflow: hidden;
36
- clip: rect(0, 0, 0, 0);
37
- white-space: nowrap;
38
- border: 0;
39
- }
40
- `;var pi=Object.defineProperty,hi=Object.getOwnPropertyDescriptor,B=(t,e,i,r)=>{for(var s=r>1?void 0:r?hi(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&pi(e,i,s),s};const nt=[{id:"home",label:"Home",items:[{route:"dashboard",label:"Dashboard",icon:"▣"}]},{id:"operate",label:"Operate",items:[{route:"agents",label:"Agents",icon:"⬤",badge:"agentCount"},{route:"channels",label:"Channels",icon:"◎",badge:"channelCount"},{route:"messages",label:"Messages",icon:"○"},{route:"chat",label:"Chat",icon:"▬"},{route:"sessions",label:"Sessions",icon:"◷",badge:"sessionCount"},{route:"subagents",label:"Sub-Agents",icon:"◔"},{route:"pipelines",label:"Pipelines",icon:"◈"}]},{id:"observe",label:"Observe",items:[{route:"observe",label:"Overview",icon:"△",badge:"errorCount"},{route:"observe/context",label:"Context Engine",icon:"◥"},{route:"context",label:"Context DAG",icon:"◖"},{route:"observe/billing",label:"Billing",icon:"◇"},{route:"observe/delivery",label:"Delivery",icon:"▷"},{route:"observe/diagnostics",label:"Diagnostics",icon:"□"}]},{id:"configure",label:"Configure",items:[{route:"skills",label:"Skills",icon:"⚒"},{route:"mcp",label:"MCP Servers",icon:"⚖"},{route:"models",label:"Models",icon:"⌸"},{route:"memory",label:"Memory",icon:"◉"},{route:"scheduler",label:"Scheduler",icon:"▨"},{route:"security",label:"Security",icon:"☖"},{route:"media",label:"Media",icon:"▶"},{route:"approvals",label:"Approvals",icon:"✓",badge:"pendingApprovals"},{route:"config",label:"Config",icon:"⚙"}]}],ui={route:"setup",label:"Setup",icon:"▶"},at="ic_sidebar_collapsed";let I=class extends x{constructor(){super(...arguments),this.currentRoute="dashboard",this.pendingApprovals=0,this.errorCount=0,this.agentCount=0,this.channelCount=0,this.sessionCount=0,this.open=!1,this._collapsed=!1}connectedCallback(){super.connectedCallback();try{const t=localStorage.getItem(at);t!==null&&(this._collapsed=JSON.parse(t))}catch{}}_isActive(t){if(this.currentRoute===t)return!0;if(!this.currentRoute.startsWith(t+"/"))return!1;for(const e of nt)for(const i of e.items)if(i.route.length>t.length&&(this.currentRoute===i.route||this.currentRoute.startsWith(i.route+"/")))return!1;return!0}_navigate(t){this.dispatchEvent(new CustomEvent("navigate",{detail:t}))}_logout(){this.dispatchEvent(new CustomEvent("logout"))}_toggleCollapse(){this._collapsed=!this._collapsed;try{localStorage.setItem(at,JSON.stringify(this._collapsed))}catch{}}_closeOverlay(){this.dispatchEvent(new CustomEvent("close"))}_getBadgeValue(t){switch(t.badge){case"pendingApprovals":return this.pendingApprovals;case"errorCount":return this.errorCount;case"agentCount":return this.agentCount;case"channelCount":return this.channelCount;case"sessionCount":return this.sessionCount;default:return 0}}_renderNavItem(t){const e=this._isActive(t.route),i=this._getBadgeValue(t);return o`
41
- <button
42
- class="nav-item"
43
- aria-current=${e?"page":g}
44
- @click=${()=>this._navigate(t.route)}
45
- >
46
- <span class="nav-icon">${t.icon}</span>
47
- <span class="nav-label">${t.label}</span>
48
- ${i>0?o`<span class="badge">${i}</span>`:g}
49
- </button>
50
- `}render(){return o`
51
- <div class="overlay" @click=${this._closeOverlay}></div>
52
- <div class="sidebar ${this._collapsed?"collapsed":""}">
53
- <nav role="navigation" aria-label="Main navigation">
54
- ${nt.map(t=>o`
55
- <div class="section-header">
56
- <span class="section-label">${t.label}</span>
57
- </div>
58
- ${t.items.map(e=>this._renderNavItem(e))}
59
- `)}
60
- <div class="divider"></div>
61
- ${this._renderNavItem(ui)}
62
- </nav>
63
- <div class="sidebar-footer">
64
- <button
65
- class="logout-btn"
66
- @click=${this._logout}
67
- aria-label="Logout"
68
- >
69
- <span class="nav-icon">\u2BBB</span>
70
- <span class="logout-label">Logout</span>
71
- </button>
72
- <button
73
- class="collapse-btn"
74
- @click=${this._toggleCollapse}
75
- aria-label=${this._collapsed?"Expand sidebar":"Collapse sidebar"}
76
- >
77
- ${this._collapsed?"»":"«"}
78
- </button>
79
- </div>
80
- </div>
81
- `}};I.styles=[O,j,S`
82
- :host {
83
- display: block;
84
- }
85
-
86
- .sidebar {
87
- display: flex;
88
- flex-direction: column;
89
- width: 240px;
90
- height: 100vh;
91
- background: var(--ic-surface);
92
- border-right: 1px solid var(--ic-border);
93
- position: sticky;
94
- top: 0;
95
- transition: width var(--ic-transition);
96
- overflow: hidden;
97
- }
98
-
99
- .sidebar.collapsed {
100
- width: 64px;
101
- }
102
-
103
- nav {
104
- flex: 1;
105
- display: flex;
106
- flex-direction: column;
107
- padding: var(--ic-space-sm) 0;
108
- overflow-y: auto;
109
- }
110
-
111
- .section-header {
112
- display: flex;
113
- align-items: center;
114
- padding: 6px 16px 4px;
115
- font-size: 11px;
116
- font-weight: 600;
117
- text-transform: uppercase;
118
- letter-spacing: 0.05em;
119
- color: var(--ic-text-dim);
120
- user-select: none;
121
- margin-top: 4px;
122
- }
123
-
124
- .section-header:first-of-type {
125
- margin-top: 0;
126
- }
127
-
128
- .collapsed .section-header {
129
- justify-content: center;
130
- padding: 6px 0;
131
- }
132
-
133
- .collapsed .section-label {
134
- display: none;
135
- }
136
-
137
- .collapsed .section-header::after {
138
- content: "";
139
- display: block;
140
- width: 16px;
141
- height: 1px;
142
- background: var(--ic-border);
143
- }
144
-
145
- .nav-item {
146
- display: flex;
147
- align-items: center;
148
- gap: var(--ic-space-sm);
149
- padding: var(--ic-space-sm) var(--ic-space-md);
150
- background: none;
151
- border: none;
152
- border-left: 3px solid transparent;
153
- color: var(--ic-text-muted);
154
- cursor: pointer;
155
- font-family: inherit;
156
- font-size: var(--ic-text-sm);
157
- width: 100%;
158
- text-align: left;
159
- transition: color var(--ic-transition), background var(--ic-transition),
160
- border-color var(--ic-transition);
161
- white-space: nowrap;
162
- }
163
-
164
- .nav-item:hover {
165
- color: var(--ic-text);
166
- background: var(--ic-surface-2);
167
- }
168
-
169
- .nav-item[aria-current="page"] {
170
- color: var(--ic-accent);
171
- background: rgba(59, 130, 246, 0.1);
172
- border-left-color: var(--ic-accent);
173
- }
174
-
175
- .nav-icon {
176
- display: inline-flex;
177
- align-items: center;
178
- justify-content: center;
179
- width: 20px;
180
- height: 20px;
181
- font-size: 14px;
182
- flex-shrink: 0;
183
- }
184
-
185
- .nav-label {
186
- flex: 1;
187
- overflow: hidden;
188
- text-overflow: ellipsis;
189
- }
190
-
191
- .collapsed .nav-label {
192
- display: none;
193
- }
194
-
195
- .badge {
196
- display: inline-flex;
197
- align-items: center;
198
- justify-content: center;
199
- min-width: 18px;
200
- height: 18px;
201
- padding: 0 5px;
202
- border-radius: 9px;
203
- font-size: 11px;
204
- font-weight: 600;
205
- color: white;
206
- background: var(--ic-error);
207
- flex-shrink: 0;
208
- }
209
-
210
- .collapsed .badge {
211
- display: none;
212
- }
213
-
214
- .divider {
215
- height: 1px;
216
- background: var(--ic-border);
217
- margin: var(--ic-space-sm) var(--ic-space-md);
218
- }
219
-
220
- .sidebar-footer {
221
- padding: var(--ic-space-sm);
222
- border-top: 1px solid var(--ic-border);
223
- }
224
-
225
- .collapse-btn {
226
- display: flex;
227
- align-items: center;
228
- justify-content: center;
229
- width: 100%;
230
- padding: var(--ic-space-sm);
231
- background: none;
232
- border: none;
233
- color: var(--ic-text-dim);
234
- cursor: pointer;
235
- font-family: inherit;
236
- font-size: var(--ic-text-sm);
237
- transition: color var(--ic-transition);
238
- }
239
-
240
- .collapse-btn:hover {
241
- color: var(--ic-text);
242
- }
243
-
244
- .logout-btn {
245
- display: flex;
246
- align-items: center;
247
- gap: var(--ic-space-sm);
248
- width: 100%;
249
- padding: var(--ic-space-sm) var(--ic-space-md);
250
- background: none;
251
- border: none;
252
- border-left: 3px solid transparent;
253
- color: var(--ic-text-dim);
254
- cursor: pointer;
255
- font-family: inherit;
256
- font-size: var(--ic-text-sm);
257
- text-align: left;
258
- transition: color var(--ic-transition);
259
- }
260
-
261
- .logout-btn:hover {
262
- color: var(--ic-error);
263
- }
264
-
265
- .collapsed .logout-label {
266
- display: none;
267
- }
268
-
269
- /* Mobile overlay */
270
- .overlay {
271
- display: none;
272
- }
273
-
274
- @media (max-width: 767px) {
275
- .sidebar {
276
- position: fixed;
277
- z-index: 50;
278
- left: 0;
279
- top: 0;
280
- transform: translateX(-100%);
281
- transition: transform var(--ic-transition-slow);
282
- }
283
-
284
- :host([open]) .sidebar {
285
- transform: translateX(0);
286
- width: 240px;
287
- }
288
-
289
- :host([open]) .sidebar.collapsed {
290
- width: 240px;
291
- }
292
-
293
- :host([open]) .collapsed .nav-label,
294
- :host([open]) .collapsed .badge,
295
- :host([open]) .collapsed .logout-label,
296
- :host([open]) .collapsed .section-label {
297
- display: inline;
298
- }
299
-
300
- :host([open]) .collapsed .section-header::after {
301
- display: none;
302
- }
303
-
304
- :host([open]) .overlay {
305
- display: block;
306
- position: fixed;
307
- inset: 0;
308
- background: rgba(0, 0, 0, 0.5);
309
- z-index: 49;
310
- }
311
- }
312
-
313
- @media (min-width: 768px) and (max-width: 1023px) {
314
- .sidebar:not(.collapsed) {
315
- width: 64px;
316
- }
317
-
318
- .sidebar:not(.collapsed) .nav-label,
319
- .sidebar:not(.collapsed) .badge,
320
- .sidebar:not(.collapsed) .logout-label,
321
- .sidebar:not(.collapsed) .section-label {
322
- display: none;
323
- }
324
-
325
- .sidebar:not(.collapsed) .section-header {
326
- justify-content: center;
327
- padding: 6px 0;
328
- }
329
-
330
- .sidebar:not(.collapsed) .section-header::after {
331
- content: "";
332
- display: block;
333
- width: 16px;
334
- height: 1px;
335
- background: var(--ic-border);
336
- }
337
- }
338
- `];B([u()],I.prototype,"currentRoute",2);B([u({type:Number})],I.prototype,"pendingApprovals",2);B([u({type:Number})],I.prototype,"errorCount",2);B([u({type:Number})],I.prototype,"agentCount",2);B([u({type:Number})],I.prototype,"channelCount",2);B([u({type:Number})],I.prototype,"sessionCount",2);B([u({type:Boolean,reflect:!0})],I.prototype,"open",2);B([v()],I.prototype,"_collapsed",2);I=B([A("ic-sidebar")],I);var vi=Object.defineProperty,mi=Object.getOwnPropertyDescriptor,ce=(t,e,i,r)=>{for(var s=r>1?void 0:r?mi(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&vi(e,i,s),s};let F=class extends x{constructor(){super(...arguments),this.connectionStatus="disconnected",this.notificationCount=0,this.sidebarCollapsed=!1,this.tokenId="",this._menuOpen=!1,this._boundCloseMenu=this._closeMenuOnOutsideClick.bind(this)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._boundCloseMenu)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._boundCloseMenu)}_closeMenuOnOutsideClick(t){const e=t.composedPath();this._menuOpen&&!e.includes(this)&&(this._menuOpen=!1)}_toggleSidebar(){this.dispatchEvent(new CustomEvent("toggle-sidebar"))}_toggleMenu(){this._menuOpen=!this._menuOpen}_logout(){this._menuOpen=!1,this.dispatchEvent(new CustomEvent("logout"))}_getAvatarText(){return this.tokenId&&this.tokenId.length>=2?this.tokenId.slice(0,2).toUpperCase():"OP"}_getStatusText(){switch(this.connectionStatus){case"connected":return"Connected";case"reconnecting":return"Reconnecting";case"disconnected":return"Disconnected";default:return"Unknown"}}render(){return o`
339
- <div class="topbar">
340
- <button
341
- class="hamburger"
342
- @click=${this._toggleSidebar}
343
- aria-label="Toggle navigation"
344
- >
345
- \u2630
346
- </button>
347
- <div class="brand">
348
- <img class="brand-icon" src="${"/app/"}comis-logo.png" alt="Comis" />
349
- </div>
350
- <div class="spacer"></div>
351
- <aside role="complementary" aria-label="System status">
352
- <div class="status-area">
353
- <div class="connection" aria-live="polite">
354
- <span class="connection-dot ${this.connectionStatus}"></span>
355
- <span class="connection-text">${this._getStatusText()}</span>
356
- </div>
357
- <button
358
- class="bell-btn"
359
- aria-label="Notifications${this.notificationCount>0?`, ${this.notificationCount} pending`:""}"
360
- >
361
- \u{1F514}
362
- ${this.notificationCount>0?o`<span class="bell-badge">${this.notificationCount}</span>`:g}
363
- </button>
364
- <div class="user-menu">
365
- <button
366
- class="avatar-btn"
367
- @click=${this._toggleMenu}
368
- aria-label="User menu"
369
- aria-expanded=${this._menuOpen}
370
- >
371
- ${this._getAvatarText()}
372
- </button>
373
- ${this._menuOpen?o`
374
- <div class="dropdown">
375
- <div class="dropdown-info">
376
- ${this.tokenId?`${this.tokenId.slice(0,6)}${"*".repeat(Math.min(8,Math.max(0,this.tokenId.length-10)))}${this.tokenId.length>10?this.tokenId.slice(-4):""}`:"Operator"}
377
- </div>
378
- <div class="dropdown-divider"></div>
379
- <button
380
- class="dropdown-action"
381
- @click=${this._logout}
382
- >
383
- Logout
384
- </button>
385
- </div>
386
- `:g}
387
- </div>
388
- </div>
389
- </aside>
390
- </div>
391
- `}};F.styles=[O,j,S`
392
- :host {
393
- display: block;
394
- }
395
-
396
- .topbar {
397
- display: flex;
398
- align-items: center;
399
- height: 48px;
400
- padding: 0 var(--ic-space-md);
401
- background: var(--ic-surface);
402
- border-bottom: 1px solid var(--ic-border);
403
- }
404
-
405
- .hamburger {
406
- display: none;
407
- align-items: center;
408
- justify-content: center;
409
- width: 32px;
410
- height: 32px;
411
- padding: 0;
412
- margin-right: var(--ic-space-sm);
413
- background: none;
414
- border: none;
415
- color: var(--ic-text-muted);
416
- cursor: pointer;
417
- font-size: 18px;
418
- }
419
-
420
- .hamburger:hover {
421
- color: var(--ic-text);
422
- }
423
-
424
- @media (max-width: 767px) {
425
- .hamburger {
426
- display: flex;
427
- }
428
- }
429
-
430
- .brand {
431
- font-size: 1.125rem;
432
- font-weight: 700;
433
- color: var(--ic-text);
434
- display: flex;
435
- align-items: center;
436
- gap: var(--ic-space-xs);
437
- }
438
-
439
- .brand-icon {
440
- width: 80px;
441
- height: 32px;
442
- object-fit: contain;
443
- }
444
-
445
- .spacer {
446
- flex: 1;
447
- }
448
-
449
- .status-area {
450
- display: flex;
451
- align-items: center;
452
- gap: var(--ic-space-md);
453
- }
454
-
455
- /* Connection status */
456
- .connection {
457
- display: flex;
458
- align-items: center;
459
- gap: var(--ic-space-xs);
460
- }
461
-
462
- .connection-dot {
463
- width: 8px;
464
- height: 8px;
465
- border-radius: 50%;
466
- flex-shrink: 0;
467
- }
468
-
469
- .connection-dot.connected {
470
- background: var(--ic-success);
471
- }
472
-
473
- .connection-dot.reconnecting {
474
- background: var(--ic-warning);
475
- animation: pulse 1.5s ease-in-out infinite;
476
- }
477
-
478
- .connection-dot.disconnected {
479
- background: var(--ic-error);
480
- }
481
-
482
- @keyframes pulse {
483
- 0%, 100% { opacity: 1; }
484
- 50% { opacity: 0.4; }
485
- }
486
-
487
- .connection-text {
488
- font-size: var(--ic-text-xs);
489
- color: var(--ic-text-dim);
490
- }
491
-
492
- /* Notification bell */
493
- .bell-btn {
494
- position: relative;
495
- display: flex;
496
- align-items: center;
497
- justify-content: center;
498
- width: 32px;
499
- height: 32px;
500
- padding: 0;
501
- background: none;
502
- border: none;
503
- color: var(--ic-text-muted);
504
- cursor: pointer;
505
- font-size: 16px;
506
- }
507
-
508
- .bell-btn:hover {
509
- color: var(--ic-text);
510
- }
511
-
512
- .bell-badge {
513
- position: absolute;
514
- top: 2px;
515
- right: 2px;
516
- min-width: 14px;
517
- height: 14px;
518
- padding: 0 3px;
519
- border-radius: 7px;
520
- font-size: 10px;
521
- font-weight: 600;
522
- color: white;
523
- background: var(--ic-error);
524
- display: flex;
525
- align-items: center;
526
- justify-content: center;
527
- }
528
-
529
- /* User menu */
530
- .user-menu {
531
- position: relative;
532
- }
533
-
534
- .avatar-btn {
535
- display: flex;
536
- align-items: center;
537
- justify-content: center;
538
- width: 32px;
539
- height: 32px;
540
- padding: 0;
541
- border-radius: 50%;
542
- background: var(--ic-surface-2);
543
- border: 1px solid var(--ic-border);
544
- color: var(--ic-text-muted);
545
- cursor: pointer;
546
- font-family: inherit;
547
- font-size: var(--ic-text-xs);
548
- font-weight: 600;
549
- }
550
-
551
- .avatar-btn:hover {
552
- border-color: var(--ic-accent);
553
- color: var(--ic-text);
554
- }
555
-
556
- .dropdown {
557
- position: absolute;
558
- top: 100%;
559
- right: 0;
560
- margin-top: var(--ic-space-xs);
561
- min-width: 180px;
562
- background: var(--ic-surface);
563
- border: 1px solid var(--ic-border);
564
- border-radius: var(--ic-radius-md);
565
- box-shadow: var(--ic-shadow-lg);
566
- z-index: 100;
567
- padding: var(--ic-space-sm) 0;
568
- }
569
-
570
- .dropdown-info {
571
- padding: var(--ic-space-sm) var(--ic-space-md);
572
- font-size: var(--ic-text-xs);
573
- color: var(--ic-text-dim);
574
- white-space: nowrap;
575
- overflow: hidden;
576
- text-overflow: ellipsis;
577
- }
578
-
579
- .dropdown-divider {
580
- height: 1px;
581
- background: var(--ic-border);
582
- margin: var(--ic-space-xs) 0;
583
- }
584
-
585
- .dropdown-action {
586
- display: block;
587
- width: 100%;
588
- padding: var(--ic-space-sm) var(--ic-space-md);
589
- background: none;
590
- border: none;
591
- color: var(--ic-text-muted);
592
- cursor: pointer;
593
- font-family: inherit;
594
- font-size: var(--ic-text-sm);
595
- text-align: left;
596
- }
597
-
598
- .dropdown-action:hover {
599
- background: var(--ic-surface-2);
600
- color: var(--ic-error);
601
- }
602
- `];ce([u()],F.prototype,"connectionStatus",2);ce([u({type:Number})],F.prototype,"notificationCount",2);ce([u({type:Boolean})],F.prototype,"sidebarCollapsed",2);ce([u()],F.prototype,"tokenId",2);ce([v()],F.prototype,"_menuOpen",2);F=ce([A("ic-topbar")],F);var gi=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,ee=(t,e,i,r)=>{for(var s=r>1?void 0:r?fi(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&gi(e,i,s),s};const bi=[{id:"v-dashboard",label:"Dashboard",category:"view",icon:"home",action:"dashboard"},{id:"v-agents",label:"Agents",category:"view",icon:"users",action:"agents"},{id:"v-sessions",label:"Sessions",category:"view",icon:"message-circle",action:"sessions"},{id:"v-channels",label:"Channels",category:"view",icon:"radio",action:"channels"},{id:"v-chat",label:"Chat Console",category:"view",icon:"message-square",action:"chat"},{id:"v-memory",label:"Memory Inspector",category:"view",icon:"database",action:"memory"},{id:"v-skills",label:"Skills",category:"view",icon:"zap",action:"skills"},{id:"v-models",label:"Models",category:"view",icon:"cpu",action:"models"},{id:"v-scheduler",label:"Scheduler",category:"view",icon:"clock",action:"scheduler"},{id:"v-pipelines",label:"Pipelines",category:"view",icon:"git-branch",action:"pipelines"},{id:"v-observe",label:"Observability",category:"view",icon:"bar-chart-2",action:"observe/overview"},{id:"v-billing",label:"Billing",category:"view",icon:"dollar-sign",action:"observe/billing"},{id:"v-delivery",label:"Delivery",category:"view",icon:"send",action:"observe/delivery"},{id:"v-diagnostics",label:"Diagnostics",category:"view",icon:"activity",action:"observe/diagnostics"},{id:"v-context",label:"Context Engine",category:"view",icon:"layers",action:"observe/context"},{id:"v-security",label:"Security",category:"view",icon:"shield",action:"security"},{id:"v-config",label:"Settings",category:"view",icon:"settings",action:"config"},{id:"v-setup",label:"Setup Wizard",category:"view",icon:"compass",action:"setup"}],_i=[{id:"c-refresh",label:"Refresh Data",category:"command",icon:"refresh-cw",action:"refresh"},{id:"c-sidebar",label:"Toggle Sidebar",category:"command",icon:"sidebar",action:"toggle-sidebar"},{id:"c-logout",label:"Logout",category:"command",icon:"log-out",action:"logout"},{id:"c-shortcuts",label:"Show Keyboard Shortcuts",category:"command",icon:"help-circle",action:"show-shortcuts"}],yi=["view","agent","session","command"],wi={view:"Views",agent:"Agents",session:"Sessions",command:"Commands"};let N=class extends x{constructor(){super(...arguments),this.open=!1,this.agents=[],this.sessions=[],this._query="",this._activeIndex=-1,this._results=[]}updated(t){t.has("open")&&this.open&&(this._query="",this._activeIndex=-1,this._results=this._filterResults(""),this.updateComplete.then(()=>{this.shadowRoot?.querySelector(".search-input")?.focus()}))}_getAllItems(){const t=[...bi];for(const e of this.agents)t.push({id:`a-${e.id}`,label:e.name??e.id,category:"agent",icon:"user",action:`agents/${e.id}`});for(const e of this.sessions.slice(0,20))t.push({id:`s-${e.key}`,label:`${e.agentId}: ${e.key}`,category:"session",icon:"message-circle",action:`sessions/${e.key}`});return t.push(..._i),t}_filterResults(t){const e=this._getAllItems();if(!t)return e.filter(r=>r.category==="view"||r.category==="command").slice(0,20);const i=t.toLowerCase();return e.filter(r=>r.label.toLowerCase().includes(i)).slice(0,20)}_getGroupedResults(){const t=new Map;for(const e of this._results){let i=t.get(e.category);i||(i=[],t.set(e.category,i)),i.push(e)}return yi.filter(e=>t.has(e)).map(e=>({category:e,items:t.get(e)}))}_handleInput(t){this._query=t.target.value,this._results=this._filterResults(this._query),this._activeIndex=this._results.length>0?0:-1}_handleKeydown(t){switch(t.key){case"ArrowDown":t.preventDefault(),this._results.length>0&&(this._activeIndex=Math.min(this._activeIndex+1,this._results.length-1),this._scrollActiveIntoView());break;case"ArrowUp":t.preventDefault(),this._results.length>0&&(this._activeIndex=Math.max(this._activeIndex-1,0),this._scrollActiveIntoView());break;case"Enter":t.preventDefault(),this._activeIndex>=0&&this._activeIndex<this._results.length&&this._executeItem(this._results[this._activeIndex]);break;case"Escape":t.preventDefault(),this._close();break}}_scrollActiveIntoView(){this.updateComplete.then(()=>{this.shadowRoot?.querySelector(`#result-${this._activeIndex}`)?.scrollIntoView({block:"nearest"})})}_executeItem(t){t.category==="command"?this.dispatchEvent(new CustomEvent("command",{detail:t.action,bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("navigate",{detail:t.action,bubbles:!0,composed:!0})),this._close()}_close(){this._query="",this._activeIndex=-1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}_handleBackdropClick(t){t.target.classList.contains("backdrop")&&this._close()}render(){if(!this.open)return g;const t=this._getGroupedResults();let e=0;return o`
603
- <div class="backdrop" @click=${this._handleBackdropClick}>
604
- <div class="palette" role="dialog" aria-label="Command palette">
605
- <input
606
- class="search-input"
607
- type="text"
608
- placeholder="Search views, agents, sessions, commands..."
609
- role="combobox"
610
- aria-expanded="true"
611
- aria-controls="palette-results"
612
- aria-activedescendant=${this._activeIndex>=0?`result-${this._activeIndex}`:""}
613
- aria-autocomplete="list"
614
- .value=${this._query}
615
- @input=${this._handleInput}
616
- @keydown=${this._handleKeydown}
617
- />
618
- <div class="results" id="palette-results" role="listbox" aria-label="Search results">
619
- ${this._results.length===0?o`<div class="no-results">No results found</div>`:t.map(i=>o`
620
- <div class="category-header">${wi[i.category]??i.category}</div>
621
- ${i.items.map(r=>{const s=e++;return o`
622
- <div
623
- id="result-${s}"
624
- class="result-item"
625
- role="option"
626
- aria-selected=${s===this._activeIndex?"true":"false"}
627
- @click=${()=>this._executeItem(r)}
628
- @pointerenter=${()=>{this._activeIndex=s}}
629
- >
630
- <ic-icon class="result-icon" name=${r.icon} size="16px"></ic-icon>
631
- <span class="result-label">${r.label}</span>
632
- ${r.shortcut?o`<span class="result-shortcut">${r.shortcut}</span>`:g}
633
- </div>
634
- `})}
635
- `)}
636
- </div>
637
- <div class="footer">
638
- <span><kbd>&uarr;</kbd><kbd>&darr;</kbd> Navigate</span>
639
- <span><kbd>Enter</kbd> Select</span>
640
- <span><kbd>Esc</kbd> Close</span>
641
- </div>
642
- </div>
643
- </div>
644
- `}};N.styles=[O,j,di,S`
645
- :host {
646
- display: block;
647
- }
648
-
649
- .backdrop {
650
- position: fixed;
651
- inset: 0;
652
- background: rgba(0, 0, 0, 0.5);
653
- z-index: 100;
654
- display: flex;
655
- align-items: flex-start;
656
- justify-content: center;
657
- padding-top: 15vh;
658
- }
659
-
660
- .palette {
661
- background: var(--ic-surface, #111827);
662
- border: 1px solid var(--ic-border, #374151);
663
- border-radius: var(--ic-radius-lg, 0.75rem);
664
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
665
- max-width: 640px;
666
- width: 90%;
667
- max-height: 400px;
668
- display: flex;
669
- flex-direction: column;
670
- overflow: hidden;
671
- }
672
-
673
- .search-input {
674
- width: 100%;
675
- padding: var(--ic-space-md, 0.75rem) var(--ic-space-lg, 1rem);
676
- background: transparent;
677
- border: none;
678
- border-bottom: 1px solid var(--ic-border, #374151);
679
- color: var(--ic-text, #f3f4f6);
680
- font-size: 1rem;
681
- font-family: inherit;
682
- outline: none;
683
- box-sizing: border-box;
684
- }
685
-
686
- .search-input::placeholder {
687
- color: var(--ic-text-dim, #6b7280);
688
- }
689
-
690
- .results {
691
- overflow-y: auto;
692
- flex: 1;
693
- padding: var(--ic-space-xs, 0.25rem) 0;
694
- }
695
-
696
- .category-header {
697
- padding: var(--ic-space-xs, 0.25rem) var(--ic-space-md, 0.75rem);
698
- font-size: 0.6875rem;
699
- font-weight: 600;
700
- text-transform: uppercase;
701
- letter-spacing: 0.05em;
702
- color: var(--ic-text-dim, #6b7280);
703
- margin-top: var(--ic-space-xs, 0.25rem);
704
- }
705
-
706
- .result-item {
707
- display: flex;
708
- align-items: center;
709
- gap: var(--ic-space-sm, 0.5rem);
710
- padding: var(--ic-space-sm, 0.5rem) var(--ic-space-md, 0.75rem);
711
- cursor: pointer;
712
- color: var(--ic-text, #f3f4f6);
713
- font-size: var(--ic-text-sm, 0.875rem);
714
- transition: background 0.1s;
715
- }
716
-
717
- .result-item:hover,
718
- .result-item[aria-selected="true"] {
719
- background: var(--ic-accent, #3b82f6);
720
- color: #fff;
721
- }
722
-
723
- .result-icon {
724
- width: 16px;
725
- height: 16px;
726
- flex-shrink: 0;
727
- opacity: 0.7;
728
- }
729
-
730
- .result-label {
731
- flex: 1;
732
- min-width: 0;
733
- overflow: hidden;
734
- text-overflow: ellipsis;
735
- white-space: nowrap;
736
- }
737
-
738
- .result-shortcut {
739
- font-size: 0.6875rem;
740
- color: var(--ic-text-dim, #6b7280);
741
- font-family: var(--ic-font-mono, monospace);
742
- flex-shrink: 0;
743
- }
744
-
745
- .result-item[aria-selected="true"] .result-shortcut {
746
- color: rgba(255, 255, 255, 0.7);
747
- }
748
-
749
- .no-results {
750
- padding: var(--ic-space-lg, 1rem);
751
- text-align: center;
752
- color: var(--ic-text-dim, #6b7280);
753
- font-size: var(--ic-text-sm, 0.875rem);
754
- }
755
-
756
- .footer {
757
- border-top: 1px solid var(--ic-border, #374151);
758
- padding: var(--ic-space-xs, 0.25rem) var(--ic-space-md, 0.75rem);
759
- display: flex;
760
- gap: var(--ic-space-md, 0.75rem);
761
- font-size: 0.6875rem;
762
- color: var(--ic-text-dim, #6b7280);
763
- }
764
-
765
- .footer kbd {
766
- background: var(--ic-surface-2, #1f2937);
767
- border: 1px solid var(--ic-border, #374151);
768
- border-radius: 3px;
769
- padding: 1px 4px;
770
- font-size: 0.625rem;
771
- font-family: inherit;
772
- }
773
- `];ee([u({type:Boolean})],N.prototype,"open",2);ee([u({attribute:!1})],N.prototype,"agents",2);ee([u({attribute:!1})],N.prototype,"sessions",2);ee([v()],N.prototype,"_query",2);ee([v()],N.prototype,"_activeIndex",2);ee([v()],N.prototype,"_results",2);N=ee([A("ic-command-palette")],N);var $i=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,Ae=(t,e,i,r)=>{for(var s=r>1?void 0:r?xi(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&$i(e,i,s),s};const ot={sm:"16px",md:"24px",lg:"48px"};let oe=class extends x{constructor(){super(...arguments),this.mode="spinner",this.size="md",this.lines=3}render(){return this.mode==="skeleton"?this._renderSkeleton():this._renderSpinner()}_renderSpinner(){const t=ot[this.size]??ot.md;return o`
774
- <div
775
- class="spinner"
776
- style="width: ${t}; height: ${t};"
777
- role="status"
778
- aria-label="Loading"
779
- ></div>
780
- `}_renderSkeleton(){const t=["100%","80%","60%"],e=Array.from({length:this.lines},(i,r)=>r);return o`
781
- <div
782
- class="skeleton-container"
783
- role="status"
784
- aria-label="Loading"
785
- >
786
- ${e.map(i=>o`<div
787
- class="skeleton-line"
788
- style="width: ${t[i%t.length]};"
789
- ></div>`)}
790
- </div>
791
- `}};oe.styles=[O,S`
792
- :host {
793
- display: block;
794
- }
795
-
796
- /* --- Spinner --- */
797
- .spinner {
798
- border: 2px solid var(--ic-border);
799
- border-top-color: var(--ic-accent);
800
- border-radius: 50%;
801
- animation: spin 0.8s linear infinite;
802
- }
803
-
804
- @keyframes spin {
805
- to {
806
- transform: rotate(360deg);
807
- }
808
- }
809
-
810
- @media (prefers-reduced-motion: reduce) {
811
- .spinner {
812
- animation: none;
813
- border-top-color: var(--ic-accent);
814
- opacity: 0.7;
815
- }
816
- }
817
-
818
- /* --- Skeleton --- */
819
- .skeleton-container {
820
- display: flex;
821
- flex-direction: column;
822
- gap: var(--ic-space-sm);
823
- }
824
-
825
- .skeleton-line {
826
- height: 12px;
827
- background: var(--ic-surface-2);
828
- border-radius: var(--ic-radius-sm);
829
- position: relative;
830
- overflow: hidden;
831
- }
832
-
833
- .skeleton-line::after {
834
- content: "";
835
- position: absolute;
836
- top: 0;
837
- left: 0;
838
- right: 0;
839
- bottom: 0;
840
- background: linear-gradient(
841
- 90deg,
842
- transparent,
843
- rgba(255, 255, 255, 0.05),
844
- transparent
845
- );
846
- animation: shimmer 1.5s ease-in-out infinite;
847
- }
848
-
849
- @keyframes shimmer {
850
- 0% {
851
- transform: translateX(-100%);
852
- }
853
- 100% {
854
- transform: translateX(100%);
855
- }
856
- }
857
-
858
- @media (prefers-reduced-motion: reduce) {
859
- .skeleton-line::after {
860
- animation: none;
861
- display: none;
862
- }
863
- }
864
- `];Ae([u()],oe.prototype,"mode",2);Ae([u()],oe.prototype,"size",2);Ae([u({type:Number})],oe.prototype,"lines",2);oe=Ae([A("ic-loading")],oe);var ki=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Ve=(t,e,i,r)=>{for(var s=r>1?void 0:r?Ci(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&ki(e,i,s),s};let ge=class extends x{constructor(){super(...arguments),this.variant="dashboard",this._showSkeleton=!1,this._delayTimer=null}connectedCallback(){super.connectedCallback(),this._delayTimer=setTimeout(()=>{this._showSkeleton=!0},150)}disconnectedCallback(){super.disconnectedCallback(),this._delayTimer&&(clearTimeout(this._delayTimer),this._delayTimer=null)}_renderDashboard(){return o`
865
- <div class="skeleton-stats">
866
- <div class="skeleton-stat-card"><ic-loading mode="skeleton" lines="2"></ic-loading></div>
867
- <div class="skeleton-stat-card"><ic-loading mode="skeleton" lines="2"></ic-loading></div>
868
- <div class="skeleton-stat-card"><ic-loading mode="skeleton" lines="2"></ic-loading></div>
869
- </div>
870
- <div class="skeleton-content-block"><ic-loading mode="skeleton" lines="6"></ic-loading></div>
871
- `}_renderList(){return o`
872
- <div class="skeleton-search"></div>
873
- <div class="skeleton-content-block">
874
- ${Array.from({length:8},()=>o`
875
- <div class="skeleton-row">
876
- <div class="skeleton-row-cell"><ic-loading mode="skeleton" lines="1"></ic-loading></div>
877
- <div class="skeleton-row-cell"><ic-loading mode="skeleton" lines="1"></ic-loading></div>
878
- <div class="skeleton-row-cell"><ic-loading mode="skeleton" lines="1"></ic-loading></div>
879
- </div>
880
- `)}
881
- </div>
882
- `}_renderDetail(){return o`
883
- <div class="skeleton-detail-header">
884
- <ic-loading mode="skeleton" lines="2"></ic-loading>
885
- </div>
886
- <div class="skeleton-two-col">
887
- <div class="skeleton-block"><ic-loading mode="skeleton" lines="5"></ic-loading></div>
888
- <div class="skeleton-block"><ic-loading mode="skeleton" lines="5"></ic-loading></div>
889
- </div>
890
- `}_renderTable(){return o`
891
- <div class="skeleton-content-block">
892
- <ic-loading mode="skeleton" lines="1"></ic-loading>
893
- ${Array.from({length:8},()=>o`
894
- <div class="skeleton-row">
895
- <div class="skeleton-row-cell"><ic-loading mode="skeleton" lines="1"></ic-loading></div>
896
- <div class="skeleton-row-cell"><ic-loading mode="skeleton" lines="1"></ic-loading></div>
897
- </div>
898
- `)}
899
- </div>
900
- `}_renderEditor(){return o`
901
- <div class="skeleton-detail-header">
902
- <ic-loading mode="skeleton" lines="1"></ic-loading>
903
- </div>
904
- <div class="skeleton-editor-block"><ic-loading mode="skeleton" lines="8"></ic-loading></div>
905
- `}render(){const t=this._showSkeleton?"skeleton-container":"skeleton-container skeleton-hidden";return o`
906
- <div class=${t} role="status" aria-label="Loading content">
907
- ${(()=>{switch(this.variant){case"dashboard":return this._renderDashboard();case"list":return this._renderList();case"detail":return this._renderDetail();case"table":return this._renderTable();case"editor":return this._renderEditor()}})()}
908
- </div>
909
- `}};ge.styles=[O,S`
910
- :host {
911
- display: block;
912
- }
913
-
914
- .skeleton-container {
915
- padding: var(--ic-space-md, 0.75rem) 0;
916
- }
917
-
918
- .skeleton-hidden {
919
- visibility: hidden;
920
- }
921
-
922
- /* Dashboard variant */
923
- .skeleton-stats {
924
- display: grid;
925
- grid-template-columns: repeat(3, 1fr);
926
- gap: var(--ic-space-md);
927
- margin-bottom: var(--ic-space-lg);
928
- }
929
-
930
- @media (max-width: 639px) {
931
- .skeleton-stats {
932
- grid-template-columns: 1fr;
933
- }
934
- }
935
-
936
- .skeleton-stat-card {
937
- background: var(--ic-surface, #111827);
938
- border: 1px solid var(--ic-border, #374151);
939
- border-radius: var(--ic-radius-md);
940
- padding: var(--ic-space-md) var(--ic-space-lg);
941
- height: 80px;
942
- }
943
-
944
- .skeleton-content-block {
945
- background: var(--ic-surface, #111827);
946
- border: 1px solid var(--ic-border, #374151);
947
- border-radius: var(--ic-radius-lg);
948
- padding: var(--ic-space-lg);
949
- }
950
-
951
- /* List variant */
952
- .skeleton-search {
953
- height: 40px;
954
- background: var(--ic-surface, #111827);
955
- border: 1px solid var(--ic-border, #374151);
956
- border-radius: var(--ic-radius-md);
957
- margin-bottom: var(--ic-space-md);
958
- max-width: 320px;
959
- }
960
-
961
- .skeleton-row {
962
- display: flex;
963
- gap: var(--ic-space-md);
964
- padding: var(--ic-space-sm) var(--ic-space-md);
965
- border-bottom: 1px solid var(--ic-border, #374151);
966
- }
967
-
968
- .skeleton-row-cell {
969
- flex: 1;
970
- }
971
-
972
- /* Detail variant */
973
- .skeleton-detail-header {
974
- margin-bottom: var(--ic-space-lg);
975
- }
976
-
977
- .skeleton-two-col {
978
- display: grid;
979
- grid-template-columns: 1fr 1fr;
980
- gap: var(--ic-space-lg);
981
- }
982
-
983
- @media (max-width: 767px) {
984
- .skeleton-two-col {
985
- grid-template-columns: 1fr;
986
- }
987
- }
988
-
989
- .skeleton-block {
990
- background: var(--ic-surface, #111827);
991
- border: 1px solid var(--ic-border, #374151);
992
- border-radius: var(--ic-radius-lg);
993
- padding: var(--ic-space-lg);
994
- min-height: 150px;
995
- }
996
-
997
- /* Editor variant */
998
- .skeleton-editor-block {
999
- background: var(--ic-surface, #111827);
1000
- border: 1px solid var(--ic-border, #374151);
1001
- border-radius: var(--ic-radius-lg);
1002
- padding: var(--ic-space-lg);
1003
- min-height: 300px;
1004
- }
1005
- `];Ve([u()],ge.prototype,"variant",2);Ve([v()],ge.prototype,"_showSkeleton",2);ge=Ve([A("ic-skeleton-view")],ge);var Si=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,bt=(t,e,i,r)=>{for(var s=r>1?void 0:r?Ei(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&Si(e,i,s),s};const lt={success:"var(--ic-success)",error:"var(--ic-error)",warning:"var(--ic-warning)",info:"var(--ic-info)"},Ai=5;let Ti=0,L=class extends x{constructor(){super(...arguments),this._toasts=[],this._timers=new Map}connectedCallback(){super.connectedCallback(),L._instance=this,this._onDocumentToast=this._onDocumentToast.bind(this),document.addEventListener("ic-toast",this._onDocumentToast)}disconnectedCallback(){super.disconnectedCallback(),L._instance===this&&(L._instance=null),document.removeEventListener("ic-toast",this._onDocumentToast);for(const t of this._timers.values())clearTimeout(t);this._timers.clear()}static show(t,e="info",i=4e3){L._instance&&L._instance._addToast(t,e,i)}_onDocumentToast(t){const{message:e,variant:i="info",duration:r=4e3}=t.detail;this._addToast(e,i,r)}_addToast(t,e,i){const r=++Ti,s={id:r,message:t,variant:e,duration:i};let a=[...this._toasts,s];for(;a.length>Ai;){const l=a[0];this._clearTimer(l.id),a=a.slice(1)}this._toasts=a;const n=setTimeout(()=>{this._removeToast(r)},i);this._timers.set(r,n)}_removeToast(t){this._clearTimer(t),this._toasts=this._toasts.filter(e=>e.id!==t)}_clearTimer(t){const e=this._timers.get(t);e!==void 0&&(clearTimeout(e),this._timers.delete(t))}render(){return o`
1006
- <div role="alert" aria-live="polite">
1007
- ${this._toasts.map(t=>{const e=lt[t.variant]??lt.info;return o`
1008
- <div class="toast" data-variant=${t.variant}>
1009
- <div class="toast__border" style="background: ${e}"></div>
1010
- <span class="toast__message">${t.message}</span>
1011
- <button
1012
- class="toast__close"
1013
- aria-label="Close notification"
1014
- @click=${()=>this._removeToast(t.id)}
1015
- >\u2715</button>
1016
- </div>
1017
- `})}
1018
- </div>
1019
- `}};L.styles=[O,S`
1020
- :host {
1021
- position: fixed;
1022
- bottom: var(--ic-space-lg);
1023
- right: var(--ic-space-lg);
1024
- z-index: 10000;
1025
- display: flex;
1026
- flex-direction: column;
1027
- gap: var(--ic-space-sm);
1028
- pointer-events: none;
1029
- }
1030
-
1031
- .toast {
1032
- display: flex;
1033
- align-items: center;
1034
- gap: var(--ic-space-sm);
1035
- background: var(--ic-surface);
1036
- border: 1px solid var(--ic-border);
1037
- border-radius: var(--ic-radius-md);
1038
- padding: var(--ic-space-sm) var(--ic-space-md);
1039
- min-width: 16rem;
1040
- max-width: 24rem;
1041
- box-shadow: var(--ic-shadow-lg);
1042
- pointer-events: auto;
1043
- animation: toast-enter var(--ic-transition-slow) ease forwards;
1044
- }
1045
-
1046
- .toast--exiting {
1047
- animation: toast-exit var(--ic-transition) ease forwards;
1048
- }
1049
-
1050
- @keyframes toast-enter {
1051
- from {
1052
- opacity: 0;
1053
- transform: translateX(1rem);
1054
- }
1055
- to {
1056
- opacity: 1;
1057
- transform: translateX(0);
1058
- }
1059
- }
1060
-
1061
- @keyframes toast-exit {
1062
- from {
1063
- opacity: 1;
1064
- }
1065
- to {
1066
- opacity: 0;
1067
- }
1068
- }
1069
-
1070
- @media (prefers-reduced-motion: reduce) {
1071
- .toast,
1072
- .toast--exiting {
1073
- animation: none;
1074
- }
1075
- }
1076
-
1077
- .toast__border {
1078
- width: 4px;
1079
- align-self: stretch;
1080
- border-radius: 2px;
1081
- flex-shrink: 0;
1082
- }
1083
-
1084
- .toast__message {
1085
- flex: 1;
1086
- font-size: var(--ic-text-sm);
1087
- color: var(--ic-text);
1088
- }
1089
-
1090
- .toast__close {
1091
- background: none;
1092
- border: none;
1093
- color: var(--ic-text-dim);
1094
- cursor: pointer;
1095
- padding: var(--ic-space-xs);
1096
- font-size: var(--ic-text-sm);
1097
- line-height: 1;
1098
- flex-shrink: 0;
1099
- border-radius: var(--ic-radius-sm);
1100
- transition: color var(--ic-transition);
1101
- }
1102
-
1103
- .toast__close:hover {
1104
- color: var(--ic-text);
1105
- }
1106
- `];L._instance=null;bt([v()],L.prototype,"_toasts",2);L=bt([A("ic-toast")],L);class Oi{constructor(e,i,r){this._unsubs=[],this._host=e,this._eventDispatcher=i,this._events=r,this._host.addController(this)}hostConnected(){for(const[e,i]of Object.entries(this._events)){const r=this._eventDispatcher.addEventListener(e,i);this._unsubs.push(r)}}hostDisconnected(){for(const e of this._unsubs)e();this._unsubs=[]}}var Pi=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,_e=(t,e,i,r)=>{for(var s=r>1?void 0:r?Di(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&Pi(e,i,s),s};let Y=class extends x{constructor(){super(...arguments),this.data=[],this.width=80,this.height=24,this.color="var(--ic-accent)"}_buildPoints(){const{data:t,width:e,height:i}=this;if(t.length===0)return"";if(t.length===1)return`${e/2},${i/2}`;const r=Math.max(...t),s=Math.min(...t),a=r-s,n=e/(t.length-1),l=1;return t.map((c,d)=>{const p=d*n,h=a===0?i/2:l+(r-c)/a*(i-l*2);return`${p},${h}`}).join(" ")}render(){if(this.data.length===0)return o``;const t=this._buildPoints();if(this.data.length===1){const[e,i]=t.split(",").map(Number);return o`
1107
- <svg
1108
- viewBox="0 0 ${this.width} ${this.height}"
1109
- preserveAspectRatio="none"
1110
- >
1111
- ${W`<circle cx=${e} cy=${i} r="2" fill=${this.color} />`}
1112
- </svg>
1113
- `}return o`
1114
- <svg
1115
- viewBox="0 0 ${this.width} ${this.height}"
1116
- preserveAspectRatio="none"
1117
- >
1118
- ${W`<polyline
1119
- points=${t}
1120
- fill="none"
1121
- stroke=${this.color}
1122
- stroke-width="1.5"
1123
- stroke-linecap="round"
1124
- stroke-linejoin="round"
1125
- />`}
1126
- </svg>
1127
- `}};Y.styles=[O,S`
1128
- :host {
1129
- display: inline-block;
1130
- }
1131
-
1132
- svg {
1133
- display: block;
1134
- width: 100%;
1135
- height: 100%;
1136
- }
1137
- `];_e([u({attribute:!1})],Y.prototype,"data",2);_e([u({type:Number})],Y.prototype,"width",2);_e([u({type:Number})],Y.prototype,"height",2);_e([u()],Y.prototype,"color",2);Y=_e([A("ic-sparkline")],Y);var Ii=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,K=(t,e,i,r)=>{for(var s=r>1?void 0:r?Ri(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&Ii(e,i,s),s};let R=class extends x{constructor(){super(...arguments),this.label="",this.value="",this.trend="",this.trendValue="",this.threshold="normal",this.sparklineData=[],this.delta="",this.deltaDirection="flat"}_renderTrend(){if(!this.trend)return g;const e={up:"↑",down:"↓",flat:"—"}[this.trend]??"",i=`trend trend--${this.trend}`;return o`<span class=${i}>${e}${this.trendValue?` ${this.trendValue}`:""}</span>`}_renderDelta(){if(!this.delta)return g;const e={up:"↑",down:"↓",flat:"—"}[this.deltaDirection]??"",i=`delta delta--${this.deltaDirection}`;return o`<span class=${i}>${e} ${this.delta}</span>`}_renderThresholdIcon(){return this.threshold==="warning"?o`<span class="threshold-icon threshold-icon--warning" aria-hidden="true">\u26A0</span>`:this.threshold==="critical"?o`<span class="threshold-icon threshold-icon--critical" aria-hidden="true">\u26D4</span>`:g}_renderSparkline(){return this.sparklineData.length===0?g:o`
1138
- <div class="sparkline-area">
1139
- <ic-sparkline
1140
- .data=${this.sparklineData}
1141
- height=${24}
1142
- color="var(--ic-accent)"
1143
- ></ic-sparkline>
1144
- </div>
1145
- `}render(){const t=this.threshold!=="normal"?`card card--${this.threshold}`:"card",e=this.delta?`, ${this.deltaDirection} ${this.delta}`:"",i=this.threshold!=="normal"?`${this.label}: ${this.value}${e} (${this.threshold})`:`${this.label}: ${this.value}${e}`;return o`
1146
- <div class=${t} role="group" aria-label=${i}>
1147
- <div class="value-row">
1148
- ${this._renderThresholdIcon()}
1149
- <span class="value">${this.value}</span>
1150
- ${this._renderTrend()}
1151
- ${this._renderDelta()}
1152
- </div>
1153
- ${this._renderSparkline()}
1154
- <div class="label">${this.label}</div>
1155
- </div>
1156
- `}};R.styles=[O,j,S`
1157
- :host {
1158
- display: block;
1159
- min-width: 8rem;
1160
- flex: 1;
1161
- }
1162
-
1163
- .card {
1164
- background: var(--ic-surface);
1165
- border: 1px solid var(--ic-border);
1166
- border-radius: var(--ic-radius-md);
1167
- padding: var(--ic-space-md) var(--ic-space-lg);
1168
- }
1169
-
1170
- .value-row {
1171
- display: flex;
1172
- align-items: baseline;
1173
- gap: var(--ic-space-sm);
1174
- }
1175
-
1176
- .value {
1177
- font-size: var(--ic-text-2xl);
1178
- font-weight: 700;
1179
- color: var(--ic-text);
1180
- line-height: 1.2;
1181
- }
1182
-
1183
- .trend {
1184
- display: inline-flex;
1185
- align-items: center;
1186
- gap: 2px;
1187
- font-size: var(--ic-text-xs);
1188
- }
1189
-
1190
- .trend--up {
1191
- color: var(--ic-success);
1192
- }
1193
-
1194
- .trend--down {
1195
- color: var(--ic-error);
1196
- }
1197
-
1198
- .trend--flat {
1199
- color: var(--ic-text-dim);
1200
- }
1201
-
1202
- .label {
1203
- font-size: var(--ic-text-xs);
1204
- color: var(--ic-text-dim);
1205
- text-transform: uppercase;
1206
- letter-spacing: 0.05em;
1207
- margin-top: var(--ic-space-xs);
1208
- }
1209
-
1210
- .card--warning {
1211
- border-left: 3px solid var(--ic-warning);
1212
- }
1213
-
1214
- .card--critical {
1215
- border-left: 3px solid var(--ic-error);
1216
- }
1217
-
1218
- .threshold-icon {
1219
- font-size: var(--ic-text-sm);
1220
- flex-shrink: 0;
1221
- }
1222
-
1223
- .threshold-icon--warning {
1224
- color: var(--ic-warning);
1225
- }
1226
-
1227
- .threshold-icon--critical {
1228
- color: var(--ic-error);
1229
- }
1230
-
1231
- /* Delta indicator */
1232
- .delta {
1233
- display: inline-flex;
1234
- align-items: center;
1235
- gap: 2px;
1236
- font-size: var(--ic-text-xs);
1237
- margin-left: auto;
1238
- }
1239
-
1240
- .delta--up {
1241
- color: var(--ic-success);
1242
- }
1243
-
1244
- .delta--down {
1245
- color: var(--ic-error);
1246
- }
1247
-
1248
- .delta--flat {
1249
- color: var(--ic-text-dim);
1250
- }
1251
-
1252
- /* Sparkline area */
1253
- .sparkline-area {
1254
- margin-top: var(--ic-space-xs);
1255
- width: 100%;
1256
- height: 24px;
1257
- }
1258
- `];K([u()],R.prototype,"label",2);K([u()],R.prototype,"value",2);K([u()],R.prototype,"trend",2);K([u()],R.prototype,"trendValue",2);K([u()],R.prototype,"threshold",2);K([u({attribute:!1})],R.prototype,"sparklineData",2);K([u()],R.prototype,"delta",2);K([u()],R.prototype,"deltaDirection",2);R=K([A("ic-stat-card")],R);var zi=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,ye=(t,e,i,r)=>{for(var s=r>1?void 0:r?Mi(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&zi(e,i,s),s};let Z=class extends x{constructor(){super(...arguments),this.value=0,this.label="",this.showPercent=!0,this.thresholds={green:80,yellow:90}}_getColor(){const{value:t,thresholds:e}=this;return t<e.green?"var(--ic-success)":t<e.yellow?"var(--ic-warning)":"var(--ic-error)"}render(){const t=Math.min(this.value,100),e=this._getColor();return o`
1259
- ${this.label?o`<div class="label">${this.label}</div>`:g}
1260
- <div
1261
- class="bar-container"
1262
- role="progressbar"
1263
- aria-valuenow=${this.value}
1264
- aria-valuemin=${0}
1265
- aria-valuemax=${100}
1266
- >
1267
- <div class="track">
1268
- <div
1269
- class="fill"
1270
- style="width: ${t}%; background-color: ${e};"
1271
- ></div>
1272
- </div>
1273
- ${this.showPercent?o`<span class="percent">${Math.round(this.value)}%</span>`:g}
1274
- </div>
1275
- `}};Z.styles=[O,S`
1276
- :host {
1277
- display: block;
1278
- }
1279
-
1280
- .label {
1281
- font-size: var(--ic-text-xs);
1282
- color: var(--ic-text-dim);
1283
- margin-bottom: var(--ic-space-xs);
1284
- }
1285
-
1286
- .bar-container {
1287
- display: flex;
1288
- align-items: center;
1289
- gap: var(--ic-space-sm);
1290
- }
1291
-
1292
- .track {
1293
- flex: 1;
1294
- height: 6px;
1295
- background: var(--ic-surface-alt, #1f2937);
1296
- border-radius: 3px;
1297
- overflow: hidden;
1298
- }
1299
-
1300
- .fill {
1301
- height: 100%;
1302
- border-radius: 3px;
1303
- transition: width 0.3s ease;
1304
- }
1305
-
1306
- .percent {
1307
- font-size: var(--ic-text-xs);
1308
- color: var(--ic-text-dim);
1309
- font-family: var(--ic-font-mono, ui-monospace, monospace);
1310
- min-width: 2.5em;
1311
- text-align: right;
1312
- }
1313
- `];ye([u({type:Number})],Z.prototype,"value",2);ye([u()],Z.prototype,"label",2);ye([u({type:Boolean})],Z.prototype,"showPercent",2);ye([u({attribute:!1})],Z.prototype,"thresholds",2);Z=ye([A("ic-progress-bar")],Z);var Li=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,we=(t,e,i,r)=>{for(var s=r>1?void 0:r?Ui(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&Li(e,i,s),s};let Q=class extends x{constructor(){super(...arguments),this.value=0,this.label="",this.trend=0,this.size="md"}_getClampedValue(){return Math.max(0,Math.min(100,this.value))}_getArcColor(){const t=this._getClampedValue();return t<60?"var(--ic-success)":t<=80?"var(--ic-warning)":"var(--ic-error)"}_getTrendChar(){return this.trend>0?"↑":this.trend<0?"↓":"—"}_getTrendClass(){return this.trend>0?"trend-up":this.trend<0?"trend-down":"trend-flat"}render(){const t=this._getClampedValue(),e=50,i=50,r=42,s=2*Math.PI*r,a=t/100*s,n=s-a;return o`
1314
- <svg
1315
- class="gauge-svg"
1316
- viewBox="0 0 100 100"
1317
- preserveAspectRatio="xMidYMid meet"
1318
- >
1319
- <!-- Background circle -->
1320
- ${W`
1321
- <circle
1322
- cx=${e}
1323
- cy=${i}
1324
- r=${r}
1325
- fill="none"
1326
- stroke="var(--ic-surface-2, #1f2937)"
1327
- stroke-width="8"
1328
- />
1329
- `}
1330
- <!-- Value arc -->
1331
- ${W`
1332
- <circle
1333
- cx=${e}
1334
- cy=${i}
1335
- r=${r}
1336
- fill="none"
1337
- stroke=${this._getArcColor()}
1338
- stroke-width="8"
1339
- stroke-linecap="round"
1340
- stroke-dasharray=${s}
1341
- stroke-dashoffset=${n}
1342
- transform="rotate(-90 ${e} ${i})"
1343
- class="value-arc"
1344
- />
1345
- `}
1346
- <!-- Percentage text -->
1347
- ${W`
1348
- <text
1349
- x=${e}
1350
- y=${i-2}
1351
- text-anchor="middle"
1352
- dominant-baseline="central"
1353
- font-size="18"
1354
- class="value-text"
1355
- >${t}%</text>
1356
- `}
1357
- <!-- Trend indicator -->
1358
- ${W`
1359
- <text
1360
- x=${e}
1361
- y=${i+16}
1362
- text-anchor="middle"
1363
- dominant-baseline="central"
1364
- font-size="12"
1365
- class=${this._getTrendClass()}
1366
- >${this._getTrendChar()}</text>
1367
- `}
1368
- </svg>
1369
- ${this.label?o`<span class="label">${this.label}</span>`:""}
1370
- `}};Q.styles=[O,S`
1371
- :host {
1372
- display: inline-block;
1373
- text-align: center;
1374
- }
1375
-
1376
- :host([size="sm"]) {
1377
- --gauge-size: 60px;
1378
- }
1379
-
1380
- :host,
1381
- :host([size="md"]) {
1382
- --gauge-size: 100px;
1383
- }
1384
-
1385
- :host([size="lg"]) {
1386
- --gauge-size: 140px;
1387
- }
1388
-
1389
- .gauge-svg {
1390
- width: var(--gauge-size);
1391
- height: var(--gauge-size);
1392
- }
1393
-
1394
- .value-text {
1395
- font-weight: 700;
1396
- fill: var(--ic-text, #f9fafb);
1397
- }
1398
-
1399
- .trend-up {
1400
- fill: var(--ic-success);
1401
- }
1402
-
1403
- .trend-down {
1404
- fill: var(--ic-error);
1405
- }
1406
-
1407
- .trend-flat {
1408
- fill: var(--ic-text-dim);
1409
- }
1410
-
1411
- .label {
1412
- display: block;
1413
- font-size: var(--ic-text-xs);
1414
- color: var(--ic-text-dim);
1415
- margin-top: var(--ic-space-xs);
1416
- }
1417
- `];we([u({type:Number})],Q.prototype,"value",2);we([u()],Q.prototype,"label",2);we([u({type:Number})],Q.prototype,"trend",2);we([u({reflect:!0})],Q.prototype,"size",2);Q=we([A("ic-metric-gauge")],Q);var Ni=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,z=(t,e,i,r)=>{for(var s=r>1?void 0:r?Vi(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&Ni(e,i,s),s};const ct={active:"var(--ic-success)",idle:"var(--ic-warning)",suspended:"var(--ic-text-dim)",error:"var(--ic-error)",unknown:"var(--ic-text-dim)"},Hi=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});let P=class extends x{constructor(){super(...arguments),this.name="",this.provider="",this.model="",this.status="unknown",this.agentId="",this.messagesToday=0,this.tokenUsageToday=0,this.costToday=0,this.budgetUtilization=0,this.suspended=!1}_formatTokens(t){if(t>=1e6){const e=t/1e6;return e%1===0?`${e}M`:`${e.toFixed(1)}M`}if(t>=1e3){const e=t/1e3;return e%1===0?`${e}K`:`${e.toFixed(1)}K`}return String(t)}_budgetColor(t){return t>=90?"var(--ic-error)":t>=70?"var(--ic-warning)":"var(--ic-success)"}_handleClick(){this.dispatchEvent(new CustomEvent("navigate",{detail:`agents/${this.agentId||this.name}`,bubbles:!0,composed:!0}))}_handleKeydown(t){(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._handleClick())}_handleAction(t,e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("agent-action",{detail:{action:t,agentId:this.agentId||this.name},bubbles:!0,composed:!0}))}render(){const t=this.suspended?"suspended":this.status,e=ct[t]??ct.unknown,i=t==="active"?"1a":"0d",r=this.messagesToday>0||this.tokenUsageToday>0,s=new Intl.NumberFormat("en-US"),a=this.costToday>0,n=this.budgetUtilization>0,l=Math.min(100,Math.max(0,this.budgetUtilization));return o`
1418
- <div
1419
- class="card ${this.suspended?"card--suspended":""}"
1420
- role="link"
1421
- tabindex="0"
1422
- @click=${this._handleClick}
1423
- @keydown=${this._handleKeydown}
1424
- >
1425
- <div class="card-header">
1426
- <span class="agent-name">${this.name||"Unnamed Agent"}</span>
1427
- <span
1428
- class="status-badge"
1429
- style="background: ${e}${i}; color: ${e}"
1430
- >
1431
- <span class="status-dot" style="background: ${e}"></span>
1432
- ${t}
1433
- </span>
1434
- </div>
1435
-
1436
- <div class="card-details">
1437
- <div class="detail-row">
1438
- <span class="detail-label">Provider</span>
1439
- <span class="detail-value">${this.provider||"---"}</span>
1440
- </div>
1441
- <div class="detail-row">
1442
- <span class="detail-label">Model</span>
1443
- <span class="detail-value">${this.model||"---"}</span>
1444
- </div>
1445
- ${r?o`
1446
- <div class="detail-row">
1447
- <span class="detail-label">Messages</span>
1448
- <span class="detail-value">${s.format(this.messagesToday)}</span>
1449
- </div>
1450
- <div class="detail-row">
1451
- <span class="detail-label">Tokens</span>
1452
- <span class="detail-value">${this._formatTokens(this.tokenUsageToday)}</span>
1453
- </div>
1454
- `:""}
1455
- ${a?o`
1456
- <div class="detail-row">
1457
- <span class="detail-label">Cost Today</span>
1458
- <span class="detail-value">${Hi.format(this.costToday)}</span>
1459
- </div>
1460
- `:g}
1461
- ${n?o`
1462
- <div class="detail-row">
1463
- <span class="detail-label">Budget</span>
1464
- <div class="budget-bar">
1465
- <div class="budget-track">
1466
- <div
1467
- class="budget-fill"
1468
- style="width: ${l}%; background: ${this._budgetColor(l)}"
1469
- ></div>
1470
- </div>
1471
- <span class="budget-pct">${l}%</span>
1472
- </div>
1473
- </div>
1474
- `:g}
1475
- </div>
1476
-
1477
- <div class="card-actions">
1478
- <button
1479
- class="action-btn"
1480
- aria-label="Configure ${this.name||"agent"}"
1481
- @click=${c=>this._handleAction("configure",c)}
1482
- >Configure</button>
1483
- ${this.suspended?o`<button
1484
- class="action-btn"
1485
- aria-label="Resume ${this.name||"agent"}"
1486
- @click=${c=>this._handleAction("resume",c)}
1487
- >Resume</button>`:o`<button
1488
- class="action-btn"
1489
- aria-label="Suspend ${this.name||"agent"}"
1490
- @click=${c=>this._handleAction("suspend",c)}
1491
- >Suspend</button>`}
1492
- <button
1493
- class="action-btn action-btn--danger"
1494
- aria-label="Delete ${this.name||"agent"}"
1495
- @click=${c=>this._handleAction("delete",c)}
1496
- >Delete</button>
1497
- </div>
1498
- </div>
1499
- `}};P.styles=[O,j,S`
1500
- :host {
1501
- display: block;
1502
- }
1503
-
1504
- .card {
1505
- background: var(--ic-surface);
1506
- border: 1px solid var(--ic-border);
1507
- border-radius: 0.75rem;
1508
- padding: 1.25rem;
1509
- transition: border-color 0.15s;
1510
- cursor: pointer;
1511
- display: flex;
1512
- flex-direction: column;
1513
- }
1514
-
1515
- .card:hover {
1516
- border-color: var(--ic-border-hover, #374151);
1517
- }
1518
-
1519
- .card:focus-visible {
1520
- outline: 2px solid var(--ic-accent);
1521
- outline-offset: 2px;
1522
- }
1523
-
1524
- .card--suspended {
1525
- opacity: 0.65;
1526
- }
1527
-
1528
- .card-header {
1529
- display: flex;
1530
- align-items: center;
1531
- justify-content: space-between;
1532
- margin-bottom: 0.75rem;
1533
- }
1534
-
1535
- .agent-name {
1536
- font-size: 1rem;
1537
- font-weight: 600;
1538
- color: var(--ic-text);
1539
- }
1540
-
1541
- .status-badge {
1542
- display: flex;
1543
- align-items: center;
1544
- gap: 0.375rem;
1545
- padding: 0.25rem 0.625rem;
1546
- border-radius: 9999px;
1547
- font-size: 0.75rem;
1548
- font-weight: 500;
1549
- text-transform: capitalize;
1550
- }
1551
-
1552
- .status-dot {
1553
- width: 0.375rem;
1554
- height: 0.375rem;
1555
- border-radius: 50%;
1556
- }
1557
-
1558
- .card-details {
1559
- display: flex;
1560
- flex-direction: column;
1561
- gap: 0.375rem;
1562
- flex: 1;
1563
- }
1564
-
1565
- .detail-row {
1566
- display: flex;
1567
- align-items: center;
1568
- justify-content: space-between;
1569
- font-size: 0.8125rem;
1570
- }
1571
-
1572
- .detail-label {
1573
- color: var(--ic-text-dim);
1574
- }
1575
-
1576
- .detail-value {
1577
- color: var(--ic-text-muted);
1578
- font-family: ui-monospace, monospace;
1579
- font-size: 0.75rem;
1580
- }
1581
-
1582
- .budget-bar {
1583
- display: flex;
1584
- align-items: center;
1585
- gap: 0.5rem;
1586
- }
1587
-
1588
- .budget-track {
1589
- flex: 1;
1590
- height: 4px;
1591
- background: var(--ic-surface-2, #1f2937);
1592
- border-radius: 2px;
1593
- overflow: hidden;
1594
- min-width: 40px;
1595
- }
1596
-
1597
- .budget-fill {
1598
- height: 100%;
1599
- border-radius: 2px;
1600
- transition: width 0.3s;
1601
- }
1602
-
1603
- .budget-pct {
1604
- font-family: ui-monospace, monospace;
1605
- font-size: 0.75rem;
1606
- color: var(--ic-text-muted);
1607
- min-width: 2.5rem;
1608
- text-align: right;
1609
- }
1610
-
1611
- .card-actions {
1612
- display: flex;
1613
- gap: 0.5rem;
1614
- margin-top: 0.75rem;
1615
- padding-top: 0.75rem;
1616
- border-top: 1px solid var(--ic-border);
1617
- }
1618
-
1619
- .action-btn {
1620
- flex: 1;
1621
- display: inline-flex;
1622
- align-items: center;
1623
- justify-content: center;
1624
- padding: 0.375rem 0.5rem;
1625
- background: transparent;
1626
- border: 1px solid var(--ic-border);
1627
- border-radius: 0.375rem;
1628
- color: var(--ic-text-dim);
1629
- font-size: 0.75rem;
1630
- font-family: inherit;
1631
- cursor: pointer;
1632
- transition: background 0.15s, color 0.15s, border-color 0.15s;
1633
- }
1634
-
1635
- .action-btn:hover {
1636
- background: var(--ic-surface-2, #1f2937);
1637
- color: var(--ic-text);
1638
- border-color: var(--ic-text-dim);
1639
- }
1640
-
1641
- .action-btn--danger:hover {
1642
- color: var(--ic-error, #f87171);
1643
- border-color: var(--ic-error, #f87171);
1644
- }
1645
- `];z([u({type:String})],P.prototype,"name",2);z([u({type:String})],P.prototype,"provider",2);z([u({type:String})],P.prototype,"model",2);z([u({type:String})],P.prototype,"status",2);z([u({type:String})],P.prototype,"agentId",2);z([u({type:Number})],P.prototype,"messagesToday",2);z([u({type:Number})],P.prototype,"tokenUsageToday",2);z([u({type:Number})],P.prototype,"costToday",2);z([u({type:Number})],P.prototype,"budgetUtilization",2);z([u({type:Boolean})],P.prototype,"suspended",2);P=z([A("ic-agent-card")],P);const _t={healthy:{color:"var(--ic-success)",label:"Healthy",severity:"green",pulse:!1,icon:"check-circle"},idle:{color:"var(--ic-success)",label:"Idle",severity:"green",pulse:!1,icon:"pause-circle"},stale:{color:"var(--ic-warning)",label:"Stale",severity:"yellow",pulse:!1,icon:"clock"},"startup-grace":{color:"var(--ic-warning)",label:"Starting",severity:"yellow",pulse:!0,icon:"loader"},stuck:{color:"var(--ic-error)",label:"Stuck",severity:"red",pulse:!1,icon:"alert-triangle"},errored:{color:"var(--ic-error)",label:"Error",severity:"red",pulse:!1,icon:"x-circle"},disconnected:{color:"var(--ic-text-dim)",label:"Disconnected",severity:"gray",pulse:!1,icon:"wifi-off"},unknown:{color:"var(--ic-text-dim)",label:"Unknown",severity:"gray",pulse:!1,icon:"help-circle"}},ji=new Set(Object.keys(_t)),Bi={connected:"healthy",running:"healthy",error:"errored",stopped:"disconnected",reconnecting:"healthy"};function yt(t){const e=t.toLowerCase().trim();return ji.has(e)?e:Bi[e]??"unknown"}function Ki(t){return _t[yt(t)]}function qi(t){return t==="healthy"||t==="idle"}var Fi=Object.defineProperty,Gi=Object.getOwnPropertyDescriptor,He=(t,e,i,r)=>{for(var s=r>1?void 0:r?Gi(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&Fi(e,i,s),s};const Wi={telegram:"M20.3 3.5L2.6 10.3c-1.2.5-1.2 1.2-.2 1.5l4.5 1.4 1.7 5.3c.2.6.1.8.7.8.4 0 .7-.2.9-.4l2.2-2.1 4.5 3.3c.8.5 1.4.2 1.6-.8l2.9-13.6c.3-1.3-.5-1.9-1.6-1.2zM8.4 13l8.7-5.4c.4-.3.8-.1.5.2l-7.1 6.4-.3 3.1-1.8-4.3z",discord:"M19.5 5.6A16 16 0 0015.5 4a12 12 0 00-.5 1.1 15 15 0 00-6 0A12 12 0 008.5 4 16 16 0 004.5 5.6 17 17 0 002 18.6a16 16 0 005 2.5c.4-.6.8-1.2 1.1-1.8a10 10 0 01-1.7-1l.4-.3a11.5 11.5 0 0010.4 0l.4.3c-.5.4-1.1.7-1.7 1 .3.6.7 1.2 1.1 1.8a16 16 0 005-2.5A17 17 0 0019.5 5.6zM8.3 16c-1 0-1.8-1-1.8-2.1s.8-2.1 1.8-2.1 1.9 1 1.8 2.1S9.4 16 8.3 16zm7.4 0c-1 0-1.8-1-1.8-2.1s.8-2.1 1.8-2.1 1.9 1 1.8 2.1S16.8 16 15.7 16z",slack:"M5.1 15c0 1-.8 1.8-1.8 1.8S1.5 16 1.5 15s.8-1.8 1.8-1.8h1.8V15zm.9 0c0-1 .8-1.8 1.8-1.8s1.8.8 1.8 1.8v4.5c0 1-.8 1.8-1.8 1.8S6 20.5 6 19.5V15zM9 5.1c-1 0-1.8-.8-1.8-1.8S8 1.5 9 1.5s1.8.8 1.8 1.8v1.8H9zm0 .9c1 0 1.8.8 1.8 1.8S10 9.6 9 9.6H4.5c-1 0-1.8-.8-1.8-1.8S3.5 6 4.5 6H9zm9.9 1.8c0-1 .8-1.8 1.8-1.8s1.8.8 1.8 1.8-.8 1.8-1.8 1.8h-1.8V7.8zm-.9 0c0 1-.8 1.8-1.8 1.8S14.4 8.8 14.4 7.8V3.3c0-1 .8-1.8 1.8-1.8s1.8.8 1.8 1.8v4.5zM15 18.9c1 0 1.8.8 1.8 1.8s-.8 1.8-1.8 1.8-1.8-.8-1.8-1.8v-1.8H15zm0-.9c-1 0-1.8-.8-1.8-1.8s.8-1.8 1.8-1.8h4.5c1 0 1.8.8 1.8 1.8s-.8 1.8-1.8 1.8H15z",whatsapp:"M17.5 14.4c-.3-.1-1.6-.8-1.9-.9-.3-.1-.5-.1-.7.1-.2.3-.7.9-.9 1.1-.2.2-.3.2-.6.1-.3-.1-1.2-.4-2.3-1.4-.9-.8-1.4-1.7-1.6-2-.2-.3 0-.5.1-.6l.4-.5c.1-.2.2-.3.2-.5.1-.2 0-.3 0-.5s-.7-1.6-.9-2.2c-.3-.6-.5-.5-.7-.5h-.6c-.2 0-.5.1-.8.3-.3.3-1 1-1 2.5s1.1 2.9 1.2 3.1c.2.2 2.1 3.2 5 4.5.7.3 1.3.5 1.7.6.7.2 1.3.2 1.8.1.6-.1 1.6-.7 1.9-1.3.2-.6.2-1.2.2-1.3-.1-.1-.3-.2-.6-.3zM12 2C6.5 2 2 6.5 2 12c0 1.8.5 3.5 1.3 4.9L2 22l5.2-1.4c1.4.8 3 1.2 4.8 1.2 5.5 0 10-4.5 10-10S17.5 2 12 2z",line:"M22 10.8c0-4.8-4.8-8.7-10.8-8.7S.4 6 .4 10.8c0 4.3 3.8 7.9 9 8.6.3.1.8.2.9.5.1.3.1.6 0 .9l-.1.9c0 .3-.2 1.1.9.6s6.2-3.7 8.5-6.3c1.6-1.6 2.4-3.4 2.4-5.2zM7.5 13.3H5.7c-.3 0-.5-.2-.5-.5V9.2c0-.3.2-.5.5-.5s.5.2.5.5v3.1h1.3c.3 0 .5.2.5.5s-.2.5-.5.5zm1.9-.5c0 .3-.2.5-.5.5s-.5-.2-.5-.5V9.2c0-.3.2-.5.5-.5s.5.2.5.5v3.6zm5 0c0 .2-.1.4-.3.4l-.2.1-2.5-3.4v3c0 .3-.2.5-.5.5s-.5-.2-.5-.5V9.2c0-.2.1-.4.3-.4h.1l2.6 3.5V9.2c0-.3.2-.5.5-.5s.5.2.5.5v3.6zm3.5.5h-1.8c-.3 0-.5-.2-.5-.5V9.2c0-.3.2-.5.5-.5s.5.2.5.5v3.1h1.3c.3 0 .5.2.5.5s-.2.5-.5.5z",signal:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 3c3.9 0 7 3.1 7 7s-3.1 7-7 7-7-3.1-7-7 3.1-7 7-7zm0 3a4 4 0 100 8 4 4 0 000-8zm0 2.5a1.5 1.5 0 110 3 1.5 1.5 0 010-3z",imessage:"M12 2C6.5 2 2 5.8 2 10.5c0 2.7 1.5 5.1 3.8 6.7-.2 1-.6 2.5-1.8 3.8 2.1-.3 3.8-1.1 4.8-1.8.9.2 2 .3 3.2.3 5.5 0 10-3.8 10-8.5S17.5 2 12 2z",irc:"M4 4h16v12H5.2L4 17.2V4zm2 2v8h12V6H6zm2 2h8v1H8V8zm0 3h6v1H8v-1z"},Ji={telegram:"var(--ic-telegram)",discord:"var(--ic-discord)",slack:"var(--ic-slack)",whatsapp:"var(--ic-whatsapp)",line:"var(--ic-line)",signal:"var(--ic-signal)",imessage:"var(--ic-imessage)",irc:"var(--ic-irc)"},Xi="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2z";let fe=class extends x{constructor(){super(...arguments),this.platform="",this.size="20px"}render(){const t=this.platform.toLowerCase(),e=Wi[t]??Xi,i=Ji[t]??"var(--ic-text-dim)";return o`
1646
- <svg
1647
- width=${this.size}
1648
- height=${this.size}
1649
- viewBox="0 0 24 24"
1650
- fill=${i}
1651
- aria-hidden="true"
1652
- >
1653
- ${W`<path d=${e} />`}
1654
- </svg>
1655
- `}};fe.styles=[O,S`
1656
- :host {
1657
- display: inline-flex;
1658
- align-items: center;
1659
- }
1660
-
1661
- svg {
1662
- display: block;
1663
- }
1664
- `];He([u()],fe.prototype,"platform",2);He([u()],fe.prototype,"size",2);fe=He([A("ic-platform-icon")],fe);var Yi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,te=(t,e,i,r)=>{for(var s=r>1?void 0:r?Zi(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&Yi(e,i,s),s};let V=class extends x{constructor(){super(...arguments),this.channelType="",this.name="",this.status="disconnected",this.enabled=!1,this.uptime=0,this.channelId=""}_formatUptime(t){if(t<60)return"0m";const e=Math.floor(t/86400),i=Math.floor(t%86400/3600),r=Math.floor(t%3600/60);return e>0?`${e}d ${i}h`:i>0?`${i}h`:`${r}m`}_handleClick(){this.dispatchEvent(new CustomEvent("navigate",{detail:`channels/${this.channelId||this.channelType}`,bubbles:!0,composed:!0}))}_handleKeydown(t){(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._handleClick())}render(){const t=Ki(this.status),e=this.name||this.channelType,i=this.uptime>0&&qi(yt(this.status));return o`
1665
- <div
1666
- class="badge"
1667
- role="link"
1668
- tabindex="0"
1669
- @click=${this._handleClick}
1670
- @keydown=${this._handleKeydown}
1671
- >
1672
- <ic-platform-icon .platform=${this.channelType} size="16px"></ic-platform-icon>
1673
- <span class="channel-name">${e}</span>
1674
- <span class="status-dot ${t.pulse?"pulse":""}" style="background: ${t.color}"></span>
1675
- <span class="status-label" style="font-size: 0.6875rem; color: ${t.color};">${t.label}</span>
1676
- ${i?o`<span class="uptime">${this._formatUptime(this.uptime)}</span>`:""}
1677
- ${this.enabled?"":o`<span class="disabled-label">(off)</span>`}
1678
- </div>
1679
- `}};V.styles=[O,j,S`
1680
- :host {
1681
- display: inline-block;
1682
- }
1683
-
1684
- .badge {
1685
- display: inline-flex;
1686
- align-items: center;
1687
- gap: 0.5rem;
1688
- padding: 0.5rem 0.875rem;
1689
- background: var(--ic-surface);
1690
- border: 1px solid var(--ic-border);
1691
- border-radius: 0.5rem;
1692
- font-size: 0.8125rem;
1693
- transition: border-color 0.15s;
1694
- cursor: pointer;
1695
- }
1696
-
1697
- .badge:hover {
1698
- border-color: var(--ic-border-hover, #374151);
1699
- }
1700
-
1701
- .badge:focus-visible {
1702
- outline: 2px solid var(--ic-accent);
1703
- outline-offset: 2px;
1704
- }
1705
-
1706
- .channel-name {
1707
- color: var(--ic-text-muted);
1708
- font-weight: 500;
1709
- text-transform: capitalize;
1710
- }
1711
-
1712
- .status-dot {
1713
- width: 0.5rem;
1714
- height: 0.5rem;
1715
- border-radius: 50%;
1716
- margin-left: 0.25rem;
1717
- }
1718
-
1719
- .status-dot.pulse {
1720
- animation: pulse 2s ease-in-out infinite;
1721
- }
1722
-
1723
- @keyframes pulse {
1724
- 0%, 100% { opacity: 1; }
1725
- 50% { opacity: 0.4; }
1726
- }
1727
-
1728
- @media (prefers-reduced-motion: reduce) {
1729
- .status-dot.pulse { animation: none; }
1730
- }
1731
-
1732
- .uptime {
1733
- font-size: var(--ic-text-xs);
1734
- color: var(--ic-text-dim);
1735
- }
1736
-
1737
- .disabled-label {
1738
- font-size: 0.6875rem;
1739
- color: var(--ic-text-dim);
1740
- margin-left: 0.125rem;
1741
- }
1742
- `];te([u({type:String})],V.prototype,"channelType",2);te([u({type:String})],V.prototype,"name",2);te([u({type:String})],V.prototype,"status",2);te([u({type:Boolean})],V.prototype,"enabled",2);te([u({type:Number})],V.prototype,"uptime",2);te([u({type:String})],V.prototype,"channelId",2);V=te([A("ic-channel-badge")],V);var Qi=Object.defineProperty,es=Object.getOwnPropertyDescriptor,je=(t,e,i,r)=>{for(var s=r>1?void 0:r?es(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&Qi(e,i,s),s};let be=class extends x{constructor(){super(...arguments),this.options=[],this.selected=new Set}_toggleChip(t){const e=new Set(this.selected);e.has(t)?e.delete(t):e.add(t),this.selected=e,this.dispatchEvent(new CustomEvent("filter-change",{detail:{selected:e},bubbles:!0,composed:!0}))}_toggleAll(){const e=this.options.every(i=>this.selected.has(i.value))?new Set:new Set(this.options.map(i=>i.value));this.selected=e,this.dispatchEvent(new CustomEvent("filter-change",{detail:{selected:e},bubbles:!0,composed:!0}))}_renderChip(t,e,i,r){if(e){const s=r??"var(--ic-accent)";return o`
1743
- <button
1744
- class="chip"
1745
- style="background: ${s}33; color: ${s}; border: 1px solid ${s};"
1746
- @click=${i}
1747
- >
1748
- ${t}
1749
- </button>
1750
- `}return o`
1751
- <button class="chip chip--unselected" @click=${i}>
1752
- ${t}
1753
- </button>
1754
- `}render(){const t=this.options.length>0&&this.options.every(e=>this.selected.has(e.value));return o`
1755
- <div class="chips">
1756
- ${this._renderChip("All",t,()=>this._toggleAll())}
1757
- ${this.options.map(e=>this._renderChip(e.label,this.selected.has(e.value),()=>this._toggleChip(e.value),e.color))}
1758
- </div>
1759
- `}};be.styles=[O,j,S`
1760
- :host {
1761
- display: block;
1762
- }
1763
-
1764
- .chips {
1765
- display: flex;
1766
- flex-wrap: wrap;
1767
- gap: var(--ic-space-xs);
1768
- }
1769
-
1770
- .chip {
1771
- border-radius: 9999px;
1772
- padding: 0.25rem 0.75rem;
1773
- font-size: var(--ic-text-xs);
1774
- cursor: pointer;
1775
- transition: all 0.15s;
1776
- font-family: inherit;
1777
- line-height: 1.5;
1778
- }
1779
-
1780
- .chip--unselected {
1781
- background: transparent;
1782
- color: var(--ic-text-dim);
1783
- border: 1px solid var(--ic-border);
1784
- }
1785
-
1786
- .chip--unselected:hover {
1787
- border-color: var(--ic-text-dim);
1788
- }
1789
- `];je([u({attribute:!1})],be.prototype,"options",2);je([u({attribute:!1})],be.prototype,"selected",2);be=je([A("ic-filter-chips")],be);var ts=Object.defineProperty,is=Object.getOwnPropertyDescriptor,ie=(t,e,i,r)=>{for(var s=r>1?void 0:r?is(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&ts(e,i,s),s};const wt={"message:received":{label:"MSG IN",color:"#3b82f6"},"message:sent":{label:"MSG OUT",color:"#22c55e"},"message:streaming":{label:"STREAM",color:"#8b5cf6"},"session:created":{label:"SESSION",color:"#06b6d4"},"session:expired":{label:"EXPIRED",color:"#6b7280"},"audit:event":{label:"AUDIT",color:"#f59e0b"},"skill:loaded":{label:"SKILL",color:"#10b981"},"skill:executed":{label:"SKILL RUN",color:"#10b981"},"skill:rejected":{label:"REJECTED",color:"#ef4444"},"scheduler:job_started":{label:"JOB START",color:"#8b5cf6"},"scheduler:job_completed":{label:"JOB DONE",color:"#22c55e"},"scheduler:heartbeat_check":{label:"HEARTBEAT",color:"#06b6d4"},"scheduler:task_extracted":{label:"TASK",color:"#f59e0b"},"system:error":{label:"ERROR",color:"#ef4444"}},ss=Object.entries(wt).map(([t,e])=>({value:t,label:e.label,color:e.color}));function rs(t){const e=Date.now()-t,i=Math.floor(e/1e3);if(i<60)return`${i}s ago`;const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function ns(t,e){if(t==="message:received"||t==="message:sent"){const r=e.channelType??e.channelId??"",s=e.text??"",a=s.length>60?s.slice(0,57)+"...":s;return r?`[${r}] ${a}`:a}if(t==="system:error")return(e.message??e.error??"Unknown error").slice(0,80);if(t==="skill:executed"||t==="skill:loaded")return e.skillName??e.name??"unknown skill";if(t==="scheduler:job_completed"||t==="scheduler:job_started")return e.taskId??e.jobId??"";if(t==="audit:event")return e.action??e.type??"audit event";const i=Object.keys(e).slice(0,2);return i.length===0?"":i.map(r=>`${r}: ${String(e[r]).slice(0,30)}`).join(", ")}let H=class extends x{constructor(){super(...arguments),this.entries=[],this.sseSubscribe=null,this._liveEntries=[],this._activeFilters=new Set,this._paused=!1,this._pauseBuffer=[],this._unsubscribe=null,this._nextLiveId=1e5}connectedCallback(){super.connectedCallback(),this._startSse()}disconnectedCallback(){super.disconnectedCallback(),this._stopSse()}updated(t){t.has("sseSubscribe")&&(this._stopSse(),this._startSse())}_startSse(){this.sseSubscribe&&(this._unsubscribe=this.sseSubscribe((t,e)=>{if(t==="ping"||t==="error")return;const i={id:this._nextLiveId++,event:t,payload:e??{},timestamp:Date.now()};this._paused?this._pauseBuffer=[i,...this._pauseBuffer].slice(0,200):this._liveEntries=[i,...this._liveEntries].slice(0,200)}))}_stopSse(){this._unsubscribe?.(),this._unsubscribe=null}_mergedEntries(){const t=[...this.entries].reverse(),e=[...this._liveEntries,...t],i=new Set,r=[];for(const s of e)if(!i.has(s.id)&&(i.add(s.id),r.push(s),r.length>=200))break;return r}_onFilterChange(t){this._activeFilters=t.detail.selected}_togglePause(){this._paused?(this._liveEntries=[...this._pauseBuffer,...this._liveEntries].slice(0,200),this._pauseBuffer=[],this._paused=!1):this._paused=!0}render(){const t=this._mergedEntries(),e=this._activeFilters.size===0?t:t.filter(r=>this._activeFilters.has(r.event)),i=this._unsubscribe!==null;return o`
1790
- <div class="feed-container" aria-label="Activity feed">
1791
- <div class="feed-header">
1792
- <span class="feed-title">Recent Activity</span>
1793
- <div class="header-controls">
1794
- ${i?this._paused?o`
1795
- <span class="paused-indicator">
1796
- <span class="paused-dot"></span>
1797
- Paused
1798
- </span>
1799
- `:o`
1800
- <span class="live-indicator">
1801
- <span class="live-dot"></span>
1802
- Live
1803
- </span>
1804
- `:g}
1805
- ${i?o`
1806
- <button
1807
- class="pause-btn"
1808
- @click=${this._togglePause}
1809
- aria-label=${this._paused?"Resume live feed":"Pause live feed"}
1810
- >
1811
- ${this._paused?`Resume (${this._pauseBuffer.length})`:"Pause"}
1812
- </button>
1813
- `:g}
1814
- </div>
1815
- </div>
1816
-
1817
- <div class="feed-filters">
1818
- <ic-filter-chips
1819
- .options=${ss}
1820
- .selected=${this._activeFilters}
1821
- @filter-change=${this._onFilterChange}
1822
- ></ic-filter-chips>
1823
- </div>
1824
-
1825
- <div class="feed-list" aria-live="polite">
1826
- ${e.length===0?o`
1827
- <div class="empty-state">No activity yet</div>
1828
- `:e.map(r=>{const s=wt[r.event]??{label:r.event.toUpperCase(),color:"#6b7280"},a=ns(r.event,r.payload);return o`
1829
- <div class="feed-item">
1830
- <span
1831
- class="event-badge"
1832
- style="background: ${s.color}1a; color: ${s.color}"
1833
- >
1834
- ${s.label}
1835
- </span>
1836
- <span class="event-summary">${a}</span>
1837
- <span class="event-time">${rs(r.timestamp)}</span>
1838
- </div>
1839
- `})}
1840
- </div>
1841
- </div>
1842
- `}};H.styles=[O,j,S`
1843
- :host {
1844
- display: block;
1845
- }
1846
-
1847
- .feed-container {
1848
- background: var(--ic-surface);
1849
- border: 1px solid var(--ic-border);
1850
- border-radius: 0.75rem;
1851
- overflow: hidden;
1852
- }
1853
-
1854
- .feed-header {
1855
- display: flex;
1856
- align-items: center;
1857
- justify-content: space-between;
1858
- padding: 0.875rem 1.25rem;
1859
- border-bottom: 1px solid var(--ic-border);
1860
- }
1861
-
1862
- .feed-title {
1863
- font-size: 0.875rem;
1864
- font-weight: 600;
1865
- color: var(--ic-text);
1866
- }
1867
-
1868
- .header-controls {
1869
- display: flex;
1870
- align-items: center;
1871
- gap: 0.5rem;
1872
- }
1873
-
1874
- .live-indicator {
1875
- display: flex;
1876
- align-items: center;
1877
- gap: 0.375rem;
1878
- font-size: 0.75rem;
1879
- color: var(--ic-success);
1880
- }
1881
-
1882
- .live-dot {
1883
- width: 0.375rem;
1884
- height: 0.375rem;
1885
- border-radius: 50%;
1886
- background: var(--ic-success);
1887
- animation: pulse 2s infinite;
1888
- }
1889
-
1890
- @keyframes pulse {
1891
- 0%,
1892
- 100% {
1893
- opacity: 1;
1894
- }
1895
- 50% {
1896
- opacity: 0.4;
1897
- }
1898
- }
1899
-
1900
- .paused-indicator {
1901
- display: flex;
1902
- align-items: center;
1903
- gap: 0.375rem;
1904
- font-size: 0.75rem;
1905
- color: var(--ic-warning);
1906
- }
1907
-
1908
- .paused-dot {
1909
- width: 0.375rem;
1910
- height: 0.375rem;
1911
- border-radius: 50%;
1912
- background: var(--ic-warning);
1913
- }
1914
-
1915
- .pause-btn {
1916
- background: transparent;
1917
- border: 1px solid var(--ic-border);
1918
- border-radius: var(--ic-radius-sm, 0.25rem);
1919
- padding: 0.125rem 0.5rem;
1920
- font-size: var(--ic-text-xs);
1921
- color: var(--ic-text-dim);
1922
- cursor: pointer;
1923
- font-family: inherit;
1924
- }
1925
-
1926
- .pause-btn:hover {
1927
- border-color: var(--ic-text-dim);
1928
- color: var(--ic-text);
1929
- }
1930
-
1931
- .feed-filters {
1932
- padding: 0.5rem 1.25rem;
1933
- border-bottom: 1px solid var(--ic-border);
1934
- }
1935
-
1936
- .feed-list {
1937
- max-height: 28rem;
1938
- overflow-y: auto;
1939
- }
1940
-
1941
- .feed-item {
1942
- display: flex;
1943
- align-items: flex-start;
1944
- gap: 0.75rem;
1945
- padding: 0.625rem 1.25rem;
1946
- border-bottom: 1px solid var(--ic-border);
1947
- font-size: 0.8125rem;
1948
- }
1949
-
1950
- .feed-item:last-child {
1951
- border-bottom: none;
1952
- }
1953
-
1954
- .event-badge {
1955
- padding: 0.125rem 0.5rem;
1956
- border-radius: 0.25rem;
1957
- font-size: 0.625rem;
1958
- font-weight: 600;
1959
- letter-spacing: 0.025em;
1960
- white-space: nowrap;
1961
- flex-shrink: 0;
1962
- }
1963
-
1964
- .event-summary {
1965
- color: var(--ic-text-muted);
1966
- flex: 1;
1967
- overflow: hidden;
1968
- text-overflow: ellipsis;
1969
- white-space: nowrap;
1970
- }
1971
-
1972
- .event-time {
1973
- color: var(--ic-text-dim);
1974
- font-size: 0.75rem;
1975
- white-space: nowrap;
1976
- flex-shrink: 0;
1977
- }
1978
-
1979
- .empty-state {
1980
- padding: 2rem 1.25rem;
1981
- text-align: center;
1982
- color: var(--ic-text-dim);
1983
- font-size: 0.875rem;
1984
- }
1985
- `];ie([u({attribute:!1})],H.prototype,"entries",2);ie([u({attribute:!1})],H.prototype,"sseSubscribe",2);ie([v()],H.prototype,"_liveEntries",2);ie([v()],H.prototype,"_activeFilters",2);ie([v()],H.prototype,"_paused",2);ie([v()],H.prototype,"_pauseBuffer",2);H=ie([A("ic-activity-feed")],H);var as=Object.defineProperty,os=Object.getOwnPropertyDescriptor,$=(t,e,i,r)=>{for(var s=r>1?void 0:r?os(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&as(e,i,s),s};const ls=6e4,_={agents:"agents",sessions:"sessions",messages:"observe/delivery",tokens:"observe/billing",cost:"observe/billing",errors:"observe/diagnostics",health:"observe/overview",context:"observe/context",channels:"channels"};function cs(t){if(t<0)return"0m";const e=Math.floor(t/86400),i=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),s=[];return e>0&&s.push(`${e}d`),(i>0||e>0)&&s.push(`${i}h`),s.push(`${r}m`),s.join(" ")}function pe(t){return new Intl.NumberFormat("en-US").format(t)}function ds(t){if(t>=1e6){const e=t/1e6;return e%1===0?`${e}M`:`${e.toFixed(1)}M`}if(t>=1e3){const e=t/1e3;return e%1===0?`${e}K`:`${e.toFixed(1)}K`}return String(t)}const dt=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function ps(t,e,i){return t<e?"var(--ic-success)":t<i?"var(--ic-warning)":"var(--ic-error)"}function hs(t,e,i){return t<e?"":t<i?"(Warning)":"(Critical)"}let y=class extends x{constructor(){super(...arguments),this.apiClient=null,this.rpcClient=null,this.eventDispatcher=null,this._loadState="loading",this._error="",this._agents=[],this._channels=[],this._activity=[],this._systemHealth=null,this._deliveryStats=null,this._messagesToday=0,this._tokenUsageToday=0,this._sessionCount=0,this._errorCount=0,this._totalCost=0,this._prevMessages=0,this._prevTokens=0,this._prevCost=0,this._mcpStatus="---",this._contextSummary=null,this._tokenSparklineData=[],this._costSparklineData=[],this._agentBilling=new Map,this._sse=null,this._rpcRefreshInterval=null,this._reloadDebounce=null}connectedCallback(){super.connectedCallback(),this._initSse()}disconnectedCallback(){super.disconnectedCallback(),this._reloadDebounce!==null&&(clearTimeout(this._reloadDebounce),this._reloadDebounce=null),this._stopRpcRefresh()}updated(t){t.has("apiClient")&&this.apiClient&&this._loadData(),t.has("rpcClient")&&(this._stopRpcRefresh(),this._startRpcRefresh(),this._loadRpcData()),t.has("eventDispatcher")&&this.eventDispatcher&&!this._sse&&this._initSse()}_navigate(t){this.dispatchEvent(new CustomEvent("navigate",{detail:t,bubbles:!0,composed:!0}))}_makeKeyHandler(t){return e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._navigate(t))}}_scheduleReload(t=300){this._reloadDebounce!==null&&clearTimeout(this._reloadDebounce),this._reloadDebounce=setTimeout(()=>{this._reloadDebounce=null,this._loadData()},t)}_initSse(){!this.eventDispatcher||this._sse||(this._sse=new Oi(this,this.eventDispatcher,{"message:received":()=>{this._messagesToday++},"message:sent":()=>{this._messagesToday++},"session:created":()=>{this._sessionCount++},"system:error":()=>{this._errorCount++},"observability:token_usage":()=>{this._scheduleReload()},"diagnostic:channel_health":()=>{this._scheduleReload(500)},"diagnostic:billing_snapshot":()=>{this._scheduleReload()},"agent:hot_added":()=>{this._scheduleReload()},"agent:hot_removed":()=>{this._scheduleReload()},"channel:registered":()=>{this._scheduleReload()},"channel:deregistered":()=>{this._scheduleReload()},"observability:metrics":()=>{this._scheduleReload(500)}}))}_startRpcRefresh(){this._rpcRefreshInterval===null&&(this._rpcRefreshInterval=setInterval(()=>{this._loadRpcData()},ls))}_stopRpcRefresh(){this._rpcRefreshInterval!==null&&(clearInterval(this._rpcRefreshInterval),this._rpcRefreshInterval=null)}async _loadRpcData(){if(!this.rpcClient||this.rpcClient.status!=="connected")return;const t=this.rpcClient,[e,i,r,s,a,n,l,c]=await Promise.allSettled([t.call("gateway.status"),t.call("obs.delivery.stats"),t.call("obs.billing.total",{sinceMs:864e5}),t.call("obs.billing.total",{sinceMs:1728e5}),t.call("session.list",{}),t.call("mcp.list"),t.call("obs.context.pipeline",{limit:50}),t.call("obs.billing.usage24h")]);if(e.status==="fulfilled"&&(this._systemHealth=e.value),i.status==="fulfilled"){const d=i.value,p=Number(d.total??d.totalDelivered??0),h=Number(d.successes??0),m=Number(d.failures??d.failed??0),f=Number(d.avgLatencyMs??0);this._deliveryStats={successRate:p>0?h/p*100:0,avgLatencyMs:f,totalDelivered:p,failed:m},this._messagesToday=p,this._errorCount=m}if(r.status==="fulfilled"){const d=Number(r.value.totalTokens??0),p=Number(r.value.totalCost??0);if(this._tokenUsageToday=d,this._totalCost=p,s.status==="fulfilled"){const h=Number(s.value.totalTokens??0),m=Number(s.value.totalCost??0);this._prevTokens=Math.max(0,h-d),this._prevCost=Math.max(0,m-p)}this._prevMessages=0}if(a.status==="fulfilled"&&(this._sessionCount=Number(a.value.total??0)),n.status==="fulfilled"){const d=n.value;if(!d.servers||d.total===0)this._mcpStatus="N/A";else{const p=d.servers.filter(h=>h.status==="connected").length;this._mcpStatus=`${p}/${d.total}`}}if(l.status==="fulfilled"){const d=l.value;if(d&&d.length>0){const p=d.filter(f=>f.cacheHitTokens>0).length,h=d.reduce((f,T)=>f+T.budgetUtilization,0)/d.length,m=d.reduce((f,T)=>f+T.tokensEvicted,0);this._contextSummary={cacheHitRate:Math.round(p/d.length*100),budgetUtilization:Math.round(h),totalEvictions:m,reReads:d.length-p}}else this._contextSummary=null}c.status==="fulfilled"&&Array.isArray(c.value)&&(this._tokenSparklineData=c.value.map(d=>d.tokens)),await Promise.allSettled([this._loadCostSparkline(),this._loadAgentBilling()])}async _loadCostSparkline(){if(!this.rpcClient)return;const t=864e5,e=Array.from({length:7},(a,n)=>this.rpcClient.call("obs.billing.total",{sinceMs:t*(n+1)})),r=(await Promise.allSettled(e)).map(a=>a.status==="fulfilled"?Number(a.value.totalCost??0):0),s=r.map((a,n)=>n===0?a:Math.max(0,a-r[n-1]));this._costSparklineData=s.reverse()}async _loadSparklineData(){!this.rpcClient||this.rpcClient.status!=="connected"||await Promise.allSettled([(async()=>{const t=await this.rpcClient.call("obs.billing.usage24h");this._tokenSparklineData=t.map(e=>e.tokens)})(),this._loadCostSparkline()])}async _loadAgentBilling(){if(!this.rpcClient||this._agents.length===0)return;const t=await Promise.allSettled(this._agents.slice(0,20).map(i=>this.rpcClient.call("obs.billing.byAgent",{agentId:i.id}))),e=new Map;t.forEach((i,r)=>{i.status==="fulfilled"&&e.set(this._agents[r].id,{cost:i.value.totalCost??0,tokens:i.value.totalTokens??0})}),this._agentBilling=e}async _loadData(){if(this.apiClient){this._loadState="loading",this._error="";try{const[t,e,i]=await Promise.all([this.apiClient.getAgents().catch(()=>[]),this.apiClient.getChannels().catch(()=>[]),this.apiClient.getActivity(50).catch(()=>[])]);this._agents=t,this._channels=e,this._activity=i,this._loadState="loaded",this._loadRpcData()}catch(t){this._error=t instanceof Error?t.message:"Failed to load dashboard data",this._loadState="error"}}}_computeDelta(t,e){if(e<=0)return t>0?{trend:"up",trendValue:"+100%"}:{trend:"flat",trendValue:""};const i=Math.round((t-e)/e*100);return i>0?{trend:"up",trendValue:`+${i}%`}:i<0?{trend:"down",trendValue:`${i}%`}:{trend:"flat",trendValue:""}}_getSseSubscriber(){return this.apiClient?this.apiClient.subscribeEvents.bind(this.apiClient):null}_renderSystemHealth(){if(!this._systemHealth)return o`
1986
- <div class="info-card info-card--link" role="link" tabindex="0"
1987
- @click=${()=>this._navigate(_.health)}
1988
- @keydown=${this._makeKeyHandler(_.health)}
1989
- aria-label="View system overview"
1990
- >
1991
- <div class="info-card-title">System Health</div>
1992
- <div class="info-row">
1993
- <span class="info-label">Loading...</span>
1994
- <span class="info-value">---</span>
1995
- </div>
1996
- </div>
1997
- `;const t=this._systemHealth,e=t.memoryUsage??0,i=Math.round(e/1024/1024),r=t.eventLoopDelay??0,s=ps(r,50,100),a=t.uptime??0,n=t.nodeVersion??"---";return o`
1998
- <div class="info-card info-card--link" role="link" tabindex="0"
1999
- @click=${()=>this._navigate(_.health)}
2000
- @keydown=${this._makeKeyHandler(_.health)}
2001
- aria-label="View system overview"
2002
- >
2003
- <div class="info-card-title">System Health</div>
2004
- <div class="info-row">
2005
- <span class="info-label">Uptime</span>
2006
- <span class="info-value">${cs(a)}</span>
2007
- </div>
2008
- <div class="info-row">
2009
- <span class="info-label">Memory (RSS)</span>
2010
- <span class="info-value">${i} MB</span>
2011
- </div>
2012
- <div class="info-row">
2013
- <span class="info-label">Event Loop Delay</span>
2014
- <span class="info-value" style="color: ${s}">
2015
- ${r.toFixed(1)}ms ${hs(r,50,100)}
2016
- </span>
2017
- </div>
2018
- <div class="info-row">
2019
- <span class="info-label">Node.js</span>
2020
- <span class="info-value">${n}</span>
2021
- </div>
2022
- <div class="info-row">
2023
- <span class="info-label">MCP Servers</span>
2024
- <span class="info-value">${this._mcpStatus}</span>
2025
- </div>
2026
- ${t.cpuUsage!=null?o`
2027
- <div class="info-row">
2028
- <span class="info-label">CPU</span>
2029
- <div style="flex: 1; max-width: 60%; margin-left: auto;">
2030
- <ic-progress-bar
2031
- .value=${Math.round(t.cpuUsage)}
2032
- .showPercent=${!0}
2033
- .thresholds=${{green:70,yellow:90}}
2034
- ></ic-progress-bar>
2035
- </div>
2036
- </div>
2037
- `:g}
2038
- </div>
2039
- `}_renderContextSummary(){if(!this._contextSummary)return o`
2040
- <div class="info-card info-card--link" role="link" tabindex="0"
2041
- @click=${()=>this._navigate(_.context)}
2042
- @keydown=${this._makeKeyHandler(_.context)}
2043
- aria-label="View context engine"
2044
- >
2045
- <div class="info-card-title">Context Engine</div>
2046
- <div class="no-data-placeholder">No pipeline data</div>
2047
- </div>
2048
- `;const t=this._contextSummary;return o`
2049
- <div class="info-card info-card--link" role="link" tabindex="0"
2050
- @click=${()=>this._navigate(_.context)}
2051
- @keydown=${this._makeKeyHandler(_.context)}
2052
- aria-label="View context engine"
2053
- >
2054
- <div class="info-card-title">Context Engine</div>
2055
- <div class="context-summary-grid">
2056
- <div class="context-metric">
2057
- <span class="context-metric-value">${t.cacheHitRate}%</span>
2058
- <span class="context-metric-label">Cache Hit Rate</span>
2059
- </div>
2060
- <div class="context-metric">
2061
- <ic-metric-gauge
2062
- .value=${t.budgetUtilization}
2063
- label="Budget Used"
2064
- size="sm"
2065
- ></ic-metric-gauge>
2066
- </div>
2067
- <div class="context-metric">
2068
- <span class="context-metric-value">${pe(t.reReads)}</span>
2069
- <span class="context-metric-label">Re-reads</span>
2070
- </div>
2071
- <div class="context-metric">
2072
- <span class="context-metric-value">${pe(t.totalEvictions)}</span>
2073
- <span class="context-metric-label">Evictions</span>
2074
- </div>
2075
- </div>
2076
- </div>
2077
- `}render(){if(this._loadState==="loading")return o`<ic-skeleton-view variant="dashboard"></ic-skeleton-view>`;if(this._loadState==="error")return o`
2078
- <div class="error-container">
2079
- <span class="error-message">${this._error}</span>
2080
- <button class="retry-btn" @click=${()=>this._loadData()}>Retry</button>
2081
- </div>
2082
- `;const t=this._agents.filter(a=>a.status==="active").length,e=this.rpcClient!=null,i=this._computeDelta(this._messagesToday,this._prevMessages),r=this._computeDelta(this._tokenUsageToday,this._prevTokens),s=this._computeDelta(this._totalCost,this._prevCost);return o`
2083
- <div class="dashboard-grid" role="region" aria-label="Dashboard">
2084
- <!-- Stats row: 6 stat cards with click-to-navigate -->
2085
- <div class="stats-row" aria-live="polite">
2086
- <div class="stat-card-link" role="link" tabindex="0"
2087
- @click=${()=>this._navigate(_.agents)}
2088
- @keydown=${this._makeKeyHandler(_.agents)}
2089
- aria-label="View all agents"
2090
- >
2091
- <ic-stat-card
2092
- label="Active Agents"
2093
- .value=${`${t}/${this._agents.length}`}
2094
- ></ic-stat-card>
2095
- </div>
2096
- <div class="stat-card-link" role="link" tabindex="0"
2097
- @click=${()=>this._navigate(_.sessions)}
2098
- @keydown=${this._makeKeyHandler(_.sessions)}
2099
- aria-label="View all sessions"
2100
- >
2101
- <ic-stat-card
2102
- label="Sessions"
2103
- .value=${e?pe(this._sessionCount):"---"}
2104
- ></ic-stat-card>
2105
- </div>
2106
- <div class="stat-card-link" role="link" tabindex="0"
2107
- @click=${()=>this._navigate(_.messages)}
2108
- @keydown=${this._makeKeyHandler(_.messages)}
2109
- aria-label="View message delivery"
2110
- >
2111
- <ic-stat-card
2112
- label="Messages Today"
2113
- .value=${e?pe(this._messagesToday):"---"}
2114
- .trend=${e?i.trend:""}
2115
- .trendValue=${e?i.trendValue:""}
2116
- ></ic-stat-card>
2117
- </div>
2118
- <div class="stat-card-link" role="link" tabindex="0"
2119
- @click=${()=>this._navigate(_.tokens)}
2120
- @keydown=${this._makeKeyHandler(_.tokens)}
2121
- aria-label="View token billing"
2122
- >
2123
- <ic-stat-card
2124
- label="Tokens Today"
2125
- .value=${e?ds(this._tokenUsageToday):"---"}
2126
- .trend=${e?r.trend:""}
2127
- .trendValue=${e?r.trendValue:""}
2128
- ></ic-stat-card>
2129
- </div>
2130
- <div class="stat-card-link" role="link" tabindex="0"
2131
- @click=${()=>this._navigate(_.cost)}
2132
- @keydown=${this._makeKeyHandler(_.cost)}
2133
- aria-label="View cost billing"
2134
- >
2135
- <ic-stat-card
2136
- label="Cost Today"
2137
- .value=${e?dt.format(this._totalCost):"---"}
2138
- .trend=${e?s.trend:""}
2139
- .trendValue=${e?s.trendValue:""}
2140
- ></ic-stat-card>
2141
- </div>
2142
- <div class="stat-card-link" role="link" tabindex="0"
2143
- @click=${()=>this._navigate(_.errors)}
2144
- @keydown=${this._makeKeyHandler(_.errors)}
2145
- aria-label="View error diagnostics"
2146
- >
2147
- <ic-stat-card
2148
- label="Errors"
2149
- .value=${e?pe(this._errorCount):"---"}
2150
- .threshold=${this._errorCount>10?"critical":this._errorCount>3?"warning":"normal"}
2151
- ></ic-stat-card>
2152
- </div>
2153
- </div>
2154
-
2155
- <!-- Info cards row: System Health + Context Engine Summary (clickable) -->
2156
- <div class="info-cards-row">
2157
- ${this._renderSystemHealth()}
2158
- ${this._renderContextSummary()}
2159
- </div>
2160
-
2161
- <!-- Sparklines row -->
2162
- <div class="sparklines-row">
2163
- <div class="sparkline-card" role="link" tabindex="0"
2164
- @click=${()=>this._navigate(_.tokens)}
2165
- @keydown=${this._makeKeyHandler(_.tokens)}
2166
- aria-label="View token usage details"
2167
- >
2168
- <div class="sparkline-header">
2169
- <span class="sparkline-title">Token Usage (24h)</span>
2170
- <ic-sparkline
2171
- .data=${this._tokenSparklineData}
2172
- width=${120}
2173
- height=${32}
2174
- color="var(--ic-accent)"
2175
- ></ic-sparkline>
2176
- </div>
2177
- </div>
2178
- <div class="sparkline-card" role="link" tabindex="0"
2179
- @click=${()=>this._navigate(_.cost)}
2180
- @keydown=${this._makeKeyHandler(_.cost)}
2181
- aria-label="View cost trend details"
2182
- >
2183
- <div class="sparkline-header">
2184
- <span class="sparkline-title">Cost Trend (7d)</span>
2185
- <ic-sparkline
2186
- .data=${this._costSparklineData}
2187
- width=${120}
2188
- height=${32}
2189
- color="var(--ic-success)"
2190
- ></ic-sparkline>
2191
- </div>
2192
- </div>
2193
- </div>
2194
-
2195
- <!-- Agents section -->
2196
- <div class="section">
2197
- <span class="section-title section-title--link"
2198
- role="link" tabindex="0"
2199
- @click=${()=>this._navigate(_.agents)}
2200
- @keydown=${this._makeKeyHandler(_.agents)}
2201
- >Agents</span>
2202
- <div class="agents-grid">
2203
- ${this._agents.length===0?o`<div class="empty-text">No agents configured</div>`:this._agents.map(a=>{const n=this._agentBilling.get(a.id);return o`
2204
- <div class="agent-card-wrapper">
2205
- <ic-agent-card
2206
- .name=${a.name??a.id}
2207
- .provider=${a.provider}
2208
- .model=${a.model}
2209
- .status=${a.status}
2210
- .agentId=${a.id}
2211
- .messagesToday=${a.messagesToday??0}
2212
- .tokenUsageToday=${a.tokenUsageToday??0}
2213
- ></ic-agent-card>
2214
- ${n?o`<div class="agent-cost-badge">${dt.format(n.cost)}</div>`:g}
2215
- </div>
2216
- `})}
2217
- </div>
2218
- </div>
2219
-
2220
- <!-- Channels section -->
2221
- <div class="section">
2222
- <span class="section-title section-title--link"
2223
- role="link" tabindex="0"
2224
- @click=${()=>this._navigate(_.channels)}
2225
- @keydown=${this._makeKeyHandler(_.channels)}
2226
- >Channels</span>
2227
- <div class="channels-row">
2228
- ${this._channels.length===0?o`<div class="empty-text">No channels configured</div>`:this._channels.map(a=>o`
2229
- <ic-channel-badge
2230
- .channelType=${a.type}
2231
- .name=${a.name}
2232
- .status=${a.status}
2233
- .enabled=${a.enabled}
2234
- .uptime=${a.uptime}
2235
- ></ic-channel-badge>
2236
- `)}
2237
- </div>
2238
- </div>
2239
-
2240
- <!-- Activity section -->
2241
- <div class="section">
2242
- <ic-activity-feed
2243
- .entries=${this._activity}
2244
- .sseSubscribe=${this._getSseSubscriber()}
2245
- ></ic-activity-feed>
2246
- </div>
2247
- </div>
2248
- `}};y.styles=[O,j,S`
2249
- :host {
2250
- display: block;
2251
- }
2252
-
2253
- .dashboard-grid {
2254
- display: grid;
2255
- grid-template-columns: 1fr;
2256
- gap: 1.5rem;
2257
- }
2258
-
2259
- /* Stats row -- 3-column grid (responsive) */
2260
- .stats-row {
2261
- display: grid;
2262
- grid-template-columns: repeat(3, 1fr);
2263
- gap: var(--ic-space-md);
2264
- }
2265
-
2266
- @media (max-width: 1023px) {
2267
- .stats-row {
2268
- grid-template-columns: repeat(2, 1fr);
2269
- }
2270
- }
2271
-
2272
- @media (max-width: 639px) {
2273
- .stats-row {
2274
- grid-template-columns: 1fr;
2275
- }
2276
- }
2277
-
2278
- /* Clickable stat card link wrappers */
2279
- .stat-card-link {
2280
- cursor: pointer;
2281
- border-radius: var(--ic-radius-md);
2282
- transition: transform 0.1s;
2283
- }
2284
-
2285
- .stat-card-link:hover {
2286
- transform: translateY(-1px);
2287
- }
2288
-
2289
- .stat-card-link:focus-visible {
2290
- outline: 2px solid var(--ic-accent);
2291
- outline-offset: 2px;
2292
- }
2293
-
2294
- /* Info cards row */
2295
- .info-cards-row {
2296
- display: grid;
2297
- grid-template-columns: 1fr 1fr;
2298
- gap: var(--ic-space-lg);
2299
- }
2300
-
2301
- @media (max-width: 767px) {
2302
- .info-cards-row {
2303
- grid-template-columns: 1fr;
2304
- }
2305
- }
2306
-
2307
- .info-card {
2308
- background: var(--ic-surface);
2309
- border: 1px solid var(--ic-border);
2310
- border-radius: var(--ic-radius-lg);
2311
- padding: var(--ic-space-lg);
2312
- }
2313
-
2314
- .info-card--link {
2315
- cursor: pointer;
2316
- transition: border-color 0.15s;
2317
- }
2318
-
2319
- .info-card--link:hover {
2320
- border-color: var(--ic-border-hover, #374151);
2321
- }
2322
-
2323
- .info-card--link:focus-visible {
2324
- outline: 2px solid var(--ic-accent);
2325
- outline-offset: 2px;
2326
- }
2327
-
2328
- .info-card-title {
2329
- font-size: var(--ic-text-sm);
2330
- font-weight: 600;
2331
- color: var(--ic-text);
2332
- margin-bottom: var(--ic-space-md);
2333
- }
2334
-
2335
- .info-row {
2336
- display: flex;
2337
- justify-content: space-between;
2338
- align-items: center;
2339
- padding: var(--ic-space-xs) 0;
2340
- font-size: var(--ic-text-sm);
2341
- }
2342
-
2343
- .info-label {
2344
- color: var(--ic-text-dim);
2345
- }
2346
-
2347
- .info-value {
2348
- color: var(--ic-text);
2349
- font-family: var(--ic-font-mono, ui-monospace, monospace);
2350
- }
2351
-
2352
- /* Context engine summary grid */
2353
- .context-summary-grid {
2354
- display: grid;
2355
- grid-template-columns: 1fr 1fr;
2356
- gap: var(--ic-space-md);
2357
- align-items: start;
2358
- }
2359
-
2360
- .context-metric {
2361
- display: flex;
2362
- flex-direction: column;
2363
- align-items: center;
2364
- gap: var(--ic-space-xs);
2365
- }
2366
-
2367
- .context-metric-label {
2368
- font-size: var(--ic-text-xs);
2369
- color: var(--ic-text-dim);
2370
- }
2371
-
2372
- .context-metric-value {
2373
- font-size: var(--ic-text-lg);
2374
- font-weight: 600;
2375
- color: var(--ic-text);
2376
- font-family: var(--ic-font-mono, ui-monospace, monospace);
2377
- }
2378
-
2379
- /* Sparklines row */
2380
- .sparklines-row {
2381
- display: grid;
2382
- grid-template-columns: 1fr 1fr;
2383
- gap: var(--ic-space-lg);
2384
- }
2385
-
2386
- @media (max-width: 639px) {
2387
- .sparklines-row {
2388
- grid-template-columns: 1fr;
2389
- }
2390
- }
2391
-
2392
- .sparkline-card {
2393
- background: var(--ic-surface);
2394
- border: 1px solid var(--ic-border);
2395
- border-radius: var(--ic-radius-lg);
2396
- padding: var(--ic-space-md) var(--ic-space-lg);
2397
- cursor: pointer;
2398
- transition: border-color 0.15s;
2399
- }
2400
-
2401
- .sparkline-card:hover {
2402
- border-color: var(--ic-border-hover, #374151);
2403
- }
2404
-
2405
- .sparkline-card:focus-visible {
2406
- outline: 2px solid var(--ic-accent);
2407
- outline-offset: 2px;
2408
- }
2409
-
2410
- .sparkline-header {
2411
- display: flex;
2412
- align-items: center;
2413
- justify-content: space-between;
2414
- gap: var(--ic-space-md);
2415
- }
2416
-
2417
- .sparkline-title {
2418
- font-size: var(--ic-text-sm);
2419
- font-weight: 600;
2420
- color: var(--ic-text-dim);
2421
- }
2422
-
2423
- /* Section styles */
2424
- .section {
2425
- display: flex;
2426
- flex-direction: column;
2427
- gap: 1rem;
2428
- }
2429
-
2430
- .section-title {
2431
- font-size: 0.875rem;
2432
- font-weight: 600;
2433
- color: var(--ic-text-dim);
2434
- text-transform: uppercase;
2435
- letter-spacing: 0.05em;
2436
- }
2437
-
2438
- .section-title--link {
2439
- cursor: pointer;
2440
- }
2441
-
2442
- .section-title--link:hover {
2443
- color: var(--ic-accent);
2444
- }
2445
-
2446
- .section-title--link:focus-visible {
2447
- outline: 2px solid var(--ic-accent);
2448
- outline-offset: 2px;
2449
- }
2450
-
2451
- .agents-grid {
2452
- display: grid;
2453
- grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
2454
- gap: 0.75rem;
2455
- }
2456
-
2457
- .agent-card-wrapper {
2458
- position: relative;
2459
- }
2460
-
2461
- .agent-cost-badge {
2462
- position: absolute;
2463
- top: 0.5rem;
2464
- right: 0.5rem;
2465
- padding: 0.125rem 0.5rem;
2466
- background: var(--ic-accent);
2467
- color: #fff;
2468
- font-size: 0.6875rem;
2469
- font-weight: 600;
2470
- border-radius: 9999px;
2471
- font-family: var(--ic-font-mono, ui-monospace, monospace);
2472
- pointer-events: none;
2473
- }
2474
-
2475
- .channels-row {
2476
- display: flex;
2477
- flex-wrap: wrap;
2478
- gap: 0.5rem;
2479
- }
2480
-
2481
- /* Loading & error states */
2482
- .state-container {
2483
- display: flex;
2484
- align-items: center;
2485
- justify-content: center;
2486
- padding: 3rem;
2487
- color: var(--ic-text-dim);
2488
- font-size: 0.875rem;
2489
- }
2490
-
2491
- .error-container {
2492
- display: flex;
2493
- flex-direction: column;
2494
- align-items: center;
2495
- gap: 0.75rem;
2496
- padding: 3rem;
2497
- }
2498
-
2499
- .error-message {
2500
- color: var(--ic-error);
2501
- font-size: 0.875rem;
2502
- }
2503
-
2504
- .retry-btn {
2505
- padding: 0.5rem 1rem;
2506
- background: var(--ic-surface);
2507
- border: 1px solid var(--ic-border);
2508
- border-radius: 0.375rem;
2509
- color: var(--ic-text);
2510
- font-size: 0.8125rem;
2511
- cursor: pointer;
2512
- font-family: inherit;
2513
- }
2514
-
2515
- .retry-btn:hover {
2516
- background: var(--ic-surface-alt, #374151);
2517
- }
2518
-
2519
- .loading-spinner {
2520
- width: 1.5rem;
2521
- height: 1.5rem;
2522
- border: 2px solid var(--ic-border);
2523
- border-top-color: var(--ic-accent);
2524
- border-radius: 50%;
2525
- animation: spin 0.8s linear infinite;
2526
- }
2527
-
2528
- @keyframes spin {
2529
- to {
2530
- transform: rotate(360deg);
2531
- }
2532
- }
2533
-
2534
- .empty-text {
2535
- color: var(--ic-text-dim);
2536
- font-size: 0.8125rem;
2537
- }
2538
-
2539
- .stat-value-placeholder {
2540
- color: var(--ic-text-dim);
2541
- }
2542
-
2543
- .no-data-placeholder {
2544
- color: var(--ic-text-dim);
2545
- font-size: var(--ic-text-sm);
2546
- padding: var(--ic-space-md) 0;
2547
- }
2548
- `];$([u({attribute:!1})],y.prototype,"apiClient",2);$([u({attribute:!1})],y.prototype,"rpcClient",2);$([u({attribute:!1})],y.prototype,"eventDispatcher",2);$([v()],y.prototype,"_loadState",2);$([v()],y.prototype,"_error",2);$([v()],y.prototype,"_agents",2);$([v()],y.prototype,"_channels",2);$([v()],y.prototype,"_activity",2);$([v()],y.prototype,"_systemHealth",2);$([v()],y.prototype,"_deliveryStats",2);$([v()],y.prototype,"_messagesToday",2);$([v()],y.prototype,"_tokenUsageToday",2);$([v()],y.prototype,"_sessionCount",2);$([v()],y.prototype,"_errorCount",2);$([v()],y.prototype,"_totalCost",2);$([v()],y.prototype,"_prevMessages",2);$([v()],y.prototype,"_prevTokens",2);$([v()],y.prototype,"_prevCost",2);$([v()],y.prototype,"_mcpStatus",2);$([v()],y.prototype,"_contextSummary",2);$([v()],y.prototype,"_tokenSparklineData",2);$([v()],y.prototype,"_costSparklineData",2);$([v()],y.prototype,"_agentBilling",2);y=$([A("ic-dashboard")],y);var us=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,E=(t,e,i,r)=>{for(var s=r>1?void 0:r?vs(e,i):e,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(r?n(e,i,s):n(s))||s);return r&&s&&us(e,i,s),s};const pt={"ic-chat-console":()=>b(()=>import("./chat-console-CNmzl0JW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),"ic-memory-inspector":()=>b(()=>import("./memory-inspector-1hDGCGat.js"),__vite__mapDeps([11,12,7,8,6,13,14])),"ic-agent-list":()=>b(()=>import("./agent-list-LHCJ4rw2.js"),__vite__mapDeps([15,12,7,6,14,9,5])),"ic-agent-detail":()=>b(()=>import("./agent-detail-BG9MGWWj.js"),__vite__mapDeps([16,17,7,14,8])),"ic-agent-editor":()=>b(()=>import("./agent-editor-C26Q_xCs.js"),__vite__mapDeps([18,17,7,19])),"ic-workspace-manager":()=>b(()=>import("./workspace-manager-BQlr10iH.js"),__vite__mapDeps([20,17,7,14,9,5,8])),"ic-skills-view":()=>b(()=>import("./skills-D8yVfSUy.js"),__vite__mapDeps([21,22,6,9,5,14,7])),"ic-mcp-management":()=>b(()=>import("./mcp-management-BNZPnpDn.js"),__vite__mapDeps([23,9,5,14,7,8])),"ic-models-view":()=>b(()=>import("./models-C1qcU_j3.js"),__vite__mapDeps([24,22,9,5,7,25,6])),"ic-channel-list":()=>b(()=>import("./channel-list-B8dj3O9a.js"),__vite__mapDeps([26,14,9,5])),"ic-channel-detail":()=>b(()=>import("./channel-detail-CaInesJM.js"),__vite__mapDeps([27,17,22,5,25,8,7,9])),"ic-message-center":()=>b(()=>import("./message-center-CXefwsUu.js"),__vite__mapDeps([28,17,9,5,14,8])),"ic-scheduler-view":()=>b(()=>import("./scheduler-BGgwKd06.js"),__vite__mapDeps([29,22,9,5,8,7])),"ic-session-list-view":()=>b(()=>import("./session-list-6ybUTxbY.js"),__vite__mapDeps([30,1,12,7,8,6,9,5,14])),"ic-session-detail":()=>b(()=>import("./session-detail-SGEYNJ0M.js"),__vite__mapDeps([31,1,2,3,4,5,17,7,8,10,32,14,9])),"ic-observe-dashboard":()=>b(()=>import("./observe-view-C0VBhX4C.js"),__vite__mapDeps([33,34,22,7,8,9,5,35])),"ic-context-engine-view":()=>b(()=>import("./context-engine-BZ5Am6hA.js"),__vite__mapDeps([36,10,32,8,9,5])),"ic-billing-view":()=>b(()=>import("./billing-view-CtYvBqTE.js"),__vite__mapDeps([37,38,9,5])),"ic-delivery-view":()=>b(()=>import("./delivery-view-OfBZof-m.js"),__vite__mapDeps([39,38,8,35,7,13,9,5])),"ic-diagnostics-view":()=>b(()=>import("./diagnostics-view-YFwCxgr2.js"),__vite__mapDeps([40,34,38,7,8,9,5])),"ic-subagents-view":()=>b(()=>import("./subagents-HHXMeHYo.js"),__vite__mapDeps([41,9,5,14,7,8])),"ic-security-view":()=>b(()=>import("./security-D15st4xx.js"),__vite__mapDeps([42,22,9,5,7,8,25,43,19])),"ic-approvals-view":()=>b(()=>import("./approvals-q9VH_IKr.js"),[]),"ic-config-editor":()=>b(()=>import("./config-editor-DX4ITw6y.js"),__vite__mapDeps([44,9,5,14,7,8,22,43,19])),"ic-setup-wizard":()=>b(()=>import("./setup-wizard-nT0tz9QP.js"),__vite__mapDeps([45,5])),"ic-pipeline-list":()=>b(()=>import("./pipeline-list-BPW8hV-q.js"),__vite__mapDeps([46,17,14,47,9,5])),"ic-pipeline-builder":()=>b(()=>import("./pipeline-builder-DcUUIrm0.js"),__vite__mapDeps([48,17,49,4,14,47])),"ic-pipeline-monitor":()=>b(()=>import("./pipeline-monitor-Bip16T7e.js"),__vite__mapDeps([50,49,4,17,14])),"ic-pipeline-history":()=>b(()=>import("./pipeline-history-DkfOQ6SW.js"),__vite__mapDeps([51,17,14,9,5])),"ic-pipeline-history-detail":()=>b(()=>import("./pipeline-history-detail-hyHgD0ai.js"),__vite__mapDeps([52,3,4,5,17,14])),"ic-context-dag-browser":()=>b(()=>import("./context-dag-browser-BwiaF5tf.js"),__vite__mapDeps([53,9,5,6,7,8,13])),"ic-media-test-view":()=>b(()=>import("./media-test-BkK3RCRK.js"),__vite__mapDeps([54,22,9,5])),"ic-media-config-view":()=>b(()=>import("./media-config-BBvTYxOX.js"),[])},$e="comis_token";let k=class extends x{constructor(){super(...arguments),this._authenticated=!1,this._authError="",this._currentView="ic-dashboard",this._currentRoute="dashboard",this._routeParams={},this._connectionStatus="disconnected",this._pendingApprovals=0,this._errorCount=0,this._agentCount=0,this._channelCount=0,this._sessionCount=0,this._sidebarOpen=!1,this._viewLoading=!1,this._commandPaletteOpen=!1,this._shortcutsHelpOpen=!1,this._agentList=[],this._sessionList=[],this._loadedViews=new Set,this._pendingGotoKey=null,this._apiClient=null,this._router=null,this._rpcClient=null,this._globalState=null,this._eventDispatcher=null,this._stateUnsubscribe=null,this._approvalUnsub=null,this._approvalResolvedUnsub=null,this._errorUnsub=null,this._pollingController=null,this._token="",this._boundKeyHandler=this._handleGlobalKeydown.bind(this),this._gotoWaiting=!1}connectedCallback(){super.connectedCallback();const t=sessionStorage.getItem($e);t&&this._initWithToken(t),document.addEventListener("keydown",this._boundKeyHandler)}disconnectedCallback(){super.disconnectedCallback(),this._cleanup(),document.removeEventListener("keydown",this._boundKeyHandler),this._pendingGotoKey&&(clearTimeout(this._pendingGotoKey),this._pendingGotoKey=null)}_isInputTarget(t){const e=t.target?.tagName;return!!(e==="INPUT"||e==="TEXTAREA"||e==="SELECT"||t.target?.isContentEditable)}_handleGlobalKeydown(t){if((t.ctrlKey||t.metaKey)&&t.key==="k"){t.preventDefault(),this._commandPaletteOpen=!this._commandPaletteOpen;return}if(t.key==="Escape"){if(this._commandPaletteOpen){this._commandPaletteOpen=!1;return}if(this._shortcutsHelpOpen){this._shortcutsHelpOpen=!1;return}this.dispatchEvent(new CustomEvent("close-overlay",{bubbles:!0,composed:!0})),this._sidebarOpen&&(this._sidebarOpen=!1);return}if(!this._isInputTarget(t)&&!this._commandPaletteOpen){if(t.key==="?"&&!t.ctrlKey&&!t.metaKey&&!t.altKey){this._shortcutsHelpOpen=!this._shortcutsHelpOpen;return}if(this._gotoWaiting){switch(this._gotoWaiting=!1,this._pendingGotoKey&&(clearTimeout(this._pendingGotoKey),this._pendingGotoKey=null),t.key.toLowerCase()){case"d":this._router?.navigate("dashboard");return;case"a":this._router?.navigate("agents");return;case"c":this._router?.navigate("chat");return;case"s":this._router?.navigate("sessions");return;case"o":this._router?.navigate("observe/overview");return}return}t.key==="g"&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&(this._gotoWaiting=!0,this._pendingGotoKey=setTimeout(()=>{this._gotoWaiting=!1,this._pendingGotoKey=null},500))}}_handleCommand(t){switch(t){case"refresh":window.location.reload();break;case"toggle-sidebar":this._sidebarOpen=!this._sidebarOpen;break;case"logout":this._handleLogout();break;case"show-shortcuts":this._shortcutsHelpOpen=!0;break}}_initWithToken(t){this._token=t;const e=`${window.location.protocol}//${window.location.host}`;this._apiClient=st(e,t),this._apiClient.getAgents().then(()=>{sessionStorage.setItem($e,t),this._authenticated=!0,this._authError="",this._rpcClient=ni();const r=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;this._rpcClient.connect(r,t);const s=this._rpcClient;this._apiClient=st(e,t,(a,n)=>s.call(a,n)),this._globalState=ai(),this._rpcClient.onStatusChange(a=>{this._globalState?.update({connectionStatus:a})}),this._eventDispatcher=li(),this._eventDispatcher.start(e,t),this._approvalUnsub=this._eventDispatcher.addEventListener("approval:requested",()=>{const a=this._globalState.getSnapshot();this._globalState.update({pendingApprovals:a.pendingApprovals+1})}),this._approvalResolvedUnsub=this._eventDispatcher.addEventListener("approval:resolved",()=>{const a=this._globalState.getSnapshot();this._globalState.update({pendingApprovals:Math.max(0,a.pendingApprovals-1)})}),this._errorUnsub=this._eventDispatcher.addEventListener("system:error",()=>{const a=this._globalState.getSnapshot();this._globalState.update({errorCount:(a.errorCount??0)+1})}),this._stateUnsubscribe=this._globalState.subscribe(()=>{const a=this._globalState.getSnapshot();this._connectionStatus=a.connectionStatus,this._pendingApprovals=a.pendingApprovals,this._errorCount=a.errorCount,this._agentCount=a.agentCount,this._channelCount=a.channelCount,this._sessionCount=a.sessionCount}),this._pollingController=new ci(this,this._rpcClient,a=>{this._agentCount=a.agents,this._channelCount=a.channels,this._sessionCount=a.sessions,this._agentList=a.agentIds.map(n=>({id:n})),this._sessionList=a.sessionEntries.map(n=>({key:n.sessionKey,agentId:n.agentId}))},3e4),this._pollingController.hostConnected(),this._router=Qt(a=>{this._currentView=a.view,this._currentRoute=a.route,this._routeParams=a.params}),this._router.start()}).catch(()=>{this._authError="Invalid token or server unreachable",sessionStorage.removeItem($e)})}_handleLogin(t){t.preventDefault();const r=t.target.querySelector("input").value.trim();if(!r){this._authError="Please enter a token";return}this._initWithToken(r)}_handleLogout(){sessionStorage.removeItem($e),this._authenticated=!1,this._cleanup(),this._apiClient=null,this._token=""}_cleanup(){this._pollingController&&(this._pollingController.hostDisconnected(),this._pollingController=null),this._rpcClient?.disconnect(),this._rpcClient=null,this._eventDispatcher?.stop(),this._eventDispatcher=null,this._stateUnsubscribe?.(),this._stateUnsubscribe=null,this._approvalUnsub?.(),this._approvalUnsub=null,this._approvalResolvedUnsub?.(),this._approvalResolvedUnsub=null,this._errorUnsub?.(),this._errorUnsub=null,this._globalState=null,this._router?.stop(),this._router=null}_renderAuth(){return o`
2549
- <div class="auth-container">
2550
- <div class="auth-card">
2551
- <div class="auth-title">Comis</div>
2552
- <div class="auth-subtitle">Enter your gateway token to continue</div>
2553
- <form @submit=${this._handleLogin}>
2554
- <input
2555
- class="auth-input"
2556
- type="password"
2557
- placeholder="Gateway bearer token"
2558
- autocomplete="off"
2559
- />
2560
- ${this._authError?o`<div class="auth-error">${this._authError}</div>`:g}
2561
- <button class="auth-btn" type="submit">Connect</button>
2562
- </form>
2563
- </div>
2564
- </div>
2565
- `}_renderApp(){return o`
2566
- <div class="shell">
2567
- <ic-sidebar
2568
- .currentRoute=${this._currentRoute}
2569
- .pendingApprovals=${this._pendingApprovals}
2570
- .errorCount=${this._errorCount}
2571
- .agentCount=${this._agentCount}
2572
- .channelCount=${this._channelCount}
2573
- .sessionCount=${this._sessionCount}
2574
- ?open=${this._sidebarOpen}
2575
- @navigate=${t=>{this._router?.navigate(t.detail),this._sidebarOpen=!1}}
2576
- @logout=${()=>this._handleLogout()}
2577
- @close=${()=>{this._sidebarOpen=!1}}
2578
- ></ic-sidebar>
2579
- <div class="shell-main">
2580
- <ic-topbar
2581
- .connectionStatus=${this._connectionStatus}
2582
- .notificationCount=${this._pendingApprovals}
2583
- .tokenId=${this._token}
2584
- @toggle-sidebar=${()=>{this._sidebarOpen=!this._sidebarOpen}}
2585
- @logout=${()=>this._handleLogout()}
2586
- ></ic-topbar>
2587
- <main class="content" role="main" aria-label="Main content" @navigate=${t=>{this._router?.navigate(t.detail)}}>
2588
- ${this._renderView()}
2589
- </main>
2590
- </div>
2591
- </div>
2592
- ${this._commandPaletteOpen?o`
2593
- <ic-command-palette
2594
- ?open=${this._commandPaletteOpen}
2595
- .agents=${this._agentList}
2596
- .sessions=${this._sessionList}
2597
- @navigate=${t=>{this._router?.navigate(t.detail),this._commandPaletteOpen=!1}}
2598
- @close=${()=>{this._commandPaletteOpen=!1}}
2599
- @command=${t=>this._handleCommand(t.detail)}
2600
- ></ic-command-palette>
2601
- `:g}
2602
- ${this._shortcutsHelpOpen?this._renderShortcutsHelp():g}
2603
- <ic-toast></ic-toast>
2604
- `}_renderShortcutsHelp(){return o`
2605
- <div class="shortcuts-backdrop" @click=${t=>{t.target.classList.contains("shortcuts-backdrop")&&(this._shortcutsHelpOpen=!1)}}>
2606
- <div class="shortcuts-panel" role="dialog" aria-label="Keyboard shortcuts">
2607
- <div class="shortcuts-title">Keyboard Shortcuts</div>
2608
- <table class="shortcuts-table">
2609
- <tbody>
2610
- <tr><td><kbd>Ctrl</kbd>+<kbd>K</kbd></td><td>Command Palette</td></tr>
2611
- <tr><td><kbd>Esc</kbd></td><td>Close Overlay</td></tr>
2612
- <tr><td><kbd>?</kbd></td><td>Toggle This Help</td></tr>
2613
- <tr><td><kbd>G</kbd> then <kbd>D</kbd></td><td>Go to Dashboard</td></tr>
2614
- <tr><td><kbd>G</kbd> then <kbd>A</kbd></td><td>Go to Agents</td></tr>
2615
- <tr><td><kbd>G</kbd> then <kbd>C</kbd></td><td>Go to Chat</td></tr>
2616
- <tr><td><kbd>G</kbd> then <kbd>S</kbd></td><td>Go to Sessions</td></tr>
2617
- <tr><td><kbd>G</kbd> then <kbd>O</kbd></td><td>Go to Observability</td></tr>
2618
- </tbody>
2619
- </table>
2620
- </div>
2621
- </div>
2622
- `}async _loadViewIfNeeded(t){if(this._loadedViews.has(t))return;const e=pt[t];if(e){this._viewLoading=!0;try{await e(),this._loadedViews.add(t)}finally{this._viewLoading=!1}}}_getSkeletonVariant(){switch(this._currentView){case"ic-dashboard":return"dashboard";case"ic-agent-detail":case"ic-session-detail":case"ic-channel-detail":case"ic-chat-console":case"ic-message-center":return"detail";case"ic-config-editor":case"ic-pipeline-builder":case"ic-workspace-manager":return"editor";case"ic-billing-view":case"ic-delivery-view":case"ic-diagnostics-view":case"ic-observe-dashboard":case"ic-context-engine-view":case"ic-memory-inspector":case"ic-media-test-view":case"ic-media-config-view":return"table";default:return"list"}}_renderView(){if(!this._loadedViews.has(this._currentView)&&pt[this._currentView])return this._loadViewIfNeeded(this._currentView),o`<ic-skeleton-view variant=${this._getSkeletonVariant()}></ic-skeleton-view>`;switch(this._currentView){case"ic-dashboard":return o`<ic-dashboard .apiClient=${this._apiClient} .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher}></ic-dashboard>`;case"ic-chat-console":return o`<ic-chat-console
2623
- .apiClient=${this._apiClient}
2624
- .rpcClient=${this._rpcClient}
2625
- .eventDispatcher=${this._eventDispatcher}
2626
- .sessionKey=${this._routeParams.sessionKey??""}
2627
- .authToken=${this._token}
2628
- ></ic-chat-console>`;case"ic-memory-inspector":return o`<ic-memory-inspector .apiClient=${this._apiClient} .rpcClient=${this._rpcClient}></ic-memory-inspector>`;case"ic-agent-list":return o`<ic-agent-list .apiClient=${this._apiClient} .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher}></ic-agent-list>`;case"ic-agent-detail":return o`<ic-agent-detail .apiClient=${this._apiClient} .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher} .agentId=${this._routeParams.id??""}></ic-agent-detail>`;case"ic-agent-editor":return o`<ic-agent-editor .rpcClient=${this._rpcClient} .agentId=${this._routeParams.id??""}></ic-agent-editor>`;case"ic-workspace-manager":return o`<ic-workspace-manager
2629
- .rpcClient=${this._rpcClient}
2630
- .agentId=${this._routeParams.id??""}
2631
- ></ic-workspace-manager>`;case"ic-skills-view":return o`<ic-skills-view .apiClient=${this._apiClient} .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher}></ic-skills-view>`;case"ic-mcp-management":return o`<ic-mcp-management .rpcClient=${this._rpcClient} .apiClient=${this._apiClient} .eventDispatcher=${this._eventDispatcher}></ic-mcp-management>`;case"ic-models-view":return o`<ic-models-view .apiClient=${this._apiClient} .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher}></ic-models-view>`;case"ic-channel-list":return o`<ic-channel-list
2632
- .apiClient=${this._apiClient}
2633
- .rpcClient=${this._rpcClient}
2634
- .eventDispatcher=${this._eventDispatcher}
2635
- @navigate=${t=>{this._router?.navigate(t.detail)}}
2636
- ></ic-channel-list>`;case"ic-channel-detail":return o`<ic-channel-detail
2637
- .apiClient=${this._apiClient}
2638
- .rpcClient=${this._rpcClient}
2639
- .eventDispatcher=${this._eventDispatcher}
2640
- .channelType=${this._routeParams.type??""}
2641
- @navigate=${t=>{this._router?.navigate(t.detail)}}
2642
- ></ic-channel-detail>`;case"ic-message-center":return o`<ic-message-center
2643
- .rpcClient=${this._rpcClient}
2644
- .eventDispatcher=${this._eventDispatcher}
2645
- .channelType=${this._routeParams.type??""}
2646
- @navigate=${t=>{this._router?.navigate(t.detail)}}
2647
- ></ic-message-center>`;case"ic-scheduler-view":return o`<ic-scheduler-view
2648
- .rpcClient=${this._rpcClient}
2649
- .eventDispatcher=${this._eventDispatcher}
2650
- .routeParams=${this._routeParams}
2651
- ></ic-scheduler-view>`;case"ic-session-list-view":return o`<ic-session-list-view .apiClient=${this._apiClient} .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher}></ic-session-list-view>`;case"ic-session-detail":return o`<ic-session-detail .apiClient=${this._apiClient} .rpcClient=${this._rpcClient} .sessionKey=${this._routeParams.key??""}></ic-session-detail>`;case"ic-subagents-view":return o`<ic-subagents-view .rpcClient=${this._rpcClient} .apiClient=${this._apiClient} .eventDispatcher=${this._eventDispatcher}></ic-subagents-view>`;case"ic-security-view":return o`<ic-security-view .rpcClient=${this._rpcClient} .apiClient=${this._apiClient} .eventDispatcher=${this._eventDispatcher}></ic-security-view>`;case"ic-approvals-view":return o`<ic-approvals-view .rpcClient=${this._rpcClient} .apiClient=${this._apiClient}></ic-approvals-view>`;case"ic-config-editor":return o`<ic-config-editor .rpcClient=${this._rpcClient}></ic-config-editor>`;case"ic-setup-wizard":return o`<ic-setup-wizard .rpcClient=${this._rpcClient}></ic-setup-wizard>`;case"ic-observe-dashboard":return o`<ic-observe-view .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher} .initialTab=${"overview"}></ic-observe-view>`;case"ic-context-engine-view":return o`<ic-context-engine-view .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher}></ic-context-engine-view>`;case"ic-context-dag-browser":return o`<ic-context-dag-browser .rpcClient=${this._rpcClient}></ic-context-dag-browser>`;case"ic-media-test-view":return o`<ic-media-test-view .rpcClient=${this._rpcClient} .apiClient=${this._apiClient}></ic-media-test-view>`;case"ic-media-config-view":return o`<ic-media-config-view .rpcClient=${this._rpcClient}></ic-media-config-view>`;case"ic-billing-view":return o`<ic-billing-view .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher}></ic-billing-view>`;case"ic-delivery-view":return o`<ic-delivery-view .rpcClient=${this._rpcClient}></ic-delivery-view>`;case"ic-diagnostics-view":return o`<ic-diagnostics-view .rpcClient=${this._rpcClient} .eventDispatcher=${this._eventDispatcher}></ic-diagnostics-view>`;case"ic-pipeline-list":return o`<ic-pipeline-list .rpcClient=${this._rpcClient}></ic-pipeline-list>`;case"ic-pipeline-builder":return o`<ic-pipeline-builder .rpcClient=${this._rpcClient} .graphId=${this._routeParams.graphId??""}></ic-pipeline-builder>`;case"ic-pipeline-monitor":return o`<ic-pipeline-monitor .rpcClient=${this._rpcClient} .graphId=${this._routeParams.graphId??""} .eventDispatcher=${this._eventDispatcher}></ic-pipeline-monitor>`;case"ic-pipeline-history":return o`<ic-pipeline-history .rpcClient=${this._rpcClient}></ic-pipeline-history>`;case"ic-pipeline-history-detail":return o`<ic-pipeline-history-detail .rpcClient=${this._rpcClient} .graphId=${this._routeParams.graphId??""}></ic-pipeline-history-detail>`;default:return this._renderPlaceholder()}}_renderPlaceholder(){const t=this._currentView.replace(/^ic-/,"").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase());return o`
2652
- <div class="placeholder">
2653
- <div class="placeholder-title">${t}</div>
2654
- <div>Coming soon</div>
2655
- </div>
2656
- `}render(){return this._authenticated?this._renderApp():this._renderAuth()}};k.styles=S`
2657
- :host {
2658
- display: block;
2659
- min-height: 100vh;
2660
- background: var(--ic-bg, #030712);
2661
- color: var(--ic-text, #f3f4f6);
2662
- font-family: var(--ic-font-sans, ui-sans-serif, system-ui, sans-serif);
2663
- }
2664
-
2665
- .auth-container {
2666
- display: flex;
2667
- flex-direction: column;
2668
- align-items: center;
2669
- justify-content: center;
2670
- min-height: 100vh;
2671
- padding: 1rem;
2672
- }
2673
-
2674
- .auth-card {
2675
- background: var(--ic-surface, #111827);
2676
- border: 1px solid var(--ic-border, #374151);
2677
- border-radius: var(--ic-radius-lg, 0.75rem);
2678
- padding: 2rem;
2679
- max-width: 24rem;
2680
- width: 100%;
2681
- }
2682
-
2683
- .auth-title {
2684
- font-size: 1.5rem;
2685
- font-weight: 700;
2686
- margin-bottom: 0.25rem;
2687
- }
2688
-
2689
- .auth-subtitle {
2690
- color: var(--ic-text-muted, #9ca3af);
2691
- margin-bottom: 1.5rem;
2692
- font-size: 0.875rem;
2693
- }
2694
-
2695
- .auth-input {
2696
- width: 100%;
2697
- padding: 0.625rem 0.75rem;
2698
- background: var(--ic-surface-2, #1f2937);
2699
- border: 1px solid #4b5563;
2700
- border-radius: var(--ic-radius-md, 0.5rem);
2701
- color: var(--ic-text, #f3f4f6);
2702
- font-size: 0.875rem;
2703
- outline: none;
2704
- box-sizing: border-box;
2705
- }
2706
-
2707
- .auth-input:focus {
2708
- border-color: var(--ic-accent, #3b82f6);
2709
- }
2710
-
2711
- .auth-input::placeholder {
2712
- color: var(--ic-text-dim, #6b7280);
2713
- }
2714
-
2715
- .auth-btn {
2716
- width: 100%;
2717
- padding: 0.625rem;
2718
- margin-top: 1rem;
2719
- background: var(--ic-accent, #3b82f6);
2720
- color: white;
2721
- border: none;
2722
- border-radius: var(--ic-radius-md, 0.5rem);
2723
- font-size: 0.875rem;
2724
- font-weight: 500;
2725
- cursor: pointer;
2726
- }
2727
-
2728
- .auth-btn:hover {
2729
- background: var(--ic-accent-hover, #2563eb);
2730
- }
2731
-
2732
- .auth-error {
2733
- color: var(--ic-error, #f87171);
2734
- font-size: 0.75rem;
2735
- margin-top: 0.5rem;
2736
- }
2737
-
2738
- /* Shell layout: sidebar + main area */
2739
- .shell {
2740
- display: flex;
2741
- min-height: 100vh;
2742
- }
2743
-
2744
- .shell-main {
2745
- flex: 1;
2746
- display: flex;
2747
- flex-direction: column;
2748
- min-width: 0;
2749
- }
2750
-
2751
- .content {
2752
- flex: 1;
2753
- padding: var(--ic-space-lg, 1.5rem);
2754
- max-width: 1440px;
2755
- width: 100%;
2756
- margin: 0 auto;
2757
- box-sizing: border-box;
2758
- overflow-y: auto;
2759
- }
2760
-
2761
- /* Placeholder for unimplemented views */
2762
- .placeholder {
2763
- display: flex;
2764
- flex-direction: column;
2765
- align-items: center;
2766
- justify-content: center;
2767
- min-height: 300px;
2768
- color: var(--ic-text-dim, #6b7280);
2769
- font-size: 1rem;
2770
- }
2771
-
2772
- .placeholder-title {
2773
- font-size: 1.25rem;
2774
- font-weight: 600;
2775
- margin-bottom: 0.5rem;
2776
- color: var(--ic-text-muted, #9ca3af);
2777
- }
2778
-
2779
- /* Keyboard shortcuts help overlay */
2780
- .shortcuts-backdrop {
2781
- position: fixed;
2782
- inset: 0;
2783
- background: rgba(0, 0, 0, 0.5);
2784
- z-index: 99;
2785
- display: flex;
2786
- align-items: center;
2787
- justify-content: center;
2788
- }
2789
-
2790
- .shortcuts-panel {
2791
- background: var(--ic-surface, #111827);
2792
- border: 1px solid var(--ic-border, #374151);
2793
- border-radius: var(--ic-radius-lg, 0.75rem);
2794
- padding: 1.5rem;
2795
- max-width: 400px;
2796
- width: 90%;
2797
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
2798
- }
2799
-
2800
- .shortcuts-title {
2801
- font-size: 1.125rem;
2802
- font-weight: 600;
2803
- margin-bottom: 1rem;
2804
- }
2805
-
2806
- .shortcuts-table {
2807
- width: 100%;
2808
- border-collapse: collapse;
2809
- }
2810
-
2811
- .shortcuts-table td {
2812
- padding: 0.375rem 0;
2813
- font-size: 0.875rem;
2814
- }
2815
-
2816
- .shortcuts-table td:first-child {
2817
- color: var(--ic-text-dim, #6b7280);
2818
- padding-right: 1rem;
2819
- white-space: nowrap;
2820
- }
2821
-
2822
- .shortcuts-table kbd {
2823
- background: var(--ic-surface-2, #1f2937);
2824
- border: 1px solid var(--ic-border, #374151);
2825
- border-radius: 3px;
2826
- padding: 2px 6px;
2827
- font-size: 0.75rem;
2828
- font-family: inherit;
2829
- }
2830
- `;E([v()],k.prototype,"_authenticated",2);E([v()],k.prototype,"_authError",2);E([v()],k.prototype,"_currentView",2);E([v()],k.prototype,"_currentRoute",2);E([v()],k.prototype,"_routeParams",2);E([v()],k.prototype,"_connectionStatus",2);E([v()],k.prototype,"_pendingApprovals",2);E([v()],k.prototype,"_errorCount",2);E([v()],k.prototype,"_agentCount",2);E([v()],k.prototype,"_channelCount",2);E([v()],k.prototype,"_sessionCount",2);E([v()],k.prototype,"_sidebarOpen",2);E([v()],k.prototype,"_viewLoading",2);E([v()],k.prototype,"_commandPaletteOpen",2);E([v()],k.prototype,"_shortcutsHelpOpen",2);E([v()],k.prototype,"_agentList",2);E([v()],k.prototype,"_sessionList",2);E([v()],k.prototype,"_token",2);k=E([A("ic-app")],k);export{g as A,ne as E,L as I,Oi as S,x as a,o as b,qi as c,yt as d,j as f,Ki as g,S as i,fs as j,u as n,v as r,O as s,A as t,W as w};