@swestash/agent-lens 0.9.6 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-lens.js +328 -96
- package/dist/agent-lens.js.map +1 -1
- package/package.json +1 -1
- package/web/404.html +2 -2
- package/web/assets/AboutView-B6r8WJKS.js +1 -0
- package/web/assets/{Dashboard-BkRLAY2N.js → Dashboard-C0axgFBI.js} +1 -1
- package/web/assets/{FileView-BbPK6hx9.js → FileView-D3OB1c3e.js} +1 -1
- package/web/assets/{FilesView-D0gm4_XO.js → FilesView-DYSJHOfO.js} +1 -1
- package/web/assets/{SecurityView-92YGEb3-.js → SecurityView-Dl5rRtT4.js} +1 -1
- package/web/assets/{SessionView-Dy0ELjaS.js → SessionView-77dXiwzp.js} +8 -8
- package/web/assets/SkillView-Bkwf24pB.js +1 -0
- package/web/assets/{SkillsView-FtrADGqR.js → SkillsView-CAGiD59V.js} +1 -1
- package/web/assets/{WorkflowView-D45UzOuV.js → WorkflowView-CR2GzUdU.js} +1 -1
- package/web/assets/{index-Bgxu3c84.js → index-BnVRCFL6.js} +1 -1
- package/web/assets/{index-DYY0_SmQ.js → index-BxbXFMQG.js} +13 -13
- package/web/assets/index-CeW4iDDs.css +1 -0
- package/web/assets/{jsonish-Dd3X-MG6.js → jsonish-B3QCD4cU.js} +1 -1
- package/web/assets/{severity-CoO1IKlD.js → severity-DTzxtVJn.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/SkillView-Te5jcVBw.js +0 -1
- package/web/assets/index-DBaa9asK.css +0 -1
package/package.json
CHANGED
package/web/404.html
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
document.documentElement.dataset.theme = "dark";
|
|
17
17
|
}
|
|
18
18
|
</script>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
20
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-BxbXFMQG.js"></script>
|
|
20
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CeW4iDDs.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
23
23
|
<div id="root"></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{x as j,j as e,A as g}from"./index-BxbXFMQG.js";const c="v0.10.0-1-gc8707c8";function d(r){if(r==null)return"unknown";if(r<1e3)return`${r} B`;const s=["kB","MB","GB","TB"];let n=r/1e3,t=0;for(;n>=1e3&&t<s.length-1;)n/=1e3,t++;return`${n<10?n.toFixed(1):Math.round(n)} ${s[t]}`}function i({label:r,children:s}){return e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:r}),e.jsx("td",{children:s})]})}function a({info:r}){return e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"path",children:r.path})," ",e.jsx("span",{className:"origin-tag",title:l(r.origin),children:r.origin})]})}function l(r){switch(r){case"env":return"Set by an environment variable";case"flag":return"Set by a command-line flag";case"file":return"Set in the config file";case"fixed":return"Not independently relocatable — move the whole data dir (ADR-021)";default:return"Built-in default"}}function o({label:r,v:s,what:n,rerun:t}){const h=s.in_data.filter(x=>x<s.expected);return e.jsxs(i,{label:r,children:["v",s.expected,s.stale&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"warn-tag",children:"data is older"})]}),e.jsx("div",{className:"muted",children:s.in_data.length===0?e.jsxs(e.Fragment,{children:["No ",n," stored yet."]}):s.stale?e.jsxs(e.Fragment,{children:["Stored ",n," came from v",h.join(", v")," — re-run ",e.jsx("code",{children:t})," to relabel with v",s.expected,"."]}):e.jsxs(e.Fragment,{children:["All stored ",n," came from v",s.in_data.join(", v"),"."]})})]})}function m(){const r=j("/about");return e.jsxs("div",{className:"about",children:[e.jsx("h1",{children:"About"}),e.jsxs("p",{className:"muted",children:["Diagnostics for this install. Configuration is shown read-only — it resolves"," ",e.jsx("code",{children:"flag > env > config file > default"}),", so change it with"," ",e.jsx("code",{children:"agent-lens config"}),", an env var, or the config file."]}),e.jsx(g,{state:r,children:s=>e.jsxs(e.Fragment,{children:[e.jsxs("section",{children:[e.jsx("h2",{children:"Versions"}),e.jsx("table",{className:"kv",children:e.jsxs("tbody",{children:[e.jsxs(i,{label:"Agent Lens",children:[s.versions.app," ",e.jsx("span",{className:"origin-tag",children:s.versions.app_source}),s.versions.app_source==="unknown"&&e.jsxs("span",{className:"muted",children:[" ","— no npm metadata and no git tag reachable; this is an unreleased or archive build"]})]}),c!==s.versions.app&&e.jsxs(i,{label:"Web build",children:[c," ",e.jsx("span",{className:"warn-tag",role:"status",children:"differs from the server"}),e.jsx("div",{className:"muted",children:"The page you are looking at was built from a different revision than the server serving it — usually a service still running an older install. Restart it, or rebuild the UI."})]}),e.jsxs(i,{label:"Schema",children:[s.versions.schema??"unstamped",s.versions.schema_stale&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"warn-tag",children:"stale"}),e.jsxs("div",{className:"muted",children:["Written by an older build (this one expects ",s.versions.schema_expected,"). Run"," ",e.jsx("code",{children:"agent-lens ingest --full"}),"."]})]})]}),e.jsx(o,{label:"Detector",v:s.versions.detector,what:"security findings",rerun:"agent-lens ingest --full"}),e.jsx(o,{label:"Classifier",v:s.versions.classifier,what:"session categories",rerun:"agent-lens metrics"})]})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Paths"}),e.jsx("table",{className:"kv",children:e.jsxs("tbody",{children:[e.jsx(i,{label:"Config file",children:s.paths.config_file?e.jsx("code",{className:"path",children:s.paths.config_file}):e.jsx("span",{className:"muted",children:"none — using built-in defaults"})}),e.jsx(i,{label:"Data dir",children:e.jsx(a,{info:s.paths.data_dir})}),e.jsx(i,{label:"Archive",children:e.jsx(a,{info:s.paths.archive})}),e.jsx(i,{label:"Database",children:e.jsx(a,{info:s.paths.db})}),e.jsx(i,{label:"Triage store",children:e.jsx(a,{info:s.paths.triage_db})})]})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Server"}),e.jsx("table",{className:"kv",children:e.jsxs("tbody",{children:[e.jsx(i,{label:"Bound to",children:e.jsxs("code",{children:[s.server.host,":",s.server.port]})}),e.jsx(i,{label:"Network",children:s.server.loopback_only?"Loopback only — not reachable from other machines":e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"warn-tag",children:"non-loopback bind"}),e.jsx("div",{className:"muted",children:"Reachable from other machines on this network. The API is unauthenticated."})]})})]})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Retention"}),e.jsx("table",{className:"kv",children:e.jsx("tbody",{children:e.jsxs(i,{label:"Keep .versions",children:[s.retention.versions_keep_days," day",s.retention.versions_keep_days===1?"":"s"," ",e.jsx("span",{className:"origin-tag",title:l(s.retention.origin),children:s.retention.origin}),e.jsxs("div",{className:"muted",children:["How long superseded transcript snapshots are kept before ",e.jsx("code",{children:"scripts/prune.sh"})," ","removes them. Does not affect the database."]})]})})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Pricing"}),e.jsx("table",{className:"kv",children:e.jsxs("tbody",{children:[e.jsxs(i,{label:"Models priced",children:[s.pricing.models," ",e.jsx("span",{className:"origin-tag",title:l(s.pricing.origin),children:s.pricing.origin}),e.jsxs("div",{className:"muted",children:["Cost is estimated from token counts at API list prices — never read from the transcripts, which do not record it. Override or add rates with a"," ",e.jsx("code",{children:"pricing"})," block in the config file."]})]}),s.pricing.applied.length>0&&e.jsx(i,{label:"Overrides",children:s.pricing.applied.map(n=>e.jsx("code",{className:"path",children:n},n))}),s.pricing.invalid.length>0&&e.jsxs(i,{label:"Ignored",children:[e.jsx("span",{className:"warn-tag",children:"malformed"})," ",s.pricing.invalid.map(n=>e.jsx("code",{className:"path",children:n},n)),e.jsxs("div",{className:"muted",children:["Each entry needs numeric ",e.jsx("code",{children:"input"})," and ",e.jsx("code",{children:"output"})," rates. These kept their built-in rate."]})]}),e.jsx(i,{label:"Unpriced models",children:s.pricing.unpriced.length===0?e.jsx("span",{className:"muted",children:"None — every model in this store has a rate"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"warn-tag",role:"status",children:"cost understated"})," ",s.pricing.unpriced.map(n=>e.jsx("code",{className:"path",children:n},n)),e.jsxs("div",{className:"muted",children:["These have token usage but no rate, so they contribute $0 to every cost shown. Upgrade for an updated table, or add rates under ",e.jsx("code",{children:"pricing"})," in the config file."]})]})})]})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Sources"}),s.sources.length===0?e.jsx("p",{className:"muted",children:"No sources configured."}):e.jsx("table",{className:"kv",children:e.jsx("tbody",{children:s.sources.map(n=>e.jsxs(i,{label:n.label,children:[e.jsx("code",{className:"path",children:n.config_dir})," ",e.jsx("span",{className:"origin-tag",children:n.agent})]},n.label))})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Storage"}),e.jsx("table",{className:"kv",children:e.jsxs("tbody",{children:[e.jsx(i,{label:"Database",children:d(s.storage.db_bytes)}),e.jsxs(i,{label:"Ingested",children:[d(s.storage.archive_bytes)," across ",s.storage.archive_files.toLocaleString()," file",s.storage.archive_files===1?"":"s",e.jsxs("div",{className:"muted",children:["Transcript bytes read into the database",s.storage.last_ingested?`, as of the last ingest (${new Date(s.storage.last_ingested).toLocaleString()})`:"",". Excludes anything in the archive that has not been ingested, such as"," ",e.jsx("code",{children:".versions/"})," retention snapshots — so it is not the archive folder’s size on disk."]})]})]})})]})]})})]})}export{m as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as q,j,u as zw,a as jb,f as Lt,s as Eb,b as Pn,c as xi,L as Ww,d as wi,g as ce,R as A,e as Uw,h as Wh,l as Kw,i as Hw,k as Gw,E as Vw,m as Xw,n as Yw,o as ho}from"./index-DYY0_SmQ.js";const po=8,Zw=26;function Jw(){const[e,t]=q.useState(new Set),r=o=>t(u=>{const s=new Set(u);return s.has(o)?s.delete(o):s.add(o),s});return{topN:(o,u)=>e.has(u)?o:o.slice(0,po),expandHeight:(o,u,s=Zw)=>e.has(o)?Math.max(240,u*s):void 0,expandBtn:(o,u)=>{if(!(u<=po))return j.jsx("button",{type:"button",className:"link-btn",onClick:()=>r(o),children:e.has(o)?`show top ${po}`:`show all (${u})`})}}}function Be(){const{theme:e}=zw();return q.useMemo(()=>{const t=getComputedStyle(document.documentElement),r=c=>t.getPropertyValue(c).trim(),n={bg:r("--bg"),panel:r("--panel"),panel2:r("--panel2"),border:r("--border"),text:r("--text"),muted:r("--muted"),accent:r("--accent"),green:r("--user"),gold:r("--gold"),red:r("--err"),violet:r("--violet"),teal:r("--teal")},i={input:n.green,output:n.accent,cache_creation:n.gold,cache_read:n.muted},a=[n.accent,n.green,n.gold,n.violet,n.teal,n.red,n.muted,"#d98c5f","#5f9ed9"],o={stroke:n.muted,tick:{fill:n.muted,fontSize:11},tickLine:!1},u={stroke:n.border,strokeDasharray:"3 3",vertical:!1},s={contentStyle:{background:n.panel2,border:`1px solid ${n.border}`,borderRadius:6,fontSize:12},labelStyle:{color:n.text},itemStyle:{color:n.text}};return{C:n,TOKEN_COLORS:i,PALETTE:a,axisProps:o,gridProps:u,tooltipStyle:s}},[e])}function ct({title:e,hint:t,actions:r,bodyHeight:n,hidden:i,children:a}){return i?null:j.jsxs("div",{className:"card",children:[j.jsxs("div",{className:"card-head",children:[j.jsx("h3",{children:e}),t&&j.jsx("span",{className:"card-hint",children:t}),r&&j.jsx("span",{className:"card-actions",children:r})]}),j.jsx("div",{className:"chart-body",style:n!=null?{height:n}:void 0,children:a})]})}function Ge({label:e,value:t,sub:r,title:n}){return j.jsxs("div",{className:"kpi",title:n,children:[j.jsx("div",{className:"kpi-label",children:e}),j.jsx("div",{className:"kpi-value",children:t}),r!=null&&j.jsx("div",{className:"kpi-sub",children:r})]})}function Mb(e,t){var n;const r=((n=e==null?void 0:e.payload)==null?void 0:n[t])??(e==null?void 0:e[t]);return typeof r=="string"&&r!==""?r:null}function Qw({active:e,payload:t,versionsByName:r}){var s,c,f,l;const{C:n,tooltipStyle:i}=Be();if(!e||!(t!=null&&t.length))return null;const a=String(((c=(s=t[0])==null?void 0:s.payload)==null?void 0:c.name)??""),o=Number(((l=(f=t[0])==null?void 0:f.payload)==null?void 0:l.n)??0),u=r.get(a)??[];return j.jsxs("div",{style:{...i.contentStyle,padding:"8px 10px",maxWidth:280},children:[j.jsx("div",{style:{color:n.text,fontWeight:600,marginBottom:4},children:a}),j.jsxs("div",{style:{color:n.muted,marginBottom:u.length?6:0},children:[o," firing",o===1?"":"s"," total"]}),u.map(h=>j.jsxs("div",{style:{color:n.text,display:"flex",justifyContent:"space-between",gap:12},children:[j.jsx("span",{style:{color:n.muted},children:h.version_id.slice(0,8)}),j.jsx("span",{children:h.n})]},h.version_id)),u.length>0&&j.jsx("div",{style:{color:n.muted,marginTop:6,fontSize:11},children:"click to open skill →"})]})}function Nf({x:e,y:t,payload:r,onSelect:n,title:i}){return j.jsxs("text",{x:e,y:t,dy:4,textAnchor:"end",className:"axis-link",fontSize:11,onClick:()=>(r==null?void 0:r.value)&&n(r.value),children:[i&&j.jsx("title",{children:i}),r==null?void 0:r.value]})}function eO(){const e=jb(),t=(n,i)=>{i!=null&&i!==""&&e(`/?${n}=${encodeURIComponent(i)}`)};return{drillFilter:t,drillTo:(n,i)=>a=>t(n,Mb(a,i))}}function tO({s:e}){const t=new Map(e.by_severity.map(a=>[a.severity,a.n])),r=t.get("critical")??0,n=t.get("high")??0,i=e.total===0?"—":`${r} / ${n}`;return j.jsxs(Ww,{className:"kpi kpi-btn"+(r>0?" sev-critical":n>0?" sev-high":""),to:"/security",title:"Security findings — critical / high. Opens the Security page.",children:[j.jsx("div",{className:"kpi-label",children:"Security findings"}),j.jsx("div",{className:"kpi-value",children:i}),j.jsx("div",{className:"kpi-sub",children:e.total===0?"no open findings":`critical / high · ${e.total} open in ${e.sessions_flagged} sessions`})]})}function rO({t:e}){const{TOKEN_COLORS:t}=Be(),r=e.input+e.output+e.cache_creation+e.cache_read,n=[{name:"Input",v:e.input,c:t.input},{name:"Output",v:e.output,c:t.output},{name:"Cache write",v:e.cache_creation,c:t.cache_creation},{name:"Cache read",v:e.cache_read,c:t.cache_read}];return j.jsxs("div",{className:"kpi",title:"Token totals by type: input · output · cache-write · cache-read",children:[j.jsx("div",{className:"kpi-label",children:"Token breakdown"}),j.jsx("ul",{className:"kpi-bd",children:n.map(i=>j.jsxs("li",{children:[j.jsx("span",{className:"kpi-bd-dot",style:{background:i.c},"aria-hidden":"true"}),j.jsx("span",{className:"kpi-bd-name",children:i.name}),j.jsx("span",{className:"kpi-bd-val",children:Lt(i.v)}),j.jsxs("span",{className:"kpi-bd-pct",children:[r?Math.round(i.v/r*100):0,"%"]})]},i.name))})]})}function nO({overview:e,bd:t,security:r}){var s,c;const n=((s=t==null?void 0:t.error_types)==null?void 0:s.failures)??0,i=((c=t==null?void 0:t.error_types)==null?void 0:c.rejections)??0,a=e.tool_calls??0,o=a?n/a*100:0,u=a?i/a*100:0;return j.jsxs("div",{className:"kpis",children:[j.jsx(Ge,{label:"Sessions",value:e.sessions_main,sub:`+${e.sessions_subagent.toLocaleString()} subagent runs`}),j.jsx(Ge,{label:"Projects",value:e.projects,sub:"distinct project paths"}),j.jsx(Ge,{label:"Turns",value:e.turns,sub:`${e.tool_calls.toLocaleString()} tool calls`}),j.jsx(Ge,{label:"Tool error rate",value:a?o.toFixed(1)+"%":"—",title:"Genuine tool failures as a share of all tool calls (rejections/blocks excluded — see the rejection rate).",sub:`${n.toLocaleString()} failed of ${a.toLocaleString()} calls`}),j.jsx(Ge,{label:"Rejection rate",value:a?u.toFixed(1)+"%":"—",title:"User-rejected + guardrail-blocked tool calls as a share of all tool calls. Not agent failures.",sub:`${i.toLocaleString()} rejected/blocked`}),j.jsx(Ge,{label:"Workflow runs",value:e.workflows.total||"—",title:"Async workflow runs in range. Success rate is over decided runs (completed vs failed); in-flight runs are excluded from the rate.",sub:e.workflows.total?`${Math.round(e.workflows.success_rate*100)}% success · ${Lt(e.workflows.total_tokens)}`:"no workflow runs"}),j.jsx(Ge,{label:"Est. cost (API-equiv.)",value:Pn(e.cost),title:"Estimated at API list prices for this usage (cache reads/writes included at their discounted cache rates).",sub:e.unpriced_models.length?`⚠ unpriced: ${e.unpriced_models.map(Eb).join(", ")}`:"API list price estimate"}),j.jsx(Ge,{label:"Cost / session",value:e.sessions_main?Pn(e.cost/e.sessions_main):"—",title:"Estimated API-equivalent cost divided by main sessions in range.",sub:"API-equiv. per main session"}),j.jsx(Ge,{label:"Cache-read ratio",value:(e.cache_read_ratio*100).toFixed(1)+"%",sub:"of all tokens are cached replays — excluded from “work”"}),j.jsx(Ge,{label:"Turn duration p50 / p95",value:`${xi(e.turn_duration_ms.p50)} / ${xi(e.turn_duration_ms.p95)}`,sub:`${e.turn_duration_ms.count} turns`}),j.jsx(Ge,{label:"Session duration p50 / p95",value:`${xi(e.session_duration_ms.p50)} / ${xi(e.session_duration_ms.p95)}`,title:"End-to-end wall-clock length of main sessions (subagents excluded).",sub:`${e.session_duration_ms.count} sessions`}),j.jsx(Ge,{label:"Total tokens",value:Lt(e.total_tokens),sub:`${Lt(e.tokens.input+e.tokens.output)} non-cache`}),j.jsx(rO,{t:e.tokens}),r&&j.jsx(tO,{s:r})]})}function Cb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Cb(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ee(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Cb(e))&&(n&&(n+=" "),n+=t);return n}var vo,Uh;function Fe(){if(Uh)return vo;Uh=1;var e=Array.isArray;return vo=e,vo}var yo,Kh;function $b(){if(Kh)return yo;Kh=1;var e=typeof wi=="object"&&wi&&wi.Object===Object&&wi;return yo=e,yo}var mo,Hh;function mt(){if(Hh)return mo;Hh=1;var e=$b(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return mo=r,mo}var go,Gh;function si(){if(Gh)return go;Gh=1;var e=mt(),t=e.Symbol;return go=t,go}var bo,Vh;function iO(){if(Vh)return bo;Vh=1;var e=si(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),s=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(u?o[i]=s:delete o[i]),f}return bo=a,bo}var xo,Xh;function aO(){if(Xh)return xo;Xh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return xo=r,xo}var wo,Yh;function Mt(){if(Yh)return wo;Yh=1;var e=si(),t=iO(),r=aO(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return wo=o,wo}var Oo,Zh;function Ct(){if(Zh)return Oo;Zh=1;function e(t){return t!=null&&typeof t=="object"}return Oo=e,Oo}var _o,Jh;function Qr(){if(Jh)return _o;Jh=1;var e=Mt(),t=Ct(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return _o=n,_o}var So,Qh;function Rf(){if(Qh)return So;Qh=1;var e=Fe(),t=Qr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return So=i,So}var Ao,ep;function Ft(){if(ep)return Ao;ep=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Ao=e,Ao}var Po,tp;function Df(){if(tp)return Po;tp=1;var e=Mt(),t=Ft(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var s=e(u);return s==n||s==i||s==r||s==a}return Po=o,Po}var To,rp;function oO(){if(rp)return To;rp=1;var e=mt(),t=e["__core-js_shared__"];return To=t,To}var jo,np;function uO(){if(np)return jo;np=1;var e=oO(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return jo=r,jo}var Eo,ip;function Ib(){if(ip)return Eo;ip=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Eo=r,Eo}var Mo,ap;function sO(){if(ap)return Mo;ap=1;var e=Df(),t=uO(),r=Ft(),n=Ib(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,s=o.toString,c=u.hasOwnProperty,f=RegExp("^"+s.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var d=e(h)?f:a;return d.test(n(h))}return Mo=l,Mo}var Co,op;function cO(){if(op)return Co;op=1;function e(t,r){return t==null?void 0:t[r]}return Co=e,Co}var $o,up;function fr(){if(up)return $o;up=1;var e=sO(),t=cO();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return $o=r,$o}var Io,sp;function Na(){if(sp)return Io;sp=1;var e=fr(),t=e(Object,"create");return Io=t,Io}var ko,cp;function lO(){if(cp)return ko;cp=1;var e=Na();function t(){this.__data__=e?e(null):{},this.size=0}return ko=t,ko}var No,lp;function fO(){if(lp)return No;lp=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return No=e,No}var Ro,fp;function hO(){if(fp)return Ro;fp=1;var e=Na(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return Ro=i,Ro}var Do,hp;function pO(){if(hp)return Do;hp=1;var e=Na(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Do=n,Do}var qo,pp;function dO(){if(pp)return qo;pp=1;var e=Na(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return qo=r,qo}var Lo,dp;function vO(){if(dp)return Lo;dp=1;var e=lO(),t=fO(),r=hO(),n=pO(),i=dO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Lo=a,Lo}var Bo,vp;function yO(){if(vp)return Bo;vp=1;function e(){this.__data__=[],this.size=0}return Bo=e,Bo}var Fo,yp;function qf(){if(yp)return Fo;yp=1;function e(t,r){return t===r||t!==t&&r!==r}return Fo=e,Fo}var zo,mp;function Ra(){if(mp)return zo;mp=1;var e=qf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return zo=t,zo}var Wo,gp;function mO(){if(gp)return Wo;gp=1;var e=Ra(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return Wo=n,Wo}var Uo,bp;function gO(){if(bp)return Uo;bp=1;var e=Ra();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Uo=t,Uo}var Ko,xp;function bO(){if(xp)return Ko;xp=1;var e=Ra();function t(r){return e(this.__data__,r)>-1}return Ko=t,Ko}var Ho,wp;function xO(){if(wp)return Ho;wp=1;var e=Ra();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Ho=t,Ho}var Go,Op;function Da(){if(Op)return Go;Op=1;var e=yO(),t=mO(),r=gO(),n=bO(),i=xO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Go=a,Go}var Vo,_p;function Lf(){if(_p)return Vo;_p=1;var e=fr(),t=mt(),r=e(t,"Map");return Vo=r,Vo}var Xo,Sp;function wO(){if(Sp)return Xo;Sp=1;var e=vO(),t=Da(),r=Lf();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Xo=n,Xo}var Yo,Ap;function OO(){if(Ap)return Yo;Ap=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Yo=e,Yo}var Zo,Pp;function qa(){if(Pp)return Zo;Pp=1;var e=OO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Zo=t,Zo}var Jo,Tp;function _O(){if(Tp)return Jo;Tp=1;var e=qa();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Jo=t,Jo}var Qo,jp;function SO(){if(jp)return Qo;jp=1;var e=qa();function t(r){return e(this,r).get(r)}return Qo=t,Qo}var eu,Ep;function AO(){if(Ep)return eu;Ep=1;var e=qa();function t(r){return e(this,r).has(r)}return eu=t,eu}var tu,Mp;function PO(){if(Mp)return tu;Mp=1;var e=qa();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return tu=t,tu}var ru,Cp;function Bf(){if(Cp)return ru;Cp=1;var e=wO(),t=_O(),r=SO(),n=AO(),i=PO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ru=a,ru}var nu,$p;function kb(){if($p)return nu;$p=1;var e=Bf(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],s=a.cache;if(s.has(u))return s.get(u);var c=n.apply(this,o);return a.cache=s.set(u,c)||s,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,nu=r,nu}var iu,Ip;function TO(){if(Ip)return iu;Ip=1;var e=kb(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return iu=r,iu}var au,kp;function jO(){if(kp)return au;kp=1;var e=TO(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,u,s,c){a.push(s?c.replace(r,"$1"):u||o)}),a});return au=n,au}var ou,Np;function Ff(){if(Np)return ou;Np=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return ou=e,ou}var uu,Rp;function EO(){if(Rp)return uu;Rp=1;var e=si(),t=Ff(),r=Fe(),n=Qr(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return uu=o,uu}var su,Dp;function Nb(){if(Dp)return su;Dp=1;var e=EO();function t(r){return r==null?"":e(r)}return su=t,su}var cu,qp;function Rb(){if(qp)return cu;qp=1;var e=Fe(),t=Rf(),r=jO(),n=Nb();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return cu=i,cu}var lu,Lp;function La(){if(Lp)return lu;Lp=1;var e=Qr();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return lu=t,lu}var fu,Bp;function zf(){if(Bp)return fu;Bp=1;var e=Rb(),t=La();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return fu=r,fu}var hu,Fp;function Db(){if(Fp)return hu;Fp=1;var e=zf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return hu=t,hu}var MO=Db();const Je=ce(MO);var pu,zp;function CO(){if(zp)return pu;zp=1;function e(t){return t==null}return pu=e,pu}var $O=CO();const Q=ce($O);var du,Wp;function IO(){if(Wp)return du;Wp=1;var e=Mt(),t=Fe(),r=Ct(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return du=i,du}var kO=IO();const or=ce(kO);var NO=Df();const X=ce(NO);var RO=Ft();const en=ce(RO);var vu={exports:{}},ne={};/**
|
|
1
|
+
import{r as q,j,u as zw,a as jb,f as Lt,s as Eb,b as Pn,c as xi,L as Ww,d as wi,g as ce,R as A,e as Uw,h as Wh,l as Kw,i as Hw,k as Gw,E as Vw,m as Xw,n as Yw,o as ho}from"./index-BxbXFMQG.js";const po=8,Zw=26;function Jw(){const[e,t]=q.useState(new Set),r=o=>t(u=>{const s=new Set(u);return s.has(o)?s.delete(o):s.add(o),s});return{topN:(o,u)=>e.has(u)?o:o.slice(0,po),expandHeight:(o,u,s=Zw)=>e.has(o)?Math.max(240,u*s):void 0,expandBtn:(o,u)=>{if(!(u<=po))return j.jsx("button",{type:"button",className:"link-btn",onClick:()=>r(o),children:e.has(o)?`show top ${po}`:`show all (${u})`})}}}function Be(){const{theme:e}=zw();return q.useMemo(()=>{const t=getComputedStyle(document.documentElement),r=c=>t.getPropertyValue(c).trim(),n={bg:r("--bg"),panel:r("--panel"),panel2:r("--panel2"),border:r("--border"),text:r("--text"),muted:r("--muted"),accent:r("--accent"),green:r("--user"),gold:r("--gold"),red:r("--err"),violet:r("--violet"),teal:r("--teal")},i={input:n.green,output:n.accent,cache_creation:n.gold,cache_read:n.muted},a=[n.accent,n.green,n.gold,n.violet,n.teal,n.red,n.muted,"#d98c5f","#5f9ed9"],o={stroke:n.muted,tick:{fill:n.muted,fontSize:11},tickLine:!1},u={stroke:n.border,strokeDasharray:"3 3",vertical:!1},s={contentStyle:{background:n.panel2,border:`1px solid ${n.border}`,borderRadius:6,fontSize:12},labelStyle:{color:n.text},itemStyle:{color:n.text}};return{C:n,TOKEN_COLORS:i,PALETTE:a,axisProps:o,gridProps:u,tooltipStyle:s}},[e])}function ct({title:e,hint:t,actions:r,bodyHeight:n,hidden:i,children:a}){return i?null:j.jsxs("div",{className:"card",children:[j.jsxs("div",{className:"card-head",children:[j.jsx("h3",{children:e}),t&&j.jsx("span",{className:"card-hint",children:t}),r&&j.jsx("span",{className:"card-actions",children:r})]}),j.jsx("div",{className:"chart-body",style:n!=null?{height:n}:void 0,children:a})]})}function Ge({label:e,value:t,sub:r,title:n}){return j.jsxs("div",{className:"kpi",title:n,children:[j.jsx("div",{className:"kpi-label",children:e}),j.jsx("div",{className:"kpi-value",children:t}),r!=null&&j.jsx("div",{className:"kpi-sub",children:r})]})}function Mb(e,t){var n;const r=((n=e==null?void 0:e.payload)==null?void 0:n[t])??(e==null?void 0:e[t]);return typeof r=="string"&&r!==""?r:null}function Qw({active:e,payload:t,versionsByName:r}){var s,c,f,l;const{C:n,tooltipStyle:i}=Be();if(!e||!(t!=null&&t.length))return null;const a=String(((c=(s=t[0])==null?void 0:s.payload)==null?void 0:c.name)??""),o=Number(((l=(f=t[0])==null?void 0:f.payload)==null?void 0:l.n)??0),u=r.get(a)??[];return j.jsxs("div",{style:{...i.contentStyle,padding:"8px 10px",maxWidth:280},children:[j.jsx("div",{style:{color:n.text,fontWeight:600,marginBottom:4},children:a}),j.jsxs("div",{style:{color:n.muted,marginBottom:u.length?6:0},children:[o," firing",o===1?"":"s"," total"]}),u.map(h=>j.jsxs("div",{style:{color:n.text,display:"flex",justifyContent:"space-between",gap:12},children:[j.jsx("span",{style:{color:n.muted},children:h.version_id.slice(0,8)}),j.jsx("span",{children:h.n})]},h.version_id)),u.length>0&&j.jsx("div",{style:{color:n.muted,marginTop:6,fontSize:11},children:"click to open skill →"})]})}function Nf({x:e,y:t,payload:r,onSelect:n,title:i}){return j.jsxs("text",{x:e,y:t,dy:4,textAnchor:"end",className:"axis-link",fontSize:11,onClick:()=>(r==null?void 0:r.value)&&n(r.value),children:[i&&j.jsx("title",{children:i}),r==null?void 0:r.value]})}function eO(){const e=jb(),t=(n,i)=>{i!=null&&i!==""&&e(`/?${n}=${encodeURIComponent(i)}`)};return{drillFilter:t,drillTo:(n,i)=>a=>t(n,Mb(a,i))}}function tO({s:e}){const t=new Map(e.by_severity.map(a=>[a.severity,a.n])),r=t.get("critical")??0,n=t.get("high")??0,i=e.total===0?"—":`${r} / ${n}`;return j.jsxs(Ww,{className:"kpi kpi-btn"+(r>0?" sev-critical":n>0?" sev-high":""),to:"/security",title:"Security findings — critical / high. Opens the Security page.",children:[j.jsx("div",{className:"kpi-label",children:"Security findings"}),j.jsx("div",{className:"kpi-value",children:i}),j.jsx("div",{className:"kpi-sub",children:e.total===0?"no open findings":`critical / high · ${e.total} open in ${e.sessions_flagged} sessions`})]})}function rO({t:e}){const{TOKEN_COLORS:t}=Be(),r=e.input+e.output+e.cache_creation+e.cache_read,n=[{name:"Input",v:e.input,c:t.input},{name:"Output",v:e.output,c:t.output},{name:"Cache write",v:e.cache_creation,c:t.cache_creation},{name:"Cache read",v:e.cache_read,c:t.cache_read}];return j.jsxs("div",{className:"kpi",title:"Token totals by type: input · output · cache-write · cache-read",children:[j.jsx("div",{className:"kpi-label",children:"Token breakdown"}),j.jsx("ul",{className:"kpi-bd",children:n.map(i=>j.jsxs("li",{children:[j.jsx("span",{className:"kpi-bd-dot",style:{background:i.c},"aria-hidden":"true"}),j.jsx("span",{className:"kpi-bd-name",children:i.name}),j.jsx("span",{className:"kpi-bd-val",children:Lt(i.v)}),j.jsxs("span",{className:"kpi-bd-pct",children:[r?Math.round(i.v/r*100):0,"%"]})]},i.name))})]})}function nO({overview:e,bd:t,security:r}){var s,c;const n=((s=t==null?void 0:t.error_types)==null?void 0:s.failures)??0,i=((c=t==null?void 0:t.error_types)==null?void 0:c.rejections)??0,a=e.tool_calls??0,o=a?n/a*100:0,u=a?i/a*100:0;return j.jsxs("div",{className:"kpis",children:[j.jsx(Ge,{label:"Sessions",value:e.sessions_main,sub:`+${e.sessions_subagent.toLocaleString()} subagent runs`}),j.jsx(Ge,{label:"Projects",value:e.projects,sub:"distinct project paths"}),j.jsx(Ge,{label:"Turns",value:e.turns,sub:`${e.tool_calls.toLocaleString()} tool calls`}),j.jsx(Ge,{label:"Tool error rate",value:a?o.toFixed(1)+"%":"—",title:"Genuine tool failures as a share of all tool calls (rejections/blocks excluded — see the rejection rate).",sub:`${n.toLocaleString()} failed of ${a.toLocaleString()} calls`}),j.jsx(Ge,{label:"Rejection rate",value:a?u.toFixed(1)+"%":"—",title:"User-rejected + guardrail-blocked tool calls as a share of all tool calls. Not agent failures.",sub:`${i.toLocaleString()} rejected/blocked`}),j.jsx(Ge,{label:"Workflow runs",value:e.workflows.total||"—",title:"Async workflow runs in range. Success rate is over decided runs (completed vs failed); in-flight runs are excluded from the rate.",sub:e.workflows.total?`${Math.round(e.workflows.success_rate*100)}% success · ${Lt(e.workflows.total_tokens)}`:"no workflow runs"}),j.jsx(Ge,{label:"Est. cost (API-equiv.)",value:Pn(e.cost),title:"Estimated at API list prices for this usage (cache reads/writes included at their discounted cache rates).",sub:e.unpriced_models.length?`⚠ unpriced: ${e.unpriced_models.map(Eb).join(", ")}`:"API list price estimate"}),j.jsx(Ge,{label:"Cost / session",value:e.sessions_main?Pn(e.cost/e.sessions_main):"—",title:"Estimated API-equivalent cost divided by main sessions in range.",sub:"API-equiv. per main session"}),j.jsx(Ge,{label:"Cache-read ratio",value:(e.cache_read_ratio*100).toFixed(1)+"%",sub:"of all tokens are cached replays — excluded from “work”"}),j.jsx(Ge,{label:"Turn duration p50 / p95",value:`${xi(e.turn_duration_ms.p50)} / ${xi(e.turn_duration_ms.p95)}`,sub:`${e.turn_duration_ms.count} turns`}),j.jsx(Ge,{label:"Session duration p50 / p95",value:`${xi(e.session_duration_ms.p50)} / ${xi(e.session_duration_ms.p95)}`,title:"End-to-end wall-clock length of main sessions (subagents excluded).",sub:`${e.session_duration_ms.count} sessions`}),j.jsx(Ge,{label:"Total tokens",value:Lt(e.total_tokens),sub:`${Lt(e.tokens.input+e.tokens.output)} non-cache`}),j.jsx(rO,{t:e.tokens}),r&&j.jsx(tO,{s:r})]})}function Cb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Cb(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ee(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Cb(e))&&(n&&(n+=" "),n+=t);return n}var vo,Uh;function Fe(){if(Uh)return vo;Uh=1;var e=Array.isArray;return vo=e,vo}var yo,Kh;function $b(){if(Kh)return yo;Kh=1;var e=typeof wi=="object"&&wi&&wi.Object===Object&&wi;return yo=e,yo}var mo,Hh;function mt(){if(Hh)return mo;Hh=1;var e=$b(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return mo=r,mo}var go,Gh;function si(){if(Gh)return go;Gh=1;var e=mt(),t=e.Symbol;return go=t,go}var bo,Vh;function iO(){if(Vh)return bo;Vh=1;var e=si(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),s=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(u?o[i]=s:delete o[i]),f}return bo=a,bo}var xo,Xh;function aO(){if(Xh)return xo;Xh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return xo=r,xo}var wo,Yh;function Mt(){if(Yh)return wo;Yh=1;var e=si(),t=iO(),r=aO(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return wo=o,wo}var Oo,Zh;function Ct(){if(Zh)return Oo;Zh=1;function e(t){return t!=null&&typeof t=="object"}return Oo=e,Oo}var _o,Jh;function Qr(){if(Jh)return _o;Jh=1;var e=Mt(),t=Ct(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return _o=n,_o}var So,Qh;function Rf(){if(Qh)return So;Qh=1;var e=Fe(),t=Qr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return So=i,So}var Ao,ep;function Ft(){if(ep)return Ao;ep=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Ao=e,Ao}var Po,tp;function Df(){if(tp)return Po;tp=1;var e=Mt(),t=Ft(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var s=e(u);return s==n||s==i||s==r||s==a}return Po=o,Po}var To,rp;function oO(){if(rp)return To;rp=1;var e=mt(),t=e["__core-js_shared__"];return To=t,To}var jo,np;function uO(){if(np)return jo;np=1;var e=oO(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return jo=r,jo}var Eo,ip;function Ib(){if(ip)return Eo;ip=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Eo=r,Eo}var Mo,ap;function sO(){if(ap)return Mo;ap=1;var e=Df(),t=uO(),r=Ft(),n=Ib(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,s=o.toString,c=u.hasOwnProperty,f=RegExp("^"+s.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var d=e(h)?f:a;return d.test(n(h))}return Mo=l,Mo}var Co,op;function cO(){if(op)return Co;op=1;function e(t,r){return t==null?void 0:t[r]}return Co=e,Co}var $o,up;function fr(){if(up)return $o;up=1;var e=sO(),t=cO();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return $o=r,$o}var Io,sp;function Na(){if(sp)return Io;sp=1;var e=fr(),t=e(Object,"create");return Io=t,Io}var ko,cp;function lO(){if(cp)return ko;cp=1;var e=Na();function t(){this.__data__=e?e(null):{},this.size=0}return ko=t,ko}var No,lp;function fO(){if(lp)return No;lp=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return No=e,No}var Ro,fp;function hO(){if(fp)return Ro;fp=1;var e=Na(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return Ro=i,Ro}var Do,hp;function pO(){if(hp)return Do;hp=1;var e=Na(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Do=n,Do}var qo,pp;function dO(){if(pp)return qo;pp=1;var e=Na(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return qo=r,qo}var Lo,dp;function vO(){if(dp)return Lo;dp=1;var e=lO(),t=fO(),r=hO(),n=pO(),i=dO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Lo=a,Lo}var Bo,vp;function yO(){if(vp)return Bo;vp=1;function e(){this.__data__=[],this.size=0}return Bo=e,Bo}var Fo,yp;function qf(){if(yp)return Fo;yp=1;function e(t,r){return t===r||t!==t&&r!==r}return Fo=e,Fo}var zo,mp;function Ra(){if(mp)return zo;mp=1;var e=qf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return zo=t,zo}var Wo,gp;function mO(){if(gp)return Wo;gp=1;var e=Ra(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return Wo=n,Wo}var Uo,bp;function gO(){if(bp)return Uo;bp=1;var e=Ra();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Uo=t,Uo}var Ko,xp;function bO(){if(xp)return Ko;xp=1;var e=Ra();function t(r){return e(this.__data__,r)>-1}return Ko=t,Ko}var Ho,wp;function xO(){if(wp)return Ho;wp=1;var e=Ra();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Ho=t,Ho}var Go,Op;function Da(){if(Op)return Go;Op=1;var e=yO(),t=mO(),r=gO(),n=bO(),i=xO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Go=a,Go}var Vo,_p;function Lf(){if(_p)return Vo;_p=1;var e=fr(),t=mt(),r=e(t,"Map");return Vo=r,Vo}var Xo,Sp;function wO(){if(Sp)return Xo;Sp=1;var e=vO(),t=Da(),r=Lf();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Xo=n,Xo}var Yo,Ap;function OO(){if(Ap)return Yo;Ap=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Yo=e,Yo}var Zo,Pp;function qa(){if(Pp)return Zo;Pp=1;var e=OO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Zo=t,Zo}var Jo,Tp;function _O(){if(Tp)return Jo;Tp=1;var e=qa();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Jo=t,Jo}var Qo,jp;function SO(){if(jp)return Qo;jp=1;var e=qa();function t(r){return e(this,r).get(r)}return Qo=t,Qo}var eu,Ep;function AO(){if(Ep)return eu;Ep=1;var e=qa();function t(r){return e(this,r).has(r)}return eu=t,eu}var tu,Mp;function PO(){if(Mp)return tu;Mp=1;var e=qa();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return tu=t,tu}var ru,Cp;function Bf(){if(Cp)return ru;Cp=1;var e=wO(),t=_O(),r=SO(),n=AO(),i=PO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ru=a,ru}var nu,$p;function kb(){if($p)return nu;$p=1;var e=Bf(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],s=a.cache;if(s.has(u))return s.get(u);var c=n.apply(this,o);return a.cache=s.set(u,c)||s,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,nu=r,nu}var iu,Ip;function TO(){if(Ip)return iu;Ip=1;var e=kb(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return iu=r,iu}var au,kp;function jO(){if(kp)return au;kp=1;var e=TO(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,u,s,c){a.push(s?c.replace(r,"$1"):u||o)}),a});return au=n,au}var ou,Np;function Ff(){if(Np)return ou;Np=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return ou=e,ou}var uu,Rp;function EO(){if(Rp)return uu;Rp=1;var e=si(),t=Ff(),r=Fe(),n=Qr(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return uu=o,uu}var su,Dp;function Nb(){if(Dp)return su;Dp=1;var e=EO();function t(r){return r==null?"":e(r)}return su=t,su}var cu,qp;function Rb(){if(qp)return cu;qp=1;var e=Fe(),t=Rf(),r=jO(),n=Nb();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return cu=i,cu}var lu,Lp;function La(){if(Lp)return lu;Lp=1;var e=Qr();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return lu=t,lu}var fu,Bp;function zf(){if(Bp)return fu;Bp=1;var e=Rb(),t=La();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return fu=r,fu}var hu,Fp;function Db(){if(Fp)return hu;Fp=1;var e=zf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return hu=t,hu}var MO=Db();const Je=ce(MO);var pu,zp;function CO(){if(zp)return pu;zp=1;function e(t){return t==null}return pu=e,pu}var $O=CO();const Q=ce($O);var du,Wp;function IO(){if(Wp)return du;Wp=1;var e=Mt(),t=Fe(),r=Ct(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return du=i,du}var kO=IO();const or=ce(kO);var NO=Df();const X=ce(NO);var RO=Ft();const en=ce(RO);var vu={exports:{}},ne={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as d,x as h,j as e,A as o,L as r,w as t}from"./index-BxbXFMQG.js";import{relPath as m,LinesDelta as p}from"./FilesView-DYSJHOfO.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{e as q,h as x,r as E,
|
|
1
|
+
import{e as q,h as x,r as E,x as C,j as e,F as P,E as D,m as K,S as n,L as $,w as k,P as I}from"./index-BxbXFMQG.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(D,{error:S}),j?e.jsx(K,{}):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($,{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(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 +1 @@
|
|
|
1
|
-
import{r as m,e as ie,h as P,z as ne,w as ae,j as e,D as p,F as le,G as y,E as re,m as ce,S as $,P as oe,v as de,L as ue}from"./index-DYY0_SmQ.js";import{S as he,a as me}from"./severity-CoO1IKlD.js";function W(t,n){const[l,a]=m.useState(n),[N,d]=m.useState(t);return N!==t&&(d(t),a(n)),[l,a]}const M=50,pe={total:0,findings:[]},je=new Set;function ke(){const{get:t,set:n,clear:l}=ie(),a=P("/sources",[]),N=P("/projects",[]),[d,S]=m.useState(!1),[j,V]=m.useState(0),{sort:r,toggle:_}=ne("severity","desc"),b=t("severity"),v=t("category"),k=t("rule"),w=t("session"),R=t("source"),F=t("project"),T=t("from"),A=t("to"),u=t("status","open"),C=m.useMemo(()=>{const s=new URLSearchParams;for(const[c,h]of Object.entries({severity:b,category:v,rule:k,session:w,source:R,project:F,from:T,to:A,status:u}))h&&s.set(c,h);return s},[b,v,k,w,R,F,T,A,u]),i=P("/security/summary",null,[j]),D=P(p?null:"/security/mutes",[],[j]),K=`${C.toString()}|${r.key}|${r.dir}`,[E,B]=W(K,1),[o,L]=W(`${K}|${E}|${j}`,je),f=new URLSearchParams(C);f.set("sort",r.key),f.set("dir",r.dir),f.set("limit",String(M)),f.set("offset",String((E-1)*M));const{data:H,loading:I,error:Y}=ae("/security/findings?"+f.toString(),{deps:[j]}),[q,G]=W(`${K}|${E}|${j}`,null),J=q??Y,{total:g,findings:O}=H??pe,x=m.useCallback(async s=>{S(!0),G(null);try{await s(),V(c=>c+1)}catch(c){G(String(c))}finally{S(!1)}},[]),X=m.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),Q=m.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!v||s.category===v),[i,v]),Z=Math.max(1,Math.ceil(g/M)),ee=[...C.keys()].some(s=>s!=="status")||u!=="open",z=O.map(s=>s.id),se=z.length>0&&z.every(s=>o.has(s)),te=s=>L(c=>{const h=new Set(c);return h.has(s)?h.delete(s):h.add(s),h});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."]})]}),p&&e.jsxs("div",{className:"demo-note",role:"note",children:["📦 This is a static demo over synthetic sessions. Browse the findings and reference below —"," ",e.jsx("strong",{children:"triage"})," (mark safe, mute rules) and live filtering run in the local app on your own data."]}),e.jsxs("div",{className:"kpi-row sev-kpis",role:"group","aria-label":"Open findings by severity",children:[e.jsxs("button",{type:"button",className:"kpi kpi-btn"+(b?"":" is-active"),onClick:()=>n({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+(b===s?" is-active":""),onClick:()=>n({severity:b===s?"":s}),"aria-pressed":b===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:()=>n({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>n({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:u,onChange:s=>n({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:v,onChange:s=>{const c=s.target.value,h=!k||Q.some(U=>U.rule_id===k&&(!c||U.category===c));n({category:c,rule:h?k:""})},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:k,onChange:s=>n({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=>n({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),a.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=>n({project:s}),options:[{value:"",label:"all projects"},...N.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=>n({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:A,onChange:s=>n({to:s.target.value})})]}),w&&e.jsxs("span",{className:"tag filter-chip",children:["session ",w.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>n({session:""}),children:"✕"})]}),ee&&e.jsx("button",{type:"button",className:"ghost",onClick:l,children:"clear filters"})]}),!p&&(o.size>0||u==="open"&&g>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[o.size>0&&u!=="dismissed"&&e.jsxs("button",{type:"button",disabled:d,onClick:()=>x(()=>y("/security/dismiss",{ids:[...o]})),children:["✓ Mark ",o.size," safe"]}),o.size>0&&u==="dismissed"&&e.jsxs("button",{type:"button",disabled:d,onClick:()=>x(()=>y("/security/reopen",{ids:[...o]})),children:["↩ Reopen ",o.size]}),o.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>L(new Set),children:"clear selection"}),u==="open"&&g>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:d,onClick:()=>{confirm(`Dismiss all ${g} open findings matching the current filter as safe?`)&&x(()=>y("/security/dismiss-matching",{filter:Object.fromEntries(C)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",g," matching"]})]}),e.jsx(re,{error:J}),I?e.jsx(ce,{}):O.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&u==="open"?"No open security findings — nothing risky is awaiting review.":"No findings match these filters."}):e.jsxs("table",{className:"sessions findings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[!p&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:se,onChange:s=>L(s.target.checked?new Set(z):new Set)})}),e.jsx($,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:_}),e.jsx("th",{children:"Finding"}),e.jsx($,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:_}),e.jsx("th",{children:"Evidence"}),e.jsx($,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:_}),e.jsx($,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:_}),!p&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:O.map(s=>e.jsx(ge,{f:s,selected:o.has(s.id),onToggle:()=>te(s.id),busy:d,onDismiss:()=>x(()=>y("/security/dismiss",{ids:[s.id]})),onReopen:()=>x(()=>y("/security/reopen",{ids:[s.id]})),onMute:()=>x(()=>y("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!I&&g>M&&e.jsx(oe,{page:E,pages:Z,total:g,unit:"findings",onPage:B}),!p&&D.length>0&&e.jsx(xe,{mutes:D,busy:d,onUnmute:s=>x(()=>y("/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:n,onToggle:l,busy:a,onDismiss:N,onReopen:d,onMute:S}){const j=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!p&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:n,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:j,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(/^.*\//,"")})]}),!p&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:a,onClick:d,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:a,onClick:N,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:a,onClick:S,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function xe({mutes:t,busy:n,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(a=>e.jsxs("li",{children:[e.jsx("code",{children:a.rule_id}),e.jsxs("span",{className:"tag mute-scope",children:[a.scope,a.scope_id?`: ${a.scope_id}`:""]}),a.note&&e.jsx("span",{className:"muted small mute-note",children:a.note}),e.jsx("button",{type:"button",className:"linkish unmute",disabled:n,onClick:()=>l(a),children:"unmute"})]},`${a.rule_id}:${a.scope}:${a.scope_id}`))})]})}function ye({summary:t}){const n=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:a=>a.stopPropagation(),children:[l.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[n.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{r as m,e as ie,h as P,B as ne,x as ae,j as e,G as p,F as le,H as y,E as re,m as ce,S as $,P as oe,w as de,L as ue}from"./index-BxbXFMQG.js";import{S as he,a as me}from"./severity-DTzxtVJn.js";function W(t,n){const[l,a]=m.useState(n),[N,d]=m.useState(t);return N!==t&&(d(t),a(n)),[l,a]}const M=50,pe={total:0,findings:[]},je=new Set;function ke(){const{get:t,set:n,clear:l}=ie(),a=P("/sources",[]),N=P("/projects",[]),[d,S]=m.useState(!1),[j,Q]=m.useState(0),{sort:r,toggle:_}=ne("severity","desc"),b=t("severity"),v=t("category"),k=t("rule"),w=t("session"),R=t("source"),F=t("project"),T=t("from"),A=t("to"),u=t("status","open"),C=m.useMemo(()=>{const s=new URLSearchParams;for(const[c,h]of Object.entries({severity:b,category:v,rule:k,session:w,source:R,project:F,from:T,to:A,status:u}))h&&s.set(c,h);return s},[b,v,k,w,R,F,T,A,u]),i=P("/security/summary",null,[j]),I=P(p?null:"/security/mutes",[],[j]),K=`${C.toString()}|${r.key}|${r.dir}`,[E,U]=W(K,1),[o,L]=W(`${K}|${E}|${j}`,je),f=new URLSearchParams(C);f.set("sort",r.key),f.set("dir",r.dir),f.set("limit",String(M)),f.set("offset",String((E-1)*M));const{data:V,loading:D,error:Y}=ae("/security/findings?"+f.toString(),{deps:[j]}),[q,B]=W(`${K}|${E}|${j}`,null),J=q??Y,{total:g,findings:O}=V??pe,x=m.useCallback(async s=>{S(!0),B(null);try{await s(),Q(c=>c+1)}catch(c){B(String(c))}finally{S(!1)}},[]),X=m.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),G=m.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!v||s.category===v),[i,v]),Z=Math.max(1,Math.ceil(g/M)),ee=[...C.keys()].some(s=>s!=="status")||u!=="open",z=O.map(s=>s.id),se=z.length>0&&z.every(s=>o.has(s)),te=s=>L(c=>{const h=new Set(c);return h.has(s)?h.delete(s):h.add(s),h});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."]})]}),p&&e.jsxs("div",{className:"demo-note",role:"note",children:["📦 This is a static demo over synthetic sessions. Browse the findings and reference below —"," ",e.jsx("strong",{children:"triage"})," (mark safe, mute rules) and live filtering run in the local app on your own data."]}),e.jsxs("div",{className:"kpi-row sev-kpis",role:"group","aria-label":"Open findings by severity",children:[e.jsxs("button",{type:"button",className:"kpi kpi-btn"+(b?"":" is-active"),onClick:()=>n({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+(b===s?" is-active":""),onClick:()=>n({severity:b===s?"":s}),"aria-pressed":b===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:()=>n({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>n({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:u,onChange:s=>n({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:v,onChange:s=>{const c=s.target.value,h=!k||G.some(H=>H.rule_id===k&&(!c||H.category===c));n({category:c,rule:h?k:""})},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:k,onChange:s=>n({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=>n({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),a.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=>n({project:s}),options:[{value:"",label:"all projects"},...N.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=>n({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:A,onChange:s=>n({to:s.target.value})})]}),w&&e.jsxs("span",{className:"tag filter-chip",children:["session ",w.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>n({session:""}),children:"✕"})]}),ee&&e.jsx("button",{type:"button",className:"ghost",onClick:l,children:"clear filters"})]}),!p&&(o.size>0||u==="open"&&g>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[o.size>0&&u!=="dismissed"&&e.jsxs("button",{type:"button",disabled:d,onClick:()=>x(()=>y("/security/dismiss",{ids:[...o]})),children:["✓ Mark ",o.size," safe"]}),o.size>0&&u==="dismissed"&&e.jsxs("button",{type:"button",disabled:d,onClick:()=>x(()=>y("/security/reopen",{ids:[...o]})),children:["↩ Reopen ",o.size]}),o.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>L(new Set),children:"clear selection"}),u==="open"&&g>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:d,onClick:()=>{confirm(`Dismiss all ${g} open findings matching the current filter as safe?`)&&x(()=>y("/security/dismiss-matching",{filter:Object.fromEntries(C)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",g," matching"]})]}),e.jsx(re,{error:J}),D?e.jsx(ce,{}):O.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&u==="open"?"No open security findings — nothing risky is awaiting review.":"No findings match these filters."}):e.jsxs("table",{className:"sessions findings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[!p&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:se,onChange:s=>L(s.target.checked?new Set(z):new Set)})}),e.jsx($,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:_}),e.jsx("th",{children:"Finding"}),e.jsx($,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:_}),e.jsx("th",{children:"Evidence"}),e.jsx($,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:_}),e.jsx($,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:_}),!p&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:O.map(s=>e.jsx(ge,{f:s,selected:o.has(s.id),onToggle:()=>te(s.id),busy:d,onDismiss:()=>x(()=>y("/security/dismiss",{ids:[s.id]})),onReopen:()=>x(()=>y("/security/reopen",{ids:[s.id]})),onMute:()=>x(()=>y("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!D&&g>M&&e.jsx(oe,{page:E,pages:Z,total:g,unit:"findings",onPage:U}),!p&&I.length>0&&e.jsx(xe,{mutes:I,busy:d,onUnmute:s=>x(()=>y("/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:n,onToggle:l,busy:a,onDismiss:N,onReopen:d,onMute:S}){const j=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!p&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:n,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:j,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(/^.*\//,"")})]}),!p&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:a,onClick:d,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:a,onClick:N,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:a,onClick:S,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function xe({mutes:t,busy:n,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(a=>e.jsxs("li",{children:[e.jsx("code",{children:a.rule_id}),e.jsxs("span",{className:"tag mute-scope",children:[a.scope,a.scope_id?`: ${a.scope_id}`:""]}),a.note&&e.jsx("span",{className:"muted small mute-note",children:a.note}),e.jsx("button",{type:"button",className:"linkish unmute",disabled:n,onClick:()=>l(a),children:"unmute"})]},`${a.rule_id}:${a.scope}:${a.scope_id}`))})]})}function ye({summary:t}){const n=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:a=>a.stopPropagation(),children:[l.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[n.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,12 +1,12 @@
|
|
|
1
|
-
import{p as os,j as s,q as O,r as m,L as _,f as cs,t as ds,b as us,c as C,v as W,s as ms,w as hs,i as R,n as D,l as ps,x as xs,y as fs,E as js,m as gs}from"./index-DYY0_SmQ.js";import{S as I,a as V}from"./severity-CoO1IKlD.js";import{A as E,C as y,p as k}from"./jsonish-Dd3X-MG6.js";import{M as Ns,r as ws}from"./index-Bgxu3c84.js";function _s({id:e}){const n=os();return s.jsxs("details",{className:"export-menu col-customizer",ref:n,children:[s.jsx("summary",{className:"export",title:"Export this session as Markdown",children:"⬇ Export Markdown"}),s.jsxs("div",{className:"col-menu",role:"group","aria-label":"Export options",children:[s.jsxs("a",{href:O(e),download:!0,children:["Redacted ",s.jsx("span",{className:"muted small",children:"(secrets masked)"})]}),s.jsxs("a",{href:O(e,"structure"),download:!0,children:["Structure only ",s.jsx("span",{className:"muted small",children:"(scrubbed)"})]}),s.jsxs("a",{className:"export-verbatim",href:O(e,"off"),download:!0,children:["Verbatim ",s.jsx("span",{className:"muted small",children:"(unredacted)"})]})]})]})}function ks({c:e}){var r;const[n,t]=m.useState(!1),a=m.useId(),l=(r=e.signals)==null?void 0:r.loc;return s.jsxs("div",{className:"classification",children:[s.jsx("span",{className:"tag cat cat-"+(e.category??"none"),children:e.category??"unclassified"}),e.complexity_band&&s.jsxs("span",{className:"tag complexity",children:[e.complexity_band," · ",e.complexity_score]}),l&&s.jsxs("span",{className:"muted small",children:["+",l.added,"/−",l.removed," LoC · ",l.files," files"]}),s.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":a,onClick:()=>t(i=>!i),children:["why ",n?"▾":"▸"]}),n&&(e.signals?s.jsx(bs,{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 ys={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},P=e=>`${Math.max(0,Math.min(1,e))*100}%`;function L({counts:e}){const n=Object.entries(e).sort((t,a)=>a[1]-t[1]);return n.length===0?s.jsx("span",{className:"muted",children:"—"}):s.jsx("span",{className:"sig-chips",children:n.map(([t,a])=>s.jsxs("span",{className:"sig-chip",children:[t," ",s.jsxs("span",{className:"muted",children:["×",a]})]},t))})}function bs({id:e,s:n,category:t}){const[a,l]=m.useState(!1),r=m.useId(),i=n.complexity_weights??{},o=n.complexity_subscores??{},c=Object.keys(i).map(d=>({key:d,weight:i[d],subscore:o[d]??0,pts:i[d]*(o[d]??0)*100})).sort((d,N)=>N.pts-d.pts),u=Math.max(...c.map(d=>d.pts),1e-4),p=Object.entries(n.category_scores??{}).map(([d,N])=>({k:d,v:N})).sort((d,N)=>N.v-d.v),j=Math.max(...p.map(d=>d.v),1e-4),x=p.filter(d=>d.v>.02||d.k===t),f=n.skills&&Object.keys(n.skills).length>0;return s.jsxs("div",{id:e,className:"signals-panel",children:[c.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Complexity breakdown ",s.jsx("span",{className:"muted",children:"— what built the score"})]}),s.jsx("ul",{className:"sig-bars",children:c.map(d=>s.jsxs("li",{className:"sig-bar-row",children:[s.jsx("span",{className:"sig-bar-label",children:ys[d.key]??d.key}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:P(d.pts/u)}})}),s.jsxs("span",{className:"sig-bar-val",children:[d.pts.toFixed(1)," pts"]}),s.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(d.subscore*100),"% intensity · weight ",Math.round(d.weight*100),"%"]})]},d.key))})]}),x.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Category scores ",s.jsxs("span",{className:"muted",children:["— why “",t,"” won"]})]}),s.jsx("ul",{className:"sig-bars",children:x.map(d=>s.jsxs("li",{className:"sig-bar-row"+(d.k===t?" is-win":""),children:[s.jsx("span",{className:"sig-bar-label",children:d.k}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:P(d.v/j)}})}),s.jsx("span",{className:"sig-bar-val",children:d.v.toFixed(2)})]},d.k))})]}),s.jsxs("section",{className:"sig-section",children:[s.jsx("h4",{className:"sig-h",children:"Evidence"}),s.jsxs("dl",{className:"sig-grid",children:[n.tool_counts&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Tools"}),s.jsx("dd",{children:s.jsx(L,{counts:n.tool_counts})})]}),f&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Skills"}),s.jsx("dd",{children:s.jsx(L,{counts:n.skills})})]}),n.subagent_role&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Subagent role"}),s.jsx("dd",{children:n.subagent_role})]}),n.files&&n.files.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("dt",{children:["Files (",n.files.length,")"]}),s.jsx("dd",{className:"sig-files",children:n.files.join(", ")})]})]})]}),s.jsx("button",{className:"ghost small","aria-expanded":a,"aria-controls":r,onClick:()=>l(d=>!d),children:a?"Hide raw JSON ▴":"View raw JSON ▾"}),a&&s.jsx("pre",{id:r,className:"code signals",children:JSON.stringify(n,null,2)})]})}function vs({f:e}){var i;const[n,t]=m.useState(!1),a=m.useId(),l=((i=e.signals)==null?void 0:i.modifiers)??{},r=Object.keys(l).filter(o=>l[o]!==!1&&l[o]!=null&&l[o]!=="");return s.jsxs("div",{className:"finding sev-border-"+e.severity,children:[s.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":a,onClick:()=>t(o=>!o),children:[s.jsx(V,{severity:e.severity}),s.jsx("span",{className:"finding-title",children:e.title??e.rule_id}),e.framework_ref&&s.jsx("span",{className:"tag framework",children:e.framework_ref}),s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&s.jsxs("div",{className:"finding-body",id: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}),r.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Context"}),s.jsx("dd",{children:r.map(o=>s.jsxs("span",{className:"sig-chip",children:[o,l[o]!==!0?s.jsxs("span",{className:"muted",children:[" ",String(l[o])]}):null]},o))})]})]}),s.jsxs(_,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(e.rule_id)}`,children:["see all “",e.rule_id,"” findings →"]})]})]})}function Ss({findings:e}){if(!e.length)return null;const n=[...e].sort((t,a)=>I.indexOf(t.severity)-I.indexOf(a.severity));return s.jsx("div",{className:"tool-findings",children:n.map(t=>s.jsx(vs,{f:t},t.id))})}function Cs({findings:e,sessionId:n}){const t=new Map;for(const l of e)t.set(l.severity,(t.get(l.severity)??0)+1);const a=I.find(l=>t.has(l))??"info";return s.jsxs("div",{className:"security-banner sev-border-"+a,role:"status",children:[s.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),s.jsxs("span",{className:"security-banner-text",children:[e.length," security ",e.length===1?"finding":"findings"," in this session"]}),s.jsx("span",{className:"security-banner-sevs",children:I.filter(l=>t.has(l)).map(l=>s.jsx(V,{severity:l,count:t.get(l)},l))}),s.jsx(_,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function Is(e){const n={dirs:new Map,files:[]};for(const a of e){const l=a.display.startsWith("/"),r=(l?a.display.slice(1):a.display).split("/");l&&r.length>0&&(r[0]="/"+r[0]);let i=n;for(const o of r.slice(0,-1))i=i.dirs.get(o)??i.dirs.set(o,{dirs:new Map,files:[]}).get(o);i.files.push({name:r[r.length-1],path:a.path,list:a.list})}const t=a=>{for(const[l,r]of[...a.dirs.entries()])if(t(r),r.files.length===0&&r.dirs.size===1){const[i,o]=[...r.dirs.entries()][0];a.dirs.delete(l),a.dirs.set(l+"/"+i,o)}};return t(n),n}function Q({node:e,depth:n}){const t={paddingLeft:`${.4+n*1.1}rem`};return s.jsxs(s.Fragment,{children:[[...e.dirs.entries()].sort(([a],[l])=>a.localeCompare(l)).map(([a,l])=>s.jsxs(m.Fragment,{children:[s.jsx("tr",{children:s.jsx("td",{colSpan:3,style:t,children:s.jsxs("span",{className:"muted",children:["📁 ",a,"/"]})})}),s.jsx(Q,{node:l,depth:n+1})]},a)),[...e.files].sort((a,l)=>a.name.localeCompare(l.name)).map(a=>{const l=a.list.find(o=>o.event_uuid),r=a.list.reduce((o,c)=>o+(c.lines_added??0),0),i=a.list.reduce((o,c)=>o+(c.lines_removed??0),0);return s.jsxs("tr",{children:[s.jsx("td",{style:t,children:l!=null&&l.event_uuid?s.jsx("a",{href:`#ev-${l.event_uuid}`,className:"title",title:a.path+" — jump to the first change",children:a.name}):s.jsx("span",{title:a.path,children:a.name})}),s.jsxs("td",{className:"num",children:[a.list.length,"× ",s.jsxs("span",{className:"muted",children:["(+",r," −",i,")"]})]}),s.jsx("td",{children:s.jsx(_,{className:"subagent-link small",to:`/file?path=${encodeURIComponent(a.path)}`,children:"history →"})})]},a.path)})]})}function Ts({changes:e,projectPath:n}){const t=new Map;for(const r of e)(t.get(r.file_path)??t.set(r.file_path,[]).get(r.file_path)).push(r);const a=r=>n&&r.startsWith(n.replace(/\/$/,"")+"/")?r.slice(n.replace(/\/$/,"").length+1):r,l=Is([...t.entries()].map(([r,i])=>({display:a(r),path:r,list:i})));return s.jsxs("details",{className:"wf-run files-changed",children:[s.jsxs("summary",{children:["📄 ",t.size," ",t.size===1?"file":"files"," changed · ",e.length," ",e.length===1?"edit":"edits"]}),s.jsx("table",{className:"sessions",children:s.jsx("tbody",{children:s.jsx(Q,{node:l,depth:0})})})]})}function Os({d:e}){const n=e.session;return s.jsxs("div",{className:"detail-head",children:[s.jsx(_,{to:"/",className:"back",children:"← all sessions"}),s.jsx("h1",{children:n.title||n.id.slice(0,12)}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("span",{children:s.jsx("b",{children:n.source_id})}),s.jsx("span",{className:"path",children:n.project_path}),n.is_sidechain?s.jsx("span",{className:"tag subagent",children:"subagent"}):null,e.parent&&s.jsxs("span",{className:"spawned-by",children:["↖ spawned by"," ",s.jsx(_,{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:[n.event_count," events"]}),s.jsxs("span",{title:ds(n.token_split),children:[cs(n.tokens)," tok"]}),s.jsx("span",{title:"Estimated at API list prices (cache-aware)",children:us(n.cost)}),n.tool_call_count>0&&s.jsxs("span",{className:n.tool_failure_count>0?"tool-err-stat":"muted",title:"Tool calls that returned is_error, of "+n.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:[n.tool_failure_count," failed",n.tool_rejection_count>0?` · ${n.tool_rejection_count} declined/blocked`:"",` of ${n.tool_call_count} tool calls`]}),s.jsx("span",{children:C(n.duration_ms)}),s.jsx("span",{className:"muted",children:W(n.started_at)}),s.jsx(_s,{id:n.id})]}),e.classification&&s.jsx(ks,{c:e.classification}),e.findings&&e.findings.length>0&&s.jsx(Cs,{findings:e.findings,sessionId:n.id}),e.file_changes&&e.file_changes.length>0&&s.jsx(Ts,{changes:e.file_changes,projectPath:n.project_path??null})]})}function Es({turnCount:e,anyOpen:n,onToggleAll:t,hideTools:a,onToggleHideTools:l,format:r,onChooseFormat:i}){return s.jsxs("div",{className:"transcript-tools",children:[e>1&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"muted small",children:[e," turns"]}),s.jsx("button",{className:"ghost small",onClick:t,children:n?"Collapse all":"Expand all"})]}),s.jsxs("button",{className:"ghost small"+(a?" is-active":""),"aria-pressed":a,onClick:l,title:"Hide Bash/Edit/Skill and other tool calls — show only assistant answers, plans and questions",children:[a?"☑ ":"☐ ","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"})]})]})}function Fs({d:e}){const n=e.workflow_runs??[],t=e.children.filter(l=>!l.workflow_run_id),a=n.length>0;return s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Spawned subagents (",e.children.length,")"]}),n.map(l=>{const r=e.children.filter(i=>i.workflow_run_id===l.run_id);return s.jsxs("details",{className:"wf-run",children:[s.jsxs("summary",{children:[s.jsxs(_,{className:"wf-run-name",to:`/workflow/${l.run_id}`,onClick:i=>i.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:[r.length," agent",r.length===1?"":"s",l.turn_seq!=null?` · turn ${l.turn_seq+1}`:""," · ",s.jsx("code",{children:l.run_id})]})]}),s.jsx("ul",{children:r.map(i=>s.jsx(E,{a:i},i.id))})]},l.run_id)}),t.length>0&&(a?s.jsxs("details",{className:"wf-run",open:!0,children:[s.jsxs("summary",{children:[s.jsx("span",{className:"wf-run-name",children:"Task / Agent"}),s.jsxs("span",{className:"muted small",children:[t.length," subagent",t.length===1?"":"s"]})]}),s.jsx("ul",{children:t.map(l=>s.jsx(E,{a:l},l.id))})]}):s.jsx("ul",{children:t.map(l=>s.jsx(E,{a:l},l.id))}))]})}function H(e,n){const t=e===""?[]:e.split(`
|
|
1
|
+
import{p as os,j as s,q as O,r as m,L as _,f as cs,t as ds,b as us,v as ms,c as C,w as W,s as hs,x as ps,i as R,n as D,l as xs,y as fs,z as js,E as gs,m as Ns}from"./index-BxbXFMQG.js";import{S as I,a as V}from"./severity-DTzxtVJn.js";import{A as F,C as y,p as k}from"./jsonish-B3QCD4cU.js";import{M as ws,r as _s}from"./index-BnVRCFL6.js";function ks({id:e}){const n=os();return s.jsxs("details",{className:"export-menu col-customizer",ref:n,children:[s.jsx("summary",{className:"export",title:"Export this session as Markdown",children:"⬇ Export Markdown"}),s.jsxs("div",{className:"col-menu",role:"group","aria-label":"Export options",children:[s.jsxs("a",{href:O(e),download:!0,children:["Redacted ",s.jsx("span",{className:"muted small",children:"(secrets masked)"})]}),s.jsxs("a",{href:O(e,"structure"),download:!0,children:["Structure only ",s.jsx("span",{className:"muted small",children:"(scrubbed)"})]}),s.jsxs("a",{className:"export-verbatim",href:O(e,"off"),download:!0,children:["Verbatim ",s.jsx("span",{className:"muted small",children:"(unredacted)"})]})]})]})}function ys({c:e}){var r;const[n,t]=m.useState(!1),a=m.useId(),l=(r=e.signals)==null?void 0:r.loc;return s.jsxs("div",{className:"classification",children:[s.jsx("span",{className:"tag cat cat-"+(e.category??"none"),children:e.category??"unclassified"}),e.complexity_band&&s.jsxs("span",{className:"tag complexity",children:[e.complexity_band," · ",e.complexity_score]}),l&&s.jsxs("span",{className:"muted small",children:["+",l.added,"/−",l.removed," LoC · ",l.files," files"]}),s.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":a,onClick:()=>t(i=>!i),children:["why ",n?"▾":"▸"]}),n&&(e.signals?s.jsx(vs,{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 bs={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},L=e=>`${Math.max(0,Math.min(1,e))*100}%`;function P({counts:e}){const n=Object.entries(e).sort((t,a)=>a[1]-t[1]);return n.length===0?s.jsx("span",{className:"muted",children:"—"}):s.jsx("span",{className:"sig-chips",children:n.map(([t,a])=>s.jsxs("span",{className:"sig-chip",children:[t," ",s.jsxs("span",{className:"muted",children:["×",a]})]},t))})}function vs({id:e,s:n,category:t}){const[a,l]=m.useState(!1),r=m.useId(),i=n.complexity_weights??{},o=n.complexity_subscores??{},c=Object.keys(i).map(d=>({key:d,weight:i[d],subscore:o[d]??0,pts:i[d]*(o[d]??0)*100})).sort((d,N)=>N.pts-d.pts),u=Math.max(...c.map(d=>d.pts),1e-4),p=Object.entries(n.category_scores??{}).map(([d,N])=>({k:d,v:N})).sort((d,N)=>N.v-d.v),j=Math.max(...p.map(d=>d.v),1e-4),x=p.filter(d=>d.v>.02||d.k===t),f=n.skills&&Object.keys(n.skills).length>0;return s.jsxs("div",{id:e,className:"signals-panel",children:[c.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Complexity breakdown ",s.jsx("span",{className:"muted",children:"— what built the score"})]}),s.jsx("ul",{className:"sig-bars",children:c.map(d=>s.jsxs("li",{className:"sig-bar-row",children:[s.jsx("span",{className:"sig-bar-label",children:bs[d.key]??d.key}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.pts/u)}})}),s.jsxs("span",{className:"sig-bar-val",children:[d.pts.toFixed(1)," pts"]}),s.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(d.subscore*100),"% intensity · weight ",Math.round(d.weight*100),"%"]})]},d.key))})]}),x.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Category scores ",s.jsxs("span",{className:"muted",children:["— why “",t,"” won"]})]}),s.jsx("ul",{className:"sig-bars",children:x.map(d=>s.jsxs("li",{className:"sig-bar-row"+(d.k===t?" is-win":""),children:[s.jsx("span",{className:"sig-bar-label",children:d.k}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.v/j)}})}),s.jsx("span",{className:"sig-bar-val",children:d.v.toFixed(2)})]},d.k))})]}),s.jsxs("section",{className:"sig-section",children:[s.jsx("h4",{className:"sig-h",children:"Evidence"}),s.jsxs("dl",{className:"sig-grid",children:[n.tool_counts&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Tools"}),s.jsx("dd",{children:s.jsx(P,{counts:n.tool_counts})})]}),f&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Skills"}),s.jsx("dd",{children:s.jsx(P,{counts:n.skills})})]}),n.subagent_role&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Subagent role"}),s.jsx("dd",{children:n.subagent_role})]}),n.files&&n.files.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("dt",{children:["Files (",n.files.length,")"]}),s.jsx("dd",{className:"sig-files",children:n.files.join(", ")})]})]})]}),s.jsx("button",{className:"ghost small","aria-expanded":a,"aria-controls":r,onClick:()=>l(d=>!d),children:a?"Hide raw JSON ▴":"View raw JSON ▾"}),a&&s.jsx("pre",{id:r,className:"code signals",children:JSON.stringify(n,null,2)})]})}function Ss({f:e}){var i;const[n,t]=m.useState(!1),a=m.useId(),l=((i=e.signals)==null?void 0:i.modifiers)??{},r=Object.keys(l).filter(o=>l[o]!==!1&&l[o]!=null&&l[o]!=="");return s.jsxs("div",{className:"finding sev-border-"+e.severity,children:[s.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":a,onClick:()=>t(o=>!o),children:[s.jsx(V,{severity:e.severity}),s.jsx("span",{className:"finding-title",children:e.title??e.rule_id}),e.framework_ref&&s.jsx("span",{className:"tag framework",children:e.framework_ref}),s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&s.jsxs("div",{className:"finding-body",id: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}),r.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Context"}),s.jsx("dd",{children:r.map(o=>s.jsxs("span",{className:"sig-chip",children:[o,l[o]!==!0?s.jsxs("span",{className:"muted",children:[" ",String(l[o])]}):null]},o))})]})]}),s.jsxs(_,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(e.rule_id)}`,children:["see all “",e.rule_id,"” findings →"]})]})]})}function Cs({findings:e}){if(!e.length)return null;const n=[...e].sort((t,a)=>I.indexOf(t.severity)-I.indexOf(a.severity));return s.jsx("div",{className:"tool-findings",children:n.map(t=>s.jsx(Ss,{f:t},t.id))})}function Is({findings:e,sessionId:n}){const t=new Map;for(const l of e)t.set(l.severity,(t.get(l.severity)??0)+1);const a=I.find(l=>t.has(l))??"info";return s.jsxs("div",{className:"security-banner sev-border-"+a,role:"status",children:[s.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),s.jsxs("span",{className:"security-banner-text",children:[e.length," security ",e.length===1?"finding":"findings"," in this session"]}),s.jsx("span",{className:"security-banner-sevs",children:I.filter(l=>t.has(l)).map(l=>s.jsx(V,{severity:l,count:t.get(l)},l))}),s.jsx(_,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function Ts(e){const n={dirs:new Map,files:[]};for(const a of e){const l=a.display.startsWith("/"),r=(l?a.display.slice(1):a.display).split("/");l&&r.length>0&&(r[0]="/"+r[0]);let i=n;for(const o of r.slice(0,-1))i=i.dirs.get(o)??i.dirs.set(o,{dirs:new Map,files:[]}).get(o);i.files.push({name:r[r.length-1],path:a.path,list:a.list})}const t=a=>{for(const[l,r]of[...a.dirs.entries()])if(t(r),r.files.length===0&&r.dirs.size===1){const[i,o]=[...r.dirs.entries()][0];a.dirs.delete(l),a.dirs.set(l+"/"+i,o)}};return t(n),n}function Q({node:e,depth:n}){const t={paddingLeft:`${.4+n*1.1}rem`};return s.jsxs(s.Fragment,{children:[[...e.dirs.entries()].sort(([a],[l])=>a.localeCompare(l)).map(([a,l])=>s.jsxs(m.Fragment,{children:[s.jsx("tr",{children:s.jsx("td",{colSpan:3,style:t,children:s.jsxs("span",{className:"muted",children:["📁 ",a,"/"]})})}),s.jsx(Q,{node:l,depth:n+1})]},a)),[...e.files].sort((a,l)=>a.name.localeCompare(l.name)).map(a=>{const l=a.list.find(o=>o.event_uuid),r=a.list.reduce((o,c)=>o+(c.lines_added??0),0),i=a.list.reduce((o,c)=>o+(c.lines_removed??0),0);return s.jsxs("tr",{children:[s.jsx("td",{style:t,children:l!=null&&l.event_uuid?s.jsx("a",{href:`#ev-${l.event_uuid}`,className:"title",title:a.path+" — jump to the first change",children:a.name}):s.jsx("span",{title:a.path,children:a.name})}),s.jsxs("td",{className:"num",children:[a.list.length,"× ",s.jsxs("span",{className:"muted",children:["(+",r," −",i,")"]})]}),s.jsx("td",{children:s.jsx(_,{className:"subagent-link small",to:`/file?path=${encodeURIComponent(a.path)}`,children:"history →"})})]},a.path)})]})}function Os({changes:e,projectPath:n}){const t=new Map;for(const r of e)(t.get(r.file_path)??t.set(r.file_path,[]).get(r.file_path)).push(r);const a=r=>n&&r.startsWith(n.replace(/\/$/,"")+"/")?r.slice(n.replace(/\/$/,"").length+1):r,l=Ts([...t.entries()].map(([r,i])=>({display:a(r),path:r,list:i})));return s.jsxs("details",{className:"wf-run files-changed",children:[s.jsxs("summary",{children:["📄 ",t.size," ",t.size===1?"file":"files"," changed · ",e.length," ",e.length===1?"edit":"edits"]}),s.jsx("table",{className:"sessions",children:s.jsx("tbody",{children:s.jsx(Q,{node:l,depth:0})})})]})}function Fs({d:e}){var t;const n=e.session;return s.jsxs("div",{className:"detail-head",children:[s.jsx(_,{to:"/",className:"back",children:"← all sessions"}),s.jsx("h1",{children:n.title||n.id.slice(0,12)}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("span",{children:s.jsx("b",{children:n.source_id})}),s.jsx("span",{className:"path",children:n.project_path}),n.is_sidechain?s.jsx("span",{className:"tag subagent",children:"subagent"}):null,e.parent&&s.jsxs("span",{className:"spawned-by",children:["↖ spawned by"," ",s.jsx(_,{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:[n.event_count," events"]}),s.jsxs("span",{title:ds(n.token_split),children:[cs(n.tokens)," tok"]}),s.jsxs("span",{title:ms(n.unpriced_models),children:[us(n.cost),(t=n.unpriced_models)!=null&&t.length?s.jsx("span",{className:"warn-tag",children:" ⚠"}):null]}),n.tool_call_count>0&&s.jsxs("span",{className:n.tool_failure_count>0?"tool-err-stat":"muted",title:"Tool calls that returned is_error, of "+n.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:[n.tool_failure_count," failed",n.tool_rejection_count>0?` · ${n.tool_rejection_count} declined/blocked`:"",` of ${n.tool_call_count} tool calls`]}),s.jsx("span",{children:C(n.duration_ms)}),s.jsx("span",{className:"muted",children:W(n.started_at)}),s.jsx(ks,{id:n.id})]}),e.classification&&s.jsx(ys,{c:e.classification}),e.findings&&e.findings.length>0&&s.jsx(Is,{findings:e.findings,sessionId:n.id}),e.file_changes&&e.file_changes.length>0&&s.jsx(Os,{changes:e.file_changes,projectPath:n.project_path??null})]})}function Es({turnCount:e,anyOpen:n,onToggleAll:t,hideTools:a,onToggleHideTools:l,format:r,onChooseFormat:i}){return s.jsxs("div",{className:"transcript-tools",children:[e>1&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"muted small",children:[e," turns"]}),s.jsx("button",{className:"ghost small",onClick:t,children:n?"Collapse all":"Expand all"})]}),s.jsxs("button",{className:"ghost small"+(a?" is-active":""),"aria-pressed":a,onClick:l,title:"Hide Bash/Edit/Skill and other tool calls — show only assistant answers, plans and questions",children:[a?"☑ ":"☐ ","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"})]})]})}function Ms({d:e}){const n=e.workflow_runs??[],t=e.children.filter(l=>!l.workflow_run_id),a=n.length>0;return s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Spawned subagents (",e.children.length,")"]}),n.map(l=>{const r=e.children.filter(i=>i.workflow_run_id===l.run_id);return s.jsxs("details",{className:"wf-run",children:[s.jsxs("summary",{children:[s.jsxs(_,{className:"wf-run-name",to:`/workflow/${l.run_id}`,onClick:i=>i.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:[r.length," agent",r.length===1?"":"s",l.turn_seq!=null?` · turn ${l.turn_seq+1}`:""," · ",s.jsx("code",{children:l.run_id})]})]}),s.jsx("ul",{children:r.map(i=>s.jsx(F,{a:i},i.id))})]},l.run_id)}),t.length>0&&(a?s.jsxs("details",{className:"wf-run",open:!0,children:[s.jsxs("summary",{children:[s.jsx("span",{className:"wf-run-name",children:"Task / Agent"}),s.jsxs("span",{className:"muted small",children:[t.length," subagent",t.length===1?"":"s"]})]}),s.jsx("ul",{children:t.map(l=>s.jsx(F,{a:l},l.id))})]}):s.jsx("ul",{children:t.map(l=>s.jsx(F,{a:l},l.id))}))]})}function H(e,n){const t=e===""?[]:e.split(`
|
|
2
2
|
`),a=n===""?[]:n.split(`
|
|
3
|
-
`),l=t.length,r=a.length;if(l*r>25e4)return[...t.map(p=>({type:"del",text:p})),...a.map(p=>({type:"add",text:p}))];const i=Array.from({length:l+1},()=>new Array(r+1).fill(0));for(let p=l-1;p>=0;p--)for(let j=r-1;j>=0;j--)i[p][j]=t[p]===a[j]?i[p+1][j+1]+1:Math.max(i[p+1][j],i[p][j+1]);const o=[];let c=0,u=0;for(;c<l&&u<r;)t[c]===a[u]?(o.push({type:"ctx",text:t[c]}),c++,u++):i[c+1][u]>=i[c][u+1]?(o.push({type:"del",text:t[c]}),c++):(o.push({type:"add",text:a[u]}),u++);for(;c<l;)o.push({type:"del",text:t[c++]});for(;u<r;)o.push({type:"add",text:a[u++]});return o}function
|
|
4
|
-
`).map(i=>({type:"add",text:i}))]}else if(e==="MultiEdit"){if(!Array.isArray(t.edits)||(a=t.edits.filter(i=>{const o=i;return!!o&&typeof o.old_string=="string"&&typeof o.new_string=="string"}).map(i=>H(i.old_string,i.new_string)),a.length===0))return null}else{if(typeof t.old_string!="string"||typeof t.new_string!="string")return null;a=[H(t.old_string,t.new_string)]}let l=0,r=0;for(const i of a)for(const o of i)o.type==="add"?l++:o.type==="del"&&r++;return{file_path:t.file_path,kind:e,hunks:a,adds:l,dels:r}}catch{return null}}function
|
|
5
|
-
`).length>18,[t,a]=m.useState(!1),l=m.useId();return n?s.jsxs("div",{className:"text-wrap"+(t?"":" is-clamped"),children:[s.jsx(J,{text:e,id:l}),s.jsx("button",{className:"ghost small show-more","aria-expanded":t,"aria-controls":l,onClick:()=>a(r=>!r),children:t?"Show less ▴":"Show more ▾"})]}):s.jsx(J,{text:e})}function ns({t:e}){const[n,t]=m.useState(!1),[a,l]=m.useState(!1),r=m.useId(),i=e.skill_name?`Skill · ${e.skill_name}`:e.tool_name==="Workflow"&&e.workflow_name?`Workflow · ${e.workflow_name}`:e.agent_type?`${e.tool_name} → ${e.agent_type}`:e.tool_name;return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":n,"aria-controls":r,onClick:()=>t(o=>!o),children:[s.jsxs("span",{className:"tool-name",children:["🔧 ",i]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),e.spawned_session_id&&s.jsx(_,{className:"subagent-link small",to:`/session/${e.spawned_session_id}`,children:"view subagent transcript →"}),e.workflow_run_id&&s.jsxs(_,{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(_,{className:"subagent-link small",to:`/skill/${encodeURIComponent(e.skill_name)}${e.skill_id?`?v=${e.skill_id}`:""}`,children:["📖 view skill",e.skill_id?" version":""," →"]}),n&&s.jsxs("div",{className:"tool-body",id:r,children:[e.input_json&&e.input_json!=="{}"&&s.jsxs("div",{className:"code-block",children:[s.jsx(y,{text:k(e.input_json),className:"copy-corner",title:"Copy tool input JSON"}),s.jsx("pre",{className:"code",children:k(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(o=>!o),children:[a?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),a&&s.jsxs("div",{className:"code-block",children:[s.jsx(y,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]})]})]})}function
|
|
3
|
+
`),l=t.length,r=a.length;if(l*r>25e4)return[...t.map(p=>({type:"del",text:p})),...a.map(p=>({type:"add",text:p}))];const i=Array.from({length:l+1},()=>new Array(r+1).fill(0));for(let p=l-1;p>=0;p--)for(let j=r-1;j>=0;j--)i[p][j]=t[p]===a[j]?i[p+1][j+1]+1:Math.max(i[p+1][j],i[p][j+1]);const o=[];let c=0,u=0;for(;c<l&&u<r;)t[c]===a[u]?(o.push({type:"ctx",text:t[c]}),c++,u++):i[c+1][u]>=i[c][u+1]?(o.push({type:"del",text:t[c]}),c++):(o.push({type:"add",text:a[u]}),u++);for(;c<l;)o.push({type:"del",text:t[c++]});for(;u<r;)o.push({type:"add",text:a[u++]});return o}function z(e){if(!e)return null;try{const n=JSON.parse(e).plan;return typeof n=="string"&&n.trim()?n:null}catch{return null}}function $s(e){if(!e)return[];try{const n=JSON.parse(e).questions;return Array.isArray(n)?n:[]}catch{return[]}}function As(e){if(!e)return{answers:{},annotations:{}};try{const n=JSON.parse(e);if(n&&typeof n=="object"&&n.answers)return{answers:n.answers,annotations:n.annotations??{}}}catch{}return{answers:{},annotations:{}}}function qs(e){if(!e)return null;try{const n=JSON.parse(e);if(!n||typeof n!="object")return null;const t=typeof n.command=="string"?n.command:"";return t.trim()?{command:t,description:typeof n.description=="string"?n.description:void 0,timeout:typeof n.timeout=="number"?n.timeout:void 0,run_in_background:n.run_in_background===!0,restart:n.restart===!0}:null}catch{return null}}function Bs(e,n){if(!n)return null;try{const t=JSON.parse(n);if(!t||typeof t!="object"||typeof t.file_path!="string")return null;let a;if(e==="Write"){if(typeof t.content!="string")return null;a=[t.content===""?[]:t.content.split(`
|
|
4
|
+
`).map(i=>({type:"add",text:i}))]}else if(e==="MultiEdit"){if(!Array.isArray(t.edits)||(a=t.edits.filter(i=>{const o=i;return!!o&&typeof o.old_string=="string"&&typeof o.new_string=="string"}).map(i=>H(i.old_string,i.new_string)),a.length===0))return null}else{if(typeof t.old_string!="string"||typeof t.new_string!="string")return null;a=[H(t.old_string,t.new_string)]}let l=0,r=0;for(const i of a)for(const o of i)o.type==="add"?l++:o.type==="del"&&r++;return{file_path:t.file_path,kind:e,hunks:a,adds:l,dels:r}}catch{return null}}function Rs(e){const n=e.lastIndexOf("/");return n>=0?{dir:e.slice(0,n+1),base:e.slice(n+1)}:{dir:"",base:e}}function K(e){var a,l,r,i,o;const n=(l=(a=e.match(/<command-name>([^<]*)<\/command-name>/))==null?void 0:a[1])==null?void 0:l.trim();if(n){const c=((i=(r=e.match(/<command-args>([^<]*)<\/command-args>/))==null?void 0:r[1])==null?void 0:i.trim())??"";return{kind:"invocation",name:n.startsWith("/")?n:`/${n}`,args:c}}const t=(o=e.match(/<(?:local-command-stdout|command-output|local-command-stderr)>([\s\S]*?)<\/(?:local-command-stdout|command-output|local-command-stderr)>/))==null?void 0:o[1];return t!=null?{kind:"output",stdout:t.trim()}:/<local-command-caveat>/.test(e)?{kind:"caveat"}:null}function Y(e){if(!/<task-notification>/.test(e))return null;const n=t=>{var a,l;return((l=(a=e.match(new RegExp(`<${t}>([\\s\\S]*?)</${t}>`)))==null?void 0:a[1])==null?void 0:l.trim())??null};return{taskId:n("task-id"),toolUseId:n("tool-use-id"),status:n("status"),summary:n("summary")}}function Ls(e){const n=K(e);if((n==null?void 0:n.kind)==="invocation")return`⌘ ${n.name}${n.args?" "+n.args:""}`;if((n==null?void 0:n.kind)==="output")return"⌘ command output";if((n==null?void 0:n.kind)==="caveat")return"⌘ local command";const t=Y(e);return t?`🔔 task ${t.status??"notification"}`:e}const G=m.createContext("markdown"),X=m.createContext(new Map),Z=m.createContext(!1),ss=m.createContext(null);function Ps({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 Hs({n:e}){const n=m.useContext(X),t=e.toolUseId?n.get(e.toolUseId):void 0,a=(e.status??"").toLowerCase();return s.jsxs("div",{className:"task-notif",children:[s.jsxs("div",{className:"task-notif-head",children:[s.jsx("span",{className:"task-notif-icon","aria-hidden":"true",children:"🔔"}),e.status&&s.jsx("span",{className:"tag task-status task-status-"+a,children:e.status}),e.taskId&&s.jsxs("code",{className:"task-notif-id",children:["task ",e.taskId]}),t&&s.jsx(_,{className:"subagent-link small",to:`/workflow/${t}`,children:"view workflow →"})]}),e.summary&&s.jsx("div",{className:"task-notif-summary",children:e.summary})]})}function J({text:e,id:n}){return m.useContext(G)==="raw"?s.jsx("div",{className:"text",id:n,children:e}):s.jsx("div",{className:"text md",id:n,children:s.jsx(ws,{remarkPlugins:[_s],components:Js,children:e})})}const Js={a:({node:e,...n})=>s.jsx("a",{...n,target:"_blank",rel:"noopener noreferrer"})};function es({text:e}){const n=e.length>1400||e.split(`
|
|
5
|
+
`).length>18,[t,a]=m.useState(!1),l=m.useId();return n?s.jsxs("div",{className:"text-wrap"+(t?"":" is-clamped"),children:[s.jsx(J,{text:e,id:l}),s.jsx("button",{className:"ghost small show-more","aria-expanded":t,"aria-controls":l,onClick:()=>a(r=>!r),children:t?"Show less ▴":"Show more ▾"})]}):s.jsx(J,{text:e})}function ns({t:e}){const[n,t]=m.useState(!1),[a,l]=m.useState(!1),r=m.useId(),i=e.skill_name?`Skill · ${e.skill_name}`:e.tool_name==="Workflow"&&e.workflow_name?`Workflow · ${e.workflow_name}`:e.agent_type?`${e.tool_name} → ${e.agent_type}`:e.tool_name;return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":n,"aria-controls":r,onClick:()=>t(o=>!o),children:[s.jsxs("span",{className:"tool-name",children:["🔧 ",i]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),e.spawned_session_id&&s.jsx(_,{className:"subagent-link small",to:`/session/${e.spawned_session_id}`,children:"view subagent transcript →"}),e.workflow_run_id&&s.jsxs(_,{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(_,{className:"subagent-link small",to:`/skill/${encodeURIComponent(e.skill_name)}${e.skill_id?`?v=${e.skill_id}`:""}`,children:["📖 view skill",e.skill_id?" version":""," →"]}),n&&s.jsxs("div",{className:"tool-body",id:r,children:[e.input_json&&e.input_json!=="{}"&&s.jsxs("div",{className:"code-block",children:[s.jsx(y,{text:k(e.input_json),className:"copy-corner",title:"Copy tool input JSON"}),s.jsx("pre",{className:"code",children:k(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(o=>!o),children:[a?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),a&&s.jsxs("div",{className:"code-block",children:[s.jsx(y,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]})]})]})}function Us({plan:e}){return s.jsxs("div",{className:"plan-card",children:[s.jsx("div",{className:"plan-card-head",children:"📋 Approved plan"}),s.jsx(es,{text:e})]})}function Ws({t:e}){const[n,t]=m.useState(!1),a=m.useId(),l=$s(e.input_json),{answers:r,annotations:i}=As(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((o,c)=>{var N;const u=r[o.question],p=Array.isArray(u)?u:u!=null?[u]:[],j=new Set(p),x=new Set(o.options.map(g=>g.label)),f=p.filter(g=>!x.has(g)),d=(N=i[o.question])==null?void 0:N.notes;return s.jsxs("div",{className:"qa-q",children:[s.jsxs("div",{className:"qa-q-head",children:[o.header&&s.jsx("span",{className:"tag",children:o.header}),o.multiSelect&&s.jsx("span",{className:"muted small",children:"multi-select"})]}),s.jsx("div",{className:"qa-question",children:o.question}),s.jsxs("ul",{className:"qa-options",children:[o.options.map((g,v)=>{const S=j.has(g.label);return s.jsxs("li",{className:"qa-opt"+(S?" is-selected":""),children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:S?"☑":"☐"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:g.label}),g.description&&s.jsx("span",{className:"qa-opt-desc muted",children:g.description})]})]},v)}),f.map((g,v)=>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:g}),s.jsx("span",{className:"qa-opt-desc muted",children:"custom answer"})]})]},"c"+v))]}),d&&s.jsxs("div",{className:"qa-note",children:["📝 ",d]})]},c)}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":n,"aria-controls":a,onClick:()=>t(o=>!o),children:n?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(y,{text:k(e.input_json??"{}")+(e.result_summary?`
|
|
6
6
|
|
|
7
7
|
`+k(e.result_summary):""),label:"JSON",title:"Copy raw question JSON"})]}),n&&s.jsxs("pre",{id:a,className:"code",children:[k(e.input_json??"{}"),e.result_summary?`
|
|
8
8
|
|
|
9
|
-
`+k(e.result_summary):""]})]})}function
|
|
10
|
-
`),t=[];let a="NORMAL",l=0;const r=[];let i=!1;for(const o of n){if(r.length>0){t.push({text:o,cont:!0});const c=r[0];(c.strip?o.replace(/^\t+/,""):o).trimEnd()===c.delim&&r.shift();continue}t.push({text:o,cont:a!=="NORMAL"||l>0||i}),i=!1;for(let c=0;c<o.length;c++){const u=o[c];if(a==="SQUOTE"){u==="'"&&(a="NORMAL");continue}if(a==="DQUOTE"){u==="\\"?c++:u==='"'?a="NORMAL":u==="$"&&o[c+1]==="("?(l++,c++):u===")"?l>0&&l--:u==="<"&&o[c+1]==="<"&&o[c+2]!=="<"&&o[c-1]!=="<"&&(c=U(o,c,r));continue}if(u==="\\")c++;else if(u==="'")a="SQUOTE";else if(u==='"')a="DQUOTE";else{if(u==="#"&&(c===0||/\s/.test(o[c-1])))break;u==="$"&&o[c+1]==="("?(l++,c++):u==="("?l++:u===")"?l>0&&l--:u==="<"&&o[c+1]==="<"&&o[c+2]!=="<"&&o[c-1]!=="<"&&(c=U(o,c,r))}}if(a==="NORMAL"&&l===0&&r.length===0){const c=o.replace(/\s+$/,""),u=c.match(/\\+$/);(u&&u[0].length%2===1||/(&&|\|\||\|)$/.test(c))&&(i=!0)}}return t}function
|
|
11
|
-
`)[0],j=
|
|
12
|
-
`:""]},f))})]}),(n.run_in_background||n.restart||n.timeout!=null)&&s.jsxs("div",{className:"bash-badges",children:[n.run_in_background&&s.jsx("span",{className:"bash-badge",children:"background"}),n.restart&&s.jsx("span",{className:"bash-badge",children:"restart"}),n.timeout!=null&&s.jsxs("span",{className:"bash-badge",children:["timeout ",Math.round(n.timeout/1e3),"s"]})]}),e.result_summary&&s.jsx("pre",{className:"shell-out",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":l,onClick:()=>r(x=>!x),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(y,{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":i,"aria-controls":u,onClick:()=>o(x=>!x),children:i?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(y,{text:k(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),i&&s.jsx("pre",{id:u,className:"code",children:k(e.input_json??"{}")})]})]})}const
|
|
9
|
+
`+k(e.result_summary):""]})]})}function Ds({t:e}){const n=e.workflow_name?`Workflow · ${e.workflow_name}`:"Workflow";return s.jsxs("div",{className:"tool launch-tool",children:[s.jsxs("div",{className:"launch-tool-head",children:[s.jsxs("span",{className:"tool-name",children:["🔀 ",n]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status})]}),e.workflow_run_id&&s.jsxs(_,{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 U(e,n,t){let a=n+2,l=!1;for(e[a]==="-"&&(l=!0,a++);e[a]===" "||e[a]===" ";)a++;let r="";(e[a]==="'"||e[a]==='"')&&(r=e[a],a++);let i="";if(r){for(;a<e.length&&e[a]!==r;)i+=e[a++];e[a]===r&&a++}else for(;a<e.length&&/[A-Za-z0-9_]/.test(e[a]);)i+=e[a++];return i&&t.push({delim:i,strip:l}),a-1}function Vs(e){const n=e.split(`
|
|
10
|
+
`),t=[];let a="NORMAL",l=0;const r=[];let i=!1;for(const o of n){if(r.length>0){t.push({text:o,cont:!0});const c=r[0];(c.strip?o.replace(/^\t+/,""):o).trimEnd()===c.delim&&r.shift();continue}t.push({text:o,cont:a!=="NORMAL"||l>0||i}),i=!1;for(let c=0;c<o.length;c++){const u=o[c];if(a==="SQUOTE"){u==="'"&&(a="NORMAL");continue}if(a==="DQUOTE"){u==="\\"?c++:u==='"'?a="NORMAL":u==="$"&&o[c+1]==="("?(l++,c++):u===")"?l>0&&l--:u==="<"&&o[c+1]==="<"&&o[c+2]!=="<"&&o[c-1]!=="<"&&(c=U(o,c,r));continue}if(u==="\\")c++;else if(u==="'")a="SQUOTE";else if(u==='"')a="DQUOTE";else{if(u==="#"&&(c===0||/\s/.test(o[c-1])))break;u==="$"&&o[c+1]==="("?(l++,c++):u==="("?l++:u===")"?l>0&&l--:u==="<"&&o[c+1]==="<"&&o[c+2]!=="<"&&o[c-1]!=="<"&&(c=U(o,c,r))}}if(a==="NORMAL"&&l===0&&r.length===0){const c=o.replace(/\s+$/,""),u=c.match(/\\+$/);(u&&u[0].length%2===1||/(&&|\|\||\|)$/.test(c))&&(i=!0)}}return t}function Qs({t:e,bash:n}){const[t,a]=m.useState(!1),[l,r]=m.useState(!1),[i,o]=m.useState(!1),c=m.useId(),u=m.useId(),p=n.command.split(`
|
|
11
|
+
`)[0],j=Vs(n.command);return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":t,"aria-controls":c,onClick:()=>a(x=>!x),children:[s.jsx("span",{className:"tool-name",children:"🖥 Bash"}),n.description?s.jsxs("span",{className:"bash-desc",children:["# ",n.description]}):!t&&s.jsx("span",{className:"bash-preview",children:p}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:t?"▾":"▸"})]}),t&&s.jsxs("div",{className:"tool-body",id:c,children:[s.jsxs("div",{className:"shell code-block",children:[s.jsx(y,{text:n.command,className:"copy-corner",title:"Copy command"}),s.jsx("pre",{className:"shell-cmd",children:j.map((x,f)=>s.jsxs("span",{children:[s.jsx("span",{className:"shell-gutter"+(x.cont?" cont":""),"aria-hidden":"true",children:x.cont?" ":"$ "}),x.text,f<j.length-1?`
|
|
12
|
+
`:""]},f))})]}),(n.run_in_background||n.restart||n.timeout!=null)&&s.jsxs("div",{className:"bash-badges",children:[n.run_in_background&&s.jsx("span",{className:"bash-badge",children:"background"}),n.restart&&s.jsx("span",{className:"bash-badge",children:"restart"}),n.timeout!=null&&s.jsxs("span",{className:"bash-badge",children:["timeout ",Math.round(n.timeout/1e3),"s"]})]}),e.result_summary&&s.jsx("pre",{className:"shell-out",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":l,onClick:()=>r(x=>!x),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(y,{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":i,"aria-controls":u,onClick:()=>o(x=>!x),children:i?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(y,{text:k(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),i&&s.jsx("pre",{id:u,className:"code",children:k(e.input_json??"{}")})]})]})}const zs={Edit:"✏️",MultiEdit:"✏️",Write:"📄"},E=400;function Ks({t:e,edit:n}){const[t,a]=m.useState(!1),[l,r]=m.useState(!1),[i,o]=m.useState(!1),c=m.useId(),u=m.useId(),{dir:p,base:j}=Rs(n.file_path);return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":t,"aria-controls":c,onClick:()=>a(x=>!x),children:[s.jsxs("span",{className:"tool-name",children:[zs[n.kind]??"✏️"," ",n.kind]}),s.jsxs("span",{className:"edit-path",children:[s.jsx("span",{className:"base",children:j}),p&&s.jsx("span",{className:"dir",children:p.replace(/\/$/,"")})]}),s.jsxs("span",{className:"diff-stat",children:[n.adds>0&&s.jsxs("span",{className:"add",children:["+",n.adds]}),n.dels>0&&s.jsxs("span",{className:"del",children:["−",n.dels]})]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:t?"▾":"▸"})]}),t&&s.jsxs("div",{className:"tool-body",id:c,children:[n.hunks.map((x,f)=>s.jsxs("div",{className:"diff",children:[n.hunks.length>1&&s.jsxs("div",{className:"diff-hunk-sep",children:["edit ",f+1]}),x.slice(0,E).map((d,N)=>s.jsxs("div",{className:"diff-line "+d.type,children:[s.jsx("span",{className:"diff-sign","aria-hidden":"true",children:d.type==="add"?"+":d.type==="del"?"−":" "}),s.jsx("span",{className:"diff-text",children:d.text===""?" ":d.text})]},N)),x.length>E&&s.jsxs("div",{className:"diff-more",children:["… ",x.length-E," more lines — View raw JSON for the rest"]})]},f)),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:()=>r(x=>!x),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(y,{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":i,"aria-controls":u,onClick:()=>o(x=>!x),children:i?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(y,{text:k(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),i&&s.jsx("pre",{id:u,className:"code",children:k(e.input_json??"{}")})]})]})}function Ys({t:e,hideTools:n}){const t=e.findings??[],a=n&&t.length===0,l=Gs(e,a);return t.length===0?l:s.jsxs(s.Fragment,{children:[l,s.jsx(Cs,{findings:t})]})}function Gs(e,n){if(e.tool_name==="ExitPlanMode"){const t=z(e.input_json);if(t)return s.jsx(Us,{plan:t})}if(e.tool_name==="AskUserQuestion")return s.jsx(Ws,{t:e});if(e.tool_name==="Workflow")return s.jsx(Ds,{t:e});if(e.tool_name==="Bash"){const t=qs(e.input_json);if(t)return n?null:s.jsx(Qs,{t:e,bash:t})}if(e.tool_name==="Edit"||e.tool_name==="MultiEdit"||e.tool_name==="Write"){const t=Bs(e.tool_name,e.input_json);if(t)return n?null:s.jsx(Ks,{t:e,edit:t})}return n?null:s.jsx(ns,{t:e})}function Xs(e,n){return e.findings&&e.findings.length||e.tool_name==="AskUserQuestion"||e.tool_name==="Workflow"||e.tool_name==="ExitPlanMode"&&z(e.input_json)?!0:!n}function ts({e}){const[n,t]=m.useState(!1),a=m.useId(),l=m.useContext(Z),r=m.useContext(ss),i=e.role||e.type,o=i==="user"?"👤":i==="assistant"?"🤖":"⚙️",c=e.toolCalls.filter(f=>Xs(f,l));if(!(e.text||e.thinking||c.length))return null;const p=e.text?K(e.text):null,j=e.text&&!p?Y(e.text):null,x=e.text||e.thinking||"";return s.jsxs("div",{id:"ev-"+e.uuid,className:"event ev-"+i+(r===e.uuid?" ev-flagged":""),children:[s.jsxs("div",{className:"ev-meta",children:[s.jsxs("span",{className:"ev-who",children:[o," ",i]}),e.model&&s.jsx("span",{className:"tag",children:hs(e.model)}),e.is_sidechain?s.jsx("span",{className:"tag subagent",children:"subagent"}):null,s.jsx("span",{className:"muted ev-time",children:W(e.timestamp)}),x&&s.jsx(y,{text:x,className:"ev-copy copy-hover",title:"Copy message"})]}),e.thinking&&s.jsxs("div",{className:"thinking",children:[s.jsxs("button",{className:"thinking-toggle","aria-expanded":n,"aria-controls":a,onClick:()=>t(f=>!f),children:["🧠 thinking ",n?"▾":"▸"]}),n&&s.jsxs("div",{className:"code-block",children:[s.jsx(y,{text:e.thinking,className:"copy-corner",title:"Copy thinking"}),s.jsx("pre",{id:a,className:"thinking-body",children:e.thinking})]})]}),e.text&&(p?s.jsx(Ps,{cmd:p}):j?s.jsx(Hs,{n:j}):s.jsx(es,{text:e.text})),c.map((f,d)=>s.jsx(Ys,{t:f,hideTools:l},d))]})}function Zs({turn:e,events:n,open:t,onToggle:a}){const l=m.useId();return s.jsxs("section",{className:"turn"+(t?" is-open":""),children:[s.jsxs("button",{className:"turn-head","aria-expanded":t,"aria-controls":l,onClick:a,children:[s.jsx("span",{className:"chev turn-chev","aria-hidden":"true",children:t?"▾":"▸"}),s.jsxs("span",{className:"turn-no",children:["turn ",e.seq+1]}),e.prompt_preview?s.jsx("span",{className:"turn-preview",children:Ls(e.prompt_preview)}):null,s.jsxs("span",{className:"turn-stats muted",children:[n.length," msg",n.length===1?"":"s",e.duration_ms?" · "+C(e.duration_ms):""]})]}),s.jsx("div",{id:l,className:"turn-body",role:"region","aria-label":`turn ${e.seq+1} messages`,children:t&&n.map(r=>s.jsx(ts,{e:r},r.uuid))})]})}function se(e,n){const t=new Map(n.map(l=>[l.id,l])),a=[];for(const l of e){const r=l.turn_id??null,i=a[a.length-1];i&&i.turnId===r?i.events.push(l):a.push({turnId:r,turn:r?t.get(r)??null:null,events:[l]})}return a}function ee(e){const{data:n,error:t}=ps("/sessions/"+e,{reset:!0}),a=m.useMemo(()=>{const l=new Map;for(const r of(n==null?void 0:n.events)??[])for(const i of r.toolCalls)i.tool_name==="Workflow"&&i.id&&i.workflow_run_id&&l.set(i.id,i.workflow_run_id);return l},[n]);return{d:n,error:t,wfMap:a}}const M="msgFormat",$="hideTools";function as(e){const n=xs(e,null);if(n!=null)return n;try{return localStorage.getItem("agentlens."+e)}catch{return null}}const ls=e=>e==="raw"?"raw":"markdown",rs=e=>e===!0||e===1||e==="1";function ne(){return ls(as(M))}function te(){return rs(as($))}function ae(e){D(M,e)}function le(e){D($,e)}async function re(){const[e,n]=await Promise.all([R(M),R($)]);return{...e!=null?{format:ls(e)}:{},...n!=null?{hideTools:rs(n)}:{}}}function ue(){var q;const{id:e}=fs(),{hash:n}=js(),{d:t,error:a,wfMap:l}=ee(e),[r,i]=m.useState(new Set),[o,c]=m.useState(ne),[u,p]=m.useState(te);m.useEffect(()=>i(new Set),[e]),m.useEffect(()=>{re().then(h=>{h.format!==void 0&&c(h.format),h.hideTools!==void 0&&p(h.hideTools)})},[]);const j=h=>{c(h),ae(h)},x=()=>p(h=>(le(!h),!h)),f=((q=/^#ev-(.+)$/.exec(n))==null?void 0:q[1])??null,[d,N]=m.useState(null);m.useEffect(()=>{var b;const h=f?(b=t==null?void 0:t.events.find(w=>w.uuid===f))==null?void 0:b.turn_id:null;h&&i(w=>{if(!w.has(h))return w;const B=new Set(w);return B.delete(h),B})},[t,f]);const g=m.useRef(null);if(m.useEffect(()=>{if(!t||!f){g.current=null;return}if(g.current===n)return;const h=document.getElementById("ev-"+f);if(!h)return;g.current=n,h.scrollIntoView({block:"center",behavior:"smooth"}),N(f);const b=window.setTimeout(()=>N(null),3e3);return()=>window.clearTimeout(b)},[t,n,f,r]),a)return s.jsx(gs,{error:a});if(!t)return s.jsx(Ns,{});const v=t.events.filter(h=>h.text||h.thinking||h.toolCalls.length),S=se(v,t.turns),T=S.filter(h=>h.turn).map(h=>h.turnId),A=T.some(h=>!r.has(h)),is=h=>i(b=>{const w=new Set(b);return w.has(h)?w.delete(h):w.add(h),w});return s.jsxs("div",{className:"detail",children:[s.jsx(Fs,{d:t}),t.children&&t.children.length>0&&s.jsx(Ms,{d:t}),s.jsx(Es,{turnCount:T.length,anyOpen:A,onToggleAll:()=>i(A?new Set(T):new Set),hideTools:u,onToggleHideTools:x,format:o,onChooseFormat:j}),s.jsx(X.Provider,{value:l,children:s.jsx(G.Provider,{value:o,children:s.jsx(Z.Provider,{value:u,children:s.jsx(ss.Provider,{value:d,children:s.jsxs("div",{className:"transcript",children:[v.length===0&&s.jsx("div",{className:"muted pad",role:"status",children:"This session has no rendered messages."}),S.map((h,b)=>h.turn?s.jsx(Zs,{turn:h.turn,events:h.events,open:!r.has(h.turnId),onToggle:()=>is(h.turnId)},h.turnId):s.jsx("div",{className:"unturned",children:h.events.map(w=>s.jsx(ts,{e:w},w.uuid))},"unturned-"+b))]})})})})})]})}export{ue as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{y as x,x as j,j as s,A as v,e as f,r as d,L as m,w as c}from"./index-BxbXFMQG.js";import{M as N,r as p}from"./index-BnVRCFL6.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 +1 @@
|
|
|
1
|
-
import{e as q,h as v,r as c,
|
|
1
|
+
import{e as q,h as v,r as c,B as F,x as C,C as E,j as e,F as R,E as w,m as I,S as d,L as K,w as M,P as D}from"./index-BxbXFMQG.js";const u=50,$={name:t=>t.name,fired:t=>t.call_count,last_fired:t=>t.last_fired};function Q(){const{params:t,get:r,set:n,pick:f}=q(),k=v("/sources",[]),y=v("/projects",[]),[h,m]=c.useState(r("q")),{sort:a,toggle:i}=F("fired","desc"),[N,j]=c.useState(1),p=f(["source","project","q"]),{data:x,loading:g,error:_}=C("/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(()=>E(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"}),k.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(R,{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(w,{error:_}),g?e.jsx(I,{}):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(K,{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(S=>e.jsx("span",{className:"tag",children:S},S))})}),e.jsx("td",{children:M(s.last_fired)})]},s.name))})]}),!g&&l.length>0&&e.jsx(D,{page:o,pages:b,total:l.length,unit:"skills",onPage:j})]})}export{Q as default};
|