@swestash/agent-lens 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{D as d,x as h,j as e,A as o,L as r,w as t}from"./index-DAAJAs1W.js";import{relPath as m,LinesDelta as p}from"./FilesView-DxZpH4mQ.js";function v(){const[i]=d(),l=i.get("path")??"",a=i.get("project")??"",n=new URLSearchParams({path:l});a&&n.set("project",a);const s=h(l?"/file?"+n.toString():null);return e.jsx(o,{state:s,empty:e.jsx("div",{className:"muted pad",children:"Not found."}),children:c=>e.jsx(j,{data:c})})}function j({data:i}){return e.jsxs("div",{className:"file-view",children:[e.jsx(r,{to:"/files",className:"back",children:"← all files"}),e.jsxs("header",{className:"skill-head",children:[e.jsxs("h1",{children:["📄 ",m(i.file_path,i.project_path)]}),e.jsxs("div",{className:"skill-head-meta muted",children:[e.jsx("span",{title:i.file_path,children:i.file_path}),i.project_path?e.jsxs(e.Fragment,{children:[" · in ",i.project_path.replace(/^.*\//,"")]}):null]})]}),e.jsxs("div",{className:"kpis",children:[e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"sessions"}),e.jsx("div",{className:"kpi-value",children:i.sessions_count.toLocaleString()})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"changes"}),e.jsx("div",{className:"kpi-value",children:i.changes_count.toLocaleString()})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"lines + / −"}),e.jsxs("div",{className:"kpi-value",children:["+",i.lines_added.toLocaleString()," −",i.lines_removed.toLocaleString()]})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"first · last touched"}),e.jsxs("div",{className:"kpi-value kpi-sub",children:[t(i.first_ts)," · ",t(i.last_ts)]})]})]}),i.sessions.map(l=>{var n;const a=(n=l.changes.find(s=>s.event_uuid))==null?void 0:n.event_uuid;return e.jsxs("div",{className:"card",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:e.jsx(r,{to:`/session/${l.session_id}${a?`#ev-${a}`:""}`,className:"title",title:a?"Open the session at this file's first change":void 0,children:l.title||e.jsx("span",{className:"muted",children:l.session_id.slice(0,12)})})}),e.jsxs("span",{className:"card-hint",children:[l.category&&e.jsx("span",{className:`tag cat-${l.category}`,children:l.category}),l.source_id&&e.jsx("span",{className:"tag",children:l.source_id})," ",t(l.started_at)]})]}),e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Turn"}),e.jsx("th",{children:"Tool"}),e.jsx("th",{className:"num",children:"+ / −"}),e.jsx("th",{children:"Prompt"}),e.jsx("th",{children:"When"})]})}),e.jsx("tbody",{children:l.changes.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:s.event_uuid?e.jsxs(r,{to:`/session/${l.session_id}#ev-${s.event_uuid}`,className:"title",title:"Jump to this change in the transcript",children:["turn ",s.turn_seq!=null?s.turn_seq+1:"?"]}):e.jsxs("span",{className:"muted",children:["turn ",s.turn_seq!=null?s.turn_seq+1:"?"]})}),e.jsx("td",{children:e.jsx("span",{className:"tag",children:s.tool_name})}),e.jsx("td",{className:"num",children:e.jsx(p,{added:s.lines_added,removed:s.lines_removed})}),e.jsx("td",{className:"muted",title:s.prompt_preview??void 0,children:s.prompt_preview?s.prompt_preview.length>80?s.prompt_preview.slice(0,79)+"…":s.prompt_preview:"—"}),e.jsx("td",{children:t(s.timestamp)})]},s.id))})]})]},l.session_id)}),e.jsx("p",{className:"muted pad",children:"Tracked from Edit/Write tool calls — changes made via shell commands or outside sessions aren’t captured."})]})}export{v as default};
1
+ import{J as d,x as h,j as e,D as o,L as r,v as t}from"./index-CvMppG1z.js";import{relPath as m,LinesDelta as p}from"./FilesView-B6_w8jKK.js";function v(){const[i]=d(),l=i.get("path")??"",a=i.get("project")??"",n=new URLSearchParams({path:l});a&&n.set("project",a);const s=h(l?"/file?"+n.toString():null);return e.jsx(o,{state:s,empty:e.jsx("div",{className:"muted pad",children:"Not found."}),children:c=>e.jsx(j,{data:c})})}function j({data:i}){return e.jsxs("div",{className:"file-view",children:[e.jsx(r,{to:"/files",className:"back",children:"← all files"}),e.jsxs("header",{className:"skill-head",children:[e.jsxs("h1",{children:["📄 ",m(i.file_path,i.project_path)]}),e.jsxs("div",{className:"skill-head-meta muted",children:[e.jsx("span",{title:i.file_path,children:i.file_path}),i.project_path?e.jsxs(e.Fragment,{children:[" · in ",i.project_path.replace(/^.*\//,"")]}):null]})]}),e.jsxs("div",{className:"kpis",children:[e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"sessions"}),e.jsx("div",{className:"kpi-value",children:i.sessions_count.toLocaleString()})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"changes"}),e.jsx("div",{className:"kpi-value",children:i.changes_count.toLocaleString()})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"lines + / −"}),e.jsxs("div",{className:"kpi-value",children:["+",i.lines_added.toLocaleString()," −",i.lines_removed.toLocaleString()]})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"first · last touched"}),e.jsxs("div",{className:"kpi-value kpi-sub",children:[t(i.first_ts)," · ",t(i.last_ts)]})]})]}),i.sessions.map(l=>{var n;const a=(n=l.changes.find(s=>s.event_uuid))==null?void 0:n.event_uuid;return e.jsxs("div",{className:"card",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:e.jsx(r,{to:`/session/${l.session_id}${a?`#ev-${a}`:""}`,className:"title",title:a?"Open the session at this file's first change":void 0,children:l.title||e.jsx("span",{className:"muted",children:l.session_id.slice(0,12)})})}),e.jsxs("span",{className:"card-hint",children:[l.category&&e.jsx("span",{className:`tag cat-${l.category}`,children:l.category}),l.source_id&&e.jsx("span",{className:"tag",children:l.source_id})," ",t(l.started_at)]})]}),e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Turn"}),e.jsx("th",{children:"Tool"}),e.jsx("th",{className:"num",children:"+ / −"}),e.jsx("th",{children:"Prompt"}),e.jsx("th",{children:"When"})]})}),e.jsx("tbody",{children:l.changes.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:s.event_uuid?e.jsxs(r,{to:`/session/${l.session_id}#ev-${s.event_uuid}`,className:"title",title:"Jump to this change in the transcript",children:["turn ",s.turn_seq!=null?s.turn_seq+1:"?"]}):e.jsxs("span",{className:"muted",children:["turn ",s.turn_seq!=null?s.turn_seq+1:"?"]})}),e.jsx("td",{children:e.jsx("span",{className:"tag",children:s.tool_name})}),e.jsx("td",{className:"num",children:e.jsx(p,{added:s.lines_added,removed:s.lines_removed})}),e.jsx("td",{className:"muted",title:s.prompt_preview??void 0,children:s.prompt_preview?s.prompt_preview.length>80?s.prompt_preview.slice(0,79)+"…":s.prompt_preview:"—"}),e.jsx("td",{children:t(s.timestamp)})]},s.id))})]})]},l.session_id)}),e.jsx("p",{className:"muted pad",children:"Tracked from Edit/Write tool calls — changes made via shell commands or outside sessions aren’t captured."})]})}export{v as default};
@@ -1 +1 @@
1
- import{k as q,m as x,r as E,x as C,j as e,F as P,E as k,o as D,S as n,L as K,w as $,P as I}from"./index-DAAJAs1W.js";const i=50,M={total:0,files:[]};function A(t,a){return a&&t.startsWith(a.replace(/\/$/,"")+"/")?t.slice(a.replace(/\/$/,"").length+1):t}function R({added:t,removed:a}){return t==null&&a==null?e.jsx("span",{className:"muted",children:"—"}):e.jsxs("span",{className:"sub",children:[t!=null&&e.jsxs("span",{className:"tag",children:["+",t.toLocaleString()]}),a!=null&&e.jsxs("span",{className:"tag",children:["−",a.toLocaleString()]})]})}function G(){const{get:t,set:a,pick:g}=q(["offset"]),f=x("/sources",[]),b=x("/projects",[]),[h,u]=E.useState(t("q")),p=Number(t("offset","0")),o=g(["source","project","q","sort","dir"]);o.set("limit",String(i)),o.set("offset",String(p));const{data:N,loading:j,error:S}=C("/files?"+o.toString()),{total:d,files:m}=N??M;function v(s){s.preventDefault(),a({q:h.trim()})}const l=t("sort","last_ts"),r=t("dir")==="asc"?"asc":"desc";function c(s,F){a({sort:s,dir:l===s?r==="asc"?"desc":"asc":F})}const _=Math.floor(p/i)+1,y=Math.max(1,Math.ceil(d/i)),L=!!(t("q")||t("source")||t("project"));return e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:"Files"}),e.jsxs("div",{className:"filters",children:[e.jsxs("form",{onSubmit:v,className:"search",role:"search",children:[e.jsx("input",{type:"search","aria-label":"Search files by path",placeholder:"Search file paths…",value:h,onChange:s=>u(s.target.value)}),e.jsx("button",{type:"submit",children:"Search"}),t("q")&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>(u(""),a({q:""})),children:"clear"})]}),e.jsxs("select",{"aria-label":"Filter by source",value:t("source"),onChange:s=>a({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),f.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(P,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:t("project"),onChange:s=>a({project:s}),options:[{value:"",label:"all projects"},...b.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]})]}),e.jsx(k,{error:S}),j?e.jsx(D,{}):m.length===0?e.jsx("div",{className:"muted pad",role:"status",children:L?"No files match the filter.":"No file changes ingested yet — run agent-lens refresh (or ingest) first."}):e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(n,{label:"File",sortKey:"path",active:l,dir:r,onSort:c,defaultDir:"asc"}),e.jsx("th",{children:"Project"}),e.jsx(n,{label:"Sessions",sortKey:"sessions",active:l,dir:r,onSort:c,className:"num"}),e.jsx(n,{label:"Changes",sortKey:"changes",active:l,dir:r,onSort:c,className:"num"}),e.jsx("th",{className:"num",children:"+ / −"}),e.jsx(n,{label:"Last touched",sortKey:"last_ts",active:l,dir:r,onSort:c})]})}),e.jsx("tbody",{children:m.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(K,{to:`/file?path=${encodeURIComponent(s.file_path)}${s.project_id?`&project=${encodeURIComponent(s.project_id)}`:""}`,className:"title",title:s.file_path,children:A(s.file_path,s.project_path)})}),e.jsx("td",{children:s.project_path?e.jsx("span",{className:"tag",title:s.project_path,children:s.project_path.replace(/^.*\//,"")}):e.jsx("span",{className:"muted",children:"—"})}),e.jsx("td",{className:"num",children:s.sessions.toLocaleString()}),e.jsx("td",{className:"num",children:s.changes.toLocaleString()}),e.jsx("td",{className:"num",children:e.jsx(R,{added:s.lines_added,removed:s.lines_removed})}),e.jsx("td",{children:$(s.last_ts)})]},(s.project_id??"")+"\0"+s.file_path))})]}),!j&&d>0&&e.jsx(I,{page:_,pages:y,total:d,unit:"files",onPage:s=>a({offset:String((s-1)*i)})}),e.jsx("p",{className:"muted pad",children:"Tracked from Edit/Write tool calls — changes made via shell commands or outside sessions aren’t captured."})]})}export{R as LinesDelta,G as default,A as relPath};
1
+ import{i as E,k as x,r as F,x as C,j as e,H as P,E as k,n as D,I as n,L as I,v as K,P as $}from"./index-CvMppG1z.js";const i=50,M={total:0,files:[]};function A(t,a){return a&&t.startsWith(a.replace(/\/$/,"")+"/")?t.slice(a.replace(/\/$/,"").length+1):t}function R({added:t,removed:a}){return t==null&&a==null?e.jsx("span",{className:"muted",children:"—"}):e.jsxs("span",{className:"sub",children:[t!=null&&e.jsxs("span",{className:"tag",children:["+",t.toLocaleString()]}),a!=null&&e.jsxs("span",{className:"tag",children:["−",a.toLocaleString()]})]})}function H(){const{get:t,set:a,pick:g}=E(["offset"]),f=x("/sources",[]),b=x("/projects",[]),[h,u]=F.useState(t("q")),p=Number(t("offset","0")),o=g(["source","project","q","sort","dir"]);o.set("limit",String(i)),o.set("offset",String(p));const{data:N,loading:j,error:v}=C("/files?"+o.toString()),{total:d,files:m}=N??M;function S(s){s.preventDefault(),a({q:h.trim()})}const l=t("sort","last_ts"),r=t("dir")==="asc"?"asc":"desc";function c(s,q){a({sort:s,dir:l===s?r==="asc"?"desc":"asc":q})}const _=Math.floor(p/i)+1,y=Math.max(1,Math.ceil(d/i)),L=!!(t("q")||t("source")||t("project"));return e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:"Files"}),e.jsxs("div",{className:"filters",children:[e.jsxs("form",{onSubmit:S,className:"search",role:"search",children:[e.jsx("input",{type:"search","aria-label":"Search files by path",placeholder:"Search file paths…",value:h,onChange:s=>u(s.target.value)}),e.jsx("button",{type:"submit",children:"Search"}),t("q")&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>(u(""),a({q:""})),children:"clear"})]}),e.jsxs("select",{"aria-label":"Filter by source",value:t("source"),onChange:s=>a({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),f.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(P,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:t("project"),onChange:s=>a({project:s}),options:[{value:"",label:"all projects"},...b.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]})]}),e.jsx(k,{error:v}),j?e.jsx(D,{}):m.length===0?e.jsx("div",{className:"muted pad",role:"status",children:L?"No files match the filter.":"No file changes ingested yet — run agent-lens refresh (or ingest) first."}):e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(n,{label:"File",sortKey:"path",active:l,dir:r,onSort:c,defaultDir:"asc"}),e.jsx("th",{children:"Project"}),e.jsx(n,{label:"Sessions",sortKey:"sessions",active:l,dir:r,onSort:c,className:"num"}),e.jsx(n,{label:"Changes",sortKey:"changes",active:l,dir:r,onSort:c,className:"num"}),e.jsx("th",{className:"num",children:"+ / −"}),e.jsx(n,{label:"Last touched",sortKey:"last_ts",active:l,dir:r,onSort:c})]})}),e.jsx("tbody",{children:m.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(I,{to:`/file?path=${encodeURIComponent(s.file_path)}${s.project_id?`&project=${encodeURIComponent(s.project_id)}`:""}`,className:"title",title:s.file_path,children:A(s.file_path,s.project_path)})}),e.jsx("td",{children:s.project_path?e.jsx("span",{className:"tag",title:s.project_path,children:s.project_path.replace(/^.*\//,"")}):e.jsx("span",{className:"muted",children:"—"})}),e.jsx("td",{className:"num",children:s.sessions.toLocaleString()}),e.jsx("td",{className:"num",children:s.changes.toLocaleString()}),e.jsx("td",{className:"num",children:e.jsx(R,{added:s.lines_added,removed:s.lines_removed})}),e.jsx("td",{children:K(s.last_ts)})]},(s.project_id??"")+"\0"+s.file_path))})]}),!j&&d>0&&e.jsx($,{page:_,pages:y,total:d,unit:"files",onPage:s=>a({offset:String((s-1)*i)})}),e.jsx("p",{className:"muted pad",children:"Tracked from Edit/Write tool calls — changes made via shell commands or outside sessions aren’t captured."})]})}export{R as LinesDelta,H as default,A as relPath};
@@ -1 +1 @@
1
- import{k as ie,m as E,r as k,B as ae,x as ne,j as e,G as h,F as le,H as x,E as re,o as ce,S as $,P as oe,w as de,L as ue}from"./index-DAAJAs1W.js";import{u as W,S as he,a as me}from"./useResetOn-DeM1LqwP.js";const P=50,pe={total:0,findings:[]},je=new Set;function ke(){const{get:t,set:a,clear:l}=ie(),n=E("/sources",[]),M=E("/projects",[]),[m,f]=k.useState(!1),[p,Q]=k.useState(0),{sort:r,toggle:S}=ae("severity","desc"),y=t("severity"),b=t("category"),v=t("rule"),_=t("session"),R=t("source"),F=t("project"),T=t("from"),A=t("to"),d=t("status","open"),w=k.useMemo(()=>{const s=new URLSearchParams;for(const[c,u]of Object.entries({severity:y,category:b,rule:v,session:_,source:R,project:F,from:T,to:A,status:d}))u&&s.set(c,u);return s},[y,b,v,_,R,F,T,A,d]),i=E("/security/summary",null,[p]),I=E(h?null:"/security/mutes",[],[p]),L=`${w.toString()}|${r.key}|${r.dir}`,[C,U]=W(L,1),[o,O]=W(`${L}|${C}|${p}`,je),N=new URLSearchParams(w);N.set("sort",r.key),N.set("dir",r.dir),N.set("limit",String(P)),N.set("offset",String((C-1)*P));const{data:V,loading:D,error:Y}=ne("/security/findings?"+N.toString(),{deps:[p]}),[q,B]=W(`${L}|${C}|${p}`,null),J=q??Y,{total:j,findings:K}=V??pe,g=k.useCallback(async s=>{f(!0),B(null);try{await s(),Q(c=>c+1)}catch(c){B(String(c))}finally{f(!1)}},[]),X=k.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),G=k.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!b||s.category===b),[i,b]),Z=Math.max(1,Math.ceil(j/P)),ee=[...w.keys()].some(s=>s!=="status")||d!=="open",z=K.map(s=>s.id),se=z.length>0&&z.every(s=>o.has(s)),te=s=>O(c=>{const u=new Set(c);return u.has(s)?u.delete(s):u.add(s),u});return e.jsxs("div",{children:[e.jsxs("div",{className:"detail-head",children:[e.jsx("h1",{children:"Security findings"}),e.jsxs("p",{className:"muted page-intro",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."]})]}),h&&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"+(y?"":" is-active"),onClick:()=>a({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"]})]}),he.map(s=>e.jsxs("button",{type:"button",className:"kpi kpi-btn sev-kpi sev-"+s+(y===s?" is-active":""),onClick:()=>a({severity:y===s?"":s}),"aria-pressed":y===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:()=>a({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>a({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:d,onChange:s=>a({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:b,onChange:s=>{const c=s.target.value,u=!v||G.some(H=>H.rule_id===v&&(!c||H.category===c));a({category:c,rule:u?v:""})},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:v,onChange:s=>a({rule:s.target.value}),children:[e.jsx("option",{value:"",children:"all rules"}),G.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:R,onChange:s=>a({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),n.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(le,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:F,onChange:s=>a({project:s}),options:[{value:"",label:"all projects"},...M.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]}),e.jsxs("label",{className:"ctl",children:["from ",e.jsx("input",{type:"date",value:T,onChange:s=>a({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:A,onChange:s=>a({to:s.target.value})})]}),_&&e.jsxs("span",{className:"tag filter-chip",children:["session ",_.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>a({session:""}),children:"✕"})]}),ee&&e.jsx("button",{type:"button",className:"ghost",onClick:l,children:"clear filters"})]}),!h&&(o.size>0||d==="open"&&j>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[o.size>0&&d!=="dismissed"&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>g(()=>x("/security/dismiss",{ids:[...o]})),children:["✓ Mark ",o.size," safe"]}),o.size>0&&d==="dismissed"&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>g(()=>x("/security/reopen",{ids:[...o]})),children:["↩ Reopen ",o.size]}),o.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>O(new Set),children:"clear selection"}),d==="open"&&j>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:m,onClick:()=>{confirm(`Dismiss all ${j} open findings matching the current filter as safe?`)&&g(()=>x("/security/dismiss-matching",{filter:Object.fromEntries(w)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",j," matching"]})]}),e.jsx(re,{error:J}),D?e.jsx(ce,{}):K.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&d==="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:[!h&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:se,onChange:s=>O(s.target.checked?new Set(z):new Set)})}),e.jsx($,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:S}),e.jsx("th",{children:"Finding"}),e.jsx($,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:S}),e.jsx("th",{children:"Evidence"}),e.jsx($,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:S}),e.jsx($,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:S}),!h&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:K.map(s=>e.jsx(ge,{f:s,selected:o.has(s.id),onToggle:()=>te(s.id),busy:m,onDismiss:()=>g(()=>x("/security/dismiss",{ids:[s.id]})),onReopen:()=>g(()=>x("/security/reopen",{ids:[s.id]})),onMute:()=>g(()=>x("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!D&&j>P&&e.jsx(oe,{page:C,pages:Z,total:j,unit:"findings",onPage:U}),!h&&I.length>0&&e.jsx(xe,{mutes:I,busy:m,onUnmute:s=>g(()=>x("/security/unmute",{rule_id:s.rule_id,scope:s.scope,scope_id:s.scope_id}))}),i&&i.categories.length>0&&e.jsx(ye,{summary:i})]})}function ge({f:t,selected:a,onToggle:l,busy:n,onDismiss:M,onReopen:m,onMute:f}){const p=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!h&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:a,onChange:l})}),e.jsxs("td",{children:[e.jsx(me,{severity:t.severity}),t.dismissed?e.jsx("span",{className:"tag dismissed",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",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:de(t.started_at??null)}),e.jsxs("td",{className:"small",children:[e.jsx(ue,{to:p,className:"title",children:t.session_title||t.session_id.slice(0,12)}),t.is_sidechain?e.jsx("span",{className:"tag subagent",children:"subagent"}):null,t.project_path&&e.jsx("div",{className:"muted path",children:t.project_path.replace(/^.*\//,"")})]}),!h&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:m,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:M,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:f,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function xe({mutes:t,busy:a,onUnmute:l}){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(n=>e.jsxs("li",{children:[e.jsx("code",{children:n.rule_id}),e.jsxs("span",{className:"tag mute-scope",children:[n.scope,n.scope_id?`: ${n.scope_id}`:""]}),n.note&&e.jsx("span",{className:"muted small mute-note",children:n.note}),e.jsx("button",{type:"button",className:"linkish unmute",disabled:a,onClick:()=>l(n),children:"unmute"})]},`${n.rule_id}:${n.scope}:${n.scope_id}`))})]})}function ye({summary:t}){const a=new Map(t.by_category.map(l=>[l.category,l.n]));return e.jsxs("section",{className:"sec-reference",children:[e.jsx("h2",{children:"Risk categories"}),e.jsx("p",{className:"muted small sec-reference-intro",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(l=>e.jsxs("details",{className:"card sec-ref",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"sec-ref-title",children:l.title}),e.jsxs("a",{className:"tag framework",href:l.framework_url,target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),children:[l.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[a.get(l.key)??0," open"]})]}),e.jsxs("dl",{className:"sec-ref-body",children:[e.jsx("dt",{children:"What"}),e.jsx("dd",{children:l.what}),e.jsx("dt",{children:"Why it matters"}),e.jsx("dd",{children:l.why}),e.jsx("dt",{children:"What to do"}),e.jsx("dd",{children:l.remediation})]})]},l.key))})]})}export{ke as default};
1
+ import{i as ie,k as E,r as k,F as ae,x as ne,j as e,S as h,H as le,K as x,E as re,n as ce,I as $,P as oe,v as de,L as ue}from"./index-CvMppG1z.js";import{u as I,S as he,a as me}from"./useResetOn-BZWxJ_cM.js";const P=50,pe={total:0,findings:[]},je=new Set;function ke(){const{get:t,set:a,clear:l}=ie(),n=E("/sources",[]),M=E("/projects",[]),[m,f]=k.useState(!1),[p,B]=k.useState(0),{sort:r,toggle:S}=ae("severity","desc"),y=t("severity"),b=t("category"),v=t("rule"),_=t("session"),R=t("source"),F=t("project"),T=t("from"),A=t("to"),d=t("status","open"),w=k.useMemo(()=>{const s=new URLSearchParams;for(const[c,u]of Object.entries({severity:y,category:b,rule:v,session:_,source:R,project:F,from:T,to:A,status:d}))u&&s.set(c,u);return s},[y,b,v,_,R,F,T,A,d]),i=E("/security/summary",null,[p]),W=E(h?null:"/security/mutes",[],[p]),L=`${w.toString()}|${r.key}|${r.dir}`,[C,G]=I(L,1),[o,O]=I(`${L}|${C}|${p}`,je),N=new URLSearchParams(w);N.set("sort",r.key),N.set("dir",r.dir),N.set("limit",String(P)),N.set("offset",String((C-1)*P));const{data:V,loading:D,error:Y}=ne("/security/findings?"+N.toString(),{deps:[p]}),[q,H]=I(`${L}|${C}|${p}`,null),J=q??Y,{total:j,findings:K}=V??pe,g=k.useCallback(async s=>{f(!0),H(null);try{await s(),B(c=>c+1)}catch(c){H(String(c))}finally{f(!1)}},[]),X=k.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),Q=k.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!b||s.category===b),[i,b]),Z=Math.max(1,Math.ceil(j/P)),ee=[...w.keys()].some(s=>s!=="status")||d!=="open",z=K.map(s=>s.id),se=z.length>0&&z.every(s=>o.has(s)),te=s=>O(c=>{const u=new Set(c);return u.has(s)?u.delete(s):u.add(s),u});return e.jsxs("div",{children:[e.jsxs("div",{className:"detail-head",children:[e.jsx("h1",{children:"Security findings"}),e.jsxs("p",{className:"muted page-intro",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."]})]}),h&&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"+(y?"":" is-active"),onClick:()=>a({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"]})]}),he.map(s=>e.jsxs("button",{type:"button",className:"kpi kpi-btn sev-kpi sev-"+s+(y===s?" is-active":""),onClick:()=>a({severity:y===s?"":s}),"aria-pressed":y===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:()=>a({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>a({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:d,onChange:s=>a({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:b,onChange:s=>{const c=s.target.value,u=!v||Q.some(U=>U.rule_id===v&&(!c||U.category===c));a({category:c,rule:u?v:""})},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:v,onChange:s=>a({rule:s.target.value}),children:[e.jsx("option",{value:"",children:"all rules"}),Q.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:R,onChange:s=>a({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),n.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(le,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:F,onChange:s=>a({project:s}),options:[{value:"",label:"all projects"},...M.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]}),e.jsxs("label",{className:"ctl",children:["from ",e.jsx("input",{type:"date",value:T,onChange:s=>a({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:A,onChange:s=>a({to:s.target.value})})]}),_&&e.jsxs("span",{className:"tag filter-chip",children:["session ",_.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>a({session:""}),children:"✕"})]}),ee&&e.jsx("button",{type:"button",className:"ghost",onClick:l,children:"clear filters"})]}),!h&&(o.size>0||d==="open"&&j>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[o.size>0&&d!=="dismissed"&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>g(()=>x("/security/dismiss",{ids:[...o]})),children:["✓ Mark ",o.size," safe"]}),o.size>0&&d==="dismissed"&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>g(()=>x("/security/reopen",{ids:[...o]})),children:["↩ Reopen ",o.size]}),o.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>O(new Set),children:"clear selection"}),d==="open"&&j>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:m,onClick:()=>{confirm(`Dismiss all ${j} open findings matching the current filter as safe?`)&&g(()=>x("/security/dismiss-matching",{filter:Object.fromEntries(w)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",j," matching"]})]}),e.jsx(re,{error:J}),D?e.jsx(ce,{}):K.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&d==="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:[!h&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:se,onChange:s=>O(s.target.checked?new Set(z):new Set)})}),e.jsx($,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:S}),e.jsx("th",{children:"Finding"}),e.jsx($,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:S}),e.jsx("th",{children:"Evidence"}),e.jsx($,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:S}),e.jsx($,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:S}),!h&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:K.map(s=>e.jsx(ge,{f:s,selected:o.has(s.id),onToggle:()=>te(s.id),busy:m,onDismiss:()=>g(()=>x("/security/dismiss",{ids:[s.id]})),onReopen:()=>g(()=>x("/security/reopen",{ids:[s.id]})),onMute:()=>g(()=>x("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!D&&j>P&&e.jsx(oe,{page:C,pages:Z,total:j,unit:"findings",onPage:G}),!h&&W.length>0&&e.jsx(xe,{mutes:W,busy:m,onUnmute:s=>g(()=>x("/security/unmute",{rule_id:s.rule_id,scope:s.scope,scope_id:s.scope_id}))}),i&&i.categories.length>0&&e.jsx(ye,{summary:i})]})}function ge({f:t,selected:a,onToggle:l,busy:n,onDismiss:M,onReopen:m,onMute:f}){const p=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!h&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:a,onChange:l})}),e.jsxs("td",{children:[e.jsx(me,{severity:t.severity}),t.dismissed?e.jsx("span",{className:"tag dismissed",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",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:de(t.started_at??null)}),e.jsxs("td",{className:"small",children:[e.jsx(ue,{to:p,className:"title",children:t.session_title||t.session_id.slice(0,12)}),t.is_sidechain?e.jsx("span",{className:"tag subagent",children:"subagent"}):null,t.project_path&&e.jsx("div",{className:"muted path",children:t.project_path.replace(/^.*\//,"")})]}),!h&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:m,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:M,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:f,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function xe({mutes:t,busy:a,onUnmute:l}){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(n=>e.jsxs("li",{children:[e.jsx("code",{children:n.rule_id}),e.jsxs("span",{className:"tag mute-scope",children:[n.scope,n.scope_id?`: ${n.scope_id}`:""]}),n.note&&e.jsx("span",{className:"muted small mute-note",children:n.note}),e.jsx("button",{type:"button",className:"linkish unmute",disabled:a,onClick:()=>l(n),children:"unmute"})]},`${n.rule_id}:${n.scope}:${n.scope_id}`))})]})}function ye({summary:t}){const a=new Map(t.by_category.map(l=>[l.category,l.n]));return e.jsxs("section",{className:"sec-reference",children:[e.jsx("h2",{children:"Risk categories"}),e.jsx("p",{className:"muted small sec-reference-intro",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(l=>e.jsxs("details",{className:"card sec-ref",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"sec-ref-title",children:l.title}),e.jsxs("a",{className:"tag framework",href:l.framework_url,target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),children:[l.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[a.get(l.key)??0," open"]})]}),e.jsxs("dl",{className:"sec-ref-body",children:[e.jsx("dt",{children:"What"}),e.jsx("dd",{children:l.what}),e.jsx("dt",{children:"Why it matters"}),e.jsx("dd",{children:l.why}),e.jsx("dt",{children:"What to do"}),e.jsx("dd",{children:l.remediation})]})]},l.key))})]})}export{ke as default};
@@ -0,0 +1,15 @@
1
+ import{d as Cs,j as s,p as ye,r as u,L as W,f as oe,t as ns,a as Ts,q as Es,b as Z,v as as,s as Is,w as Ee,x as Os,e as ke,h as be,l as As,y as $s,z as Rs,i as Ds,E as Fs,n as Ls,A as Be}from"./index-CvMppG1z.js";import{S as _e,a as ls,u as Ps}from"./useResetOn-BZWxJ_cM.js";import{A as Me,C as X,p as Q}from"./jsonish-DMAKObPI.js";import{M as qs,r as Bs}from"./index-CcEbkJx7.js";import{u as Us}from"./theme-ByPiBqSS.js";function Hs({id:e}){const t=Cs();return s.jsxs("details",{className:"export-menu col-customizer",ref:t,children:[s.jsx("summary",{className:"export",title:"Export this session as Markdown",children:"⬇ Export Markdown"}),s.jsxs("div",{className:"col-menu",role:"group","aria-label":"Export options",children:[s.jsxs("a",{href:ye(e),download:!0,children:["Redacted ",s.jsx("span",{className:"muted small",children:"(secrets masked)"})]}),s.jsxs("a",{href:ye(e,"structure"),download:!0,children:["Structure only ",s.jsx("span",{className:"muted small",children:"(scrubbed)"})]}),s.jsxs("a",{className:"export-verbatim",href:ye(e,"off"),download:!0,children:["Verbatim ",s.jsx("span",{className:"muted small",children:"(unredacted)"})]})]})]})}function Ks({c:e}){var c;const[t,n]=u.useState(!1),a=u.useId(),l=(c=e.signals)==null?void 0:c.loc;return s.jsxs("div",{className:"classification",children:[s.jsx("span",{className:"tag cat cat-"+(e.category??"none"),children:e.category??"unclassified"}),e.complexity_band&&s.jsxs("span",{className:"tag complexity",children:[e.complexity_band," · ",e.complexity_score]}),l&&s.jsxs("span",{className:"muted small",children:["+",l.added,"/−",l.removed," LoC · ",l.files," files"]}),s.jsxs("button",{className:"ghost small","aria-expanded":t,"aria-controls":a,onClick:()=>n(r=>!r),children:["why ",t?"▾":"▸"]}),t&&(e.signals?s.jsx(Ws,{id:a,s:e.signals,category:e.category}):s.jsx("div",{id:a,className:"muted small pad",children:"No signals recorded for this session."}))]})}const Gs={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},Ue=e=>`${Math.max(0,Math.min(1,e))*100}%`;function He({counts:e}){const t=Object.entries(e).sort((n,a)=>a[1]-n[1]);return t.length===0?s.jsx("span",{className:"muted",children:"—"}):s.jsx("span",{className:"sig-chips",children:t.map(([n,a])=>s.jsxs("span",{className:"sig-chip",children:[n," ",s.jsxs("span",{className:"muted",children:["×",a]})]},n))})}function Ws({id:e,s:t,category:n}){const[a,l]=u.useState(!1),c=u.useId(),r=t.complexity_weights??{},i=t.complexity_subscores??{},h=Object.keys(r).map(x=>({key:x,weight:r[x],subscore:i[x]??0,pts:r[x]*(i[x]??0)*100})).sort((x,S)=>S.pts-x.pts),f=Math.max(...h.map(x=>x.pts),1e-4),p=Object.entries(t.category_scores??{}).map(([x,S])=>({k:x,v:S})).sort((x,S)=>S.v-x.v),g=Math.max(...p.map(x=>x.v),1e-4),j=p.filter(x=>x.v>.02||x.k===n),E=t.skills&&Object.keys(t.skills).length>0;return s.jsxs("div",{id:e,className:"signals-panel",children:[h.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:h.map(x=>s.jsxs("li",{className:"sig-bar-row",children:[s.jsx("span",{className:"sig-bar-label",children:Gs[x.key]??x.key}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:Ue(x.pts/f)}})}),s.jsxs("span",{className:"sig-bar-val",children:[x.pts.toFixed(1)," pts"]}),s.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(x.subscore*100),"% intensity · weight ",Math.round(x.weight*100),"%"]})]},x.key))})]}),j.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 “",n,"” won"]})]}),s.jsx("ul",{className:"sig-bars",children:j.map(x=>s.jsxs("li",{className:"sig-bar-row"+(x.k===n?" is-win":""),children:[s.jsx("span",{className:"sig-bar-label",children:x.k}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:Ue(x.v/g)}})}),s.jsx("span",{className:"sig-bar-val",children:x.v.toFixed(2)})]},x.k))})]}),s.jsxs("section",{className:"sig-section",children:[s.jsx("h4",{className:"sig-h",children:"Evidence"}),s.jsxs("dl",{className:"sig-grid",children:[t.tool_counts&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Tools"}),s.jsx("dd",{children:s.jsx(He,{counts:t.tool_counts})})]}),E&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Skills"}),s.jsx("dd",{children:s.jsx(He,{counts:t.skills})})]}),t.subagent_role&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Subagent role"}),s.jsx("dd",{children:t.subagent_role})]}),t.files&&t.files.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("dt",{children:["Files (",t.files.length,")"]}),s.jsx("dd",{className:"sig-files",children:t.files.join(", ")})]})]})]}),s.jsx("button",{className:"ghost small","aria-expanded":a,"aria-controls":c,onClick:()=>l(x=>!x),children:a?"Hide raw JSON ▴":"View raw JSON ▾"}),a&&s.jsx("pre",{id:c,className:"code signals",children:JSON.stringify(t,null,2)})]})}function Js({f:e}){var r;const[t,n]=u.useState(!1),a=u.useId(),l=((r=e.signals)==null?void 0:r.modifiers)??{},c=Object.keys(l).filter(i=>l[i]!==!1&&l[i]!=null&&l[i]!=="");return s.jsxs("div",{className:"finding sev-border-"+e.severity,children:[s.jsxs("button",{className:"finding-head","aria-expanded":t,"aria-controls":a,onClick:()=>n(i=>!i),children:[s.jsx(ls,{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:t?"▾":"▸"})]}),t&&s.jsxs("div",{className:"finding-body",id:a,children:[e.evidence&&s.jsx("div",{className:"code-block",children:s.jsx("pre",{className:"code finding-evidence",children:e.evidence})}),s.jsxs("dl",{className:"sig-grid",children:[s.jsx("dt",{children:"Rule"}),s.jsx("dd",{children:s.jsx("code",{children:e.rule_id})}),s.jsx("dt",{children:"Category"}),s.jsx("dd",{children:e.category}),c.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Context"}),s.jsx("dd",{children:c.map(i=>s.jsxs("span",{className:"sig-chip",children:[i,l[i]!==!0?s.jsxs("span",{className:"muted",children:[" ",String(l[i])]}):null]},i))})]})]}),s.jsxs(W,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(e.rule_id)}`,children:["see all “",e.rule_id,"” findings →"]})]})]})}function Vs({findings:e}){if(!e.length)return null;const t=[...e].sort((n,a)=>_e.indexOf(n.severity)-_e.indexOf(a.severity));return s.jsx("div",{className:"tool-findings",children:t.map(n=>s.jsx(Js,{f:n},n.id))})}function Qs({findings:e,sessionId:t}){const n=new Map;for(const l of e)n.set(l.severity,(n.get(l.severity)??0)+1);const a=_e.find(l=>n.has(l))??"info";return s.jsxs("div",{className:"security-banner sev-border-"+a,role:"status",children:[s.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),s.jsxs("span",{className:"security-banner-text",children:[e.length," security ",e.length===1?"finding":"findings"," in this session"]}),s.jsx("span",{className:"security-banner-sevs",children:_e.filter(l=>n.has(l)).map(l=>s.jsx(ls,{severity:l,count:n.get(l)},l))}),s.jsx(W,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(t)}`,children:"view on Security page →"})]})}function Xs(e){const t={dirs:new Map,files:[]};for(const a of e){const l=a.display.startsWith("/"),c=(l?a.display.slice(1):a.display).split("/");l&&c.length>0&&(c[0]="/"+c[0]);let r=t;for(const i of c.slice(0,-1))r=r.dirs.get(i)??r.dirs.set(i,{dirs:new Map,files:[]}).get(i);r.files.push({name:c[c.length-1],path:a.path,list:a.list})}const n=a=>{for(const[l,c]of[...a.dirs.entries()])if(n(c),c.files.length===0&&c.dirs.size===1){const[r,i]=[...c.dirs.entries()][0];a.dirs.delete(l),a.dirs.set(l+"/"+r,i)}};return n(t),t}function rs({node:e,depth:t}){const n={paddingLeft:`${.4+t*1.1}rem`};return s.jsxs(s.Fragment,{children:[[...e.dirs.entries()].sort(([a],[l])=>a.localeCompare(l)).map(([a,l])=>s.jsxs(u.Fragment,{children:[s.jsx("tr",{children:s.jsx("td",{colSpan:3,style:n,children:s.jsxs("span",{className:"muted",children:["📁 ",a,"/"]})})}),s.jsx(rs,{node:l,depth:t+1})]},a)),[...e.files].sort((a,l)=>a.name.localeCompare(l.name)).map(a=>{const l=a.list.find(i=>i.event_uuid),c=a.list.reduce((i,h)=>i+(h.lines_added??0),0),r=a.list.reduce((i,h)=>i+(h.lines_removed??0),0);return s.jsxs("tr",{children:[s.jsx("td",{style:n,children:l!=null&&l.event_uuid?s.jsx("a",{href:`#ev-${l.event_uuid}`,className:"title",title:a.path+" — jump to the first change",children:a.name}):s.jsx("span",{title:a.path,children:a.name})}),s.jsxs("td",{className:"num",children:[a.list.length,"× ",s.jsxs("span",{className:"muted",children:["(+",c," −",r,")"]})]}),s.jsx("td",{children:s.jsx(W,{className:"subagent-link small",to:`/file?path=${encodeURIComponent(a.path)}`,children:"history →"})})]},a.path)})]})}const Ke=7,Se=4;function zs({changes:e,projectPath:t}){const n=new Map;for(const r of e)(n.get(r.file_path)??n.set(r.file_path,[]).get(r.file_path)).push(r);const a=r=>t&&r.startsWith(t.replace(/\/$/,"")+"/")?r.slice(t.replace(/\/$/,"").length+1):r,l=Xs([...n.entries()].map(([r,i])=>({display:a(r),path:r,list:i}))),c=[...n.entries()].filter(([,r])=>r.length>=Ke).sort((r,i)=>i[1].length-r[1].length);return s.jsxs("details",{className:"wf-run files-changed",children:[s.jsxs("summary",{children:["📄 ",n.size," ",n.size===1?"file":"files"," changed · ",e.length," ",e.length===1?"edit":"edits",c.length>0&&s.jsxs("span",{className:"muted",children:[" · ",c.length," edited ",Ke,"+ times"]})]}),c.length>0&&s.jsxs("p",{className:"muted files-rework",children:["Most reworked:"," ",c.slice(0,Se).map(([r,i],h)=>s.jsxs(u.Fragment,{children:[h>0&&", ",s.jsxs("span",{title:r,children:[a(r).split("/").pop()," (",i.length,"×)"]})]},r)),c.length>Se&&`, and ${c.length-Se} more`]}),s.jsx("table",{className:"sessions",children:s.jsx("tbody",{children:s.jsx(rs,{node:l,depth:0})})})]})}function Ys({d:e}){var n;const t=e.session;return s.jsxs("div",{className:"detail-head",children:[s.jsx(W,{to:"/",className:"back",children:"← all sessions"}),s.jsx("h1",{children:t.title||t.id.slice(0,12)}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("span",{children:s.jsx("b",{children:t.source_id})}),s.jsx("span",{className:"path",children:t.project_path}),t.is_sidechain?s.jsx("span",{className:"tag subagent",children:"subagent"}):null,e.parent&&s.jsxs("span",{className:"spawned-by",children:["↖ spawned by"," ",s.jsx(W,{to:`/session/${e.parent.id}`,children:e.parent.title||e.parent.id.slice(0,12)}),e.parent.turn_seq!=null?` · turn ${e.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[e.turns.length," turns"]}),s.jsxs("span",{children:[t.event_count," events"]}),s.jsxs("span",{title:ns(t.token_split),children:[oe(t.tokens)," tok"]}),s.jsxs("span",{title:Es(t.unpriced_models),children:[Ts(t.cost),(n=t.unpriced_models)!=null&&n.length?s.jsx("span",{className:"warn-tag",children:" ⚠"}):null]}),t.tool_call_count>0&&s.jsxs("span",{className:t.tool_failure_count>0?"tool-err-stat":"muted",title:"Tool calls that returned is_error, of "+t.tool_call_count+". Failures = the agent's tool errored; declined/blocked = you rejected it or a guardrail blocked it (heuristic split from the result text — not an API-reported distinction).",children:[t.tool_failure_count," failed",t.tool_rejection_count>0?` · ${t.tool_rejection_count} declined/blocked`:"",` of ${t.tool_call_count} tool calls`]}),s.jsx("span",{children:Z(t.duration_ms)}),s.jsx("span",{className:"muted",children:as(t.started_at)}),s.jsx(Hs,{id:t.id})]}),e.classification&&s.jsx(Ks,{c:e.classification}),e.findings&&e.findings.length>0&&s.jsx(Qs,{findings:e.findings,sessionId:t.id}),e.file_changes&&e.file_changes.length>0&&s.jsx(zs,{changes:e.file_changes,projectPath:t.project_path??null})]})}function Zs({search:e,turnCount:t,anyOpen:n,onToggleAll:a,hideTools:l,onToggleHideTools:c,format:r,onChooseFormat:i}){return s.jsxs(s.Fragment,{children:[e,s.jsxs("div",{className:"transcript-tools",children:[t>1&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"muted small",children:[t," turns"]}),s.jsx("button",{className:"ghost small",onClick:a,children:n?"Collapse all":"Expand all"})]}),s.jsxs("button",{className:"ghost small"+(l?" is-active":""),"aria-pressed":l,onClick:c,title:"Hide Bash/Edit/Skill and other tool calls — show only assistant answers, plans and questions",children:[l?"☑ ":"☐ ","Hide tool messages"]}),s.jsxs("div",{className:"format-toggle",role:"group","aria-label":"Message format",children:[s.jsx("button",{className:"ghost small"+(r==="markdown"?" is-active":""),"aria-pressed":r==="markdown",onClick:()=>i("markdown"),children:"Markdown"}),s.jsx("button",{className:"ghost small"+(r==="raw"?" is-active":""),"aria-pressed":r==="raw",onClick:()=>i("raw"),children:"Raw"})]})]})]})}const me=2,et={hits:[],byTurn:new Map,total:0};function is(e){var t;return[e.input_json,e.result_summary,(t=e.full_result)==null?void 0:t.text].filter(Boolean).join(`
2
+ `)}function os(e){const t=[];e.text&&t.push(e.text),e.thinking&&t.push(e.thinking);for(const n of e.toolCalls)t.push(is(n));return t.join(`
3
+ `).toLowerCase()}function st(e){return new Map(e.map(t=>[t.uuid,os(t)]))}function tt(e,t){let n=0;for(let a=e.indexOf(t);a!==-1;a=e.indexOf(t,a+t.length))n++;return n}function nt(e,t,n){const a=n.trim().toLowerCase();if(a.length<me)return et;const l=[],c=new Map;for(const r of e){const i=tt(t.get(r.uuid)??os(r),a);i&&(l.push({uuid:r.uuid,turnId:r.turn_id??null,count:i}),r.turn_id&&c.set(r.turn_id,(c.get(r.turn_id)??0)+1))}return{hits:l,byTurn:c,total:l.length}}function at(e,t){return Ae(is(e),t)}function Ae(e,t){const n=t.trim().toLowerCase();return!e||n.length<me?!1:e.toLowerCase().includes(n)}function cs(e,t,n){return a=>{if(a.key==="Escape"){a.preventDefault(),n();return}if(a.key==="Enter"){if(a.shiftKey){a.preventDefault(),e();return}a.target.tagName!=="BUTTON"&&(a.preventDefault(),t())}}}function lt({query:e,total:t,index:n,onPrev:a,onNext:l,onClear:c,onBackToBox:r}){return s.jsxs("div",{className:"search-nav",role:"group","aria-label":"Search matches",tabIndex:-1,onKeyDown:cs(a,l,c),children:[s.jsx("button",{type:"button",className:"ghost small sn-back","aria-label":"Back to the search box",onClick:r,children:"🔍"}),s.jsxs("span",{className:"sn-term",children:[s.jsx("span",{className:"sn-q",children:e}),s.jsxs("span",{className:"sn-pos",children:[n+1,"/",t]})]}),s.jsx("button",{type:"button",className:"ghost small","aria-label":"Previous match",onClick:a,children:"◂"}),s.jsx("button",{type:"button",className:"ghost small","aria-label":"Next match",onClick:l,children:"▸"}),s.jsx("button",{type:"button",className:"ghost small","aria-label":"Clear search",onClick:c,children:"✕"})]})}const rt=150;function it({query:e,onQuery:t,total:n,index:a,onPrev:l,onNext:c,inputRef:r}){const[i,h]=u.useState(e),f=u.useRef(0),p=u.useRef(null),[g,j]=u.useState(!0);u.useEffect(()=>{const b=p.current;if(!b||typeof IntersectionObserver>"u")return;const C=new IntersectionObserver(([D])=>j(D.isIntersecting));return C.observe(b),()=>C.disconnect()},[]);const E=u.useRef(e);E.current!==e&&(E.current=e,h(e)),u.useEffect(()=>()=>window.clearTimeout(f.current),[]);const x=b=>{h(b),window.clearTimeout(f.current),f.current=window.setTimeout(()=>t(b),rt)},S=()=>{var b;window.clearTimeout(f.current),h(""),t(""),(b=r.current)==null||b.focus()},I=i.trim().length>=me;return s.jsxs(s.Fragment,{children:[s.jsxs("form",{ref:p,className:"transcript-search",role:"search",onSubmit:b=>b.preventDefault(),onKeyDown:cs(l,c,S),children:[s.jsx("span",{className:"ts-icon","aria-hidden":"true",children:"🔍"}),s.jsx("input",{ref:r,type:"search","aria-label":"Find in this session",placeholder:"Find in session…",value:i,onChange:b=>x(b.target.value)}),s.jsx("span",{className:"ts-count muted small",role:"status","aria-live":"polite",children:I?n===0?"No matches":`${a+1} of ${n} message${n===1?"":"s"}`:""}),s.jsx("button",{type:"button",className:"ghost small","aria-label":"Previous match",disabled:n===0,onClick:l,children:"◂"}),s.jsx("button",{type:"button",className:"ghost small","aria-label":"Next match",disabled:n===0,onClick:c,children:"▸"}),i&&s.jsx("button",{type:"button",className:"ghost small","aria-label":"Clear search",onClick:S,children:"✕"})]}),n>0&&!g&&s.jsx(lt,{query:e,total:n,index:a,onPrev:l,onNext:c,onClear:S,onBackToBox:()=>{var b;return(b=r.current)==null?void 0:b.focus()}})]})}function ot({d:e}){const t=e.workflow_runs??[],n=e.children.filter(l=>!l.workflow_run_id),a=t.length>0;return s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Spawned subagents (",e.children.length,")"]}),t.map(l=>{const c=e.children.filter(r=>r.workflow_run_id===l.run_id);return s.jsxs("details",{className:"wf-run",children:[s.jsxs("summary",{children:[s.jsxs(W,{className:"wf-run-name",to:`/workflow/${l.run_id}`,onClick:r=>r.stopPropagation(),children:["🔀 ",l.name||"workflow"," →"]}),l.status&&s.jsx("span",{className:"tag task-status task-status-"+l.status.toLowerCase(),children:l.status}),s.jsxs("span",{className:"muted small",children:[c.length," agent",c.length===1?"":"s",l.turn_seq!=null?` · turn ${l.turn_seq+1}`:""," · ",s.jsx("code",{children:l.run_id})]})]}),s.jsx("ul",{children:c.map(r=>s.jsx(Me,{a:r},r.id))})]},l.run_id)}),n.length>0&&(a?s.jsxs("details",{className:"wf-run",open:!0,children:[s.jsxs("summary",{children:[s.jsx("span",{className:"wf-run-name",children:"Task / Agent"}),s.jsxs("span",{className:"muted small",children:[n.length," subagent",n.length===1?"":"s"]})]}),s.jsx("ul",{children:n.map(l=>s.jsx(Me,{a:l},l.id))})]}):s.jsx("ul",{children:n.map(l=>s.jsx(Me,{a:l},l.id))}))]})}const ct="command-name",dt="command-args",ut="local-command-caveat",ht=["local-command-stdout","local-command-stderr","command-output"],mt="task-notification",ft="task-id",pt="tool-use-id",xt="status",gt="summary",Ge=ht.join("|");function ce(e,t){var n,a;return((a=(n=e.match(new RegExp(`<${t}>([\\s\\S]*?)</${t}>`)))==null?void 0:n[1])==null?void 0:a.trim())??null}function jt(e){var t,n;return((n=(t=e.match(new RegExp(`<(?:${Ge})>([\\s\\S]*?)</(?:${Ge})>`)))==null?void 0:t[1])==null?void 0:n.trim())??null}function We(e,t){const n=e===""?[]:e.split(`
4
+ `),a=t===""?[]:t.split(`
5
+ `),l=n.length,c=a.length;if(l*c>25e4)return[...n.map(p=>({type:"del",text:p})),...a.map(p=>({type:"add",text:p}))];const r=Array.from({length:l+1},()=>new Array(c+1).fill(0));for(let p=l-1;p>=0;p--)for(let g=c-1;g>=0;g--)r[p][g]=n[p]===a[g]?r[p+1][g+1]+1:Math.max(r[p+1][g],r[p][g+1]);const i=[];let h=0,f=0;for(;h<l&&f<c;)n[h]===a[f]?(i.push({type:"ctx",text:n[h]}),h++,f++):r[h+1][f]>=r[h][f+1]?(i.push({type:"del",text:n[h]}),h++):(i.push({type:"add",text:a[f]}),f++);for(;h<l;)i.push({type:"del",text:n[h++]});for(;f<c;)i.push({type:"add",text:a[f++]});return i}function ds(e){if(!e)return null;try{const t=JSON.parse(e).plan;return typeof t=="string"&&t.trim()?t:null}catch{return null}}function Nt(e){if(!e)return[];try{const t=JSON.parse(e).questions;return Array.isArray(t)?t:[]}catch{return[]}}function wt(e){if(!e)return{answers:{},annotations:{}};try{const t=JSON.parse(e);if(t&&typeof t=="object"&&t.answers)return{answers:t.answers,annotations:t.annotations??{}}}catch{}return{answers:{},annotations:{}}}function kt(e){if(!e)return null;try{const t=JSON.parse(e);if(!t||typeof t!="object")return null;const n=typeof t.command=="string"?t.command:"";return n.trim()?{command:n,description:typeof t.description=="string"?t.description:void 0,timeout:typeof t.timeout=="number"?t.timeout:void 0,run_in_background:t.run_in_background===!0,restart:t.restart===!0}:null}catch{return null}}function _t(e,t){if(!t)return null;try{const n=JSON.parse(t);if(!n||typeof n!="object"||typeof n.file_path!="string")return null;let a;if(e==="Write"){if(typeof n.content!="string")return null;a=[n.content===""?[]:n.content.split(`
6
+ `).map(r=>({type:"add",text:r}))]}else if(e==="MultiEdit"){if(!Array.isArray(n.edits)||(a=n.edits.filter(r=>{const i=r;return!!i&&typeof i.old_string=="string"&&typeof i.new_string=="string"}).map(r=>We(r.old_string,r.new_string)),a.length===0))return null}else{if(typeof n.old_string!="string"||typeof n.new_string!="string")return null;a=[We(n.old_string,n.new_string)]}let l=0,c=0;for(const r of a)for(const i of r)i.type==="add"?l++:i.type==="del"&&c++;return{file_path:n.file_path,kind:e,hunks:a,adds:l,dels:c}}catch{return null}}function bt(e){const t=e.lastIndexOf("/");return t>=0?{dir:e.slice(0,t+1),base:e.slice(t+1)}:{dir:"",base:e}}function us(e){const t=ce(e,ct);if(t){const a=ce(e,dt)??"";return{kind:"invocation",name:t.startsWith("/")?t:`/${t}`,args:a}}const n=jt(e);return n!=null?{kind:"output",stdout:n}:e.includes(`<${ut}>`)?{kind:"caveat"}:null}function hs(e){return e.includes(`<${mt}>`)?{taskId:ce(e,ft),toolUseId:ce(e,pt),status:ce(e,xt),summary:ce(e,gt)}:null}function vt(e){const t=us(e);if((t==null?void 0:t.kind)==="invocation")return`⌘ ${t.name}${t.args?" "+t.args:""}`;if((t==null?void 0:t.kind)==="output")return"⌘ command output";if((t==null?void 0:t.kind)==="caveat")return"⌘ local command";const n=hs(e);return n?`🔔 task ${n.status??"notification"}`:e}const ms=u.createContext("markdown"),fs=u.createContext(new Map),ps=u.createContext(!1),xs=u.createContext(null),gs=u.createContext(null),$e=u.createContext({query:"",activeUuid:null});function yt({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 Mt({n:e}){const t=u.useContext(fs),n=e.toolUseId?t.get(e.toolUseId):void 0,a=(e.status??"").toLowerCase();return s.jsxs("div",{className:"task-notif",children:[s.jsxs("div",{className:"task-notif-head",children:[s.jsx("span",{className:"task-notif-icon","aria-hidden":"true",children:"🔔"}),e.status&&s.jsx("span",{className:"tag task-status task-status-"+a,children:e.status}),e.taskId&&s.jsxs("code",{className:"task-notif-id",children:["task ",e.taskId]}),n&&s.jsx(W,{className:"subagent-link small",to:`/workflow/${n}`,children:"view workflow →"})]}),e.summary&&s.jsx("div",{className:"task-notif-summary",children:e.summary})]})}function Je({text:e,id:t}){return u.useContext(ms)==="raw"?s.jsx("div",{className:"text",id:t,children:e}):s.jsx("div",{className:"text md",id:t,children:s.jsx(qs,{remarkPlugins:[Bs],components:St,children:e})})}const St={a:({node:e,...t})=>s.jsx("a",{...t,target:"_blank",rel:"noopener noreferrer"})};function js({text:e,uuid:t}){const n=e.length>1400||e.split(`
7
+ `).length>18,[a,l]=u.useState(!1),c=u.useContext($e),r=u.useId();if(!n)return s.jsx(Je,{text:e});const i=a||!!t&&c.activeUuid===t&&Ae(e,c.query);return s.jsxs("div",{className:"text-wrap"+(i?"":" is-clamped"),children:[s.jsx(Je,{text:e,id:r}),s.jsx("button",{className:"ghost small show-more","aria-expanded":i,"aria-controls":r,onClick:()=>l(!i),children:i?"Show less ▴":"Show more ▾"})]})}function Ns({t:e}){const[t,n]=u.useState(!1),[a,l]=u.useState(!1),c=u.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":t,"aria-controls":c,onClick:()=>n(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:Z(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:t?"▾":"▸"})]}),e.spawned_session_id&&s.jsx(W,{className:"subagent-link small",to:`/session/${e.spawned_session_id}`,children:"view subagent transcript →"}),e.workflow_run_id&&s.jsxs(W,{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(W,{className:"subagent-link small",to:`/skill/${encodeURIComponent(e.skill_name)}${e.skill_id?`?v=${e.skill_id}`:""}`,children:["📖 view skill",e.skill_id?" version":""," →"]}),t&&s.jsxs("div",{className:"tool-body",id:c,children:[e.input_json&&e.input_json!=="{}"&&s.jsxs("div",{className:"code-block",children:[s.jsx(X,{text:Q(e.input_json),className:"copy-corner",title:"Copy tool input JSON"}),s.jsx("pre",{className:"code",children:Q(e.input_json)})]}),e.result_summary&&s.jsx("div",{className:"result",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":a,onClick:()=>l(i=>!i),children:[a?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),a&&s.jsxs("div",{className:"code-block",children:[s.jsx(X,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]})]})]})}function Ct({plan:e}){return s.jsxs("div",{className:"plan-card",children:[s.jsx("div",{className:"plan-card-head",children:"📋 Approved plan"}),s.jsx(js,{text:e})]})}function Tt({t:e}){const[t,n]=u.useState(!1),a=u.useId(),l=Nt(e.input_json),{answers:c,annotations:r}=wt(e.result_summary);return l.length===0?s.jsx(Ns,{t:e}):s.jsxs("div",{className:"qa-card",children:[s.jsxs("div",{className:"qa-card-head",children:["🙋 Question",l.length===1?"":"s"," for the user"]}),l.map((i,h)=>{var S;const f=c[i.question],p=Array.isArray(f)?f:f!=null?[f]:[],g=new Set(p),j=new Set(i.options.map(I=>I.label)),E=p.filter(I=>!j.has(I)),x=(S=r[i.question])==null?void 0:S.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((I,b)=>{const C=g.has(I.label);return s.jsxs("li",{className:"qa-opt"+(C?" is-selected":""),children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:C?"☑":"☐"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:I.label}),I.description&&s.jsx("span",{className:"qa-opt-desc muted",children:I.description})]})]},b)}),E.map((I,b)=>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:I}),s.jsx("span",{className:"qa-opt-desc muted",children:"custom answer"})]})]},"c"+b))]}),x&&s.jsxs("div",{className:"qa-note",children:["📝 ",x]})]},h)}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":t,"aria-controls":a,onClick:()=>n(i=>!i),children:t?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(X,{text:Q(e.input_json??"{}")+(e.result_summary?`
8
+
9
+ `+Q(e.result_summary):""),label:"JSON",title:"Copy raw question JSON"})]}),t&&s.jsxs("pre",{id:a,className:"code",children:[Q(e.input_json??"{}"),e.result_summary?`
10
+
11
+ `+Q(e.result_summary):""]})]})}function Et({t:e}){const t=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:["🔀 ",t]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status})]}),e.workflow_run_id&&s.jsxs(W,{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 Ve(e,t,n){let a=t+2,l=!1;for(e[a]==="-"&&(l=!0,a++);e[a]===" "||e[a]===" ";)a++;let c="";(e[a]==="'"||e[a]==='"')&&(c=e[a],a++);let r="";if(c){for(;a<e.length&&e[a]!==c;)r+=e[a++];e[a]===c&&a++}else for(;a<e.length&&/[A-Za-z0-9_]/.test(e[a]);)r+=e[a++];return r&&n.push({delim:r,strip:l}),a-1}function It(e){const t=e.split(`
12
+ `),n=[];let a="NORMAL",l=0;const c=[];let r=!1;for(const i of t){if(c.length>0){n.push({text:i,cont:!0});const h=c[0];(h.strip?i.replace(/^\t+/,""):i).trimEnd()===h.delim&&c.shift();continue}n.push({text:i,cont:a!=="NORMAL"||l>0||r}),r=!1;for(let h=0;h<i.length;h++){const f=i[h];if(a==="SQUOTE"){f==="'"&&(a="NORMAL");continue}if(a==="DQUOTE"){f==="\\"?h++:f==='"'?a="NORMAL":f==="$"&&i[h+1]==="("?(l++,h++):f===")"?l>0&&l--:f==="<"&&i[h+1]==="<"&&i[h+2]!=="<"&&i[h-1]!=="<"&&(h=Ve(i,h,c));continue}if(f==="\\")h++;else if(f==="'")a="SQUOTE";else if(f==='"')a="DQUOTE";else{if(f==="#"&&(h===0||/\s/.test(i[h-1])))break;f==="$"&&i[h+1]==="("?(l++,h++):f==="("?l++:f===")"?l>0&&l--:f==="<"&&i[h+1]==="<"&&i[h+2]!=="<"&&i[h-1]!=="<"&&(h=Ve(i,h,c))}}if(a==="NORMAL"&&l===0&&c.length===0){const h=i.replace(/\s+$/,""),f=h.match(/\\+$/);(f&&f[0].length%2===1||/(&&|\|\||\|)$/.test(h))&&(r=!0)}}return n}function Ot({t:e,bash:t}){const[n,a]=u.useState(!1),[l,c]=u.useState(!1),[r,i]=u.useState(!1),h=u.useId(),f=u.useId(),p=t.command.split(`
13
+ `)[0],g=It(t.command);return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":n,"aria-controls":h,onClick:()=>a(j=>!j),children:[s.jsx("span",{className:"tool-name",children:"🖥 Bash"}),t.description?s.jsxs("span",{className:"bash-desc",children:["# ",t.description]}):!n&&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:Z(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&s.jsxs("div",{className:"tool-body",id:h,children:[s.jsxs("div",{className:"shell code-block",children:[s.jsx(X,{text:t.command,className:"copy-corner",title:"Copy command"}),s.jsx("pre",{className:"shell-cmd",children:g.map((j,E)=>s.jsxs("span",{children:[s.jsx("span",{className:"shell-gutter"+(j.cont?" cont":""),"aria-hidden":"true",children:j.cont?" ":"$ "}),j.text,E<g.length-1?`
14
+ `:""]},E))})]}),(t.run_in_background||t.restart||t.timeout!=null)&&s.jsxs("div",{className:"bash-badges",children:[t.run_in_background&&s.jsx("span",{className:"bash-badge",children:"background"}),t.restart&&s.jsx("span",{className:"bash-badge",children:"restart"}),t.timeout!=null&&s.jsxs("span",{className:"bash-badge",children:["timeout ",Math.round(t.timeout/1e3),"s"]})]}),e.result_summary&&s.jsx("pre",{className:"shell-out",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":l,onClick:()=>c(j=>!j),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(X,{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":f,onClick:()=>i(j=>!j),children:r?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(X,{text:Q(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),r&&s.jsx("pre",{id:f,className:"code",children:Q(e.input_json??"{}")})]})]})}const At={Edit:"✏️",MultiEdit:"✏️",Write:"📄"},Ce=400;function $t({t:e,edit:t}){const[n,a]=u.useState(!1),[l,c]=u.useState(!1),[r,i]=u.useState(!1),h=u.useId(),f=u.useId(),{dir:p,base:g}=bt(t.file_path);return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":n,"aria-controls":h,onClick:()=>a(j=>!j),children:[s.jsxs("span",{className:"tool-name",children:[At[t.kind]??"✏️"," ",t.kind]}),s.jsxs("span",{className:"edit-path",children:[s.jsx("span",{className:"base",children:g}),p&&s.jsx("span",{className:"dir",children:p.replace(/\/$/,"")})]}),s.jsxs("span",{className:"diff-stat",children:[t.adds>0&&s.jsxs("span",{className:"add",children:["+",t.adds]}),t.dels>0&&s.jsxs("span",{className:"del",children:["−",t.dels]})]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:Z(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&s.jsxs("div",{className:"tool-body",id:h,children:[t.hunks.map((j,E)=>s.jsxs("div",{className:"diff",children:[t.hunks.length>1&&s.jsxs("div",{className:"diff-hunk-sep",children:["edit ",E+1]}),j.slice(0,Ce).map((x,S)=>s.jsxs("div",{className:"diff-line "+x.type,children:[s.jsx("span",{className:"diff-sign","aria-hidden":"true",children:x.type==="add"?"+":x.type==="del"?"−":" "}),s.jsx("span",{className:"diff-text",children:x.text===""?" ":x.text})]},S)),j.length>Ce&&s.jsxs("div",{className:"diff-more",children:["… ",j.length-Ce," more lines — View raw JSON for the rest"]})]},E)),e.result_summary&&s.jsx("pre",{className:"shell-out",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":l,onClick:()=>c(j=>!j),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(X,{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":f,onClick:()=>i(j=>!j),children:r?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(X,{text:Q(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),r&&s.jsx("pre",{id:f,className:"code",children:Q(e.input_json??"{}")})]})]})}function Rt({t:e,hideTools:t}){const n=e.findings??[],a=t&&n.length===0,l=Dt(e,a);return n.length===0?l:s.jsxs(s.Fragment,{children:[l,s.jsx(Vs,{findings:n})]})}function Dt(e,t){if(e.tool_name==="ExitPlanMode"){const n=ds(e.input_json);if(n)return s.jsx(Ct,{plan:n})}if(e.tool_name==="AskUserQuestion")return s.jsx(Tt,{t:e});if(e.tool_name==="Workflow")return s.jsx(Et,{t:e});if(e.tool_name==="Bash"){const n=kt(e.input_json);if(n)return t?null:s.jsx(Ot,{t:e,bash:n})}if(e.tool_name==="Edit"||e.tool_name==="MultiEdit"||e.tool_name==="Write"){const n=_t(e.tool_name,e.input_json);if(n)return t?null:s.jsx($t,{t:e,edit:n})}return t?null:s.jsx(Ns,{t:e})}function Ft(e,t){return e.findings&&e.findings.length||e.tool_name==="AskUserQuestion"||e.tool_name==="Workflow"||e.tool_name==="ExitPlanMode"&&ds(e.input_json)?!0:!t}function ws({e}){const[t,n]=u.useState(!1),a=u.useId(),l=u.useContext(ps),c=u.useContext(xs),r=u.useContext($e),i=u.useContext(gs),h=t||r.activeUuid===e.uuid&&Ae(e.thinking,r.query),f=e.role||e.type,p=f==="user"?"👤":f==="assistant"?"🤖":"⚙️",g=b=>i===e.uuid||r.activeUuid===e.uuid&&at(b,r.query),j=e.toolCalls.filter(b=>Ft(b,l)||g(b));if(!(e.text||e.thinking||j.length))return null;const x=e.text?us(e.text):null,S=e.text&&!x?hs(e.text):null,I=e.text||e.thinking||"";return s.jsxs("div",{id:"ev-"+e.uuid,className:"event ev-"+f+(c===e.uuid?" ev-flagged":""),children:[s.jsxs("div",{className:"ev-meta",children:[s.jsxs("span",{className:"ev-who",children:[p," ",f]}),e.model&&s.jsx("span",{className:"tag",children:Is(e.model)}),e.is_sidechain?s.jsx("span",{className:"tag subagent",children:"subagent"}):null,e.usage&&s.jsxs("span",{className:"muted ev-tokens",title:ns(e.usage),children:[oe(Ee(e.usage))," tok"]}),s.jsx("span",{className:"muted ev-time",children:as(e.timestamp)}),I&&s.jsx(X,{text:I,className:"ev-copy copy-hover",title:"Copy message"})]}),e.thinking&&s.jsxs("div",{className:"thinking",children:[s.jsxs("button",{className:"thinking-toggle","aria-expanded":h,"aria-controls":a,onClick:()=>n(!h),children:["🧠 thinking ",h?"▾":"▸"]}),h&&s.jsxs("div",{className:"code-block",children:[s.jsx(X,{text:e.thinking,className:"copy-corner",title:"Copy thinking"}),s.jsx("pre",{id:a,className:"thinking-body",children:e.thinking})]})]}),e.text&&(x?s.jsx(yt,{cmd:x}):S?s.jsx(Mt,{n:S}):s.jsx(js,{text:e.text,uuid:e.uuid})),j.map((b,C)=>s.jsx(Rt,{t:b,hideTools:l&&!g(b)},C))]})}function Lt({turn:e,events:t,matches:n=0,total:a,open:l,onToggle:c}){const r=u.useId();return s.jsxs("section",{className:"turn"+(l?" is-open":""),children:[s.jsxs("button",{className:"turn-head","aria-expanded":l,"aria-controls":r,onClick:c,children:[s.jsx("span",{className:"chev turn-chev","aria-hidden":"true",children:l?"▾":"▸"}),s.jsxs("span",{className:"turn-no",children:["turn ",e.seq+1]}),e.prompt_preview?s.jsx("span",{className:"turn-preview",children:vt(e.prompt_preview)}):null,n>0&&s.jsx("span",{className:"turn-matches",title:`${n} message${n===1?"":"s"} match the search`,children:n}),s.jsxs("span",{className:"turn-stats muted",children:[a!=null&&a>t.length?`${t.length} of ${a}`:t.length," msg",(a??t.length)===1?"":"s",e.duration_ms?" · "+Z(e.duration_ms):""]})]}),s.jsx("div",{id:r,className:"turn-body",role:"region","aria-label":`turn ${e.seq+1} messages`,children:l&&t.map(i=>s.jsx(ws,{e:i},i.uuid))})]})}function Pt(e,t){const n=new Map(t.map(l=>[l.id,l])),a=[];for(const l of e){const c=l.turn_id??null,r=a[a.length-1];r&&r.turnId===c?r.events.push(l):a.push({turnId:c,turn:c?n.get(c)??null:null,events:[l]})}return a}function qt(e){const{data:t,error:n}=Os("/sessions/"+e,{reset:!0}),a=u.useMemo(()=>{const l=new Map;for(const c of(t==null?void 0:t.events)??[])for(const r of c.toolCalls)r.tool_name==="Workflow"&&r.id&&r.workflow_run_id&&l.set(r.id,r.workflow_run_id);return l},[t]);return{d:t,error:n,wfMap:a}}const Te="al-search";function Bt(e,t){u.useEffect(()=>{const n=e.current,a=CSS==null?void 0:CSS.highlights,l=globalThis.Highlight;if(!n||!a||!l)return;const c=t.trim().toLowerCase();let r=0;const i=()=>{var g;if(r=0,a.delete(Te),c.length<me)return;const f=[],p=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(let j=p.nextNode();j;j=p.nextNode()){const E=(g=j.nodeValue)==null?void 0:g.toLowerCase();if(E)for(let x=E.indexOf(c);x!==-1;x=E.indexOf(c,x+c.length)){const S=new Range;S.setStart(j,x),S.setEnd(j,x+c.length),f.push(S)}}f.length&&a.set(Te,new l(...f))};i();const h=new MutationObserver(()=>{r||(r=requestAnimationFrame(i))});return h.observe(n,{childList:!0,subtree:!0,characterData:!0}),()=>{h.disconnect(),r&&cancelAnimationFrame(r),a.delete(Te)}},[e,t])}function Ut(e,t,n,a,l){const[c,r]=u.useState(null);u.useEffect(()=>{var f;const h=t?(f=e==null?void 0:e.find(p=>p.uuid===t))==null?void 0:f.turn_id:null;h&&l(p=>{if(!p.has(h))return p;const g=new Set(p);return g.delete(h),g})},[e,t,n,l]);const i=u.useRef(null);return u.useEffect(()=>{var g;if(!e||!t||!n){i.current=null;return}if(i.current===n)return;const h=document.getElementById("ev-"+t);if(!h)return;i.current=n;const f=((g=window.matchMedia)==null?void 0:g.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;h.scrollIntoView({block:"center",behavior:f?"auto":"smooth"}),r(t);const p=window.setTimeout(()=>r(null),3e3);return()=>window.clearTimeout(p)},[e,t,n,a]),c}const Re="msgFormat",De="hideTools",Fe="timelineAxis",Le="timelineMetric";function ve(e){const t=As(e,null);if(t!=null)return t;try{return localStorage.getItem("agentlens."+e)}catch{return null}}const ks=e=>e==="raw"?"raw":"markdown",_s=e=>e===!0||e===1||e==="1",bs=e=>e==="literal"?"literal":"compressed",vs=e=>e==="output"||e==="total"?e:"work";function Ht(){return ks(ve(Re))}function Kt(){return _s(ve(De))}function Gt(e){be(Re,e)}function Wt(e){be(De,e)}function Jt(){return bs(ve(Fe))}function Vt(){return vs(ve(Le))}function Qt(e){be(Fe,e)}function Xt(e){be(Le,e)}async function zt(){const[e,t,n,a]=await Promise.all([ke(Re),ke(De),ke(Fe),ke(Le)]);return{...e!=null?{format:ks(e)}:{},...t!=null?{hideTools:_s(t)}:{},...n!=null?{axisMode:bs(n)}:{},...a!=null?{metric:vs(a)}:{}}}const Qe=6e4,Xe=14,ze=3e4,Yt=4,Zt=3,en=.5;function sn(e){if(!e)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}const Ye=(e,t,n)=>e<t?t:e>n?n:e;function tn(e,t){var y;const n=t.gapMs??Qe,a=Math.max(t.width,0),l=e.map(m=>({uuid:m.uuid,t:sn(m.timestamp)})).filter(m=>m.t!==null).filter(m=>!t.domain||m.t>=t.domain[0]&&m.t<=t.domain[1]).sort((m,k)=>m.t-k.t);if(l.length===0)return nn(a);const c=[],r=[],i=[];let h=0;for(let m=1;m<l.length;m++){const k=l[m].t-l[m-1].t;if(!(k<=n)){if((y=t.expandedGaps)!=null&&y.has(l[m-1].t)){i.push({t0:l[m-1].t,t1:l[m].t,durationMs:k});continue}c.push({from:h,to:m-1}),r.push(k),h=m}}c.push({from:h,to:l.length-1});const f=l[0].t,p=l[l.length-1].t,g=f===p,j=c.map(({from:m,to:k})=>g?{t0:l[m].t-ze,t1:l[k].t+ze}:{t0:l[m].t,t1:l[k].t}),E=Math.min(r.length*Xe,a),x=Math.max(a-E,0),S=j.map(m=>Math.max(m.t1-m.t0,0)),I=S.reduce((m,k)=>m+k,0),b=c.length?x*en/c.length:0,C=c.map(m=>Math.max(Yt,(m.to-m.from+1)*Zt,b)),D=C.reduce((m,k)=>m+k,0),z=Math.max(x-D,0),Y=D<=x?C.map((m,k)=>m+(I>0?S[k]/I*z:z/c.length)):C.map(m=>m/(D||1)*x),M=[],$=[];let U=0;for(let m=0;m<c.length;m++){const k=Y[m];if(M.push({t0:j[m].t0,t1:j[m].t1,x0:U,x1:U+k}),U+=k,m<r.length){const R=Math.min(Xe,Math.max(a-U,0));$.push({afterSegment:m,t0:j[m].t1,t1:j[m+1].t0,x0:U,x1:U+R,durationMs:r[m]}),U+=R}}const te=l.map((m,k)=>{const R=l[k+1];if(!R)return{...m,durationMs:0};const v=R.t-m.t;return{...m,durationMs:v>n?0:v}}),G=M[0].t0,q=M[M.length-1].t1,J=m=>{const k=Ye(m,G,q);for(let R=0;R<M.length;R++){const v=M[R];if(k<=v.t1||R===M.length-1)return k<v.t0?v.x0:v.t1===v.t0?(v.x0+v.x1)/2:v.x0+(k-v.t0)/(v.t1-v.t0)*(v.x1-v.x0)}return M[M.length-1].x1},H=m=>{const k=Ye(m,0,U);for(let R=0;R<M.length;R++){const v=M[R];if(k<=v.x1||R===M.length-1){if(k<v.x0){const V=$[R-1];return k-V.x0<V.x1-k?V.t0:V.t1}return v.x1===v.x0?v.t0:v.t0+(k-v.x0)/(v.x1-v.x0)*(v.t1-v.t0)}}return q},B=r.reduce((m,k)=>m+k,0),ee=i.map(m=>({...m,x0:J(m.t0),x1:J(m.t1)}));let T=0;for(let m=1;m<l.length;m++)l[m].t-l[m-1].t>Qe&&T++;return{points:te,segments:M,breaks:$,expanded:ee,width:a,domain:[f,p],spanMs:p-f,activeMs:Math.max(p-f-B,0),idleMs:B,collapsibleGaps:T,degenerate:g,x:J,t:H}}function nn(e){return{points:[],segments:[],breaks:[],expanded:[],width:e,domain:null,spanMs:0,activeMs:0,idleMs:0,collapsibleGaps:0,degenerate:!0,x:()=>0,t:()=>0}}function an(e){return e.toolCalls.some(t=>t.status==="error")?"tool-error":e.toolCalls.length?"tool":e.thinking&&!e.text?"thinking":e.role==="user"?"user":e.role==="assistant"?"assistant":"meta"}function ln(e,t){return e.usage?t==="output"?e.usage.output:t==="total"?Ee(e.usage)+e.usage.cache_read:Ee(e.usage):0}function rn(e){return e.usage?e.usage.input+e.usage.cache_creation+e.usage.cache_read:0}const Ze=["critical","high","medium","low","info"];function on({events:e,points:t,findings:n,fileChanges:a,turnSeqById:l,metric:c}){const r=new Map(e.map(p=>[p.uuid,p])),i=new Map;for(const p of n??[]){if(!p.event_uuid)continue;const g=i.get(p.event_uuid);(!g||Ze.indexOf(p.severity)<Ze.indexOf(g))&&i.set(p.event_uuid,p.severity)}const h=new Map;for(const p of a??[])p.event_uuid&&h.set(p.event_uuid,(h.get(p.event_uuid)??0)+1);const f=[];for(const p of t){const g=r.get(p.uuid);if(!g)continue;const j=g.turn_id!=null?l==null?void 0:l.get(g.turn_id):void 0;f.push({uuid:p.uuid,kind:an(g),turnSeq:j==null?null:j+1,t:p.t,durationMs:p.durationMs,value:ln(g,c),context:rn(g),error:g.toolCalls.some(E=>E.status==="error"),finding:i.get(p.uuid)??null,fileChange:(h.get(p.uuid)??0)>0,fileChangeCount:h.get(p.uuid)??0,spawn:g.toolCalls.some(E=>E.spawned_session_id)})}return f}function cn(e){return e.some(t=>t.usage)}const L=44,Ie=6,ys=3,dn=L+ys+Ie,un=2,Ms=3,es=3;function hn(){const e=u.useRef(null),[t,n]=u.useState(0);return u.useEffect(()=>{if(!e.current||typeof ResizeObserver>"u")return;const a=new ResizeObserver(([l])=>n(l.contentRect.width));return a.observe(e.current),()=>a.disconnect()},[]),[e,t]}const mn=[{kind:"user",label:"user"},{kind:"assistant",label:"assistant"},{kind:"thinking",label:"thinking"},{kind:"tool",label:"tool"}];function ss(e,t){return t?`${Z(e)} before your next message`:`${Z(e)} mid-turn`}function Oe(e,t){const n=t.x(e.t),a=e.kind==="user"||e.kind==="meta";return{x:n,w:a?Ms:Math.max(un,t.x(e.t+e.durationMs)-n-1)}}const ts=3,fn=12;function pn(e){const{events:t,findings:n,fileChanges:a,userPromptUuids:l,turnSeqById:c,axisMode:r,onAxisMode:i,metric:h,onMetric:f}=e,{range:p,onRange:g,onJump:j,domain:E,onDomain:x}=e,[S,I]=hn(),b=u.useRef(null),[C,D]=u.useState(null),[z,Y]=u.useState(()=>new Set),[M,$]=u.useState(0),[U,te]=u.useState(null),[G,q]=u.useState(null),{TIMELINE_COLORS:J,C:H}=Us(),B=cn(t);u.useEffect(()=>{if(!p)return;const o=N=>{if(N.key!=="Escape"||N.defaultPrevented)return;const _=N.target;_&&(_.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(_.tagName))||g(null)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[p,g]);const ee=B?h:"work",T=tn(t,{width:I,gapMs:r==="literal"?1/0:void 0,...E?{domain:E}:{},expandedGaps:z}),y=on({events:t,points:T.points,findings:n,fileChanges:a,turnSeqById:c,metric:ee}),m=p&&!T.degenerate?[T.x(p[0]),T.x(p[1])]:null,k=6,R=o=>m?Math.abs(o-m[0])<=k?"start":Math.abs(o-m[1])<=k?"end":null:null,v=o=>o==="start"?m[1]:m[0],V=(o,N)=>{const[_,O]=o<=N?[o,N]:[N,o];return[T.t(_),T.t(O)]},fe=o=>{let N=null;return y.forEach((_,O)=>{const{x:A,w:K}=Oe(_,T),F=o<A?A-o:o>A+K?o-(A+K):0;(!N||F<N.d)&&(N={uuid:_.uuid,d:F,i:O,x:A,w:K})}),N},P=y[Math.min(M,y.length-1)]??null,de=P?[`message ${Math.min(M,y.length-1)+1} of ${y.length}`,P.kind==="tool-error"?"tool error":P.kind,B&&P.value>0?`${oe(P.value)} tokens`:null,new Date(P.t).toLocaleTimeString(),P.finding?`${P.finding} security finding`:null,P.fileChange?"changed files":null].filter(Boolean).join(", "):"",ne=(o,N)=>{const _=Math.max(0,Math.min(o,y.length-1));if($(_),!N){te(null);return}const O=U??Math.min(M,y.length-1);te(O);const[A,K]=O<=_?[O,_]:[_,O];g([y[A].t,y[K].t])},le=o=>{if(y.length)switch(o.key){case"ArrowLeft":o.preventDefault(),ne(M-1,o.shiftKey);break;case"ArrowRight":o.preventDefault(),ne(M+1,o.shiftKey);break;case"Home":o.preventDefault(),ne(0,o.shiftKey);break;case"End":o.preventDefault(),ne(y.length-1,o.shiftKey);break;case"Enter":case" ":o.preventDefault(),P&&j(P.uuid);break}},ae=o=>{var _;const N=(_=b.current)==null?void 0:_.getBoundingClientRect();return N?o.clientX-N.left:0},pe=o=>{if(o.button!==0||T.degenerate)return;const N=ae(o),_=R(N),O={x:N,pointerId:o.pointerId,captured:!1};D(_?{kind:_,anchor:v(_),...O}:{kind:"new",anchor:N,...O})},xe=o=>{var A,K;const N=ae(o);if(!C){const F=fe(N);q(F&&F.d<=fn?{uuid:F.uuid,x:F.x,w:F.w}:null);return}const _=N,O=Math.abs(_-C.anchor)>=ts;O&&!C.captured&&((K=(A=o.currentTarget).setPointerCapture)==null||K.call(A,C.pointerId)),D({...C,x:_,captured:C.captured||O}),O&&g(V(C.anchor,_))},ge=o=>{var _,O,A,K,F,Pe;if(!C)return;const N=ae(o);if(C.captured&&((O=(_=o.currentTarget).hasPointerCapture)!=null&&O.call(_,C.pointerId))&&((K=(A=o.currentTarget).releasePointerCapture)==null||K.call(A,C.pointerId)),D(null),Math.abs(N-C.anchor)<ts){const Ss=(Pe=(F=o.target)==null?void 0:F.closest)==null?void 0:Pe.call(F,".tl-break, .tl-expanded");if(C.kind==="new"&&!Ss){const qe=fe(N);qe&&j(qe.uuid)}return}g(V(C.anchor,N))};if(t.length===0)return null;if(!T.domain)return s.jsx("div",{className:"timeline",ref:S,children:s.jsx("div",{className:"tl-caption muted",children:"No timing data for this session."})});const je=[`${T.points.length} message${T.points.length===1?"":"s"}`,T.spanMs>0?`${Z(T.spanMs)} span`:null,T.breaks.length?`${T.breaks.length} break${T.breaks.length===1?"":"s"}`:null].filter(Boolean).join(" · "),re=Math.max(0,...y.map(o=>o.context)),ue=re>0?y.filter(o=>o.context>0).map(o=>`${Oe(o,T).x.toFixed(1)},${(L-o.context/re*L).toFixed(1)}`).join(" "):"",se=y.map(o=>o.value).filter(o=>o>0).sort((o,N)=>o-N),ie=se.length?se[Math.min(Math.floor(se.length*.95),se.length-1)]:0,Ne=o=>!B||ie<=0?L*.6:o<=0?es:Math.max(es,Math.min(1,Math.sqrt(o)/Math.sqrt(ie))*L),we=new Set(y.map(o=>o.kind)),he=G?y.find(o=>o.uuid===G.uuid):void 0,d=G&&he?{mark:he,x:G.x,w:G.w}:null,w=o=>o==="tool-error"?J.toolError:o==="meta"?H.muted:J[o];return s.jsxs("div",{className:"timeline",ref:S,children:[s.jsxs("div",{className:"tl-head",children:[B&&s.jsxs("label",{className:"tl-ctl",children:[s.jsx("span",{className:"sr-only",children:"Mark height metric"}),s.jsxs("select",{value:h,onChange:o=>f(o.target.value),children:[s.jsx("option",{value:"work",children:"work tokens"}),s.jsx("option",{value:"output",children:"output tokens"}),s.jsx("option",{value:"total",children:"total (incl. cache read)"})]})]}),T.collapsibleGaps>0&&s.jsxs("button",{type:"button",className:"link-btn tl-axis",onClick:()=>i(r==="compressed"?"literal":"compressed"),title:r==="compressed"?"Idle gaps are collapsed. Switch to literal wall-clock.":"Literal wall-clock. Switch to collapsed idle gaps.",children:["time ⇄ ",r]}),s.jsx("span",{className:"tl-caption muted",children:je})]}),I>0&&s.jsxs("svg",{ref:b,className:"tl-svg"+(C?" is-dragging":""),width:I,height:dn,role:"group","aria-label":`Session timeline: ${je}. Use the arrow keys to move between messages, Enter to open one, Shift with the arrows to select a range.`,tabIndex:0,onKeyDown:le,onFocus:()=>$(o=>Math.min(o,Math.max(y.length-1,0))),onPointerDown:pe,onPointerMove:xe,onPointerUp:ge,onPointerCancel:ge,onPointerLeave:()=>q(null),children:[T.breaks.map((o,N)=>{const _=T.points.find(A=>A.t>=o.t1),O=!!_&&!!(l!=null&&l.has(_.uuid));return s.jsxs("g",{className:"tl-break",onDoubleClick:A=>{A.stopPropagation(),Y(K=>{const F=new Set(K);return F.has(o.t0)?F.delete(o.t0):F.add(o.t0),F})},children:[s.jsx("rect",{x:o.x0,y:0,width:o.x1-o.x0,height:L}),s.jsxs("title",{children:[ss(o.durationMs,O)," — double-click to show it to scale"]})]},"b"+N)}),T.expanded.map((o,N)=>s.jsxs("g",{className:"tl-expanded",onDoubleClick:_=>{_.stopPropagation(),Y(O=>{const A=new Set(O);return A.delete(o.t0),A})},children:[s.jsx("rect",{x:o.x0,y:0,width:Math.max(o.x1-o.x0,1),height:L}),s.jsxs("title",{children:[ss(o.durationMs,!1)," — shown in full; double-click to collapse it again"]})]},"x"+N)),y.map(o=>s.jsx(xn,{m:o,scale:T,h:Ne(o.value),fill:w(o.kind)},o.uuid)),ue&&s.jsx("polyline",{className:"tl-context",points:ue}),d&&s.jsx("rect",{className:"tl-hover",x:d.x-1,y:0,width:d.w+2,height:L}),P&&s.jsx("rect",{className:"tl-cursor",x:T.x(P.t)-1,y:0,width:Math.max(Ms,2),height:L}),m&&s.jsxs("g",{className:"tl-sel",children:[s.jsx("rect",{className:"tl-sel-shade",x:0,y:0,width:Math.max(m[0],0),height:L}),s.jsx("rect",{className:"tl-sel-shade",x:m[1],y:0,width:Math.max(I-m[1],0),height:L}),s.jsx("rect",{className:"tl-sel-box",x:m[0],y:0,width:Math.max(m[1]-m[0],1),height:L}),s.jsx("rect",{className:"tl-sel-handle",x:m[0]-1,y:0,width:2,height:L}),s.jsx("rect",{className:"tl-sel-handle",x:m[1]-1,y:0,width:2,height:L})]}),s.jsx("g",{className:"tl-rail",transform:`translate(0, ${L+ys})`,children:y.map(o=>{const N=T.x(o.t);return s.jsxs("g",{children:[o.error&&s.jsx("rect",{className:"tl-err",x:N,y:0,width:2,height:Ie}),o.finding&&s.jsx("rect",{className:"tl-find sev-"+o.finding,x:N,y:0,width:2,height:Ie}),o.fileChange&&s.jsx("rect",{className:"tl-file",x:N,y:1,width:3,height:3}),o.spawn&&s.jsx("path",{className:"tl-spawn",d:`M ${N-2} 0 L ${N+2} 0 L ${N} 4 Z`})]},"r"+o.uuid)})})]}),d&&s.jsxs("div",{className:"tl-tip"+(d.x>I*.6?" is-right":""),style:d.x>I*.6?{right:Math.max(I-d.x,0)}:{left:d.x},"aria-hidden":"true",children:[s.jsxs("div",{className:"tl-tip-head",children:[d.mark.turnSeq!=null&&s.jsxs("span",{className:"tl-tip-turn",children:["turn ",d.mark.turnSeq]}),s.jsx("span",{children:d.mark.kind==="tool-error"?"tool error":d.mark.kind})]}),s.jsxs("div",{className:"tl-tip-row muted",children:[new Date(d.mark.t).toLocaleTimeString(),B&&d.mark.value>0?` · ${oe(d.mark.value)} tok`:"",d.mark.durationMs>0?` · ${Z(d.mark.durationMs)}`:"",d.mark.context>0?` · ${oe(d.mark.context)} context`:""]}),(d.mark.error||d.mark.finding||d.mark.fileChange||d.mark.spawn)&&s.jsxs("div",{className:"tl-tip-row",children:[d.mark.error&&s.jsx("span",{className:"tl-tip-flag is-err",children:"tool error"}),d.mark.finding&&s.jsxs("span",{className:"tl-tip-flag sev-"+d.mark.finding,children:[d.mark.finding," finding"]}),d.mark.fileChange&&s.jsxs("span",{className:"tl-tip-flag",children:[d.mark.fileChangeCount," file",d.mark.fileChangeCount===1?"":"s"]}),d.mark.spawn&&s.jsx("span",{className:"tl-tip-flag",children:"subagent"})]})]}),s.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:de}),s.jsxs("div",{className:"tl-legend",children:[mn.filter(o=>we.has(o.kind)).map(o=>s.jsxs("span",{className:"tl-key",children:[s.jsx("span",{className:"tl-swatch",style:{background:w(o.kind)}}),o.label]},o.kind)),we.has("tool-error")&&s.jsxs("span",{className:"tl-key",children:[s.jsx("span",{className:"tl-swatch",style:{background:J.toolError}}),"tool error"]}),re>0&&s.jsxs("span",{className:"tl-key",title:"Prompt size per message — input + cache-write + cache-read. Shape only; a fuller context is not a worse one.",children:[s.jsx("span",{className:"tl-swatch is-line"}),"context, peak ",oe(re)]})]})]})}function xn({m:e,scale:t,h:n,fill:a}){const{x:l,w:c}=Oe(e,t);return s.jsx("rect",{className:"tl-mark",x:l,y:L-n,width:c,height:n,rx:2,fill:a})}function _n(){var he;const{id:e}=$s(),{hash:t}=Rs(),{d:n,error:a,wfMap:l}=qt(e),[c,r]=u.useState(new Set),[i,h]=u.useState(Ht),[f,p]=u.useState(Kt),[g,j]=u.useState(Jt),[E,x]=u.useState(Vt);u.useEffect(()=>r(new Set),[e]),u.useEffect(()=>{zt().then(d=>{d.format!==void 0&&h(d.format),d.hideTools!==void 0&&p(d.hideTools),d.axisMode!==void 0&&j(d.axisMode),d.metric!==void 0&&x(d.metric)})},[]);const S=d=>{h(d),Gt(d)},I=d=>{j(d),Qt(d)},b=d=>{x(d),Xt(d)},C=()=>p(d=>(Wt(!d),!d)),D=u.useMemo(()=>(n==null?void 0:n.events.filter(d=>d.text||d.thinking||d.toolCalls.length))??[],[n]),{get:z,set:Y}=Ds(),M=z("q"),$=u.useMemo(()=>{const d=Date.parse(z("from")),w=Date.parse(z("to"));return Number.isNaN(d)||Number.isNaN(w)?null:[d,w]},[z]),U=d=>Y(d?{from:new Date(d[0]).toISOString(),to:new Date(d[1]).toISOString()}:{from:"",to:""},{replace:!0}),[te,G]=u.useState(null);u.useEffect(()=>G(null),[e]);const q=u.useMemo(()=>$?D.filter(d=>{if(!d.timestamp)return!0;const w=Date.parse(d.timestamp);return Number.isNaN(w)||w>=$[0]&&w<=$[1]}):D,[D,$]),J=u.useMemo(()=>st(q),[q]),H=u.useMemo(()=>nt(q,J,M),[q,J,M]),B=((he=/^#ev-(.+)$/.exec(t))==null?void 0:he[1])??null,[ee,T]=Ps(t+`
15
+ `+M,{idx:0,seq:0}),y=H.hits[ee.idx]??null,[m,k]=u.useState(null);u.useEffect(()=>k(null),[e]);const R=d=>k(w=>({uuid:d,nonce:((w==null?void 0:w.nonce)??0)+1})),v=M.trim().length>=me&&H.total===0;u.useEffect(()=>{var w;if(!v)return;const d=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;window.scrollTo({top:0,behavior:d?"auto":"smooth"})},[v,M]);const V=(m==null?void 0:m.uuid)??(y==null?void 0:y.uuid)??B,fe=m?`band:${m.uuid}:${m.nonce}`:y?`q:${M}:${ee.idx}:${ee.seq}`:t?`${t}${$?":ranged":""}`:null,P=Ut(n==null?void 0:n.events,V,fe,c,r),[de,ne]=u.useState(!1);u.useEffect(()=>{if(!B||!$||!n)return;const d=n.events.find(o=>o.uuid===B),w=d!=null&&d.timestamp?Date.parse(d.timestamp):NaN;Number.isNaN(w)||w>=$[0]&&w<=$[1]||(Y({from:"",to:""}),ne(!0),R(B))},[B,$,n,Y]),u.useEffect(()=>{if(!de)return;const d=window.setTimeout(()=>ne(!1),6e3);return()=>window.clearTimeout(d)},[de]);const le=d=>{H.total&&T(w=>({idx:(w.idx+d+H.total)%H.total,seq:w.seq+1}))},ae=u.useRef({step:le,total:H.total});ae.current={step:le,total:H.total};const pe=u.useRef(null),xe=u.useRef(null);Bt(xe,M),u.useEffect(()=>{const d=w=>{var A;if(w.defaultPrevented||w.metaKey||w.ctrlKey||w.altKey)return;const o=w.target,N=!!o&&(o.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(o.tagName));if(w.key==="/"&&!N){w.preventDefault(),(A=pe.current)==null||A.focus();return}const _=document.activeElement,O=!_||_===document.body||_===document.documentElement;w.key==="Enter"&&O&&ae.current.total&&(w.preventDefault(),ae.current.step(w.shiftKey?-1:1))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]);const ge=u.useMemo(()=>new Map(((n==null?void 0:n.turns)??[]).map(d=>[d.id,d.seq])),[n]),je=u.useMemo(()=>new Set(((n==null?void 0:n.turns)??[]).map(d=>d.user_event_uuid).filter(d=>!!d)),[n]),re=u.useMemo(()=>({query:M,activeUuid:(y==null?void 0:y.uuid)??null}),[M,y]);if(a)return s.jsx(Fs,{error:a});if(!n)return s.jsx(Ls,{});const ue=Pt(q,n.turns),se=new Map;for(const d of D)d.turn_id&&se.set(d.turn_id,(se.get(d.turn_id)??0)+1);const ie=ue.filter(d=>d.turn).map(d=>d.turnId),Ne=ie.some(d=>!c.has(d)),we=d=>r(w=>{const o=new Set(w);return o.has(d)?o.delete(d):o.add(d),o});return s.jsxs("div",{className:"detail",children:[s.jsx(Ys,{d:n}),s.jsx(pn,{events:D,findings:n.findings,fileChanges:n.file_changes,userPromptUuids:je,turnSeqById:ge,axisMode:g,onAxisMode:I,metric:E,onMetric:b,range:$,onRange:U,onJump:R,domain:te,onDomain:G}),de&&s.jsx("div",{className:"tl-pill muted",role:"status",children:"Range cleared to show the linked message."}),$&&s.jsxs("div",{className:"tl-pill",role:"status",children:[s.jsxs("span",{className:"tl-pill-range",children:[Be($[0]),"–",Be($[1])]}),s.jsx("span",{className:"muted",children:q.length===0?"no messages in this range":`showing ${q.length} of ${D.length} messages`}),te?s.jsx("button",{type:"button",className:"link-btn",onClick:()=>G(null),children:"◂ full session"}):s.jsx("button",{type:"button",className:"link-btn",onClick:()=>G($),children:"⤢ zoom"}),s.jsx("button",{type:"button",className:"link-btn",onClick:()=>U(null),children:"clear ✕"})]}),n.children&&n.children.length>0&&s.jsx(ot,{d:n}),s.jsx(Zs,{search:s.jsx(it,{query:M,onQuery:d=>Y({q:d},{replace:!0}),total:H.total,index:ee.idx,onPrev:()=>le(-1),onNext:()=>le(1),inputRef:pe}),turnCount:ie.length,anyOpen:Ne,onToggleAll:()=>r(Ne?new Set(ie):new Set),hideTools:f,onToggleHideTools:C,format:i,onChooseFormat:S}),s.jsx(fs.Provider,{value:l,children:s.jsx(ms.Provider,{value:i,children:s.jsx(ps.Provider,{value:f,children:s.jsx(gs.Provider,{value:V,children:s.jsx(xs.Provider,{value:P,children:s.jsx($e.Provider,{value:re,children:s.jsxs("div",{className:"transcript",ref:xe,children:[D.length===0&&s.jsx("div",{className:"muted pad",role:"status",children:"This session has no rendered messages."}),D.length>0&&q.length===0&&s.jsx("div",{className:"muted pad",role:"status",children:"No messages in the selected time range."}),ue.map((d,w)=>d.turn?s.jsx(Lt,{turn:d.turn,events:d.events,matches:H.byTurn.get(d.turnId)??0,total:se.get(d.turnId),open:!c.has(d.turnId),onToggle:()=>we(d.turnId)},d.turnId):s.jsx("div",{className:"unturned",children:d.events.map(o=>s.jsx(ws,{e:o},o.uuid))},"unturned-"+w))]})})})})})})})]})}export{_n as default};
@@ -1 +1 @@
1
- import{y as x,x as j,j as s,A as v,k as f,r as d,L as m,w as c}from"./index-DAAJAs1W.js";import{M as N,r as p}from"./index-DrIth0LC.js";function k(e){return!e||e<0?"—":e>=1024?(e/1024).toFixed(1)+" KB":e+" B"}function y(e,l){return`${e.slice(0,8)} · ${c(l)}`}function S(){const{name:e=""}=x(),l=j("/skills/"+encodeURIComponent(e),{reset:!0});return s.jsx(v,{state:l,empty:s.jsx("div",{className:"muted pad",children:"Not found."}),children:t=>s.jsx(b,{data:t})})}function b({data:e}){const{get:l,set:t}=f(),o=l("v"),n=d.useMemo(()=>e.versions.length?e.versions.find(i=>i.id===o)??e.versions[0]:null,[e,o]),a=d.useMemo(()=>n?e.sessions.filter(i=>i.version_id===n.id):[],[e,n]),h=d.useMemo(()=>e.sessions.filter(i=>!i.version_id).length,[e]);function u(i){t({v:i})}return s.jsxs("div",{className:"skill-view",children:[s.jsx(m,{to:"/skills",className:"back",children:"← all skills"}),s.jsxs("header",{className:"skill-head",children:[s.jsxs("h1",{children:["📖 ",e.name]}),s.jsxs("div",{className:"skill-head-meta muted",children:[e.call_count.toLocaleString()," firing",e.call_count===1?"":"s"," ·"," ",e.versions.length," version",e.versions.length===1?"":"s",n!=null&&n.summary?s.jsxs(s.Fragment,{children:[" · ",n.summary]}):null]})]}),e.versions.length===0?s.jsxs("div",{className:"empty",children:["This skill fired ",e.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:(n==null?void 0:n.id)??"",onChange:i=>u(i.target.value),children:e.versions.map((i,r)=>s.jsxs("option",{value:i.id,children:[y(i.id,i.last_seen)," · ",i.call_count," fire",i.call_count===1?"":"s",r===0?" (latest)":""]},i.id))})]}),n&&s.jsxs("span",{className:"muted small",children:["first seen ",c(n.first_seen)," · last seen ",c(n.last_seen)," ·"," ",k(n.body_bytes)]})]}),n&&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 ",n.id.slice(0,8)]})]}),s.jsx("div",{className:"md skill-body",children:s.jsx(N,{remarkPlugins:[p],children:n.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:a.length})]}),a.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:a.map(i=>{var r;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(m,{to:`/session/${i.id}`,className:"title",children:i.title||s.jsx("span",{className:"muted",children:i.id.slice(0,12)})})}),s.jsx("td",{children:i.source_id}),s.jsx("td",{className:"path",children:((r=i.project_path)==null?void 0:r.replace(/^.*\//,""))??"—"}),s.jsx("td",{className:"num",children:i.fire_count}),s.jsx("td",{children:c(i.fired_at)})]},i.id)})})]}),h>0&&s.jsxs("div",{className:"muted small pad",children:[h," firing(s) had no captured body and aren’t attributed to a version."]})]})]})]})]})}export{S as default};
1
+ import{y as x,x as j,j as s,D as v,i as f,r as d,L as m,v as c}from"./index-CvMppG1z.js";import{M as N,r as p}from"./index-CcEbkJx7.js";function k(e){return!e||e<0?"—":e>=1024?(e/1024).toFixed(1)+" KB":e+" B"}function y(e,l){return`${e.slice(0,8)} · ${c(l)}`}function S(){const{name:e=""}=x(),l=j("/skills/"+encodeURIComponent(e),{reset:!0});return s.jsx(v,{state:l,empty:s.jsx("div",{className:"muted pad",children:"Not found."}),children:t=>s.jsx(b,{data:t})})}function b({data:e}){const{get:l,set:t}=f(),o=l("v"),n=d.useMemo(()=>e.versions.length?e.versions.find(i=>i.id===o)??e.versions[0]:null,[e,o]),a=d.useMemo(()=>n?e.sessions.filter(i=>i.version_id===n.id):[],[e,n]),h=d.useMemo(()=>e.sessions.filter(i=>!i.version_id).length,[e]);function u(i){t({v:i})}return s.jsxs("div",{className:"skill-view",children:[s.jsx(m,{to:"/skills",className:"back",children:"← all skills"}),s.jsxs("header",{className:"skill-head",children:[s.jsxs("h1",{children:["📖 ",e.name]}),s.jsxs("div",{className:"skill-head-meta muted",children:[e.call_count.toLocaleString()," firing",e.call_count===1?"":"s"," ·"," ",e.versions.length," version",e.versions.length===1?"":"s",n!=null&&n.summary?s.jsxs(s.Fragment,{children:[" · ",n.summary]}):null]})]}),e.versions.length===0?s.jsxs("div",{className:"empty",children:["This skill fired ",e.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:(n==null?void 0:n.id)??"",onChange:i=>u(i.target.value),children:e.versions.map((i,r)=>s.jsxs("option",{value:i.id,children:[y(i.id,i.last_seen)," · ",i.call_count," fire",i.call_count===1?"":"s",r===0?" (latest)":""]},i.id))})]}),n&&s.jsxs("span",{className:"muted small",children:["first seen ",c(n.first_seen)," · last seen ",c(n.last_seen)," ·"," ",k(n.body_bytes)]})]}),n&&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 ",n.id.slice(0,8)]})]}),s.jsx("div",{className:"md skill-body",children:s.jsx(N,{remarkPlugins:[p],children:n.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:a.length})]}),a.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:a.map(i=>{var r;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(m,{to:`/session/${i.id}`,className:"title",children:i.title||s.jsx("span",{className:"muted",children:i.id.slice(0,12)})})}),s.jsx("td",{children:i.source_id}),s.jsx("td",{className:"path",children:((r=i.project_path)==null?void 0:r.replace(/^.*\//,""))??"—"}),s.jsx("td",{className:"num",children:i.fire_count}),s.jsx("td",{children:c(i.fired_at)})]},i.id)})})]}),h>0&&s.jsxs("div",{className:"muted small pad",children:[h," firing(s) had no captured body and aren’t attributed to a version."]})]})]})]})]})}export{S as default};
@@ -0,0 +1 @@
1
+ import{i as q,k as S,r as c,F,x as E,G as C,j as e,H as I,E as R,n as K,I as d,L as M,v as w,P as D}from"./index-CvMppG1z.js";const u=50,$={name:t=>t.name,fired:t=>t.call_count,last_fired:t=>t.last_fired};function G(){const{params:t,get:r,set:n,pick:k}=q(),f=S("/sources",[]),y=S("/projects",[]),[h,m]=c.useState(r("q")),{sort:a,toggle:i}=F("fired","desc"),[N,j]=c.useState(1),p=k(["source","project","q"]),{data:x,loading:g,error:_}=E("/skills"+(p.toString()?"?"+p:""));function L(s){s.preventDefault(),n({q:h.trim()})}c.useEffect(()=>j(1),[t,a.key,a.dir]);const l=c.useMemo(()=>C(x??[],$[a.key],a.dir),[x,a.key,a.dir]),b=Math.max(1,Math.ceil(l.length/u)),o=Math.min(N,b),P=l.slice((o-1)*u,o*u);return e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:"Skills"}),e.jsxs("div",{className:"filters",children:[e.jsxs("form",{onSubmit:L,className:"search",role:"search",children:[e.jsx("input",{type:"search","aria-label":"Search skills by name and body",placeholder:"Search skill names & bodies…",value:h,onChange:s=>m(s.target.value)}),e.jsx("button",{type:"submit",children:"Search"}),r("q")&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>(m(""),n({q:""})),children:"clear"})]}),e.jsxs("select",{"aria-label":"Filter by source",value:r("source"),onChange:s=>n({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),f.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(I,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:r("project"),onChange:s=>n({project:s}),options:[{value:"",label:"all projects"},...y.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]})]}),e.jsx(R,{error:_}),g?e.jsx(K,{}):l.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(d,{label:"Skill",sortKey:"name",active:a.key,dir:a.dir,onSort:i,defaultDir:"asc"}),e.jsx(d,{label:"Fired",sortKey:"fired",active:a.key,dir:a.dir,onSort:i,className:"num"}),e.jsx("th",{className:"num",children:"Versions"}),e.jsx("th",{children:"Sources"}),e.jsx(d,{label:"Last fired",sortKey:"last_fired",active:a.key,dir:a.dir,onSort:i})]})}),e.jsx("tbody",{children:P.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(M,{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(v=>e.jsx("span",{className:"tag",children:v},v))})}),e.jsx("td",{children:w(s.last_fired)})]},s.name))})]}),!g&&l.length>0&&e.jsx(D,{page:o,pages:b,total:l.length,unit:"skills",onPage:j})]})}export{G as default};
@@ -1 +1 @@
1
- import{j as s,r as C,y as D,x as G,A as K,L as T,s as L,f as W,b as q,c as Y,w as z}from"./index-DAAJAs1W.js";import{s as E,d as v,l as M,a as H,C as V,p as S,A as Q}from"./jsonish-BI7lbDY8.js";import{M as F,r as J}from"./index-DrIth0LC.js";const N=e=>e===null||typeof e!="object",R=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function A({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const r=typeof e;return r==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):r==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function P({v:e}){return N(e)?s.jsx(A,{v:e}):Array.isArray(e)?e.every(N)?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 I(e){const r=[],a=new Set;for(const l of e)for(const n of Object.keys(l??{}))a.has(n)||(a.add(n),r.push(n));return r}function U({rows:e}){const r=I(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:r.map(a=>s.jsx("th",{children:a},a))})}),s.jsx("tbody",{children:e.map((a,l)=>s.jsx("tr",{children:r.map(n=>s.jsx("td",{children:s.jsx(P,{v:a[n]})},n))},l))})]})})}function X({obj:e}){const r=Object.entries(e),a=I(r.map(([,l])=>l));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"}),a.map(l=>s.jsx("th",{children:l},l))]})}),s.jsx("tbody",{children:r.map(([l,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:l}),a.map(t=>s.jsx("td",{children:s.jsx(P,{v:n[t]})},t))]},l))})]})})}function Z({name:e,value:r,depth:a}){const[l,n]=C.useState(a<1),t=Array.isArray(r)?`[${r.length}]`:`{${Object.keys(r).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":l,onClick:()=>n(i=>!i),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:l?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:t})]}),l&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(B,{value:r,depth:a+1})})]})}function B({value:e,depth:r=0}){if(N(e))return s.jsx(A,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(R)?s.jsx(U,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((t,i)=>s.jsx("li",{children:s.jsx(P,{v:t})},i))});const a=Object.entries(e);if(a.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(a.every(([,t])=>R(t)))return s.jsx(X,{obj:e});const l=a.filter(([,t])=>N(t)),n=a.filter(([,t])=>!N(t));return s.jsxs("div",{className:"rv-obj",children:[l.length>0&&s.jsx("div",{className:"rv-metrics",children:l.map(([t,i])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:t}),s.jsx("span",{className:"rv-mval",children:s.jsx(A,{v:i})})]},t))}),n.map(([t,i])=>s.jsx(Z,{name:t,value:i,depth:r},t))]})}function k({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(B,{value:e,depth:0})})}const f=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),_=e=>e===null||typeof e!="object",ss=new Set(["script","scriptPath","description"]),es=["skill","name","id","title"];function as({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):_(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(_)?s.jsx("ol",{className:"launch-list",children:e.map((r,a)=>s.jsx("li",{children:r===null?"—":String(r)},a))}):s.jsx(k,{value:e}):s.jsx(k,{value:e})}function ns({rec:e,index:r}){const a=es.find(t=>typeof e[t]=="string"),l=a?String(e[a]):`task ${r+1}`,n=Object.entries(e).filter(([t])=>t!==a);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:r+1}),s.jsx("span",{className:"launch-card-title",children:l})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([t,i])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:t}),s.jsx("dd",{children:s.jsx(as,{v:i})})]},t))})]})}function $({raw:e}){const[r,a]=C.useState(!1),{body:l,note:n}=E(v(e)),{value:t,repaired:i}=M(l);if(t===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const d=H(t),x=f(d)?Object.entries(d):[["",d]],y=x.filter(([o,c])=>_(c)&&o!=="script"),g=x.filter(([,o])=>!_(o)),h=f(d)&&typeof d.script=="string"?d.script:null,u=f(d)&&typeof d.scriptPath=="string"?d.scriptPath:null,m=f(d)&&typeof d.description=="string"?d.description:null,p=y.filter(([o])=>!ss.has(o)),w=m||u||h||p.length>0,b=o=>Array.isArray(o)&&o.length>0&&o.every(f);return s.jsxs("div",{className:"launch",children:[w&&s.jsxs("div",{className:"launch-meta",children:[m&&s.jsx("div",{className:"launch-desc",children:m}),u&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:u})]}),p.map(([o,c])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:o})," ",s.jsx("code",{children:String(c)})]},o)),h&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",h.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:h})]})]}),g.map(([o,c])=>b(c)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[c.length," ",o||(c.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),c.map((j,O)=>s.jsx(ns,{rec:j,index:O},O))]},o||"tasks"):s.jsxs("div",{className:"launch-section",children:[o&&s.jsx("div",{className:"launch-tasks-head",children:o}),s.jsx(k,{value:c})]},o||"value")),(n||i)&&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":r,onClick:()=>a(o=>!o),children:r?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(V,{text:S(l),label:"JSON",title:"Copy raw launch JSON"})]}),r&&s.jsx("pre",{className:"code launch-raw",children:S(l)})]})}function ts({raw:e}){const{body:r,note:a}=E(v(e)),l=/^\s*[[{]/.test(r),{value:n,repaired:t}=l?M(r):{value:void 0,repaired:!1},i=n!==void 0;return s.jsxs(s.Fragment,{children:[i?s.jsx("div",{className:"wf-result-body",children:s.jsx(k,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(F,{remarkPlugins:[J],children:r})}),(a||t)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",a??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(V,{text:i?S(r):r,label:"result",title:"Copy the returned result"})})]})}function rs(e,r){if(e&&e.length){const a=new Map,l=(n,t)=>{let i=a.get(n);return i?t&&(i.title=t):(i={title:t||`Phase ${n}`,agentCount:0,models:[]},a.set(n,i)),i};for(const n of e)n.type==="workflow_phase"&&l(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const t=l(n.phaseIndex,n.phaseTitle);t.agentCount++,n.model&&!t.models.includes(n.model)&&t.models.push(n.model)}if(a.size)return[...a.keys()].sort((n,t)=>n-t).map(n=>a.get(n))}return r.map(a=>({title:a,agentCount:0,models:[]}))}function ds(){const{run_id:e}=D(),r=G("/workflows/"+e,{reset:!0});return s.jsx(K,{state:r,children:a=>s.jsx(ls,{d:a})})}function ls({d:e}){var x,y,g,h,u,m,p,w,b,o;const r=(e.status??"").toLowerCase(),a=((x=e.run)==null?void 0:x.agent_count)??e.stats.agent_count,l=((y=e.run)==null?void 0:y.total_tokens)??e.stats.total_tokens,n=((g=e.run)==null?void 0:g.duration_ms)??e.stats.duration_ms,t=(((h=e.run)==null?void 0:h.phases)??[]).map(c=>c==null?void 0:c.title).filter(c=>!!c),i=rs((u=e.run)==null?void 0:u.progress,t),d=((m=e.run)==null?void 0:m.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(T,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",e.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:e.run_id}),e.status&&s.jsx("span",{className:"tag task-status task-status-"+r,children:e.status}),((p=e.run)==null?void 0:p.default_model)&&s.jsx("span",{className:"tag",children:L(e.run.default_model)}),((w=e.parent)==null?void 0:w.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(T,{to:`/session/${e.parent.id}`,children:e.parent.title||e.parent.id.slice(0,12)}),e.parent.turn_seq!=null?` · turn ${e.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[a," agent",a===1?"":"s"]}),s.jsxs("span",{children:[W(l)," tok"]}),((b=e.run)==null?void 0:b.total_tool_calls)!=null&&s.jsxs("span",{children:[e.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:q(e.stats.total_cost)}),s.jsx("span",{children:Y(n)}),s.jsx("span",{className:"muted",children:z(((o=e.run)==null?void 0:o.started_at)??e.stats.started_at)})]}),i.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:i.map((c,j)=>s.jsxs(C.Fragment,{children:[j>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:c.title}),c.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[c.agentCount," agent",c.agentCount===1?"":"s",c.models.length?` · ${c.models.map(L).join(", ")}`:""]})]})]},j))})]}),e.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",e.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+e.completion.status.toLowerCase(),children:e.completion.status})]}),e.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:v(e.completion.summary)}),e.completion.result?s.jsx(ts,{raw:e.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),e.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:v(e.completion.failures)})]})]}),d.length>0&&s.jsxs("details",{className:"wf-logs",open:d.length<=20,children:[s.jsxs("summary",{children:["Run log · ",d.length," line",d.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:d.map((c,j)=>s.jsx("li",{children:c},j))})]}),e.input_json?s.jsx("div",{className:"wf-result wf-launch",children:e.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx($,{raw:e.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),r==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx($,{raw:e.input_json})]})}):!e.completion&&e.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(F,{remarkPlugins:[J],children:e.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",e.agents.length,")"]}),e.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:e.agents.map(c=>s.jsx(Q,{a:c},c.id))})]})]})}export{ds as default};
1
+ import{j as s,r as C,y as B,x as G,D as K,L as T,s as L,f as W,a as q,b as Y,v as z}from"./index-CvMppG1z.js";import{s as E,d as v,l as M,a as H,C as V,p as S,A as Q}from"./jsonish-DMAKObPI.js";import{M as F,r as J}from"./index-CcEbkJx7.js";const N=e=>e===null||typeof e!="object",R=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function A({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const r=typeof e;return r==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):r==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function P({v:e}){return N(e)?s.jsx(A,{v:e}):Array.isArray(e)?e.every(N)?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 D(e){const r=[],a=new Set;for(const l of e)for(const n of Object.keys(l??{}))a.has(n)||(a.add(n),r.push(n));return r}function U({rows:e}){const r=D(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:r.map(a=>s.jsx("th",{children:a},a))})}),s.jsx("tbody",{children:e.map((a,l)=>s.jsx("tr",{children:r.map(n=>s.jsx("td",{children:s.jsx(P,{v:a[n]})},n))},l))})]})})}function X({obj:e}){const r=Object.entries(e),a=D(r.map(([,l])=>l));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"}),a.map(l=>s.jsx("th",{children:l},l))]})}),s.jsx("tbody",{children:r.map(([l,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:l}),a.map(t=>s.jsx("td",{children:s.jsx(P,{v:n[t]})},t))]},l))})]})})}function Z({name:e,value:r,depth:a}){const[l,n]=C.useState(a<1),t=Array.isArray(r)?`[${r.length}]`:`{${Object.keys(r).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":l,onClick:()=>n(i=>!i),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:l?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:t})]}),l&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(I,{value:r,depth:a+1})})]})}function I({value:e,depth:r=0}){if(N(e))return s.jsx(A,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(R)?s.jsx(U,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((t,i)=>s.jsx("li",{children:s.jsx(P,{v:t})},i))});const a=Object.entries(e);if(a.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(a.every(([,t])=>R(t)))return s.jsx(X,{obj:e});const l=a.filter(([,t])=>N(t)),n=a.filter(([,t])=>!N(t));return s.jsxs("div",{className:"rv-obj",children:[l.length>0&&s.jsx("div",{className:"rv-metrics",children:l.map(([t,i])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:t}),s.jsx("span",{className:"rv-mval",children:s.jsx(A,{v:i})})]},t))}),n.map(([t,i])=>s.jsx(Z,{name:t,value:i,depth:r},t))]})}function k({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(I,{value:e,depth:0})})}const f=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),_=e=>e===null||typeof e!="object",ss=new Set(["script","scriptPath","description"]),es=["skill","name","id","title"];function as({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):_(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(_)?s.jsx("ol",{className:"launch-list",children:e.map((r,a)=>s.jsx("li",{children:r===null?"—":String(r)},a))}):s.jsx(k,{value:e}):s.jsx(k,{value:e})}function ns({rec:e,index:r}){const a=es.find(t=>typeof e[t]=="string"),l=a?String(e[a]):`task ${r+1}`,n=Object.entries(e).filter(([t])=>t!==a);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:r+1}),s.jsx("span",{className:"launch-card-title",children:l})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([t,i])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:t}),s.jsx("dd",{children:s.jsx(as,{v:i})})]},t))})]})}function $({raw:e}){const[r,a]=C.useState(!1),{body:l,note:n}=E(v(e)),{value:t,repaired:i}=M(l);if(t===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const d=H(t),x=f(d)?Object.entries(d):[["",d]],y=x.filter(([o,c])=>_(c)&&o!=="script"),g=x.filter(([,o])=>!_(o)),h=f(d)&&typeof d.script=="string"?d.script:null,u=f(d)&&typeof d.scriptPath=="string"?d.scriptPath:null,m=f(d)&&typeof d.description=="string"?d.description:null,p=y.filter(([o])=>!ss.has(o)),w=m||u||h||p.length>0,b=o=>Array.isArray(o)&&o.length>0&&o.every(f);return s.jsxs("div",{className:"launch",children:[w&&s.jsxs("div",{className:"launch-meta",children:[m&&s.jsx("div",{className:"launch-desc",children:m}),u&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:u})]}),p.map(([o,c])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:o})," ",s.jsx("code",{children:String(c)})]},o)),h&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",h.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:h})]})]}),g.map(([o,c])=>b(c)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[c.length," ",o||(c.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),c.map((j,O)=>s.jsx(ns,{rec:j,index:O},O))]},o||"tasks"):s.jsxs("div",{className:"launch-section",children:[o&&s.jsx("div",{className:"launch-tasks-head",children:o}),s.jsx(k,{value:c})]},o||"value")),(n||i)&&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":r,onClick:()=>a(o=>!o),children:r?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(V,{text:S(l),label:"JSON",title:"Copy raw launch JSON"})]}),r&&s.jsx("pre",{className:"code launch-raw",children:S(l)})]})}function ts({raw:e}){const{body:r,note:a}=E(v(e)),l=/^\s*[[{]/.test(r),{value:n,repaired:t}=l?M(r):{value:void 0,repaired:!1},i=n!==void 0;return s.jsxs(s.Fragment,{children:[i?s.jsx("div",{className:"wf-result-body",children:s.jsx(k,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(F,{remarkPlugins:[J],children:r})}),(a||t)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",a??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(V,{text:i?S(r):r,label:"result",title:"Copy the returned result"})})]})}function rs(e,r){if(e&&e.length){const a=new Map,l=(n,t)=>{let i=a.get(n);return i?t&&(i.title=t):(i={title:t||`Phase ${n}`,agentCount:0,models:[]},a.set(n,i)),i};for(const n of e)n.type==="workflow_phase"&&l(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const t=l(n.phaseIndex,n.phaseTitle);t.agentCount++,n.model&&!t.models.includes(n.model)&&t.models.push(n.model)}if(a.size)return[...a.keys()].sort((n,t)=>n-t).map(n=>a.get(n))}return r.map(a=>({title:a,agentCount:0,models:[]}))}function ds(){const{run_id:e}=B(),r=G("/workflows/"+e,{reset:!0});return s.jsx(K,{state:r,children:a=>s.jsx(ls,{d:a})})}function ls({d:e}){var x,y,g,h,u,m,p,w,b,o;const r=(e.status??"").toLowerCase(),a=((x=e.run)==null?void 0:x.agent_count)??e.stats.agent_count,l=((y=e.run)==null?void 0:y.total_tokens)??e.stats.total_tokens,n=((g=e.run)==null?void 0:g.duration_ms)??e.stats.duration_ms,t=(((h=e.run)==null?void 0:h.phases)??[]).map(c=>c==null?void 0:c.title).filter(c=>!!c),i=rs((u=e.run)==null?void 0:u.progress,t),d=((m=e.run)==null?void 0:m.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(T,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",e.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:e.run_id}),e.status&&s.jsx("span",{className:"tag task-status task-status-"+r,children:e.status}),((p=e.run)==null?void 0:p.default_model)&&s.jsx("span",{className:"tag",children:L(e.run.default_model)}),((w=e.parent)==null?void 0:w.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(T,{to:`/session/${e.parent.id}`,children:e.parent.title||e.parent.id.slice(0,12)}),e.parent.turn_seq!=null?` · turn ${e.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[a," agent",a===1?"":"s"]}),s.jsxs("span",{children:[W(l)," tok"]}),((b=e.run)==null?void 0:b.total_tool_calls)!=null&&s.jsxs("span",{children:[e.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:q(e.stats.total_cost)}),s.jsx("span",{children:Y(n)}),s.jsx("span",{className:"muted",children:z(((o=e.run)==null?void 0:o.started_at)??e.stats.started_at)})]}),i.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:i.map((c,j)=>s.jsxs(C.Fragment,{children:[j>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:c.title}),c.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[c.agentCount," agent",c.agentCount===1?"":"s",c.models.length?` · ${c.models.map(L).join(", ")}`:""]})]})]},j))})]}),e.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",e.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+e.completion.status.toLowerCase(),children:e.completion.status})]}),e.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:v(e.completion.summary)}),e.completion.result?s.jsx(ts,{raw:e.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),e.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:v(e.completion.failures)})]})]}),d.length>0&&s.jsxs("details",{className:"wf-logs",open:d.length<=20,children:[s.jsxs("summary",{children:["Run log · ",d.length," line",d.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:d.map((c,j)=>s.jsx("li",{children:c},j))})]}),e.input_json?s.jsx("div",{className:"wf-result wf-launch",children:e.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx($,{raw:e.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),r==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx($,{raw:e.input_json})]})}):!e.completion&&e.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(F,{remarkPlugins:[J],children:e.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",e.agents.length,")"]}),e.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:e.agents.map(c=>s.jsx(Q,{a:c},c.id))})]})]})}export{ds as default};
@@ -0,0 +1 @@
1
+ :root{--bg: #0f1115;--panel: #171a21;--panel2: #1e222b;--border: #2a2f3a;--text: #e6e8ec;--muted: #8b93a3;--accent: #6ea8fe;--user: #7ee0a0;--assistant: #6ea8fe;--tag: #2a2f3a;--err: #ff6b6b;--ok: #7ee0a0;--gold: #e0b85a;--violet: #b98cff;--teal: #4fd1c5;--tl-user: #3fa270;--tl-assistant: #058dfa;--tl-thinking: #b343ad;--tl-tool: #a86819;--burn-1: #48515b;--burn-2: #536478;--burn-3: #5d7896;--burn-4: #688cb6;--burn-5: #72a1d6;--burn-6: #7cb6f7;--burn-7: #96ccff;--code-bg: var(--bg)}:root[data-theme=light]{--bg: #ffffff;--panel: #f6f7f9;--panel2: #eceef2;--border: #d5d9e0;--text: #1b1f27;--muted: #5b6472;--accent: #2563eb;--user: #0f9d58;--assistant: #2563eb;--tag: #e4e7ec;--err: #d32f2f;--ok: #15803d;--gold: #b7791f;--violet: #7c3aed;--teal: #0d9488;--tl-user: #226929;--tl-assistant: #2649c0;--tl-thinking: #8d1a89;--tl-tool: #a1790c;--burn-1: #a4aeb9;--burn-2: #859ab3;--burn-3: #6787ac;--burn-4: #4874a4;--burn-5: #26609c;--burn-6: #004c93;--burn-7: #003979;--code-bg: #eef1f5}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px/1.5 ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}button{background:var(--panel2);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:6px 12px;cursor:pointer}button:hover:not(:disabled){border-color:var(--accent)}button:disabled{opacity:.4;cursor:default}button.ghost{background:transparent}select,input{background:var(--panel2);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:6px 10px}input:focus,select:focus{border-color:var(--accent)}a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.skip-link{position:absolute;left:8px;top:-40px;z-index:10;background:var(--panel2);border:1px solid var(--accent);border-radius:6px;padding:6px 12px;transition:top .15s ease}.skip-link:focus{top:8px;text-decoration:none}.topbar{display:flex;align-items:center;gap:12px;padding:12px 20px;border-bottom:1px solid var(--border);background:var(--panel);position:sticky;top:0;z-index:5}.brand{font-weight:700;font-size:16px;color:var(--text);display:inline-flex;align-items:center;gap:8px}.brand-logo{height:22px;width:auto;display:block}.tagline{color:var(--muted);font-size:12px}.version-badge{color:var(--muted);font-size:11px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;padding:2px 6px;border:1px solid var(--border);border-radius:10px;margin-left:-4px;white-space:nowrap}a.version-badge:hover{color:var(--text);border-color:var(--muted)}.topbar-actions{margin-left:auto;display:inline-flex;align-items:center;gap:8px}.theme-toggle{font-size:15px;line-height:1;padding:5px 9px}.refresh-btn{font-size:13px;line-height:1;padding:5px 10px;display:inline-flex;align-items:center;gap:4px}.refresh-btn[disabled]{opacity:.65;cursor:default}.refresh-icon{display:inline-block}.refresh-icon.spinning{animation:agentlens-spin .8s linear infinite}@keyframes agentlens-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.refresh-icon.spinning{animation:none}}.content{max-width:1100px;margin:0 auto;padding:20px}.content.wide{max-width:min(1600px,94vw)}.filters{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:16px}.col-th{width:1%;white-space:nowrap;text-align:right}.col-td{width:1%}.col-customizer{position:relative;display:inline-block}.col-customizer>summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;padding:2px 6px;border-radius:6px;color:var(--muted);font-size:15px;line-height:1}.col-customizer>summary:hover{background:var(--panel2);color:var(--text)}.col-customizer[open]>summary{background:var(--panel2);color:var(--text)}.col-customizer>summary::-webkit-details-marker{display:none}.col-menu{position:absolute;z-index:20;top:calc(100% + 4px);right:0;background:var(--panel);border:1px solid var(--border);border-radius:8px;padding:8px;min-width:150px;box-shadow:0 6px 20px #00000047}.col-menu label{display:flex;align-items:center;gap:8px;padding:4px 6px;font-size:13px;white-space:nowrap;cursor:pointer}.col-menu .ms-clear{margin-top:6px}.multi-select{position:relative}.multi-select>summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;padding:7px 10px;border:1px solid var(--border);border-radius:6px;background:var(--panel2);font-size:14px}.multi-select>summary::-webkit-details-marker{display:none}.multi-select[open]>summary{border-color:var(--accent)}.multi-select>.col-menu{left:0;right:auto}.search{display:flex;gap:6px;flex:1;min-width:280px}.search input{flex:1;min-width:0}.search button{flex:none}.filters>select,.filters .search input,.filters .search button,.filters .filter-select-btn,.filters .multi-select>summary{height:36px;box-sizing:border-box;font-size:13px;font-family:inherit}.filters .filter-select-btn,.filters .multi-select>summary{display:inline-flex;align-items:center;padding:0 10px}.muted{color:var(--muted)}.pad{padding:24px 0}.error{color:var(--err);padding:12px;border:1px solid var(--err);border-radius:6px;margin-bottom:12px}table.sessions{width:100%;border-collapse:collapse}.sessions th{text-align:left;font-weight:600;font-size:12px;color:var(--muted);padding:8px;border-bottom:1px solid var(--border)}.sessions th.num,.sessions td.num{text-align:right;font-variant-numeric:tabular-nums}.sessions td{padding:10px 8px;border-bottom:1px solid var(--border);vertical-align:top}.sessions tr:hover td{background:var(--panel)}.title{font-weight:600}.sub{margin-top:4px;display:flex;gap:4px;flex-wrap:wrap}.path{color:var(--muted)}.tag{font-size:11px;background:var(--tag);color:var(--muted);border-radius:4px;padding:1px 6px}.tag.subagent{background:#3a2f10;color:#e0b85a}.tag.meta-type,.tag.meta-depth{margin-left:6px}.tag.meta-depth{background:var(--tag);color:var(--muted)}.schema-banner{background:#3a2f10;color:#e0b85a;border-bottom:1px solid var(--border);padding:8px 16px;font-size:13px;text-align:center}.schema-banner code{background:#0000004d;padding:1px 5px;border-radius:4px}:root[data-theme=light] .schema-banner{background:#fbe9c8;color:#8a5a0f}.pager{display:flex;align-items:center;gap:16px;justify-content:center;margin-top:18px}.page-jump{display:inline-flex;align-items:center}.page-jump select{padding:6px 8px;font-size:13px}.detail-head{margin-bottom:18px}.back{font-size:13px}.detail-head h1{font-size:20px;margin:8px 0}.detail-meta{display:flex;flex-wrap:wrap;gap:14px;align-items:center;color:var(--text);font-size:13px}.detail-meta .path,.spawned-by{color:var(--muted)}.export{margin-left:auto;border:1px solid var(--border);border-radius:6px;padding:6px 12px}.export-menu{margin-left:auto}.export-menu>summary.export{display:inline-block;list-style:none;cursor:pointer}.export-menu>summary.export::-webkit-details-marker{display:none}.export-menu .col-menu a{display:block;padding:5px 8px;border-radius:4px;white-space:nowrap;text-decoration:none;color:var(--text)}.export-menu .col-menu a:hover{background:var(--panel2)}.export-menu .col-menu a.export-verbatim{color:var(--warn, #c9772b)}.subagent-link{display:inline-block;font-size:12px;margin:0 0 4px 10px}.subagents{margin:0 0 18px;padding:12px 14px;border:1px solid var(--border);border-radius:8px}.subagents h2{font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:0 0 8px}.subagents ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.subagents li{font-size:13px}.wf-run{border:1px solid var(--border);border-radius:6px;margin-top:8px;background:var(--panel2)}.wf-run>summary{cursor:pointer;padding:7px 10px;display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;list-style:none}.wf-run>summary::-webkit-details-marker{display:none}.wf-run>summary:before{content:"▸";color:var(--muted);font-size:11px}.wf-run[open]>summary:before{content:"▾"}.wf-run-name{font-weight:600;font-size:13px}.wf-run>ul{padding:0 10px 10px 24px}.wf-run code{font-size:11px;color:var(--muted)}.cmd{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;margin:4px 0}.cmd-chip{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;font-weight:600;color:var(--accent);border:1px solid var(--accent);border-radius:6px;padding:2px 9px;background:color-mix(in srgb,var(--accent) 10%,transparent)}.cmd-args{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--muted)}.cmd-out{margin:4px 0 0;padding:6px 10px;border-left:2px solid var(--border);color:var(--muted);font-size:12px;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.cmd-note{margin:2px 0}.bash-desc,.bash-preview{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--muted)}.bash-preview{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.shell{margin-top:6px;background:var(--code-bg);border:1px solid var(--border);border-radius:6px;padding:10px}.shell-cmd{margin:0;white-space:pre-wrap;word-break:break-word;overflow-x:auto;font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:12px}.shell-gutter{color:var(--accent);-webkit-user-select:none;user-select:none}.shell-gutter.cont{color:transparent}.shell-out{margin:6px 0 0;padding:8px 10px;white-space:pre-wrap;word-break:break-word;overflow-x:auto;background:var(--code-bg);border-radius:6px;color:var(--muted);font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:12px}.bash-badges{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}.bash-badge{font-size:11px;color:var(--muted);background:var(--tag);border-radius:6px;padding:1px 7px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.edit-path{flex:1;min-width:0;display:flex;gap:8px;align-items:baseline;overflow:hidden;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.edit-path .base{font-weight:600;flex:none}.edit-path .dir{color:var(--muted);font-size:11px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.diff-stat{flex:none;display:inline-flex;gap:6px;font-size:11px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.diff-stat .add{color:var(--ok)}.diff-stat .del{color:var(--err)}.diff{margin-top:6px;border:1px solid var(--border);border-radius:6px;overflow:hidden;background:var(--code-bg)}.diff-line{display:flex;font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:12px;line-height:1.5}.diff-sign{width:2ch;flex:none;text-align:center;-webkit-user-select:none;user-select:none;color:var(--muted)}.diff-text{flex:1;min-width:0;white-space:pre-wrap;word-break:break-word;padding-right:8px}.diff-line.add{background:color-mix(in srgb,var(--ok) 15%,transparent)}.diff-line.add .diff-sign{color:var(--ok)}.diff-line.del{background:color-mix(in srgb,var(--err) 15%,transparent)}.diff-line.del .diff-sign{color:var(--err)}.diff-line.ctx{color:var(--muted)}.diff-hunk-sep{padding:2px 8px;font-size:11px;color:var(--muted);background:var(--panel2);border-bottom:1px solid var(--border)}.diff-more{padding:4px 8px;font-size:11px;color:var(--muted);font-style:italic}.task-notif{margin:4px 0;padding:7px 10px;border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:6px;background:var(--panel2)}.task-notif-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}.task-notif-id{font-size:11px;color:var(--muted)}.task-notif-summary{margin-top:4px;font-size:13px;color:var(--muted)}.task-status{text-transform:lowercase}.task-status-completed{color:var(--ok, #2e7d32);border-color:var(--ok, #2e7d32)}.task-status-failed,.task-status-error{color:var(--err, #c62828);border-color:var(--err, #c62828)}.wf-result{margin-top:14px}.wf-result h2{margin-bottom:6px;display:flex;align-items:baseline;gap:8px}.wf-result-summary{margin:0 0 8px;font-size:14px}.wf-result-body{max-height:520px;overflow:auto}.wf-failures{margin-top:8px}.wf-failures>summary{cursor:pointer;color:var(--muted);font-size:13px}.wf-trunc{margin-top:6px}.rv-root{font-size:13px;line-height:1.55}.json-chev{color:var(--muted);display:inline-block;width:1.1em}.json-number{color:#f0a868}.json-null{color:var(--muted)}.rv-str{overflow-wrap:anywhere}.rv-true{color:var(--user)}.rv-false{color:var(--err)}.rv-metrics{display:flex;flex-wrap:wrap;gap:4px 20px;margin:4px 0 10px}.rv-metric{display:flex;gap:7px;align-items:baseline}.rv-mkey{color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.rv-mval{font-weight:600}.rv-list{margin:4px 0;padding-left:18px}.rv-section{margin:3px 0}.rv-sec-head{background:none;border:none;border-radius:0;padding:3px 0;margin:0;cursor:pointer;font:inherit;color:var(--text);text-align:left;width:100%;display:flex;gap:6px;align-items:baseline}.rv-sec-head:hover{text-decoration:none}.rv-sec-name{color:var(--accent);font-weight:600}.rv-sec-body{padding-left:12px;margin-left:4px;border-left:1px solid var(--border)}.rv-table-wrap{max-height:360px;overflow:auto;border:1px solid var(--border);border-radius:6px;margin:4px 0}.rv-table{border-collapse:collapse;width:100%;font-size:12.5px}.rv-table th{position:sticky;top:0;background:var(--panel2);text-align:left;padding:5px 9px;color:var(--muted);font-weight:600;border-bottom:1px solid var(--border);white-space:nowrap}.rv-table td{padding:4px 9px;border-bottom:1px solid var(--border);vertical-align:top}.rv-table tr:last-child td{border-bottom:none}.rv-rowkey{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--accent);white-space:nowrap}.transcript{display:flex;flex-direction:column;gap:10px}.transcript-tools{display:flex;align-items:center;gap:12px;margin-bottom:2px}.unturned{display:flex;flex-direction:column;gap:10px}.transcript-search{display:flex;align-items:center;gap:6px;margin-bottom:6px}.transcript-search input{flex:1;min-width:0;max-width:420px}.transcript-search .ts-icon{flex:none;opacity:.7}.transcript-search .ts-count{flex:none;min-width:116px}.to-top{position:fixed;right:18px;bottom:18px;z-index:19;width:38px;height:38px;border-radius:50%;border:1px solid var(--border);background:var(--panel2);color:var(--text);font-size:16px;line-height:1;cursor:pointer;box-shadow:0 4px 14px #0000004d}.to-top:hover{background:var(--tag)}.to-top:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.app:has(.search-nav) .to-top{bottom:68px}.search-nav{position:fixed;right:18px;bottom:18px;z-index:20;display:flex;align-items:center;gap:6px;max-width:calc(100vw - 36px);padding:6px 8px;background:var(--panel2);border:1px solid var(--border);border-radius:999px;box-shadow:0 4px 16px #00000047}.search-nav .sn-term{display:flex;align-items:center;gap:8px;min-width:0;padding:2px 2px 2px 0;font-size:12px}.search-nav .sn-q{color:var(--muted);max-width:22ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.search-nav .sn-pos{color:var(--text);font-weight:600;font-variant-numeric:tabular-nums}:root{--hl-bg: #e0b85a;--hl-fg: #0f1115}:root[data-theme=light]{--hl-bg: #ffe08a;--hl-fg: #1b1f27}::highlight(al-search){background-color:var(--hl-bg);color:var(--hl-fg)}.turn-matches{flex:none;font-size:11px;font-weight:600;color:var(--hl-fg);background:var(--hl-bg);border-radius:999px;padding:1px 7px}.turn{display:flex;flex-direction:column;gap:10px}.turn-head{display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:transparent;border:none;border-top:1px dashed var(--border);border-radius:0;padding:8px 4px 4px;font-size:12px;color:var(--accent);position:sticky;top:0;z-index:1;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.turn-head:hover:not(:disabled){border-color:var(--accent)}.turn-head .turn-chev{margin-left:0;color:var(--muted)}.turn-no{font-weight:600}.turn-preview{color:var(--muted);font-weight:400;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.turn-stats{margin-left:auto;flex:none}.turn-body{display:flex;flex-direction:column;gap:10px}.turn-body:empty{display:none}.event{background:var(--panel);border:1px solid var(--border);border-radius:8px;padding:12px;scroll-margin-top:16px}.event.ev-user{border-left:3px solid var(--user)}.event.ev-assistant{border-left:3px solid var(--assistant)}.event.ev-flagged{animation:agentlens-flag 3s ease-out;position:relative;z-index:1}@keyframes agentlens-flag{0%,45%{box-shadow:inset 6px 0 0 var(--gold),0 0 0 2px var(--gold),0 0 22px 2px color-mix(in srgb,var(--gold) 45%,transparent);background:color-mix(in srgb,var(--gold) 22%,var(--panel))}to{box-shadow:inset 0 0 0 0 transparent,0 0 0 0 transparent,0 0 0 0 transparent;background:var(--panel)}}@media(prefers-reduced-motion:reduce){.event.ev-flagged{animation:none;box-shadow:inset 6px 0 0 var(--gold),0 0 0 2px var(--gold);background:color-mix(in srgb,var(--gold) 18%,var(--panel))}}.ev-meta{display:flex;align-items:center;gap:8px;margin-bottom:6px;font-size:12px}.ev-who{font-weight:600}.ev-tokens{white-space:nowrap}.ev-time{margin-left:auto}.text{white-space:pre-wrap;word-break:break-word}.text-wrap{position:relative}.text-wrap.is-clamped .text{max-height:22em;overflow:hidden}.text-wrap.is-clamped:after{content:"";position:absolute;left:0;right:0;top:calc(22em - 48px);height:48px;background:linear-gradient(transparent,var(--panel));pointer-events:none}.show-more{margin-top:6px;position:relative}.transcript-tools .format-toggle{margin-left:auto;display:flex;gap:0}.format-toggle button,.view-toggle button{border-radius:0;position:relative}.format-toggle button:first-child,.view-toggle button:first-child{border-radius:6px 0 0 6px}.format-toggle button:last-child,.view-toggle button:last-child{border-radius:0 6px 6px 0}.format-toggle button:not(:first-child),.view-toggle button:not(:first-child){margin-left:-1px}.format-toggle button.is-active,.view-toggle button.is-active{background:var(--panel2);color:var(--text);border-color:var(--accent);z-index:1}.format-toggle button:hover:not(:disabled),.view-toggle button:hover:not(:disabled){z-index:2}.text.md{white-space:normal}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md p{margin:0 0 .7em}.md h1,.md h2,.md h3,.md h4,.md h5,.md h6{margin:1em 0 .4em;line-height:1.25;font-weight:600}.md h1{font-size:1.3em}.md h2{font-size:1.18em}.md h3{font-size:1.08em}.md h4,.md h5,.md h6{font-size:1em}.md ul,.md ol{margin:0 0 .7em;padding-left:1.4em}.md li{margin:.15em 0}.md li>ul,.md li>ol{margin-bottom:0}.md a{color:var(--accent);text-decoration:underline}.md code{font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:.88em;background:var(--code-bg);border:1px solid var(--border);border-radius:4px;padding:.1em .35em}.md pre{background:var(--code-bg);border:1px solid var(--border);border-radius:6px;padding:10px;overflow-x:auto;margin:0 0 .7em}.md pre code{background:none;border:none;padding:0;font-size:.85em}.md blockquote{margin:0 0 .7em;padding:.1em 0 .1em .9em;border-left:3px solid var(--border);color:var(--muted)}.md hr{border:none;border-top:1px solid var(--border);margin:1em 0}.md table{border-collapse:collapse;margin:0 0 .7em;display:block;overflow-x:auto}.md th,.md td{border:1px solid var(--border);padding:5px 9px;text-align:left}.md th{background:var(--panel2)}.md img{max-width:100%}.thinking{margin:4px 0}.thinking-toggle{font-size:12px;padding:2px 8px;color:var(--muted)}.thinking-body{white-space:pre-wrap;word-break:break-word;background:var(--panel2);border-radius:6px;padding:10px;margin:6px 0;color:var(--muted);font-size:13px}.tool{margin-top:6px;border:1px solid var(--border);border-radius:6px;background:var(--panel2)}.tool-err{border-color:var(--err)}.tool-err-stat{color:var(--err)}.tool-head{display:flex;align-items:center;gap:10px;width:100%;background:transparent;border:none;text-align:left}.tool-name{font-weight:600;font-size:13px}.tool-status{font-size:11px;color:var(--muted)}.chev{margin-left:auto;color:var(--muted)}.tool-body{padding:0 10px 10px}.code,.result{white-space:pre-wrap;word-break:break-word;background:var(--code-bg);border-radius:6px;padding:10px;font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:12px;overflow-x:auto}.result{color:var(--muted);margin-top:6px;font-family:inherit}.full-result{margin-top:6px}.full-result .show-full{font-size:12px;color:var(--accent);border:1px solid var(--border);border-radius:6px;padding:2px 8px;cursor:pointer}.full-result .code-block{margin-top:6px}.full-result .code{max-height:420px;overflow:auto}.nav{display:flex;gap:4px}.nav-link{color:var(--muted);font-size:13px;padding:4px 10px;border-radius:6px}.nav-link:hover{text-decoration:none;color:var(--text);background:var(--panel2)}.nav-link.active{color:var(--text);background:var(--panel2)}.ctl{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:13px}.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}.kpi{background:var(--panel);border:1px solid var(--border);border-radius:8px;padding:12px 14px}.kpi-label{font-size:12px;color:var(--muted)}.kpi-value{font-size:22px;font-weight:700;margin:4px 0;font-variant-numeric:tabular-nums}.kpi-sub{font-size:11px;color:var(--muted)}.kpi-bd{list-style:none;margin:6px 0 0;padding:0;display:flex;flex-direction:column;gap:5px}.kpi-bd li{display:grid;grid-template-columns:auto 1fr auto auto;align-items:center;gap:8px;font-size:13px}.kpi-bd-dot{width:9px;height:9px;border-radius:2px}.kpi-bd-name{color:var(--muted)}.kpi-bd-val{font-variant-numeric:tabular-nums;font-weight:600}.kpi-bd-pct{font-variant-numeric:tabular-nums;color:var(--muted);min-width:32px;text-align:right}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(380px,1fr));gap:14px}.card{background:var(--panel);border:1px solid var(--border);border-radius:8px;padding:14px;min-width:0;display:flex;flex-direction:column;position:relative}.card-head{display:flex;align-items:baseline;gap:10px;margin-bottom:10px;flex-wrap:wrap}.card-head h3{margin:0;font-size:14px}.card-hint{font-size:11px;color:var(--muted)}.lat-legend{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px 12px;font-size:12px}.lat-chip{display:inline-flex;align-items:center;gap:5px;background:none;border:1px solid transparent;border-radius:5px;padding:1px 5px;cursor:pointer;font:inherit;line-height:1.4}.lat-chip:hover{border-color:var(--border)}.lat-chip:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.lat-key{display:inline-flex;align-items:center;gap:5px;padding-left:4px}.card-actions{margin-left:auto;display:flex;align-items:center;gap:8px}.link-btn{background:none;border:none;color:var(--accent);font-size:11px;cursor:pointer;padding:0;white-space:nowrap}.link-btn:hover{text-decoration:underline}.chart-body{height:var(--chart-h, 240px)}.seg{display:inline-flex;border:1px solid var(--border);border-radius:6px;overflow:hidden}.seg button{background:none;border:none;color:var(--muted);font-size:11px;padding:2px 8px;cursor:pointer}.seg button+button{border-left:1px solid var(--border)}.seg button.on{background:var(--panel2);color:var(--text)}.views{display:flex;margin-bottom:14px}.dash-strip{margin-bottom:18px}.strip-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}.strip-head h2{font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:0}.strip-actions{margin-left:auto;display:flex;align-items:center;gap:8px}.strip-menu{min-width:210px}.strip-row{display:flex;align-items:center;gap:2px}.strip-row label{flex:1}.strip-row .move{background:none;border:none;color:var(--muted);cursor:pointer;padding:2px 5px;font-size:12px;line-height:1;border-radius:4px}.strip-row .move:hover:not(:disabled){background:var(--panel2);color:var(--text)}.strip-row .move:disabled{opacity:.3;cursor:default}.axis-link{fill:var(--muted);cursor:pointer}.axis-link:hover{fill:var(--accent);text-decoration:underline}.empty{color:var(--muted);font-size:13px;padding:24px 8px}.empty code{background:var(--panel2);padding:1px 5px;border-radius:4px}.classification{display:flex;align-items:center;gap:10px;margin-top:12px;flex-wrap:wrap}.tag.complexity{background:#2c2440;color:#b98cff}.tag.cat{color:var(--text);background:#243}.tag.cat-feature{background:#173a2a;color:#7ee0a0}.tag.cat-bugfix{background:#3a1d1d;color:#ff9b9b}.tag.cat-refactor{background:#233247;color:#6ea8fe}.tag.cat-docs{background:#2f2a16;color:#e0b85a}.tag.cat-ops{background:#232a33;color:#79c0ff}.tag.cat-review{background:#2c2440;color:#b98cff}.tag.cat-chore{background:var(--tag);color:var(--muted)}.small{font-size:12px}button.small{padding:2px 8px;font-size:12px}.signals{margin-top:8px;max-height:320px;overflow:auto;width:100%}.signals-panel{width:100%;margin-top:8px;padding:12px 14px;background:var(--panel);border:1px solid var(--border);border-radius:8px;display:flex;flex-direction:column;gap:14px}.sig-section{display:flex;flex-direction:column;gap:7px}.sig-h{margin:0;font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.03em;color:var(--text)}.sig-h .muted{font-weight:400;text-transform:none;letter-spacing:0}.sig-bars{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:5px}.sig-bar-row{display:grid;grid-template-columns:110px 1fr auto;align-items:center;gap:10px;font-size:12px}.sig-bar-label{color:var(--text);text-transform:capitalize}.sig-bar{height:8px;background:var(--code-bg);border-radius:4px;overflow:hidden}.sig-bar-fill{display:block;height:100%;background:var(--accent);border-radius:4px;min-width:2px}.sig-bar-val{color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}.sig-bar-sub{grid-column:2 / -1;font-size:11px;margin-top:-2px}.sig-bar-row.is-win .sig-bar-fill{background:var(--user)}.sig-bar-row.is-win .sig-bar-label{color:var(--user);font-weight:600}.sig-grid{display:grid;grid-template-columns:max-content 1fr;gap:6px 14px;margin:0;font-size:12px}.sig-grid dt{color:var(--muted)}.sig-grid dd{margin:0;color:var(--text)}.sig-chips{display:inline-flex;flex-wrap:wrap;gap:4px 6px}.sig-chip{background:var(--panel2);border:1px solid var(--border);border-radius:4px;padding:1px 6px}.sig-files{font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:11px;color:var(--muted);word-break:break-all;max-height:140px;overflow:auto}.skill-head{margin:8px 0 14px}.skill-head h1{margin:0 0 4px;font-size:1.5em}.skill-head-meta{font-size:13px}.skill-version-bar{display:flex;flex-wrap:wrap;align-items:center;gap:14px;margin-bottom:14px}.skill-version-bar select{max-width:460px}.skill-cards{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:14px;align-items:start}@media(max-width:1200px){.skill-cards{grid-template-columns:1fr}}.skill-body{max-height:70vh;overflow:auto}.file-view .card{margin-top:14px}.skill-body-card,.skill-sessions-card{min-width:0}.skill-sessions-card table{width:100%}.sessions th .sort-th{display:inline-flex;align-items:center;gap:4px;background:none;border:none;padding:0;margin:0;font:inherit;font-weight:600;font-size:12px;color:var(--muted);cursor:pointer}.sessions th .sort-th:hover:not(:disabled){color:var(--text);border:none}.sessions th .sort-th.is-active{color:var(--text)}.sort-ind{font-size:9px;opacity:.6}.sessions th .sort-th.is-active .sort-ind{color:var(--accent);opacity:1}.filter-select{position:relative;display:inline-block}.filter-select-btn{display:inline-flex;align-items:center;justify-content:space-between;gap:8px;min-width:180px;max-width:280px;text-align:left;padding:6px 10px}.filter-select-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.filter-select .chev{color:var(--muted);font-size:10px}.filter-select-pop{position:absolute;z-index:20;top:calc(100% + 4px);left:0;min-width:240px;max-width:380px;background:var(--panel2);border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 24px #0000004d;padding:6px}.filter-select-search{width:100%;margin-bottom:6px}.filter-select-list{list-style:none;margin:0;padding:0;max-height:260px;overflow-y:auto}.filter-select-opt{padding:6px 8px;border-radius:5px;cursor:pointer;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.filter-select-opt.is-active{background:var(--panel)}.filter-select-opt.is-selected{color:var(--accent);font-weight:600}.filter-select-empty{padding:8px;font-size:13px}.plan-card{margin-top:6px;border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:6px;background:var(--panel2);padding:8px 12px}.plan-card-head{font-weight:600;font-size:13px;margin-bottom:4px}.qa-card{margin-top:6px;border:1px solid var(--border);border-left:3px solid var(--user);border-radius:6px;background:var(--panel2);padding:8px 12px}.qa-card-head{font-weight:600;font-size:13px;margin-bottom:6px}.qa-q{margin:8px 0}.qa-q+.qa-q{border-top:1px solid var(--border);padding-top:8px}.qa-q-head{display:flex;gap:8px;align-items:baseline;margin-bottom:2px}.qa-question{font-weight:600;font-size:13px;margin-bottom:6px}.qa-options{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.qa-opt{display:flex;gap:8px;align-items:baseline;padding:5px 8px;border:1px solid var(--border);border-radius:5px}.qa-opt.is-selected{border-color:var(--ok);background:var(--panel)}.qa-mark{font-size:13px;line-height:1.3}.qa-opt.is-selected .qa-mark{color:var(--ok)}.qa-opt-body{display:flex;flex-direction:column;gap:2px;min-width:0}.qa-opt-label{font-weight:600;font-size:13px}.qa-opt-desc{font-size:12px}.qa-note{margin-top:6px;font-size:13px;color:var(--muted);border-left:2px solid var(--border);padding-left:8px}.copy-btn{font-size:11px;padding:2px 7px;line-height:1.4;color:var(--muted);flex:none}.copy-btn:hover:not(:disabled){color:var(--text)}.copy-hover{opacity:0;transition:opacity .12s}.event:hover .copy-hover,.copy-hover:focus-visible{opacity:1}.ev-copy{margin-left:auto}.code-block{position:relative}.code-block .copy-corner{position:absolute;top:6px;right:6px;z-index:1;background:var(--panel2);opacity:0;transition:opacity .12s}.code-block:hover .copy-corner,.code-block .copy-corner:focus-visible{opacity:1}.launch{margin-top:6px;font-size:13px}.launch-meta{margin-bottom:10px;display:flex;flex-direction:column;gap:4px}.launch-desc{font-size:13px}.launch-metaline{font-size:12px}.launch-metaline code{font-size:11px;color:var(--muted);word-break:break-all}.launch-src>summary{cursor:pointer;font-size:12px;color:var(--muted)}.launch-src pre{margin-top:6px;max-height:320px;overflow:auto}.launch-tasks-head{font-size:12px;color:var(--muted);font-weight:600;margin:4px 0 8px}.launch-card{border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:6px;background:var(--panel2);padding:8px 12px;margin-bottom:8px}.launch-card-head{display:flex;align-items:baseline;gap:8px;font-weight:600;font-size:13px;margin-bottom:6px}.launch-card-idx{flex:none;min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--tag);color:var(--muted);font-size:11px;font-weight:600;display:inline-flex;align-items:center;justify-content:center}.launch-card-title{word-break:break-word}.launch-fields{margin:0;display:flex;flex-direction:column;gap:8px}.launch-field>dt{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin-bottom:2px}.launch-field>dd{margin:0}.launch-text{white-space:pre-wrap;word-break:break-word}.launch-list{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:3px}.launch-list>li{padding-left:2px}.launch-actions{display:flex;align-items:center;gap:8px;margin-top:8px}.launch-raw{max-height:420px;overflow:auto;margin-top:6px}.wf-launch details>summary{cursor:pointer;list-style:none}.wf-launch details>summary::-webkit-details-marker{display:none}.wf-launch details>summary h2{display:inline-flex;align-items:baseline;gap:6px}.wf-launch details>summary h2:before{content:"▸";color:var(--muted);font-size:12px}.wf-launch details[open]>summary h2:before{content:"▾"}.launch-tool{border-left:3px solid var(--accent);padding:8px 12px}.launch-tool-head{display:flex;align-items:baseline;gap:10px;margin-bottom:2px}.wf-phases{display:flex;flex-wrap:wrap;align-items:stretch;gap:8px;margin-top:10px}.wf-phase-chip{display:flex;flex-direction:column;gap:2px;font-size:12px;padding:6px 12px;border:1px solid var(--border);border-radius:10px;background:var(--panel2);min-width:88px}.wf-phase-title{font-weight:600}.wf-phase-desc{color:var(--muted);font-size:11px}.wf-phase-arrow{align-self:center;color:var(--muted);font-size:15px}.wf-logs{margin-top:14px}.wf-logs>summary{cursor:pointer;font-size:13px;font-weight:600}.wf-log-list{margin:8px 0 0;padding-left:0;list-style:none;display:flex;flex-direction:column;gap:2px;font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:12px}.wf-log-list>li{padding:3px 8px;border-radius:4px;background:var(--panel2);white-space:pre-wrap;word-break:break-word}:root[data-theme=light] .brand-logo{filter:brightness(.5) saturate(1.8)}:root[data-theme=light] .tag.subagent{background:#f6e6c8;color:#8a6d1f}:root[data-theme=light] .tag.complexity{background:#ece4fb;color:#6d28d9}:root[data-theme=light] .tag.cat{background:#dff0e6;color:#10633a}:root[data-theme=light] .tag.cat-feature{background:#d8f3e3;color:#0f7a44}:root[data-theme=light] .tag.cat-bugfix{background:#fbe0e0;color:#b12626}:root[data-theme=light] .tag.cat-refactor{background:#dbe8fb;color:#1d4ed8}:root[data-theme=light] .tag.cat-docs{background:#f6ecd0;color:#8a6d1f}:root[data-theme=light] .tag.cat-ops{background:#dceaf8;color:#1a5fa8}:root[data-theme=light] .tag.cat-review{background:#ece4fb;color:#6d28d9}:root[data-theme=light] .json-number{color:#b45309}.tag.sev{font-weight:600;text-transform:capitalize}.sev-critical{background:#3a1a1a;color:#ff8f8f}.sev-high{background:#3a2a12;color:#f0a860}.sev-medium{background:#2f2a16;color:#e0b85a}.sev-low{background:#23303f;color:#79c0ff}.sev-info{background:var(--tag);color:var(--muted)}.sec-count{display:inline-flex;align-items:center;gap:6px;justify-content:flex-end}:root{--sev-c-critical: #ff8f8f;--sev-c-high: #f0a860;--sev-c-medium: #e0b85a;--sev-c-low: #79c0ff}:root[data-theme=light]{--sev-c-critical: #b12626;--sev-c-high: #b5651d;--sev-c-medium: #8a6d1f;--sev-c-low: #1a5fa8}.sev-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:var(--muted);flex:none}.sev-dot.sev-critical{background:var(--sev-c-critical)}.sev-dot.sev-high{background:var(--sev-c-high)}.sev-dot.sev-medium{background:var(--sev-c-medium)}.sev-dot.sev-low{background:var(--sev-c-low)}.sev-dot.sev-info{background:var(--muted)}.tag.framework{background:transparent;border:1px solid var(--border);color:var(--muted)}.sev-border-critical{border-left:3px solid var(--err)}.sev-border-high{border-left:3px solid #e0873a}.sev-border-medium{border-left:3px solid var(--gold)}.sev-border-low{border-left:3px solid var(--accent)}.sev-border-info{border-left:3px solid var(--border)}.tool-findings{display:flex;flex-direction:column;gap:6px;margin:4px 0 10px}.finding{background:var(--panel);border:1px solid var(--border);border-radius:6px}.finding-head{display:flex;align-items:center;gap:8px;width:100%;background:none;border:none;padding:7px 10px;text-align:left;cursor:pointer}.finding-head:hover:not(:disabled){border-color:transparent}.finding-title{font-weight:600;font-size:13px}.finding-head .chev{margin-left:auto;color:var(--muted)}.finding-body{padding:0 10px 10px;display:flex;flex-direction:column;gap:8px}.finding-evidence{white-space:pre-wrap;word-break:break-word}.security-banner{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:12px;padding:8px 12px;background:var(--panel);border:1px solid var(--border);border-radius:8px}.security-banner-text{font-weight:600;font-size:13px}.security-banner-sevs{display:flex;gap:5px;flex-wrap:wrap}.kpi-row{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:16px}.sev-kpis .kpi{min-width:108px}.kpi-btn{display:block;text-align:left;cursor:pointer;color:inherit;font:inherit;text-decoration:none}.kpi-btn:hover{border-color:var(--accent);text-decoration:none}.kpi-btn.is-active{border-color:var(--accent);outline:2px solid var(--accent)}.sev-kpi.sev-critical .kpi-value{color:#ff8f8f}.sev-kpi.sev-high .kpi-value{color:#f0a860}.sev-kpi.sev-medium .kpi-value{color:#e0b85a}.sev-kpi.sev-low .kpi-value{color:#79c0ff}.finding-evidence-cell code{white-space:pre-wrap;word-break:break-word;font-size:12px;color:var(--muted)}.findings-table td{vertical-align:top}.linkish{background:none;border:none;color:var(--accent);cursor:pointer;padding:0 2px;font:inherit}.sec-reference{margin-top:28px}.sec-reference h2{font-size:16px;margin-bottom:4px}.sec-ref-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:12px;margin-top:10px}.sec-ref>summary{display:flex;align-items:center;gap:10px;cursor:pointer;flex-wrap:wrap;list-style:none}.sec-ref>summary::-webkit-details-marker{display:none}.sec-ref>summary:before{content:"▸";color:var(--muted)}.sec-ref[open]>summary:before{content:"▾"}.sec-ref-title{font-weight:600}.sec-ref-body{margin:10px 0 0;display:grid;grid-template-columns:auto 1fr;gap:6px 12px}.sec-ref-body dt{color:var(--muted);font-size:12px}.sec-ref-body dd{margin:0;font-size:13px;line-height:1.45}.demo-note{margin:0 0 16px;padding:9px 13px;border-radius:8px;font-size:13px;background:var(--panel);border:1px solid var(--border);color:var(--muted)}.demo-note strong{color:var(--text)}.triage-counts{margin:-6px 0 12px}.triage-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px;padding:8px 12px;background:var(--panel);border:1px solid var(--border);border-radius:8px}.triage-bar button{font-size:13px}.check-col{width:28px;text-align:center}.findings-table .check-col input{cursor:pointer}tr.is-dismissed{opacity:.6}.finding-evidence-cell .tool-tag{margin-right:6px;vertical-align:middle}.finding-actions{white-space:nowrap}.finding-actions .linkish{margin-right:8px}.muted-rules{margin-top:20px}.muted-rules>summary{cursor:pointer;list-style:none}.muted-rules>summary::-webkit-details-marker{display:none}.muted-rules>summary:before{content:"▸ ";color:var(--muted)}.muted-rules[open]>summary:before{content:"▾ "}.muted-rules-list{list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;gap:6px}.muted-rules-list li{display:flex;align-items:center;gap:4px;font-size:13px;flex-wrap:wrap}:root[data-theme=light] .sev-critical{background:#fbe0e0;color:#b12626}:root[data-theme=light] .sev-high{background:#f7e2c8;color:#b5651d}:root[data-theme=light] .sev-medium{background:#f6ecd0;color:#8a6d1f}:root[data-theme=light] .sev-low{background:#dceaf8;color:#1a5fa8}:root[data-theme=light] .sev-kpi.sev-critical .kpi-value{color:#b12626}:root[data-theme=light] .sev-kpi.sev-high .kpi-value{color:#b5651d}:root[data-theme=light] .sev-kpi.sev-medium .kpi-value{color:#8a6d1f}:root[data-theme=light] .sev-kpi.sev-low .kpi-value{color:#1a5fa8}.page-intro{margin:4px 0 0}.filter-chip{align-self:center}.tag.dismissed{margin-left:4px}.tag.framework,.findings-table .tag.subagent,.tag.mute-scope,.mute-note{margin-left:6px}.linkish.unmute{margin-left:8px}.sec-reference-intro{margin-top:0}.about{max-width:900px}.about h1{margin-bottom:4px}.about>p.muted{margin-top:0}.about section{margin-top:28px}.about h2{font-size:14px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin-bottom:8px}table.kv{width:100%;border-collapse:collapse}table.kv th[scope=row]{text-align:left;font-weight:500;color:var(--muted);padding:8px 16px 8px 0;vertical-align:top;white-space:nowrap;width:1%}table.kv td{padding:8px 0;vertical-align:top}table.kv tr+tr th,table.kv tr+tr td{border-top:1px solid var(--border)}table.kv .muted{font-size:12px;margin-top:4px}.about code.path{word-break:break-all}.origin-tag{font-size:11px;color:var(--muted);background:var(--tag);border-radius:8px;padding:1px 6px;white-space:nowrap}.warn-tag{font-size:11px;color:#e0b85a;background:#3a2f10;border-radius:8px;padding:1px 6px;white-space:nowrap}.timeline{border:1px solid var(--border);border-radius:8px;background:var(--panel);padding:8px 10px 6px;margin:10px 0}.tl-head{display:flex;align-items:center;gap:10px;font-size:12px;margin-bottom:4px}.tl-caption{margin-left:auto}.tl-ctl select{font:inherit;background:var(--panel2);color:var(--text);border:1px solid var(--border);border-radius:5px;padding:1px 4px}.tl-axis{font-variant-numeric:tabular-nums}.tl-svg{display:block;width:100%}.tl-break rect{fill:var(--panel2);stroke:var(--border);stroke-dasharray:2 2}.tl-mark{shape-rendering:crispEdges}.tl-context{fill:none;stroke:var(--muted);stroke-width:1.25;stroke-opacity:.65;pointer-events:none}.tl-swatch.is-line{height:2px;border-radius:1px;background:var(--muted);opacity:.65;align-self:center}.tl-expanded{cursor:zoom-out}.tl-expanded rect{fill:var(--panel2);stroke:var(--border);stroke-dasharray:2 2;opacity:.75}.tl-err{fill:var(--err)}.tl-file,.tl-spawn{fill:var(--muted)}.tl-find.sev-critical{fill:var(--sev-c-critical)}.tl-find.sev-high{fill:var(--sev-c-high)}.tl-find.sev-medium{fill:var(--sev-c-medium)}.tl-find.sev-low{fill:var(--sev-c-low)}.tl-find.sev-info{fill:var(--muted)}.tl-svg{cursor:crosshair}.tl-svg.is-dragging{cursor:ew-resize}.tl-break{cursor:zoom-in}.tl-cursor{fill:var(--text);opacity:0;pointer-events:none}.tl-svg:focus-visible .tl-cursor{opacity:.9}.tl-svg:focus{outline:none}.tl-svg:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}.tl-sel-shade{fill:var(--bg);opacity:.62;pointer-events:none}.tl-sel-box{fill:var(--accent);opacity:.1;pointer-events:none}.tl-sel-handle{fill:var(--accent);pointer-events:none}.tl-pill{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:12px;border:1px solid var(--border);border-radius:8px;background:var(--panel);padding:5px 10px;margin:-4px 0 10px}.tl-pill-range{font-weight:600;font-variant-numeric:tabular-nums}.tl-hover{fill:var(--text);opacity:.28;pointer-events:none}.timeline{position:relative}.tl-tip{position:absolute;bottom:52px;z-index:5;pointer-events:none;min-width:140px;max-width:260px;padding:6px 9px;border:1px solid var(--border);border-radius:7px;background:var(--panel2);box-shadow:0 6px 18px #00000059;font-size:12px;line-height:1.45}.tl-tip.is-right{text-align:right}.tl-tip-head{display:flex;gap:6px;align-items:baseline;font-weight:600}.tl-tip.is-right .tl-tip-head{justify-content:flex-end}.tl-tip-turn{color:var(--muted);font-weight:500}.tl-tip-row{font-variant-numeric:tabular-nums;display:flex;gap:6px;flex-wrap:wrap}.tl-tip.is-right .tl-tip-row{justify-content:flex-end}.tl-tip-flag{border-radius:4px;background:var(--tag);padding:0 5px;font-size:11px}.tl-tip-flag.is-err{background:color-mix(in srgb,var(--err) 22%,transparent);color:var(--err)}.tl-tip-flag.sev-critical{background:color-mix(in srgb,var(--sev-c-critical) 22%,transparent);color:var(--sev-c-critical)}.tl-tip-flag.sev-high{background:color-mix(in srgb,var(--sev-c-high) 22%,transparent);color:var(--sev-c-high)}.tl-tip-flag.sev-medium{background:color-mix(in srgb,var(--sev-c-medium) 22%,transparent);color:var(--sev-c-medium)}.tl-tip-flag.sev-low{background:color-mix(in srgb,var(--sev-c-low) 22%,transparent);color:var(--sev-c-low)}.tl-legend{display:flex;flex-wrap:wrap;gap:10px;font-size:11px;color:var(--muted);margin-top:4px}.tl-key{display:inline-flex;align-items:center;gap:4px}.tl-swatch{width:8px;height:8px;border-radius:2px;display:inline-block}.burn{display:flex;flex-direction:column;gap:8px;height:100%;justify-content:center}.burn-grid{display:flex;flex-direction:column;gap:2px}.burn-row{display:flex;align-items:center;gap:2px}.burn-day{width:30px;flex:none;font-size:11px;color:var(--muted)}.burn-cell{flex:1 1 0;height:14px;border-radius:2px}.burn-tick{flex:1 1 0;font-size:10px;color:var(--muted);font-style:normal;text-align:left}.burn-hours{margin-top:2px}.burn-lg .burn-cell{height:40px}.burn-lg .burn-day,.burn-lg .burn-tick{font-size:12px}.burn-lg .burn-day{width:36px}.burn-legend{display:flex;flex-direction:column;gap:3px;font-size:11px;color:var(--muted)}.burn-legend-cap{align-self:flex-start}.burn-bar{height:10px;border-radius:2px}.burn-ticks{position:relative;height:12px}.burn-ticks span{position:absolute;transform:translate(-50%);font-size:10px;font-variant-numeric:tabular-nums;white-space:nowrap}.burn-ticks span:first-child{transform:none}.burn-ticks span:last-child{transform:translate(-100%)}.chart-modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:50;background:#0009;display:flex;align-items:center;justify-content:center;padding:24px}.chart-modal{position:relative;width:min(1100px,100%);max-height:100%;overflow:auto}.chart-modal>.card{margin:0}.chart-modal-close{position:absolute;top:10px;right:10px;background:none;border:none;color:var(--muted);font-size:14px;line-height:1;cursor:pointer;padding:4px 6px;border-radius:4px}.chart-modal-close:hover{color:var(--text);background:var(--tag)}.chart-body-lg{height:min(70vh,720px)}.chart-body-lg:has(.burn){height:auto}.card-expand{background:none;border:none;color:var(--muted);font-size:12px;line-height:1;cursor:pointer;padding:2px 4px;border-radius:4px}.card-expand:hover{color:var(--accent);background:var(--tag)}.chart-moved{display:flex;align-items:center;justify-content:center;height:100%;color:var(--muted);font-size:12px}.card-guide{margin-left:2px}.card-guide>summary{list-style:none;cursor:help;color:var(--muted);font-size:12px;border-radius:50%;width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;line-height:1}.card-guide>summary::-webkit-details-marker{display:none}.card-guide>summary:hover,.card-guide[open]>summary{color:var(--accent);background:var(--tag)}.card-guide-body{position:absolute;z-index:6;top:40px;left:10px;right:10px;padding:10px 12px;border:1px solid var(--border);border-radius:7px;background:var(--panel2);box-shadow:0 6px 18px #00000059;font-size:12px;line-height:1.5;color:var(--text);font-weight:400}.card-guide-body p{margin:0 0 7px}.card-guide-body p:last-child{margin-bottom:0}.card-guide-body dt{color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.03em}.card-guide-body dd{margin:1px 0 7px}.card-guide-body dd:last-child{margin-bottom:0}.burn{position:relative}.burn-tip{position:absolute;z-index:6;pointer-events:none;padding:5px 8px;border:1px solid var(--border);border-radius:7px;background:var(--panel2);box-shadow:0 6px 18px #00000059;font-size:12px;line-height:1.45;white-space:nowrap}.burn-tip-head{font-weight:600}.burn-tip-row{color:var(--muted);font-variant-numeric:tabular-nums}.files-rework{margin:.4rem 0 .2rem;padding-left:.4rem;font-size:12px}.burn-tip-support{font-size:11px;opacity:.8}.burn-cell{cursor:default}.burn-cell:hover{outline:2px solid var(--text);outline-offset:-1px}