@farazirfan/costar-server-executor 1.7.68 → 1.7.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-server.d.ts.map +1 -1
- package/dist/web-server.js +10 -0
- package/dist/web-server.js.map +1 -1
- package/package.json +5 -2
- package/public/assets/index-DnNU5Z1l.js +960 -0
- package/public/assets/index-DnNU5Z1l.js.map +1 -0
- package/public/assets/index-p0BMQzJL.css +1 -0
- package/public/index-legacy.html +3261 -0
- package/public/index.html +12 -3873
|
@@ -0,0 +1,960 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const r of a)if(r.type==="childList")for(const n of r.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&i(n)}).observe(document,{childList:!0,subtree:!0});function s(a){const r={};return a.integrity&&(r.integrity=a.integrity),a.referrerPolicy&&(r.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?r.credentials="include":a.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(a){if(a.ep)return;a.ep=!0;const r=s(a);fetch(a.href,r)}})();const B=globalThis,W=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vt=Symbol(),Y=new WeakMap;let ft=class{constructor(t,s,i){if(this._$cssResult$=!0,i!==vt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o;const s=this.t;if(W&&t===void 0){const i=s!==void 0&&s.length===1;i&&(t=Y.get(s)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Y.set(s,t))}return t}toString(){return this.cssText}};const $t=e=>new ft(typeof e=="string"?e:e+"",void 0,vt),bt=(e,t)=>{if(W)e.adoptedStyleSheets=t.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(const s of t){const i=document.createElement("style"),a=B.litNonce;a!==void 0&&i.setAttribute("nonce",a),i.textContent=s.cssText,e.appendChild(i)}},X=W?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let s="";for(const i of t.cssRules)s+=i.cssText;return $t(s)})(e):e;const{is:wt,defineProperty:St,getOwnPropertyDescriptor:_t,getOwnPropertyNames:xt,getOwnPropertySymbols:At,getPrototypeOf:kt}=Object,J=globalThis,tt=J.trustedTypes,Et=tt?tt.emptyScript:"",Mt=J.reactiveElementPolyfillSupport,C=(e,t)=>e,j={toAttribute(e,t){switch(t){case Boolean:e=e?Et:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=e!==null;break;case Number:s=e===null?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch{s=null}}return s}},q=(e,t)=>!wt(e,t),et={attribute:!0,type:String,converter:j,reflect:!1,useDefault:!1,hasChanged:q};Symbol.metadata??=Symbol("metadata"),J.litPropertyMetadata??=new WeakMap;let k=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=et){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),a=this.getPropertyDescriptor(t,i,s);a!==void 0&&St(this.prototype,t,a)}}static getPropertyDescriptor(t,s,i){const{get:a,set:r}=_t(this.prototype,t)??{get(){return this[s]},set(n){this[s]=n}};return{get:a,set(n){const p=a?.call(this);r?.call(this,n),this.requestUpdate(t,p,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??et}static _$Ei(){if(this.hasOwnProperty(C("elementProperties")))return;const t=kt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(C("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(C("properties"))){const s=this.properties,i=[...xt(s),...At(s)];for(const a of i)this.createProperty(a,s[a])}const t=this[Symbol.metadata];if(t!==null){const s=litPropertyMetadata.get(t);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(t){const s=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const a of i)s.unshift(X(a))}else t!==void 0&&s.push(X(t));return s}static _$Eu(t,s){const i=s.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){const i=this.constructor.elementProperties.get(t),a=this.constructor._$Eu(t,i);if(a!==void 0&&i.reflect===!0){const r=(i.converter?.toAttribute!==void 0?i.converter:j).toAttribute(s,i.type);this._$Em=t,r==null?this.removeAttribute(a):this.setAttribute(a,r),this._$Em=null}}_$AK(t,s){const i=this.constructor,a=i._$Eh.get(t);if(a!==void 0&&this._$Em!==a){const r=i.getPropertyOptions(a),n=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:j;this._$Em=a;const p=n.fromAttribute(s,r.type);this[a]=p??this._$Ej?.get(a)??p,this._$Em=null}}requestUpdate(t,s,i,a=!1,r){if(t!==void 0){const n=this.constructor;if(a===!1&&(r=this[t]),i??=n.getPropertyOptions(t),!((i.hasChanged??q)(r,s)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,s,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:a,wrapped:r},n){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??s??this[t]),r!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),a===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[a,r]of this._$Ep)this[a]=r;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[a,r]of i){const{wrapped:n}=r,p=this[a];n!==!0||this._$AL.has(a)||p===void 0||this.C(a,void 0,r,p)}}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(s)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(s=>this._$ET(s,this[s])),this._$EM()}updated(t){}firstUpdated(t){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[C("elementProperties")]=new Map,k[C("finalized")]=new Map,Mt?.({ReactiveElement:k}),(J.reactiveElementVersions??=[]).push("2.1.2");const Z=globalThis,st=e=>e,N=Z.trustedTypes,it=N?N.createPolicy("lit-html",{createHTML:e=>e}):void 0,pt="$lit$",b=`lit$${Math.random().toFixed(9).slice(2)}$`,ut="?"+b,Lt=`<${ut}>`,x=document,D=()=>x.createComment(""),F=e=>e===null||typeof e!="object"&&typeof e!="function",G=Array.isArray,Ct=e=>G(e)||typeof e?.[Symbol.iterator]=="function",V=`[
|
|
2
|
+
\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,at=/-->/g,ot=/>/g,w=RegExp(`>|${V}(?:([^\\s"'>=/]+)(${V}*=${V}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),rt=/'/g,nt=/"/g,gt=/^(?:script|style|textarea|title)$/i,Tt=e=>(t,...s)=>({_$litType$:e,strings:t,values:s}),o=Tt(1),E=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),ct=new WeakMap,_=x.createTreeWalker(x,129);function yt(e,t){if(!G(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return it!==void 0?it.createHTML(t):t}const Dt=(e,t)=>{const s=e.length-1,i=[];let a,r=t===2?"<svg>":t===3?"<math>":"",n=L;for(let p=0;p<s;p++){const h=e[p];let m,f,u=-1,$=0;for(;$<h.length&&(n.lastIndex=$,f=n.exec(h),f!==null);)$=n.lastIndex,n===L?f[1]==="!--"?n=at:f[1]!==void 0?n=ot:f[2]!==void 0?(gt.test(f[2])&&(a=RegExp("</"+f[2],"g")),n=w):f[3]!==void 0&&(n=w):n===w?f[0]===">"?(n=a??L,u=-1):f[1]===void 0?u=-2:(u=n.lastIndex-f[2].length,m=f[1],n=f[3]===void 0?w:f[3]==='"'?nt:rt):n===nt||n===rt?n=w:n===at||n===ot?n=L:(n=w,a=void 0);const y=n===w&&e[p+1].startsWith("/>")?" ":"";r+=n===L?h+Lt:u>=0?(i.push(m),h.slice(0,u)+pt+h.slice(u)+b+y):h+b+(u===-2?p:y)}return[yt(e,r+(e[s]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};class P{constructor({strings:t,_$litType$:s},i){let a;this.parts=[];let r=0,n=0;const p=t.length-1,h=this.parts,[m,f]=Dt(t,s);if(this.el=P.createElement(m,i),_.currentNode=this.el.content,s===2||s===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(a=_.nextNode())!==null&&h.length<p;){if(a.nodeType===1){if(a.hasAttributes())for(const u of a.getAttributeNames())if(u.endsWith(pt)){const $=f[n++],y=a.getAttribute(u).split(b),H=/([.?@])?(.*)/.exec($);h.push({type:1,index:r,name:H[2],strings:y,ctor:H[1]==="."?Pt:H[1]==="?"?Ot:H[1]==="@"?Ht:z}),a.removeAttribute(u)}else u.startsWith(b)&&(h.push({type:6,index:r}),a.removeAttribute(u));if(gt.test(a.tagName)){const u=a.textContent.split(b),$=u.length-1;if($>0){a.textContent=N?N.emptyScript:"";for(let y=0;y<$;y++)a.append(u[y],D()),_.nextNode(),h.push({type:2,index:++r});a.append(u[$],D())}}}else if(a.nodeType===8)if(a.data===ut)h.push({type:2,index:r});else{let u=-1;for(;(u=a.data.indexOf(b,u+1))!==-1;)h.push({type:7,index:r}),u+=b.length-1}r++}}static createElement(t,s){const i=x.createElement("template");return i.innerHTML=t,i}}function M(e,t,s=e,i){if(t===E)return t;let a=i!==void 0?s._$Co?.[i]:s._$Cl;const r=F(t)?void 0:t._$litDirective$;return a?.constructor!==r&&(a?._$AO?.(!1),r===void 0?a=void 0:(a=new r(e),a._$AT(e,s,i)),i!==void 0?(s._$Co??=[])[i]=a:s._$Cl=a),a!==void 0&&(t=M(e,a._$AS(e,t.values),a,i)),t}class Ft{constructor(t,s){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:s},parts:i}=this._$AD,a=(t?.creationScope??x).importNode(s,!0);_.currentNode=a;let r=_.nextNode(),n=0,p=0,h=i[0];for(;h!==void 0;){if(n===h.index){let m;h.type===2?m=new O(r,r.nextSibling,this,t):h.type===1?m=new h.ctor(r,h.name,h.strings,this,t):h.type===6&&(m=new Rt(r,this,t)),this._$AV.push(m),h=i[++p]}n!==h?.index&&(r=_.nextNode(),n++)}return _.currentNode=x,a}p(t){let s=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,s),s+=i.strings.length-2):i._$AI(t[s])),s++}}class O{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,s,i,a){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=i,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const s=this._$AM;return s!==void 0&&t?.nodeType===11&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=M(this,t,s),F(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==E&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ct(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==v&&F(this._$AH)?this._$AA.nextSibling.data=t:this.T(x.createTextNode(t)),this._$AH=t}$(t){const{values:s,_$litType$:i}=t,a=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=P.createElement(yt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===a)this._$AH.p(s);else{const r=new Ft(a,this),n=r.u(this.options);r.p(s),this.T(n),this._$AH=r}}_$AC(t){let s=ct.get(t.strings);return s===void 0&&ct.set(t.strings,s=new P(t)),s}k(t){G(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let i,a=0;for(const r of t)a===s.length?s.push(i=new O(this.O(D()),this.O(D()),this,this.options)):i=s[a],i._$AI(r),a++;a<s.length&&(this._$AR(i&&i._$AB.nextSibling,a),s.length=a)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){const i=st(t).nextSibling;st(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}}class z{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,s,i,a,r){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=s,this._$AM=a,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=v}_$AI(t,s=this,i,a){const r=this.strings;let n=!1;if(r===void 0)t=M(this,t,s,0),n=!F(t)||t!==this._$AH&&t!==E,n&&(this._$AH=t);else{const p=t;let h,m;for(t=r[0],h=0;h<r.length-1;h++)m=M(this,p[i+h],s,h),m===E&&(m=this._$AH[h]),n||=!F(m)||m!==this._$AH[h],m===v?t=v:t!==v&&(t+=(m??"")+r[h+1]),this._$AH[h]=m}n&&!a&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Pt extends z{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}}class Ot extends z{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}}class Ht extends z{constructor(t,s,i,a,r){super(t,s,i,a,r),this.type=5}_$AI(t,s=this){if((t=M(this,t,s,0)??v)===E)return;const i=this._$AH,a=t===v&&i!==v||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==v&&(i===v||a);a&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Rt{constructor(t,s,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t)}}const Bt=Z.litHtmlPolyfillSupport;Bt?.(P,O),(Z.litHtmlVersions??=[]).push("3.3.2");const jt=(e,t,s)=>{const i=s?.renderBefore??t;let a=i._$litPart$;if(a===void 0){const r=s?.renderBefore??null;i._$litPart$=a=new O(t.insertBefore(D(),r),r,void 0,s??{})}return a._$AI(e),a};const K=globalThis;class T extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=jt(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,K.litElementHydrateSupport?.({LitElement:T});const Nt=K.litElementPolyfillSupport;Nt?.({LitElement:T});(K.litElementVersions??=[]).push("4.2.2");const Ut=e=>(t,s)=>{s!==void 0?s.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const Jt={attribute:!0,type:String,converter:j,reflect:!1,hasChanged:q},zt=(e=Jt,t,s)=>{const{kind:i,metadata:a}=s;let r=globalThis.litPropertyMetadata.get(a);if(r===void 0&&globalThis.litPropertyMetadata.set(a,r=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),r.set(s.name,e),i==="accessor"){const{name:n}=s;return{set(p){const h=t.get.call(this);t.set.call(this,p),this.requestUpdate(n,h,e,!0,p)},init(p){return p!==void 0&&this.C(n,void 0,e,p),p}}}if(i==="setter"){const{name:n}=s;return function(p){const h=this[n];t.call(this,p),this.requestUpdate(n,h,e,!0,p)}}throw Error("Unsupported decorator location: "+i)};function Vt(e){return(t,s)=>typeof s=="object"?zt(e,t,s):((i,a,r)=>{const n=a.hasOwnProperty(r);return a.constructor.createProperty(r,i),n?Object.getOwnPropertyDescriptor(a,r):void 0})(e,t,s)}function d(e){return Vt({...e,state:!0,attribute:!1})}class It{constructor(t=""){this.baseUrl=t}url(t,s){const i=this.baseUrl||window.location.origin,a=new URL(t,i);if(s)for(const[r,n]of Object.entries(s))n!==void 0&&n!==""&&a.searchParams.set(r,n);return a.toString()}async get(t,s){const i=await fetch(this.url(t,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(t,s){const i=await fetch(this.url(t,s));if(!i.ok)throw new Error(i.statusText);return i.text()}async post(t,s){const i=await fetch(this.url(t),{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(t,s){const i=await fetch(this.url(t),{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(t){const s=await fetch(this.url(t),{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(t,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:t}),signal:i.signal});if(!a.ok||!a.body){s.onError?.(`HTTP ${a.status}: ${a.statusText}`);return}const r=a.body.getReader(),n=new TextDecoder;let p="";for(;;){const{done:h,value:m}=await r.read();if(h)break;p+=n.decode(m,{stream:!0});const f=p.split(`
|
|
4
|
+
`);p=f.pop()||"";for(const u of f){if(!u.startsWith("data: "))continue;const $=u.slice(6);if($==="[DONE]"){s.onDone?.({});continue}try{const y=JSON.parse($);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($)}}}s.onDone?.({})}catch(a){if(a.name==="AbortError")return;s.onError?.(a.message||"Stream error")}})(),{abort:()=>i.abort()}}streamLogs(t){const s=new EventSource(this.url("/api/logs/stream"));return s.onopen=()=>t.onConnect?.(),s.onmessage=i=>{try{t.onLog(JSON.parse(i.data))}catch{t.onLog({message:i.data})}},s.onerror=()=>t.onError?.("Log stream disconnected"),{close:()=>s.close()}}}const g=new It,Wt=[{label:"main",tabs:["dashboard","chat"]},{label:"agent",tabs:["cron","activity","sessions"]},{label:"data",tabs:["assets","projects","workspace"]},{label:"system",tabs:["skills","logs","config"]}],I={dashboard:"/",chat:"/chat",cron:"/cron",activity:"/activity",sessions:"/sessions",assets:"/assets",projects:"/projects",workspace:"/workspace",skills:"/skills",logs:"/logs",config:"/config"},qt={dashboard:"Dashboard",chat:"Chat",cron:"Cron Jobs",activity:"Activity",sessions:"Sessions",assets:"Assets",projects:"Projects",workspace:"Workspace",skills:"Skills",logs:"Logs",config:"Config"},Zt={dashboard:"home",chat:"messageSquare",cron:"clock",activity:"activity",sessions:"fileText",assets:"package",projects:"folder",workspace:"edit",skills:"zap",logs:"terminal",config:"settings"},Gt={main:"Main",agent:"Agent",data:"Data",system:"System"};function Kt(e){return I[e]}function lt(e){for(const[s,i]of Object.entries(I))if(e===i)return s;const t=e.replace(/\/$/,"")||"/";for(const[s,i]of Object.entries(I))if(t===i)return s;return null}function Qt(e){return Zt[e]}function Yt(e){return qt[e]}function Xt(e){return Gt[e]||e}const mt="costar.dashboard.settings.v1",S={theme:"system",chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};function te(){try{const e=localStorage.getItem(mt);if(!e)return{...S};const t=JSON.parse(e);return{theme:t.theme==="light"||t.theme==="dark"||t.theme==="system"?t.theme:S.theme,chatShowThinking:typeof t.chatShowThinking=="boolean"?t.chatShowThinking:S.chatShowThinking,splitRatio:typeof t.splitRatio=="number"&&t.splitRatio>=.3&&t.splitRatio<=.8?t.splitRatio:S.splitRatio,navCollapsed:typeof t.navCollapsed=="boolean"?t.navCollapsed:S.navCollapsed,navGroupsCollapsed:typeof t.navGroupsCollapsed=="object"&&t.navGroupsCollapsed!==null?t.navGroupsCollapsed:S.navGroupsCollapsed}}catch{return{...S}}}function ee(e){try{localStorage.setItem(mt,JSON.stringify(e))}catch{}}function se(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function dt(e){return e==="system"?se():e}const ie={messageSquare:o`
|
|
5
|
+
<svg viewBox="0 0 24 24">
|
|
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
|
+
</svg>
|
|
8
|
+
`,barChart:o`
|
|
9
|
+
<svg viewBox="0 0 24 24">
|
|
10
|
+
<line x1="12" x2="12" y1="20" y2="10" />
|
|
11
|
+
<line x1="18" x2="18" y1="20" y2="4" />
|
|
12
|
+
<line x1="6" x2="6" y1="20" y2="16" />
|
|
13
|
+
</svg>
|
|
14
|
+
`,link:o`
|
|
15
|
+
<svg viewBox="0 0 24 24">
|
|
16
|
+
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
|
|
17
|
+
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
|
|
18
|
+
</svg>
|
|
19
|
+
`,radio:o`
|
|
20
|
+
<svg viewBox="0 0 24 24">
|
|
21
|
+
<circle cx="12" cy="12" r="2" />
|
|
22
|
+
<path
|
|
23
|
+
d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
`,fileText:o`
|
|
27
|
+
<svg viewBox="0 0 24 24">
|
|
28
|
+
<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" />
|
|
29
|
+
<polyline points="14 2 14 8 20 8" />
|
|
30
|
+
<line x1="16" x2="8" y1="13" y2="13" />
|
|
31
|
+
<line x1="16" x2="8" y1="17" y2="17" />
|
|
32
|
+
<line x1="10" x2="8" y1="9" y2="9" />
|
|
33
|
+
</svg>
|
|
34
|
+
`,zap:o`
|
|
35
|
+
<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" /></svg>
|
|
36
|
+
`,monitor:o`
|
|
37
|
+
<svg viewBox="0 0 24 24">
|
|
38
|
+
<rect width="20" height="14" x="2" y="3" rx="2" />
|
|
39
|
+
<line x1="8" x2="16" y1="21" y2="21" />
|
|
40
|
+
<line x1="12" x2="12" y1="17" y2="21" />
|
|
41
|
+
</svg>
|
|
42
|
+
`,settings:o`
|
|
43
|
+
<svg viewBox="0 0 24 24">
|
|
44
|
+
<path
|
|
45
|
+
d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"
|
|
46
|
+
/>
|
|
47
|
+
<circle cx="12" cy="12" r="3" />
|
|
48
|
+
</svg>
|
|
49
|
+
`,bug:o`
|
|
50
|
+
<svg viewBox="0 0 24 24">
|
|
51
|
+
<path d="m8 2 1.88 1.88" />
|
|
52
|
+
<path d="M14.12 3.88 16 2" />
|
|
53
|
+
<path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1" />
|
|
54
|
+
<path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6" />
|
|
55
|
+
<path d="M12 20v-9" />
|
|
56
|
+
<path d="M6.53 9C4.6 8.8 3 7.1 3 5" />
|
|
57
|
+
<path d="M6 13H2" />
|
|
58
|
+
<path d="M3 21c0-2.1 1.7-3.9 3.8-4" />
|
|
59
|
+
<path d="M20.97 5c0 2.1-1.6 3.8-3.5 4" />
|
|
60
|
+
<path d="M22 13h-4" />
|
|
61
|
+
<path d="M17.2 17c2.1.1 3.8 1.9 3.8 4" />
|
|
62
|
+
</svg>
|
|
63
|
+
`,scrollText:o`
|
|
64
|
+
<svg viewBox="0 0 24 24">
|
|
65
|
+
<path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4" />
|
|
66
|
+
<path d="M19 17V5a2 2 0 0 0-2-2H4" />
|
|
67
|
+
<path d="M15 8h-5" />
|
|
68
|
+
<path d="M15 12h-5" />
|
|
69
|
+
</svg>
|
|
70
|
+
`,folder:o`
|
|
71
|
+
<svg viewBox="0 0 24 24">
|
|
72
|
+
<path
|
|
73
|
+
d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"
|
|
74
|
+
/>
|
|
75
|
+
</svg>
|
|
76
|
+
`,menu:o`
|
|
77
|
+
<svg viewBox="0 0 24 24">
|
|
78
|
+
<line x1="4" x2="20" y1="12" y2="12" />
|
|
79
|
+
<line x1="4" x2="20" y1="6" y2="6" />
|
|
80
|
+
<line x1="4" x2="20" y1="18" y2="18" />
|
|
81
|
+
</svg>
|
|
82
|
+
`,x:o`
|
|
83
|
+
<svg viewBox="0 0 24 24">
|
|
84
|
+
<path d="M18 6 6 18" />
|
|
85
|
+
<path d="m6 6 12 12" />
|
|
86
|
+
</svg>
|
|
87
|
+
`,check:o`
|
|
88
|
+
<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5" /></svg>
|
|
89
|
+
`,arrowDown:o`
|
|
90
|
+
<svg viewBox="0 0 24 24">
|
|
91
|
+
<path d="M12 5v14" />
|
|
92
|
+
<path d="m19 12-7 7-7-7" />
|
|
93
|
+
</svg>
|
|
94
|
+
`,copy:o`
|
|
95
|
+
<svg viewBox="0 0 24 24">
|
|
96
|
+
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
|
|
97
|
+
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
|
|
98
|
+
</svg>
|
|
99
|
+
`,search:o`
|
|
100
|
+
<svg viewBox="0 0 24 24">
|
|
101
|
+
<circle cx="11" cy="11" r="8" />
|
|
102
|
+
<path d="m21 21-4.3-4.3" />
|
|
103
|
+
</svg>
|
|
104
|
+
`,brain:o`
|
|
105
|
+
<svg viewBox="0 0 24 24">
|
|
106
|
+
<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z" />
|
|
107
|
+
<path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z" />
|
|
108
|
+
<path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4" />
|
|
109
|
+
<path d="M17.599 6.5a3 3 0 0 0 .399-1.375" />
|
|
110
|
+
<path d="M6.003 5.125A3 3 0 0 0 6.401 6.5" />
|
|
111
|
+
<path d="M3.477 10.896a4 4 0 0 1 .585-.396" />
|
|
112
|
+
<path d="M19.938 10.5a4 4 0 0 1 .585.396" />
|
|
113
|
+
<path d="M6 18a4 4 0 0 1-1.967-.516" />
|
|
114
|
+
<path d="M19.967 17.484A4 4 0 0 1 18 18" />
|
|
115
|
+
</svg>
|
|
116
|
+
`,book:o`
|
|
117
|
+
<svg viewBox="0 0 24 24">
|
|
118
|
+
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20" />
|
|
119
|
+
</svg>
|
|
120
|
+
`,loader:o`
|
|
121
|
+
<svg viewBox="0 0 24 24">
|
|
122
|
+
<path d="M12 2v4" />
|
|
123
|
+
<path d="m16.2 7.8 2.9-2.9" />
|
|
124
|
+
<path d="M18 12h4" />
|
|
125
|
+
<path d="m16.2 16.2 2.9 2.9" />
|
|
126
|
+
<path d="M12 18v4" />
|
|
127
|
+
<path d="m4.9 19.1 2.9-2.9" />
|
|
128
|
+
<path d="M2 12h4" />
|
|
129
|
+
<path d="m4.9 4.9 2.9 2.9" />
|
|
130
|
+
</svg>
|
|
131
|
+
`,wrench:o`
|
|
132
|
+
<svg viewBox="0 0 24 24">
|
|
133
|
+
<path
|
|
134
|
+
d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"
|
|
135
|
+
/>
|
|
136
|
+
</svg>
|
|
137
|
+
`,fileCode:o`
|
|
138
|
+
<svg viewBox="0 0 24 24">
|
|
139
|
+
<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" />
|
|
140
|
+
<polyline points="14 2 14 8 20 8" />
|
|
141
|
+
<path d="m10 13-2 2 2 2" />
|
|
142
|
+
<path d="m14 17 2-2-2-2" />
|
|
143
|
+
</svg>
|
|
144
|
+
`,edit:o`
|
|
145
|
+
<svg viewBox="0 0 24 24">
|
|
146
|
+
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
|
|
147
|
+
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
|
|
148
|
+
</svg>
|
|
149
|
+
`,penLine:o`
|
|
150
|
+
<svg viewBox="0 0 24 24">
|
|
151
|
+
<path d="M12 20h9" />
|
|
152
|
+
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" />
|
|
153
|
+
</svg>
|
|
154
|
+
`,paperclip:o`
|
|
155
|
+
<svg viewBox="0 0 24 24">
|
|
156
|
+
<path
|
|
157
|
+
d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"
|
|
158
|
+
/>
|
|
159
|
+
</svg>
|
|
160
|
+
`,globe:o`
|
|
161
|
+
<svg viewBox="0 0 24 24">
|
|
162
|
+
<circle cx="12" cy="12" r="10" />
|
|
163
|
+
<path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" />
|
|
164
|
+
<path d="M2 12h20" />
|
|
165
|
+
</svg>
|
|
166
|
+
`,image:o`
|
|
167
|
+
<svg viewBox="0 0 24 24">
|
|
168
|
+
<rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
|
|
169
|
+
<circle cx="9" cy="9" r="2" />
|
|
170
|
+
<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
|
|
171
|
+
</svg>
|
|
172
|
+
`,smartphone:o`
|
|
173
|
+
<svg viewBox="0 0 24 24">
|
|
174
|
+
<rect width="14" height="20" x="5" y="2" rx="2" ry="2" />
|
|
175
|
+
<path d="M12 18h.01" />
|
|
176
|
+
</svg>
|
|
177
|
+
`,plug:o`
|
|
178
|
+
<svg viewBox="0 0 24 24">
|
|
179
|
+
<path d="M12 22v-5" />
|
|
180
|
+
<path d="M9 8V2" />
|
|
181
|
+
<path d="M15 8V2" />
|
|
182
|
+
<path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z" />
|
|
183
|
+
</svg>
|
|
184
|
+
`,circle:o`
|
|
185
|
+
<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /></svg>
|
|
186
|
+
`,puzzle:o`
|
|
187
|
+
<svg viewBox="0 0 24 24">
|
|
188
|
+
<path
|
|
189
|
+
d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"
|
|
190
|
+
/>
|
|
191
|
+
</svg>
|
|
192
|
+
`,activity:o`
|
|
193
|
+
<svg viewBox="0 0 24 24">
|
|
194
|
+
<path d="M22 12h-4l-3 9L9 3l-3 9H2" />
|
|
195
|
+
</svg>
|
|
196
|
+
`,database:o`
|
|
197
|
+
<svg viewBox="0 0 24 24">
|
|
198
|
+
<ellipse cx="12" cy="5" rx="9" ry="3" />
|
|
199
|
+
<path d="M3 5V19A9 3 0 0 0 21 19V5" />
|
|
200
|
+
<path d="M3 12A9 3 0 0 0 21 12" />
|
|
201
|
+
</svg>
|
|
202
|
+
`,package:o`
|
|
203
|
+
<svg viewBox="0 0 24 24">
|
|
204
|
+
<path d="m7.5 4.27 9 5.15" />
|
|
205
|
+
<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z" />
|
|
206
|
+
<path d="m3.3 7 8.7 5 8.7-5" />
|
|
207
|
+
<path d="M12 22V12" />
|
|
208
|
+
</svg>
|
|
209
|
+
`,play:o`
|
|
210
|
+
<svg viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3" /></svg>
|
|
211
|
+
`,trash:o`
|
|
212
|
+
<svg viewBox="0 0 24 24">
|
|
213
|
+
<path d="M3 6h18" />
|
|
214
|
+
<path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" />
|
|
215
|
+
<path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" />
|
|
216
|
+
</svg>
|
|
217
|
+
`,clock:o`
|
|
218
|
+
<svg viewBox="0 0 24 24">
|
|
219
|
+
<circle cx="12" cy="12" r="10" />
|
|
220
|
+
<polyline points="12 6 12 12 16 14" />
|
|
221
|
+
</svg>
|
|
222
|
+
`,send:o`
|
|
223
|
+
<svg viewBox="0 0 24 24">
|
|
224
|
+
<path d="m22 2-7 20-4-9-9-4Z" />
|
|
225
|
+
<path d="M22 2 11 13" />
|
|
226
|
+
</svg>
|
|
227
|
+
`,sun:o`
|
|
228
|
+
<svg viewBox="0 0 24 24">
|
|
229
|
+
<circle cx="12" cy="12" r="4" />
|
|
230
|
+
<path d="M12 2v2" /><path d="M12 20v2" />
|
|
231
|
+
<path d="m4.93 4.93 1.41 1.41" /><path d="m17.66 17.66 1.41 1.41" />
|
|
232
|
+
<path d="M2 12h2" /><path d="M20 12h2" />
|
|
233
|
+
<path d="m6.34 17.66-1.41 1.41" /><path d="m19.07 4.93-1.41 1.41" />
|
|
234
|
+
</svg>
|
|
235
|
+
`,moon:o`
|
|
236
|
+
<svg viewBox="0 0 24 24"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" /></svg>
|
|
237
|
+
`,chevronDown:o`
|
|
238
|
+
<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6" /></svg>
|
|
239
|
+
`,chevronRight:o`
|
|
240
|
+
<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6" /></svg>
|
|
241
|
+
`,refresh:o`
|
|
242
|
+
<svg viewBox="0 0 24 24">
|
|
243
|
+
<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
|
|
244
|
+
<path d="M21 3v5h-5" />
|
|
245
|
+
<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
|
|
246
|
+
<path d="M8 16H3v5" />
|
|
247
|
+
</svg>
|
|
248
|
+
`,terminal:o`
|
|
249
|
+
<svg viewBox="0 0 24 24">
|
|
250
|
+
<polyline points="4 17 10 11 4 5" />
|
|
251
|
+
<line x1="12" x2="20" y1="19" y2="19" />
|
|
252
|
+
</svg>
|
|
253
|
+
`,home:o`
|
|
254
|
+
<svg viewBox="0 0 24 24">
|
|
255
|
+
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
|
|
256
|
+
<polyline points="9 22 9 12 15 12 15 22" />
|
|
257
|
+
</svg>
|
|
258
|
+
`,save:o`
|
|
259
|
+
<svg viewBox="0 0 24 24">
|
|
260
|
+
<path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" />
|
|
261
|
+
<polyline points="17 21 17 13 7 13 7 21" />
|
|
262
|
+
<polyline points="7 3 7 8 15 8" />
|
|
263
|
+
</svg>
|
|
264
|
+
`,plus:o`
|
|
265
|
+
<svg viewBox="0 0 24 24">
|
|
266
|
+
<path d="M5 12h14" />
|
|
267
|
+
<path d="M12 5v14" />
|
|
268
|
+
</svg>
|
|
269
|
+
`,externalLink:o`
|
|
270
|
+
<svg viewBox="0 0 24 24">
|
|
271
|
+
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
|
|
272
|
+
<polyline points="15 3 21 3 21 9" />
|
|
273
|
+
<line x1="10" x2="21" y1="14" y2="3" />
|
|
274
|
+
</svg>
|
|
275
|
+
`,stop:o`
|
|
276
|
+
<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2" /></svg>
|
|
277
|
+
`};function ae(e,t="nav-item__icon"){return o`<span class=${t} aria-hidden="true">${ie[e]}</span>`}function A(e){const t=typeof e=="number"?new Date(e):new Date(e),i=Date.now()-t.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`:t.toLocaleDateString()}function U(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;if(e<36e5){const i=Math.floor(e/6e4),a=Math.round(e%6e4/1e3);return a>0?`${i}m ${a}s`:`${i}m`}const t=Math.floor(e/36e5),s=Math.round(e%36e5/6e4);return s>0?`${t}h ${s}m`:`${t}h`}function Q(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function oe(e){return o`
|
|
278
|
+
<div class="dashboard-grid" style="animation: dashboard-enter 0.4s var(--ease-out) both;">
|
|
279
|
+
<!-- Status Cards -->
|
|
280
|
+
<div class="stats-row">
|
|
281
|
+
${R("Status",e.serverStatus?.status||"...",e.serverStatus?.version?`v${e.serverStatus.version}`:"")}
|
|
282
|
+
${R("Uptime",e.serverStatus?.uptime?U(e.serverStatus.uptime*1e3):"...","")}
|
|
283
|
+
${R("Activities",e.activityStats?String(e.activityStats.total):"...",e.activityStats?`${e.activityStats.completed} completed, ${e.activityStats.failed} failed`:"")}
|
|
284
|
+
${R("Active Project",e.activeProject?.name||"None",e.projectCount!==null?`${e.projectCount} total`:"")}
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
<!-- Quick Actions -->
|
|
288
|
+
<div class="card" style="animation-delay: 0.1s;">
|
|
289
|
+
<div class="card-header">
|
|
290
|
+
<h3>Quick Actions</h3>
|
|
291
|
+
</div>
|
|
292
|
+
<div class="card-body" style="display: flex; gap: 8px; flex-wrap: wrap; padding: 16px;">
|
|
293
|
+
<button class="btn btn-primary btn-sm" @click=${()=>e.setTab("chat")}>Open Chat</button>
|
|
294
|
+
<button class="btn btn-sm" @click=${()=>e.setTab("cron")}>Manage Cron</button>
|
|
295
|
+
<button class="btn btn-sm" @click=${()=>e.setTab("activity")}>View Activity</button>
|
|
296
|
+
<button class="btn btn-sm" @click=${()=>e.setTab("workspace")}>Workspace</button>
|
|
297
|
+
<button class="btn btn-sm" @click=${()=>e.setTab("logs")}>View Logs</button>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
<!-- Recent Activity -->
|
|
302
|
+
${e.recentActivity.length>0?o`
|
|
303
|
+
<div class="card" style="animation-delay: 0.2s;">
|
|
304
|
+
<div class="card-header">
|
|
305
|
+
<h3>Recent Activity</h3>
|
|
306
|
+
</div>
|
|
307
|
+
<div class="table-wrap">
|
|
308
|
+
<table>
|
|
309
|
+
<thead>
|
|
310
|
+
<tr>
|
|
311
|
+
<th>Time</th>
|
|
312
|
+
<th>Request</th>
|
|
313
|
+
<th>Status</th>
|
|
314
|
+
<th>Executor</th>
|
|
315
|
+
</tr>
|
|
316
|
+
</thead>
|
|
317
|
+
<tbody>
|
|
318
|
+
${e.recentActivity.slice(0,5).map(t=>o`
|
|
319
|
+
<tr>
|
|
320
|
+
<td style="white-space: nowrap;">${A(t.created_at)}</td>
|
|
321
|
+
<td style="max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
|
322
|
+
${(t.request||"").substring(0,80)}
|
|
323
|
+
</td>
|
|
324
|
+
<td>
|
|
325
|
+
<span class="tag ${t.status==="completed"?"tag-green":t.status==="failed"?"tag-red":"tag-yellow"}">
|
|
326
|
+
${t.status}
|
|
327
|
+
</span>
|
|
328
|
+
</td>
|
|
329
|
+
<td>
|
|
330
|
+
<span class="tag ${t.executor==="client"?"tag-blue":"tag-muted"}">${t.executor}</span>
|
|
331
|
+
</td>
|
|
332
|
+
</tr>
|
|
333
|
+
`)}
|
|
334
|
+
</tbody>
|
|
335
|
+
</table>
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
`:v}
|
|
339
|
+
</div>
|
|
340
|
+
`}function R(e,t,s){return o`
|
|
341
|
+
<div class="stat-card">
|
|
342
|
+
<div class="stat-label">${e}</div>
|
|
343
|
+
<div class="stat-value">${t}</div>
|
|
344
|
+
${s?o`<div class="stat-sub">${s}</div>`:v}
|
|
345
|
+
</div>
|
|
346
|
+
`}function re(e){return o`
|
|
347
|
+
<div class="chat-layout">
|
|
348
|
+
<!-- Messages -->
|
|
349
|
+
<div class="chat-messages" id="chat-messages">
|
|
350
|
+
${e.chatMessages.length===0&&!e.chatLoading?o`
|
|
351
|
+
<div class="empty-state">
|
|
352
|
+
<div class="empty-icon">💬</div>
|
|
353
|
+
<p>Send a message to start chatting with your agent.</p>
|
|
354
|
+
</div>
|
|
355
|
+
`:v}
|
|
356
|
+
|
|
357
|
+
${e.chatMessages.map(t=>ne(t))}
|
|
358
|
+
|
|
359
|
+
${e.chatStream?o`
|
|
360
|
+
<div class="chat-msg chat-msg--assistant">
|
|
361
|
+
<div class="chat-msg__role">Assistant</div>
|
|
362
|
+
<div class="chat-msg__body">${e.chatStream}</div>
|
|
363
|
+
</div>
|
|
364
|
+
`:v}
|
|
365
|
+
|
|
366
|
+
${e.chatLoading&&!e.chatStream?o`<div class="chat-msg chat-msg--assistant"><div class="chat-msg__body"><span class="typing-indicator">Thinking...</span></div></div>`:v}
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
<!-- Compose -->
|
|
370
|
+
<div class="chat-compose">
|
|
371
|
+
<div class="chat-compose__inner">
|
|
372
|
+
<textarea
|
|
373
|
+
class="chat-input"
|
|
374
|
+
placeholder="Type a message..."
|
|
375
|
+
.value=${e.chatMessage}
|
|
376
|
+
@input=${t=>{e.chatMessage=t.target.value}}
|
|
377
|
+
@keydown=${t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),e.handleSendChat())}}
|
|
378
|
+
?disabled=${e.chatSending}
|
|
379
|
+
rows="1"
|
|
380
|
+
></textarea>
|
|
381
|
+
<div class="chat-compose__actions">
|
|
382
|
+
${e.chatSending?o`<button class="btn btn-sm btn-danger" @click=${()=>e.abortChat()}>Stop</button>`:o`<button class="btn btn-sm btn-primary" @click=${()=>e.handleSendChat()} ?disabled=${!e.chatMessage.trim()}>Send</button>`}
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
</div>
|
|
386
|
+
</div>
|
|
387
|
+
`}function ne(e){const t=e.role==="user";return o`
|
|
388
|
+
<div class="chat-msg chat-msg--${e.role}">
|
|
389
|
+
<div class="chat-msg__role">${t?"You":"Assistant"}</div>
|
|
390
|
+
<div class="chat-msg__body">${e.content}</div>
|
|
391
|
+
${e.tool_calls&&Array.isArray(e.tool_calls)&&e.tool_calls.length>0?o`
|
|
392
|
+
<div class="chat-msg__tools">
|
|
393
|
+
${e.tool_calls.map(s=>o`
|
|
394
|
+
<div class="tool-card">
|
|
395
|
+
<div class="tool-card__name">${s.name||s.function?.name||"tool"}</div>
|
|
396
|
+
</div>
|
|
397
|
+
`)}
|
|
398
|
+
</div>
|
|
399
|
+
`:v}
|
|
400
|
+
</div>
|
|
401
|
+
`}function ce(e){return o`
|
|
402
|
+
<div class="page-content">
|
|
403
|
+
<!-- Create Form -->
|
|
404
|
+
<div class="card">
|
|
405
|
+
<div class="card-header">
|
|
406
|
+
<h3>Create Cron Job</h3>
|
|
407
|
+
</div>
|
|
408
|
+
<div class="card-body" style="padding: 16px;">
|
|
409
|
+
<div class="form-grid">
|
|
410
|
+
<div class="form-field">
|
|
411
|
+
<label>Name</label>
|
|
412
|
+
<input type="text" class="input" placeholder="Job name" .value=${e.cronForm.name}
|
|
413
|
+
@input=${t=>{e.cronForm={...e.cronForm,name:t.target.value}}} />
|
|
414
|
+
</div>
|
|
415
|
+
<div class="form-field">
|
|
416
|
+
<label>Schedule Type</label>
|
|
417
|
+
<select class="input" .value=${e.cronForm.scheduleType}
|
|
418
|
+
@change=${t=>{e.cronForm={...e.cronForm,scheduleType:t.target.value}}}>
|
|
419
|
+
<option value="every">Every (interval)</option>
|
|
420
|
+
<option value="cron">Cron expression</option>
|
|
421
|
+
<option value="at">At (one-time)</option>
|
|
422
|
+
</select>
|
|
423
|
+
</div>
|
|
424
|
+
${e.cronForm.scheduleType==="every"?o`
|
|
425
|
+
<div class="form-field">
|
|
426
|
+
<label>Interval (e.g. 30m, 2h, 1d)</label>
|
|
427
|
+
<input type="text" class="input" placeholder="30m" .value=${e.cronForm.every}
|
|
428
|
+
@input=${t=>{e.cronForm={...e.cronForm,every:t.target.value}}} />
|
|
429
|
+
</div>
|
|
430
|
+
`:e.cronForm.scheduleType==="cron"?o`
|
|
431
|
+
<div class="form-field">
|
|
432
|
+
<label>Cron Expression</label>
|
|
433
|
+
<input type="text" class="input" placeholder="0 */6 * * *" .value=${e.cronForm.cronExpression}
|
|
434
|
+
@input=${t=>{e.cronForm={...e.cronForm,cronExpression:t.target.value}}} />
|
|
435
|
+
</div>
|
|
436
|
+
`:o`
|
|
437
|
+
<div class="form-field">
|
|
438
|
+
<label>Run At (ISO datetime)</label>
|
|
439
|
+
<input type="datetime-local" class="input" .value=${e.cronForm.at}
|
|
440
|
+
@input=${t=>{e.cronForm={...e.cronForm,at:t.target.value}}} />
|
|
441
|
+
</div>
|
|
442
|
+
`}
|
|
443
|
+
<div class="form-field" style="grid-column: 1 / -1;">
|
|
444
|
+
<label>Instruction</label>
|
|
445
|
+
<textarea class="input" rows="3" placeholder="What should the agent do?"
|
|
446
|
+
.value=${e.cronForm.instruction}
|
|
447
|
+
@input=${t=>{e.cronForm={...e.cronForm,instruction:t.target.value}}}></textarea>
|
|
448
|
+
</div>
|
|
449
|
+
<div>
|
|
450
|
+
<button class="btn btn-primary" @click=${()=>e.createCronJob()} ?disabled=${e.cronLoading}>
|
|
451
|
+
Create Job
|
|
452
|
+
</button>
|
|
453
|
+
</div>
|
|
454
|
+
</div>
|
|
455
|
+
</div>
|
|
456
|
+
</div>
|
|
457
|
+
|
|
458
|
+
<!-- Jobs List -->
|
|
459
|
+
<div class="card">
|
|
460
|
+
<div class="card-header">
|
|
461
|
+
<h3>Cron Jobs</h3>
|
|
462
|
+
<button class="btn btn-sm" @click=${()=>e.loadCronJobs()}>Refresh</button>
|
|
463
|
+
</div>
|
|
464
|
+
${e.cronLoading?o`<div class="loading-center"><div class="spinner"></div></div>`:e.cronJobs.length===0?o`<div class="empty-state"><div class="empty-icon">⏰</div><p>No cron jobs configured</p></div>`:o`
|
|
465
|
+
<div class="table-wrap">
|
|
466
|
+
<table>
|
|
467
|
+
<thead>
|
|
468
|
+
<tr><th>Name</th><th>Schedule</th><th>Status</th><th>Next Run</th><th>Instruction</th><th>Actions</th></tr>
|
|
469
|
+
</thead>
|
|
470
|
+
<tbody>
|
|
471
|
+
${e.cronJobs.map(t=>le(e,t))}
|
|
472
|
+
</tbody>
|
|
473
|
+
</table>
|
|
474
|
+
</div>
|
|
475
|
+
`}
|
|
476
|
+
</div>
|
|
477
|
+
</div>
|
|
478
|
+
`}function le(e,t){const s=de(t),i=t.status==="active"||t.enabled?o`<span class="tag tag-green">Active</span>`:t.status==="completed"?o`<span class="tag tag-blue">Done</span>`:o`<span class="tag tag-muted">Paused</span>`;return o`
|
|
479
|
+
<tr>
|
|
480
|
+
<td><strong>${t.name}</strong></td>
|
|
481
|
+
<td><code>${s}</code></td>
|
|
482
|
+
<td>${i}</td>
|
|
483
|
+
<td>${t.next_run_at?A(t.next_run_at):"--"}</td>
|
|
484
|
+
<td style="max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
|
485
|
+
${(t.instruction||"").substring(0,80)}
|
|
486
|
+
</td>
|
|
487
|
+
<td style="white-space: nowrap;">
|
|
488
|
+
<button class="btn btn-sm btn-primary" @click=${()=>e.runCronJob(t.id)}>Run</button>
|
|
489
|
+
<button class="btn btn-sm" @click=${()=>e.showCronHistory(t.id,t.name)}>History</button>
|
|
490
|
+
<button class="btn btn-sm btn-danger" @click=${()=>e.deleteCronJob(t.id)}>Delete</button>
|
|
491
|
+
</td>
|
|
492
|
+
</tr>
|
|
493
|
+
`}function de(e){if(e.cron_expression)return e.cron_expression;if(e.schedule_type==="every"&&e.schedule_value){const t=Math.round(e.schedule_value/6e4);return t>=60?`every ${Math.round(t/60)}h`:`every ${t}m`}return e.schedule_at?`at ${new Date(e.schedule_at).toLocaleString()}`:"--"}function he(e){return o`
|
|
494
|
+
<div class="page-content">
|
|
495
|
+
<!-- Stats Bar -->
|
|
496
|
+
${e.activityStats?o`
|
|
497
|
+
<div class="stats-row">
|
|
498
|
+
<div class="stat-card"><div class="stat-label">Total</div><div class="stat-value">${e.activityStats.total}</div></div>
|
|
499
|
+
<div class="stat-card"><div class="stat-label">Completed</div><div class="stat-value" style="color: var(--ok);">${e.activityStats.completed}</div></div>
|
|
500
|
+
<div class="stat-card"><div class="stat-label">Failed</div><div class="stat-value" style="color: var(--danger);">${e.activityStats.failed}</div></div>
|
|
501
|
+
<div class="stat-card"><div class="stat-label">Avg Duration</div><div class="stat-value">${U(e.activityStats.avgDuration||0)}</div></div>
|
|
502
|
+
</div>
|
|
503
|
+
`:v}
|
|
504
|
+
|
|
505
|
+
<!-- Toolbar -->
|
|
506
|
+
<div class="toolbar">
|
|
507
|
+
<input type="text" class="input" placeholder="Search activity..."
|
|
508
|
+
style="max-width: 300px;"
|
|
509
|
+
.value=${e.activitySearch}
|
|
510
|
+
@input=${t=>{e.activitySearch=t.target.value}}
|
|
511
|
+
@keydown=${t=>{t.key==="Enter"&&e.searchActivity()}} />
|
|
512
|
+
<select class="input" style="max-width: 150px;"
|
|
513
|
+
.value=${e.activityStatusFilter}
|
|
514
|
+
@change=${t=>{e.activityStatusFilter=t.target.value,e.loadActivity()}}>
|
|
515
|
+
<option value="">All Status</option>
|
|
516
|
+
<option value="completed">Completed</option>
|
|
517
|
+
<option value="pending">Pending</option>
|
|
518
|
+
<option value="failed">Failed</option>
|
|
519
|
+
</select>
|
|
520
|
+
<button class="btn btn-sm" @click=${()=>e.loadActivity()}>Refresh</button>
|
|
521
|
+
</div>
|
|
522
|
+
|
|
523
|
+
<!-- Table -->
|
|
524
|
+
<div class="card">
|
|
525
|
+
<div class="card-header">
|
|
526
|
+
<h3>Activity Log</h3>
|
|
527
|
+
</div>
|
|
528
|
+
${e.activityLoading?o`<div class="loading-center"><div class="spinner"></div></div>`:e.activityList.length===0?o`<div class="empty-state"><div class="empty-icon">📊</div><p>No activity recorded yet</p></div>`:o`
|
|
529
|
+
<div class="table-wrap">
|
|
530
|
+
<table>
|
|
531
|
+
<thead>
|
|
532
|
+
<tr><th>Time</th><th>Request</th><th>Status</th><th>Executor</th><th>Duration</th></tr>
|
|
533
|
+
</thead>
|
|
534
|
+
<tbody>
|
|
535
|
+
${e.activityList.map(t=>ve(e,t))}
|
|
536
|
+
</tbody>
|
|
537
|
+
</table>
|
|
538
|
+
</div>
|
|
539
|
+
${e.activityHasMore?o`<div style="padding: 16px; text-align: center;"><button class="btn btn-sm" @click=${()=>e.loadMoreActivity()}>Load More</button></div>`:v}
|
|
540
|
+
`}
|
|
541
|
+
</div>
|
|
542
|
+
</div>
|
|
543
|
+
|
|
544
|
+
<!-- Detail Modal -->
|
|
545
|
+
${e.activityDetail?o`
|
|
546
|
+
<div class="modal-overlay open" @click=${t=>{t.target===t.currentTarget&&(e.activityDetail=null)}}>
|
|
547
|
+
<div class="modal" style="max-width: 800px;">
|
|
548
|
+
<div class="modal-header">
|
|
549
|
+
<h3>Activity Detail</h3>
|
|
550
|
+
<button class="btn btn-sm" @click=${()=>{e.activityDetail=null}}>Close</button>
|
|
551
|
+
</div>
|
|
552
|
+
<div class="modal-body">
|
|
553
|
+
<div class="config-list">
|
|
554
|
+
<div class="config-row"><span class="config-key">ID</span><span class="config-value"><code>${e.activityDetail.id}</code></span></div>
|
|
555
|
+
<div class="config-row"><span class="config-key">Status</span><span class="config-value">${e.activityDetail.status}</span></div>
|
|
556
|
+
<div class="config-row"><span class="config-key">Executor</span><span class="config-value">${e.activityDetail.executor}</span></div>
|
|
557
|
+
<div class="config-row"><span class="config-key">Created</span><span class="config-value">${new Date(e.activityDetail.created_at).toLocaleString()}</span></div>
|
|
558
|
+
${e.activityDetail.duration?o`<div class="config-row"><span class="config-key">Duration</span><span class="config-value">${U(e.activityDetail.duration)}</span></div>`:v}
|
|
559
|
+
${e.activityDetail.keywords?o`<div class="config-row"><span class="config-key">Keywords</span><span class="config-value">${e.activityDetail.keywords}</span></div>`:v}
|
|
560
|
+
</div>
|
|
561
|
+
<h4 style="margin-top: 16px;">Request</h4>
|
|
562
|
+
<pre class="code-block">${e.activityDetail.request||"(empty)"}</pre>
|
|
563
|
+
${e.activityDetail.response?o`<h4 style="margin-top: 16px;">Response</h4><pre class="code-block">${e.activityDetail.response}</pre>`:v}
|
|
564
|
+
${e.activityDetail.error?o`<h4 style="margin-top: 16px; color: var(--danger);">Error</h4><pre class="code-block" style="color: var(--danger);">${e.activityDetail.error}</pre>`:v}
|
|
565
|
+
</div>
|
|
566
|
+
</div>
|
|
567
|
+
</div>
|
|
568
|
+
`:v}
|
|
569
|
+
`}function ve(e,t){return o`
|
|
570
|
+
<tr style="cursor: pointer;" @click=${()=>{e.activityDetail=t}}>
|
|
571
|
+
<td style="white-space: nowrap;">${A(t.created_at)}</td>
|
|
572
|
+
<td style="max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
|
573
|
+
${Q(t.request||"",80)}
|
|
574
|
+
</td>
|
|
575
|
+
<td>
|
|
576
|
+
<span class="tag ${t.status==="completed"?"tag-green":t.status==="failed"?"tag-red":"tag-yellow"}">${t.status}</span>
|
|
577
|
+
</td>
|
|
578
|
+
<td>
|
|
579
|
+
<span class="tag ${t.executor==="client"?"tag-blue":"tag-muted"}">${t.executor}</span>
|
|
580
|
+
</td>
|
|
581
|
+
<td>${t.duration?U(t.duration):"--"}</td>
|
|
582
|
+
</tr>
|
|
583
|
+
`}function pe(e){const t=e.assetTypeFilter?e.assetsList.filter(s=>s.type===e.assetTypeFilter):e.assetsList;return o`
|
|
584
|
+
<div class="page-content">
|
|
585
|
+
<div class="toolbar">
|
|
586
|
+
<select class="input" style="max-width: 150px;"
|
|
587
|
+
.value=${e.assetTypeFilter}
|
|
588
|
+
@change=${s=>{e.assetTypeFilter=s.target.value}}>
|
|
589
|
+
<option value="">All Types</option>
|
|
590
|
+
<option value="image">Image</option>
|
|
591
|
+
<option value="document">Document</option>
|
|
592
|
+
<option value="audio">Audio</option>
|
|
593
|
+
<option value="video">Video</option>
|
|
594
|
+
<option value="code">Code</option>
|
|
595
|
+
<option value="other">Other</option>
|
|
596
|
+
</select>
|
|
597
|
+
<button class="btn btn-sm" @click=${()=>e.loadAssets()}>Refresh</button>
|
|
598
|
+
<span class="muted-text" style="margin-left: auto;">${t.length} assets</span>
|
|
599
|
+
</div>
|
|
600
|
+
|
|
601
|
+
<div class="card">
|
|
602
|
+
<div class="card-header"><h3>Assets</h3></div>
|
|
603
|
+
${e.assetsLoading?o`<div class="loading-center"><div class="spinner"></div></div>`:t.length===0?o`<div class="empty-state"><div class="empty-icon">📦</div><p>No assets tracked yet</p></div>`:o`
|
|
604
|
+
<div class="table-wrap">
|
|
605
|
+
<table>
|
|
606
|
+
<thead><tr><th>Name</th><th>Type</th><th>Path / URL</th><th>Created</th></tr></thead>
|
|
607
|
+
<tbody>
|
|
608
|
+
${t.map(s=>o`
|
|
609
|
+
<tr>
|
|
610
|
+
<td>
|
|
611
|
+
<strong>${s.name}</strong>
|
|
612
|
+
${s.description?o`<br /><span class="muted-text">${Q(s.description,60)}</span>`:v}
|
|
613
|
+
</td>
|
|
614
|
+
<td><span class="tag tag-blue">${s.type||"unknown"}</span></td>
|
|
615
|
+
<td style="max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
|
616
|
+
${s.remote_url||s.local_file_path||"--"}
|
|
617
|
+
</td>
|
|
618
|
+
<td style="white-space: nowrap;">${A(s.created_at)}</td>
|
|
619
|
+
</tr>
|
|
620
|
+
`)}
|
|
621
|
+
</tbody>
|
|
622
|
+
</table>
|
|
623
|
+
</div>
|
|
624
|
+
`}
|
|
625
|
+
</div>
|
|
626
|
+
</div>
|
|
627
|
+
`}function ue(e){return o`
|
|
628
|
+
<div class="page-content">
|
|
629
|
+
<div class="card">
|
|
630
|
+
<div class="card-header">
|
|
631
|
+
<h3>Projects</h3>
|
|
632
|
+
<button class="btn btn-sm" @click=${()=>e.loadProjects()}>Refresh</button>
|
|
633
|
+
</div>
|
|
634
|
+
${e.projectsLoading?o`<div class="loading-center"><div class="spinner"></div></div>`:e.projectsList.length===0?o`<div class="empty-state"><div class="empty-icon">📂</div><p>No projects yet</p></div>`:o`
|
|
635
|
+
<div class="table-wrap">
|
|
636
|
+
<table>
|
|
637
|
+
<thead><tr><th>Name</th><th>Description</th><th>Path</th><th>Status</th><th>Created</th></tr></thead>
|
|
638
|
+
<tbody>
|
|
639
|
+
${e.projectsList.map(t=>o`
|
|
640
|
+
<tr style="${t.is_active?"border-left: 3px solid var(--ok);":""}">
|
|
641
|
+
<td><strong>${t.name}</strong></td>
|
|
642
|
+
<td style="max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
|
643
|
+
${Q(t.description||"",80)}
|
|
644
|
+
</td>
|
|
645
|
+
<td><code>${t.project_path||"--"}</code></td>
|
|
646
|
+
<td>
|
|
647
|
+
${t.is_active?o`<span class="tag tag-green">Active</span>`:o`<span class="tag tag-muted">Inactive</span>`}
|
|
648
|
+
</td>
|
|
649
|
+
<td style="white-space: nowrap;">${A(t.created_at)}</td>
|
|
650
|
+
</tr>
|
|
651
|
+
`)}
|
|
652
|
+
</tbody>
|
|
653
|
+
</table>
|
|
654
|
+
</div>
|
|
655
|
+
`}
|
|
656
|
+
</div>
|
|
657
|
+
</div>
|
|
658
|
+
`}function ge(e){return o`
|
|
659
|
+
<div class="page-content">
|
|
660
|
+
<div class="card">
|
|
661
|
+
<div class="card-header">
|
|
662
|
+
<h3>Sessions</h3>
|
|
663
|
+
<button class="btn btn-sm" @click=${()=>e.loadSessions()}>Refresh</button>
|
|
664
|
+
</div>
|
|
665
|
+
${e.sessionsLoading?o`<div class="loading-center"><div class="spinner"></div></div>`:e.sessionsList.length===0?o`<div class="empty-state"><div class="empty-icon">📝</div><p>No session files found</p></div>`:o`
|
|
666
|
+
<div class="table-wrap">
|
|
667
|
+
<table>
|
|
668
|
+
<thead><tr><th>Name</th><th>Size</th><th>Modified</th><th>Actions</th></tr></thead>
|
|
669
|
+
<tbody>
|
|
670
|
+
${e.sessionsList.map(t=>o`
|
|
671
|
+
<tr>
|
|
672
|
+
<td><code>${t.name}</code></td>
|
|
673
|
+
<td>${ye(t.size)}</td>
|
|
674
|
+
<td>${t.modified?A(t.modified):"--"}</td>
|
|
675
|
+
<td>
|
|
676
|
+
<button class="btn btn-sm" @click=${()=>e.viewSession(t.name)}>View</button>
|
|
677
|
+
</td>
|
|
678
|
+
</tr>
|
|
679
|
+
`)}
|
|
680
|
+
</tbody>
|
|
681
|
+
</table>
|
|
682
|
+
</div>
|
|
683
|
+
`}
|
|
684
|
+
</div>
|
|
685
|
+
|
|
686
|
+
${e.sessionDetail?o`
|
|
687
|
+
<div class="card">
|
|
688
|
+
<div class="card-header">
|
|
689
|
+
<h3>${e.sessionDetailName}</h3>
|
|
690
|
+
<button class="btn btn-sm" @click=${()=>{e.sessionDetail=null,e.sessionDetailName=""}}>Close</button>
|
|
691
|
+
</div>
|
|
692
|
+
<div class="card-body" style="padding: 16px;">
|
|
693
|
+
<div class="chat-messages" style="max-height: 500px; overflow-y: auto;">
|
|
694
|
+
${e.sessionDetail.map(t=>o`
|
|
695
|
+
<div class="chat-msg chat-msg--${t.role}">
|
|
696
|
+
<div class="chat-msg__role">${t.role==="user"?"User":t.role==="assistant"?"Assistant":"System"}</div>
|
|
697
|
+
<div class="chat-msg__body">${typeof t.content=="string"?t.content:JSON.stringify(t.content)}</div>
|
|
698
|
+
</div>
|
|
699
|
+
`)}
|
|
700
|
+
</div>
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|
|
703
|
+
`:v}
|
|
704
|
+
</div>
|
|
705
|
+
`}function ye(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function me(e){return o`
|
|
706
|
+
<div class="page-content">
|
|
707
|
+
<div class="card">
|
|
708
|
+
<div class="card-header">
|
|
709
|
+
<h3>Workspace Files</h3>
|
|
710
|
+
<button class="btn btn-sm" @click=${()=>e.loadWorkspaceFiles()}>Refresh</button>
|
|
711
|
+
</div>
|
|
712
|
+
${e.workspaceLoading?o`<div class="loading-center"><div class="spinner"></div></div>`:e.workspaceFiles.length===0?o`<div class="empty-state"><div class="empty-icon">📁</div><p>No workspace files</p></div>`:o`
|
|
713
|
+
<div class="table-wrap">
|
|
714
|
+
<table>
|
|
715
|
+
<thead><tr><th>File</th><th>Size</th><th>Modified</th><th>Actions</th></tr></thead>
|
|
716
|
+
<tbody>
|
|
717
|
+
${e.workspaceFiles.map(t=>o`
|
|
718
|
+
<tr class="${e.workspaceEditingFile===t.name?"row-active":""}">
|
|
719
|
+
<td><code>${t.name}</code></td>
|
|
720
|
+
<td>${t.size}B</td>
|
|
721
|
+
<td>${t.modified?A(t.modified):"--"}</td>
|
|
722
|
+
<td>
|
|
723
|
+
<button class="btn btn-sm" @click=${()=>e.editWorkspaceFile(t.name)}>
|
|
724
|
+
${e.workspaceEditingFile===t.name?"Refresh":"Edit"}
|
|
725
|
+
</button>
|
|
726
|
+
</td>
|
|
727
|
+
</tr>
|
|
728
|
+
`)}
|
|
729
|
+
</tbody>
|
|
730
|
+
</table>
|
|
731
|
+
</div>
|
|
732
|
+
`}
|
|
733
|
+
</div>
|
|
734
|
+
|
|
735
|
+
${e.workspaceEditingFile?o`
|
|
736
|
+
<div class="card">
|
|
737
|
+
<div class="card-header">
|
|
738
|
+
<h3>${e.workspaceEditingFile}</h3>
|
|
739
|
+
<div style="display: flex; gap: 8px;">
|
|
740
|
+
<button class="btn btn-sm btn-primary" @click=${()=>e.saveWorkspaceFile()} ?disabled=${e.workspaceSaving}>
|
|
741
|
+
${e.workspaceSaving?"Saving...":"Save"}
|
|
742
|
+
</button>
|
|
743
|
+
<button class="btn btn-sm" @click=${()=>{e.workspaceEditingFile="",e.workspaceEditContent=""}}>Close</button>
|
|
744
|
+
</div>
|
|
745
|
+
</div>
|
|
746
|
+
<div class="card-body" style="padding: 0;">
|
|
747
|
+
<textarea
|
|
748
|
+
class="workspace-editor"
|
|
749
|
+
style="width: 100%; min-height: 400px; padding: 16px; font-family: var(--mono); font-size: 13px; background: var(--bg); color: var(--text); border: none; resize: vertical;"
|
|
750
|
+
.value=${e.workspaceEditContent}
|
|
751
|
+
@input=${t=>{e.workspaceEditContent=t.target.value}}
|
|
752
|
+
></textarea>
|
|
753
|
+
</div>
|
|
754
|
+
</div>
|
|
755
|
+
`:v}
|
|
756
|
+
</div>
|
|
757
|
+
`}function fe(e){return o`
|
|
758
|
+
<div class="page-content">
|
|
759
|
+
<div class="card">
|
|
760
|
+
<div class="card-header">
|
|
761
|
+
<h3>Skills</h3>
|
|
762
|
+
<button class="btn btn-sm" @click=${()=>e.loadSkills()}>Refresh</button>
|
|
763
|
+
</div>
|
|
764
|
+
${e.skillsLoading?o`<div class="loading-center"><div class="spinner"></div></div>`:e.skillsList.length===0?o`<div class="empty-state"><div class="empty-icon">⚡</div><p>No skills registered</p></div>`:o`
|
|
765
|
+
<div class="table-wrap">
|
|
766
|
+
<table>
|
|
767
|
+
<thead><tr><th>Name</th><th>Description</th><th>Status</th></tr></thead>
|
|
768
|
+
<tbody>
|
|
769
|
+
${e.skillsList.map(t=>o`
|
|
770
|
+
<tr>
|
|
771
|
+
<td><strong>${t.name}</strong></td>
|
|
772
|
+
<td>${t.description}</td>
|
|
773
|
+
<td>
|
|
774
|
+
${t.enabled?o`<span class="tag tag-green">Enabled</span>`:o`<span class="tag tag-muted">Disabled</span>`}
|
|
775
|
+
</td>
|
|
776
|
+
</tr>
|
|
777
|
+
`)}
|
|
778
|
+
</tbody>
|
|
779
|
+
</table>
|
|
780
|
+
</div>
|
|
781
|
+
`}
|
|
782
|
+
</div>
|
|
783
|
+
</div>
|
|
784
|
+
`}function $e(e){return o`
|
|
785
|
+
<div class="page-content">
|
|
786
|
+
<div class="toolbar">
|
|
787
|
+
<label style="display: flex; align-items: center; gap: 8px;">
|
|
788
|
+
<input type="checkbox" ?checked=${e.logStreaming}
|
|
789
|
+
@change=${t=>{t.target.checked?e.startLogStream():e.stopLogStream()}} />
|
|
790
|
+
Live streaming
|
|
791
|
+
</label>
|
|
792
|
+
<select class="input" style="max-width: 150px;"
|
|
793
|
+
.value=${e.logFilter}
|
|
794
|
+
@change=${t=>{e.logFilter=t.target.value}}>
|
|
795
|
+
<option value="">All levels</option>
|
|
796
|
+
<option value="error">Errors only</option>
|
|
797
|
+
<option value="warn">Warnings+</option>
|
|
798
|
+
</select>
|
|
799
|
+
<button class="btn btn-sm" @click=${()=>{e.logEntries=[]}}>Clear</button>
|
|
800
|
+
<span class="muted-text" style="margin-left: auto;">${e.logEntries.length} entries</span>
|
|
801
|
+
</div>
|
|
802
|
+
|
|
803
|
+
<div class="card">
|
|
804
|
+
<div class="card-header"><h3>Server Logs</h3></div>
|
|
805
|
+
<div class="log-container" style="max-height: 600px; overflow-y: auto; padding: 0;">
|
|
806
|
+
${ht(e).length===0?o`<div class="empty-state"><div class="empty-icon">📋</div><p>${e.logStreaming?"Waiting for log entries...":"Start streaming to see logs"}</p></div>`:o`
|
|
807
|
+
<pre class="log-pre" style="margin: 0; padding: 16px; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-all;">${ht(e).map(t=>be(t)).join(`
|
|
808
|
+
`)}</pre>
|
|
809
|
+
`}
|
|
810
|
+
</div>
|
|
811
|
+
</div>
|
|
812
|
+
</div>
|
|
813
|
+
`}function ht(e){return e.logFilter?e.logEntries.filter(t=>{const s=(t.level||"").toLowerCase();return e.logFilter==="error"?s==="error"||s==="fatal":e.logFilter==="warn"?s==="warn"||s==="error"||s==="fatal":!0}):e.logEntries}function be(e){if(typeof e=="string")return e;const t=e.timestamp?new Date(e.timestamp).toLocaleTimeString():"",s=e.level||"info",i=e.component?`[${e.component}]`:"",a=e.message||JSON.stringify(e);return`${t} ${s.toUpperCase().padEnd(5)} ${i} ${a}`}function we(e){return o`
|
|
814
|
+
<div class="page-content">
|
|
815
|
+
<!-- Server Config -->
|
|
816
|
+
<div class="card">
|
|
817
|
+
<div class="card-header">
|
|
818
|
+
<h3>Server Configuration</h3>
|
|
819
|
+
<button class="btn btn-sm" @click=${()=>e.loadConfig()}>Refresh</button>
|
|
820
|
+
</div>
|
|
821
|
+
${e.configLoading?o`<div class="loading-center"><div class="spinner"></div></div>`:o`
|
|
822
|
+
<div class="config-list" style="padding: 16px;">
|
|
823
|
+
${Object.entries(e.configData).map(([t,s])=>o`
|
|
824
|
+
<div class="config-row">
|
|
825
|
+
<span class="config-key">${t}</span>
|
|
826
|
+
<span class="config-value">${String(s)}</span>
|
|
827
|
+
</div>
|
|
828
|
+
`)}
|
|
829
|
+
</div>
|
|
830
|
+
`}
|
|
831
|
+
</div>
|
|
832
|
+
|
|
833
|
+
<!-- Environment Variables -->
|
|
834
|
+
<div class="card">
|
|
835
|
+
<div class="card-header">
|
|
836
|
+
<h3>Environment Variables</h3>
|
|
837
|
+
<div style="display: flex; gap: 8px;">
|
|
838
|
+
<button class="btn btn-sm" @click=${()=>e.loadEnv()}>Refresh</button>
|
|
839
|
+
</div>
|
|
840
|
+
</div>
|
|
841
|
+
${e.envLoading?o`<div class="loading-center"><div class="spinner"></div></div>`:o`
|
|
842
|
+
<div class="config-list" style="padding: 16px;">
|
|
843
|
+
${Object.entries(e.envData).map(([t,s])=>o`
|
|
844
|
+
<div class="config-row">
|
|
845
|
+
<span class="config-key">${t}</span>
|
|
846
|
+
<span class="config-value">
|
|
847
|
+
${Se(t)?_e(String(s)):String(s)}
|
|
848
|
+
</span>
|
|
849
|
+
</div>
|
|
850
|
+
`)}
|
|
851
|
+
${Object.keys(e.envData).length===0?o`<p class="muted-text">No environment variables loaded</p>`:v}
|
|
852
|
+
</div>
|
|
853
|
+
`}
|
|
854
|
+
</div>
|
|
855
|
+
|
|
856
|
+
<!-- UI Settings -->
|
|
857
|
+
<div class="card">
|
|
858
|
+
<div class="card-header"><h3>UI Settings</h3></div>
|
|
859
|
+
<div class="config-list" style="padding: 16px;">
|
|
860
|
+
<div class="config-row">
|
|
861
|
+
<span class="config-key">Theme</span>
|
|
862
|
+
<span class="config-value">
|
|
863
|
+
<select class="input" style="width: auto;"
|
|
864
|
+
.value=${e.theme}
|
|
865
|
+
@change=${t=>{e.setTheme(t.target.value)}}>
|
|
866
|
+
<option value="system">System</option>
|
|
867
|
+
<option value="dark">Dark</option>
|
|
868
|
+
<option value="light">Light</option>
|
|
869
|
+
</select>
|
|
870
|
+
</span>
|
|
871
|
+
</div>
|
|
872
|
+
</div>
|
|
873
|
+
</div>
|
|
874
|
+
|
|
875
|
+
<!-- Self Update -->
|
|
876
|
+
<div class="card">
|
|
877
|
+
<div class="card-header"><h3>Server Update</h3></div>
|
|
878
|
+
<div class="card-body" style="padding: 16px;">
|
|
879
|
+
<button class="btn btn-primary" @click=${()=>e.selfUpdate()} ?disabled=${e.updating}>
|
|
880
|
+
${e.updating?"Updating...":"Update Server"}
|
|
881
|
+
</button>
|
|
882
|
+
${e.updateResult?o`<pre class="code-block" style="margin-top: 12px;">${e.updateResult}</pre>`:v}
|
|
883
|
+
</div>
|
|
884
|
+
</div>
|
|
885
|
+
</div>
|
|
886
|
+
`}function Se(e){const t=e.toLowerCase();return t.includes("key")||t.includes("secret")||t.includes("token")||t.includes("password")}function _e(e){return!e||e.length<8?"***":e.substring(0,6)+"..."+e.substring(e.length-4)}var xe=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,l=(e,t,s,i)=>{for(var a=i>1?void 0:i?Ae(t,s):t,r=e.length-1,n;r>=0;r--)(n=e[r])&&(a=(i?n(t,s,a):n(a))||a);return i&&a&&xe(t,s,a),a};let c=class extends T{constructor(){super(...arguments),this.settings=te(),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={name:"",instruction:"",scheduleType:"every",every:"30m",cronExpression:"",at:""},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.handlePopState=()=>{const e=lt(window.location.pathname);e&&e!==this.tab&&(this.tab=e,this.loadTabData(e))}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.theme=this.settings.theme,this.themeResolved=dt(this.theme),this.applyTheme();const e=lt(window.location.pathname);e&&(this.tab=e),window.addEventListener("popstate",this.handlePopState),this.loadStatus(),this.loadTabData(this.tab)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopState),this.logStream?.close()}setTab(e){if(e===this.tab)return;this.tab=e;const t=Kt(e);history.pushState(null,"",t),this.loadTabData(e)}loadTabData(e){switch(e){case"dashboard":this.loadDashboard();break;case"cron":this.loadCronJobs();break;case"activity":this.loadActivity();break;case"assets":this.loadAssets();break;case"projects":this.loadProjects();break;case"sessions":this.loadSessions();break;case"workspace":this.loadWorkspaceFiles();break;case"skills":this.loadSkills();break;case"config":this.loadConfig(),this.loadEnv();break}}setTheme(e){this.theme=e,this.themeResolved=dt(e),this.applyTheme(),this.settings={...this.settings,theme:e},ee(this.settings)}applyTheme(){document.documentElement.setAttribute("data-theme",this.themeResolved)}async loadStatus(){try{this.serverStatus=await g.get("/api/status")}catch{this.serverStatus={status:"offline",version:"?",uptime:0,userId:"",sandboxId:""}}}async loadDashboard(){try{const[e,t,s,i]=await Promise.allSettled([g.get("/api/status"),g.get("/api/db/activity/stats"),g.get("/api/db/projects",{limit:"100"}),g.get("/api/db/activity",{limit:"5"})]);e.status==="fulfilled"&&(this.serverStatus=e.value),t.status==="fulfilled"&&(this.activityStats=t.value),s.status==="fulfilled"&&(this.projectCount=s.value.length,this.activeProject=s.value.find(a=>a.is_active)||null),i.status==="fulfilled"&&(this.recentActivity=i.value)}catch{}}async handleSendChat(e){const t=e||this.chatMessage.trim();!t||this.chatSending||(this.chatMessages=[...this.chatMessages,{role:"user",content:t}],this.chatMessage="",this.chatSending=!0,this.chatStream="",this.chatAbort=g.streamChat(t,{onDelta:s=>{this.chatStream=(this.chatStream||"")+s},onDone:()=>{this.chatStream&&(this.chatMessages=[...this.chatMessages,{role:"assistant",content:this.chatStream}]),this.chatStream=null,this.chatSending=!1,this.chatAbort=null},onError:s=>{this.chatMessages=[...this.chatMessages,{role:"assistant",content:`Error: ${s}`}],this.chatStream=null,this.chatSending=!1,this.chatAbort=null}}))}abortChat(){this.chatAbort?.abort(),this.chatStream=null,this.chatSending=!1,this.chatAbort=null}async loadCronJobs(){this.cronLoading=!0;try{this.cronJobs=await g.get("/api/cron/jobs")}catch{this.cronJobs=[]}this.cronLoading=!1}async createCronJob(){this.cronLoading=!0;try{await g.post("/api/cron/jobs",{name:this.cronForm.name||"Untitled",instruction:this.cronForm.instruction,schedule_type:this.cronForm.scheduleType,every:this.cronForm.scheduleType==="every"?this.cronForm.every:void 0,cron_expression:this.cronForm.scheduleType==="cron"?this.cronForm.cronExpression:void 0,at:this.cronForm.scheduleType==="at"?this.cronForm.at:void 0}),this.cronForm={name:"",instruction:"",scheduleType:"every",every:"30m",cronExpression:"",at:""},await this.loadCronJobs()}catch(e){alert(`Failed to create job: ${e.message}`)}this.cronLoading=!1}async runCronJob(e){try{await g.post(`/api/cron/jobs/${e}/run`)}catch(t){alert(`Failed to run job: ${t.message}`)}}async deleteCronJob(e){if(confirm("Delete this cron job?"))try{await g.del(`/api/cron/jobs/${e}`),await this.loadCronJobs()}catch(t){alert(`Failed to delete job: ${t.message}`)}}async showCronHistory(e,t){this.cronHistoryJob=t,this.cronHistoryOpen=!0;try{this.cronHistory=await g.get("/api/cron/history",{jobId:e,limit:"50"})}catch{this.cronHistory=[]}}async loadActivity(){this.activityLoading=!0,this.activityOffset=0;try{const e={limit:"50",offset:"0"};this.activityStatusFilter&&(e.status=this.activityStatusFilter);const[t,s]=await Promise.allSettled([g.get("/api/db/activity",e),g.get("/api/db/activity/stats")]);t.status==="fulfilled"&&(this.activityList=t.value,this.activityHasMore=t.value.length>=50),s.status==="fulfilled"&&(this.activityStats=s.value)}catch{this.activityList=[]}this.activityLoading=!1}async loadMoreActivity(){this.activityOffset+=50;try{const e={limit:"50",offset:String(this.activityOffset)};this.activityStatusFilter&&(e.status=this.activityStatusFilter);const t=await g.get("/api/db/activity",e);this.activityList=[...this.activityList,...t],this.activityHasMore=t.length>=50}catch{this.activityHasMore=!1}}async searchActivity(){if(!this.activitySearch.trim()){this.loadActivity();return}this.activityLoading=!0;try{this.activityList=await g.get("/api/db/activity/search",{q:this.activitySearch,limit:"50"}),this.activityHasMore=!1}catch{this.activityList=[]}this.activityLoading=!1}async loadAssets(){this.assetsLoading=!0;try{this.assetsList=await g.get("/api/db/assets",{limit:"100"})}catch{this.assetsList=[]}this.assetsLoading=!1}async loadProjects(){this.projectsLoading=!0;try{this.projectsList=await g.get("/api/db/projects",{limit:"100"})}catch{this.projectsList=[]}this.projectsLoading=!1}async loadSessions(){this.sessionsLoading=!0;try{const e=await g.get("/api/sessions");this.sessionsList=e.sessions||[]}catch{this.sessionsList=[]}this.sessionsLoading=!1}async viewSession(e){this.sessionDetailName=e;try{const t=await g.get("/api/session/messages");this.sessionDetail=t.messages||t}catch{this.sessionDetail=[]}}async loadWorkspaceFiles(){this.workspaceLoading=!0;try{const e=await g.get("/api/workspace/files");this.workspaceFiles=e.files||[]}catch{this.workspaceFiles=[]}this.workspaceLoading=!1}async editWorkspaceFile(e){this.workspaceEditingFile=e;try{const t=await g.get("/api/workspace/file",{name:e});this.workspaceEditContent=t.content||""}catch{this.workspaceEditContent="(Failed to load file)"}}async saveWorkspaceFile(){this.workspaceSaving=!0;try{await g.put("/api/workspace/file",{name:this.workspaceEditingFile,content:this.workspaceEditContent})}catch(e){alert(`Failed to save: ${e.message}`)}this.workspaceSaving=!1}async loadSkills(){this.skillsLoading=!0;try{const e=await g.get("/api/skills");this.skillsList=Array.isArray(e)?e:e.skills||[]}catch{this.skillsList=[]}this.skillsLoading=!1}startLogStream(){this.logStreaming=!0,this.logStream=g.streamLogs({onLog:e=>{this.logEntries=[...this.logEntries.slice(-500),e]},onError:()=>{this.logStreaming=!1}})}stopLogStream(){this.logStream?.close(),this.logStream=null,this.logStreaming=!1}async loadConfig(){this.configLoading=!0;try{this.configData=await g.get("/api/config")}catch{this.configData={}}this.configLoading=!1}async loadEnv(){this.envLoading=!0;try{this.envData=await g.get("/api/env")}catch{this.envData={}}this.envLoading=!1}async selfUpdate(){this.updating=!0,this.updateResult="";try{const e=await g.post("/api/update");this.updateResult=e.stdout||e.message||"Update complete"}catch(e){this.updateResult=`Error: ${e.message}`}this.updating=!1}render(){return o`
|
|
887
|
+
<div class="shell">
|
|
888
|
+
<!-- Top Bar -->
|
|
889
|
+
<header class="topbar">
|
|
890
|
+
<div class="topbar__left">
|
|
891
|
+
<span class="topbar__brand">CoStar</span>
|
|
892
|
+
${this.serverStatus?.version?o`<span class="topbar__version">v${this.serverStatus.version}</span>`:v}
|
|
893
|
+
</div>
|
|
894
|
+
<div class="topbar__right">
|
|
895
|
+
<span class="topbar__status ${this.serverStatus?.status==="running"?"status--ok":""}">
|
|
896
|
+
${this.serverStatus?.status||"..."}
|
|
897
|
+
</span>
|
|
898
|
+
</div>
|
|
899
|
+
</header>
|
|
900
|
+
|
|
901
|
+
<!-- Sidebar Nav -->
|
|
902
|
+
<nav class="nav">
|
|
903
|
+
${Wt.map(e=>o`
|
|
904
|
+
<div class="nav-group">
|
|
905
|
+
<div class="nav-group__label">${Xt(e.label)}</div>
|
|
906
|
+
${e.tabs.map(t=>o`
|
|
907
|
+
<button
|
|
908
|
+
class="nav-item ${this.tab===t?"active":""}"
|
|
909
|
+
@click=${()=>this.setTab(t)}
|
|
910
|
+
>
|
|
911
|
+
${ae(Qt(t))}
|
|
912
|
+
<span>${Yt(t)}</span>
|
|
913
|
+
</button>
|
|
914
|
+
`)}
|
|
915
|
+
</div>
|
|
916
|
+
`)}
|
|
917
|
+
</nav>
|
|
918
|
+
|
|
919
|
+
<!-- Content -->
|
|
920
|
+
<main class="content">
|
|
921
|
+
${this.renderPage()}
|
|
922
|
+
</main>
|
|
923
|
+
</div>
|
|
924
|
+
|
|
925
|
+
<!-- Cron History Modal -->
|
|
926
|
+
${this.cronHistoryOpen?o`
|
|
927
|
+
<div class="modal-overlay open" @click=${e=>{e.target===e.currentTarget&&(this.cronHistoryOpen=!1)}}>
|
|
928
|
+
<div class="modal" style="max-width: 700px;">
|
|
929
|
+
<div class="modal-header">
|
|
930
|
+
<h3>History: ${this.cronHistoryJob}</h3>
|
|
931
|
+
<button class="btn btn-sm" @click=${()=>{this.cronHistoryOpen=!1}}>Close</button>
|
|
932
|
+
</div>
|
|
933
|
+
<div class="modal-body">
|
|
934
|
+
${this.cronHistory.length===0?o`<p class="muted-text">No run history</p>`:o`
|
|
935
|
+
<div class="table-wrap">
|
|
936
|
+
<table>
|
|
937
|
+
<thead><tr><th>Time</th><th>Status</th><th>Duration</th><th>Summary</th></tr></thead>
|
|
938
|
+
<tbody>
|
|
939
|
+
${this.cronHistory.map(e=>o`
|
|
940
|
+
<tr>
|
|
941
|
+
<td>${new Date(e.startedAt).toLocaleString()}</td>
|
|
942
|
+
<td>
|
|
943
|
+
<span class="tag ${e.status==="ok"?"tag-green":e.status==="error"?"tag-red":"tag-yellow"}">${e.status}</span>
|
|
944
|
+
</td>
|
|
945
|
+
<td>${e.duration?`${(e.duration/1e3).toFixed(1)}s`:"--"}</td>
|
|
946
|
+
<td style="max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
|
947
|
+
${e.summary||e.error||"--"}
|
|
948
|
+
</td>
|
|
949
|
+
</tr>
|
|
950
|
+
`)}
|
|
951
|
+
</tbody>
|
|
952
|
+
</table>
|
|
953
|
+
</div>
|
|
954
|
+
`}
|
|
955
|
+
</div>
|
|
956
|
+
</div>
|
|
957
|
+
</div>
|
|
958
|
+
`:v}
|
|
959
|
+
`}renderPage(){switch(this.tab){case"dashboard":return oe(this);case"chat":return re(this);case"cron":return ce(this);case"activity":return he(this);case"assets":return pe(this);case"projects":return ue(this);case"sessions":return ge(this);case"workspace":return me(this);case"skills":return fe(this);case"logs":return $e(this);case"config":return we(this);default:return o`<p>Unknown page</p>`}}};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([Ut("costar-app")],c);
|
|
960
|
+
//# sourceMappingURL=index-DnNU5Z1l.js.map
|