@swestash/agent-lens 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/agent-lens.js +22 -10
- package/dist/agent-lens.js.map +1 -1
- package/package.json +1 -1
- package/web/assets/{CopyButton-hsiW2B6o.js → CopyButton-CQ5SHT0Q.js} +1 -1
- package/web/assets/{Dashboard-CPfpfHm8.js → Dashboard-BZeT30Fc.js} +1 -1
- package/web/assets/{SecurityView-CvWWSbuL.js → SecurityView-CCSq2PMa.js} +1 -1
- package/web/assets/{SessionView-BLTA0iKW.js → SessionView-DTYrghRK.js} +1 -1
- package/web/assets/{SkillView-DVoLJAU0.js → SkillView-BPXOcH3K.js} +1 -1
- package/web/assets/{SkillsView-c6k5JsWR.js → SkillsView-ClZpsQqe.js} +1 -1
- package/web/assets/{WorkflowView-juGHkf05.js → WorkflowView-DwxhHR6A.js} +1 -1
- package/web/assets/{index-D-kuW17t.js → index-B_beFRjy.js} +2 -2
- package/web/assets/{index-BfFCjgfs.css → index-CGKywTVG.css} +1 -1
- package/web/assets/{index-BXp9oWUn.js → index-CM-5HLoq.js} +1 -1
- package/web/assets/{severity-ZaGgvxL_.js → severity-TiQaFcLQ.js} +1 -1
- package/web/index.html +2 -2
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,j as p}from"./index-
|
|
1
|
+
import{r as u,j as p}from"./index-B_beFRjy.js";function d(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/?9;|'/g,"'").replace(/&/g,"&")}function y(e){const t=e.match(/\s*\(\s*truncated[^)]*\)\s*$/i);return!t||t.index==null?{body:e,note:null}:{body:e.slice(0,t.index).trimEnd(),note:t[0].trim()}}function m(e){try{return{value:JSON.parse(e),repaired:!1}}catch{}const t=[];let s=!1,a=!1,o=-1,i=[];for(let r=0;r<e.length;r++){const n=e[r];if(s){a?a=!1:n==="\\"?a=!0:n==='"'&&(s=!1);continue}n==='"'?s=!0:n==="{"||n==="["?t.push(n==="{"?"}":"]"):n==="}"||n==="]"?(t.pop(),o=r+1,i=[...t]):n===","&&(o=r,i=[...t])}if(o<0)return{value:void 0,repaired:!1};const c=e.slice(0,o)+i.reverse().join("");try{return{value:JSON.parse(c),repaired:!0}}catch{return{value:void 0,repaired:!1}}}function l(e){if(typeof e=="string"){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return l(JSON.parse(t))}catch{return e}return e}if(Array.isArray(e))return e.map(l);if(e&&typeof e=="object"){const t={};for(const[s,a]of Object.entries(e))t[s]=l(a);return t}return e}function h(e,t=2e4){try{return JSON.stringify(JSON.parse(e),null,2).slice(0,t)}catch{return e.slice(0,t)}}function g({text:e,label:t,title:s="Copy to clipboard",className:a=""}){const[o,i]=u.useState(!1),c=async()=>{try{await navigator.clipboard.writeText(e)}catch{const r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();try{document.execCommand("copy")}catch{}r.remove()}i(!0),window.setTimeout(()=>i(!1),1200)};return p.jsxs("button",{type:"button",className:"ghost small copy-btn "+a,onClick:c,"aria-label":s,title:s,children:[o?"✓ Copied":"⧉",t?" "+t:""]})}export{g as C,l as a,d,m as l,h as p,y as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as mi,g as ce,r as N,R as P,u as kw,j as $,a as Dw,b as Nw,d as cn,s as qh,f as gi,e as Lh,h as Zt,L as Rw}from"./index-D-kuW17t.js";function Sb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Sb(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ee(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Sb(e))&&(n&&(n+=" "),n+=t);return n}var lo,Bh;function Fe(){if(Bh)return lo;Bh=1;var e=Array.isArray;return lo=e,lo}var fo,Fh;function Ab(){if(Fh)return fo;Fh=1;var e=typeof mi=="object"&&mi&&mi.Object===Object&&mi;return fo=e,fo}var ho,zh;function vt(){if(zh)return ho;zh=1;var e=Ab(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return ho=r,ho}var po,Wh;function si(){if(Wh)return po;Wh=1;var e=vt(),t=e.Symbol;return po=t,po}var vo,Uh;function qw(){if(Uh)return vo;Uh=1;var e=si(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),s=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(u?o[i]=s:delete o[i]),f}return vo=a,vo}var yo,Kh;function Lw(){if(Kh)return yo;Kh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return yo=r,yo}var mo,Hh;function Et(){if(Hh)return mo;Hh=1;var e=si(),t=qw(),r=Lw(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return mo=o,mo}var go,Gh;function Mt(){if(Gh)return go;Gh=1;function e(t){return t!=null&&typeof t=="object"}return go=e,go}var bo,Vh;function Qr(){if(Vh)return bo;Vh=1;var e=Et(),t=Mt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return bo=n,bo}var xo,Xh;function Mf(){if(Xh)return xo;Xh=1;var e=Fe(),t=Qr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return xo=i,xo}var wo,Yh;function Ft(){if(Yh)return wo;Yh=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return wo=e,wo}var Oo,Zh;function $f(){if(Zh)return Oo;Zh=1;var e=Et(),t=Ft(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var s=e(u);return s==n||s==i||s==r||s==a}return Oo=o,Oo}var _o,Jh;function Bw(){if(Jh)return _o;Jh=1;var e=vt(),t=e["__core-js_shared__"];return _o=t,_o}var So,Qh;function Fw(){if(Qh)return So;Qh=1;var e=Bw(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return So=r,So}var Ao,ep;function Pb(){if(ep)return Ao;ep=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Ao=r,Ao}var Po,tp;function zw(){if(tp)return Po;tp=1;var e=$f(),t=Fw(),r=Ft(),n=Pb(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,s=o.toString,c=u.hasOwnProperty,f=RegExp("^"+s.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var p=e(h)?f:a;return p.test(n(h))}return Po=l,Po}var To,rp;function Ww(){if(rp)return To;rp=1;function e(t,r){return t==null?void 0:t[r]}return To=e,To}var jo,np;function hr(){if(np)return jo;np=1;var e=zw(),t=Ww();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return jo=r,jo}var Eo,ip;function Ia(){if(ip)return Eo;ip=1;var e=hr(),t=e(Object,"create");return Eo=t,Eo}var Mo,ap;function Uw(){if(ap)return Mo;ap=1;var e=Ia();function t(){this.__data__=e?e(null):{},this.size=0}return Mo=t,Mo}var $o,op;function Kw(){if(op)return $o;op=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return $o=e,$o}var Co,up;function Hw(){if(up)return Co;up=1;var e=Ia(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return Co=i,Co}var Io,sp;function Gw(){if(sp)return Io;sp=1;var e=Ia(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Io=n,Io}var ko,cp;function Vw(){if(cp)return ko;cp=1;var e=Ia(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return ko=r,ko}var Do,lp;function Xw(){if(lp)return Do;lp=1;var e=Uw(),t=Kw(),r=Hw(),n=Gw(),i=Vw();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Do=a,Do}var No,fp;function Yw(){if(fp)return No;fp=1;function e(){this.__data__=[],this.size=0}return No=e,No}var Ro,hp;function Cf(){if(hp)return Ro;hp=1;function e(t,r){return t===r||t!==t&&r!==r}return Ro=e,Ro}var qo,pp;function ka(){if(pp)return qo;pp=1;var e=Cf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return qo=t,qo}var Lo,dp;function Zw(){if(dp)return Lo;dp=1;var e=ka(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return Lo=n,Lo}var Bo,vp;function Jw(){if(vp)return Bo;vp=1;var e=ka();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Bo=t,Bo}var Fo,yp;function Qw(){if(yp)return Fo;yp=1;var e=ka();function t(r){return e(this.__data__,r)>-1}return Fo=t,Fo}var zo,mp;function eO(){if(mp)return zo;mp=1;var e=ka();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return zo=t,zo}var Wo,gp;function Da(){if(gp)return Wo;gp=1;var e=Yw(),t=Zw(),r=Jw(),n=Qw(),i=eO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Wo=a,Wo}var Uo,bp;function If(){if(bp)return Uo;bp=1;var e=hr(),t=vt(),r=e(t,"Map");return Uo=r,Uo}var Ko,xp;function tO(){if(xp)return Ko;xp=1;var e=Xw(),t=Da(),r=If();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Ko=n,Ko}var Ho,wp;function rO(){if(wp)return Ho;wp=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Ho=e,Ho}var Go,Op;function Na(){if(Op)return Go;Op=1;var e=rO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Go=t,Go}var Vo,_p;function nO(){if(_p)return Vo;_p=1;var e=Na();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Vo=t,Vo}var Xo,Sp;function iO(){if(Sp)return Xo;Sp=1;var e=Na();function t(r){return e(this,r).get(r)}return Xo=t,Xo}var Yo,Ap;function aO(){if(Ap)return Yo;Ap=1;var e=Na();function t(r){return e(this,r).has(r)}return Yo=t,Yo}var Zo,Pp;function oO(){if(Pp)return Zo;Pp=1;var e=Na();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Zo=t,Zo}var Jo,Tp;function kf(){if(Tp)return Jo;Tp=1;var e=tO(),t=nO(),r=iO(),n=aO(),i=oO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Jo=a,Jo}var Qo,jp;function Tb(){if(jp)return Qo;jp=1;var e=kf(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],s=a.cache;if(s.has(u))return s.get(u);var c=n.apply(this,o);return a.cache=s.set(u,c)||s,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,Qo=r,Qo}var eu,Ep;function uO(){if(Ep)return eu;Ep=1;var e=Tb(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return eu=r,eu}var tu,Mp;function sO(){if(Mp)return tu;Mp=1;var e=uO(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,u,s,c){a.push(s?c.replace(r,"$1"):u||o)}),a});return tu=n,tu}var ru,$p;function Df(){if($p)return ru;$p=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return ru=e,ru}var nu,Cp;function cO(){if(Cp)return nu;Cp=1;var e=si(),t=Df(),r=Fe(),n=Qr(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return nu=o,nu}var iu,Ip;function jb(){if(Ip)return iu;Ip=1;var e=cO();function t(r){return r==null?"":e(r)}return iu=t,iu}var au,kp;function Eb(){if(kp)return au;kp=1;var e=Fe(),t=Mf(),r=sO(),n=jb();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return au=i,au}var ou,Dp;function Ra(){if(Dp)return ou;Dp=1;var e=Qr();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return ou=t,ou}var uu,Np;function Nf(){if(Np)return uu;Np=1;var e=Eb(),t=Ra();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return uu=r,uu}var su,Rp;function Mb(){if(Rp)return su;Rp=1;var e=Nf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return su=t,su}var lO=Mb();const Ze=ce(lO);var cu,qp;function fO(){if(qp)return cu;qp=1;function e(t){return t==null}return cu=e,cu}var hO=fO();const Q=ce(hO);var lu,Lp;function pO(){if(Lp)return lu;Lp=1;var e=Et(),t=Fe(),r=Mt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return lu=i,lu}var dO=pO();const ur=ce(dO);var vO=$f();const X=ce(vO);var yO=Ft();const en=ce(yO);var fu={exports:{}},ne={};/**
|
|
1
|
+
import{c as mi,g as ce,r as N,R as P,u as kw,j as $,a as Dw,b as Nw,d as cn,s as qh,f as gi,e as Lh,h as Zt,L as Rw}from"./index-B_beFRjy.js";function Sb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Sb(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ee(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Sb(e))&&(n&&(n+=" "),n+=t);return n}var lo,Bh;function Fe(){if(Bh)return lo;Bh=1;var e=Array.isArray;return lo=e,lo}var fo,Fh;function Ab(){if(Fh)return fo;Fh=1;var e=typeof mi=="object"&&mi&&mi.Object===Object&&mi;return fo=e,fo}var ho,zh;function vt(){if(zh)return ho;zh=1;var e=Ab(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return ho=r,ho}var po,Wh;function si(){if(Wh)return po;Wh=1;var e=vt(),t=e.Symbol;return po=t,po}var vo,Uh;function qw(){if(Uh)return vo;Uh=1;var e=si(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),s=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(u?o[i]=s:delete o[i]),f}return vo=a,vo}var yo,Kh;function Lw(){if(Kh)return yo;Kh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return yo=r,yo}var mo,Hh;function Et(){if(Hh)return mo;Hh=1;var e=si(),t=qw(),r=Lw(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return mo=o,mo}var go,Gh;function Mt(){if(Gh)return go;Gh=1;function e(t){return t!=null&&typeof t=="object"}return go=e,go}var bo,Vh;function Qr(){if(Vh)return bo;Vh=1;var e=Et(),t=Mt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return bo=n,bo}var xo,Xh;function Mf(){if(Xh)return xo;Xh=1;var e=Fe(),t=Qr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return xo=i,xo}var wo,Yh;function Ft(){if(Yh)return wo;Yh=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return wo=e,wo}var Oo,Zh;function $f(){if(Zh)return Oo;Zh=1;var e=Et(),t=Ft(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var s=e(u);return s==n||s==i||s==r||s==a}return Oo=o,Oo}var _o,Jh;function Bw(){if(Jh)return _o;Jh=1;var e=vt(),t=e["__core-js_shared__"];return _o=t,_o}var So,Qh;function Fw(){if(Qh)return So;Qh=1;var e=Bw(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return So=r,So}var Ao,ep;function Pb(){if(ep)return Ao;ep=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Ao=r,Ao}var Po,tp;function zw(){if(tp)return Po;tp=1;var e=$f(),t=Fw(),r=Ft(),n=Pb(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,s=o.toString,c=u.hasOwnProperty,f=RegExp("^"+s.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var p=e(h)?f:a;return p.test(n(h))}return Po=l,Po}var To,rp;function Ww(){if(rp)return To;rp=1;function e(t,r){return t==null?void 0:t[r]}return To=e,To}var jo,np;function hr(){if(np)return jo;np=1;var e=zw(),t=Ww();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return jo=r,jo}var Eo,ip;function Ia(){if(ip)return Eo;ip=1;var e=hr(),t=e(Object,"create");return Eo=t,Eo}var Mo,ap;function Uw(){if(ap)return Mo;ap=1;var e=Ia();function t(){this.__data__=e?e(null):{},this.size=0}return Mo=t,Mo}var $o,op;function Kw(){if(op)return $o;op=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return $o=e,$o}var Co,up;function Hw(){if(up)return Co;up=1;var e=Ia(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return Co=i,Co}var Io,sp;function Gw(){if(sp)return Io;sp=1;var e=Ia(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Io=n,Io}var ko,cp;function Vw(){if(cp)return ko;cp=1;var e=Ia(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return ko=r,ko}var Do,lp;function Xw(){if(lp)return Do;lp=1;var e=Uw(),t=Kw(),r=Hw(),n=Gw(),i=Vw();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Do=a,Do}var No,fp;function Yw(){if(fp)return No;fp=1;function e(){this.__data__=[],this.size=0}return No=e,No}var Ro,hp;function Cf(){if(hp)return Ro;hp=1;function e(t,r){return t===r||t!==t&&r!==r}return Ro=e,Ro}var qo,pp;function ka(){if(pp)return qo;pp=1;var e=Cf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return qo=t,qo}var Lo,dp;function Zw(){if(dp)return Lo;dp=1;var e=ka(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return Lo=n,Lo}var Bo,vp;function Jw(){if(vp)return Bo;vp=1;var e=ka();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Bo=t,Bo}var Fo,yp;function Qw(){if(yp)return Fo;yp=1;var e=ka();function t(r){return e(this.__data__,r)>-1}return Fo=t,Fo}var zo,mp;function eO(){if(mp)return zo;mp=1;var e=ka();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return zo=t,zo}var Wo,gp;function Da(){if(gp)return Wo;gp=1;var e=Yw(),t=Zw(),r=Jw(),n=Qw(),i=eO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Wo=a,Wo}var Uo,bp;function If(){if(bp)return Uo;bp=1;var e=hr(),t=vt(),r=e(t,"Map");return Uo=r,Uo}var Ko,xp;function tO(){if(xp)return Ko;xp=1;var e=Xw(),t=Da(),r=If();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Ko=n,Ko}var Ho,wp;function rO(){if(wp)return Ho;wp=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Ho=e,Ho}var Go,Op;function Na(){if(Op)return Go;Op=1;var e=rO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Go=t,Go}var Vo,_p;function nO(){if(_p)return Vo;_p=1;var e=Na();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Vo=t,Vo}var Xo,Sp;function iO(){if(Sp)return Xo;Sp=1;var e=Na();function t(r){return e(this,r).get(r)}return Xo=t,Xo}var Yo,Ap;function aO(){if(Ap)return Yo;Ap=1;var e=Na();function t(r){return e(this,r).has(r)}return Yo=t,Yo}var Zo,Pp;function oO(){if(Pp)return Zo;Pp=1;var e=Na();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Zo=t,Zo}var Jo,Tp;function kf(){if(Tp)return Jo;Tp=1;var e=tO(),t=nO(),r=iO(),n=aO(),i=oO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Jo=a,Jo}var Qo,jp;function Tb(){if(jp)return Qo;jp=1;var e=kf(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],s=a.cache;if(s.has(u))return s.get(u);var c=n.apply(this,o);return a.cache=s.set(u,c)||s,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,Qo=r,Qo}var eu,Ep;function uO(){if(Ep)return eu;Ep=1;var e=Tb(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return eu=r,eu}var tu,Mp;function sO(){if(Mp)return tu;Mp=1;var e=uO(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,u,s,c){a.push(s?c.replace(r,"$1"):u||o)}),a});return tu=n,tu}var ru,$p;function Df(){if($p)return ru;$p=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return ru=e,ru}var nu,Cp;function cO(){if(Cp)return nu;Cp=1;var e=si(),t=Df(),r=Fe(),n=Qr(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return nu=o,nu}var iu,Ip;function jb(){if(Ip)return iu;Ip=1;var e=cO();function t(r){return r==null?"":e(r)}return iu=t,iu}var au,kp;function Eb(){if(kp)return au;kp=1;var e=Fe(),t=Mf(),r=sO(),n=jb();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return au=i,au}var ou,Dp;function Ra(){if(Dp)return ou;Dp=1;var e=Qr();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return ou=t,ou}var uu,Np;function Nf(){if(Np)return uu;Np=1;var e=Eb(),t=Ra();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return uu=r,uu}var su,Rp;function Mb(){if(Rp)return su;Rp=1;var e=Nf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return su=t,su}var lO=Mb();const Ze=ce(lO);var cu,qp;function fO(){if(qp)return cu;qp=1;function e(t){return t==null}return cu=e,cu}var hO=fO();const Q=ce(hO);var lu,Lp;function pO(){if(Lp)return lu;Lp=1;var e=Et(),t=Fe(),r=Mt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return lu=i,lu}var dO=pO();const ur=ce(dO);var vO=$f();const X=ce(vO);var yO=Ft();const en=ce(yO);var fu={exports:{}},ne={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as te,r as a,n as ie,d as N,p,j as e,F as ae,q as j,S as R,P as le,l as ne,L as re}from"./index-D-kuW17t.js";import{S as ce,a as oe}from"./severity-ZaGgvxL_.js";const E=50;function ge(){const[t,h]=te(),[i,l]=a.useState(null),[c,M]=a.useState({total:0,findings:[]}),[S,F]=a.useState([]),[H,V]=a.useState([]),[G,Q]=a.useState([]),[K,U]=a.useState(!0),[D,_]=a.useState(null),[f,I]=a.useState(!1),[w,q]=a.useState(1),[u,C]=a.useState(new Set),[T,J]=a.useState(0),{sort:r,toggle:P}=ie("severity","desc"),x=t.get("severity")??"",y=t.get("category")??"",b=t.get("rule")??"",L=t.get("session")??"",$=t.get("source")??"",A=t.get("project")??"",O=t.get("from")??"",W=t.get("to")??"",m=t.get("status")??"open",v=a.useMemo(()=>{const s=new URLSearchParams;for(const[n,d]of Object.entries({severity:x,category:y,rule:b,session:L,source:$,project:A,from:O,to:W,status:m}))d&&s.set(n,d);return s},[x,y,b,L,$,A,O,W,m]);a.useEffect(()=>{N("/sources").then(V).catch(()=>{}),N("/projects").then(Q).catch(()=>{})},[]),a.useEffect(()=>{N("/security/summary").then(l).catch(()=>{}),p||N("/security/mutes").then(F).catch(()=>{})},[T]),a.useEffect(()=>q(1),[v.toString(),r.key,r.dir]),a.useEffect(()=>C(new Set),[v.toString(),r.key,r.dir,w,T]),a.useEffect(()=>{U(!0),_(null);const s=new URLSearchParams(v);s.set("sort",r.key),s.set("dir",r.dir),s.set("limit",String(E)),s.set("offset",String((w-1)*E)),N("/security/findings?"+s.toString()).then(M).catch(n=>_(String(n))).finally(()=>U(!1))},[v,r.key,r.dir,w,T]);const o=a.useCallback(s=>{const n=new URLSearchParams(t);for(const[d,k]of Object.entries(s))k?n.set(d,k):n.delete(d);h(n)},[t,h]),g=a.useCallback(async s=>{I(!0),_(null);try{await s(),J(n=>n+1)}catch(n){_(String(n))}finally{I(!1)}},[]),X=a.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),B=a.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!y||s.category===y),[i,y]),Y=Math.max(1,Math.ceil(c.total/E)),Z=[...v.keys()].some(s=>s!=="status")||m!=="open",z=c.findings.map(s=>s.id),ee=z.length>0&&z.every(s=>u.has(s)),se=s=>C(n=>{const d=new Set(n);return d.has(s)?d.delete(s):d.add(s),d});return e.jsxs("div",{children:[e.jsxs("div",{className:"detail-head",children:[e.jsx("h1",{children:"Security findings"}),e.jsxs("p",{className:"muted",style:{margin:"4px 0 0",maxWidth:760},children:["Risky operations the agent performed, flagged after the fact by deterministic rules over each tool call. Counts show ",e.jsx("strong",{children:"open"})," findings — mark benign ones safe or mute a noisy rule so a real one stands out. agent-lens is retrospective; it surfaces what ",e.jsx("em",{children:"happened"}),", it doesn't block."]})]}),p&&e.jsxs("div",{className:"demo-note",role:"note",children:["📦 This is a static demo over synthetic sessions. Browse the findings and reference below —"," ",e.jsx("strong",{children:"triage"})," (mark safe, mute rules) and live filtering run in the local app on your own data."]}),e.jsxs("div",{className:"kpi-row sev-kpis",role:"group","aria-label":"Open findings by severity",children:[e.jsxs("button",{type:"button",className:"kpi kpi-btn"+(x?"":" is-active"),onClick:()=>o({severity:""}),children:[e.jsx("div",{className:"kpi-label",children:"Open findings"}),e.jsx("div",{className:"kpi-value",children:(i==null?void 0:i.total)??"—"}),e.jsxs("div",{className:"kpi-sub",children:[(i==null?void 0:i.sessions_flagged)??0," sessions flagged"]})]}),ce.map(s=>e.jsxs("button",{type:"button",className:"kpi kpi-btn sev-kpi sev-"+s+(x===s?" is-active":""),onClick:()=>o({severity:x===s?"":s}),"aria-pressed":x===s,children:[e.jsx("div",{className:"kpi-label",children:s}),e.jsx("div",{className:"kpi-value",children:X.get(s)??0})]},s))]}),i&&(i.dismissed>0||i.muted>0)&&e.jsxs("div",{className:"triage-counts muted small",children:[e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:m,onChange:s=>o({status:s.target.value}),children:[e.jsx("option",{value:"open",children:"open"}),e.jsx("option",{value:"dismissed",children:"dismissed"}),e.jsx("option",{value:"muted",children:"muted"}),e.jsx("option",{value:"all",children:"all"})]}),e.jsxs("select",{"aria-label":"Filter by category",value:y,onChange:s=>{const n=s.target.value,d=!b||B.some(k=>k.rule_id===b&&(!n||k.category===n));o({category:n,rule:d?b:""})},children:[e.jsx("option",{value:"",children:"all categories"}),((i==null?void 0:i.categories)??[]).map(s=>e.jsx("option",{value:s.key,children:s.title},s.key))]}),e.jsxs("select",{"aria-label":"Filter by rule",value:b,onChange:s=>o({rule:s.target.value}),children:[e.jsx("option",{value:"",children:"all rules"}),B.map(s=>e.jsxs("option",{value:s.rule_id,children:[s.rule_id," (",s.n,")"]},s.rule_id))]}),e.jsxs("select",{"aria-label":"Filter by source",value:$,onChange:s=>o({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),H.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(ae,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:A,onChange:s=>o({project:s}),options:[{value:"",label:"all projects"},...G.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]}),e.jsxs("label",{className:"ctl",children:["from ",e.jsx("input",{type:"date",value:O,onChange:s=>o({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:W,onChange:s=>o({to:s.target.value})})]}),L&&e.jsxs("span",{className:"tag",style:{alignSelf:"center"},children:["session ",L.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>o({session:""}),children:"✕"})]}),Z&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>h(new URLSearchParams),children:"clear filters"})]}),!p&&(u.size>0||m==="open"&&c.total>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[u.size>0&&m!=="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/dismiss",{ids:[...u]})),children:["✓ Mark ",u.size," safe"]}),u.size>0&&m==="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/reopen",{ids:[...u]})),children:["↩ Reopen ",u.size]}),u.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>C(new Set),children:"clear selection"}),m==="open"&&c.total>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:f,onClick:()=>{confirm(`Dismiss all ${c.total} open findings matching the current filter as safe?`)&&g(()=>j("/security/dismiss-matching",{filter:Object.fromEntries(v)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",c.total," matching"]})]}),D&&e.jsx("div",{className:"error",role:"alert",children:D}),K?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):c.findings.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&m==="open"?"No open security findings — nothing risky is awaiting review.":"No findings match these filters."}):e.jsxs("table",{className:"sessions findings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[!p&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:ee,onChange:s=>C(s.target.checked?new Set(z):new Set)})}),e.jsx(R,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Finding"}),e.jsx(R,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Evidence"}),e.jsx(R,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:P}),e.jsx(R,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:P}),!p&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:c.findings.map(s=>e.jsx(de,{f:s,selected:u.has(s.id),onToggle:()=>se(s.id),busy:f,onDismiss:()=>g(()=>j("/security/dismiss",{ids:[s.id]})),onReopen:()=>g(()=>j("/security/reopen",{ids:[s.id]})),onMute:()=>g(()=>j("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!K&&c.total>E&&e.jsx(le,{page:w,pages:Y,total:c.total,unit:"findings",onPage:q}),!p&&S.length>0&&e.jsx(ue,{mutes:S,busy:f,onUnmute:s=>g(()=>j("/security/unmute",{rule_id:s.rule_id,scope:s.scope,scope_id:s.scope_id}))}),i&&i.categories.length>0&&e.jsx(he,{summary:i})]})}function de({f:t,selected:h,onToggle:i,busy:l,onDismiss:c,onReopen:M,onMute:S}){const F=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!p&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:h,onChange:i})}),e.jsxs("td",{children:[e.jsx(oe,{severity:t.severity}),t.dismissed?e.jsx("span",{className:"tag",style:{marginLeft:4},title:t.dismiss_note??"",children:"safe"}):null]}),e.jsxs("td",{children:[e.jsx("div",{className:"finding-title",children:t.title??t.rule_id}),e.jsxs("div",{className:"muted small",children:[e.jsx("code",{children:t.rule_id}),t.framework_ref&&e.jsx("span",{className:"tag framework",style:{marginLeft:6},children:t.framework_ref})]})]}),e.jsx("td",{className:"small",children:t.category}),e.jsxs("td",{className:"finding-evidence-cell",children:[t.tool_name&&e.jsx("span",{className:"tag tool-tag",title:"Tool the finding fired on",children:t.tool_name}),e.jsx("code",{title:t.evidence??"",children:t.evidence})]}),e.jsx("td",{className:"small muted",title:t.started_at??"",children:ne(t.started_at??null)}),e.jsxs("td",{className:"small",children:[e.jsx(re,{to:F,className:"title",children:t.session_title||t.session_id.slice(0,12)}),t.is_sidechain?e.jsx("span",{className:"tag subagent",style:{marginLeft:6},children:"subagent"}):null,t.project_path&&e.jsx("div",{className:"muted path",children:t.project_path.replace(/^.*\//,"")})]}),!p&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:M,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:c,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:S,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function ue({mutes:t,busy:h,onUnmute:i}){return e.jsxs("details",{className:"card muted-rules",children:[e.jsx("summary",{children:e.jsxs("span",{className:"sec-ref-title",children:["Muted rules (",t.length,")"]})}),e.jsx("ul",{className:"muted-rules-list",children:t.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.rule_id}),e.jsxs("span",{className:"tag",style:{marginLeft:6},children:[l.scope,l.scope_id?`: ${l.scope_id}`:""]}),l.note&&e.jsx("span",{className:"muted small",style:{marginLeft:6},children:l.note}),e.jsx("button",{type:"button",className:"linkish",style:{marginLeft:8},disabled:h,onClick:()=>i(l),children:"unmute"})]},`${l.rule_id}:${l.scope}:${l.scope_id}`))})]})}function he({summary:t}){const h=new Map(t.by_category.map(i=>[i.category,i.n]));return e.jsxs("section",{className:"sec-reference",children:[e.jsx("h2",{children:"Risk categories"}),e.jsx("p",{className:"muted small",style:{marginTop:0},children:"What each category means and why it matters, anchored to OWASP Top 10 for Agentic Apps and MITRE ATLAS."}),e.jsx("div",{className:"sec-ref-grid",children:t.categories.map(i=>e.jsxs("details",{className:"card sec-ref",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"sec-ref-title",children:i.title}),e.jsxs("a",{className:"tag framework",href:i.framework_url,target:"_blank",rel:"noreferrer",onClick:l=>l.stopPropagation(),children:[i.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[h.get(i.key)??0," open"]})]}),e.jsxs("dl",{className:"sec-ref-body",children:[e.jsx("dt",{children:"What"}),e.jsx("dd",{children:i.what}),e.jsx("dt",{children:"Why it matters"}),e.jsx("dd",{children:i.why}),e.jsx("dt",{children:"What to do"}),e.jsx("dd",{children:i.remediation})]})]},i.key))})]})}export{ge as default};
|
|
1
|
+
import{a as te,r as a,n as ie,d as N,p,j as e,F as ae,q as j,S as R,P as le,l as ne,L as re}from"./index-B_beFRjy.js";import{S as ce,a as oe}from"./severity-TiQaFcLQ.js";const E=50;function ge(){const[t,h]=te(),[i,l]=a.useState(null),[c,M]=a.useState({total:0,findings:[]}),[S,F]=a.useState([]),[H,V]=a.useState([]),[G,Q]=a.useState([]),[K,U]=a.useState(!0),[D,_]=a.useState(null),[f,I]=a.useState(!1),[w,q]=a.useState(1),[u,C]=a.useState(new Set),[T,J]=a.useState(0),{sort:r,toggle:P}=ie("severity","desc"),x=t.get("severity")??"",y=t.get("category")??"",b=t.get("rule")??"",L=t.get("session")??"",$=t.get("source")??"",A=t.get("project")??"",O=t.get("from")??"",W=t.get("to")??"",m=t.get("status")??"open",v=a.useMemo(()=>{const s=new URLSearchParams;for(const[n,d]of Object.entries({severity:x,category:y,rule:b,session:L,source:$,project:A,from:O,to:W,status:m}))d&&s.set(n,d);return s},[x,y,b,L,$,A,O,W,m]);a.useEffect(()=>{N("/sources").then(V).catch(()=>{}),N("/projects").then(Q).catch(()=>{})},[]),a.useEffect(()=>{N("/security/summary").then(l).catch(()=>{}),p||N("/security/mutes").then(F).catch(()=>{})},[T]),a.useEffect(()=>q(1),[v.toString(),r.key,r.dir]),a.useEffect(()=>C(new Set),[v.toString(),r.key,r.dir,w,T]),a.useEffect(()=>{U(!0),_(null);const s=new URLSearchParams(v);s.set("sort",r.key),s.set("dir",r.dir),s.set("limit",String(E)),s.set("offset",String((w-1)*E)),N("/security/findings?"+s.toString()).then(M).catch(n=>_(String(n))).finally(()=>U(!1))},[v,r.key,r.dir,w,T]);const o=a.useCallback(s=>{const n=new URLSearchParams(t);for(const[d,k]of Object.entries(s))k?n.set(d,k):n.delete(d);h(n)},[t,h]),g=a.useCallback(async s=>{I(!0),_(null);try{await s(),J(n=>n+1)}catch(n){_(String(n))}finally{I(!1)}},[]),X=a.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),B=a.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!y||s.category===y),[i,y]),Y=Math.max(1,Math.ceil(c.total/E)),Z=[...v.keys()].some(s=>s!=="status")||m!=="open",z=c.findings.map(s=>s.id),ee=z.length>0&&z.every(s=>u.has(s)),se=s=>C(n=>{const d=new Set(n);return d.has(s)?d.delete(s):d.add(s),d});return e.jsxs("div",{children:[e.jsxs("div",{className:"detail-head",children:[e.jsx("h1",{children:"Security findings"}),e.jsxs("p",{className:"muted",style:{margin:"4px 0 0",maxWidth:760},children:["Risky operations the agent performed, flagged after the fact by deterministic rules over each tool call. Counts show ",e.jsx("strong",{children:"open"})," findings — mark benign ones safe or mute a noisy rule so a real one stands out. agent-lens is retrospective; it surfaces what ",e.jsx("em",{children:"happened"}),", it doesn't block."]})]}),p&&e.jsxs("div",{className:"demo-note",role:"note",children:["📦 This is a static demo over synthetic sessions. Browse the findings and reference below —"," ",e.jsx("strong",{children:"triage"})," (mark safe, mute rules) and live filtering run in the local app on your own data."]}),e.jsxs("div",{className:"kpi-row sev-kpis",role:"group","aria-label":"Open findings by severity",children:[e.jsxs("button",{type:"button",className:"kpi kpi-btn"+(x?"":" is-active"),onClick:()=>o({severity:""}),children:[e.jsx("div",{className:"kpi-label",children:"Open findings"}),e.jsx("div",{className:"kpi-value",children:(i==null?void 0:i.total)??"—"}),e.jsxs("div",{className:"kpi-sub",children:[(i==null?void 0:i.sessions_flagged)??0," sessions flagged"]})]}),ce.map(s=>e.jsxs("button",{type:"button",className:"kpi kpi-btn sev-kpi sev-"+s+(x===s?" is-active":""),onClick:()=>o({severity:x===s?"":s}),"aria-pressed":x===s,children:[e.jsx("div",{className:"kpi-label",children:s}),e.jsx("div",{className:"kpi-value",children:X.get(s)??0})]},s))]}),i&&(i.dismissed>0||i.muted>0)&&e.jsxs("div",{className:"triage-counts muted small",children:[e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:m,onChange:s=>o({status:s.target.value}),children:[e.jsx("option",{value:"open",children:"open"}),e.jsx("option",{value:"dismissed",children:"dismissed"}),e.jsx("option",{value:"muted",children:"muted"}),e.jsx("option",{value:"all",children:"all"})]}),e.jsxs("select",{"aria-label":"Filter by category",value:y,onChange:s=>{const n=s.target.value,d=!b||B.some(k=>k.rule_id===b&&(!n||k.category===n));o({category:n,rule:d?b:""})},children:[e.jsx("option",{value:"",children:"all categories"}),((i==null?void 0:i.categories)??[]).map(s=>e.jsx("option",{value:s.key,children:s.title},s.key))]}),e.jsxs("select",{"aria-label":"Filter by rule",value:b,onChange:s=>o({rule:s.target.value}),children:[e.jsx("option",{value:"",children:"all rules"}),B.map(s=>e.jsxs("option",{value:s.rule_id,children:[s.rule_id," (",s.n,")"]},s.rule_id))]}),e.jsxs("select",{"aria-label":"Filter by source",value:$,onChange:s=>o({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),H.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(ae,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:A,onChange:s=>o({project:s}),options:[{value:"",label:"all projects"},...G.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]}),e.jsxs("label",{className:"ctl",children:["from ",e.jsx("input",{type:"date",value:O,onChange:s=>o({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:W,onChange:s=>o({to:s.target.value})})]}),L&&e.jsxs("span",{className:"tag",style:{alignSelf:"center"},children:["session ",L.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>o({session:""}),children:"✕"})]}),Z&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>h(new URLSearchParams),children:"clear filters"})]}),!p&&(u.size>0||m==="open"&&c.total>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[u.size>0&&m!=="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/dismiss",{ids:[...u]})),children:["✓ Mark ",u.size," safe"]}),u.size>0&&m==="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/reopen",{ids:[...u]})),children:["↩ Reopen ",u.size]}),u.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>C(new Set),children:"clear selection"}),m==="open"&&c.total>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:f,onClick:()=>{confirm(`Dismiss all ${c.total} open findings matching the current filter as safe?`)&&g(()=>j("/security/dismiss-matching",{filter:Object.fromEntries(v)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",c.total," matching"]})]}),D&&e.jsx("div",{className:"error",role:"alert",children:D}),K?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):c.findings.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&m==="open"?"No open security findings — nothing risky is awaiting review.":"No findings match these filters."}):e.jsxs("table",{className:"sessions findings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[!p&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:ee,onChange:s=>C(s.target.checked?new Set(z):new Set)})}),e.jsx(R,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Finding"}),e.jsx(R,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Evidence"}),e.jsx(R,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:P}),e.jsx(R,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:P}),!p&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:c.findings.map(s=>e.jsx(de,{f:s,selected:u.has(s.id),onToggle:()=>se(s.id),busy:f,onDismiss:()=>g(()=>j("/security/dismiss",{ids:[s.id]})),onReopen:()=>g(()=>j("/security/reopen",{ids:[s.id]})),onMute:()=>g(()=>j("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!K&&c.total>E&&e.jsx(le,{page:w,pages:Y,total:c.total,unit:"findings",onPage:q}),!p&&S.length>0&&e.jsx(ue,{mutes:S,busy:f,onUnmute:s=>g(()=>j("/security/unmute",{rule_id:s.rule_id,scope:s.scope,scope_id:s.scope_id}))}),i&&i.categories.length>0&&e.jsx(he,{summary:i})]})}function de({f:t,selected:h,onToggle:i,busy:l,onDismiss:c,onReopen:M,onMute:S}){const F=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!p&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:h,onChange:i})}),e.jsxs("td",{children:[e.jsx(oe,{severity:t.severity}),t.dismissed?e.jsx("span",{className:"tag",style:{marginLeft:4},title:t.dismiss_note??"",children:"safe"}):null]}),e.jsxs("td",{children:[e.jsx("div",{className:"finding-title",children:t.title??t.rule_id}),e.jsxs("div",{className:"muted small",children:[e.jsx("code",{children:t.rule_id}),t.framework_ref&&e.jsx("span",{className:"tag framework",style:{marginLeft:6},children:t.framework_ref})]})]}),e.jsx("td",{className:"small",children:t.category}),e.jsxs("td",{className:"finding-evidence-cell",children:[t.tool_name&&e.jsx("span",{className:"tag tool-tag",title:"Tool the finding fired on",children:t.tool_name}),e.jsx("code",{title:t.evidence??"",children:t.evidence})]}),e.jsx("td",{className:"small muted",title:t.started_at??"",children:ne(t.started_at??null)}),e.jsxs("td",{className:"small",children:[e.jsx(re,{to:F,className:"title",children:t.session_title||t.session_id.slice(0,12)}),t.is_sidechain?e.jsx("span",{className:"tag subagent",style:{marginLeft:6},children:"subagent"}):null,t.project_path&&e.jsx("div",{className:"muted path",children:t.project_path.replace(/^.*\//,"")})]}),!p&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:M,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:c,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:S,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function ue({mutes:t,busy:h,onUnmute:i}){return e.jsxs("details",{className:"card muted-rules",children:[e.jsx("summary",{children:e.jsxs("span",{className:"sec-ref-title",children:["Muted rules (",t.length,")"]})}),e.jsx("ul",{className:"muted-rules-list",children:t.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.rule_id}),e.jsxs("span",{className:"tag",style:{marginLeft:6},children:[l.scope,l.scope_id?`: ${l.scope_id}`:""]}),l.note&&e.jsx("span",{className:"muted small",style:{marginLeft:6},children:l.note}),e.jsx("button",{type:"button",className:"linkish",style:{marginLeft:8},disabled:h,onClick:()=>i(l),children:"unmute"})]},`${l.rule_id}:${l.scope}:${l.scope_id}`))})]})}function he({summary:t}){const h=new Map(t.by_category.map(i=>[i.category,i.n]));return e.jsxs("section",{className:"sec-reference",children:[e.jsx("h2",{children:"Risk categories"}),e.jsx("p",{className:"muted small",style:{marginTop:0},children:"What each category means and why it matters, anchored to OWASP Top 10 for Agentic Apps and MITRE ATLAS."}),e.jsx("div",{className:"sec-ref-grid",children:t.categories.map(i=>e.jsxs("details",{className:"card sec-ref",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"sec-ref-title",children:i.title}),e.jsxs("a",{className:"tag framework",href:i.framework_url,target:"_blank",rel:"noreferrer",onClick:l=>l.stopPropagation(),children:[i.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[h.get(i.key)??0," open"]})]}),e.jsxs("dl",{className:"sec-ref-body",children:[e.jsx("dt",{children:"What"}),e.jsx("dd",{children:i.what}),e.jsx("dt",{children:"Why it matters"}),e.jsx("dd",{children:i.why}),e.jsx("dt",{children:"What to do"}),e.jsx("dd",{children:i.remediation})]})]},i.key))})]})}export{ge as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as cs,k as ds,r as m,d as us,j as s,L as y,h as H,t as ms,f as W,e as C,l as D,m as hs,s as Q}from"./index-D-kuW17t.js";import{C as b,p as v}from"./CopyButton-hsiW2B6o.js";import{S as O,a as V}from"./severity-ZaGgvxL_.js";import{M as ps,r as xs}from"./index-BXp9oWUn.js";const K=m.createContext("markdown"),Y=m.createContext(new Map),z=m.createContext(!1),G=m.createContext(null),X="agentlens.msgFormat";function fs(){try{return localStorage.getItem(X)==="raw"?"raw":"markdown"}catch{return"markdown"}}const Z="agentlens.hideTools";function js(){try{return localStorage.getItem(Z)==="1"}catch{return!1}}function gs({c:e}){var o;const[n,t]=m.useState(!1),l=m.useId(),a=(o=e.signals)==null?void 0:o.loc;return s.jsxs("div",{className:"classification",children:[s.jsx("span",{className:"tag cat cat-"+(e.category??"none"),children:e.category??"unclassified"}),e.complexity_band&&s.jsxs("span",{className:"tag complexity",children:[e.complexity_band," · ",e.complexity_score]}),a&&s.jsxs("span",{className:"muted small",children:["+",a.added,"/−",a.removed," LoC · ",a.files," files"]}),s.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(r=>!r),children:["why ",n?"▾":"▸"]}),n&&(e.signals?s.jsx(ws,{id:l,s:e.signals,category:e.category}):s.jsx("div",{id:l,className:"muted small pad",children:"No signals recorded for this session."}))]})}const Ns={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},L=e=>`${Math.max(0,Math.min(1,e))*100}%`;function R({counts:e}){const n=Object.entries(e).sort((t,l)=>l[1]-t[1]);return n.length===0?s.jsx("span",{className:"muted",children:"—"}):s.jsx("span",{className:"sig-chips",children:n.map(([t,l])=>s.jsxs("span",{className:"sig-chip",children:[t," ",s.jsxs("span",{className:"muted",children:["×",l]})]},t))})}function ws({id:e,s:n,category:t}){const[l,a]=m.useState(!1),o=m.useId(),r=n.complexity_weights??{},i=n.complexity_subscores??{},c=Object.keys(r).map(d=>({key:d,weight:r[d],subscore:i[d]??0,pts:r[d]*(i[d]??0)*100})).sort((d,_)=>_.pts-d.pts),u=Math.max(...c.map(d=>d.pts),1e-4),p=Object.entries(n.category_scores??{}).map(([d,_])=>({k:d,v:_})).sort((d,_)=>_.v-d.v),f=Math.max(...p.map(d=>d.v),1e-4),x=p.filter(d=>d.v>.02||d.k===t),g=n.skills&&Object.keys(n.skills).length>0;return s.jsxs("div",{id:e,className:"signals-panel",children:[c.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Complexity breakdown ",s.jsx("span",{className:"muted",children:"— what built the score"})]}),s.jsx("ul",{className:"sig-bars",children:c.map(d=>s.jsxs("li",{className:"sig-bar-row",children:[s.jsx("span",{className:"sig-bar-label",children:Ns[d.key]??d.key}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.pts/u)}})}),s.jsxs("span",{className:"sig-bar-val",children:[d.pts.toFixed(1)," pts"]}),s.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(d.subscore*100),"% intensity · weight ",Math.round(d.weight*100),"%"]})]},d.key))})]}),x.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Category scores ",s.jsxs("span",{className:"muted",children:["— why “",t,"” won"]})]}),s.jsx("ul",{className:"sig-bars",children:x.map(d=>s.jsxs("li",{className:"sig-bar-row"+(d.k===t?" is-win":""),children:[s.jsx("span",{className:"sig-bar-label",children:d.k}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.v/f)}})}),s.jsx("span",{className:"sig-bar-val",children:d.v.toFixed(2)})]},d.k))})]}),s.jsxs("section",{className:"sig-section",children:[s.jsx("h4",{className:"sig-h",children:"Evidence"}),s.jsxs("dl",{className:"sig-grid",children:[n.tool_counts&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Tools"}),s.jsx("dd",{children:s.jsx(R,{counts:n.tool_counts})})]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Skills"}),s.jsx("dd",{children:s.jsx(R,{counts:n.skills})})]}),n.subagent_role&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Subagent role"}),s.jsx("dd",{children:n.subagent_role})]}),n.files&&n.files.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("dt",{children:["Files (",n.files.length,")"]}),s.jsx("dd",{className:"sig-files",children:n.files.join(", ")})]})]})]}),s.jsx("button",{className:"ghost small","aria-expanded":l,"aria-controls":o,onClick:()=>a(d=>!d),children:l?"Hide raw JSON ▴":"View raw JSON ▾"}),l&&s.jsx("pre",{id:o,className:"code signals",children:JSON.stringify(n,null,2)})]})}function _s({f:e}){var r;const[n,t]=m.useState(!1),l=m.useId(),a=((r=e.signals)==null?void 0:r.modifiers)??{},o=Object.keys(a).filter(i=>a[i]!==!1&&a[i]!=null&&a[i]!=="");return s.jsxs("div",{className:"finding sev-border-"+e.severity,children:[s.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":l,onClick:()=>t(i=>!i),children:[s.jsx(V,{severity:e.severity}),s.jsx("span",{className:"finding-title",children:e.title??e.rule_id}),e.framework_ref&&s.jsx("span",{className:"tag framework",children:e.framework_ref}),s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&s.jsxs("div",{className:"finding-body",id:l,children:[e.evidence&&s.jsx("div",{className:"code-block",children:s.jsx("pre",{className:"code finding-evidence",children:e.evidence})}),s.jsxs("dl",{className:"sig-grid",children:[s.jsx("dt",{children:"Rule"}),s.jsx("dd",{children:s.jsx("code",{children:e.rule_id})}),s.jsx("dt",{children:"Category"}),s.jsx("dd",{children:e.category}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Context"}),s.jsx("dd",{children:o.map(i=>s.jsxs("span",{className:"sig-chip",children:[i,a[i]!==!0?s.jsxs("span",{className:"muted",children:[" ",String(a[i])]}):null]},i))})]})]}),s.jsxs(y,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(e.rule_id)}`,children:["see all “",e.rule_id,"” findings →"]})]})]})}function ks({findings:e}){if(!e.length)return null;const n=[...e].sort((t,l)=>O.indexOf(t.severity)-O.indexOf(l.severity));return s.jsx("div",{className:"tool-findings",children:n.map(t=>s.jsx(_s,{f:t},t.id))})}function ys({findings:e,sessionId:n}){const t=new Map;for(const a of e)t.set(a.severity,(t.get(a.severity)??0)+1);const l=O.find(a=>t.has(a))??"info";return s.jsxs("div",{className:"security-banner sev-border-"+l,role:"status",children:[s.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),s.jsxs("span",{className:"security-banner-text",children:[e.length," security ",e.length===1?"finding":"findings"," in this session"]}),s.jsx("span",{className:"security-banner-sevs",children:O.filter(a=>t.has(a)).map(a=>s.jsx(V,{severity:a,count:t.get(a)},a))}),s.jsx(y,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function ss({t:e}){const[n,t]=m.useState(!1),[l,a]=m.useState(!1),o=m.useId(),r=e.skill_name?`Skill · ${e.skill_name}`:e.tool_name==="Workflow"&&e.workflow_name?`Workflow · ${e.workflow_name}`:e.agent_type?`${e.tool_name} → ${e.agent_type}`:e.tool_name;return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":n,"aria-controls":o,onClick:()=>t(i=>!i),children:[s.jsxs("span",{className:"tool-name",children:["🔧 ",r]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),e.spawned_session_id&&s.jsx(y,{className:"subagent-link small",to:`/session/${e.spawned_session_id}`,children:"view subagent transcript →"}),e.workflow_run_id&&s.jsxs(y,{className:"subagent-link small",to:`/workflow/${e.workflow_run_id}`,children:["🔀 launched ",e.workflow_agent_count??0," agent",e.workflow_agent_count===1?"":"s"," · ",s.jsx("code",{children:e.workflow_run_id})," →"]}),e.skill_name&&s.jsxs(y,{className:"subagent-link small",to:`/skill/${encodeURIComponent(e.skill_name)}${e.skill_id?`?v=${e.skill_id}`:""}`,children:["📖 view skill",e.skill_id?" version":""," →"]}),n&&s.jsxs("div",{className:"tool-body",id:o,children:[e.input_json&&e.input_json!=="{}"&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:v(e.input_json),className:"copy-corner",title:"Copy tool input JSON"}),s.jsx("pre",{className:"code",children:v(e.input_json)})]}),e.result_summary&&s.jsx("div",{className:"result",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":l,onClick:()=>a(i=>!i),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]})]})]})}function es(e){if(!e)return null;try{const n=JSON.parse(e).plan;return typeof n=="string"&&n.trim()?n:null}catch{return null}}function vs({plan:e}){return s.jsxs("div",{className:"plan-card",children:[s.jsx("div",{className:"plan-card-head",children:"📋 Approved plan"}),s.jsx(as,{text:e})]})}function bs(e){if(!e)return[];try{const n=JSON.parse(e).questions;return Array.isArray(n)?n:[]}catch{return[]}}function Ss(e){if(!e)return{answers:{},annotations:{}};try{const n=JSON.parse(e);if(n&&typeof n=="object"&&n.answers)return{answers:n.answers,annotations:n.annotations??{}}}catch{}return{answers:{},annotations:{}}}function Cs({t:e}){const[n,t]=m.useState(!1),l=m.useId(),a=bs(e.input_json),{answers:o,annotations:r}=Ss(e.result_summary);return a.length===0?s.jsx(ss,{t:e}):s.jsxs("div",{className:"qa-card",children:[s.jsxs("div",{className:"qa-card-head",children:["🙋 Question",a.length===1?"":"s"," for the user"]}),a.map((i,c)=>{var _;const u=o[i.question],p=Array.isArray(u)?u:u!=null?[u]:[],f=new Set(p),x=new Set(i.options.map(w=>w.label)),g=p.filter(w=>!x.has(w)),d=(_=r[i.question])==null?void 0:_.notes;return s.jsxs("div",{className:"qa-q",children:[s.jsxs("div",{className:"qa-q-head",children:[i.header&&s.jsx("span",{className:"tag",children:i.header}),i.multiSelect&&s.jsx("span",{className:"muted small",children:"multi-select"})]}),s.jsx("div",{className:"qa-question",children:i.question}),s.jsxs("ul",{className:"qa-options",children:[i.options.map((w,S)=>{const N=f.has(w.label);return s.jsxs("li",{className:"qa-opt"+(N?" is-selected":""),children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:N?"☑":"☐"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w.label}),w.description&&s.jsx("span",{className:"qa-opt-desc muted",children:w.description})]})]},S)}),g.map((w,S)=>s.jsxs("li",{className:"qa-opt is-selected",children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:"☑"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w}),s.jsx("span",{className:"qa-opt-desc muted",children:"custom answer"})]})]},"c"+S))]}),d&&s.jsxs("div",{className:"qa-note",children:["📝 ",d]})]},c)}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(i=>!i),children:n?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(b,{text:v(e.input_json??"{}")+(e.result_summary?`
|
|
1
|
+
import{i as cs,k as ds,r as m,d as us,j as s,L as y,h as H,t as ms,f as W,e as C,l as D,m as hs,s as Q}from"./index-B_beFRjy.js";import{C as b,p as v}from"./CopyButton-CQ5SHT0Q.js";import{S as O,a as V}from"./severity-TiQaFcLQ.js";import{M as ps,r as xs}from"./index-CM-5HLoq.js";const K=m.createContext("markdown"),Y=m.createContext(new Map),z=m.createContext(!1),G=m.createContext(null),X="agentlens.msgFormat";function fs(){try{return localStorage.getItem(X)==="raw"?"raw":"markdown"}catch{return"markdown"}}const Z="agentlens.hideTools";function js(){try{return localStorage.getItem(Z)==="1"}catch{return!1}}function gs({c:e}){var o;const[n,t]=m.useState(!1),l=m.useId(),a=(o=e.signals)==null?void 0:o.loc;return s.jsxs("div",{className:"classification",children:[s.jsx("span",{className:"tag cat cat-"+(e.category??"none"),children:e.category??"unclassified"}),e.complexity_band&&s.jsxs("span",{className:"tag complexity",children:[e.complexity_band," · ",e.complexity_score]}),a&&s.jsxs("span",{className:"muted small",children:["+",a.added,"/−",a.removed," LoC · ",a.files," files"]}),s.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(r=>!r),children:["why ",n?"▾":"▸"]}),n&&(e.signals?s.jsx(ws,{id:l,s:e.signals,category:e.category}):s.jsx("div",{id:l,className:"muted small pad",children:"No signals recorded for this session."}))]})}const Ns={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},L=e=>`${Math.max(0,Math.min(1,e))*100}%`;function R({counts:e}){const n=Object.entries(e).sort((t,l)=>l[1]-t[1]);return n.length===0?s.jsx("span",{className:"muted",children:"—"}):s.jsx("span",{className:"sig-chips",children:n.map(([t,l])=>s.jsxs("span",{className:"sig-chip",children:[t," ",s.jsxs("span",{className:"muted",children:["×",l]})]},t))})}function ws({id:e,s:n,category:t}){const[l,a]=m.useState(!1),o=m.useId(),r=n.complexity_weights??{},i=n.complexity_subscores??{},c=Object.keys(r).map(d=>({key:d,weight:r[d],subscore:i[d]??0,pts:r[d]*(i[d]??0)*100})).sort((d,_)=>_.pts-d.pts),u=Math.max(...c.map(d=>d.pts),1e-4),p=Object.entries(n.category_scores??{}).map(([d,_])=>({k:d,v:_})).sort((d,_)=>_.v-d.v),f=Math.max(...p.map(d=>d.v),1e-4),x=p.filter(d=>d.v>.02||d.k===t),g=n.skills&&Object.keys(n.skills).length>0;return s.jsxs("div",{id:e,className:"signals-panel",children:[c.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Complexity breakdown ",s.jsx("span",{className:"muted",children:"— what built the score"})]}),s.jsx("ul",{className:"sig-bars",children:c.map(d=>s.jsxs("li",{className:"sig-bar-row",children:[s.jsx("span",{className:"sig-bar-label",children:Ns[d.key]??d.key}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.pts/u)}})}),s.jsxs("span",{className:"sig-bar-val",children:[d.pts.toFixed(1)," pts"]}),s.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(d.subscore*100),"% intensity · weight ",Math.round(d.weight*100),"%"]})]},d.key))})]}),x.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Category scores ",s.jsxs("span",{className:"muted",children:["— why “",t,"” won"]})]}),s.jsx("ul",{className:"sig-bars",children:x.map(d=>s.jsxs("li",{className:"sig-bar-row"+(d.k===t?" is-win":""),children:[s.jsx("span",{className:"sig-bar-label",children:d.k}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.v/f)}})}),s.jsx("span",{className:"sig-bar-val",children:d.v.toFixed(2)})]},d.k))})]}),s.jsxs("section",{className:"sig-section",children:[s.jsx("h4",{className:"sig-h",children:"Evidence"}),s.jsxs("dl",{className:"sig-grid",children:[n.tool_counts&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Tools"}),s.jsx("dd",{children:s.jsx(R,{counts:n.tool_counts})})]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Skills"}),s.jsx("dd",{children:s.jsx(R,{counts:n.skills})})]}),n.subagent_role&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Subagent role"}),s.jsx("dd",{children:n.subagent_role})]}),n.files&&n.files.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("dt",{children:["Files (",n.files.length,")"]}),s.jsx("dd",{className:"sig-files",children:n.files.join(", ")})]})]})]}),s.jsx("button",{className:"ghost small","aria-expanded":l,"aria-controls":o,onClick:()=>a(d=>!d),children:l?"Hide raw JSON ▴":"View raw JSON ▾"}),l&&s.jsx("pre",{id:o,className:"code signals",children:JSON.stringify(n,null,2)})]})}function _s({f:e}){var r;const[n,t]=m.useState(!1),l=m.useId(),a=((r=e.signals)==null?void 0:r.modifiers)??{},o=Object.keys(a).filter(i=>a[i]!==!1&&a[i]!=null&&a[i]!=="");return s.jsxs("div",{className:"finding sev-border-"+e.severity,children:[s.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":l,onClick:()=>t(i=>!i),children:[s.jsx(V,{severity:e.severity}),s.jsx("span",{className:"finding-title",children:e.title??e.rule_id}),e.framework_ref&&s.jsx("span",{className:"tag framework",children:e.framework_ref}),s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&s.jsxs("div",{className:"finding-body",id:l,children:[e.evidence&&s.jsx("div",{className:"code-block",children:s.jsx("pre",{className:"code finding-evidence",children:e.evidence})}),s.jsxs("dl",{className:"sig-grid",children:[s.jsx("dt",{children:"Rule"}),s.jsx("dd",{children:s.jsx("code",{children:e.rule_id})}),s.jsx("dt",{children:"Category"}),s.jsx("dd",{children:e.category}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Context"}),s.jsx("dd",{children:o.map(i=>s.jsxs("span",{className:"sig-chip",children:[i,a[i]!==!0?s.jsxs("span",{className:"muted",children:[" ",String(a[i])]}):null]},i))})]})]}),s.jsxs(y,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(e.rule_id)}`,children:["see all “",e.rule_id,"” findings →"]})]})]})}function ks({findings:e}){if(!e.length)return null;const n=[...e].sort((t,l)=>O.indexOf(t.severity)-O.indexOf(l.severity));return s.jsx("div",{className:"tool-findings",children:n.map(t=>s.jsx(_s,{f:t},t.id))})}function ys({findings:e,sessionId:n}){const t=new Map;for(const a of e)t.set(a.severity,(t.get(a.severity)??0)+1);const l=O.find(a=>t.has(a))??"info";return s.jsxs("div",{className:"security-banner sev-border-"+l,role:"status",children:[s.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),s.jsxs("span",{className:"security-banner-text",children:[e.length," security ",e.length===1?"finding":"findings"," in this session"]}),s.jsx("span",{className:"security-banner-sevs",children:O.filter(a=>t.has(a)).map(a=>s.jsx(V,{severity:a,count:t.get(a)},a))}),s.jsx(y,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function ss({t:e}){const[n,t]=m.useState(!1),[l,a]=m.useState(!1),o=m.useId(),r=e.skill_name?`Skill · ${e.skill_name}`:e.tool_name==="Workflow"&&e.workflow_name?`Workflow · ${e.workflow_name}`:e.agent_type?`${e.tool_name} → ${e.agent_type}`:e.tool_name;return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":n,"aria-controls":o,onClick:()=>t(i=>!i),children:[s.jsxs("span",{className:"tool-name",children:["🔧 ",r]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),e.spawned_session_id&&s.jsx(y,{className:"subagent-link small",to:`/session/${e.spawned_session_id}`,children:"view subagent transcript →"}),e.workflow_run_id&&s.jsxs(y,{className:"subagent-link small",to:`/workflow/${e.workflow_run_id}`,children:["🔀 launched ",e.workflow_agent_count??0," agent",e.workflow_agent_count===1?"":"s"," · ",s.jsx("code",{children:e.workflow_run_id})," →"]}),e.skill_name&&s.jsxs(y,{className:"subagent-link small",to:`/skill/${encodeURIComponent(e.skill_name)}${e.skill_id?`?v=${e.skill_id}`:""}`,children:["📖 view skill",e.skill_id?" version":""," →"]}),n&&s.jsxs("div",{className:"tool-body",id:o,children:[e.input_json&&e.input_json!=="{}"&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:v(e.input_json),className:"copy-corner",title:"Copy tool input JSON"}),s.jsx("pre",{className:"code",children:v(e.input_json)})]}),e.result_summary&&s.jsx("div",{className:"result",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":l,onClick:()=>a(i=>!i),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]})]})]})}function es(e){if(!e)return null;try{const n=JSON.parse(e).plan;return typeof n=="string"&&n.trim()?n:null}catch{return null}}function vs({plan:e}){return s.jsxs("div",{className:"plan-card",children:[s.jsx("div",{className:"plan-card-head",children:"📋 Approved plan"}),s.jsx(as,{text:e})]})}function bs(e){if(!e)return[];try{const n=JSON.parse(e).questions;return Array.isArray(n)?n:[]}catch{return[]}}function Ss(e){if(!e)return{answers:{},annotations:{}};try{const n=JSON.parse(e);if(n&&typeof n=="object"&&n.answers)return{answers:n.answers,annotations:n.annotations??{}}}catch{}return{answers:{},annotations:{}}}function Cs({t:e}){const[n,t]=m.useState(!1),l=m.useId(),a=bs(e.input_json),{answers:o,annotations:r}=Ss(e.result_summary);return a.length===0?s.jsx(ss,{t:e}):s.jsxs("div",{className:"qa-card",children:[s.jsxs("div",{className:"qa-card-head",children:["🙋 Question",a.length===1?"":"s"," for the user"]}),a.map((i,c)=>{var _;const u=o[i.question],p=Array.isArray(u)?u:u!=null?[u]:[],f=new Set(p),x=new Set(i.options.map(w=>w.label)),g=p.filter(w=>!x.has(w)),d=(_=r[i.question])==null?void 0:_.notes;return s.jsxs("div",{className:"qa-q",children:[s.jsxs("div",{className:"qa-q-head",children:[i.header&&s.jsx("span",{className:"tag",children:i.header}),i.multiSelect&&s.jsx("span",{className:"muted small",children:"multi-select"})]}),s.jsx("div",{className:"qa-question",children:i.question}),s.jsxs("ul",{className:"qa-options",children:[i.options.map((w,S)=>{const N=f.has(w.label);return s.jsxs("li",{className:"qa-opt"+(N?" is-selected":""),children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:N?"☑":"☐"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w.label}),w.description&&s.jsx("span",{className:"qa-opt-desc muted",children:w.description})]})]},S)}),g.map((w,S)=>s.jsxs("li",{className:"qa-opt is-selected",children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:"☑"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w}),s.jsx("span",{className:"qa-opt-desc muted",children:"custom answer"})]})]},"c"+S))]}),d&&s.jsxs("div",{className:"qa-note",children:["📝 ",d]})]},c)}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(i=>!i),children:n?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(b,{text:v(e.input_json??"{}")+(e.result_summary?`
|
|
2
2
|
|
|
3
3
|
`+v(e.result_summary):""),label:"JSON",title:"Copy raw question JSON"})]}),n&&s.jsxs("pre",{id:l,className:"code",children:[v(e.input_json??"{}"),e.result_summary?`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as N,a as g,r as a,d as k,j as s,L as j,l as c}from"./index-
|
|
1
|
+
import{i as N,a as g,r as a,d as k,j as s,L as j,l as c}from"./index-B_beFRjy.js";import{M as b,r as y}from"./index-CM-5HLoq.js";function S(l){return!l||l<0?"—":l>=1024?(l/1024).toFixed(1)+" KB":l+" B"}function _(l,t){return`${l.slice(0,8)} · ${c(t)}`}function F(){const{name:l=""}=N(),[t,v]=g(),[i,o]=a.useState(null),[f,h]=a.useState(!0),[m,u]=a.useState(null);a.useEffect(()=>{h(!0),u(null),o(null),k("/skills/"+encodeURIComponent(l)).then(o).catch(e=>u(String(e))).finally(()=>h(!1))},[l]);const r=a.useMemo(()=>{if(!(i!=null&&i.versions.length))return null;const e=t.get("v");return i.versions.find(n=>n.id===e)??i.versions[0]},[i,t]),d=a.useMemo(()=>i&&r?i.sessions.filter(e=>e.version_id===r.id):[],[i,r]),x=a.useMemo(()=>i?i.sessions.filter(e=>!e.version_id).length:0,[i]);function p(e){const n=new URLSearchParams(t);n.set("v",e),v(n)}return f?s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):m?s.jsx("div",{className:"error",role:"alert",children:m}):i?s.jsxs("div",{className:"skill-view",children:[s.jsx(j,{to:"/skills",className:"back",children:"← all skills"}),s.jsxs("header",{className:"skill-head",children:[s.jsxs("h1",{children:["📖 ",i.name]}),s.jsxs("div",{className:"skill-head-meta muted",children:[i.call_count.toLocaleString()," firing",i.call_count===1?"":"s"," ·"," ",i.versions.length," version",i.versions.length===1?"":"s",r!=null&&r.summary?s.jsxs(s.Fragment,{children:[" · ",r.summary]}):null]})]}),i.versions.length===0?s.jsxs("div",{className:"empty",children:["This skill fired ",i.call_count.toLocaleString()," time(s) but no SKILL.md body was captured in the transcripts, so there is no version content to show."]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"skill-version-bar",children:[s.jsxs("label",{className:"ctl",children:["version"," ",s.jsx("select",{"aria-label":"Skill version",value:(r==null?void 0:r.id)??"",onChange:e=>p(e.target.value),children:i.versions.map((e,n)=>s.jsxs("option",{value:e.id,children:[_(e.id,e.last_seen)," · ",e.call_count," fire",e.call_count===1?"":"s",n===0?" (latest)":""]},e.id))})]}),r&&s.jsxs("span",{className:"muted small",children:["first seen ",c(r.first_seen)," · last seen ",c(r.last_seen)," ·"," ",S(r.body_bytes)]})]}),r&&s.jsxs("div",{className:"cards skill-cards",children:[s.jsxs("div",{className:"card skill-body-card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Skill body"}),s.jsxs("span",{className:"card-hint",children:["version ",r.id.slice(0,8)]})]}),s.jsx("div",{className:"md skill-body",children:s.jsx(b,{remarkPlugins:[y],children:r.body})})]}),s.jsxs("div",{className:"card skill-sessions-card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Sessions that fired this version"}),s.jsx("span",{className:"card-hint",children:d.length})]}),d.length===0?s.jsx("div",{className:"empty",children:"No sessions fired this version."}):s.jsxs("table",{className:"sessions",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Session"}),s.jsx("th",{children:"Source"}),s.jsx("th",{children:"Project"}),s.jsx("th",{className:"num",children:"Fires"}),s.jsx("th",{children:"When"})]})}),s.jsx("tbody",{children:d.map(e=>{var n;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(j,{to:`/session/${e.id}`,className:"title",children:e.title||s.jsx("span",{className:"muted",children:e.id.slice(0,12)})})}),s.jsx("td",{children:e.source_id}),s.jsx("td",{className:"path",children:((n=e.project_path)==null?void 0:n.replace(/^.*\//,""))??"—"}),s.jsx("td",{className:"num",children:e.fire_count}),s.jsx("td",{children:c(e.fired_at)})]},e.id)})})]}),x>0&&s.jsxs("div",{className:"muted small pad",children:[x," firing(s) had no captured body and aren’t attributed to a version."]})]})]})]})]}):s.jsx("div",{className:"muted pad",children:"Not found."})}export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,r,n as I,d as h,o as K,j as e,F as M,S as m,L as D,l as U,P as $}from"./index-
|
|
1
|
+
import{a as C,r,n as I,d as h,o as K,j as e,F as M,S as m,L as D,l as U,P as $}from"./index-B_beFRjy.js";const j=50,V={name:t=>t.name,fired:t=>t.call_count,last_fired:t=>t.last_fired};function G(){const[t,N]=C(),[P,L]=r.useState([]),[_,q]=r.useState([]),[o,E]=r.useState([]),[p,x]=r.useState(!0),[S,g]=r.useState(null),[f,v]=r.useState(t.get("q")??""),{sort:a,toggle:d}=I("fired","desc"),[R,b]=r.useState(1);r.useEffect(()=>{h("/sources").then(L).catch(()=>{}),h("/projects").then(q).catch(()=>{})},[]),r.useEffect(()=>{x(!0),g(null);const s=new URLSearchParams;for(const l of["source","project","q"]){const y=t.get(l);y&&s.set(l,y)}const n=s.toString()?"?"+s.toString():"";h("/skills"+n).then(E).catch(l=>g(String(l))).finally(()=>x(!1))},[t]);function c(s,n){const l=new URLSearchParams(t);n?l.set(s,n):l.delete(s),N(l)}function F(s){s.preventDefault(),c("q",f.trim())}r.useEffect(()=>b(1),[t,a.key,a.dir]);const i=r.useMemo(()=>K(o,V[a.key],a.dir),[o,a.key,a.dir]),k=Math.max(1,Math.ceil(i.length/j)),u=Math.min(R,k),w=i.slice((u-1)*j,u*j);return e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:"Skills"}),e.jsxs("div",{className:"filters",children:[e.jsxs("form",{onSubmit:F,className:"search",role:"search",children:[e.jsx("input",{type:"search","aria-label":"Search skills by name and body",placeholder:"Search skill names & bodies…",value:f,onChange:s=>v(s.target.value)}),e.jsx("button",{type:"submit",children:"Search"}),t.get("q")&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>(v(""),c("q","")),children:"clear"})]}),e.jsxs("select",{"aria-label":"Filter by source",value:t.get("source")??"",onChange:s=>c("source",s.target.value),children:[e.jsx("option",{value:"",children:"all sources"}),P.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(M,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:t.get("project")??"",onChange:s=>c("project",s),options:[{value:"",label:"all projects"},..._.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]})]}),S&&e.jsx("div",{className:"error",role:"alert",children:S}),p?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):o.length===0?e.jsx("div",{className:"muted pad",role:"status",children:"No skills fired match."}):e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(m,{label:"Skill",sortKey:"name",active:a.key,dir:a.dir,onSort:d,defaultDir:"asc"}),e.jsx(m,{label:"Fired",sortKey:"fired",active:a.key,dir:a.dir,onSort:d,className:"num"}),e.jsx("th",{className:"num",children:"Versions"}),e.jsx("th",{children:"Sources"}),e.jsx(m,{label:"Last fired",sortKey:"last_fired",active:a.key,dir:a.dir,onSort:d})]})}),e.jsx("tbody",{children:w.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(D,{to:`/skill/${encodeURIComponent(s.name)}`,className:"title",children:s.name})}),e.jsx("td",{className:"num",children:s.call_count.toLocaleString()}),e.jsx("td",{className:"num",title:`${s.version_count} distinct captured ${s.version_count===1?"version":"versions"}`,children:s.version_count||e.jsx("span",{className:"muted",children:"—"})}),e.jsx("td",{children:e.jsx("span",{className:"sub",children:s.sources.map(n=>e.jsx("span",{className:"tag",children:n},n))})}),e.jsx("td",{children:U(s.last_fired)})]},s.name))})]}),!p&&i.length>0&&e.jsx($,{page:u,pages:k,total:i.length,unit:"skills",onPage:b})]})}export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,r as p,i as z,d as H,L as O,s as $,h as J,f as F,e as I,l as Q}from"./index-D-kuW17t.js";import{s as B,d as S,l as D,a as U,C as G,p as L}from"./CopyButton-hsiW2B6o.js";import{M as K,r as q}from"./index-BXp9oWUn.js";const g=e=>e===null||typeof e!="object",M=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function T({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const t=typeof e;return t==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):t==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function E({v:e}){return g(e)?s.jsx(T,{v:e}):Array.isArray(e)?e.every(g)?s.jsx("span",{className:"rv-str",children:e.map(String).join(", ")||"—"}):s.jsxs("span",{className:"muted",children:["[",e.length,"]"]}):s.jsx("span",{className:"muted",children:`{${Object.keys(e).length}}`})}function W(e){const t=[],l=new Set;for(const r of e)for(const n of Object.keys(r??{}))l.has(n)||(l.add(n),t.push(n));return t}function X({rows:e}){const t=W(e);return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:t.map(l=>s.jsx("th",{children:l},l))})}),s.jsx("tbody",{children:e.map((l,r)=>s.jsx("tr",{children:t.map(n=>s.jsx("td",{children:s.jsx(E,{v:l[n]})},n))},r))})]})})}function Z({obj:e}){const t=Object.entries(e),l=W(t.map(([,r])=>r));return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"key"}),l.map(r=>s.jsx("th",{children:r},r))]})}),s.jsx("tbody",{children:t.map(([r,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:r}),l.map(a=>s.jsx("td",{children:s.jsx(E,{v:n[a]})},a))]},r))})]})})}function ss({name:e,value:t,depth:l}){const[r,n]=p.useState(l<1),a=Array.isArray(t)?`[${t.length}]`:`{${Object.keys(t).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":r,onClick:()=>n(c=>!c),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:r?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:a})]}),r&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(Y,{value:t,depth:l+1})})]})}function Y({value:e,depth:t=0}){if(g(e))return s.jsx(T,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(M)?s.jsx(X,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((a,c)=>s.jsx("li",{children:s.jsx(E,{v:a})},c))});const l=Object.entries(e);if(l.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(l.every(([,a])=>M(a)))return s.jsx(Z,{obj:e});const r=l.filter(([,a])=>g(a)),n=l.filter(([,a])=>!g(a));return s.jsxs("div",{className:"rv-obj",children:[r.length>0&&s.jsx("div",{className:"rv-metrics",children:r.map(([a,c])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:a}),s.jsx("span",{className:"rv-mval",children:s.jsx(T,{v:c})})]},a))}),n.map(([a,c])=>s.jsx(ss,{name:a,value:c,depth:t},a))]})}function C({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(Y,{value:e,depth:0})})}const N=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),A=e=>e===null||typeof e!="object",es=new Set(["script","scriptPath","description"]),ts=["skill","name","id","title"];function ns({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):A(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(A)?s.jsx("ol",{className:"launch-list",children:e.map((t,l)=>s.jsx("li",{children:t===null?"—":String(t)},l))}):s.jsx(C,{value:e}):s.jsx(C,{value:e})}function as({rec:e,index:t}){const l=ts.find(a=>typeof e[a]=="string"),r=l?String(e[l]):`task ${t+1}`,n=Object.entries(e).filter(([a])=>a!==l);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:t+1}),s.jsx("span",{className:"launch-card-title",children:r})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([a,c])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:a}),s.jsx("dd",{children:s.jsx(ns,{v:c})})]},a))})]})}function V({raw:e}){const[t,l]=p.useState(!1),{body:r,note:n}=B(S(e)),{value:a,repaired:c}=D(r);if(a===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const o=U(a),y=N(o)?Object.entries(o):[["",o]],P=y.filter(([i,h])=>A(h)&&i!=="script"),w=y.filter(([,i])=>!A(i)),u=N(o)&&typeof o.script=="string"?o.script:null,m=N(o)&&typeof o.scriptPath=="string"?o.scriptPath:null,j=N(o)&&typeof o.description=="string"?o.description:null,x=P.filter(([i])=>!es.has(i)),b=j||m||u||x.length>0,v=i=>Array.isArray(i)&&i.length>0&&i.every(N);return s.jsxs("div",{className:"launch",children:[b&&s.jsxs("div",{className:"launch-meta",children:[j&&s.jsx("div",{className:"launch-desc",children:j}),m&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:m})]}),x.map(([i,h])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:i})," ",s.jsx("code",{children:String(h)})]},i)),u&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",u.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:u})]})]}),w.map(([i,h])=>v(h)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[h.length," ",i||(h.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),h.map((_,f)=>s.jsx(as,{rec:_,index:f},f))]},i||"tasks"):s.jsxs("div",{className:"launch-section",children:[i&&s.jsx("div",{className:"launch-tasks-head",children:i}),s.jsx(C,{value:h})]},i||"value")),(n||c)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",n??"Payload was truncated; showing the recoverable portion."]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{type:"button",className:"ghost small","aria-expanded":t,onClick:()=>l(i=>!i),children:t?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(G,{text:L(r),label:"JSON",title:"Copy raw launch JSON"})]}),t&&s.jsx("pre",{className:"code launch-raw",children:L(r)})]})}function ls({raw:e}){const{body:t,note:l}=B(S(e)),r=/^\s*[[{]/.test(t),{value:n,repaired:a}=r?D(t):{value:void 0,repaired:!1},c=n!==void 0;return s.jsxs(s.Fragment,{children:[c?s.jsx("div",{className:"wf-result-body",children:s.jsx(C,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(K,{remarkPlugins:[q],children:t})}),(l||a)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",l??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(G,{text:c?L(t):t,label:"result",title:"Copy the returned result"})})]})}function rs(e,t){if(e&&e.length){const l=new Map,r=(n,a)=>{let c=l.get(n);return c?a&&(c.title=a):(c={title:a||`Phase ${n}`,agentCount:0,models:[]},l.set(n,c)),c};for(const n of e)n.type==="workflow_phase"&&r(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const a=r(n.phaseIndex,n.phaseTitle);a.agentCount++,n.model&&!a.models.includes(n.model)&&a.models.push(n.model)}if(l.size)return[...l.keys()].sort((n,a)=>n-a).map(n=>l.get(n))}return t.map(l=>({title:l,agentCount:0,models:[]}))}function cs({a:e}){const t=e.agent_description||e.title||e.id.slice(0,12);return s.jsxs("li",{children:[s.jsx(O,{to:`/session/${e.id}`,children:t}),e.agent_type&&s.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&s.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),s.jsxs("span",{className:"muted",children:[" ","· ",(e.models??"").split(",").filter(Boolean).map($).join(", ")||"—"," ·"," ",J(e.tokens)," tok · ",F(e.cost),e.duration_ms!=null?` · ${I(e.duration_ms)}`:""]})]})}function hs(){var m,j,x,b,v,i,h,_,f,R;const{run_id:e}=z(),[t,l]=p.useState(null),[r,n]=p.useState(null);if(p.useEffect(()=>{l(null),n(null),H("/workflows/"+e).then(l).catch(d=>n(String(d)))},[e]),r)return s.jsx("div",{className:"error",role:"alert",children:r});if(!t)return s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"});const a=(t.status??"").toLowerCase(),c=((m=t.run)==null?void 0:m.agent_count)??t.stats.agent_count,o=((j=t.run)==null?void 0:j.total_tokens)??t.stats.total_tokens,y=((x=t.run)==null?void 0:x.duration_ms)??t.stats.duration_ms,P=(((b=t.run)==null?void 0:b.phases)??[]).map(d=>d==null?void 0:d.title).filter(d=>!!d),w=rs((v=t.run)==null?void 0:v.progress,P),u=((i=t.run)==null?void 0:i.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(O,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",t.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:t.run_id}),t.status&&s.jsx("span",{className:"tag task-status task-status-"+a,children:t.status}),((h=t.run)==null?void 0:h.default_model)&&s.jsx("span",{className:"tag",children:$(t.run.default_model)}),((_=t.parent)==null?void 0:_.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(O,{to:`/session/${t.parent.id}`,children:t.parent.title||t.parent.id.slice(0,12)}),t.parent.turn_seq!=null?` · turn ${t.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[c," agent",c===1?"":"s"]}),s.jsxs("span",{children:[J(o)," tok"]}),((f=t.run)==null?void 0:f.total_tool_calls)!=null&&s.jsxs("span",{children:[t.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:F(t.stats.total_cost)}),s.jsx("span",{children:I(y)}),s.jsx("span",{className:"muted",children:Q(((R=t.run)==null?void 0:R.started_at)??t.stats.started_at)})]}),w.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:w.map((d,k)=>s.jsxs(p.Fragment,{children:[k>0&&s.jsx("span",{className:"wf-phase-arrow","aria-hidden":"true",children:"→"}),s.jsxs("div",{className:"wf-phase-chip",children:[s.jsx("span",{className:"wf-phase-title",children:d.title}),d.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[d.agentCount," agent",d.agentCount===1?"":"s",d.models.length?` · ${d.models.map($).join(", ")}`:""]})]})]},k))})]}),t.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",t.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+t.completion.status.toLowerCase(),children:t.completion.status})]}),t.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:S(t.completion.summary)}),t.completion.result?s.jsx(ls,{raw:t.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),t.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:S(t.completion.failures)})]})]}),u.length>0&&s.jsxs("details",{className:"wf-logs",open:u.length<=20,children:[s.jsxs("summary",{children:["Run log · ",u.length," line",u.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:u.map((d,k)=>s.jsx("li",{children:d},k))})]}),t.input_json?s.jsx("div",{className:"wf-result wf-launch",children:t.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx(V,{raw:t.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),a==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx(V,{raw:t.input_json})]})}):!t.completion&&t.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(K,{remarkPlugins:[q],children:t.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",t.agents.length,")"]}),t.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:t.agents.map(d=>s.jsx(cs,{a:d},d.id))})]})]})}export{hs as default};
|
|
1
|
+
import{j as s,r as p,i as z,d as H,L as O,s as $,h as J,f as F,e as I,l as Q}from"./index-B_beFRjy.js";import{s as B,d as S,l as D,a as U,C as G,p as L}from"./CopyButton-CQ5SHT0Q.js";import{M as K,r as q}from"./index-CM-5HLoq.js";const g=e=>e===null||typeof e!="object",M=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function T({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const t=typeof e;return t==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):t==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function E({v:e}){return g(e)?s.jsx(T,{v:e}):Array.isArray(e)?e.every(g)?s.jsx("span",{className:"rv-str",children:e.map(String).join(", ")||"—"}):s.jsxs("span",{className:"muted",children:["[",e.length,"]"]}):s.jsx("span",{className:"muted",children:`{${Object.keys(e).length}}`})}function W(e){const t=[],l=new Set;for(const r of e)for(const n of Object.keys(r??{}))l.has(n)||(l.add(n),t.push(n));return t}function X({rows:e}){const t=W(e);return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:t.map(l=>s.jsx("th",{children:l},l))})}),s.jsx("tbody",{children:e.map((l,r)=>s.jsx("tr",{children:t.map(n=>s.jsx("td",{children:s.jsx(E,{v:l[n]})},n))},r))})]})})}function Z({obj:e}){const t=Object.entries(e),l=W(t.map(([,r])=>r));return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"key"}),l.map(r=>s.jsx("th",{children:r},r))]})}),s.jsx("tbody",{children:t.map(([r,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:r}),l.map(a=>s.jsx("td",{children:s.jsx(E,{v:n[a]})},a))]},r))})]})})}function ss({name:e,value:t,depth:l}){const[r,n]=p.useState(l<1),a=Array.isArray(t)?`[${t.length}]`:`{${Object.keys(t).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":r,onClick:()=>n(c=>!c),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:r?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:a})]}),r&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(Y,{value:t,depth:l+1})})]})}function Y({value:e,depth:t=0}){if(g(e))return s.jsx(T,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(M)?s.jsx(X,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((a,c)=>s.jsx("li",{children:s.jsx(E,{v:a})},c))});const l=Object.entries(e);if(l.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(l.every(([,a])=>M(a)))return s.jsx(Z,{obj:e});const r=l.filter(([,a])=>g(a)),n=l.filter(([,a])=>!g(a));return s.jsxs("div",{className:"rv-obj",children:[r.length>0&&s.jsx("div",{className:"rv-metrics",children:r.map(([a,c])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:a}),s.jsx("span",{className:"rv-mval",children:s.jsx(T,{v:c})})]},a))}),n.map(([a,c])=>s.jsx(ss,{name:a,value:c,depth:t},a))]})}function C({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(Y,{value:e,depth:0})})}const N=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),A=e=>e===null||typeof e!="object",es=new Set(["script","scriptPath","description"]),ts=["skill","name","id","title"];function ns({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):A(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(A)?s.jsx("ol",{className:"launch-list",children:e.map((t,l)=>s.jsx("li",{children:t===null?"—":String(t)},l))}):s.jsx(C,{value:e}):s.jsx(C,{value:e})}function as({rec:e,index:t}){const l=ts.find(a=>typeof e[a]=="string"),r=l?String(e[l]):`task ${t+1}`,n=Object.entries(e).filter(([a])=>a!==l);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:t+1}),s.jsx("span",{className:"launch-card-title",children:r})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([a,c])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:a}),s.jsx("dd",{children:s.jsx(ns,{v:c})})]},a))})]})}function V({raw:e}){const[t,l]=p.useState(!1),{body:r,note:n}=B(S(e)),{value:a,repaired:c}=D(r);if(a===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const o=U(a),y=N(o)?Object.entries(o):[["",o]],P=y.filter(([i,h])=>A(h)&&i!=="script"),w=y.filter(([,i])=>!A(i)),u=N(o)&&typeof o.script=="string"?o.script:null,m=N(o)&&typeof o.scriptPath=="string"?o.scriptPath:null,j=N(o)&&typeof o.description=="string"?o.description:null,x=P.filter(([i])=>!es.has(i)),b=j||m||u||x.length>0,v=i=>Array.isArray(i)&&i.length>0&&i.every(N);return s.jsxs("div",{className:"launch",children:[b&&s.jsxs("div",{className:"launch-meta",children:[j&&s.jsx("div",{className:"launch-desc",children:j}),m&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:m})]}),x.map(([i,h])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:i})," ",s.jsx("code",{children:String(h)})]},i)),u&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",u.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:u})]})]}),w.map(([i,h])=>v(h)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[h.length," ",i||(h.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),h.map((_,f)=>s.jsx(as,{rec:_,index:f},f))]},i||"tasks"):s.jsxs("div",{className:"launch-section",children:[i&&s.jsx("div",{className:"launch-tasks-head",children:i}),s.jsx(C,{value:h})]},i||"value")),(n||c)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",n??"Payload was truncated; showing the recoverable portion."]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{type:"button",className:"ghost small","aria-expanded":t,onClick:()=>l(i=>!i),children:t?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(G,{text:L(r),label:"JSON",title:"Copy raw launch JSON"})]}),t&&s.jsx("pre",{className:"code launch-raw",children:L(r)})]})}function ls({raw:e}){const{body:t,note:l}=B(S(e)),r=/^\s*[[{]/.test(t),{value:n,repaired:a}=r?D(t):{value:void 0,repaired:!1},c=n!==void 0;return s.jsxs(s.Fragment,{children:[c?s.jsx("div",{className:"wf-result-body",children:s.jsx(C,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(K,{remarkPlugins:[q],children:t})}),(l||a)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",l??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(G,{text:c?L(t):t,label:"result",title:"Copy the returned result"})})]})}function rs(e,t){if(e&&e.length){const l=new Map,r=(n,a)=>{let c=l.get(n);return c?a&&(c.title=a):(c={title:a||`Phase ${n}`,agentCount:0,models:[]},l.set(n,c)),c};for(const n of e)n.type==="workflow_phase"&&r(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const a=r(n.phaseIndex,n.phaseTitle);a.agentCount++,n.model&&!a.models.includes(n.model)&&a.models.push(n.model)}if(l.size)return[...l.keys()].sort((n,a)=>n-a).map(n=>l.get(n))}return t.map(l=>({title:l,agentCount:0,models:[]}))}function cs({a:e}){const t=e.agent_description||e.title||e.id.slice(0,12);return s.jsxs("li",{children:[s.jsx(O,{to:`/session/${e.id}`,children:t}),e.agent_type&&s.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&s.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),s.jsxs("span",{className:"muted",children:[" ","· ",(e.models??"").split(",").filter(Boolean).map($).join(", ")||"—"," ·"," ",J(e.tokens)," tok · ",F(e.cost),e.duration_ms!=null?` · ${I(e.duration_ms)}`:""]})]})}function hs(){var m,j,x,b,v,i,h,_,f,R;const{run_id:e}=z(),[t,l]=p.useState(null),[r,n]=p.useState(null);if(p.useEffect(()=>{l(null),n(null),H("/workflows/"+e).then(l).catch(d=>n(String(d)))},[e]),r)return s.jsx("div",{className:"error",role:"alert",children:r});if(!t)return s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"});const a=(t.status??"").toLowerCase(),c=((m=t.run)==null?void 0:m.agent_count)??t.stats.agent_count,o=((j=t.run)==null?void 0:j.total_tokens)??t.stats.total_tokens,y=((x=t.run)==null?void 0:x.duration_ms)??t.stats.duration_ms,P=(((b=t.run)==null?void 0:b.phases)??[]).map(d=>d==null?void 0:d.title).filter(d=>!!d),w=rs((v=t.run)==null?void 0:v.progress,P),u=((i=t.run)==null?void 0:i.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(O,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",t.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:t.run_id}),t.status&&s.jsx("span",{className:"tag task-status task-status-"+a,children:t.status}),((h=t.run)==null?void 0:h.default_model)&&s.jsx("span",{className:"tag",children:$(t.run.default_model)}),((_=t.parent)==null?void 0:_.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(O,{to:`/session/${t.parent.id}`,children:t.parent.title||t.parent.id.slice(0,12)}),t.parent.turn_seq!=null?` · turn ${t.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[c," agent",c===1?"":"s"]}),s.jsxs("span",{children:[J(o)," tok"]}),((f=t.run)==null?void 0:f.total_tool_calls)!=null&&s.jsxs("span",{children:[t.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:F(t.stats.total_cost)}),s.jsx("span",{children:I(y)}),s.jsx("span",{className:"muted",children:Q(((R=t.run)==null?void 0:R.started_at)??t.stats.started_at)})]}),w.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:w.map((d,k)=>s.jsxs(p.Fragment,{children:[k>0&&s.jsx("span",{className:"wf-phase-arrow","aria-hidden":"true",children:"→"}),s.jsxs("div",{className:"wf-phase-chip",children:[s.jsx("span",{className:"wf-phase-title",children:d.title}),d.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[d.agentCount," agent",d.agentCount===1?"":"s",d.models.length?` · ${d.models.map($).join(", ")}`:""]})]})]},k))})]}),t.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",t.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+t.completion.status.toLowerCase(),children:t.completion.status})]}),t.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:S(t.completion.summary)}),t.completion.result?s.jsx(ls,{raw:t.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),t.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:S(t.completion.failures)})]})]}),u.length>0&&s.jsxs("details",{className:"wf-logs",open:u.length<=20,children:[s.jsxs("summary",{children:["Run log · ",u.length," line",u.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:u.map((d,k)=>s.jsx("li",{children:d},k))})]}),t.input_json?s.jsx("div",{className:"wf-result wf-launch",children:t.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx(V,{raw:t.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),a==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx(V,{raw:t.input_json})]})}):!t.completion&&t.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(K,{remarkPlugins:[q],children:t.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",t.agents.length,")"]}),t.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:t.agents.map(d=>s.jsx(cs,{a:d},d.id))})]})]})}export{hs as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionView-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionView-DTYrghRK.js","assets/CopyButton-CQ5SHT0Q.js","assets/severity-TiQaFcLQ.js","assets/index-CM-5HLoq.js","assets/WorkflowView-DwxhHR6A.js","assets/SkillView-BPXOcH3K.js","assets/SecurityView-CCSq2PMa.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function $d(o,a){for(var s=0;s<a.length;s++){const f=a[s];if(typeof f!="string"&&!Array.isArray(f)){for(const h in f)if(h!=="default"&&!(h in o)){const v=Object.getOwnPropertyDescriptor(f,h);v&&Object.defineProperty(o,h,v.get?v:{enumerable:!0,get:()=>f[h]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))f(h);new MutationObserver(h=>{for(const v of h)if(v.type==="childList")for(const S of v.addedNodes)S.tagName==="LINK"&&S.rel==="modulepreload"&&f(S)}).observe(document,{childList:!0,subtree:!0});function s(h){const v={};return h.integrity&&(v.integrity=h.integrity),h.referrerPolicy&&(v.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?v.credentials="include":h.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function f(h){if(h.ep)return;h.ep=!0;const v=s(h);fetch(h.href,v)}})();const Ad="modulepreload",Bd=function(o){return"/"+o},lc={},Wn=function(a,s,f){let h=Promise.resolve();if(s&&s.length>0){let S=function(R){return Promise.all(R.map(z=>Promise.resolve(z).then(j=>({status:"fulfilled",value:j}),j=>({status:"rejected",reason:j}))))};document.getElementsByTagName("link");const k=document.querySelector("meta[property=csp-nonce]"),C=(k==null?void 0:k.nonce)||(k==null?void 0:k.getAttribute("nonce"));h=S(s.map(R=>{if(R=Bd(R),R in lc)return;lc[R]=!0;const z=R.endsWith(".css"),j=z?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${R}"]${j}`))return;const I=document.createElement("link");if(I.rel=z?"stylesheet":Ad,z||(I.as="script"),I.crossOrigin="",I.href=R,C&&I.setAttribute("nonce",C),document.head.appendChild(I),z)return new Promise((Z,A)=>{I.addEventListener("load",Z),I.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${R}`)))})}))}function v(S){const k=new Event("vite:preloadError",{cancelable:!0});if(k.payload=S,window.dispatchEvent(k),!k.defaultPrevented)throw S}return h.then(S=>{for(const k of S||[])k.status==="rejected"&&v(k.reason);return a().catch(v)})};var jh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vd(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Xo={exports:{}},Lr={},Go={exports:{}},te={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -65,4 +65,4 @@ Error generating stack: `+i.message+`
|
|
|
65
65
|
* LICENSE.md file in the root directory of this source tree.
|
|
66
66
|
*
|
|
67
67
|
* @license MIT
|
|
68
|
-
*/function Jl(){return Jl=Object.assign?Object.assign.bind():function(o){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var f in s)({}).hasOwnProperty.call(s,f)&&(o[f]=s[f])}return o},Jl.apply(null,arguments)}function Uc(o,a){if(o==null)return{};var s={};for(var f in o)if({}.hasOwnProperty.call(o,f)){if(a.indexOf(f)!==-1)continue;s[f]=o[f]}return s}function Qp(o){return!!(o.metaKey||o.altKey||o.ctrlKey||o.shiftKey)}function Kp(o,a){return o.button===0&&(!a||a==="_self")&&!Qp(o)}function lu(o){return o===void 0&&(o=""),new URLSearchParams(typeof o=="string"||Array.isArray(o)||o instanceof URLSearchParams?o:Object.keys(o).reduce((a,s)=>{let f=o[s];return a.concat(Array.isArray(f)?f.map(h=>[s,h]):[[s,f]])},[]))}function Yp(o,a){let s=lu(o);return a&&a.forEach((f,h)=>{s.has(h)||a.getAll(h).forEach(v=>{s.append(h,v)})}),s}const Xp=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Gp=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Jp="6";try{window.__reactRouterVersion=Jp}catch{}const Zp=E.createContext({isTransitioning:!1}),qp="startTransition",Sc=Kd[qp];function bp(o){let{basename:a,children:s,future:f,window:h}=o,v=E.useRef();v.current==null&&(v.current=qd({window:h,v5Compat:!0}));let S=v.current,[k,C]=E.useState({action:S.action,location:S.location}),{v7_startTransition:R}=f||{},z=E.useCallback(j=>{R&&Sc?Sc(()=>C(j)):C(j)},[C,R]);return E.useLayoutEffect(()=>S.listen(z),[S,z]),E.useEffect(()=>Bp(f),[f]),E.createElement(Wp,{basename:a,children:s,location:k.location,navigationType:k.action,navigator:S,future:f})}const eh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",th=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,su=E.forwardRef(function(a,s){let{onClick:f,relative:h,reloadDocument:v,replace:S,state:k,target:C,to:R,preventScrollReset:z,viewTransition:j}=a,I=Uc(a,Xp),{basename:Z}=E.useContext(bt),A,K=!1;if(typeof R=="string"&&th.test(R)&&(A=R,eh))try{let D=new URL(window.location.href),H=R.startsWith("//")?new URL(D.protocol+R):new URL(R),ue=Vn(H.pathname,Z);H.origin===D.origin&&ue!=null?R=ue+H.search+H.hash:K=!0}catch{}let O=Cp(R,{relative:h}),q=rh(R,{replace:S,state:k,target:C,preventScrollReset:z,relative:h,viewTransition:j});function b(D){f&&f(D),D.defaultPrevented||q(D)}return E.createElement("a",Jl({},I,{href:A||O,onClick:K||v?f:b,ref:s,target:C}))}),Yl=E.forwardRef(function(a,s){let{"aria-current":f="page",caseSensitive:h=!1,className:v="",end:S=!1,style:k,to:C,viewTransition:R,children:z}=a,j=Uc(a,Gp),I=bl(C,{relative:j.relative}),Z=hn(),A=E.useContext(Tc),{navigator:K,basename:O}=E.useContext(bt),q=A!=null&&ih(I)&&R===!0,b=K.encodeLocation?K.encodeLocation(I).pathname:I.pathname,D=Z.pathname,H=A&&A.navigation&&A.navigation.location?A.navigation.location.pathname:null;h||(D=D.toLowerCase(),H=H?H.toLowerCase():null,b=b.toLowerCase()),H&&O&&(H=Vn(H,O)||H);const ue=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let Ee=D===b||!S&&D.startsWith(b)&&D.charAt(ue)==="/",Ne=H!=null&&(H===b||!S&&H.startsWith(b)&&H.charAt(b.length)==="/"),F={isActive:Ee,isPending:Ne,isTransitioning:q},ge=Ee?f:void 0,ce;typeof v=="function"?ce=v(F):ce=[v,Ee?"active":null,Ne?"pending":null,q?"transitioning":null].filter(Boolean).join(" ");let Be=typeof k=="function"?k(F):k;return E.createElement(su,Jl({},j,{"aria-current":ge,className:ce,ref:s,style:Be,to:C,viewTransition:R}),typeof z=="function"?z(F):z)});var iu;(function(o){o.UseScrollRestoration="useScrollRestoration",o.UseSubmit="useSubmit",o.UseSubmitFetcher="useSubmitFetcher",o.UseFetcher="useFetcher",o.useViewTransitionState="useViewTransitionState"})(iu||(iu={}));var kc;(function(o){o.UseFetcher="useFetcher",o.UseFetchers="useFetchers",o.UseScrollRestoration="useScrollRestoration"})(kc||(kc={}));function nh(o){let a=E.useContext(Zl);return a||xe(!1),a}function rh(o,a){let{target:s,replace:f,state:h,preventScrollReset:v,relative:S,viewTransition:k}=a===void 0?{}:a,C=Dc(),R=hn(),z=bl(o,{relative:S});return E.useCallback(j=>{if(Kp(j,s)){j.preventDefault();let I=f!==void 0?f:Gl(R)===Gl(z);C(o,{replace:I,state:h,preventScrollReset:v,relative:S,viewTransition:k})}},[R,C,z,f,h,s,o,v,S,k])}function lh(o){let a=E.useRef(lu(o)),s=E.useRef(!1),f=hn(),h=E.useMemo(()=>Yp(f.search,s.current?null:a.current),[f.search]),v=Dc(),S=E.useCallback((k,C)=>{const R=lu(typeof k=="function"?k(h):k);s.current=!0,v("?"+R,C)},[v,h]);return[h,S]}function ih(o,a){a===void 0&&(a={});let s=E.useContext(Zp);s==null&&xe(!1);let{basename:f}=nh(iu.useViewTransitionState),h=bl(o,{relative:a.relative});if(!s.isTransitioning)return!1;let v=Vn(s.currentLocation.pathname,f)||s.currentLocation.pathname,S=Vn(s.nextLocation.pathname,f)||s.nextLocation.pathname;return nu(h.pathname,S)!=null||nu(h.pathname,v)!=null}const oh="/assets/logo-Cd7Wsq5o.png",eu={},au=(eu==null?void 0:eu.VITE_SNAPSHOT)==="1",$c="/";function uh(o){if(!au)return"/api"+o;const a=o.split("?")[0].replace(/^\//,"");return`${$c}snapshot/${a}.json`}function Lh(o){return au?`${$c}snapshot/sessions/${o}.export.md`:`/api/sessions/${o}/export.md`}async function Tr(o){const a=await fetch(uh(o));if(!a.ok)throw new Error(`${a.status} ${await a.text()}`);return a.json()}async function sh(o,a){const s=await fetch("/api"+o,{method:"POST",...a!==void 0?{headers:{"content-type":"application/json"},body:JSON.stringify(a)}:{}});if(!s.ok)throw new Error(`${s.status} ${await s.text()}`);return s.json()}const Ac="agentlens.theme";function ah(){if(typeof document<"u"){const o=document.documentElement.dataset.theme;if(o==="light"||o==="dark")return o}try{const o=localStorage.getItem(Ac);if(o==="light"||o==="dark")return o}catch{}return"dark"}const Bc=E.createContext({theme:"dark",toggle:()=>{}});function ch({children:o}){const[a,s]=E.useState(ah);typeof document<"u"&&(document.documentElement.dataset.theme=a),E.useEffect(()=>{try{localStorage.setItem(Ac,a)}catch{}},[a]);const f=()=>s(h=>h==="dark"?"light":"dark");return x.jsx(Bc.Provider,{value:{theme:a,toggle:f},children:o})}function fh(){return E.useContext(Bc)}function dh(o){const a=Math.round((Date.now()-new Date(o).getTime())/1e3);if(a<45)return"just now";const s=Math.round(a/60);if(s<60)return`${s}m ago`;const f=Math.round(s/60);return f<24?`${f}h ago`:`${Math.round(f/24)}d ago`}function ph(){const{theme:o,toggle:a}=fh(),[s,f]=E.useState(null),[h,v]=E.useState(!1),S=E.useCallback(()=>{Tr("/health").then(A=>{f(A.last_ingested??null),v(!!A.schema_stale)}).catch(()=>{})},[]);E.useEffect(()=>{S();const A=setInterval(S,6e4);return()=>clearInterval(A)},[S]);const[k,C]=E.useState(!1),[R,z]=E.useState(null),j=E.useCallback(async()=>{C(!0),z(null);try{await sh("/refresh"),window.location.reload()}catch(A){z(String((A==null?void 0:A.message)??A).slice(0,200)),C(!1)}},[]),{pathname:I}=hn(),Z=I==="/dashboard"||I==="/security"||I.startsWith("/skill/");return x.jsxs("div",{className:"app",children:[x.jsx("a",{className:"skip-link",href:"#main",children:"Skip to content"}),x.jsxs("header",{className:"topbar",children:[x.jsxs(su,{to:"/",className:"brand",children:[x.jsx("img",{src:oh,alt:"",className:"brand-logo"})," Agent Lens"]}),x.jsxs("nav",{className:"nav",children:[x.jsx(Yl,{to:"/",end:!0,className:({isActive:A})=>A?"nav-link active":"nav-link",children:"Sessions"}),x.jsx(Yl,{to:"/skills",className:({isActive:A})=>A?"nav-link active":"nav-link",children:"Skills"}),x.jsx(Yl,{to:"/security",className:({isActive:A})=>A?"nav-link active":"nav-link",children:"Security"}),x.jsx(Yl,{to:"/dashboard",className:({isActive:A})=>A?"nav-link active":"nav-link",children:"Dashboard"})]}),s?x.jsxs("span",{className:"tagline",title:`Data last ingested ${new Date(s).toLocaleString()}`,children:["updated ",dh(s)]}):x.jsx("span",{className:"tagline",children:"local agent session explorer"}),x.jsxs("div",{className:"topbar-actions",children:[!au&&x.jsxs("button",{type:"button",className:"ghost refresh-btn",onClick:j,disabled:k,"aria-label":"Refresh data — collect new transcripts and rebuild",title:R?`Refresh failed: ${R}`:"Collect new transcripts and rebuild the data (runs on the host)",children:[x.jsx("span",{className:k?"refresh-icon spinning":"refresh-icon","aria-hidden":"true",children:"⟳"})," ",k?"Refreshing…":R?"Retry":"Refresh"]}),x.jsx("button",{type:"button",className:"ghost theme-toggle",onClick:a,"aria-label":"Toggle light or dark theme","aria-pressed":o==="light",title:o==="dark"?"Switch to light theme":"Switch to dark theme",children:o==="dark"?"☀":"☾"})]})]}),h&&x.jsxs("div",{className:"schema-banner",role:"status",children:["⚠ Data schema is out of date — run ",x.jsx("code",{children:"agent-lens ingest --full"})," on the host to rebuild. The ",x.jsx("em",{children:"Refresh"})," button only does an incremental ingest and won't fix this."]}),x.jsx("main",{className:"content"+(Z?" wide":""),id:"main",tabIndex:-1,children:x.jsx(Vp,{})})]})}function hh(o){if(!o||o<0)return"—";const a=Math.round(o/1e3);if(a<60)return`${a}s`;const s=Math.round(a/60);return s<60?`${s}m`:`${Math.floor(s/60)}h ${s%60}m`}function zr(o){return o>=1e9?(o/1e9).toFixed(1)+"B":o>=1e6?(o/1e6).toFixed(1)+"M":o>=1e3?(o/1e3).toFixed(1)+"k":String(o)}function mh(o){return o>=.01?"$"+o.toFixed(2):o>0?"<$0.01":"$0"}function vh(o){return o?`input ${zr(o.input)} · output ${zr(o.output)} · cache-write ${zr(o.cache_creation)} · cache-read ${zr(o.cache_read)}`:""}function gh(o){if(!o)return"—";const a=new Date(o);return isNaN(a.getTime())?o:a.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function xc(o){return o?o==="<synthetic>"?"local":o.replace(/^claude-/,"").replace(/-\d{8}$/,""):""}function yh({value:o,options:a,onChange:s,ariaLabel:f,searchPlaceholder:h="Filter…"}){const[v,S]=E.useState(!1),[k,C]=E.useState(""),[R,z]=E.useState(0),j=E.useRef(null),I=E.useRef(null),Z=E.useId(),A=D=>`${Z}-opt-${D}`,K=a.find(D=>D.value===o)??a[0]??{value:"",label:""},O=E.useMemo(()=>{const D=k.trim().toLowerCase();return D?a.filter(H=>H.label.toLowerCase().includes(D)):a},[a,k]);E.useEffect(()=>{if(!v)return;const D=H=>{j.current&&!j.current.contains(H.target)&&S(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[v]),E.useEffect(()=>{var H;if(!v)return;C(""),(H=I.current)==null||H.focus();const D=O.findIndex(ue=>ue.value===o);z(D>=0?D:0)},[v]),E.useEffect(()=>{z(D=>Math.min(D,Math.max(0,O.length-1)))},[O.length]);function q(D){D&&(s(D.value),S(!1))}function b(D){if(D.key==="ArrowDown"){if(D.preventDefault(),!v)return S(!0);z(H=>Math.min(H+1,O.length-1))}else D.key==="ArrowUp"?(D.preventDefault(),z(H=>Math.max(H-1,0))):D.key==="Enter"?(D.preventDefault(),q(O[R])):D.key==="Escape"&&(D.preventDefault(),S(!1))}return x.jsxs("div",{className:"filter-select",ref:j,children:[x.jsxs("button",{type:"button",className:"filter-select-btn","aria-label":f,"aria-haspopup":"listbox","aria-expanded":v,onClick:()=>S(D=>!D),children:[x.jsx("span",{className:"filter-select-value"+(K.value?"":" muted"),children:K.label}),x.jsx("span",{className:"chev","aria-hidden":"true",children:"▾"})]}),v&&x.jsxs("div",{className:"filter-select-pop",children:[x.jsx("input",{ref:I,type:"text",role:"combobox","aria-expanded":"true","aria-controls":Z,"aria-activedescendant":O.length?A(R):void 0,"aria-label":f,className:"filter-select-search",placeholder:h,value:k,onChange:D=>C(D.target.value),onKeyDown:b}),x.jsx("ul",{className:"filter-select-list",role:"listbox",id:Z,"aria-label":f,children:O.length===0?x.jsx("li",{className:"filter-select-empty muted",role:"presentation",children:"No matches"}):O.map((D,H)=>x.jsx("li",{id:A(H),role:"option","aria-selected":D.value===o,className:"filter-select-opt"+(H===R?" is-active":"")+(D.value===o?" is-selected":""),onMouseEnter:()=>z(H),onMouseDown:ue=>{ue.preventDefault(),q(D)},children:D.value?D.label:x.jsx("span",{className:"muted",children:D.label})},D.value||"__all__"))})]})]})}function wh({page:o,pages:a,total:s,unit:f,onPage:h}){return x.jsxs("div",{className:"pager",children:[x.jsx("button",{disabled:o<=1,onClick:()=>h(o-1),children:"← Prev"}),x.jsxs("span",{className:"muted",children:["page ",o," / ",a," · ",s," ",f]}),x.jsx("button",{disabled:o>=a,onClick:()=>h(o+1),children:"Next →"}),a>1&&x.jsxs("label",{className:"page-jump",children:[x.jsx("span",{className:"sr-only",children:"Jump to page"}),x.jsx("select",{value:o,onChange:v=>h(Number(v.target.value)),children:Array.from({length:a},(v,S)=>S+1).map(v=>x.jsxs("option",{value:v,children:["page ",v," / ",a]},v))})]})]})}function Th(o,a,s){const f=s==="asc"?1:-1;return o.map((h,v)=>({row:h,i:v})).sort((h,v)=>{const S=a(h.row),k=a(v.row);if(S==null&&k==null)return h.i-v.i;if(S==null)return 1;if(k==null)return-1;const C=typeof S=="number"&&typeof k=="number"?S-k:String(S).localeCompare(String(k),void 0,{numeric:!0,sensitivity:"base"});return C!==0?C*f:h.i-v.i}).map(h=>h.row)}function zh(o,a){const[s,f]=E.useState({key:o,dir:a});return{sort:s,toggle:(v,S="desc")=>f(k=>k.key===v?{key:v,dir:k.dir==="asc"?"desc":"asc"}:{key:v,dir:S})}}function An({label:o,sortKey:a,active:s,dir:f,onSort:h,defaultDir:v="desc",className:S}){const k=s===a;return x.jsx("th",{className:S,"aria-sort":k?f==="asc"?"ascending":"descending":"none",children:x.jsxs("button",{type:"button",className:"sort-th"+(k?" is-active":""),onClick:()=>h(a,v),children:[x.jsx("span",{children:o}),x.jsx("span",{className:"sort-ind","aria-hidden":"true",children:k?f==="asc"?"▲":"▼":"↕"})]})})}const Xl=50;function Sh(){const[o,a]=lh(),[s,f]=E.useState([]),[h,v]=E.useState([]),[S,k]=E.useState([]),[C,R]=E.useState({total:0,sessions:[]}),[z,j]=E.useState(!0),[I,Z]=E.useState(null),[A,K]=E.useState(o.get("q")??""),O=Number(o.get("offset")??0);E.useEffect(()=>{Tr("/sources").then(f).catch(()=>{}),Tr("/projects").then(v).catch(()=>{}),Tr("/models").then(k).catch(()=>{})},[]),E.useEffect(()=>{j(!0),Z(null);const F=new URLSearchParams;for(const ge of["source","project","model","q","sort","dir"]){const ce=o.get(ge);ce&&F.set(ge,ce)}F.set("kind",o.get("kind")||"main"),F.set("limit",String(Xl)),F.set("offset",String(O)),Tr("/sessions?"+F.toString()).then(R).catch(ge=>Z(String(ge))).finally(()=>j(!1))},[o]);function q(F,ge){const ce=new URLSearchParams(o);ge?ce.set(F,ge):ce.delete(F),F!=="offset"&&ce.delete("offset"),a(ce)}function b(F){F.preventDefault(),q("q",A.trim())}const D=o.get("sort")??"started",H=o.get("dir")==="asc"?"asc":"desc";function ue(F,ge){const ce=D===F?H==="asc"?"desc":"asc":ge,Be=new URLSearchParams(o);Be.set("sort",F),Be.set("dir",ce),Be.delete("offset"),a(Be)}const Ee=Math.floor(O/Xl)+1,Ne=Math.max(1,Math.ceil(C.total/Xl));return x.jsxs("div",{children:[x.jsx("h1",{className:"sr-only",children:"Sessions"}),x.jsxs("div",{className:"filters",children:[x.jsxs("form",{onSubmit:b,className:"search",role:"search",children:[x.jsx("input",{type:"search","aria-label":"Search session names, projects and transcripts",placeholder:"Search names, projects & transcripts…",value:A,onChange:F=>K(F.target.value)}),x.jsx("button",{type:"submit",children:"Search"}),o.get("q")&&x.jsx("button",{type:"button",className:"ghost",onClick:()=>(K(""),q("q","")),children:"clear"})]}),x.jsxs("select",{"aria-label":"Filter by source",value:o.get("source")??"",onChange:F=>q("source",F.target.value),children:[x.jsx("option",{value:"",children:"all sources"}),s.map(F=>x.jsxs("option",{value:F.id,children:[F.label," (",F.session_count,")"]},F.id))]}),x.jsx(yh,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:o.get("project")??"",onChange:F=>q("project",F),options:[{value:"",label:"all projects"},...h.map(F=>({value:F.id,label:`${F.path.replace(/^.*\//,"")} (${F.session_count})`}))]}),x.jsxs("select",{"aria-label":"Filter by model",value:o.get("model")??"",onChange:F=>q("model",F.target.value),children:[x.jsx("option",{value:"",children:"all models"}),S.map(F=>x.jsx("option",{value:F,children:xc(F)},F))]}),x.jsxs("select",{"aria-label":"Filter by kind",value:o.get("kind")||"main",onChange:F=>q("kind",F.target.value),children:[x.jsx("option",{value:"main",children:"main only"}),x.jsx("option",{value:"all",children:"main + subagents"}),x.jsx("option",{value:"subagent",children:"subagents only"})]})]}),I&&x.jsx("div",{className:"error",role:"alert",children:I}),z?x.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):C.sessions.length===0?x.jsx("div",{className:"muted pad",role:"status",children:"No sessions match."}):x.jsxs("table",{className:"sessions",children:[x.jsx("thead",{children:x.jsxs("tr",{children:[x.jsx(An,{label:"Session",sortKey:"title",active:D,dir:H,onSort:ue,defaultDir:"asc"}),x.jsx("th",{children:"Source"}),x.jsx("th",{children:"Project"}),x.jsx(An,{label:"Turns",sortKey:"turns",active:D,dir:H,onSort:ue,className:"num"}),x.jsx(An,{label:"Tokens",sortKey:"tokens",active:D,dir:H,onSort:ue,className:"num"}),x.jsx(An,{label:"Cost",sortKey:"cost",active:D,dir:H,onSort:ue,className:"num"}),x.jsx(An,{label:"Duration",sortKey:"duration",active:D,dir:H,onSort:ue,className:"num"}),x.jsx(An,{label:"Started",sortKey:"started",active:D,dir:H,onSort:ue})]})}),x.jsx("tbody",{children:C.sessions.map(F=>{var ge;return x.jsxs("tr",{children:[x.jsxs("td",{children:[x.jsx(su,{to:`/session/${F.id}`,className:"title",children:F.title||x.jsx("span",{className:"muted",children:F.id.slice(0,12)})}),x.jsxs("div",{className:"sub",children:[F.is_sidechain?x.jsx("span",{className:"tag subagent",children:"subagent"}):null,(F.models??"").split(",").filter(Boolean).slice(0,3).map(ce=>x.jsx("span",{className:"tag",children:xc(ce)},ce))]})]}),x.jsx("td",{children:F.source_id}),x.jsx("td",{className:"path",children:((ge=F.project_path)==null?void 0:ge.replace(/^.*\//,""))??"—"}),x.jsx("td",{className:"num",children:F.turn_count}),x.jsx("td",{className:"num",title:vh(F.token_split),children:zr(F.tokens)}),x.jsx("td",{className:"num",title:"Estimated at API list prices (cache-aware)",children:mh(F.cost)}),x.jsx("td",{className:"num",children:hh(F.duration_ms)}),x.jsx("td",{children:gh(F.started_at)})]},F.id)})})]}),x.jsx(wh,{page:Ee,pages:Ne,total:C.total,unit:"sessions",onPage:F=>q("offset",String((F-1)*Xl))})]})}const kh=E.lazy(()=>Wn(()=>import("./Dashboard-CPfpfHm8.js"),[])),xh=E.lazy(()=>Wn(()=>import("./SessionView-BLTA0iKW.js"),__vite__mapDeps([0,1,2,3]))),Eh=E.lazy(()=>Wn(()=>import("./WorkflowView-juGHkf05.js"),__vite__mapDeps([4,1,3]))),Ch=E.lazy(()=>Wn(()=>import("./SkillsView-c6k5JsWR.js"),[])),_h=E.lazy(()=>Wn(()=>import("./SkillView-DVoLJAU0.js"),__vite__mapDeps([5,3]))),Ph=E.lazy(()=>Wn(()=>import("./SecurityView-CvWWSbuL.js"),__vite__mapDeps([6,2]))),Bn=()=>x.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}),Nh="/".replace(/\/$/,"");Zd.createRoot(document.getElementById("root")).render(x.jsx(Ec.StrictMode,{children:x.jsx(ch,{children:x.jsx(bp,{basename:Nh,children:x.jsx(Hp,{children:x.jsxs(Lt,{path:"/",element:x.jsx(ph,{}),children:[x.jsx(Lt,{index:!0,element:x.jsx(Sh,{})}),x.jsx(Lt,{path:"dashboard",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(kh,{})})}),x.jsx(Lt,{path:"session/:id",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(xh,{})})}),x.jsx(Lt,{path:"workflow/:run_id",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(Eh,{})})}),x.jsx(Lt,{path:"skills",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(Ch,{})})}),x.jsx(Lt,{path:"skill/:name",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(_h,{})})}),x.jsx(Lt,{path:"security",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(Ph,{})})})]})})})})}));export{yh as F,su as L,wh as P,Ec as R,An as S,lh as a,Dc as b,jh as c,Tr as d,hh as e,mh as f,Vd as g,zr as h,Rh as i,x as j,hn as k,gh as l,Lh as m,zh as n,Th as o,au as p,sh as q,E as r,xc as s,vh as t,fh as u};
|
|
68
|
+
*/function Jl(){return Jl=Object.assign?Object.assign.bind():function(o){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var f in s)({}).hasOwnProperty.call(s,f)&&(o[f]=s[f])}return o},Jl.apply(null,arguments)}function Uc(o,a){if(o==null)return{};var s={};for(var f in o)if({}.hasOwnProperty.call(o,f)){if(a.indexOf(f)!==-1)continue;s[f]=o[f]}return s}function Qp(o){return!!(o.metaKey||o.altKey||o.ctrlKey||o.shiftKey)}function Kp(o,a){return o.button===0&&(!a||a==="_self")&&!Qp(o)}function lu(o){return o===void 0&&(o=""),new URLSearchParams(typeof o=="string"||Array.isArray(o)||o instanceof URLSearchParams?o:Object.keys(o).reduce((a,s)=>{let f=o[s];return a.concat(Array.isArray(f)?f.map(h=>[s,h]):[[s,f]])},[]))}function Yp(o,a){let s=lu(o);return a&&a.forEach((f,h)=>{s.has(h)||a.getAll(h).forEach(v=>{s.append(h,v)})}),s}const Xp=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Gp=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Jp="6";try{window.__reactRouterVersion=Jp}catch{}const Zp=E.createContext({isTransitioning:!1}),qp="startTransition",Sc=Kd[qp];function bp(o){let{basename:a,children:s,future:f,window:h}=o,v=E.useRef();v.current==null&&(v.current=qd({window:h,v5Compat:!0}));let S=v.current,[k,C]=E.useState({action:S.action,location:S.location}),{v7_startTransition:R}=f||{},z=E.useCallback(j=>{R&&Sc?Sc(()=>C(j)):C(j)},[C,R]);return E.useLayoutEffect(()=>S.listen(z),[S,z]),E.useEffect(()=>Bp(f),[f]),E.createElement(Wp,{basename:a,children:s,location:k.location,navigationType:k.action,navigator:S,future:f})}const eh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",th=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,su=E.forwardRef(function(a,s){let{onClick:f,relative:h,reloadDocument:v,replace:S,state:k,target:C,to:R,preventScrollReset:z,viewTransition:j}=a,I=Uc(a,Xp),{basename:Z}=E.useContext(bt),A,K=!1;if(typeof R=="string"&&th.test(R)&&(A=R,eh))try{let D=new URL(window.location.href),H=R.startsWith("//")?new URL(D.protocol+R):new URL(R),ue=Vn(H.pathname,Z);H.origin===D.origin&&ue!=null?R=ue+H.search+H.hash:K=!0}catch{}let O=Cp(R,{relative:h}),q=rh(R,{replace:S,state:k,target:C,preventScrollReset:z,relative:h,viewTransition:j});function b(D){f&&f(D),D.defaultPrevented||q(D)}return E.createElement("a",Jl({},I,{href:A||O,onClick:K||v?f:b,ref:s,target:C}))}),Yl=E.forwardRef(function(a,s){let{"aria-current":f="page",caseSensitive:h=!1,className:v="",end:S=!1,style:k,to:C,viewTransition:R,children:z}=a,j=Uc(a,Gp),I=bl(C,{relative:j.relative}),Z=hn(),A=E.useContext(Tc),{navigator:K,basename:O}=E.useContext(bt),q=A!=null&&ih(I)&&R===!0,b=K.encodeLocation?K.encodeLocation(I).pathname:I.pathname,D=Z.pathname,H=A&&A.navigation&&A.navigation.location?A.navigation.location.pathname:null;h||(D=D.toLowerCase(),H=H?H.toLowerCase():null,b=b.toLowerCase()),H&&O&&(H=Vn(H,O)||H);const ue=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let Ee=D===b||!S&&D.startsWith(b)&&D.charAt(ue)==="/",Ne=H!=null&&(H===b||!S&&H.startsWith(b)&&H.charAt(b.length)==="/"),F={isActive:Ee,isPending:Ne,isTransitioning:q},ge=Ee?f:void 0,ce;typeof v=="function"?ce=v(F):ce=[v,Ee?"active":null,Ne?"pending":null,q?"transitioning":null].filter(Boolean).join(" ");let Be=typeof k=="function"?k(F):k;return E.createElement(su,Jl({},j,{"aria-current":ge,className:ce,ref:s,style:Be,to:C,viewTransition:R}),typeof z=="function"?z(F):z)});var iu;(function(o){o.UseScrollRestoration="useScrollRestoration",o.UseSubmit="useSubmit",o.UseSubmitFetcher="useSubmitFetcher",o.UseFetcher="useFetcher",o.useViewTransitionState="useViewTransitionState"})(iu||(iu={}));var kc;(function(o){o.UseFetcher="useFetcher",o.UseFetchers="useFetchers",o.UseScrollRestoration="useScrollRestoration"})(kc||(kc={}));function nh(o){let a=E.useContext(Zl);return a||xe(!1),a}function rh(o,a){let{target:s,replace:f,state:h,preventScrollReset:v,relative:S,viewTransition:k}=a===void 0?{}:a,C=Dc(),R=hn(),z=bl(o,{relative:S});return E.useCallback(j=>{if(Kp(j,s)){j.preventDefault();let I=f!==void 0?f:Gl(R)===Gl(z);C(o,{replace:I,state:h,preventScrollReset:v,relative:S,viewTransition:k})}},[R,C,z,f,h,s,o,v,S,k])}function lh(o){let a=E.useRef(lu(o)),s=E.useRef(!1),f=hn(),h=E.useMemo(()=>Yp(f.search,s.current?null:a.current),[f.search]),v=Dc(),S=E.useCallback((k,C)=>{const R=lu(typeof k=="function"?k(h):k);s.current=!0,v("?"+R,C)},[v,h]);return[h,S]}function ih(o,a){a===void 0&&(a={});let s=E.useContext(Zp);s==null&&xe(!1);let{basename:f}=nh(iu.useViewTransitionState),h=bl(o,{relative:a.relative});if(!s.isTransitioning)return!1;let v=Vn(s.currentLocation.pathname,f)||s.currentLocation.pathname,S=Vn(s.nextLocation.pathname,f)||s.nextLocation.pathname;return nu(h.pathname,S)!=null||nu(h.pathname,v)!=null}const oh="/assets/logo-Cd7Wsq5o.png",eu={},au=(eu==null?void 0:eu.VITE_SNAPSHOT)==="1",$c="/";function uh(o){if(!au)return"/api"+o;const a=o.split("?")[0].replace(/^\//,"");return`${$c}snapshot/${a}.json`}function Lh(o){return au?`${$c}snapshot/sessions/${o}.export.md`:`/api/sessions/${o}/export.md`}async function Tr(o){const a=await fetch(uh(o));if(!a.ok)throw new Error(`${a.status} ${await a.text()}`);return a.json()}async function sh(o,a){const s=await fetch("/api"+o,{method:"POST",...a!==void 0?{headers:{"content-type":"application/json"},body:JSON.stringify(a)}:{}});if(!s.ok)throw new Error(`${s.status} ${await s.text()}`);return s.json()}const Ac="agentlens.theme";function ah(){if(typeof document<"u"){const o=document.documentElement.dataset.theme;if(o==="light"||o==="dark")return o}try{const o=localStorage.getItem(Ac);if(o==="light"||o==="dark")return o}catch{}return"dark"}const Bc=E.createContext({theme:"dark",toggle:()=>{}});function ch({children:o}){const[a,s]=E.useState(ah);typeof document<"u"&&(document.documentElement.dataset.theme=a),E.useEffect(()=>{try{localStorage.setItem(Ac,a)}catch{}},[a]);const f=()=>s(h=>h==="dark"?"light":"dark");return x.jsx(Bc.Provider,{value:{theme:a,toggle:f},children:o})}function fh(){return E.useContext(Bc)}function dh(o){const a=Math.round((Date.now()-new Date(o).getTime())/1e3);if(a<45)return"just now";const s=Math.round(a/60);if(s<60)return`${s}m ago`;const f=Math.round(s/60);return f<24?`${f}h ago`:`${Math.round(f/24)}d ago`}function ph(){const{theme:o,toggle:a}=fh(),[s,f]=E.useState(null),[h,v]=E.useState(!1),S=E.useCallback(()=>{Tr("/health").then(A=>{f(A.last_ingested??null),v(!!A.schema_stale)}).catch(()=>{})},[]);E.useEffect(()=>{S();const A=setInterval(S,6e4);return()=>clearInterval(A)},[S]);const[k,C]=E.useState(!1),[R,z]=E.useState(null),j=E.useCallback(async()=>{C(!0),z(null);try{await sh("/refresh"),window.location.reload()}catch(A){z(String((A==null?void 0:A.message)??A).slice(0,200)),C(!1)}},[]),{pathname:I}=hn(),Z=I==="/dashboard"||I==="/security"||I.startsWith("/skill/");return x.jsxs("div",{className:"app",children:[x.jsx("a",{className:"skip-link",href:"#main",children:"Skip to content"}),x.jsxs("header",{className:"topbar",children:[x.jsxs(su,{to:"/",className:"brand",children:[x.jsx("img",{src:oh,alt:"",className:"brand-logo"})," Agent Lens"]}),x.jsxs("nav",{className:"nav",children:[x.jsx(Yl,{to:"/",end:!0,className:({isActive:A})=>A?"nav-link active":"nav-link",children:"Sessions"}),x.jsx(Yl,{to:"/skills",className:({isActive:A})=>A?"nav-link active":"nav-link",children:"Skills"}),x.jsx(Yl,{to:"/security",className:({isActive:A})=>A?"nav-link active":"nav-link",children:"Security"}),x.jsx(Yl,{to:"/dashboard",className:({isActive:A})=>A?"nav-link active":"nav-link",children:"Dashboard"})]}),s?x.jsxs("span",{className:"tagline",title:`Data last ingested ${new Date(s).toLocaleString()}`,children:["updated ",dh(s)]}):x.jsx("span",{className:"tagline",children:"local agent session explorer"}),x.jsxs("div",{className:"topbar-actions",children:[!au&&x.jsxs("button",{type:"button",className:"ghost refresh-btn",onClick:j,disabled:k,"aria-label":"Refresh data — collect new transcripts and rebuild",title:R?`Refresh failed: ${R}`:"Collect new transcripts and rebuild the data (runs on the host)",children:[x.jsx("span",{className:k?"refresh-icon spinning":"refresh-icon","aria-hidden":"true",children:"⟳"})," ",k?"Refreshing…":R?"Retry":"Refresh"]}),x.jsx("button",{type:"button",className:"ghost theme-toggle",onClick:a,"aria-label":"Toggle light or dark theme","aria-pressed":o==="light",title:o==="dark"?"Switch to light theme":"Switch to dark theme",children:o==="dark"?"☀":"☾"})]})]}),h&&x.jsxs("div",{className:"schema-banner",role:"status",children:["⚠ Data schema is out of date — run ",x.jsx("code",{children:"agent-lens ingest --full"})," on the host to rebuild. The ",x.jsx("em",{children:"Refresh"})," button only does an incremental ingest and won't fix this."]}),x.jsx("main",{className:"content"+(Z?" wide":""),id:"main",tabIndex:-1,children:x.jsx(Vp,{})})]})}function hh(o){if(!o||o<0)return"—";const a=Math.round(o/1e3);if(a<60)return`${a}s`;const s=Math.round(a/60);return s<60?`${s}m`:`${Math.floor(s/60)}h ${s%60}m`}function zr(o){return o>=1e9?(o/1e9).toFixed(1)+"B":o>=1e6?(o/1e6).toFixed(1)+"M":o>=1e3?(o/1e3).toFixed(1)+"k":String(o)}function mh(o){return o>=.01?"$"+o.toFixed(2):o>0?"<$0.01":"$0"}function vh(o){return o?`input ${zr(o.input)} · output ${zr(o.output)} · cache-write ${zr(o.cache_creation)} · cache-read ${zr(o.cache_read)}`:""}function gh(o){if(!o)return"—";const a=new Date(o);return isNaN(a.getTime())?o:a.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function xc(o){return o?o==="<synthetic>"?"local":o.replace(/^claude-/,"").replace(/-\d{8}$/,""):""}function yh({value:o,options:a,onChange:s,ariaLabel:f,searchPlaceholder:h="Filter…"}){const[v,S]=E.useState(!1),[k,C]=E.useState(""),[R,z]=E.useState(0),j=E.useRef(null),I=E.useRef(null),Z=E.useId(),A=D=>`${Z}-opt-${D}`,K=a.find(D=>D.value===o)??a[0]??{value:"",label:""},O=E.useMemo(()=>{const D=k.trim().toLowerCase();return D?a.filter(H=>H.label.toLowerCase().includes(D)):a},[a,k]);E.useEffect(()=>{if(!v)return;const D=H=>{j.current&&!j.current.contains(H.target)&&S(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[v]),E.useEffect(()=>{var H;if(!v)return;C(""),(H=I.current)==null||H.focus();const D=O.findIndex(ue=>ue.value===o);z(D>=0?D:0)},[v]),E.useEffect(()=>{z(D=>Math.min(D,Math.max(0,O.length-1)))},[O.length]);function q(D){D&&(s(D.value),S(!1))}function b(D){if(D.key==="ArrowDown"){if(D.preventDefault(),!v)return S(!0);z(H=>Math.min(H+1,O.length-1))}else D.key==="ArrowUp"?(D.preventDefault(),z(H=>Math.max(H-1,0))):D.key==="Enter"?(D.preventDefault(),q(O[R])):D.key==="Escape"&&(D.preventDefault(),S(!1))}return x.jsxs("div",{className:"filter-select",ref:j,children:[x.jsxs("button",{type:"button",className:"filter-select-btn","aria-label":f,"aria-haspopup":"listbox","aria-expanded":v,onClick:()=>S(D=>!D),children:[x.jsx("span",{className:"filter-select-value"+(K.value?"":" muted"),children:K.label}),x.jsx("span",{className:"chev","aria-hidden":"true",children:"▾"})]}),v&&x.jsxs("div",{className:"filter-select-pop",children:[x.jsx("input",{ref:I,type:"text",role:"combobox","aria-expanded":"true","aria-controls":Z,"aria-activedescendant":O.length?A(R):void 0,"aria-label":f,className:"filter-select-search",placeholder:h,value:k,onChange:D=>C(D.target.value),onKeyDown:b}),x.jsx("ul",{className:"filter-select-list",role:"listbox",id:Z,"aria-label":f,children:O.length===0?x.jsx("li",{className:"filter-select-empty muted",role:"presentation",children:"No matches"}):O.map((D,H)=>x.jsx("li",{id:A(H),role:"option","aria-selected":D.value===o,className:"filter-select-opt"+(H===R?" is-active":"")+(D.value===o?" is-selected":""),onMouseEnter:()=>z(H),onMouseDown:ue=>{ue.preventDefault(),q(D)},children:D.value?D.label:x.jsx("span",{className:"muted",children:D.label})},D.value||"__all__"))})]})]})}function wh({page:o,pages:a,total:s,unit:f,onPage:h}){return x.jsxs("div",{className:"pager",children:[x.jsx("button",{disabled:o<=1,onClick:()=>h(o-1),children:"← Prev"}),x.jsxs("span",{className:"muted",children:["page ",o," / ",a," · ",s," ",f]}),x.jsx("button",{disabled:o>=a,onClick:()=>h(o+1),children:"Next →"}),a>1&&x.jsxs("label",{className:"page-jump",children:[x.jsx("span",{className:"sr-only",children:"Jump to page"}),x.jsx("select",{value:o,onChange:v=>h(Number(v.target.value)),children:Array.from({length:a},(v,S)=>S+1).map(v=>x.jsxs("option",{value:v,children:["page ",v," / ",a]},v))})]})]})}function Th(o,a,s){const f=s==="asc"?1:-1;return o.map((h,v)=>({row:h,i:v})).sort((h,v)=>{const S=a(h.row),k=a(v.row);if(S==null&&k==null)return h.i-v.i;if(S==null)return 1;if(k==null)return-1;const C=typeof S=="number"&&typeof k=="number"?S-k:String(S).localeCompare(String(k),void 0,{numeric:!0,sensitivity:"base"});return C!==0?C*f:h.i-v.i}).map(h=>h.row)}function zh(o,a){const[s,f]=E.useState({key:o,dir:a});return{sort:s,toggle:(v,S="desc")=>f(k=>k.key===v?{key:v,dir:k.dir==="asc"?"desc":"asc"}:{key:v,dir:S})}}function An({label:o,sortKey:a,active:s,dir:f,onSort:h,defaultDir:v="desc",className:S}){const k=s===a;return x.jsx("th",{className:S,"aria-sort":k?f==="asc"?"ascending":"descending":"none",children:x.jsxs("button",{type:"button",className:"sort-th"+(k?" is-active":""),onClick:()=>h(a,v),children:[x.jsx("span",{children:o}),x.jsx("span",{className:"sort-ind","aria-hidden":"true",children:k?f==="asc"?"▲":"▼":"↕"})]})})}const Xl=50;function Sh(){const[o,a]=lh(),[s,f]=E.useState([]),[h,v]=E.useState([]),[S,k]=E.useState([]),[C,R]=E.useState({total:0,sessions:[]}),[z,j]=E.useState(!0),[I,Z]=E.useState(null),[A,K]=E.useState(o.get("q")??""),O=Number(o.get("offset")??0);E.useEffect(()=>{Tr("/sources").then(f).catch(()=>{}),Tr("/projects").then(v).catch(()=>{}),Tr("/models").then(k).catch(()=>{})},[]),E.useEffect(()=>{j(!0),Z(null);const F=new URLSearchParams;for(const ge of["source","project","model","q","sort","dir"]){const ce=o.get(ge);ce&&F.set(ge,ce)}F.set("kind",o.get("kind")||"main"),F.set("limit",String(Xl)),F.set("offset",String(O)),Tr("/sessions?"+F.toString()).then(R).catch(ge=>Z(String(ge))).finally(()=>j(!1))},[o]);function q(F,ge){const ce=new URLSearchParams(o);ge?ce.set(F,ge):ce.delete(F),F!=="offset"&&ce.delete("offset"),a(ce)}function b(F){F.preventDefault(),q("q",A.trim())}const D=o.get("sort")??"started",H=o.get("dir")==="asc"?"asc":"desc";function ue(F,ge){const ce=D===F?H==="asc"?"desc":"asc":ge,Be=new URLSearchParams(o);Be.set("sort",F),Be.set("dir",ce),Be.delete("offset"),a(Be)}const Ee=Math.floor(O/Xl)+1,Ne=Math.max(1,Math.ceil(C.total/Xl));return x.jsxs("div",{children:[x.jsx("h1",{className:"sr-only",children:"Sessions"}),x.jsxs("div",{className:"filters",children:[x.jsxs("form",{onSubmit:b,className:"search",role:"search",children:[x.jsx("input",{type:"search","aria-label":"Search session names, projects and transcripts",placeholder:"Search names, projects & transcripts…",value:A,onChange:F=>K(F.target.value)}),x.jsx("button",{type:"submit",children:"Search"}),o.get("q")&&x.jsx("button",{type:"button",className:"ghost",onClick:()=>(K(""),q("q","")),children:"clear"})]}),x.jsxs("select",{"aria-label":"Filter by source",value:o.get("source")??"",onChange:F=>q("source",F.target.value),children:[x.jsx("option",{value:"",children:"all sources"}),s.map(F=>x.jsxs("option",{value:F.id,children:[F.label," (",F.session_count,")"]},F.id))]}),x.jsx(yh,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:o.get("project")??"",onChange:F=>q("project",F),options:[{value:"",label:"all projects"},...h.map(F=>({value:F.id,label:`${F.path.replace(/^.*\//,"")} (${F.session_count})`}))]}),x.jsxs("select",{"aria-label":"Filter by model",value:o.get("model")??"",onChange:F=>q("model",F.target.value),children:[x.jsx("option",{value:"",children:"all models"}),S.map(F=>x.jsx("option",{value:F,children:xc(F)},F))]}),x.jsxs("select",{"aria-label":"Filter by kind",value:o.get("kind")||"main",onChange:F=>q("kind",F.target.value),children:[x.jsx("option",{value:"main",children:"main only"}),x.jsx("option",{value:"all",children:"main + subagents"}),x.jsx("option",{value:"subagent",children:"subagents only"})]})]}),I&&x.jsx("div",{className:"error",role:"alert",children:I}),z?x.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):C.sessions.length===0?x.jsx("div",{className:"muted pad",role:"status",children:"No sessions match."}):x.jsxs("table",{className:"sessions",children:[x.jsx("thead",{children:x.jsxs("tr",{children:[x.jsx(An,{label:"Session",sortKey:"title",active:D,dir:H,onSort:ue,defaultDir:"asc"}),x.jsx("th",{children:"Source"}),x.jsx("th",{children:"Project"}),x.jsx(An,{label:"Turns",sortKey:"turns",active:D,dir:H,onSort:ue,className:"num"}),x.jsx(An,{label:"Tokens",sortKey:"tokens",active:D,dir:H,onSort:ue,className:"num"}),x.jsx(An,{label:"Cost",sortKey:"cost",active:D,dir:H,onSort:ue,className:"num"}),x.jsx(An,{label:"Duration",sortKey:"duration",active:D,dir:H,onSort:ue,className:"num"}),x.jsx(An,{label:"Started",sortKey:"started",active:D,dir:H,onSort:ue})]})}),x.jsx("tbody",{children:C.sessions.map(F=>{var ge;return x.jsxs("tr",{children:[x.jsxs("td",{children:[x.jsx(su,{to:`/session/${F.id}`,className:"title",children:F.title||x.jsx("span",{className:"muted",children:F.id.slice(0,12)})}),x.jsxs("div",{className:"sub",children:[F.is_sidechain?x.jsx("span",{className:"tag subagent",children:"subagent"}):null,(F.models??"").split(",").filter(Boolean).slice(0,3).map(ce=>x.jsx("span",{className:"tag",children:xc(ce)},ce))]})]}),x.jsx("td",{children:F.source_id}),x.jsx("td",{className:"path",children:((ge=F.project_path)==null?void 0:ge.replace(/^.*\//,""))??"—"}),x.jsx("td",{className:"num",children:F.turn_count}),x.jsx("td",{className:"num",title:vh(F.token_split),children:zr(F.tokens)}),x.jsx("td",{className:"num",title:"Estimated at API list prices (cache-aware)",children:mh(F.cost)}),x.jsx("td",{className:"num",children:hh(F.duration_ms)}),x.jsx("td",{children:gh(F.started_at)})]},F.id)})})]}),x.jsx(wh,{page:Ee,pages:Ne,total:C.total,unit:"sessions",onPage:F=>q("offset",String((F-1)*Xl))})]})}const kh=E.lazy(()=>Wn(()=>import("./Dashboard-BZeT30Fc.js"),[])),xh=E.lazy(()=>Wn(()=>import("./SessionView-DTYrghRK.js"),__vite__mapDeps([0,1,2,3]))),Eh=E.lazy(()=>Wn(()=>import("./WorkflowView-DwxhHR6A.js"),__vite__mapDeps([4,1,3]))),Ch=E.lazy(()=>Wn(()=>import("./SkillsView-ClZpsQqe.js"),[])),_h=E.lazy(()=>Wn(()=>import("./SkillView-BPXOcH3K.js"),__vite__mapDeps([5,3]))),Ph=E.lazy(()=>Wn(()=>import("./SecurityView-CCSq2PMa.js"),__vite__mapDeps([6,2]))),Bn=()=>x.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}),Nh="/".replace(/\/$/,"");Zd.createRoot(document.getElementById("root")).render(x.jsx(Ec.StrictMode,{children:x.jsx(ch,{children:x.jsx(bp,{basename:Nh,children:x.jsx(Hp,{children:x.jsxs(Lt,{path:"/",element:x.jsx(ph,{}),children:[x.jsx(Lt,{index:!0,element:x.jsx(Sh,{})}),x.jsx(Lt,{path:"dashboard",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(kh,{})})}),x.jsx(Lt,{path:"session/:id",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(xh,{})})}),x.jsx(Lt,{path:"workflow/:run_id",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(Eh,{})})}),x.jsx(Lt,{path:"skills",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(Ch,{})})}),x.jsx(Lt,{path:"skill/:name",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(_h,{})})}),x.jsx(Lt,{path:"security",element:x.jsx(E.Suspense,{fallback:x.jsx(Bn,{}),children:x.jsx(Ph,{})})})]})})})})}));export{yh as F,su as L,wh as P,Ec as R,An as S,lh as a,Dc as b,jh as c,Tr as d,hh as e,mh as f,Vd as g,zr as h,Rh as i,x as j,hn as k,gh as l,Lh as m,zh as n,Th as o,au as p,sh as q,E as r,xc as s,vh as t,fh as u};
|