jfl 0.7.2 → 0.8.0
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/commands/context-hub.d.ts.map +1 -1
- package/dist/commands/context-hub.js +26 -0
- package/dist/commands/context-hub.js.map +1 -1
- package/dist/commands/migrate-tenet.d.ts +25 -0
- package/dist/commands/migrate-tenet.d.ts.map +1 -0
- package/dist/commands/migrate-tenet.js +252 -0
- package/dist/commands/migrate-tenet.js.map +1 -0
- package/dist/commands/peter.d.ts.map +1 -1
- package/dist/commands/peter.js +47 -5
- package/dist/commands/peter.js.map +1 -1
- package/dist/commands/pi.d.ts +1 -0
- package/dist/commands/pi.d.ts.map +1 -1
- package/dist/commands/pi.js +5 -1
- package/dist/commands/pi.js.map +1 -1
- package/dist/commands/pivot.d.ts +28 -0
- package/dist/commands/pivot.d.ts.map +1 -0
- package/dist/commands/pivot.js +219 -0
- package/dist/commands/pivot.js.map +1 -0
- package/dist/commands/services-create.js +348 -0
- package/dist/commands/services-create.js.map +1 -1
- package/dist/dashboard-static/assets/index-BVrmW-ZI.js +154 -0
- package/dist/dashboard-static/assets/{index-CW8oWAdr.css → index-DtruPD44.css} +1 -1
- package/dist/dashboard-static/index.html +2 -2
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-generator.d.ts.map +1 -1
- package/dist/lib/agent-generator.js +15 -0
- package/dist/lib/agent-generator.js.map +1 -1
- package/dist/lib/counterfactual-engine.d.ts +136 -0
- package/dist/lib/counterfactual-engine.d.ts.map +1 -0
- package/dist/lib/counterfactual-engine.js +417 -0
- package/dist/lib/counterfactual-engine.js.map +1 -0
- package/dist/lib/dynamics-model.d.ts +107 -0
- package/dist/lib/dynamics-model.d.ts.map +1 -0
- package/dist/lib/dynamics-model.js +363 -0
- package/dist/lib/dynamics-model.js.map +1 -0
- package/dist/lib/eval-snapshot.d.ts.map +1 -1
- package/dist/lib/eval-snapshot.js +15 -4
- package/dist/lib/eval-snapshot.js.map +1 -1
- package/dist/lib/invariant-monitor.d.ts +50 -0
- package/dist/lib/invariant-monitor.d.ts.map +1 -0
- package/dist/lib/invariant-monitor.js +400 -0
- package/dist/lib/invariant-monitor.js.map +1 -0
- package/dist/lib/meta-orchestrator.d.ts +40 -3
- package/dist/lib/meta-orchestrator.d.ts.map +1 -1
- package/dist/lib/meta-orchestrator.js +181 -2
- package/dist/lib/meta-orchestrator.js.map +1 -1
- package/dist/lib/openclaw-sdk.d.ts +8 -0
- package/dist/lib/openclaw-sdk.d.ts.map +1 -1
- package/dist/lib/openclaw-sdk.js +11 -0
- package/dist/lib/openclaw-sdk.js.map +1 -1
- package/dist/lib/peter-parker-bridge.d.ts +37 -1
- package/dist/lib/peter-parker-bridge.d.ts.map +1 -1
- package/dist/lib/peter-parker-bridge.js +201 -1
- package/dist/lib/peter-parker-bridge.js.map +1 -1
- package/dist/lib/service-detector.d.ts +1 -1
- package/dist/lib/service-detector.d.ts.map +1 -1
- package/dist/lib/service-detector.js +26 -6
- package/dist/lib/service-detector.js.map +1 -1
- package/dist/lib/service-gtm.d.ts +1 -1
- package/dist/lib/service-gtm.d.ts.map +1 -1
- package/dist/lib/state-capture.d.ts +36 -0
- package/dist/lib/state-capture.d.ts.map +1 -0
- package/dist/lib/state-capture.js +541 -0
- package/dist/lib/state-capture.js.map +1 -0
- package/dist/lib/stratus-client.d.ts +78 -2
- package/dist/lib/stratus-client.d.ts.map +1 -1
- package/dist/lib/stratus-client.js +432 -1
- package/dist/lib/stratus-client.js.map +1 -1
- package/dist/lib/world-model-store.d.ts +172 -0
- package/dist/lib/world-model-store.d.ts.map +1 -0
- package/dist/lib/world-model-store.js +487 -0
- package/dist/lib/world-model-store.js.map +1 -0
- package/dist/types/world-model.d.ts +478 -0
- package/dist/types/world-model.d.ts.map +1 -0
- package/dist/types/world-model.js +80 -0
- package/dist/types/world-model.js.map +1 -0
- package/dist/utils/jfl-config.d.ts +5 -0
- package/dist/utils/jfl-config.d.ts.map +1 -1
- package/dist/utils/jfl-config.js +13 -1
- package/dist/utils/jfl-config.js.map +1 -1
- package/package.json +1 -1
- package/packages/pi/extensions/hud-tool.ts +2 -24
- package/packages/pi/extensions/index.ts +48 -25
- package/packages/pi/extensions/onboarding-v1.ts +455 -0
- package/packages/pi/extensions/onboarding-v2.ts +516 -0
- package/packages/pi/extensions/onboarding-v3.ts +675 -0
- package/packages/pi/extensions/pivot-tool.ts +59 -0
- package/packages/pi/extensions/session.ts +58 -0
- package/packages/pi/extensions/types.ts +2 -0
- package/packages/pi/skills/pivot/SKILL.md +91 -0
- package/template/.claude/settings.json +9 -0
- package/dist/dashboard-static/assets/index-Ck8f9dcM.js +0 -121
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var rt,z,er,Se,St,tr,rr,nr,bt,pt,ht,Ke={},Qe=[],Tr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Le=Array.isArray;function _e(t,r){for(var n in r)t[n]=r[n];return t}function yt(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function ft(t,r,n){var s,o,i,l={};for(i in r)i=="key"?s=r[i]:i=="ref"?o=r[i]:l[i]=r[i];if(arguments.length>2&&(l.children=arguments.length>3?rt.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)l[i]===void 0&&(l[i]=t.defaultProps[i]);return Ve(t,l,s,o,null)}function Ve(t,r,n,s,o){var i={type:t,props:r,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++er,__i:-1,__u:0};return o==null&&z.vnode!=null&&z.vnode(i),i}function ie(t){return t.children}function we(t,r){this.props=t,this.context=r}function Re(t,r){if(r==null)return t.__?Re(t.__,t.__i+1):null;for(var n;r<t.__k.length;r++)if((n=t.__k[r])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?Re(t):null}function Rr(t){if(t.__P&&t.__d){var r=t.__v,n=r.__e,s=[],o=[],i=_e({},r);i.__v=r.__v+1,z.vnode&&z.vnode(i),_t(t.__P,i,r,t.__n,t.__P.namespaceURI,32&r.__u?[n]:null,s,n??Re(r),!!(32&r.__u),o),i.__v=r.__v,i.__.__k[i.__i]=i,lr(s,i,o),r.__e=r.__=null,i.__e!=n&&sr(i)}}function sr(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(r){if(r!=null&&r.__e!=null)return t.__e=t.__c.base=r.__e}),sr(t)}function Ct(t){(!t.__d&&(t.__d=!0)&&Se.push(t)&&!Ze.__r++||St!=z.debounceRendering)&&((St=z.debounceRendering)||tr)(Ze)}function Ze(){for(var t,r=1;Se.length;)Se.length>r&&Se.sort(rr),t=Se.shift(),r=Se.length,Rr(t);Ze.__r=0}function or(t,r,n,s,o,i,l,a,h,p,v){var c,b,y,x,T,_,$,w=s&&s.__k||Qe,P=r.length;for(h=Er(n,r,w,h,P),c=0;c<P;c++)(y=n.__k[c])!=null&&(b=y.__i!=-1&&w[y.__i]||Ke,y.__i=c,_=_t(t,y,b,o,i,l,a,h,p,v),x=y.__e,y.ref&&b.ref!=y.ref&&(b.ref&&wt(b.ref,null,y),v.push(y.ref,y.__c||x,y)),T==null&&x!=null&&(T=x),($=!!(4&y.__u))||b.__k===y.__k?h=ir(y,h,t,$):typeof y.type=="function"&&_!==void 0?h=_:x&&(h=x.nextSibling),y.__u&=-7);return n.__e=T,h}function Er(t,r,n,s,o){var i,l,a,h,p,v=n.length,c=v,b=0;for(t.__k=new Array(o),i=0;i<o;i++)(l=r[i])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=t.__k[i]=Ve(null,l,null,null,null):Le(l)?l=t.__k[i]=Ve(ie,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=t.__k[i]=Ve(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):t.__k[i]=l,h=i+b,l.__=t,l.__b=t.__b+1,a=null,(p=l.__i=$r(l,n,h,c))!=-1&&(c--,(a=n[p])&&(a.__u|=2)),a==null||a.__v==null?(p==-1&&(o>v?b--:o<v&&b++),typeof l.type!="function"&&(l.__u|=4)):p!=h&&(p==h-1?b--:p==h+1?b++:(p>h?b--:b++,l.__u|=4))):t.__k[i]=null;if(c)for(i=0;i<v;i++)(a=n[i])!=null&&(2&a.__u)==0&&(a.__e==s&&(s=Re(a)),cr(a,a));return s}function ir(t,r,n,s){var o,i;if(typeof t.type=="function"){for(o=t.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=t,r=ir(o[i],r,n,s));return r}t.__e!=r&&(s&&(r&&t.type&&!r.parentNode&&(r=Re(t)),n.insertBefore(t.__e,r||null)),r=t.__e);do r=r&&r.nextSibling;while(r!=null&&r.nodeType==8);return r}function et(t,r){return r=r||[],t==null||typeof t=="boolean"||(Le(t)?t.some(function(n){et(n,r)}):r.push(t)),r}function $r(t,r,n,s){var o,i,l,a=t.key,h=t.type,p=r[n],v=p!=null&&(2&p.__u)==0;if(p===null&&a==null||v&&a==p.key&&h==p.type)return n;if(s>(v?1:0)){for(o=n-1,i=n+1;o>=0||i<r.length;)if((p=r[l=o>=0?o--:i++])!=null&&(2&p.__u)==0&&a==p.key&&h==p.type)return l}return-1}function Mt(t,r,n){r[0]=="-"?t.setProperty(r,n??""):t[r]=n==null?"":typeof n!="number"||Tr.test(r)?n:n+"px"}function Ge(t,r,n,s,o){var i,l;e:if(r=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof s=="string"&&(t.style.cssText=s=""),s)for(r in s)n&&r in n||Mt(t.style,r,"");if(n)for(r in n)s&&n[r]==s[r]||Mt(t.style,r,n[r])}else if(r[0]=="o"&&r[1]=="n")i=r!=(r=r.replace(nr,"$1")),l=r.toLowerCase(),r=l in t||r=="onFocusOut"||r=="onFocusIn"?l.slice(2):r.slice(2),t.l||(t.l={}),t.l[r+i]=n,n?s?n.u=s.u:(n.u=bt,t.addEventListener(r,i?ht:pt,i)):t.removeEventListener(r,i?ht:pt,i);else{if(o=="http://www.w3.org/2000/svg")r=r.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(r!="width"&&r!="height"&&r!="href"&&r!="list"&&r!="form"&&r!="tabIndex"&&r!="download"&&r!="rowSpan"&&r!="colSpan"&&r!="role"&&r!="popover"&&r in t)try{t[r]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&r[4]!="-"?t.removeAttribute(r):t.setAttribute(r,r=="popover"&&n==1?"":n))}}function Tt(t){return function(r){if(this.l){var n=this.l[r.type+t];if(r.t==null)r.t=bt++;else if(r.t<n.u)return;return n(z.event?z.event(r):r)}}}function _t(t,r,n,s,o,i,l,a,h,p){var v,c,b,y,x,T,_,$,w,P,S,f,g,A,u,C=r.type;if(r.constructor!==void 0)return null;128&n.__u&&(h=!!(32&n.__u),i=[a=r.__e=n.__e]),(v=z.__b)&&v(r);e:if(typeof C=="function")try{if($=r.props,w="prototype"in C&&C.prototype.render,P=(v=C.contextType)&&s[v.__c],S=v?P?P.props.value:v.__:s,n.__c?_=(c=r.__c=n.__c).__=c.__E:(w?r.__c=c=new C($,S):(r.__c=c=new we($,S),c.constructor=C,c.render=Dr),P&&P.sub(c),c.state||(c.state={}),c.__n=s,b=c.__d=!0,c.__h=[],c._sb=[]),w&&c.__s==null&&(c.__s=c.state),w&&C.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=_e({},c.__s)),_e(c.__s,C.getDerivedStateFromProps($,c.__s))),y=c.props,x=c.state,c.__v=r,b)w&&C.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),w&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(w&&C.getDerivedStateFromProps==null&&$!==y&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps($,S),r.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate($,c.__s,S)===!1){r.__v!=n.__v&&(c.props=$,c.state=c.__s,c.__d=!1),r.__e=n.__e,r.__k=n.__k,r.__k.some(function(M){M&&(M.__=r)}),Qe.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&l.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate($,c.__s,S),w&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(y,x,T)})}if(c.context=S,c.props=$,c.__P=t,c.__e=!1,f=z.__r,g=0,w)c.state=c.__s,c.__d=!1,f&&f(r),v=c.render(c.props,c.state,c.context),Qe.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,f&&f(r),v=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++g<25);c.state=c.__s,c.getChildContext!=null&&(s=_e(_e({},s),c.getChildContext())),w&&!b&&c.getSnapshotBeforeUpdate!=null&&(T=c.getSnapshotBeforeUpdate(y,x)),A=v!=null&&v.type===ie&&v.key==null?ar(v.props.children):v,a=or(t,Le(A)?A:[A],r,n,s,o,i,l,a,h,p),c.base=r.__e,r.__u&=-161,c.__h.length&&l.push(c),_&&(c.__E=c.__=null)}catch(M){if(r.__v=null,h||i!=null)if(M.then){for(r.__u|=h?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,r.__e=a}else{for(u=i.length;u--;)yt(i[u]);gt(r)}else r.__e=n.__e,r.__k=n.__k,M.then||gt(r);z.__e(M,r,n)}else i==null&&r.__v==n.__v?(r.__k=n.__k,r.__e=n.__e):a=r.__e=Fr(n.__e,r,n,s,o,i,l,h,p);return(v=z.diffed)&&v(r),128&r.__u?void 0:a}function gt(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(gt))}function lr(t,r,n){for(var s=0;s<n.length;s++)wt(n[s],n[++s],n[++s]);z.__c&&z.__c(r,t),t.some(function(o){try{t=o.__h,o.__h=[],t.some(function(i){i.call(o)})}catch(i){z.__e(i,o.__v)}})}function ar(t){return typeof t!="object"||t==null||t.__b>0?t:Le(t)?t.map(ar):_e({},t)}function Fr(t,r,n,s,o,i,l,a,h){var p,v,c,b,y,x,T,_=n.props||Ke,$=r.props,w=r.type;if(w=="svg"?o="http://www.w3.org/2000/svg":w=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(p=0;p<i.length;p++)if((y=i[p])&&"setAttribute"in y==!!w&&(w?y.localName==w:y.nodeType==3)){t=y,i[p]=null;break}}if(t==null){if(w==null)return document.createTextNode($);t=document.createElementNS(o,w,$.is&&$),a&&(z.__m&&z.__m(r,i),a=!1),i=null}if(w==null)_===$||a&&t.data==$||(t.data=$);else{if(i=i&&rt.call(t.childNodes),!a&&i!=null)for(_={},p=0;p<t.attributes.length;p++)_[(y=t.attributes[p]).name]=y.value;for(p in _)y=_[p],p=="dangerouslySetInnerHTML"?c=y:p=="children"||p in $||p=="value"&&"defaultValue"in $||p=="checked"&&"defaultChecked"in $||Ge(t,p,null,y,o);for(p in $)y=$[p],p=="children"?b=y:p=="dangerouslySetInnerHTML"?v=y:p=="value"?x=y:p=="checked"?T=y:a&&typeof y!="function"||_[p]===y||Ge(t,p,y,_[p],o);if(v)a||c&&(v.__html==c.__html||v.__html==t.innerHTML)||(t.innerHTML=v.__html),r.__k=[];else if(c&&(t.innerHTML=""),or(r.type=="template"?t.content:t,Le(b)?b:[b],r,n,s,w=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,l,i?i[0]:n.__k&&Re(n,0),a,h),i!=null)for(p=i.length;p--;)yt(i[p]);a||(p="value",w=="progress"&&x==null?t.removeAttribute("value"):x!=null&&(x!==t[p]||w=="progress"&&!x||w=="option"&&x!=_[p])&&Ge(t,p,x,_[p],o),p="checked",T!=null&&T!=t[p]&&Ge(t,p,T,_[p],o))}return t}function wt(t,r,n){try{if(typeof t=="function"){var s=typeof t.__u=="function";s&&t.__u(),s&&r==null||(t.__u=t(r))}else t.current=r}catch(o){z.__e(o,n)}}function cr(t,r,n){var s,o;if(z.unmount&&z.unmount(t),(s=t.ref)&&(s.current&&s.current!=t.__e||wt(s,null,r)),(s=t.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(i){z.__e(i,r)}s.base=s.__P=null}if(s=t.__k)for(o=0;o<s.length;o++)s[o]&&cr(s[o],r,n||typeof t.type!="function");n||yt(t.__e),t.__c=t.__=t.__e=void 0}function Dr(t,r,n){return this.constructor(t,n)}function Pr(t,r,n){var s,o,i,l;r==document&&(r=document.documentElement),z.__&&z.__(t,r),o=(s=!1)?null:r.__k,i=[],l=[],_t(r,t=r.__k=ft(ie,null,[t]),o||Ke,Ke,r.namespaceURI,o?null:r.firstChild?rt.call(r.childNodes):null,i,o?o.__e:r.firstChild,s,l),lr(i,t,l)}rt=Qe.slice,z={__e:function(t,r,n,s){for(var o,i,l;r=r.__;)if((o=r.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(t)),l=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t,s||{}),l=o.__d),l)return o.__E=o}catch(a){t=a}throw t}},er=0,we.prototype.setState=function(t,r){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=_e({},this.state),typeof t=="function"&&(t=t(_e({},n),this.props)),t&&_e(n,t),t!=null&&this.__v&&(r&&this._sb.push(r),Ct(this))},we.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Ct(this))},we.prototype.render=ie,Se=[],tr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,rr=function(t,r){return t.__v.__b-r.__v.__b},Ze.__r=0,nr=/(PointerCapture)$|Capture$/i,bt=0,pt=Tt(!1),ht=Tt(!0);var Ar=0;function e(t,r,n,s,o,i){r||(r={});var l,a,h=r;if("ref"in h)for(a in h={},r)a=="ref"?l=r[a]:h[a]=r[a];var p={type:t,props:h,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ar,__i:-1,__u:0,__source:o,__self:i};if(typeof t=="function"&&(l=t.defaultProps))for(a in l)h[a]===void 0&&(h[a]=l[a]);return z.vnode&&z.vnode(p),p}var Ae,ne,st,Rt,Ie=0,dr=[],oe=z,Et=oe.__b,$t=oe.__r,Ft=oe.diffed,Dt=oe.__c,Pt=oe.unmount,At=oe.__;function kt(t,r){oe.__h&&oe.__h(ne,t,Ie||r),Ie=0;var n=ne.__H||(ne.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function j(t){return Ie=1,Ir(pr,t)}function Ir(t,r,n){var s=kt(Ae++,2);if(s.t=t,!s.__c&&(s.__=[n?n(r):pr(void 0,r),function(a){var h=s.__N?s.__N[0]:s.__[0],p=s.t(h,a);h!==p&&(s.__N=[p,s.__[1]],s.__c.setState({}))}],s.__c=ne,!ne.__f)){var o=function(a,h,p){if(!s.__c.__H)return!0;var v=s.__c.__H.__.filter(function(b){return b.__c});if(v.every(function(b){return!b.__N}))return!i||i.call(this,a,h,p);var c=s.__c.props!==a;return v.some(function(b){if(b.__N){var y=b.__[0];b.__=b.__N,b.__N=void 0,y!==b.__[0]&&(c=!0)}}),i&&i.call(this,a,h,p)||c};ne.__f=!0;var i=ne.shouldComponentUpdate,l=ne.componentWillUpdate;ne.componentWillUpdate=function(a,h,p){if(this.__e){var v=i;i=void 0,o(a,h,p),i=v}l&&l.call(this,a,h,p)},ne.shouldComponentUpdate=o}return s.__N||s.__}function ve(t,r){var n=kt(Ae++,3);!oe.__s&&ur(n.__H,r)&&(n.__=t,n.u=r,ne.__H.__h.push(n))}function me(t){return Ie=5,Ee(function(){return{current:t}},[])}function Ee(t,r){var n=kt(Ae++,7);return ur(n.__H,r)&&(n.__=t(),n.__H=r,n.__h=t),n.__}function $e(t,r){return Ie=8,Ee(function(){return t},r)}function jr(){for(var t;t=dr.shift();){var r=t.__H;if(t.__P&&r)try{r.__h.some(Je),r.__h.some(mt),r.__h=[]}catch(n){r.__h=[],oe.__e(n,t.__v)}}}oe.__b=function(t){ne=null,Et&&Et(t)},oe.__=function(t,r){t&&r.__k&&r.__k.__m&&(t.__m=r.__k.__m),At&&At(t,r)},oe.__r=function(t){$t&&$t(t),Ae=0;var r=(ne=t.__c).__H;r&&(st===ne?(r.__h=[],ne.__h=[],r.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(r.__h.some(Je),r.__h.some(mt),r.__h=[],Ae=0)),st=ne},oe.diffed=function(t){Ft&&Ft(t);var r=t.__c;r&&r.__H&&(r.__H.__h.length&&(dr.push(r)!==1&&Rt===oe.requestAnimationFrame||((Rt=oe.requestAnimationFrame)||Lr)(jr)),r.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),st=ne=null},oe.__c=function(t,r){r.some(function(n){try{n.__h.some(Je),n.__h=n.__h.filter(function(s){return!s.__||mt(s)})}catch(s){r.some(function(o){o.__h&&(o.__h=[])}),r=[],oe.__e(s,n.__v)}}),Dt&&Dt(t,r)},oe.unmount=function(t){Pt&&Pt(t);var r,n=t.__c;n&&n.__H&&(n.__H.__.some(function(s){try{Je(s)}catch(o){r=o}}),n.__H=void 0,r&&oe.__e(r,n.__v))};var It=typeof requestAnimationFrame=="function";function Lr(t){var r,n=function(){clearTimeout(s),It&&cancelAnimationFrame(r),setTimeout(t)},s=setTimeout(n,35);It&&(r=requestAnimationFrame(n))}function Je(t){var r=ne,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),ne=r}function mt(t){var r=ne;t.__c=t.__(),ne=r}function ur(t,r){return!t||t.length!==r.length||r.some(function(n,s){return n!==t[s]})}function pr(t,r){return typeof r=="function"?r(t):r}const Gr=()=>{const r=new URLSearchParams(window.location.search).get("token");if(r){localStorage.setItem("jfl-token",r);const n=new URL(window.location.href);return n.searchParams.delete("token"),window.history.replaceState({},"",n.toString()),r}return localStorage.getItem("jfl-token")||""};let ot=null;function je(){return ot||(ot=Gr()),ot}async function Y(t,r={}){const n={"Content-Type":"application/json",...je()?{Authorization:`Bearer ${je()}`}:{},...r.headers||{}},s=await fetch(t,{...r,headers:n});if(s.status===401)throw new Error("Unauthorized");if(!s.ok)throw new Error(`API error: ${s.status}`);return s.json()}function hr(t,r,n){const s=`${t}${t.includes("?")?"&":"?"}token=${je()}`,o=new EventSource(s);return o.onmessage=i=>{try{r(JSON.parse(i.data))}catch{}},o.onerror=i=>n==null?void 0:n(i),()=>o.close()}async function Or(t,r,n,s,o,i){var c;const l={"Content-Type":"application/json",...je()?{Authorization:`Bearer ${je()}`}:{}},a=await fetch("/api/chat",{method:"POST",headers:l,body:JSON.stringify({message:t,history:r})});if(!a.ok){i(`API error: ${a.status}`);return}const h=(c=a.body)==null?void 0:c.getReader();if(!h){i("No response body");return}const p=new TextDecoder;let v="";for(;;){const{done:b,value:y}=await h.read();if(b)break;v+=p.decode(y,{stream:!0});const x=v.split(`
|
|
2
|
-
`);v=x.pop()||"";for(const T of x){if(!T.startsWith("data: "))continue;const _=T.slice(6);if(_==="[DONE]"){o();return}try{const $=JSON.parse(_);$.sources&&n($.sources),$.delta&&s($.delta)}catch{}}}o()}const N={status:()=>Y("/api/context/status"),events:(t=50,r)=>{let n=`/api/events?limit=${t}`;return r&&(n+=`&pattern=${encodeURIComponent(r)}`),Y(n)},leaderboard:()=>Y("/api/eval/leaderboard"),trajectory:(t,r="composite")=>Y(`/api/eval/trajectory?agent=${encodeURIComponent(t)}&metric=${r}`),journal:()=>Y("/api/context",{method:"POST",body:JSON.stringify({})}).then(t=>t.items||[]),search:t=>Y(`/api/context/search?q=${encodeURIComponent(t)}`),services:()=>Y("/api/services"),projects:()=>Y("/api/projects"),flows:()=>Y("/api/flows"),flowExecutions:()=>Y("/api/flows/executions"),approveFlow:(t,r)=>Y(`/api/flows/${encodeURIComponent(t)}/approve`,{method:"POST",body:JSON.stringify({trigger_event_id:r})}),memoryStatus:()=>Y("/api/memory/status"),memorySearch:(t,r)=>{const n={query:t};return r&&r!=="all"&&(n.type=r),Y("/api/memory/search",{method:"POST",body:JSON.stringify(n)})},publishEvent:(t,r,n="dashboard")=>Y("/api/events",{method:"POST",body:JSON.stringify({type:t,source:n,data:r})}),toggleFlow:(t,r)=>Y(`/api/flows/${encodeURIComponent(t)}/toggle`,{method:"POST",body:JSON.stringify({enabled:r})}),spawnAction:(t,r,n)=>Y("/api/actions/spawn",{method:"POST",body:JSON.stringify({command:t,args:r,event_type:n})}),predictions:()=>Y("/api/eval/predictions"),synopsis:(t=24)=>Y(`/api/synopsis?hours=${t}`),telemetryDigest:(t=168)=>Y(`/api/telemetry/digest?hours=${t}`),telemetryAgentStatus:()=>Y("/api/telemetry/agent"),telemetryAgentRun:()=>Y("/api/telemetry/agent/run",{method:"POST"}),childSynopsis:async(t,r=24)=>{try{const n=await fetch(`http://localhost:${t}/api/synopsis?hours=${r}`);return n.ok?n.json():null}catch{return null}},topology:()=>Y("/api/v1/topology"),autoresearchStatus:()=>Y("/api/v1/autoresearch/status"),evalEntries:(t=100)=>Y(`/api/eval/entries?limit=${t}`),rlAgents:()=>Y("/api/v1/agents"),rlExperiments:t=>Y(t?`/api/v1/experiments?agent=${t}`:"/api/v1/experiments"),rlSessions:()=>Y("/api/v1/sessions"),productContext:()=>Y("/api/v1/product-context"),findings:(t=!1,r=!1)=>{const n=new URLSearchParams;t&&n.set("refresh","true"),r&&n.set("include_dismissed","true");const s=n.toString();return Y(`/api/v1/findings${s?`?${s}`:""}`)},dismissFinding:t=>Y(`/api/v1/findings/${encodeURIComponent(t)}/dismiss`,{method:"POST"}),spawnFindingAgent:t=>Y(`/api/v1/findings/${encodeURIComponent(t)}/spawn`,{method:"POST"}),analyzeFindings:()=>Y("/api/v1/findings/analyze",{method:"POST"}),setupReport:()=>Y("/api/setup-report")};function xe({label:t,value:r,sub:n,trend:s,icon:o}){return e("div",{class:"bg-card rounded-lg border border-border p-4 animate-fade-in",children:[e("div",{class:"flex items-center justify-between mb-2",children:[e("span",{class:"text-xs text-muted-foreground uppercase tracking-wider",children:t}),o&&e("span",{class:"text-muted-foreground",children:o})]}),e("div",{class:"text-2xl font-semibold mono",children:r}),n&&e("div",{class:`text-xs mt-1 ${s==="up"?"text-success":s==="down"?"text-destructive":"text-muted-foreground"}`,children:n})]})}function tt({data:t,width:r=120,height:n=32,color:s="var(--success)",className:o=""}){if(!t.length)return null;const i=Math.min(...t),a=Math.max(...t)-i||1,h=2,p=t.map((v,c)=>{const b=h+c/(t.length-1||1)*(r-h*2),y=n-h-(v-i)/a*(n-h*2);return`${b},${y}`}).join(" ");return e("svg",{width:r,height:n,class:o,viewBox:`0 0 ${r} ${n}`,children:[e("polyline",{points:p,fill:"none",stroke:s,"stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),e("circle",{cx:parseFloat(p.split(" ").pop().split(",")[0]),cy:parseFloat(p.split(" ").pop().split(",")[1]),r:"2.5",fill:s})]})}function K(t,r,n=[]){const[s,o]=j(null),[i,l]=j(!0),[a,h]=j(null),p=me(),v=$e(()=>{t().then(c=>{o(c),h(null),l(!1)}).catch(c=>{h(c.message),l(!1)})},n);return ve(()=>(v(),p.current=setInterval(v,r),()=>clearInterval(p.current)),[v,r]),{data:s,loading:i,error:a,refetch:v}}function fr(t,r){const[n,s]=j(!1);return ve(()=>{const o=localStorage.getItem("jfl-token")||"",i=`${t}${t.includes("?")?"&":"?"}token=${o}`,l=new EventSource(i);return l.onopen=()=>s(!0),l.onmessage=a=>{try{r(JSON.parse(a.data))}catch{}},l.onerror=()=>s(!1),()=>l.close()},[t]),{connected:n}}function D(...t){return t.filter(Boolean).join(" ")}function le(t){const r=Date.now()-new Date(t).getTime(),n=Math.floor(r/1e3);if(n<60)return`${n}s ago`;const s=Math.floor(n/60);if(s<60)return`${s}m ago`;const o=Math.floor(s/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}const Br={ok:"bg-success",active:"bg-success",error:"bg-destructive",down:"bg-destructive",warning:"bg-warning",idle:"bg-muted-foreground"};function gr({status:t,label:r,pulse:n=!0}){return e("span",{class:"inline-flex items-center gap-1.5",children:[e("span",{class:D("inline-block w-2 h-2 rounded-full",Br[t]||"bg-muted-foreground",n&&(t==="ok"||t==="active")&&"animate-pulse-dot")}),r&&e("span",{class:"text-xs text-muted-foreground",children:r})]})}const ee={card:"rgba(24, 24, 28, 0.95)",border:"rgba(60, 60, 60, 0.25)",text:"#f5f5f5",textMuted:"#8b8b8b",textDim:"#5a5a5a",data:"#4a7dfc",rl:"#a855f7",success:"#34d399",alert:"#f87171",orange:"#FF5722"};function jt(t){return t.includes("error")||t.includes("fail")||t.includes("crash")||t.includes("regression")?"alert":t.includes("scored")||t.includes("success")||t.includes("complete")||t.includes("pass")?"success":t.includes("peter")||t.includes("rollout")||t.includes("experiment")||t.includes("rl:")?"rl":"data"}function it(t){switch(t){case"alert":return ee.alert;case"success":return ee.success;case"rl":return ee.rl;default:return ee.data}}function Nr(t){return!(t.type.startsWith("session:")||t.type.startsWith("hook:")||t.type==="heartbeat")}function zr(t){const r=t.source||"unknown";let n="system";const s=t.type.toLowerCase();return s.includes("eval:")||s.includes(":scored")?n=r.includes("eval")?"peter-parker":"eval-engine":s.includes("telemetry:")?n="peter-parker":s.includes("peter:")?s.includes("rollout")?n="stratus":s.includes("task")?n="eval-engine":n="agents":s.includes("stratus:")?n="eval-engine":s.includes("flow:")&&(n="flow-engine"),{source:r,destination:n}}function Ur(t){const r=t.data||{};if(t.type==="eval:scored"){const n=r.agent||"agent",s=typeof r.composite=="number"?r.composite.toFixed(4):"—",o=typeof r.delta=="number"?r.delta>=0?`+${r.delta.toFixed(4)}`:r.delta.toFixed(4):null;return o?`${n} scored ${s} (${o})`:`${n} scored ${s}`}return t.type.includes("task-completed")?r.description||r.title||"Task completed":t.type.includes("insight")?r.summary||r.insight||"Insight generated":t.type.includes("flow:triggered")?`Flow "${r.flow||r.name||"flow"}" triggered`:t.type.includes("rollout")?r.description||"Rollout initiated":t.type.includes("regression")?r.message||"Regression detected":r.title||r.message||r.description||t.type.split(":").pop()||t.type}function Xr({events:t,windowMs:r=6e4,buckets:n=12}){const s=Date.now(),o=r/n,i=Array(n).fill(0);for(const v of t){const c=s-new Date(v.ts).getTime();if(c<r){const b=Math.floor(c/o);b<n&&i[n-1-b]++}}const l=Math.max(...i,1),a=80,h=20,p=a/n-1;return e("svg",{width:a,height:h,class:"shrink-0",children:[i.map((v,c)=>{const b=v/l*(h-4),y=c*(p+1),x=h-b-2;return e("rect",{x:y,y:x,width:p,height:b,fill:ee.orange,opacity:.3+v/l*.7,rx:"1"},c)}),e("rect",{x:(n-1)*(p+1),y:h-i[n-1]/l*(h-4)-2,width:p,height:i[n-1]/l*(h-4),fill:ee.orange,rx:"1",children:e("animate",{attributeName:"opacity",values:"1;0.5;1",dur:"1s",repeatCount:"indefinite"})})]})}function Hr({events:t,maxEvents:r=50,useSSE:n=!0,collapsed:s,onToggleCollapse:o,className:i}){const[l,a]=j([]),[h,p]=j(!1),[v,c]=j(!1),b=me(null),y=me(!0),x=s??h,T=o??p,$=(t??l).filter(Nr);ve(()=>{if(!n||t)return;const f=hr("/api/events/stream",g=>{c(!0);const A=g;a(u=>[A,...u].slice(0,r))},()=>c(!1));return()=>f()},[n,t,r]),ve(()=>{y.current&&b.current&&!x&&(b.current.scrollTop=0)},[$.length,x]);const w=$e(()=>{b.current&&(y.current=b.current.scrollTop<10)},[]),P=$.length,S=$.filter(f=>Date.now()-new Date(f.ts).getTime()<6e4).length;return e("div",{class:D("rounded-lg overflow-hidden",i),style:{background:ee.card,border:`1px solid ${ee.border}`,backdropFilter:"blur(12px)"},children:[e("button",{onClick:()=>T(!x),class:"w-full flex items-center justify-between px-4 py-2.5 transition-colors",style:{background:"transparent",border:"none",borderBottom:x?"none":`1px solid ${ee.border}`},children:[e("div",{class:"flex items-center gap-3",children:[e("div",{class:"flex items-center gap-2",children:[e("span",{class:"w-2 h-2 rounded-full",style:{backgroundColor:v?ee.success:ee.textDim,boxShadow:v?`0 0 8px ${ee.success}`:"none"}}),e("span",{class:"text-xs font-semibold uppercase tracking-wider",style:{color:ee.text},children:"Flow Log"})]}),e("span",{class:"text-[10px] mono px-2 py-0.5 rounded-full",style:{background:`${ee.orange}15`,color:ee.orange,border:`1px solid ${ee.orange}25`},children:[S,"/min"]})]}),e("div",{class:"flex items-center gap-4",children:[e(Xr,{events:$}),e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:ee.textMuted,"stroke-width":"2",style:{transform:x?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.2s ease"},children:e("path",{d:"M6 9l6 6 6-6"})})]})]}),!x&&e("div",{ref:b,onScroll:w,class:"overflow-y-auto animate-fade-in",style:{maxHeight:"240px"},children:$.length===0?e("div",{class:"px-4 py-6 text-center",children:e("span",{class:"text-xs",style:{color:ee.textMuted},children:v?"Waiting for events...":"Connecting to event stream..."})}):e("div",{class:"divide-y",style:{borderColor:`${ee.border}`},children:$.slice(0,20).map((f,g)=>{const A=jt(f.type),u=it(A),{source:C,destination:M}=zr(f),E=Ur(f);return e("div",{class:"px-4 py-2 flex items-start gap-3 transition-colors hover:bg-white/[0.02]",style:{animation:g===0?"fade-in 0.2s ease":void 0,borderColor:ee.border},children:[e("span",{class:"text-[9px] mono shrink-0 w-12 mt-0.5",style:{color:ee.textDim},children:le(f.ts)}),e("div",{class:"flex items-center gap-1.5 shrink-0 min-w-[140px]",children:[e("span",{class:"text-[9px] mono truncate max-w-[50px]",style:{color:ee.textMuted},children:C.split("-")[0]}),e("svg",{width:"14",height:"8",viewBox:"0 0 14 8",class:"shrink-0",children:e("path",{d:"M0 4h10M8 1l3 3-3 3",fill:"none",stroke:u,"stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),e("span",{class:"text-[9px] mono truncate max-w-[50px]",style:{color:ee.textMuted},children:M.split("-")[0]})]}),e("span",{class:"text-[8px] mono px-1.5 py-0.5 rounded shrink-0 uppercase tracking-wider",style:{background:`${u}18`,color:u,border:`1px solid ${u}30`},children:A}),e("span",{class:"text-[10px] truncate flex-1",style:{color:ee.text},children:E})]},f.id||`${f.ts}-${g}`)})})}),x&&P>0&&e("div",{class:"px-4 py-1.5 flex items-center justify-between",children:[e("span",{class:"text-[9px] mono",style:{color:ee.textDim},children:[P," events buffered"]}),e("div",{class:"flex gap-1",children:["data","rl","success","alert"].map(f=>{const g=$.filter(A=>jt(A.type)===f).length;return g===0?null:e("span",{class:"text-[8px] mono px-1 rounded",style:{background:`${it(f)}15`,color:it(f)},children:g},f)})})]})]})}const he={border:"rgba(60, 60, 60, 0.25)",text:"#f5f5f5",textMuted:"#8b8b8b",textDim:"#5a5a5a",success:"#34d399",destructive:"#f87171",purple:"#a855f7",orange:"#FF5722"};function Lt(t){switch(t){case"regression":return"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z";case"insight":return"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z";case"milestone":return"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z";case"success":return"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"}}function Fe(t){switch(t){case"regression":return he.destructive;case"insight":return he.purple;case"milestone":return he.orange;case"success":return he.success}}function Yr(t){switch(t){case"regression":return`${he.destructive}08`;case"insight":return`${he.purple}08`;case"milestone":return`${he.orange}08`;case"success":return`${he.success}08`}}function Wr(t){const r=t.data||{},n=t.type.toLowerCase();if(n.includes("regression")||n==="eval:scored"&&r.delta<-.01)return{id:t.id,type:"regression",title:"Regression Detected",description:r.message||r.description||`Score dropped by ${Math.abs(r.delta||0).toFixed(4)}`,ts:t.ts,source:t.source,data:r};if(n.includes("insight")||n.includes("discovery")||n.includes("correlation"))return{id:t.id,type:"insight",title:r.title||"Cross-Service Insight",description:r.summary||r.insight||r.description||"New pattern detected",ts:t.ts,source:t.source,data:r};if(n.includes("milestone")||n.includes("first-positive")||n.includes("breakthrough"))return{id:t.id,type:"milestone",title:r.title||"Agent Milestone",description:r.description||r.message||"Achievement unlocked",ts:t.ts,source:t.source,data:r};if(n==="eval:scored"){const s=r.delta,o=r.composite;if(s>.02)return{id:t.id,type:"success",title:"Significant Improvement",description:`${r.agent||"Agent"} improved by +${s.toFixed(4)} to ${(o==null?void 0:o.toFixed(4))||"—"}`,ts:t.ts,source:t.source,data:r}}if(n.includes("test")&&(n.includes("added")||n.includes("created"))){const s=r.count||r.tests_added||1;return{id:t.id,type:"milestone",title:"Tests Added",description:`${s} new test${s>1?"s":""} added to coverage`,ts:t.ts,source:t.source,data:r}}return null}function Vr({className:t,maxAlerts:r=5}){var v;const[n,s]=j(new Set),[o,i]=j([]),a=((v=K(()=>N.events(100),15e3).data)==null?void 0:v.events)||[];ve(()=>{const c=[],b=new Set;for(const y of a){if(b.has(y.id)||n.has(y.id))continue;b.add(y.id);const x=Wr(y);x&&c.push(x)}c.sort((y,x)=>new Date(x.ts).getTime()-new Date(y.ts).getTime()),i(c.slice(0,r))},[a,n,r]);const h=c=>{s(b=>new Set([...b,c]))},p=()=>{s(c=>new Set([...c,...o.map(b=>b.id)]))};return o.length===0?null:e("div",{class:D("rounded-lg overflow-hidden animate-fade-in",t),style:{background:Yr(o[0].type),border:`1px solid ${Fe(o[0].type)}30`},children:[e("div",{class:"px-4 py-2.5 flex items-center justify-between",style:{borderBottom:`1px solid ${Fe(o[0].type)}20`},children:[e("div",{class:"flex items-center gap-2",children:[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:Fe(o[0].type),"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:e("path",{d:Lt(o[0].type)})}),e("span",{class:"text-xs font-semibold uppercase tracking-wider",style:{color:Fe(o[0].type)},children:o.length===1?"Alert":`${o.length} Alerts`})]}),o.length>1&&e("button",{onClick:p,class:"text-[9px] mono px-2 py-0.5 rounded transition-colors",style:{color:he.textMuted,background:"rgba(255,255,255,0.05)",border:"none"},children:"dismiss all"})]}),e("div",{class:"divide-y",style:{borderColor:`${he.border}`},children:o.map((c,b)=>{const y=Fe(c.type);return e("div",{class:"px-4 py-3 flex items-start gap-3 transition-all",style:{animation:b===0?"fade-in 0.3s ease":void 0,background:b===0?`${y}05`:"transparent",borderColor:`${y}15`},children:[e("div",{class:"shrink-0 w-8 h-8 rounded-lg flex items-center justify-center",style:{background:`${y}15`,border:`1px solid ${y}25`},children:e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:y,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:e("path",{d:Lt(c.type)})})}),e("div",{class:"flex-1 min-w-0",children:[e("div",{class:"flex items-center gap-2 mb-0.5",children:[e("span",{class:"text-sm font-medium",style:{color:he.text},children:c.title}),e("span",{class:"text-[9px] mono",style:{color:he.textDim},children:le(c.ts)})]}),e("p",{class:"text-xs leading-relaxed",style:{color:he.textMuted},children:c.description}),c.source&&e("span",{class:"text-[9px] mono mt-1 inline-block",style:{color:he.textDim},children:["via ",c.source]})]}),e("button",{onClick:()=>h(c.id),class:"shrink-0 p-1.5 rounded transition-colors hover:bg-white/5",style:{color:he.textMuted,background:"none",border:"none"},children:e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",children:e("path",{d:"M18 6L6 18M6 6l12 12"})})})]},c.id)})})]})}function mr({name:t}){return e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"shrink-0",children:{dashboard:e(ie,{children:[e("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),e("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),e("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),e("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]}),events:e("path",{d:"M13 2 3 14h9l-1 8 10-12h-9z"}),loop:e(ie,{children:[e("circle",{cx:"7",cy:"12",r:"2"}),e("circle",{cx:"12",cy:"7",r:"2"}),e("circle",{cx:"17",cy:"10",r:"2"}),e("circle",{cx:"12",cy:"17",r:"2"}),e("path",{d:"M7 12l5-5M12 7l5 3M17 10l-5 7"})]}),topology:e(ie,{children:[e("circle",{cx:"5",cy:"6",r:"2"}),e("circle",{cx:"12",cy:"4",r:"2"}),e("circle",{cx:"19",cy:"8",r:"2"}),e("circle",{cx:"7",cy:"18",r:"2"}),e("circle",{cx:"17",cy:"17",r:"2"}),e("path",{d:"M7 6l5-2M14 4l5 4M5 8l2 10M12 6l5 11M9 18h8"})]}),system:e(ie,{children:[e("path",{d:"M3 3v18h18"}),e("path",{d:"m7 16 4-8 4 4 4-6"})]}),reviews:e(ie,{children:[e("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e("path",{d:"M14 2v6h6"}),e("path",{d:"m9 15 2 2 4-4"})]}),chat:e("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),synopsis:e(ie,{children:[e("path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"}),e("path",{d:"M8 7h6"}),e("path",{d:"M8 11h8"})]}),search:e(ie,{children:[e("circle",{cx:"11",cy:"11",r:"8"}),e("path",{d:"m21 21-4.3-4.3"})]}),findings:e(ie,{children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 8v4"}),e("path",{d:"M12 16h.01"})]})}[t]})}const Jr=[{id:"overview",label:"Overview",icon:"dashboard"},{id:"activity",label:"Activity",icon:"events"},{id:"kanban",label:"Kanban",icon:"findings"},{id:"loop",label:"Loop",icon:"loop"},{id:"experiments",label:"Experiments",icon:"system"},{id:"findings",label:"Findings",icon:"findings"},{id:"reviews",label:"Reviews",icon:"reviews"},{id:"chat",label:"Chat",icon:"chat"},{id:"synopsis",label:"Synopsis",icon:"synopsis"},{id:"topology",label:"Topology",icon:"topology"},{id:"system",label:"System",icon:"system"},{id:"setup-report",label:"Setup Report",icon:"findings"},{id:"system-graph",label:"System Graph",icon:"topology"}];function qr({status:t,currentPage:r,setPage:n}){var v,c;const s=((v=t==null?void 0:t.config)==null?void 0:v.name)||"JFL",o=(t==null?void 0:t.status)||"unknown",i=(t==null?void 0:t.type)||"standalone",l=(t==null?void 0:t.children)||[],h=K(()=>N.leaderboard(),3e4).data||[],p=h.length>0?[...h].sort((b,y)=>(y.composite||0)-(b.composite||0))[0]:null;return e("aside",{class:"w-56 h-screen bg-sidebar flex flex-col fixed left-0 top-0 z-10 border-r border-sidebar-border",children:[e("div",{class:"px-4 pt-5 pb-4",children:[e("div",{class:"flex items-center gap-2.5",children:[e("div",{class:D("w-7 h-7 rounded-lg flex items-center justify-center text-xs font-bold",o==="ok"||o==="running"?"bg-success/15 text-success":"bg-warning/15 text-warning"),children:s.charAt(0).toUpperCase()}),e("div",{class:"min-w-0",children:[e("div",{class:"font-semibold text-sm text-sidebar-foreground truncate",children:s}),e("div",{class:"flex items-center gap-1.5 mt-0.5",children:[e("span",{class:"text-[10px] mono text-muted-foreground uppercase tracking-wider",children:i}),(t==null?void 0:t.port)&&e("span",{class:"text-[10px] mono text-muted-foreground",children:[":",t.port]})]})]})]}),(p==null?void 0:p.trajectory)&&p.trajectory.length>1&&e("div",{class:"mt-3 flex items-center gap-2",children:[e(tt,{data:p.trajectory,width:100,height:20,color:p.delta!=null&&p.delta>0?"var(--success)":"var(--info)"}),e("span",{class:"text-[10px] mono tabular-nums text-muted-foreground",children:(c=p.composite)==null?void 0:c.toFixed(2)})]})]}),e("div",{class:"px-3 pb-3",children:e(Kr,{setPage:n})}),e("nav",{class:"flex-1 overflow-y-auto pb-2",children:[Jr.map(b=>e("button",{onClick:()=>n(b.id),class:D("w-full flex items-center gap-2.5 px-4 py-1.5 text-[13px] transition-colors relative",r===b.id?"text-sidebar-foreground font-medium bg-accent/60 before:absolute before:left-0 before:top-[5px] before:bottom-[5px] before:w-[2px] before:bg-info before:rounded-r":"text-muted-foreground hover:text-sidebar-foreground hover:bg-accent/30"),children:[e(mr,{name:b.icon}),b.label]},b.id)),h.length>0&&e("div",{class:"mt-5",children:[e("div",{class:"px-4 pb-1 text-[10px] uppercase tracking-widest text-muted-foreground font-medium",children:"Agents"}),h.sort((b,y)=>(y.composite||0)-(b.composite||0)).slice(0,6).map(b=>{const y=b.delta!=null&&b.delta>0;return e("button",{onClick:()=>n("loop"),class:"w-full flex items-center gap-2.5 px-4 py-1 text-[13px] text-muted-foreground hover:text-sidebar-foreground transition-colors",children:[e("span",{class:D("w-[6px] h-[6px] rounded-full shrink-0",y?"bg-success":"bg-muted-foreground/50")}),e("span",{class:"truncate",children:b.agent}),b.composite!=null&&e("span",{class:"ml-auto mono text-[10px] tabular-nums",children:b.composite.toFixed(2)})]},b.agent)})]})]}),l.length>0&&e("div",{class:"border-t border-sidebar-border py-3 px-4",children:[e("div",{class:"text-[10px] uppercase tracking-widest text-muted-foreground font-medium mb-2",children:"Products"}),e("div",{class:"space-y-1.5",children:l.map(b=>e("div",{class:"flex items-center gap-2",children:[e("span",{class:D("w-[6px] h-[6px] rounded-full shrink-0",b.status==="ok"?"bg-success":b.status==="error"?"bg-destructive":"bg-muted-foreground/50")}),e("span",{class:"text-xs text-sidebar-foreground truncate flex-1",children:b.name}),e("span",{class:"text-[10px] mono text-muted-foreground",children:[":",b.port]})]},b.name))})]}),e("div",{class:"px-4 py-3 border-t border-sidebar-border",children:e("div",{class:"text-[10px] text-muted-foreground/60 mono",children:"jfl v0.3.0"})})]})}function Kr({setPage:t}){const[r,n]=j(""),[s,o]=j([]),[i,l]=j(!1),a=async()=>{var h;if(r.trim()){l(!0);try{const p=await N.memorySearch(r.trim());o(((h=p.results)==null?void 0:h.slice(0,5))||[])}catch{o([])}l(!1)}};return e("div",{class:"relative",children:[e("div",{class:"flex items-center gap-1.5 bg-accent/40 rounded-md px-2.5 py-1.5 border border-sidebar-border/50 focus-within:border-info/50 transition-colors",children:[e(mr,{name:"search"}),e("input",{type:"text",placeholder:"Search...",value:r,onInput:h=>n(h.target.value),onKeyDown:h=>h.key==="Enter"&&a(),class:"bg-transparent text-xs text-sidebar-foreground placeholder:text-muted-foreground/50 outline-none flex-1 min-w-0"}),i&&e("span",{class:"text-[10px] text-muted-foreground animate-pulse-dot",children:"..."})]}),s.length>0&&e("div",{class:"absolute top-full left-0 right-0 mt-1 bg-card border border-border rounded-md shadow-lg z-50 max-h-60 overflow-y-auto",children:s.map((h,p)=>{var v;return e("button",{onClick:()=>{o([]),n(""),t("activity")},class:"w-full text-left px-3 py-2 hover:bg-muted/30 transition-colors border-b border-border/30 last:border-0",children:[e("div",{class:"text-xs font-medium truncate",children:h.title||((v=h.content)==null?void 0:v.slice(0,60))}),e("div",{class:"flex items-center gap-2 mt-0.5",children:[h.type&&e("span",{class:"text-[10px] mono text-info",children:h.type}),h.relevance&&e("span",{class:D("text-[10px] mono",h.relevance==="high"?"text-success":"text-muted-foreground"),children:h.relevance})]})]},p)})})]})}function Qr({status:t}){var C,M,E,m;const r=K(()=>N.events(100),1e4),n=K(()=>N.leaderboard(),15e3),s=K(()=>N.journal(),15e3),o=K(()=>N.synopsis(24),3e4),i=K(()=>N.memoryStatus(),3e4),l=K(()=>N.flowExecutions(),15e3),a=(t==null?void 0:t.type)||"standalone",h=t==null?void 0:t.config,p=(t==null?void 0:t.children)||[],v=((C=r.data)==null?void 0:C.events)||[],c=n.data||[],b=s.data||[],y=(t==null?void 0:t.sources)||{},x=Object.values(y).filter(Boolean).length,T=Object.keys(y).length,_=i.data,$=l.data,P=(Array.isArray($)?$:($==null?void 0:$.executions)||[]).filter(d=>d.gated),S=c.length>0?[...c].sort((d,k)=>(k.composite||0)-(d.composite||0))[0]:null,f=b.filter(d=>d.type!=="file").slice(0,5),g=v.filter(d=>!d.type.startsWith("session:")&&!d.type.startsWith("hook:")).slice(0,10),[A,u]=j(!1);return e("div",{class:"space-y-6",children:[e("div",{class:"flex items-center justify-between",children:[e("div",{children:[e("h1",{class:"text-xl font-semibold",children:(h==null?void 0:h.name)||"Dashboard"}),(h==null?void 0:h.description)&&e("p",{class:"text-sm text-muted-foreground mt-1",children:h.description})]}),e(Zr,{})]}),e(Vr,{maxAlerts:3}),e("div",{class:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e(xe,{label:"Sources",value:`${x}/${T}`,sub:"connected",trend:x===T?"up":"down"}),e(xe,{label:"Items",value:(t==null?void 0:t.itemCount)||0,sub:"indexed"}),e(xe,{label:"Agents",value:c.length,sub:S?`best: ${(M=S.composite)==null?void 0:M.toFixed(2)}`:"none",trend:(S==null?void 0:S.delta)!=null&&S.delta>0?"up":void 0}),e(xe,{label:"Memories",value:(_==null?void 0:_.total_memories)||0,sub:(E=_==null?void 0:_.embeddings)!=null&&E.available?"with embeddings":"keyword only"})]}),P.length>0&&e("div",{class:"bg-warning/5 border border-warning/30 rounded-lg p-4",children:[e("h3",{class:"text-xs text-warning uppercase tracking-wider font-medium mb-2",children:["Actions Needed (",P.length,")"]}),e("div",{class:"space-y-1.5",children:P.map((d,k)=>e("div",{class:"flex items-center justify-between",children:[e("div",{class:"flex items-center gap-2",children:[e("span",{class:"w-1.5 h-1.5 rounded-full bg-warning animate-pulse"}),e("span",{class:"text-sm font-medium",children:d.flow}),e("span",{class:"text-[10px] mono text-muted-foreground",children:le(d.started_at)})]}),e("button",{onClick:()=>N.approveFlow(d.flow,d.trigger_event_id),class:"text-[10px] mono px-2 py-0.5 rounded bg-success/15 text-success hover:bg-success/25 transition-colors",children:"approve"})]},k))})]}),S&&e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("div",{class:"flex items-center justify-between mb-3",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider",children:"Top Agent"}),e("span",{class:"text-[10px] mono text-muted-foreground",children:[c.length," total"]})]}),e("div",{class:"flex items-center gap-4",children:[e("div",{children:[e("div",{class:"text-sm font-medium",children:S.agent}),e("div",{class:"flex items-center gap-2 mt-1",children:[e("span",{class:"text-2xl font-bold tabular-nums",children:(m=S.composite)==null?void 0:m.toFixed(4)}),S.delta!=null&&e("span",{class:D("text-sm mono",S.delta>=0?"text-success":"text-destructive"),children:[S.delta>=0?"+":"",S.delta.toFixed(4)]})]})]}),S.trajectory&&S.trajectory.length>1&&e(tt,{data:S.trajectory,width:160,height:36,color:S.delta!=null&&S.delta>0?"var(--success)":"var(--info)"})]})]}),o.data&&e(en,{data:o.data}),a==="portfolio"&&p.length>0&&e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:["Products (",p.length,")"]}),e("div",{class:"space-y-2",children:p.map(d=>e("div",{class:"flex items-center gap-3 text-sm",children:[e(gr,{status:d.status==="ok"?"ok":"error"}),e("span",{class:"font-medium",children:d.name}),e("span",{class:"text-[10px] mono text-muted-foreground",children:[":",d.port]}),d.status==="ok"&&e("a",{href:`http://localhost:${d.port}/dashboard/`,target:"_blank",rel:"noopener",class:"text-[10px] text-info hover:underline ml-auto",children:"Open"})]},d.name))})]}),e("div",{class:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:"Recent Journal"}),f.length>0?e("div",{class:"space-y-2",children:f.map((d,k)=>e("div",{class:"flex items-start gap-2 text-sm",children:[e("span",{class:"text-[10px] mono text-muted-foreground whitespace-nowrap mt-0.5 w-12 shrink-0",children:le(d.timestamp||d.ts)}),e("div",{class:"min-w-0",children:[e("div",{class:"truncate",children:d.title}),d.type&&e("span",{class:"text-[10px] mono text-info",children:d.type})]})]},k))}):e("div",{class:"text-sm text-muted-foreground",children:"No journal entries"})]}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:"Recent Events"}),g.length>0?e("div",{class:"space-y-2",children:g.map(d=>{var O;const k=d.data||{},I=d.type.startsWith("hook:")?`${k.tool_name||"tool"} ${(O=k.file_paths)!=null&&O.length?`on ${k.file_paths[0]}`:""}`:k.title||k.agent||d.source||d.type;return e("div",{class:"flex items-start gap-2 text-sm",children:[e("span",{class:"text-[10px] mono text-muted-foreground whitespace-nowrap mt-0.5 w-12 shrink-0",children:le(d.ts)}),e("div",{class:"min-w-0",children:e("div",{class:"flex items-center gap-2",children:[e("span",{class:"text-[10px] mono text-info whitespace-nowrap",children:d.type}),e("span",{class:"truncate text-muted-foreground",children:I})]})})]},d.id)})}):e("div",{class:"text-sm text-muted-foreground",children:"No events"})]})]}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:"Context Sources"}),e("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Object.entries(y).map(([d,k])=>e("div",{class:"flex items-center gap-2",children:[e("span",{class:D("w-1.5 h-1.5 rounded-full",k?"bg-success":"bg-destructive")}),e("span",{class:"text-sm capitalize",children:d}),e("span",{class:"text-[10px] text-muted-foreground",children:k?"ok":"disconnected"})]},d))})]}),e(Hr,{events:v,collapsed:A,onToggleCollapse:u})]})}function Zr(){const[t,r]=j(null),n=[{label:"run eval",event:"eval:run-requested",data:{source:"dashboard"}},{label:"run peter",spawn:!0,command:"jfl",args:["peter","run"]}],s=async o=>{try{o.spawn?await N.spawnAction(o.command,o.args,o.event):await N.publishEvent(o.event,o.data||{}),r(o.label),setTimeout(()=>r(null),2e3)}catch(i){console.error("Action failed:",i)}};return e("div",{class:"flex items-center gap-2",children:n.map(o=>e("button",{onClick:()=>s(o),class:D("text-[10px] mono px-2 py-1 rounded transition-colors",t===o.label?"bg-success/15 text-success":"bg-muted text-muted-foreground hover:text-foreground hover:bg-muted/80"),children:t===o.label?"done":o.label},o.label))})}function en({data:t}){const r=t.summary;return r.features+r.fixes+r.decisions+r.discoveries>0||t.commits.length>0?e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:["Work Summary ",e("span",{class:"text-[10px] font-normal",children:["last ",t.hours,"h"]})]}),e("div",{class:"grid grid-cols-2 md:grid-cols-5 gap-4 mb-4",children:[r.features>0&&e("div",{children:[e("div",{class:"text-lg font-semibold mono text-success",children:r.features}),e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"Features"})]}),r.fixes>0&&e("div",{children:[e("div",{class:"text-lg font-semibold mono text-warning",children:r.fixes}),e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"Fixes"})]}),r.decisions>0&&e("div",{children:[e("div",{class:"text-lg font-semibold mono text-info",children:r.decisions}),e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"Decisions"})]}),r.discoveries>0&&e("div",{children:[e("div",{class:"text-lg font-semibold mono text-purple-400",children:r.discoveries}),e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"Discoveries"})]}),t.commits.length>0&&e("div",{children:[e("div",{class:"text-lg font-semibold mono",children:t.commits.length}),e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"Commits"})]})]}),t.commits.length>0&&e("div",{class:"border-t border-border pt-3",children:e("div",{class:"space-y-1",children:t.commits.slice(0,5).map(s=>e("div",{class:"flex items-center gap-2 text-xs",children:[e("span",{class:"mono text-muted-foreground text-[10px]",children:s.hash.slice(0,7)}),e("span",{class:"truncate",children:s.message}),e("span",{class:"text-[10px] text-muted-foreground ml-auto whitespace-nowrap",children:le(s.date)})]},s.hash))})}),r.incompleteItems.length>0&&e("div",{class:"border-t border-border pt-3 mt-3",children:[e("div",{class:"text-[10px] text-muted-foreground uppercase tracking-wider mb-2",children:"Incomplete"}),e("div",{class:"space-y-1",children:r.incompleteItems.slice(0,5).map((s,o)=>e("div",{class:"text-xs text-warning/80 flex items-center gap-1.5",children:[e("span",{class:"w-1 h-1 rounded-full bg-warning/60 shrink-0"}),s]},o))})]})]}):null}const tn={critical:{bg:"bg-destructive/10",text:"text-destructive",icon:"🔴"},warning:{bg:"bg-warning/10",text:"text-warning",icon:"⚠️"},info:{bg:"bg-info/10",text:"text-info",icon:"ℹ️"}},rn={performance_regression:"Performance Regression",test_failure:"Test Failure",error_spike:"Error Spike",coverage_gap:"Coverage Gap",stale_code:"Stale Code",eval_plateau:"Eval Plateau"};function nn(){var P;const[t,r]=j(!1),[n,s]=j(null),[o,i]=j(null),[l,a]=j(0),h=K(()=>N.findings(!1,t),3e4,[t,l]),p=async()=>{try{await N.analyzeFindings(),a(S=>S+1)}catch(S){console.error("Failed to analyze:",S)}},v=async S=>{s(S.id);try{await N.spawnFindingAgent(S.id),setTimeout(()=>s(null),3e3)}catch(f){console.error("Failed to spawn:",f),s(null)}},c=async S=>{i(S.id);try{await N.dismissFinding(S.id),a(f=>f+1)}catch(f){console.error("Failed to dismiss:",f)}i(null)},b=((P=h.data)==null?void 0:P.findings)||[],y=b.filter(S=>!S.dismissed),x=b.filter(S=>S.dismissed),T={critical:0,warning:1,info:2};y.sort((S,f)=>T[S.severity]-T[f.severity]);const _=y.filter(S=>S.severity==="critical").length,$=y.filter(S=>S.severity==="warning").length,w=y.filter(S=>S.severity==="info").length;return e("div",{class:"space-y-6",children:[e("div",{class:"flex items-center justify-between",children:[e("div",{children:[e("h1",{class:"text-xl font-semibold",children:"Findings"}),e("p",{class:"text-sm text-muted-foreground mt-1",children:"Automatically detected issues — click Fix to spawn an agent"})]}),e("div",{class:"flex items-center gap-2",children:[e("button",{onClick:p,class:"text-[10px] mono px-2 py-1 rounded bg-muted text-muted-foreground hover:text-foreground transition-colors",children:h.loading?"analyzing...":"re-analyze"}),e("button",{onClick:()=>r(!t),class:D("text-[10px] mono px-2 py-1 rounded transition-colors",t?"bg-info/15 text-info":"bg-muted text-muted-foreground hover:text-foreground"),children:t?"hide dismissed":"show dismissed"})]})]}),y.length>0&&e("div",{class:"flex items-center gap-4",children:[_>0&&e("div",{class:"flex items-center gap-1.5",children:[e("span",{class:"w-2 h-2 rounded-full bg-destructive"}),e("span",{class:"text-sm mono",children:[_," critical"]})]}),$>0&&e("div",{class:"flex items-center gap-1.5",children:[e("span",{class:"w-2 h-2 rounded-full bg-warning"}),e("span",{class:"text-sm mono",children:[$," warning"]})]}),w>0&&e("div",{class:"flex items-center gap-1.5",children:[e("span",{class:"w-2 h-2 rounded-full bg-info"}),e("span",{class:"text-sm mono",children:[w," info"]})]})]}),h.loading&&b.length===0?e("div",{class:"text-sm text-muted-foreground animate-pulse-dot",children:"Loading findings..."}):y.length===0&&!t?e("div",{class:"bg-card rounded-lg border border-border p-8 text-center",children:[e("div",{class:"text-success text-2xl mb-2",children:"✓"}),e("div",{class:"text-sm font-medium",children:"No active findings"}),e("div",{class:"text-xs text-muted-foreground mt-1",children:"Everything looks good! Run re-analyze to check again."})]}):e("div",{class:"space-y-4",children:[y.map(S=>e(Gt,{finding:S,spawning:n===S.id,dismissing:o===S.id,onSpawn:()=>v(S),onDismiss:()=>c(S)},S.id)),t&&x.length>0&&e(ie,{children:[e("div",{class:"text-xs text-muted-foreground uppercase tracking-wider pt-4",children:["Dismissed (",x.length,")"]}),x.map(S=>e(Gt,{finding:S,spawning:!1,dismissing:!1,onSpawn:()=>{},onDismiss:()=>{},disabled:!0},S.id))]})]})]})}function Gt({finding:t,spawning:r,dismissing:n,onSpawn:s,onDismiss:o,disabled:i}){const[l,a]=j(!1),h=tn[t.severity],p=rn[t.type];return e("div",{class:D("bg-card rounded-lg border border-border overflow-hidden transition-all",t.dismissed&&"opacity-50"),children:e("div",{class:"p-4",children:[e("div",{class:"flex items-start gap-3",children:[e("span",{class:"text-lg leading-none",children:h.icon}),e("div",{class:"flex-1 min-w-0",children:[e("div",{class:"flex items-center gap-2 flex-wrap",children:[e("span",{class:D("font-medium",h.text),children:t.title}),e("span",{class:"text-[10px] mono px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:p})]}),e("p",{class:"text-sm text-muted-foreground mt-1",children:t.description}),t.scope_files.length>0&&e("div",{class:"mt-2",children:[e("button",{onClick:()=>a(!l),class:"text-[10px] mono text-info hover:underline",children:[l?"hide":"show"," ",t.scope_files.length," file",t.scope_files.length!==1?"s":""]}),l&&e("div",{class:"mt-2 p-2 bg-muted/30 rounded text-xs mono space-y-0.5 max-h-32 overflow-y-auto",children:t.scope_files.map((v,c)=>e("div",{class:"text-muted-foreground truncate",children:v},c))})]})]}),!i&&e("div",{class:"flex items-center gap-2 shrink-0",children:[t.agent_config&&e("button",{onClick:s,disabled:r,class:D("text-[10px] mono px-3 py-1.5 rounded transition-colors",r?"bg-success/15 text-success":"bg-info/15 text-info hover:bg-info/25"),children:r?"spawned!":"Fix"}),e("button",{onClick:o,disabled:n,class:"text-[10px] mono px-2 py-1.5 rounded bg-muted text-muted-foreground hover:text-foreground transition-colors",children:n?"...":"dismiss"})]})]}),t.agent_config&&e("div",{class:"flex items-center gap-4 mt-3 pt-3 border-t border-border text-[10px] mono text-muted-foreground",children:[e("span",{children:["target: ",t.agent_config.metric," ≥ ",t.agent_config.target]}),e("span",{children:["rounds: ",t.agent_config.rounds]}),e("span",{children:["eval: ",t.agent_config.eval_script]})]})]})})}function sn(){const t=K(()=>N.rlAgents().then(v=>v.agents),15e3),r=K(()=>N.rlSessions().then(v=>v.sessions),1e4),n=K(()=>N.productContext(),3e4),s=t.data||[],o=r.data||[],i=n.data||{context:null,updatedAt:null},l={};for(const v of o)l[v.agent]||(l[v.agent]=[]),l[v.agent].push(v);const a=o.reduce((v,c)=>v+c.rounds.length,0),h=o.reduce((v,c)=>v+c.rounds.filter(b=>b.kept).length,0),p=s.filter(v=>(l[v.name]||[]).length>0).length;return e("div",{class:"space-y-6",children:[e("div",{children:[e("h1",{class:"text-xl font-semibold",children:"Autoresearch"}),e("p",{class:"text-sm text-muted-foreground mt-1",children:"Scoped agents optimizing your services. Branches grow overnight, you review in the morning."})]}),e("div",{class:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e(Oe,{label:"Agents",value:s.length,sub:`${p} active`}),e(Oe,{label:"Sessions",value:o.length,sub:"completed"}),e(Oe,{label:"Rounds",value:a,sub:`${h} kept`,accent:h>0}),e(Oe,{label:"Hit Rate",value:a>0?`${Math.round(h/a*100)}%`:"—",sub:"improvements",accent:h>0})]}),e("div",{children:[e("h2",{class:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-3",children:"Agents"}),e("div",{class:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:s.map(v=>e(on,{agent:v,sessions:l[v.name]||[]},v.name))})]}),i.context&&e(ln,{context:i.context,updatedAt:i.updatedAt}),o.length>0&&e(an,{sessions:o})]})}function Oe({label:t,value:r,sub:n,accent:s}){return e("div",{class:"card p-4",children:[e("div",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-1",children:t}),e("div",{class:D("text-2xl font-bold tabular-nums",s?"text-green-400":""),children:r}),e("div",{class:"text-xs text-muted-foreground mt-0.5",children:n})]})}function on({agent:t,sessions:r}){var p,v,c,b;const n=r.flatMap(y=>y.rounds),s=n.filter(y=>y.kept),o=r[r.length-1],i=o==null?void 0:o.rounds[o.rounds.length-1],l=s.length>0?Math.max(...s.map(y=>Math.abs(y.delta))):0,a=s.length>0,h=(((v=(p=t.context_scope)==null?void 0:p.produces)==null?void 0:v.length)||0)+(((b=(c=t.context_scope)==null?void 0:c.consumes)==null?void 0:b.length)||0);return e("div",{class:D("card p-4 border-l-2",a?"border-l-green-500":"border-l-border"),children:[e("div",{class:"flex items-center justify-between mb-2",children:[e("h3",{class:"text-sm font-semibold",children:t.name}),e("span",{class:D("text-[10px] px-2 py-0.5 rounded font-mono",t.direction==="minimize"?"bg-green-500/10 text-green-400":"bg-purple-500/10 text-purple-400"),children:[t.direction==="minimize"?"↓":"↑"," ",t.metric]})]}),e("div",{class:"text-xs text-muted-foreground mb-3",children:[t.target_repo?`→ ${t.target_repo}`:"self"," · ",h," scope patterns"]}),e("div",{class:"grid grid-cols-3 gap-2 mb-3",children:[e(lt,{label:"rounds",value:n.length}),e(lt,{label:"kept",value:s.length,accent:a}),e(lt,{label:"best Δ",value:l>0?l.toFixed(0):"—",accent:a})]}),n.length>0&&e("div",{class:"flex gap-px h-5 items-end mb-2",children:n.slice(-15).map((y,x)=>e("div",{class:D("flex-1 min-w-1 rounded-sm transition-all",y.kept?"bg-green-500/70 h-full":"bg-red-500/50 h-2/5"),title:`R${y.round}: ${y.delta>0?"+":""}${y.delta.toFixed(1)} ${y.kept?"KEPT":"REVERTED"}`},x))}),i?e("div",{class:"text-[11px] text-muted-foreground border-t border-border pt-2 mt-1 tabular-nums",children:["Last: ",i.metric.toFixed(1)," (",i.delta>0?"+":"",i.delta.toFixed(1),")",e("span",{class:i.kept?"text-green-400":"text-red-400",children:[" ",i.kept?"✓":"✗"]}),i.timestamp&&e("span",{class:"ml-1",children:["· ",le(i.timestamp)]})]}):e("div",{class:"text-xs text-muted-foreground italic",children:"No experiments yet"})]})}function lt({label:t,value:r,accent:n}){return e("div",{class:"text-center",children:[e("div",{class:D("text-lg font-bold tabular-nums",n?"text-green-400":"text-foreground"),children:r}),e("div",{class:"text-[10px] text-muted-foreground",children:t})]})}function ln({context:t,updatedAt:r}){const n=t.replace(/^# Product Context\n\n_Synthesized.*?\n\n/,""),s=n.split(/^## /m).filter(Boolean).map(o=>{const i=o.split(`
|
|
3
|
-
`),l=i[0].trim(),a=i.slice(1).join(`
|
|
4
|
-
`).trim();return{title:l,body:a}});return e("div",{class:"card p-4",children:[e("div",{class:"flex items-center justify-between mb-3",children:[e("h2",{class:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Product Context"}),r&&e("span",{class:"text-[11px] text-muted-foreground",children:le(r)})]}),s.length>0?e("div",{class:"space-y-3",children:s.map((o,i)=>e("div",{children:[e("h3",{class:"text-xs font-semibold text-foreground mb-1",children:o.title}),e("div",{class:"text-xs text-muted-foreground leading-relaxed whitespace-pre-line",children:o.body.split(`
|
|
5
|
-
`).map((l,a)=>{const h=l.replace(/\*\*(.*?)\*\*/g,"$1");return l.startsWith("- ")?e("div",{class:"ml-2",children:["· ",h.replace(/^- /,"")]},a):h?e("div",{children:h},a):null})})]},i))}):e("div",{class:"text-xs text-muted-foreground whitespace-pre-line leading-relaxed",children:n})]})}function an({sessions:t}){return e("div",{class:"card p-4",children:[e("h2",{class:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-3",children:"Recent Sessions"}),e("div",{class:"overflow-x-auto",children:e("table",{class:"w-full text-xs",children:[e("thead",{children:e("tr",{class:"border-b border-border text-muted-foreground",children:[e("th",{class:"text-left py-2 px-2 font-medium",children:"Agent"}),e("th",{class:"text-center py-2 px-2 font-medium",children:"Rounds"}),e("th",{class:"text-center py-2 px-2 font-medium",children:"Kept"}),e("th",{class:"text-right py-2 px-2 font-medium",children:"Best Δ"}),e("th",{class:"text-left py-2 px-2 font-medium",children:"Results"})]})}),e("tbody",{children:t.slice(-10).reverse().map(r=>{const n=r.rounds.filter(o=>o.kept),s=n.length>0?Math.max(...n.map(o=>Math.abs(o.delta))):0;return e("tr",{class:"border-b border-border/50 hover:bg-muted/20",children:[e("td",{class:"py-2 px-2 font-medium",children:r.agent}),e("td",{class:"py-2 px-2 text-center text-muted-foreground tabular-nums",children:r.rounds.length}),e("td",{class:D("py-2 px-2 text-center tabular-nums",n.length>0?"text-green-400":"text-muted-foreground"),children:n.length}),e("td",{class:D("py-2 px-2 text-right tabular-nums",s>0?"text-green-400":"text-muted-foreground"),children:s>0?s.toFixed(1):"—"}),e("td",{class:"py-2 px-2",children:e("div",{class:"flex gap-1",children:r.rounds.map((o,i)=>e("span",{class:D("inline-block w-2 h-2 rounded-full",o.kept?"bg-green-500":"bg-red-500"),title:`R${o.round}: ${o.delta>0?"+":""}${o.delta.toFixed(1)}`},i))})})]},r.id)})})]})})]})}const R={bg:"#191919",info:"#4a7dfc",infoGlow:"#4a7dfcaa",success:"#34d399",successGlow:"#34d39988",warning:"#eab308",warningGlow:"#eab30888",purple:"#a855f7",purpleGlow:"#a855f788",cyan:"#06b6d4",text:"#f5f5f5",textMuted:"#8b8b8b",textDim:"#5a5a5a",grid:"#2a2a2a"};function qe(t){switch(t){case"gtm":return{fill:R.cyan,glow:R.cyan+"88"};case"orchestrator":return{fill:R.purple,glow:R.purpleGlow};case"eval":return{fill:R.warning,glow:R.warningGlow};case"service":return{fill:R.success,glow:R.successGlow};default:return{fill:R.info,glow:R.infoGlow}}}function cn(t,r=18){return t.length<=r?t:t.slice(0,r-1)+"…"}const fe=new Set(["peter-parker","telemetry-agent","eval-engine","stratus"]),xr=36,vr=32;function De(t){switch(t){case"running":return R.success;case"idle":return R.warning;default:return R.textDim}}function Ot(){const t=Date.now(),r=[{id:"telemetry-agent",label:"Telemetry Agent",type:"agent",status:"running",eventCount:142,lastAction:"telemetry:insight emitted",lastTs:new Date(t-45e3).toISOString(),reward:[.4,.5,.6,.55,.7,.65,.8]},{id:"peter-parker",label:"Peter Parker",type:"orchestrator",status:"running",eventCount:89,lastAction:"task dispatched to builder",lastTs:new Date(t-12e4).toISOString(),reward:[.3,.4,.5,.55,.6,.7,.75]},{id:"eval-engine",label:"Eval Engine",type:"eval",status:"running",eventCount:234,lastAction:"eval:scored lobsters-prg-0.6.0",lastTs:new Date(t-3e4).toISOString(),reward:[.6,.5,.7,.8,.75,.85,.9]},{id:"stratus",label:"Stratus API",type:"service",status:"running",eventCount:1203,lastAction:"rollout prediction served",lastTs:new Date(t-15e3).toISOString(),reward:[.5,.55,.6,.65,.7,.75,.8]}],n=[{id:"jfl-gtm",label:"JFL",type:"gtm",status:"running",eventCount:456,lastAction:"gtm:deploy",lastTs:new Date(t-6e4).toISOString(),reward:[.5,.6,.7,.65,.75,.8,.85]},{id:"productrank-gtm",label:"ProductRank",type:"gtm",status:"running",eventCount:312,lastAction:"gtm:train",lastTs:new Date(t-9e4).toISOString(),reward:[.4,.5,.55,.6,.7,.75,.8]},{id:"gatcha-gtm",label:"Gatcha",type:"gtm",status:"running",eventCount:198,lastAction:"gtm:eval",lastTs:new Date(t-3e4).toISOString(),reward:[.6,.55,.65,.7,.75,.8,.85]}],s=[{id:"jfl-gtm/context-hub",label:"Context Hub",type:"service",status:"running",eventCount:234,parentGtm:"jfl-gtm",reward:[.5,.6,.55,.7,.65,.75,.8]},{id:"jfl-gtm/memory-server",label:"Memory Server",type:"service",status:"running",eventCount:178,parentGtm:"jfl-gtm",reward:[.4,.5,.55,.6,.65,.7,.75]},{id:"jfl-gtm/journal-sync",label:"Journal Sync",type:"service",status:"running",eventCount:92,parentGtm:"jfl-gtm",reward:[.6,.55,.7,.65,.75,.8,.85]},{id:"jfl-gtm/skill-runner",label:"Skill Runner",type:"agent",status:"running",eventCount:156,parentGtm:"jfl-gtm",reward:[.45,.55,.6,.65,.7,.75,.8]},{id:"productrank-gtm/arena",label:"Arena",type:"eval",status:"running",eventCount:567,parentGtm:"productrank-gtm",reward:[.7,.65,.75,.8,.85,.9,.88]},{id:"productrank-gtm/ranker",label:"Ranker",type:"service",status:"running",eventCount:445,parentGtm:"productrank-gtm",reward:[.55,.6,.65,.7,.75,.8,.85]},{id:"productrank-gtm/scraper",label:"Scraper",type:"agent",status:"running",eventCount:289,parentGtm:"productrank-gtm",reward:[.5,.55,.6,.65,.7,.72,.75]},{id:"gatcha-gtm/game-engine",label:"Game Engine",type:"service",status:"running",eventCount:678,parentGtm:"gatcha-gtm",reward:[.6,.65,.7,.75,.8,.85,.88]},{id:"gatcha-gtm/nft-minter",label:"NFT Minter",type:"service",status:"running",eventCount:123,parentGtm:"gatcha-gtm",reward:[.5,.55,.6,.65,.68,.7,.75]},{id:"gatcha-gtm/matchmaker",label:"Matchmaker",type:"agent",status:"running",eventCount:234,parentGtm:"gatcha-gtm",reward:[.55,.6,.65,.7,.75,.78,.8]}],o=[];for(const l of r){const a=qe(l.type),h=l.type==="orchestrator"?32:l.type==="service"?28:24;o.push({...l,x:0,y:0,targetX:0,targetY:0,radius:h,baseRadius:h,color:a.fill,glowColor:a.glow,pulsePhase:Math.random()*Math.PI*2})}for(const l of n){const a=qe(l.type);o.push({...l,x:0,y:0,targetX:0,targetY:0,radius:xr,baseRadius:vr,color:a.fill,glowColor:a.glow,pulsePhase:Math.random()*Math.PI*2,isGtm:!0,childCount:0,aggregateReward:l.reward})}for(const l of s){const a=qe(l.type),h=l.type==="eval"?24:l.type==="agent"?22:20;o.push({id:l.id,label:l.label,type:l.type,status:l.status,eventCount:l.eventCount,lastAction:`${l.type} activity`,lastTs:new Date(t-Math.random()*3e5).toISOString(),reward:l.reward,x:0,y:0,targetX:0,targetY:0,radius:h,baseRadius:h,color:a.fill,glowColor:a.glow,pulsePhase:Math.random()*Math.PI*2,parentGtm:l.parentGtm})}const i=[{id:"e1",source:"telemetry-agent",target:"peter-parker",eventType:"telemetry:insight",active:!0,lastFired:t-45e3,color:R.info,category:"data",particles:[]},{id:"e2",source:"peter-parker",target:"eval-engine",eventType:"peter:task-completed",active:!0,lastFired:t-12e4,color:R.purple,category:"rl",particles:[]},{id:"e3",source:"eval-engine",target:"telemetry-agent",eventType:"eval:scored",active:!0,lastFired:t-3e4,color:R.warning,category:"success",particles:[]},{id:"e4",source:"peter-parker",target:"stratus",eventType:"peter:rollout-request",active:!0,lastFired:t-15e3,color:R.purple,category:"rl",particles:[]},{id:"e5",source:"stratus",target:"eval-engine",eventType:"stratus:prediction",active:!0,lastFired:t-2e4,color:R.success,category:"success",particles:[]},{id:"e6",source:"jfl-gtm",target:"peter-parker",eventType:"gtm:request",active:!0,lastFired:t-35e3,color:R.info,category:"data",particles:[]},{id:"e7",source:"productrank-gtm",target:"eval-engine",eventType:"gtm:eval",active:!0,lastFired:t-55e3,color:R.warning,category:"success",particles:[]},{id:"e8",source:"gatcha-gtm",target:"stratus",eventType:"gtm:predict",active:!0,lastFired:t-25e3,color:R.success,category:"success",particles:[]},{id:"e9",source:"telemetry-agent",target:"jfl-gtm",eventType:"telemetry:metrics",active:!0,lastFired:t-4e4,color:R.info,category:"data",particles:[]},{id:"e10",source:"telemetry-agent",target:"productrank-gtm",eventType:"telemetry:metrics",active:!0,lastFired:t-5e4,color:R.info,category:"data",particles:[]},{id:"e11",source:"telemetry-agent",target:"gatcha-gtm",eventType:"telemetry:metrics",active:!0,lastFired:t-6e4,color:R.info,category:"data",particles:[]},{id:"e12",source:"jfl-gtm/context-hub",target:"jfl-gtm/memory-server",eventType:"context:sync",active:!0,lastFired:t-1e4,color:R.info,category:"data",particles:[]},{id:"e13",source:"jfl-gtm/memory-server",target:"jfl-gtm/journal-sync",eventType:"memory:write",active:!0,lastFired:t-15e3,color:R.info,category:"data",particles:[]},{id:"e14",source:"jfl-gtm/skill-runner",target:"jfl-gtm/context-hub",eventType:"skill:result",active:!0,lastFired:t-2e4,color:R.purple,category:"rl",particles:[]},{id:"e15",source:"productrank-gtm/arena",target:"productrank-gtm/ranker",eventType:"arena:score",active:!0,lastFired:t-12e3,color:R.warning,category:"success",particles:[]},{id:"e16",source:"productrank-gtm/scraper",target:"productrank-gtm/arena",eventType:"scraper:data",active:!0,lastFired:t-18e3,color:R.info,category:"data",particles:[]},{id:"e17",source:"gatcha-gtm/game-engine",target:"gatcha-gtm/matchmaker",eventType:"game:match",active:!0,lastFired:t-8e3,color:R.success,category:"success",particles:[]},{id:"e18",source:"gatcha-gtm/matchmaker",target:"gatcha-gtm/nft-minter",eventType:"match:reward",active:!0,lastFired:t-22e3,color:R.purple,category:"rl",particles:[]}];for(const l of i){const a=l.active?3+Math.floor(Math.random()*3):1;for(let h=0;h<a;h++)l.particles.push({t:Math.random(),speed:8e-4+Math.random()*.0015,size:2+Math.random()*2.5,alpha:.5+Math.random()*.5,trail:[]})}return{nodes:o,edges:i}}function dn(t,r){const n=Date.now(),s=new Set;for(const l of t)(l.type==="gtm"||l.id.endsWith("-gtm"))&&s.add(l.id);const o=t.map(l=>{const a=l.type==="gtm"||l.id.endsWith("-gtm");let h;if(!a&&!fe.has(l.id))if(l.id.includes("/"))h=l.id.split("/")[0];else for(const b of s){const y=b.replace(/-gtm$/,"");if(l.id.startsWith(y+"-")||l.id.startsWith(y+"/")){h=b;break}}const p=a?"gtm":l.type;let v;a?v=vr:fe.has(l.id)?v=28:l.type==="orchestrator"?v=26:v=22;const c=qe(p);return{id:l.id,label:l.label,type:p,status:l.status,eventCount:l.eventCount||Math.floor(Math.random()*200)+50,lastAction:`${l.type} activity`,lastTs:new Date(n-Math.random()*3e5).toISOString(),reward:Array.from({length:7},()=>.3+Math.random()*.5),x:0,y:0,targetX:0,targetY:0,radius:v,baseRadius:v,color:c.fill,glowColor:c.glow,pulsePhase:Math.random()*Math.PI*2,produces:l.produces,consumes:l.consumes,parentGtm:h,isGtm:a,childCount:0,aggregateReward:Array.from({length:7},()=>.3+Math.random()*.5)}}),i=r.map(l=>{const a=l.category==="success"?R.success:l.category==="rl"?R.purple:R.info,h={id:l.id,source:l.source,target:l.target,eventType:l.eventType,active:!0,lastFired:n-Math.random()*12e4,color:a,category:l.category,particles:[]},p=3+Math.floor(Math.random()*3);for(let v=0;v<p;v++)h.particles.push({t:Math.random(),speed:8e-4+Math.random()*.0015,size:2+Math.random()*2.5,alpha:.5+Math.random()*.5,trail:[]});return h});return{nodes:o,edges:i}}function Be(t,r,n,s,o){const i=r/2,l=n/2;if(t.length===0)return;const h=Math.min(r/1200,n/800,1),p=o||new Set,v=t.filter(f=>f.isGtm),c=t.filter(f=>fe.has(f.id)),b=t.filter(f=>!f.isGtm&&!fe.has(f.id)),y=new Map;for(const f of v)y.set(f.id,[]);for(const f of b)f.parentGtm&&y.has(f.parentGtm)&&y.get(f.parentGtm).push(f);for(const f of v){const g=y.get(f.id)||[];f.childCount=g.length,g.length>0&&(f.aggregateReward=g[0].reward.map((u,C)=>g.reduce((E,m)=>E+(m.reward[C]||0),0)/g.length));const A=p.has(f.id);f.radius=A?f.baseRadius:xr}const x=b.filter(f=>!f.parentGtm||!y.has(f.parentGtm)),T=v.filter(f=>p.has(f.id)),_=v.filter(f=>!p.has(f.id)),$=160;if(T.length===1){const f=T[0];f.targetX=i,f.targetY=l,f.x===0&&f.y===0&&(f.x=i+(Math.random()-.5)*40,f.y=l+(Math.random()-.5)*40);const g=y.get(f.id)||[],A=g.length;if(A>0){const C=Math.PI*2/A,M=-Math.PI/2;g.forEach((E,m)=>{const d=M+m*C,k=$*h+(m%2===0?15:-10);E.targetX=i+Math.cos(d)*k,E.targetY=l+Math.sin(d)*k,E.x===0&&E.y===0&&(E.x=E.targetX+(Math.random()-.5)*30,E.y=E.targetY+(Math.random()-.5)*30)})}const u=Math.min(r,n)*.42;_.forEach((C,M)=>{const E=Math.PI*2*M/Math.max(_.length,1)-Math.PI/2;C.targetX=i+Math.cos(E)*u,C.targetY=l+Math.sin(E)*u,C.x===0&&C.y===0&&(C.x=C.targetX+(Math.random()-.5)*40,C.y=C.targetY+(Math.random()-.5)*40);const m=y.get(C.id)||[];for(const d of m)d.targetX=C.targetX,d.targetY=C.targetY,d.x===0&&d.y===0&&(d.x=d.targetX,d.y=d.targetY)})}else{const f=[{x:r*.22,y:n*.32},{x:r*.68,y:n*.38},{x:r*.45,y:n*.72}];v.forEach((g,A)=>{const u=p.has(g.id),C=f[A%f.length];g.targetX=C.x,g.targetY=C.y,g.x===0&&g.y===0&&(g.x=g.targetX+(Math.random()-.5)*40,g.y=g.targetY+(Math.random()-.5)*40);const M=y.get(g.id)||[];if(u&&M.length>0){const E=M.length,m=Math.PI*2/E,d=-Math.PI/2;M.forEach((k,I)=>{const O=d+I*m,B=$*h+(I%2===0?15:-10);k.targetX=g.targetX+Math.cos(O)*B,k.targetY=g.targetY+Math.sin(O)*B,k.x===0&&k.y===0&&(k.x=k.targetX+(Math.random()-.5)*30,k.y=k.targetY+(Math.random()-.5)*30)})}else for(const E of M)E.targetX=g.targetX,E.targetY=g.targetY,E.x===0&&E.y===0&&(E.x=E.targetX,E.y=E.targetY)})}if(c.length>0){const f=l-40,g=50*h,A=[{x:i,y:f-g*.5},{x:i+g,y:f+g*.3},{x:i,y:f+g*1.1},{x:i-g,y:f+g*.3}],u={"peter-parker":0,stratus:1,"eval-engine":2,"telemetry-agent":3};c.forEach((C,M)=>{const E=u[C.id]??M%4,m=A[E];C.targetX=m.x,C.targetY=m.y,C.x===0&&C.y===0&&(C.x=m.x+(Math.random()-.5)*20,C.y=m.y+(Math.random()-.5)*20)})}if(x.length>0){const f=Math.min(r,n)*.44,g=Math.PI*2/x.length,A=Math.PI/6;x.forEach((u,C)=>{const M=A+C*g;u.targetX=i+Math.cos(M)*f,u.targetY=l+Math.sin(M)*f,u.x===0&&u.y===0&&(u.x=u.targetX+(Math.random()-.5)*50,u.y=u.targetY+(Math.random()-.5)*50)})}const P=t.filter(f=>f.isGtm||fe.has(f.id)||!f.parentGtm?!0:p.has(f.parentGtm));for(let f=0;f<6;f++)for(let g=0;g<P.length;g++)for(let A=g+1;A<P.length;A++){const u=P[g],C=P[A];if(u.isGtm&&C.parentGtm===u.id&&p.has(u.id)||C.isGtm&&u.parentGtm===C.id&&p.has(C.id))continue;const M=u.targetX-C.targetX,E=u.targetY-C.targetY,m=Math.sqrt(M*M+E*E),d=(u.radius+C.radius)*2.5;if(m<d&&m>0){const k=(d-m)*.2,I=M/m*k,O=E/m*k,B=u.isGtm||fe.has(u.id),X=C.isGtm||fe.has(C.id);B||(u.targetX+=I*(X?1:.5),u.targetY+=O*(X?1:.5)),X||(C.targetX-=I*(B?1:.5),C.targetY-=O*(B?1:.5))}}const S=60;for(const f of t)f.targetX=Math.max(S,Math.min(r-S,f.targetX)),f.targetY=Math.max(S,Math.min(n-S,f.targetY))}function Pe(t,r,n,s,o,i,l,a,h){const p=1-h;return[p*p*p*t+3*p*p*h*n+3*p*h*h*o+h*h*h*l,p*p*p*r+3*p*p*h*s+3*p*h*h*i+h*h*h*a]}function xt(t,r){const n=r.x-t.x,s=r.y-t.y,o=Math.sqrt(n*n+s*s),i=o>0?-s/o:0,l=o>0?n/o:0,a=Math.min(o*.25,70),h=(t.x+r.x)/2,p=(t.y+r.y)/2;return{sx:t.x,sy:t.y,c1x:h+i*a-n*.15,c1y:p+l*a-s*.15,c2x:h+i*a+n*.15,c2y:p+l*a+s*.15,ex:r.x,ey:r.y}}function pe(t,r){const n=parseInt(t.slice(1,3),16),s=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16);return`rgba(${n}, ${s}, ${o}, ${r})`}function at(t,r,n,s,o){return Math.max(0,Math.sqrt((t-n)**2+(r-s)**2)-o)}const Ne=`
|
|
6
|
-
attribute vec2 a_position;
|
|
7
|
-
void main() {
|
|
8
|
-
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
9
|
-
}
|
|
10
|
-
`,un=`
|
|
11
|
-
precision highp float;
|
|
12
|
-
uniform sampler2D u_scene;
|
|
13
|
-
uniform sampler2D u_bloom;
|
|
14
|
-
uniform vec2 u_resolution;
|
|
15
|
-
uniform float u_time;
|
|
16
|
-
|
|
17
|
-
float hash(vec2 p) {
|
|
18
|
-
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
void main() {
|
|
22
|
-
vec2 uv = gl_FragCoord.xy / u_resolution;
|
|
23
|
-
vec4 scene = texture2D(u_scene, uv);
|
|
24
|
-
vec4 bloom = texture2D(u_bloom, uv);
|
|
25
|
-
vec3 color = scene.rgb + bloom.rgb * 0.35;
|
|
26
|
-
float vignette = 1.0 - 0.4 * length((uv - 0.5) * 1.5);
|
|
27
|
-
color *= vignette;
|
|
28
|
-
float scan = 0.97 + 0.03 * sin(uv.y * u_resolution.y * 1.5 + u_time * 0.5);
|
|
29
|
-
color *= scan;
|
|
30
|
-
color += (hash(uv + u_time * 0.001) - 0.5) * 0.015;
|
|
31
|
-
color = pow(color, vec3(0.95));
|
|
32
|
-
gl_FragColor = vec4(color, 1.0);
|
|
33
|
-
}
|
|
34
|
-
`,pn=`
|
|
35
|
-
precision highp float;
|
|
36
|
-
uniform sampler2D u_texture;
|
|
37
|
-
uniform vec2 u_resolution;
|
|
38
|
-
uniform float u_radius;
|
|
39
|
-
void main() {
|
|
40
|
-
vec2 uv = gl_FragCoord.xy / u_resolution;
|
|
41
|
-
float texelSize = 1.0 / u_resolution.x;
|
|
42
|
-
vec3 result = vec3(0.0);
|
|
43
|
-
float weights[5];
|
|
44
|
-
weights[0] = 0.227027;
|
|
45
|
-
weights[1] = 0.1945946;
|
|
46
|
-
weights[2] = 0.1216216;
|
|
47
|
-
weights[3] = 0.054054;
|
|
48
|
-
weights[4] = 0.016216;
|
|
49
|
-
result += texture2D(u_texture, uv).rgb * weights[0];
|
|
50
|
-
for (int i = 1; i < 5; i++) {
|
|
51
|
-
float offset = float(i) * texelSize * u_radius;
|
|
52
|
-
result += texture2D(u_texture, uv + vec2(offset, 0.0)).rgb * weights[i];
|
|
53
|
-
result += texture2D(u_texture, uv - vec2(offset, 0.0)).rgb * weights[i];
|
|
54
|
-
}
|
|
55
|
-
gl_FragColor = vec4(result, 1.0);
|
|
56
|
-
}
|
|
57
|
-
`,hn=`
|
|
58
|
-
precision highp float;
|
|
59
|
-
uniform sampler2D u_texture;
|
|
60
|
-
uniform vec2 u_resolution;
|
|
61
|
-
uniform float u_radius;
|
|
62
|
-
void main() {
|
|
63
|
-
vec2 uv = gl_FragCoord.xy / u_resolution;
|
|
64
|
-
float texelSize = 1.0 / u_resolution.y;
|
|
65
|
-
vec3 result = vec3(0.0);
|
|
66
|
-
float weights[5];
|
|
67
|
-
weights[0] = 0.227027;
|
|
68
|
-
weights[1] = 0.1945946;
|
|
69
|
-
weights[2] = 0.1216216;
|
|
70
|
-
weights[3] = 0.054054;
|
|
71
|
-
weights[4] = 0.016216;
|
|
72
|
-
result += texture2D(u_texture, uv).rgb * weights[0];
|
|
73
|
-
for (int i = 1; i < 5; i++) {
|
|
74
|
-
float offset = float(i) * texelSize * u_radius;
|
|
75
|
-
result += texture2D(u_texture, uv + vec2(0.0, offset)).rgb * weights[i];
|
|
76
|
-
result += texture2D(u_texture, uv - vec2(0.0, offset)).rgb * weights[i];
|
|
77
|
-
}
|
|
78
|
-
gl_FragColor = vec4(result, 1.0);
|
|
79
|
-
}
|
|
80
|
-
`,fn=`
|
|
81
|
-
precision highp float;
|
|
82
|
-
uniform sampler2D u_texture;
|
|
83
|
-
uniform vec2 u_resolution;
|
|
84
|
-
uniform float u_threshold;
|
|
85
|
-
void main() {
|
|
86
|
-
vec2 uv = gl_FragCoord.xy / u_resolution;
|
|
87
|
-
vec4 color = texture2D(u_texture, uv);
|
|
88
|
-
float brightness = dot(color.rgb, vec3(0.2126, 0.7152, 0.0722));
|
|
89
|
-
float contribution = smoothstep(u_threshold, u_threshold + 0.15, brightness);
|
|
90
|
-
gl_FragColor = vec4(color.rgb * contribution * 1.5, 1.0);
|
|
91
|
-
}
|
|
92
|
-
`;function Bt(t,r,n){const s=t.createShader(n);return s?(t.shaderSource(s,r),t.compileShader(s),t.getShaderParameter(s,t.COMPILE_STATUS)?s:(console.error("Shader compile error:",t.getShaderInfoLog(s)),t.deleteShader(s),null)):null}function ze(t,r,n){const s=Bt(t,r,t.VERTEX_SHADER),o=Bt(t,n,t.FRAGMENT_SHADER);if(!s||!o)return null;const i=t.createProgram();return i?(t.attachShader(i,s),t.attachShader(i,o),t.linkProgram(i),t.getProgramParameter(i,t.LINK_STATUS)?i:(console.error("Program link error:",t.getProgramInfoLog(i)),null)):null}function Ue(t,r,n){const s=t.createFramebuffer(),o=t.createTexture();return!s||!o?null:(t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r,n,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,o,0),t.bindFramebuffer(t.FRAMEBUFFER,null),{fb:s,tex:o})}function gn(t,r,n,s){t.fillStyle=R.grid;for(let i=50;i<r;i+=50)for(let l=50;l<n;l+=50){const a=Math.sqrt((i-r/2)**2+(l-n/2)**2),h=Math.sin(s*3e-4+a*.004)*.3+.7;t.globalAlpha=.12*h,t.beginPath(),t.arc(i,l,.8,0,Math.PI*2),t.fill()}t.globalAlpha=1}function mn(t,r,n,s,o,i,l,a,h,p){var S,f;t.clearRect(0,0,r,n);const v=h||{scale:1,offsetX:0,offsetY:0},c=p||new Set,b=new Set,y=new Set,x=i||l;if(x)for(const g of o)(g.source===x||g.target===x)&&(b.add(g.source),b.add(g.target),y.add(g.id));gn(t,r,n,a),t.save(),t.translate(v.offsetX,v.offsetY),t.scale(v.scale,v.scale);const T=s.filter(g=>g.isGtm||fe.has(g.id)||!g.parentGtm?!0:c.has(g.parentGtm)),_=s.filter(g=>g.isGtm),$=new Map(s.map(g=>[g.id,g]));for(const g of _){if(!c.has(g.id))continue;const u=s.filter(m=>m.parentGtm===g.id);if(u.length===0)continue;let C=0;for(const m of u){const d=m.x-g.x,k=m.y-g.y,I=Math.sqrt(d*d+k*k)+m.radius+20;C=Math.max(C,I)}const M=Math.max(C,80);t.save(),t.globalAlpha=.08,t.strokeStyle=g.color,t.lineWidth=1,t.setLineDash([8,12]),t.beginPath(),t.arc(g.x,g.y,M,0,Math.PI*2),t.stroke(),t.setLineDash([]);const E=t.createRadialGradient(g.x,g.y,0,g.x,g.y,M);E.addColorStop(0,pe(g.color,.03)),E.addColorStop(.7,pe(g.color,.015)),E.addColorStop(1,pe(g.color,0)),t.fillStyle=E,t.beginPath(),t.arc(g.x,g.y,M,0,Math.PI*2),t.fill(),t.restore()}const w=s.filter(g=>fe.has(g.id));if(w.length>1){let g=0,A=0;for(const E of w)g+=E.x,A+=E.y;const u=g/w.length,C=A/w.length;let M=0;for(const E of w){const m=E.x-u,d=E.y-C,k=Math.sqrt(m*m+d*d)+E.radius+15;M=Math.max(M,k)}t.save(),t.globalAlpha=.06,t.strokeStyle=R.purple,t.lineWidth=1,t.setLineDash([4,8]),t.beginPath(),t.arc(u,C,M,0,Math.PI*2),t.stroke(),t.setLineDash([]),t.restore()}const P=new Set;for(const g of o){let A=$.get(g.source),u=$.get(g.target);if(!A||!u)continue;const C=A.parentGtm&&!c.has(A.parentGtm),M=u.parentGtm&&!c.has(u.parentGtm);if(C){const F=$.get(A.parentGtm);F&&(A=F)}if(M){const F=$.get(u.parentGtm);F&&(u=F)}if(A.id===u.id)continue;const E=`${A.id}->${u.id}`,m=C||M;if(m){if(P.has(E))continue;P.add(E)}const d=y.has(g.id)||C&&g.source&&((S=$.get(g.source))==null?void 0:S.parentGtm)===A.id||M&&g.target&&((f=$.get(g.target))==null?void 0:f.parentGtm)===u.id,k=y.size>0&&!d,{sx:I,sy:O,c1x:B,c1y:X,c2x:Z,c2y:ce,ex:de,ey:ae}=xt(A,u),be=Date.now()-g.lastFired,V=be<5e3,ke=V?1-be/5e3:0,G=g.active?d?.8:.35:.08,H=k?.05:Math.min(1,G+ke*.5),U=m?1.8:1;t.save(),t.globalAlpha=H*.4,t.strokeStyle=g.color,t.shadowColor=g.color,t.shadowBlur=d?20:V?14:8,t.lineWidth=(d?5:3)*U,t.beginPath(),t.moveTo(I,O),t.bezierCurveTo(B,X,Z,ce,de,ae),t.stroke(),t.restore(),t.save(),t.globalAlpha=H,t.strokeStyle=g.color,t.lineWidth=(d?2.5:1.2)*U,t.beginPath(),t.moveTo(I,O),t.bezierCurveTo(B,X,Z,ce,de,ae),t.stroke(),t.restore();const Q=.88,[te,se]=Pe(I,O,B,X,Z,ce,de,ae,Q),[W,J]=Pe(I,O,B,X,Z,ce,de,ae,Q+.04),q=Math.atan2(J-se,W-te),L=(d?9:6)*U;if(t.save(),t.globalAlpha=H,t.fillStyle=g.color,t.shadowColor=g.color,t.shadowBlur=6,t.translate(W,J),t.rotate(q),t.beginPath(),t.moveTo(0,0),t.lineTo(-L*1.2,-L*.5),t.lineTo(-L*1.2,L*.5),t.closePath(),t.fill(),t.restore(),g.active||V)for(const F of g.particles){const re=k?.05:F.alpha*(d?1:.6);for(let ye=F.trail.length-1;ye>=0;ye--){const nt=F.trail[ye];t.save(),t.globalAlpha=nt.a*re*.3,t.fillStyle=g.color,t.shadowColor=g.color,t.shadowBlur=F.size*2,t.beginPath(),t.arc(nt.x,nt.y,F.size*(1-ye*.1),0,Math.PI*2),t.fill(),t.restore()}const[ue,ge]=Pe(I,O,B,X,Z,ce,de,ae,F.t);t.save(),t.globalAlpha=re,t.fillStyle="#ffffff",t.shadowColor=g.color,t.shadowBlur=F.size*6,t.beginPath(),t.arc(ue,ge,F.size*.6,0,Math.PI*2),t.fill(),t.restore(),t.save(),t.globalAlpha=re*.7,t.fillStyle=g.color,t.shadowColor=g.color,t.shadowBlur=F.size*10,t.beginPath(),t.arc(ue,ge,F.size*1.2,0,Math.PI*2),t.fill(),t.restore()}}for(const g of T){const A=i===g.id,u=l===g.id,M=b.size>0&&!b.has(g.id)&&!A&&!u?.15:1,E=g.isGtm&&!c.has(g.id),m=Math.sin(a*.002+g.pulsePhase)*.15+.85,d=g.radius*(A?1.15:u?1.1:1);if(g.status==="running"||A||u){const O=d*(u?2.2:A?2:E?1.4:1.6)*m,B=t.createRadialGradient(g.x,g.y,d*.5,g.x,g.y,O);B.addColorStop(0,pe(g.color,.15*M)),B.addColorStop(.5,pe(g.color,.04*M)),B.addColorStop(1,pe(g.color,0)),t.fillStyle=B,t.beginPath(),t.arc(g.x,g.y,O,0,Math.PI*2),t.fill()}if(g.isGtm){const O=d*(E?1.3:1.6),B=(Math.sin(a*.002+g.pulsePhase)*.2+.4)*M;t.save(),t.globalAlpha=B*.25,t.strokeStyle=g.color,t.lineWidth=E?3:2.5,t.beginPath(),t.arc(g.x,g.y,O,0,Math.PI*2),t.stroke(),t.restore(),t.save(),t.globalAlpha=B*.15,t.strokeStyle=g.color,t.lineWidth=1,t.setLineDash([6,4]),t.beginPath(),t.arc(g.x,g.y,d*1.15,0,Math.PI*2),t.stroke(),t.setLineDash([]),t.restore()}else if(g.status==="running"){const O=(Math.sin(a*.003+g.pulsePhase)*.3+.5)*M,B=d*(1.5+Math.sin(a*.001+g.pulsePhase*2)*.3);t.save(),t.globalAlpha=O*.15,t.strokeStyle=g.color,t.lineWidth=1,t.setLineDash([4,6]),t.beginPath(),t.arc(g.x,g.y,B,0,Math.PI*2),t.stroke(),t.setLineDash([]),t.restore()}const k=t.createRadialGradient(g.x-d*.2,g.y-d*.2,0,g.x,g.y,d);k.addColorStop(0,pe(g.color,.3*M)),k.addColorStop(.7,pe(g.color,.12*M)),k.addColorStop(1,pe(g.color,.05*M)),t.save(),t.fillStyle=k,t.shadowColor=g.color,t.shadowBlur=u?25:A?18:E?15:10,t.globalAlpha=M,t.beginPath(),t.arc(g.x,g.y,d,0,Math.PI*2),t.fill(),t.restore(),t.save(),t.globalAlpha=M*(u?.9:A?.7:.4),t.strokeStyle=g.color,t.lineWidth=u?2:1.2,t.beginPath(),t.arc(g.x,g.y,d,0,Math.PI*2),t.stroke(),t.restore();const I=t.createRadialGradient(g.x,g.y,0,g.x,g.y,d*.35);I.addColorStop(0,pe("#ffffff",.6*M*m)),I.addColorStop(.5,pe(g.color,.4*M*m)),I.addColorStop(1,pe(g.color,0)),t.fillStyle=I,t.beginPath(),t.arc(g.x,g.y,d*.35,0,Math.PI*2),t.fill()}t.restore()}function Nt({data:t,color:r,width:n=48,height:s=16}){if(t.length<2)return null;const o=Math.max(...t),i=Math.min(...t),l=o-i||1,a=t.map((p,v)=>{const c=v/(t.length-1)*n,b=s-(p-i)/l*(s-2)-1;return`${c},${b}`}).join(" "),h=s-(t[t.length-1]-i)/l*(s-2)-1;return e("svg",{width:n,height:s,class:"shrink-0",children:[e("polyline",{points:a,fill:"none",stroke:r,"stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",opacity:"0.7"}),e("circle",{cx:String(n),cy:String(h),r:"2",fill:r,children:e("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"2s",repeatCount:"indefinite"})})]})}function xn(){var g,A;const t=me(null),r=me(null),n=me(0),s=me(!0),o=me({nodes:[],edges:[],hoveredNode:null,selectedNode:null,dragging:null,dragOffset:{x:0,y:0},mouse:{x:0,y:0},time:0,liveEventQueue:[],offscreenCanvas:null,offscreenCtx:null,gl:null,programs:{threshold:null,blurH:null,blurV:null,composite:null},fbos:{scene:null,bright:null,pingpong:[null,null]},quadVBO:null,sceneTexture:null,fboWidth:0,fboHeight:0}),[i,l]=j(null),[a,h]=j(!1),[p,v]=j([]),[,c]=j(0),[b,y]=j([]),[x,T]=j(new Set),[_,$]=j({scale:1,offsetX:0,offsetY:0}),w=me(!1),P=me({x:0,y:0,offsetX:0,offsetY:0}),S=$e(u=>{const C=o.current;if(!u||C.selectedNode===u.id)C.selectedNode=null,l(null);else{C.selectedNode=u.id;const M=C.edges.filter(k=>k.source===u.id||k.target===u.id),E=[];for(const k of M){const I=k.source===u.id,O=I?k.target:k.source,B=C.nodes.find(X=>X.id===O);B&&E.push({id:O,label:B.label,direction:I?"out":"in",eventType:k.eventType})}const m=p.filter(k=>{const I=k.type.toLowerCase(),O=u.id.toLowerCase();return I.includes(O.split("-")[0])||M.some(B=>I.startsWith(B.eventType.split(":")[0]))}).slice(0,8).map(k=>({type:k.type,ts:k.ts,data:"",source:void 0})),d=m.length>0?m:M.slice(0,5).map(k=>({type:k.eventType,ts:new Date(k.lastFired).toISOString(),data:`${k.source} -> ${k.target}`,source:k.source}));l({node:u,edges:M,recentEvents:d,connectedServices:E})}},[p]);ve(()=>{const u=t.current,C=r.current;if(!u||!C)return;const M=document.createElement("canvas"),E=M.getContext("2d");if(!E)return;const m=o.current;m.offscreenCanvas=M,m.offscreenCtx=E;const d=u.getContext("webgl",{alpha:!1,antialias:!1,premultipliedAlpha:!1});if(d){m.gl=d,m.programs.threshold=ze(d,Ne,fn),m.programs.blurH=ze(d,Ne,pn),m.programs.blurV=ze(d,Ne,hn),m.programs.composite=ze(d,Ne,un);const G=new Float32Array([-1,-1,1,-1,-1,1,1,1]),H=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,H),d.bufferData(d.ARRAY_BUFFER,G,d.STATIC_DRAW),m.quadVBO=H,m.sceneTexture=d.createTexture(),s.current=!0}else s.current=!1;const k=(G,H)=>{if(!d)return;const U=Math.floor(G/2),Q=Math.floor(H/2);m.fbos.scene=Ue(d,G,H),m.fbos.bright=Ue(d,U,Q),m.fbos.pingpong=[Ue(d,U,Q),Ue(d,U,Q)],m.fboWidth=G,m.fboHeight=H},I=()=>{const G=C.getBoundingClientRect(),H=Math.min(window.devicePixelRatio||1,2),U=Math.floor(G.width*H),Q=Math.floor(G.height*H);u.width=U,u.height=Q,u.style.width=G.width+"px",u.style.height=G.height+"px",M.width=U,M.height=Q,d&&(d.viewport(0,0,U,Q),k(U,Q)),N.topology().then(({nodes:te,edges:se})=>{if(te.length>=6){const{nodes:J,edges:q}=dn(te,se);m.nodes=J,m.edges=q,h(!0)}else{const{nodes:J,edges:q}=Ot();m.nodes=J,m.edges=q}const W=C.getBoundingClientRect();Be(m.nodes,W.width,W.height,m.edges,x),y([...m.nodes]),c(J=>J+1)}).catch(()=>{if(m.nodes.length===0){const{nodes:te,edges:se}=Ot();m.nodes=te,m.edges=se}Be(m.nodes,G.width,G.height,m.edges,x),y([...m.nodes]),c(te=>te+1)})};I(),window.addEventListener("resize",I);const O=(G,H)=>{const{scale:U,offsetX:Q,offsetY:te}=_;return{x:(G-Q)/U,y:(H-te)/U}},B=G=>{const H=u.getBoundingClientRect(),U=G.clientX-H.left,Q=G.clientY-H.top;if(m.mouse={x:U,y:Q},w.current){const L=U-P.current.x,F=Q-P.current.y;$(re=>({...re,offsetX:P.current.offsetX+L,offsetY:P.current.offsetY+F}));return}const{x:te,y:se}=O(U,Q);if(m.dragging){const L=m.nodes.find(F=>F.id===m.dragging);L&&(L.x=te-m.dragOffset.x,L.y=se-m.dragOffset.y,L.targetX=L.x,L.targetY=L.y);return}const W=m.nodes.filter(L=>L.isGtm||fe.has(L.id)||!L.parentGtm?!0:x.has(L.parentGtm));let J=null,q=1/0;for(const L of W){const F=at(L.x,L.y,te,se,L.radius*1.5);F<q&&F<20/_.scale&&(q=F,J=L)}m.hoveredNode=(J==null?void 0:J.id)||null,u.style.cursor=J?"pointer":w.current?"grabbing":"default"},X=G=>{const H=u.getBoundingClientRect(),U=G.clientX-H.left,Q=G.clientY-H.top,{x:te,y:se}=O(U,Q),W=m.nodes.filter(q=>q.isGtm||fe.has(q.id)||!q.parentGtm?!0:x.has(q.parentGtm));let J=null;for(const q of W)if(at(q.x,q.y,te,se,q.radius*1.5)<5/_.scale){J=q;break}J?(m.dragging=J.id,m.dragOffset={x:te-J.x,y:se-J.y}):(w.current=!0,P.current={x:U,y:Q,offsetX:_.offsetX,offsetY:_.offsetY},u.style.cursor="grabbing")},Z=G=>{const H=m.dragging,U=w.current,Q=u.getBoundingClientRect(),te=G.clientX-Q.left,se=G.clientY-Q.top,{x:W,y:J}=O(te,se);if(U){const F=Math.sqrt((te-P.current.x)**2+(se-P.current.y)**2);w.current=!1,u.style.cursor="default",F<5&&(m.selectedNode=null,l(null));return}if(H){const F=m.nodes.find(re=>re.id===H);if(m.dragging=null,F&&Math.sqrt((W-(m.dragOffset.x+F.targetX))**2+(J-(m.dragOffset.y+F.targetY))**2)<5/_.scale)if(F.isGtm){T(ge=>{const ye=new Set(ge);return ye.has(F.id)?ye.delete(F.id):ye.add(F.id),ye});const ue=C.getBoundingClientRect();setTimeout(()=>{Be(m.nodes,ue.width,ue.height,m.edges,x.has(F.id)?new Set([...x].filter(ge=>ge!==F.id)):new Set([...x,F.id])),c(ge=>ge+1)},10)}else S(F);return}const q=m.nodes.filter(F=>F.isGtm||fe.has(F.id)||!F.parentGtm?!0:x.has(F.parentGtm));let L=null;for(const F of q)if(at(F.x,F.y,W,J,F.radius*1.5)<5/_.scale){L=F;break}if(L)if(L.isGtm){T(re=>{const ue=new Set(re);return ue.has(L.id)?ue.delete(L.id):ue.add(L.id),ue});const F=C.getBoundingClientRect();setTimeout(()=>{Be(m.nodes,F.width,F.height,m.edges,x.has(L.id)?new Set([...x].filter(re=>re!==L.id)):new Set([...x,L.id])),c(re=>re+1)},10)}else S(L);else m.selectedNode=null,l(null)},ce=G=>{G.preventDefault();const H=u.getBoundingClientRect(),U=G.clientX-H.left,Q=G.clientY-H.top,te=G.deltaY<0?1.1:.9,se=Math.max(.3,Math.min(3,_.scale*te)),W=(U-_.offsetX)/_.scale,J=(Q-_.offsetY)/_.scale;$({scale:se,offsetX:U-W*se,offsetY:Q-J*se})},de=G=>{G.preventDefault(),$({scale:1,offsetX:0,offsetY:0})};u.addEventListener("mousemove",B),u.addEventListener("mousedown",X),u.addEventListener("mouseup",Z),u.addEventListener("wheel",ce,{passive:!1}),u.addEventListener("dblclick",de);function ae(G){if(!d||!m.quadVBO)return;d.useProgram(G),d.bindBuffer(d.ARRAY_BUFFER,m.quadVBO);const H=d.getAttribLocation(G,"a_position");d.enableVertexAttribArray(H),d.vertexAttribPointer(H,2,d.FLOAT,!1,0,0),d.drawArrays(d.TRIANGLE_STRIP,0,4)}let be=performance.now();const V=G=>{const H=G-be;be=G,m.time=G;for(const W of m.nodes)m.dragging!==W.id&&(W.x+=(W.targetX-W.x)*.06,W.y+=(W.targetY-W.y)*.06);for(const W of m.edges){if(!W.active&&Date.now()-W.lastFired>1e4)continue;const J=m.nodes.find(F=>F.id===W.source),q=m.nodes.find(F=>F.id===W.target);if(!J||!q)continue;const L=xt(J,q);for(const F of W.particles){F.t+=F.speed*(H/16),F.t>1&&(F.t-=1,F.speed=8e-4+Math.random()*.0015,F.trail=[]);const[re,ue]=Pe(L.sx,L.sy,L.c1x,L.c1y,L.c2x,L.c2y,L.ex,L.ey,F.t);F.trail.unshift({x:re,y:ue,a:F.alpha}),F.trail.length>8&&F.trail.pop();for(let ge=0;ge<F.trail.length;ge++)F.trail[ge].a*=.82}}const U=Math.min(window.devicePixelRatio||1,2),Q=C.getBoundingClientRect(),te=Q.width,se=Q.height;if(E&&(E.save(),E.scale(U,U),mn(E,te,se,m.nodes,m.edges,m.hoveredNode,m.selectedNode,G,_,x),E.restore()),d&&s.current&&m.sceneTexture&&m.fbos.scene&&m.fbos.bright&&m.fbos.pingpong[0]&&m.fbos.pingpong[1]){const W=m.fboWidth,J=m.fboHeight,q=Math.floor(W/2),L=Math.floor(J/2);d.bindTexture(d.TEXTURE_2D,m.sceneTexture),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,M),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),m.programs.threshold&&(d.bindFramebuffer(d.FRAMEBUFFER,m.fbos.bright.fb),d.viewport(0,0,q,L),d.useProgram(m.programs.threshold),d.activeTexture(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,m.sceneTexture),d.uniform1i(d.getUniformLocation(m.programs.threshold,"u_texture"),0),d.uniform2f(d.getUniformLocation(m.programs.threshold,"u_resolution"),q,L),d.uniform1f(d.getUniformLocation(m.programs.threshold,"u_threshold"),.45),ae(m.programs.threshold));const F=4;for(let re=0;re<F;re++){const ue=2+re*1.5;if(m.programs.blurH){const ge=re===0?m.fbos.bright:m.fbos.pingpong[1];d.bindFramebuffer(d.FRAMEBUFFER,m.fbos.pingpong[0].fb),d.viewport(0,0,q,L),d.useProgram(m.programs.blurH),d.activeTexture(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,ge.tex),d.uniform1i(d.getUniformLocation(m.programs.blurH,"u_texture"),0),d.uniform2f(d.getUniformLocation(m.programs.blurH,"u_resolution"),q,L),d.uniform1f(d.getUniformLocation(m.programs.blurH,"u_radius"),ue),ae(m.programs.blurH)}m.programs.blurV&&(d.bindFramebuffer(d.FRAMEBUFFER,m.fbos.pingpong[1].fb),d.viewport(0,0,q,L),d.useProgram(m.programs.blurV),d.activeTexture(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,m.fbos.pingpong[0].tex),d.uniform1i(d.getUniformLocation(m.programs.blurV,"u_texture"),0),d.uniform2f(d.getUniformLocation(m.programs.blurV,"u_resolution"),q,L),d.uniform1f(d.getUniformLocation(m.programs.blurV,"u_radius"),ue),ae(m.programs.blurV))}m.programs.composite&&(d.bindFramebuffer(d.FRAMEBUFFER,null),d.viewport(0,0,W,J),d.useProgram(m.programs.composite),d.activeTexture(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,m.sceneTexture),d.uniform1i(d.getUniformLocation(m.programs.composite,"u_scene"),0),d.activeTexture(d.TEXTURE1),d.bindTexture(d.TEXTURE_2D,m.fbos.pingpong[1].tex),d.uniform1i(d.getUniformLocation(m.programs.composite,"u_bloom"),1),d.uniform2f(d.getUniformLocation(m.programs.composite,"u_resolution"),W,J),d.uniform1f(d.getUniformLocation(m.programs.composite,"u_time"),G*.001),ae(m.programs.composite))}else if(!s.current){const W=u.getContext("2d");W&&M&&(W.clearRect(0,0,u.width,u.height),W.drawImage(M,0,0))}n.current=requestAnimationFrame(V)};n.current=requestAnimationFrame(V);let ke=null;try{ke=hr("/api/events/stream",G=>{h(!0);const H=G;v(U=>[{type:H.type,ts:H.ts},...U].slice(0,20));for(const U of m.edges)(H.type===U.eventType||H.type.startsWith(U.eventType.split(":")[0]+":"))&&(U.lastFired=Date.now(),U.active=!0,U.particles.push({t:0,speed:.003+Math.random()*.002,size:3.5,alpha:1,trail:[]}),setTimeout(()=>{U.particles.length>10&&U.particles.shift()},3e3))})}catch{}return()=>{window.removeEventListener("resize",I),u.removeEventListener("mousemove",B),u.removeEventListener("mousedown",X),u.removeEventListener("mouseup",Z),u.removeEventListener("wheel",ce),u.removeEventListener("dblclick",de),cancelAnimationFrame(n.current),ke==null||ke()}},[S,_,x]);const f=o.current;return e("div",{class:"flex h-[calc(100vh-3rem)] gap-0",children:[e("div",{ref:r,class:"flex-1 relative overflow-hidden",style:{background:R.bg},children:[e("style",{children:`
|
|
93
|
-
@keyframes topo-breathe {
|
|
94
|
-
0%, 100% { opacity: 0.25; }
|
|
95
|
-
50% { opacity: 0.5; }
|
|
96
|
-
}
|
|
97
|
-
@keyframes topo-float-1 {
|
|
98
|
-
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
99
|
-
33% { transform: translate(25px, -18px) scale(1.05); }
|
|
100
|
-
66% { transform: translate(-12px, 14px) scale(0.95); }
|
|
101
|
-
}
|
|
102
|
-
@keyframes topo-float-2 {
|
|
103
|
-
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
104
|
-
33% { transform: translate(-30px, 12px) scale(1.08); }
|
|
105
|
-
66% { transform: translate(18px, -24px) scale(0.92); }
|
|
106
|
-
}
|
|
107
|
-
@keyframes topo-float-3 {
|
|
108
|
-
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
109
|
-
33% { transform: translate(14px, 22px) scale(0.96); }
|
|
110
|
-
66% { transform: translate(-22px, -14px) scale(1.04); }
|
|
111
|
-
}
|
|
112
|
-
.topo-orb-1 { animation: topo-float-1 12s ease-in-out infinite; }
|
|
113
|
-
.topo-orb-2 { animation: topo-float-2 15s ease-in-out infinite; }
|
|
114
|
-
.topo-orb-3 { animation: topo-float-3 18s ease-in-out infinite; }
|
|
115
|
-
@keyframes topo-status-pulse {
|
|
116
|
-
0%, 100% { box-shadow: 0 0 4px currentColor; opacity: 1; }
|
|
117
|
-
50% { box-shadow: 0 0 10px currentColor; opacity: 0.7; }
|
|
118
|
-
}
|
|
119
|
-
.topo-status-pulse { animation: topo-status-pulse 2s ease-in-out infinite; }
|
|
120
|
-
`}),e("div",{class:"absolute inset-0 pointer-events-none overflow-hidden",style:{zIndex:0},children:[e("div",{class:"absolute rounded-full topo-orb-1",style:{width:"360px",height:"360px",left:"12%",top:"18%",background:`radial-gradient(circle, ${pe(R.info,.06)} 0%, transparent 70%)`,filter:"blur(40px)"}}),e("div",{class:"absolute rounded-full topo-orb-2",style:{width:"400px",height:"400px",right:"10%",bottom:"15%",background:`radial-gradient(circle, ${pe(R.purple,.05)} 0%, transparent 70%)`,filter:"blur(50px)"}}),e("div",{class:"absolute rounded-full topo-orb-3",style:{width:"280px",height:"280px",left:"45%",top:"40%",background:`radial-gradient(circle, ${pe(R.cyan,.04)} 0%, transparent 70%)`,filter:"blur(35px)"}})]}),e("canvas",{ref:t,class:"absolute inset-0 w-full h-full",style:{zIndex:1,pointerEvents:"none"}}),f.nodes.length>0&&e("div",{class:"absolute inset-0 pointer-events-none",style:{zIndex:5},children:[f.nodes.filter(u=>u.isGtm).map(u=>{const C=f.nodes.filter(m=>m.parentGtm===u.id);let M=u.y;for(const m of C)M=Math.min(M,m.y-m.radius);const E=M-45;return e("div",{class:"absolute",style:{left:`${u.x}px`,top:`${Math.max(20,E)}px`,transform:"translateX(-50%)"},children:e("span",{style:{fontSize:"9px",fontFamily:"'JetBrains Mono', monospace",fontWeight:600,padding:"3px 10px",borderRadius:"12px",color:u.color,background:"rgba(15, 15, 18, 0.7)",border:`1px solid ${u.color}30`,textTransform:"uppercase",letterSpacing:"1.5px"},children:u.label.replace(/-gtm$/i,"").toUpperCase()})},`cluster-${u.id}`)}),f.nodes.filter(u=>fe.has(u.id)).length>1&&(()=>{const u=f.nodes.filter(d=>fe.has(d.id));let C=0,M=1/0;for(const d of u)C+=d.x,M=Math.min(M,d.y-d.radius);const E=C/u.length,m=M-35;return e("div",{class:"absolute",style:{left:`${E}px`,top:`${Math.max(20,m)}px`,transform:"translateX(-50%)"},children:e("span",{style:{fontSize:"8px",fontFamily:"'JetBrains Mono', monospace",fontWeight:500,padding:"2px 8px",borderRadius:"10px",color:R.purple,background:"rgba(15, 15, 18, 0.6)",border:`1px solid ${R.purple}25`,textTransform:"uppercase",letterSpacing:"1px"},children:"SYSTEM"})})})()]}),b.length>0&&e("div",{class:"absolute inset-0 pointer-events-none",style:{zIndex:2,transform:`translate(${_.offsetX}px, ${_.offsetY}px) scale(${_.scale})`,transformOrigin:"0 0"},children:b.filter(u=>u.isGtm||fe.has(u.id)||!u.parentGtm?!0:x.has(u.parentGtm)).map(u=>{const C=f.hoveredNode===u.id,M=f.selectedNode===u.id,E=f.hoveredNode||f.selectedNode,m=new Set;if(E)for(const I of f.edges)(I.source===E||I.target===E)&&(m.add(I.source),m.add(I.target));const d=m.size>0&&!m.has(u.id)&&!C&&!M,k=u.isGtm&&!x.has(u.id);return e("div",{class:"absolute pointer-events-auto",style:{left:`${u.x}px`,top:`${u.y+u.radius+14}px`,transform:`translateX(-50%) scale(${1/_.scale})`,transformOrigin:"center top",transition:"opacity 0.3s ease",opacity:d?.15:C||M?1:.8,cursor:u.isGtm?"pointer":"default"},children:e("div",{style:{background:M?"rgba(18, 18, 22, 0.92)":"rgba(18, 18, 22, 0.75)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",border:`1px solid ${M?u.color+"55":C?u.color+"33":"rgba(255,255,255,0.06)"}`,borderRadius:"10px",padding:k?"10px 14px":"8px 12px",whiteSpace:"nowrap",boxShadow:M?`0 0 24px ${u.color}22, 0 4px 16px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06)`:"0 2px 10px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04)",transition:"border-color 0.25s ease, box-shadow 0.3s ease"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[e("span",{class:D("topo-status-pulse"),style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,backgroundColor:De(u.status),color:De(u.status),display:(u.status==="running","block"),boxShadow:u.status==="running"?void 0:"none",animation:u.status==="running"?void 0:"none"}}),e("span",{style:{fontSize:k?"13px":u.isGtm?"12px":"11px",fontWeight:u.isGtm?700:600,color:R.text},children:cn(u.label,u.isGtm?20:16)}),k&&u.childCount?e("span",{style:{fontSize:"9px",fontFamily:"'JetBrains Mono', monospace",padding:"2px 6px",borderRadius:"6px",backgroundColor:`${u.color}20`,color:u.color},children:[u.childCount," services"]}):e("span",{style:{fontSize:"8px",fontFamily:"'JetBrains Mono', monospace",padding:"1px 5px",borderRadius:"4px",backgroundColor:`${u.color}18`,color:u.color,textTransform:"uppercase",letterSpacing:"0.5px"},children:u.type})]}),e("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"5px",gap:"8px"},children:[e("span",{style:{fontSize:"9px",fontFamily:"'JetBrains Mono', monospace",color:R.textMuted},children:[u.eventCount," events"]}),e(Nt,{data:k&&u.aggregateReward?u.aggregateReward:u.reward,color:u.color,width:k?60:48,height:14})]}),k&&e("div",{style:{marginTop:"6px",fontSize:"8px",color:R.textDim,textAlign:"center"},children:"click to expand"})]})},u.id)})}),f.edges.length>0&&e("div",{class:"absolute inset-0 pointer-events-none",style:{zIndex:3,transform:`translate(${_.offsetX}px, ${_.offsetY}px) scale(${_.scale})`,transformOrigin:"0 0"},children:f.edges.map(u=>{const C=f.nodes.find(I=>I.id===u.source),M=f.nodes.find(I=>I.id===u.target);if(!C||!M||!(f.hoveredNode===u.source||f.hoveredNode===u.target||f.selectedNode===u.source||f.selectedNode===u.target))return null;const m=xt(C,M),[d,k]=Pe(m.sx,m.sy,m.c1x,m.c1y,m.c2x,m.c2y,m.ex,m.ey,.5);return e("div",{class:"absolute",style:{left:`${d}px`,top:`${k}px`,transform:`translate(-50%, -50%) scale(${1/_.scale})`},children:e("span",{style:{fontSize:"8px",fontFamily:"'JetBrains Mono', monospace",padding:"2px 6px",borderRadius:"5px",color:u.color,background:"rgba(15, 15, 18, 0.88)",border:`1px solid ${u.color}33`,backdropFilter:"blur(6px)",letterSpacing:"0.05em"},children:u.eventType})},u.id)})}),e("div",{class:"absolute top-5 left-5 flex items-center gap-3",style:{zIndex:10},children:[e("h1",{class:"text-base font-semibold tracking-tight",style:{color:R.text},children:"Agent Topology"}),e("span",{class:D("text-[9px] mono px-2 py-0.5 rounded-full tracking-widest uppercase",a?"text-success":"text-muted-foreground"),style:{background:a?"rgba(52, 211, 153, 0.1)":"rgba(90, 90, 90, 0.2)",border:`1px solid ${a?"rgba(52, 211, 153, 0.2)":"rgba(90, 90, 90, 0.15)"}`},children:a?"LIVE":"MOCK"})]}),e("div",{class:"absolute bottom-5 left-5 flex items-center gap-4",style:{zIndex:10},children:[{color:R.cyan,label:"GTM",isGtm:!0},{color:R.info,label:"Agent"},{color:R.purple,label:"Orchestrator"},{color:R.warning,label:"Eval"},{color:R.success,label:"Service"}].map(u=>e("div",{class:"flex items-center gap-1.5",children:[e("span",{style:{width:u.isGtm?"10px":"6px",height:u.isGtm?"10px":"6px",borderRadius:"50%",backgroundColor:u.color,boxShadow:`0 0 6px ${u.color}88`,border:u.isGtm?`1.5px solid ${u.color}`:"none"}}),e("span",{class:"text-[9px] uppercase tracking-wider",style:{color:R.textMuted},children:u.label})]},u.label))}),e("div",{class:"absolute bottom-5 flex items-center gap-4",style:{zIndex:10,right:i?"336px":"20px",transition:"right 0.3s ease"},children:[{color:R.info,label:"Data"},{color:R.success,label:"Success"},{color:R.purple,label:"RL"}].map(u=>e("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[e("svg",{width:"20",height:"4",style:{flexShrink:0},children:e("line",{x1:"0",y1:"2",x2:"20",y2:"2",stroke:u.color,"stroke-width":"1.5","stroke-dasharray":"6 4"})}),e("span",{class:"text-[9px]",style:{color:R.textMuted},children:u.label})]},u.label))}),p.length>0&&e("div",{class:"absolute bottom-5 max-w-60",style:{zIndex:10,right:i?"336px":"20px",bottom:"40px",transition:"right 0.3s ease"},children:[e("div",{class:"text-[9px] uppercase tracking-widest font-medium mb-1.5",style:{color:R.textDim},children:"Live Events"}),e("div",{class:"space-y-0.5 max-h-28 overflow-hidden",children:p.slice(0,6).map((u,C)=>e("div",{class:"text-[9px] mono truncate animate-fade-in",style:{opacity:1-C*.14,color:R.textDim},children:[e("span",{style:{color:R.info},children:u.type})," ",e("span",{style:{opacity:.5},children:le(u.ts)})]},`${u.ts}-${C}`))})]}),e("div",{class:"absolute",style:{right:i?"336px":"20px",bottom:"140px",width:"180px",height:"100px",background:"rgba(12, 12, 15, 0.85)",border:"1px solid rgba(60, 60, 60, 0.3)",borderRadius:"6px",overflow:"hidden",zIndex:10,transition:"right 0.3s ease"},onClick:u=>{const C=u.currentTarget.getBoundingClientRect(),M=u.clientX-C.left,E=u.clientY-C.top,m=o.current;if(m.nodes.length===0)return;let d=1/0,k=-1/0,I=1/0,O=-1/0;m.nodes.forEach(V=>{d=Math.min(d,V.x),k=Math.max(k,V.x),I=Math.min(I,V.y),O=Math.max(O,V.y)});const B=50;d-=B,k+=B,I-=B,O+=B;const X=k-d,Z=O-I,ce=d+M/180*X,de=I+E/100*Z,ae=t.current;if(!ae)return;const{scale:be}=_;$({scale:be,offsetX:ae.width/2-ce*be,offsetY:ae.height/2-de*be})},children:e("svg",{width:"180",height:"100",style:{display:"block"},children:(()=>{const u=o.current;if(u.nodes.length===0)return null;let C=1/0,M=-1/0,E=1/0,m=-1/0;u.nodes.forEach(V=>{C=Math.min(C,V.x),M=Math.max(M,V.x),E=Math.min(E,V.y),m=Math.max(m,V.y)});const d=50;C-=d,M+=d,E-=d,m+=d;const k=M-C,I=m-E,O=u.nodes.filter(V=>V.isGtm||!V.parentGtm?!0:x.has(V.parentGtm)),B=V=>(V-C)/k*180,X=V=>(V-E)/I*100,Z=t.current,ce=Z?-_.offsetX/_.scale:0,de=Z?-_.offsetY/_.scale:0,ae=Z?Z.width/_.scale:k,be=Z?Z.height/_.scale:I;return e(ie,{children:[O.map(V=>{const G=V.isGtm&&!x.has(V.id)?5:V.isGtm?4:2;return e("circle",{cx:B(V.x),cy:X(V.y),r:G,fill:V.color,opacity:.8},V.id)}),e("rect",{x:B(ce),y:X(de),width:ae/k*180,height:be/I*100,fill:"none",stroke:R.info,"stroke-width":"1",opacity:.6})]})})()})})]}),i&&e("div",{class:"w-80 overflow-y-auto animate-slide-in",style:{background:"rgba(18, 18, 22, 0.95)",borderLeft:"1px solid rgba(60, 60, 60, 0.2)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",flexShrink:0},children:[e("div",{class:"p-4",style:{borderBottom:"1px solid rgba(60, 60, 60, 0.2)"},children:[e("div",{class:"flex items-center justify-between mb-3",children:[e("div",{class:"flex items-center gap-2.5",children:[e("span",{class:"w-3 h-3 rounded-full",style:{backgroundColor:i.node.color,boxShadow:`0 0 10px ${i.node.color}66`}}),e("h2",{class:"font-semibold text-sm",style:{color:R.text},children:i.node.label})]}),e("button",{onClick:()=>{o.current.selectedNode=null,l(null)},class:"p-1 rounded transition-colors",style:{color:R.textMuted,background:"none",border:"none",cursor:"pointer"},children:e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",children:e("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),e("div",{class:"flex items-center gap-2 flex-wrap",children:[e("span",{class:"text-[9px] mono px-2 py-0.5 rounded-full uppercase tracking-wider",style:{backgroundColor:De(i.node.status)+"15",color:De(i.node.status),border:`1px solid ${De(i.node.status)}22`},children:i.node.status}),e("span",{class:"text-[9px] mono px-2 py-0.5 rounded-full uppercase tracking-wider",style:{backgroundColor:i.node.color+"15",color:i.node.color,border:`1px solid ${i.node.color}22`},children:i.node.type})]}),(((g=i.node.produces)==null?void 0:g.length)||((A=i.node.consumes)==null?void 0:A.length))&&e("div",{class:"mt-3 space-y-2",children:[i.node.produces&&i.node.produces.length>0&&e("div",{children:[e("span",{class:"text-[8px] uppercase tracking-widest",style:{color:R.textDim},children:"produces"}),e("div",{class:"flex flex-wrap gap-1 mt-1",children:i.node.produces.map(u=>e("span",{class:"text-[8px] mono px-1.5 py-0.5 rounded",style:{background:`${R.success}15`,color:R.success,border:`1px solid ${R.success}25`},children:u},u))})]}),i.node.consumes&&i.node.consumes.length>0&&e("div",{children:[e("span",{class:"text-[8px] uppercase tracking-widest",style:{color:R.textDim},children:"consumes"}),e("div",{class:"flex flex-wrap gap-1 mt-1",children:i.node.consumes.map(u=>e("span",{class:"text-[8px] mono px-1.5 py-0.5 rounded",style:{background:`${R.info}15`,color:R.info,border:`1px solid ${R.info}25`},children:u},u))})]})]})]}),e("div",{class:"p-4 space-y-5",children:[e("div",{children:[e("div",{class:"text-[9px] uppercase tracking-widest font-medium mb-2.5",style:{color:R.textDim},children:"Stats"}),e("div",{class:"grid grid-cols-2 gap-2",children:[e("div",{class:"rounded-lg p-3",style:{background:"rgba(40, 40, 44, 0.4)",border:"1px solid rgba(60, 60, 60, 0.15)"},children:[e("div",{class:"text-[9px] uppercase tracking-wider",style:{color:R.textDim},children:"Events"}),e("div",{class:"text-lg font-semibold mono tabular-nums mt-1",style:{color:R.text},children:i.node.eventCount})]}),e("div",{class:"rounded-lg p-3",style:{background:"rgba(40, 40, 44, 0.4)",border:"1px solid rgba(60, 60, 60, 0.15)"},children:[e("div",{class:"text-[9px] uppercase tracking-wider",style:{color:R.textDim},children:"Connections"}),e("div",{class:"text-lg font-semibold mono tabular-nums mt-1",style:{color:R.text},children:i.edges.length})]})]})]}),e("div",{children:[e("div",{class:"text-[9px] uppercase tracking-widest font-medium mb-2",style:{color:R.textDim},children:"Reward Signal"}),e("div",{class:"rounded-lg p-3",style:{background:"rgba(40, 40, 44, 0.4)",border:"1px solid rgba(60, 60, 60, 0.15)"},children:[e(Nt,{data:i.node.reward,color:i.node.color,width:220,height:40}),e("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"6px"},children:[e("span",{class:"text-[9px] mono",style:{color:R.textMuted},children:"7 sessions"}),e("span",{class:"text-[9px] mono",style:{color:i.node.color},children:[(i.node.reward[i.node.reward.length-1]*100).toFixed(0),"%"]})]})]})]}),e("div",{children:[e("div",{class:"text-[9px] uppercase tracking-widest font-medium mb-2",style:{color:R.textDim},children:"Last Action"}),e("div",{class:"text-xs",style:{color:R.text,opacity:.8},children:i.node.lastAction}),e("div",{class:"text-[9px] mono mt-1",style:{color:R.textMuted},children:i.node.lastTs?le(i.node.lastTs):"--"})]}),e("div",{children:[e("div",{class:"text-[9px] uppercase tracking-widest font-medium mb-2",style:{color:R.textDim},children:["Connected Services (",i.connectedServices.length,")"]}),e("div",{class:"space-y-3",children:[i.connectedServices.filter(u=>u.direction==="in").length>0&&e("div",{children:[e("div",{class:"text-[8px] uppercase tracking-wider mb-1.5 flex items-center gap-1.5",style:{color:R.info},children:[e("svg",{width:"10",height:"6",viewBox:"0 0 10 6",children:e("path",{d:"M10 3H2M4 0.5L1 3l3 2.5",fill:"none",stroke:R.info,"stroke-width":"1.2"})}),"feeds into"]}),e("div",{class:"space-y-1",children:i.connectedServices.filter(u=>u.direction==="in").map(u=>e("div",{class:"flex items-center gap-2 text-xs pl-3",children:[e("span",{style:{color:R.text},children:u.label}),e("span",{class:"mono text-[8px] ml-auto",style:{color:R.textDim},children:u.eventType})]},u.id))})]}),i.connectedServices.filter(u=>u.direction==="out").length>0&&e("div",{children:[e("div",{class:"text-[8px] uppercase tracking-wider mb-1.5 flex items-center gap-1.5",style:{color:R.success},children:[e("svg",{width:"10",height:"6",viewBox:"0 0 10 6",children:e("path",{d:"M0 3h8M6 0.5l3 2.5-3 2.5",fill:"none",stroke:R.success,"stroke-width":"1.2"})}),"feeds out to"]}),e("div",{class:"space-y-1",children:i.connectedServices.filter(u=>u.direction==="out").map(u=>e("div",{class:"flex items-center gap-2 text-xs pl-3",children:[e("span",{style:{color:R.text},children:u.label}),e("span",{class:"mono text-[8px] ml-auto",style:{color:R.textDim},children:u.eventType})]},u.id))})]})]})]}),i.recentEvents.length>0&&e("div",{children:[e("div",{class:"text-[9px] uppercase tracking-widest font-medium mb-2",style:{color:R.textDim},children:"Recent Activity"}),e("div",{class:"space-y-1",children:i.recentEvents.map((u,C)=>e("div",{class:"flex items-center justify-between text-[9px]",children:[e("span",{class:"mono",style:{color:R.info},children:u.type}),e("span",{class:"mono",style:{color:R.textMuted},children:le(u.ts)})]},C))})]})]}),e("div",{class:"p-4",style:{borderTop:"1px solid rgba(60, 60, 60, 0.15)"},children:e("div",{class:"text-[8px] mono tracking-wider",style:{color:R.textDim,opacity:.5},children:"Canvas 2D + WebGL Bloom / 4-pass Gaussian"})})]})]})}function vn(t,r){const n=[];for(const o of t){if(o.type==="session:started"||o.type==="session:ended")continue;const i=o.data||{};let l,a;if(o.type==="hook:tool-use"){const h=i.tool_name||"tool",p=i.file_paths||[];l=p.length>0?`${h} → ${p[0]}${p.length>1?` +${p.length-1}`:""}`:h,a=i.hook_event_name||o.source}else o.type==="hook:subagent-start"||o.type==="hook:subagent-stop"?(l=`Agent ${o.type==="hook:subagent-start"?"started":"stopped"}`,a=o.source):(l=i.title||o.type,a=i.summary||o.source);n.push({id:o.id,ts:o.ts,kind:"event",type:o.type,title:l,detail:a,source:o.source,data:o.data})}for(const o of r)o.type!=="file"&&n.push({id:`j-${o.timestamp}-${o.title}`,ts:o.timestamp,kind:"journal",type:o.type,title:o.title,detail:o.content,source:o.source});n.sort((o,i)=>i.ts.localeCompare(o.ts));const s=new Set;return n.filter(o=>{const i=`${o.kind}-${o.title}-${o.ts.slice(0,16)}`;return s.has(i)?!1:(s.add(i),!0)})}function bn(t){const r={},n=new Date().toISOString().slice(0,10),s=new Date(Date.now()-864e5).toISOString().slice(0,10);for(const o of t){const i=o.ts.slice(0,10),l=i===n?"Today":i===s?"Yesterday":i;r[l]||(r[l]=[]),r[l].push(o)}return r}const yn=[{label:"All",filter:""},{label:"Eval",filter:"eval"},{label:"Agent",filter:"peter"},{label:"Decision",filter:"decision"},{label:"Feature",filter:"feature"},{label:"Fix",filter:"fix"},{label:"Flow",filter:"flow"},{label:"Telemetry",filter:"telemetry"}],_n={event:"●",journal:"◆"},wn={"eval:scored":"text-info","peter:pr-created":"text-warning","peter:pr-proposed":"text-warning","telemetry:insight":"text-accent-foreground","flow:triggered":"text-info/70","flow:completed":"text-success",feature:"text-success",fix:"text-destructive",decision:"text-warning",milestone:"text-info",discovery:"text-info/70"};function kn(){var $;const[t,r]=j([]),[n,s]=j(""),[o,i]=j(""),[l,a]=j(new Set),h=K(()=>N.events(200),1e4),p=K(()=>N.journal(),1e4),v=fr("/api/events/stream",$e(w=>{r(P=>[w,...P].slice(0,50))},[])),b=[...t,...(($=h.data)==null?void 0:$.events)||[]].filter((w,P,S)=>S.findIndex(f=>f.id===w.id)===P),x=vn(b,p.data||[]).filter(w=>{var P;if(n&&!w.type.toLowerCase().includes(n))return!1;if(o){const S=o.toLowerCase();return w.title.toLowerCase().includes(S)||((P=w.detail)==null?void 0:P.toLowerCase().includes(S))||w.type.toLowerCase().includes(S)}return!0}),T=bn(x),_=w=>{a(P=>{const S=new Set(P);return S.has(w)?S.delete(w):S.add(w),S})};return e("div",{class:"space-y-5",children:[e("div",{class:"flex items-center justify-between",children:[e("h1",{class:"text-xl font-semibold",children:"Activity"}),e("div",{class:"flex items-center gap-3",children:[v.connected&&e("span",{class:"text-xs text-success mono animate-pulse-dot",children:"LIVE"}),e("span",{class:"text-sm text-muted-foreground",children:[x.length," items"]})]})]}),e("div",{class:"relative",children:[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:[e("circle",{cx:"11",cy:"11",r:"8"}),e("path",{d:"m21 21-4.3-4.3"})]}),e("input",{type:"text",placeholder:"Search activity...",value:o,onInput:w=>i(w.target.value),class:"w-full bg-card border border-border rounded-lg pl-10 pr-4 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-info/50 transition-colors"})]}),e("div",{class:"flex flex-wrap gap-1.5",children:yn.map(w=>e("button",{onClick:()=>s(n===w.filter?"":w.filter),class:D("text-[11px] mono font-medium px-2 py-0.5 rounded-md transition-colors",n===w.filter?"bg-foreground/10 text-foreground":"bg-muted/50 text-muted-foreground hover:text-foreground"),children:w.label},w.filter))}),Object.entries(T).map(([w,P])=>e("div",{children:[e("div",{class:"text-[10px] uppercase tracking-widest text-muted-foreground font-medium mb-2 sticky top-0 bg-background py-1",children:w}),e("div",{class:"space-y-0.5",children:P.map(S=>{var M,E,m;const f=l.has(S.id),g=wn[S.type]||"text-foreground",A=_n[S.kind]||"○",u=(M=S.data)==null?void 0:M.delta,C=((E=S.data)==null?void 0:E.improved)==="true"||((m=S.data)==null?void 0:m.improved)===!0;return e("button",{onClick:()=>_(S.id),class:"w-full text-left flex items-start gap-3 py-2 px-3 rounded hover:bg-muted/30 transition-colors animate-fade-in",children:[e("span",{class:"text-[10px] text-muted-foreground mono whitespace-nowrap mt-0.5 w-14 shrink-0",children:le(S.ts)}),e("span",{class:D("text-xs mt-0.5 shrink-0",S.kind==="journal"?"text-success":"text-info"),children:A}),e("div",{class:"flex-1 min-w-0",children:[e("div",{class:"flex items-center gap-2",children:[e("span",{class:D("text-xs mono font-medium whitespace-nowrap",g),children:S.type}),e("span",{class:"text-sm truncate",children:S.title}),u!=null&&e("span",{class:D("text-xs mono ml-auto shrink-0",C?"text-success":"text-destructive"),children:[u>=0?"+":"",Number(u).toFixed(3)]})]}),f&&S.detail&&e("div",{class:"text-xs text-muted-foreground mt-1 whitespace-pre-wrap",children:S.detail}),f&&S.files&&S.files.length>0&&e("div",{class:"flex flex-wrap gap-1 mt-1",children:S.files.map(d=>e("span",{class:"text-[10px] mono bg-muted/50 px-1.5 py-0.5 rounded",children:d},d))})]})]},S.id)})})]},w)),x.length===0&&e("div",{class:"bg-card rounded-lg border border-border p-8 text-center text-sm text-muted-foreground",children:o||n?"No matching activity":"No activity yet"})]})}function Sn(t){if(!t)return;const r=t.match(/autoresearch-r(\d+)/);if(r)return`Round ${r[1]}`;let n=t.replace(/^pp\//,"").replace(/^feature\//,"").replace(/-\d{10,}$/,"").replace(/-/g," ");return n&&(n=n.charAt(0).toUpperCase()+n.slice(1)),n||void 0}function Cn(t){return t.map(r=>{var n,s,o;return{ts:r.ts,branch:r.branch,prNumber:r.pr_number,delta:(n=r.delta)==null?void 0:n.composite,composite:r.composite,improved:r.improved,agent:r.agent,testsTotal:(s=r.metrics)==null?void 0:s.tests_total,testsPassed:(o=r.metrics)==null?void 0:o.tests_passed,description:Sn(r.branch)||r.notes}})}function Mn(){var w,P,S;const t=K(()=>N.events(500),15e3),r=K(()=>N.leaderboard(),15e3),n=K(()=>N.flowExecutions(),15e3),s=K(()=>N.evalEntries(100),15e3),o=((w=t.data)==null?void 0:w.events)||[],i=r.data||[],l=n.data||[],a=((P=s.data)==null?void 0:P.entries)||[],h=Cn(a),p=o.filter(f=>f.type==="telemetry:insight").length,v=o.filter(f=>f.type.startsWith("peter:")).length,c=h.length,b=h.filter(f=>f.improved===!0).length,y=h.filter(f=>f.improved===!1).length,x=l.length,T=[...i].sort((f,g)=>(g.composite||0)-(f.composite||0))[0],_=(S=T==null?void 0:T.trajectory)==null?void 0:S[0],$=T==null?void 0:T.composite;return e("div",{class:"space-y-6",children:[e("div",{class:"flex items-center justify-between",children:[e("h1",{class:"text-xl font-semibold",children:"Self-Driving Loop"}),e("span",{class:"text-sm text-muted-foreground",children:[h.length," cycles"]})]}),_!=null&&$!=null&&e("div",{class:"bg-card rounded-lg border border-border p-4",children:e("div",{class:"flex items-center gap-4",children:[e("div",{children:[e("div",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-1",children:"Score"}),e("div",{class:"flex items-center gap-2",children:[e("span",{class:"text-2xl font-bold tabular-nums",children:$.toFixed(2)}),(()=>{const f=$-_;return e("span",{class:D("text-sm mono",f>=0?"text-success":"text-destructive"),children:[f>=0?"▲":"▼",f>=0?"+":"",f.toFixed(3)]})})()]})]}),(T==null?void 0:T.trajectory)&&T.trajectory.length>1&&e(tt,{data:T.trajectory,width:200,height:40,color:$>=_?"var(--success)":"var(--destructive)"}),e("div",{class:"ml-auto",children:[e("div",{class:"w-40 h-3 bg-muted rounded-full overflow-hidden",children:e("div",{class:"h-full bg-success rounded-full transition-all",style:{width:`${Math.round($*100)}%`}})}),e("div",{class:"text-[10px] text-muted-foreground text-right mt-0.5",children:[Math.round($*100),"%"]})]})]})}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-4",children:"Pipeline"}),e("div",{class:"flex items-center justify-between text-center",children:[{label:"DETECT",count:p,color:"text-accent-foreground",detail:"insights"},{label:"PROPOSE",count:v,color:"text-warning",detail:"PRs"},{label:"EVAL",count:c,color:"text-info",detail:"runs"},{label:"MERGE",count:b,color:"text-success",detail:"merged"},{label:"LEARN",count:x,color:"text-info/70",detail:"flows"}].map((f,g)=>e("div",{class:"flex items-center",children:[g>0&&e("svg",{width:"24",height:"16",class:"text-muted-foreground/30 mx-1 shrink-0",children:e("path",{d:"M2 8h16M14 4l4 4-4 4",fill:"none",stroke:"currentColor","stroke-width":"1.5"})}),e("div",{children:[e("div",{class:D("text-2xl font-bold tabular-nums",f.color),children:f.count}),e("div",{class:"text-[10px] mono text-muted-foreground uppercase tracking-wider",children:f.label}),e("div",{class:"text-[10px] text-muted-foreground",children:f.detail})]})]},f.label))}),y>0&&e("div",{class:"flex items-center gap-2 mt-3 text-xs text-destructive",children:e("span",{class:"mono",children:[y," rejected"]})})]}),i.length>0&&e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:"Agents"}),e("div",{class:"space-y-2",children:i.sort((f,g)=>(g.composite||0)-(f.composite||0)).map(f=>e("div",{class:"flex items-center gap-3",children:[e("span",{class:D("w-2 h-2 rounded-full shrink-0",f.delta!=null&&f.delta>0?"bg-success":"bg-muted-foreground/50")}),e("span",{class:"text-sm font-medium flex-1 truncate",children:f.agent}),e("span",{class:"text-sm mono tabular-nums text-muted-foreground",children:f.composite!=null?f.composite.toFixed(4):"—"}),f.trajectory&&f.trajectory.length>1&&e(tt,{data:f.trajectory,width:80,height:24})]},f.agent))})]}),h.length>0&&e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:"Recent Cycles"}),e("div",{class:"space-y-1",children:h.slice(0,20).map((f,g)=>e("div",{class:D("flex items-center gap-3 py-2 px-2 text-sm rounded -mx-2",f.improved===!0&&"bg-success/5",f.improved===!1&&"bg-destructive/5"),children:[e("span",{class:"text-[10px] text-muted-foreground mono w-12 shrink-0",children:le(f.ts)}),e("span",{class:D("w-2 h-2 rounded-full shrink-0",f.improved===!0?"bg-success":f.improved===!1?"bg-destructive":"bg-muted-foreground/50")}),e("span",{class:"truncate flex-1 text-foreground",title:f.branch||f.agent,children:f.description||f.branch||f.agent||"Eval run"}),f.composite!=null&&e("span",{class:"text-xs mono tabular-nums bg-muted px-1.5 py-0.5 rounded",children:f.composite.toFixed(2)}),f.delta!=null&&e("span",{class:D("text-xs mono tabular-nums px-1.5 py-0.5 rounded",f.delta>=0?"bg-success/20 text-success":"bg-destructive/20 text-destructive"),children:[f.delta>=0?"+":"",f.delta.toFixed(3)]}),f.testsTotal!=null&&e("span",{class:"text-[10px] text-muted-foreground mono whitespace-nowrap",children:[f.testsPassed!=null&&f.testsPassed!==f.testsTotal?`${f.testsPassed}/${f.testsTotal}`:`${f.testsTotal}`," tests"]}),f.prNumber&&e("span",{class:"text-[10px] mono text-muted-foreground",children:["#",f.prNumber]}),e("span",{class:D("text-[10px] mono w-14 text-right",f.improved===!0?"text-success":f.improved===!1?"text-destructive":"text-muted-foreground"),children:f.improved===!0?"✓ merged":f.improved===!1?"✗ rejected":"—"})]},`${f.ts}-${g}`))})]}),h.length===0&&e("div",{class:"bg-card rounded-lg border border-border p-8 text-center",children:[e("div",{class:"text-sm text-muted-foreground",children:"No eval cycles yet"}),e("div",{class:"text-xs text-muted-foreground/70 mt-1",children:["Run ",e("span",{class:"mono",children:'jfl peter pr --task "add tests"'})," to start the loop"]})]})]})}function Tn(t){return t.gated?"pending":t.error||t.actions_failed&&t.actions_failed>0?"failed":t.completed_at?"completed":"running"}function Rn({status:t}){var $;const[r,n]=j(24),s=K(()=>N.projects(),15e3),o=K(()=>N.memoryStatus(),3e4),i=K(()=>N.flows(),15e3),l=K(()=>N.flowExecutions(),15e3),a=K(()=>N.telemetryDigest(r),3e4,[r]);K(()=>N.telemetryAgentStatus(),15e3);const h=(t==null?void 0:t.sources)||{},p=Object.values(h).filter(Boolean).length,v=Object.keys(h).length,c=o.data,b=i.data||[],y=l.data,x=Array.isArray(y)?y:(y==null?void 0:y.executions)||[],T=x.filter(w=>Tn(w)==="pending"),_=a.data;return e("div",{class:"space-y-6",children:[e("div",{class:"flex items-center justify-between",children:[e("h1",{class:"text-xl font-semibold",children:"System"}),e("span",{class:D("text-xs mono px-2 py-0.5 rounded",(t==null?void 0:t.status)==="running"||(t==null?void 0:t.status)==="ok"?"bg-success/10 text-success":"bg-destructive/10 text-destructive"),children:(t==null?void 0:t.status)||"unknown"})]}),e("div",{class:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e(xe,{label:"Hub",value:(t==null?void 0:t.status)==="running"||(t==null?void 0:t.status)==="ok"?"OK":(t==null?void 0:t.status)||"--",sub:`port :${(t==null?void 0:t.port)||"--"}`,trend:(t==null?void 0:t.status)==="running"||(t==null?void 0:t.status)==="ok"?"up":"down"}),e(xe,{label:"Sources",value:`${p}/${v}`,sub:"connected",trend:p===v?"up":"down"}),e(xe,{label:"Items",value:(t==null?void 0:t.itemCount)||0,sub:"indexed"}),e(xe,{label:"Memories",value:(c==null?void 0:c.total_memories)||0,sub:($=c==null?void 0:c.embeddings)!=null&&$.available?"with embeddings":"keyword only"})]}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("div",{class:"flex items-center justify-between mb-3",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider",children:"Costs"}),e("div",{class:"flex gap-1",children:[24,72,168].map(w=>e("button",{onClick:()=>n(w),class:D("text-[10px] mono px-2 py-0.5 rounded transition-colors",r===w?"bg-foreground/10 text-foreground":"text-muted-foreground hover:text-foreground"),children:w===24?"24h":w===72?"3d":"7d"},w))})]}),_?e(ie,{children:[e("div",{class:"text-2xl font-bold tabular-nums mb-3",children:["$",_.totalCostUsd.toFixed(2)]}),e("div",{class:"space-y-1.5",children:_.costs.sort((w,P)=>P.estimatedCostUsd-w.estimatedCostUsd).map(w=>{const P=_.totalCostUsd>0?w.estimatedCostUsd/_.totalCostUsd*100:0;return e("div",{class:"flex items-center gap-3 text-xs",children:[e("span",{class:"w-32 truncate mono text-muted-foreground",children:w.model}),e("div",{class:"flex-1 h-1.5 bg-muted rounded-full overflow-hidden",children:e("div",{class:"h-full bg-info rounded-full",style:{width:`${P}%`}})}),e("span",{class:"mono text-muted-foreground w-16 text-right",children:["$",w.estimatedCostUsd.toFixed(2)]}),e("span",{class:"text-muted-foreground/60 w-10 text-right",children:[P.toFixed(0),"%"]})]},w.model)})})]}):e("div",{class:"text-sm text-muted-foreground",children:"No cost data"})]}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("div",{class:"flex items-center justify-between mb-3",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider",children:["Flows (",b.length," defined, ",b.filter(w=>w.enabled!==!1).length," enabled)"]}),T.length>0&&e("span",{class:"text-[10px] mono text-warning",children:[T.length," pending"]})]}),T.length>0&&e("div",{class:"mb-3 space-y-1.5",children:T.map((w,P)=>e("div",{class:"flex items-center justify-between p-2 rounded border border-warning/30 bg-warning/5",children:[e("div",{class:"flex items-center gap-2",children:[e("span",{class:"w-1.5 h-1.5 rounded-full bg-warning animate-pulse"}),e("span",{class:"text-sm font-medium",children:w.flow}),e("span",{class:"text-[10px] mono text-muted-foreground",children:le(w.started_at)})]}),e("button",{onClick:()=>N.approveFlow(w.flow,w.trigger_event_id),class:"text-[10px] mono px-2 py-0.5 rounded bg-success/15 text-success hover:bg-success/25 transition-colors",children:"approve"})]},P))}),e("div",{class:"space-y-1",children:b.map(w=>{var g;const P=typeof w.trigger=="string"?w.trigger:((g=w.trigger)==null?void 0:g.pattern)||"",S=w.enabled!==!1,f=x.filter(A=>A.flow===w.name).length;return e("div",{class:D("flex items-center gap-3 py-1.5 text-sm",!S&&"opacity-40"),children:[e("span",{class:D("w-1.5 h-1.5 rounded-full",S?"bg-success":"bg-muted-foreground/50")}),e("span",{class:"font-medium flex-1 truncate",children:w.name}),e("span",{class:"text-[10px] mono text-info",children:P}),f>0&&e("span",{class:"text-[10px] text-muted-foreground",children:[f," runs"]}),e("button",{onClick:()=>N.toggleFlow(w.name,!S),class:D("text-[10px] mono px-1.5 py-0.5 rounded transition-colors",S?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:S?"on":"off"})]},w.name)})})]}),_&&e("div",{class:"grid grid-cols-2 gap-4",children:[e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-2",children:"Sessions"}),e("div",{class:"grid grid-cols-2 gap-2 text-sm",children:[e("div",{children:[e("span",{class:"text-muted-foreground",children:"Started:"}),e("span",{class:"ml-1 font-medium",children:_.sessions.started})]}),e("div",{children:[e("span",{class:"text-muted-foreground",children:"Ended:"}),e("span",{class:"ml-1 font-medium",children:_.sessions.ended})]}),e("div",{children:[e("span",{class:"text-muted-foreground",children:"Crashed:"}),e("span",{class:D("ml-1 font-medium",_.sessions.crashed>0?"text-destructive":""),children:_.sessions.crashed})]}),e("div",{children:[e("span",{class:"text-muted-foreground",children:"Avg:"}),e("span",{class:"ml-1 font-medium",children:[Math.round(_.sessions.avgDurationS/60),"m"]})]})]})]}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-2",children:"Errors"}),_.errors.total>0?e("div",{class:"space-y-1",children:Object.entries(_.errors.byType).map(([w,P])=>e("div",{class:"flex items-center justify-between text-sm",children:[e("span",{class:"text-muted-foreground truncate",children:w}),e("span",{class:"text-destructive mono",children:P})]},w))}):e("div",{class:"text-sm text-success",children:"No errors"})]})]}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:"Context Sources"}),e("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Object.entries(h).map(([w,P])=>e("div",{class:"flex items-center gap-2",children:[e("span",{class:D("w-1.5 h-1.5 rounded-full",P?"bg-success":"bg-destructive")}),e("span",{class:"text-sm capitalize",children:w}),e("span",{class:"text-[10px] text-muted-foreground",children:P?"ok":"down"})]},w))})]}),s.data&&s.data.length>0&&e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:["Tracked Projects (",s.data.length,")"]}),e("div",{class:"space-y-2",children:s.data.map(w=>e("div",{class:"flex items-center gap-3 text-sm",children:[e(gr,{status:w.status==="OK"?"ok":"error"}),e("span",{class:"font-medium",children:w.name}),e("span",{class:"text-[10px] mono text-muted-foreground",children:[":",w.port]}),w.status==="OK"&&e("a",{href:`http://localhost:${w.port}/dashboard/`,target:"_blank",rel:"noopener",class:"text-[10px] text-info hover:underline ml-auto",children:"Open"})]},w.name))})]})]})}function En(t){const r=t.data||{},n=[];if(Array.isArray(r.findings))for(const s of r.findings)n.push({file:s.file||"unknown",line:s.line,severity:s.severity||"yellow",category:s.category||"general",message:s.message||"",suggestion:s.suggestion});return{id:t.id,ts:t.ts,pr:r.pr,branch:r.branch||r.ref,agent:r.agent||t.source,findings:n,summary:r.summary,source:t.source}}const br={red:{bg:"bg-destructive/15",text:"text-destructive",label:"RED"},yellow:{bg:"bg-warning/15",text:"text-warning",label:"YLW"},green:{bg:"bg-success/15",text:"text-success",label:"OK"}},$n=[{label:"All",value:""},{label:"Red",value:"red"},{label:"Yellow",value:"yellow"},{label:"Green",value:"green"}];function Fn(){var y;const[t,r]=j([]),[n,s]=j(""),[o,i]=j(new Set),l=K(()=>N.events(200,"review:*"),15e3);fr("/api/events/stream",$e(x=>{var _;const T=x;(_=T.type)!=null&&_.startsWith("review:")&&r($=>[T,...$].slice(0,50))},[]));const h=[...t,...((y=l.data)==null?void 0:y.events)||[]].filter((x,T,_)=>_.findIndex($=>$.id===x.id)===T),p=Ee(()=>h.map(En).sort((x,T)=>T.ts.localeCompare(x.ts)),[h]),v=n?p.filter(x=>x.findings.some(T=>T.severity===n)):p,c=Ee(()=>{let x=0,T=0,_=0;for(const $ of p)for(const w of $.findings)w.severity==="red"?x++:w.severity==="yellow"?T++:_++;return{red:x,yellow:T,green:_,total:p.length}},[p]),b=x=>{i(T=>{const _=new Set(T);return _.has(x)?_.delete(x):_.add(x),_})};return e("div",{class:"space-y-5",children:[e("div",{class:"flex items-center justify-between",children:[e("h1",{class:"text-xl font-semibold",children:"Reviews"}),e("div",{class:"flex items-center gap-3",children:[t.length>0&&e("span",{class:"text-xs text-success mono animate-pulse-dot",children:"LIVE"}),e("span",{class:"text-sm text-muted-foreground",children:[v.length," reviews"]})]})]}),e("div",{class:"grid grid-cols-4 gap-3",children:[e(Xe,{label:"Reviews",value:c.total,color:"text-foreground"}),e(Xe,{label:"Red Findings",value:c.red,color:"text-destructive"}),e(Xe,{label:"Yellow Findings",value:c.yellow,color:"text-warning"}),e(Xe,{label:"Green Findings",value:c.green,color:"text-success"})]}),e("div",{class:"flex flex-wrap gap-1.5",children:$n.map(x=>e("button",{onClick:()=>s(x.value),class:D("text-[11px] mono font-medium px-2 py-0.5 rounded-md transition-colors",n===x.value?"bg-foreground/10 text-foreground":"bg-muted/50 text-muted-foreground hover:text-foreground"),children:x.label},x.value))}),e("div",{class:"bg-card rounded-lg border border-border",children:l.loading&&v.length===0?e("div",{class:"p-4 text-sm text-muted-foreground animate-pulse-dot",children:"Loading reviews..."}):v.length===0?e("div",{class:"py-8 text-sm text-muted-foreground text-center",children:"No review events yet. Reviews appear when AI eval runs on PRs."}):e("div",{class:"divide-y divide-border/50",children:v.map(x=>e(Dn,{review:x,expanded:o.has(x.id),onToggle:()=>b(x.id)},x.id))})})]})}function Xe({label:t,value:r,color:n}){return e("div",{class:"bg-card rounded-lg border border-border p-3",children:[e("div",{class:"text-[10px] text-muted-foreground uppercase tracking-wider",children:t}),e("div",{class:D("text-2xl font-semibold mono tabular-nums mt-1",n),children:r})]})}function Dn({review:t,expanded:r,onToggle:n}){const s=t.findings.filter(l=>l.severity==="red").length,o=t.findings.filter(l=>l.severity==="yellow").length,i=t.findings.filter(l=>l.severity==="green").length;return e("div",{class:"animate-fade-in",children:[e("button",{onClick:n,class:"w-full flex items-center gap-3 px-4 py-3 hover:bg-muted/20 transition-colors text-left",children:[e("div",{class:"flex items-center gap-1.5 shrink-0",children:[s>0&&e(He,{severity:"red",count:s}),o>0&&e(He,{severity:"yellow",count:o}),i>0&&e(He,{severity:"green",count:i}),t.findings.length===0&&e(He,{severity:"green",count:0})]}),e("div",{class:"flex-1 min-w-0",children:[e("div",{class:"flex items-center gap-2",children:[t.pr&&e("span",{class:"text-xs mono font-medium text-info",children:["PR #",t.pr]}),t.branch&&e("span",{class:"text-xs mono text-muted-foreground truncate",children:t.branch})]}),t.summary&&e("div",{class:"text-xs text-muted-foreground mt-0.5 truncate",children:t.summary})]}),e("div",{class:"flex items-center gap-2 shrink-0",children:[e("span",{class:"text-[10px] mono text-muted-foreground",children:t.agent}),e("span",{class:"text-[10px] mono text-muted-foreground whitespace-nowrap",children:le(t.ts)}),e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:D("text-muted-foreground transition-transform",r&&"rotate-180"),children:e("polyline",{points:"6 9 12 15 18 9"})})]})]}),r&&t.findings.length>0&&e("div",{class:"px-4 pb-3 space-y-1.5",children:t.findings.map((l,a)=>e(Pn,{finding:l},a))})]})}function He({severity:t,count:r}){const n=br[t];return e("span",{class:D("text-[10px] mono font-medium px-1.5 py-0.5 rounded",n.bg,n.text),children:r>0?r:n.label})}function Pn({finding:t}){const r=br[t.severity];return e("div",{class:D("rounded-md px-3 py-2 text-xs",r.bg),children:[e("div",{class:"flex items-center gap-2",children:[e("span",{class:D("mono font-medium",r.text),children:r.label}),e("span",{class:"mono text-muted-foreground",children:[t.file,t.line&&`:${t.line}`]}),e("span",{class:"text-muted-foreground/60 mono",children:t.category})]}),e("div",{class:"mt-1 text-foreground",children:t.message}),t.suggestion&&e("div",{class:"mt-1 text-muted-foreground italic",children:t.suggestion})]})}function An(){const[t,r]=j([]),[n,s]=j(""),[o,i]=j(!1),l=me(null),a=me(null);ve(()=>{var p;(p=l.current)==null||p.scrollIntoView({behavior:"smooth"})},[t]),ve(()=>{var p;(p=a.current)==null||p.focus()},[]);const h=async()=>{const p=n.trim();if(!p||o)return;const v={id:`u-${Date.now()}`,role:"user",content:p,ts:new Date().toISOString()},c=`a-${Date.now()}`,b={id:c,role:"assistant",content:"",ts:new Date().toISOString(),streaming:!0};r(x=>[...x,v,b]),s(""),i(!0);const y=t.filter(x=>!x.streaming).slice(-8).map(x=>({role:x.role,content:x.content}));await Or(p,y,x=>{r(T=>T.map(_=>_.id===c?{..._,sources:x}:_))},x=>{r(T=>T.map(_=>_.id===c?{..._,content:_.content+x}:_))},()=>{r(x=>x.map(T=>T.id===c?{...T,streaming:!1}:T)),i(!1)},x=>{r(T=>T.map(_=>_.id===c?{..._,content:`Error: ${x}`,streaming:!1}:_)),i(!1)})};return e("div",{class:"flex flex-col h-[calc(100vh-3rem)]",children:[e("div",{class:"flex items-center justify-between mb-4",children:[e("h1",{class:"text-xl font-semibold",children:"Chat"}),e("div",{class:"flex items-center gap-2",children:[t.length>0&&e("button",{onClick:()=>r([]),class:"text-[10px] mono px-2 py-1 rounded bg-muted text-muted-foreground hover:text-foreground transition-colors",children:"clear"}),e("span",{class:"text-sm text-muted-foreground",children:[t.length," messages"]})]})]}),e("div",{class:"flex-1 overflow-y-auto space-y-4 pb-4",children:[t.length===0&&e("div",{class:"flex flex-col items-center justify-center h-full text-center",children:[e("div",{class:"text-muted-foreground/40 mb-4",children:e("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",children:e("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),e("div",{class:"text-sm text-muted-foreground mb-1",children:"Ask about your project"}),e("div",{class:"text-xs text-muted-foreground/60 max-w-sm",children:"Answers grounded in your journal, knowledge base, and code context."}),e("div",{class:"flex flex-wrap gap-1.5 mt-4 justify-center",children:["What decisions were made recently?","What features were built this week?","What bugs were fixed?","Summarize the current roadmap"].map(p=>e("button",{onClick:()=>{var v;s(p),(v=a.current)==null||v.focus()},class:"text-[11px] mono px-2.5 py-1 rounded-md bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors",children:p},p))})]}),t.map(p=>e(In,{message:p},p.id)),e("div",{ref:l})]}),e("div",{class:"border-t border-border pt-3",children:e("div",{class:"flex gap-2",children:[e("input",{ref:a,type:"text",placeholder:"Ask about your project...",value:n,onInput:p=>s(p.target.value),onKeyDown:p=>p.key==="Enter"&&h(),disabled:o,class:"flex-1 bg-card border border-border rounded-lg px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:border-info/50 transition-colors disabled:opacity-50"}),e("button",{onClick:h,disabled:o||!n.trim(),class:D("px-4 py-2.5 rounded-lg text-sm font-medium transition-colors",n.trim()&&!o?"bg-info text-white hover:bg-info/90":"bg-muted text-muted-foreground cursor-not-allowed"),children:e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[e("path",{d:"M22 2 11 13"}),e("path",{d:"M22 2 15 22l-4-9-9-4z"})]})})]})})]})}function In({message:t}){const r=t.role==="user",[n,s]=j(!1);return e("div",{class:D("flex gap-3 animate-fade-in",r&&"flex-row-reverse"),children:[e("div",{class:D("w-6 h-6 rounded-full flex items-center justify-center shrink-0 mt-0.5",r?"bg-foreground/10":"bg-info/15"),children:e("span",{class:D("text-[10px] font-bold",r?"text-foreground":"text-info"),children:r?"Y":"J"})}),e("div",{class:"max-w-[80%] space-y-2",children:[e("div",{class:D("rounded-lg px-3 py-2",r?"bg-foreground/5 border border-border":"bg-card border border-border"),children:[r?e("div",{class:"text-sm",children:t.content}):e("div",{class:"text-sm space-y-1.5",children:[t.content?t.content.split(`
|
|
121
|
-
`).map((o,i)=>o.trim()?o.startsWith("# ")?e("div",{class:"font-semibold text-sm mt-2 first:mt-0",children:o.slice(2)},i):o.startsWith("## ")?e("div",{class:"font-medium text-sm text-muted-foreground mt-2",children:o.slice(3)},i):o.startsWith("- ")?e("div",{class:"text-sm pl-3",children:[e("span",{class:"text-muted-foreground mr-1.5",children:"•"}),zt(o.slice(2))]},i):e("div",{class:"text-sm",children:zt(o)},i):e("div",{class:"h-2"},i)):t.streaming?e("span",{class:"text-muted-foreground animate-pulse-dot",children:"Thinking..."}):null,t.streaming&&t.content&&e("span",{class:"inline-block w-1.5 h-4 bg-info/60 animate-pulse ml-0.5 align-middle"})]}),e("div",{class:"flex items-center gap-2 mt-1.5",children:[e("span",{class:"text-[10px] text-muted-foreground/50 mono",children:le(t.ts)}),t.sources&&t.sources.length>0&&e("button",{onClick:()=>s(!n),class:"text-[10px] text-info/70 hover:text-info mono transition-colors",children:[t.sources.length," sources ",n?"▾":"▸"]})]})]}),n&&t.sources&&e("div",{class:"bg-card/50 border border-border/50 rounded-lg p-2 space-y-1.5 animate-fade-in",children:t.sources.map((o,i)=>e("div",{class:"flex items-start gap-2 text-[11px]",children:[e("span",{class:D("shrink-0 px-1.5 py-0.5 rounded mono uppercase text-[9px]",o.type==="decision"?"bg-warning/15 text-warning":o.type==="feature"?"bg-success/15 text-success":o.type==="fix"?"bg-destructive/15 text-destructive":"bg-info/15 text-info"),children:o.type||"ctx"}),e("div",{class:"min-w-0",children:[e("div",{class:"font-medium truncate",children:o.title}),o.content&&e("div",{class:"text-muted-foreground line-clamp-2 mt-0.5",children:o.content.slice(0,150)})]})]},i))})]})]})}function zt(t){const r=[];let n=t,s=0;for(;n.length>0;){const o=n.match(/\*\*(.+?)\*\*/),i=n.match(/`(.+?)`/),l=(o==null?void 0:o.index)??1/0,a=(i==null?void 0:i.index)??1/0;if(l===1/0&&a===1/0){r.push(e("span",{children:n},s++));break}l<=a&&o?(l>0&&r.push(e("span",{children:n.slice(0,l)},s++)),r.push(e("span",{class:"font-medium",children:o[1]},s++)),n=n.slice(l+o[0].length)):i&&(a>0&&r.push(e("span",{children:n.slice(0,a)},s++)),r.push(e("span",{class:"mono text-info text-[10px] bg-info/10 px-1 py-0.5 rounded",children:i[1]},s++)),n=n.slice(a+i[0].length))}return e(ie,{children:r})}function jn({status:t}){var y;const[r,n]=j(24),[s,o]=j([]),[i,l]=j(!1),a=K(()=>N.synopsis(r),3e4,[r]),h=(t==null?void 0:t.children)||[],v=((t==null?void 0:t.type)||"standalone")==="portfolio"&&h.length>0;ve(()=>{if(!v)return;l(!0);const x=h.map(T=>({name:T.name,port:T.port,status:"loading",data:null}));o(x),Promise.all(h.map(async T=>{const _=await N.childSynopsis(T.port,r);return{name:T.name,port:T.port,status:_?"ok":"error",data:_}})).then(T=>{o(T),l(!1)})},[v,r,h.map(x=>x.port).join(",")]);const c=Ln(a.data,s);return e("div",{class:"space-y-5",children:[e("div",{class:"flex items-center justify-between",children:[e("h1",{class:"text-xl font-semibold",children:"Synopsis"}),e("div",{class:"flex items-center gap-2",children:[6,12,24,48,168].map(x=>e("button",{onClick:()=>n(x),class:D("text-[11px] mono font-medium px-2 py-0.5 rounded-md transition-colors",r===x?"bg-foreground/10 text-foreground":"bg-muted/50 text-muted-foreground hover:text-foreground"),children:[x,"h"]},x))})]}),v&&e("div",{class:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e(Ye,{label:"Features",value:c.features,color:"text-success"}),e(Ye,{label:"Fixes",value:c.fixes,color:"text-warning"}),e(Ye,{label:"Decisions",value:c.decisions,color:"text-info"}),e(Ye,{label:"Commits",value:c.commits,color:"text-foreground"})]}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("div",{class:"flex items-center justify-between mb-3",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider",children:((y=t==null?void 0:t.config)==null?void 0:y.name)||"This Project"}),a.loading&&e("span",{class:"text-[10px] text-muted-foreground animate-pulse-dot",children:"loading..."})]}),a.data?e(Ut,{data:a.data}):e("div",{class:"text-sm text-muted-foreground",children:["No activity in the last ",r,"h"]})]}),v&&e("div",{class:"space-y-4",children:[e("h2",{class:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:["Products (",h.length,")"]}),s.map(x=>e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("div",{class:"flex items-center justify-between mb-3",children:[e("div",{class:"flex items-center gap-2",children:[e("span",{class:D("w-[6px] h-[6px] rounded-full shrink-0",x.status==="ok"?"bg-success":x.status==="loading"?"bg-muted-foreground/50 animate-pulse":"bg-destructive")}),e("h3",{class:"text-sm font-medium",children:x.name}),e("span",{class:"text-[10px] mono text-muted-foreground",children:[":",x.port]})]}),x.status==="loading"&&e("span",{class:"text-[10px] text-muted-foreground animate-pulse-dot",children:"loading..."})]}),x.data?e(Ut,{data:x.data}):x.status==="error"?e("div",{class:"text-xs text-muted-foreground",children:"Unable to fetch synopsis"}):null]},x.name))]}),!v&&a.data&&a.data.commits.length>0&&e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("h3",{class:"text-xs text-muted-foreground uppercase tracking-wider mb-3",children:"Commits"}),e("div",{class:"space-y-1.5",children:a.data.commits.map(x=>e("div",{class:"flex items-center gap-2 text-xs",children:[e("span",{class:"mono text-muted-foreground text-[10px] w-14 shrink-0",children:x.hash.slice(0,7)}),e("span",{class:"truncate flex-1",children:x.message}),e("span",{class:"text-[10px] mono text-muted-foreground",children:x.author}),e("span",{class:"text-[10px] text-muted-foreground whitespace-nowrap",children:le(x.date)})]},x.hash))})]})]})}function Ye({label:t,value:r,color:n}){return e("div",{class:"bg-card rounded-lg border border-border p-3",children:[e("div",{class:"text-[10px] text-muted-foreground uppercase tracking-wider",children:t}),e("div",{class:D("text-2xl font-semibold mono tabular-nums mt-1",n),children:r}),e("div",{class:"text-[10px] text-muted-foreground",children:"across all projects"})]})}function Ut({data:t}){const r=t.summary,n=r.features+r.fixes+r.decisions+r.discoveries>0;return e("div",{class:"space-y-3",children:[n&&e("div",{class:"flex gap-4",children:[r.features>0&&e(Ce,{label:"features",value:r.features,color:"text-success"}),r.fixes>0&&e(Ce,{label:"fixes",value:r.fixes,color:"text-warning"}),r.decisions>0&&e(Ce,{label:"decisions",value:r.decisions,color:"text-info"}),r.discoveries>0&&e(Ce,{label:"discoveries",value:r.discoveries,color:"text-purple-400"}),t.commits.length>0&&e(Ce,{label:"commits",value:t.commits.length,color:"text-foreground"}),r.filesModified>0&&e(Ce,{label:"files",value:r.filesModified,color:"text-muted-foreground"})]}),t.journalEntries.length>0&&e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase tracking-wider mb-1.5",children:"Journal"}),e("div",{class:"space-y-1",children:t.journalEntries.slice(0,5).map((s,o)=>e("div",{class:"flex items-start gap-2 text-xs",children:[e("span",{class:D("text-[10px] mono px-1 py-0.5 rounded shrink-0",s.type==="feature"?"bg-success/15 text-success":s.type==="fix"?"bg-warning/15 text-warning":s.type==="decision"?"bg-info/15 text-info":"bg-muted text-muted-foreground"),children:s.type}),e("span",{class:"truncate",children:s.title}),e("span",{class:"text-[10px] text-muted-foreground whitespace-nowrap ml-auto",children:le(s.ts)})]},o))})]}),r.incompleteItems.length>0&&e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase tracking-wider mb-1.5",children:"Incomplete"}),e("div",{class:"space-y-1",children:r.incompleteItems.map((s,o)=>e("div",{class:"text-xs text-warning/80 flex items-center gap-1.5",children:[e("span",{class:"w-1 h-1 rounded-full bg-warning/60 shrink-0"}),s]},o))})]})]})}function Ce({label:t,value:r,color:n}){return e("div",{children:[e("div",{class:D("text-lg font-semibold mono tabular-nums",n),children:r}),e("div",{class:"text-[10px] text-muted-foreground uppercase",children:t})]})}function Ln(t,r){let n=0,s=0,o=0,i=0;const l=a=>{a&&(n+=a.summary.features,s+=a.summary.fixes,o+=a.summary.decisions,i+=a.commits.length)};l(t);for(const a of r)l(a.data);return{features:n,fixes:s,decisions:o,commits:i}}function Gn(){const r=K(()=>N.setupReport(),3e4).data;if(!r)return e("div",{class:"space-y-6",children:[e("h1",{class:"text-xl font-semibold",children:"Setup Report"}),e("div",{class:"bg-card rounded-lg border border-border p-8 text-center",children:e("div",{class:"text-muted-foreground text-sm",children:["No setup report found. Run ",e("code",{class:"bg-muted px-1.5 py-0.5 rounded text-xs",children:"jfl setup --force"})," to generate."]})})]});r.docHealth.bloatedDocs.length===0&&r.docHealth.staleDocs.length===0&&r.docHealth.missingDocs.length===0||r.docHealth.bloatedDocs.length>10;const n=r.docHealth.bloatedDocs.length+r.docHealth.staleDocs.length+r.docHealth.missingDocs.length;return e("div",{class:"space-y-6",children:[e("div",{class:"flex items-center justify-between",children:[e("h1",{class:"text-xl font-semibold",children:"Setup Report"}),e("span",{class:"text-xs text-muted-foreground mono",children:new Date(r.timestamp).toLocaleString()})]}),e("div",{class:"grid grid-cols-2 lg:grid-cols-5 gap-4",children:[e(xe,{label:"Readiness",value:`${r.context.readiness}%`,sub:`${r.context.sessions} sessions`,trend:r.context.readiness>=80?"up":r.context.readiness>=50?"flat":"down"}),e(xe,{label:"Services",value:r.systemModel.services,sub:`${r.systemModel.invariants} invariants`}),e(xe,{label:"Concurrency",value:r.systemModel.concurrencyPatterns,sub:"patterns detected",trend:r.systemModel.concurrencyPatterns>50?"down":"flat"}),e(xe,{label:"Agents",value:r.context.existingAgents.length,sub:"configured",trend:"up"}),e(xe,{label:"Doc Health",value:n,sub:"issues",trend:n===0?"up":n>10?"down":"flat"})]}),e("section",{children:[e("h2",{class:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-3",children:"System Model (TLA+)"}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"Services"}),e("div",{class:"text-lg font-semibold mono",children:r.systemModel.services})]}),e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"State Variables"}),e("div",{class:"text-lg font-semibold mono",children:r.systemModel.stateVariables})]}),e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"Actions"}),e("div",{class:"text-lg font-semibold mono",children:r.systemModel.actions})]}),e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"Invariants"}),e("div",{class:"text-lg font-semibold mono",children:r.systemModel.invariants})]})]}),e("div",{class:"mt-3 pt-3 border-t border-border text-xs text-muted-foreground",children:["Run ",e("code",{class:"bg-muted px-1 py-0.5 rounded",children:"jfl verify"})," to check invariants with TLC model checker"]})]})]}),e("section",{children:[e("h2",{class:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-3",children:"Journal Insights"}),e("div",{class:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("div",{class:"flex items-center justify-between mb-2",children:[e("span",{class:"text-sm font-medium",children:"Revert Rate"}),e("span",{class:D("text-lg font-semibold mono",r.journalInsights.revertRate>.3?"text-destructive":r.journalInsights.revertRate>.1?"text-warning":"text-success"),children:[(r.journalInsights.revertRate*100).toFixed(1),"%"]})]}),r.journalInsights.topReverts.length>0&&e("div",{class:"space-y-1 mt-2",children:r.journalInsights.topReverts.slice(0,5).map(s=>e("div",{class:"flex items-center justify-between text-xs",children:[e("span",{class:"text-muted-foreground truncate",children:s.pattern}),e("span",{class:"mono text-destructive",children:[s.count," reverts"]})]},s.pattern))})]}),e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("span",{class:"text-sm font-medium",children:"File Hotspots"}),e("div",{class:"space-y-1.5 mt-2",children:r.journalInsights.hotspots.slice(0,6).map(s=>e("div",{class:"flex items-center justify-between text-xs",children:[e("span",{class:"text-muted-foreground truncate mono",children:s.path}),e("div",{class:"flex items-center gap-2",children:[e("span",{class:"mono",children:s.touches}),s.reverts>0&&e("span",{class:"text-destructive mono",children:["(",s.reverts," rev)"]})]})]},s.path))})]})]})]}),r.journalInsights.evalTrends.length>0&&e("section",{children:[e("h2",{class:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-3",children:"Agent Eval Trends"}),e("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-3",children:r.journalInsights.evalTrends.map(s=>e("div",{class:"bg-card rounded-lg border border-border p-3 animate-fade-in",children:[e("div",{class:"flex items-center gap-2 mb-1",children:[e("span",{class:D("text-sm",s.trend==="improving"?"text-success":s.trend==="degrading"?"text-destructive":"text-muted-foreground"),children:s.trend==="improving"?"📈":s.trend==="degrading"?"📉":"➡️"}),e("span",{class:"text-sm font-medium truncate",children:s.agent})]}),e("div",{class:"text-xs text-muted-foreground",children:[s.scores.length," evals · ",s.trend]})]},s.agent))})]}),e("section",{children:[e("h2",{class:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-3",children:["Doc Health",e("span",{class:"ml-2 text-xs font-normal",children:[r.docHealth.totalDocs," docs · ",r.docHealth.totalLines.toLocaleString()," lines · ",(r.docHealth.totalBytes/1024).toFixed(0),"KB"]})]}),e("div",{class:"grid grid-cols-1 md:grid-cols-3 gap-3 mb-4",children:[e("div",{class:D("bg-card rounded-lg border p-3",r.docHealth.bloatedDocs.length>0?"border-warning":"border-border"),children:[e("div",{class:"text-[10px] text-muted-foreground uppercase",children:["Bloated (",">","300 lines)"]}),e("div",{class:"text-lg font-semibold mono",children:r.docHealth.bloatedDocs.length})]}),e("div",{class:D("bg-card rounded-lg border p-3",r.docHealth.staleDocs.length>0?"border-warning":"border-border"),children:[e("div",{class:"text-[10px] text-muted-foreground uppercase",children:["Stale (",">","14 days)"]}),e("div",{class:"text-lg font-semibold mono",children:r.docHealth.staleDocs.length})]}),e("div",{class:D("bg-card rounded-lg border p-3",r.docHealth.missingDocs.length>0?"border-warning":"border-border"),children:[e("div",{class:"text-[10px] text-muted-foreground uppercase",children:"Missing"}),e("div",{class:"text-lg font-semibold mono",children:r.docHealth.missingDocs.length})]})]}),r.docHealth.bloatedDocs.length>0&&e("div",{class:"bg-card rounded-lg border border-border p-4 mb-3",children:[e("span",{class:"text-sm font-medium",children:"Bloated Docs"}),e("div",{class:"space-y-1 mt-2",children:r.docHealth.bloatedDocs.slice(0,10).map(s=>e("div",{class:"flex items-center justify-between text-xs",children:[e("span",{class:"text-muted-foreground truncate mono",children:s.path}),e("span",{class:"mono text-warning",children:[s.lines," lines"]})]},s.path))})]}),r.docHealth.recommendations.length>0&&e("div",{class:"bg-card rounded-lg border border-border p-4",children:[e("span",{class:"text-sm font-medium",children:"Recommendations"}),e("div",{class:"space-y-2 mt-2",children:r.docHealth.recommendations.slice(0,8).map((s,o)=>{const i={trim:"✂️",update:"📝",create:"📄",archive:"📦",split:"🔀",merge:"🔗"}[s.type]||"📋";return e("div",{class:"flex items-start gap-2 text-xs",children:[e("span",{children:i}),e("div",{children:[e("span",{class:D("font-medium uppercase text-[10px] px-1 py-0.5 rounded mr-1",s.priority===1?"bg-destructive/20 text-destructive":s.priority===2?"bg-warning/20 text-warning":"bg-muted text-muted-foreground"),children:s.type}),e("span",{class:"mono",children:s.target}),e("div",{class:"text-muted-foreground mt-0.5",children:s.rationale})]})]},o)})})]})]}),e("section",{children:[e("h2",{class:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-3",children:["Configured Agents (",r.context.existingAgents.length,")"]}),e("div",{class:"flex flex-wrap gap-2",children:r.context.existingAgents.map(s=>e("span",{class:"bg-card border border-border rounded px-2 py-1 text-xs mono",children:s},s))})]})]})}function On(t,r,n){const s=r/2,o=n/2,i=t.filter(x=>x.type==="orchestrator"),l=t.filter(x=>x.type==="service"),a=t.filter(x=>x.type==="agent"),h=t.filter(x=>!["orchestrator","service","agent"].includes(x.type)),p=[],v=0;i.forEach((x,T)=>{const _=2*Math.PI*T/Math.max(i.length,1)-Math.PI/2;p.push({...x,x:s+v*Math.cos(_),y:o+v*Math.sin(_),ring:0})});const c=Math.min(r,n)*.22;l.forEach((x,T)=>{const _=2*Math.PI*T/Math.max(l.length,1)-Math.PI/2;p.push({...x,x:s+c*Math.cos(_),y:o+c*Math.sin(_),ring:1})});const b=[...a,...h],y=Math.min(r,n)*.38;return b.forEach((x,T)=>{const _=2*Math.PI*T/Math.max(b.length,1)-Math.PI/2;p.push({...x,x:s+y*Math.cos(_),y:o+y*Math.sin(_),ring:2})}),p}const Xt={orchestrator:{fill:"#FF4F00",stroke:"#FF4F00"},service:{fill:"#0066FF",stroke:"#0066FF"},agent:{fill:"#00CC66",stroke:"#00CC66"},source:{fill:"#8B5CF6",stroke:"#8B5CF6"},telemetry:{fill:"#F59E0B",stroke:"#F59E0B"}},Bn={running:1,stopped:.4,error:1,unknown:.3};function Nn({nodes:t,edges:r,selected:n,onSelect:s,width:o,height:i}){const l=Ee(()=>{const a=new Map;for(const h of t)a.set(h.id,h);return a},[t]);return e("svg",{width:o,height:i,viewBox:`0 0 ${o} ${i}`,class:"select-none",onClick:()=>s(null),children:[e("circle",{cx:o/2,cy:i/2,r:Math.min(o,i)*.22,fill:"none",stroke:"rgba(255,255,255,0.04)",strokeDasharray:"4 4"}),e("circle",{cx:o/2,cy:i/2,r:Math.min(o,i)*.38,fill:"none",stroke:"rgba(255,255,255,0.04)",strokeDasharray:"4 4"}),r.map((a,h)=>{const p=l.get(a.source),v=l.get(a.target);if(!p||!v)return null;const c=n===a.source||n===a.target;return e("line",{x1:p.x,y1:p.y,x2:v.x,y2:v.y,stroke:c?"rgba(255,255,255,0.3)":"rgba(255,255,255,0.08)",strokeWidth:c?1.5:.5,class:"transition-all duration-300"},h)}),t.map(a=>{const h=Xt[a.type]||Xt.service,p=Bn[a.status]||.3,v=n===a.id,c=a.ring===0?24:a.ring===1?18:14;return e("g",{class:"cursor-pointer",onClick:b=>{b.stopPropagation(),s(a.id)},children:[a.status==="running"&&e("circle",{cx:a.x,cy:a.y,r:c+6,fill:"none",stroke:h.stroke,strokeWidth:1,opacity:.2,children:[e("animate",{attributeName:"r",values:`${c+4};${c+8};${c+4}`,dur:"3s",repeatCount:"indefinite"}),e("animate",{attributeName:"opacity",values:"0.2;0.05;0.2",dur:"3s",repeatCount:"indefinite"})]}),a.status==="error"&&e("circle",{cx:a.x,cy:a.y,r:c+4,fill:"none",stroke:"#FF3366",strokeWidth:2,opacity:.6,children:e("animate",{attributeName:"opacity",values:"0.6;0;0.6",dur:"1s",repeatCount:"indefinite"})}),e("circle",{cx:a.x,cy:a.y,r:c,fill:v?h.fill:`${h.fill}20`,stroke:h.stroke,strokeWidth:v?2.5:1.5,opacity:p,class:"transition-all duration-200"}),e("text",{x:a.x,y:a.y+c+14,textAnchor:"middle",fill:"rgba(255,255,255,0.7)",fontSize:a.ring===2?9:11,fontFamily:"JetBrains Mono, monospace",children:a.label.length>16?a.label.slice(0,14)+"…":a.label}),e("circle",{cx:a.x+c*.7,cy:a.y-c*.7,r:3,fill:a.status==="running"?"#00CC66":a.status==="error"?"#FF3366":"#666"}),e("text",{x:a.x,y:a.y+4,textAnchor:"middle",fill:v?"#09090B":h.fill,fontSize:c*.7,fontFamily:"system-ui",opacity:p,children:a.type==="orchestrator"?"⚡":a.type==="service"?"◆":a.type==="agent"?"●":"○"})]},a.id)})]})}function zn({node:t,report:r,edges:n}){if(t){const s=n.filter(i=>i.target===t.id),o=n.filter(i=>i.source===t.id);return e("div",{class:"space-y-4 animate-fade-in",children:[e("div",{class:"flex items-center gap-2",children:[e("span",{class:D("w-3 h-3 rounded-full",t.status==="running"?"bg-success":t.status==="error"?"bg-destructive":"bg-muted")}),e("h3",{class:"text-sm font-semibold",children:t.label}),e("span",{class:"text-xs text-muted-foreground",children:t.type})]}),e("div",{class:"grid grid-cols-2 gap-2 text-xs",children:[e("div",{class:"bg-muted/30 rounded p-2",children:[e("div",{class:"text-muted-foreground",children:"Status"}),e("div",{class:"font-medium",children:t.status})]}),e("div",{class:"bg-muted/30 rounded p-2",children:[e("div",{class:"text-muted-foreground",children:"Events"}),e("div",{class:"font-medium mono",children:t.eventCount})]})]}),o.length>0&&e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase mb-1",children:["Produces → (",o.length,")"]}),e("div",{class:"space-y-0.5",children:o.slice(0,6).map((i,l)=>e("div",{class:"text-xs mono text-success/80",children:[i.event," → ",i.target]},l))})]}),s.length>0&&e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase mb-1",children:["← Consumes (",s.length,")"]}),e("div",{class:"space-y-0.5",children:s.slice(0,6).map((i,l)=>e("div",{class:"text-xs mono text-blue-400/80",children:[i.source," → ",i.event]},l))})]}),t.produces.length>0&&e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase mb-1",children:"Event types"}),e("div",{class:"flex flex-wrap gap-1",children:t.produces.map(i=>e("span",{class:"text-[10px] mono bg-muted/50 px-1.5 py-0.5 rounded",children:i},i))})]})]})}return r?e("div",{class:"space-y-4",children:[e("h3",{class:"text-sm font-semibold",children:"System Overview"}),e("div",{class:"grid grid-cols-2 gap-2 text-xs",children:[e("div",{class:"bg-muted/30 rounded p-2",children:[e("div",{class:"text-muted-foreground",children:"Readiness"}),e("div",{class:"text-lg font-semibold mono text-success",children:[r.context.readiness,"%"]})]}),e("div",{class:"bg-muted/30 rounded p-2",children:[e("div",{class:"text-muted-foreground",children:"Services"}),e("div",{class:"text-lg font-semibold mono",children:r.systemModel.services})]}),e("div",{class:"bg-muted/30 rounded p-2",children:[e("div",{class:"text-muted-foreground",children:"Agents"}),e("div",{class:"text-lg font-semibold mono",children:r.context.existingAgents.length})]}),e("div",{class:"bg-muted/30 rounded p-2",children:[e("div",{class:"text-muted-foreground",children:"Invariants"}),e("div",{class:"text-lg font-semibold mono",children:r.systemModel.invariants})]})]}),e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase mb-1",children:"TLA+ Model"}),e("div",{class:"text-xs space-y-0.5",children:[e("div",{class:"flex justify-between",children:[e("span",{children:"State variables"}),e("span",{class:"mono",children:r.systemModel.stateVariables})]}),e("div",{class:"flex justify-between",children:[e("span",{children:"Actions"}),e("span",{class:"mono",children:r.systemModel.actions})]}),e("div",{class:"flex justify-between",children:[e("span",{children:"Concurrency patterns"}),e("span",{class:"mono text-warning",children:r.systemModel.concurrencyPatterns})]})]})]}),e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase mb-1",children:"Doc Health"}),e("div",{class:"text-xs space-y-0.5",children:[e("div",{class:"flex justify-between",children:[e("span",{children:"Total docs"}),e("span",{class:"mono",children:r.docHealth.totalDocs})]}),e("div",{class:"flex justify-between",children:[e("span",{children:"Bloated"}),e("span",{class:"mono text-warning",children:r.docHealth.bloatedDocs.length})]}),e("div",{class:"flex justify-between",children:[e("span",{children:"Recommendations"}),e("span",{class:"mono",children:r.docHealth.recommendations.length})]})]})]}),e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase mb-1",children:"Journal"}),e("div",{class:"text-xs space-y-0.5",children:[e("div",{class:"flex justify-between",children:[e("span",{children:"Sessions"}),e("span",{class:"mono",children:r.context.sessions})]}),e("div",{class:"flex justify-between",children:[e("span",{children:"Revert rate"}),e("span",{class:D("mono",r.journalInsights.revertRate>.1?"text-destructive":"text-success"),children:[(r.journalInsights.revertRate*100).toFixed(1),"%"]})]})]})]}),r.journalInsights.hotspots.length>0&&e("div",{children:[e("div",{class:"text-[10px] text-muted-foreground uppercase mb-1",children:"Hotspots"}),e("div",{class:"text-xs space-y-0.5",children:r.journalInsights.hotspots.slice(0,4).map(s=>e("div",{class:"flex justify-between",children:[e("span",{class:"mono truncate",children:s.path}),e("span",{class:"mono",children:s.touches})]},s.path))})]}),e("div",{class:"pt-2 border-t border-border text-[10px] text-muted-foreground",children:new Date(r.timestamp).toLocaleString()})]}):e("div",{class:"text-sm text-muted-foreground",children:["Click a node to see details. Run ",e("code",{class:"bg-muted px-1 py-0.5 rounded text-xs",children:"jfl setup"})," for full report."]})}function Un(){return e("div",{class:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[[{color:"#FF4F00",label:"Orchestrator"},{color:"#0066FF",label:"Service"},{color:"#00CC66",label:"Agent"},{color:"#8B5CF6",label:"Source"}].map(r=>e("div",{class:"flex items-center gap-1",children:[e("span",{class:"w-2 h-2 rounded-full",style:{backgroundColor:r.color}}),r.label]},r.label)),e("div",{class:"flex items-center gap-1",children:[e("span",{class:"w-2 h-2 rounded-full bg-success"})," running"]}),e("div",{class:"flex items-center gap-1",children:[e("span",{class:"w-2 h-2 rounded-full bg-muted"})," stopped"]})]})}function Xn(){var v;const[t,r]=j(null),n=me(null),[s,o]=j({width:600,height:500}),i=K(()=>N.topology(),1e4),l=K(()=>N.setupReport(),3e4);ve(()=>{const c=n.current;if(!c)return;const b=new ResizeObserver(y=>{const{width:x,height:T}=y[0].contentRect;x>0&&T>0&&o({width:x,height:T})});return b.observe(c),()=>b.disconnect()},[]);const a=Ee(()=>{var c;return(c=i.data)!=null&&c.nodes?On(i.data.nodes,s.width,s.height):[]},[i.data,s]),h=((v=i.data)==null?void 0:v.edges)||[],p=a.find(c=>c.id===t)||null;return e("div",{class:"h-full flex flex-col gap-3",children:[e("div",{class:"flex items-center justify-between",children:[e("h1",{class:"text-xl font-semibold",children:"System Graph"}),e(Un,{})]}),e("div",{class:"flex-1 flex gap-4 min-h-0",children:[e("div",{ref:n,class:"flex-1 bg-card rounded-lg border border-border overflow-hidden relative",children:[a.length===0?e("div",{class:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No topology data. Start the context hub."}):e(Nn,{nodes:a,edges:h,selected:t,onSelect:r,width:s.width,height:s.height}),e("div",{class:"absolute bottom-3 left-3 flex items-center gap-1 text-[10px] text-muted-foreground bg-card/80 backdrop-blur px-2 py-1 rounded",children:[e("span",{class:"text-success",children:"●"})," ",a.filter(c=>c.status==="running").length," running",e("span",{class:"mx-1",children:"·"}),a.length," total",e("span",{class:"mx-1",children:"·"}),h.length," connections"]})]}),e("div",{class:"w-72 bg-card rounded-lg border border-border p-4 overflow-y-auto",children:e(zn,{node:p,report:l.data,edges:h})})]})]})}function Hn(t,r){for(var n in r)t[n]=r[n];return t}function Ht(t,r){for(var n in t)if(n!=="__source"&&!(n in r))return!0;for(var s in r)if(s!=="__source"&&t[s]!==r[s])return!0;return!1}function Yt(t,r){this.props=t,this.context=r}(Yt.prototype=new we).isPureReactComponent=!0,Yt.prototype.shouldComponentUpdate=function(t,r){return Ht(this.props,t)||Ht(this.state,r)};var Wt=z.__b;z.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),Wt&&Wt(t)};var Yn=z.__e;z.__e=function(t,r,n,s){if(t.then){for(var o,i=r;i=i.__;)if((o=i.__c)&&o.__c)return r.__e==null&&(r.__e=n.__e,r.__k=n.__k),o.__c(t,r)}Yn(t,r,n,s)};var Vt=z.unmount;function yr(t,r,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(s){typeof s.__c=="function"&&s.__c()}),t.__c.__H=null),(t=Hn({},t)).__c!=null&&(t.__c.__P===n&&(t.__c.__P=r),t.__c.__e=!0,t.__c=null),t.__k=t.__k&&t.__k.map(function(s){return yr(s,r,n)})),t}function _r(t,r,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(s){return _r(s,r,n)}),t.__c&&t.__c.__P===r&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function ct(){this.__u=0,this.o=null,this.__b=null}function wr(t){if(!t.__)return null;var r=t.__.__c;return r&&r.__a&&r.__a(t)}function We(){this.i=null,this.l=null}z.unmount=function(t){var r=t.__c;r&&(r.__z=!0),r&&r.__R&&r.__R(),r&&32&t.__u&&(t.type=null),Vt&&Vt(t)},(ct.prototype=new we).__c=function(t,r){var n=r.__c,s=this;s.o==null&&(s.o=[]),s.o.push(n);var o=wr(s.__v),i=!1,l=function(){i||s.__z||(i=!0,n.__R=null,o?o(h):h())};n.__R=l;var a=n.__P;n.__P=null;var h=function(){if(!--s.__u){if(s.state.__a){var p=s.state.__a;s.__v.__k[0]=_r(p,p.__c.__P,p.__c.__O)}var v;for(s.setState({__a:s.__b=null});v=s.o.pop();)v.__P=a,v.forceUpdate()}};s.__u++||32&r.__u||s.setState({__a:s.__b=s.__v.__k[0]}),t.then(l,l)},ct.prototype.componentWillUnmount=function(){this.o=[]},ct.prototype.render=function(t,r){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),s=this.__v.__k[0].__c;this.__v.__k[0]=yr(this.__b,n,s.__O=s.__P)}this.__b=null}var o=r.__a&&ft(ie,null,t.fallback);return o&&(o.__u&=-33),[ft(ie,null,r.__a?null:t.children),o]};var Jt=function(t,r,n){if(++n[1]===n[0]&&t.l.delete(r),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(n=t.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.i=n=n[2]}};(We.prototype=new we).__a=function(t){var r=this,n=wr(r.__v),s=r.l.get(t);return s[0]++,function(o){var i=function(){r.props.revealOrder?(s.push(o),Jt(r,t,s)):o()};n?n(i):i()}},We.prototype.render=function(t){this.i=null,this.l=new Map;var r=et(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&r.reverse();for(var n=r.length;n--;)this.l.set(r[n],this.i=[1,0,this.i]);return t.children},We.prototype.componentDidUpdate=We.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(r,n){Jt(t,n,r)})};var Wn=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Vn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Jn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,qn=/[A-Z0-9]/g,Kn=typeof document<"u",Qn=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};we.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(we.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})});var qt=z.event;function Zn(){}function es(){return this.cancelBubble}function ts(){return this.defaultPrevented}z.event=function(t){return qt&&(t=qt(t)),t.persist=Zn,t.isPropagationStopped=es,t.isDefaultPrevented=ts,t.nativeEvent=t};var rs={enumerable:!1,configurable:!0,get:function(){return this.class}},Kt=z.vnode;z.vnode=function(t){typeof t.type=="string"&&(function(r){var n=r.props,s=r.type,o={},i=s.indexOf("-")===-1;for(var l in n){var a=n[l];if(!(l==="value"&&"defaultValue"in n&&a==null||Kn&&l==="children"&&s==="noscript"||l==="class"||l==="className")){var h=l.toLowerCase();l==="defaultValue"&&"value"in n&&n.value==null?l="value":l==="download"&&a===!0?a="":h==="translate"&&a==="no"?a=!1:h[0]==="o"&&h[1]==="n"?h==="ondoubleclick"?l="ondblclick":h!=="onchange"||s!=="input"&&s!=="textarea"||Qn(n.type)?h==="onfocus"?l="onfocusin":h==="onblur"?l="onfocusout":Jn.test(l)&&(l=h):h=l="oninput":i&&Vn.test(l)?l=l.replace(qn,"-$&").toLowerCase():a===null&&(a=void 0),h==="oninput"&&o[l=h]&&(l="oninputCapture"),o[l]=a}}s=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=et(n.children).forEach(function(p){p.props.selected=o.value.indexOf(p.props.value)!=-1})),s=="select"&&o.defaultValue!=null&&(o.value=et(n.children).forEach(function(p){p.props.selected=o.multiple?o.defaultValue.indexOf(p.props.value)!=-1:o.defaultValue==p.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",rs)):n.className&&(o.class=o.className=n.className),r.props=o})(t),t.$$typeof=Wn,Kt&&Kt(t)};var Qt=z.__r;z.__r=function(t){Qt&&Qt(t),t.__c};var Zt=z.diffed;z.diffed=function(t){Zt&&Zt(t);var r=t.props,n=t.__e;n!=null&&t.type==="textarea"&&"value"in r&&r.value!==n.value&&(n.value=r.value==null?"":r.value)};const vt=["backlog","in_progress","eval","done"],kr={backlog:{label:"Backlog"},in_progress:{label:"In Progress"},eval:{label:"In Review"},done:{label:"Done"}},Sr={human:"#8b8b8b",agent:"#8b8b8b",setup:"#8b8b8b",verify:"#e5534b",findings:"#d29922"},ns={10:"#e5534b",9:"#e5534b",8:"#d29922",7:"#d29922",6:"#d29922",5:"#8b8b8b",4:"#8b8b8b",3:"#8b8b8b",2:"#8b8b8b",1:"#8b8b8b",0:"#8b8b8b"};function Cr({priority:t}){if(t===0)return null;const r=ns[t]??"#8b8b8b",n=Math.min(4,Math.ceil(t/2.5));return e("svg",{width:"14",height:"14",viewBox:"0 0 16 16",style:{flexShrink:0},children:[0,1,2,3].map(s=>e("rect",{x:s*4,y:12-(s+1)*3,width:"3",height:(s+1)*3,rx:"0.5",fill:s<n?r:"#2a2a2a"},s))})}function Mr(t){const r=Date.now()-new Date(t).getTime(),n=Math.floor(r/6e4);if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function ss({card:t,onClose:r,onMove:n}){var i,l;const s=t.links||{},o=s.pr||s.eval||s.journal||s.violation||s.session;return e("div",{style:{width:340,background:"#0a0a0a",borderLeft:"1px solid #1e1e1e",padding:"16px 20px",overflowY:"auto",flexShrink:0,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:16},children:[e("div",{style:{flex:1},children:[e("div",{style:{fontSize:15,fontWeight:500,color:"#e0e0e0",lineHeight:1.4},children:t.title}),e("div",{style:{fontSize:11,color:"#444",fontFamily:"monospace",marginTop:4},children:[t.url?e("a",{href:t.url,target:"_blank",rel:"noopener",style:{color:"#5c9eff",textDecoration:"none"},children:t.id}):t.id," · ",t.source," · ",Mr(t.createdAt)," ago"]})]}),e("button",{onClick:r,style:{background:"none",border:"none",color:"#555",cursor:"pointer",fontSize:16,padding:"0 0 0 8px"},children:"×"})]}),e("div",{style:{borderTop:"1px solid #1a1a1a",paddingTop:12,marginBottom:16},children:[e(Me,{label:"Status",children:e("select",{value:t.column,onChange:a=>n(t.id,a.target.value),style:{background:"#111",border:"1px solid #1e1e1e",borderRadius:3,color:"#ccc",fontSize:12,padding:"2px 6px",fontFamily:"inherit"},children:vt.map(a=>e("option",{value:a,children:kr[a].label},a))})}),e(Me,{label:"Priority",children:e("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e(Cr,{priority:t.priority}),e("span",{style:{fontSize:12,color:"#888"},children:["P",t.priority]})]})}),t.agent&&e(Me,{label:"Assignee",children:e("span",{style:{fontSize:12,color:"#888"},children:t.agent})}),t.scope&&e(Me,{label:"Scope",children:e("span",{style:{fontSize:12,color:"#5c9eff",fontFamily:"monospace"},children:t.scope})}),t.score!==null&&e(Me,{label:"Score",children:e("span",{style:{fontSize:12,color:"#4ade80",fontFamily:"monospace"},children:t.score.toFixed(4)})}),e(Me,{label:"Source",children:e("span",{style:{fontSize:11,color:Sr[t.source]??"#555",textTransform:"uppercase",letterSpacing:"0.04em"},children:t.source})})]}),((i=t.labels)==null?void 0:i.length)>0&&e("div",{style:{marginBottom:16},children:[e("div",{style:{fontSize:11,color:"#555",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:6},children:"Labels"}),e("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:t.labels.map(a=>e("span",{style:{fontSize:11,color:"#888",background:"#161616",border:"1px solid #1e1e1e",borderRadius:3,padding:"1px 6px"},children:a},a))})]}),t.description&&e("div",{style:{marginBottom:16},children:[e("div",{style:{fontSize:11,color:"#555",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:6},children:"Description"}),e("div",{style:{fontSize:13,color:"#999",lineHeight:1.5},children:t.description})]}),o&&e("div",{style:{marginBottom:16},children:[e("div",{style:{fontSize:11,color:"#555",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:6},children:"Links"}),e("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[s.pr&&e(Te,{label:`PR #${s.pr}`,href:s.pr_url??`https://github.com/402goose/jfl-cli/pull/${s.pr}`}),s.eval&&e(Te,{label:`Eval: ${s.eval}`,onClick:()=>{}}),s.journal&&e(Te,{label:`Journal: ${s.journal}`,onClick:()=>{}}),s.violation&&e(Te,{label:`Violation: ${s.violation}`,onClick:()=>{}}),s.session&&e(Te,{label:`Session: ${s.session}`,onClick:()=>{}}),(l=s.docs)==null?void 0:l.map(a=>e(Te,{label:a,onClick:()=>{}},a))]})]}),e("div",{children:[e("div",{style:{fontSize:11,color:"#555",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:6},children:"Activity"}),e("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e(dt,{text:`Created by ${t.source}`,time:t.createdAt}),t.agent&&t.column!=="backlog"&&e(dt,{text:`Picked by ${t.agent}`,time:t.updatedAt}),t.score!==null&&e(dt,{text:`Scored ${t.score.toFixed(4)}`,time:t.updatedAt})]})]})]})}function Me({label:t,children:r}){return e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"5px 0"},children:[e("span",{style:{fontSize:12,color:"#555"},children:t}),r]})}function Te({label:t,href:r,onClick:n}){const s={fontSize:12,color:"#5c9eff",cursor:"pointer",background:"none",border:"none",padding:0,fontFamily:"inherit",textAlign:"left"};return r?e("a",{href:r,target:"_blank",rel:"noopener",style:{...s,textDecoration:"none"},children:[t," ↗"]}):e("button",{onClick:n,style:s,children:[t," →"]})}function dt({text:t,time:r}){return e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("span",{style:{fontSize:12,color:"#666"},children:t}),e("span",{style:{fontSize:11,color:"#333",fontFamily:"monospace"},children:Mr(r)})]})}function os({card:t,onDragStart:r,isDragging:n,isSelected:s,onClick:o}){var i;return e("div",{draggable:!0,onClick:o,onDragStart:l=>{l.dataTransfer.setData("text/plain",t.id),l.dataTransfer.effectAllowed="move",r(t.id)},style:{background:s?"#141414":n?"#1a1a1a":"transparent",borderLeft:s?"2px solid #5c9eff":"2px solid transparent",borderBottom:"1px solid #1e1e1e",padding:"10px 12px 10px 10px",cursor:"pointer",transition:"background 0.1s",opacity:n?.4:1},onMouseEnter:l=>{!n&&!s&&(l.currentTarget.style.background="#0e0e0e")},onMouseLeave:l=>{!n&&!s&&(l.currentTarget.style.background="transparent")},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e(Cr,{priority:t.priority}),e("span",{style:{fontSize:13,color:"#e0e0e0",fontWeight:400,flex:1,lineHeight:1.4},children:t.title})]}),e("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:5,marginLeft:22},children:[t.scope&&e("span",{style:{fontSize:10,color:"#5c9eff",fontFamily:"monospace"},children:t.scope}),t.source!=="human"&&e("span",{style:{fontSize:10,color:Sr[t.source]??"#555",textTransform:"uppercase",letterSpacing:"0.04em"},children:t.source}),(i=t.labels)==null?void 0:i.slice(0,2).map(l=>e("span",{style:{fontSize:10,color:"#666",background:"#161616",borderRadius:2,padding:"0 4px"},children:l},l)),t.agent&&e("span",{style:{fontSize:10,color:"#444"},children:t.agent}),t.score!==null&&e("span",{style:{fontSize:10,color:"#4ade80",fontFamily:"monospace"},children:t.score.toFixed(2)}),t.url?e("a",{href:t.url,target:"_blank",rel:"noopener",style:{fontSize:10,color:"#333",marginLeft:"auto",fontFamily:"monospace",textDecoration:"none"},onClick:l=>l.stopPropagation(),children:t.id}):e("span",{style:{fontSize:10,color:"#2a2a2a",marginLeft:"auto",fontFamily:"monospace"},children:t.id})]})]})}function is(){var E,m,d;const[t,r]=j({backlog:[],in_progress:[],eval:[],done:[]}),[n,s]=j(""),[o,i]=j(!0),[l,a]=j(null),[h,p]=j(null),[v,c]=j(null),[b,y]=j(null),[x,T]=j(""),[_,$]=j({name:"",type:""}),[w,P]=j([]);ve(()=>{Y("/api/kanban/scopes").then(k=>{$(k.workspace??{name:"",type:""}),P(k.services??[])}).catch(()=>{})},[]);const S=$e(async()=>{try{const k=new URLSearchParams;x&&k.set("scope",x),k.set("aggregate","true");const I=await Y(`/api/kanban?${k}`);r(I),a(null)}catch(k){a(k.message)}finally{i(!1)}},[x]);ve(()=>{S();const k=setInterval(S,5e3);return()=>clearInterval(k)},[S]);const f=async(k,I)=>{try{await Y("/api/kanban",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"move",id:k.replace("#",""),column:I})}),(b==null?void 0:b.id)===k&&y({...b,column:I}),await S()}catch{}},g=async()=>{if(n.trim())try{await Y("/api/kanban",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",title:n.trim(),scope:x||void 0})}),s(""),await S()}catch{}},A=vt.flatMap(k=>t[k]??[]),u=w.map(k=>k.name).filter(Boolean),C=A.length,M=(((E=t.in_progress)==null?void 0:E.length)??0)+(((m=t.eval)==null?void 0:m.length)??0);return e("div",{style:{display:"flex",height:"calc(100vh - 48px)",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"},children:[e("div",{style:{flex:1,padding:"20px 24px",overflow:"auto"},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[e("div",{children:[e("h1",{style:{fontSize:14,fontWeight:500,color:"#e0e0e0",margin:0,letterSpacing:"-0.01em"},children:"Issues"}),e("p",{style:{fontSize:12,color:"#444",marginTop:2,fontFamily:"monospace"},children:[C," total · ",M," active · ",((d=t.done)==null?void 0:d.length)??0," closed"]})]}),e("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[u.length>0&&e("select",{value:x,onChange:k=>T(k.target.value),style:{background:"#0a0a0a",border:"1px solid #1e1e1e",borderRadius:4,color:"#888",padding:"5px 8px",fontSize:12,fontFamily:"monospace"},children:[e("option",{value:"",children:"All scopes"}),u.map(k=>e("option",{value:k,children:k},k))]}),e("form",{onSubmit:k=>{k.preventDefault(),g()},style:{display:"flex",gap:6},children:[e("input",{value:n,onChange:k=>s(k.target.value),placeholder:"New issue…",style:{background:"#0a0a0a",border:"1px solid #1e1e1e",borderRadius:4,color:"#e0e0e0",padding:"5px 10px",fontSize:13,width:200,outline:"none",fontFamily:"inherit"},onFocus:k=>k.currentTarget.style.borderColor="#333",onBlur:k=>k.currentTarget.style.borderColor="#1e1e1e"}),e("button",{type:"submit",style:{background:"#e0e0e0",color:"#0a0a0a",border:"none",borderRadius:4,padding:"5px 12px",fontSize:13,cursor:"pointer",fontWeight:500,fontFamily:"inherit"},children:"Create"})]})]})]}),l&&e("div",{style:{color:"#e5534b",fontSize:12,marginBottom:12},children:l}),e("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:1,background:"#1e1e1e",borderRadius:6,overflow:"hidden",border:"1px solid #1e1e1e"},children:vt.map(k=>{const I=kr[k],O=t[k]??[],B=v===k;return e("div",{onDragOver:X=>{X.preventDefault(),X.dataTransfer.dropEffect="move",c(k)},onDragEnter:X=>{X.preventDefault(),c(k)},onDragLeave:X=>{const Z=X.currentTarget.getBoundingClientRect(),{clientX:ce,clientY:de}=X;(ce<Z.left||ce>Z.right||de<Z.top||de>Z.bottom)&&c(null)},onDrop:X=>{X.preventDefault();const Z=X.dataTransfer.getData("text/plain");Z&&h&&f(Z,k),p(null),c(null)},style:{background:B?"#0f0f0f":"#0a0a0a",minHeight:400,transition:"background 0.1s"},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 12px",borderBottom:"1px solid #1e1e1e"},children:[e("span",{style:{fontSize:12,fontWeight:500,color:"#888",textTransform:"uppercase",letterSpacing:"0.05em"},children:I.label}),e("span",{style:{fontSize:11,color:"#444",fontFamily:"monospace"},children:O.length})]}),O.length===0?e("div",{style:{fontSize:12,color:"#2a2a2a",textAlign:"center",padding:"40px 0"},children:B?"Drop here":"No issues"}):O.map(X=>e(os,{card:X,onDragStart:p,isDragging:h===X.id,isSelected:(b==null?void 0:b.id)===X.id,onClick:()=>y((b==null?void 0:b.id)===X.id?null:X)},X.id))]},k)})})]}),b&&e(ss,{card:b,onClose:()=>y(null),onMove:f})]})}const ls={_startTime:Date.now(),_lastPage:"",pageView(t){const r=this._lastPage?Date.now()-this._startTime:0;this._lastPage&&r>1e3&&this._emit("dashboard:page-dwell",{page:this._lastPage,durationMs:r}),this._emit("dashboard:page-view",{page:t}),this._startTime=Date.now(),this._lastPage=t},click(t,r){this._emit("dashboard:click",{target:t,...r})},_emit(t,r){const n=new Date().toISOString(),s=localStorage.getItem("jfl-token")||"";fetch("/api/hooks",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({type:t,source:"dashboard",data:r,ts:n})}).catch(()=>{}),fetch("https://jfl-platform.fly.dev/api/v1/telemetry/ingest",{method:"POST",headers:{"Content-Type":"application/json","x-jfl-install-id":"jfl-dashboard"},body:JSON.stringify({events:[{event_id:crypto.randomUUID(),ts:n,category:"dashboard",event:t,install_id:"jfl-dashboard",...r}]})}).catch(()=>{})}},ut={overview:Qr,activity:()=>e(kn,{}),loop:()=>e(Mn,{}),experiments:()=>e(sn,{}),findings:()=>e(nn,{}),reviews:()=>e(Fn,{}),chat:()=>e(An,{}),synopsis:jn,topology:xn,system:Rn,"setup-report":()=>e(Gn,{}),"system-graph":()=>e(Xn,{}),kanban:()=>e(is,{})};function as(){const t=K(()=>N.status(),1e4),r=location.hash.replace("#/","")||"overview",[n,s]=j(r in ut?r:"overview"),o=me(!0);if(ve(()=>{ls.pageView(n),o.current||(location.hash=`#/${n}`),o.current=!1},[n]),t.loading)return e("div",{class:"flex items-center justify-center h-screen",children:e("div",{class:"text-muted-foreground text-sm animate-pulse-dot",children:"Loading dashboard..."})});if(t.error)return e("div",{class:"flex items-center justify-center h-screen",children:e("div",{class:"text-center",children:[e("div",{class:"text-destructive text-sm font-medium",children:"Connection Error"}),e("div",{class:"text-muted-foreground text-xs mt-1",children:t.error}),e("div",{class:"text-muted-foreground text-xs mt-2 mono",children:"jfl context-hub start"})]})});const i=ut[n]||ut.overview;return e("div",{class:"flex min-h-screen",children:[e(qr,{status:t.data,currentPage:n,setPage:l=>s(l)}),e("main",{class:"flex-1 ml-56 p-6",children:e(i,{status:t.data})})]})}Pr(e(as,{}),document.getElementById("app"));
|