@swestash/agent-lens 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-lens.js +271 -239
- package/dist/agent-lens.js.map +1 -1
- package/package.json +1 -1
- package/web/404.html +25 -0
- package/web/assets/Dashboard-BkRLAY2N.js +69 -0
- package/web/assets/{FileView-CJ6k5gBT.js → FileView-BbPK6hx9.js} +1 -1
- package/web/assets/{FilesView-ZB8kU8Hl.js → FilesView-D0gm4_XO.js} +1 -1
- package/web/assets/SecurityView-92YGEb3-.js +1 -0
- package/web/assets/{SessionView-BsrumXE9.js → SessionView-Dy0ELjaS.js} +8 -8
- package/web/assets/{SkillView-DhhjbXCQ.js → SkillView-Te5jcVBw.js} +1 -1
- package/web/assets/{SkillsView-CXjGf2j5.js → SkillsView-FtrADGqR.js} +1 -1
- package/web/assets/{WorkflowView-DVgrrFly.js → WorkflowView-D45UzOuV.js} +1 -1
- package/web/assets/{index-DumYdTnf.js → index-Bgxu3c84.js} +1 -1
- package/web/assets/{index-Dt08Kre7.css → index-DBaa9asK.css} +1 -1
- package/web/assets/{index-F_4kZQVd.js → index-DYY0_SmQ.js} +2 -2
- package/web/assets/jsonish-Dd3X-MG6.js +1 -0
- package/web/assets/{severity-ChuAKM2D.js → severity-CoO1IKlD.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/Dashboard-BeHGt7nW.js +0 -69
- package/web/assets/SecurityView-DOUnL_jp.js +0 -1
- package/web/assets/jsonish-B1rzsNYu.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionView-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionView-Dy0ELjaS.js","assets/severity-CoO1IKlD.js","assets/jsonish-Dd3X-MG6.js","assets/index-Bgxu3c84.js","assets/WorkflowView-D45UzOuV.js","assets/SkillView-Te5jcVBw.js","assets/FileView-BbPK6hx9.js","assets/FilesView-D0gm4_XO.js","assets/SecurityView-92YGEb3-.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function Xd(o,a){for(var s=0;s<a.length;s++){const f=a[s];if(typeof f!="string"&&!Array.isArray(f)){for(const d in f)if(d!=="default"&&!(d in o)){const m=Object.getOwnPropertyDescriptor(f,d);m&&Object.defineProperty(o,d,m.get?m:{enumerable:!0,get:()=>f[d]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))f(d);new MutationObserver(d=>{for(const m of d)if(m.type==="childList")for(const g of m.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&f(g)}).observe(document,{childList:!0,subtree:!0});function s(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function f(d){if(d.ep)return;d.ep=!0;const m=s(d);fetch(d.href,m)}})();const Jd="modulepreload",Zd=function(o){return"/"+o},uc={},en=function(a,s,f){let d=Promise.resolve();if(s&&s.length>0){let g=function(_){return Promise.all(_.map(L=>Promise.resolve(L).then(P=>({status:"fulfilled",value:P}),P=>({status:"rejected",reason:P}))))};document.getElementsByTagName("link");const x=document.querySelector("meta[property=csp-nonce]"),E=(x==null?void 0:x.nonce)||(x==null?void 0:x.getAttribute("nonce"));d=g(s.map(_=>{if(_=Zd(_),_ in uc)return;uc[_]=!0;const L=_.endsWith(".css"),P=L?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${_}"]${P}`))return;const I=document.createElement("link");if(I.rel=L?"stylesheet":Jd,L||(I.as="script"),I.crossOrigin="",I.href=_,E&&I.setAttribute("nonce",E),document.head.appendChild(I),L)return new Promise((Z,U)=>{I.addEventListener("load",Z),I.addEventListener("error",()=>U(new Error(`Unable to preload CSS for ${_}`)))})}))}function m(g){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=g,window.dispatchEvent(x),!x.defaultPrevented)throw g}return d.then(g=>{for(const x of g||[])x.status==="rejected"&&m(x.reason);return a().catch(m)})};var qh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qd(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Go={exports:{}},Rr={},Xo={exports:{}},ee={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -66,4 +66,4 @@ Error generating stack: `+i.message+`
|
|
|
66
66
|
*
|
|
67
67
|
* @license MIT
|
|
68
68
|
*/function Xl(){return Xl=Object.assign?Object.assign.bind():function(o){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var f in s)({}).hasOwnProperty.call(s,f)&&(o[f]=s[f])}return o},Xl.apply(null,arguments)}function Vc(o,a){if(o==null)return{};var s={};for(var f in o)if({}.hasOwnProperty.call(o,f)){if(a.indexOf(f)!==-1)continue;s[f]=o[f]}return s}function th(o){return!!(o.metaKey||o.altKey||o.ctrlKey||o.shiftKey)}function nh(o,a){return o.button===0&&(!a||a==="_self")&&!th(o)}function iu(o){return o===void 0&&(o=""),new URLSearchParams(typeof o=="string"||Array.isArray(o)||o instanceof URLSearchParams?o:Object.keys(o).reduce((a,s)=>{let f=o[s];return a.concat(Array.isArray(f)?f.map(d=>[s,d]):[[s,f]])},[]))}function rh(o,a){let s=iu(o);return a&&a.forEach((f,d)=>{s.has(d)||a.getAll(d).forEach(m=>{s.append(d,m)})}),s}const lh=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ih=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],oh="6";try{window.__reactRouterVersion=oh}catch{}const uh=C.createContext({isTransitioning:!1}),sh="startTransition",Ec=np[sh];function ah(o){let{basename:a,children:s,future:f,window:d}=o,m=C.useRef();m.current==null&&(m.current=sp({window:d,v5Compat:!0}));let g=m.current,[x,E]=C.useState({action:g.action,location:g.location}),{v7_startTransition:_}=f||{},L=C.useCallback(P=>{_&&Ec?Ec(()=>E(P)):E(P)},[E,_]);return C.useLayoutEffect(()=>g.listen(L),[g,L]),C.useEffect(()=>Zp(f),[f]),C.createElement(bp,{basename:a,children:s,location:x.location,navigationType:x.action,navigator:g,future:f})}const ch=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,du=C.forwardRef(function(a,s){let{onClick:f,relative:d,reloadDocument:m,replace:g,state:x,target:E,to:_,preventScrollReset:L,viewTransition:P}=a,I=Vc(a,lh),{basename:Z}=C.useContext(tn),U,Q=!1;if(typeof _=="string"&&fh.test(_)&&(U=_,ch))try{let D=new URL(window.location.href),K=_.startsWith("//")?new URL(D.protocol+_):new URL(_),ae=Bn(K.pathname,Z);K.origin===D.origin&&ae!=null?_=ae+K.search+K.hash:Q=!0}catch{}let O=Ip(_,{relative:d}),ne=ph(_,{replace:g,state:x,target:E,preventScrollReset:L,relative:d,viewTransition:P});function q(D){f&&f(D),D.defaultPrevented||ne(D)}return C.createElement("a",Xl({},I,{href:U||O,onClick:Q||m?f:q,ref:s,target:E}))}),Lr=C.forwardRef(function(a,s){let{"aria-current":f="page",caseSensitive:d=!1,className:m="",end:g=!1,style:x,to:E,viewTransition:_,children:L}=a,P=Vc(a,ih),I=ql(E,{relative:P.relative}),Z=vn(),U=C.useContext(Ic),{navigator:Q,basename:O}=C.useContext(tn),ne=U!=null&&mh(I)&&_===!0,q=Q.encodeLocation?Q.encodeLocation(I).pathname:I.pathname,D=Z.pathname,K=U&&U.navigation&&U.navigation.location?U.navigation.location.pathname:null;d||(D=D.toLowerCase(),K=K?K.toLowerCase():null,q=q.toLowerCase()),K&&O&&(K=Bn(K,O)||K);const ae=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let ke=D===q||!g&&D.startsWith(q)&&D.charAt(ae)==="/",Pe=K!=null&&(K===q||!g&&K.startsWith(q)&&K.charAt(q.length)==="/"),Ne={isActive:ke,isPending:Pe,isTransitioning:ne},$=ke?f:void 0,Ce;typeof m=="function"?Ce=m(Ne):Ce=[m,ke?"active":null,Pe?"pending":null,ne?"transitioning":null].filter(Boolean).join(" ");let ut=typeof x=="function"?x(Ne):x;return C.createElement(du,Xl({},P,{"aria-current":$,className:Ce,ref:s,style:ut,to:E,viewTransition:_}),typeof L=="function"?L(Ne):L)});var ou;(function(o){o.UseScrollRestoration="useScrollRestoration",o.UseSubmit="useSubmit",o.UseSubmitFetcher="useSubmitFetcher",o.UseFetcher="useFetcher",o.useViewTransitionState="useViewTransitionState"})(ou||(ou={}));var Cc;(function(o){o.UseFetcher="useFetcher",o.UseFetchers="useFetchers",o.UseScrollRestoration="useScrollRestoration"})(Cc||(Cc={}));function dh(o){let a=C.useContext(Jl);return a||Se(!1),a}function ph(o,a){let{target:s,replace:f,state:d,preventScrollReset:m,relative:g,viewTransition:x}=a===void 0?{}:a,E=Fc(),_=vn(),L=ql(o,{relative:g});return C.useCallback(P=>{if(nh(P,s)){P.preventDefault();let I=f!==void 0?f:Gl(_)===Gl(L);E(o,{replace:I,state:d,preventScrollReset:m,relative:g,viewTransition:x})}},[_,E,L,f,d,s,o,m,g,x])}function hh(o){let a=C.useRef(iu(o)),s=C.useRef(!1),f=vn(),d=C.useMemo(()=>rh(f.search,s.current?null:a.current),[f.search]),m=Fc(),g=C.useCallback((x,E)=>{const _=iu(typeof x=="function"?x(d):x);s.current=!0,m("?"+_,E)},[m,d]);return[d,g]}function mh(o,a){a===void 0&&(a={});let s=C.useContext(uh);s==null&&Se(!1);let{basename:f}=dh(ou.useViewTransitionState),d=ql(o,{relative:a.relative});if(!s.isTransitioning)return!1;let m=Bn(s.currentLocation.pathname,f)||s.currentLocation.pathname,g=Bn(s.nextLocation.pathname,f)||s.nextLocation.pathname;return ru(d.pathname,g)!=null||ru(d.pathname,m)!=null}const vh="/assets/logo-Cd7Wsq5o.png",eu={},Dr=(eu==null?void 0:eu.VITE_SNAPSHOT)==="1",uu="/";function gh(o){if(!Dr)return"/api"+o;const[a,s]=o.split("?"),f=a.replace(/^\//,"");if(f==="file"){const d=new URLSearchParams(s??"");return`${uu}snapshot/file/${yh(d.get("path")??"",d.get("project"))}.json`}return`${uu}snapshot/${f}.json`}function yh(o,a){const s=`${a??""}
|
|
69
|
-
${o}`;let f=3735928559,d=1103547991;for(let m=0;m<s.length;m++){const g=s.charCodeAt(m);f=Math.imul(f^g,2654435761),d=Math.imul(d^g,1597334677)}return f=Math.imul(f^f>>>16,2246822507)^Math.imul(d^d>>>13,3266489909),d=Math.imul(d^d>>>16,2246822507)^Math.imul(f^f>>>13,3266489909),(4294967296*(2097151&d)+(f>>>0)).toString(36)}function em(o,a){return Dr?`${uu}snapshot/sessions/${o}.export.md`:`/api/sessions/${o}/export.md${a?`?redact=${a}`:""}`}async function bl(o){const a=await fetch(gh(o));if(!a.ok)throw new Error(`${a.status} ${await a.text()}`);return a.json()}async function wh(o,a){const s=await fetch("/api"+o,{method:"POST",...a!==void 0?{headers:{"content-type":"application/json"},body:JSON.stringify(a)}:{}});if(!s.ok)throw new Error(`${s.status} ${await s.text()}`);return s.json()}const Bc="agentlens.theme";function Sh(){if(typeof document<"u"){const o=document.documentElement.dataset.theme;if(o==="light"||o==="dark")return o}try{const o=localStorage.getItem(Bc);if(o==="light"||o==="dark")return o}catch{}return"dark"}const Wc=C.createContext({theme:"dark",toggle:()=>{}});function kh({children:o}){const[a,s]=C.useState(Sh);typeof document<"u"&&(document.documentElement.dataset.theme=a),C.useEffect(()=>{try{localStorage.setItem(Bc,a)}catch{}},[a]);const f=()=>s(d=>d==="dark"?"light":"dark");return w.jsx(Wc.Provider,{value:{theme:a,toggle:f},children:o})}function xh(){return C.useContext(Wc)}function Eh(o){const a=Math.round((Date.now()-new Date(o).getTime())/1e3);if(a<45)return"just now";const s=Math.round(a/60);if(s<60)return`${s}m ago`;const f=Math.round(s/60);return f<24?`${f}h ago`:`${Math.round(f/24)}d ago`}function Ch(){const{theme:o,toggle:a}=xh(),[s,f]=C.useState(null),[d,m]=C.useState(!1),g=C.useCallback(()=>{bl("/health").then(U=>{f(U.last_ingested??null),m(!!U.schema_stale)}).catch(()=>{})},[]);C.useEffect(()=>{g();const U=setInterval(g,6e4);return()=>clearInterval(U)},[g]);const[x,E]=C.useState(!1),[_,L]=C.useState(null),P=C.useCallback(async()=>{E(!0),L(null);try{await wh("/refresh"),window.location.reload()}catch(U){L(String((U==null?void 0:U.message)??U).slice(0,200)),E(!1)}},[]),{pathname:I}=vn(),Z=I==="/dashboard"||I==="/security"||I.startsWith("/skill/")||I==="/file";return w.jsxs("div",{className:"app",children:[w.jsx("a",{className:"skip-link",href:"#main",children:"Skip to content"}),w.jsxs("header",{className:"topbar",children:[w.jsxs(du,{to:"/",className:"brand",children:[w.jsx("img",{src:vh,alt:"",className:"brand-logo"})," Agent Lens"]}),w.jsxs("nav",{className:"nav",children:[w.jsx(Lr,{to:"/",end:!0,className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Sessions"}),w.jsx(Lr,{to:"/files",className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Files"}),w.jsx(Lr,{to:"/skills",className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Skills"}),w.jsx(Lr,{to:"/security",className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Security"}),w.jsx(Lr,{to:"/dashboard",className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Dashboard"})]}),s?w.jsxs("span",{className:"tagline",title:`Data last ingested ${new Date(s).toLocaleString()}`,children:["updated ",Eh(s)]}):w.jsx("span",{className:"tagline",children:"local agent session explorer"}),w.jsxs("div",{className:"topbar-actions",children:[!Dr&&w.jsxs("button",{type:"button",className:"ghost refresh-btn",onClick:P,disabled:x,"aria-label":"Refresh data — collect new transcripts and rebuild",title:_?`Refresh failed: ${_}`:"Collect new transcripts and rebuild the data (runs on the host)",children:[w.jsx("span",{className:x?"refresh-icon spinning":"refresh-icon","aria-hidden":"true",children:"⟳"})," ",x?"Refreshing…":_?"Retry":"Refresh"]}),w.jsx("button",{type:"button",className:"ghost theme-toggle",onClick:a,"aria-label":"Toggle light or dark theme","aria-pressed":o==="light",title:o==="dark"?"Switch to light theme":"Switch to dark theme",children:o==="dark"?"☀":"☾"})]})]}),d&&w.jsxs("div",{className:"schema-banner",role:"status",children:["⚠ Data schema is out of date — run ",w.jsx("code",{children:"agent-lens ingest --full"})," on the host to rebuild. The ",w.jsx("em",{children:"Refresh"})," button only does an incremental ingest and won't fix this."]}),w.jsx("main",{className:"content"+(Z?" wide":""),id:"main",tabIndex:-1,children:w.jsx(qp,{})})]})}function Hc(o,a,s={}){const[f,d]=C.useState({data:null,loading:!0,error:null});return C.useEffect(()=>{const m=o();if(!m){d(x=>({...x,loading:!1,error:null}));return}d(x=>({data:s.reset?null:x.data,loading:!0,error:null}));let g=!1;return m.then(x=>!g&&d({data:x,loading:!1,error:null}),x=>!g&&d(E=>({data:E.data,loading:!1,error:String(x)}))),()=>{g=!0}},a),f}function _h(o,a){return Hc(()=>o===null?null:bl(o),[o,...(a==null?void 0:a.deps)??[]],a)}function tu(o,a,s=[]){const[f]=C.useState(a),{data:d}=Hc(()=>o===null?null:bl(o),[o,...s]);return d??f}function Ph(o=[]){const[a,s]=hh(),f=o.join(","),d=C.useCallback((E,_="")=>a.get(E)??_,[a]),m=C.useCallback(E=>{const _=new URLSearchParams(a);for(const[L,P]of Object.entries(E))P?_.set(L,P):_.delete(L);for(const L of f?f.split(","):[])L in E||_.delete(L);s(_)},[a,s,f]),g=C.useCallback(E=>{const _=new URLSearchParams;for(const L of E){const P=a.get(L);P&&_.set(L,P)}return _},[a]),x=C.useCallback(()=>s(new URLSearchParams),[s]);return{params:a,get:d,set:m,pick:g,clear:x}}function gt(){return w.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"})}function Qc({error:o}){return o?w.jsx("div",{className:"error",role:"alert",children:o}):null}function tm({state:o,empty:a,children:s}){return o.error?w.jsx(Qc,{error:o.error}):o.loading?w.jsx(gt,{}):o.data?w.jsx(w.Fragment,{children:s(o.data)}):w.jsx(w.Fragment,{children:a??w.jsx(gt,{})})}function Kc(o,a=!0){const s=C.useRef(null),f=C.useRef(o);return f.current=o,C.useEffect(()=>{if(!a)return;const d=m=>{const g=s.current;g&&!g.contains(m.target)&&f.current()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),s}function Yc(){const o=Kc(()=>{var a;(a=o.current)!=null&&a.open&&(o.current.open=!1)});return o}function Nh(o){if(!o||o<0)return"—";const a=Math.round(o/1e3);if(a<60)return`${a}s`;const s=Math.round(a/60);return s<60?`${s}m`:`${Math.floor(s/60)}h ${s%60}m`}function Tr(o){return o>=1e9?(o/1e9).toFixed(1)+"B":o>=1e6?(o/1e6).toFixed(1)+"M":o>=1e3?(o/1e3).toFixed(1)+"k":String(o)}function jh(o){return o>=.01?"$"+o.toFixed(2):o>0?"<$0.01":"$0"}function Rh(o){return o?`input ${Tr(o.input)} · output ${Tr(o.output)} · cache-write ${Tr(o.cache_creation)} · cache-read ${Tr(o.cache_read)}`:""}function Lh(o){if(!o)return"—";const a=new Date(o);return isNaN(a.getTime())?o:a.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Gc(o){return o?o==="<synthetic>"?"local":o.replace(/^claude-/,"").replace(/-\d{8}$/,""):""}function Th({value:o,options:a,onChange:s,ariaLabel:f,searchPlaceholder:d="Filter…"}){const[m,g]=C.useState(!1),[x,E]=C.useState(""),[_,L]=C.useState(0),P=Kc(()=>g(!1),m),I=C.useRef(null),Z=C.useId(),U=D=>`${Z}-opt-${D}`,Q=a.find(D=>D.value===o)??a[0]??{value:"",label:""},O=C.useMemo(()=>{const D=x.trim().toLowerCase();return D?a.filter(K=>K.label.toLowerCase().includes(D)):a},[a,x]);C.useEffect(()=>{var K;if(!m)return;E(""),(K=I.current)==null||K.focus();const D=O.findIndex(ae=>ae.value===o);L(D>=0?D:0)},[m]),C.useEffect(()=>{L(D=>Math.min(D,Math.max(0,O.length-1)))},[O.length]);function ne(D){D&&(s(D.value),g(!1))}function q(D){if(D.key==="ArrowDown"){if(D.preventDefault(),!m)return g(!0);L(K=>Math.min(K+1,O.length-1))}else D.key==="ArrowUp"?(D.preventDefault(),L(K=>Math.max(K-1,0))):D.key==="Enter"?(D.preventDefault(),ne(O[_])):D.key==="Escape"&&(D.preventDefault(),g(!1))}return w.jsxs("div",{className:"filter-select",ref:P,children:[w.jsxs("button",{type:"button",className:"filter-select-btn","aria-label":f,"aria-haspopup":"listbox","aria-expanded":m,onClick:()=>g(D=>!D),children:[w.jsx("span",{className:"filter-select-value"+(Q.value?"":" muted"),children:Q.label}),w.jsx("span",{className:"chev","aria-hidden":"true",children:"▾"})]}),m&&w.jsxs("div",{className:"filter-select-pop",children:[w.jsx("input",{ref:I,type:"text",role:"combobox","aria-expanded":"true","aria-controls":Z,"aria-activedescendant":O.length?U(_):void 0,"aria-label":f,className:"filter-select-search",placeholder:d,value:x,onChange:D=>E(D.target.value),onKeyDown:q}),w.jsx("ul",{className:"filter-select-list",role:"listbox",id:Z,"aria-label":f,children:O.length===0?w.jsx("li",{className:"filter-select-empty muted",role:"presentation",children:"No matches"}):O.map((D,K)=>w.jsx("li",{id:U(K),role:"option","aria-selected":D.value===o,className:"filter-select-opt"+(K===_?" is-active":"")+(D.value===o?" is-selected":""),onMouseEnter:()=>L(K),onMouseDown:ae=>{ae.preventDefault(),ne(D)},children:D.value?D.label:w.jsx("span",{className:"muted",children:D.label})},D.value||"__all__"))})]})]})}function zh({page:o,pages:a,total:s,unit:f,onPage:d}){return w.jsxs("div",{className:"pager",children:[w.jsx("button",{disabled:o<=1,onClick:()=>d(o-1),children:"← Prev"}),w.jsxs("span",{className:"muted",children:["page ",o," / ",a," · ",s," ",f]}),w.jsx("button",{disabled:o>=a,onClick:()=>d(o+1),children:"Next →"}),a>1&&w.jsxs("label",{className:"page-jump",children:[w.jsx("span",{className:"sr-only",children:"Jump to page"}),w.jsx("select",{value:o,onChange:m=>d(Number(m.target.value)),children:Array.from({length:a},(m,g)=>g+1).map(m=>w.jsxs("option",{value:m,children:["page ",m," / ",a]},m))})]})]})}function nm(o,a,s){const f=s==="asc"?1:-1;return o.map((d,m)=>({row:d,i:m})).sort((d,m)=>{const g=a(d.row),x=a(m.row);if(g==null&&x==null)return d.i-m.i;if(g==null)return 1;if(x==null)return-1;const E=typeof g=="number"&&typeof x=="number"?g-x:String(g).localeCompare(String(x),void 0,{numeric:!0,sensitivity:"base"});return E!==0?E*f:d.i-m.i}).map(d=>d.row)}function rm(o,a){const[s,f]=C.useState({key:o,dir:a});return{sort:s,toggle:(m,g="desc")=>f(x=>x.key===m?{key:m,dir:x.dir==="asc"?"desc":"asc"}:{key:m,dir:g})}}function Oh({label:o,sortKey:a,active:s,dir:f,onSort:d,defaultDir:m="desc",className:g}){const x=s===a;return w.jsx("th",{className:g,"aria-sort":x?f==="asc"?"ascending":"descending":"none",children:w.jsxs("button",{type:"button",className:"sort-th"+(x?" is-active":""),onClick:()=>d(a,m),children:[w.jsx("span",{children:o}),w.jsx("span",{className:"sort-ind","aria-hidden":"true",children:x?f==="asc"?"▲":"▼":"↕"})]})})}const Xc="agentlens.";function Ih(o,a){try{const s=localStorage.getItem(Xc+o);return s==null?a:JSON.parse(s)}catch{return a}}async function Dh(o){if(Dr)return null;try{return(await bl(`/prefs/${encodeURIComponent(o)}`)).value??null}catch{return null}}function Mh(o,a){try{localStorage.setItem(Xc+o,JSON.stringify(a))}catch{}Dr||fetch(`/api/prefs/${encodeURIComponent(o)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:a})}).catch(()=>{})}const Jc=[{id:"session",label:"Session",toggleable:!1,defaultVisible:!0,sortKey:"title",sortDefaultDir:"asc",cell:o=>w.jsxs("td",{children:[w.jsx(du,{to:`/session/${o.id}`,className:"title",children:o.title||w.jsx("span",{className:"muted",children:o.id.slice(0,12)})}),w.jsxs("div",{className:"sub",children:[o.is_sidechain?w.jsx("span",{className:"tag subagent",children:"subagent"}):null,(o.models??"").split(",").filter(Boolean).slice(0,3).map(a=>w.jsx("span",{className:"tag",children:Gc(a)},a))]})]})},{id:"source",label:"Source",toggleable:!0,defaultVisible:!0,cell:o=>w.jsx("td",{children:o.source_id})},{id:"project",label:"Project",toggleable:!0,defaultVisible:!0,cell:o=>{var a;return w.jsx("td",{className:"path",children:((a=o.project_path)==null?void 0:a.replace(/^.*\//,""))??"—"})}},{id:"turns",label:"Turns",toggleable:!0,defaultVisible:!0,sortKey:"turns",thClassName:"num",cell:o=>w.jsx("td",{className:"num",children:o.turn_count})},{id:"tokens",label:"Tokens",toggleable:!0,defaultVisible:!0,sortKey:"tokens",thClassName:"num",cell:o=>w.jsx("td",{className:"num",title:Rh(o.token_split),children:Tr(o.tokens)})},{id:"security",label:"Security",toggleable:!0,defaultVisible:!0,sortKey:"security",thClassName:"num",cell:o=>w.jsx("td",{className:"num",children:o.finding_count>0&&o.worst_severity?w.jsxs("span",{className:"sec-count","aria-label":`${o.finding_count} finding${o.finding_count===1?"":"s"}, highest severity ${o.worst_severity}`,title:`${o.finding_count} finding${o.finding_count===1?"":"s"} · highest severity: ${o.worst_severity}`,children:[w.jsx("span",{className:"sev-dot sev-"+o.worst_severity,"aria-hidden":"true"}),o.finding_count]}):w.jsx("span",{className:"muted",children:"—"})})},{id:"errors",label:"Errors",toggleable:!0,defaultVisible:!0,sortKey:"errors",thClassName:"num",cell:o=>w.jsx("td",{className:"num",title:o.tool_call_count>0?`${o.tool_error_count}/${o.tool_call_count} tool calls returned an error (includes user-rejected/guardrail-blocked; see the session for the failure vs declined split)`:"no tool calls",children:o.tool_error_count>0?w.jsx("span",{className:"tool-err-stat",children:o.tool_error_count}):w.jsx("span",{className:"muted",children:"—"})})},{id:"duration",label:"Duration",toggleable:!0,defaultVisible:!0,sortKey:"duration",thClassName:"num",cell:o=>w.jsx("td",{className:"num",children:Nh(o.duration_ms)})},{id:"cost",label:"Cost",toggleable:!0,defaultVisible:!1,sortKey:"cost",thClassName:"num",cell:o=>w.jsx("td",{className:"num",title:"Estimated at API list prices (cache-aware)",children:jh(o.cost)})},{id:"started",label:"Started",toggleable:!0,defaultVisible:!0,sortKey:"started",cell:o=>w.jsx("td",{children:Lh(o.started_at)})}],su=Jc.filter(o=>o.toggleable),au="sessions.columns";function Zc(o){if(!Array.isArray(o))return new Set(su.filter(s=>s.defaultVisible).map(s=>s.id));const a=new Set(su.map(s=>s.id));return new Set(o.filter(s=>typeof s=="string"&&a.has(s)))}function Fh(){return Zc(Ih(au,null))}const Yl=50,Uh={total:0,sessions:[]},$h=[{value:"critical",label:"critical"},{value:"high",label:"high"},{value:"medium",label:"medium"},{value:"low",label:"low"},{value:"info",label:"info"}],Ah=[{value:"command-failed",label:"command failed"},{value:"file-state",label:"file state"},{value:"string-not-found",label:"string not found"},{value:"token-limit",label:"token limit"},{value:"other",label:"other"},{value:"user-rejected",label:"user rejected"},{value:"guardrail-blocked",label:"guardrail blocked"}];function _c({label:o,options:a,selected:s,onChange:f}){function d(g,x){const E=new Set(s);x?E.add(g):E.delete(g),f(a.map(_=>_.value).filter(_=>E.has(_)))}const m=Yc();return w.jsxs("details",{className:"multi-select",ref:m,children:[w.jsxs("summary",{"aria-label":o,children:[o,s.length?` (${s.length})`:""," ▾"]}),w.jsxs("div",{className:"col-menu",role:"group","aria-label":o,children:[a.map(g=>w.jsxs("label",{children:[w.jsx("input",{type:"checkbox",checked:s.includes(g.value),onChange:x=>d(g.value,x.target.checked)}),g.label]},g.value)),s.length>0&&w.jsx("button",{type:"button",className:"ghost small ms-clear",onClick:()=>f([]),children:"clear"})]})]})}function Vh({visible:o,onToggle:a}){const s=Yc();return w.jsxs("details",{className:"col-customizer",ref:s,children:[w.jsx("summary",{"aria-label":"Show or hide columns",title:"Show/hide columns",children:"⚙"}),w.jsx("div",{className:"col-menu",role:"group","aria-label":"Toggle columns",children:su.map(f=>w.jsxs("label",{children:[w.jsx("input",{type:"checkbox",checked:o.has(f.id),onChange:d=>a(f.id,d.target.checked)}),f.label]},f.id))})]})}function Bh(){const{get:o,set:a,pick:s}=Ph(["offset"]),f=tu("/sources",[]),d=tu("/projects",[]),m=tu("/models",[]),[g,x]=C.useState(o("q")),[E,_]=C.useState(Fh),L=Number(o("offset","0"));C.useEffect(()=>{Dh(au).then($=>$!=null&&_(Zc($)))},[]);const P=s(["source","project","model","q","sort","dir","severity","error_type"]);P.set("kind",o("kind")||"main"),P.set("limit",String(Yl)),P.set("offset",String(L));const{data:I,loading:Z,error:U}=_h("/sessions?"+P.toString()),{total:Q,sessions:O}=I??Uh;function ne($){$.preventDefault(),a({q:g.trim()})}function q($,Ce){_(ut=>{const $e=new Set(ut);return Ce?$e.add($):$e.delete($),Mh(au,[...$e]),$e})}const D=o("sort","started"),K=o("dir")==="asc"?"asc":"desc";function ae($,Ce){a({sort:$,dir:D===$?K==="asc"?"desc":"asc":Ce})}const ke=Math.floor(L/Yl)+1,Pe=Math.max(1,Math.ceil(Q/Yl)),Ne=Jc.filter($=>!$.toggleable||E.has($.id));return w.jsxs("div",{children:[w.jsx("h1",{className:"sr-only",children:"Sessions"}),w.jsxs("div",{className:"filters",children:[w.jsxs("form",{onSubmit:ne,className:"search",role:"search",children:[w.jsx("input",{type:"search","aria-label":"Search session names, projects and transcripts",placeholder:"Search names, projects & transcripts…",value:g,onChange:$=>x($.target.value)}),w.jsx("button",{type:"submit",children:"Search"}),o("q")&&w.jsx("button",{type:"button",className:"ghost",onClick:()=>(x(""),a({q:""})),children:"clear"})]}),w.jsxs("select",{"aria-label":"Filter by source",value:o("source"),onChange:$=>a({source:$.target.value}),children:[w.jsx("option",{value:"",children:"all sources"}),f.map($=>w.jsxs("option",{value:$.id,children:[$.label," (",$.session_count,")"]},$.id))]}),w.jsx(Th,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:o("project"),onChange:$=>a({project:$}),options:[{value:"",label:"all projects"},...d.map($=>({value:$.id,label:`${$.path.replace(/^.*\//,"")} (${$.session_count})`}))]}),w.jsxs("select",{"aria-label":"Filter by model",value:o("model"),onChange:$=>a({model:$.target.value}),children:[w.jsx("option",{value:"",children:"all models"}),m.map($=>w.jsx("option",{value:$,children:Gc($)},$))]}),w.jsxs("select",{"aria-label":"Filter by kind",value:o("kind")||"main",onChange:$=>a({kind:$.target.value}),children:[w.jsx("option",{value:"main",children:"main only"}),w.jsx("option",{value:"all",children:"main + subagents"}),w.jsx("option",{value:"subagent",children:"subagents only"})]}),w.jsx(_c,{label:"Security",options:$h,selected:o("severity").split(",").filter(Boolean),onChange:$=>a({severity:$.join(",")})}),w.jsx(_c,{label:"Errors",options:Ah,selected:o("error_type").split(",").filter(Boolean),onChange:$=>a({error_type:$.join(",")})})]}),w.jsx(Qc,{error:U}),Z?w.jsx(gt,{}):O.length===0?w.jsx("div",{className:"muted pad",role:"status",children:"No sessions match."}):w.jsxs("table",{className:"sessions",children:[w.jsx("thead",{children:w.jsxs("tr",{children:[Ne.map($=>$.sortKey?w.jsx(Oh,{label:$.label,sortKey:$.sortKey,active:D,dir:K,onSort:ae,defaultDir:$.sortDefaultDir??"desc",className:$.thClassName},$.id):w.jsx("th",{className:$.thClassName,children:$.label},$.id)),w.jsx("th",{className:"col-th","aria-label":"Columns",children:w.jsx(Vh,{visible:E,onToggle:q})})]})}),w.jsx("tbody",{children:O.map($=>w.jsxs("tr",{children:[Ne.map(Ce=>w.jsx(C.Fragment,{children:Ce.cell($)},Ce.id)),w.jsx("td",{className:"col-td"})]},$.id))})]}),w.jsx(zh,{page:ke,pages:Pe,total:Q,unit:"sessions",onPage:$=>a({offset:String(($-1)*Yl)})})]})}const Wh=C.lazy(()=>en(()=>import("./Dashboard-BeHGt7nW.js"),[])),Hh=C.lazy(()=>en(()=>import("./SessionView-BsrumXE9.js"),__vite__mapDeps([0,1,2,3]))),Qh=C.lazy(()=>en(()=>import("./WorkflowView-DVgrrFly.js"),__vite__mapDeps([4,2,3]))),Kh=C.lazy(()=>en(()=>import("./SkillsView-CXjGf2j5.js"),[])),Yh=C.lazy(()=>en(()=>import("./SkillView-DhhjbXCQ.js"),__vite__mapDeps([5,3]))),Gh=C.lazy(()=>en(()=>import("./FilesView-ZB8kU8Hl.js"),[])),Xh=C.lazy(()=>en(()=>import("./FileView-CJ6k5gBT.js"),__vite__mapDeps([6,7]))),Jh=C.lazy(()=>en(()=>import("./SecurityView-DOUnL_jp.js"),__vite__mapDeps([8,1]))),Zh="/".replace(/\/$/,"");up.createRoot(document.getElementById("root")).render(w.jsx(Pc.StrictMode,{children:w.jsx(kh,{children:w.jsx(ah,{basename:Zh,children:w.jsx(eh,{children:w.jsxs(vt,{path:"/",element:w.jsx(Ch,{}),children:[w.jsx(vt,{index:!0,element:w.jsx(Bh,{})}),w.jsx(vt,{path:"dashboard",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Wh,{})})}),w.jsx(vt,{path:"session/:id",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Hh,{})})}),w.jsx(vt,{path:"workflow/:run_id",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Qh,{})})}),w.jsx(vt,{path:"files",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Gh,{})})}),w.jsx(vt,{path:"file",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Xh,{})})}),w.jsx(vt,{path:"skills",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Kh,{})})}),w.jsx(vt,{path:"skill/:name",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Yh,{})})}),w.jsx(vt,{path:"security",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Jh,{})})})]})})})})}));export{tm as A,nm as B,hh as C,Dr as D,Qc as E,Th as F,wh as G,gt as L,zh as P,Pc as R,Oh as S,Ph as a,Fc as b,qh as c,tu as d,Hc as e,Dh as f,qd as g,Tr as h,jh as i,w as j,Nh as k,Ih as l,Mh as m,bl as n,du as o,Yc as p,em as q,C as r,Gc as s,Rh as t,xh as u,Lh as v,_h as w,bh as x,vn as y,rm as z};
|
|
69
|
+
${o}`;let f=3735928559,d=1103547991;for(let m=0;m<s.length;m++){const g=s.charCodeAt(m);f=Math.imul(f^g,2654435761),d=Math.imul(d^g,1597334677)}return f=Math.imul(f^f>>>16,2246822507)^Math.imul(d^d>>>13,3266489909),d=Math.imul(d^d>>>16,2246822507)^Math.imul(f^f>>>13,3266489909),(4294967296*(2097151&d)+(f>>>0)).toString(36)}function em(o,a){return Dr?`${uu}snapshot/sessions/${o}.export.md`:`/api/sessions/${o}/export.md${a?`?redact=${a}`:""}`}async function bl(o){const a=await fetch(gh(o));if(!a.ok)throw new Error(`${a.status} ${await a.text()}`);return a.json()}async function wh(o,a){const s=await fetch("/api"+o,{method:"POST",...a!==void 0?{headers:{"content-type":"application/json"},body:JSON.stringify(a)}:{}});if(!s.ok)throw new Error(`${s.status} ${await s.text()}`);return s.json()}const Bc="agentlens.theme";function Sh(){if(typeof document<"u"){const o=document.documentElement.dataset.theme;if(o==="light"||o==="dark")return o}try{const o=localStorage.getItem(Bc);if(o==="light"||o==="dark")return o}catch{}return"dark"}const Wc=C.createContext({theme:"dark",toggle:()=>{}});function kh({children:o}){const[a,s]=C.useState(Sh);typeof document<"u"&&(document.documentElement.dataset.theme=a),C.useEffect(()=>{try{localStorage.setItem(Bc,a)}catch{}},[a]);const f=()=>s(d=>d==="dark"?"light":"dark");return w.jsx(Wc.Provider,{value:{theme:a,toggle:f},children:o})}function xh(){return C.useContext(Wc)}function Eh(o){const a=Math.round((Date.now()-new Date(o).getTime())/1e3);if(a<45)return"just now";const s=Math.round(a/60);if(s<60)return`${s}m ago`;const f=Math.round(s/60);return f<24?`${f}h ago`:`${Math.round(f/24)}d ago`}function Ch(){const{theme:o,toggle:a}=xh(),[s,f]=C.useState(null),[d,m]=C.useState(!1),g=C.useCallback(()=>{bl("/health").then(U=>{f(U.last_ingested??null),m(!!U.schema_stale)}).catch(()=>{})},[]);C.useEffect(()=>{g();const U=setInterval(g,6e4);return()=>clearInterval(U)},[g]);const[x,E]=C.useState(!1),[_,L]=C.useState(null),P=C.useCallback(async()=>{E(!0),L(null);try{await wh("/refresh"),window.location.reload()}catch(U){L(String((U==null?void 0:U.message)??U).slice(0,200)),E(!1)}},[]),{pathname:I}=vn(),Z=I==="/dashboard"||I==="/security"||I.startsWith("/skill/")||I==="/file";return w.jsxs("div",{className:"app",children:[w.jsx("a",{className:"skip-link",href:"#main",children:"Skip to content"}),w.jsxs("header",{className:"topbar",children:[w.jsxs(du,{to:"/",className:"brand",children:[w.jsx("img",{src:vh,alt:"",className:"brand-logo"})," Agent Lens"]}),w.jsxs("nav",{className:"nav",children:[w.jsx(Lr,{to:"/",end:!0,className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Sessions"}),w.jsx(Lr,{to:"/files",className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Files"}),w.jsx(Lr,{to:"/skills",className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Skills"}),w.jsx(Lr,{to:"/security",className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Security"}),w.jsx(Lr,{to:"/dashboard",className:({isActive:U})=>U?"nav-link active":"nav-link",children:"Dashboard"})]}),s?w.jsxs("span",{className:"tagline",title:`Data last ingested ${new Date(s).toLocaleString()}`,children:["updated ",Eh(s)]}):w.jsx("span",{className:"tagline",children:"local agent session explorer"}),w.jsxs("div",{className:"topbar-actions",children:[!Dr&&w.jsxs("button",{type:"button",className:"ghost refresh-btn",onClick:P,disabled:x,"aria-label":"Refresh data — collect new transcripts and rebuild",title:_?`Refresh failed: ${_}`:"Collect new transcripts and rebuild the data (runs on the host)",children:[w.jsx("span",{className:x?"refresh-icon spinning":"refresh-icon","aria-hidden":"true",children:"⟳"})," ",x?"Refreshing…":_?"Retry":"Refresh"]}),w.jsx("button",{type:"button",className:"ghost theme-toggle",onClick:a,"aria-label":"Toggle light or dark theme","aria-pressed":o==="light",title:o==="dark"?"Switch to light theme":"Switch to dark theme",children:o==="dark"?"☀":"☾"})]})]}),d&&w.jsxs("div",{className:"schema-banner",role:"status",children:["⚠ Data schema is out of date — run ",w.jsx("code",{children:"agent-lens ingest --full"})," on the host to rebuild. The ",w.jsx("em",{children:"Refresh"})," button only does an incremental ingest and won't fix this."]}),w.jsx("main",{className:"content"+(Z?" wide":""),id:"main",tabIndex:-1,children:w.jsx(qp,{})})]})}function Hc(o,a,s={}){const[f,d]=C.useState({data:null,loading:!0,error:null});return C.useEffect(()=>{const m=o();if(!m){d(x=>({...x,loading:!1,error:null}));return}d(x=>({data:s.reset?null:x.data,loading:!0,error:null}));let g=!1;return m.then(x=>!g&&d({data:x,loading:!1,error:null}),x=>!g&&d(E=>({data:E.data,loading:!1,error:String(x)}))),()=>{g=!0}},a),f}function _h(o,a){return Hc(()=>o===null?null:bl(o),[o,...(a==null?void 0:a.deps)??[]],a)}function tu(o,a,s=[]){const[f]=C.useState(a),{data:d}=Hc(()=>o===null?null:bl(o),[o,...s]);return d??f}function Ph(o=[]){const[a,s]=hh(),f=o.join(","),d=C.useCallback((E,_="")=>a.get(E)??_,[a]),m=C.useCallback(E=>{const _=new URLSearchParams(a);for(const[L,P]of Object.entries(E))P?_.set(L,P):_.delete(L);for(const L of f?f.split(","):[])L in E||_.delete(L);s(_)},[a,s,f]),g=C.useCallback(E=>{const _=new URLSearchParams;for(const L of E){const P=a.get(L);P&&_.set(L,P)}return _},[a]),x=C.useCallback(()=>s(new URLSearchParams),[s]);return{params:a,get:d,set:m,pick:g,clear:x}}function gt(){return w.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"})}function Qc({error:o}){return o?w.jsx("div",{className:"error",role:"alert",children:o}):null}function tm({state:o,empty:a,children:s}){return o.error?w.jsx(Qc,{error:o.error}):o.loading?w.jsx(gt,{}):o.data?w.jsx(w.Fragment,{children:s(o.data)}):w.jsx(w.Fragment,{children:a??w.jsx(gt,{})})}function Kc(o,a=!0){const s=C.useRef(null),f=C.useRef(o);return f.current=o,C.useEffect(()=>{if(!a)return;const d=m=>{const g=s.current;g&&!g.contains(m.target)&&f.current()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),s}function Yc(){const o=Kc(()=>{var a;(a=o.current)!=null&&a.open&&(o.current.open=!1)});return o}function Nh(o){if(!o||o<0)return"—";const a=Math.round(o/1e3);if(a<60)return`${a}s`;const s=Math.round(a/60);return s<60?`${s}m`:`${Math.floor(s/60)}h ${s%60}m`}function Tr(o){return o>=1e9?(o/1e9).toFixed(1)+"B":o>=1e6?(o/1e6).toFixed(1)+"M":o>=1e3?(o/1e3).toFixed(1)+"k":String(o)}function jh(o){return o>=.01?"$"+o.toFixed(2):o>0?"<$0.01":"$0"}function Rh(o){return o?`input ${Tr(o.input)} · output ${Tr(o.output)} · cache-write ${Tr(o.cache_creation)} · cache-read ${Tr(o.cache_read)}`:""}function Lh(o){if(!o)return"—";const a=new Date(o);return isNaN(a.getTime())?o:a.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Gc(o){return o?o==="<synthetic>"?"local":o.replace(/^claude-/,"").replace(/-\d{8}$/,""):""}function Th({value:o,options:a,onChange:s,ariaLabel:f,searchPlaceholder:d="Filter…"}){const[m,g]=C.useState(!1),[x,E]=C.useState(""),[_,L]=C.useState(0),P=Kc(()=>g(!1),m),I=C.useRef(null),Z=C.useId(),U=D=>`${Z}-opt-${D}`,Q=a.find(D=>D.value===o)??a[0]??{value:"",label:""},O=C.useMemo(()=>{const D=x.trim().toLowerCase();return D?a.filter(K=>K.label.toLowerCase().includes(D)):a},[a,x]);C.useEffect(()=>{var K;if(!m)return;E(""),(K=I.current)==null||K.focus();const D=O.findIndex(ae=>ae.value===o);L(D>=0?D:0)},[m]),C.useEffect(()=>{L(D=>Math.min(D,Math.max(0,O.length-1)))},[O.length]);function ne(D){D&&(s(D.value),g(!1))}function q(D){if(D.key==="ArrowDown"){if(D.preventDefault(),!m)return g(!0);L(K=>Math.min(K+1,O.length-1))}else D.key==="ArrowUp"?(D.preventDefault(),L(K=>Math.max(K-1,0))):D.key==="Enter"?(D.preventDefault(),ne(O[_])):D.key==="Escape"&&(D.preventDefault(),g(!1))}return w.jsxs("div",{className:"filter-select",ref:P,children:[w.jsxs("button",{type:"button",className:"filter-select-btn","aria-label":f,"aria-haspopup":"listbox","aria-expanded":m,onClick:()=>g(D=>!D),children:[w.jsx("span",{className:"filter-select-value"+(Q.value?"":" muted"),children:Q.label}),w.jsx("span",{className:"chev","aria-hidden":"true",children:"▾"})]}),m&&w.jsxs("div",{className:"filter-select-pop",children:[w.jsx("input",{ref:I,type:"text",role:"combobox","aria-expanded":"true","aria-controls":Z,"aria-activedescendant":O.length?U(_):void 0,"aria-label":f,className:"filter-select-search",placeholder:d,value:x,onChange:D=>E(D.target.value),onKeyDown:q}),w.jsx("ul",{className:"filter-select-list",role:"listbox",id:Z,"aria-label":f,children:O.length===0?w.jsx("li",{className:"filter-select-empty muted",role:"presentation",children:"No matches"}):O.map((D,K)=>w.jsx("li",{id:U(K),role:"option","aria-selected":D.value===o,className:"filter-select-opt"+(K===_?" is-active":"")+(D.value===o?" is-selected":""),onMouseEnter:()=>L(K),onMouseDown:ae=>{ae.preventDefault(),ne(D)},children:D.value?D.label:w.jsx("span",{className:"muted",children:D.label})},D.value||"__all__"))})]})]})}function zh({page:o,pages:a,total:s,unit:f,onPage:d}){return w.jsxs("div",{className:"pager",children:[w.jsx("button",{disabled:o<=1,onClick:()=>d(o-1),children:"← Prev"}),w.jsxs("span",{className:"muted",children:["page ",o," / ",a," · ",s," ",f]}),w.jsx("button",{disabled:o>=a,onClick:()=>d(o+1),children:"Next →"}),a>1&&w.jsxs("label",{className:"page-jump",children:[w.jsx("span",{className:"sr-only",children:"Jump to page"}),w.jsx("select",{value:o,onChange:m=>d(Number(m.target.value)),children:Array.from({length:a},(m,g)=>g+1).map(m=>w.jsxs("option",{value:m,children:["page ",m," / ",a]},m))})]})]})}function nm(o,a,s){const f=s==="asc"?1:-1;return o.map((d,m)=>({row:d,i:m})).sort((d,m)=>{const g=a(d.row),x=a(m.row);if(g==null&&x==null)return d.i-m.i;if(g==null)return 1;if(x==null)return-1;const E=typeof g=="number"&&typeof x=="number"?g-x:String(g).localeCompare(String(x),void 0,{numeric:!0,sensitivity:"base"});return E!==0?E*f:d.i-m.i}).map(d=>d.row)}function rm(o,a){const[s,f]=C.useState({key:o,dir:a});return{sort:s,toggle:(m,g="desc")=>f(x=>x.key===m?{key:m,dir:x.dir==="asc"?"desc":"asc"}:{key:m,dir:g})}}function Oh({label:o,sortKey:a,active:s,dir:f,onSort:d,defaultDir:m="desc",className:g}){const x=s===a;return w.jsx("th",{className:g,"aria-sort":x?f==="asc"?"ascending":"descending":"none",children:w.jsxs("button",{type:"button",className:"sort-th"+(x?" is-active":""),onClick:()=>d(a,m),children:[w.jsx("span",{children:o}),w.jsx("span",{className:"sort-ind","aria-hidden":"true",children:x?f==="asc"?"▲":"▼":"↕"})]})})}const Xc="agentlens.";function Ih(o,a){try{const s=localStorage.getItem(Xc+o);return s==null?a:JSON.parse(s)}catch{return a}}async function Dh(o){if(Dr)return null;try{return(await bl(`/prefs/${encodeURIComponent(o)}`)).value??null}catch{return null}}function Mh(o,a){try{localStorage.setItem(Xc+o,JSON.stringify(a))}catch{}Dr||fetch(`/api/prefs/${encodeURIComponent(o)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:a})}).catch(()=>{})}const Jc=[{id:"session",label:"Session",toggleable:!1,defaultVisible:!0,sortKey:"title",sortDefaultDir:"asc",cell:o=>w.jsxs("td",{children:[w.jsx(du,{to:`/session/${o.id}`,className:"title",children:o.title||w.jsx("span",{className:"muted",children:o.id.slice(0,12)})}),w.jsxs("div",{className:"sub",children:[o.is_sidechain?w.jsx("span",{className:"tag subagent",children:"subagent"}):null,(o.models??"").split(",").filter(Boolean).slice(0,3).map(a=>w.jsx("span",{className:"tag",children:Gc(a)},a))]})]})},{id:"source",label:"Source",toggleable:!0,defaultVisible:!0,cell:o=>w.jsx("td",{children:o.source_id})},{id:"project",label:"Project",toggleable:!0,defaultVisible:!0,cell:o=>{var a;return w.jsx("td",{className:"path",children:((a=o.project_path)==null?void 0:a.replace(/^.*\//,""))??"—"})}},{id:"turns",label:"Turns",toggleable:!0,defaultVisible:!0,sortKey:"turns",thClassName:"num",cell:o=>w.jsx("td",{className:"num",children:o.turn_count})},{id:"tokens",label:"Tokens",toggleable:!0,defaultVisible:!0,sortKey:"tokens",thClassName:"num",cell:o=>w.jsx("td",{className:"num",title:Rh(o.token_split),children:Tr(o.tokens)})},{id:"security",label:"Security",toggleable:!0,defaultVisible:!0,sortKey:"security",thClassName:"num",cell:o=>w.jsx("td",{className:"num",children:o.finding_count>0&&o.worst_severity?w.jsxs("span",{className:"sec-count","aria-label":`${o.finding_count} finding${o.finding_count===1?"":"s"}, highest severity ${o.worst_severity}`,title:`${o.finding_count} finding${o.finding_count===1?"":"s"} · highest severity: ${o.worst_severity}`,children:[w.jsx("span",{className:"sev-dot sev-"+o.worst_severity,"aria-hidden":"true"}),o.finding_count]}):w.jsx("span",{className:"muted",children:"—"})})},{id:"errors",label:"Errors",toggleable:!0,defaultVisible:!0,sortKey:"errors",thClassName:"num",cell:o=>w.jsx("td",{className:"num",title:o.tool_call_count>0?`${o.tool_error_count}/${o.tool_call_count} tool calls returned an error (includes user-rejected/guardrail-blocked; see the session for the failure vs declined split)`:"no tool calls",children:o.tool_error_count>0?w.jsx("span",{className:"tool-err-stat",children:o.tool_error_count}):w.jsx("span",{className:"muted",children:"—"})})},{id:"duration",label:"Duration",toggleable:!0,defaultVisible:!0,sortKey:"duration",thClassName:"num",cell:o=>w.jsx("td",{className:"num",children:Nh(o.duration_ms)})},{id:"cost",label:"Cost",toggleable:!0,defaultVisible:!1,sortKey:"cost",thClassName:"num",cell:o=>w.jsx("td",{className:"num",title:"Estimated at API list prices (cache-aware)",children:jh(o.cost)})},{id:"started",label:"Started",toggleable:!0,defaultVisible:!0,sortKey:"started",cell:o=>w.jsx("td",{children:Lh(o.started_at)})}],su=Jc.filter(o=>o.toggleable),au="sessions.columns";function Zc(o){if(!Array.isArray(o))return new Set(su.filter(s=>s.defaultVisible).map(s=>s.id));const a=new Set(su.map(s=>s.id));return new Set(o.filter(s=>typeof s=="string"&&a.has(s)))}function Fh(){return Zc(Ih(au,null))}const Yl=50,Uh={total:0,sessions:[]},$h=[{value:"critical",label:"critical"},{value:"high",label:"high"},{value:"medium",label:"medium"},{value:"low",label:"low"},{value:"info",label:"info"}],Ah=[{value:"command-failed",label:"command failed"},{value:"file-state",label:"file state"},{value:"string-not-found",label:"string not found"},{value:"token-limit",label:"token limit"},{value:"other",label:"other"},{value:"user-rejected",label:"user rejected"},{value:"guardrail-blocked",label:"guardrail blocked"}];function _c({label:o,options:a,selected:s,onChange:f}){function d(g,x){const E=new Set(s);x?E.add(g):E.delete(g),f(a.map(_=>_.value).filter(_=>E.has(_)))}const m=Yc();return w.jsxs("details",{className:"multi-select",ref:m,children:[w.jsxs("summary",{"aria-label":o,children:[o,s.length?` (${s.length})`:""," ▾"]}),w.jsxs("div",{className:"col-menu",role:"group","aria-label":o,children:[a.map(g=>w.jsxs("label",{children:[w.jsx("input",{type:"checkbox",checked:s.includes(g.value),onChange:x=>d(g.value,x.target.checked)}),g.label]},g.value)),s.length>0&&w.jsx("button",{type:"button",className:"ghost small ms-clear",onClick:()=>f([]),children:"clear"})]})]})}function Vh({visible:o,onToggle:a}){const s=Yc();return w.jsxs("details",{className:"col-customizer",ref:s,children:[w.jsx("summary",{"aria-label":"Show or hide columns",title:"Show/hide columns",children:"⚙"}),w.jsx("div",{className:"col-menu",role:"group","aria-label":"Toggle columns",children:su.map(f=>w.jsxs("label",{children:[w.jsx("input",{type:"checkbox",checked:o.has(f.id),onChange:d=>a(f.id,d.target.checked)}),f.label]},f.id))})]})}function Bh(){const{get:o,set:a,pick:s}=Ph(["offset"]),f=tu("/sources",[]),d=tu("/projects",[]),m=tu("/models",[]),[g,x]=C.useState(o("q")),[E,_]=C.useState(Fh),L=Number(o("offset","0"));C.useEffect(()=>{Dh(au).then($=>$!=null&&_(Zc($)))},[]);const P=s(["source","project","model","q","sort","dir","severity","error_type"]);P.set("kind",o("kind")||"main"),P.set("limit",String(Yl)),P.set("offset",String(L));const{data:I,loading:Z,error:U}=_h("/sessions?"+P.toString()),{total:Q,sessions:O}=I??Uh;function ne($){$.preventDefault(),a({q:g.trim()})}function q($,Ce){_(ut=>{const $e=new Set(ut);return Ce?$e.add($):$e.delete($),Mh(au,[...$e]),$e})}const D=o("sort","started"),K=o("dir")==="asc"?"asc":"desc";function ae($,Ce){a({sort:$,dir:D===$?K==="asc"?"desc":"asc":Ce})}const ke=Math.floor(L/Yl)+1,Pe=Math.max(1,Math.ceil(Q/Yl)),Ne=Jc.filter($=>!$.toggleable||E.has($.id));return w.jsxs("div",{children:[w.jsx("h1",{className:"sr-only",children:"Sessions"}),w.jsxs("div",{className:"filters",children:[w.jsxs("form",{onSubmit:ne,className:"search",role:"search",children:[w.jsx("input",{type:"search","aria-label":"Search session names, projects and transcripts",placeholder:"Search names, projects & transcripts…",value:g,onChange:$=>x($.target.value)}),w.jsx("button",{type:"submit",children:"Search"}),o("q")&&w.jsx("button",{type:"button",className:"ghost",onClick:()=>(x(""),a({q:""})),children:"clear"})]}),w.jsxs("select",{"aria-label":"Filter by source",value:o("source"),onChange:$=>a({source:$.target.value}),children:[w.jsx("option",{value:"",children:"all sources"}),f.map($=>w.jsxs("option",{value:$.id,children:[$.label," (",$.session_count,")"]},$.id))]}),w.jsx(Th,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:o("project"),onChange:$=>a({project:$}),options:[{value:"",label:"all projects"},...d.map($=>({value:$.id,label:`${$.path.replace(/^.*\//,"")} (${$.session_count})`}))]}),w.jsxs("select",{"aria-label":"Filter by model",value:o("model"),onChange:$=>a({model:$.target.value}),children:[w.jsx("option",{value:"",children:"all models"}),m.map($=>w.jsx("option",{value:$,children:Gc($)},$))]}),w.jsxs("select",{"aria-label":"Filter by kind",value:o("kind")||"main",onChange:$=>a({kind:$.target.value}),children:[w.jsx("option",{value:"main",children:"main only"}),w.jsx("option",{value:"all",children:"main + subagents"}),w.jsx("option",{value:"subagent",children:"subagents only"})]}),w.jsx(_c,{label:"Security",options:$h,selected:o("severity").split(",").filter(Boolean),onChange:$=>a({severity:$.join(",")})}),w.jsx(_c,{label:"Errors",options:Ah,selected:o("error_type").split(",").filter(Boolean),onChange:$=>a({error_type:$.join(",")})})]}),w.jsx(Qc,{error:U}),Z?w.jsx(gt,{}):O.length===0?w.jsx("div",{className:"muted pad",role:"status",children:"No sessions match."}):w.jsxs("table",{className:"sessions",children:[w.jsx("thead",{children:w.jsxs("tr",{children:[Ne.map($=>$.sortKey?w.jsx(Oh,{label:$.label,sortKey:$.sortKey,active:D,dir:K,onSort:ae,defaultDir:$.sortDefaultDir??"desc",className:$.thClassName},$.id):w.jsx("th",{className:$.thClassName,children:$.label},$.id)),w.jsx("th",{className:"col-th","aria-label":"Columns",children:w.jsx(Vh,{visible:E,onToggle:q})})]})}),w.jsx("tbody",{children:O.map($=>w.jsxs("tr",{children:[Ne.map(Ce=>w.jsx(C.Fragment,{children:Ce.cell($)},Ce.id)),w.jsx("td",{className:"col-td"})]},$.id))})]}),w.jsx(zh,{page:ke,pages:Pe,total:Q,unit:"sessions",onPage:$=>a({offset:String(($-1)*Yl)})})]})}const Wh=C.lazy(()=>en(()=>import("./Dashboard-BkRLAY2N.js"),[])),Hh=C.lazy(()=>en(()=>import("./SessionView-Dy0ELjaS.js"),__vite__mapDeps([0,1,2,3]))),Qh=C.lazy(()=>en(()=>import("./WorkflowView-D45UzOuV.js"),__vite__mapDeps([4,2,3]))),Kh=C.lazy(()=>en(()=>import("./SkillsView-FtrADGqR.js"),[])),Yh=C.lazy(()=>en(()=>import("./SkillView-Te5jcVBw.js"),__vite__mapDeps([5,3]))),Gh=C.lazy(()=>en(()=>import("./FilesView-D0gm4_XO.js"),[])),Xh=C.lazy(()=>en(()=>import("./FileView-BbPK6hx9.js"),__vite__mapDeps([6,7]))),Jh=C.lazy(()=>en(()=>import("./SecurityView-92YGEb3-.js"),__vite__mapDeps([8,1]))),Zh="/".replace(/\/$/,"");up.createRoot(document.getElementById("root")).render(w.jsx(Pc.StrictMode,{children:w.jsx(kh,{children:w.jsx(ah,{basename:Zh,children:w.jsx(eh,{children:w.jsxs(vt,{path:"/",element:w.jsx(Ch,{}),children:[w.jsx(vt,{index:!0,element:w.jsx(Bh,{})}),w.jsx(vt,{path:"dashboard",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Wh,{})})}),w.jsx(vt,{path:"session/:id",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Hh,{})})}),w.jsx(vt,{path:"workflow/:run_id",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Qh,{})})}),w.jsx(vt,{path:"files",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Gh,{})})}),w.jsx(vt,{path:"file",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Xh,{})})}),w.jsx(vt,{path:"skills",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Kh,{})})}),w.jsx(vt,{path:"skill/:name",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Yh,{})})}),w.jsx(vt,{path:"security",element:w.jsx(C.Suspense,{fallback:w.jsx(gt,{}),children:w.jsx(Jh,{})})})]})})})})}));export{tm as A,nm as B,hh as C,Dr as D,Qc as E,Th as F,wh as G,du as L,zh as P,Pc as R,Oh as S,Fc as a,jh as b,Nh as c,qh as d,Ph as e,Tr as f,qd as g,tu as h,Dh as i,w as j,Hc as k,Ih as l,gt as m,Mh as n,bl as o,Yc as p,em as q,C as r,Gc as s,Rh as t,xh as u,Lh as v,_h as w,bh as x,vn as y,rm as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as u,j as l,L as d,f,b as m,c as h,r as y}from"./index-DYY0_SmQ.js";function x({a:e}){const t=e.agent_description||e.title||e.id.slice(0,12),n=(e.models??"").split(",").filter(Boolean).map(u).join(", ");return l.jsxs("li",{children:[l.jsx(d,{to:`/session/${e.id}`,children:t}),e.agent_type&&l.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&l.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),l.jsxs("span",{className:"muted",children:[" ","· ",n||"—"," · ",f(e.tokens)," tok · ",m(e.cost),e.duration_ms!=null?` · ${h(e.duration_ms)}`:""]})]})}function j({text:e,label:t,title:n="Copy to clipboard",className:a=""}){const[o,i]=y.useState(!1),c=async()=>{try{await navigator.clipboard.writeText(e)}catch{const s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy")}catch{}s.remove()}i(!0),window.setTimeout(()=>i(!1),1200)};return l.jsxs("button",{type:"button",className:"ghost small copy-btn "+a,onClick:c,"aria-label":n,title:n,children:[o?"✓ Copied":"⧉",t?" "+t:""]})}function k(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/?9;|'/g,"'").replace(/&/g,"&")}function b(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 w(e){try{return{value:JSON.parse(e),repaired:!1}}catch{}const t=[];let n=!1,a=!1,o=-1,i=[];for(let s=0;s<e.length;s++){const r=e[s];if(n){a?a=!1:r==="\\"?a=!0:r==='"'&&(n=!1);continue}r==='"'?n=!0:r==="{"||r==="["?t.push(r==="{"?"}":"]"):r==="}"||r==="]"?(t.pop(),o=s+1,i=[...t]):r===","&&(o=s,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 p(e){if(typeof e=="string"){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return p(JSON.parse(t))}catch{return e}return e}if(Array.isArray(e))return e.map(p);if(e&&typeof e=="object"){const t={};for(const[n,a]of Object.entries(e))t[n]=p(a);return t}return e}function C(e,t=2e4){try{return JSON.stringify(JSON.parse(e),null,2).slice(0,t)}catch{return e.slice(0,t)}}export{x as A,j as C,p as a,k as d,w as l,C as p,b as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./index-
|
|
1
|
+
import{j as i}from"./index-DYY0_SmQ.js";const n=["critical","high","medium","low","info"];function r({severity:s,count:a}){return i.jsxs("span",{className:"tag sev sev-"+s,children:[s,a!=null?` ${a}`:""]})}export{n as S,r as a};
|
package/web/index.html
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
document.documentElement.dataset.theme = "dark";
|
|
17
17
|
}
|
|
18
18
|
</script>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
20
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-DYY0_SmQ.js"></script>
|
|
20
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DBaa9asK.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
23
23
|
<div id="root"></div>
|