@swestash/agent-lens 0.13.1 → 0.13.3
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 +2 -0
- package/dist/agent-lens.js.map +1 -1
- package/package.json +1 -1
- package/web/404.html +2 -2
- package/web/assets/{AboutView-CTsaAH4S.js → AboutView-Bs9oC-qO.js} +1 -1
- package/web/assets/{Dashboard-BlgHbFAO.js → Dashboard-ChkGvwY5.js} +1 -1
- package/web/assets/{FileView-H8cznXgC.js → FileView-Ds04pgGe.js} +1 -1
- package/web/assets/{FilesView-DcTXVmTM.js → FilesView-DQRiYUkL.js} +1 -1
- package/web/assets/{SecurityView-BX8_fqTV.js → SecurityView-CYJCfLrm.js} +1 -1
- package/web/assets/{SessionView-Ca_qMO_F.js → SessionView-BBpziIqZ.js} +1 -1
- package/web/assets/{SkillView-DOVeEKYQ.js → SkillView-BCH5ldzv.js} +1 -1
- package/web/assets/{SkillsView-Cpn8jdVM.js → SkillsView-Nlyh5MJW.js} +1 -1
- package/web/assets/{WorkflowView-DIDK6U8g.js → WorkflowView-JwRwz2E2.js} +1 -1
- package/web/assets/index-BPS7n4_B.css +1 -0
- package/web/assets/{index-2eZrG4wC.js → index-C2D0y2yH.js} +1 -1
- package/web/assets/{index-CZWQ3Zzl.js → index-r-fSz0IT.js} +15 -15
- package/web/assets/{jsonish-CXEf39_V.js → jsonish-mD--ddqP.js} +1 -1
- package/web/assets/{useResetOn-BsVWvhC3.js → useResetOn-2tqWddId.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/index-BJ7zMXRA.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-r-fSz0IT.js"></script>
|
|
20
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BPS7n4_B.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
23
23
|
<div id="root"></div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as j,j as e,A as g}from"./index-
|
|
1
|
+
import{x as j,j as e,A as g}from"./index-r-fSz0IT.js";const c="v0.13.2-1-g0662873";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 R,j,u as lO,a as Hb,f as Lt,s as Gb,b as jn,c as wi,L as fO,d as Oi,g as ce,R as P,e as hO,l as Yh,h as Zh,i as dO,k as pO,m as Jh,n as vO,E as yO,o as mO,p as mo}from"./index-CZWQ3Zzl.js";const go=8,gO=26;function bO(){const[e,t]=R.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,go),expandHeight:(o,u,s=gO)=>e.has(o)?Math.max(240,u*s):void 0,expandBtn:(o,u)=>{if(!(u<=go))return j.jsx("button",{type:"button",className:"link-btn",onClick:()=>r(o),children:e.has(o)?`show top ${go}`:`show all (${u})`})}}}function Be(){const{theme:e}=lO();return R.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 Vb(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 xO({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 Ff({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 wO(){const e=Hb(),t=(n,i)=>{i!=null&&i!==""&&e(`/?${n}=${encodeURIComponent(i)}`)};return{drillFilter:t,drillTo:(n,i)=>a=>t(n,Vb(a,i))}}const Er="custom",qa="all",Xb=[{id:qa,label:"All"},{id:"cost",label:"Cost",kpis:["cost","cost-per-session","total-tokens","token-breakdown","cache-read-ratio","sessions"],charts:["cost-over-time","tokens-over-time","tokens-by-model"]},{id:"reliability",label:"Reliability",kpis:["tool-error-rate","rejection-rate","workflow-runs","turns","turn-duration","session-duration","security"],charts:["tool-errors","error-types","activity"]},{id:"activity",label:"Activity",kpis:["sessions","projects","turns","session-duration"],charts:["activity","category","complexity","tool-frequency","skill-activation","subagent-fanout"]}];function Yb(e){return Xb.find(t=>t.id===e)}const bo="dashboard.layout",Qh="dashboard.charts";function Di(){return{hidden:[],order:[]}}function Zb(){return{kpis:Di(),charts:Di()}}function OO(){return{v:1,active:qa,custom:null,kpisCollapsed:!1}}function xl(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function ed(e){if(typeof e!="object"||e===null)return Di();const t=e;return{hidden:xl(t.hidden),order:xl(t.order)}}function _O(e){if(typeof e!="object"||e===null)return null;const t=e;return{kpis:ed(t.kpis),charts:ed(t.charts)}}function td(e,t){if(typeof e!="object"||e===null){const n=xl(t);if(n.length===0)return OO();const i=Zb();return i.charts.hidden=n,{v:1,active:Er,custom:i,kpisCollapsed:!1}}const r=e;return{v:1,active:typeof r.active=="string"?r.active:qa,custom:_O(r.custom),kpisCollapsed:r.kpisCollapsed===!0}}function Jb(e,t){const r=new Set(e),n=new Set,i=[];for(const a of t)r.has(a)&&!n.has(a)&&(i.push(a),n.add(a));for(const a of e)n.has(a)||i.push(a);return i}function Ri(e,t){const r=new Map(e.map(n=>[n.id,n]));return Jb(e.map(n=>n.id),t).map(n=>r.get(n))}function rd(e,t){if(!e)return Di();const r=new Set(e);return{order:[...e],hidden:t.filter(n=>!r.has(n))}}function SO(e,t,r){return{kpis:rd(e.kpis,t),charts:rd(e.charts,r)}}function Qb(e){return e.active!==Er&&Yb(e.active)?e.active:e.custom?Er:qa}function nd(e,t,r){const n=Qb(e);return n!==Er?SO(Yb(n),t,r):e.custom??Zb()}function AO(e,t){return{...e,active:Er,custom:t}}function PO(e,t,r,n){const i=Jb(e,t),a=i.indexOf(r),o=a+n;return a<0||o<0||o>=i.length?t:([i[a],i[o]]=[i[o],i[a]],i)}function jO(e,t,r){const n=e.filter(i=>i!==t);return r||n.push(t),n}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(fO,{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 EO({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 id({overview:e,bd:t}){var a,o;const r=((a=t==null?void 0:t.error_types)==null?void 0:a.failures)??0,n=((o=t==null?void 0:t.error_types)==null?void 0:o.rejections)??0,i=e.tool_calls??0;return{failures:r,rejections:n,toolCalls:i,errRate:i?r/i*100:0,rejRate:i?n/i*100:0}}const zf=[{id:"sessions",label:"Sessions",render:({overview:e})=>j.jsx(Ge,{label:"Sessions",value:e.sessions_main,sub:`+${e.sessions_subagent.toLocaleString()} subagent runs`})},{id:"projects",label:"Projects",render:({overview:e})=>j.jsx(Ge,{label:"Projects",value:e.projects,sub:"distinct project paths"})},{id:"turns",label:"Turns",render:({overview:e})=>j.jsx(Ge,{label:"Turns",value:e.turns,sub:`${e.tool_calls.toLocaleString()} tool calls`})},{id:"tool-error-rate",label:"Tool error rate",render:e=>{const{failures:t,toolCalls:r,errRate:n}=id(e);return j.jsx(Ge,{label:"Tool error rate",value:r?n.toFixed(1)+"%":"—",title:"Genuine tool failures as a share of all tool calls (rejections/blocks excluded — see the rejection rate).",sub:`${t.toLocaleString()} failed of ${r.toLocaleString()} calls`})}},{id:"rejection-rate",label:"Rejection rate",render:e=>{const{rejections:t,toolCalls:r,rejRate:n}=id(e);return j.jsx(Ge,{label:"Rejection rate",value:r?n.toFixed(1)+"%":"—",title:"User-rejected + guardrail-blocked tool calls as a share of all tool calls. Not agent failures.",sub:`${t.toLocaleString()} rejected/blocked`})}},{id:"workflow-runs",label:"Workflow runs",render:({overview:e})=>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"})},{id:"cost",label:"Est. cost",render:({overview:e})=>j.jsx(Ge,{label:"Est. cost (API-equiv.)",value:jn(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(Gb).join(", ")}`:"API list price estimate"})},{id:"cost-per-session",label:"Cost / session",render:({overview:e})=>j.jsx(Ge,{label:"Cost / session",value:e.sessions_main?jn(e.cost/e.sessions_main):"—",title:"Estimated API-equivalent cost divided by main sessions in range.",sub:"API-equiv. per main session"})},{id:"cache-read-ratio",label:"Cache-read ratio",render:({overview:e})=>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”"})},{id:"turn-duration",label:"Turn duration",render:({overview:e})=>j.jsx(Ge,{label:"Turn duration p50 / p95",value:`${wi(e.turn_duration_ms.p50)} / ${wi(e.turn_duration_ms.p95)}`,sub:`${e.turn_duration_ms.count} turns`})},{id:"session-duration",label:"Session duration",render:({overview:e})=>j.jsx(Ge,{label:"Session duration p50 / p95",value:`${wi(e.session_duration_ms.p50)} / ${wi(e.session_duration_ms.p95)}`,title:"End-to-end wall-clock length of main sessions (subagents excluded).",sub:`${e.session_duration_ms.count} sessions`})},{id:"total-tokens",label:"Total tokens",render:({overview:e})=>j.jsx(Ge,{label:"Total tokens",value:Lt(e.total_tokens),sub:`${Lt(e.tokens.input+e.tokens.output)} non-cache`})},{id:"token-breakdown",label:"Token breakdown",render:({overview:e})=>j.jsx(EO,{t:e.tokens})},{id:"security",label:"Security findings",render:({security:e})=>e?j.jsx(TO,{s:e}):null}];function CO({ctx:e,layout:t}){const r=new Set(t.hidden);return j.jsx("div",{className:"kpis",children:Ri(zf,t.order).filter(n=>!r.has(n.id)).map(n=>j.jsx(R.Fragment,{children:n.render(e)},n.id))})}function e0(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=e0(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=e0(e))&&(n&&(n+=" "),n+=t);return n}var xo,ad;function Fe(){if(ad)return xo;ad=1;var e=Array.isArray;return xo=e,xo}var wo,od;function t0(){if(od)return wo;od=1;var e=typeof Oi=="object"&&Oi&&Oi.Object===Object&&Oi;return wo=e,wo}var Oo,ud;function mt(){if(ud)return Oo;ud=1;var e=t0(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Oo=r,Oo}var _o,sd;function ci(){if(sd)return _o;sd=1;var e=mt(),t=e.Symbol;return _o=t,_o}var So,cd;function MO(){if(cd)return So;cd=1;var e=ci(),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 So=a,So}var Ao,ld;function $O(){if(ld)return Ao;ld=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Ao=r,Ao}var Po,fd;function Ct(){if(fd)return Po;fd=1;var e=ci(),t=MO(),r=$O(),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 Po=o,Po}var jo,hd;function Mt(){if(hd)return jo;hd=1;function e(t){return t!=null&&typeof t=="object"}return jo=e,jo}var To,dd;function en(){if(dd)return To;dd=1;var e=Ct(),t=Mt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return To=n,To}var Eo,pd;function Wf(){if(pd)return Eo;pd=1;var e=Fe(),t=en(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Eo=i,Eo}var Co,vd;function Ft(){if(vd)return Co;vd=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Co=e,Co}var Mo,yd;function Uf(){if(yd)return Mo;yd=1;var e=Ct(),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 Mo=o,Mo}var $o,md;function kO(){if(md)return $o;md=1;var e=mt(),t=e["__core-js_shared__"];return $o=t,$o}var ko,gd;function IO(){if(gd)return ko;gd=1;var e=kO(),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 ko=r,ko}var Io,bd;function r0(){if(bd)return Io;bd=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 Io=r,Io}var No,xd;function NO(){if(xd)return No;xd=1;var e=Uf(),t=IO(),r=Ft(),n=r0(),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 No=l,No}var Ro,wd;function RO(){if(wd)return Ro;wd=1;function e(t,r){return t==null?void 0:t[r]}return Ro=e,Ro}var Do,Od;function fr(){if(Od)return Do;Od=1;var e=NO(),t=RO();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return Do=r,Do}var qo,_d;function La(){if(_d)return qo;_d=1;var e=fr(),t=e(Object,"create");return qo=t,qo}var Lo,Sd;function DO(){if(Sd)return Lo;Sd=1;var e=La();function t(){this.__data__=e?e(null):{},this.size=0}return Lo=t,Lo}var Bo,Ad;function qO(){if(Ad)return Bo;Ad=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Bo=e,Bo}var Fo,Pd;function LO(){if(Pd)return Fo;Pd=1;var e=La(),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 Fo=i,Fo}var zo,jd;function BO(){if(jd)return zo;jd=1;var e=La(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return zo=n,zo}var Wo,Td;function FO(){if(Td)return Wo;Td=1;var e=La(),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 Wo=r,Wo}var Uo,Ed;function zO(){if(Ed)return Uo;Ed=1;var e=DO(),t=qO(),r=LO(),n=BO(),i=FO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Uo=a,Uo}var Ko,Cd;function WO(){if(Cd)return Ko;Cd=1;function e(){this.__data__=[],this.size=0}return Ko=e,Ko}var Ho,Md;function Kf(){if(Md)return Ho;Md=1;function e(t,r){return t===r||t!==t&&r!==r}return Ho=e,Ho}var Go,$d;function Ba(){if($d)return Go;$d=1;var e=Kf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return Go=t,Go}var Vo,kd;function UO(){if(kd)return Vo;kd=1;var e=Ba(),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 Vo=n,Vo}var Xo,Id;function KO(){if(Id)return Xo;Id=1;var e=Ba();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Xo=t,Xo}var Yo,Nd;function HO(){if(Nd)return Yo;Nd=1;var e=Ba();function t(r){return e(this.__data__,r)>-1}return Yo=t,Yo}var Zo,Rd;function GO(){if(Rd)return Zo;Rd=1;var e=Ba();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Zo=t,Zo}var Jo,Dd;function Fa(){if(Dd)return Jo;Dd=1;var e=WO(),t=UO(),r=KO(),n=HO(),i=GO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Jo=a,Jo}var Qo,qd;function Hf(){if(qd)return Qo;qd=1;var e=fr(),t=mt(),r=e(t,"Map");return Qo=r,Qo}var eu,Ld;function VO(){if(Ld)return eu;Ld=1;var e=zO(),t=Fa(),r=Hf();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return eu=n,eu}var tu,Bd;function XO(){if(Bd)return tu;Bd=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return tu=e,tu}var ru,Fd;function za(){if(Fd)return ru;Fd=1;var e=XO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return ru=t,ru}var nu,zd;function YO(){if(zd)return nu;zd=1;var e=za();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return nu=t,nu}var iu,Wd;function ZO(){if(Wd)return iu;Wd=1;var e=za();function t(r){return e(this,r).get(r)}return iu=t,iu}var au,Ud;function JO(){if(Ud)return au;Ud=1;var e=za();function t(r){return e(this,r).has(r)}return au=t,au}var ou,Kd;function QO(){if(Kd)return ou;Kd=1;var e=za();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 ou=t,ou}var uu,Hd;function Gf(){if(Hd)return uu;Hd=1;var e=VO(),t=YO(),r=ZO(),n=JO(),i=QO();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,uu=a,uu}var su,Gd;function n0(){if(Gd)return su;Gd=1;var e=Gf(),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,su=r,su}var cu,Vd;function e_(){if(Vd)return cu;Vd=1;var e=n0(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return cu=r,cu}var lu,Xd;function t_(){if(Xd)return lu;Xd=1;var e=e_(),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 lu=n,lu}var fu,Yd;function Vf(){if(Yd)return fu;Yd=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 fu=e,fu}var hu,Zd;function r_(){if(Zd)return hu;Zd=1;var e=ci(),t=Vf(),r=Fe(),n=en(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return hu=o,hu}var du,Jd;function i0(){if(Jd)return du;Jd=1;var e=r_();function t(r){return r==null?"":e(r)}return du=t,du}var pu,Qd;function a0(){if(Qd)return pu;Qd=1;var e=Fe(),t=Wf(),r=t_(),n=i0();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return pu=i,pu}var vu,ep;function Wa(){if(ep)return vu;ep=1;var e=en();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return vu=t,vu}var yu,tp;function Xf(){if(tp)return yu;tp=1;var e=a0(),t=Wa();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 yu=r,yu}var mu,rp;function o0(){if(rp)return mu;rp=1;var e=Xf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return mu=t,mu}var n_=o0();const Je=ce(n_);var gu,np;function i_(){if(np)return gu;np=1;function e(t){return t==null}return gu=e,gu}var a_=i_();const Q=ce(a_);var bu,ip;function o_(){if(ip)return bu;ip=1;var e=Ct(),t=Fe(),r=Mt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return bu=i,bu}var u_=o_();const or=ce(u_);var s_=Uf();const X=ce(s_);var c_=Ft();const tn=ce(c_);var xu={exports:{}},ne={};/**
|
|
1
|
+
import{r as R,j,u as lO,a as Hb,f as Lt,s as Gb,b as jn,c as wi,L as fO,d as Oi,g as ce,R as P,e as hO,l as Yh,h as Zh,i as dO,k as pO,m as Jh,n as vO,E as yO,o as mO,p as mo}from"./index-r-fSz0IT.js";const go=8,gO=26;function bO(){const[e,t]=R.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,go),expandHeight:(o,u,s=gO)=>e.has(o)?Math.max(240,u*s):void 0,expandBtn:(o,u)=>{if(!(u<=go))return j.jsx("button",{type:"button",className:"link-btn",onClick:()=>r(o),children:e.has(o)?`show top ${go}`:`show all (${u})`})}}}function Be(){const{theme:e}=lO();return R.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 Vb(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 xO({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 Ff({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 wO(){const e=Hb(),t=(n,i)=>{i!=null&&i!==""&&e(`/?${n}=${encodeURIComponent(i)}`)};return{drillFilter:t,drillTo:(n,i)=>a=>t(n,Vb(a,i))}}const Er="custom",qa="all",Xb=[{id:qa,label:"All"},{id:"cost",label:"Cost",kpis:["cost","cost-per-session","total-tokens","token-breakdown","cache-read-ratio","sessions"],charts:["cost-over-time","tokens-over-time","tokens-by-model"]},{id:"reliability",label:"Reliability",kpis:["tool-error-rate","rejection-rate","workflow-runs","turns","turn-duration","session-duration","security"],charts:["tool-errors","error-types","activity"]},{id:"activity",label:"Activity",kpis:["sessions","projects","turns","session-duration"],charts:["activity","category","complexity","tool-frequency","skill-activation","subagent-fanout"]}];function Yb(e){return Xb.find(t=>t.id===e)}const bo="dashboard.layout",Qh="dashboard.charts";function Di(){return{hidden:[],order:[]}}function Zb(){return{kpis:Di(),charts:Di()}}function OO(){return{v:1,active:qa,custom:null,kpisCollapsed:!1}}function xl(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function ed(e){if(typeof e!="object"||e===null)return Di();const t=e;return{hidden:xl(t.hidden),order:xl(t.order)}}function _O(e){if(typeof e!="object"||e===null)return null;const t=e;return{kpis:ed(t.kpis),charts:ed(t.charts)}}function td(e,t){if(typeof e!="object"||e===null){const n=xl(t);if(n.length===0)return OO();const i=Zb();return i.charts.hidden=n,{v:1,active:Er,custom:i,kpisCollapsed:!1}}const r=e;return{v:1,active:typeof r.active=="string"?r.active:qa,custom:_O(r.custom),kpisCollapsed:r.kpisCollapsed===!0}}function Jb(e,t){const r=new Set(e),n=new Set,i=[];for(const a of t)r.has(a)&&!n.has(a)&&(i.push(a),n.add(a));for(const a of e)n.has(a)||i.push(a);return i}function Ri(e,t){const r=new Map(e.map(n=>[n.id,n]));return Jb(e.map(n=>n.id),t).map(n=>r.get(n))}function rd(e,t){if(!e)return Di();const r=new Set(e);return{order:[...e],hidden:t.filter(n=>!r.has(n))}}function SO(e,t,r){return{kpis:rd(e.kpis,t),charts:rd(e.charts,r)}}function Qb(e){return e.active!==Er&&Yb(e.active)?e.active:e.custom?Er:qa}function nd(e,t,r){const n=Qb(e);return n!==Er?SO(Yb(n),t,r):e.custom??Zb()}function AO(e,t){return{...e,active:Er,custom:t}}function PO(e,t,r,n){const i=Jb(e,t),a=i.indexOf(r),o=a+n;return a<0||o<0||o>=i.length?t:([i[a],i[o]]=[i[o],i[a]],i)}function jO(e,t,r){const n=e.filter(i=>i!==t);return r||n.push(t),n}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(fO,{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 EO({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 id({overview:e,bd:t}){var a,o;const r=((a=t==null?void 0:t.error_types)==null?void 0:a.failures)??0,n=((o=t==null?void 0:t.error_types)==null?void 0:o.rejections)??0,i=e.tool_calls??0;return{failures:r,rejections:n,toolCalls:i,errRate:i?r/i*100:0,rejRate:i?n/i*100:0}}const zf=[{id:"sessions",label:"Sessions",render:({overview:e})=>j.jsx(Ge,{label:"Sessions",value:e.sessions_main,sub:`+${e.sessions_subagent.toLocaleString()} subagent runs`})},{id:"projects",label:"Projects",render:({overview:e})=>j.jsx(Ge,{label:"Projects",value:e.projects,sub:"distinct project paths"})},{id:"turns",label:"Turns",render:({overview:e})=>j.jsx(Ge,{label:"Turns",value:e.turns,sub:`${e.tool_calls.toLocaleString()} tool calls`})},{id:"tool-error-rate",label:"Tool error rate",render:e=>{const{failures:t,toolCalls:r,errRate:n}=id(e);return j.jsx(Ge,{label:"Tool error rate",value:r?n.toFixed(1)+"%":"—",title:"Genuine tool failures as a share of all tool calls (rejections/blocks excluded — see the rejection rate).",sub:`${t.toLocaleString()} failed of ${r.toLocaleString()} calls`})}},{id:"rejection-rate",label:"Rejection rate",render:e=>{const{rejections:t,toolCalls:r,rejRate:n}=id(e);return j.jsx(Ge,{label:"Rejection rate",value:r?n.toFixed(1)+"%":"—",title:"User-rejected + guardrail-blocked tool calls as a share of all tool calls. Not agent failures.",sub:`${t.toLocaleString()} rejected/blocked`})}},{id:"workflow-runs",label:"Workflow runs",render:({overview:e})=>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"})},{id:"cost",label:"Est. cost",render:({overview:e})=>j.jsx(Ge,{label:"Est. cost (API-equiv.)",value:jn(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(Gb).join(", ")}`:"API list price estimate"})},{id:"cost-per-session",label:"Cost / session",render:({overview:e})=>j.jsx(Ge,{label:"Cost / session",value:e.sessions_main?jn(e.cost/e.sessions_main):"—",title:"Estimated API-equivalent cost divided by main sessions in range.",sub:"API-equiv. per main session"})},{id:"cache-read-ratio",label:"Cache-read ratio",render:({overview:e})=>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”"})},{id:"turn-duration",label:"Turn duration",render:({overview:e})=>j.jsx(Ge,{label:"Turn duration p50 / p95",value:`${wi(e.turn_duration_ms.p50)} / ${wi(e.turn_duration_ms.p95)}`,sub:`${e.turn_duration_ms.count} turns`})},{id:"session-duration",label:"Session duration",render:({overview:e})=>j.jsx(Ge,{label:"Session duration p50 / p95",value:`${wi(e.session_duration_ms.p50)} / ${wi(e.session_duration_ms.p95)}`,title:"End-to-end wall-clock length of main sessions (subagents excluded).",sub:`${e.session_duration_ms.count} sessions`})},{id:"total-tokens",label:"Total tokens",render:({overview:e})=>j.jsx(Ge,{label:"Total tokens",value:Lt(e.total_tokens),sub:`${Lt(e.tokens.input+e.tokens.output)} non-cache`})},{id:"token-breakdown",label:"Token breakdown",render:({overview:e})=>j.jsx(EO,{t:e.tokens})},{id:"security",label:"Security findings",render:({security:e})=>e?j.jsx(TO,{s:e}):null}];function CO({ctx:e,layout:t}){const r=new Set(t.hidden);return j.jsx("div",{className:"kpis",children:Ri(zf,t.order).filter(n=>!r.has(n.id)).map(n=>j.jsx(R.Fragment,{children:n.render(e)},n.id))})}function e0(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=e0(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=e0(e))&&(n&&(n+=" "),n+=t);return n}var xo,ad;function Fe(){if(ad)return xo;ad=1;var e=Array.isArray;return xo=e,xo}var wo,od;function t0(){if(od)return wo;od=1;var e=typeof Oi=="object"&&Oi&&Oi.Object===Object&&Oi;return wo=e,wo}var Oo,ud;function mt(){if(ud)return Oo;ud=1;var e=t0(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Oo=r,Oo}var _o,sd;function ci(){if(sd)return _o;sd=1;var e=mt(),t=e.Symbol;return _o=t,_o}var So,cd;function MO(){if(cd)return So;cd=1;var e=ci(),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 So=a,So}var Ao,ld;function $O(){if(ld)return Ao;ld=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Ao=r,Ao}var Po,fd;function Ct(){if(fd)return Po;fd=1;var e=ci(),t=MO(),r=$O(),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 Po=o,Po}var jo,hd;function Mt(){if(hd)return jo;hd=1;function e(t){return t!=null&&typeof t=="object"}return jo=e,jo}var To,dd;function en(){if(dd)return To;dd=1;var e=Ct(),t=Mt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return To=n,To}var Eo,pd;function Wf(){if(pd)return Eo;pd=1;var e=Fe(),t=en(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Eo=i,Eo}var Co,vd;function Ft(){if(vd)return Co;vd=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Co=e,Co}var Mo,yd;function Uf(){if(yd)return Mo;yd=1;var e=Ct(),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 Mo=o,Mo}var $o,md;function kO(){if(md)return $o;md=1;var e=mt(),t=e["__core-js_shared__"];return $o=t,$o}var ko,gd;function IO(){if(gd)return ko;gd=1;var e=kO(),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 ko=r,ko}var Io,bd;function r0(){if(bd)return Io;bd=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 Io=r,Io}var No,xd;function NO(){if(xd)return No;xd=1;var e=Uf(),t=IO(),r=Ft(),n=r0(),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 No=l,No}var Ro,wd;function RO(){if(wd)return Ro;wd=1;function e(t,r){return t==null?void 0:t[r]}return Ro=e,Ro}var Do,Od;function fr(){if(Od)return Do;Od=1;var e=NO(),t=RO();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return Do=r,Do}var qo,_d;function La(){if(_d)return qo;_d=1;var e=fr(),t=e(Object,"create");return qo=t,qo}var Lo,Sd;function DO(){if(Sd)return Lo;Sd=1;var e=La();function t(){this.__data__=e?e(null):{},this.size=0}return Lo=t,Lo}var Bo,Ad;function qO(){if(Ad)return Bo;Ad=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Bo=e,Bo}var Fo,Pd;function LO(){if(Pd)return Fo;Pd=1;var e=La(),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 Fo=i,Fo}var zo,jd;function BO(){if(jd)return zo;jd=1;var e=La(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return zo=n,zo}var Wo,Td;function FO(){if(Td)return Wo;Td=1;var e=La(),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 Wo=r,Wo}var Uo,Ed;function zO(){if(Ed)return Uo;Ed=1;var e=DO(),t=qO(),r=LO(),n=BO(),i=FO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Uo=a,Uo}var Ko,Cd;function WO(){if(Cd)return Ko;Cd=1;function e(){this.__data__=[],this.size=0}return Ko=e,Ko}var Ho,Md;function Kf(){if(Md)return Ho;Md=1;function e(t,r){return t===r||t!==t&&r!==r}return Ho=e,Ho}var Go,$d;function Ba(){if($d)return Go;$d=1;var e=Kf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return Go=t,Go}var Vo,kd;function UO(){if(kd)return Vo;kd=1;var e=Ba(),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 Vo=n,Vo}var Xo,Id;function KO(){if(Id)return Xo;Id=1;var e=Ba();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Xo=t,Xo}var Yo,Nd;function HO(){if(Nd)return Yo;Nd=1;var e=Ba();function t(r){return e(this.__data__,r)>-1}return Yo=t,Yo}var Zo,Rd;function GO(){if(Rd)return Zo;Rd=1;var e=Ba();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Zo=t,Zo}var Jo,Dd;function Fa(){if(Dd)return Jo;Dd=1;var e=WO(),t=UO(),r=KO(),n=HO(),i=GO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Jo=a,Jo}var Qo,qd;function Hf(){if(qd)return Qo;qd=1;var e=fr(),t=mt(),r=e(t,"Map");return Qo=r,Qo}var eu,Ld;function VO(){if(Ld)return eu;Ld=1;var e=zO(),t=Fa(),r=Hf();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return eu=n,eu}var tu,Bd;function XO(){if(Bd)return tu;Bd=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return tu=e,tu}var ru,Fd;function za(){if(Fd)return ru;Fd=1;var e=XO();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return ru=t,ru}var nu,zd;function YO(){if(zd)return nu;zd=1;var e=za();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return nu=t,nu}var iu,Wd;function ZO(){if(Wd)return iu;Wd=1;var e=za();function t(r){return e(this,r).get(r)}return iu=t,iu}var au,Ud;function JO(){if(Ud)return au;Ud=1;var e=za();function t(r){return e(this,r).has(r)}return au=t,au}var ou,Kd;function QO(){if(Kd)return ou;Kd=1;var e=za();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 ou=t,ou}var uu,Hd;function Gf(){if(Hd)return uu;Hd=1;var e=VO(),t=YO(),r=ZO(),n=JO(),i=QO();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,uu=a,uu}var su,Gd;function n0(){if(Gd)return su;Gd=1;var e=Gf(),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,su=r,su}var cu,Vd;function e_(){if(Vd)return cu;Vd=1;var e=n0(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return cu=r,cu}var lu,Xd;function t_(){if(Xd)return lu;Xd=1;var e=e_(),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 lu=n,lu}var fu,Yd;function Vf(){if(Yd)return fu;Yd=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 fu=e,fu}var hu,Zd;function r_(){if(Zd)return hu;Zd=1;var e=ci(),t=Vf(),r=Fe(),n=en(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return hu=o,hu}var du,Jd;function i0(){if(Jd)return du;Jd=1;var e=r_();function t(r){return r==null?"":e(r)}return du=t,du}var pu,Qd;function a0(){if(Qd)return pu;Qd=1;var e=Fe(),t=Wf(),r=t_(),n=i0();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return pu=i,pu}var vu,ep;function Wa(){if(ep)return vu;ep=1;var e=en();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return vu=t,vu}var yu,tp;function Xf(){if(tp)return yu;tp=1;var e=a0(),t=Wa();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 yu=r,yu}var mu,rp;function o0(){if(rp)return mu;rp=1;var e=Xf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return mu=t,mu}var n_=o0();const Je=ce(n_);var gu,np;function i_(){if(np)return gu;np=1;function e(t){return t==null}return gu=e,gu}var a_=i_();const Q=ce(a_);var bu,ip;function o_(){if(ip)return bu;ip=1;var e=Ct(),t=Fe(),r=Mt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return bu=i,bu}var u_=o_();const or=ce(u_);var s_=Uf();const X=ce(s_);var c_=Ft();const tn=ce(c_);var xu={exports:{}},ne={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as d,x as h,j as e,A as o,L as r,w as t}from"./index-
|
|
1
|
+
import{D as d,x as h,j as e,A as o,L as r,w as t}from"./index-r-fSz0IT.js";import{relPath as m,LinesDelta as p}from"./FilesView-DQRiYUkL.js";function v(){const[i]=d(),l=i.get("path")??"",a=i.get("project")??"",n=new URLSearchParams({path:l});a&&n.set("project",a);const s=h(l?"/file?"+n.toString():null);return e.jsx(o,{state:s,empty:e.jsx("div",{className:"muted pad",children:"Not found."}),children:c=>e.jsx(j,{data:c})})}function j({data:i}){return e.jsxs("div",{className:"file-view",children:[e.jsx(r,{to:"/files",className:"back",children:"← all files"}),e.jsxs("header",{className:"skill-head",children:[e.jsxs("h1",{children:["📄 ",m(i.file_path,i.project_path)]}),e.jsxs("div",{className:"skill-head-meta muted",children:[e.jsx("span",{title:i.file_path,children:i.file_path}),i.project_path?e.jsxs(e.Fragment,{children:[" · in ",i.project_path.replace(/^.*\//,"")]}):null]})]}),e.jsxs("div",{className:"kpis",children:[e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"sessions"}),e.jsx("div",{className:"kpi-value",children:i.sessions_count.toLocaleString()})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"changes"}),e.jsx("div",{className:"kpi-value",children:i.changes_count.toLocaleString()})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"lines + / −"}),e.jsxs("div",{className:"kpi-value",children:["+",i.lines_added.toLocaleString()," −",i.lines_removed.toLocaleString()]})]}),e.jsxs("div",{className:"kpi",children:[e.jsx("div",{className:"kpi-label",children:"first · last touched"}),e.jsxs("div",{className:"kpi-value kpi-sub",children:[t(i.first_ts)," · ",t(i.last_ts)]})]})]}),i.sessions.map(l=>{var n;const a=(n=l.changes.find(s=>s.event_uuid))==null?void 0:n.event_uuid;return e.jsxs("div",{className:"card",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:e.jsx(r,{to:`/session/${l.session_id}${a?`#ev-${a}`:""}`,className:"title",title:a?"Open the session at this file's first change":void 0,children:l.title||e.jsx("span",{className:"muted",children:l.session_id.slice(0,12)})})}),e.jsxs("span",{className:"card-hint",children:[l.category&&e.jsx("span",{className:`tag cat-${l.category}`,children:l.category}),l.source_id&&e.jsx("span",{className:"tag",children:l.source_id})," ",t(l.started_at)]})]}),e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Turn"}),e.jsx("th",{children:"Tool"}),e.jsx("th",{className:"num",children:"+ / −"}),e.jsx("th",{children:"Prompt"}),e.jsx("th",{children:"When"})]})}),e.jsx("tbody",{children:l.changes.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:s.event_uuid?e.jsxs(r,{to:`/session/${l.session_id}#ev-${s.event_uuid}`,className:"title",title:"Jump to this change in the transcript",children:["turn ",s.turn_seq!=null?s.turn_seq+1:"?"]}):e.jsxs("span",{className:"muted",children:["turn ",s.turn_seq!=null?s.turn_seq+1:"?"]})}),e.jsx("td",{children:e.jsx("span",{className:"tag",children:s.tool_name})}),e.jsx("td",{className:"num",children:e.jsx(p,{added:s.lines_added,removed:s.lines_removed})}),e.jsx("td",{className:"muted",title:s.prompt_preview??void 0,children:s.prompt_preview?s.prompt_preview.length>80?s.prompt_preview.slice(0,79)+"…":s.prompt_preview:"—"}),e.jsx("td",{children:t(s.timestamp)})]},s.id))})]})]},l.session_id)}),e.jsx("p",{className:"muted pad",children:"Tracked from Edit/Write tool calls — changes made via shell commands or outside sessions aren’t captured."})]})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as q,m as x,r as E,x as C,j as e,F as P,E as k,o as D,S as n,L as K,w as $,P as I}from"./index-
|
|
1
|
+
import{k as q,m as x,r as E,x as C,j as e,F as P,E as k,o as D,S as n,L as K,w as $,P as I}from"./index-r-fSz0IT.js";const i=50,M={total:0,files:[]};function A(t,a){return a&&t.startsWith(a.replace(/\/$/,"")+"/")?t.slice(a.replace(/\/$/,"").length+1):t}function R({added:t,removed:a}){return t==null&&a==null?e.jsx("span",{className:"muted",children:"—"}):e.jsxs("span",{className:"sub",children:[t!=null&&e.jsxs("span",{className:"tag",children:["+",t.toLocaleString()]}),a!=null&&e.jsxs("span",{className:"tag",children:["−",a.toLocaleString()]})]})}function G(){const{get:t,set:a,pick:g}=q(["offset"]),f=x("/sources",[]),b=x("/projects",[]),[h,u]=E.useState(t("q")),p=Number(t("offset","0")),o=g(["source","project","q","sort","dir"]);o.set("limit",String(i)),o.set("offset",String(p));const{data:N,loading:j,error:S}=C("/files?"+o.toString()),{total:d,files:m}=N??M;function v(s){s.preventDefault(),a({q:h.trim()})}const l=t("sort","last_ts"),r=t("dir")==="asc"?"asc":"desc";function c(s,F){a({sort:s,dir:l===s?r==="asc"?"desc":"asc":F})}const _=Math.floor(p/i)+1,y=Math.max(1,Math.ceil(d/i)),L=!!(t("q")||t("source")||t("project"));return e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:"Files"}),e.jsxs("div",{className:"filters",children:[e.jsxs("form",{onSubmit:v,className:"search",role:"search",children:[e.jsx("input",{type:"search","aria-label":"Search files by path",placeholder:"Search file paths…",value:h,onChange:s=>u(s.target.value)}),e.jsx("button",{type:"submit",children:"Search"}),t("q")&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>(u(""),a({q:""})),children:"clear"})]}),e.jsxs("select",{"aria-label":"Filter by source",value:t("source"),onChange:s=>a({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),f.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(P,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:t("project"),onChange:s=>a({project:s}),options:[{value:"",label:"all projects"},...b.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]})]}),e.jsx(k,{error:S}),j?e.jsx(D,{}):m.length===0?e.jsx("div",{className:"muted pad",role:"status",children:L?"No files match the filter.":"No file changes ingested yet — run agent-lens refresh (or ingest) first."}):e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(n,{label:"File",sortKey:"path",active:l,dir:r,onSort:c,defaultDir:"asc"}),e.jsx("th",{children:"Project"}),e.jsx(n,{label:"Sessions",sortKey:"sessions",active:l,dir:r,onSort:c,className:"num"}),e.jsx(n,{label:"Changes",sortKey:"changes",active:l,dir:r,onSort:c,className:"num"}),e.jsx("th",{className:"num",children:"+ / −"}),e.jsx(n,{label:"Last touched",sortKey:"last_ts",active:l,dir:r,onSort:c})]})}),e.jsx("tbody",{children:m.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(K,{to:`/file?path=${encodeURIComponent(s.file_path)}${s.project_id?`&project=${encodeURIComponent(s.project_id)}`:""}`,className:"title",title:s.file_path,children:A(s.file_path,s.project_path)})}),e.jsx("td",{children:s.project_path?e.jsx("span",{className:"tag",title:s.project_path,children:s.project_path.replace(/^.*\//,"")}):e.jsx("span",{className:"muted",children:"—"})}),e.jsx("td",{className:"num",children:s.sessions.toLocaleString()}),e.jsx("td",{className:"num",children:s.changes.toLocaleString()}),e.jsx("td",{className:"num",children:e.jsx(R,{added:s.lines_added,removed:s.lines_removed})}),e.jsx("td",{children:$(s.last_ts)})]},(s.project_id??"")+"\0"+s.file_path))})]}),!j&&d>0&&e.jsx(I,{page:_,pages:y,total:d,unit:"files",onPage:s=>a({offset:String((s-1)*i)})}),e.jsx("p",{className:"muted pad",children:"Tracked from Edit/Write tool calls — changes made via shell commands or outside sessions aren’t captured."})]})}export{R as LinesDelta,G as default,A as relPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as ie,m as E,r as k,B as ae,x as ne,j as e,G as h,F as le,H as x,E as re,o as ce,S as $,P as oe,w as de,L as ue}from"./index-CZWQ3Zzl.js";import{u as W,S as he,a as me}from"./useResetOn-BsVWvhC3.js";const P=50,pe={total:0,findings:[]},je=new Set;function ke(){const{get:t,set:a,clear:l}=ie(),n=E("/sources",[]),M=E("/projects",[]),[m,f]=k.useState(!1),[p,Q]=k.useState(0),{sort:r,toggle:S}=ae("severity","desc"),y=t("severity"),b=t("category"),v=t("rule"),_=t("session"),R=t("source"),F=t("project"),T=t("from"),A=t("to"),d=t("status","open"),w=k.useMemo(()=>{const s=new URLSearchParams;for(const[c,u]of Object.entries({severity:y,category:b,rule:v,session:_,source:R,project:F,from:T,to:A,status:d}))u&&s.set(c,u);return s},[y,b,v,_,R,F,T,A,d]),i=E("/security/summary",null,[p]),I=E(h?null:"/security/mutes",[],[p]),L=`${w.toString()}|${r.key}|${r.dir}`,[C,U]=W(L,1),[o,O]=W(`${L}|${C}|${p}`,je),N=new URLSearchParams(w);N.set("sort",r.key),N.set("dir",r.dir),N.set("limit",String(P)),N.set("offset",String((C-1)*P));const{data:V,loading:D,error:Y}=ne("/security/findings?"+N.toString(),{deps:[p]}),[q,B]=W(`${L}|${C}|${p}`,null),J=q??Y,{total:j,findings:K}=V??pe,g=k.useCallback(async s=>{f(!0),B(null);try{await s(),Q(c=>c+1)}catch(c){B(String(c))}finally{f(!1)}},[]),X=k.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),G=k.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!b||s.category===b),[i,b]),Z=Math.max(1,Math.ceil(j/P)),ee=[...w.keys()].some(s=>s!=="status")||d!=="open",z=K.map(s=>s.id),se=z.length>0&&z.every(s=>o.has(s)),te=s=>O(c=>{const u=new Set(c);return u.has(s)?u.delete(s):u.add(s),u});return e.jsxs("div",{children:[e.jsxs("div",{className:"detail-head",children:[e.jsx("h1",{children:"Security findings"}),e.jsxs("p",{className:"muted page-intro",children:["Risky operations the agent performed, flagged after the fact by deterministic rules over each tool call. Counts show ",e.jsx("strong",{children:"open"})," findings — mark benign ones safe or mute a noisy rule so a real one stands out. agent-lens is retrospective; it surfaces what ",e.jsx("em",{children:"happened"}),", it doesn't block."]})]}),h&&e.jsxs("div",{className:"demo-note",role:"note",children:["📦 This is a static demo over synthetic sessions. Browse the findings and reference below —"," ",e.jsx("strong",{children:"triage"})," (mark safe, mute rules) and live filtering run in the local app on your own data."]}),e.jsxs("div",{className:"kpi-row sev-kpis",role:"group","aria-label":"Open findings by severity",children:[e.jsxs("button",{type:"button",className:"kpi kpi-btn"+(y?"":" is-active"),onClick:()=>a({severity:""}),children:[e.jsx("div",{className:"kpi-label",children:"Open findings"}),e.jsx("div",{className:"kpi-value",children:(i==null?void 0:i.total)??"—"}),e.jsxs("div",{className:"kpi-sub",children:[(i==null?void 0:i.sessions_flagged)??0," sessions flagged"]})]}),he.map(s=>e.jsxs("button",{type:"button",className:"kpi kpi-btn sev-kpi sev-"+s+(y===s?" is-active":""),onClick:()=>a({severity:y===s?"":s}),"aria-pressed":y===s,children:[e.jsx("div",{className:"kpi-label",children:s}),e.jsx("div",{className:"kpi-value",children:X.get(s)??0})]},s))]}),i&&(i.dismissed>0||i.muted>0)&&e.jsxs("div",{className:"triage-counts muted small",children:[e.jsxs("button",{type:"button",className:"linkish",onClick:()=>a({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>a({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:d,onChange:s=>a({status:s.target.value}),children:[e.jsx("option",{value:"open",children:"open"}),e.jsx("option",{value:"dismissed",children:"dismissed"}),e.jsx("option",{value:"muted",children:"muted"}),e.jsx("option",{value:"all",children:"all"})]}),e.jsxs("select",{"aria-label":"Filter by category",value:b,onChange:s=>{const c=s.target.value,u=!v||G.some(H=>H.rule_id===v&&(!c||H.category===c));a({category:c,rule:u?v:""})},children:[e.jsx("option",{value:"",children:"all categories"}),((i==null?void 0:i.categories)??[]).map(s=>e.jsx("option",{value:s.key,children:s.title},s.key))]}),e.jsxs("select",{"aria-label":"Filter by rule",value:v,onChange:s=>a({rule:s.target.value}),children:[e.jsx("option",{value:"",children:"all rules"}),G.map(s=>e.jsxs("option",{value:s.rule_id,children:[s.rule_id," (",s.n,")"]},s.rule_id))]}),e.jsxs("select",{"aria-label":"Filter by source",value:R,onChange:s=>a({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),n.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(le,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:F,onChange:s=>a({project:s}),options:[{value:"",label:"all projects"},...M.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]}),e.jsxs("label",{className:"ctl",children:["from ",e.jsx("input",{type:"date",value:T,onChange:s=>a({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:A,onChange:s=>a({to:s.target.value})})]}),_&&e.jsxs("span",{className:"tag filter-chip",children:["session ",_.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>a({session:""}),children:"✕"})]}),ee&&e.jsx("button",{type:"button",className:"ghost",onClick:l,children:"clear filters"})]}),!h&&(o.size>0||d==="open"&&j>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[o.size>0&&d!=="dismissed"&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>g(()=>x("/security/dismiss",{ids:[...o]})),children:["✓ Mark ",o.size," safe"]}),o.size>0&&d==="dismissed"&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>g(()=>x("/security/reopen",{ids:[...o]})),children:["↩ Reopen ",o.size]}),o.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>O(new Set),children:"clear selection"}),d==="open"&&j>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:m,onClick:()=>{confirm(`Dismiss all ${j} open findings matching the current filter as safe?`)&&g(()=>x("/security/dismiss-matching",{filter:Object.fromEntries(w)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",j," matching"]})]}),e.jsx(re,{error:J}),D?e.jsx(ce,{}):K.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&d==="open"?"No open security findings — nothing risky is awaiting review.":"No findings match these filters."}):e.jsxs("table",{className:"sessions findings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[!h&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:se,onChange:s=>O(s.target.checked?new Set(z):new Set)})}),e.jsx($,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:S}),e.jsx("th",{children:"Finding"}),e.jsx($,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:S}),e.jsx("th",{children:"Evidence"}),e.jsx($,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:S}),e.jsx($,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:S}),!h&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:K.map(s=>e.jsx(ge,{f:s,selected:o.has(s.id),onToggle:()=>te(s.id),busy:m,onDismiss:()=>g(()=>x("/security/dismiss",{ids:[s.id]})),onReopen:()=>g(()=>x("/security/reopen",{ids:[s.id]})),onMute:()=>g(()=>x("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!D&&j>P&&e.jsx(oe,{page:C,pages:Z,total:j,unit:"findings",onPage:U}),!h&&I.length>0&&e.jsx(xe,{mutes:I,busy:m,onUnmute:s=>g(()=>x("/security/unmute",{rule_id:s.rule_id,scope:s.scope,scope_id:s.scope_id}))}),i&&i.categories.length>0&&e.jsx(ye,{summary:i})]})}function ge({f:t,selected:a,onToggle:l,busy:n,onDismiss:M,onReopen:m,onMute:f}){const p=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!h&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:a,onChange:l})}),e.jsxs("td",{children:[e.jsx(me,{severity:t.severity}),t.dismissed?e.jsx("span",{className:"tag dismissed",title:t.dismiss_note??"",children:"safe"}):null]}),e.jsxs("td",{children:[e.jsx("div",{className:"finding-title",children:t.title??t.rule_id}),e.jsxs("div",{className:"muted small",children:[e.jsx("code",{children:t.rule_id}),t.framework_ref&&e.jsx("span",{className:"tag framework",children:t.framework_ref})]})]}),e.jsx("td",{className:"small",children:t.category}),e.jsxs("td",{className:"finding-evidence-cell",children:[t.tool_name&&e.jsx("span",{className:"tag tool-tag",title:"Tool the finding fired on",children:t.tool_name}),e.jsx("code",{title:t.evidence??"",children:t.evidence})]}),e.jsx("td",{className:"small muted",title:t.started_at??"",children:de(t.started_at??null)}),e.jsxs("td",{className:"small",children:[e.jsx(ue,{to:p,className:"title",children:t.session_title||t.session_id.slice(0,12)}),t.is_sidechain?e.jsx("span",{className:"tag subagent",children:"subagent"}):null,t.project_path&&e.jsx("div",{className:"muted path",children:t.project_path.replace(/^.*\//,"")})]}),!h&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:m,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:M,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:f,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function xe({mutes:t,busy:a,onUnmute:l}){return e.jsxs("details",{className:"card muted-rules",children:[e.jsx("summary",{children:e.jsxs("span",{className:"sec-ref-title",children:["Muted rules (",t.length,")"]})}),e.jsx("ul",{className:"muted-rules-list",children:t.map(n=>e.jsxs("li",{children:[e.jsx("code",{children:n.rule_id}),e.jsxs("span",{className:"tag mute-scope",children:[n.scope,n.scope_id?`: ${n.scope_id}`:""]}),n.note&&e.jsx("span",{className:"muted small mute-note",children:n.note}),e.jsx("button",{type:"button",className:"linkish unmute",disabled:a,onClick:()=>l(n),children:"unmute"})]},`${n.rule_id}:${n.scope}:${n.scope_id}`))})]})}function ye({summary:t}){const a=new Map(t.by_category.map(l=>[l.category,l.n]));return e.jsxs("section",{className:"sec-reference",children:[e.jsx("h2",{children:"Risk categories"}),e.jsx("p",{className:"muted small sec-reference-intro",children:"What each category means and why it matters, anchored to OWASP Top 10 for Agentic Apps and MITRE ATLAS."}),e.jsx("div",{className:"sec-ref-grid",children:t.categories.map(l=>e.jsxs("details",{className:"card sec-ref",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"sec-ref-title",children:l.title}),e.jsxs("a",{className:"tag framework",href:l.framework_url,target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),children:[l.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[a.get(l.key)??0," open"]})]}),e.jsxs("dl",{className:"sec-ref-body",children:[e.jsx("dt",{children:"What"}),e.jsx("dd",{children:l.what}),e.jsx("dt",{children:"Why it matters"}),e.jsx("dd",{children:l.why}),e.jsx("dt",{children:"What to do"}),e.jsx("dd",{children:l.remediation})]})]},l.key))})]})}export{ke as default};
|
|
1
|
+
import{k as ie,m as E,r as k,B as ae,x as ne,j as e,G as h,F as le,H as x,E as re,o as ce,S as $,P as oe,w as de,L as ue}from"./index-r-fSz0IT.js";import{u as W,S as he,a as me}from"./useResetOn-2tqWddId.js";const P=50,pe={total:0,findings:[]},je=new Set;function ke(){const{get:t,set:a,clear:l}=ie(),n=E("/sources",[]),M=E("/projects",[]),[m,f]=k.useState(!1),[p,Q]=k.useState(0),{sort:r,toggle:S}=ae("severity","desc"),y=t("severity"),b=t("category"),v=t("rule"),_=t("session"),R=t("source"),F=t("project"),T=t("from"),A=t("to"),d=t("status","open"),w=k.useMemo(()=>{const s=new URLSearchParams;for(const[c,u]of Object.entries({severity:y,category:b,rule:v,session:_,source:R,project:F,from:T,to:A,status:d}))u&&s.set(c,u);return s},[y,b,v,_,R,F,T,A,d]),i=E("/security/summary",null,[p]),I=E(h?null:"/security/mutes",[],[p]),L=`${w.toString()}|${r.key}|${r.dir}`,[C,U]=W(L,1),[o,O]=W(`${L}|${C}|${p}`,je),N=new URLSearchParams(w);N.set("sort",r.key),N.set("dir",r.dir),N.set("limit",String(P)),N.set("offset",String((C-1)*P));const{data:V,loading:D,error:Y}=ne("/security/findings?"+N.toString(),{deps:[p]}),[q,B]=W(`${L}|${C}|${p}`,null),J=q??Y,{total:j,findings:K}=V??pe,g=k.useCallback(async s=>{f(!0),B(null);try{await s(),Q(c=>c+1)}catch(c){B(String(c))}finally{f(!1)}},[]),X=k.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),G=k.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!b||s.category===b),[i,b]),Z=Math.max(1,Math.ceil(j/P)),ee=[...w.keys()].some(s=>s!=="status")||d!=="open",z=K.map(s=>s.id),se=z.length>0&&z.every(s=>o.has(s)),te=s=>O(c=>{const u=new Set(c);return u.has(s)?u.delete(s):u.add(s),u});return e.jsxs("div",{children:[e.jsxs("div",{className:"detail-head",children:[e.jsx("h1",{children:"Security findings"}),e.jsxs("p",{className:"muted page-intro",children:["Risky operations the agent performed, flagged after the fact by deterministic rules over each tool call. Counts show ",e.jsx("strong",{children:"open"})," findings — mark benign ones safe or mute a noisy rule so a real one stands out. agent-lens is retrospective; it surfaces what ",e.jsx("em",{children:"happened"}),", it doesn't block."]})]}),h&&e.jsxs("div",{className:"demo-note",role:"note",children:["📦 This is a static demo over synthetic sessions. Browse the findings and reference below —"," ",e.jsx("strong",{children:"triage"})," (mark safe, mute rules) and live filtering run in the local app on your own data."]}),e.jsxs("div",{className:"kpi-row sev-kpis",role:"group","aria-label":"Open findings by severity",children:[e.jsxs("button",{type:"button",className:"kpi kpi-btn"+(y?"":" is-active"),onClick:()=>a({severity:""}),children:[e.jsx("div",{className:"kpi-label",children:"Open findings"}),e.jsx("div",{className:"kpi-value",children:(i==null?void 0:i.total)??"—"}),e.jsxs("div",{className:"kpi-sub",children:[(i==null?void 0:i.sessions_flagged)??0," sessions flagged"]})]}),he.map(s=>e.jsxs("button",{type:"button",className:"kpi kpi-btn sev-kpi sev-"+s+(y===s?" is-active":""),onClick:()=>a({severity:y===s?"":s}),"aria-pressed":y===s,children:[e.jsx("div",{className:"kpi-label",children:s}),e.jsx("div",{className:"kpi-value",children:X.get(s)??0})]},s))]}),i&&(i.dismissed>0||i.muted>0)&&e.jsxs("div",{className:"triage-counts muted small",children:[e.jsxs("button",{type:"button",className:"linkish",onClick:()=>a({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>a({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:d,onChange:s=>a({status:s.target.value}),children:[e.jsx("option",{value:"open",children:"open"}),e.jsx("option",{value:"dismissed",children:"dismissed"}),e.jsx("option",{value:"muted",children:"muted"}),e.jsx("option",{value:"all",children:"all"})]}),e.jsxs("select",{"aria-label":"Filter by category",value:b,onChange:s=>{const c=s.target.value,u=!v||G.some(H=>H.rule_id===v&&(!c||H.category===c));a({category:c,rule:u?v:""})},children:[e.jsx("option",{value:"",children:"all categories"}),((i==null?void 0:i.categories)??[]).map(s=>e.jsx("option",{value:s.key,children:s.title},s.key))]}),e.jsxs("select",{"aria-label":"Filter by rule",value:v,onChange:s=>a({rule:s.target.value}),children:[e.jsx("option",{value:"",children:"all rules"}),G.map(s=>e.jsxs("option",{value:s.rule_id,children:[s.rule_id," (",s.n,")"]},s.rule_id))]}),e.jsxs("select",{"aria-label":"Filter by source",value:R,onChange:s=>a({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),n.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(le,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:F,onChange:s=>a({project:s}),options:[{value:"",label:"all projects"},...M.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]}),e.jsxs("label",{className:"ctl",children:["from ",e.jsx("input",{type:"date",value:T,onChange:s=>a({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:A,onChange:s=>a({to:s.target.value})})]}),_&&e.jsxs("span",{className:"tag filter-chip",children:["session ",_.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>a({session:""}),children:"✕"})]}),ee&&e.jsx("button",{type:"button",className:"ghost",onClick:l,children:"clear filters"})]}),!h&&(o.size>0||d==="open"&&j>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[o.size>0&&d!=="dismissed"&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>g(()=>x("/security/dismiss",{ids:[...o]})),children:["✓ Mark ",o.size," safe"]}),o.size>0&&d==="dismissed"&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>g(()=>x("/security/reopen",{ids:[...o]})),children:["↩ Reopen ",o.size]}),o.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>O(new Set),children:"clear selection"}),d==="open"&&j>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:m,onClick:()=>{confirm(`Dismiss all ${j} open findings matching the current filter as safe?`)&&g(()=>x("/security/dismiss-matching",{filter:Object.fromEntries(w)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",j," matching"]})]}),e.jsx(re,{error:J}),D?e.jsx(ce,{}):K.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&d==="open"?"No open security findings — nothing risky is awaiting review.":"No findings match these filters."}):e.jsxs("table",{className:"sessions findings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[!h&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:se,onChange:s=>O(s.target.checked?new Set(z):new Set)})}),e.jsx($,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:S}),e.jsx("th",{children:"Finding"}),e.jsx($,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:S}),e.jsx("th",{children:"Evidence"}),e.jsx($,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:S}),e.jsx($,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:S}),!h&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:K.map(s=>e.jsx(ge,{f:s,selected:o.has(s.id),onToggle:()=>te(s.id),busy:m,onDismiss:()=>g(()=>x("/security/dismiss",{ids:[s.id]})),onReopen:()=>g(()=>x("/security/reopen",{ids:[s.id]})),onMute:()=>g(()=>x("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!D&&j>P&&e.jsx(oe,{page:C,pages:Z,total:j,unit:"findings",onPage:U}),!h&&I.length>0&&e.jsx(xe,{mutes:I,busy:m,onUnmute:s=>g(()=>x("/security/unmute",{rule_id:s.rule_id,scope:s.scope,scope_id:s.scope_id}))}),i&&i.categories.length>0&&e.jsx(ye,{summary:i})]})}function ge({f:t,selected:a,onToggle:l,busy:n,onDismiss:M,onReopen:m,onMute:f}){const p=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!h&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:a,onChange:l})}),e.jsxs("td",{children:[e.jsx(me,{severity:t.severity}),t.dismissed?e.jsx("span",{className:"tag dismissed",title:t.dismiss_note??"",children:"safe"}):null]}),e.jsxs("td",{children:[e.jsx("div",{className:"finding-title",children:t.title??t.rule_id}),e.jsxs("div",{className:"muted small",children:[e.jsx("code",{children:t.rule_id}),t.framework_ref&&e.jsx("span",{className:"tag framework",children:t.framework_ref})]})]}),e.jsx("td",{className:"small",children:t.category}),e.jsxs("td",{className:"finding-evidence-cell",children:[t.tool_name&&e.jsx("span",{className:"tag tool-tag",title:"Tool the finding fired on",children:t.tool_name}),e.jsx("code",{title:t.evidence??"",children:t.evidence})]}),e.jsx("td",{className:"small muted",title:t.started_at??"",children:de(t.started_at??null)}),e.jsxs("td",{className:"small",children:[e.jsx(ue,{to:p,className:"title",children:t.session_title||t.session_id.slice(0,12)}),t.is_sidechain?e.jsx("span",{className:"tag subagent",children:"subagent"}):null,t.project_path&&e.jsx("div",{className:"muted path",children:t.project_path.replace(/^.*\//,"")})]}),!h&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:m,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:M,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:n,onClick:f,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function xe({mutes:t,busy:a,onUnmute:l}){return e.jsxs("details",{className:"card muted-rules",children:[e.jsx("summary",{children:e.jsxs("span",{className:"sec-ref-title",children:["Muted rules (",t.length,")"]})}),e.jsx("ul",{className:"muted-rules-list",children:t.map(n=>e.jsxs("li",{children:[e.jsx("code",{children:n.rule_id}),e.jsxs("span",{className:"tag mute-scope",children:[n.scope,n.scope_id?`: ${n.scope_id}`:""]}),n.note&&e.jsx("span",{className:"muted small mute-note",children:n.note}),e.jsx("button",{type:"button",className:"linkish unmute",disabled:a,onClick:()=>l(n),children:"unmute"})]},`${n.rule_id}:${n.scope}:${n.scope_id}`))})]})}function ye({summary:t}){const a=new Map(t.by_category.map(l=>[l.category,l.n]));return e.jsxs("section",{className:"sec-reference",children:[e.jsx("h2",{children:"Risk categories"}),e.jsx("p",{className:"muted small sec-reference-intro",children:"What each category means and why it matters, anchored to OWASP Top 10 for Agentic Apps and MITRE ATLAS."}),e.jsx("div",{className:"sec-ref-grid",children:t.categories.map(l=>e.jsxs("details",{className:"card sec-ref",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"sec-ref-title",children:l.title}),e.jsxs("a",{className:"tag framework",href:l.framework_url,target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),children:[l.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[a.get(l.key)??0," open"]})]}),e.jsxs("dl",{className:"sec-ref-body",children:[e.jsx("dt",{children:"What"}),e.jsx("dd",{children:l.what}),e.jsx("dt",{children:"Why it matters"}),e.jsx("dd",{children:l.why}),e.jsx("dt",{children:"What to do"}),e.jsx("dd",{children:l.remediation})]})]},l.key))})]})}export{ke as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as Os,j as e,q as A,r as d,L as y,f as Ms,t as Fs,b as $s,v as Rs,c as T,w as ts,s as qs,x as As,h as G,i as as,l as Ls,y as Bs,z as Ps,k as Us,E as Ds,o as Hs}from"./index-CZWQ3Zzl.js";import{S as O,a as ls,u as Js}from"./useResetOn-BsVWvhC3.js";import{A as L,C as S,p as v}from"./jsonish-CXEf39_V.js";import{M as Ws,r as Ks}from"./index-2eZrG4wC.js";function Vs({id:s}){const n=Os();return e.jsxs("details",{className:"export-menu col-customizer",ref:n,children:[e.jsx("summary",{className:"export",title:"Export this session as Markdown",children:"⬇ Export Markdown"}),e.jsxs("div",{className:"col-menu",role:"group","aria-label":"Export options",children:[e.jsxs("a",{href:A(s),download:!0,children:["Redacted ",e.jsx("span",{className:"muted small",children:"(secrets masked)"})]}),e.jsxs("a",{href:A(s,"structure"),download:!0,children:["Structure only ",e.jsx("span",{className:"muted small",children:"(scrubbed)"})]}),e.jsxs("a",{className:"export-verbatim",href:A(s,"off"),download:!0,children:["Verbatim ",e.jsx("span",{className:"muted small",children:"(unredacted)"})]})]})]})}function Qs({c:s}){var i;const[n,t]=d.useState(!1),a=d.useId(),l=(i=s.signals)==null?void 0:i.loc;return e.jsxs("div",{className:"classification",children:[e.jsx("span",{className:"tag cat cat-"+(s.category??"none"),children:s.category??"unclassified"}),s.complexity_band&&e.jsxs("span",{className:"tag complexity",children:[s.complexity_band," · ",s.complexity_score]}),l&&e.jsxs("span",{className:"muted small",children:["+",l.added,"/−",l.removed," LoC · ",l.files," files"]}),e.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":a,onClick:()=>t(r=>!r),children:["why ",n?"▾":"▸"]}),n&&(s.signals?e.jsx(Ys,{id:a,s:s.signals,category:s.category}):e.jsx("div",{id:a,className:"muted small pad",children:"No signals recorded for this session."}))]})}const zs={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},X=s=>`${Math.max(0,Math.min(1,s))*100}%`;function Z({counts:s}){const n=Object.entries(s).sort((t,a)=>a[1]-t[1]);return n.length===0?e.jsx("span",{className:"muted",children:"—"}):e.jsx("span",{className:"sig-chips",children:n.map(([t,a])=>e.jsxs("span",{className:"sig-chip",children:[t," ",e.jsxs("span",{className:"muted",children:["×",a]})]},t))})}function Ys({id:s,s:n,category:t}){const[a,l]=d.useState(!1),i=d.useId(),r=n.complexity_weights??{},o=n.complexity_subscores??{},c=Object.keys(r).map(m=>({key:m,weight:r[m],subscore:o[m]??0,pts:r[m]*(o[m]??0)*100})).sort((m,w)=>w.pts-m.pts),u=Math.max(...c.map(m=>m.pts),1e-4),h=Object.entries(n.category_scores??{}).map(([m,w])=>({k:m,v:w})).sort((m,w)=>w.v-m.v),f=Math.max(...h.map(m=>m.v),1e-4),x=h.filter(m=>m.v>.02||m.k===t),g=n.skills&&Object.keys(n.skills).length>0;return e.jsxs("div",{id:s,className:"signals-panel",children:[c.length>0&&e.jsxs("section",{className:"sig-section",children:[e.jsxs("h4",{className:"sig-h",children:["Complexity breakdown ",e.jsx("span",{className:"muted",children:"— what built the score"})]}),e.jsx("ul",{className:"sig-bars",children:c.map(m=>e.jsxs("li",{className:"sig-bar-row",children:[e.jsx("span",{className:"sig-bar-label",children:zs[m.key]??m.key}),e.jsx("span",{className:"sig-bar","aria-hidden":"true",children:e.jsx("span",{className:"sig-bar-fill",style:{width:X(m.pts/u)}})}),e.jsxs("span",{className:"sig-bar-val",children:[m.pts.toFixed(1)," pts"]}),e.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(m.subscore*100),"% intensity · weight ",Math.round(m.weight*100),"%"]})]},m.key))})]}),x.length>0&&e.jsxs("section",{className:"sig-section",children:[e.jsxs("h4",{className:"sig-h",children:["Category scores ",e.jsxs("span",{className:"muted",children:["— why “",t,"” won"]})]}),e.jsx("ul",{className:"sig-bars",children:x.map(m=>e.jsxs("li",{className:"sig-bar-row"+(m.k===t?" is-win":""),children:[e.jsx("span",{className:"sig-bar-label",children:m.k}),e.jsx("span",{className:"sig-bar","aria-hidden":"true",children:e.jsx("span",{className:"sig-bar-fill",style:{width:X(m.v/f)}})}),e.jsx("span",{className:"sig-bar-val",children:m.v.toFixed(2)})]},m.k))})]}),e.jsxs("section",{className:"sig-section",children:[e.jsx("h4",{className:"sig-h",children:"Evidence"}),e.jsxs("dl",{className:"sig-grid",children:[n.tool_counts&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Tools"}),e.jsx("dd",{children:e.jsx(Z,{counts:n.tool_counts})})]}),g&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Skills"}),e.jsx("dd",{children:e.jsx(Z,{counts:n.skills})})]}),n.subagent_role&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Subagent role"}),e.jsx("dd",{children:n.subagent_role})]}),n.files&&n.files.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("dt",{children:["Files (",n.files.length,")"]}),e.jsx("dd",{className:"sig-files",children:n.files.join(", ")})]})]})]}),e.jsx("button",{className:"ghost small","aria-expanded":a,"aria-controls":i,onClick:()=>l(m=>!m),children:a?"Hide raw JSON ▴":"View raw JSON ▾"}),a&&e.jsx("pre",{id:i,className:"code signals",children:JSON.stringify(n,null,2)})]})}function Gs({f:s}){var r;const[n,t]=d.useState(!1),a=d.useId(),l=((r=s.signals)==null?void 0:r.modifiers)??{},i=Object.keys(l).filter(o=>l[o]!==!1&&l[o]!=null&&l[o]!=="");return e.jsxs("div",{className:"finding sev-border-"+s.severity,children:[e.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":a,onClick:()=>t(o=>!o),children:[e.jsx(ls,{severity:s.severity}),e.jsx("span",{className:"finding-title",children:s.title??s.rule_id}),s.framework_ref&&e.jsx("span",{className:"tag framework",children:s.framework_ref}),e.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&e.jsxs("div",{className:"finding-body",id:a,children:[s.evidence&&e.jsx("div",{className:"code-block",children:e.jsx("pre",{className:"code finding-evidence",children:s.evidence})}),e.jsxs("dl",{className:"sig-grid",children:[e.jsx("dt",{children:"Rule"}),e.jsx("dd",{children:e.jsx("code",{children:s.rule_id})}),e.jsx("dt",{children:"Category"}),e.jsx("dd",{children:s.category}),i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Context"}),e.jsx("dd",{children:i.map(o=>e.jsxs("span",{className:"sig-chip",children:[o,l[o]!==!0?e.jsxs("span",{className:"muted",children:[" ",String(l[o])]}):null]},o))})]})]}),e.jsxs(y,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(s.rule_id)}`,children:["see all “",s.rule_id,"” findings →"]})]})]})}function Xs({findings:s}){if(!s.length)return null;const n=[...s].sort((t,a)=>O.indexOf(t.severity)-O.indexOf(a.severity));return e.jsx("div",{className:"tool-findings",children:n.map(t=>e.jsx(Gs,{f:t},t.id))})}function Zs({findings:s,sessionId:n}){const t=new Map;for(const l of s)t.set(l.severity,(t.get(l.severity)??0)+1);const a=O.find(l=>t.has(l))??"info";return e.jsxs("div",{className:"security-banner sev-border-"+a,role:"status",children:[e.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),e.jsxs("span",{className:"security-banner-text",children:[s.length," security ",s.length===1?"finding":"findings"," in this session"]}),e.jsx("span",{className:"security-banner-sevs",children:O.filter(l=>t.has(l)).map(l=>e.jsx(ls,{severity:l,count:t.get(l)},l))}),e.jsx(y,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function se(s){const n={dirs:new Map,files:[]};for(const a of s){const l=a.display.startsWith("/"),i=(l?a.display.slice(1):a.display).split("/");l&&i.length>0&&(i[0]="/"+i[0]);let r=n;for(const o of i.slice(0,-1))r=r.dirs.get(o)??r.dirs.set(o,{dirs:new Map,files:[]}).get(o);r.files.push({name:i[i.length-1],path:a.path,list:a.list})}const t=a=>{for(const[l,i]of[...a.dirs.entries()])if(t(i),i.files.length===0&&i.dirs.size===1){const[r,o]=[...i.dirs.entries()][0];a.dirs.delete(l),a.dirs.set(l+"/"+r,o)}};return t(n),n}function rs({node:s,depth:n}){const t={paddingLeft:`${.4+n*1.1}rem`};return e.jsxs(e.Fragment,{children:[[...s.dirs.entries()].sort(([a],[l])=>a.localeCompare(l)).map(([a,l])=>e.jsxs(d.Fragment,{children:[e.jsx("tr",{children:e.jsx("td",{colSpan:3,style:t,children:e.jsxs("span",{className:"muted",children:["📁 ",a,"/"]})})}),e.jsx(rs,{node:l,depth:n+1})]},a)),[...s.files].sort((a,l)=>a.name.localeCompare(l.name)).map(a=>{const l=a.list.find(o=>o.event_uuid),i=a.list.reduce((o,c)=>o+(c.lines_added??0),0),r=a.list.reduce((o,c)=>o+(c.lines_removed??0),0);return e.jsxs("tr",{children:[e.jsx("td",{style:t,children:l!=null&&l.event_uuid?e.jsx("a",{href:`#ev-${l.event_uuid}`,className:"title",title:a.path+" — jump to the first change",children:a.name}):e.jsx("span",{title:a.path,children:a.name})}),e.jsxs("td",{className:"num",children:[a.list.length,"× ",e.jsxs("span",{className:"muted",children:["(+",i," −",r,")"]})]}),e.jsx("td",{children:e.jsx(y,{className:"subagent-link small",to:`/file?path=${encodeURIComponent(a.path)}`,children:"history →"})})]},a.path)})]})}function ee({changes:s,projectPath:n}){const t=new Map;for(const i of s)(t.get(i.file_path)??t.set(i.file_path,[]).get(i.file_path)).push(i);const a=i=>n&&i.startsWith(n.replace(/\/$/,"")+"/")?i.slice(n.replace(/\/$/,"").length+1):i,l=se([...t.entries()].map(([i,r])=>({display:a(i),path:i,list:r})));return e.jsxs("details",{className:"wf-run files-changed",children:[e.jsxs("summary",{children:["📄 ",t.size," ",t.size===1?"file":"files"," changed · ",s.length," ",s.length===1?"edit":"edits"]}),e.jsx("table",{className:"sessions",children:e.jsx("tbody",{children:e.jsx(rs,{node:l,depth:0})})})]})}function ne({d:s}){var t;const n=s.session;return e.jsxs("div",{className:"detail-head",children:[e.jsx(y,{to:"/",className:"back",children:"← all sessions"}),e.jsx("h1",{children:n.title||n.id.slice(0,12)}),e.jsxs("div",{className:"detail-meta",children:[e.jsx("span",{children:e.jsx("b",{children:n.source_id})}),e.jsx("span",{className:"path",children:n.project_path}),n.is_sidechain?e.jsx("span",{className:"tag subagent",children:"subagent"}):null,s.parent&&e.jsxs("span",{className:"spawned-by",children:["↖ spawned by"," ",e.jsx(y,{to:`/session/${s.parent.id}`,children:s.parent.title||s.parent.id.slice(0,12)}),s.parent.turn_seq!=null?` · turn ${s.parent.turn_seq+1}`:""]}),e.jsxs("span",{children:[s.turns.length," turns"]}),e.jsxs("span",{children:[n.event_count," events"]}),e.jsxs("span",{title:Fs(n.token_split),children:[Ms(n.tokens)," tok"]}),e.jsxs("span",{title:Rs(n.unpriced_models),children:[$s(n.cost),(t=n.unpriced_models)!=null&&t.length?e.jsx("span",{className:"warn-tag",children:" ⚠"}):null]}),n.tool_call_count>0&&e.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`]}),e.jsx("span",{children:T(n.duration_ms)}),e.jsx("span",{className:"muted",children:ts(n.started_at)}),e.jsx(Vs,{id:n.id})]}),s.classification&&e.jsx(Qs,{c:s.classification}),s.findings&&s.findings.length>0&&e.jsx(Zs,{findings:s.findings,sessionId:n.id}),s.file_changes&&s.file_changes.length>0&&e.jsx(ee,{changes:s.file_changes,projectPath:n.project_path??null})]})}function te({search:s,turnCount:n,anyOpen:t,onToggleAll:a,hideTools:l,onToggleHideTools:i,format:r,onChooseFormat:o}){return e.jsxs(e.Fragment,{children:[s,e.jsxs("div",{className:"transcript-tools",children:[n>1&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"muted small",children:[n," turns"]}),e.jsx("button",{className:"ghost small",onClick:a,children:t?"Collapse all":"Expand all"})]}),e.jsxs("button",{className:"ghost small"+(l?" is-active":""),"aria-pressed":l,onClick:i,title:"Hide Bash/Edit/Skill and other tool calls — show only assistant answers, plans and questions",children:[l?"☑ ":"☐ ","Hide tool messages"]}),e.jsxs("div",{className:"format-toggle",role:"group","aria-label":"Message format",children:[e.jsx("button",{className:"ghost small"+(r==="markdown"?" is-active":""),"aria-pressed":r==="markdown",onClick:()=>o("markdown"),children:"Markdown"}),e.jsx("button",{className:"ghost small"+(r==="raw"?" is-active":""),"aria-pressed":r==="raw",onClick:()=>o("raw"),children:"Raw"})]})]})]})}const M=2,ae={hits:[],byTurn:new Map,total:0};function is(s){var n;return[s.input_json,s.result_summary,(n=s.full_result)==null?void 0:n.text].filter(Boolean).join(`
|
|
1
|
+
import{e as Os,j as e,q as A,r as d,L as y,f as Ms,t as Fs,b as $s,v as Rs,c as T,w as ts,s as qs,x as As,h as G,i as as,l as Ls,y as Bs,z as Ps,k as Us,E as Ds,o as Hs}from"./index-r-fSz0IT.js";import{S as O,a as ls,u as Js}from"./useResetOn-2tqWddId.js";import{A as L,C as S,p as v}from"./jsonish-mD--ddqP.js";import{M as Ws,r as Ks}from"./index-C2D0y2yH.js";function Vs({id:s}){const n=Os();return e.jsxs("details",{className:"export-menu col-customizer",ref:n,children:[e.jsx("summary",{className:"export",title:"Export this session as Markdown",children:"⬇ Export Markdown"}),e.jsxs("div",{className:"col-menu",role:"group","aria-label":"Export options",children:[e.jsxs("a",{href:A(s),download:!0,children:["Redacted ",e.jsx("span",{className:"muted small",children:"(secrets masked)"})]}),e.jsxs("a",{href:A(s,"structure"),download:!0,children:["Structure only ",e.jsx("span",{className:"muted small",children:"(scrubbed)"})]}),e.jsxs("a",{className:"export-verbatim",href:A(s,"off"),download:!0,children:["Verbatim ",e.jsx("span",{className:"muted small",children:"(unredacted)"})]})]})]})}function Qs({c:s}){var i;const[n,t]=d.useState(!1),a=d.useId(),l=(i=s.signals)==null?void 0:i.loc;return e.jsxs("div",{className:"classification",children:[e.jsx("span",{className:"tag cat cat-"+(s.category??"none"),children:s.category??"unclassified"}),s.complexity_band&&e.jsxs("span",{className:"tag complexity",children:[s.complexity_band," · ",s.complexity_score]}),l&&e.jsxs("span",{className:"muted small",children:["+",l.added,"/−",l.removed," LoC · ",l.files," files"]}),e.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":a,onClick:()=>t(r=>!r),children:["why ",n?"▾":"▸"]}),n&&(s.signals?e.jsx(Ys,{id:a,s:s.signals,category:s.category}):e.jsx("div",{id:a,className:"muted small pad",children:"No signals recorded for this session."}))]})}const zs={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},X=s=>`${Math.max(0,Math.min(1,s))*100}%`;function Z({counts:s}){const n=Object.entries(s).sort((t,a)=>a[1]-t[1]);return n.length===0?e.jsx("span",{className:"muted",children:"—"}):e.jsx("span",{className:"sig-chips",children:n.map(([t,a])=>e.jsxs("span",{className:"sig-chip",children:[t," ",e.jsxs("span",{className:"muted",children:["×",a]})]},t))})}function Ys({id:s,s:n,category:t}){const[a,l]=d.useState(!1),i=d.useId(),r=n.complexity_weights??{},o=n.complexity_subscores??{},c=Object.keys(r).map(m=>({key:m,weight:r[m],subscore:o[m]??0,pts:r[m]*(o[m]??0)*100})).sort((m,w)=>w.pts-m.pts),u=Math.max(...c.map(m=>m.pts),1e-4),h=Object.entries(n.category_scores??{}).map(([m,w])=>({k:m,v:w})).sort((m,w)=>w.v-m.v),f=Math.max(...h.map(m=>m.v),1e-4),x=h.filter(m=>m.v>.02||m.k===t),g=n.skills&&Object.keys(n.skills).length>0;return e.jsxs("div",{id:s,className:"signals-panel",children:[c.length>0&&e.jsxs("section",{className:"sig-section",children:[e.jsxs("h4",{className:"sig-h",children:["Complexity breakdown ",e.jsx("span",{className:"muted",children:"— what built the score"})]}),e.jsx("ul",{className:"sig-bars",children:c.map(m=>e.jsxs("li",{className:"sig-bar-row",children:[e.jsx("span",{className:"sig-bar-label",children:zs[m.key]??m.key}),e.jsx("span",{className:"sig-bar","aria-hidden":"true",children:e.jsx("span",{className:"sig-bar-fill",style:{width:X(m.pts/u)}})}),e.jsxs("span",{className:"sig-bar-val",children:[m.pts.toFixed(1)," pts"]}),e.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(m.subscore*100),"% intensity · weight ",Math.round(m.weight*100),"%"]})]},m.key))})]}),x.length>0&&e.jsxs("section",{className:"sig-section",children:[e.jsxs("h4",{className:"sig-h",children:["Category scores ",e.jsxs("span",{className:"muted",children:["— why “",t,"” won"]})]}),e.jsx("ul",{className:"sig-bars",children:x.map(m=>e.jsxs("li",{className:"sig-bar-row"+(m.k===t?" is-win":""),children:[e.jsx("span",{className:"sig-bar-label",children:m.k}),e.jsx("span",{className:"sig-bar","aria-hidden":"true",children:e.jsx("span",{className:"sig-bar-fill",style:{width:X(m.v/f)}})}),e.jsx("span",{className:"sig-bar-val",children:m.v.toFixed(2)})]},m.k))})]}),e.jsxs("section",{className:"sig-section",children:[e.jsx("h4",{className:"sig-h",children:"Evidence"}),e.jsxs("dl",{className:"sig-grid",children:[n.tool_counts&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Tools"}),e.jsx("dd",{children:e.jsx(Z,{counts:n.tool_counts})})]}),g&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Skills"}),e.jsx("dd",{children:e.jsx(Z,{counts:n.skills})})]}),n.subagent_role&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Subagent role"}),e.jsx("dd",{children:n.subagent_role})]}),n.files&&n.files.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("dt",{children:["Files (",n.files.length,")"]}),e.jsx("dd",{className:"sig-files",children:n.files.join(", ")})]})]})]}),e.jsx("button",{className:"ghost small","aria-expanded":a,"aria-controls":i,onClick:()=>l(m=>!m),children:a?"Hide raw JSON ▴":"View raw JSON ▾"}),a&&e.jsx("pre",{id:i,className:"code signals",children:JSON.stringify(n,null,2)})]})}function Gs({f:s}){var r;const[n,t]=d.useState(!1),a=d.useId(),l=((r=s.signals)==null?void 0:r.modifiers)??{},i=Object.keys(l).filter(o=>l[o]!==!1&&l[o]!=null&&l[o]!=="");return e.jsxs("div",{className:"finding sev-border-"+s.severity,children:[e.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":a,onClick:()=>t(o=>!o),children:[e.jsx(ls,{severity:s.severity}),e.jsx("span",{className:"finding-title",children:s.title??s.rule_id}),s.framework_ref&&e.jsx("span",{className:"tag framework",children:s.framework_ref}),e.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&e.jsxs("div",{className:"finding-body",id:a,children:[s.evidence&&e.jsx("div",{className:"code-block",children:e.jsx("pre",{className:"code finding-evidence",children:s.evidence})}),e.jsxs("dl",{className:"sig-grid",children:[e.jsx("dt",{children:"Rule"}),e.jsx("dd",{children:e.jsx("code",{children:s.rule_id})}),e.jsx("dt",{children:"Category"}),e.jsx("dd",{children:s.category}),i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Context"}),e.jsx("dd",{children:i.map(o=>e.jsxs("span",{className:"sig-chip",children:[o,l[o]!==!0?e.jsxs("span",{className:"muted",children:[" ",String(l[o])]}):null]},o))})]})]}),e.jsxs(y,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(s.rule_id)}`,children:["see all “",s.rule_id,"” findings →"]})]})]})}function Xs({findings:s}){if(!s.length)return null;const n=[...s].sort((t,a)=>O.indexOf(t.severity)-O.indexOf(a.severity));return e.jsx("div",{className:"tool-findings",children:n.map(t=>e.jsx(Gs,{f:t},t.id))})}function Zs({findings:s,sessionId:n}){const t=new Map;for(const l of s)t.set(l.severity,(t.get(l.severity)??0)+1);const a=O.find(l=>t.has(l))??"info";return e.jsxs("div",{className:"security-banner sev-border-"+a,role:"status",children:[e.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),e.jsxs("span",{className:"security-banner-text",children:[s.length," security ",s.length===1?"finding":"findings"," in this session"]}),e.jsx("span",{className:"security-banner-sevs",children:O.filter(l=>t.has(l)).map(l=>e.jsx(ls,{severity:l,count:t.get(l)},l))}),e.jsx(y,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function se(s){const n={dirs:new Map,files:[]};for(const a of s){const l=a.display.startsWith("/"),i=(l?a.display.slice(1):a.display).split("/");l&&i.length>0&&(i[0]="/"+i[0]);let r=n;for(const o of i.slice(0,-1))r=r.dirs.get(o)??r.dirs.set(o,{dirs:new Map,files:[]}).get(o);r.files.push({name:i[i.length-1],path:a.path,list:a.list})}const t=a=>{for(const[l,i]of[...a.dirs.entries()])if(t(i),i.files.length===0&&i.dirs.size===1){const[r,o]=[...i.dirs.entries()][0];a.dirs.delete(l),a.dirs.set(l+"/"+r,o)}};return t(n),n}function rs({node:s,depth:n}){const t={paddingLeft:`${.4+n*1.1}rem`};return e.jsxs(e.Fragment,{children:[[...s.dirs.entries()].sort(([a],[l])=>a.localeCompare(l)).map(([a,l])=>e.jsxs(d.Fragment,{children:[e.jsx("tr",{children:e.jsx("td",{colSpan:3,style:t,children:e.jsxs("span",{className:"muted",children:["📁 ",a,"/"]})})}),e.jsx(rs,{node:l,depth:n+1})]},a)),[...s.files].sort((a,l)=>a.name.localeCompare(l.name)).map(a=>{const l=a.list.find(o=>o.event_uuid),i=a.list.reduce((o,c)=>o+(c.lines_added??0),0),r=a.list.reduce((o,c)=>o+(c.lines_removed??0),0);return e.jsxs("tr",{children:[e.jsx("td",{style:t,children:l!=null&&l.event_uuid?e.jsx("a",{href:`#ev-${l.event_uuid}`,className:"title",title:a.path+" — jump to the first change",children:a.name}):e.jsx("span",{title:a.path,children:a.name})}),e.jsxs("td",{className:"num",children:[a.list.length,"× ",e.jsxs("span",{className:"muted",children:["(+",i," −",r,")"]})]}),e.jsx("td",{children:e.jsx(y,{className:"subagent-link small",to:`/file?path=${encodeURIComponent(a.path)}`,children:"history →"})})]},a.path)})]})}function ee({changes:s,projectPath:n}){const t=new Map;for(const i of s)(t.get(i.file_path)??t.set(i.file_path,[]).get(i.file_path)).push(i);const a=i=>n&&i.startsWith(n.replace(/\/$/,"")+"/")?i.slice(n.replace(/\/$/,"").length+1):i,l=se([...t.entries()].map(([i,r])=>({display:a(i),path:i,list:r})));return e.jsxs("details",{className:"wf-run files-changed",children:[e.jsxs("summary",{children:["📄 ",t.size," ",t.size===1?"file":"files"," changed · ",s.length," ",s.length===1?"edit":"edits"]}),e.jsx("table",{className:"sessions",children:e.jsx("tbody",{children:e.jsx(rs,{node:l,depth:0})})})]})}function ne({d:s}){var t;const n=s.session;return e.jsxs("div",{className:"detail-head",children:[e.jsx(y,{to:"/",className:"back",children:"← all sessions"}),e.jsx("h1",{children:n.title||n.id.slice(0,12)}),e.jsxs("div",{className:"detail-meta",children:[e.jsx("span",{children:e.jsx("b",{children:n.source_id})}),e.jsx("span",{className:"path",children:n.project_path}),n.is_sidechain?e.jsx("span",{className:"tag subagent",children:"subagent"}):null,s.parent&&e.jsxs("span",{className:"spawned-by",children:["↖ spawned by"," ",e.jsx(y,{to:`/session/${s.parent.id}`,children:s.parent.title||s.parent.id.slice(0,12)}),s.parent.turn_seq!=null?` · turn ${s.parent.turn_seq+1}`:""]}),e.jsxs("span",{children:[s.turns.length," turns"]}),e.jsxs("span",{children:[n.event_count," events"]}),e.jsxs("span",{title:Fs(n.token_split),children:[Ms(n.tokens)," tok"]}),e.jsxs("span",{title:Rs(n.unpriced_models),children:[$s(n.cost),(t=n.unpriced_models)!=null&&t.length?e.jsx("span",{className:"warn-tag",children:" ⚠"}):null]}),n.tool_call_count>0&&e.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`]}),e.jsx("span",{children:T(n.duration_ms)}),e.jsx("span",{className:"muted",children:ts(n.started_at)}),e.jsx(Vs,{id:n.id})]}),s.classification&&e.jsx(Qs,{c:s.classification}),s.findings&&s.findings.length>0&&e.jsx(Zs,{findings:s.findings,sessionId:n.id}),s.file_changes&&s.file_changes.length>0&&e.jsx(ee,{changes:s.file_changes,projectPath:n.project_path??null})]})}function te({search:s,turnCount:n,anyOpen:t,onToggleAll:a,hideTools:l,onToggleHideTools:i,format:r,onChooseFormat:o}){return e.jsxs(e.Fragment,{children:[s,e.jsxs("div",{className:"transcript-tools",children:[n>1&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"muted small",children:[n," turns"]}),e.jsx("button",{className:"ghost small",onClick:a,children:t?"Collapse all":"Expand all"})]}),e.jsxs("button",{className:"ghost small"+(l?" is-active":""),"aria-pressed":l,onClick:i,title:"Hide Bash/Edit/Skill and other tool calls — show only assistant answers, plans and questions",children:[l?"☑ ":"☐ ","Hide tool messages"]}),e.jsxs("div",{className:"format-toggle",role:"group","aria-label":"Message format",children:[e.jsx("button",{className:"ghost small"+(r==="markdown"?" is-active":""),"aria-pressed":r==="markdown",onClick:()=>o("markdown"),children:"Markdown"}),e.jsx("button",{className:"ghost small"+(r==="raw"?" is-active":""),"aria-pressed":r==="raw",onClick:()=>o("raw"),children:"Raw"})]})]})]})}const M=2,ae={hits:[],byTurn:new Map,total:0};function is(s){var n;return[s.input_json,s.result_summary,(n=s.full_result)==null?void 0:n.text].filter(Boolean).join(`
|
|
2
2
|
`)}function os(s){const n=[];s.text&&n.push(s.text),s.thinking&&n.push(s.thinking);for(const t of s.toolCalls)n.push(is(t));return n.join(`
|
|
3
3
|
`).toLowerCase()}function le(s){return new Map(s.map(n=>[n.uuid,os(n)]))}function re(s,n){let t=0;for(let a=s.indexOf(n);a!==-1;a=s.indexOf(n,a+n.length))t++;return t}function ie(s,n,t){const a=t.trim().toLowerCase();if(a.length<M)return ae;const l=[],i=new Map;for(const r of s){const o=re(n.get(r.uuid)??os(r),a);o&&(l.push({uuid:r.uuid,turnId:r.turn_id??null,count:o}),r.turn_id&&i.set(r.turn_id,(i.get(r.turn_id)??0)+1))}return{hits:l,byTurn:i,total:l.length}}function oe(s,n){return U(is(s),n)}function U(s,n){const t=n.trim().toLowerCase();return!s||t.length<M?!1:s.toLowerCase().includes(t)}function cs(s,n,t){return a=>{if(a.key==="Escape"){a.preventDefault(),t();return}if(a.key==="Enter"){if(a.shiftKey){a.preventDefault(),s();return}a.target.tagName!=="BUTTON"&&(a.preventDefault(),n())}}}function ce({query:s,total:n,index:t,onPrev:a,onNext:l,onClear:i,onBackToBox:r}){return e.jsxs("div",{className:"search-nav",role:"group","aria-label":"Search matches",tabIndex:-1,onKeyDown:cs(a,l,i),children:[e.jsx("button",{type:"button",className:"ghost small sn-back","aria-label":"Back to the search box",onClick:r,children:"🔍"}),e.jsxs("span",{className:"sn-term",children:[e.jsx("span",{className:"sn-q",children:s}),e.jsxs("span",{className:"sn-pos",children:[t+1,"/",n]})]}),e.jsx("button",{type:"button",className:"ghost small","aria-label":"Previous match",onClick:a,children:"◂"}),e.jsx("button",{type:"button",className:"ghost small","aria-label":"Next match",onClick:l,children:"▸"}),e.jsx("button",{type:"button",className:"ghost small","aria-label":"Clear search",onClick:i,children:"✕"})]})}const de=150;function ue({query:s,onQuery:n,total:t,index:a,onPrev:l,onNext:i,inputRef:r}){const[o,c]=d.useState(s),u=d.useRef(0),h=d.useRef(null),[f,x]=d.useState(!0);d.useEffect(()=>{const N=h.current;if(!N||typeof IntersectionObserver>"u")return;const b=new IntersectionObserver(([F])=>x(F.isIntersecting));return b.observe(N),()=>b.disconnect()},[]);const g=d.useRef(s);g.current!==s&&(g.current=s,c(s)),d.useEffect(()=>()=>window.clearTimeout(u.current),[]);const m=N=>{c(N),window.clearTimeout(u.current),u.current=window.setTimeout(()=>n(N),de)},w=()=>{var N;window.clearTimeout(u.current),c(""),n(""),(N=r.current)==null||N.focus()},j=o.trim().length>=M;return e.jsxs(e.Fragment,{children:[e.jsxs("form",{ref:h,className:"transcript-search",role:"search",onSubmit:N=>N.preventDefault(),onKeyDown:cs(l,i,w),children:[e.jsx("span",{className:"ts-icon","aria-hidden":"true",children:"🔍"}),e.jsx("input",{ref:r,type:"search","aria-label":"Find in this session",placeholder:"Find in session…",value:o,onChange:N=>m(N.target.value)}),e.jsx("span",{className:"ts-count muted small",role:"status","aria-live":"polite",children:j?t===0?"No matches":`${a+1} of ${t} message${t===1?"":"s"}`:""}),e.jsx("button",{type:"button",className:"ghost small","aria-label":"Previous match",disabled:t===0,onClick:l,children:"◂"}),e.jsx("button",{type:"button",className:"ghost small","aria-label":"Next match",disabled:t===0,onClick:i,children:"▸"}),o&&e.jsx("button",{type:"button",className:"ghost small","aria-label":"Clear search",onClick:w,children:"✕"})]}),t>0&&!f&&e.jsx(ce,{query:s,total:t,index:a,onPrev:l,onNext:i,onClear:w,onBackToBox:()=>{var N;return(N=r.current)==null?void 0:N.focus()}})]})}function me({d:s}){const n=s.workflow_runs??[],t=s.children.filter(l=>!l.workflow_run_id),a=n.length>0;return e.jsxs("div",{className:"subagents",children:[e.jsxs("h2",{children:["Spawned subagents (",s.children.length,")"]}),n.map(l=>{const i=s.children.filter(r=>r.workflow_run_id===l.run_id);return e.jsxs("details",{className:"wf-run",children:[e.jsxs("summary",{children:[e.jsxs(y,{className:"wf-run-name",to:`/workflow/${l.run_id}`,onClick:r=>r.stopPropagation(),children:["🔀 ",l.name||"workflow"," →"]}),l.status&&e.jsx("span",{className:"tag task-status task-status-"+l.status.toLowerCase(),children:l.status}),e.jsxs("span",{className:"muted small",children:[i.length," agent",i.length===1?"":"s",l.turn_seq!=null?` · turn ${l.turn_seq+1}`:""," · ",e.jsx("code",{children:l.run_id})]})]}),e.jsx("ul",{children:i.map(r=>e.jsx(L,{a:r},r.id))})]},l.run_id)}),t.length>0&&(a?e.jsxs("details",{className:"wf-run",open:!0,children:[e.jsxs("summary",{children:[e.jsx("span",{className:"wf-run-name",children:"Task / Agent"}),e.jsxs("span",{className:"muted small",children:[t.length," subagent",t.length===1?"":"s"]})]}),e.jsx("ul",{children:t.map(l=>e.jsx(L,{a:l},l.id))})]}):e.jsx("ul",{children:t.map(l=>e.jsx(L,{a:l},l.id))}))]})}function ss(s,n){const t=s===""?[]:s.split(`
|
|
4
4
|
`),a=n===""?[]:n.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as x,x as j,j as s,A as v,k as f,r as d,L as m,w as c}from"./index-
|
|
1
|
+
import{y as x,x as j,j as s,A as v,k as f,r as d,L as m,w as c}from"./index-r-fSz0IT.js";import{M as N,r as p}from"./index-C2D0y2yH.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{k as q,m as k,r as c,B as F,x as C,C as E,j as e,F as R,E as w,o as I,S as d,L as K,w as M,P as D}from"./index-
|
|
1
|
+
import{k as q,m as k,r as c,B as F,x as C,C as E,j as e,F as R,E as w,o as I,S as d,L as K,w as M,P as D}from"./index-r-fSz0IT.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:v}=q(),f=k("/sources",[]),y=k("/projects",[]),[h,m]=c.useState(r("q")),{sort:a,toggle:i}=F("fired","desc"),[N,j]=c.useState(1),p=v(["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"}),f.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,r as C,y as D,x as G,A as K,L as T,s as L,f as W,b as q,c as Y,w as z}from"./index-CZWQ3Zzl.js";import{s as E,d as v,l as M,a as H,C as V,p as S,A as Q}from"./jsonish-CXEf39_V.js";import{M as F,r as J}from"./index-2eZrG4wC.js";const N=e=>e===null||typeof e!="object",R=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function A({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const r=typeof e;return r==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):r==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function P({v:e}){return N(e)?s.jsx(A,{v:e}):Array.isArray(e)?e.every(N)?s.jsx("span",{className:"rv-str",children:e.map(String).join(", ")||"—"}):s.jsxs("span",{className:"muted",children:["[",e.length,"]"]}):s.jsx("span",{className:"muted",children:`{${Object.keys(e).length}}`})}function I(e){const r=[],a=new Set;for(const l of e)for(const n of Object.keys(l??{}))a.has(n)||(a.add(n),r.push(n));return r}function U({rows:e}){const r=I(e);return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:r.map(a=>s.jsx("th",{children:a},a))})}),s.jsx("tbody",{children:e.map((a,l)=>s.jsx("tr",{children:r.map(n=>s.jsx("td",{children:s.jsx(P,{v:a[n]})},n))},l))})]})})}function X({obj:e}){const r=Object.entries(e),a=I(r.map(([,l])=>l));return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"key"}),a.map(l=>s.jsx("th",{children:l},l))]})}),s.jsx("tbody",{children:r.map(([l,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:l}),a.map(t=>s.jsx("td",{children:s.jsx(P,{v:n[t]})},t))]},l))})]})})}function Z({name:e,value:r,depth:a}){const[l,n]=C.useState(a<1),t=Array.isArray(r)?`[${r.length}]`:`{${Object.keys(r).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":l,onClick:()=>n(i=>!i),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:l?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:t})]}),l&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(B,{value:r,depth:a+1})})]})}function B({value:e,depth:r=0}){if(N(e))return s.jsx(A,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(R)?s.jsx(U,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((t,i)=>s.jsx("li",{children:s.jsx(P,{v:t})},i))});const a=Object.entries(e);if(a.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(a.every(([,t])=>R(t)))return s.jsx(X,{obj:e});const l=a.filter(([,t])=>N(t)),n=a.filter(([,t])=>!N(t));return s.jsxs("div",{className:"rv-obj",children:[l.length>0&&s.jsx("div",{className:"rv-metrics",children:l.map(([t,i])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:t}),s.jsx("span",{className:"rv-mval",children:s.jsx(A,{v:i})})]},t))}),n.map(([t,i])=>s.jsx(Z,{name:t,value:i,depth:r},t))]})}function k({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(B,{value:e,depth:0})})}const f=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),_=e=>e===null||typeof e!="object",ss=new Set(["script","scriptPath","description"]),es=["skill","name","id","title"];function as({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):_(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(_)?s.jsx("ol",{className:"launch-list",children:e.map((r,a)=>s.jsx("li",{children:r===null?"—":String(r)},a))}):s.jsx(k,{value:e}):s.jsx(k,{value:e})}function ns({rec:e,index:r}){const a=es.find(t=>typeof e[t]=="string"),l=a?String(e[a]):`task ${r+1}`,n=Object.entries(e).filter(([t])=>t!==a);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:r+1}),s.jsx("span",{className:"launch-card-title",children:l})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([t,i])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:t}),s.jsx("dd",{children:s.jsx(as,{v:i})})]},t))})]})}function $({raw:e}){const[r,a]=C.useState(!1),{body:l,note:n}=E(v(e)),{value:t,repaired:i}=M(l);if(t===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const d=H(t),x=f(d)?Object.entries(d):[["",d]],y=x.filter(([o,c])=>_(c)&&o!=="script"),g=x.filter(([,o])=>!_(o)),h=f(d)&&typeof d.script=="string"?d.script:null,u=f(d)&&typeof d.scriptPath=="string"?d.scriptPath:null,m=f(d)&&typeof d.description=="string"?d.description:null,p=y.filter(([o])=>!ss.has(o)),w=m||u||h||p.length>0,b=o=>Array.isArray(o)&&o.length>0&&o.every(f);return s.jsxs("div",{className:"launch",children:[w&&s.jsxs("div",{className:"launch-meta",children:[m&&s.jsx("div",{className:"launch-desc",children:m}),u&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:u})]}),p.map(([o,c])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:o})," ",s.jsx("code",{children:String(c)})]},o)),h&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",h.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:h})]})]}),g.map(([o,c])=>b(c)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[c.length," ",o||(c.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),c.map((j,O)=>s.jsx(ns,{rec:j,index:O},O))]},o||"tasks"):s.jsxs("div",{className:"launch-section",children:[o&&s.jsx("div",{className:"launch-tasks-head",children:o}),s.jsx(k,{value:c})]},o||"value")),(n||i)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",n??"Payload was truncated; showing the recoverable portion."]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{type:"button",className:"ghost small","aria-expanded":r,onClick:()=>a(o=>!o),children:r?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(V,{text:S(l),label:"JSON",title:"Copy raw launch JSON"})]}),r&&s.jsx("pre",{className:"code launch-raw",children:S(l)})]})}function ts({raw:e}){const{body:r,note:a}=E(v(e)),l=/^\s*[[{]/.test(r),{value:n,repaired:t}=l?M(r):{value:void 0,repaired:!1},i=n!==void 0;return s.jsxs(s.Fragment,{children:[i?s.jsx("div",{className:"wf-result-body",children:s.jsx(k,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(F,{remarkPlugins:[J],children:r})}),(a||t)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",a??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(V,{text:i?S(r):r,label:"result",title:"Copy the returned result"})})]})}function rs(e,r){if(e&&e.length){const a=new Map,l=(n,t)=>{let i=a.get(n);return i?t&&(i.title=t):(i={title:t||`Phase ${n}`,agentCount:0,models:[]},a.set(n,i)),i};for(const n of e)n.type==="workflow_phase"&&l(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const t=l(n.phaseIndex,n.phaseTitle);t.agentCount++,n.model&&!t.models.includes(n.model)&&t.models.push(n.model)}if(a.size)return[...a.keys()].sort((n,t)=>n-t).map(n=>a.get(n))}return r.map(a=>({title:a,agentCount:0,models:[]}))}function ds(){const{run_id:e}=D(),r=G("/workflows/"+e,{reset:!0});return s.jsx(K,{state:r,children:a=>s.jsx(ls,{d:a})})}function ls({d:e}){var x,y,g,h,u,m,p,w,b,o;const r=(e.status??"").toLowerCase(),a=((x=e.run)==null?void 0:x.agent_count)??e.stats.agent_count,l=((y=e.run)==null?void 0:y.total_tokens)??e.stats.total_tokens,n=((g=e.run)==null?void 0:g.duration_ms)??e.stats.duration_ms,t=(((h=e.run)==null?void 0:h.phases)??[]).map(c=>c==null?void 0:c.title).filter(c=>!!c),i=rs((u=e.run)==null?void 0:u.progress,t),d=((m=e.run)==null?void 0:m.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(T,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",e.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:e.run_id}),e.status&&s.jsx("span",{className:"tag task-status task-status-"+r,children:e.status}),((p=e.run)==null?void 0:p.default_model)&&s.jsx("span",{className:"tag",children:L(e.run.default_model)}),((w=e.parent)==null?void 0:w.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(T,{to:`/session/${e.parent.id}`,children:e.parent.title||e.parent.id.slice(0,12)}),e.parent.turn_seq!=null?` · turn ${e.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[a," agent",a===1?"":"s"]}),s.jsxs("span",{children:[W(l)," tok"]}),((b=e.run)==null?void 0:b.total_tool_calls)!=null&&s.jsxs("span",{children:[e.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:q(e.stats.total_cost)}),s.jsx("span",{children:Y(n)}),s.jsx("span",{className:"muted",children:z(((o=e.run)==null?void 0:o.started_at)??e.stats.started_at)})]}),i.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:i.map((c,j)=>s.jsxs(C.Fragment,{children:[j>0&&s.jsx("span",{className:"wf-phase-arrow","aria-hidden":"true",children:"→"}),s.jsxs("div",{className:"wf-phase-chip",children:[s.jsx("span",{className:"wf-phase-title",children:c.title}),c.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[c.agentCount," agent",c.agentCount===1?"":"s",c.models.length?` · ${c.models.map(L).join(", ")}`:""]})]})]},j))})]}),e.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",e.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+e.completion.status.toLowerCase(),children:e.completion.status})]}),e.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:v(e.completion.summary)}),e.completion.result?s.jsx(ts,{raw:e.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),e.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:v(e.completion.failures)})]})]}),d.length>0&&s.jsxs("details",{className:"wf-logs",open:d.length<=20,children:[s.jsxs("summary",{children:["Run log · ",d.length," line",d.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:d.map((c,j)=>s.jsx("li",{children:c},j))})]}),e.input_json?s.jsx("div",{className:"wf-result wf-launch",children:e.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx($,{raw:e.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),r==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx($,{raw:e.input_json})]})}):!e.completion&&e.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(F,{remarkPlugins:[J],children:e.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",e.agents.length,")"]}),e.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:e.agents.map(c=>s.jsx(Q,{a:c},c.id))})]})]})}export{ds as default};
|
|
1
|
+
import{j as s,r as C,y as D,x as G,A as K,L as T,s as L,f as W,b as q,c as Y,w as z}from"./index-r-fSz0IT.js";import{s as E,d as v,l as M,a as H,C as V,p as S,A as Q}from"./jsonish-mD--ddqP.js";import{M as F,r as J}from"./index-C2D0y2yH.js";const N=e=>e===null||typeof e!="object",R=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function A({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const r=typeof e;return r==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):r==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function P({v:e}){return N(e)?s.jsx(A,{v:e}):Array.isArray(e)?e.every(N)?s.jsx("span",{className:"rv-str",children:e.map(String).join(", ")||"—"}):s.jsxs("span",{className:"muted",children:["[",e.length,"]"]}):s.jsx("span",{className:"muted",children:`{${Object.keys(e).length}}`})}function I(e){const r=[],a=new Set;for(const l of e)for(const n of Object.keys(l??{}))a.has(n)||(a.add(n),r.push(n));return r}function U({rows:e}){const r=I(e);return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:r.map(a=>s.jsx("th",{children:a},a))})}),s.jsx("tbody",{children:e.map((a,l)=>s.jsx("tr",{children:r.map(n=>s.jsx("td",{children:s.jsx(P,{v:a[n]})},n))},l))})]})})}function X({obj:e}){const r=Object.entries(e),a=I(r.map(([,l])=>l));return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"key"}),a.map(l=>s.jsx("th",{children:l},l))]})}),s.jsx("tbody",{children:r.map(([l,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:l}),a.map(t=>s.jsx("td",{children:s.jsx(P,{v:n[t]})},t))]},l))})]})})}function Z({name:e,value:r,depth:a}){const[l,n]=C.useState(a<1),t=Array.isArray(r)?`[${r.length}]`:`{${Object.keys(r).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":l,onClick:()=>n(i=>!i),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:l?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:t})]}),l&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(B,{value:r,depth:a+1})})]})}function B({value:e,depth:r=0}){if(N(e))return s.jsx(A,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(R)?s.jsx(U,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((t,i)=>s.jsx("li",{children:s.jsx(P,{v:t})},i))});const a=Object.entries(e);if(a.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(a.every(([,t])=>R(t)))return s.jsx(X,{obj:e});const l=a.filter(([,t])=>N(t)),n=a.filter(([,t])=>!N(t));return s.jsxs("div",{className:"rv-obj",children:[l.length>0&&s.jsx("div",{className:"rv-metrics",children:l.map(([t,i])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:t}),s.jsx("span",{className:"rv-mval",children:s.jsx(A,{v:i})})]},t))}),n.map(([t,i])=>s.jsx(Z,{name:t,value:i,depth:r},t))]})}function k({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(B,{value:e,depth:0})})}const f=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),_=e=>e===null||typeof e!="object",ss=new Set(["script","scriptPath","description"]),es=["skill","name","id","title"];function as({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):_(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(_)?s.jsx("ol",{className:"launch-list",children:e.map((r,a)=>s.jsx("li",{children:r===null?"—":String(r)},a))}):s.jsx(k,{value:e}):s.jsx(k,{value:e})}function ns({rec:e,index:r}){const a=es.find(t=>typeof e[t]=="string"),l=a?String(e[a]):`task ${r+1}`,n=Object.entries(e).filter(([t])=>t!==a);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:r+1}),s.jsx("span",{className:"launch-card-title",children:l})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([t,i])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:t}),s.jsx("dd",{children:s.jsx(as,{v:i})})]},t))})]})}function $({raw:e}){const[r,a]=C.useState(!1),{body:l,note:n}=E(v(e)),{value:t,repaired:i}=M(l);if(t===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const d=H(t),x=f(d)?Object.entries(d):[["",d]],y=x.filter(([o,c])=>_(c)&&o!=="script"),g=x.filter(([,o])=>!_(o)),h=f(d)&&typeof d.script=="string"?d.script:null,u=f(d)&&typeof d.scriptPath=="string"?d.scriptPath:null,m=f(d)&&typeof d.description=="string"?d.description:null,p=y.filter(([o])=>!ss.has(o)),w=m||u||h||p.length>0,b=o=>Array.isArray(o)&&o.length>0&&o.every(f);return s.jsxs("div",{className:"launch",children:[w&&s.jsxs("div",{className:"launch-meta",children:[m&&s.jsx("div",{className:"launch-desc",children:m}),u&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:u})]}),p.map(([o,c])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:o})," ",s.jsx("code",{children:String(c)})]},o)),h&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",h.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:h})]})]}),g.map(([o,c])=>b(c)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[c.length," ",o||(c.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),c.map((j,O)=>s.jsx(ns,{rec:j,index:O},O))]},o||"tasks"):s.jsxs("div",{className:"launch-section",children:[o&&s.jsx("div",{className:"launch-tasks-head",children:o}),s.jsx(k,{value:c})]},o||"value")),(n||i)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",n??"Payload was truncated; showing the recoverable portion."]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{type:"button",className:"ghost small","aria-expanded":r,onClick:()=>a(o=>!o),children:r?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(V,{text:S(l),label:"JSON",title:"Copy raw launch JSON"})]}),r&&s.jsx("pre",{className:"code launch-raw",children:S(l)})]})}function ts({raw:e}){const{body:r,note:a}=E(v(e)),l=/^\s*[[{]/.test(r),{value:n,repaired:t}=l?M(r):{value:void 0,repaired:!1},i=n!==void 0;return s.jsxs(s.Fragment,{children:[i?s.jsx("div",{className:"wf-result-body",children:s.jsx(k,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(F,{remarkPlugins:[J],children:r})}),(a||t)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",a??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(V,{text:i?S(r):r,label:"result",title:"Copy the returned result"})})]})}function rs(e,r){if(e&&e.length){const a=new Map,l=(n,t)=>{let i=a.get(n);return i?t&&(i.title=t):(i={title:t||`Phase ${n}`,agentCount:0,models:[]},a.set(n,i)),i};for(const n of e)n.type==="workflow_phase"&&l(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const t=l(n.phaseIndex,n.phaseTitle);t.agentCount++,n.model&&!t.models.includes(n.model)&&t.models.push(n.model)}if(a.size)return[...a.keys()].sort((n,t)=>n-t).map(n=>a.get(n))}return r.map(a=>({title:a,agentCount:0,models:[]}))}function ds(){const{run_id:e}=D(),r=G("/workflows/"+e,{reset:!0});return s.jsx(K,{state:r,children:a=>s.jsx(ls,{d:a})})}function ls({d:e}){var x,y,g,h,u,m,p,w,b,o;const r=(e.status??"").toLowerCase(),a=((x=e.run)==null?void 0:x.agent_count)??e.stats.agent_count,l=((y=e.run)==null?void 0:y.total_tokens)??e.stats.total_tokens,n=((g=e.run)==null?void 0:g.duration_ms)??e.stats.duration_ms,t=(((h=e.run)==null?void 0:h.phases)??[]).map(c=>c==null?void 0:c.title).filter(c=>!!c),i=rs((u=e.run)==null?void 0:u.progress,t),d=((m=e.run)==null?void 0:m.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(T,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",e.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:e.run_id}),e.status&&s.jsx("span",{className:"tag task-status task-status-"+r,children:e.status}),((p=e.run)==null?void 0:p.default_model)&&s.jsx("span",{className:"tag",children:L(e.run.default_model)}),((w=e.parent)==null?void 0:w.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(T,{to:`/session/${e.parent.id}`,children:e.parent.title||e.parent.id.slice(0,12)}),e.parent.turn_seq!=null?` · turn ${e.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[a," agent",a===1?"":"s"]}),s.jsxs("span",{children:[W(l)," tok"]}),((b=e.run)==null?void 0:b.total_tool_calls)!=null&&s.jsxs("span",{children:[e.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:q(e.stats.total_cost)}),s.jsx("span",{children:Y(n)}),s.jsx("span",{className:"muted",children:z(((o=e.run)==null?void 0:o.started_at)??e.stats.started_at)})]}),i.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:i.map((c,j)=>s.jsxs(C.Fragment,{children:[j>0&&s.jsx("span",{className:"wf-phase-arrow","aria-hidden":"true",children:"→"}),s.jsxs("div",{className:"wf-phase-chip",children:[s.jsx("span",{className:"wf-phase-title",children:c.title}),c.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[c.agentCount," agent",c.agentCount===1?"":"s",c.models.length?` · ${c.models.map(L).join(", ")}`:""]})]})]},j))})]}),e.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",e.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+e.completion.status.toLowerCase(),children:e.completion.status})]}),e.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:v(e.completion.summary)}),e.completion.result?s.jsx(ts,{raw:e.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),e.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:v(e.completion.failures)})]})]}),d.length>0&&s.jsxs("details",{className:"wf-logs",open:d.length<=20,children:[s.jsxs("summary",{children:["Run log · ",d.length," line",d.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:d.map((c,j)=>s.jsx("li",{children:c},j))})]}),e.input_json?s.jsx("div",{className:"wf-result wf-launch",children:e.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx($,{raw:e.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),r==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx($,{raw:e.input_json})]})}):!e.completion&&e.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(F,{remarkPlugins:[J],children:e.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",e.agents.length,")"]}),e.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:e.agents.map(c=>s.jsx(Q,{a:c},c.id))})]})]})}export{ds as default};
|