@farazirfan/costar-server-executor 1.7.72 → 1.7.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const n of a)if(n.type==="childList")for(const r of n.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function s(a){const n={};return a.integrity&&(n.integrity=a.integrity),a.referrerPolicy&&(n.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?n.credentials="include":a.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(a){if(a.ep)return;a.ep=!0;const n=s(a);fetch(a.href,n)}})();const
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const n of a)if(n.type==="childList")for(const r of n.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function s(a){const n={};return a.integrity&&(n.integrity=a.integrity),a.referrerPolicy&&(n.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?n.credentials="include":a.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(a){if(a.ep)return;a.ep=!0;const n=s(a);fetch(a.href,n)}})();const j=globalThis,Z=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pt=Symbol(),st=new WeakMap;let Dt=class{constructor(e,s,i){if(this._$cssResult$=!0,i!==pt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=s}get styleSheet(){let e=this.o;const s=this.t;if(Z&&e===void 0){const i=s!==void 0&&s.length===1;i&&(e=st.get(s)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&st.set(s,e))}return e}toString(){return this.cssText}};const Rt=t=>new Dt(typeof t=="string"?t:t+"",void 0,pt),Pt=(t,e)=>{if(Z)t.adoptedStyleSheets=e.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(const s of e){const i=document.createElement("style"),a=j.litNonce;a!==void 0&&i.setAttribute("nonce",a),i.textContent=s.cssText,t.appendChild(i)}},it=Z?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let s="";for(const i of e.cssRules)s+=i.cssText;return Rt(s)})(t):t;const{is:Ft,defineProperty:Ht,getOwnPropertyDescriptor:Ot,getOwnPropertyNames:jt,getOwnPropertySymbols:Bt,getPrototypeOf:Nt}=Object,I=globalThis,at=I.trustedTypes,Ut=at?at.emptyScript:"",Jt=I.reactiveElementPolyfillSupport,M=(t,e)=>t,N={toAttribute(t,e){switch(e){case Boolean:t=t?Ut:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=t!==null;break;case Number:s=t===null?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch{s=null}}return s}},G=(t,e)=>!Ft(t,e),ot={attribute:!0,type:String,converter:N,reflect:!1,useDefault:!1,hasChanged:G};Symbol.metadata??=Symbol("metadata"),I.litPropertyMetadata??=new WeakMap;let A=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,s=ot){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(e,s),!s.noAccessor){const i=Symbol(),a=this.getPropertyDescriptor(e,i,s);a!==void 0&&Ht(this.prototype,e,a)}}static getPropertyDescriptor(e,s,i){const{get:a,set:n}=Ot(this.prototype,e)??{get(){return this[s]},set(r){this[s]=r}};return{get:a,set(r){const u=a?.call(this);n?.call(this,r),this.requestUpdate(e,u,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ot}static _$Ei(){if(this.hasOwnProperty(M("elementProperties")))return;const e=Nt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(M("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(M("properties"))){const s=this.properties,i=[...jt(s),...Bt(s)];for(const a of i)this.createProperty(a,s[a])}const e=this[Symbol.metadata];if(e!==null){const s=litPropertyMetadata.get(e);if(s!==void 0)for(const[i,a]of s)this.elementProperties.set(i,a)}this._$Eh=new Map;for(const[s,i]of this.elementProperties){const a=this._$Eu(s,i);a!==void 0&&this._$Eh.set(a,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const s=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const a of i)s.unshift(it(a))}else e!==void 0&&s.push(it(e));return s}static _$Eu(e,s){const i=s.attribute;return i===!1?void 0:typeof i=="string"?i: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,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Pt(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,s,i){this._$AK(e,i)}_$ET(e,s){const i=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,i);if(a!==void 0&&i.reflect===!0){const n=(i.converter?.toAttribute!==void 0?i.converter:N).toAttribute(s,i.type);this._$Em=e,n==null?this.removeAttribute(a):this.setAttribute(a,n),this._$Em=null}}_$AK(e,s){const i=this.constructor,a=i._$Eh.get(e);if(a!==void 0&&this._$Em!==a){const n=i.getPropertyOptions(a),r=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:N;this._$Em=a;const u=r.fromAttribute(s,n.type);this[a]=u??this._$Ej?.get(a)??u,this._$Em=null}}requestUpdate(e,s,i,a=!1,n){if(e!==void 0){const r=this.constructor;if(a===!1&&(n=this[e]),i??=r.getPropertyOptions(e),!((i.hasChanged??G)(n,s)||i.useDefault&&i.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,s,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,s,{useDefault:i,reflect:a,wrapped:n},r){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??s??this[e]),n!==!0||r!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(s=void 0),this._$AL.set(e,s)),a===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}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[a,n]of this._$Ep)this[a]=n;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[a,n]of i){const{wrapped:r}=n,u=this[a];r!==!0||this._$AL.has(a)||u===void 0||this.C(a,void 0,n,u)}}let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(s)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(s)}willUpdate(e){}_$AE(e){this._$EO?.forEach(s=>s.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(s=>this._$ET(s,this[s])),this._$EM()}updated(e){}firstUpdated(e){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[M("elementProperties")]=new Map,A[M("finalized")]=new Map,Jt?.({ReactiveElement:A}),(I.reactiveElementVersions??=[]).push("2.1.2");const K=globalThis,nt=t=>t,U=K.trustedTypes,rt=U?U.createPolicy("lit-html",{createHTML:t=>t}):void 0,gt="$lit$",$=`lit$${Math.random().toFixed(9).slice(2)}$`,yt="?"+$,It=`<${yt}>`,x=document,D=()=>x.createComment(""),R=t=>t===null||typeof t!="object"&&typeof t!="function",Q=Array.isArray,zt=t=>Q(t)||typeof t?.[Symbol.iterator]=="function",W=`[
|
|
2
2
|
\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ct=/-->/g,lt=/>/g,w=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),dt=/'/g,ht=/"/g,ft=/^(?:script|style|textarea|title)$/i,Vt=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),o=Vt(1),E=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),vt=new WeakMap,_=x.createTreeWalker(x,129);function mt(t,e){if(!Q(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return rt!==void 0?rt.createHTML(e):e}const Wt=(t,e)=>{const s=t.length-1,i=[];let a,n=e===2?"<svg>":e===3?"<math>":"",r=L;for(let u=0;u<s;u++){const h=t[u];let f,m,g=-1,b=0;for(;b<h.length&&(r.lastIndex=b,m=r.exec(h),m!==null);)b=r.lastIndex,r===L?m[1]==="!--"?r=ct:m[1]!==void 0?r=lt:m[2]!==void 0?(ft.test(m[2])&&(a=RegExp("</"+m[2],"g")),r=w):m[3]!==void 0&&(r=w):r===w?m[0]===">"?(r=a??L,g=-1):m[1]===void 0?g=-2:(g=r.lastIndex-m[2].length,f=m[1],r=m[3]===void 0?w:m[3]==='"'?ht:dt):r===ht||r===dt?r=w:r===ct||r===lt?r=L:(r=w,a=void 0);const y=r===w&&t[u+1].startsWith("/>")?" ":"";n+=r===L?h+zt:g>=0?(i.push(f),h.slice(0,g)+gt+h.slice(g)+$+y):h+$+(g===-2?u:y)}return[mt(t,n+(t[s]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class F{constructor({strings:e,_$litType$:s},i){let a;this.parts=[];let n=0,r=0;const u=e.length-1,h=this.parts,[f,m]=Wt(e,s);if(this.el=F.createElement(f,i),_.currentNode=this.el.content,s===2||s===3){const g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(a=_.nextNode())!==null&&h.length<u;){if(a.nodeType===1){if(a.hasAttributes())for(const g of a.getAttributeNames())if(g.endsWith(gt)){const b=m[r++],y=a.getAttribute(g).split($),H=/([.?@])?(.*)/.exec(b);h.push({type:1,index:n,name:H[2],strings:y,ctor:H[1]==="."?Zt:H[1]==="?"?Gt:H[1]==="@"?Kt:I}),a.removeAttribute(g)}else g.startsWith($)&&(h.push({type:6,index:n}),a.removeAttribute(g));if(ft.test(a.tagName)){const g=a.textContent.split($),b=g.length-1;if(b>0){a.textContent=U?U.emptyScript:"";for(let y=0;y<b;y++)a.append(g[y],D()),_.nextNode(),h.push({type:2,index:++n});a.append(g[b],D())}}}else if(a.nodeType===8)if(a.data===yt)h.push({type:2,index:n});else{let g=-1;for(;(g=a.data.indexOf($,g+1))!==-1;)h.push({type:7,index:n}),g+=$.length-1}n++}}static createElement(e,s){const i=x.createElement("template");return i.innerHTML=e,i}}function C(t,e,s=t,i){if(e===E)return e;let a=i!==void 0?s._$Co?.[i]:s._$Cl;const n=R(e)?void 0:e._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),n===void 0?a=void 0:(a=new n(t),a._$AT(t,s,i)),i!==void 0?(s._$Co??=[])[i]=a:s._$Cl=a),a!==void 0&&(e=C(t,a._$AS(t,e.values),a,i)),e}class qt{constructor(e,s){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:s},parts:i}=this._$AD,a=(e?.creationScope??x).importNode(s,!0);_.currentNode=a;let n=_.nextNode(),r=0,u=0,h=i[0];for(;h!==void 0;){if(r===h.index){let f;h.type===2?f=new P(n,n.nextSibling,this,e):h.type===1?f=new h.ctor(n,h.name,h.strings,this,e):h.type===6&&(f=new Qt(n,this,e)),this._$AV.push(f),h=i[++u]}r!==h?.index&&(n=_.nextNode(),r++)}return _.currentNode=x,a}p(e){let s=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,s),s+=i.strings.length-2):i._$AI(e[s])),s++}}class P{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,s,i,a){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=e,this._$AB=s,this._$AM=i,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const s=this._$AM;return s!==void 0&&e?.nodeType===11&&(e=s.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,s=this){e=C(this,e,s),R(e)?e===v||e==null||e===""?(this._$AH!==v&&this._$AR(),this._$AH=v):e!==this._$AH&&e!==E&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):It(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!==v&&R(this._$AH)?this._$AA.nextSibling.data=e:this.T(x.createTextNode(e)),this._$AH=e}$(e){const{values:s,_$litType$:i}=e,a=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=F.createElement(mt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===a)this._$AH.p(s);else{const n=new qt(a,this),r=n.u(this.options);n.p(s),this.T(r),this._$AH=n}}_$AC(e){let s=vt.get(e.strings);return s===void 0&&vt.set(e.strings,s=new F(e)),s}k(e){Q(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let i,a=0;for(const n of e)a===s.length?s.push(i=new P(this.O(D()),this.O(D()),this,this.options)):i=s[a],i._$AI(n),a++;a<s.length&&(this._$AR(i&&i._$AB.nextSibling,a),s.length=a)}_$AR(e=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);e!==this._$AB;){const i=nt(e).nextSibling;nt(e).remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class I{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,s,i,a,n){this.type=1,this._$AH=v,this._$AN=void 0,this.element=e,this.name=s,this._$AM=a,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=v}_$AI(e,s=this,i,a){const n=this.strings;let r=!1;if(n===void 0)e=C(this,e,s,0),r=!R(e)||e!==this._$AH&&e!==E,r&&(this._$AH=e);else{const u=e;let h,f;for(e=n[0],h=0;h<n.length-1;h++)f=C(this,u[i+h],s,h),f===E&&(f=this._$AH[h]),r||=!R(f)||f!==this._$AH[h],f===v?e=v:e!==v&&(e+=(f??"")+n[h+1]),this._$AH[h]=f}r&&!a&&this.j(e)}j(e){e===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Zt extends I{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===v?void 0:e}}class Gt extends I{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==v)}}class Kt extends I{constructor(e,s,i,a,n){super(e,s,i,a,n),this.type=5}_$AI(e,s=this){if((e=C(this,e,s,0)??v)===E)return;const i=this._$AH,a=e===v&&i!==v||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==v&&(i===v||a);a&&this.element.removeEventListener(this.name,this,i),n&&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 Qt{constructor(e,s,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){C(this,e)}}const Yt=K.litHtmlPolyfillSupport;Yt?.(F,P),(K.litHtmlVersions??=[]).push("3.3.2");const Xt=(t,e,s)=>{const i=s?.renderBefore??e;let a=i._$litPart$;if(a===void 0){const n=s?.renderBefore??null;i._$litPart$=a=new P(e.insertBefore(D(),n),n,void 0,s??{})}return a._$AI(t),a};const Y=globalThis;class T extends A{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 s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Xt(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return E}}T._$litElement$=!0,T.finalized=!0,Y.litElementHydrateSupport?.({LitElement:T});const te=Y.litElementPolyfillSupport;te?.({LitElement:T});(Y.litElementVersions??=[]).push("4.2.2");const ee=t=>(e,s)=>{s!==void 0?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};const se={attribute:!0,type:String,converter:N,reflect:!1,hasChanged:G},ie=(t=se,e,s)=>{const{kind:i,metadata:a}=s;let n=globalThis.litPropertyMetadata.get(a);if(n===void 0&&globalThis.litPropertyMetadata.set(a,n=new Map),i==="setter"&&((t=Object.create(t)).wrapped=!0),n.set(s.name,t),i==="accessor"){const{name:r}=s;return{set(u){const h=e.get.call(this);e.set.call(this,u),this.requestUpdate(r,h,t,!0,u)},init(u){return u!==void 0&&this.C(r,void 0,t,u),u}}}if(i==="setter"){const{name:r}=s;return function(u){const h=this[r];e.call(this,u),this.requestUpdate(r,h,t,!0,u)}}throw Error("Unsupported decorator location: "+i)};function ae(t){return(e,s)=>typeof s=="object"?ie(t,e,s):((i,a,n)=>{const r=a.hasOwnProperty(n);return a.constructor.createProperty(n,i),r?Object.getOwnPropertyDescriptor(a,n):void 0})(t,e,s)}function d(t){return ae({...t,state:!0,attribute:!1})}const bt={name:"",instruction:"",scheduleType:"every",every:"30m",cronExpression:"",at:""},$t="costar.dashboard.settings.v1",S={theme:"system",chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};function oe(){try{const t=localStorage.getItem($t);if(!t)return{...S};const e=JSON.parse(t);return{theme:e.theme==="light"||e.theme==="dark"||e.theme==="system"?e.theme:S.theme,chatShowThinking:typeof e.chatShowThinking=="boolean"?e.chatShowThinking:S.chatShowThinking,splitRatio:typeof e.splitRatio=="number"&&e.splitRatio>=.3&&e.splitRatio<=.8?e.splitRatio:S.splitRatio,navCollapsed:typeof e.navCollapsed=="boolean"?e.navCollapsed:S.navCollapsed,navGroupsCollapsed:typeof e.navGroupsCollapsed=="object"&&e.navGroupsCollapsed!==null?e.navGroupsCollapsed:S.navGroupsCollapsed}}catch{return{...S}}}function ne(t){try{localStorage.setItem($t,JSON.stringify(t))}catch{}}const re=[{label:"main",tabs:["dashboard","chat"]},{label:"agent",tabs:["cron","activity","sessions"]},{label:"data",tabs:["assets","projects","workspace"]},{label:"system",tabs:["skills","logs","config"]}],q={dashboard:"/",chat:"/chat",cron:"/cron",activity:"/activity",sessions:"/sessions",assets:"/assets",projects:"/projects",workspace:"/workspace",skills:"/skills",logs:"/logs",config:"/config"},ce={dashboard:"Dashboard",chat:"Chat",cron:"Cron Jobs",activity:"Activity",sessions:"Sessions",assets:"Assets",projects:"Projects",workspace:"Workspace",skills:"Skills",logs:"Logs",config:"Config"},le={dashboard:"home",chat:"messageSquare",cron:"clock",activity:"activity",sessions:"fileText",assets:"package",projects:"folder",workspace:"edit",skills:"zap",logs:"terminal",config:"settings"},de={main:"Main",agent:"Agent",data:"Data",system:"System"};function he(t){return q[t]}function wt(t){for(const[s,i]of Object.entries(q))if(t===i)return s;const e=t.replace(/\/$/,"")||"/";for(const[s,i]of Object.entries(q))if(e===i)return s;return null}function ve(t){return le[t]}function ue(t){return ce[t]}function pe(t){return de[t]||t}function ge(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function St(t){return t==="system"?ge():t}class ye{constructor(e=""){this.baseUrl=e}url(e,s){const i=this.baseUrl||window.location.origin,a=new URL(e,i);if(s)for(const[n,r]of Object.entries(s))r!==void 0&&r!==""&&a.searchParams.set(n,r);return a.toString()}async get(e,s){const i=await fetch(this.url(e,s));if(!i.ok){const a=await i.json().catch(()=>({error:i.statusText}));throw new Error(a.error||i.statusText)}return i.json()}async getText(e,s){const i=await fetch(this.url(e,s));if(!i.ok)throw new Error(i.statusText);return i.text()}async post(e,s){const i=await fetch(this.url(e),{method:"POST",headers:{"Content-Type":"application/json"},body:s!==void 0?JSON.stringify(s):void 0});if(!i.ok){const a=await i.json().catch(()=>({error:i.statusText}));throw new Error(a.error||i.statusText)}return i.json()}async put(e,s){const i=await fetch(this.url(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:s!==void 0?JSON.stringify(s):void 0});if(!i.ok){const a=await i.json().catch(()=>({error:i.statusText}));throw new Error(a.error||i.statusText)}return i.json()}async del(e){const s=await fetch(this.url(e),{method:"DELETE"});if(!s.ok){const i=await s.json().catch(()=>({error:s.statusText}));throw new Error(i.error||s.statusText)}return s.json()}streamChat(e,s){const i=new AbortController;return(async()=>{try{const a=await fetch(this.url("/api/chat"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e}),signal:i.signal});if(!a.ok||!a.body){s.onError?.(`HTTP ${a.status}: ${a.statusText}`);return}const n=a.body.getReader(),r=new TextDecoder;let u="";for(;;){const{done:h,value:f}=await n.read();if(h)break;u+=r.decode(f,{stream:!0});const m=u.split(`
|
|
4
|
-
`);u=m.pop()||"";for(const g of m){if(!g.startsWith("data: "))continue;const b=g.slice(6);if(b==="[DONE]"){s.onDone?.({});continue}try{const y=JSON.parse(b);y.type==="text_delta"||y.type==="content_block_delta"?s.onDelta(y.text||y.delta?.text||""):y.type==="tool_start"||y.type==="content_block_start"?s.onToolStart?.(y):y.type==="tool_end"||y.type==="content_block_stop"?s.onToolEnd?.(y):y.type==="message_stop"||y.type==="done"?s.onDone?.(y):y.type==="error"&&s.onError?.(y.error||"Unknown error")}catch{s.onDelta(b)}}}s.onDone?.({})}catch(a){if(a.name==="AbortError")return;s.onError?.(a.message||"Stream error")}})(),{abort:()=>i.abort()}}streamLogs(e){const s=new EventSource(this.url("/api/logs/stream"));return s.onopen=()=>e.onConnect?.(),s.onmessage=i=>{try{e.onLog(JSON.parse(i.data))}catch{e.onLog({message:i.data})}},s.onerror=()=>e.onError?.("Log stream disconnected"),{close:()=>s.close()}}}const p=new ye;async function fe(t){try{const[e,s]=await Promise.all([p.get("/api/status"),p.get("/api/version")]);t.serverStatus={online:!0,version:s.version,uptime:e.agent.uptime,userId:e.agent.userId,cronRunning:e.cron.isRunning,cronJobs:e.cron.trackedJobs,heartbeatEnabled:e.heartbeat.enabled,skills:e.skills}}catch{t.serverStatus={online:!1,version:"?",uptime:0,userId:"",cronRunning:!1,cronJobs:0,heartbeatEnabled:!1,skills:{total:0,eligible:0}}}}async function _t(t){const[e,s,i,a,n]=await Promise.allSettled([p.get("/api/status"),p.get("/api/version"),p.get("/api/db/activity/stats"),p.get("/api/db/projects",{limit:"100"}),p.get("/api/db/activity",{limit:"5"})]);e.status==="fulfilled"&&s.status==="fulfilled"?t.serverStatus={online:!0,version:s.value.version,uptime:e.value.agent.uptime,userId:e.value.agent.userId,cronRunning:e.value.cron.isRunning,cronJobs:e.value.cron.trackedJobs,heartbeatEnabled:e.value.heartbeat.enabled,skills:e.value.skills}:s.status==="fulfilled"&&(t.serverStatus={online:!0,version:s.value.version,uptime:s.value.uptime,userId:"",cronRunning:!1,cronJobs:0,heartbeatEnabled:!1,skills:{total:0,eligible:0}}),i.status==="fulfilled"&&(t.activityStats=i.value),a.status==="fulfilled"&&(t.projectCount=a.value.length,t.activeProject=a.value.find(r=>r.is_active)||null),n.status==="fulfilled"&&(t.recentActivity=n.value)}async function V(t){t.cronLoading=!0;try{t.cronJobs=await p.get("/api/cron/jobs")}catch{t.cronJobs=[]}t.cronLoading=!1}async function me(t){t.cronLoading=!0;try{const e=t.cronForm;await p.post("/api/cron/jobs",{name:e.name||"Untitled",instruction:e.instruction,schedule_type:e.scheduleType,every:e.scheduleType==="every"?e.every:void 0,cron_expression:e.scheduleType==="cron"?e.cronExpression:void 0,at:e.scheduleType==="at"?e.at:void 0}),t.cronForm={...bt},await V(t)}catch(e){alert(`Failed to create job: ${e.message}`)}t.cronLoading=!1}async function be(t,e){try{await p.post(`/api/cron/jobs/${e}/run`)}catch(s){alert(`Failed to run job: ${s.message}`)}}async function $e(t,e){if(confirm("Delete this cron job?"))try{await p.del(`/api/cron/jobs/${e}`),await V(t)}catch(s){alert(`Failed to delete job: ${s.message}`)}}async function we(t,e,s){t.cronHistoryJob=s,t.cronHistoryOpen=!0;try{t.cronHistory=await p.get("/api/cron/history",{jobId:e,limit:"50"})}catch{t.cronHistory=[]}}async function X(t){t.activityLoading=!0,t.activityOffset=0;try{const e={limit:"50",offset:"0"};t.activityStatusFilter&&(e.status=t.activityStatusFilter);const[s,i]=await Promise.allSettled([p.get("/api/db/activity",e),p.get("/api/db/activity/stats")]);s.status==="fulfilled"&&(t.activityList=s.value,t.activityHasMore=s.value.length>=50),i.status==="fulfilled"&&(t.activityStats=i.value)}catch{t.activityList=[]}t.activityLoading=!1}async function Se(t){t.activityOffset+=50;try{const e={limit:"50",offset:String(t.activityOffset)};t.activityStatusFilter&&(e.status=t.activityStatusFilter);const s=await p.get("/api/db/activity",e);t.activityList=[...t.activityList,...s],t.activityHasMore=s.length>=50}catch{t.activityHasMore=!1}}async function _e(t){if(!t.activitySearch.trim()){await X(t);return}t.activityLoading=!0;try{t.activityList=await p.get("/api/db/activity/search",{q:t.activitySearch,limit:"50"}),t.activityHasMore=!1}catch{t.activityList=[]}t.activityLoading=!1}async function xt(t){t.assetsLoading=!0;try{t.assetsList=await p.get("/api/db/assets",{limit:"100"})}catch{t.assetsList=[]}t.assetsLoading=!1}async function kt(t){t.projectsLoading=!0;try{t.projectsList=await p.get("/api/db/projects",{limit:"100"})}catch{t.projectsList=[]}t.projectsLoading=!1}async function At(t){t.sessionsLoading=!0;try{const e=await p.get("/api/sessions");t.sessionsList=e.
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),dt=/'/g,ht=/"/g,ft=/^(?:script|style|textarea|title)$/i,Vt=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),o=Vt(1),E=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),vt=new WeakMap,_=x.createTreeWalker(x,129);function mt(t,e){if(!Q(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return rt!==void 0?rt.createHTML(e):e}const Wt=(t,e)=>{const s=t.length-1,i=[];let a,n=e===2?"<svg>":e===3?"<math>":"",r=L;for(let u=0;u<s;u++){const h=t[u];let f,m,g=-1,b=0;for(;b<h.length&&(r.lastIndex=b,m=r.exec(h),m!==null);)b=r.lastIndex,r===L?m[1]==="!--"?r=ct:m[1]!==void 0?r=lt:m[2]!==void 0?(ft.test(m[2])&&(a=RegExp("</"+m[2],"g")),r=w):m[3]!==void 0&&(r=w):r===w?m[0]===">"?(r=a??L,g=-1):m[1]===void 0?g=-2:(g=r.lastIndex-m[2].length,f=m[1],r=m[3]===void 0?w:m[3]==='"'?ht:dt):r===ht||r===dt?r=w:r===ct||r===lt?r=L:(r=w,a=void 0);const y=r===w&&t[u+1].startsWith("/>")?" ":"";n+=r===L?h+It:g>=0?(i.push(f),h.slice(0,g)+gt+h.slice(g)+$+y):h+$+(g===-2?u:y)}return[mt(t,n+(t[s]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class P{constructor({strings:e,_$litType$:s},i){let a;this.parts=[];let n=0,r=0;const u=e.length-1,h=this.parts,[f,m]=Wt(e,s);if(this.el=P.createElement(f,i),_.currentNode=this.el.content,s===2||s===3){const g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(a=_.nextNode())!==null&&h.length<u;){if(a.nodeType===1){if(a.hasAttributes())for(const g of a.getAttributeNames())if(g.endsWith(gt)){const b=m[r++],y=a.getAttribute(g).split($),H=/([.?@])?(.*)/.exec(b);h.push({type:1,index:n,name:H[2],strings:y,ctor:H[1]==="."?Zt:H[1]==="?"?Gt:H[1]==="@"?Kt:z}),a.removeAttribute(g)}else g.startsWith($)&&(h.push({type:6,index:n}),a.removeAttribute(g));if(ft.test(a.tagName)){const g=a.textContent.split($),b=g.length-1;if(b>0){a.textContent=U?U.emptyScript:"";for(let y=0;y<b;y++)a.append(g[y],D()),_.nextNode(),h.push({type:2,index:++n});a.append(g[b],D())}}}else if(a.nodeType===8)if(a.data===yt)h.push({type:2,index:n});else{let g=-1;for(;(g=a.data.indexOf($,g+1))!==-1;)h.push({type:7,index:n}),g+=$.length-1}n++}}static createElement(e,s){const i=x.createElement("template");return i.innerHTML=e,i}}function C(t,e,s=t,i){if(e===E)return e;let a=i!==void 0?s._$Co?.[i]:s._$Cl;const n=R(e)?void 0:e._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),n===void 0?a=void 0:(a=new n(t),a._$AT(t,s,i)),i!==void 0?(s._$Co??=[])[i]=a:s._$Cl=a),a!==void 0&&(e=C(t,a._$AS(t,e.values),a,i)),e}class qt{constructor(e,s){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:s},parts:i}=this._$AD,a=(e?.creationScope??x).importNode(s,!0);_.currentNode=a;let n=_.nextNode(),r=0,u=0,h=i[0];for(;h!==void 0;){if(r===h.index){let f;h.type===2?f=new F(n,n.nextSibling,this,e):h.type===1?f=new h.ctor(n,h.name,h.strings,this,e):h.type===6&&(f=new Qt(n,this,e)),this._$AV.push(f),h=i[++u]}r!==h?.index&&(n=_.nextNode(),r++)}return _.currentNode=x,a}p(e){let s=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,s),s+=i.strings.length-2):i._$AI(e[s])),s++}}class F{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,s,i,a){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=e,this._$AB=s,this._$AM=i,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const s=this._$AM;return s!==void 0&&e?.nodeType===11&&(e=s.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,s=this){e=C(this,e,s),R(e)?e===v||e==null||e===""?(this._$AH!==v&&this._$AR(),this._$AH=v):e!==this._$AH&&e!==E&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):zt(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!==v&&R(this._$AH)?this._$AA.nextSibling.data=e:this.T(x.createTextNode(e)),this._$AH=e}$(e){const{values:s,_$litType$:i}=e,a=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=P.createElement(mt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===a)this._$AH.p(s);else{const n=new qt(a,this),r=n.u(this.options);n.p(s),this.T(r),this._$AH=n}}_$AC(e){let s=vt.get(e.strings);return s===void 0&&vt.set(e.strings,s=new P(e)),s}k(e){Q(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let i,a=0;for(const n of e)a===s.length?s.push(i=new F(this.O(D()),this.O(D()),this,this.options)):i=s[a],i._$AI(n),a++;a<s.length&&(this._$AR(i&&i._$AB.nextSibling,a),s.length=a)}_$AR(e=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);e!==this._$AB;){const i=nt(e).nextSibling;nt(e).remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class z{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,s,i,a,n){this.type=1,this._$AH=v,this._$AN=void 0,this.element=e,this.name=s,this._$AM=a,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=v}_$AI(e,s=this,i,a){const n=this.strings;let r=!1;if(n===void 0)e=C(this,e,s,0),r=!R(e)||e!==this._$AH&&e!==E,r&&(this._$AH=e);else{const u=e;let h,f;for(e=n[0],h=0;h<n.length-1;h++)f=C(this,u[i+h],s,h),f===E&&(f=this._$AH[h]),r||=!R(f)||f!==this._$AH[h],f===v?e=v:e!==v&&(e+=(f??"")+n[h+1]),this._$AH[h]=f}r&&!a&&this.j(e)}j(e){e===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Zt extends z{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===v?void 0:e}}class Gt extends z{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==v)}}class Kt extends z{constructor(e,s,i,a,n){super(e,s,i,a,n),this.type=5}_$AI(e,s=this){if((e=C(this,e,s,0)??v)===E)return;const i=this._$AH,a=e===v&&i!==v||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==v&&(i===v||a);a&&this.element.removeEventListener(this.name,this,i),n&&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 Qt{constructor(e,s,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){C(this,e)}}const Yt=K.litHtmlPolyfillSupport;Yt?.(P,F),(K.litHtmlVersions??=[]).push("3.3.2");const Xt=(t,e,s)=>{const i=s?.renderBefore??e;let a=i._$litPart$;if(a===void 0){const n=s?.renderBefore??null;i._$litPart$=a=new F(e.insertBefore(D(),n),n,void 0,s??{})}return a._$AI(t),a};const Y=globalThis;class T extends A{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 s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Xt(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return E}}T._$litElement$=!0,T.finalized=!0,Y.litElementHydrateSupport?.({LitElement:T});const te=Y.litElementPolyfillSupport;te?.({LitElement:T});(Y.litElementVersions??=[]).push("4.2.2");const ee=t=>(e,s)=>{s!==void 0?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};const se={attribute:!0,type:String,converter:N,reflect:!1,hasChanged:G},ie=(t=se,e,s)=>{const{kind:i,metadata:a}=s;let n=globalThis.litPropertyMetadata.get(a);if(n===void 0&&globalThis.litPropertyMetadata.set(a,n=new Map),i==="setter"&&((t=Object.create(t)).wrapped=!0),n.set(s.name,t),i==="accessor"){const{name:r}=s;return{set(u){const h=e.get.call(this);e.set.call(this,u),this.requestUpdate(r,h,t,!0,u)},init(u){return u!==void 0&&this.C(r,void 0,t,u),u}}}if(i==="setter"){const{name:r}=s;return function(u){const h=this[r];e.call(this,u),this.requestUpdate(r,h,t,!0,u)}}throw Error("Unsupported decorator location: "+i)};function ae(t){return(e,s)=>typeof s=="object"?ie(t,e,s):((i,a,n)=>{const r=a.hasOwnProperty(n);return a.constructor.createProperty(n,i),r?Object.getOwnPropertyDescriptor(a,n):void 0})(t,e,s)}function d(t){return ae({...t,state:!0,attribute:!1})}const bt={name:"",instruction:"",scheduleType:"every",every:"30m",cronExpression:"",at:""},$t="costar.dashboard.settings.v1",S={theme:"system",chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};function oe(){try{const t=localStorage.getItem($t);if(!t)return{...S};const e=JSON.parse(t);return{theme:e.theme==="light"||e.theme==="dark"||e.theme==="system"?e.theme:S.theme,chatShowThinking:typeof e.chatShowThinking=="boolean"?e.chatShowThinking:S.chatShowThinking,splitRatio:typeof e.splitRatio=="number"&&e.splitRatio>=.3&&e.splitRatio<=.8?e.splitRatio:S.splitRatio,navCollapsed:typeof e.navCollapsed=="boolean"?e.navCollapsed:S.navCollapsed,navGroupsCollapsed:typeof e.navGroupsCollapsed=="object"&&e.navGroupsCollapsed!==null?e.navGroupsCollapsed:S.navGroupsCollapsed}}catch{return{...S}}}function ne(t){try{localStorage.setItem($t,JSON.stringify(t))}catch{}}const re=[{label:"main",tabs:["dashboard","chat"]},{label:"agent",tabs:["cron","activity","sessions"]},{label:"data",tabs:["assets","projects","workspace"]},{label:"system",tabs:["skills","logs","config"]}],q={dashboard:"/",chat:"/chat",cron:"/cron",activity:"/activity",sessions:"/sessions",assets:"/assets",projects:"/projects",workspace:"/workspace",skills:"/skills",logs:"/logs",config:"/config"},ce={dashboard:"Dashboard",chat:"Chat",cron:"Cron Jobs",activity:"Activity",sessions:"Sessions",assets:"Assets",projects:"Projects",workspace:"Workspace",skills:"Skills",logs:"Logs",config:"Config"},le={dashboard:"home",chat:"messageSquare",cron:"clock",activity:"activity",sessions:"fileText",assets:"package",projects:"folder",workspace:"edit",skills:"zap",logs:"terminal",config:"settings"},de={main:"Main",agent:"Agent",data:"Data",system:"System"};function he(t){return q[t]}function wt(t){for(const[s,i]of Object.entries(q))if(t===i)return s;const e=t.replace(/\/$/,"")||"/";for(const[s,i]of Object.entries(q))if(e===i)return s;return null}function ve(t){return le[t]}function ue(t){return ce[t]}function pe(t){return de[t]||t}function ge(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function St(t){return t==="system"?ge():t}class ye{constructor(e=""){this._chatSessionId=null,this.baseUrl=e}url(e,s){const i=this.baseUrl||window.location.origin,a=new URL(e,i);if(s)for(const[n,r]of Object.entries(s))r!==void 0&&r!==""&&a.searchParams.set(n,r);return a.toString()}async get(e,s){const i=await fetch(this.url(e,s));if(!i.ok){const a=await i.json().catch(()=>({error:i.statusText}));throw new Error(a.error||i.statusText)}return i.json()}async getText(e,s){const i=await fetch(this.url(e,s));if(!i.ok)throw new Error(i.statusText);return i.text()}async post(e,s){const i=await fetch(this.url(e),{method:"POST",headers:{"Content-Type":"application/json"},body:s!==void 0?JSON.stringify(s):void 0});if(!i.ok){const a=await i.json().catch(()=>({error:i.statusText}));throw new Error(a.error||i.statusText)}return i.json()}async put(e,s){const i=await fetch(this.url(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:s!==void 0?JSON.stringify(s):void 0});if(!i.ok){const a=await i.json().catch(()=>({error:i.statusText}));throw new Error(a.error||i.statusText)}return i.json()}async del(e){const s=await fetch(this.url(e),{method:"DELETE"});if(!s.ok){const i=await s.json().catch(()=>({error:s.statusText}));throw new Error(i.error||s.statusText)}return s.json()}streamChat(e,s){const i=new AbortController;return(async()=>{try{if(!this._chatSessionId){const h=await fetch(this.url("/api/sessions"),{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal});if(!h.ok){s.onError?.(`Failed to create session: ${h.statusText}`);return}const f=await h.json();this._chatSessionId=f.id}const a=await fetch(this.url(`/api/sessions/${this._chatSessionId}/messages/stream`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e}),signal:i.signal});if(!a.ok||!a.body){a.status===404?(this._chatSessionId=null,s.onError?.("Session expired. Please try again.")):s.onError?.(`HTTP ${a.status}: ${a.statusText}`);return}const n=a.body.getReader(),r=new TextDecoder;let u="";for(;;){const{done:h,value:f}=await n.read();if(h)break;u+=r.decode(f,{stream:!0});const m=u.split(`
|
|
4
|
+
`);u=m.pop()||"";for(const g of m){if(!g.startsWith("data: "))continue;const b=g.slice(6);if(b==="[DONE]"){s.onDone?.({});continue}try{const y=JSON.parse(b);y.type==="text_delta"||y.type==="content_block_delta"?s.onDelta(y.text||y.delta?.text||""):y.type==="tool_start"||y.type==="content_block_start"?s.onToolStart?.(y):y.type==="tool_end"||y.type==="content_block_stop"?s.onToolEnd?.(y):y.type==="message_stop"||y.type==="done"?s.onDone?.(y):y.type==="error"&&s.onError?.(y.error||"Unknown error")}catch{s.onDelta(b)}}}s.onDone?.({})}catch(a){if(a.name==="AbortError")return;s.onError?.(a.message||"Stream error")}})(),{abort:()=>i.abort()}}streamLogs(e){const s=new EventSource(this.url("/api/logs/stream"));return s.onopen=()=>e.onConnect?.(),s.onmessage=i=>{try{e.onLog(JSON.parse(i.data))}catch{e.onLog({message:i.data})}},s.onerror=()=>e.onError?.("Log stream disconnected"),{close:()=>s.close()}}}const p=new ye;async function fe(t){try{const[e,s]=await Promise.all([p.get("/api/status"),p.get("/api/version")]);t.serverStatus={online:!0,version:s.version,uptime:e.agent.uptime,userId:e.agent.userId,cronRunning:e.cron.isRunning,cronJobs:e.cron.trackedJobs,heartbeatEnabled:e.heartbeat.enabled,skills:e.skills}}catch{t.serverStatus={online:!1,version:"?",uptime:0,userId:"",cronRunning:!1,cronJobs:0,heartbeatEnabled:!1,skills:{total:0,eligible:0}}}}async function _t(t){const[e,s,i,a,n]=await Promise.allSettled([p.get("/api/status"),p.get("/api/version"),p.get("/api/db/activity/stats"),p.get("/api/db/projects",{limit:"100"}),p.get("/api/db/activity",{limit:"5"})]);e.status==="fulfilled"&&s.status==="fulfilled"?t.serverStatus={online:!0,version:s.value.version,uptime:e.value.agent.uptime,userId:e.value.agent.userId,cronRunning:e.value.cron.isRunning,cronJobs:e.value.cron.trackedJobs,heartbeatEnabled:e.value.heartbeat.enabled,skills:e.value.skills}:s.status==="fulfilled"&&(t.serverStatus={online:!0,version:s.value.version,uptime:s.value.uptime,userId:"",cronRunning:!1,cronJobs:0,heartbeatEnabled:!1,skills:{total:0,eligible:0}}),i.status==="fulfilled"&&(t.activityStats=i.value),a.status==="fulfilled"&&(t.projectCount=a.value.length,t.activeProject=a.value.find(r=>r.is_active)||null),n.status==="fulfilled"&&(t.recentActivity=n.value)}async function V(t){t.cronLoading=!0;try{t.cronJobs=await p.get("/api/cron/jobs")}catch{t.cronJobs=[]}t.cronLoading=!1}async function me(t){t.cronLoading=!0;try{const e=t.cronForm;await p.post("/api/cron/jobs",{name:e.name||"Untitled",instruction:e.instruction,schedule_type:e.scheduleType,every:e.scheduleType==="every"?e.every:void 0,cron_expression:e.scheduleType==="cron"?e.cronExpression:void 0,at:e.scheduleType==="at"?e.at:void 0}),t.cronForm={...bt},await V(t)}catch(e){alert(`Failed to create job: ${e.message}`)}t.cronLoading=!1}async function be(t,e){try{await p.post(`/api/cron/jobs/${e}/run`)}catch(s){alert(`Failed to run job: ${s.message}`)}}async function $e(t,e){if(confirm("Delete this cron job?"))try{await p.del(`/api/cron/jobs/${e}`),await V(t)}catch(s){alert(`Failed to delete job: ${s.message}`)}}async function we(t,e,s){t.cronHistoryJob=s,t.cronHistoryOpen=!0;try{t.cronHistory=await p.get("/api/cron/history",{jobId:e,limit:"50"})}catch{t.cronHistory=[]}}async function X(t){t.activityLoading=!0,t.activityOffset=0;try{const e={limit:"50",offset:"0"};t.activityStatusFilter&&(e.status=t.activityStatusFilter);const[s,i]=await Promise.allSettled([p.get("/api/db/activity",e),p.get("/api/db/activity/stats")]);s.status==="fulfilled"&&(t.activityList=s.value,t.activityHasMore=s.value.length>=50),i.status==="fulfilled"&&(t.activityStats=i.value)}catch{t.activityList=[]}t.activityLoading=!1}async function Se(t){t.activityOffset+=50;try{const e={limit:"50",offset:String(t.activityOffset)};t.activityStatusFilter&&(e.status=t.activityStatusFilter);const s=await p.get("/api/db/activity",e);t.activityList=[...t.activityList,...s],t.activityHasMore=s.length>=50}catch{t.activityHasMore=!1}}async function _e(t){if(!t.activitySearch.trim()){await X(t);return}t.activityLoading=!0;try{t.activityList=await p.get("/api/db/activity/search",{q:t.activitySearch,limit:"50"}),t.activityHasMore=!1}catch{t.activityList=[]}t.activityLoading=!1}async function xt(t){t.assetsLoading=!0;try{t.assetsList=await p.get("/api/db/assets",{limit:"100"})}catch{t.assetsList=[]}t.assetsLoading=!1}async function kt(t){t.projectsLoading=!0;try{t.projectsList=await p.get("/api/db/projects",{limit:"100"})}catch{t.projectsList=[]}t.projectsLoading=!1}async function At(t){t.sessionsLoading=!0;try{const e=await p.get("/api/sessions/files");t.sessionsList=(e.files||[]).map(s=>({name:s.filename||s.name,size:s.sizeBytes||s.size,modified:s.modifiedAt||s.modified,turns:s.turns}))}catch{t.sessionsList=[]}t.sessionsLoading=!1}async function xe(t,e){t.sessionDetailName=e;try{const s=await p.get(`/api/sessions/files/${encodeURIComponent(e)}/parsed`);t.sessionDetail=s.turns||s}catch{t.sessionDetail=[]}}async function Et(t){t.workspaceLoading=!0;try{const e=await p.get("/api/workspace/files");t.workspaceFiles=e.files||[]}catch{t.workspaceFiles=[]}t.workspaceLoading=!1}async function ke(t,e){t.workspaceEditingFile=e;try{const s=await p.get(`/api/workspace/files/${encodeURIComponent(e)}`);t.workspaceEditContent=s.content||""}catch{t.workspaceEditContent="(Failed to load file)"}}async function Ae(t){t.workspaceSaving=!0;try{await p.put(`/api/workspace/files/${encodeURIComponent(t.workspaceEditingFile)}`,{content:t.workspaceEditContent})}catch(e){alert(`Failed to save: ${e.message}`)}t.workspaceSaving=!1}async function Ct(t){t.skillsLoading=!0;try{const e=await p.get("/api/skills");t.skillsList=Array.isArray(e)?e:e.skills||[]}catch{t.skillsList=[]}t.skillsLoading=!1}async function Lt(t){t.configLoading=!0;try{t.configData=await p.get("/api/config")}catch{t.configData={}}t.configLoading=!1}async function Mt(t){t.envLoading=!0;try{t.envData=await p.get("/api/env")}catch{t.envData={}}t.envLoading=!1}async function Ee(t){t.updating=!0,t.updateResult="";try{const e=await p.post("/api/update");t.updateResult=e.stdout||e.message||"Update complete"}catch(e){t.updateResult=`Error: ${e.message}`}t.updating=!1}function Ce(t,e){if(e===t.tab)return;t.tab=e;const s=he(e);history.pushState(null,"",s),tt(t)}function Le(t,e){t.theme=e,t.themeResolved=St(e),Tt(t.themeResolved),t.settings={...t.settings,theme:e},ne(t.settings)}function Me(t){const e=wt(window.location.pathname);e&&e!==t.tab&&(t.tab=e,tt(t))}async function tt(t){switch(t.tab){case"dashboard":await _t(t);break;case"cron":await V(t);break;case"activity":await X(t);break;case"assets":await xt(t);break;case"projects":await kt(t);break;case"sessions":await At(t);break;case"workspace":await Et(t);break;case"skills":await Ct(t);break;case"config":await Lt(t),await Mt(t);break}}function Te(t){t.theme=t.settings.theme,t.themeResolved=St(t.theme),Tt(t.themeResolved);const e=wt(window.location.pathname);e&&(t.tab=e),fe(t),tt(t)}function De(t){t.logStream?.close(),t.logStream=null,t.popStateHandler&&(window.removeEventListener("popstate",t.popStateHandler),t.popStateHandler=null)}function Tt(t){document.documentElement.setAttribute("data-theme",t)}function Re(t){return t.chatSending||t.chatLoading}async function Pe(t,e){const s=e||t.chatMessage.trim();!s||Re(t)||(t.chatMessages=[...t.chatMessages,{role:"user",content:s}],t.chatMessage="",t.chatSending=!0,t.chatStream="",t.chatAbort=p.streamChat(s,{onDelta:i=>{t.chatStream=(t.chatStream||"")+i},onToolStart:i=>{},onToolEnd:i=>{},onDone:()=>{t.chatStream&&(t.chatMessages=[...t.chatMessages,{role:"assistant",content:t.chatStream}]),t.chatStream=null,t.chatSending=!1,t.chatAbort=null},onError:i=>{t.chatMessages=[...t.chatMessages,{role:"assistant",content:`Error: ${i}`}],t.chatStream=null,t.chatSending=!1,t.chatAbort=null}}))}function Fe(t){t.chatAbort?.abort(),t.chatStream=null,t.chatSending=!1,t.chatAbort=null}async function He(t,e){await Pe(t,e)}function Oe(t){Fe(t)}const je={messageSquare:o`
|
|
5
5
|
<svg viewBox="0 0 24 24">
|
|
6
6
|
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
|
7
7
|
</svg>
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
</svg>
|
|
275
275
|
`,stop:o`
|
|
276
276
|
<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2" /></svg>
|
|
277
|
-
`};function
|
|
277
|
+
`};function B(t,e="nav-item__icon"){return o`<span class=${e} aria-hidden="true">${je[t]}</span>`}function Be(t){return o`
|
|
278
278
|
<header class="topbar">
|
|
279
279
|
<div class="topbar__left">
|
|
280
280
|
<span class="topbar__brand">CoStar</span>
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
class="nav-item ${t.tab===e?"active":""}"
|
|
302
302
|
@click=${()=>t.setTab(e)}
|
|
303
303
|
>
|
|
304
|
-
${
|
|
304
|
+
${B(ve(e))}
|
|
305
305
|
<span>${ue(e)}</span>
|
|
306
306
|
</button>
|
|
307
307
|
`}function Je(t){return o`
|
|
@@ -311,24 +311,24 @@
|
|
|
311
311
|
@click=${()=>t.setTheme("light")}
|
|
312
312
|
title="Light theme"
|
|
313
313
|
>
|
|
314
|
-
${
|
|
314
|
+
${B("sun","btn-icon")}
|
|
315
315
|
</button>
|
|
316
316
|
<button
|
|
317
317
|
class="btn btn-sm ${t.theme==="dark"?"btn-primary":""}"
|
|
318
318
|
@click=${()=>t.setTheme("dark")}
|
|
319
319
|
title="Dark theme"
|
|
320
320
|
>
|
|
321
|
-
${
|
|
321
|
+
${B("moon","btn-icon")}
|
|
322
322
|
</button>
|
|
323
323
|
<button
|
|
324
324
|
class="btn btn-sm ${t.theme==="system"?"btn-primary":""}"
|
|
325
325
|
@click=${()=>t.setTheme("system")}
|
|
326
326
|
title="System theme"
|
|
327
327
|
>
|
|
328
|
-
${
|
|
328
|
+
${B("monitor","btn-icon")}
|
|
329
329
|
</button>
|
|
330
330
|
</div>
|
|
331
|
-
`}function k(t){const e=typeof t=="number"?new Date(t):new Date(t),i=Date.now()-e.getTime();return i<0||i<6e4?"just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:i<6048e5?`${Math.floor(i/864e5)}d ago`:e.toLocaleDateString()}function J(t){if(t<1e3)return`${t}ms`;if(t<6e4)return`${(t/1e3).toFixed(1)}s`;if(t<36e5){const i=Math.floor(t/6e4),a=Math.round(t%6e4/1e3);return a>0?`${i}m ${a}s`:`${i}m`}const e=Math.floor(t/36e5),s=Math.round(t%36e5/6e4);return s>0?`${e}h ${s}m`:`${e}h`}function et(t,e=120){return t.length<=e?t:`${t.slice(0,Math.max(0,e-1))}…`}function
|
|
331
|
+
`}function k(t){const e=typeof t=="number"?new Date(t):new Date(t),i=Date.now()-e.getTime();return i<0||i<6e4?"just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:i<6048e5?`${Math.floor(i/864e5)}d ago`:e.toLocaleDateString()}function J(t){if(t<1e3)return`${t}ms`;if(t<6e4)return`${(t/1e3).toFixed(1)}s`;if(t<36e5){const i=Math.floor(t/6e4),a=Math.round(t%6e4/1e3);return a>0?`${i}m ${a}s`:`${i}m`}const e=Math.floor(t/36e5),s=Math.round(t%36e5/6e4);return s>0?`${e}h ${s}m`:`${e}h`}function et(t,e=120){return t.length<=e?t:`${t.slice(0,Math.max(0,e-1))}…`}function Ie(t){return o`
|
|
332
332
|
<div class="dashboard-grid" style="animation: dashboard-enter 0.4s var(--ease-out) both;">
|
|
333
333
|
<!-- Status Cards -->
|
|
334
334
|
<div class="stats-row">
|
|
@@ -397,7 +397,7 @@
|
|
|
397
397
|
<div class="stat-value">${e}</div>
|
|
398
398
|
${s?o`<div class="stat-sub">${s}</div>`:v}
|
|
399
399
|
</div>
|
|
400
|
-
`}function
|
|
400
|
+
`}function ze(t){return o`
|
|
401
401
|
<div class="chat-layout">
|
|
402
402
|
<!-- Messages -->
|
|
403
403
|
<div class="chat-messages" id="chat-messages">
|
|
@@ -939,7 +939,7 @@
|
|
|
939
939
|
</div>
|
|
940
940
|
`}function ns(t){const e=t.toLowerCase();return e.includes("key")||e.includes("secret")||e.includes("token")||e.includes("password")}function rs(t){return!t||t.length<8?"***":t.substring(0,6)+"..."+t.substring(t.length-4)}function cs(t){return o`
|
|
941
941
|
<div class="shell">
|
|
942
|
-
${
|
|
942
|
+
${Be(t)}
|
|
943
943
|
${Ne(t)}
|
|
944
944
|
|
|
945
945
|
<main class="content">
|
|
@@ -948,7 +948,7 @@
|
|
|
948
948
|
</div>
|
|
949
949
|
|
|
950
950
|
${ds(t)}
|
|
951
|
-
`}function ls(t){switch(t.tab){case"dashboard":return
|
|
951
|
+
`}function ls(t){switch(t.tab){case"dashboard":return Ie(t);case"chat":return ze(t);case"cron":return We(t);case"activity":return Ge(t);case"assets":return Qe(t);case"projects":return Ye(t);case"sessions":return Xe(t);case"workspace":return es(t);case"skills":return ss(t);case"logs":return is(t);case"config":return os(t);default:return o`<p>Unknown page</p>`}}function ds(t){return t.cronHistoryOpen?o`
|
|
952
952
|
<div class="modal-overlay open" @click=${e=>{e.target===e.currentTarget&&(t.cronHistoryOpen=!1)}}>
|
|
953
953
|
<div class="modal" style="max-width: 700px;">
|
|
954
954
|
<div class="modal-header">
|
|
@@ -985,4 +985,4 @@
|
|
|
985
985
|
</div>
|
|
986
986
|
</div>
|
|
987
987
|
`:v}function hs(t){t.logStreaming=!0,t.logStream=p.streamLogs({onLog:e=>{t.logEntries=[...t.logEntries.slice(-500),e]},onError:()=>{t.logStreaming=!1}})}function vs(t){t.logStream?.close(),t.logStream=null,t.logStreaming=!1}var us=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,l=(t,e,s,i)=>{for(var a=i>1?void 0:i?ps(e,s):e,n=t.length-1,r;n>=0;n--)(r=t[n])&&(a=(i?r(e,s,a):r(a))||a);return i&&a&&us(e,s,a),a};let c=class extends T{constructor(){super(...arguments),this.settings=oe(),this.tab="dashboard",this.theme="system",this.themeResolved="dark",this.serverStatus=null,this.activityStats=null,this.activeProject=null,this.projectCount=null,this.recentActivity=[],this.chatMessage="",this.chatMessages=[],this.chatLoading=!1,this.chatSending=!1,this.chatStream=null,this.chatAbort=null,this.cronJobs=[],this.cronLoading=!1,this.cronForm={...bt},this.cronHistory=[],this.cronHistoryJob="",this.cronHistoryOpen=!1,this.activityList=[],this.activityLoading=!1,this.activitySearch="",this.activityStatusFilter="",this.activityOffset=0,this.activityHasMore=!1,this.activityDetail=null,this.assetsList=[],this.assetsLoading=!1,this.assetTypeFilter="",this.projectsList=[],this.projectsLoading=!1,this.sessionsList=[],this.sessionsLoading=!1,this.sessionDetail=null,this.sessionDetailName="",this.workspaceFiles=[],this.workspaceLoading=!1,this.workspaceEditingFile="",this.workspaceEditContent="",this.workspaceSaving=!1,this.skillsList=[],this.skillsLoading=!1,this.logEntries=[],this.logStreaming=!1,this.logFilter="",this.logStream=null,this.configData={},this.configLoading=!1,this.envData={},this.envLoading=!1,this.updating=!1,this.updateResult="",this.popStateHandler=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.popStateHandler=()=>Me(this),window.addEventListener("popstate",this.popStateHandler),Te(this)}disconnectedCallback(){De(this),super.disconnectedCallback()}setTab(t){Ce(this,t)}setTheme(t){Le(this,t)}async handleSendChat(t){await He(this,t)}abortChat(){Oe(this)}async loadDashboard(){await _t(this)}async loadCronJobs(){await V(this)}async createCronJob(){await me(this)}async runCronJob(t){await be(this,t)}async deleteCronJob(t){await $e(this,t)}async showCronHistory(t,e){await we(this,t,e)}async loadActivity(){await X(this)}async loadMoreActivity(){await Se(this)}async searchActivity(){await _e(this)}async loadAssets(){await xt(this)}async loadProjects(){await kt(this)}async loadSessions(){await At(this)}async viewSession(t){await xe(this,t)}async loadWorkspaceFiles(){await Et(this)}async editWorkspaceFile(t){await ke(this,t)}async saveWorkspaceFile(){await Ae(this)}async loadSkills(){await Ct(this)}startLogStream(){hs(this)}stopLogStream(){vs(this)}async loadConfig(){await Lt(this)}async loadEnv(){await Mt(this)}async selfUpdate(){await Ee(this)}render(){return cs(this)}};l([d()],c.prototype,"settings",2);l([d()],c.prototype,"tab",2);l([d()],c.prototype,"theme",2);l([d()],c.prototype,"themeResolved",2);l([d()],c.prototype,"serverStatus",2);l([d()],c.prototype,"activityStats",2);l([d()],c.prototype,"activeProject",2);l([d()],c.prototype,"projectCount",2);l([d()],c.prototype,"recentActivity",2);l([d()],c.prototype,"chatMessage",2);l([d()],c.prototype,"chatMessages",2);l([d()],c.prototype,"chatLoading",2);l([d()],c.prototype,"chatSending",2);l([d()],c.prototype,"chatStream",2);l([d()],c.prototype,"cronJobs",2);l([d()],c.prototype,"cronLoading",2);l([d()],c.prototype,"cronForm",2);l([d()],c.prototype,"cronHistory",2);l([d()],c.prototype,"cronHistoryJob",2);l([d()],c.prototype,"cronHistoryOpen",2);l([d()],c.prototype,"activityList",2);l([d()],c.prototype,"activityLoading",2);l([d()],c.prototype,"activitySearch",2);l([d()],c.prototype,"activityStatusFilter",2);l([d()],c.prototype,"activityOffset",2);l([d()],c.prototype,"activityHasMore",2);l([d()],c.prototype,"activityDetail",2);l([d()],c.prototype,"assetsList",2);l([d()],c.prototype,"assetsLoading",2);l([d()],c.prototype,"assetTypeFilter",2);l([d()],c.prototype,"projectsList",2);l([d()],c.prototype,"projectsLoading",2);l([d()],c.prototype,"sessionsList",2);l([d()],c.prototype,"sessionsLoading",2);l([d()],c.prototype,"sessionDetail",2);l([d()],c.prototype,"sessionDetailName",2);l([d()],c.prototype,"workspaceFiles",2);l([d()],c.prototype,"workspaceLoading",2);l([d()],c.prototype,"workspaceEditingFile",2);l([d()],c.prototype,"workspaceEditContent",2);l([d()],c.prototype,"workspaceSaving",2);l([d()],c.prototype,"skillsList",2);l([d()],c.prototype,"skillsLoading",2);l([d()],c.prototype,"logEntries",2);l([d()],c.prototype,"logStreaming",2);l([d()],c.prototype,"logFilter",2);l([d()],c.prototype,"configData",2);l([d()],c.prototype,"configLoading",2);l([d()],c.prototype,"envData",2);l([d()],c.prototype,"envLoading",2);l([d()],c.prototype,"updating",2);l([d()],c.prototype,"updateResult",2);c=l([ee("costar-app")],c);
|
|
988
|
-
//# sourceMappingURL=index-
|
|
988
|
+
//# sourceMappingURL=index-DQT6gXg5.js.map
|