@swestash/agent-lens 0.5.0 → 0.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swestash/agent-lens",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "description": "Local-only tool that passively collects, browses, and analyzes Claude Code CLI session traces.",
6
6
  "license": "MIT",
@@ -1 +1 @@
1
- import{r as u,j as p}from"./index-DTfBIYUK.js";function d(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#3?9;|&#x27;/g,"'").replace(/&amp;/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
+ import{r as u,j as p}from"./index-D-kuW17t.js";function d(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#3?9;|&#x27;/g,"'").replace(/&amp;/g,"&")}function y(e){const t=e.match(/\s*\(\s*truncated[^)]*\)\s*$/i);return!t||t.index==null?{body:e,note:null}:{body:e.slice(0,t.index).trimEnd(),note:t[0].trim()}}function m(e){try{return{value:JSON.parse(e),repaired:!1}}catch{}const t=[];let s=!1,a=!1,o=-1,i=[];for(let r=0;r<e.length;r++){const n=e[r];if(s){a?a=!1:n==="\\"?a=!0:n==='"'&&(s=!1);continue}n==='"'?s=!0:n==="{"||n==="["?t.push(n==="{"?"}":"]"):n==="}"||n==="]"?(t.pop(),o=r+1,i=[...t]):n===","&&(o=r,i=[...t])}if(o<0)return{value:void 0,repaired:!1};const c=e.slice(0,o)+i.reverse().join("");try{return{value:JSON.parse(c),repaired:!0}}catch{return{value:void 0,repaired:!1}}}function l(e){if(typeof e=="string"){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return l(JSON.parse(t))}catch{return e}return e}if(Array.isArray(e))return e.map(l);if(e&&typeof e=="object"){const t={};for(const[s,a]of Object.entries(e))t[s]=l(a);return t}return e}function h(e,t=2e4){try{return JSON.stringify(JSON.parse(e),null,2).slice(0,t)}catch{return e.slice(0,t)}}function g({text:e,label:t,title:s="Copy to clipboard",className:a=""}){const[o,i]=u.useState(!1),c=async()=>{try{await navigator.clipboard.writeText(e)}catch{const r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();try{document.execCommand("copy")}catch{}r.remove()}i(!0),window.setTimeout(()=>i(!1),1200)};return p.jsxs("button",{type:"button",className:"ghost small copy-btn "+a,onClick:c,"aria-label":s,title:s,children:[o?"✓ Copied":"⧉",t?" "+t:""]})}export{g as C,l as a,d,m as l,h as p,y as s};
@@ -1,4 +1,4 @@
1
- import{c as mi,g as ce,r as N,R as P,u as kw,j as $,a as Dw,b as Nw,d as cn,s as qh,f as gi,e as Lh,h as Zt,L as Rw}from"./index-DTfBIYUK.js";function Sb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Sb(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ee(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Sb(e))&&(n&&(n+=" "),n+=t);return n}var lo,Bh;function Fe(){if(Bh)return lo;Bh=1;var e=Array.isArray;return lo=e,lo}var fo,Fh;function Ab(){if(Fh)return fo;Fh=1;var e=typeof mi=="object"&&mi&&mi.Object===Object&&mi;return fo=e,fo}var ho,zh;function vt(){if(zh)return ho;zh=1;var e=Ab(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return ho=r,ho}var po,Wh;function si(){if(Wh)return po;Wh=1;var e=vt(),t=e.Symbol;return po=t,po}var vo,Uh;function qw(){if(Uh)return vo;Uh=1;var e=si(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),s=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(u?o[i]=s:delete o[i]),f}return vo=a,vo}var yo,Kh;function Lw(){if(Kh)return yo;Kh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return yo=r,yo}var mo,Hh;function Et(){if(Hh)return mo;Hh=1;var e=si(),t=qw(),r=Lw(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return mo=o,mo}var go,Gh;function Mt(){if(Gh)return go;Gh=1;function e(t){return t!=null&&typeof t=="object"}return go=e,go}var bo,Vh;function Qr(){if(Vh)return bo;Vh=1;var e=Et(),t=Mt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return bo=n,bo}var xo,Xh;function Mf(){if(Xh)return xo;Xh=1;var e=Fe(),t=Qr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return xo=i,xo}var wo,Yh;function Ft(){if(Yh)return wo;Yh=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return wo=e,wo}var Oo,Zh;function $f(){if(Zh)return Oo;Zh=1;var e=Et(),t=Ft(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var s=e(u);return s==n||s==i||s==r||s==a}return Oo=o,Oo}var _o,Jh;function Bw(){if(Jh)return _o;Jh=1;var e=vt(),t=e["__core-js_shared__"];return _o=t,_o}var So,Qh;function Fw(){if(Qh)return So;Qh=1;var e=Bw(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return So=r,So}var Ao,ep;function Pb(){if(ep)return Ao;ep=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Ao=r,Ao}var Po,tp;function zw(){if(tp)return Po;tp=1;var e=$f(),t=Fw(),r=Ft(),n=Pb(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,s=o.toString,c=u.hasOwnProperty,f=RegExp("^"+s.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var p=e(h)?f:a;return p.test(n(h))}return Po=l,Po}var To,rp;function Ww(){if(rp)return To;rp=1;function e(t,r){return t==null?void 0:t[r]}return To=e,To}var jo,np;function hr(){if(np)return jo;np=1;var e=zw(),t=Ww();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return jo=r,jo}var Eo,ip;function Ia(){if(ip)return Eo;ip=1;var e=hr(),t=e(Object,"create");return Eo=t,Eo}var Mo,ap;function Uw(){if(ap)return Mo;ap=1;var e=Ia();function t(){this.__data__=e?e(null):{},this.size=0}return Mo=t,Mo}var $o,op;function Kw(){if(op)return $o;op=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return $o=e,$o}var Co,up;function Hw(){if(up)return Co;up=1;var e=Ia(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return Co=i,Co}var Io,sp;function Gw(){if(sp)return Io;sp=1;var e=Ia(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Io=n,Io}var ko,cp;function Vw(){if(cp)return ko;cp=1;var e=Ia(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return ko=r,ko}var Do,lp;function Xw(){if(lp)return Do;lp=1;var e=Uw(),t=Kw(),r=Hw(),n=Gw(),i=Vw();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Do=a,Do}var No,fp;function Yw(){if(fp)return No;fp=1;function e(){this.__data__=[],this.size=0}return No=e,No}var Ro,hp;function Cf(){if(hp)return Ro;hp=1;function e(t,r){return t===r||t!==t&&r!==r}return Ro=e,Ro}var qo,pp;function ka(){if(pp)return qo;pp=1;var e=Cf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return qo=t,qo}var Lo,dp;function Zw(){if(dp)return Lo;dp=1;var e=ka(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return Lo=n,Lo}var Bo,vp;function Jw(){if(vp)return Bo;vp=1;var e=ka();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Bo=t,Bo}var Fo,yp;function Qw(){if(yp)return Fo;yp=1;var e=ka();function t(r){return e(this.__data__,r)>-1}return Fo=t,Fo}var zo,mp;function eO(){if(mp)return zo;mp=1;var e=ka();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return zo=t,zo}var Wo,gp;function Da(){if(gp)return Wo;gp=1;var e=Yw(),t=Zw(),r=Jw(),n=Qw(),i=eO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Wo=a,Wo}var Uo,bp;function If(){if(bp)return Uo;bp=1;var e=hr(),t=vt(),r=e(t,"Map");return Uo=r,Uo}var Ko,xp;function tO(){if(xp)return Ko;xp=1;var e=Xw(),t=Da(),r=If();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Ko=n,Ko}var Ho,wp;function rO(){if(wp)return Ho;wp=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Ho=e,Ho}var Go,Op;function Na(){if(Op)return Go;Op=1;var e=rO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Go=t,Go}var Vo,_p;function nO(){if(_p)return Vo;_p=1;var e=Na();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Vo=t,Vo}var Xo,Sp;function iO(){if(Sp)return Xo;Sp=1;var e=Na();function t(r){return e(this,r).get(r)}return Xo=t,Xo}var Yo,Ap;function aO(){if(Ap)return Yo;Ap=1;var e=Na();function t(r){return e(this,r).has(r)}return Yo=t,Yo}var Zo,Pp;function oO(){if(Pp)return Zo;Pp=1;var e=Na();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Zo=t,Zo}var Jo,Tp;function kf(){if(Tp)return Jo;Tp=1;var e=tO(),t=nO(),r=iO(),n=aO(),i=oO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Jo=a,Jo}var Qo,jp;function Tb(){if(jp)return Qo;jp=1;var e=kf(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],s=a.cache;if(s.has(u))return s.get(u);var c=n.apply(this,o);return a.cache=s.set(u,c)||s,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,Qo=r,Qo}var eu,Ep;function uO(){if(Ep)return eu;Ep=1;var e=Tb(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return eu=r,eu}var tu,Mp;function sO(){if(Mp)return tu;Mp=1;var e=uO(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,u,s,c){a.push(s?c.replace(r,"$1"):u||o)}),a});return tu=n,tu}var ru,$p;function Df(){if($p)return ru;$p=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return ru=e,ru}var nu,Cp;function cO(){if(Cp)return nu;Cp=1;var e=si(),t=Df(),r=Fe(),n=Qr(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return nu=o,nu}var iu,Ip;function jb(){if(Ip)return iu;Ip=1;var e=cO();function t(r){return r==null?"":e(r)}return iu=t,iu}var au,kp;function Eb(){if(kp)return au;kp=1;var e=Fe(),t=Mf(),r=sO(),n=jb();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return au=i,au}var ou,Dp;function Ra(){if(Dp)return ou;Dp=1;var e=Qr();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return ou=t,ou}var uu,Np;function Nf(){if(Np)return uu;Np=1;var e=Eb(),t=Ra();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return uu=r,uu}var su,Rp;function Mb(){if(Rp)return su;Rp=1;var e=Nf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return su=t,su}var lO=Mb();const Ze=ce(lO);var cu,qp;function fO(){if(qp)return cu;qp=1;function e(t){return t==null}return cu=e,cu}var hO=fO();const Q=ce(hO);var lu,Lp;function pO(){if(Lp)return lu;Lp=1;var e=Et(),t=Fe(),r=Mt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return lu=i,lu}var dO=pO();const ur=ce(dO);var vO=$f();const X=ce(vO);var yO=Ft();const en=ce(yO);var fu={exports:{}},ne={};/**
1
+ import{c as mi,g as ce,r as N,R as P,u as kw,j as $,a as Dw,b as Nw,d as cn,s as qh,f as gi,e as Lh,h as Zt,L as Rw}from"./index-D-kuW17t.js";function Sb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Sb(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ee(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Sb(e))&&(n&&(n+=" "),n+=t);return n}var lo,Bh;function Fe(){if(Bh)return lo;Bh=1;var e=Array.isArray;return lo=e,lo}var fo,Fh;function Ab(){if(Fh)return fo;Fh=1;var e=typeof mi=="object"&&mi&&mi.Object===Object&&mi;return fo=e,fo}var ho,zh;function vt(){if(zh)return ho;zh=1;var e=Ab(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return ho=r,ho}var po,Wh;function si(){if(Wh)return po;Wh=1;var e=vt(),t=e.Symbol;return po=t,po}var vo,Uh;function qw(){if(Uh)return vo;Uh=1;var e=si(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),s=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(u?o[i]=s:delete o[i]),f}return vo=a,vo}var yo,Kh;function Lw(){if(Kh)return yo;Kh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return yo=r,yo}var mo,Hh;function Et(){if(Hh)return mo;Hh=1;var e=si(),t=qw(),r=Lw(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return mo=o,mo}var go,Gh;function Mt(){if(Gh)return go;Gh=1;function e(t){return t!=null&&typeof t=="object"}return go=e,go}var bo,Vh;function Qr(){if(Vh)return bo;Vh=1;var e=Et(),t=Mt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return bo=n,bo}var xo,Xh;function Mf(){if(Xh)return xo;Xh=1;var e=Fe(),t=Qr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return xo=i,xo}var wo,Yh;function Ft(){if(Yh)return wo;Yh=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return wo=e,wo}var Oo,Zh;function $f(){if(Zh)return Oo;Zh=1;var e=Et(),t=Ft(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var s=e(u);return s==n||s==i||s==r||s==a}return Oo=o,Oo}var _o,Jh;function Bw(){if(Jh)return _o;Jh=1;var e=vt(),t=e["__core-js_shared__"];return _o=t,_o}var So,Qh;function Fw(){if(Qh)return So;Qh=1;var e=Bw(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return So=r,So}var Ao,ep;function Pb(){if(ep)return Ao;ep=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Ao=r,Ao}var Po,tp;function zw(){if(tp)return Po;tp=1;var e=$f(),t=Fw(),r=Ft(),n=Pb(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,s=o.toString,c=u.hasOwnProperty,f=RegExp("^"+s.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var p=e(h)?f:a;return p.test(n(h))}return Po=l,Po}var To,rp;function Ww(){if(rp)return To;rp=1;function e(t,r){return t==null?void 0:t[r]}return To=e,To}var jo,np;function hr(){if(np)return jo;np=1;var e=zw(),t=Ww();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return jo=r,jo}var Eo,ip;function Ia(){if(ip)return Eo;ip=1;var e=hr(),t=e(Object,"create");return Eo=t,Eo}var Mo,ap;function Uw(){if(ap)return Mo;ap=1;var e=Ia();function t(){this.__data__=e?e(null):{},this.size=0}return Mo=t,Mo}var $o,op;function Kw(){if(op)return $o;op=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return $o=e,$o}var Co,up;function Hw(){if(up)return Co;up=1;var e=Ia(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return Co=i,Co}var Io,sp;function Gw(){if(sp)return Io;sp=1;var e=Ia(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Io=n,Io}var ko,cp;function Vw(){if(cp)return ko;cp=1;var e=Ia(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return ko=r,ko}var Do,lp;function Xw(){if(lp)return Do;lp=1;var e=Uw(),t=Kw(),r=Hw(),n=Gw(),i=Vw();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Do=a,Do}var No,fp;function Yw(){if(fp)return No;fp=1;function e(){this.__data__=[],this.size=0}return No=e,No}var Ro,hp;function Cf(){if(hp)return Ro;hp=1;function e(t,r){return t===r||t!==t&&r!==r}return Ro=e,Ro}var qo,pp;function ka(){if(pp)return qo;pp=1;var e=Cf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return qo=t,qo}var Lo,dp;function Zw(){if(dp)return Lo;dp=1;var e=ka(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return Lo=n,Lo}var Bo,vp;function Jw(){if(vp)return Bo;vp=1;var e=ka();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Bo=t,Bo}var Fo,yp;function Qw(){if(yp)return Fo;yp=1;var e=ka();function t(r){return e(this.__data__,r)>-1}return Fo=t,Fo}var zo,mp;function eO(){if(mp)return zo;mp=1;var e=ka();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return zo=t,zo}var Wo,gp;function Da(){if(gp)return Wo;gp=1;var e=Yw(),t=Zw(),r=Jw(),n=Qw(),i=eO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Wo=a,Wo}var Uo,bp;function If(){if(bp)return Uo;bp=1;var e=hr(),t=vt(),r=e(t,"Map");return Uo=r,Uo}var Ko,xp;function tO(){if(xp)return Ko;xp=1;var e=Xw(),t=Da(),r=If();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Ko=n,Ko}var Ho,wp;function rO(){if(wp)return Ho;wp=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Ho=e,Ho}var Go,Op;function Na(){if(Op)return Go;Op=1;var e=rO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Go=t,Go}var Vo,_p;function nO(){if(_p)return Vo;_p=1;var e=Na();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Vo=t,Vo}var Xo,Sp;function iO(){if(Sp)return Xo;Sp=1;var e=Na();function t(r){return e(this,r).get(r)}return Xo=t,Xo}var Yo,Ap;function aO(){if(Ap)return Yo;Ap=1;var e=Na();function t(r){return e(this,r).has(r)}return Yo=t,Yo}var Zo,Pp;function oO(){if(Pp)return Zo;Pp=1;var e=Na();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Zo=t,Zo}var Jo,Tp;function kf(){if(Tp)return Jo;Tp=1;var e=tO(),t=nO(),r=iO(),n=aO(),i=oO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Jo=a,Jo}var Qo,jp;function Tb(){if(jp)return Qo;jp=1;var e=kf(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],s=a.cache;if(s.has(u))return s.get(u);var c=n.apply(this,o);return a.cache=s.set(u,c)||s,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,Qo=r,Qo}var eu,Ep;function uO(){if(Ep)return eu;Ep=1;var e=Tb(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return eu=r,eu}var tu,Mp;function sO(){if(Mp)return tu;Mp=1;var e=uO(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,u,s,c){a.push(s?c.replace(r,"$1"):u||o)}),a});return tu=n,tu}var ru,$p;function Df(){if($p)return ru;$p=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return ru=e,ru}var nu,Cp;function cO(){if(Cp)return nu;Cp=1;var e=si(),t=Df(),r=Fe(),n=Qr(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return nu=o,nu}var iu,Ip;function jb(){if(Ip)return iu;Ip=1;var e=cO();function t(r){return r==null?"":e(r)}return iu=t,iu}var au,kp;function Eb(){if(kp)return au;kp=1;var e=Fe(),t=Mf(),r=sO(),n=jb();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return au=i,au}var ou,Dp;function Ra(){if(Dp)return ou;Dp=1;var e=Qr();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return ou=t,ou}var uu,Np;function Nf(){if(Np)return uu;Np=1;var e=Eb(),t=Ra();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return uu=r,uu}var su,Rp;function Mb(){if(Rp)return su;Rp=1;var e=Nf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return su=t,su}var lO=Mb();const Ze=ce(lO);var cu,qp;function fO(){if(qp)return cu;qp=1;function e(t){return t==null}return cu=e,cu}var hO=fO();const Q=ce(hO);var lu,Lp;function pO(){if(Lp)return lu;Lp=1;var e=Et(),t=Fe(),r=Mt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return lu=i,lu}var dO=pO();const ur=ce(dO);var vO=$f();const X=ce(vO);var yO=Ft();const en=ce(yO);var fu={exports:{}},ne={};/**
2
2
  * @license React
3
3
  * react-is.production.min.js
4
4
  *
@@ -0,0 +1 @@
1
+ import{a as te,r as a,n as ie,d as N,p,j as e,F as ae,q as j,S as R,P as le,l as ne,L as re}from"./index-D-kuW17t.js";import{S as ce,a as oe}from"./severity-ZaGgvxL_.js";const E=50;function ge(){const[t,h]=te(),[i,l]=a.useState(null),[c,M]=a.useState({total:0,findings:[]}),[S,F]=a.useState([]),[H,V]=a.useState([]),[G,Q]=a.useState([]),[K,U]=a.useState(!0),[D,_]=a.useState(null),[f,I]=a.useState(!1),[w,q]=a.useState(1),[u,C]=a.useState(new Set),[T,J]=a.useState(0),{sort:r,toggle:P}=ie("severity","desc"),x=t.get("severity")??"",y=t.get("category")??"",b=t.get("rule")??"",L=t.get("session")??"",$=t.get("source")??"",A=t.get("project")??"",O=t.get("from")??"",W=t.get("to")??"",m=t.get("status")??"open",v=a.useMemo(()=>{const s=new URLSearchParams;for(const[n,d]of Object.entries({severity:x,category:y,rule:b,session:L,source:$,project:A,from:O,to:W,status:m}))d&&s.set(n,d);return s},[x,y,b,L,$,A,O,W,m]);a.useEffect(()=>{N("/sources").then(V).catch(()=>{}),N("/projects").then(Q).catch(()=>{})},[]),a.useEffect(()=>{N("/security/summary").then(l).catch(()=>{}),p||N("/security/mutes").then(F).catch(()=>{})},[T]),a.useEffect(()=>q(1),[v.toString(),r.key,r.dir]),a.useEffect(()=>C(new Set),[v.toString(),r.key,r.dir,w,T]),a.useEffect(()=>{U(!0),_(null);const s=new URLSearchParams(v);s.set("sort",r.key),s.set("dir",r.dir),s.set("limit",String(E)),s.set("offset",String((w-1)*E)),N("/security/findings?"+s.toString()).then(M).catch(n=>_(String(n))).finally(()=>U(!1))},[v,r.key,r.dir,w,T]);const o=a.useCallback(s=>{const n=new URLSearchParams(t);for(const[d,k]of Object.entries(s))k?n.set(d,k):n.delete(d);h(n)},[t,h]),g=a.useCallback(async s=>{I(!0),_(null);try{await s(),J(n=>n+1)}catch(n){_(String(n))}finally{I(!1)}},[]),X=a.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),B=a.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!y||s.category===y),[i,y]),Y=Math.max(1,Math.ceil(c.total/E)),Z=[...v.keys()].some(s=>s!=="status")||m!=="open",z=c.findings.map(s=>s.id),ee=z.length>0&&z.every(s=>u.has(s)),se=s=>C(n=>{const d=new Set(n);return d.has(s)?d.delete(s):d.add(s),d});return e.jsxs("div",{children:[e.jsxs("div",{className:"detail-head",children:[e.jsx("h1",{children:"Security findings"}),e.jsxs("p",{className:"muted",style:{margin:"4px 0 0",maxWidth:760},children:["Risky operations the agent performed, flagged after the fact by deterministic rules over each tool call. Counts show ",e.jsx("strong",{children:"open"})," findings — mark benign ones safe or mute a noisy rule so a real one stands out. agent-lens is retrospective; it surfaces what ",e.jsx("em",{children:"happened"}),", it doesn't block."]})]}),p&&e.jsxs("div",{className:"demo-note",role:"note",children:["📦 This is a static demo over synthetic sessions. Browse the findings and reference below —"," ",e.jsx("strong",{children:"triage"})," (mark safe, mute rules) and live filtering run in the local app on your own data."]}),e.jsxs("div",{className:"kpi-row sev-kpis",role:"group","aria-label":"Open findings by severity",children:[e.jsxs("button",{type:"button",className:"kpi kpi-btn"+(x?"":" is-active"),onClick:()=>o({severity:""}),children:[e.jsx("div",{className:"kpi-label",children:"Open findings"}),e.jsx("div",{className:"kpi-value",children:(i==null?void 0:i.total)??"—"}),e.jsxs("div",{className:"kpi-sub",children:[(i==null?void 0:i.sessions_flagged)??0," sessions flagged"]})]}),ce.map(s=>e.jsxs("button",{type:"button",className:"kpi kpi-btn sev-kpi sev-"+s+(x===s?" is-active":""),onClick:()=>o({severity:x===s?"":s}),"aria-pressed":x===s,children:[e.jsx("div",{className:"kpi-label",children:s}),e.jsx("div",{className:"kpi-value",children:X.get(s)??0})]},s))]}),i&&(i.dismissed>0||i.muted>0)&&e.jsxs("div",{className:"triage-counts muted small",children:[e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:m,onChange:s=>o({status:s.target.value}),children:[e.jsx("option",{value:"open",children:"open"}),e.jsx("option",{value:"dismissed",children:"dismissed"}),e.jsx("option",{value:"muted",children:"muted"}),e.jsx("option",{value:"all",children:"all"})]}),e.jsxs("select",{"aria-label":"Filter by category",value:y,onChange:s=>{const n=s.target.value,d=!b||B.some(k=>k.rule_id===b&&(!n||k.category===n));o({category:n,rule:d?b:""})},children:[e.jsx("option",{value:"",children:"all categories"}),((i==null?void 0:i.categories)??[]).map(s=>e.jsx("option",{value:s.key,children:s.title},s.key))]}),e.jsxs("select",{"aria-label":"Filter by rule",value:b,onChange:s=>o({rule:s.target.value}),children:[e.jsx("option",{value:"",children:"all rules"}),B.map(s=>e.jsxs("option",{value:s.rule_id,children:[s.rule_id," (",s.n,")"]},s.rule_id))]}),e.jsxs("select",{"aria-label":"Filter by source",value:$,onChange:s=>o({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),H.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(ae,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:A,onChange:s=>o({project:s}),options:[{value:"",label:"all projects"},...G.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]}),e.jsxs("label",{className:"ctl",children:["from ",e.jsx("input",{type:"date",value:O,onChange:s=>o({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:W,onChange:s=>o({to:s.target.value})})]}),L&&e.jsxs("span",{className:"tag",style:{alignSelf:"center"},children:["session ",L.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>o({session:""}),children:"✕"})]}),Z&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>h(new URLSearchParams),children:"clear filters"})]}),!p&&(u.size>0||m==="open"&&c.total>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[u.size>0&&m!=="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/dismiss",{ids:[...u]})),children:["✓ Mark ",u.size," safe"]}),u.size>0&&m==="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/reopen",{ids:[...u]})),children:["↩ Reopen ",u.size]}),u.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>C(new Set),children:"clear selection"}),m==="open"&&c.total>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:f,onClick:()=>{confirm(`Dismiss all ${c.total} open findings matching the current filter as safe?`)&&g(()=>j("/security/dismiss-matching",{filter:Object.fromEntries(v)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",c.total," matching"]})]}),D&&e.jsx("div",{className:"error",role:"alert",children:D}),K?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):c.findings.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&m==="open"?"No open security findings — nothing risky is awaiting review.":"No findings match these filters."}):e.jsxs("table",{className:"sessions findings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[!p&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:ee,onChange:s=>C(s.target.checked?new Set(z):new Set)})}),e.jsx(R,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Finding"}),e.jsx(R,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Evidence"}),e.jsx(R,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:P}),e.jsx(R,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:P}),!p&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:c.findings.map(s=>e.jsx(de,{f:s,selected:u.has(s.id),onToggle:()=>se(s.id),busy:f,onDismiss:()=>g(()=>j("/security/dismiss",{ids:[s.id]})),onReopen:()=>g(()=>j("/security/reopen",{ids:[s.id]})),onMute:()=>g(()=>j("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!K&&c.total>E&&e.jsx(le,{page:w,pages:Y,total:c.total,unit:"findings",onPage:q}),!p&&S.length>0&&e.jsx(ue,{mutes:S,busy:f,onUnmute:s=>g(()=>j("/security/unmute",{rule_id:s.rule_id,scope:s.scope,scope_id:s.scope_id}))}),i&&i.categories.length>0&&e.jsx(he,{summary:i})]})}function de({f:t,selected:h,onToggle:i,busy:l,onDismiss:c,onReopen:M,onMute:S}){const F=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!p&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:h,onChange:i})}),e.jsxs("td",{children:[e.jsx(oe,{severity:t.severity}),t.dismissed?e.jsx("span",{className:"tag",style:{marginLeft:4},title:t.dismiss_note??"",children:"safe"}):null]}),e.jsxs("td",{children:[e.jsx("div",{className:"finding-title",children:t.title??t.rule_id}),e.jsxs("div",{className:"muted small",children:[e.jsx("code",{children:t.rule_id}),t.framework_ref&&e.jsx("span",{className:"tag framework",style:{marginLeft:6},children:t.framework_ref})]})]}),e.jsx("td",{className:"small",children:t.category}),e.jsxs("td",{className:"finding-evidence-cell",children:[t.tool_name&&e.jsx("span",{className:"tag tool-tag",title:"Tool the finding fired on",children:t.tool_name}),e.jsx("code",{title:t.evidence??"",children:t.evidence})]}),e.jsx("td",{className:"small muted",title:t.started_at??"",children:ne(t.started_at??null)}),e.jsxs("td",{className:"small",children:[e.jsx(re,{to:F,className:"title",children:t.session_title||t.session_id.slice(0,12)}),t.is_sidechain?e.jsx("span",{className:"tag subagent",style:{marginLeft:6},children:"subagent"}):null,t.project_path&&e.jsx("div",{className:"muted path",children:t.project_path.replace(/^.*\//,"")})]}),!p&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:M,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:c,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:S,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function ue({mutes:t,busy:h,onUnmute:i}){return e.jsxs("details",{className:"card muted-rules",children:[e.jsx("summary",{children:e.jsxs("span",{className:"sec-ref-title",children:["Muted rules (",t.length,")"]})}),e.jsx("ul",{className:"muted-rules-list",children:t.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.rule_id}),e.jsxs("span",{className:"tag",style:{marginLeft:6},children:[l.scope,l.scope_id?`: ${l.scope_id}`:""]}),l.note&&e.jsx("span",{className:"muted small",style:{marginLeft:6},children:l.note}),e.jsx("button",{type:"button",className:"linkish",style:{marginLeft:8},disabled:h,onClick:()=>i(l),children:"unmute"})]},`${l.rule_id}:${l.scope}:${l.scope_id}`))})]})}function he({summary:t}){const h=new Map(t.by_category.map(i=>[i.category,i.n]));return e.jsxs("section",{className:"sec-reference",children:[e.jsx("h2",{children:"Risk categories"}),e.jsx("p",{className:"muted small",style:{marginTop:0},children:"What each category means and why it matters, anchored to OWASP Top 10 for Agentic Apps and MITRE ATLAS."}),e.jsx("div",{className:"sec-ref-grid",children:t.categories.map(i=>e.jsxs("details",{className:"card sec-ref",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"sec-ref-title",children:i.title}),e.jsxs("a",{className:"tag framework",href:i.framework_url,target:"_blank",rel:"noreferrer",onClick:l=>l.stopPropagation(),children:[i.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[h.get(i.key)??0," open"]})]}),e.jsxs("dl",{className:"sec-ref-body",children:[e.jsx("dt",{children:"What"}),e.jsx("dd",{children:i.what}),e.jsx("dt",{children:"Why it matters"}),e.jsx("dd",{children:i.why}),e.jsx("dt",{children:"What to do"}),e.jsx("dd",{children:i.remediation})]})]},i.key))})]})}export{ge as default};
@@ -0,0 +1,12 @@
1
+ import{i as cs,k as ds,r as m,d as us,j as s,L as y,h as H,t as ms,f as W,e as C,l as D,m as hs,s as Q}from"./index-D-kuW17t.js";import{C as b,p as v}from"./CopyButton-hsiW2B6o.js";import{S as O,a as V}from"./severity-ZaGgvxL_.js";import{M as ps,r as xs}from"./index-BXp9oWUn.js";const K=m.createContext("markdown"),Y=m.createContext(new Map),z=m.createContext(!1),G=m.createContext(null),X="agentlens.msgFormat";function fs(){try{return localStorage.getItem(X)==="raw"?"raw":"markdown"}catch{return"markdown"}}const Z="agentlens.hideTools";function js(){try{return localStorage.getItem(Z)==="1"}catch{return!1}}function gs({c:e}){var o;const[n,t]=m.useState(!1),l=m.useId(),a=(o=e.signals)==null?void 0:o.loc;return s.jsxs("div",{className:"classification",children:[s.jsx("span",{className:"tag cat cat-"+(e.category??"none"),children:e.category??"unclassified"}),e.complexity_band&&s.jsxs("span",{className:"tag complexity",children:[e.complexity_band," · ",e.complexity_score]}),a&&s.jsxs("span",{className:"muted small",children:["+",a.added,"/−",a.removed," LoC · ",a.files," files"]}),s.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(r=>!r),children:["why ",n?"▾":"▸"]}),n&&(e.signals?s.jsx(ws,{id:l,s:e.signals,category:e.category}):s.jsx("div",{id:l,className:"muted small pad",children:"No signals recorded for this session."}))]})}const Ns={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},L=e=>`${Math.max(0,Math.min(1,e))*100}%`;function R({counts:e}){const n=Object.entries(e).sort((t,l)=>l[1]-t[1]);return n.length===0?s.jsx("span",{className:"muted",children:"—"}):s.jsx("span",{className:"sig-chips",children:n.map(([t,l])=>s.jsxs("span",{className:"sig-chip",children:[t," ",s.jsxs("span",{className:"muted",children:["×",l]})]},t))})}function ws({id:e,s:n,category:t}){const[l,a]=m.useState(!1),o=m.useId(),r=n.complexity_weights??{},i=n.complexity_subscores??{},c=Object.keys(r).map(d=>({key:d,weight:r[d],subscore:i[d]??0,pts:r[d]*(i[d]??0)*100})).sort((d,_)=>_.pts-d.pts),u=Math.max(...c.map(d=>d.pts),1e-4),p=Object.entries(n.category_scores??{}).map(([d,_])=>({k:d,v:_})).sort((d,_)=>_.v-d.v),f=Math.max(...p.map(d=>d.v),1e-4),x=p.filter(d=>d.v>.02||d.k===t),g=n.skills&&Object.keys(n.skills).length>0;return s.jsxs("div",{id:e,className:"signals-panel",children:[c.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Complexity breakdown ",s.jsx("span",{className:"muted",children:"— what built the score"})]}),s.jsx("ul",{className:"sig-bars",children:c.map(d=>s.jsxs("li",{className:"sig-bar-row",children:[s.jsx("span",{className:"sig-bar-label",children:Ns[d.key]??d.key}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.pts/u)}})}),s.jsxs("span",{className:"sig-bar-val",children:[d.pts.toFixed(1)," pts"]}),s.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(d.subscore*100),"% intensity · weight ",Math.round(d.weight*100),"%"]})]},d.key))})]}),x.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Category scores ",s.jsxs("span",{className:"muted",children:["— why “",t,"” won"]})]}),s.jsx("ul",{className:"sig-bars",children:x.map(d=>s.jsxs("li",{className:"sig-bar-row"+(d.k===t?" is-win":""),children:[s.jsx("span",{className:"sig-bar-label",children:d.k}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.v/f)}})}),s.jsx("span",{className:"sig-bar-val",children:d.v.toFixed(2)})]},d.k))})]}),s.jsxs("section",{className:"sig-section",children:[s.jsx("h4",{className:"sig-h",children:"Evidence"}),s.jsxs("dl",{className:"sig-grid",children:[n.tool_counts&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Tools"}),s.jsx("dd",{children:s.jsx(R,{counts:n.tool_counts})})]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Skills"}),s.jsx("dd",{children:s.jsx(R,{counts:n.skills})})]}),n.subagent_role&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Subagent role"}),s.jsx("dd",{children:n.subagent_role})]}),n.files&&n.files.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("dt",{children:["Files (",n.files.length,")"]}),s.jsx("dd",{className:"sig-files",children:n.files.join(", ")})]})]})]}),s.jsx("button",{className:"ghost small","aria-expanded":l,"aria-controls":o,onClick:()=>a(d=>!d),children:l?"Hide raw JSON ▴":"View raw JSON ▾"}),l&&s.jsx("pre",{id:o,className:"code signals",children:JSON.stringify(n,null,2)})]})}function _s({f:e}){var r;const[n,t]=m.useState(!1),l=m.useId(),a=((r=e.signals)==null?void 0:r.modifiers)??{},o=Object.keys(a).filter(i=>a[i]!==!1&&a[i]!=null&&a[i]!=="");return s.jsxs("div",{className:"finding sev-border-"+e.severity,children:[s.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":l,onClick:()=>t(i=>!i),children:[s.jsx(V,{severity:e.severity}),s.jsx("span",{className:"finding-title",children:e.title??e.rule_id}),e.framework_ref&&s.jsx("span",{className:"tag framework",children:e.framework_ref}),s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&s.jsxs("div",{className:"finding-body",id:l,children:[e.evidence&&s.jsx("div",{className:"code-block",children:s.jsx("pre",{className:"code finding-evidence",children:e.evidence})}),s.jsxs("dl",{className:"sig-grid",children:[s.jsx("dt",{children:"Rule"}),s.jsx("dd",{children:s.jsx("code",{children:e.rule_id})}),s.jsx("dt",{children:"Category"}),s.jsx("dd",{children:e.category}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Context"}),s.jsx("dd",{children:o.map(i=>s.jsxs("span",{className:"sig-chip",children:[i,a[i]!==!0?s.jsxs("span",{className:"muted",children:[" ",String(a[i])]}):null]},i))})]})]}),s.jsxs(y,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(e.rule_id)}`,children:["see all “",e.rule_id,"” findings →"]})]})]})}function ks({findings:e}){if(!e.length)return null;const n=[...e].sort((t,l)=>O.indexOf(t.severity)-O.indexOf(l.severity));return s.jsx("div",{className:"tool-findings",children:n.map(t=>s.jsx(_s,{f:t},t.id))})}function ys({findings:e,sessionId:n}){const t=new Map;for(const a of e)t.set(a.severity,(t.get(a.severity)??0)+1);const l=O.find(a=>t.has(a))??"info";return s.jsxs("div",{className:"security-banner sev-border-"+l,role:"status",children:[s.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),s.jsxs("span",{className:"security-banner-text",children:[e.length," security ",e.length===1?"finding":"findings"," in this session"]}),s.jsx("span",{className:"security-banner-sevs",children:O.filter(a=>t.has(a)).map(a=>s.jsx(V,{severity:a,count:t.get(a)},a))}),s.jsx(y,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function ss({t:e}){const[n,t]=m.useState(!1),[l,a]=m.useState(!1),o=m.useId(),r=e.skill_name?`Skill · ${e.skill_name}`:e.tool_name==="Workflow"&&e.workflow_name?`Workflow · ${e.workflow_name}`:e.agent_type?`${e.tool_name} → ${e.agent_type}`:e.tool_name;return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":n,"aria-controls":o,onClick:()=>t(i=>!i),children:[s.jsxs("span",{className:"tool-name",children:["🔧 ",r]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),e.spawned_session_id&&s.jsx(y,{className:"subagent-link small",to:`/session/${e.spawned_session_id}`,children:"view subagent transcript →"}),e.workflow_run_id&&s.jsxs(y,{className:"subagent-link small",to:`/workflow/${e.workflow_run_id}`,children:["🔀 launched ",e.workflow_agent_count??0," agent",e.workflow_agent_count===1?"":"s"," · ",s.jsx("code",{children:e.workflow_run_id})," →"]}),e.skill_name&&s.jsxs(y,{className:"subagent-link small",to:`/skill/${encodeURIComponent(e.skill_name)}${e.skill_id?`?v=${e.skill_id}`:""}`,children:["📖 view skill",e.skill_id?" version":""," →"]}),n&&s.jsxs("div",{className:"tool-body",id:o,children:[e.input_json&&e.input_json!=="{}"&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:v(e.input_json),className:"copy-corner",title:"Copy tool input JSON"}),s.jsx("pre",{className:"code",children:v(e.input_json)})]}),e.result_summary&&s.jsx("div",{className:"result",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":l,onClick:()=>a(i=>!i),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]})]})]})}function es(e){if(!e)return null;try{const n=JSON.parse(e).plan;return typeof n=="string"&&n.trim()?n:null}catch{return null}}function vs({plan:e}){return s.jsxs("div",{className:"plan-card",children:[s.jsx("div",{className:"plan-card-head",children:"📋 Approved plan"}),s.jsx(as,{text:e})]})}function bs(e){if(!e)return[];try{const n=JSON.parse(e).questions;return Array.isArray(n)?n:[]}catch{return[]}}function Ss(e){if(!e)return{answers:{},annotations:{}};try{const n=JSON.parse(e);if(n&&typeof n=="object"&&n.answers)return{answers:n.answers,annotations:n.annotations??{}}}catch{}return{answers:{},annotations:{}}}function Cs({t:e}){const[n,t]=m.useState(!1),l=m.useId(),a=bs(e.input_json),{answers:o,annotations:r}=Ss(e.result_summary);return a.length===0?s.jsx(ss,{t:e}):s.jsxs("div",{className:"qa-card",children:[s.jsxs("div",{className:"qa-card-head",children:["🙋 Question",a.length===1?"":"s"," for the user"]}),a.map((i,c)=>{var _;const u=o[i.question],p=Array.isArray(u)?u:u!=null?[u]:[],f=new Set(p),x=new Set(i.options.map(w=>w.label)),g=p.filter(w=>!x.has(w)),d=(_=r[i.question])==null?void 0:_.notes;return s.jsxs("div",{className:"qa-q",children:[s.jsxs("div",{className:"qa-q-head",children:[i.header&&s.jsx("span",{className:"tag",children:i.header}),i.multiSelect&&s.jsx("span",{className:"muted small",children:"multi-select"})]}),s.jsx("div",{className:"qa-question",children:i.question}),s.jsxs("ul",{className:"qa-options",children:[i.options.map((w,S)=>{const N=f.has(w.label);return s.jsxs("li",{className:"qa-opt"+(N?" is-selected":""),children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:N?"☑":"☐"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w.label}),w.description&&s.jsx("span",{className:"qa-opt-desc muted",children:w.description})]})]},S)}),g.map((w,S)=>s.jsxs("li",{className:"qa-opt is-selected",children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:"☑"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w}),s.jsx("span",{className:"qa-opt-desc muted",children:"custom answer"})]})]},"c"+S))]}),d&&s.jsxs("div",{className:"qa-note",children:["📝 ",d]})]},c)}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(i=>!i),children:n?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(b,{text:v(e.input_json??"{}")+(e.result_summary?`
2
+
3
+ `+v(e.result_summary):""),label:"JSON",title:"Copy raw question JSON"})]}),n&&s.jsxs("pre",{id:l,className:"code",children:[v(e.input_json??"{}"),e.result_summary?`
4
+
5
+ `+v(e.result_summary):""]})]})}function Is({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 Os(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 J(e,n,t){let l=n+2,a=!1;for(e[l]==="-"&&(a=!0,l++);e[l]===" "||e[l]===" ";)l++;let o="";(e[l]==="'"||e[l]==='"')&&(o=e[l],l++);let r="";if(o){for(;l<e.length&&e[l]!==o;)r+=e[l++];e[l]===o&&l++}else for(;l<e.length&&/[A-Za-z0-9_]/.test(e[l]);)r+=e[l++];return r&&t.push({delim:r,strip:a}),l-1}function Ts(e){const n=e.split(`
6
+ `),t=[];let l="NORMAL",a=0;const o=[];let r=!1;for(const i of n){if(o.length>0){t.push({text:i,cont:!0});const c=o[0];(c.strip?i.replace(/^\t+/,""):i).trimEnd()===c.delim&&o.shift();continue}t.push({text:i,cont:l!=="NORMAL"||a>0||r}),r=!1;for(let c=0;c<i.length;c++){const u=i[c];if(l==="SQUOTE"){u==="'"&&(l="NORMAL");continue}if(l==="DQUOTE"){u==="\\"?c++:u==='"'?l="NORMAL":u==="$"&&i[c+1]==="("?(a++,c++):u===")"?a>0&&a--:u==="<"&&i[c+1]==="<"&&i[c+2]!=="<"&&(c=J(i,c,o));continue}if(u==="\\")c++;else if(u==="'")l="SQUOTE";else if(u==='"')l="DQUOTE";else{if(u==="#"&&(c===0||/\s/.test(i[c-1])))break;u==="$"&&i[c+1]==="("?(a++,c++):u==="("?a++:u===")"?a>0&&a--:u==="<"&&i[c+1]==="<"&&i[c+2]!=="<"&&(c=J(i,c,o))}}if(l==="NORMAL"&&a===0&&o.length===0){const c=i.replace(/\s+$/,""),u=c.match(/\\+$/);(u&&u[0].length%2===1||/(&&|\|\||\|)$/.test(c))&&(r=!0)}}return t}function Es({t:e,bash:n}){const[t,l]=m.useState(!1),[a,o]=m.useState(!1),[r,i]=m.useState(!1),c=m.useId(),u=m.useId(),p=n.command.split(`
7
+ `)[0],f=Ts(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:()=>l(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(b,{text:n.command,className:"copy-corner",title:"Copy command"}),s.jsx("pre",{className:"shell-cmd",children:f.map((x,g)=>s.jsxs("span",{children:[s.jsx("span",{className:"shell-gutter"+(x.cont?" cont":""),"aria-hidden":"true",children:x.cont?" ":"$ "}),x.text,g<f.length-1?`
8
+ `:""]},g))})]}),(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":a,onClick:()=>o(x=>!x),children:[a?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),a&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":r,"aria-controls":u,onClick:()=>i(x=>!x),children:r?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(b,{text:v(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),r&&s.jsx("pre",{id:u,className:"code",children:v(e.input_json??"{}")})]})]})}function P(e,n){const t=e===""?[]:e.split(`
9
+ `),l=n===""?[]:n.split(`
10
+ `),a=t.length,o=l.length;if(a*o>25e4)return[...t.map(p=>({type:"del",text:p})),...l.map(p=>({type:"add",text:p}))];const r=Array.from({length:a+1},()=>new Array(o+1).fill(0));for(let p=a-1;p>=0;p--)for(let f=o-1;f>=0;f--)r[p][f]=t[p]===l[f]?r[p+1][f+1]+1:Math.max(r[p+1][f],r[p][f+1]);const i=[];let c=0,u=0;for(;c<a&&u<o;)t[c]===l[u]?(i.push({type:"ctx",text:t[c]}),c++,u++):r[c+1][u]>=r[c][u+1]?(i.push({type:"del",text:t[c]}),c++):(i.push({type:"add",text:l[u]}),u++);for(;c<a;)i.push({type:"del",text:t[c++]});for(;u<o;)i.push({type:"add",text:l[u++]});return i}function Ms(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 l;if(e==="Write"){if(typeof t.content!="string")return null;l=[t.content===""?[]:t.content.split(`
11
+ `).map(r=>({type:"add",text:r}))]}else if(e==="MultiEdit"){if(!Array.isArray(t.edits)||(l=t.edits.filter(r=>{const i=r;return!!i&&typeof i.old_string=="string"&&typeof i.new_string=="string"}).map(r=>P(r.old_string,r.new_string)),l.length===0))return null}else{if(typeof t.old_string!="string"||typeof t.new_string!="string")return null;l=[P(t.old_string,t.new_string)]}let a=0,o=0;for(const r of l)for(const i of r)i.type==="add"?a++:i.type==="del"&&o++;return{file_path:t.file_path,kind:e,hunks:l,adds:a,dels:o}}catch{return null}}function $s(e){const n=e.lastIndexOf("/");return n>=0?{dir:e.slice(0,n+1),base:e.slice(n+1)}:{dir:"",base:e}}const Fs={Edit:"✏️",MultiEdit:"✏️",Write:"📄"},E=400;function qs({t:e,edit:n}){const[t,l]=m.useState(!1),[a,o]=m.useState(!1),[r,i]=m.useState(!1),c=m.useId(),u=m.useId(),{dir:p,base:f}=$s(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:()=>l(x=>!x),children:[s.jsxs("span",{className:"tool-name",children:[Fs[n.kind]??"✏️"," ",n.kind]}),s.jsxs("span",{className:"edit-path",children:[s.jsx("span",{className:"base",children:f}),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,g)=>s.jsxs("div",{className:"diff",children:[n.hunks.length>1&&s.jsxs("div",{className:"diff-hunk-sep",children:["edit ",g+1]}),x.slice(0,E).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>E&&s.jsxs("div",{className:"diff-more",children:["… ",x.length-E," more lines — View raw JSON for the rest"]})]},g)),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":a,onClick:()=>o(x=>!x),children:[a?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),a&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":r,"aria-controls":u,onClick:()=>i(x=>!x),children:r?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(b,{text:v(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),r&&s.jsx("pre",{id:u,className:"code",children:v(e.input_json??"{}")})]})]})}function Bs({t:e,hideTools:n}){const t=e.findings??[],l=n&&t.length===0,a=As(e,l);return t.length===0?a:s.jsxs(s.Fragment,{children:[a,s.jsx(ks,{findings:t})]})}function As(e,n){if(e.tool_name==="ExitPlanMode"){const t=es(e.input_json);if(t)return s.jsx(vs,{plan:t})}if(e.tool_name==="AskUserQuestion")return s.jsx(Cs,{t:e});if(e.tool_name==="Workflow")return s.jsx(Is,{t:e});if(e.tool_name==="Bash"){const t=Os(e.input_json);if(t)return n?null:s.jsx(Es,{t:e,bash:t})}if(e.tool_name==="Edit"||e.tool_name==="MultiEdit"||e.tool_name==="Write"){const t=Ms(e.tool_name,e.input_json);if(t)return n?null:s.jsx(qs,{t:e,edit:t})}return n?null:s.jsx(ss,{t:e})}function Ls(e,n){return e.findings&&e.findings.length||e.tool_name==="AskUserQuestion"||e.tool_name==="Workflow"||e.tool_name==="ExitPlanMode"&&es(e.input_json)?!0:!n}function ns(e){var l,a,o,r,i;const n=(a=(l=e.match(/<command-name>([^<]*)<\/command-name>/))==null?void 0:l[1])==null?void 0:a.trim();if(n){const c=((r=(o=e.match(/<command-args>([^<]*)<\/command-args>/))==null?void 0:o[1])==null?void 0:r.trim())??"";return{kind:"invocation",name:n.startsWith("/")?n:`/${n}`,args:c}}const t=(i=e.match(/<(?:local-command-stdout|command-output|local-command-stderr)>([\s\S]*?)<\/(?:local-command-stdout|command-output|local-command-stderr)>/))==null?void 0:i[1];return t!=null?{kind:"output",stdout:t.trim()}:/<local-command-caveat>/.test(e)?{kind:"caveat"}:null}function Rs({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 ts(e){if(!/<task-notification>/.test(e))return null;const n=t=>{var l,a;return((a=(l=e.match(new RegExp(`<${t}>([\\s\\S]*?)</${t}>`)))==null?void 0:l[1])==null?void 0:a.trim())??null};return{taskId:n("task-id"),toolUseId:n("tool-use-id"),status:n("status"),summary:n("summary")}}function Js({n:e}){const n=m.useContext(Y),t=e.toolUseId?n.get(e.toolUseId):void 0,l=(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-"+l,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 U({text:e,id:n}){return m.useContext(K)==="raw"?s.jsx("div",{className:"text",id:n,children:e}):s.jsx("div",{className:"text md",id:n,children:s.jsx(ps,{remarkPlugins:[xs],components:Ps,children:e})})}const Ps={a:({node:e,...n})=>s.jsx("a",{...n,target:"_blank",rel:"noopener noreferrer"})};function as({text:e}){const n=e.length>1400||e.split(`
12
+ `).length>18,[t,l]=m.useState(!1),a=m.useId();return n?s.jsxs("div",{className:"text-wrap"+(t?"":" is-clamped"),children:[s.jsx(U,{text:e,id:a}),s.jsx("button",{className:"ghost small show-more","aria-expanded":t,"aria-controls":a,onClick:()=>l(o=>!o),children:t?"Show less ▴":"Show more ▾"})]}):s.jsx(U,{text:e})}function Us(e,n){const t=new Map(n.map(a=>[a.id,a])),l=[];for(const a of e){const o=a.turn_id??null,r=l[l.length-1];r&&r.turnId===o?r.events.push(a):l.push({turnId:o,turn:o?t.get(o)??null:null,events:[a]})}return l}function Hs(e){const n=ns(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=ts(e);return t?`🔔 task ${t.status??"notification"}`:e}function Ws({turn:e,events:n,open:t,onToggle:l}){const a=m.useId();return s.jsxs("section",{className:"turn"+(t?" is-open":""),children:[s.jsxs("button",{className:"turn-head","aria-expanded":t,"aria-controls":a,onClick:l,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:Hs(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:a,className:"turn-body",role:"region","aria-label":`turn ${e.seq+1} messages`,children:t&&n.map(o=>s.jsx(ls,{e:o},o.uuid))})]})}function ls({e}){const[n,t]=m.useState(!1),l=m.useId(),a=m.useContext(z),o=m.useContext(G),r=e.role||e.type,i=r==="user"?"👤":r==="assistant"?"🤖":"⚙️",c=e.toolCalls.filter(g=>Ls(g,a));if(!(e.text||e.thinking||c.length))return null;const p=e.text?ns(e.text):null,f=e.text&&!p?ts(e.text):null,x=e.text||e.thinking||"";return s.jsxs("div",{id:"ev-"+e.uuid,className:"event ev-"+r+(o===e.uuid?" ev-flagged":""),children:[s.jsxs("div",{className:"ev-meta",children:[s.jsxs("span",{className:"ev-who",children:[i," ",r]}),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:D(e.timestamp)}),x&&s.jsx(b,{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":l,onClick:()=>t(g=>!g),children:["🧠 thinking ",n?"▾":"▸"]}),n&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.thinking,className:"copy-corner",title:"Copy thinking"}),s.jsx("pre",{id:l,className:"thinking-body",children:e.thinking})]})]}),e.text&&(p?s.jsx(Rs,{cmd:p}):f?s.jsx(Js,{n:f}):s.jsx(as,{text:e.text})),c.map((g,d)=>s.jsx(Bs,{t:g,hideTools:a},d))]})}function M({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 · ",W(e.cost)]})]})}function Ds({d:e}){const n=e.workflow_runs??[],t=e.children.filter(a=>!a.workflow_run_id),l=n.length>0;return s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Spawned subagents (",e.children.length,")"]}),n.map(a=>{const o=e.children.filter(r=>r.workflow_run_id===a.run_id);return s.jsxs("details",{className:"wf-run",children:[s.jsxs("summary",{children:[s.jsxs(y,{className:"wf-run-name",to:`/workflow/${a.run_id}`,onClick:r=>r.stopPropagation(),children:["🔀 ",a.name||"workflow"," →"]}),a.status&&s.jsx("span",{className:"tag task-status task-status-"+a.status.toLowerCase(),children:a.status}),s.jsxs("span",{className:"muted small",children:[o.length," agent",o.length===1?"":"s",a.turn_seq!=null?` · turn ${a.turn_seq+1}`:""," · ",s.jsx("code",{children:a.run_id})]})]}),s.jsx("ul",{children:o.map(r=>s.jsx(M,{c:r},r.id))})]},a.run_id)}),t.length>0&&(l?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(a=>s.jsx(M,{c:a},a.id))})]}):s.jsx("ul",{children:t.map(a=>s.jsx(M,{c:a},a.id))}))]})}function zs(){const{id:e}=cs(),{hash:n}=ds(),[t,l]=m.useState(null),[a,o]=m.useState(null),[r,i]=m.useState(new Set),[c,u]=m.useState(fs),[p,f]=m.useState(js),x=h=>{u(h);try{localStorage.setItem(X,h)}catch{}},g=()=>f(h=>{const k=!h;try{localStorage.setItem(Z,k?"1":"0")}catch{}return k});m.useEffect(()=>{l(null),o(null),i(new Set),us("/sessions/"+e).then(l).catch(h=>o(String(h)))},[e]);const[d,_]=m.useState(null),w=m.useRef(null);m.useEffect(()=>{if(!t)return;const h=/^#ev-(.+)$/.exec(n);if(!h){w.current=null;return}if(w.current===n)return;const k=h[1],j=t.events.find(T=>T.uuid===k);if(j!=null&&j.turn_id&&r.has(j.turn_id)){const T=j.turn_id;i(os=>{const A=new Set(os);return A.delete(T),A});return}const B=document.getElementById("ev-"+k);if(!B)return;w.current=n,B.scrollIntoView({block:"center",behavior:"smooth"}),_(k);const rs=window.setTimeout(()=>_(null),3e3);return()=>window.clearTimeout(rs)},[t,n,r]);const S=m.useMemo(()=>{const h=new Map;for(const k of(t==null?void 0:t.events)??[])for(const j of k.toolCalls)j.tool_name==="Workflow"&&j.id&&j.workflow_run_id&&h.set(j.id,j.workflow_run_id);return h},[t]);if(a)return s.jsx("div",{className:"error",role:"alert",children:a});if(!t)return s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"});const N=t.session,$=t.events.filter(h=>h.text||h.thinking||h.toolCalls.length),F=Us($,t.turns),I=F.filter(h=>h.turn).map(h=>h.turnId),q=I.some(h=>!r.has(h)),is=h=>i(k=>{const j=new Set(k);return j.has(h)?j.delete(h):j.add(h),j});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:N.title||N.id.slice(0,12)}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("span",{children:s.jsx("b",{children:N.source_id})}),s.jsx("span",{className:"path",children:N.project_path}),N.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:[N.event_count," events"]}),s.jsxs("span",{title:ms(N.token_split),children:[H(N.tokens)," tok"]}),s.jsx("span",{title:"Estimated at API list prices (cache-aware)",children:W(N.cost)}),s.jsx("span",{children:C(N.duration_ms)}),s.jsx("span",{className:"muted",children:D(N.started_at)}),s.jsx("a",{className:"export",href:hs(N.id),children:"⬇ Export Markdown"})]}),t.classification&&s.jsx(gs,{c:t.classification}),t.findings&&t.findings.length>0&&s.jsx(ys,{findings:t.findings,sessionId:N.id})]}),t.children&&t.children.length>0&&s.jsx(Ds,{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:()=>i(q?new Set(I):new Set),children:q?"Collapse all":"Expand all"})]}),s.jsxs("button",{className:"ghost small"+(p?" is-active":""),"aria-pressed":p,onClick:g,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(K.Provider,{value:c,children:s.jsx(z.Provider,{value:p,children:s.jsx(G.Provider,{value:d,children:s.jsxs("div",{className:"transcript",children:[$.length===0&&s.jsx("div",{className:"muted pad",role:"status",children:"This session has no rendered messages."}),F.map((h,k)=>h.turn?s.jsx(Ws,{turn:h.turn,events:h.events,open:!r.has(h.turnId),onToggle:()=>is(h.turnId)},h.turnId):s.jsx("div",{className:"unturned",children:h.events.map(j=>s.jsx(ls,{e:j},j.uuid))},"unturned-"+k))]})})})})})]})}export{zs as default};
@@ -1 +1 @@
1
- import{i as N,a as k,r as a,d as g,j as s,L as j,k as c}from"./index-DTfBIYUK.js";import{M as b,r as y}from"./index-CnYz-f0y.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]=k(),[i,o]=a.useState(null),[f,h]=a.useState(!0),[m,u]=a.useState(null);a.useEffect(()=>{h(!0),u(null),o(null),g("/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
+ import{i as N,a as g,r as a,d as k,j as s,L as j,l as c}from"./index-D-kuW17t.js";import{M as b,r as y}from"./index-BXp9oWUn.js";function S(l){return!l||l<0?"—":l>=1024?(l/1024).toFixed(1)+" KB":l+" B"}function _(l,t){return`${l.slice(0,8)} · ${c(t)}`}function F(){const{name:l=""}=N(),[t,v]=g(),[i,o]=a.useState(null),[f,h]=a.useState(!0),[m,u]=a.useState(null);a.useEffect(()=>{h(!0),u(null),o(null),k("/skills/"+encodeURIComponent(l)).then(o).catch(e=>u(String(e))).finally(()=>h(!1))},[l]);const r=a.useMemo(()=>{if(!(i!=null&&i.versions.length))return null;const e=t.get("v");return i.versions.find(n=>n.id===e)??i.versions[0]},[i,t]),d=a.useMemo(()=>i&&r?i.sessions.filter(e=>e.version_id===r.id):[],[i,r]),x=a.useMemo(()=>i?i.sessions.filter(e=>!e.version_id).length:0,[i]);function p(e){const n=new URLSearchParams(t);n.set("v",e),v(n)}return f?s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):m?s.jsx("div",{className:"error",role:"alert",children:m}):i?s.jsxs("div",{className:"skill-view",children:[s.jsx(j,{to:"/skills",className:"back",children:"← all skills"}),s.jsxs("header",{className:"skill-head",children:[s.jsxs("h1",{children:["📖 ",i.name]}),s.jsxs("div",{className:"skill-head-meta muted",children:[i.call_count.toLocaleString()," firing",i.call_count===1?"":"s"," ·"," ",i.versions.length," version",i.versions.length===1?"":"s",r!=null&&r.summary?s.jsxs(s.Fragment,{children:[" · ",r.summary]}):null]})]}),i.versions.length===0?s.jsxs("div",{className:"empty",children:["This skill fired ",i.call_count.toLocaleString()," time(s) but no SKILL.md body was captured in the transcripts, so there is no version content to show."]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"skill-version-bar",children:[s.jsxs("label",{className:"ctl",children:["version"," ",s.jsx("select",{"aria-label":"Skill version",value:(r==null?void 0:r.id)??"",onChange:e=>p(e.target.value),children:i.versions.map((e,n)=>s.jsxs("option",{value:e.id,children:[_(e.id,e.last_seen)," · ",e.call_count," fire",e.call_count===1?"":"s",n===0?" (latest)":""]},e.id))})]}),r&&s.jsxs("span",{className:"muted small",children:["first seen ",c(r.first_seen)," · last seen ",c(r.last_seen)," ·"," ",S(r.body_bytes)]})]}),r&&s.jsxs("div",{className:"cards skill-cards",children:[s.jsxs("div",{className:"card skill-body-card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Skill body"}),s.jsxs("span",{className:"card-hint",children:["version ",r.id.slice(0,8)]})]}),s.jsx("div",{className:"md skill-body",children:s.jsx(b,{remarkPlugins:[y],children:r.body})})]}),s.jsxs("div",{className:"card skill-sessions-card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Sessions that fired this version"}),s.jsx("span",{className:"card-hint",children:d.length})]}),d.length===0?s.jsx("div",{className:"empty",children:"No sessions fired this version."}):s.jsxs("table",{className:"sessions",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Session"}),s.jsx("th",{children:"Source"}),s.jsx("th",{children:"Project"}),s.jsx("th",{className:"num",children:"Fires"}),s.jsx("th",{children:"When"})]})}),s.jsx("tbody",{children:d.map(e=>{var n;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(j,{to:`/session/${e.id}`,className:"title",children:e.title||s.jsx("span",{className:"muted",children:e.id.slice(0,12)})})}),s.jsx("td",{children:e.source_id}),s.jsx("td",{className:"path",children:((n=e.project_path)==null?void 0:n.replace(/^.*\//,""))??"—"}),s.jsx("td",{className:"num",children:e.fire_count}),s.jsx("td",{children:c(e.fired_at)})]},e.id)})})]}),x>0&&s.jsxs("div",{className:"muted small pad",children:[x," firing(s) had no captured body and aren’t attributed to a version."]})]})]})]})]}):s.jsx("div",{className:"muted pad",children:"Not found."})}export{F as default};
@@ -1 +1 @@
1
- import{a as C,r,m as I,d as h,n as K,j as e,F as M,S as m,L as D,k as U,P as $}from"./index-DTfBIYUK.js";const j=50,V={name:t=>t.name,fired:t=>t.call_count,last_fired:t=>t.last_fired};function G(){const[t,N]=C(),[P,L]=r.useState([]),[_,q]=r.useState([]),[o,E]=r.useState([]),[p,x]=r.useState(!0),[S,g]=r.useState(null),[f,v]=r.useState(t.get("q")??""),{sort:a,toggle:d}=I("fired","desc"),[R,b]=r.useState(1);r.useEffect(()=>{h("/sources").then(L).catch(()=>{}),h("/projects").then(q).catch(()=>{})},[]),r.useEffect(()=>{x(!0),g(null);const s=new URLSearchParams;for(const l of["source","project","q"]){const y=t.get(l);y&&s.set(l,y)}const n=s.toString()?"?"+s.toString():"";h("/skills"+n).then(E).catch(l=>g(String(l))).finally(()=>x(!1))},[t]);function c(s,n){const l=new URLSearchParams(t);n?l.set(s,n):l.delete(s),N(l)}function F(s){s.preventDefault(),c("q",f.trim())}r.useEffect(()=>b(1),[t,a.key,a.dir]);const i=r.useMemo(()=>K(o,V[a.key],a.dir),[o,a.key,a.dir]),k=Math.max(1,Math.ceil(i.length/j)),u=Math.min(R,k),w=i.slice((u-1)*j,u*j);return e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:"Skills"}),e.jsxs("div",{className:"filters",children:[e.jsxs("form",{onSubmit:F,className:"search",role:"search",children:[e.jsx("input",{type:"search","aria-label":"Search skills by name and body",placeholder:"Search skill names & bodies…",value:f,onChange:s=>v(s.target.value)}),e.jsx("button",{type:"submit",children:"Search"}),t.get("q")&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>(v(""),c("q","")),children:"clear"})]}),e.jsxs("select",{"aria-label":"Filter by source",value:t.get("source")??"",onChange:s=>c("source",s.target.value),children:[e.jsx("option",{value:"",children:"all sources"}),P.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(M,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:t.get("project")??"",onChange:s=>c("project",s),options:[{value:"",label:"all projects"},..._.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]})]}),S&&e.jsx("div",{className:"error",role:"alert",children:S}),p?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):o.length===0?e.jsx("div",{className:"muted pad",role:"status",children:"No skills fired match."}):e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(m,{label:"Skill",sortKey:"name",active:a.key,dir:a.dir,onSort:d,defaultDir:"asc"}),e.jsx(m,{label:"Fired",sortKey:"fired",active:a.key,dir:a.dir,onSort:d,className:"num"}),e.jsx("th",{className:"num",children:"Versions"}),e.jsx("th",{children:"Sources"}),e.jsx(m,{label:"Last fired",sortKey:"last_fired",active:a.key,dir:a.dir,onSort:d})]})}),e.jsx("tbody",{children:w.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(D,{to:`/skill/${encodeURIComponent(s.name)}`,className:"title",children:s.name})}),e.jsx("td",{className:"num",children:s.call_count.toLocaleString()}),e.jsx("td",{className:"num",title:`${s.version_count} distinct captured ${s.version_count===1?"version":"versions"}`,children:s.version_count||e.jsx("span",{className:"muted",children:"—"})}),e.jsx("td",{children:e.jsx("span",{className:"sub",children:s.sources.map(n=>e.jsx("span",{className:"tag",children:n},n))})}),e.jsx("td",{children:U(s.last_fired)})]},s.name))})]}),!p&&i.length>0&&e.jsx($,{page:u,pages:k,total:i.length,unit:"skills",onPage:b})]})}export{G as default};
1
+ import{a as C,r,n as I,d as h,o as K,j as e,F as M,S as m,L as D,l as U,P as $}from"./index-D-kuW17t.js";const j=50,V={name:t=>t.name,fired:t=>t.call_count,last_fired:t=>t.last_fired};function G(){const[t,N]=C(),[P,L]=r.useState([]),[_,q]=r.useState([]),[o,E]=r.useState([]),[p,x]=r.useState(!0),[S,g]=r.useState(null),[f,v]=r.useState(t.get("q")??""),{sort:a,toggle:d}=I("fired","desc"),[R,b]=r.useState(1);r.useEffect(()=>{h("/sources").then(L).catch(()=>{}),h("/projects").then(q).catch(()=>{})},[]),r.useEffect(()=>{x(!0),g(null);const s=new URLSearchParams;for(const l of["source","project","q"]){const y=t.get(l);y&&s.set(l,y)}const n=s.toString()?"?"+s.toString():"";h("/skills"+n).then(E).catch(l=>g(String(l))).finally(()=>x(!1))},[t]);function c(s,n){const l=new URLSearchParams(t);n?l.set(s,n):l.delete(s),N(l)}function F(s){s.preventDefault(),c("q",f.trim())}r.useEffect(()=>b(1),[t,a.key,a.dir]);const i=r.useMemo(()=>K(o,V[a.key],a.dir),[o,a.key,a.dir]),k=Math.max(1,Math.ceil(i.length/j)),u=Math.min(R,k),w=i.slice((u-1)*j,u*j);return e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:"Skills"}),e.jsxs("div",{className:"filters",children:[e.jsxs("form",{onSubmit:F,className:"search",role:"search",children:[e.jsx("input",{type:"search","aria-label":"Search skills by name and body",placeholder:"Search skill names & bodies…",value:f,onChange:s=>v(s.target.value)}),e.jsx("button",{type:"submit",children:"Search"}),t.get("q")&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>(v(""),c("q","")),children:"clear"})]}),e.jsxs("select",{"aria-label":"Filter by source",value:t.get("source")??"",onChange:s=>c("source",s.target.value),children:[e.jsx("option",{value:"",children:"all sources"}),P.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(M,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:t.get("project")??"",onChange:s=>c("project",s),options:[{value:"",label:"all projects"},..._.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]})]}),S&&e.jsx("div",{className:"error",role:"alert",children:S}),p?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):o.length===0?e.jsx("div",{className:"muted pad",role:"status",children:"No skills fired match."}):e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(m,{label:"Skill",sortKey:"name",active:a.key,dir:a.dir,onSort:d,defaultDir:"asc"}),e.jsx(m,{label:"Fired",sortKey:"fired",active:a.key,dir:a.dir,onSort:d,className:"num"}),e.jsx("th",{className:"num",children:"Versions"}),e.jsx("th",{children:"Sources"}),e.jsx(m,{label:"Last fired",sortKey:"last_fired",active:a.key,dir:a.dir,onSort:d})]})}),e.jsx("tbody",{children:w.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(D,{to:`/skill/${encodeURIComponent(s.name)}`,className:"title",children:s.name})}),e.jsx("td",{className:"num",children:s.call_count.toLocaleString()}),e.jsx("td",{className:"num",title:`${s.version_count} distinct captured ${s.version_count===1?"version":"versions"}`,children:s.version_count||e.jsx("span",{className:"muted",children:"—"})}),e.jsx("td",{children:e.jsx("span",{className:"sub",children:s.sources.map(n=>e.jsx("span",{className:"tag",children:n},n))})}),e.jsx("td",{children:U(s.last_fired)})]},s.name))})]}),!p&&i.length>0&&e.jsx($,{page:u,pages:k,total:i.length,unit:"skills",onPage:b})]})}export{G as default};
@@ -1 +1 @@
1
- import{j as s,r as p,i as z,d as H,L as O,s as $,h as J,f as F,e as I,k as Q}from"./index-DTfBIYUK.js";import{s as B,d as S,l as D,a as U,C as G,p as L}from"./CopyButton-WFGbfzdo.js";import{M as K,r as q}from"./index-CnYz-f0y.js";const g=e=>e===null||typeof e!="object",M=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function T({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const t=typeof e;return t==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):t==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function E({v:e}){return g(e)?s.jsx(T,{v:e}):Array.isArray(e)?e.every(g)?s.jsx("span",{className:"rv-str",children:e.map(String).join(", ")||"—"}):s.jsxs("span",{className:"muted",children:["[",e.length,"]"]}):s.jsx("span",{className:"muted",children:`{${Object.keys(e).length}}`})}function W(e){const t=[],l=new Set;for(const r of e)for(const n of Object.keys(r??{}))l.has(n)||(l.add(n),t.push(n));return t}function X({rows:e}){const t=W(e);return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:t.map(l=>s.jsx("th",{children:l},l))})}),s.jsx("tbody",{children:e.map((l,r)=>s.jsx("tr",{children:t.map(n=>s.jsx("td",{children:s.jsx(E,{v:l[n]})},n))},r))})]})})}function Z({obj:e}){const t=Object.entries(e),l=W(t.map(([,r])=>r));return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"key"}),l.map(r=>s.jsx("th",{children:r},r))]})}),s.jsx("tbody",{children:t.map(([r,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:r}),l.map(a=>s.jsx("td",{children:s.jsx(E,{v:n[a]})},a))]},r))})]})})}function ss({name:e,value:t,depth:l}){const[r,n]=p.useState(l<1),a=Array.isArray(t)?`[${t.length}]`:`{${Object.keys(t).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":r,onClick:()=>n(c=>!c),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:r?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:a})]}),r&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(Y,{value:t,depth:l+1})})]})}function Y({value:e,depth:t=0}){if(g(e))return s.jsx(T,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(M)?s.jsx(X,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((a,c)=>s.jsx("li",{children:s.jsx(E,{v:a})},c))});const l=Object.entries(e);if(l.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(l.every(([,a])=>M(a)))return s.jsx(Z,{obj:e});const r=l.filter(([,a])=>g(a)),n=l.filter(([,a])=>!g(a));return s.jsxs("div",{className:"rv-obj",children:[r.length>0&&s.jsx("div",{className:"rv-metrics",children:r.map(([a,c])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:a}),s.jsx("span",{className:"rv-mval",children:s.jsx(T,{v:c})})]},a))}),n.map(([a,c])=>s.jsx(ss,{name:a,value:c,depth:t},a))]})}function C({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(Y,{value:e,depth:0})})}const N=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),A=e=>e===null||typeof e!="object",es=new Set(["script","scriptPath","description"]),ts=["skill","name","id","title"];function ns({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):A(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(A)?s.jsx("ol",{className:"launch-list",children:e.map((t,l)=>s.jsx("li",{children:t===null?"—":String(t)},l))}):s.jsx(C,{value:e}):s.jsx(C,{value:e})}function as({rec:e,index:t}){const l=ts.find(a=>typeof e[a]=="string"),r=l?String(e[l]):`task ${t+1}`,n=Object.entries(e).filter(([a])=>a!==l);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:t+1}),s.jsx("span",{className:"launch-card-title",children:r})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([a,c])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:a}),s.jsx("dd",{children:s.jsx(ns,{v:c})})]},a))})]})}function V({raw:e}){const[t,l]=p.useState(!1),{body:r,note:n}=B(S(e)),{value:a,repaired:c}=D(r);if(a===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const o=U(a),y=N(o)?Object.entries(o):[["",o]],P=y.filter(([i,h])=>A(h)&&i!=="script"),w=y.filter(([,i])=>!A(i)),u=N(o)&&typeof o.script=="string"?o.script:null,m=N(o)&&typeof o.scriptPath=="string"?o.scriptPath:null,j=N(o)&&typeof o.description=="string"?o.description:null,x=P.filter(([i])=>!es.has(i)),b=j||m||u||x.length>0,v=i=>Array.isArray(i)&&i.length>0&&i.every(N);return s.jsxs("div",{className:"launch",children:[b&&s.jsxs("div",{className:"launch-meta",children:[j&&s.jsx("div",{className:"launch-desc",children:j}),m&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:m})]}),x.map(([i,h])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:i})," ",s.jsx("code",{children:String(h)})]},i)),u&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",u.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:u})]})]}),w.map(([i,h])=>v(h)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[h.length," ",i||(h.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),h.map((_,f)=>s.jsx(as,{rec:_,index:f},f))]},i||"tasks"):s.jsxs("div",{className:"launch-section",children:[i&&s.jsx("div",{className:"launch-tasks-head",children:i}),s.jsx(C,{value:h})]},i||"value")),(n||c)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",n??"Payload was truncated; showing the recoverable portion."]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{type:"button",className:"ghost small","aria-expanded":t,onClick:()=>l(i=>!i),children:t?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(G,{text:L(r),label:"JSON",title:"Copy raw launch JSON"})]}),t&&s.jsx("pre",{className:"code launch-raw",children:L(r)})]})}function ls({raw:e}){const{body:t,note:l}=B(S(e)),r=/^\s*[[{]/.test(t),{value:n,repaired:a}=r?D(t):{value:void 0,repaired:!1},c=n!==void 0;return s.jsxs(s.Fragment,{children:[c?s.jsx("div",{className:"wf-result-body",children:s.jsx(C,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(K,{remarkPlugins:[q],children:t})}),(l||a)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",l??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(G,{text:c?L(t):t,label:"result",title:"Copy the returned result"})})]})}function rs(e,t){if(e&&e.length){const l=new Map,r=(n,a)=>{let c=l.get(n);return c?a&&(c.title=a):(c={title:a||`Phase ${n}`,agentCount:0,models:[]},l.set(n,c)),c};for(const n of e)n.type==="workflow_phase"&&r(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const a=r(n.phaseIndex,n.phaseTitle);a.agentCount++,n.model&&!a.models.includes(n.model)&&a.models.push(n.model)}if(l.size)return[...l.keys()].sort((n,a)=>n-a).map(n=>l.get(n))}return t.map(l=>({title:l,agentCount:0,models:[]}))}function cs({a:e}){const t=e.agent_description||e.title||e.id.slice(0,12);return s.jsxs("li",{children:[s.jsx(O,{to:`/session/${e.id}`,children:t}),e.agent_type&&s.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&s.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),s.jsxs("span",{className:"muted",children:[" ","· ",(e.models??"").split(",").filter(Boolean).map($).join(", ")||"—"," ·"," ",J(e.tokens)," tok · ",F(e.cost),e.duration_ms!=null?` · ${I(e.duration_ms)}`:""]})]})}function hs(){var m,j,x,b,v,i,h,_,f,R;const{run_id:e}=z(),[t,l]=p.useState(null),[r,n]=p.useState(null);if(p.useEffect(()=>{l(null),n(null),H("/workflows/"+e).then(l).catch(d=>n(String(d)))},[e]),r)return s.jsx("div",{className:"error",role:"alert",children:r});if(!t)return s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"});const a=(t.status??"").toLowerCase(),c=((m=t.run)==null?void 0:m.agent_count)??t.stats.agent_count,o=((j=t.run)==null?void 0:j.total_tokens)??t.stats.total_tokens,y=((x=t.run)==null?void 0:x.duration_ms)??t.stats.duration_ms,P=(((b=t.run)==null?void 0:b.phases)??[]).map(d=>d==null?void 0:d.title).filter(d=>!!d),w=rs((v=t.run)==null?void 0:v.progress,P),u=((i=t.run)==null?void 0:i.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(O,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",t.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:t.run_id}),t.status&&s.jsx("span",{className:"tag task-status task-status-"+a,children:t.status}),((h=t.run)==null?void 0:h.default_model)&&s.jsx("span",{className:"tag",children:$(t.run.default_model)}),((_=t.parent)==null?void 0:_.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(O,{to:`/session/${t.parent.id}`,children:t.parent.title||t.parent.id.slice(0,12)}),t.parent.turn_seq!=null?` · turn ${t.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[c," agent",c===1?"":"s"]}),s.jsxs("span",{children:[J(o)," tok"]}),((f=t.run)==null?void 0:f.total_tool_calls)!=null&&s.jsxs("span",{children:[t.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:F(t.stats.total_cost)}),s.jsx("span",{children:I(y)}),s.jsx("span",{className:"muted",children:Q(((R=t.run)==null?void 0:R.started_at)??t.stats.started_at)})]}),w.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:w.map((d,k)=>s.jsxs(p.Fragment,{children:[k>0&&s.jsx("span",{className:"wf-phase-arrow","aria-hidden":"true",children:"→"}),s.jsxs("div",{className:"wf-phase-chip",children:[s.jsx("span",{className:"wf-phase-title",children:d.title}),d.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[d.agentCount," agent",d.agentCount===1?"":"s",d.models.length?` · ${d.models.map($).join(", ")}`:""]})]})]},k))})]}),t.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",t.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+t.completion.status.toLowerCase(),children:t.completion.status})]}),t.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:S(t.completion.summary)}),t.completion.result?s.jsx(ls,{raw:t.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),t.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:S(t.completion.failures)})]})]}),u.length>0&&s.jsxs("details",{className:"wf-logs",open:u.length<=20,children:[s.jsxs("summary",{children:["Run log · ",u.length," line",u.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:u.map((d,k)=>s.jsx("li",{children:d},k))})]}),t.input_json?s.jsx("div",{className:"wf-result wf-launch",children:t.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx(V,{raw:t.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),a==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx(V,{raw:t.input_json})]})}):!t.completion&&t.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(K,{remarkPlugins:[q],children:t.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",t.agents.length,")"]}),t.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:t.agents.map(d=>s.jsx(cs,{a:d},d.id))})]})]})}export{hs as default};
1
+ import{j as s,r as p,i as z,d as H,L as O,s as $,h as J,f as F,e as I,l as Q}from"./index-D-kuW17t.js";import{s as B,d as S,l as D,a as U,C as G,p as L}from"./CopyButton-hsiW2B6o.js";import{M as K,r as q}from"./index-BXp9oWUn.js";const g=e=>e===null||typeof e!="object",M=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function T({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const t=typeof e;return t==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):t==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function E({v:e}){return g(e)?s.jsx(T,{v:e}):Array.isArray(e)?e.every(g)?s.jsx("span",{className:"rv-str",children:e.map(String).join(", ")||"—"}):s.jsxs("span",{className:"muted",children:["[",e.length,"]"]}):s.jsx("span",{className:"muted",children:`{${Object.keys(e).length}}`})}function W(e){const t=[],l=new Set;for(const r of e)for(const n of Object.keys(r??{}))l.has(n)||(l.add(n),t.push(n));return t}function X({rows:e}){const t=W(e);return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:t.map(l=>s.jsx("th",{children:l},l))})}),s.jsx("tbody",{children:e.map((l,r)=>s.jsx("tr",{children:t.map(n=>s.jsx("td",{children:s.jsx(E,{v:l[n]})},n))},r))})]})})}function Z({obj:e}){const t=Object.entries(e),l=W(t.map(([,r])=>r));return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"key"}),l.map(r=>s.jsx("th",{children:r},r))]})}),s.jsx("tbody",{children:t.map(([r,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:r}),l.map(a=>s.jsx("td",{children:s.jsx(E,{v:n[a]})},a))]},r))})]})})}function ss({name:e,value:t,depth:l}){const[r,n]=p.useState(l<1),a=Array.isArray(t)?`[${t.length}]`:`{${Object.keys(t).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":r,onClick:()=>n(c=>!c),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:r?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:a})]}),r&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(Y,{value:t,depth:l+1})})]})}function Y({value:e,depth:t=0}){if(g(e))return s.jsx(T,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(M)?s.jsx(X,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((a,c)=>s.jsx("li",{children:s.jsx(E,{v:a})},c))});const l=Object.entries(e);if(l.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(l.every(([,a])=>M(a)))return s.jsx(Z,{obj:e});const r=l.filter(([,a])=>g(a)),n=l.filter(([,a])=>!g(a));return s.jsxs("div",{className:"rv-obj",children:[r.length>0&&s.jsx("div",{className:"rv-metrics",children:r.map(([a,c])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:a}),s.jsx("span",{className:"rv-mval",children:s.jsx(T,{v:c})})]},a))}),n.map(([a,c])=>s.jsx(ss,{name:a,value:c,depth:t},a))]})}function C({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(Y,{value:e,depth:0})})}const N=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),A=e=>e===null||typeof e!="object",es=new Set(["script","scriptPath","description"]),ts=["skill","name","id","title"];function ns({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):A(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(A)?s.jsx("ol",{className:"launch-list",children:e.map((t,l)=>s.jsx("li",{children:t===null?"—":String(t)},l))}):s.jsx(C,{value:e}):s.jsx(C,{value:e})}function as({rec:e,index:t}){const l=ts.find(a=>typeof e[a]=="string"),r=l?String(e[l]):`task ${t+1}`,n=Object.entries(e).filter(([a])=>a!==l);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:t+1}),s.jsx("span",{className:"launch-card-title",children:r})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([a,c])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:a}),s.jsx("dd",{children:s.jsx(ns,{v:c})})]},a))})]})}function V({raw:e}){const[t,l]=p.useState(!1),{body:r,note:n}=B(S(e)),{value:a,repaired:c}=D(r);if(a===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const o=U(a),y=N(o)?Object.entries(o):[["",o]],P=y.filter(([i,h])=>A(h)&&i!=="script"),w=y.filter(([,i])=>!A(i)),u=N(o)&&typeof o.script=="string"?o.script:null,m=N(o)&&typeof o.scriptPath=="string"?o.scriptPath:null,j=N(o)&&typeof o.description=="string"?o.description:null,x=P.filter(([i])=>!es.has(i)),b=j||m||u||x.length>0,v=i=>Array.isArray(i)&&i.length>0&&i.every(N);return s.jsxs("div",{className:"launch",children:[b&&s.jsxs("div",{className:"launch-meta",children:[j&&s.jsx("div",{className:"launch-desc",children:j}),m&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:m})]}),x.map(([i,h])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:i})," ",s.jsx("code",{children:String(h)})]},i)),u&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",u.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:u})]})]}),w.map(([i,h])=>v(h)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[h.length," ",i||(h.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),h.map((_,f)=>s.jsx(as,{rec:_,index:f},f))]},i||"tasks"):s.jsxs("div",{className:"launch-section",children:[i&&s.jsx("div",{className:"launch-tasks-head",children:i}),s.jsx(C,{value:h})]},i||"value")),(n||c)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",n??"Payload was truncated; showing the recoverable portion."]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{type:"button",className:"ghost small","aria-expanded":t,onClick:()=>l(i=>!i),children:t?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(G,{text:L(r),label:"JSON",title:"Copy raw launch JSON"})]}),t&&s.jsx("pre",{className:"code launch-raw",children:L(r)})]})}function ls({raw:e}){const{body:t,note:l}=B(S(e)),r=/^\s*[[{]/.test(t),{value:n,repaired:a}=r?D(t):{value:void 0,repaired:!1},c=n!==void 0;return s.jsxs(s.Fragment,{children:[c?s.jsx("div",{className:"wf-result-body",children:s.jsx(C,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(K,{remarkPlugins:[q],children:t})}),(l||a)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",l??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(G,{text:c?L(t):t,label:"result",title:"Copy the returned result"})})]})}function rs(e,t){if(e&&e.length){const l=new Map,r=(n,a)=>{let c=l.get(n);return c?a&&(c.title=a):(c={title:a||`Phase ${n}`,agentCount:0,models:[]},l.set(n,c)),c};for(const n of e)n.type==="workflow_phase"&&r(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const a=r(n.phaseIndex,n.phaseTitle);a.agentCount++,n.model&&!a.models.includes(n.model)&&a.models.push(n.model)}if(l.size)return[...l.keys()].sort((n,a)=>n-a).map(n=>l.get(n))}return t.map(l=>({title:l,agentCount:0,models:[]}))}function cs({a:e}){const t=e.agent_description||e.title||e.id.slice(0,12);return s.jsxs("li",{children:[s.jsx(O,{to:`/session/${e.id}`,children:t}),e.agent_type&&s.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&s.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),s.jsxs("span",{className:"muted",children:[" ","· ",(e.models??"").split(",").filter(Boolean).map($).join(", ")||"—"," ·"," ",J(e.tokens)," tok · ",F(e.cost),e.duration_ms!=null?` · ${I(e.duration_ms)}`:""]})]})}function hs(){var m,j,x,b,v,i,h,_,f,R;const{run_id:e}=z(),[t,l]=p.useState(null),[r,n]=p.useState(null);if(p.useEffect(()=>{l(null),n(null),H("/workflows/"+e).then(l).catch(d=>n(String(d)))},[e]),r)return s.jsx("div",{className:"error",role:"alert",children:r});if(!t)return s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"});const a=(t.status??"").toLowerCase(),c=((m=t.run)==null?void 0:m.agent_count)??t.stats.agent_count,o=((j=t.run)==null?void 0:j.total_tokens)??t.stats.total_tokens,y=((x=t.run)==null?void 0:x.duration_ms)??t.stats.duration_ms,P=(((b=t.run)==null?void 0:b.phases)??[]).map(d=>d==null?void 0:d.title).filter(d=>!!d),w=rs((v=t.run)==null?void 0:v.progress,P),u=((i=t.run)==null?void 0:i.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(O,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",t.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:t.run_id}),t.status&&s.jsx("span",{className:"tag task-status task-status-"+a,children:t.status}),((h=t.run)==null?void 0:h.default_model)&&s.jsx("span",{className:"tag",children:$(t.run.default_model)}),((_=t.parent)==null?void 0:_.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(O,{to:`/session/${t.parent.id}`,children:t.parent.title||t.parent.id.slice(0,12)}),t.parent.turn_seq!=null?` · turn ${t.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[c," agent",c===1?"":"s"]}),s.jsxs("span",{children:[J(o)," tok"]}),((f=t.run)==null?void 0:f.total_tool_calls)!=null&&s.jsxs("span",{children:[t.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:F(t.stats.total_cost)}),s.jsx("span",{children:I(y)}),s.jsx("span",{className:"muted",children:Q(((R=t.run)==null?void 0:R.started_at)??t.stats.started_at)})]}),w.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:w.map((d,k)=>s.jsxs(p.Fragment,{children:[k>0&&s.jsx("span",{className:"wf-phase-arrow","aria-hidden":"true",children:"→"}),s.jsxs("div",{className:"wf-phase-chip",children:[s.jsx("span",{className:"wf-phase-title",children:d.title}),d.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[d.agentCount," agent",d.agentCount===1?"":"s",d.models.length?` · ${d.models.map($).join(", ")}`:""]})]})]},k))})]}),t.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",t.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+t.completion.status.toLowerCase(),children:t.completion.status})]}),t.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:S(t.completion.summary)}),t.completion.result?s.jsx(ls,{raw:t.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),t.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:S(t.completion.failures)})]})]}),u.length>0&&s.jsxs("details",{className:"wf-logs",open:u.length<=20,children:[s.jsxs("summary",{children:["Run log · ",u.length," line",u.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:u.map((d,k)=>s.jsx("li",{children:d},k))})]}),t.input_json?s.jsx("div",{className:"wf-result wf-launch",children:t.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx(V,{raw:t.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),a==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx(V,{raw:t.input_json})]})}):!t.completion&&t.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(K,{remarkPlugins:[q],children:t.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",t.agents.length,")"]}),t.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:t.agents.map(d=>s.jsx(cs,{a:d},d.id))})]})]})}export{hs as default};