@swestash/agent-lens 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-lens.js +332 -70
- package/dist/agent-lens.js.map +1 -1
- package/package.json +1 -1
- package/web/assets/{CopyButton-CQA_09tY.js → CopyButton-CLyPzvYe.js} +1 -1
- package/web/assets/{Dashboard-CtAZNySe.js → Dashboard-De60eF84.js} +1 -1
- package/web/assets/FileView-BbQOT43z.js +1 -0
- package/web/assets/FilesView-Ce3W2j5_.js +1 -0
- package/web/assets/{SecurityView-Dg0hnxA-.js → SecurityView-B2czCQsw.js} +1 -1
- package/web/assets/SessionView-CpmvQW2v.js +12 -0
- package/web/assets/{SkillView-BfEFS2DU.js → SkillView-DIxKdBD4.js} +1 -1
- package/web/assets/{SkillsView-CG8HFyyk.js → SkillsView-DF66QBkB.js} +1 -1
- package/web/assets/{WorkflowView-B6_1UcYD.js → WorkflowView-BWB4Z_bX.js} +1 -1
- package/web/assets/{index-B9PbFrlb.js → index-D2UV_n-R.js} +13 -13
- package/web/assets/{index-ksYuAXX3.js → index-bz6hQeaj.js} +1 -1
- package/web/assets/{severity-CZIEtWx1.js → severity-CVXkbfrj.js} +1 -1
- package/web/index.html +1 -1
- package/web/assets/SessionView-Ddk_CWjP.js +0 -12
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-D2UV_n-R.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 xi,g as de,r as D,R as A,u as Dw,j as T,a as qw,b as Lw,l as Bw,f as Fw,d as fn,s as zh,e as Ft,h as hn,i as wi,k as zw,L as Ww}from"./index-B9PbFrlb.js";function jb(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=jb(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ie(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=jb(e))&&(n&&(n+=" "),n+=t);return n}var fo,Wh;function He(){if(Wh)return fo;Wh=1;var e=Array.isArray;return fo=e,fo}var ho,Uh;function Tb(){if(Uh)return ho;Uh=1;var e=typeof xi=="object"&&xi&&xi.Object===Object&ξreturn ho=e,ho}var po,Kh;function _t(){if(Kh)return po;Kh=1;var e=Tb(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return po=r,po}var vo,Hh;function hi(){if(Hh)return vo;Hh=1;var e=_t(),t=e.Symbol;return vo=t,vo}var yo,Gh;function Uw(){if(Gh)return yo;Gh=1;var e=hi(),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 yo=a,yo}var mo,Vh;function Kw(){if(Vh)return mo;Vh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return mo=r,mo}var go,Xh;function qt(){if(Xh)return go;Xh=1;var e=hi(),t=Uw(),r=Kw(),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 go=o,go}var bo,Yh;function Lt(){if(Yh)return bo;Yh=1;function e(t){return t!=null&&typeof t=="object"}return bo=e,bo}var xo,Zh;function en(){if(Zh)return xo;Zh=1;var e=qt(),t=Lt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return xo=n,xo}var wo,Jh;function kf(){if(Jh)return wo;Jh=1;var e=He(),t=en(),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 wo=i,wo}var Oo,Qh;function Vt(){if(Qh)return Oo;Qh=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Oo=e,Oo}var _o,ed;function Nf(){if(ed)return _o;ed=1;var e=qt(),t=Vt(),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 _o=o,_o}var So,td;function Hw(){if(td)return So;td=1;var e=_t(),t=e["__core-js_shared__"];return So=t,So}var Ao,rd;function Gw(){if(rd)return Ao;rd=1;var e=Hw(),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 Ao=r,Ao}var Po,nd;function Eb(){if(nd)return Po;nd=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 Po=r,Po}var jo,id;function Vw(){if(id)return jo;id=1;var e=Nf(),t=Gw(),r=Vt(),n=Eb(),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 d=e(h)?f:a;return d.test(n(h))}return jo=l,jo}var To,ad;function Xw(){if(ad)return To;ad=1;function e(t,r){return t==null?void 0:t[r]}return To=e,To}var Eo,od;function pr(){if(od)return Eo;od=1;var e=Vw(),t=Xw();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return Eo=r,Eo}var Mo,ud;function Na(){if(ud)return Mo;ud=1;var e=pr(),t=e(Object,"create");return Mo=t,Mo}var Co,sd;function Yw(){if(sd)return Co;sd=1;var e=Na();function t(){this.__data__=e?e(null):{},this.size=0}return Co=t,Co}var $o,cd;function Zw(){if(cd)return $o;cd=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 Io,ld;function Jw(){if(ld)return Io;ld=1;var e=Na(),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 Io=i,Io}var ko,fd;function Qw(){if(fd)return ko;fd=1;var e=Na(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return ko=n,ko}var No,hd;function eO(){if(hd)return No;hd=1;var e=Na(),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 No=r,No}var Ro,dd;function tO(){if(dd)return Ro;dd=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,Ro=a,Ro}var Do,pd;function rO(){if(pd)return Do;pd=1;function e(){this.__data__=[],this.size=0}return Do=e,Do}var qo,vd;function Rf(){if(vd)return qo;vd=1;function e(t,r){return t===r||t!==t&&r!==r}return qo=e,qo}var Lo,yd;function Ra(){if(yd)return Lo;yd=1;var e=Rf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return Lo=t,Lo}var Bo,md;function nO(){if(md)return Bo;md=1;var e=Ra(),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 Bo=n,Bo}var Fo,gd;function iO(){if(gd)return Fo;gd=1;var e=Ra();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Fo=t,Fo}var zo,bd;function aO(){if(bd)return zo;bd=1;var e=Ra();function t(r){return e(this.__data__,r)>-1}return zo=t,zo}var Wo,xd;function oO(){if(xd)return Wo;xd=1;var e=Ra();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 Wo=t,Wo}var Uo,wd;function Da(){if(wd)return Uo;wd=1;var e=rO(),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,Uo=a,Uo}var Ko,Od;function Df(){if(Od)return Ko;Od=1;var e=pr(),t=_t(),r=e(t,"Map");return Ko=r,Ko}var Ho,_d;function uO(){if(_d)return Ho;_d=1;var e=tO(),t=Da(),r=Df();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Ho=n,Ho}var Go,Sd;function sO(){if(Sd)return Go;Sd=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Go=e,Go}var Vo,Ad;function qa(){if(Ad)return Vo;Ad=1;var e=sO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Vo=t,Vo}var Xo,Pd;function cO(){if(Pd)return Xo;Pd=1;var e=qa();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Xo=t,Xo}var Yo,jd;function lO(){if(jd)return Yo;jd=1;var e=qa();function t(r){return e(this,r).get(r)}return Yo=t,Yo}var Zo,Td;function fO(){if(Td)return Zo;Td=1;var e=qa();function t(r){return e(this,r).has(r)}return Zo=t,Zo}var Jo,Ed;function hO(){if(Ed)return Jo;Ed=1;var e=qa();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 Jo=t,Jo}var Qo,Md;function qf(){if(Md)return Qo;Md=1;var e=uO(),t=cO(),r=lO(),n=fO(),i=hO();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,Qo=a,Qo}var eu,Cd;function Mb(){if(Cd)return eu;Cd=1;var e=qf(),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,eu=r,eu}var tu,$d;function dO(){if($d)return tu;$d=1;var e=Mb(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return tu=r,tu}var ru,Id;function pO(){if(Id)return ru;Id=1;var e=dO(),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 ru=n,ru}var nu,kd;function Lf(){if(kd)return nu;kd=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 nu=e,nu}var iu,Nd;function vO(){if(Nd)return iu;Nd=1;var e=hi(),t=Lf(),r=He(),n=en(),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 iu=o,iu}var au,Rd;function Cb(){if(Rd)return au;Rd=1;var e=vO();function t(r){return r==null?"":e(r)}return au=t,au}var ou,Dd;function $b(){if(Dd)return ou;Dd=1;var e=He(),t=kf(),r=pO(),n=Cb();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return ou=i,ou}var uu,qd;function La(){if(qd)return uu;qd=1;var e=en();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return uu=t,uu}var su,Ld;function Bf(){if(Ld)return su;Ld=1;var e=$b(),t=La();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 su=r,su}var cu,Bd;function Ib(){if(Bd)return cu;Bd=1;var e=Bf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return cu=t,cu}var yO=Ib();const nt=de(yO);var lu,Fd;function mO(){if(Fd)return lu;Fd=1;function e(t){return t==null}return lu=e,lu}var gO=mO();const re=de(gO);var fu,zd;function bO(){if(zd)return fu;zd=1;var e=qt(),t=He(),r=Lt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return fu=i,fu}var xO=bO();const cr=de(xO);var wO=Nf();const ee=de(wO);var OO=Vt();const tn=de(OO);var hu={exports:{}},oe={};/**
|
|
1
|
+
import{c as xi,g as de,r as D,R as A,u as Dw,j as T,a as qw,b as Lw,l as Bw,f as Fw,d as fn,s as zh,e as Ft,h as hn,i as wi,k as zw,L as Ww}from"./index-D2UV_n-R.js";function jb(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=jb(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ie(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=jb(e))&&(n&&(n+=" "),n+=t);return n}var fo,Wh;function He(){if(Wh)return fo;Wh=1;var e=Array.isArray;return fo=e,fo}var ho,Uh;function Tb(){if(Uh)return ho;Uh=1;var e=typeof xi=="object"&&xi&&xi.Object===Object&ξreturn ho=e,ho}var po,Kh;function _t(){if(Kh)return po;Kh=1;var e=Tb(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return po=r,po}var vo,Hh;function hi(){if(Hh)return vo;Hh=1;var e=_t(),t=e.Symbol;return vo=t,vo}var yo,Gh;function Uw(){if(Gh)return yo;Gh=1;var e=hi(),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 yo=a,yo}var mo,Vh;function Kw(){if(Vh)return mo;Vh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return mo=r,mo}var go,Xh;function qt(){if(Xh)return go;Xh=1;var e=hi(),t=Uw(),r=Kw(),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 go=o,go}var bo,Yh;function Lt(){if(Yh)return bo;Yh=1;function e(t){return t!=null&&typeof t=="object"}return bo=e,bo}var xo,Zh;function en(){if(Zh)return xo;Zh=1;var e=qt(),t=Lt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return xo=n,xo}var wo,Jh;function kf(){if(Jh)return wo;Jh=1;var e=He(),t=en(),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 wo=i,wo}var Oo,Qh;function Vt(){if(Qh)return Oo;Qh=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Oo=e,Oo}var _o,ed;function Nf(){if(ed)return _o;ed=1;var e=qt(),t=Vt(),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 _o=o,_o}var So,td;function Hw(){if(td)return So;td=1;var e=_t(),t=e["__core-js_shared__"];return So=t,So}var Ao,rd;function Gw(){if(rd)return Ao;rd=1;var e=Hw(),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 Ao=r,Ao}var Po,nd;function Eb(){if(nd)return Po;nd=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 Po=r,Po}var jo,id;function Vw(){if(id)return jo;id=1;var e=Nf(),t=Gw(),r=Vt(),n=Eb(),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 d=e(h)?f:a;return d.test(n(h))}return jo=l,jo}var To,ad;function Xw(){if(ad)return To;ad=1;function e(t,r){return t==null?void 0:t[r]}return To=e,To}var Eo,od;function pr(){if(od)return Eo;od=1;var e=Vw(),t=Xw();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return Eo=r,Eo}var Mo,ud;function Na(){if(ud)return Mo;ud=1;var e=pr(),t=e(Object,"create");return Mo=t,Mo}var Co,sd;function Yw(){if(sd)return Co;sd=1;var e=Na();function t(){this.__data__=e?e(null):{},this.size=0}return Co=t,Co}var $o,cd;function Zw(){if(cd)return $o;cd=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 Io,ld;function Jw(){if(ld)return Io;ld=1;var e=Na(),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 Io=i,Io}var ko,fd;function Qw(){if(fd)return ko;fd=1;var e=Na(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return ko=n,ko}var No,hd;function eO(){if(hd)return No;hd=1;var e=Na(),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 No=r,No}var Ro,dd;function tO(){if(dd)return Ro;dd=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,Ro=a,Ro}var Do,pd;function rO(){if(pd)return Do;pd=1;function e(){this.__data__=[],this.size=0}return Do=e,Do}var qo,vd;function Rf(){if(vd)return qo;vd=1;function e(t,r){return t===r||t!==t&&r!==r}return qo=e,qo}var Lo,yd;function Ra(){if(yd)return Lo;yd=1;var e=Rf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return Lo=t,Lo}var Bo,md;function nO(){if(md)return Bo;md=1;var e=Ra(),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 Bo=n,Bo}var Fo,gd;function iO(){if(gd)return Fo;gd=1;var e=Ra();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Fo=t,Fo}var zo,bd;function aO(){if(bd)return zo;bd=1;var e=Ra();function t(r){return e(this.__data__,r)>-1}return zo=t,zo}var Wo,xd;function oO(){if(xd)return Wo;xd=1;var e=Ra();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 Wo=t,Wo}var Uo,wd;function Da(){if(wd)return Uo;wd=1;var e=rO(),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,Uo=a,Uo}var Ko,Od;function Df(){if(Od)return Ko;Od=1;var e=pr(),t=_t(),r=e(t,"Map");return Ko=r,Ko}var Ho,_d;function uO(){if(_d)return Ho;_d=1;var e=tO(),t=Da(),r=Df();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Ho=n,Ho}var Go,Sd;function sO(){if(Sd)return Go;Sd=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Go=e,Go}var Vo,Ad;function qa(){if(Ad)return Vo;Ad=1;var e=sO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Vo=t,Vo}var Xo,Pd;function cO(){if(Pd)return Xo;Pd=1;var e=qa();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Xo=t,Xo}var Yo,jd;function lO(){if(jd)return Yo;jd=1;var e=qa();function t(r){return e(this,r).get(r)}return Yo=t,Yo}var Zo,Td;function fO(){if(Td)return Zo;Td=1;var e=qa();function t(r){return e(this,r).has(r)}return Zo=t,Zo}var Jo,Ed;function hO(){if(Ed)return Jo;Ed=1;var e=qa();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 Jo=t,Jo}var Qo,Md;function qf(){if(Md)return Qo;Md=1;var e=uO(),t=cO(),r=lO(),n=fO(),i=hO();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,Qo=a,Qo}var eu,Cd;function Mb(){if(Cd)return eu;Cd=1;var e=qf(),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,eu=r,eu}var tu,$d;function dO(){if($d)return tu;$d=1;var e=Mb(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return tu=r,tu}var ru,Id;function pO(){if(Id)return ru;Id=1;var e=dO(),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 ru=n,ru}var nu,kd;function Lf(){if(kd)return nu;kd=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 nu=e,nu}var iu,Nd;function vO(){if(Nd)return iu;Nd=1;var e=hi(),t=Lf(),r=He(),n=en(),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 iu=o,iu}var au,Rd;function Cb(){if(Rd)return au;Rd=1;var e=vO();function t(r){return r==null?"":e(r)}return au=t,au}var ou,Dd;function $b(){if(Dd)return ou;Dd=1;var e=He(),t=kf(),r=pO(),n=Cb();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return ou=i,ou}var uu,qd;function La(){if(qd)return uu;qd=1;var e=en();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return uu=t,uu}var su,Ld;function Bf(){if(Ld)return su;Ld=1;var e=$b(),t=La();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 su=r,su}var cu,Bd;function Ib(){if(Bd)return cu;Bd=1;var e=Bf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return cu=t,cu}var yO=Ib();const nt=de(yO);var lu,Fd;function mO(){if(Fd)return lu;Fd=1;function e(t){return t==null}return lu=e,lu}var gO=mO();const re=de(gO);var fu,zd;function bO(){if(zd)return fu;zd=1;var e=qt(),t=He(),r=Lt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return fu=i,fu}var xO=bO();const cr=de(xO);var wO=Nf();const ee=de(wO);var OO=Vt();const tn=de(OO);var hu={exports:{}},oe={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v,r,d as N,j as e,L as h,o as n}from"./index-D2UV_n-R.js";import{relPath as _,LinesDelta as f}from"./FilesView-Ce3W2j5_.js";function S(){const[o]=v(),l=o.get("path")??"",d=o.get("project")??"",[i,j]=r.useState(null),[x,c]=r.useState(!0),[m,p]=r.useState(null);return r.useEffect(()=>{if(!l){c(!1);return}c(!0),p(null);const a=new URLSearchParams({path:l});d&&a.set("project",d),N("/file?"+a.toString()).then(j).catch(t=>p(String(t))).finally(()=>c(!1))},[l,d]),x?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):m?e.jsx("div",{className:"error",role:"alert",children:m}):!l||!i?e.jsx("div",{className:"muted pad",children:"Not found."}):e.jsxs("div",{className:"file-view",children:[e.jsx(h,{to:"/files",className:"back",children:"← all files"}),e.jsxs("header",{className:"skill-head",children:[e.jsxs("h1",{children:["📄 ",_(i.file_path,i.project_path)]}),e.jsxs("div",{className:"skill-head-meta muted",children:[e.jsx("span",{title:i.file_path,children:i.file_path}),i.project_path?e.jsxs(e.Fragment,{children:[" · in ",i.project_path.replace(/^.*\//,"")]}):null]})]}),e.jsxs("div",{className:"kpis",children:[e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"sessions"}),e.jsx("div",{className:"kpi-value",children:i.sessions_count.toLocaleString()})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"changes"}),e.jsx("div",{className:"kpi-value",children:i.changes_count.toLocaleString()})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"lines + / −"}),e.jsxs("div",{className:"kpi-value",children:["+",i.lines_added.toLocaleString()," −",i.lines_removed.toLocaleString()]})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"first · last touched"}),e.jsxs("div",{className:"kpi-value kpi-sub",children:[n(i.first_ts)," · ",n(i.last_ts)]})]})]}),i.sessions.map(a=>{var u;const t=(u=a.changes.find(s=>s.event_uuid))==null?void 0:u.event_uuid;return e.jsxs("div",{className:"card",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:e.jsx(h,{to:`/session/${a.session_id}${t?`#ev-${t}`:""}`,className:"title",title:t?"Open the session at this file's first change":void 0,children:a.title||e.jsx("span",{className:"muted",children:a.session_id.slice(0,12)})})}),e.jsxs("span",{className:"card-hint",children:[a.category&&e.jsx("span",{className:`tag cat-${a.category}`,children:a.category}),a.source_id&&e.jsx("span",{className:"tag",children:a.source_id})," ",n(a.started_at)]})]}),e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Turn"}),e.jsx("th",{children:"Tool"}),e.jsx("th",{className:"num",children:"+ / −"}),e.jsx("th",{children:"Prompt"}),e.jsx("th",{children:"When"})]})}),e.jsx("tbody",{children:a.changes.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:s.event_uuid?e.jsxs(h,{to:`/session/${a.session_id}#ev-${s.event_uuid}`,className:"title",title:"Jump to this change in the transcript",children:["turn ",s.turn_seq!=null?s.turn_seq+1:"?"]}):e.jsxs("span",{className:"muted",children:["turn ",s.turn_seq!=null?s.turn_seq+1:"?"]})}),e.jsx("td",{children:e.jsx("span",{className:"tag",children:s.tool_name})}),e.jsx("td",{className:"num",children:e.jsx(f,{added:s.lines_added,removed:s.lines_removed})}),e.jsx("td",{className:"muted",title:s.prompt_preview??void 0,children:s.prompt_preview?s.prompt_preview.length>80?s.prompt_preview.slice(0,79)+"…":s.prompt_preview:"—"}),e.jsx("td",{children:n(s.timestamp)})]},s.id))})]})]},a.session_id)}),e.jsx("p",{className:"muted pad",children:"Tracked from Edit/Write tool calls — changes made via shell commands or outside sessions aren’t captured."})]})}export{S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as R,r as c,d as x,j as s,F as K,S as p,L as U,o as $,P as w}from"./index-D2UV_n-R.js";const m=50;function I(t,a){return a&&t.startsWith(a.replace(/\/$/,"")+"/")?t.slice(a.replace(/\/$/,"").length+1):t}function M({added:t,removed:a}){return t==null&&a==null?s.jsx("span",{className:"muted",children:"—"}):s.jsxs("span",{className:"sub",children:[t!=null&&s.jsxs("span",{className:"tag",children:["+",t.toLocaleString()]}),a!=null&&s.jsxs("span",{className:"tag",children:["−",a.toLocaleString()]})]})}function k(){const[t,a]=R(),[_,L]=c.useState([]),[y,P]=c.useState([]),[n,q]=c.useState({total:0,files:[]}),[g,f]=c.useState(!0),[S,N]=c.useState(null),[b,v]=c.useState(t.get("q")??""),j=Number(t.get("offset")??0);c.useEffect(()=>{x("/sources").then(L).catch(()=>{}),x("/projects").then(P).catch(()=>{})},[]),c.useEffect(()=>{f(!0),N(null);const e=new URLSearchParams;for(const r of["source","project","q","sort","dir"]){const l=t.get(r);l&&e.set(r,l)}e.set("limit",String(m)),e.set("offset",String(j)),x("/files?"+e.toString()).then(q).catch(r=>N(String(r))).finally(()=>f(!1))},[t,j]);function o(e,r){const l=new URLSearchParams(t);r?l.set(e,r):l.delete(e),e!=="offset"&&l.delete("offset"),a(l)}function F(e){e.preventDefault(),o("q",b.trim())}const i=t.get("sort")??"last_ts",d=t.get("dir")==="asc"?"asc":"desc";function h(e,r){const l=i===e?d==="asc"?"desc":"asc":r,u=new URLSearchParams(t);u.set("sort",e),u.set("dir",l),u.delete("offset"),a(u)}const C=Math.floor(j/m)+1,D=Math.max(1,Math.ceil(n.total/m)),E=!!(t.get("q")||t.get("source")||t.get("project"));return s.jsxs("div",{children:[s.jsx("h1",{className:"sr-only",children:"Files"}),s.jsxs("div",{className:"filters",children:[s.jsxs("form",{onSubmit:F,className:"search",role:"search",children:[s.jsx("input",{type:"search","aria-label":"Search files by path",placeholder:"Search file paths…",value:b,onChange:e=>v(e.target.value)}),s.jsx("button",{type:"submit",children:"Search"}),t.get("q")&&s.jsx("button",{type:"button",className:"ghost",onClick:()=>(v(""),o("q","")),children:"clear"})]}),s.jsxs("select",{"aria-label":"Filter by source",value:t.get("source")??"",onChange:e=>o("source",e.target.value),children:[s.jsx("option",{value:"",children:"all sources"}),_.map(e=>s.jsx("option",{value:e.id,children:e.label},e.id))]}),s.jsx(K,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:t.get("project")??"",onChange:e=>o("project",e),options:[{value:"",label:"all projects"},...y.map(e=>({value:e.id,label:e.path.replace(/^.*\//,"")}))]})]}),S&&s.jsx("div",{className:"error",role:"alert",children:S}),g?s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):n.files.length===0?s.jsx("div",{className:"muted pad",role:"status",children:E?"No files match the filter.":"No file changes ingested yet — run agent-lens refresh (or ingest) first."}):s.jsxs("table",{className:"sessions",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx(p,{label:"File",sortKey:"path",active:i,dir:d,onSort:h,defaultDir:"asc"}),s.jsx("th",{children:"Project"}),s.jsx(p,{label:"Sessions",sortKey:"sessions",active:i,dir:d,onSort:h,className:"num"}),s.jsx(p,{label:"Changes",sortKey:"changes",active:i,dir:d,onSort:h,className:"num"}),s.jsx("th",{className:"num",children:"+ / −"}),s.jsx(p,{label:"Last touched",sortKey:"last_ts",active:i,dir:d,onSort:h})]})}),s.jsx("tbody",{children:n.files.map(e=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(U,{to:`/file?path=${encodeURIComponent(e.file_path)}${e.project_id?`&project=${encodeURIComponent(e.project_id)}`:""}`,className:"title",title:e.file_path,children:I(e.file_path,e.project_path)})}),s.jsx("td",{children:e.project_path?s.jsx("span",{className:"tag",title:e.project_path,children:e.project_path.replace(/^.*\//,"")}):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{className:"num",children:e.sessions.toLocaleString()}),s.jsx("td",{className:"num",children:e.changes.toLocaleString()}),s.jsx("td",{className:"num",children:s.jsx(M,{added:e.lines_added,removed:e.lines_removed})}),s.jsx("td",{children:$(e.last_ts)})]},(e.project_id??"")+"\0"+e.file_path))})]}),!g&&n.total>0&&s.jsx(w,{page:C,pages:D,total:n.total,unit:"files",onPage:e=>o("offset",String((e-1)*m))}),s.jsx("p",{className:"muted pad",children:"Tracked from Edit/Write tool calls — changes made via shell commands or outside sessions aren’t captured."})]})}export{M as LinesDelta,k as default,I as relPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as te,r as a,v as ie,d as N,x as g,j as e,F as ae,y as j,S as R,P as le,o as ne,L as re}from"./index-B9PbFrlb.js";import{S as ce,a as oe}from"./severity-CZIEtWx1.js";const E=50;function pe(){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(()=>{}),g||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]),p=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."]})]}),g&&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"})]}),!g&&(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:()=>p(()=>j("/security/dismiss",{ids:[...u]})),children:["✓ Mark ",u.size," safe"]}),u.size>0&&m==="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>p(()=>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?`)&&p(()=>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:[!g&&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}),!g&&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:()=>p(()=>j("/security/dismiss",{ids:[s.id]})),onReopen:()=>p(()=>j("/security/reopen",{ids:[s.id]})),onMute:()=>p(()=>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}),!g&&S.length>0&&e.jsx(ue,{mutes:S,busy:f,onUnmute:s=>p(()=>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:[!g&&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(/^.*\//,"")})]}),!g&&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{pe as default};
|
|
1
|
+
import{a as te,r as a,v as ie,d as N,x as g,j as e,F as ae,y as j,S as R,P as le,o as ne,L as re}from"./index-D2UV_n-R.js";import{S as ce,a as oe}from"./severity-CVXkbfrj.js";const E=50;function pe(){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(()=>{}),g||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]),p=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."]})]}),g&&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"})]}),!g&&(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:()=>p(()=>j("/security/dismiss",{ids:[...u]})),children:["✓ Mark ",u.size," safe"]}),u.size>0&&m==="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>p(()=>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?`)&&p(()=>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:[!g&&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}),!g&&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:()=>p(()=>j("/security/dismiss",{ids:[s.id]})),onReopen:()=>p(()=>j("/security/reopen",{ids:[s.id]})),onMute:()=>p(()=>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}),!g&&S.length>0&&e.jsx(ue,{mutes:S,busy:f,onUnmute:s=>p(()=>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:[!g&&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(/^.*\//,"")})]}),!g&&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{pe as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{m as us,n as ms,r as u,d as hs,j as s,L as y,e as H,t as ps,h as D,i as C,o as V,p as xs,q as $,s as Q}from"./index-D2UV_n-R.js";import{C as v,p as b}from"./CopyButton-CLyPzvYe.js";import{S as O,a as K}from"./severity-CVXkbfrj.js";import{M as fs,r as js}from"./index-bz6hQeaj.js";const z=u.createContext("markdown");function gs({id:e}){const n=xs();return s.jsxs("details",{className:"export-menu col-customizer",ref:n,children:[s.jsx("summary",{className:"export",title:"Export this session as Markdown",children:"⬇ Export Markdown"}),s.jsxs("div",{className:"col-menu",role:"group","aria-label":"Export options",children:[s.jsxs("a",{href:$(e),download:!0,children:["Redacted ",s.jsx("span",{className:"muted small",children:"(secrets masked)"})]}),s.jsxs("a",{href:$(e,"structure"),download:!0,children:["Structure only ",s.jsx("span",{className:"muted small",children:"(scrubbed)"})]}),s.jsxs("a",{className:"export-verbatim",href:$(e,"off"),download:!0,children:["Verbatim ",s.jsx("span",{className:"muted small",children:"(unredacted)"})]})]})]})}const Y=u.createContext(new Map),G=u.createContext(!1),X=u.createContext(null),Z="agentlens.msgFormat";function Ns(){try{return localStorage.getItem(Z)==="raw"?"raw":"markdown"}catch{return"markdown"}}const ss="agentlens.hideTools";function ws(){try{return localStorage.getItem(ss)==="1"}catch{return!1}}function _s({c:e}){var i;const[n,t]=u.useState(!1),a=u.useId(),l=(i=e.signals)==null?void 0:i.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]}),l&&s.jsxs("span",{className:"muted small",children:["+",l.added,"/−",l.removed," LoC · ",l.files," files"]}),s.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":a,onClick:()=>t(o=>!o),children:["why ",n?"▾":"▸"]}),n&&(e.signals?s.jsx(ys,{id:a,s:e.signals,category:e.category}):s.jsx("div",{id:a,className:"muted small pad",children:"No signals recorded for this session."}))]})}const ks={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 J({counts:e}){const n=Object.entries(e).sort((t,a)=>a[1]-t[1]);return n.length===0?s.jsx("span",{className:"muted",children:"—"}):s.jsx("span",{className:"sig-chips",children:n.map(([t,a])=>s.jsxs("span",{className:"sig-chip",children:[t," ",s.jsxs("span",{className:"muted",children:["×",a]})]},t))})}function ys({id:e,s:n,category:t}){const[a,l]=u.useState(!1),i=u.useId(),o=n.complexity_weights??{},r=n.complexity_subscores??{},c=Object.keys(o).map(d=>({key:d,weight:o[d],subscore:r[d]??0,pts:o[d]*(r[d]??0)*100})).sort((d,_)=>_.pts-d.pts),m=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),j=Math.max(...p.map(d=>d.v),1e-4),x=p.filter(d=>d.v>.02||d.k===t),N=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:ks[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/m)}})}),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/j)}})}),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(J,{counts:n.tool_counts})})]}),N&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Skills"}),s.jsx("dd",{children:s.jsx(J,{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":a,"aria-controls":i,onClick:()=>l(d=>!d),children:a?"Hide raw JSON ▴":"View raw JSON ▾"}),a&&s.jsx("pre",{id:i,className:"code signals",children:JSON.stringify(n,null,2)})]})}function bs({f:e}){var o;const[n,t]=u.useState(!1),a=u.useId(),l=((o=e.signals)==null?void 0:o.modifiers)??{},i=Object.keys(l).filter(r=>l[r]!==!1&&l[r]!=null&&l[r]!=="");return s.jsxs("div",{className:"finding sev-border-"+e.severity,children:[s.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":a,onClick:()=>t(r=>!r),children:[s.jsx(K,{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:a,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}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Context"}),s.jsx("dd",{children:i.map(r=>s.jsxs("span",{className:"sig-chip",children:[r,l[r]!==!0?s.jsxs("span",{className:"muted",children:[" ",String(l[r])]}):null]},r))})]})]}),s.jsxs(y,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(e.rule_id)}`,children:["see all “",e.rule_id,"” findings →"]})]})]})}function vs({findings:e}){if(!e.length)return null;const n=[...e].sort((t,a)=>O.indexOf(t.severity)-O.indexOf(a.severity));return s.jsx("div",{className:"tool-findings",children:n.map(t=>s.jsx(bs,{f:t},t.id))})}function Ss({findings:e,sessionId:n}){const t=new Map;for(const l of e)t.set(l.severity,(t.get(l.severity)??0)+1);const a=O.find(l=>t.has(l))??"info";return s.jsxs("div",{className:"security-banner sev-border-"+a,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(l=>t.has(l)).map(l=>s.jsx(K,{severity:l,count:t.get(l)},l))}),s.jsx(y,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function Cs(e){const n={dirs:new Map,files:[]};for(const a of e){const l=a.display.startsWith("/"),i=(l?a.display.slice(1):a.display).split("/");l&&i.length>0&&(i[0]="/"+i[0]);let o=n;for(const r of i.slice(0,-1))o=o.dirs.get(r)??o.dirs.set(r,{dirs:new Map,files:[]}).get(r);o.files.push({name:i[i.length-1],path:a.path,list:a.list})}const t=a=>{for(const[l,i]of[...a.dirs.entries()])if(t(i),i.files.length===0&&i.dirs.size===1){const[o,r]=[...i.dirs.entries()][0];a.dirs.delete(l),a.dirs.set(l+"/"+o,r)}};return t(n),n}function es({node:e,depth:n}){const t={paddingLeft:`${.4+n*1.1}rem`};return s.jsxs(s.Fragment,{children:[[...e.dirs.entries()].sort(([a],[l])=>a.localeCompare(l)).map(([a,l])=>s.jsxs(u.Fragment,{children:[s.jsx("tr",{children:s.jsx("td",{colSpan:3,style:t,children:s.jsxs("span",{className:"muted",children:["📁 ",a,"/"]})})}),s.jsx(es,{node:l,depth:n+1})]},a)),[...e.files].sort((a,l)=>a.name.localeCompare(l.name)).map(a=>{const l=a.list.find(r=>r.event_uuid),i=a.list.reduce((r,c)=>r+(c.lines_added??0),0),o=a.list.reduce((r,c)=>r+(c.lines_removed??0),0);return s.jsxs("tr",{children:[s.jsx("td",{style:t,children:l!=null&&l.event_uuid?s.jsx("a",{href:`#ev-${l.event_uuid}`,className:"title",title:a.path+" — jump to the first change",children:a.name}):s.jsx("span",{title:a.path,children:a.name})}),s.jsxs("td",{className:"num",children:[a.list.length,"× ",s.jsxs("span",{className:"muted",children:["(+",i," −",o,")"]})]}),s.jsx("td",{children:s.jsx(y,{className:"subagent-link small",to:`/file?path=${encodeURIComponent(a.path)}`,children:"history →"})})]},a.path)})]})}function Is({changes:e,projectPath:n}){const t=new Map;for(const i of e)(t.get(i.file_path)??t.set(i.file_path,[]).get(i.file_path)).push(i);const a=i=>n&&i.startsWith(n.replace(/\/$/,"")+"/")?i.slice(n.replace(/\/$/,"").length+1):i,l=Cs([...t.entries()].map(([i,o])=>({display:a(i),path:i,list:o})));return s.jsxs("details",{className:"wf-run files-changed",children:[s.jsxs("summary",{children:["📄 ",t.size," ",t.size===1?"file":"files"," changed · ",e.length," ",e.length===1?"edit":"edits"]}),s.jsx("table",{className:"sessions",children:s.jsx("tbody",{children:s.jsx(es,{node:l,depth:0})})})]})}function ns({t:e}){const[n,t]=u.useState(!1),[a,l]=u.useState(!1),i=u.useId(),o=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":i,onClick:()=>t(r=>!r),children:[s.jsxs("span",{className:"tool-name",children:["🔧 ",o]}),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:i,children:[e.input_json&&e.input_json!=="{}"&&s.jsxs("div",{className:"code-block",children:[s.jsx(v,{text:b(e.input_json),className:"copy-corner",title:"Copy tool input JSON"}),s.jsx("pre",{className:"code",children:b(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":a,onClick:()=>l(r=>!r),children:[a?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),a&&s.jsxs("div",{className:"code-block",children:[s.jsx(v,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]})]})]})}function ts(e){if(!e)return null;try{const n=JSON.parse(e).plan;return typeof n=="string"&&n.trim()?n:null}catch{return null}}function Os({plan:e}){return s.jsxs("div",{className:"plan-card",children:[s.jsx("div",{className:"plan-card-head",children:"📋 Approved plan"}),s.jsx(is,{text:e})]})}function Ts(e){if(!e)return[];try{const n=JSON.parse(e).questions;return Array.isArray(n)?n:[]}catch{return[]}}function $s(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 Ms({t:e}){const[n,t]=u.useState(!1),a=u.useId(),l=Ts(e.input_json),{answers:i,annotations:o}=$s(e.result_summary);return l.length===0?s.jsx(ns,{t:e}):s.jsxs("div",{className:"qa-card",children:[s.jsxs("div",{className:"qa-card-head",children:["🙋 Question",l.length===1?"":"s"," for the user"]}),l.map((r,c)=>{var _;const m=i[r.question],p=Array.isArray(m)?m:m!=null?[m]:[],j=new Set(p),x=new Set(r.options.map(w=>w.label)),N=p.filter(w=>!x.has(w)),d=(_=o[r.question])==null?void 0:_.notes;return s.jsxs("div",{className:"qa-q",children:[s.jsxs("div",{className:"qa-q-head",children:[r.header&&s.jsx("span",{className:"tag",children:r.header}),r.multiSelect&&s.jsx("span",{className:"muted small",children:"multi-select"})]}),s.jsx("div",{className:"qa-question",children:r.question}),s.jsxs("ul",{className:"qa-options",children:[r.options.map((w,S)=>{const f=j.has(w.label);return s.jsxs("li",{className:"qa-opt"+(f?" is-selected":""),children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:f?"☑":"☐"}),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)}),N.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":a,onClick:()=>t(r=>!r),children:n?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(v,{text:b(e.input_json??"{}")+(e.result_summary?`
|
|
2
|
+
|
|
3
|
+
`+b(e.result_summary):""),label:"JSON",title:"Copy raw question JSON"})]}),n&&s.jsxs("pre",{id:a,className:"code",children:[b(e.input_json??"{}"),e.result_summary?`
|
|
4
|
+
|
|
5
|
+
`+b(e.result_summary):""]})]})}function Es({t:e}){const n=e.workflow_name?`Workflow · ${e.workflow_name}`:"Workflow";return s.jsxs("div",{className:"tool launch-tool",children:[s.jsxs("div",{className:"launch-tool-head",children:[s.jsxs("span",{className:"tool-name",children:["🔀 ",n]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status})]}),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.result_summary&&s.jsx("div",{className:"result",children:e.result_summary})]})}function Fs(e){if(!e)return null;try{const n=JSON.parse(e);if(!n||typeof n!="object")return null;const t=typeof n.command=="string"?n.command:"";return t.trim()?{command:t,description:typeof n.description=="string"?n.description:void 0,timeout:typeof n.timeout=="number"?n.timeout:void 0,run_in_background:n.run_in_background===!0,restart:n.restart===!0}:null}catch{return null}}function P(e,n,t){let a=n+2,l=!1;for(e[a]==="-"&&(l=!0,a++);e[a]===" "||e[a]===" ";)a++;let i="";(e[a]==="'"||e[a]==='"')&&(i=e[a],a++);let o="";if(i){for(;a<e.length&&e[a]!==i;)o+=e[a++];e[a]===i&&a++}else for(;a<e.length&&/[A-Za-z0-9_]/.test(e[a]);)o+=e[a++];return o&&t.push({delim:o,strip:l}),a-1}function qs(e){const n=e.split(`
|
|
6
|
+
`),t=[];let a="NORMAL",l=0;const i=[];let o=!1;for(const r of n){if(i.length>0){t.push({text:r,cont:!0});const c=i[0];(c.strip?r.replace(/^\t+/,""):r).trimEnd()===c.delim&&i.shift();continue}t.push({text:r,cont:a!=="NORMAL"||l>0||o}),o=!1;for(let c=0;c<r.length;c++){const m=r[c];if(a==="SQUOTE"){m==="'"&&(a="NORMAL");continue}if(a==="DQUOTE"){m==="\\"?c++:m==='"'?a="NORMAL":m==="$"&&r[c+1]==="("?(l++,c++):m===")"?l>0&&l--:m==="<"&&r[c+1]==="<"&&r[c+2]!=="<"&&(c=P(r,c,i));continue}if(m==="\\")c++;else if(m==="'")a="SQUOTE";else if(m==='"')a="DQUOTE";else{if(m==="#"&&(c===0||/\s/.test(r[c-1])))break;m==="$"&&r[c+1]==="("?(l++,c++):m==="("?l++:m===")"?l>0&&l--:m==="<"&&r[c+1]==="<"&&r[c+2]!=="<"&&(c=P(r,c,i))}}if(a==="NORMAL"&&l===0&&i.length===0){const c=r.replace(/\s+$/,""),m=c.match(/\\+$/);(m&&m[0].length%2===1||/(&&|\|\||\|)$/.test(c))&&(o=!0)}}return t}function As({t:e,bash:n}){const[t,a]=u.useState(!1),[l,i]=u.useState(!1),[o,r]=u.useState(!1),c=u.useId(),m=u.useId(),p=n.command.split(`
|
|
7
|
+
`)[0],j=qs(n.command);return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":t,"aria-controls":c,onClick:()=>a(x=>!x),children:[s.jsx("span",{className:"tool-name",children:"🖥 Bash"}),n.description?s.jsxs("span",{className:"bash-desc",children:["# ",n.description]}):!t&&s.jsx("span",{className:"bash-preview",children:p}),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:t?"▾":"▸"})]}),t&&s.jsxs("div",{className:"tool-body",id:c,children:[s.jsxs("div",{className:"shell code-block",children:[s.jsx(v,{text:n.command,className:"copy-corner",title:"Copy command"}),s.jsx("pre",{className:"shell-cmd",children:j.map((x,N)=>s.jsxs("span",{children:[s.jsx("span",{className:"shell-gutter"+(x.cont?" cont":""),"aria-hidden":"true",children:x.cont?" ":"$ "}),x.text,N<j.length-1?`
|
|
8
|
+
`:""]},N))})]}),(n.run_in_background||n.restart||n.timeout!=null)&&s.jsxs("div",{className:"bash-badges",children:[n.run_in_background&&s.jsx("span",{className:"bash-badge",children:"background"}),n.restart&&s.jsx("span",{className:"bash-badge",children:"restart"}),n.timeout!=null&&s.jsxs("span",{className:"bash-badge",children:["timeout ",Math.round(n.timeout/1e3),"s"]})]}),e.result_summary&&s.jsx("pre",{className:"shell-out",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:()=>i(x=>!x),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(v,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":o,"aria-controls":m,onClick:()=>r(x=>!x),children:o?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(v,{text:b(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),o&&s.jsx("pre",{id:m,className:"code",children:b(e.input_json??"{}")})]})]})}function U(e,n){const t=e===""?[]:e.split(`
|
|
9
|
+
`),a=n===""?[]:n.split(`
|
|
10
|
+
`),l=t.length,i=a.length;if(l*i>25e4)return[...t.map(p=>({type:"del",text:p})),...a.map(p=>({type:"add",text:p}))];const o=Array.from({length:l+1},()=>new Array(i+1).fill(0));for(let p=l-1;p>=0;p--)for(let j=i-1;j>=0;j--)o[p][j]=t[p]===a[j]?o[p+1][j+1]+1:Math.max(o[p+1][j],o[p][j+1]);const r=[];let c=0,m=0;for(;c<l&&m<i;)t[c]===a[m]?(r.push({type:"ctx",text:t[c]}),c++,m++):o[c+1][m]>=o[c][m+1]?(r.push({type:"del",text:t[c]}),c++):(r.push({type:"add",text:a[m]}),m++);for(;c<l;)r.push({type:"del",text:t[c++]});for(;m<i;)r.push({type:"add",text:a[m++]});return r}function Bs(e,n){if(!n)return null;try{const t=JSON.parse(n);if(!t||typeof t!="object"||typeof t.file_path!="string")return null;let a;if(e==="Write"){if(typeof t.content!="string")return null;a=[t.content===""?[]:t.content.split(`
|
|
11
|
+
`).map(o=>({type:"add",text:o}))]}else if(e==="MultiEdit"){if(!Array.isArray(t.edits)||(a=t.edits.filter(o=>{const r=o;return!!r&&typeof r.old_string=="string"&&typeof r.new_string=="string"}).map(o=>U(o.old_string,o.new_string)),a.length===0))return null}else{if(typeof t.old_string!="string"||typeof t.new_string!="string")return null;a=[U(t.old_string,t.new_string)]}let l=0,i=0;for(const o of a)for(const r of o)r.type==="add"?l++:r.type==="del"&&i++;return{file_path:t.file_path,kind:e,hunks:a,adds:l,dels:i}}catch{return null}}function Rs(e){const n=e.lastIndexOf("/");return n>=0?{dir:e.slice(0,n+1),base:e.slice(n+1)}:{dir:"",base:e}}const Ls={Edit:"✏️",MultiEdit:"✏️",Write:"📄"},M=400;function Js({t:e,edit:n}){const[t,a]=u.useState(!1),[l,i]=u.useState(!1),[o,r]=u.useState(!1),c=u.useId(),m=u.useId(),{dir:p,base:j}=Rs(n.file_path);return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":t,"aria-controls":c,onClick:()=>a(x=>!x),children:[s.jsxs("span",{className:"tool-name",children:[Ls[n.kind]??"✏️"," ",n.kind]}),s.jsxs("span",{className:"edit-path",children:[s.jsx("span",{className:"base",children:j}),p&&s.jsx("span",{className:"dir",children:p.replace(/\/$/,"")})]}),s.jsxs("span",{className:"diff-stat",children:[n.adds>0&&s.jsxs("span",{className:"add",children:["+",n.adds]}),n.dels>0&&s.jsxs("span",{className:"del",children:["−",n.dels]})]}),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:t?"▾":"▸"})]}),t&&s.jsxs("div",{className:"tool-body",id:c,children:[n.hunks.map((x,N)=>s.jsxs("div",{className:"diff",children:[n.hunks.length>1&&s.jsxs("div",{className:"diff-hunk-sep",children:["edit ",N+1]}),x.slice(0,M).map((d,_)=>s.jsxs("div",{className:"diff-line "+d.type,children:[s.jsx("span",{className:"diff-sign","aria-hidden":"true",children:d.type==="add"?"+":d.type==="del"?"−":" "}),s.jsx("span",{className:"diff-text",children:d.text===""?" ":d.text})]},_)),x.length>M&&s.jsxs("div",{className:"diff-more",children:["… ",x.length-M," more lines — View raw JSON for the rest"]})]},N)),e.result_summary&&s.jsx("pre",{className:"shell-out",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:()=>i(x=>!x),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(v,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":o,"aria-controls":m,onClick:()=>r(x=>!x),children:o?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(v,{text:b(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),o&&s.jsx("pre",{id:m,className:"code",children:b(e.input_json??"{}")})]})]})}function Ps({t:e,hideTools:n}){const t=e.findings??[],a=n&&t.length===0,l=Us(e,a);return t.length===0?l:s.jsxs(s.Fragment,{children:[l,s.jsx(vs,{findings:t})]})}function Us(e,n){if(e.tool_name==="ExitPlanMode"){const t=ts(e.input_json);if(t)return s.jsx(Os,{plan:t})}if(e.tool_name==="AskUserQuestion")return s.jsx(Ms,{t:e});if(e.tool_name==="Workflow")return s.jsx(Es,{t:e});if(e.tool_name==="Bash"){const t=Fs(e.input_json);if(t)return n?null:s.jsx(As,{t:e,bash:t})}if(e.tool_name==="Edit"||e.tool_name==="MultiEdit"||e.tool_name==="Write"){const t=Bs(e.tool_name,e.input_json);if(t)return n?null:s.jsx(Js,{t:e,edit:t})}return n?null:s.jsx(ns,{t:e})}function Ws(e,n){return e.findings&&e.findings.length||e.tool_name==="AskUserQuestion"||e.tool_name==="Workflow"||e.tool_name==="ExitPlanMode"&&ts(e.input_json)?!0:!n}function as(e){var a,l,i,o,r;const n=(l=(a=e.match(/<command-name>([^<]*)<\/command-name>/))==null?void 0:a[1])==null?void 0:l.trim();if(n){const c=((o=(i=e.match(/<command-args>([^<]*)<\/command-args>/))==null?void 0:i[1])==null?void 0:o.trim())??"";return{kind:"invocation",name:n.startsWith("/")?n:`/${n}`,args:c}}const t=(r=e.match(/<(?:local-command-stdout|command-output|local-command-stderr)>([\s\S]*?)<\/(?:local-command-stdout|command-output|local-command-stderr)>/))==null?void 0:r[1];return t!=null?{kind:"output",stdout:t.trim()}:/<local-command-caveat>/.test(e)?{kind:"caveat"}:null}function Hs({cmd:e}){return e.kind==="invocation"?s.jsxs("div",{className:"cmd",children:[s.jsxs("span",{className:"cmd-chip",title:"Slash command",children:["⌘ ",e.name]}),e.args&&s.jsx("code",{className:"cmd-args",children:e.args})]}):e.kind==="output"?s.jsx("div",{className:"cmd-out",children:e.stdout&&e.stdout!=="(no content)"?e.stdout:s.jsx("span",{className:"muted",children:"no output"})}):s.jsx("div",{className:"cmd-note muted small",children:"⌘ local command context"})}function ls(e){if(!/<task-notification>/.test(e))return null;const n=t=>{var a,l;return((l=(a=e.match(new RegExp(`<${t}>([\\s\\S]*?)</${t}>`)))==null?void 0:a[1])==null?void 0:l.trim())??null};return{taskId:n("task-id"),toolUseId:n("tool-use-id"),status:n("status"),summary:n("summary")}}function Ds({n:e}){const n=u.useContext(Y),t=e.toolUseId?n.get(e.toolUseId):void 0,a=(e.status??"").toLowerCase();return s.jsxs("div",{className:"task-notif",children:[s.jsxs("div",{className:"task-notif-head",children:[s.jsx("span",{className:"task-notif-icon","aria-hidden":"true",children:"🔔"}),e.status&&s.jsx("span",{className:"tag task-status task-status-"+a,children:e.status}),e.taskId&&s.jsxs("code",{className:"task-notif-id",children:["task ",e.taskId]}),t&&s.jsx(y,{className:"subagent-link small",to:`/workflow/${t}`,children:"view workflow →"})]}),e.summary&&s.jsx("div",{className:"task-notif-summary",children:e.summary})]})}function W({text:e,id:n}){return u.useContext(z)==="raw"?s.jsx("div",{className:"text",id:n,children:e}):s.jsx("div",{className:"text md",id:n,children:s.jsx(fs,{remarkPlugins:[js],components:Vs,children:e})})}const Vs={a:({node:e,...n})=>s.jsx("a",{...n,target:"_blank",rel:"noopener noreferrer"})};function is({text:e}){const n=e.length>1400||e.split(`
|
|
12
|
+
`).length>18,[t,a]=u.useState(!1),l=u.useId();return n?s.jsxs("div",{className:"text-wrap"+(t?"":" is-clamped"),children:[s.jsx(W,{text:e,id:l}),s.jsx("button",{className:"ghost small show-more","aria-expanded":t,"aria-controls":l,onClick:()=>a(i=>!i),children:t?"Show less ▴":"Show more ▾"})]}):s.jsx(W,{text:e})}function Qs(e,n){const t=new Map(n.map(l=>[l.id,l])),a=[];for(const l of e){const i=l.turn_id??null,o=a[a.length-1];o&&o.turnId===i?o.events.push(l):a.push({turnId:i,turn:i?t.get(i)??null:null,events:[l]})}return a}function Ks(e){const n=as(e);if((n==null?void 0:n.kind)==="invocation")return`⌘ ${n.name}${n.args?" "+n.args:""}`;if((n==null?void 0:n.kind)==="output")return"⌘ command output";if((n==null?void 0:n.kind)==="caveat")return"⌘ local command";const t=ls(e);return t?`🔔 task ${t.status??"notification"}`:e}function zs({turn:e,events:n,open:t,onToggle:a}){const l=u.useId();return s.jsxs("section",{className:"turn"+(t?" is-open":""),children:[s.jsxs("button",{className:"turn-head","aria-expanded":t,"aria-controls":l,onClick:a,children:[s.jsx("span",{className:"chev turn-chev","aria-hidden":"true",children:t?"▾":"▸"}),s.jsxs("span",{className:"turn-no",children:["turn ",e.seq+1]}),e.prompt_preview?s.jsx("span",{className:"turn-preview",children:Ks(e.prompt_preview)}):null,s.jsxs("span",{className:"turn-stats muted",children:[n.length," msg",n.length===1?"":"s",e.duration_ms?" · "+C(e.duration_ms):""]})]}),s.jsx("div",{id:l,className:"turn-body",role:"region","aria-label":`turn ${e.seq+1} messages`,children:t&&n.map(i=>s.jsx(rs,{e:i},i.uuid))})]})}function rs({e}){const[n,t]=u.useState(!1),a=u.useId(),l=u.useContext(G),i=u.useContext(X),o=e.role||e.type,r=o==="user"?"👤":o==="assistant"?"🤖":"⚙️",c=e.toolCalls.filter(N=>Ws(N,l));if(!(e.text||e.thinking||c.length))return null;const p=e.text?as(e.text):null,j=e.text&&!p?ls(e.text):null,x=e.text||e.thinking||"";return s.jsxs("div",{id:"ev-"+e.uuid,className:"event ev-"+o+(i===e.uuid?" ev-flagged":""),children:[s.jsxs("div",{className:"ev-meta",children:[s.jsxs("span",{className:"ev-who",children:[r," ",o]}),e.model&&s.jsx("span",{className:"tag",children:Q(e.model)}),e.is_sidechain?s.jsx("span",{className:"tag subagent",children:"subagent"}):null,s.jsx("span",{className:"muted ev-time",children:V(e.timestamp)}),x&&s.jsx(v,{text:x,className:"ev-copy copy-hover",title:"Copy message"})]}),e.thinking&&s.jsxs("div",{className:"thinking",children:[s.jsxs("button",{className:"thinking-toggle","aria-expanded":n,"aria-controls":a,onClick:()=>t(N=>!N),children:["🧠 thinking ",n?"▾":"▸"]}),n&&s.jsxs("div",{className:"code-block",children:[s.jsx(v,{text:e.thinking,className:"copy-corner",title:"Copy thinking"}),s.jsx("pre",{id:a,className:"thinking-body",children:e.thinking})]})]}),e.text&&(p?s.jsx(Hs,{cmd:p}):j?s.jsx(Ds,{n:j}):s.jsx(is,{text:e.text})),c.map((N,d)=>s.jsx(Ps,{t:N,hideTools:l},d))]})}function E({c:e}){const n=e.agent_description||e.title||e.id.slice(0,12);return s.jsxs("li",{children:[s.jsx(y,{to:`/session/${e.id}`,children:n}),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(Q).join(", ")," ·"," ",H(e.tokens)," tok · ",D(e.cost)]})]})}function Ys({d:e}){const n=e.workflow_runs??[],t=e.children.filter(l=>!l.workflow_run_id),a=n.length>0;return s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Spawned subagents (",e.children.length,")"]}),n.map(l=>{const i=e.children.filter(o=>o.workflow_run_id===l.run_id);return s.jsxs("details",{className:"wf-run",children:[s.jsxs("summary",{children:[s.jsxs(y,{className:"wf-run-name",to:`/workflow/${l.run_id}`,onClick:o=>o.stopPropagation(),children:["🔀 ",l.name||"workflow"," →"]}),l.status&&s.jsx("span",{className:"tag task-status task-status-"+l.status.toLowerCase(),children:l.status}),s.jsxs("span",{className:"muted small",children:[i.length," agent",i.length===1?"":"s",l.turn_seq!=null?` · turn ${l.turn_seq+1}`:""," · ",s.jsx("code",{children:l.run_id})]})]}),s.jsx("ul",{children:i.map(o=>s.jsx(E,{c:o},o.id))})]},l.run_id)}),t.length>0&&(a?s.jsxs("details",{className:"wf-run",open:!0,children:[s.jsxs("summary",{children:[s.jsx("span",{className:"wf-run-name",children:"Task / Agent"}),s.jsxs("span",{className:"muted small",children:[t.length," subagent",t.length===1?"":"s"]})]}),s.jsx("ul",{children:t.map(l=>s.jsx(E,{c:l},l.id))})]}):s.jsx("ul",{children:t.map(l=>s.jsx(E,{c:l},l.id))}))]})}function ee(){const{id:e}=us(),{hash:n}=ms(),[t,a]=u.useState(null),[l,i]=u.useState(null),[o,r]=u.useState(new Set),[c,m]=u.useState(Ns),[p,j]=u.useState(ws),x=h=>{m(h);try{localStorage.setItem(Z,h)}catch{}},N=()=>j(h=>{const k=!h;try{localStorage.setItem(ss,k?"1":"0")}catch{}return k});u.useEffect(()=>{a(null),i(null),r(new Set),hs("/sessions/"+e).then(a).catch(h=>i(String(h)))},[e]);const[d,_]=u.useState(null),w=u.useRef(null);u.useEffect(()=>{if(!t)return;const h=/^#ev-(.+)$/.exec(n);if(!h){w.current=null;return}if(w.current===n)return;const k=h[1],g=t.events.find(T=>T.uuid===k);if(g!=null&&g.turn_id&&o.has(g.turn_id)){const T=g.turn_id;r(ds=>{const R=new Set(ds);return R.delete(T),R});return}const B=document.getElementById("ev-"+k);if(!B)return;w.current=n,B.scrollIntoView({block:"center",behavior:"smooth"}),_(k);const cs=window.setTimeout(()=>_(null),3e3);return()=>window.clearTimeout(cs)},[t,n,o]);const S=u.useMemo(()=>{const h=new Map;for(const k of(t==null?void 0:t.events)??[])for(const g of k.toolCalls)g.tool_name==="Workflow"&&g.id&&g.workflow_run_id&&h.set(g.id,g.workflow_run_id);return h},[t]);if(l)return s.jsx("div",{className:"error",role:"alert",children:l});if(!t)return s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"});const f=t.session,F=t.events.filter(h=>h.text||h.thinking||h.toolCalls.length),q=Qs(F,t.turns),I=q.filter(h=>h.turn).map(h=>h.turnId),A=I.some(h=>!o.has(h)),os=h=>r(k=>{const g=new Set(k);return g.has(h)?g.delete(h):g.add(h),g});return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(y,{to:"/",className:"back",children:"← all sessions"}),s.jsx("h1",{children:f.title||f.id.slice(0,12)}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("span",{children:s.jsx("b",{children:f.source_id})}),s.jsx("span",{className:"path",children:f.project_path}),f.is_sidechain?s.jsx("span",{className:"tag subagent",children:"subagent"}):null,t.parent&&s.jsxs("span",{className:"spawned-by",children:["↖ spawned by"," ",s.jsx(y,{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:[t.turns.length," turns"]}),s.jsxs("span",{children:[f.event_count," events"]}),s.jsxs("span",{title:ps(f.token_split),children:[H(f.tokens)," tok"]}),s.jsx("span",{title:"Estimated at API list prices (cache-aware)",children:D(f.cost)}),f.tool_call_count>0&&s.jsxs("span",{className:f.tool_failure_count>0?"tool-err-stat":"muted",title:"Tool calls that returned is_error, of "+f.tool_call_count+". Failures = the agent's tool errored; declined/blocked = you rejected it or a guardrail blocked it (heuristic split from the result text — not an API-reported distinction).",children:[f.tool_failure_count," failed",f.tool_rejection_count>0?` · ${f.tool_rejection_count} declined/blocked`:"",` of ${f.tool_call_count} tool calls`]}),s.jsx("span",{children:C(f.duration_ms)}),s.jsx("span",{className:"muted",children:V(f.started_at)}),s.jsx(gs,{id:f.id})]}),t.classification&&s.jsx(_s,{c:t.classification}),t.findings&&t.findings.length>0&&s.jsx(Ss,{findings:t.findings,sessionId:f.id}),t.file_changes&&t.file_changes.length>0&&s.jsx(Is,{changes:t.file_changes,projectPath:f.project_path??null})]}),t.children&&t.children.length>0&&s.jsx(Ys,{d:t}),s.jsxs("div",{className:"transcript-tools",children:[I.length>1&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"muted small",children:[I.length," turns"]}),s.jsx("button",{className:"ghost small",onClick:()=>r(A?new Set(I):new Set),children:A?"Collapse all":"Expand all"})]}),s.jsxs("button",{className:"ghost small"+(p?" is-active":""),"aria-pressed":p,onClick:N,title:"Hide Bash/Edit/Skill and other tool calls — show only assistant answers, plans and questions",children:[p?"☑ ":"☐ ","Hide tool messages"]}),s.jsxs("div",{className:"format-toggle",role:"group","aria-label":"Message format",children:[s.jsx("button",{className:"ghost small"+(c==="markdown"?" is-active":""),"aria-pressed":c==="markdown",onClick:()=>x("markdown"),children:"Markdown"}),s.jsx("button",{className:"ghost small"+(c==="raw"?" is-active":""),"aria-pressed":c==="raw",onClick:()=>x("raw"),children:"Raw"})]})]}),s.jsx(Y.Provider,{value:S,children:s.jsx(z.Provider,{value:c,children:s.jsx(G.Provider,{value:p,children:s.jsx(X.Provider,{value:d,children:s.jsxs("div",{className:"transcript",children:[F.length===0&&s.jsx("div",{className:"muted pad",role:"status",children:"This session has no rendered messages."}),q.map((h,k)=>h.turn?s.jsx(zs,{turn:h.turn,events:h.events,open:!o.has(h.turnId),onToggle:()=>os(h.turnId)},h.turnId):s.jsx("div",{className:"unturned",children:h.events.map(g=>s.jsx(rs,{e:g},g.uuid))},"unturned-"+k))]})})})})})]})}export{ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as N,a as g,r as a,d as k,j as s,L as j,o as c}from"./index-
|
|
1
|
+
import{m as N,a as g,r as a,d as k,j as s,L as j,o as c}from"./index-D2UV_n-R.js";import{M as b,r as y}from"./index-bz6hQeaj.js";function S(n){return!n||n<0?"—":n>=1024?(n/1024).toFixed(1)+" KB":n+" B"}function _(n,t){return`${n.slice(0,8)} · ${c(t)}`}function F(){const{name:n=""}=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(n)).then(o).catch(e=>u(String(e))).finally(()=>h(!1))},[n]);const r=a.useMemo(()=>{if(!(i!=null&&i.versions.length))return null;const e=t.get("v");return i.versions.find(l=>l.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 l=new URLSearchParams(t);l.set("v",e),v(l)}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,l)=>s.jsxs("option",{value:e.id,children:[_(e.id,e.last_seen)," · ",e.call_count," fire",e.call_count===1?"":"s",l===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 l;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:((l=e.project_path)==null?void 0:l.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,v as I,d as h,w as K,j as e,F as M,S as m,L as D,o as U,P as $}from"./index-
|
|
1
|
+
import{a as C,r,v as I,d as h,w as K,j as e,F as M,S as m,L as D,o as U,P as $}from"./index-D2UV_n-R.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 w(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),F=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:w,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:F.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,m as z,d as H,L as O,s as $,e as J,h as F,i as I,o as Q}from"./index-B9PbFrlb.js";import{s as B,d as S,l as D,a as U,C as G,p as L}from"./CopyButton-CQA_09tY.js";import{M as K,r as q}from"./index-ksYuAXX3.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,m as z,d as H,L as O,s as $,e as J,h as F,i as I,o as Q}from"./index-D2UV_n-R.js";import{s as B,d as S,l as D,a as U,C as G,p as L}from"./CopyButton-CLyPzvYe.js";import{M as K,r as q}from"./index-bz6hQeaj.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};
|