@toren-run/console 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +3 -1
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
var z,g,yt,Kt,I,ft,bt,kt,st,j,U,wt,rt,at,ot,zt,B={},q=[],Jt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,J=Array.isArray;function N(n,e){for(var s in e)n[s]=e[s];return n}function it(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function Yt(n,e,s){var r,i,a,l={};for(a in e)a=="key"?r=e[a]:a=="ref"?i=e[a]:l[a]=e[a];if(arguments.length>2&&(l.children=arguments.length>3?z.call(arguments,2):s),typeof n=="function"&&n.defaultProps!=null)for(a in n.defaultProps)l[a]===void 0&&(l[a]=n.defaultProps[a]);return G(n,l,r,i,null)}function G(n,e,s,r,i){var a={type:n,props:e,key:s,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++yt,__i:-1,__u:0};return i==null&&g.vnode!=null&&g.vnode(a),a}function L(n){return n.children}function V(n,e){this.props=n,this.context=e}function $(n,e){if(e==null)return n.__?$(n.__,n.__i+1):null;for(var s;e<n.__k.length;e++)if((s=n.__k[e])!=null&&s.__e!=null)return s.__e;return typeof n.type=="function"?$(n):null}function Zt(n){if(n.__P&&n.__d){var e=n.__v,s=e.__e,r=[],i=[],a=N({},e);a.__v=e.__v+1,g.vnode&&g.vnode(a),lt(n.__P,a,e,n.__n,n.__P.namespaceURI,32&e.__u?[s]:null,r,s??$(e),!!(32&e.__u),i),a.__v=e.__v,a.__.__k[a.__i]=a,xt(r,a,i),e.__e=e.__=null,a.__e!=s&&St(a)}}function St(n){if((n=n.__)!=null&&n.__c!=null)return n.__e=n.__c.base=null,n.__k.some(function(e){if(e!=null&&e.__e!=null)return n.__e=n.__c.base=e.__e}),St(n)}function vt(n){(!n.__d&&(n.__d=!0)&&I.push(n)&&!K.__r++||ft!=g.debounceRendering)&&((ft=g.debounceRendering)||bt)(K)}function K(){try{for(var n,e=1;I.length;)I.length>e&&I.sort(kt),n=I.shift(),e=I.length,Zt(n)}finally{I.length=K.__r=0}}function Tt(n,e,s,r,i,a,l,c,p,_,d){var h,o,u,v,y,S,T=r&&r.__k||q,f=e.length;for(p=Qt(s,e,T,p,f),h=0;h<f;h++)(u=s.__k[h])!=null&&(o=u.__i!=-1&&T[u.__i]||B,u.__i=h,S=lt(n,u,o,i,a,l,c,p,_,d),v=u.__e,u.ref&&o.ref!=u.ref&&(o.ref&&ct(o.ref,null,u),d.push(u.ref,u.__c||v,u)),y==null&&v!=null&&(y=v),4&u.__u?(p=Et(u,p,n),o.__e&&(o.__e=null)):typeof u.type=="function"&&S!==void 0?p=S:v&&(p=v.nextSibling),u.__u&=-7);return s.__e=y,p}function Qt(n,e,s,r,i){var a,l,c,p,_,d=s.length,h=d,o=0;for(n.__k=new Array(i),a=0;a<i;a++)(l=e[a])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=n.__k[a]=G(null,l,null,null,null):J(l)?l=n.__k[a]=G(L,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=n.__k[a]=G(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):n.__k[a]=l,p=a+o,l.__=n,l.__b=n.__b+1,c=null,(_=l.__i=Xt(l,s,p,h))!=-1&&(h--,(c=s[_])&&(c.__u|=2)),c==null||c.__v==null?(_==-1&&(i>d?o--:i<d&&o++),typeof l.type!="function"&&(l.__u|=4)):_!=p&&(_==p-1?o--:_==p+1?o++:(_>p?o--:o++,l.__u|=4))):n.__k[a]=null;if(h)for(a=0;a<d;a++)(c=s[a])!=null&&!(2&c.__u)&&(c.__e==r&&(r=$(c)),Nt(c,c));return r}function Et(n,e,s){var r,i;if(typeof n.type=="function"){for(r=n.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=n,e=Et(r[i],e,s));return e}n.__e!=e&&(e&&n.type&&!e.parentNode&&(e=$(n)),e=s.insertBefore(n.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Xt(n,e,s,r){var i,a,l,c=n.key,p=n.type,_=e[s],d=_!=null&&(2&_.__u)==0;if(_===null&&c==null||d&&c==_.key&&p==_.type)return s;if(r>(d?1:0)){for(i=s-1,a=s+1;i>=0||a<e.length;)if((_=e[l=i>=0?i--:a++])!=null&&!(2&_.__u)&&c==_.key&&p==_.type)return l}return-1}function mt(n,e,s){e[0]=="-"?n.setProperty(e,s??""):n[e]=s==null?"":typeof s!="number"||Jt.test(e)?s:s+"px"}function W(n,e,s,r,i){var a,l;t:if(e=="style")if(typeof s=="string")n.style.cssText=s;else{if(typeof r=="string"&&(n.style.cssText=r=""),r)for(e in r)s&&e in s||mt(n.style,e,"");if(s)for(e in s)r&&s[e]==r[e]||mt(n.style,e,s[e])}else if(e[0]=="o"&&e[1]=="n")a=e!=(e=e.replace(wt,"$1")),l=e.toLowerCase(),e=l in n||e=="onFocusOut"||e=="onFocusIn"?l.slice(2):e.slice(2),n.l||(n.l={}),n.l[e+a]=s,s?r?s[U]=r[U]:(s[U]=rt,n.addEventListener(e,a?ot:at,a)):n.removeEventListener(e,a?ot:at,a);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in n)try{n[e]=s??"";break t}catch{}typeof s=="function"||(s==null||s===!1&&e[4]!="-"?n.removeAttribute(e):n.setAttribute(e,e=="popover"&&s==1?"":s))}}function gt(n){return function(e){if(this.l){var s=this.l[e.type+n];if(e[j]==null)e[j]=rt++;else if(e[j]<s[U])return;return s(g.event?g.event(e):e)}}}function lt(n,e,s,r,i,a,l,c,p,_){var d,h,o,u,v,y,S,T,f,k,O,C,P,R,F,nt,x=e.type;if(e.constructor!==void 0)return null;128&s.__u&&(p=!!(32&s.__u),a=[c=e.__e=s.__e]),(d=g.__b)&&d(e);t:if(typeof x=="function"){h=l.length;try{if(f=e.props,k=x.prototype&&x.prototype.render,O=(d=x.contextType)&&r[d.__c],C=d?O?O.props.value:d.__:r,s.__c?T=(o=e.__c=s.__c).__=o.__E:(k?e.__c=o=new x(f,C):(e.__c=o=new V(f,C),o.constructor=x,o.render=ee),O&&O.sub(o),o.state||(o.state={}),o.__n=r,u=o.__d=!0,o.__h=[],o._sb=[]),k&&o.__s==null&&(o.__s=o.state),k&&x.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=N({},o.__s)),N(o.__s,x.getDerivedStateFromProps(f,o.__s))),v=o.props,y=o.state,o.__v=e,u)k&&x.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),k&&o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(k&&x.getDerivedStateFromProps==null&&f!==v&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(f,C),e.__v==s.__v||!o.__e&&o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(f,o.__s,C)===!1){e.__v!=s.__v&&(o.props=f,o.state=o.__s,o.__d=!1),e.__e=s.__e,e.__k=s.__k,e.__k.some(function(D){D&&(D.__=e)}),q.push.apply(o.__h,o._sb),o._sb=[],o.__h.length&&l.push(o),c=$(s);break t}o.componentWillUpdate!=null&&o.componentWillUpdate(f,o.__s,C),k&&o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(v,y,S)})}if(o.context=C,o.props=f,o.__P=n,o.__e=!1,P=g.__r,R=0,k)o.state=o.__s,o.__d=!1,P&&P(e),d=o.render(o.props,o.state,o.context),q.push.apply(o.__h,o._sb),o._sb=[];else do o.__d=!1,P&&P(e),d=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++R<25);o.state=o.__s,o.getChildContext!=null&&(r=N(N({},r),o.getChildContext())),k&&!u&&o.getSnapshotBeforeUpdate!=null&&(S=o.getSnapshotBeforeUpdate(v,y)),F=d!=null&&d.type===L&&d.key==null?At(d.props.children):d,c=Tt(n,J(F)?F:[F],e,s,r,i,a,l,c,p,_),o.base=e.__e,e.__u&=-161,o.__h.length&&l.push(o),T&&(o.__E=o.__=null)}catch(D){if(l.length=h,e.__v=null,p||a!=null){if(D.then){for(e.__u|=p?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;a!=null&&(a[a.indexOf(c)]=null),e.__e=c}else if(a!=null)for(nt=a.length;nt--;)it(a[nt])}else e.__e=s.__e;e.__k==null&&(e.__k=s.__k||[]),D.then||Ct(e),g.__e(D,e,s)}}else a==null&&e.__v==s.__v?(e.__k=s.__k,e.__e=s.__e):c=e.__e=te(s.__e,e,s,r,i,a,l,p,_);return(d=g.diffed)&&d(e),128&e.__u?void 0:c}function Ct(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(Ct))}function xt(n,e,s){for(var r=0;r<s.length;r++)ct(s[r],s[++r],s[++r]);g.__c&&g.__c(e,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(a){a.call(i)})}catch(a){g.__e(a,i.__v)}})}function At(n){return typeof n!="object"||n==null||n.__b>0?n:J(n)?n.map(At):n.constructor!==void 0?null:N({},n)}function te(n,e,s,r,i,a,l,c,p){var _,d,h,o,u,v,y,S=s.props||B,T=e.props,f=e.type;if(f=="svg"?i="http://www.w3.org/2000/svg":f=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(_=0;_<a.length;_++)if((u=a[_])&&"setAttribute"in u==!!f&&(f?u.localName==f:u.nodeType==3)){n=u,a[_]=null;break}}if(n==null){if(f==null)return document.createTextNode(T);n=document.createElementNS(i,f,T.is&&T),c&&(g.__m&&g.__m(e,a),c=!1),a=null}if(f==null)S===T||c&&n.data==T||(n.data=T);else{if(a=f=="textarea"&&T.defaultValue!=null?null:a&&z.call(n.childNodes),!c&&a!=null)for(S={},_=0;_<n.attributes.length;_++)S[(u=n.attributes[_]).name]=u.value;for(_ in S)u=S[_],_=="dangerouslySetInnerHTML"?h=u:_=="children"||_ in T||_=="value"&&"defaultValue"in T||_=="checked"&&"defaultChecked"in T||W(n,_,null,u,i);for(_ in T)u=T[_],_=="children"?o=u:_=="dangerouslySetInnerHTML"?d=u:_=="value"?v=u:_=="checked"?y=u:c&&typeof u!="function"||S[_]===u||W(n,_,u,S[_],i);if(d)c||h&&(d.__html==h.__html||d.__html==n.innerHTML)||(n.innerHTML=d.__html),e.__k=[];else if(h&&(n.innerHTML=""),Tt(e.type=="template"?n.content:n,J(o)?o:[o],e,s,r,f=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,l,a?a[0]:s.__k&&$(s,0),c,p),a!=null)for(_=a.length;_--;)it(a[_]);c&&f!="textarea"||(_="value",f=="progress"&&v==null?n.removeAttribute("value"):v!=null&&(v!==n[_]||f=="progress"&&!v||f=="option"&&v!=S[_])&&W(n,_,v,S[_],i),_="checked",y!=null&&y!=n[_]&&W(n,_,y,S[_],i))}return n}function ct(n,e,s){try{if(typeof n=="function"){var r=typeof n.__u=="function";r&&n.__u(),r&&e==null||(n.__u=n(e))}else n.current=e}catch(i){g.__e(i,s)}}function Nt(n,e,s){var r,i;if(g.unmount&&g.unmount(n),(r=n.ref)&&(r.current&&r.current!=n.__e||ct(r,null,e)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){g.__e(a,e)}r.base=r.__P=r.__n=null}if(r=n.__k)for(i=0;i<r.length;i++)r[i]&&Nt(r[i],e,s||typeof n.type!="function");s||it(n.__e),n.__c=n.__=n.__e=void 0}function ee(n,e,s){return this.constructor(n,s)}function It(n,e,s){var r,i,a,l;e==document&&(e=document.documentElement),g.__&&g.__(n,e),i=(r=typeof s=="function")?null:s&&s.__k||e.__k,a=[],l=[],lt(e,n=(!r&&s||e).__k=Yt(L,null,[n]),i||B,B,e.namespaceURI,!r&&s?[s]:i?null:e.firstChild?z.call(e.childNodes):null,a,!r&&s?s:i?i.__e:e.firstChild,r,l),xt(a,n,l),n.props.children=null}z=q.slice,g={__e:function(n,e,s,r){for(var i,a,l;e=e.__;)if((i=e.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(n)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(n,r||{}),l=i.__d),l)return i.__E=i}catch(c){n=c}throw n}},yt=0,Kt=function(n){return n!=null&&n.constructor===void 0},V.prototype.setState=function(n,e){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=N({},this.state),typeof n=="function"&&(n=n(N({},s),this.props)),n&&N(s,n),n!=null&&this.__v&&(e&&this._sb.push(e),vt(this))},V.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),vt(this))},V.prototype.render=L,I=[],bt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,kt=function(n,e){return n.__v.__b-e.__v.__b},K.__r=0,st=Math.random().toString(8),j="__d"+st,U="__a"+st,wt=/(PointerCapture)$|Capture$/i,rt=0,at=gt(!1),ot=gt(!0),zt=0;var H,w,ut,Ot,Z=0,Mt=[],E=g,Pt=E.__b,Rt=E.__r,$t=E.diffed,Dt=E.__c,Lt=E.unmount,Ut=E.__;function dt(n,e){E.__h&&E.__h(w,n,Z||e),Z=0;var s=w.__H||(w.__H={__:[],__h:[]});return n>=s.__.length&&s.__.push({}),s.__[n]}function m(n){return Z=1,ne(Wt,n)}function ne(n,e,s){var r=dt(H++,2);if(r.t=n,!r.__c&&(r.__=[s?s(e):Wt(void 0,e),function(c){var p=r.__N?r.__N[0]:r.__[0],_=r.t(p,c);p!==_&&(r.__N=[_,r.__[1]],r.__c.setState({}))}],r.__c=w,!w.__f)){var i=function(c,p,_){if(!r.__c.__H)return!0;var d=!1,h=r.__c.props!==c;if(r.__c.__H.__.some(function(u){if(u.__N){d=!0;var v=u.__[0];u.__=u.__N,u.__N=void 0,v!==u.__[0]&&(h=!0)}}),a){var o=a.call(this,c,p,_);return d?o||h:o}return!d||h};w.__f=!0;var a=w.shouldComponentUpdate,l=w.componentWillUpdate;w.componentWillUpdate=function(c,p,_){if(this.__e){var d=a;a=void 0,i(c,p,_),a=d}l&&l.call(this,c,p,_)},w.shouldComponentUpdate=i}return r.__N||r.__}function A(n,e){var s=dt(H++,3);!E.__s&&Ft(s.__H,e)&&(s.__=n,s.u=e,w.__H.__h.push(s))}function Q(n){return Z=5,se(function(){return{current:n}},[])}function se(n,e){var s=dt(H++,7);return Ft(s.__H,e)&&(s.__=n(),s.__H=e,s.__h=n),s.__}function ae(){for(var n;n=Mt.shift();){var e=n.__H;if(n.__P&&e)try{e.__h.some(Y),e.__h.some(_t),e.__h=[]}catch(s){e.__h=[],E.__e(s,n.__v)}}}E.__b=function(n){w=null,Pt&&Pt(n)},E.__=function(n,e){n&&e.__k&&e.__k.__m&&(n.__m=e.__k.__m),Ut&&Ut(n,e)},E.__r=function(n){Rt&&Rt(n),H=0;var e=(w=n.__c).__H;e&&(ut===w?(e.__h=[],w.__h=[],e.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(e.__h.some(Y),e.__h.some(_t),e.__h=[],H=0)),ut=w},E.diffed=function(n){$t&&$t(n);var e=n.__c;e&&e.__H&&(e.__H.__h.length&&(Mt.push(e)!==1&&Ot===E.requestAnimationFrame||((Ot=E.requestAnimationFrame)||oe)(ae)),e.__H.__.some(function(s){s.u&&(s.__H=s.u,s.u=void 0)})),ut=w=null},E.__c=function(n,e){e.some(function(s){try{s.__h.some(Y),s.__h=s.__h.filter(function(r){return!r.__||_t(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],E.__e(r,s.__v)}}),Dt&&Dt(n,e)},E.unmount=function(n){Lt&&Lt(n);var e,s=n.__c;s&&s.__H&&(s.__H.__.some(function(r){try{Y(r)}catch(i){e=i}}),s.__H=void 0,e&&E.__e(e,s.__v))};var Ht=typeof requestAnimationFrame=="function";function oe(n){var e,s=function(){clearTimeout(r),Ht&&cancelAnimationFrame(e),setTimeout(n)},r=setTimeout(s,35);Ht&&(e=requestAnimationFrame(s))}function Y(n){var e=w,s=n.__c;typeof s=="function"&&(n.__c=void 0,s()),w=e}function _t(n){var e=w;n.__c=n.__(),w=e}function Ft(n,e){return!n||n.length!==e.length||e.some(function(s,r){return s!==n[r]})}function Wt(n,e){return typeof e=="function"?e(n):e}var re=0,Ee=Array.isArray;function t(n,e,s,r,i,a){e||(e={});var l,c,p=e;if("ref"in p)for(c in p={},e)c=="ref"?l=e[c]:p[c]=e[c];var _={type:n,props:p,key:s,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--re,__i:-1,__u:0,__source:i,__self:a};if(typeof n=="function"&&(l=n.defaultProps))for(c in l)p[c]===void 0&&(p[c]=l[c]);return g.vnode&&g.vnode(_),_}var pt="toren.console.token",Gt=()=>localStorage.getItem(pt)??"",Vt=n=>localStorage.setItem(pt,n),Bt=()=>localStorage.removeItem(pt);async function b(n,e,s){let r=await fetch(e,{method:n,headers:{authorization:`Bearer ${Gt()}`,...s!==void 0?{"content-type":"application/json"}:{}},...s!==void 0?{body:JSON.stringify(s)}:{}}),i=await r.json().catch(()=>({}));if(!r.ok){let a=new Error(i.error??`${r.status}`);throw a.status=r.status,a}return i}var X=n=>(n??"").slice(0,8),tt=n=>{if(!n)return"\u2014";let e=Math.max(0,(Date.now()-new Date(n).getTime())/1e3);return e<60?`${Math.floor(e)}s ago`:e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${Math.floor(e/3600)}h ago`:`${Math.floor(e/86400)}d ago`};function M(n,e,s){let[r,i]=m(0);return A(()=>{let a=!0,l=async()=>{try{await n()}catch{}a&&i(p=>p+1)};l();let c=setInterval(l,e);return()=>{a=!1,clearInterval(c)}},s??[]),r}function ht(n){navigator.clipboard?.writeText(n)}var et=({status:n,waiting:e})=>{let s=e?"waiting_approval":n;return t("span",{class:`chip chip-${s}`,children:s==="waiting_approval"?"awaiting approval":s})},qt=()=>t("svg",{viewBox:"0 0 64 104",width:"15",height:"25","aria-hidden":"true",children:[t("defs",{children:t("mask",{id:"cm",children:[t("rect",{width:"64",height:"104",fill:"white"}),t("rect",{x:"-16",y:"47",width:"96",height:"8",fill:"black",transform:"rotate(-12 32 52)"})]})}),t("rect",{x:"12",y:"4",width:"40",height:"96",rx:"7",fill:"currentColor",mask:"url(#cm)"})]});function ie({onIn:n}){let[e,s]=m(""),[r,i]=m(""),[a,l]=m(!1);return t("div",{class:"login-wrap",children:t("form",{class:"login-card",onSubmit:async p=>{p.preventDefault(),l(!0),i(""),Vt(e.trim());try{await b("GET","/runs"),n()}catch{Bt(),i("That credential was refused. Paste the admin token (TOREN_API_TOKEN) or an issued API key.")}finally{l(!1)}},children:[t("div",{class:"login-brand",children:[t(qt,{})," ",t("b",{children:"TOREN"})," ",t("span",{class:"dwg",children:"CONSOLE"})]}),t("h1",{children:"Present credentials."}),t("p",{class:"muted",children:["The admin token unlocks everything, including key management. An issued API key (",t("code",{children:"trn_\u2026"}),") operates runs and approvals only."]}),t("input",{type:"password",autofocus:!0,placeholder:"TOREN_API_TOKEN \xB7 trn_\u2026",value:e,onInput:p=>s(p.currentTarget.value)}),r&&t("div",{class:"form-err",children:r}),t("button",{class:"btn-primary",disabled:a||!e.trim(),children:a?"Checking\u2026":"Enter the console"}),t("p",{class:"fine",children:["Tip: ",t("code",{children:"toren dev"})," prints a pre-authenticated link."]})]})})}function le({nav:n}){let[e,s]=m(null),[r,i]=m(!1);return M(async()=>s((await b("GET","/runs")).runs.filter(a=>a.mode!=="session")),2500),t("div",{class:"page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:"SHT 01 \xB7 OPERATIONS"}),t("h1",{children:"Runs"})]}),t("div",{class:"head-actions",children:[t("span",{class:"live-dot",title:"polling every 2.5s",children:[t("i",{}),"LIVE"]}),t("button",{class:"btn-primary",onClick:()=>i(!0),children:"+ New run"})]})]}),e===null?t("div",{class:"empty",children:"Loading\u2026"}):e.length===0?t("div",{class:"empty",children:[t("b",{children:"No runs yet."}),t("span",{children:["Start one here, or from the CLI: ",t("code",{children:`toren run . --input '"hello"'`})]})]}):t("table",{class:"sheet-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Run"}),t("th",{children:"Agent"}),t("th",{children:"Status"}),t("th",{children:"Started"})]})}),t("tbody",{children:e.map(a=>t("tr",{class:"rowlink",onClick:()=>n(`#/runs/${a.runId}`),children:[t("td",{class:"mono",children:[X(a.runId),t("span",{class:"dim",children:"\u2026"})]}),t("td",{children:[a.agent,a.process&&a.process!=="main"&&t("span",{class:"dim",children:[" \xB7 ",a.process]})]}),t("td",{children:t(et,{status:a.status})}),t("td",{class:"dim",children:tt(a.createdAt)})]},a.runId))})]}),r&&t(ce,{onClose:()=>i(!1),nav:n})]})}function ce({onClose:n,nav:e}){let[s,r]=m(""),[i,a]=m(""),[l,c]=m([]),[p,_]=m(""),[d,h]=m(!1);return A(()=>{b("GET","/agent").then(u=>{let v=u.agent?.crews?Object.keys(u.agent.crews):[u.agent?.name].filter(Boolean);c(v),a(u.agent?.default??v[0]??"")}).catch(()=>{})},[]),t("div",{class:"modal-back",onClick:u=>u.target===u.currentTarget&&n(),children:t("form",{class:"modal",onSubmit:async u=>{u.preventDefault(),h(!0),_("");try{let{runId:v}=await b("POST","/runs",{input:s,...i?{agent:i}:{}});n(),e(`#/runs/${v}`)}catch(v){_(String(v.message))}finally{h(!1)}},children:[t("div",{class:"overline",children:"NEW RUN"}),t("h2",{children:"Give the agent its input"}),l.length>1&&t("div",{class:"agent-select",children:l.map(u=>t("button",{type:"button",class:`agent-opt${u===i?" on":""}`,onClick:()=>a(u),children:u},u))}),t("p",{class:"muted",children:["Passed verbatim as the workflow's ",t("code",{children:"ctx.input"})," string; many agents expect JSON, e.g. ",t("code",{children:'["topic a","topic b"]'}),"."]}),t("textarea",{rows:"4",autofocus:!0,placeholder:'["research this","and this"]',value:s,onInput:u=>r(u.currentTarget.value)}),p&&t("div",{class:"form-err",children:p}),t("div",{class:"modal-actions",children:[t("button",{type:"button",class:"btn-ghost",onClick:n,children:"Cancel"}),t("button",{class:"btn-primary",disabled:d||!s.trim(),children:d?"Starting\u2026":"Start run"})]})]})})}var ue={LlmCallCompleted:"teal",ToolCallCompleted:"teal",TaskCompleted:"teal",WaveSettled:"teal",RunCompleted:"teal",RunFailed:"signal",TaskFailed:"signal",StreamInvalidated:"signal",ApprovalRequested:"amber"};function _e({e:n}){let e=ue[n.type]??"ink",s=n.payload?.usage;return t("details",{class:"ev",children:[t("summary",{children:[t("span",{class:"ev-seq",children:String(n.seq).padStart(3,"0")}),t("span",{class:`ev-type ev-${e}`,children:n.type}),s&&t("span",{class:"ev-usage",children:[s.inputTokens,"\u25B8",s.outputTokens," tok"]})]}),t("pre",{class:"ev-payload",children:JSON.stringify(n.payload,null,2)})]})}function jt({name:n,events:e}){return t("div",{class:"stream",children:[t("div",{class:"stream-head",children:[n," ",t("span",{class:"dim",children:["\xB7 ",e.length," events"]})]}),e.map(s=>t(_e,{e:s},`${n}:${s.seq}`))]})}function de({runId:n,isAdmin:e}){let[s,r]=m(null),[i,a]=m(null),[l,c]=m(""),[p,_]=m("");if(M(async()=>{r(await b("GET",`/runs/${n}`)),a(await b("GET",`/runs/${n}/events`))},2500,[n]),!s)return t("div",{class:"page",children:t("div",{class:"empty",children:"Loading\u2026"})});let d=s.run,h=s.approvals??[],o=async(u,v)=>{_("");try{await b("POST",`/runs/${n}/approvals`,{taskId:u.taskId,stepId:u.stepId,granted:v,by:"console",comment:l||void 0}),c("")}catch(y){_(String(y.message))}};return t("div",{class:"page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:["RUN ",t("span",{class:"mono",children:X(n)})," ",t("button",{class:"copy",onClick:()=>ht(n),title:"copy full id",children:"\u29C9"})]}),t("h1",{class:"h-run",children:[d.agent,d.process&&d.process!=="main"&&t("span",{class:"dim",children:[" \xB7 ",d.process]})," ",t(et,{status:d.status,waiting:h.length>0})]})]}),t("span",{class:"live-dot",children:[t("i",{}),"LIVE"]})]}),h.length>0&&t("div",{class:"approve-card",children:[t("div",{class:"overline signal",children:"HELD FOR APPROVAL \xB7 ZERO COMPUTE WHILE PARKED"}),h.map(u=>t("div",{class:"approve-row",children:[t("div",{class:"approve-what",children:[t("b",{children:u.tool}),t("pre",{class:"ev-payload inline",children:JSON.stringify(u.args,null,2)})]}),t("div",{class:"approve-actions",children:[t("input",{placeholder:"comment for the agent (optional)",value:l,onInput:v=>c(v.currentTarget.value)}),t("button",{class:"btn-primary",onClick:()=>o(u,!0),children:"Approve"}),t("button",{class:"btn-deny",onClick:()=>o(u,!1),children:"Deny"})]})]},`${u.taskId}:${u.stepId}`)),p&&t("div",{class:"form-err",children:p})]}),t("div",{class:"io-grid",children:[t("div",{class:"io-pane",children:[t("div",{class:"io-label",children:"INPUT"}),t("pre",{children:d.input??"\u2014"})]}),t("div",{class:"io-pane",children:[t("div",{class:"io-label",children:d.status==="failed"?"ERROR":"OUTPUT"}),t("pre",{class:d.status==="failed"?"err-text":"",children:d.error??d.output??(d.status==="running"?"\u2026 still working":"\u2014")})]})]}),(s.waves??[]).length>0&&t("div",{class:"waves",children:s.waves.map(u=>t("span",{class:`wave-pill${u.done?" done":""}`,children:["WAVE ",u.name," ",t("b",{children:[u.settled,"/",u.tasks]})]},u.name))}),t("div",{class:"overline",style:"margin-top:26px",children:"EVENT LOG \xB7 THE SOURCE OF TRUTH"}),i&&t("div",{class:"streams",children:[t(jt,{name:"run",events:i.run??[]}),Object.entries(i.tasks??{}).map(([u,v])=>t(jt,{name:`task:${u}`,events:v},u))]})]})}function pe(){let[n,e]=m(null),[s,r]=m([]);if(A(()=>{b("GET","/agent").then(l=>e(l.agent)),b("GET","/runs").then(l=>r(l.runs.filter(c=>c.mode!=="session"))).catch(()=>{})},[]),!n)return t("div",{class:"page",children:t("div",{class:"empty",children:"Loading\u2026"})});let i=n.crews??{[n.name]:n},a=Object.keys(i);return t("div",{class:"page",children:[t("div",{class:"page-head",children:t("div",{children:[t("div",{class:"overline",children:"SHT 03 \xB7 SPECIFICATION"}),t("h1",{children:a.length===1?a[0]:`${a.length} process agents`})]})}),a.map(l=>{let c=i[l],p=c.agents??{},_=p.main?"main":l,d=[_,...Object.keys(p).filter(u=>u!==_)].filter(u=>p[u]),h=s.filter(u=>u.agent===l),o={total:h.length,completed:h.filter(u=>u.status==="completed").length,failed:h.filter(u=>u.status==="failed").length,running:h.filter(u=>u.status==="running").length};return t("div",{class:"crew",children:[a.length>1&&t("div",{class:"crew-title",children:[l,n.default===l&&t("span",{class:"dwg",style:"margin-left:10px",children:"DEFAULT"})]}),c.processes?.length>1&&t("div",{class:"agent-env",children:["PROCESSES: ",c.processes.map(u=>t("code",{children:[u,c.defaultProcess===u?" (default)":""]},u))," ",t("span",{class:"dim",children:["(named workflows \u2014 trigger with --process or POST /runs ","{process}",")"]})]}),t("div",{class:"stat-strip",children:[t("div",{class:"stat",children:[t("b",{children:o.total}),t("span",{children:"runs"})]}),t("div",{class:"stat",children:[t("b",{class:"teal",children:o.completed}),t("span",{children:"completed"})]}),t("div",{class:"stat",children:[t("b",{class:"signal",children:o.failed}),t("span",{children:"failed"})]}),t("div",{class:"stat",children:[t("b",{children:o.running}),t("span",{children:"in flight"})]})]}),d.map(u=>{let v=p[u];return t("div",{class:"agent-card",children:[t("div",{class:"agent-head",children:[t("span",{class:"agent-ref",children:u===_?"ROOT AGENT":`SUBAGENT \xB7 ${u}`}),t("span",{class:"model-chip",children:v.model}),t("span",{class:"dim",children:["max ",v.maxSteps," steps \xB7 ",v.maxTokens," tok \xB7 prompt ",v.systemChars," chars"]})]}),v.env.length>0&&t("div",{class:"agent-env",children:["ENV: ",v.env.map(y=>t("code",{children:y},y))," ",t("span",{class:"dim",children:"(names only; values never leave the worker)"})]}),v.tools.length===0?t("div",{class:"dim",style:"padding: 4px 0 2px",children:"No tools; pure model reasoning."}):t("table",{class:"tool-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Tool"}),t("th",{children:"Description"}),t("th",{children:"Effects"}),t("th",{children:"Approval"})]})}),t("tbody",{children:v.tools.map(y=>t("tr",{children:[t("td",{class:"mono",children:y.name}),t("td",{class:"dim",children:y.description}),t("td",{class:"mono dim",children:y.effects}),t("td",{children:y.approval==="always"?t("span",{class:"chip chip-waiting_approval",style:"animation:none",children:"gated"}):t("span",{class:"dim",children:"auto"})})]},y.name))})]})]},u)})]},l)})]})}function he({nav:n}){let[e,s]=m(null),[r,i]=m([]),[a,l]=m(!1);return M(async()=>s((await b("GET","/sessions")).sessions),3e3),A(()=>{b("GET","/agent").then(c=>{i(c.agent?.crews?Object.keys(c.agent.crews):[c.agent?.name].filter(Boolean))}).catch(()=>{})},[]),t("div",{class:"page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:"SHT 05 \xB7 CONVERSATIONS"}),t("h1",{children:"Sessions"})]}),t("div",{class:"head-actions",children:[t("span",{class:"live-dot",children:[t("i",{}),"LIVE"]}),t("button",{class:"btn-primary",onClick:()=>l(!0),children:"+ New session"})]})]}),e===null?t("div",{class:"empty",children:"Loading\u2026"}):e.length===0?t("div",{class:"empty",children:[t("b",{children:"No conversations yet."}),t("span",{children:"Sessions park at zero compute between turns, and they never re-pay a completed one."})]}):t("table",{class:"sheet-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Session"}),t("th",{children:"Agent"}),t("th",{children:"Status"}),t("th",{children:"Started"})]})}),t("tbody",{children:e.map(c=>t("tr",{class:"rowlink",onClick:()=>n(`#/sessions/${c.runId}`),children:[t("td",{class:"mono",children:[X(c.runId),t("span",{class:"dim",children:"\u2026"})]}),t("td",{children:c.agent}),t("td",{children:t(et,{status:c.status==="running"?"active":c.status})}),t("td",{class:"dim",children:tt(c.createdAt)})]},c.runId))})]}),a&&t(fe,{agents:r,onClose:()=>l(!1),nav:n})]})}function fe({agents:n,onClose:e,nav:s}){let[r,i]=m(n[0]??""),[a,l]=m(""),[c,p]=m(""),[_,d]=m(!1);return t("div",{class:"modal-back",onClick:o=>o.target===o.currentTarget&&e(),children:t("form",{class:"modal",onSubmit:async o=>{o.preventDefault(),d(!0),p("");try{let{runId:u}=await b("POST","/sessions",{agent:r||void 0,message:a});e(),s(`#/sessions/${u}`)}catch(u){p(String(u.message))}finally{d(!1)}},children:[t("div",{class:"overline",children:"NEW SESSION"}),t("h2",{children:"Start a conversation"}),n.length>1&&t("div",{class:"agent-select",children:n.map(o=>t("button",{type:"button",class:`agent-opt${o===r?" on":""}`,onClick:()=>i(o),children:o},o))}),t("textarea",{rows:"3",autofocus:!0,placeholder:"First message to the agent\u2026",value:a,onInput:o=>l(o.currentTarget.value)}),c&&t("div",{class:"form-err",children:c}),t("div",{class:"modal-actions",children:[t("button",{type:"button",class:"btn-ghost",onClick:e,children:"Cancel"}),t("button",{class:"btn-primary",disabled:_||!a.trim(),children:"Start"})]})]})})}function ve({runId:n}){let[e,s]=m(null),[r,i]=m(""),[a,l]=m(""),[c,p]=m([]),[_,d]=m(!1),h=Q(null),o=Q(null),u=Q(0);if(M(async()=>s(await b("GET",`/sessions/${n}`)),2e3,[n]),A(()=>{let f=e?.transcript?.length??0;f>u.current&&(u.current=f,o.current?.scrollIntoView({behavior:"smooth"}))},[e]),!e)return t("div",{class:"page",children:t("div",{class:"empty",children:"Loading\u2026"})});let v=e.state==="awaiting_input",y=e.state==="working",S=async f=>{l("");try{await b("POST",`/sessions/${n}/messages`,f?{close:!0}:{message:r,channel:"console",...c.length?{files:c.map(k=>k.fileId)}:{}}),f||(i(""),p([])),s({...e,state:"working"})}catch(k){l(String(k.message))}},T=async f=>{l(""),d(!0);try{let k=await new Promise((C,P)=>{let R=new FileReader;R.onload=()=>C(String(R.result).split(",")[1]),R.onerror=P,R.readAsDataURL(f)}),O=await b("POST","/files",{name:f.name,content_base64:k});p(C=>[...C,O])}catch(k){l(String(k.message))}finally{d(!1),h.current&&(h.current.value="")}};return t("div",{class:"page chat-page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:["SESSION ",t("span",{class:"mono",children:X(n)})," ",t("button",{class:"copy",onClick:()=>ht(n),title:"copy full id",children:"\u29C9"})]}),t("h1",{class:"h-run",children:[e.agent," ",t(et,{status:e.state==="awaiting_input"?"running":e.state})]})]}),v&&t("button",{class:"btn-deny sm",onClick:()=>S(!0),children:"End session"})]}),t("div",{class:"chat",children:[e.transcript.map(f=>t("div",{class:`bubble ${f.role}`,children:[t("div",{class:"bubble-meta",children:f.role==="user"?`YOU${f.channel?` \xB7 ${f.channel.toUpperCase()}`:""}`:e.agent.toUpperCase()}),t("div",{class:"bubble-text",children:f.text})]},f.seq)),y&&t("div",{class:"bubble assistant thinking",children:[t("div",{class:"bubble-meta",children:e.agent.toUpperCase()}),t("div",{class:"bubble-text",children:["working",t("span",{class:"dots",children:"\u2026"})]})]}),t("div",{ref:o})]}),a&&t("div",{class:"form-err",children:a}),e.state==="completed"?t("div",{class:"chat-closed",children:"Session ended. The full transcript is durable, and it never re-paid a turn."}):t("div",{children:[c.length>0&&t("div",{class:"attach-row",children:c.map(f=>t("span",{class:"attach-chip",children:[f.name," \xB7 ",f.pages,"p",t("button",{type:"button",class:"attach-x",onClick:()=>p(c.filter(k=>k.fileId!==f.fileId)),children:"\xD7"})]},f.fileId))}),t("form",{class:"chat-input",onSubmit:f=>{f.preventDefault(),r.trim()&&S(!1)},children:[t("input",{type:"file",ref:h,style:"display:none",accept:".pdf,.docx,.xlsx,.xls,.txt,.md,.csv,.json,.yaml,.yml,.html,.xml,.log",onChange:f=>{let k=f.currentTarget.files?.[0];k&&T(k)}}),t("button",{type:"button",class:"btn-ghost attach-btn",title:"Attach a file (pdf, docx, xlsx, text)",disabled:!v||_,onClick:()=>h.current?.click(),children:_?"\u2026":"\u{1F4CE}"}),t("input",{placeholder:v?"Your message\u2026":"The agent is working; it has the floor",disabled:!v,value:r,onInput:f=>i(f.currentTarget.value)}),t("button",{class:"btn-primary",disabled:!v||!r.trim(),children:"Send"})]})]})]})}var me=n=>{let e=(new Date(n).getTime()-Date.now())/1e3;return e<=0?"due":e<90?`in ${Math.round(e)}s`:e<5400?`in ${Math.round(e/60)}m`:`in ${Math.round(e/3600)}h`};function ge(){let[n,e]=m(null),[s,r]=m([]),[i,a]=m({agent:"",cron:"",input:"",name:""}),[l,c]=m("");M(async()=>e((await b("GET","/schedules")).schedules),5e3),A(()=>{b("GET","/agent").then(d=>{let h=d.agent?.crews?Object.keys(d.agent.crews):[d.agent?.name].filter(Boolean);r(h),a(o=>({...o,agent:d.agent?.default??h[0]??""}))}).catch(()=>{})},[]);let p=async d=>{d.preventDefault(),c("");try{await b("POST","/schedules",{...i,name:i.name||i.cron}),a(h=>({...h,cron:"",input:"",name:""}))}catch(h){c(String(h.message))}},_=async(d,h)=>{c("");try{h==="rm"?await b("DELETE",`/schedules/${d}`):await b("POST",`/schedules/${d}/${h}`)}catch(o){c(String(o.message))}};return t("div",{class:"page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:"SHT 04 \xB7 TIMETABLE"}),t("h1",{children:"Schedules"})]}),t("span",{class:"live-dot",children:[t("i",{}),"LIVE"]})]}),t("form",{class:"sched-form",onSubmit:p,children:[s.length>1&&t("div",{class:"agent-select",children:s.map(d=>t("button",{type:"button",class:`agent-opt${d===i.agent?" on":""}`,onClick:()=>a(h=>({...h,agent:d})),children:d},d))}),t("div",{class:"sched-row",children:[t("input",{placeholder:'cron: "0 9 * * *"',value:i.cron,onInput:d=>a(h=>({...h,cron:d.currentTarget.value}))}),t("input",{placeholder:'input: ["topic"]',value:i.input,onInput:d=>a(h=>({...h,input:d.currentTarget.value}))}),t("input",{placeholder:"name (optional)",value:i.name,onInput:d=>a(h=>({...h,name:d.currentTarget.value}))}),t("button",{class:"btn-primary",disabled:!i.cron.trim()||!i.input.trim(),children:"Schedule"})]})]}),l&&t("div",{class:"form-err",children:l}),n===null?t("div",{class:"empty",children:"Loading\u2026"}):n.length===0?t("div",{class:"empty",children:[t("b",{children:"Nothing scheduled."}),t("span",{children:"Cron-triggered runs fire from the workers: exactly once, crash-safe."})]}):t("table",{class:"sheet-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Name"}),t("th",{children:"Agent"}),t("th",{children:"Cron"}),t("th",{children:"Next fire"}),t("th",{children:"Last fired"}),t("th",{})]})}),t("tbody",{children:n.map(d=>t("tr",{class:d.enabled?"":"row-dead",children:[t("td",{children:d.name}),t("td",{children:d.agent}),t("td",{class:"mono",children:[d.cron," ",t("span",{class:"dim",children:d.tz})]}),t("td",{children:d.enabled?t("b",{class:"mono",children:me(d.nextFireAt)}):t("span",{class:"chip chip-cancelled",children:"paused"})}),t("td",{class:"dim",children:tt(d.lastFiredAt)}),t("td",{class:"sched-actions",children:[t("button",{class:"btn-ghost sm",onClick:()=>_(d.id,d.enabled?"pause":"resume"),children:d.enabled?"Pause":"Resume"}),t("button",{class:"btn-deny sm",onClick:()=>_(d.id,"rm"),children:"Delete"})]})]},d.id))})]})]})}function ye(){let[n,e]=m(null),[s,r]=m(""),[i,a]=m(null),[l,c]=m(""),p=async()=>e((await b("GET","/keys")).keys);A(()=>{p().catch(h=>c(String(h.message)))},[]);let _=async h=>{h.preventDefault(),c("");try{let{key:o}=await b("POST","/keys",{name:s});a(o),r(""),await p()}catch(o){c(String(o.message))}},d=async h=>{c("");try{await b("DELETE",`/keys/${h}`),await p()}catch(o){c(String(o.message))}};return t("div",{class:"page",children:[t("div",{class:"page-head",children:t("div",{children:[t("div",{class:"overline",children:"SHT 02 \xB7 ACCESS"}),t("h1",{children:"API keys"})]})}),t("form",{class:"key-form",onSubmit:_,children:[t("input",{placeholder:"key name, e.g. ci-pipeline",value:s,onInput:h=>r(h.currentTarget.value)}),t("button",{class:"btn-primary",disabled:!s.trim(),children:"Issue key"})]}),i&&t("div",{class:"minted",children:[t("div",{class:"overline signal",children:"SECRET \xB7 SHOWN ONCE, STORE IT NOW"}),t("div",{class:"minted-row",children:[t("code",{children:i.secret}),t("button",{class:"btn-ghost",onClick:()=>ht(i.secret),children:"Copy"}),t("button",{class:"btn-ghost",onClick:()=>a(null),children:"Dismiss"})]})]}),l&&t("div",{class:"form-err",children:l}),n&&t("table",{class:"sheet-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Key"}),t("th",{children:"Name"}),t("th",{children:"Last used"}),t("th",{children:"Status"}),t("th",{})]})}),t("tbody",{children:n.map(h=>t("tr",{class:h.revokedAt?"row-dead":"",children:[t("td",{class:"mono",children:[h.prefix,"\u2026"]}),t("td",{children:h.name}),t("td",{class:"dim",children:tt(h.lastUsedAt)}),t("td",{children:h.revokedAt?t("span",{class:"chip chip-failed",children:"revoked"}):t("span",{class:"chip chip-completed",children:"active"})}),t("td",{children:!h.revokedAt&&t("button",{class:"btn-deny sm",onClick:()=>d(h.id),children:"Revoke"})})]},h.id))})]})]})}function be(){let[n,e]=m(()=>{let _=location.hash.match(/#token=(.+)$/);return _&&(Vt(decodeURIComponent(_[1])),history.replaceState(null,"",location.pathname+"#/runs")),!!Gt()}),[s,r]=m(location.hash||"#/runs"),[i,a]=m(!1);A(()=>{let _=()=>r(location.hash||"#/runs");return addEventListener("hashchange",_),()=>removeEventListener("hashchange",_)},[]),A(()=>{n&&b("GET","/keys").then(()=>a(!0)).catch(_=>a((_.status!==403,!1)))},[n]);let l=_=>{location.hash=_};if(!n)return t(ie,{onIn:()=>{e(!0),l("#/runs")}});let c=s.match(/^#\/runs\/(.+)$/),p=s.match(/^#\/sessions\/(.+)$/);return t("div",{class:"shell",children:[t("header",{class:"topbar",children:[t("a",{class:"brand",href:"#/runs",children:[t(qt,{})," ",t("b",{children:"TOREN"})," ",t("span",{class:"dwg",children:"CONSOLE \xB7 DWG \u2116 TRN-003"})]}),t("nav",{children:[t("a",{class:s.startsWith("#/runs")?"on":"",href:"#/runs",children:"Runs"}),t("a",{class:s.startsWith("#/sessions")?"on":"",href:"#/sessions",children:"Sessions"}),t("a",{class:s==="#/agent"?"on":"",href:"#/agent",children:"Agent"}),i&&t("a",{class:s==="#/schedules"?"on":"",href:"#/schedules",children:"Schedules"}),i&&t("a",{class:s==="#/keys"?"on":"",href:"#/keys",children:"API keys"})]}),t("div",{class:"topbar-right",children:[t("span",{class:"role",children:i?"ADMIN":"KEY"}),t("button",{class:"btn-ghost sm",onClick:()=>{Bt(),location.reload()},children:"Sign out"})]})]}),p?t(ve,{runId:p[1]}):s.startsWith("#/sessions")?t(he,{nav:l}):c?t(de,{runId:c[1],isAdmin:i}):s==="#/agent"?t(pe,{}):s==="#/schedules"&&i?t(ge,{}):s==="#/keys"&&i?t(ye,{}):t(le,{nav:l}),t("footer",{class:"foot",children:"TOREN CONSOLE \xB7 single deployment \xB7 credentials never leave this browser"})]})}It(t(be,{}),document.getElementById("root"));
|
|
1
|
+
var z,y,bt,Kt,R,vt,kt,wt,st,j,U,St,rt,at,ot,zt,B={},q=[],Jt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,J=Array.isArray;function I(n,e){for(var s in e)n[s]=e[s];return n}function it(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function Yt(n,e,s){var r,i,a,c={};for(a in e)a=="key"?r=e[a]:a=="ref"?i=e[a]:c[a]=e[a];if(arguments.length>2&&(c.children=arguments.length>3?z.call(arguments,2):s),typeof n=="function"&&n.defaultProps!=null)for(a in n.defaultProps)c[a]===void 0&&(c[a]=n.defaultProps[a]);return G(n,c,r,i,null)}function G(n,e,s,r,i){var a={type:n,props:e,key:s,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++bt,__i:-1,__u:0};return i==null&&y.vnode!=null&&y.vnode(a),a}function L(n){return n.children}function V(n,e){this.props=n,this.context=e}function $(n,e){if(e==null)return n.__?$(n.__,n.__i+1):null;for(var s;e<n.__k.length;e++)if((s=n.__k[e])!=null&&s.__e!=null)return s.__e;return typeof n.type=="function"?$(n):null}function Zt(n){if(n.__P&&n.__d){var e=n.__v,s=e.__e,r=[],i=[],a=I({},e);a.__v=e.__v+1,y.vnode&&y.vnode(a),lt(n.__P,a,e,n.__n,n.__P.namespaceURI,32&e.__u?[s]:null,r,s??$(e),!!(32&e.__u),i),a.__v=e.__v,a.__.__k[a.__i]=a,At(r,a,i),e.__e=e.__=null,a.__e!=s&&Tt(a)}}function Tt(n){if((n=n.__)!=null&&n.__c!=null)return n.__e=n.__c.base=null,n.__k.some(function(e){if(e!=null&&e.__e!=null)return n.__e=n.__c.base=e.__e}),Tt(n)}function mt(n){(!n.__d&&(n.__d=!0)&&R.push(n)&&!K.__r++||vt!=y.debounceRendering)&&((vt=y.debounceRendering)||kt)(K)}function K(){try{for(var n,e=1;R.length;)R.length>e&&R.sort(wt),n=R.shift(),e=R.length,Zt(n)}finally{R.length=K.__r=0}}function Et(n,e,s,r,i,a,c,u,p,_,d){var h,o,l,v,g,w,S=r&&r.__k||q,f=e.length;for(p=Qt(s,e,S,p,f),h=0;h<f;h++)(l=s.__k[h])!=null&&(o=l.__i!=-1&&S[l.__i]||B,l.__i=h,w=lt(n,l,o,i,a,c,u,p,_,d),v=l.__e,l.ref&&o.ref!=l.ref&&(o.ref&&ct(o.ref,null,l),d.push(l.ref,l.__c||v,l)),g==null&&v!=null&&(g=v),4&l.__u?(p=Ct(l,p,n),o.__e&&(o.__e=null)):typeof l.type=="function"&&w!==void 0?p=w:v&&(p=v.nextSibling),l.__u&=-7);return s.__e=g,p}function Qt(n,e,s,r,i){var a,c,u,p,_,d=s.length,h=d,o=0;for(n.__k=new Array(i),a=0;a<i;a++)(c=e[a])!=null&&typeof c!="boolean"&&typeof c!="function"?(typeof c=="string"||typeof c=="number"||typeof c=="bigint"||c.constructor==String?c=n.__k[a]=G(null,c,null,null,null):J(c)?c=n.__k[a]=G(L,{children:c},null,null,null):c.constructor===void 0&&c.__b>0?c=n.__k[a]=G(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):n.__k[a]=c,p=a+o,c.__=n,c.__b=n.__b+1,u=null,(_=c.__i=Xt(c,s,p,h))!=-1&&(h--,(u=s[_])&&(u.__u|=2)),u==null||u.__v==null?(_==-1&&(i>d?o--:i<d&&o++),typeof c.type!="function"&&(c.__u|=4)):_!=p&&(_==p-1?o--:_==p+1?o++:(_>p?o--:o++,c.__u|=4))):n.__k[a]=null;if(h)for(a=0;a<d;a++)(u=s[a])!=null&&!(2&u.__u)&&(u.__e==r&&(r=$(u)),Ot(u,u));return r}function Ct(n,e,s){var r,i;if(typeof n.type=="function"){for(r=n.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=n,e=Ct(r[i],e,s));return e}n.__e!=e&&(e&&n.type&&!e.parentNode&&(e=$(n)),e=s.insertBefore(n.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Xt(n,e,s,r){var i,a,c,u=n.key,p=n.type,_=e[s],d=_!=null&&(2&_.__u)==0;if(_===null&&u==null||d&&u==_.key&&p==_.type)return s;if(r>(d?1:0)){for(i=s-1,a=s+1;i>=0||a<e.length;)if((_=e[c=i>=0?i--:a++])!=null&&!(2&_.__u)&&u==_.key&&p==_.type)return c}return-1}function gt(n,e,s){e[0]=="-"?n.setProperty(e,s??""):n[e]=s==null?"":typeof s!="number"||Jt.test(e)?s:s+"px"}function W(n,e,s,r,i){var a,c;t:if(e=="style")if(typeof s=="string")n.style.cssText=s;else{if(typeof r=="string"&&(n.style.cssText=r=""),r)for(e in r)s&&e in s||gt(n.style,e,"");if(s)for(e in s)r&&s[e]==r[e]||gt(n.style,e,s[e])}else if(e[0]=="o"&&e[1]=="n")a=e!=(e=e.replace(St,"$1")),c=e.toLowerCase(),e=c in n||e=="onFocusOut"||e=="onFocusIn"?c.slice(2):e.slice(2),n.l||(n.l={}),n.l[e+a]=s,s?r?s[U]=r[U]:(s[U]=rt,n.addEventListener(e,a?ot:at,a)):n.removeEventListener(e,a?ot:at,a);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in n)try{n[e]=s??"";break t}catch{}typeof s=="function"||(s==null||s===!1&&e[4]!="-"?n.removeAttribute(e):n.setAttribute(e,e=="popover"&&s==1?"":s))}}function yt(n){return function(e){if(this.l){var s=this.l[e.type+n];if(e[j]==null)e[j]=rt++;else if(e[j]<s[U])return;return s(y.event?y.event(e):e)}}}function lt(n,e,s,r,i,a,c,u,p,_){var d,h,o,l,v,g,w,S,f,k,P,C,A,N,F,nt,O=e.type;if(e.constructor!==void 0)return null;128&s.__u&&(p=!!(32&s.__u),a=[u=e.__e=s.__e]),(d=y.__b)&&d(e);t:if(typeof O=="function"){h=c.length;try{if(f=e.props,k=O.prototype&&O.prototype.render,P=(d=O.contextType)&&r[d.__c],C=d?P?P.props.value:d.__:r,s.__c?S=(o=e.__c=s.__c).__=o.__E:(k?e.__c=o=new O(f,C):(e.__c=o=new V(f,C),o.constructor=O,o.render=ee),P&&P.sub(o),o.state||(o.state={}),o.__n=r,l=o.__d=!0,o.__h=[],o._sb=[]),k&&o.__s==null&&(o.__s=o.state),k&&O.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=I({},o.__s)),I(o.__s,O.getDerivedStateFromProps(f,o.__s))),v=o.props,g=o.state,o.__v=e,l)k&&O.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),k&&o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(k&&O.getDerivedStateFromProps==null&&f!==v&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(f,C),e.__v==s.__v||!o.__e&&o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(f,o.__s,C)===!1){e.__v!=s.__v&&(o.props=f,o.state=o.__s,o.__d=!1),e.__e=s.__e,e.__k=s.__k,e.__k.some(function(D){D&&(D.__=e)}),q.push.apply(o.__h,o._sb),o._sb=[],o.__h.length&&c.push(o),u=$(s);break t}o.componentWillUpdate!=null&&o.componentWillUpdate(f,o.__s,C),k&&o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(v,g,w)})}if(o.context=C,o.props=f,o.__P=n,o.__e=!1,A=y.__r,N=0,k)o.state=o.__s,o.__d=!1,A&&A(e),d=o.render(o.props,o.state,o.context),q.push.apply(o.__h,o._sb),o._sb=[];else do o.__d=!1,A&&A(e),d=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++N<25);o.state=o.__s,o.getChildContext!=null&&(r=I(I({},r),o.getChildContext())),k&&!l&&o.getSnapshotBeforeUpdate!=null&&(w=o.getSnapshotBeforeUpdate(v,g)),F=d!=null&&d.type===L&&d.key==null?Nt(d.props.children):d,u=Et(n,J(F)?F:[F],e,s,r,i,a,c,u,p,_),o.base=e.__e,e.__u&=-161,o.__h.length&&c.push(o),S&&(o.__E=o.__=null)}catch(D){if(c.length=h,e.__v=null,p||a!=null){if(D.then){for(e.__u|=p?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;a!=null&&(a[a.indexOf(u)]=null),e.__e=u}else if(a!=null)for(nt=a.length;nt--;)it(a[nt])}else e.__e=s.__e;e.__k==null&&(e.__k=s.__k||[]),D.then||xt(e),y.__e(D,e,s)}}else a==null&&e.__v==s.__v?(e.__k=s.__k,e.__e=s.__e):u=e.__e=te(s.__e,e,s,r,i,a,c,p,_);return(d=y.diffed)&&d(e),128&e.__u?void 0:u}function xt(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(xt))}function At(n,e,s){for(var r=0;r<s.length;r++)ct(s[r],s[++r],s[++r]);y.__c&&y.__c(e,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(a){a.call(i)})}catch(a){y.__e(a,i.__v)}})}function Nt(n){return typeof n!="object"||n==null||n.__b>0?n:J(n)?n.map(Nt):n.constructor!==void 0?null:I({},n)}function te(n,e,s,r,i,a,c,u,p){var _,d,h,o,l,v,g,w=s.props||B,S=e.props,f=e.type;if(f=="svg"?i="http://www.w3.org/2000/svg":f=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(_=0;_<a.length;_++)if((l=a[_])&&"setAttribute"in l==!!f&&(f?l.localName==f:l.nodeType==3)){n=l,a[_]=null;break}}if(n==null){if(f==null)return document.createTextNode(S);n=document.createElementNS(i,f,S.is&&S),u&&(y.__m&&y.__m(e,a),u=!1),a=null}if(f==null)w===S||u&&n.data==S||(n.data=S);else{if(a=f=="textarea"&&S.defaultValue!=null?null:a&&z.call(n.childNodes),!u&&a!=null)for(w={},_=0;_<n.attributes.length;_++)w[(l=n.attributes[_]).name]=l.value;for(_ in w)l=w[_],_=="dangerouslySetInnerHTML"?h=l:_=="children"||_ in S||_=="value"&&"defaultValue"in S||_=="checked"&&"defaultChecked"in S||W(n,_,null,l,i);for(_ in S)l=S[_],_=="children"?o=l:_=="dangerouslySetInnerHTML"?d=l:_=="value"?v=l:_=="checked"?g=l:u&&typeof l!="function"||w[_]===l||W(n,_,l,w[_],i);if(d)u||h&&(d.__html==h.__html||d.__html==n.innerHTML)||(n.innerHTML=d.__html),e.__k=[];else if(h&&(n.innerHTML=""),Et(e.type=="template"?n.content:n,J(o)?o:[o],e,s,r,f=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,c,a?a[0]:s.__k&&$(s,0),u,p),a!=null)for(_=a.length;_--;)it(a[_]);u&&f!="textarea"||(_="value",f=="progress"&&v==null?n.removeAttribute("value"):v!=null&&(v!==n[_]||f=="progress"&&!v||f=="option"&&v!=w[_])&&W(n,_,v,w[_],i),_="checked",g!=null&&g!=n[_]&&W(n,_,g,w[_],i))}return n}function ct(n,e,s){try{if(typeof n=="function"){var r=typeof n.__u=="function";r&&n.__u(),r&&e==null||(n.__u=n(e))}else n.current=e}catch(i){y.__e(i,s)}}function Ot(n,e,s){var r,i;if(y.unmount&&y.unmount(n),(r=n.ref)&&(r.current&&r.current!=n.__e||ct(r,null,e)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){y.__e(a,e)}r.base=r.__P=r.__n=null}if(r=n.__k)for(i=0;i<r.length;i++)r[i]&&Ot(r[i],e,s||typeof n.type!="function");s||it(n.__e),n.__c=n.__=n.__e=void 0}function ee(n,e,s){return this.constructor(n,s)}function Pt(n,e,s){var r,i,a,c;e==document&&(e=document.documentElement),y.__&&y.__(n,e),i=(r=typeof s=="function")?null:s&&s.__k||e.__k,a=[],c=[],lt(e,n=(!r&&s||e).__k=Yt(L,null,[n]),i||B,B,e.namespaceURI,!r&&s?[s]:i?null:e.firstChild?z.call(e.childNodes):null,a,!r&&s?s:i?i.__e:e.firstChild,r,c),At(a,n,c),n.props.children=null}z=q.slice,y={__e:function(n,e,s,r){for(var i,a,c;e=e.__;)if((i=e.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(n)),c=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(n,r||{}),c=i.__d),c)return i.__E=i}catch(u){n=u}throw n}},bt=0,Kt=function(n){return n!=null&&n.constructor===void 0},V.prototype.setState=function(n,e){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=I({},this.state),typeof n=="function"&&(n=n(I({},s),this.props)),n&&I(s,n),n!=null&&this.__v&&(e&&this._sb.push(e),mt(this))},V.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),mt(this))},V.prototype.render=L,R=[],kt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,wt=function(n,e){return n.__v.__b-e.__v.__b},K.__r=0,st=Math.random().toString(8),j="__d"+st,U="__a"+st,St=/(PointerCapture)$|Capture$/i,rt=0,at=yt(!1),ot=yt(!0),zt=0;var H,T,ut,It,Z=0,Ft=[],E=y,Rt=E.__b,$t=E.__r,Dt=E.diffed,Lt=E.__c,Ut=E.unmount,Ht=E.__;function dt(n,e){E.__h&&E.__h(T,n,Z||e),Z=0;var s=T.__H||(T.__H={__:[],__h:[]});return n>=s.__.length&&s.__.push({}),s.__[n]}function m(n){return Z=1,ne(jt,n)}function ne(n,e,s){var r=dt(H++,2);if(r.t=n,!r.__c&&(r.__=[s?s(e):jt(void 0,e),function(u){var p=r.__N?r.__N[0]:r.__[0],_=r.t(p,u);p!==_&&(r.__N=[_,r.__[1]],r.__c.setState({}))}],r.__c=T,!T.__f)){var i=function(u,p,_){if(!r.__c.__H)return!0;var d=!1,h=r.__c.props!==u;if(r.__c.__H.__.some(function(l){if(l.__N){d=!0;var v=l.__[0];l.__=l.__N,l.__N=void 0,v!==l.__[0]&&(h=!0)}}),a){var o=a.call(this,u,p,_);return d?o||h:o}return!d||h};T.__f=!0;var a=T.shouldComponentUpdate,c=T.componentWillUpdate;T.componentWillUpdate=function(u,p,_){if(this.__e){var d=a;a=void 0,i(u,p,_),a=d}c&&c.call(this,u,p,_)},T.shouldComponentUpdate=i}return r.__N||r.__}function x(n,e){var s=dt(H++,3);!E.__s&&Wt(s.__H,e)&&(s.__=n,s.u=e,T.__H.__h.push(s))}function Q(n){return Z=5,se(function(){return{current:n}},[])}function se(n,e){var s=dt(H++,7);return Wt(s.__H,e)&&(s.__=n(),s.__H=e,s.__h=n),s.__}function ae(){for(var n;n=Ft.shift();){var e=n.__H;if(n.__P&&e)try{e.__h.some(Y),e.__h.some(_t),e.__h=[]}catch(s){e.__h=[],E.__e(s,n.__v)}}}E.__b=function(n){T=null,Rt&&Rt(n)},E.__=function(n,e){n&&e.__k&&e.__k.__m&&(n.__m=e.__k.__m),Ht&&Ht(n,e)},E.__r=function(n){$t&&$t(n),H=0;var e=(T=n.__c).__H;e&&(ut===T?(e.__h=[],T.__h=[],e.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(e.__h.some(Y),e.__h.some(_t),e.__h=[],H=0)),ut=T},E.diffed=function(n){Dt&&Dt(n);var e=n.__c;e&&e.__H&&(e.__H.__h.length&&(Ft.push(e)!==1&&It===E.requestAnimationFrame||((It=E.requestAnimationFrame)||oe)(ae)),e.__H.__.some(function(s){s.u&&(s.__H=s.u,s.u=void 0)})),ut=T=null},E.__c=function(n,e){e.some(function(s){try{s.__h.some(Y),s.__h=s.__h.filter(function(r){return!r.__||_t(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],E.__e(r,s.__v)}}),Lt&&Lt(n,e)},E.unmount=function(n){Ut&&Ut(n);var e,s=n.__c;s&&s.__H&&(s.__H.__.some(function(r){try{Y(r)}catch(i){e=i}}),s.__H=void 0,e&&E.__e(e,s.__v))};var Mt=typeof requestAnimationFrame=="function";function oe(n){var e,s=function(){clearTimeout(r),Mt&&cancelAnimationFrame(e),setTimeout(n)},r=setTimeout(s,35);Mt&&(e=requestAnimationFrame(s))}function Y(n){var e=T,s=n.__c;typeof s=="function"&&(n.__c=void 0,s()),T=e}function _t(n){var e=T;n.__c=n.__(),T=e}function Wt(n,e){return!n||n.length!==e.length||e.some(function(s,r){return s!==n[r]})}function jt(n,e){return typeof e=="function"?e(n):e}var re=0,Ee=Array.isArray;function t(n,e,s,r,i,a){e||(e={});var c,u,p=e;if("ref"in p)for(u in p={},e)u=="ref"?c=e[u]:p[u]=e[u];var _={type:n,props:p,key:s,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--re,__i:-1,__u:0,__source:i,__self:a};if(typeof n=="function"&&(c=n.defaultProps))for(u in c)p[u]===void 0&&(p[u]=c[u]);return y.vnode&&y.vnode(_),_}var pt="toren.console.token",ht=()=>localStorage.getItem(pt)??"",Vt=n=>localStorage.setItem(pt,n),Bt=()=>localStorage.removeItem(pt);async function b(n,e,s){let r=await fetch(e,{method:n,headers:{authorization:`Bearer ${ht()}`,...s!==void 0?{"content-type":"application/json"}:{}},...s!==void 0?{body:JSON.stringify(s)}:{}}),i=await r.json().catch(()=>({}));if(!r.ok){let a=new Error(i.error??`${r.status}`);throw a.status=r.status,a}return i}var X=n=>(n??"").slice(0,8),tt=n=>{if(!n)return"\u2014";let e=Math.max(0,(Date.now()-new Date(n).getTime())/1e3);return e<60?`${Math.floor(e)}s ago`:e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${Math.floor(e/3600)}h ago`:`${Math.floor(e/86400)}d ago`};function M(n,e,s){let[r,i]=m(0);return x(()=>{let a=!0,c=async()=>{try{await n()}catch{}a&&i(p=>p+1)};c();let u=setInterval(c,e);return()=>{a=!1,clearInterval(u)}},s??[]),r}function ft(n){navigator.clipboard?.writeText(n)}var et=({status:n,waiting:e})=>{let s=e?"waiting_approval":n;return t("span",{class:`chip chip-${s}`,children:s==="waiting_approval"?"awaiting approval":s})},qt=()=>t("svg",{viewBox:"0 0 64 104",width:"15",height:"25","aria-hidden":"true",children:[t("defs",{children:t("mask",{id:"cm",children:[t("rect",{width:"64",height:"104",fill:"white"}),t("rect",{x:"-16",y:"47",width:"96",height:"8",fill:"black",transform:"rotate(-12 32 52)"})]})}),t("rect",{x:"12",y:"4",width:"40",height:"96",rx:"7",fill:"currentColor",mask:"url(#cm)"})]});function ie({onIn:n}){let[e,s]=m(""),[r,i]=m(""),[a,c]=m(!1);return t("div",{class:"login-wrap",children:t("form",{class:"login-card",onSubmit:async p=>{p.preventDefault(),c(!0),i(""),Vt(e.trim());try{await b("GET","/runs"),n()}catch{Bt(),i("That credential was refused. Paste the admin token (TOREN_API_TOKEN) or an issued API key.")}finally{c(!1)}},children:[t("div",{class:"login-brand",children:[t(qt,{})," ",t("b",{children:"TOREN"})," ",t("span",{class:"dwg",children:"CONSOLE"})]}),t("h1",{children:"Present credentials."}),t("p",{class:"muted",children:["The admin token unlocks everything, including key management. An issued API key (",t("code",{children:"trn_\u2026"}),") operates runs and approvals only."]}),t("input",{type:"password",autofocus:!0,placeholder:"TOREN_API_TOKEN \xB7 trn_\u2026",value:e,onInput:p=>s(p.currentTarget.value)}),r&&t("div",{class:"form-err",children:r}),t("button",{class:"btn-primary",disabled:a||!e.trim(),children:a?"Checking\u2026":"Enter the console"}),t("p",{class:"fine",children:["Tip: ",t("code",{children:"toren dev"})," prints a pre-authenticated link."]})]})})}function le({nav:n}){let[e,s]=m(null),[r,i]=m(!1);return M(async()=>s((await b("GET","/runs")).runs.filter(a=>a.mode!=="session")),2500),t("div",{class:"page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:"SHT 01 \xB7 OPERATIONS"}),t("h1",{children:"Runs"})]}),t("div",{class:"head-actions",children:[t("span",{class:"live-dot",title:"polling every 2.5s",children:[t("i",{}),"LIVE"]}),t("button",{class:"btn-primary",onClick:()=>i(!0),children:"+ New run"})]})]}),e===null?t("div",{class:"empty",children:"Loading\u2026"}):e.length===0?t("div",{class:"empty",children:[t("b",{children:"No runs yet."}),t("span",{children:["Start one here, or from the CLI: ",t("code",{children:`toren run . --input '"hello"'`})]})]}):t("table",{class:"sheet-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Run"}),t("th",{children:"Agent"}),t("th",{children:"Status"}),t("th",{children:"Started"})]})}),t("tbody",{children:e.map(a=>t("tr",{class:"rowlink",onClick:()=>n(`#/runs/${a.runId}`),children:[t("td",{class:"mono",children:[X(a.runId),t("span",{class:"dim",children:"\u2026"})]}),t("td",{children:[a.agent,a.process&&a.process!=="main"&&t("span",{class:"dim",children:[" \xB7 ",a.process]})]}),t("td",{children:t(et,{status:a.status})}),t("td",{class:"dim",children:tt(a.createdAt)})]},a.runId))})]}),r&&t(ce,{onClose:()=>i(!1),nav:n})]})}function ce({onClose:n,nav:e}){let[s,r]=m(""),[i,a]=m(""),[c,u]=m([]),[p,_]=m(""),[d,h]=m(!1);return x(()=>{b("GET","/agent").then(l=>{let v=l.agent?.crews?Object.keys(l.agent.crews):[l.agent?.name].filter(Boolean);u(v),a(l.agent?.default??v[0]??"")}).catch(()=>{})},[]),t("div",{class:"modal-back",onClick:l=>l.target===l.currentTarget&&n(),children:t("form",{class:"modal",onSubmit:async l=>{l.preventDefault(),h(!0),_("");try{let{runId:v}=await b("POST","/runs",{input:s,...i?{agent:i}:{}});n(),e(`#/runs/${v}`)}catch(v){_(String(v.message))}finally{h(!1)}},children:[t("div",{class:"overline",children:"NEW RUN"}),t("h2",{children:"Give the agent its input"}),c.length>1&&t("div",{class:"agent-select",children:c.map(l=>t("button",{type:"button",class:`agent-opt${l===i?" on":""}`,onClick:()=>a(l),children:l},l))}),t("p",{class:"muted",children:["Passed verbatim as the workflow's ",t("code",{children:"ctx.input"})," string; many agents expect JSON, e.g. ",t("code",{children:'["topic a","topic b"]'}),"."]}),t("textarea",{rows:"4",autofocus:!0,placeholder:'["research this","and this"]',value:s,onInput:l=>r(l.currentTarget.value)}),p&&t("div",{class:"form-err",children:p}),t("div",{class:"modal-actions",children:[t("button",{type:"button",class:"btn-ghost",onClick:n,children:"Cancel"}),t("button",{class:"btn-primary",disabled:d||!s.trim(),children:d?"Starting\u2026":"Start run"})]})]})})}var ue={LlmCallCompleted:"teal",ToolCallCompleted:"teal",TaskCompleted:"teal",WaveSettled:"teal",RunCompleted:"teal",RunFailed:"signal",TaskFailed:"signal",StreamInvalidated:"signal",ApprovalRequested:"amber"};function _e({e:n}){let e=ue[n.type]??"ink",s=n.payload?.usage;return t("details",{class:"ev",children:[t("summary",{children:[t("span",{class:"ev-seq",children:String(n.seq).padStart(3,"0")}),t("span",{class:`ev-type ev-${e}`,children:n.type}),s&&t("span",{class:"ev-usage",children:[s.inputTokens,"\u25B8",s.outputTokens," tok"]})]}),t("pre",{class:"ev-payload",children:JSON.stringify(n.payload,null,2)})]})}function Gt({name:n,events:e}){return t("div",{class:"stream",children:[t("div",{class:"stream-head",children:[n," ",t("span",{class:"dim",children:["\xB7 ",e.length," events"]})]}),e.map(s=>t(_e,{e:s},`${n}:${s.seq}`))]})}function de({runId:n,isAdmin:e}){let[s,r]=m(null),[i,a]=m(null),[c,u]=m(""),[p,_]=m("");if(M(async()=>{r(await b("GET",`/runs/${n}`)),a(await b("GET",`/runs/${n}/events`))},1e4,[n]),x(()=>{let l=!0,v=async()=>{if(l)try{r(await b("GET",`/runs/${n}`)),a(await b("GET",`/runs/${n}/events`))}catch{}};return(async()=>{try{let g=await fetch(`/runs/${n}/events/stream`,{headers:{authorization:`Bearer ${ht()}`}});if(!g.ok||!g.body)return;let w=g.body.getReader(),S=new TextDecoder,f="";for(;;){let{value:k,done:P}=await w.read();if(P||!l)return;f+=S.decode(k,{stream:!0});let C,A=!1;for(;(C=f.indexOf(`
|
|
2
|
+
|
|
3
|
+
`))>=0;){let N=f.slice(0,C);if(f=f.slice(C+2),N.includes("data: ")&&(A=!0),N.includes("event: done")){await v();return}}A&&await v()}}catch{}})(),()=>{l=!1}},[n]),!s)return t("div",{class:"page",children:t("div",{class:"empty",children:"Loading\u2026"})});let d=s.run,h=s.approvals??[],o=async(l,v)=>{_("");try{await b("POST",`/runs/${n}/approvals`,{taskId:l.taskId,stepId:l.stepId,granted:v,by:"console",comment:c||void 0}),u("")}catch(g){_(String(g.message))}};return t("div",{class:"page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:["RUN ",t("span",{class:"mono",children:X(n)})," ",t("button",{class:"copy",onClick:()=>ft(n),title:"copy full id",children:"\u29C9"})]}),t("h1",{class:"h-run",children:[d.agent,d.process&&d.process!=="main"&&t("span",{class:"dim",children:[" \xB7 ",d.process]})," ",t(et,{status:d.status,waiting:h.length>0})]})]}),t("span",{class:"live-dot",children:[t("i",{}),"LIVE"]})]}),h.length>0&&t("div",{class:"approve-card",children:[t("div",{class:"overline signal",children:"HELD FOR APPROVAL \xB7 ZERO COMPUTE WHILE PARKED"}),h.map(l=>t("div",{class:"approve-row",children:[t("div",{class:"approve-what",children:[t("b",{children:l.tool}),t("pre",{class:"ev-payload inline",children:JSON.stringify(l.args,null,2)})]}),t("div",{class:"approve-actions",children:[t("input",{placeholder:"comment for the agent (optional)",value:c,onInput:v=>u(v.currentTarget.value)}),t("button",{class:"btn-primary",onClick:()=>o(l,!0),children:"Approve"}),t("button",{class:"btn-deny",onClick:()=>o(l,!1),children:"Deny"})]})]},`${l.taskId}:${l.stepId}`)),p&&t("div",{class:"form-err",children:p})]}),t("div",{class:"io-grid",children:[t("div",{class:"io-pane",children:[t("div",{class:"io-label",children:"INPUT"}),t("pre",{children:d.input??"\u2014"})]}),t("div",{class:"io-pane",children:[t("div",{class:"io-label",children:d.status==="failed"?"ERROR":"OUTPUT"}),t("pre",{class:d.status==="failed"?"err-text":"",children:d.error??d.output??(d.status==="running"?"\u2026 still working":"\u2014")})]})]}),(s.waves??[]).length>0&&t("div",{class:"waves",children:s.waves.map(l=>t("span",{class:`wave-pill${l.done?" done":""}`,children:["WAVE ",l.name," ",t("b",{children:[l.settled,"/",l.tasks]})]},l.name))}),t("div",{class:"overline",style:"margin-top:26px",children:"EVENT LOG \xB7 THE SOURCE OF TRUTH"}),i&&t("div",{class:"streams",children:[t(Gt,{name:"run",events:i.run??[]}),Object.entries(i.tasks??{}).map(([l,v])=>t(Gt,{name:`task:${l}`,events:v},l))]})]})}function pe(){let[n,e]=m(null),[s,r]=m([]);if(x(()=>{b("GET","/agent").then(c=>e(c.agent)),b("GET","/runs").then(c=>r(c.runs.filter(u=>u.mode!=="session"))).catch(()=>{})},[]),!n)return t("div",{class:"page",children:t("div",{class:"empty",children:"Loading\u2026"})});let i=n.crews??{[n.name]:n},a=Object.keys(i);return t("div",{class:"page",children:[t("div",{class:"page-head",children:t("div",{children:[t("div",{class:"overline",children:"SHT 03 \xB7 SPECIFICATION"}),t("h1",{children:a.length===1?a[0]:`${a.length} process agents`})]})}),a.map(c=>{let u=i[c],p=u.agents??{},_=p.main?"main":c,d=[_,...Object.keys(p).filter(l=>l!==_)].filter(l=>p[l]),h=s.filter(l=>l.agent===c),o={total:h.length,completed:h.filter(l=>l.status==="completed").length,failed:h.filter(l=>l.status==="failed").length,running:h.filter(l=>l.status==="running").length};return t("div",{class:"crew",children:[a.length>1&&t("div",{class:"crew-title",children:[c,n.default===c&&t("span",{class:"dwg",style:"margin-left:10px",children:"DEFAULT"})]}),u.processes?.length>1&&t("div",{class:"agent-env",children:["PROCESSES: ",u.processes.map(l=>t("code",{children:[l,u.defaultProcess===l?" (default)":""]},l))," ",t("span",{class:"dim",children:["(named workflows \u2014 trigger with --process or POST /runs ","{process}",")"]})]}),t("div",{class:"stat-strip",children:[t("div",{class:"stat",children:[t("b",{children:o.total}),t("span",{children:"runs"})]}),t("div",{class:"stat",children:[t("b",{class:"teal",children:o.completed}),t("span",{children:"completed"})]}),t("div",{class:"stat",children:[t("b",{class:"signal",children:o.failed}),t("span",{children:"failed"})]}),t("div",{class:"stat",children:[t("b",{children:o.running}),t("span",{children:"in flight"})]})]}),d.map(l=>{let v=p[l];return t("div",{class:"agent-card",children:[t("div",{class:"agent-head",children:[t("span",{class:"agent-ref",children:l===_?"ROOT AGENT":`SUBAGENT \xB7 ${l}`}),t("span",{class:"model-chip",children:v.model}),t("span",{class:"dim",children:["max ",v.maxSteps," steps \xB7 ",v.maxTokens," tok \xB7 prompt ",v.systemChars," chars"]})]}),v.env.length>0&&t("div",{class:"agent-env",children:["ENV: ",v.env.map(g=>t("code",{children:g},g))," ",t("span",{class:"dim",children:"(names only; values never leave the worker)"})]}),v.tools.length===0?t("div",{class:"dim",style:"padding: 4px 0 2px",children:"No tools; pure model reasoning."}):t("table",{class:"tool-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Tool"}),t("th",{children:"Description"}),t("th",{children:"Effects"}),t("th",{children:"Approval"})]})}),t("tbody",{children:v.tools.map(g=>t("tr",{children:[t("td",{class:"mono",children:g.name}),t("td",{class:"dim",children:g.description}),t("td",{class:"mono dim",children:g.effects}),t("td",{children:g.approval==="always"?t("span",{class:"chip chip-waiting_approval",style:"animation:none",children:"gated"}):t("span",{class:"dim",children:"auto"})})]},g.name))})]})]},l)})]},c)})]})}function he({nav:n}){let[e,s]=m(null),[r,i]=m([]),[a,c]=m(!1);return M(async()=>s((await b("GET","/sessions")).sessions),3e3),x(()=>{b("GET","/agent").then(u=>{i(u.agent?.crews?Object.keys(u.agent.crews):[u.agent?.name].filter(Boolean))}).catch(()=>{})},[]),t("div",{class:"page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:"SHT 05 \xB7 CONVERSATIONS"}),t("h1",{children:"Sessions"})]}),t("div",{class:"head-actions",children:[t("span",{class:"live-dot",children:[t("i",{}),"LIVE"]}),t("button",{class:"btn-primary",onClick:()=>c(!0),children:"+ New session"})]})]}),e===null?t("div",{class:"empty",children:"Loading\u2026"}):e.length===0?t("div",{class:"empty",children:[t("b",{children:"No conversations yet."}),t("span",{children:"Sessions park at zero compute between turns, and they never re-pay a completed one."})]}):t("table",{class:"sheet-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Session"}),t("th",{children:"Agent"}),t("th",{children:"Status"}),t("th",{children:"Started"})]})}),t("tbody",{children:e.map(u=>t("tr",{class:"rowlink",onClick:()=>n(`#/sessions/${u.runId}`),children:[t("td",{class:"mono",children:[X(u.runId),t("span",{class:"dim",children:"\u2026"})]}),t("td",{children:u.agent}),t("td",{children:t(et,{status:u.status==="running"?"active":u.status})}),t("td",{class:"dim",children:tt(u.createdAt)})]},u.runId))})]}),a&&t(fe,{agents:r,onClose:()=>c(!1),nav:n})]})}function fe({agents:n,onClose:e,nav:s}){let[r,i]=m(n[0]??""),[a,c]=m(""),[u,p]=m(""),[_,d]=m(!1);return t("div",{class:"modal-back",onClick:o=>o.target===o.currentTarget&&e(),children:t("form",{class:"modal",onSubmit:async o=>{o.preventDefault(),d(!0),p("");try{let{runId:l}=await b("POST","/sessions",{agent:r||void 0,message:a});e(),s(`#/sessions/${l}`)}catch(l){p(String(l.message))}finally{d(!1)}},children:[t("div",{class:"overline",children:"NEW SESSION"}),t("h2",{children:"Start a conversation"}),n.length>1&&t("div",{class:"agent-select",children:n.map(o=>t("button",{type:"button",class:`agent-opt${o===r?" on":""}`,onClick:()=>i(o),children:o},o))}),t("textarea",{rows:"3",autofocus:!0,placeholder:"First message to the agent\u2026",value:a,onInput:o=>c(o.currentTarget.value)}),u&&t("div",{class:"form-err",children:u}),t("div",{class:"modal-actions",children:[t("button",{type:"button",class:"btn-ghost",onClick:e,children:"Cancel"}),t("button",{class:"btn-primary",disabled:_||!a.trim(),children:"Start"})]})]})})}function ve({runId:n}){let[e,s]=m(null),[r,i]=m(""),[a,c]=m(""),[u,p]=m([]),[_,d]=m(!1),h=Q(null),o=Q(null),l=Q(0);if(M(async()=>s(await b("GET",`/sessions/${n}`)),2e3,[n]),x(()=>{let f=e?.transcript?.length??0;f>l.current&&(l.current=f,o.current?.scrollIntoView({behavior:"smooth"}))},[e]),!e)return t("div",{class:"page",children:t("div",{class:"empty",children:"Loading\u2026"})});let v=e.state==="awaiting_input",g=e.state==="working",w=async f=>{c("");try{await b("POST",`/sessions/${n}/messages`,f?{close:!0}:{message:r,channel:"console",...u.length?{files:u.map(k=>k.fileId)}:{}}),f||(i(""),p([])),s({...e,state:"working"})}catch(k){c(String(k.message))}},S=async f=>{c(""),d(!0);try{let k=await new Promise((C,A)=>{let N=new FileReader;N.onload=()=>C(String(N.result).split(",")[1]),N.onerror=A,N.readAsDataURL(f)}),P=await b("POST","/files",{name:f.name,content_base64:k});p(C=>[...C,P])}catch(k){c(String(k.message))}finally{d(!1),h.current&&(h.current.value="")}};return t("div",{class:"page chat-page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:["SESSION ",t("span",{class:"mono",children:X(n)})," ",t("button",{class:"copy",onClick:()=>ft(n),title:"copy full id",children:"\u29C9"})]}),t("h1",{class:"h-run",children:[e.agent," ",t(et,{status:e.state==="awaiting_input"?"running":e.state})]})]}),v&&t("button",{class:"btn-deny sm",onClick:()=>w(!0),children:"End session"})]}),t("div",{class:"chat",children:[e.transcript.map(f=>t("div",{class:`bubble ${f.role}`,children:[t("div",{class:"bubble-meta",children:f.role==="user"?`YOU${f.channel?` \xB7 ${f.channel.toUpperCase()}`:""}`:e.agent.toUpperCase()}),t("div",{class:"bubble-text",children:f.text})]},f.seq)),g&&t("div",{class:"bubble assistant thinking",children:[t("div",{class:"bubble-meta",children:e.agent.toUpperCase()}),t("div",{class:"bubble-text",children:["working",t("span",{class:"dots",children:"\u2026"})]})]}),t("div",{ref:o})]}),a&&t("div",{class:"form-err",children:a}),e.state==="completed"?t("div",{class:"chat-closed",children:"Session ended. The full transcript is durable, and it never re-paid a turn."}):t("div",{children:[u.length>0&&t("div",{class:"attach-row",children:u.map(f=>t("span",{class:"attach-chip",children:[f.name," \xB7 ",f.pages,"p",t("button",{type:"button",class:"attach-x",onClick:()=>p(u.filter(k=>k.fileId!==f.fileId)),children:"\xD7"})]},f.fileId))}),t("form",{class:"chat-input",onSubmit:f=>{f.preventDefault(),r.trim()&&w(!1)},children:[t("input",{type:"file",ref:h,style:"display:none",accept:".pdf,.docx,.xlsx,.xls,.txt,.md,.csv,.json,.yaml,.yml,.html,.xml,.log",onChange:f=>{let k=f.currentTarget.files?.[0];k&&S(k)}}),t("button",{type:"button",class:"btn-ghost attach-btn",title:"Attach a file (pdf, docx, xlsx, text)",disabled:!v||_,onClick:()=>h.current?.click(),children:_?"\u2026":"\u{1F4CE}"}),t("input",{placeholder:v?"Your message\u2026":"The agent is working; it has the floor",disabled:!v,value:r,onInput:f=>i(f.currentTarget.value)}),t("button",{class:"btn-primary",disabled:!v||!r.trim(),children:"Send"})]})]})]})}var me=n=>{let e=(new Date(n).getTime()-Date.now())/1e3;return e<=0?"due":e<90?`in ${Math.round(e)}s`:e<5400?`in ${Math.round(e/60)}m`:`in ${Math.round(e/3600)}h`};function ge(){let[n,e]=m(null),[s,r]=m([]),[i,a]=m({agent:"",cron:"",input:"",name:""}),[c,u]=m("");M(async()=>e((await b("GET","/schedules")).schedules),5e3),x(()=>{b("GET","/agent").then(d=>{let h=d.agent?.crews?Object.keys(d.agent.crews):[d.agent?.name].filter(Boolean);r(h),a(o=>({...o,agent:d.agent?.default??h[0]??""}))}).catch(()=>{})},[]);let p=async d=>{d.preventDefault(),u("");try{await b("POST","/schedules",{...i,name:i.name||i.cron}),a(h=>({...h,cron:"",input:"",name:""}))}catch(h){u(String(h.message))}},_=async(d,h)=>{u("");try{h==="rm"?await b("DELETE",`/schedules/${d}`):await b("POST",`/schedules/${d}/${h}`)}catch(o){u(String(o.message))}};return t("div",{class:"page",children:[t("div",{class:"page-head",children:[t("div",{children:[t("div",{class:"overline",children:"SHT 04 \xB7 TIMETABLE"}),t("h1",{children:"Schedules"})]}),t("span",{class:"live-dot",children:[t("i",{}),"LIVE"]})]}),t("form",{class:"sched-form",onSubmit:p,children:[s.length>1&&t("div",{class:"agent-select",children:s.map(d=>t("button",{type:"button",class:`agent-opt${d===i.agent?" on":""}`,onClick:()=>a(h=>({...h,agent:d})),children:d},d))}),t("div",{class:"sched-row",children:[t("input",{placeholder:'cron: "0 9 * * *"',value:i.cron,onInput:d=>a(h=>({...h,cron:d.currentTarget.value}))}),t("input",{placeholder:'input: ["topic"]',value:i.input,onInput:d=>a(h=>({...h,input:d.currentTarget.value}))}),t("input",{placeholder:"name (optional)",value:i.name,onInput:d=>a(h=>({...h,name:d.currentTarget.value}))}),t("button",{class:"btn-primary",disabled:!i.cron.trim()||!i.input.trim(),children:"Schedule"})]})]}),c&&t("div",{class:"form-err",children:c}),n===null?t("div",{class:"empty",children:"Loading\u2026"}):n.length===0?t("div",{class:"empty",children:[t("b",{children:"Nothing scheduled."}),t("span",{children:"Cron-triggered runs fire from the workers: exactly once, crash-safe."})]}):t("table",{class:"sheet-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Name"}),t("th",{children:"Agent"}),t("th",{children:"Cron"}),t("th",{children:"Next fire"}),t("th",{children:"Last fired"}),t("th",{})]})}),t("tbody",{children:n.map(d=>t("tr",{class:d.enabled?"":"row-dead",children:[t("td",{children:d.name}),t("td",{children:d.agent}),t("td",{class:"mono",children:[d.cron," ",t("span",{class:"dim",children:d.tz})]}),t("td",{children:d.enabled?t("b",{class:"mono",children:me(d.nextFireAt)}):t("span",{class:"chip chip-cancelled",children:"paused"})}),t("td",{class:"dim",children:tt(d.lastFiredAt)}),t("td",{class:"sched-actions",children:[t("button",{class:"btn-ghost sm",onClick:()=>_(d.id,d.enabled?"pause":"resume"),children:d.enabled?"Pause":"Resume"}),t("button",{class:"btn-deny sm",onClick:()=>_(d.id,"rm"),children:"Delete"})]})]},d.id))})]})]})}function ye(){let[n,e]=m(null),[s,r]=m(""),[i,a]=m(null),[c,u]=m(""),p=async()=>e((await b("GET","/keys")).keys);x(()=>{p().catch(h=>u(String(h.message)))},[]);let _=async h=>{h.preventDefault(),u("");try{let{key:o}=await b("POST","/keys",{name:s});a(o),r(""),await p()}catch(o){u(String(o.message))}},d=async h=>{u("");try{await b("DELETE",`/keys/${h}`),await p()}catch(o){u(String(o.message))}};return t("div",{class:"page",children:[t("div",{class:"page-head",children:t("div",{children:[t("div",{class:"overline",children:"SHT 02 \xB7 ACCESS"}),t("h1",{children:"API keys"})]})}),t("form",{class:"key-form",onSubmit:_,children:[t("input",{placeholder:"key name, e.g. ci-pipeline",value:s,onInput:h=>r(h.currentTarget.value)}),t("button",{class:"btn-primary",disabled:!s.trim(),children:"Issue key"})]}),i&&t("div",{class:"minted",children:[t("div",{class:"overline signal",children:"SECRET \xB7 SHOWN ONCE, STORE IT NOW"}),t("div",{class:"minted-row",children:[t("code",{children:i.secret}),t("button",{class:"btn-ghost",onClick:()=>ft(i.secret),children:"Copy"}),t("button",{class:"btn-ghost",onClick:()=>a(null),children:"Dismiss"})]})]}),c&&t("div",{class:"form-err",children:c}),n&&t("table",{class:"sheet-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Key"}),t("th",{children:"Name"}),t("th",{children:"Last used"}),t("th",{children:"Status"}),t("th",{})]})}),t("tbody",{children:n.map(h=>t("tr",{class:h.revokedAt?"row-dead":"",children:[t("td",{class:"mono",children:[h.prefix,"\u2026"]}),t("td",{children:h.name}),t("td",{class:"dim",children:tt(h.lastUsedAt)}),t("td",{children:h.revokedAt?t("span",{class:"chip chip-failed",children:"revoked"}):t("span",{class:"chip chip-completed",children:"active"})}),t("td",{children:!h.revokedAt&&t("button",{class:"btn-deny sm",onClick:()=>d(h.id),children:"Revoke"})})]},h.id))})]})]})}function be(){let[n,e]=m(()=>{let _=location.hash.match(/#token=(.+)$/);return _&&(Vt(decodeURIComponent(_[1])),history.replaceState(null,"",location.pathname+"#/runs")),!!ht()}),[s,r]=m(location.hash||"#/runs"),[i,a]=m(!1);x(()=>{let _=()=>r(location.hash||"#/runs");return addEventListener("hashchange",_),()=>removeEventListener("hashchange",_)},[]),x(()=>{n&&b("GET","/keys").then(()=>a(!0)).catch(_=>a((_.status!==403,!1)))},[n]);let c=_=>{location.hash=_};if(!n)return t(ie,{onIn:()=>{e(!0),c("#/runs")}});let u=s.match(/^#\/runs\/(.+)$/),p=s.match(/^#\/sessions\/(.+)$/);return t("div",{class:"shell",children:[t("header",{class:"topbar",children:[t("a",{class:"brand",href:"#/runs",children:[t(qt,{})," ",t("b",{children:"TOREN"})," ",t("span",{class:"dwg",children:"CONSOLE \xB7 DWG \u2116 TRN-003"})]}),t("nav",{children:[t("a",{class:s.startsWith("#/runs")?"on":"",href:"#/runs",children:"Runs"}),t("a",{class:s.startsWith("#/sessions")?"on":"",href:"#/sessions",children:"Sessions"}),t("a",{class:s==="#/agent"?"on":"",href:"#/agent",children:"Agent"}),i&&t("a",{class:s==="#/schedules"?"on":"",href:"#/schedules",children:"Schedules"}),i&&t("a",{class:s==="#/keys"?"on":"",href:"#/keys",children:"API keys"})]}),t("div",{class:"topbar-right",children:[t("span",{class:"role",children:i?"ADMIN":"KEY"}),t("button",{class:"btn-ghost sm",onClick:()=>{Bt(),location.reload()},children:"Sign out"})]})]}),p?t(ve,{runId:p[1]}):s.startsWith("#/sessions")?t(he,{nav:c}):u?t(de,{runId:u[1],isAdmin:i}):s==="#/agent"?t(pe,{}):s==="#/schedules"&&i?t(ge,{}):s==="#/keys"&&i?t(ye,{}):t(le,{nav:c}),t("footer",{class:"foot",children:"TOREN CONSOLE \xB7 single deployment \xB7 credentials never leave this browser"})]})}Pt(t(be,{}),document.getElementById("root"));
|
package/package.json
CHANGED