@swestash/agent-lens 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-lens.js +135 -11
- package/dist/agent-lens.js.map +1 -1
- package/package.json +1 -1
- package/web/assets/{CopyButton-CQ5SHT0Q.js → CopyButton-XWWtxa5T.js} +1 -1
- package/web/assets/{Dashboard-BZeT30Fc.js → Dashboard-BQX66iZp.js} +34 -34
- package/web/assets/{SecurityView-CCSq2PMa.js → SecurityView-C_CfNLoD.js} +1 -1
- package/web/assets/{SessionView-DTYrghRK.js → SessionView-qPYTooYU.js} +8 -8
- package/web/assets/{SkillView-BPXOcH3K.js → SkillView-BuWdX4As.js} +1 -1
- package/web/assets/{SkillsView-ClZpsQqe.js → SkillsView-D8Wtsxi6.js} +1 -1
- package/web/assets/{WorkflowView-DwxhHR6A.js → WorkflowView-Afsv_IWs.js} +1 -1
- package/web/assets/index-BkDuOrzs.js +68 -0
- package/web/assets/index-CPyBa1Te.css +1 -0
- package/web/assets/{index-CM-5HLoq.js → index-T6SPgI6b.js} +1 -1
- package/web/assets/{severity-TiQaFcLQ.js → severity-DkldRG9Z.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/index-B_beFRjy.js +0 -68
- package/web/assets/index-CGKywTVG.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as te,r as a,n as ie,d as N,p,j as e,F as ae,q as j,S as R,P as le,l as ne,L as re}from"./index-B_beFRjy.js";import{S as ce,a as oe}from"./severity-TiQaFcLQ.js";const E=50;function ge(){const[t,h]=te(),[i,l]=a.useState(null),[c,M]=a.useState({total:0,findings:[]}),[S,F]=a.useState([]),[H,V]=a.useState([]),[G,Q]=a.useState([]),[K,U]=a.useState(!0),[D,_]=a.useState(null),[f,I]=a.useState(!1),[w,q]=a.useState(1),[u,C]=a.useState(new Set),[T,J]=a.useState(0),{sort:r,toggle:P}=ie("severity","desc"),x=t.get("severity")??"",y=t.get("category")??"",b=t.get("rule")??"",L=t.get("session")??"",$=t.get("source")??"",A=t.get("project")??"",O=t.get("from")??"",W=t.get("to")??"",m=t.get("status")??"open",v=a.useMemo(()=>{const s=new URLSearchParams;for(const[n,d]of Object.entries({severity:x,category:y,rule:b,session:L,source:$,project:A,from:O,to:W,status:m}))d&&s.set(n,d);return s},[x,y,b,L,$,A,O,W,m]);a.useEffect(()=>{N("/sources").then(V).catch(()=>{}),N("/projects").then(Q).catch(()=>{})},[]),a.useEffect(()=>{N("/security/summary").then(l).catch(()=>{}),p||N("/security/mutes").then(F).catch(()=>{})},[T]),a.useEffect(()=>q(1),[v.toString(),r.key,r.dir]),a.useEffect(()=>C(new Set),[v.toString(),r.key,r.dir,w,T]),a.useEffect(()=>{U(!0),_(null);const s=new URLSearchParams(v);s.set("sort",r.key),s.set("dir",r.dir),s.set("limit",String(E)),s.set("offset",String((w-1)*E)),N("/security/findings?"+s.toString()).then(M).catch(n=>_(String(n))).finally(()=>U(!1))},[v,r.key,r.dir,w,T]);const o=a.useCallback(s=>{const n=new URLSearchParams(t);for(const[d,k]of Object.entries(s))k?n.set(d,k):n.delete(d);h(n)},[t,h]),g=a.useCallback(async s=>{I(!0),_(null);try{await s(),J(n=>n+1)}catch(n){_(String(n))}finally{I(!1)}},[]),X=a.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),B=a.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!y||s.category===y),[i,y]),Y=Math.max(1,Math.ceil(c.total/E)),Z=[...v.keys()].some(s=>s!=="status")||m!=="open",z=c.findings.map(s=>s.id),ee=z.length>0&&z.every(s=>u.has(s)),se=s=>C(n=>{const d=new Set(n);return d.has(s)?d.delete(s):d.add(s),d});return e.jsxs("div",{children:[e.jsxs("div",{className:"detail-head",children:[e.jsx("h1",{children:"Security findings"}),e.jsxs("p",{className:"muted",style:{margin:"4px 0 0",maxWidth:760},children:["Risky operations the agent performed, flagged after the fact by deterministic rules over each tool call. Counts show ",e.jsx("strong",{children:"open"})," findings — mark benign ones safe or mute a noisy rule so a real one stands out. agent-lens is retrospective; it surfaces what ",e.jsx("em",{children:"happened"}),", it doesn't block."]})]}),p&&e.jsxs("div",{className:"demo-note",role:"note",children:["📦 This is a static demo over synthetic sessions. Browse the findings and reference below —"," ",e.jsx("strong",{children:"triage"})," (mark safe, mute rules) and live filtering run in the local app on your own data."]}),e.jsxs("div",{className:"kpi-row sev-kpis",role:"group","aria-label":"Open findings by severity",children:[e.jsxs("button",{type:"button",className:"kpi kpi-btn"+(x?"":" is-active"),onClick:()=>o({severity:""}),children:[e.jsx("div",{className:"kpi-label",children:"Open findings"}),e.jsx("div",{className:"kpi-value",children:(i==null?void 0:i.total)??"—"}),e.jsxs("div",{className:"kpi-sub",children:[(i==null?void 0:i.sessions_flagged)??0," sessions flagged"]})]}),ce.map(s=>e.jsxs("button",{type:"button",className:"kpi kpi-btn sev-kpi sev-"+s+(x===s?" is-active":""),onClick:()=>o({severity:x===s?"":s}),"aria-pressed":x===s,children:[e.jsx("div",{className:"kpi-label",children:s}),e.jsx("div",{className:"kpi-value",children:X.get(s)??0})]},s))]}),i&&(i.dismissed>0||i.muted>0)&&e.jsxs("div",{className:"triage-counts muted small",children:[e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:m,onChange:s=>o({status:s.target.value}),children:[e.jsx("option",{value:"open",children:"open"}),e.jsx("option",{value:"dismissed",children:"dismissed"}),e.jsx("option",{value:"muted",children:"muted"}),e.jsx("option",{value:"all",children:"all"})]}),e.jsxs("select",{"aria-label":"Filter by category",value:y,onChange:s=>{const n=s.target.value,d=!b||B.some(k=>k.rule_id===b&&(!n||k.category===n));o({category:n,rule:d?b:""})},children:[e.jsx("option",{value:"",children:"all categories"}),((i==null?void 0:i.categories)??[]).map(s=>e.jsx("option",{value:s.key,children:s.title},s.key))]}),e.jsxs("select",{"aria-label":"Filter by rule",value:b,onChange:s=>o({rule:s.target.value}),children:[e.jsx("option",{value:"",children:"all rules"}),B.map(s=>e.jsxs("option",{value:s.rule_id,children:[s.rule_id," (",s.n,")"]},s.rule_id))]}),e.jsxs("select",{"aria-label":"Filter by source",value:$,onChange:s=>o({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),H.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(ae,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:A,onChange:s=>o({project:s}),options:[{value:"",label:"all projects"},...G.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]}),e.jsxs("label",{className:"ctl",children:["from ",e.jsx("input",{type:"date",value:O,onChange:s=>o({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:W,onChange:s=>o({to:s.target.value})})]}),L&&e.jsxs("span",{className:"tag",style:{alignSelf:"center"},children:["session ",L.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>o({session:""}),children:"✕"})]}),Z&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>h(new URLSearchParams),children:"clear filters"})]}),!p&&(u.size>0||m==="open"&&c.total>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[u.size>0&&m!=="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/dismiss",{ids:[...u]})),children:["✓ Mark ",u.size," safe"]}),u.size>0&&m==="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/reopen",{ids:[...u]})),children:["↩ Reopen ",u.size]}),u.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>C(new Set),children:"clear selection"}),m==="open"&&c.total>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:f,onClick:()=>{confirm(`Dismiss all ${c.total} open findings matching the current filter as safe?`)&&g(()=>j("/security/dismiss-matching",{filter:Object.fromEntries(v)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",c.total," matching"]})]}),D&&e.jsx("div",{className:"error",role:"alert",children:D}),K?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):c.findings.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&m==="open"?"No open security findings — nothing risky is awaiting review.":"No findings match these filters."}):e.jsxs("table",{className:"sessions findings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[!p&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:ee,onChange:s=>C(s.target.checked?new Set(z):new Set)})}),e.jsx(R,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Finding"}),e.jsx(R,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Evidence"}),e.jsx(R,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:P}),e.jsx(R,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:P}),!p&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:c.findings.map(s=>e.jsx(de,{f:s,selected:u.has(s.id),onToggle:()=>se(s.id),busy:f,onDismiss:()=>g(()=>j("/security/dismiss",{ids:[s.id]})),onReopen:()=>g(()=>j("/security/reopen",{ids:[s.id]})),onMute:()=>g(()=>j("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!K&&c.total>E&&e.jsx(le,{page:w,pages:Y,total:c.total,unit:"findings",onPage:q}),!p&&S.length>0&&e.jsx(ue,{mutes:S,busy:f,onUnmute:s=>g(()=>j("/security/unmute",{rule_id:s.rule_id,scope:s.scope,scope_id:s.scope_id}))}),i&&i.categories.length>0&&e.jsx(he,{summary:i})]})}function de({f:t,selected:h,onToggle:i,busy:l,onDismiss:c,onReopen:M,onMute:S}){const F=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!p&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:h,onChange:i})}),e.jsxs("td",{children:[e.jsx(oe,{severity:t.severity}),t.dismissed?e.jsx("span",{className:"tag",style:{marginLeft:4},title:t.dismiss_note??"",children:"safe"}):null]}),e.jsxs("td",{children:[e.jsx("div",{className:"finding-title",children:t.title??t.rule_id}),e.jsxs("div",{className:"muted small",children:[e.jsx("code",{children:t.rule_id}),t.framework_ref&&e.jsx("span",{className:"tag framework",style:{marginLeft:6},children:t.framework_ref})]})]}),e.jsx("td",{className:"small",children:t.category}),e.jsxs("td",{className:"finding-evidence-cell",children:[t.tool_name&&e.jsx("span",{className:"tag tool-tag",title:"Tool the finding fired on",children:t.tool_name}),e.jsx("code",{title:t.evidence??"",children:t.evidence})]}),e.jsx("td",{className:"small muted",title:t.started_at??"",children:ne(t.started_at??null)}),e.jsxs("td",{className:"small",children:[e.jsx(re,{to:F,className:"title",children:t.session_title||t.session_id.slice(0,12)}),t.is_sidechain?e.jsx("span",{className:"tag subagent",style:{marginLeft:6},children:"subagent"}):null,t.project_path&&e.jsx("div",{className:"muted path",children:t.project_path.replace(/^.*\//,"")})]}),!p&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:M,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:c,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:S,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function ue({mutes:t,busy:h,onUnmute:i}){return e.jsxs("details",{className:"card muted-rules",children:[e.jsx("summary",{children:e.jsxs("span",{className:"sec-ref-title",children:["Muted rules (",t.length,")"]})}),e.jsx("ul",{className:"muted-rules-list",children:t.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.rule_id}),e.jsxs("span",{className:"tag",style:{marginLeft:6},children:[l.scope,l.scope_id?`: ${l.scope_id}`:""]}),l.note&&e.jsx("span",{className:"muted small",style:{marginLeft:6},children:l.note}),e.jsx("button",{type:"button",className:"linkish",style:{marginLeft:8},disabled:h,onClick:()=>i(l),children:"unmute"})]},`${l.rule_id}:${l.scope}:${l.scope_id}`))})]})}function he({summary:t}){const h=new Map(t.by_category.map(i=>[i.category,i.n]));return e.jsxs("section",{className:"sec-reference",children:[e.jsx("h2",{children:"Risk categories"}),e.jsx("p",{className:"muted small",style:{marginTop:0},children:"What each category means and why it matters, anchored to OWASP Top 10 for Agentic Apps and MITRE ATLAS."}),e.jsx("div",{className:"sec-ref-grid",children:t.categories.map(i=>e.jsxs("details",{className:"card sec-ref",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"sec-ref-title",children:i.title}),e.jsxs("a",{className:"tag framework",href:i.framework_url,target:"_blank",rel:"noreferrer",onClick:l=>l.stopPropagation(),children:[i.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[h.get(i.key)??0," open"]})]}),e.jsxs("dl",{className:"sec-ref-body",children:[e.jsx("dt",{children:"What"}),e.jsx("dd",{children:i.what}),e.jsx("dt",{children:"Why it matters"}),e.jsx("dd",{children:i.why}),e.jsx("dt",{children:"What to do"}),e.jsx("dd",{children:i.remediation})]})]},i.key))})]})}export{ge as default};
|
|
1
|
+
import{a as te,r as a,n as ie,d as N,p,j as e,F as ae,q as j,S as R,P as le,l as ne,L as re}from"./index-BkDuOrzs.js";import{S as ce,a as oe}from"./severity-DkldRG9Z.js";const E=50;function ge(){const[t,h]=te(),[i,l]=a.useState(null),[c,M]=a.useState({total:0,findings:[]}),[S,F]=a.useState([]),[H,V]=a.useState([]),[G,Q]=a.useState([]),[K,U]=a.useState(!0),[D,_]=a.useState(null),[f,I]=a.useState(!1),[w,q]=a.useState(1),[u,C]=a.useState(new Set),[T,J]=a.useState(0),{sort:r,toggle:P}=ie("severity","desc"),x=t.get("severity")??"",y=t.get("category")??"",b=t.get("rule")??"",L=t.get("session")??"",$=t.get("source")??"",A=t.get("project")??"",O=t.get("from")??"",W=t.get("to")??"",m=t.get("status")??"open",v=a.useMemo(()=>{const s=new URLSearchParams;for(const[n,d]of Object.entries({severity:x,category:y,rule:b,session:L,source:$,project:A,from:O,to:W,status:m}))d&&s.set(n,d);return s},[x,y,b,L,$,A,O,W,m]);a.useEffect(()=>{N("/sources").then(V).catch(()=>{}),N("/projects").then(Q).catch(()=>{})},[]),a.useEffect(()=>{N("/security/summary").then(l).catch(()=>{}),p||N("/security/mutes").then(F).catch(()=>{})},[T]),a.useEffect(()=>q(1),[v.toString(),r.key,r.dir]),a.useEffect(()=>C(new Set),[v.toString(),r.key,r.dir,w,T]),a.useEffect(()=>{U(!0),_(null);const s=new URLSearchParams(v);s.set("sort",r.key),s.set("dir",r.dir),s.set("limit",String(E)),s.set("offset",String((w-1)*E)),N("/security/findings?"+s.toString()).then(M).catch(n=>_(String(n))).finally(()=>U(!1))},[v,r.key,r.dir,w,T]);const o=a.useCallback(s=>{const n=new URLSearchParams(t);for(const[d,k]of Object.entries(s))k?n.set(d,k):n.delete(d);h(n)},[t,h]),g=a.useCallback(async s=>{I(!0),_(null);try{await s(),J(n=>n+1)}catch(n){_(String(n))}finally{I(!1)}},[]),X=a.useMemo(()=>new Map(((i==null?void 0:i.by_severity)??[]).map(s=>[s.severity,s.n])),[i]),B=a.useMemo(()=>((i==null?void 0:i.by_rule)??[]).filter(s=>!y||s.category===y),[i,y]),Y=Math.max(1,Math.ceil(c.total/E)),Z=[...v.keys()].some(s=>s!=="status")||m!=="open",z=c.findings.map(s=>s.id),ee=z.length>0&&z.every(s=>u.has(s)),se=s=>C(n=>{const d=new Set(n);return d.has(s)?d.delete(s):d.add(s),d});return e.jsxs("div",{children:[e.jsxs("div",{className:"detail-head",children:[e.jsx("h1",{children:"Security findings"}),e.jsxs("p",{className:"muted",style:{margin:"4px 0 0",maxWidth:760},children:["Risky operations the agent performed, flagged after the fact by deterministic rules over each tool call. Counts show ",e.jsx("strong",{children:"open"})," findings — mark benign ones safe or mute a noisy rule so a real one stands out. agent-lens is retrospective; it surfaces what ",e.jsx("em",{children:"happened"}),", it doesn't block."]})]}),p&&e.jsxs("div",{className:"demo-note",role:"note",children:["📦 This is a static demo over synthetic sessions. Browse the findings and reference below —"," ",e.jsx("strong",{children:"triage"})," (mark safe, mute rules) and live filtering run in the local app on your own data."]}),e.jsxs("div",{className:"kpi-row sev-kpis",role:"group","aria-label":"Open findings by severity",children:[e.jsxs("button",{type:"button",className:"kpi kpi-btn"+(x?"":" is-active"),onClick:()=>o({severity:""}),children:[e.jsx("div",{className:"kpi-label",children:"Open findings"}),e.jsx("div",{className:"kpi-value",children:(i==null?void 0:i.total)??"—"}),e.jsxs("div",{className:"kpi-sub",children:[(i==null?void 0:i.sessions_flagged)??0," sessions flagged"]})]}),ce.map(s=>e.jsxs("button",{type:"button",className:"kpi kpi-btn sev-kpi sev-"+s+(x===s?" is-active":""),onClick:()=>o({severity:x===s?"":s}),"aria-pressed":x===s,children:[e.jsx("div",{className:"kpi-label",children:s}),e.jsx("div",{className:"kpi-value",children:X.get(s)??0})]},s))]}),i&&(i.dismissed>0||i.muted>0)&&e.jsxs("div",{className:"triage-counts muted small",children:[e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"dismissed",severity:""}),children:[i.dismissed," dismissed"]})," · ",e.jsxs("button",{type:"button",className:"linkish",onClick:()=>o({status:"muted",severity:""}),children:[i.muted," muted by rule"]})]}),e.jsxs("div",{className:"filters",children:[e.jsxs("select",{"aria-label":"Filter by status",value:m,onChange:s=>o({status:s.target.value}),children:[e.jsx("option",{value:"open",children:"open"}),e.jsx("option",{value:"dismissed",children:"dismissed"}),e.jsx("option",{value:"muted",children:"muted"}),e.jsx("option",{value:"all",children:"all"})]}),e.jsxs("select",{"aria-label":"Filter by category",value:y,onChange:s=>{const n=s.target.value,d=!b||B.some(k=>k.rule_id===b&&(!n||k.category===n));o({category:n,rule:d?b:""})},children:[e.jsx("option",{value:"",children:"all categories"}),((i==null?void 0:i.categories)??[]).map(s=>e.jsx("option",{value:s.key,children:s.title},s.key))]}),e.jsxs("select",{"aria-label":"Filter by rule",value:b,onChange:s=>o({rule:s.target.value}),children:[e.jsx("option",{value:"",children:"all rules"}),B.map(s=>e.jsxs("option",{value:s.rule_id,children:[s.rule_id," (",s.n,")"]},s.rule_id))]}),e.jsxs("select",{"aria-label":"Filter by source",value:$,onChange:s=>o({source:s.target.value}),children:[e.jsx("option",{value:"",children:"all sources"}),H.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(ae,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:A,onChange:s=>o({project:s}),options:[{value:"",label:"all projects"},...G.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]}),e.jsxs("label",{className:"ctl",children:["from ",e.jsx("input",{type:"date",value:O,onChange:s=>o({from:s.target.value})})]}),e.jsxs("label",{className:"ctl",children:["to ",e.jsx("input",{type:"date",value:W,onChange:s=>o({to:s.target.value})})]}),L&&e.jsxs("span",{className:"tag",style:{alignSelf:"center"},children:["session ",L.slice(0,8),"… ",e.jsx("button",{type:"button",className:"linkish",onClick:()=>o({session:""}),children:"✕"})]}),Z&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>h(new URLSearchParams),children:"clear filters"})]}),!p&&(u.size>0||m==="open"&&c.total>0)&&e.jsxs("div",{className:"triage-bar",role:"group","aria-label":"Triage actions",children:[u.size>0&&m!=="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/dismiss",{ids:[...u]})),children:["✓ Mark ",u.size," safe"]}),u.size>0&&m==="dismissed"&&e.jsxs("button",{type:"button",disabled:f,onClick:()=>g(()=>j("/security/reopen",{ids:[...u]})),children:["↩ Reopen ",u.size]}),u.size>0&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>C(new Set),children:"clear selection"}),m==="open"&&c.total>0&&e.jsxs("button",{type:"button",className:"ghost",disabled:f,onClick:()=>{confirm(`Dismiss all ${c.total} open findings matching the current filter as safe?`)&&g(()=>j("/security/dismiss-matching",{filter:Object.fromEntries(v)}))},title:"Mark every open finding matching the current filter as safe",children:["Dismiss all ",c.total," matching"]})]}),D&&e.jsx("div",{className:"error",role:"alert",children:D}),K?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):c.findings.length===0?e.jsx("div",{className:"muted pad",role:"status",children:i&&i.total===0&&m==="open"?"No open security findings — nothing risky is awaiting review.":"No findings match these filters."}):e.jsxs("table",{className:"sessions findings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[!p&&e.jsx("th",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select all on this page",checked:ee,onChange:s=>C(s.target.checked?new Set(z):new Set)})}),e.jsx(R,{label:"Severity",sortKey:"severity",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Finding"}),e.jsx(R,{label:"Category",sortKey:"category",active:r.key,dir:r.dir,onSort:P}),e.jsx("th",{children:"Evidence"}),e.jsx(R,{label:"When",sortKey:"time",active:r.key,dir:r.dir,onSort:P}),e.jsx(R,{label:"Session",sortKey:"session",active:r.key,dir:r.dir,onSort:P}),!p&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:c.findings.map(s=>e.jsx(de,{f:s,selected:u.has(s.id),onToggle:()=>se(s.id),busy:f,onDismiss:()=>g(()=>j("/security/dismiss",{ids:[s.id]})),onReopen:()=>g(()=>j("/security/reopen",{ids:[s.id]})),onMute:()=>g(()=>j("/security/mute",{rule_id:s.rule_id,scope:"global"}))},s.id))})]}),!K&&c.total>E&&e.jsx(le,{page:w,pages:Y,total:c.total,unit:"findings",onPage:q}),!p&&S.length>0&&e.jsx(ue,{mutes:S,busy:f,onUnmute:s=>g(()=>j("/security/unmute",{rule_id:s.rule_id,scope:s.scope,scope_id:s.scope_id}))}),i&&i.categories.length>0&&e.jsx(he,{summary:i})]})}function de({f:t,selected:h,onToggle:i,busy:l,onDismiss:c,onReopen:M,onMute:S}){const F=`/session/${t.session_id}${t.event_uuid?`#ev-${t.event_uuid}`:""}`;return e.jsxs("tr",{className:t.dismissed?"is-dismissed":"",children:[!p&&e.jsx("td",{className:"check-col",children:e.jsx("input",{type:"checkbox","aria-label":"Select finding",checked:h,onChange:i})}),e.jsxs("td",{children:[e.jsx(oe,{severity:t.severity}),t.dismissed?e.jsx("span",{className:"tag",style:{marginLeft:4},title:t.dismiss_note??"",children:"safe"}):null]}),e.jsxs("td",{children:[e.jsx("div",{className:"finding-title",children:t.title??t.rule_id}),e.jsxs("div",{className:"muted small",children:[e.jsx("code",{children:t.rule_id}),t.framework_ref&&e.jsx("span",{className:"tag framework",style:{marginLeft:6},children:t.framework_ref})]})]}),e.jsx("td",{className:"small",children:t.category}),e.jsxs("td",{className:"finding-evidence-cell",children:[t.tool_name&&e.jsx("span",{className:"tag tool-tag",title:"Tool the finding fired on",children:t.tool_name}),e.jsx("code",{title:t.evidence??"",children:t.evidence})]}),e.jsx("td",{className:"small muted",title:t.started_at??"",children:ne(t.started_at??null)}),e.jsxs("td",{className:"small",children:[e.jsx(re,{to:F,className:"title",children:t.session_title||t.session_id.slice(0,12)}),t.is_sidechain?e.jsx("span",{className:"tag subagent",style:{marginLeft:6},children:"subagent"}):null,t.project_path&&e.jsx("div",{className:"muted path",children:t.project_path.replace(/^.*\//,"")})]}),!p&&e.jsxs("td",{className:"finding-actions small",children:[t.dismissed?e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:M,children:"reopen"}):e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:c,children:"safe"}),e.jsx("button",{type:"button",className:"linkish",disabled:l,onClick:S,title:`Mute rule ${t.rule_id} everywhere`,children:"mute rule"})]})]})}function ue({mutes:t,busy:h,onUnmute:i}){return e.jsxs("details",{className:"card muted-rules",children:[e.jsx("summary",{children:e.jsxs("span",{className:"sec-ref-title",children:["Muted rules (",t.length,")"]})}),e.jsx("ul",{className:"muted-rules-list",children:t.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.rule_id}),e.jsxs("span",{className:"tag",style:{marginLeft:6},children:[l.scope,l.scope_id?`: ${l.scope_id}`:""]}),l.note&&e.jsx("span",{className:"muted small",style:{marginLeft:6},children:l.note}),e.jsx("button",{type:"button",className:"linkish",style:{marginLeft:8},disabled:h,onClick:()=>i(l),children:"unmute"})]},`${l.rule_id}:${l.scope}:${l.scope_id}`))})]})}function he({summary:t}){const h=new Map(t.by_category.map(i=>[i.category,i.n]));return e.jsxs("section",{className:"sec-reference",children:[e.jsx("h2",{children:"Risk categories"}),e.jsx("p",{className:"muted small",style:{marginTop:0},children:"What each category means and why it matters, anchored to OWASP Top 10 for Agentic Apps and MITRE ATLAS."}),e.jsx("div",{className:"sec-ref-grid",children:t.categories.map(i=>e.jsxs("details",{className:"card sec-ref",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"sec-ref-title",children:i.title}),e.jsxs("a",{className:"tag framework",href:i.framework_url,target:"_blank",rel:"noreferrer",onClick:l=>l.stopPropagation(),children:[i.framework_ref," ↗"]}),e.jsxs("span",{className:"muted small",children:[h.get(i.key)??0," open"]})]}),e.jsxs("dl",{className:"sec-ref-body",children:[e.jsx("dt",{children:"What"}),e.jsx("dd",{children:i.what}),e.jsx("dt",{children:"Why it matters"}),e.jsx("dd",{children:i.why}),e.jsx("dt",{children:"What to do"}),e.jsx("dd",{children:i.remediation})]})]},i.key))})]})}export{ge as default};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{i as cs,k as ds,r as m,d as us,j as s,L as y,h as H,t as ms,f as W,e as C,l as D,m as hs,s as Q}from"./index-B_beFRjy.js";import{C as b,p as v}from"./CopyButton-CQ5SHT0Q.js";import{S as O,a as V}from"./severity-TiQaFcLQ.js";import{M as ps,r as xs}from"./index-CM-5HLoq.js";const K=m.createContext("markdown"),Y=m.createContext(new Map),z=m.createContext(!1),G=m.createContext(null),X="agentlens.msgFormat";function fs(){try{return localStorage.getItem(X)==="raw"?"raw":"markdown"}catch{return"markdown"}}const Z="agentlens.hideTools";function js(){try{return localStorage.getItem(Z)==="1"}catch{return!1}}function gs({c:e}){var o;const[n,t]=m.useState(!1),l=m.useId(),a=(o=e.signals)==null?void 0:o.loc;return s.jsxs("div",{className:"classification",children:[s.jsx("span",{className:"tag cat cat-"+(e.category??"none"),children:e.category??"unclassified"}),e.complexity_band&&s.jsxs("span",{className:"tag complexity",children:[e.complexity_band," · ",e.complexity_score]}),a&&s.jsxs("span",{className:"muted small",children:["+",a.added,"/−",a.removed," LoC · ",a.files," files"]}),s.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(r=>!r),children:["why ",n?"▾":"▸"]}),n&&(e.signals?s.jsx(ws,{id:l,s:e.signals,category:e.category}):s.jsx("div",{id:l,className:"muted small pad",children:"No signals recorded for this session."}))]})}const Ns={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},L=e=>`${Math.max(0,Math.min(1,e))*100}%`;function R({counts:e}){const n=Object.entries(e).sort((t,l)=>l[1]-t[1]);return n.length===0?s.jsx("span",{className:"muted",children:"—"}):s.jsx("span",{className:"sig-chips",children:n.map(([t,l])=>s.jsxs("span",{className:"sig-chip",children:[t," ",s.jsxs("span",{className:"muted",children:["×",l]})]},t))})}function ws({id:e,s:n,category:t}){const[l,a]=m.useState(!1),o=m.useId(),r=n.complexity_weights??{},i=n.complexity_subscores??{},c=Object.keys(r).map(d=>({key:d,weight:r[d],subscore:i[d]??0,pts:r[d]*(i[d]??0)*100})).sort((d,_)=>_.pts-d.pts),u=Math.max(...c.map(d=>d.pts),1e-4),p=Object.entries(n.category_scores??{}).map(([d,_])=>({k:d,v:_})).sort((d,_)=>_.v-d.v),f=Math.max(...p.map(d=>d.v),1e-4),x=p.filter(d=>d.v>.02||d.k===t),g=n.skills&&Object.keys(n.skills).length>0;return s.jsxs("div",{id:e,className:"signals-panel",children:[c.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Complexity breakdown ",s.jsx("span",{className:"muted",children:"— what built the score"})]}),s.jsx("ul",{className:"sig-bars",children:c.map(d=>s.jsxs("li",{className:"sig-bar-row",children:[s.jsx("span",{className:"sig-bar-label",children:Ns[d.key]??d.key}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.pts/u)}})}),s.jsxs("span",{className:"sig-bar-val",children:[d.pts.toFixed(1)," pts"]}),s.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(d.subscore*100),"% intensity · weight ",Math.round(d.weight*100),"%"]})]},d.key))})]}),x.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Category scores ",s.jsxs("span",{className:"muted",children:["— why “",t,"” won"]})]}),s.jsx("ul",{className:"sig-bars",children:x.map(d=>s.jsxs("li",{className:"sig-bar-row"+(d.k===t?" is-win":""),children:[s.jsx("span",{className:"sig-bar-label",children:d.k}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.v/f)}})}),s.jsx("span",{className:"sig-bar-val",children:d.v.toFixed(2)})]},d.k))})]}),s.jsxs("section",{className:"sig-section",children:[s.jsx("h4",{className:"sig-h",children:"Evidence"}),s.jsxs("dl",{className:"sig-grid",children:[n.tool_counts&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Tools"}),s.jsx("dd",{children:s.jsx(R,{counts:n.tool_counts})})]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Skills"}),s.jsx("dd",{children:s.jsx(R,{counts:n.skills})})]}),n.subagent_role&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Subagent role"}),s.jsx("dd",{children:n.subagent_role})]}),n.files&&n.files.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("dt",{children:["Files (",n.files.length,")"]}),s.jsx("dd",{className:"sig-files",children:n.files.join(", ")})]})]})]}),s.jsx("button",{className:"ghost small","aria-expanded":l,"aria-controls":o,onClick:()=>a(d=>!d),children:l?"Hide raw JSON ▴":"View raw JSON ▾"}),l&&s.jsx("pre",{id:o,className:"code signals",children:JSON.stringify(n,null,2)})]})}function _s({f:e}){var r;const[n,t]=m.useState(!1),l=m.useId(),a=((r=e.signals)==null?void 0:r.modifiers)??{},o=Object.keys(a).filter(i=>a[i]!==!1&&a[i]!=null&&a[i]!=="");return s.jsxs("div",{className:"finding sev-border-"+e.severity,children:[s.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":l,onClick:()=>t(i=>!i),children:[s.jsx(V,{severity:e.severity}),s.jsx("span",{className:"finding-title",children:e.title??e.rule_id}),e.framework_ref&&s.jsx("span",{className:"tag framework",children:e.framework_ref}),s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&s.jsxs("div",{className:"finding-body",id:l,children:[e.evidence&&s.jsx("div",{className:"code-block",children:s.jsx("pre",{className:"code finding-evidence",children:e.evidence})}),s.jsxs("dl",{className:"sig-grid",children:[s.jsx("dt",{children:"Rule"}),s.jsx("dd",{children:s.jsx("code",{children:e.rule_id})}),s.jsx("dt",{children:"Category"}),s.jsx("dd",{children:e.category}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Context"}),s.jsx("dd",{children:o.map(i=>s.jsxs("span",{className:"sig-chip",children:[i,a[i]!==!0?s.jsxs("span",{className:"muted",children:[" ",String(a[i])]}):null]},i))})]})]}),s.jsxs(y,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(e.rule_id)}`,children:["see all “",e.rule_id,"” findings →"]})]})]})}function ks({findings:e}){if(!e.length)return null;const n=[...e].sort((t,l)=>O.indexOf(t.severity)-O.indexOf(l.severity));return s.jsx("div",{className:"tool-findings",children:n.map(t=>s.jsx(_s,{f:t},t.id))})}function ys({findings:e,sessionId:n}){const t=new Map;for(const a of e)t.set(a.severity,(t.get(a.severity)??0)+1);const l=O.find(a=>t.has(a))??"info";return s.jsxs("div",{className:"security-banner sev-border-"+l,role:"status",children:[s.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),s.jsxs("span",{className:"security-banner-text",children:[e.length," security ",e.length===1?"finding":"findings"," in this session"]}),s.jsx("span",{className:"security-banner-sevs",children:O.filter(a=>t.has(a)).map(a=>s.jsx(V,{severity:a,count:t.get(a)},a))}),s.jsx(y,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function ss({t:e}){const[n,t]=m.useState(!1),[l,a]=m.useState(!1),o=m.useId(),r=e.skill_name?`Skill · ${e.skill_name}`:e.tool_name==="Workflow"&&e.workflow_name?`Workflow · ${e.workflow_name}`:e.agent_type?`${e.tool_name} → ${e.agent_type}`:e.tool_name;return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":n,"aria-controls":o,onClick:()=>t(i=>!i),children:[s.jsxs("span",{className:"tool-name",children:["🔧 ",r]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),e.spawned_session_id&&s.jsx(y,{className:"subagent-link small",to:`/session/${e.spawned_session_id}`,children:"view subagent transcript →"}),e.workflow_run_id&&s.jsxs(y,{className:"subagent-link small",to:`/workflow/${e.workflow_run_id}`,children:["🔀 launched ",e.workflow_agent_count??0," agent",e.workflow_agent_count===1?"":"s"," · ",s.jsx("code",{children:e.workflow_run_id})," →"]}),e.skill_name&&s.jsxs(y,{className:"subagent-link small",to:`/skill/${encodeURIComponent(e.skill_name)}${e.skill_id?`?v=${e.skill_id}`:""}`,children:["📖 view skill",e.skill_id?" version":""," →"]}),n&&s.jsxs("div",{className:"tool-body",id:o,children:[e.input_json&&e.input_json!=="{}"&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:v(e.input_json),className:"copy-corner",title:"Copy tool input JSON"}),s.jsx("pre",{className:"code",children:v(e.input_json)})]}),e.result_summary&&s.jsx("div",{className:"result",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":l,onClick:()=>a(i=>!i),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]})]})]})}function es(e){if(!e)return null;try{const n=JSON.parse(e).plan;return typeof n=="string"&&n.trim()?n:null}catch{return null}}function vs({plan:e}){return s.jsxs("div",{className:"plan-card",children:[s.jsx("div",{className:"plan-card-head",children:"📋 Approved plan"}),s.jsx(as,{text:e})]})}function bs(e){if(!e)return[];try{const n=JSON.parse(e).questions;return Array.isArray(n)?n:[]}catch{return[]}}function Ss(e){if(!e)return{answers:{},annotations:{}};try{const n=JSON.parse(e);if(n&&typeof n=="object"&&n.answers)return{answers:n.answers,annotations:n.annotations??{}}}catch{}return{answers:{},annotations:{}}}function Cs({t:e}){const[n,t]=m.useState(!1),l=m.useId(),a=bs(e.input_json),{answers:o,annotations:r}=Ss(e.result_summary);return a.length===0?s.jsx(ss,{t:e}):s.jsxs("div",{className:"qa-card",children:[s.jsxs("div",{className:"qa-card-head",children:["🙋 Question",a.length===1?"":"s"," for the user"]}),a.map((i,c)=>{var _;const u=o[i.question],p=Array.isArray(u)?u:u!=null?[u]:[],f=new Set(p),x=new Set(i.options.map(w=>w.label)),g=p.filter(w=>!x.has(w)),d=(_=r[i.question])==null?void 0:_.notes;return s.jsxs("div",{className:"qa-q",children:[s.jsxs("div",{className:"qa-q-head",children:[i.header&&s.jsx("span",{className:"tag",children:i.header}),i.multiSelect&&s.jsx("span",{className:"muted small",children:"multi-select"})]}),s.jsx("div",{className:"qa-question",children:i.question}),s.jsxs("ul",{className:"qa-options",children:[i.options.map((w,S)=>{const N=f.has(w.label);return s.jsxs("li",{className:"qa-opt"+(N?" is-selected":""),children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:N?"☑":"☐"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w.label}),w.description&&s.jsx("span",{className:"qa-opt-desc muted",children:w.description})]})]},S)}),g.map((w,S)=>s.jsxs("li",{className:"qa-opt is-selected",children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:"☑"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w}),s.jsx("span",{className:"qa-opt-desc muted",children:"custom answer"})]})]},"c"+S))]}),d&&s.jsxs("div",{className:"qa-note",children:["📝 ",d]})]},c)}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(i=>!i),children:n?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(b,{text:v(e.input_json??"{}")+(e.result_summary?`
|
|
1
|
+
import{i as cs,k as ds,r as m,d as us,j as s,L as y,h as H,t as ms,f as W,e as C,l as D,m as hs,s as Q}from"./index-BkDuOrzs.js";import{C as b,p as v}from"./CopyButton-XWWtxa5T.js";import{S as O,a as V}from"./severity-DkldRG9Z.js";import{M as ps,r as xs}from"./index-T6SPgI6b.js";const K=m.createContext("markdown"),Y=m.createContext(new Map),z=m.createContext(!1),G=m.createContext(null),X="agentlens.msgFormat";function fs(){try{return localStorage.getItem(X)==="raw"?"raw":"markdown"}catch{return"markdown"}}const Z="agentlens.hideTools";function js(){try{return localStorage.getItem(Z)==="1"}catch{return!1}}function gs({c:e}){var o;const[n,t]=m.useState(!1),l=m.useId(),a=(o=e.signals)==null?void 0:o.loc;return s.jsxs("div",{className:"classification",children:[s.jsx("span",{className:"tag cat cat-"+(e.category??"none"),children:e.category??"unclassified"}),e.complexity_band&&s.jsxs("span",{className:"tag complexity",children:[e.complexity_band," · ",e.complexity_score]}),a&&s.jsxs("span",{className:"muted small",children:["+",a.added,"/−",a.removed," LoC · ",a.files," files"]}),s.jsxs("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(i=>!i),children:["why ",n?"▾":"▸"]}),n&&(e.signals?s.jsx(ws,{id:l,s:e.signals,category:e.category}):s.jsx("div",{id:l,className:"muted small pad",children:"No signals recorded for this session."}))]})}const Ns={loc:"Lines changed",files:"Files touched",turns:"Turns",tokens:"Work tokens",duration:"Duration",subagents:"Subagents"},L=e=>`${Math.max(0,Math.min(1,e))*100}%`;function R({counts:e}){const n=Object.entries(e).sort((t,l)=>l[1]-t[1]);return n.length===0?s.jsx("span",{className:"muted",children:"—"}):s.jsx("span",{className:"sig-chips",children:n.map(([t,l])=>s.jsxs("span",{className:"sig-chip",children:[t," ",s.jsxs("span",{className:"muted",children:["×",l]})]},t))})}function ws({id:e,s:n,category:t}){const[l,a]=m.useState(!1),o=m.useId(),i=n.complexity_weights??{},r=n.complexity_subscores??{},c=Object.keys(i).map(d=>({key:d,weight:i[d],subscore:r[d]??0,pts:i[d]*(r[d]??0)*100})).sort((d,_)=>_.pts-d.pts),u=Math.max(...c.map(d=>d.pts),1e-4),p=Object.entries(n.category_scores??{}).map(([d,_])=>({k:d,v:_})).sort((d,_)=>_.v-d.v),j=Math.max(...p.map(d=>d.v),1e-4),x=p.filter(d=>d.v>.02||d.k===t),N=n.skills&&Object.keys(n.skills).length>0;return s.jsxs("div",{id:e,className:"signals-panel",children:[c.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Complexity breakdown ",s.jsx("span",{className:"muted",children:"— what built the score"})]}),s.jsx("ul",{className:"sig-bars",children:c.map(d=>s.jsxs("li",{className:"sig-bar-row",children:[s.jsx("span",{className:"sig-bar-label",children:Ns[d.key]??d.key}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.pts/u)}})}),s.jsxs("span",{className:"sig-bar-val",children:[d.pts.toFixed(1)," pts"]}),s.jsxs("span",{className:"sig-bar-sub muted",children:[Math.round(d.subscore*100),"% intensity · weight ",Math.round(d.weight*100),"%"]})]},d.key))})]}),x.length>0&&s.jsxs("section",{className:"sig-section",children:[s.jsxs("h4",{className:"sig-h",children:["Category scores ",s.jsxs("span",{className:"muted",children:["— why “",t,"” won"]})]}),s.jsx("ul",{className:"sig-bars",children:x.map(d=>s.jsxs("li",{className:"sig-bar-row"+(d.k===t?" is-win":""),children:[s.jsx("span",{className:"sig-bar-label",children:d.k}),s.jsx("span",{className:"sig-bar","aria-hidden":"true",children:s.jsx("span",{className:"sig-bar-fill",style:{width:L(d.v/j)}})}),s.jsx("span",{className:"sig-bar-val",children:d.v.toFixed(2)})]},d.k))})]}),s.jsxs("section",{className:"sig-section",children:[s.jsx("h4",{className:"sig-h",children:"Evidence"}),s.jsxs("dl",{className:"sig-grid",children:[n.tool_counts&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Tools"}),s.jsx("dd",{children:s.jsx(R,{counts:n.tool_counts})})]}),N&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Skills"}),s.jsx("dd",{children:s.jsx(R,{counts:n.skills})})]}),n.subagent_role&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Subagent role"}),s.jsx("dd",{children:n.subagent_role})]}),n.files&&n.files.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("dt",{children:["Files (",n.files.length,")"]}),s.jsx("dd",{className:"sig-files",children:n.files.join(", ")})]})]})]}),s.jsx("button",{className:"ghost small","aria-expanded":l,"aria-controls":o,onClick:()=>a(d=>!d),children:l?"Hide raw JSON ▴":"View raw JSON ▾"}),l&&s.jsx("pre",{id:o,className:"code signals",children:JSON.stringify(n,null,2)})]})}function _s({f:e}){var i;const[n,t]=m.useState(!1),l=m.useId(),a=((i=e.signals)==null?void 0:i.modifiers)??{},o=Object.keys(a).filter(r=>a[r]!==!1&&a[r]!=null&&a[r]!=="");return s.jsxs("div",{className:"finding sev-border-"+e.severity,children:[s.jsxs("button",{className:"finding-head","aria-expanded":n,"aria-controls":l,onClick:()=>t(r=>!r),children:[s.jsx(V,{severity:e.severity}),s.jsx("span",{className:"finding-title",children:e.title??e.rule_id}),e.framework_ref&&s.jsx("span",{className:"tag framework",children:e.framework_ref}),s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),n&&s.jsxs("div",{className:"finding-body",id:l,children:[e.evidence&&s.jsx("div",{className:"code-block",children:s.jsx("pre",{className:"code finding-evidence",children:e.evidence})}),s.jsxs("dl",{className:"sig-grid",children:[s.jsx("dt",{children:"Rule"}),s.jsx("dd",{children:s.jsx("code",{children:e.rule_id})}),s.jsx("dt",{children:"Category"}),s.jsx("dd",{children:e.category}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Context"}),s.jsx("dd",{children:o.map(r=>s.jsxs("span",{className:"sig-chip",children:[r,a[r]!==!0?s.jsxs("span",{className:"muted",children:[" ",String(a[r])]}):null]},r))})]})]}),s.jsxs(y,{className:"subagent-link small",to:`/security?rule=${encodeURIComponent(e.rule_id)}`,children:["see all “",e.rule_id,"” findings →"]})]})]})}function ks({findings:e}){if(!e.length)return null;const n=[...e].sort((t,l)=>O.indexOf(t.severity)-O.indexOf(l.severity));return s.jsx("div",{className:"tool-findings",children:n.map(t=>s.jsx(_s,{f:t},t.id))})}function ys({findings:e,sessionId:n}){const t=new Map;for(const a of e)t.set(a.severity,(t.get(a.severity)??0)+1);const l=O.find(a=>t.has(a))??"info";return s.jsxs("div",{className:"security-banner sev-border-"+l,role:"status",children:[s.jsx("span",{className:"security-banner-icon","aria-hidden":"true",children:"🛡"}),s.jsxs("span",{className:"security-banner-text",children:[e.length," security ",e.length===1?"finding":"findings"," in this session"]}),s.jsx("span",{className:"security-banner-sevs",children:O.filter(a=>t.has(a)).map(a=>s.jsx(V,{severity:a,count:t.get(a)},a))}),s.jsx(y,{className:"subagent-link small",to:`/security?session=${encodeURIComponent(n)}`,children:"view on Security page →"})]})}function ss({t:e}){const[n,t]=m.useState(!1),[l,a]=m.useState(!1),o=m.useId(),i=e.skill_name?`Skill · ${e.skill_name}`:e.tool_name==="Workflow"&&e.workflow_name?`Workflow · ${e.workflow_name}`:e.agent_type?`${e.tool_name} → ${e.agent_type}`:e.tool_name;return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":n,"aria-controls":o,onClick:()=>t(r=>!r),children:[s.jsxs("span",{className:"tool-name",children:["🔧 ",i]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:n?"▾":"▸"})]}),e.spawned_session_id&&s.jsx(y,{className:"subagent-link small",to:`/session/${e.spawned_session_id}`,children:"view subagent transcript →"}),e.workflow_run_id&&s.jsxs(y,{className:"subagent-link small",to:`/workflow/${e.workflow_run_id}`,children:["🔀 launched ",e.workflow_agent_count??0," agent",e.workflow_agent_count===1?"":"s"," · ",s.jsx("code",{children:e.workflow_run_id})," →"]}),e.skill_name&&s.jsxs(y,{className:"subagent-link small",to:`/skill/${encodeURIComponent(e.skill_name)}${e.skill_id?`?v=${e.skill_id}`:""}`,children:["📖 view skill",e.skill_id?" version":""," →"]}),n&&s.jsxs("div",{className:"tool-body",id:o,children:[e.input_json&&e.input_json!=="{}"&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:v(e.input_json),className:"copy-corner",title:"Copy tool input JSON"}),s.jsx("pre",{className:"code",children:v(e.input_json)})]}),e.result_summary&&s.jsx("div",{className:"result",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":l,onClick:()=>a(r=>!r),children:[l?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),l&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]})]})]})}function es(e){if(!e)return null;try{const n=JSON.parse(e).plan;return typeof n=="string"&&n.trim()?n:null}catch{return null}}function vs({plan:e}){return s.jsxs("div",{className:"plan-card",children:[s.jsx("div",{className:"plan-card-head",children:"📋 Approved plan"}),s.jsx(as,{text:e})]})}function bs(e){if(!e)return[];try{const n=JSON.parse(e).questions;return Array.isArray(n)?n:[]}catch{return[]}}function Ss(e){if(!e)return{answers:{},annotations:{}};try{const n=JSON.parse(e);if(n&&typeof n=="object"&&n.answers)return{answers:n.answers,annotations:n.annotations??{}}}catch{}return{answers:{},annotations:{}}}function Cs({t:e}){const[n,t]=m.useState(!1),l=m.useId(),a=bs(e.input_json),{answers:o,annotations:i}=Ss(e.result_summary);return a.length===0?s.jsx(ss,{t:e}):s.jsxs("div",{className:"qa-card",children:[s.jsxs("div",{className:"qa-card-head",children:["🙋 Question",a.length===1?"":"s"," for the user"]}),a.map((r,c)=>{var _;const u=o[r.question],p=Array.isArray(u)?u:u!=null?[u]:[],j=new Set(p),x=new Set(r.options.map(w=>w.label)),N=p.filter(w=>!x.has(w)),d=(_=i[r.question])==null?void 0:_.notes;return s.jsxs("div",{className:"qa-q",children:[s.jsxs("div",{className:"qa-q-head",children:[r.header&&s.jsx("span",{className:"tag",children:r.header}),r.multiSelect&&s.jsx("span",{className:"muted small",children:"multi-select"})]}),s.jsx("div",{className:"qa-question",children:r.question}),s.jsxs("ul",{className:"qa-options",children:[r.options.map((w,S)=>{const f=j.has(w.label);return s.jsxs("li",{className:"qa-opt"+(f?" is-selected":""),children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:f?"☑":"☐"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w.label}),w.description&&s.jsx("span",{className:"qa-opt-desc muted",children:w.description})]})]},S)}),N.map((w,S)=>s.jsxs("li",{className:"qa-opt is-selected",children:[s.jsx("span",{className:"qa-mark","aria-hidden":"true",children:"☑"}),s.jsxs("span",{className:"qa-opt-body",children:[s.jsx("span",{className:"qa-opt-label",children:w}),s.jsx("span",{className:"qa-opt-desc muted",children:"custom answer"})]})]},"c"+S))]}),d&&s.jsxs("div",{className:"qa-note",children:["📝 ",d]})]},c)}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":n,"aria-controls":l,onClick:()=>t(r=>!r),children:n?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(b,{text:v(e.input_json??"{}")+(e.result_summary?`
|
|
2
2
|
|
|
3
3
|
`+v(e.result_summary):""),label:"JSON",title:"Copy raw question JSON"})]}),n&&s.jsxs("pre",{id:l,className:"code",children:[v(e.input_json??"{}"),e.result_summary?`
|
|
4
4
|
|
|
5
|
-
`+v(e.result_summary):""]})]})}function Is({t:e}){const n=e.workflow_name?`Workflow · ${e.workflow_name}`:"Workflow";return s.jsxs("div",{className:"tool launch-tool",children:[s.jsxs("div",{className:"launch-tool-head",children:[s.jsxs("span",{className:"tool-name",children:["🔀 ",n]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status})]}),e.workflow_run_id&&s.jsxs(y,{className:"subagent-link small",to:`/workflow/${e.workflow_run_id}`,children:["🔀 launched ",e.workflow_agent_count??0," agent",e.workflow_agent_count===1?"":"s"," · ",s.jsx("code",{children:e.workflow_run_id})," →"]}),e.result_summary&&s.jsx("div",{className:"result",children:e.result_summary})]})}function Os(e){if(!e)return null;try{const n=JSON.parse(e);if(!n||typeof n!="object")return null;const t=typeof n.command=="string"?n.command:"";return t.trim()?{command:t,description:typeof n.description=="string"?n.description:void 0,timeout:typeof n.timeout=="number"?n.timeout:void 0,run_in_background:n.run_in_background===!0,restart:n.restart===!0}:null}catch{return null}}function J(e,n,t){let l=n+2,a=!1;for(e[l]==="-"&&(a=!0,l++);e[l]===" "||e[l]===" ";)l++;let o="";(e[l]==="'"||e[l]==='"')&&(o=e[l],l++);let
|
|
6
|
-
`),t=[];let l="NORMAL",a=0;const o=[];let
|
|
7
|
-
`)[0],
|
|
8
|
-
`:""]},
|
|
5
|
+
`+v(e.result_summary):""]})]})}function Is({t:e}){const n=e.workflow_name?`Workflow · ${e.workflow_name}`:"Workflow";return s.jsxs("div",{className:"tool launch-tool",children:[s.jsxs("div",{className:"launch-tool-head",children:[s.jsxs("span",{className:"tool-name",children:["🔀 ",n]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status})]}),e.workflow_run_id&&s.jsxs(y,{className:"subagent-link small",to:`/workflow/${e.workflow_run_id}`,children:["🔀 launched ",e.workflow_agent_count??0," agent",e.workflow_agent_count===1?"":"s"," · ",s.jsx("code",{children:e.workflow_run_id})," →"]}),e.result_summary&&s.jsx("div",{className:"result",children:e.result_summary})]})}function Os(e){if(!e)return null;try{const n=JSON.parse(e);if(!n||typeof n!="object")return null;const t=typeof n.command=="string"?n.command:"";return t.trim()?{command:t,description:typeof n.description=="string"?n.description:void 0,timeout:typeof n.timeout=="number"?n.timeout:void 0,run_in_background:n.run_in_background===!0,restart:n.restart===!0}:null}catch{return null}}function J(e,n,t){let l=n+2,a=!1;for(e[l]==="-"&&(a=!0,l++);e[l]===" "||e[l]===" ";)l++;let o="";(e[l]==="'"||e[l]==='"')&&(o=e[l],l++);let i="";if(o){for(;l<e.length&&e[l]!==o;)i+=e[l++];e[l]===o&&l++}else for(;l<e.length&&/[A-Za-z0-9_]/.test(e[l]);)i+=e[l++];return i&&t.push({delim:i,strip:a}),l-1}function Ts(e){const n=e.split(`
|
|
6
|
+
`),t=[];let l="NORMAL",a=0;const o=[];let i=!1;for(const r of n){if(o.length>0){t.push({text:r,cont:!0});const c=o[0];(c.strip?r.replace(/^\t+/,""):r).trimEnd()===c.delim&&o.shift();continue}t.push({text:r,cont:l!=="NORMAL"||a>0||i}),i=!1;for(let c=0;c<r.length;c++){const u=r[c];if(l==="SQUOTE"){u==="'"&&(l="NORMAL");continue}if(l==="DQUOTE"){u==="\\"?c++:u==='"'?l="NORMAL":u==="$"&&r[c+1]==="("?(a++,c++):u===")"?a>0&&a--:u==="<"&&r[c+1]==="<"&&r[c+2]!=="<"&&(c=J(r,c,o));continue}if(u==="\\")c++;else if(u==="'")l="SQUOTE";else if(u==='"')l="DQUOTE";else{if(u==="#"&&(c===0||/\s/.test(r[c-1])))break;u==="$"&&r[c+1]==="("?(a++,c++):u==="("?a++:u===")"?a>0&&a--:u==="<"&&r[c+1]==="<"&&r[c+2]!=="<"&&(c=J(r,c,o))}}if(l==="NORMAL"&&a===0&&o.length===0){const c=r.replace(/\s+$/,""),u=c.match(/\\+$/);(u&&u[0].length%2===1||/(&&|\|\||\|)$/.test(c))&&(i=!0)}}return t}function Es({t:e,bash:n}){const[t,l]=m.useState(!1),[a,o]=m.useState(!1),[i,r]=m.useState(!1),c=m.useId(),u=m.useId(),p=n.command.split(`
|
|
7
|
+
`)[0],j=Ts(n.command);return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":t,"aria-controls":c,onClick:()=>l(x=>!x),children:[s.jsx("span",{className:"tool-name",children:"🖥 Bash"}),n.description?s.jsxs("span",{className:"bash-desc",children:["# ",n.description]}):!t&&s.jsx("span",{className:"bash-preview",children:p}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:t?"▾":"▸"})]}),t&&s.jsxs("div",{className:"tool-body",id:c,children:[s.jsxs("div",{className:"shell code-block",children:[s.jsx(b,{text:n.command,className:"copy-corner",title:"Copy command"}),s.jsx("pre",{className:"shell-cmd",children:j.map((x,N)=>s.jsxs("span",{children:[s.jsx("span",{className:"shell-gutter"+(x.cont?" cont":""),"aria-hidden":"true",children:x.cont?" ":"$ "}),x.text,N<j.length-1?`
|
|
8
|
+
`:""]},N))})]}),(n.run_in_background||n.restart||n.timeout!=null)&&s.jsxs("div",{className:"bash-badges",children:[n.run_in_background&&s.jsx("span",{className:"bash-badge",children:"background"}),n.restart&&s.jsx("span",{className:"bash-badge",children:"restart"}),n.timeout!=null&&s.jsxs("span",{className:"bash-badge",children:["timeout ",Math.round(n.timeout/1e3),"s"]})]}),e.result_summary&&s.jsx("pre",{className:"shell-out",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":a,onClick:()=>o(x=>!x),children:[a?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),a&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":i,"aria-controls":u,onClick:()=>r(x=>!x),children:i?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(b,{text:v(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),i&&s.jsx("pre",{id:u,className:"code",children:v(e.input_json??"{}")})]})]})}function P(e,n){const t=e===""?[]:e.split(`
|
|
9
9
|
`),l=n===""?[]:n.split(`
|
|
10
|
-
`),a=t.length,o=l.length;if(a*o>25e4)return[...t.map(p=>({type:"del",text:p})),...l.map(p=>({type:"add",text:p}))];const
|
|
11
|
-
`).map(
|
|
12
|
-
`).length>18,[t,l]=m.useState(!1),a=m.useId();return n?s.jsxs("div",{className:"text-wrap"+(t?"":" is-clamped"),children:[s.jsx(U,{text:e,id:a}),s.jsx("button",{className:"ghost small show-more","aria-expanded":t,"aria-controls":a,onClick:()=>l(o=>!o),children:t?"Show less ▴":"Show more ▾"})]}):s.jsx(U,{text:e})}function Us(e,n){const t=new Map(n.map(a=>[a.id,a])),l=[];for(const a of e){const o=a.turn_id??null,
|
|
10
|
+
`),a=t.length,o=l.length;if(a*o>25e4)return[...t.map(p=>({type:"del",text:p})),...l.map(p=>({type:"add",text:p}))];const i=Array.from({length:a+1},()=>new Array(o+1).fill(0));for(let p=a-1;p>=0;p--)for(let j=o-1;j>=0;j--)i[p][j]=t[p]===l[j]?i[p+1][j+1]+1:Math.max(i[p+1][j],i[p][j+1]);const r=[];let c=0,u=0;for(;c<a&&u<o;)t[c]===l[u]?(r.push({type:"ctx",text:t[c]}),c++,u++):i[c+1][u]>=i[c][u+1]?(r.push({type:"del",text:t[c]}),c++):(r.push({type:"add",text:l[u]}),u++);for(;c<a;)r.push({type:"del",text:t[c++]});for(;u<o;)r.push({type:"add",text:l[u++]});return r}function $s(e,n){if(!n)return null;try{const t=JSON.parse(n);if(!t||typeof t!="object"||typeof t.file_path!="string")return null;let l;if(e==="Write"){if(typeof t.content!="string")return null;l=[t.content===""?[]:t.content.split(`
|
|
11
|
+
`).map(i=>({type:"add",text:i}))]}else if(e==="MultiEdit"){if(!Array.isArray(t.edits)||(l=t.edits.filter(i=>{const r=i;return!!r&&typeof r.old_string=="string"&&typeof r.new_string=="string"}).map(i=>P(i.old_string,i.new_string)),l.length===0))return null}else{if(typeof t.old_string!="string"||typeof t.new_string!="string")return null;l=[P(t.old_string,t.new_string)]}let a=0,o=0;for(const i of l)for(const r of i)r.type==="add"?a++:r.type==="del"&&o++;return{file_path:t.file_path,kind:e,hunks:l,adds:a,dels:o}}catch{return null}}function Ms(e){const n=e.lastIndexOf("/");return n>=0?{dir:e.slice(0,n+1),base:e.slice(n+1)}:{dir:"",base:e}}const Fs={Edit:"✏️",MultiEdit:"✏️",Write:"📄"},E=400;function qs({t:e,edit:n}){const[t,l]=m.useState(!1),[a,o]=m.useState(!1),[i,r]=m.useState(!1),c=m.useId(),u=m.useId(),{dir:p,base:j}=Ms(n.file_path);return s.jsxs("div",{className:"tool "+(e.status==="error"?"tool-err":""),children:[s.jsxs("button",{className:"tool-head","aria-expanded":t,"aria-controls":c,onClick:()=>l(x=>!x),children:[s.jsxs("span",{className:"tool-name",children:[Fs[n.kind]??"✏️"," ",n.kind]}),s.jsxs("span",{className:"edit-path",children:[s.jsx("span",{className:"base",children:j}),p&&s.jsx("span",{className:"dir",children:p.replace(/\/$/,"")})]}),s.jsxs("span",{className:"diff-stat",children:[n.adds>0&&s.jsxs("span",{className:"add",children:["+",n.adds]}),n.dels>0&&s.jsxs("span",{className:"del",children:["−",n.dels]})]}),e.status&&s.jsx("span",{className:"tool-status",children:e.status}),e.total_duration_ms?s.jsx("span",{className:"muted",children:C(e.total_duration_ms)}):null,s.jsx("span",{className:"chev",children:t?"▾":"▸"})]}),t&&s.jsxs("div",{className:"tool-body",id:c,children:[n.hunks.map((x,N)=>s.jsxs("div",{className:"diff",children:[n.hunks.length>1&&s.jsxs("div",{className:"diff-hunk-sep",children:["edit ",N+1]}),x.slice(0,E).map((d,_)=>s.jsxs("div",{className:"diff-line "+d.type,children:[s.jsx("span",{className:"diff-sign","aria-hidden":"true",children:d.type==="add"?"+":d.type==="del"?"−":" "}),s.jsx("span",{className:"diff-text",children:d.text===""?" ":d.text})]},_)),x.length>E&&s.jsxs("div",{className:"diff-more",children:["… ",x.length-E," more lines — View raw JSON for the rest"]})]},N)),e.result_summary&&s.jsx("pre",{className:"shell-out",children:e.result_summary}),e.full_result&&s.jsxs("div",{className:"full-result",children:[s.jsxs("button",{type:"button",className:"ghost small show-full","aria-expanded":a,onClick:()=>o(x=>!x),children:[a?"Hide":"Show"," full result (",(e.full_result.bytes/1024).toFixed(1)," KB)"]}),a&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.full_result.text,className:"copy-corner",title:"Copy full tool result"}),s.jsx("pre",{className:"code",children:e.full_result.text})]})]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{className:"ghost small","aria-expanded":i,"aria-controls":u,onClick:()=>r(x=>!x),children:i?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(b,{text:v(e.input_json??"{}"),label:"JSON",title:"Copy raw tool input JSON"})]}),i&&s.jsx("pre",{id:u,className:"code",children:v(e.input_json??"{}")})]})]})}function Bs({t:e,hideTools:n}){const t=e.findings??[],l=n&&t.length===0,a=As(e,l);return t.length===0?a:s.jsxs(s.Fragment,{children:[a,s.jsx(ks,{findings:t})]})}function As(e,n){if(e.tool_name==="ExitPlanMode"){const t=es(e.input_json);if(t)return s.jsx(vs,{plan:t})}if(e.tool_name==="AskUserQuestion")return s.jsx(Cs,{t:e});if(e.tool_name==="Workflow")return s.jsx(Is,{t:e});if(e.tool_name==="Bash"){const t=Os(e.input_json);if(t)return n?null:s.jsx(Es,{t:e,bash:t})}if(e.tool_name==="Edit"||e.tool_name==="MultiEdit"||e.tool_name==="Write"){const t=$s(e.tool_name,e.input_json);if(t)return n?null:s.jsx(qs,{t:e,edit:t})}return n?null:s.jsx(ss,{t:e})}function Ls(e,n){return e.findings&&e.findings.length||e.tool_name==="AskUserQuestion"||e.tool_name==="Workflow"||e.tool_name==="ExitPlanMode"&&es(e.input_json)?!0:!n}function ns(e){var l,a,o,i,r;const n=(a=(l=e.match(/<command-name>([^<]*)<\/command-name>/))==null?void 0:l[1])==null?void 0:a.trim();if(n){const c=((i=(o=e.match(/<command-args>([^<]*)<\/command-args>/))==null?void 0:o[1])==null?void 0:i.trim())??"";return{kind:"invocation",name:n.startsWith("/")?n:`/${n}`,args:c}}const t=(r=e.match(/<(?:local-command-stdout|command-output|local-command-stderr)>([\s\S]*?)<\/(?:local-command-stdout|command-output|local-command-stderr)>/))==null?void 0:r[1];return t!=null?{kind:"output",stdout:t.trim()}:/<local-command-caveat>/.test(e)?{kind:"caveat"}:null}function Rs({cmd:e}){return e.kind==="invocation"?s.jsxs("div",{className:"cmd",children:[s.jsxs("span",{className:"cmd-chip",title:"Slash command",children:["⌘ ",e.name]}),e.args&&s.jsx("code",{className:"cmd-args",children:e.args})]}):e.kind==="output"?s.jsx("div",{className:"cmd-out",children:e.stdout&&e.stdout!=="(no content)"?e.stdout:s.jsx("span",{className:"muted",children:"no output"})}):s.jsx("div",{className:"cmd-note muted small",children:"⌘ local command context"})}function ts(e){if(!/<task-notification>/.test(e))return null;const n=t=>{var l,a;return((a=(l=e.match(new RegExp(`<${t}>([\\s\\S]*?)</${t}>`)))==null?void 0:l[1])==null?void 0:a.trim())??null};return{taskId:n("task-id"),toolUseId:n("tool-use-id"),status:n("status"),summary:n("summary")}}function Js({n:e}){const n=m.useContext(Y),t=e.toolUseId?n.get(e.toolUseId):void 0,l=(e.status??"").toLowerCase();return s.jsxs("div",{className:"task-notif",children:[s.jsxs("div",{className:"task-notif-head",children:[s.jsx("span",{className:"task-notif-icon","aria-hidden":"true",children:"🔔"}),e.status&&s.jsx("span",{className:"tag task-status task-status-"+l,children:e.status}),e.taskId&&s.jsxs("code",{className:"task-notif-id",children:["task ",e.taskId]}),t&&s.jsx(y,{className:"subagent-link small",to:`/workflow/${t}`,children:"view workflow →"})]}),e.summary&&s.jsx("div",{className:"task-notif-summary",children:e.summary})]})}function U({text:e,id:n}){return m.useContext(K)==="raw"?s.jsx("div",{className:"text",id:n,children:e}):s.jsx("div",{className:"text md",id:n,children:s.jsx(ps,{remarkPlugins:[xs],components:Ps,children:e})})}const Ps={a:({node:e,...n})=>s.jsx("a",{...n,target:"_blank",rel:"noopener noreferrer"})};function as({text:e}){const n=e.length>1400||e.split(`
|
|
12
|
+
`).length>18,[t,l]=m.useState(!1),a=m.useId();return n?s.jsxs("div",{className:"text-wrap"+(t?"":" is-clamped"),children:[s.jsx(U,{text:e,id:a}),s.jsx("button",{className:"ghost small show-more","aria-expanded":t,"aria-controls":a,onClick:()=>l(o=>!o),children:t?"Show less ▴":"Show more ▾"})]}):s.jsx(U,{text:e})}function Us(e,n){const t=new Map(n.map(a=>[a.id,a])),l=[];for(const a of e){const o=a.turn_id??null,i=l[l.length-1];i&&i.turnId===o?i.events.push(a):l.push({turnId:o,turn:o?t.get(o)??null:null,events:[a]})}return l}function Hs(e){const n=ns(e);if((n==null?void 0:n.kind)==="invocation")return`⌘ ${n.name}${n.args?" "+n.args:""}`;if((n==null?void 0:n.kind)==="output")return"⌘ command output";if((n==null?void 0:n.kind)==="caveat")return"⌘ local command";const t=ts(e);return t?`🔔 task ${t.status??"notification"}`:e}function Ws({turn:e,events:n,open:t,onToggle:l}){const a=m.useId();return s.jsxs("section",{className:"turn"+(t?" is-open":""),children:[s.jsxs("button",{className:"turn-head","aria-expanded":t,"aria-controls":a,onClick:l,children:[s.jsx("span",{className:"chev turn-chev","aria-hidden":"true",children:t?"▾":"▸"}),s.jsxs("span",{className:"turn-no",children:["turn ",e.seq+1]}),e.prompt_preview?s.jsx("span",{className:"turn-preview",children:Hs(e.prompt_preview)}):null,s.jsxs("span",{className:"turn-stats muted",children:[n.length," msg",n.length===1?"":"s",e.duration_ms?" · "+C(e.duration_ms):""]})]}),s.jsx("div",{id:a,className:"turn-body",role:"region","aria-label":`turn ${e.seq+1} messages`,children:t&&n.map(o=>s.jsx(ls,{e:o},o.uuid))})]})}function ls({e}){const[n,t]=m.useState(!1),l=m.useId(),a=m.useContext(z),o=m.useContext(G),i=e.role||e.type,r=i==="user"?"👤":i==="assistant"?"🤖":"⚙️",c=e.toolCalls.filter(N=>Ls(N,a));if(!(e.text||e.thinking||c.length))return null;const p=e.text?ns(e.text):null,j=e.text&&!p?ts(e.text):null,x=e.text||e.thinking||"";return s.jsxs("div",{id:"ev-"+e.uuid,className:"event ev-"+i+(o===e.uuid?" ev-flagged":""),children:[s.jsxs("div",{className:"ev-meta",children:[s.jsxs("span",{className:"ev-who",children:[r," ",i]}),e.model&&s.jsx("span",{className:"tag",children:Q(e.model)}),e.is_sidechain?s.jsx("span",{className:"tag subagent",children:"subagent"}):null,s.jsx("span",{className:"muted ev-time",children:D(e.timestamp)}),x&&s.jsx(b,{text:x,className:"ev-copy copy-hover",title:"Copy message"})]}),e.thinking&&s.jsxs("div",{className:"thinking",children:[s.jsxs("button",{className:"thinking-toggle","aria-expanded":n,"aria-controls":l,onClick:()=>t(N=>!N),children:["🧠 thinking ",n?"▾":"▸"]}),n&&s.jsxs("div",{className:"code-block",children:[s.jsx(b,{text:e.thinking,className:"copy-corner",title:"Copy thinking"}),s.jsx("pre",{id:l,className:"thinking-body",children:e.thinking})]})]}),e.text&&(p?s.jsx(Rs,{cmd:p}):j?s.jsx(Js,{n:j}):s.jsx(as,{text:e.text})),c.map((N,d)=>s.jsx(Bs,{t:N,hideTools:a},d))]})}function $({c:e}){const n=e.agent_description||e.title||e.id.slice(0,12);return s.jsxs("li",{children:[s.jsx(y,{to:`/session/${e.id}`,children:n}),e.agent_type&&s.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&s.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),s.jsxs("span",{className:"muted",children:[" ","· ",(e.models??"").split(",").filter(Boolean).map(Q).join(", ")," ·"," ",H(e.tokens)," tok · ",W(e.cost)]})]})}function Ds({d:e}){const n=e.workflow_runs??[],t=e.children.filter(a=>!a.workflow_run_id),l=n.length>0;return s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Spawned subagents (",e.children.length,")"]}),n.map(a=>{const o=e.children.filter(i=>i.workflow_run_id===a.run_id);return s.jsxs("details",{className:"wf-run",children:[s.jsxs("summary",{children:[s.jsxs(y,{className:"wf-run-name",to:`/workflow/${a.run_id}`,onClick:i=>i.stopPropagation(),children:["🔀 ",a.name||"workflow"," →"]}),a.status&&s.jsx("span",{className:"tag task-status task-status-"+a.status.toLowerCase(),children:a.status}),s.jsxs("span",{className:"muted small",children:[o.length," agent",o.length===1?"":"s",a.turn_seq!=null?` · turn ${a.turn_seq+1}`:""," · ",s.jsx("code",{children:a.run_id})]})]}),s.jsx("ul",{children:o.map(i=>s.jsx($,{c:i},i.id))})]},a.run_id)}),t.length>0&&(l?s.jsxs("details",{className:"wf-run",open:!0,children:[s.jsxs("summary",{children:[s.jsx("span",{className:"wf-run-name",children:"Task / Agent"}),s.jsxs("span",{className:"muted small",children:[t.length," subagent",t.length===1?"":"s"]})]}),s.jsx("ul",{children:t.map(a=>s.jsx($,{c:a},a.id))})]}):s.jsx("ul",{children:t.map(a=>s.jsx($,{c:a},a.id))}))]})}function zs(){const{id:e}=cs(),{hash:n}=ds(),[t,l]=m.useState(null),[a,o]=m.useState(null),[i,r]=m.useState(new Set),[c,u]=m.useState(fs),[p,j]=m.useState(js),x=h=>{u(h);try{localStorage.setItem(X,h)}catch{}},N=()=>j(h=>{const k=!h;try{localStorage.setItem(Z,k?"1":"0")}catch{}return k});m.useEffect(()=>{l(null),o(null),r(new Set),us("/sessions/"+e).then(l).catch(h=>o(String(h)))},[e]);const[d,_]=m.useState(null),w=m.useRef(null);m.useEffect(()=>{if(!t)return;const h=/^#ev-(.+)$/.exec(n);if(!h){w.current=null;return}if(w.current===n)return;const k=h[1],g=t.events.find(T=>T.uuid===k);if(g!=null&&g.turn_id&&i.has(g.turn_id)){const T=g.turn_id;r(os=>{const A=new Set(os);return A.delete(T),A});return}const B=document.getElementById("ev-"+k);if(!B)return;w.current=n,B.scrollIntoView({block:"center",behavior:"smooth"}),_(k);const is=window.setTimeout(()=>_(null),3e3);return()=>window.clearTimeout(is)},[t,n,i]);const S=m.useMemo(()=>{const h=new Map;for(const k of(t==null?void 0:t.events)??[])for(const g of k.toolCalls)g.tool_name==="Workflow"&&g.id&&g.workflow_run_id&&h.set(g.id,g.workflow_run_id);return h},[t]);if(a)return s.jsx("div",{className:"error",role:"alert",children:a});if(!t)return s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"});const f=t.session,M=t.events.filter(h=>h.text||h.thinking||h.toolCalls.length),F=Us(M,t.turns),I=F.filter(h=>h.turn).map(h=>h.turnId),q=I.some(h=>!i.has(h)),rs=h=>r(k=>{const g=new Set(k);return g.has(h)?g.delete(h):g.add(h),g});return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(y,{to:"/",className:"back",children:"← all sessions"}),s.jsx("h1",{children:f.title||f.id.slice(0,12)}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("span",{children:s.jsx("b",{children:f.source_id})}),s.jsx("span",{className:"path",children:f.project_path}),f.is_sidechain?s.jsx("span",{className:"tag subagent",children:"subagent"}):null,t.parent&&s.jsxs("span",{className:"spawned-by",children:["↖ spawned by"," ",s.jsx(y,{to:`/session/${t.parent.id}`,children:t.parent.title||t.parent.id.slice(0,12)}),t.parent.turn_seq!=null?` · turn ${t.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[t.turns.length," turns"]}),s.jsxs("span",{children:[f.event_count," events"]}),s.jsxs("span",{title:ms(f.token_split),children:[H(f.tokens)," tok"]}),s.jsx("span",{title:"Estimated at API list prices (cache-aware)",children:W(f.cost)}),f.tool_call_count>0&&s.jsxs("span",{className:f.tool_failure_count>0?"tool-err-stat":"muted",title:"Tool calls that returned is_error, of "+f.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:[f.tool_failure_count," failed",f.tool_rejection_count>0?` · ${f.tool_rejection_count} declined/blocked`:"",` of ${f.tool_call_count} tool calls`]}),s.jsx("span",{children:C(f.duration_ms)}),s.jsx("span",{className:"muted",children:D(f.started_at)}),s.jsx("a",{className:"export",href:hs(f.id),children:"⬇ Export Markdown"})]}),t.classification&&s.jsx(gs,{c:t.classification}),t.findings&&t.findings.length>0&&s.jsx(ys,{findings:t.findings,sessionId:f.id})]}),t.children&&t.children.length>0&&s.jsx(Ds,{d:t}),s.jsxs("div",{className:"transcript-tools",children:[I.length>1&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"muted small",children:[I.length," turns"]}),s.jsx("button",{className:"ghost small",onClick:()=>r(q?new Set(I):new Set),children:q?"Collapse all":"Expand all"})]}),s.jsxs("button",{className:"ghost small"+(p?" is-active":""),"aria-pressed":p,onClick:N,title:"Hide Bash/Edit/Skill and other tool calls — show only assistant answers, plans and questions",children:[p?"☑ ":"☐ ","Hide tool messages"]}),s.jsxs("div",{className:"format-toggle",role:"group","aria-label":"Message format",children:[s.jsx("button",{className:"ghost small"+(c==="markdown"?" is-active":""),"aria-pressed":c==="markdown",onClick:()=>x("markdown"),children:"Markdown"}),s.jsx("button",{className:"ghost small"+(c==="raw"?" is-active":""),"aria-pressed":c==="raw",onClick:()=>x("raw"),children:"Raw"})]})]}),s.jsx(Y.Provider,{value:S,children:s.jsx(K.Provider,{value:c,children:s.jsx(z.Provider,{value:p,children:s.jsx(G.Provider,{value:d,children:s.jsxs("div",{className:"transcript",children:[M.length===0&&s.jsx("div",{className:"muted pad",role:"status",children:"This session has no rendered messages."}),F.map((h,k)=>h.turn?s.jsx(Ws,{turn:h.turn,events:h.events,open:!i.has(h.turnId),onToggle:()=>rs(h.turnId)},h.turnId):s.jsx("div",{className:"unturned",children:h.events.map(g=>s.jsx(ls,{e:g},g.uuid))},"unturned-"+k))]})})})})})]})}export{zs as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as N,a as g,r as a,d as k,j as s,L as j,l as c}from"./index-
|
|
1
|
+
import{i as N,a as g,r as a,d as k,j as s,L as j,l as c}from"./index-BkDuOrzs.js";import{M as b,r as y}from"./index-T6SPgI6b.js";function S(l){return!l||l<0?"—":l>=1024?(l/1024).toFixed(1)+" KB":l+" B"}function _(l,t){return`${l.slice(0,8)} · ${c(t)}`}function F(){const{name:l=""}=N(),[t,v]=g(),[i,o]=a.useState(null),[f,h]=a.useState(!0),[m,u]=a.useState(null);a.useEffect(()=>{h(!0),u(null),o(null),k("/skills/"+encodeURIComponent(l)).then(o).catch(e=>u(String(e))).finally(()=>h(!1))},[l]);const r=a.useMemo(()=>{if(!(i!=null&&i.versions.length))return null;const e=t.get("v");return i.versions.find(n=>n.id===e)??i.versions[0]},[i,t]),d=a.useMemo(()=>i&&r?i.sessions.filter(e=>e.version_id===r.id):[],[i,r]),x=a.useMemo(()=>i?i.sessions.filter(e=>!e.version_id).length:0,[i]);function p(e){const n=new URLSearchParams(t);n.set("v",e),v(n)}return f?s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):m?s.jsx("div",{className:"error",role:"alert",children:m}):i?s.jsxs("div",{className:"skill-view",children:[s.jsx(j,{to:"/skills",className:"back",children:"← all skills"}),s.jsxs("header",{className:"skill-head",children:[s.jsxs("h1",{children:["📖 ",i.name]}),s.jsxs("div",{className:"skill-head-meta muted",children:[i.call_count.toLocaleString()," firing",i.call_count===1?"":"s"," ·"," ",i.versions.length," version",i.versions.length===1?"":"s",r!=null&&r.summary?s.jsxs(s.Fragment,{children:[" · ",r.summary]}):null]})]}),i.versions.length===0?s.jsxs("div",{className:"empty",children:["This skill fired ",i.call_count.toLocaleString()," time(s) but no SKILL.md body was captured in the transcripts, so there is no version content to show."]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"skill-version-bar",children:[s.jsxs("label",{className:"ctl",children:["version"," ",s.jsx("select",{"aria-label":"Skill version",value:(r==null?void 0:r.id)??"",onChange:e=>p(e.target.value),children:i.versions.map((e,n)=>s.jsxs("option",{value:e.id,children:[_(e.id,e.last_seen)," · ",e.call_count," fire",e.call_count===1?"":"s",n===0?" (latest)":""]},e.id))})]}),r&&s.jsxs("span",{className:"muted small",children:["first seen ",c(r.first_seen)," · last seen ",c(r.last_seen)," ·"," ",S(r.body_bytes)]})]}),r&&s.jsxs("div",{className:"cards skill-cards",children:[s.jsxs("div",{className:"card skill-body-card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Skill body"}),s.jsxs("span",{className:"card-hint",children:["version ",r.id.slice(0,8)]})]}),s.jsx("div",{className:"md skill-body",children:s.jsx(b,{remarkPlugins:[y],children:r.body})})]}),s.jsxs("div",{className:"card skill-sessions-card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Sessions that fired this version"}),s.jsx("span",{className:"card-hint",children:d.length})]}),d.length===0?s.jsx("div",{className:"empty",children:"No sessions fired this version."}):s.jsxs("table",{className:"sessions",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Session"}),s.jsx("th",{children:"Source"}),s.jsx("th",{children:"Project"}),s.jsx("th",{className:"num",children:"Fires"}),s.jsx("th",{children:"When"})]})}),s.jsx("tbody",{children:d.map(e=>{var n;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(j,{to:`/session/${e.id}`,className:"title",children:e.title||s.jsx("span",{className:"muted",children:e.id.slice(0,12)})})}),s.jsx("td",{children:e.source_id}),s.jsx("td",{className:"path",children:((n=e.project_path)==null?void 0:n.replace(/^.*\//,""))??"—"}),s.jsx("td",{className:"num",children:e.fire_count}),s.jsx("td",{children:c(e.fired_at)})]},e.id)})})]}),x>0&&s.jsxs("div",{className:"muted small pad",children:[x," firing(s) had no captured body and aren’t attributed to a version."]})]})]})]})]}):s.jsx("div",{className:"muted pad",children:"Not found."})}export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,r,n as I,d as h,o as K,j as e,F as M,S as m,L as D,l as U,P as $}from"./index-
|
|
1
|
+
import{a as C,r,n as I,d as h,o as K,j as e,F as M,S as m,L as D,l as U,P as $}from"./index-BkDuOrzs.js";const j=50,V={name:t=>t.name,fired:t=>t.call_count,last_fired:t=>t.last_fired};function G(){const[t,N]=C(),[P,L]=r.useState([]),[_,q]=r.useState([]),[o,E]=r.useState([]),[p,x]=r.useState(!0),[S,g]=r.useState(null),[f,v]=r.useState(t.get("q")??""),{sort:a,toggle:d}=I("fired","desc"),[R,b]=r.useState(1);r.useEffect(()=>{h("/sources").then(L).catch(()=>{}),h("/projects").then(q).catch(()=>{})},[]),r.useEffect(()=>{x(!0),g(null);const s=new URLSearchParams;for(const l of["source","project","q"]){const y=t.get(l);y&&s.set(l,y)}const n=s.toString()?"?"+s.toString():"";h("/skills"+n).then(E).catch(l=>g(String(l))).finally(()=>x(!1))},[t]);function c(s,n){const l=new URLSearchParams(t);n?l.set(s,n):l.delete(s),N(l)}function F(s){s.preventDefault(),c("q",f.trim())}r.useEffect(()=>b(1),[t,a.key,a.dir]);const i=r.useMemo(()=>K(o,V[a.key],a.dir),[o,a.key,a.dir]),k=Math.max(1,Math.ceil(i.length/j)),u=Math.min(R,k),w=i.slice((u-1)*j,u*j);return e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:"Skills"}),e.jsxs("div",{className:"filters",children:[e.jsxs("form",{onSubmit:F,className:"search",role:"search",children:[e.jsx("input",{type:"search","aria-label":"Search skills by name and body",placeholder:"Search skill names & bodies…",value:f,onChange:s=>v(s.target.value)}),e.jsx("button",{type:"submit",children:"Search"}),t.get("q")&&e.jsx("button",{type:"button",className:"ghost",onClick:()=>(v(""),c("q","")),children:"clear"})]}),e.jsxs("select",{"aria-label":"Filter by source",value:t.get("source")??"",onChange:s=>c("source",s.target.value),children:[e.jsx("option",{value:"",children:"all sources"}),P.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}),e.jsx(M,{ariaLabel:"Filter by project",searchPlaceholder:"Find project…",value:t.get("project")??"",onChange:s=>c("project",s),options:[{value:"",label:"all projects"},..._.map(s=>({value:s.id,label:s.path.replace(/^.*\//,"")}))]})]}),S&&e.jsx("div",{className:"error",role:"alert",children:S}),p?e.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"}):o.length===0?e.jsx("div",{className:"muted pad",role:"status",children:"No skills fired match."}):e.jsxs("table",{className:"sessions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(m,{label:"Skill",sortKey:"name",active:a.key,dir:a.dir,onSort:d,defaultDir:"asc"}),e.jsx(m,{label:"Fired",sortKey:"fired",active:a.key,dir:a.dir,onSort:d,className:"num"}),e.jsx("th",{className:"num",children:"Versions"}),e.jsx("th",{children:"Sources"}),e.jsx(m,{label:"Last fired",sortKey:"last_fired",active:a.key,dir:a.dir,onSort:d})]})}),e.jsx("tbody",{children:w.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(D,{to:`/skill/${encodeURIComponent(s.name)}`,className:"title",children:s.name})}),e.jsx("td",{className:"num",children:s.call_count.toLocaleString()}),e.jsx("td",{className:"num",title:`${s.version_count} distinct captured ${s.version_count===1?"version":"versions"}`,children:s.version_count||e.jsx("span",{className:"muted",children:"—"})}),e.jsx("td",{children:e.jsx("span",{className:"sub",children:s.sources.map(n=>e.jsx("span",{className:"tag",children:n},n))})}),e.jsx("td",{children:U(s.last_fired)})]},s.name))})]}),!p&&i.length>0&&e.jsx($,{page:u,pages:k,total:i.length,unit:"skills",onPage:b})]})}export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,r as p,i as z,d as H,L as O,s as $,h as J,f as F,e as I,l as Q}from"./index-B_beFRjy.js";import{s as B,d as S,l as D,a as U,C as G,p as L}from"./CopyButton-CQ5SHT0Q.js";import{M as K,r as q}from"./index-CM-5HLoq.js";const g=e=>e===null||typeof e!="object",M=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function T({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const t=typeof e;return t==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):t==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function E({v:e}){return g(e)?s.jsx(T,{v:e}):Array.isArray(e)?e.every(g)?s.jsx("span",{className:"rv-str",children:e.map(String).join(", ")||"—"}):s.jsxs("span",{className:"muted",children:["[",e.length,"]"]}):s.jsx("span",{className:"muted",children:`{${Object.keys(e).length}}`})}function W(e){const t=[],l=new Set;for(const r of e)for(const n of Object.keys(r??{}))l.has(n)||(l.add(n),t.push(n));return t}function X({rows:e}){const t=W(e);return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:t.map(l=>s.jsx("th",{children:l},l))})}),s.jsx("tbody",{children:e.map((l,r)=>s.jsx("tr",{children:t.map(n=>s.jsx("td",{children:s.jsx(E,{v:l[n]})},n))},r))})]})})}function Z({obj:e}){const t=Object.entries(e),l=W(t.map(([,r])=>r));return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"key"}),l.map(r=>s.jsx("th",{children:r},r))]})}),s.jsx("tbody",{children:t.map(([r,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:r}),l.map(a=>s.jsx("td",{children:s.jsx(E,{v:n[a]})},a))]},r))})]})})}function ss({name:e,value:t,depth:l}){const[r,n]=p.useState(l<1),a=Array.isArray(t)?`[${t.length}]`:`{${Object.keys(t).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":r,onClick:()=>n(c=>!c),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:r?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:a})]}),r&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(Y,{value:t,depth:l+1})})]})}function Y({value:e,depth:t=0}){if(g(e))return s.jsx(T,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(M)?s.jsx(X,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((a,c)=>s.jsx("li",{children:s.jsx(E,{v:a})},c))});const l=Object.entries(e);if(l.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(l.every(([,a])=>M(a)))return s.jsx(Z,{obj:e});const r=l.filter(([,a])=>g(a)),n=l.filter(([,a])=>!g(a));return s.jsxs("div",{className:"rv-obj",children:[r.length>0&&s.jsx("div",{className:"rv-metrics",children:r.map(([a,c])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:a}),s.jsx("span",{className:"rv-mval",children:s.jsx(T,{v:c})})]},a))}),n.map(([a,c])=>s.jsx(ss,{name:a,value:c,depth:t},a))]})}function C({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(Y,{value:e,depth:0})})}const N=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),A=e=>e===null||typeof e!="object",es=new Set(["script","scriptPath","description"]),ts=["skill","name","id","title"];function ns({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):A(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(A)?s.jsx("ol",{className:"launch-list",children:e.map((t,l)=>s.jsx("li",{children:t===null?"—":String(t)},l))}):s.jsx(C,{value:e}):s.jsx(C,{value:e})}function as({rec:e,index:t}){const l=ts.find(a=>typeof e[a]=="string"),r=l?String(e[l]):`task ${t+1}`,n=Object.entries(e).filter(([a])=>a!==l);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:t+1}),s.jsx("span",{className:"launch-card-title",children:r})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([a,c])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:a}),s.jsx("dd",{children:s.jsx(ns,{v:c})})]},a))})]})}function V({raw:e}){const[t,l]=p.useState(!1),{body:r,note:n}=B(S(e)),{value:a,repaired:c}=D(r);if(a===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const o=U(a),y=N(o)?Object.entries(o):[["",o]],P=y.filter(([i,h])=>A(h)&&i!=="script"),w=y.filter(([,i])=>!A(i)),u=N(o)&&typeof o.script=="string"?o.script:null,m=N(o)&&typeof o.scriptPath=="string"?o.scriptPath:null,j=N(o)&&typeof o.description=="string"?o.description:null,x=P.filter(([i])=>!es.has(i)),b=j||m||u||x.length>0,v=i=>Array.isArray(i)&&i.length>0&&i.every(N);return s.jsxs("div",{className:"launch",children:[b&&s.jsxs("div",{className:"launch-meta",children:[j&&s.jsx("div",{className:"launch-desc",children:j}),m&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:m})]}),x.map(([i,h])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:i})," ",s.jsx("code",{children:String(h)})]},i)),u&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",u.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:u})]})]}),w.map(([i,h])=>v(h)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[h.length," ",i||(h.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),h.map((_,f)=>s.jsx(as,{rec:_,index:f},f))]},i||"tasks"):s.jsxs("div",{className:"launch-section",children:[i&&s.jsx("div",{className:"launch-tasks-head",children:i}),s.jsx(C,{value:h})]},i||"value")),(n||c)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",n??"Payload was truncated; showing the recoverable portion."]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{type:"button",className:"ghost small","aria-expanded":t,onClick:()=>l(i=>!i),children:t?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(G,{text:L(r),label:"JSON",title:"Copy raw launch JSON"})]}),t&&s.jsx("pre",{className:"code launch-raw",children:L(r)})]})}function ls({raw:e}){const{body:t,note:l}=B(S(e)),r=/^\s*[[{]/.test(t),{value:n,repaired:a}=r?D(t):{value:void 0,repaired:!1},c=n!==void 0;return s.jsxs(s.Fragment,{children:[c?s.jsx("div",{className:"wf-result-body",children:s.jsx(C,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(K,{remarkPlugins:[q],children:t})}),(l||a)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",l??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(G,{text:c?L(t):t,label:"result",title:"Copy the returned result"})})]})}function rs(e,t){if(e&&e.length){const l=new Map,r=(n,a)=>{let c=l.get(n);return c?a&&(c.title=a):(c={title:a||`Phase ${n}`,agentCount:0,models:[]},l.set(n,c)),c};for(const n of e)n.type==="workflow_phase"&&r(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const a=r(n.phaseIndex,n.phaseTitle);a.agentCount++,n.model&&!a.models.includes(n.model)&&a.models.push(n.model)}if(l.size)return[...l.keys()].sort((n,a)=>n-a).map(n=>l.get(n))}return t.map(l=>({title:l,agentCount:0,models:[]}))}function cs({a:e}){const t=e.agent_description||e.title||e.id.slice(0,12);return s.jsxs("li",{children:[s.jsx(O,{to:`/session/${e.id}`,children:t}),e.agent_type&&s.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&s.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),s.jsxs("span",{className:"muted",children:[" ","· ",(e.models??"").split(",").filter(Boolean).map($).join(", ")||"—"," ·"," ",J(e.tokens)," tok · ",F(e.cost),e.duration_ms!=null?` · ${I(e.duration_ms)}`:""]})]})}function hs(){var m,j,x,b,v,i,h,_,f,R;const{run_id:e}=z(),[t,l]=p.useState(null),[r,n]=p.useState(null);if(p.useEffect(()=>{l(null),n(null),H("/workflows/"+e).then(l).catch(d=>n(String(d)))},[e]),r)return s.jsx("div",{className:"error",role:"alert",children:r});if(!t)return s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"});const a=(t.status??"").toLowerCase(),c=((m=t.run)==null?void 0:m.agent_count)??t.stats.agent_count,o=((j=t.run)==null?void 0:j.total_tokens)??t.stats.total_tokens,y=((x=t.run)==null?void 0:x.duration_ms)??t.stats.duration_ms,P=(((b=t.run)==null?void 0:b.phases)??[]).map(d=>d==null?void 0:d.title).filter(d=>!!d),w=rs((v=t.run)==null?void 0:v.progress,P),u=((i=t.run)==null?void 0:i.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(O,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",t.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:t.run_id}),t.status&&s.jsx("span",{className:"tag task-status task-status-"+a,children:t.status}),((h=t.run)==null?void 0:h.default_model)&&s.jsx("span",{className:"tag",children:$(t.run.default_model)}),((_=t.parent)==null?void 0:_.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(O,{to:`/session/${t.parent.id}`,children:t.parent.title||t.parent.id.slice(0,12)}),t.parent.turn_seq!=null?` · turn ${t.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[c," agent",c===1?"":"s"]}),s.jsxs("span",{children:[J(o)," tok"]}),((f=t.run)==null?void 0:f.total_tool_calls)!=null&&s.jsxs("span",{children:[t.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:F(t.stats.total_cost)}),s.jsx("span",{children:I(y)}),s.jsx("span",{className:"muted",children:Q(((R=t.run)==null?void 0:R.started_at)??t.stats.started_at)})]}),w.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:w.map((d,k)=>s.jsxs(p.Fragment,{children:[k>0&&s.jsx("span",{className:"wf-phase-arrow","aria-hidden":"true",children:"→"}),s.jsxs("div",{className:"wf-phase-chip",children:[s.jsx("span",{className:"wf-phase-title",children:d.title}),d.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[d.agentCount," agent",d.agentCount===1?"":"s",d.models.length?` · ${d.models.map($).join(", ")}`:""]})]})]},k))})]}),t.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",t.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+t.completion.status.toLowerCase(),children:t.completion.status})]}),t.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:S(t.completion.summary)}),t.completion.result?s.jsx(ls,{raw:t.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),t.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:S(t.completion.failures)})]})]}),u.length>0&&s.jsxs("details",{className:"wf-logs",open:u.length<=20,children:[s.jsxs("summary",{children:["Run log · ",u.length," line",u.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:u.map((d,k)=>s.jsx("li",{children:d},k))})]}),t.input_json?s.jsx("div",{className:"wf-result wf-launch",children:t.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx(V,{raw:t.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),a==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx(V,{raw:t.input_json})]})}):!t.completion&&t.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(K,{remarkPlugins:[q],children:t.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",t.agents.length,")"]}),t.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:t.agents.map(d=>s.jsx(cs,{a:d},d.id))})]})]})}export{hs as default};
|
|
1
|
+
import{j as s,r as p,i as z,d as H,L as O,s as $,h as J,f as F,e as I,l as Q}from"./index-BkDuOrzs.js";import{s as B,d as S,l as D,a as U,C as G,p as L}from"./CopyButton-XWWtxa5T.js";import{M as K,r as q}from"./index-T6SPgI6b.js";const g=e=>e===null||typeof e!="object",M=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function T({v:e}){if(e==null)return s.jsx("span",{className:"json-null",children:"—"});const t=typeof e;return t==="boolean"?s.jsx("span",{className:e?"rv-true":"rv-false",children:e?"✓ true":"✗ false"}):t==="number"?s.jsx("span",{className:"json-number",children:String(e)}):s.jsx("span",{className:"rv-str",children:String(e)})}function E({v:e}){return g(e)?s.jsx(T,{v:e}):Array.isArray(e)?e.every(g)?s.jsx("span",{className:"rv-str",children:e.map(String).join(", ")||"—"}):s.jsxs("span",{className:"muted",children:["[",e.length,"]"]}):s.jsx("span",{className:"muted",children:`{${Object.keys(e).length}}`})}function W(e){const t=[],l=new Set;for(const r of e)for(const n of Object.keys(r??{}))l.has(n)||(l.add(n),t.push(n));return t}function X({rows:e}){const t=W(e);return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:t.map(l=>s.jsx("th",{children:l},l))})}),s.jsx("tbody",{children:e.map((l,r)=>s.jsx("tr",{children:t.map(n=>s.jsx("td",{children:s.jsx(E,{v:l[n]})},n))},r))})]})})}function Z({obj:e}){const t=Object.entries(e),l=W(t.map(([,r])=>r));return s.jsx("div",{className:"rv-table-wrap",children:s.jsxs("table",{className:"rv-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"key"}),l.map(r=>s.jsx("th",{children:r},r))]})}),s.jsx("tbody",{children:t.map(([r,n])=>s.jsxs("tr",{children:[s.jsx("td",{className:"rv-rowkey",children:r}),l.map(a=>s.jsx("td",{children:s.jsx(E,{v:n[a]})},a))]},r))})]})})}function ss({name:e,value:t,depth:l}){const[r,n]=p.useState(l<1),a=Array.isArray(t)?`[${t.length}]`:`{${Object.keys(t).length}}`;return s.jsxs("div",{className:"rv-section",children:[s.jsxs("button",{className:"rv-sec-head","aria-expanded":r,onClick:()=>n(c=>!c),children:[s.jsx("span",{className:"json-chev","aria-hidden":"true",children:r?"▾":"▸"}),s.jsx("span",{className:"rv-sec-name",children:e}),s.jsx("span",{className:"muted small",children:a})]}),r&&s.jsx("div",{className:"rv-sec-body",children:s.jsx(Y,{value:t,depth:l+1})})]})}function Y({value:e,depth:t=0}){if(g(e))return s.jsx(T,{v:e});if(Array.isArray(e))return e.length===0?s.jsx("span",{className:"muted",children:"empty"}):e.every(M)?s.jsx(X,{rows:e}):s.jsx("ul",{className:"rv-list",children:e.map((a,c)=>s.jsx("li",{children:s.jsx(E,{v:a})},c))});const l=Object.entries(e);if(l.length===0)return s.jsx("span",{className:"muted",children:"empty"});if(l.every(([,a])=>M(a)))return s.jsx(Z,{obj:e});const r=l.filter(([,a])=>g(a)),n=l.filter(([,a])=>!g(a));return s.jsxs("div",{className:"rv-obj",children:[r.length>0&&s.jsx("div",{className:"rv-metrics",children:r.map(([a,c])=>s.jsxs("div",{className:"rv-metric",children:[s.jsx("span",{className:"rv-mkey",children:a}),s.jsx("span",{className:"rv-mval",children:s.jsx(T,{v:c})})]},a))}),n.map(([a,c])=>s.jsx(ss,{name:a,value:c,depth:t},a))]})}function C({value:e}){return s.jsx("div",{className:"rv-root",children:s.jsx(Y,{value:e,depth:0})})}const N=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),A=e=>e===null||typeof e!="object",es=new Set(["script","scriptPath","description"]),ts=["skill","name","id","title"];function ns({v:e}){return e==null?s.jsx("span",{className:"muted",children:"—"}):typeof e=="string"?s.jsx("span",{className:"launch-text",children:e}):A(e)?s.jsx("span",{className:"json-number",children:String(e)}):Array.isArray(e)?e.every(A)?s.jsx("ol",{className:"launch-list",children:e.map((t,l)=>s.jsx("li",{children:t===null?"—":String(t)},l))}):s.jsx(C,{value:e}):s.jsx(C,{value:e})}function as({rec:e,index:t}){const l=ts.find(a=>typeof e[a]=="string"),r=l?String(e[l]):`task ${t+1}`,n=Object.entries(e).filter(([a])=>a!==l);return s.jsxs("div",{className:"launch-card",children:[s.jsxs("div",{className:"launch-card-head",children:[s.jsx("span",{className:"launch-card-idx",children:t+1}),s.jsx("span",{className:"launch-card-title",children:r})]}),s.jsx("dl",{className:"launch-fields",children:n.map(([a,c])=>s.jsxs("div",{className:"launch-field",children:[s.jsx("dt",{children:a}),s.jsx("dd",{children:s.jsx(ns,{v:c})})]},a))})]})}function V({raw:e}){const[t,l]=p.useState(!1),{body:r,note:n}=B(S(e)),{value:a,repaired:c}=D(r);if(a===void 0)return s.jsx("div",{className:"launch",children:s.jsx("pre",{className:"code",children:e})});const o=U(a),y=N(o)?Object.entries(o):[["",o]],P=y.filter(([i,h])=>A(h)&&i!=="script"),w=y.filter(([,i])=>!A(i)),u=N(o)&&typeof o.script=="string"?o.script:null,m=N(o)&&typeof o.scriptPath=="string"?o.scriptPath:null,j=N(o)&&typeof o.description=="string"?o.description:null,x=P.filter(([i])=>!es.has(i)),b=j||m||u||x.length>0,v=i=>Array.isArray(i)&&i.length>0&&i.every(N);return s.jsxs("div",{className:"launch",children:[b&&s.jsxs("div",{className:"launch-meta",children:[j&&s.jsx("div",{className:"launch-desc",children:j}),m&&s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:"script"})," ",s.jsx("code",{children:m})]}),x.map(([i,h])=>s.jsxs("div",{className:"launch-metaline",children:[s.jsx("span",{className:"muted",children:i})," ",s.jsx("code",{children:String(h)})]},i)),u&&s.jsxs("details",{className:"launch-src",children:[s.jsxs("summary",{children:["script source · ",u.length.toLocaleString()," chars"]}),s.jsx("pre",{className:"code",children:u})]})]}),w.map(([i,h])=>v(h)?s.jsxs("div",{className:"launch-tasks",children:[s.jsxs("div",{className:"launch-tasks-head",children:[h.length," ",i||(h.length===1?"task":"tasks")," ",s.jsx("span",{className:"muted",children:"launched"})]}),h.map((_,f)=>s.jsx(as,{rec:_,index:f},f))]},i||"tasks"):s.jsxs("div",{className:"launch-section",children:[i&&s.jsx("div",{className:"launch-tasks-head",children:i}),s.jsx(C,{value:h})]},i||"value")),(n||c)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",n??"Payload was truncated; showing the recoverable portion."]}),s.jsxs("div",{className:"launch-actions",children:[s.jsx("button",{type:"button",className:"ghost small","aria-expanded":t,onClick:()=>l(i=>!i),children:t?"Hide raw JSON ▴":"View raw JSON ▾"}),s.jsx(G,{text:L(r),label:"JSON",title:"Copy raw launch JSON"})]}),t&&s.jsx("pre",{className:"code launch-raw",children:L(r)})]})}function ls({raw:e}){const{body:t,note:l}=B(S(e)),r=/^\s*[[{]/.test(t),{value:n,repaired:a}=r?D(t):{value:void 0,repaired:!1},c=n!==void 0;return s.jsxs(s.Fragment,{children:[c?s.jsx("div",{className:"wf-result-body",children:s.jsx(C,{value:n})}):s.jsx("div",{className:"text md wf-result-body",children:s.jsx(K,{remarkPlugins:[q],children:t})}),(l||a)&&s.jsxs("div",{className:"muted small wf-trunc",children:["⚠ ",l??"Result was truncated; showing the recoverable portion."]}),s.jsx("div",{className:"launch-actions",children:s.jsx(G,{text:c?L(t):t,label:"result",title:"Copy the returned result"})})]})}function rs(e,t){if(e&&e.length){const l=new Map,r=(n,a)=>{let c=l.get(n);return c?a&&(c.title=a):(c={title:a||`Phase ${n}`,agentCount:0,models:[]},l.set(n,c)),c};for(const n of e)n.type==="workflow_phase"&&r(n.index,n.title);for(const n of e)if(n.type==="workflow_agent"&&n.phaseIndex!=null){const a=r(n.phaseIndex,n.phaseTitle);a.agentCount++,n.model&&!a.models.includes(n.model)&&a.models.push(n.model)}if(l.size)return[...l.keys()].sort((n,a)=>n-a).map(n=>l.get(n))}return t.map(l=>({title:l,agentCount:0,models:[]}))}function cs({a:e}){const t=e.agent_description||e.title||e.id.slice(0,12);return s.jsxs("li",{children:[s.jsx(O,{to:`/session/${e.id}`,children:t}),e.agent_type&&s.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&s.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),s.jsxs("span",{className:"muted",children:[" ","· ",(e.models??"").split(",").filter(Boolean).map($).join(", ")||"—"," ·"," ",J(e.tokens)," tok · ",F(e.cost),e.duration_ms!=null?` · ${I(e.duration_ms)}`:""]})]})}function hs(){var m,j,x,b,v,i,h,_,f,R;const{run_id:e}=z(),[t,l]=p.useState(null),[r,n]=p.useState(null);if(p.useEffect(()=>{l(null),n(null),H("/workflows/"+e).then(l).catch(d=>n(String(d)))},[e]),r)return s.jsx("div",{className:"error",role:"alert",children:r});if(!t)return s.jsx("div",{className:"muted pad",role:"status","aria-live":"polite",children:"Loading…"});const a=(t.status??"").toLowerCase(),c=((m=t.run)==null?void 0:m.agent_count)??t.stats.agent_count,o=((j=t.run)==null?void 0:j.total_tokens)??t.stats.total_tokens,y=((x=t.run)==null?void 0:x.duration_ms)??t.stats.duration_ms,P=(((b=t.run)==null?void 0:b.phases)??[]).map(d=>d==null?void 0:d.title).filter(d=>!!d),w=rs((v=t.run)==null?void 0:v.progress,P),u=((i=t.run)==null?void 0:i.logs)??[];return s.jsxs("div",{className:"detail",children:[s.jsxs("div",{className:"detail-head",children:[s.jsx(O,{to:"/",className:"back",children:"← all sessions"}),s.jsxs("h1",{children:["🔀 ",t.name||"workflow"]}),s.jsxs("div",{className:"detail-meta",children:[s.jsx("code",{children:t.run_id}),t.status&&s.jsx("span",{className:"tag task-status task-status-"+a,children:t.status}),((h=t.run)==null?void 0:h.default_model)&&s.jsx("span",{className:"tag",children:$(t.run.default_model)}),((_=t.parent)==null?void 0:_.id)&&s.jsxs("span",{className:"spawned-by",children:["↖ launched from"," ",s.jsx(O,{to:`/session/${t.parent.id}`,children:t.parent.title||t.parent.id.slice(0,12)}),t.parent.turn_seq!=null?` · turn ${t.parent.turn_seq+1}`:""]}),s.jsxs("span",{children:[c," agent",c===1?"":"s"]}),s.jsxs("span",{children:[J(o)," tok"]}),((f=t.run)==null?void 0:f.total_tool_calls)!=null&&s.jsxs("span",{children:[t.run.total_tool_calls," tool calls"]}),s.jsx("span",{title:"Estimated from ingested agent transcripts at API list prices (cache-aware)",children:F(t.stats.total_cost)}),s.jsx("span",{children:I(y)}),s.jsx("span",{className:"muted",children:Q(((R=t.run)==null?void 0:R.started_at)??t.stats.started_at)})]}),w.length>0&&s.jsx("div",{className:"wf-phases","aria-label":"workflow phases",children:w.map((d,k)=>s.jsxs(p.Fragment,{children:[k>0&&s.jsx("span",{className:"wf-phase-arrow","aria-hidden":"true",children:"→"}),s.jsxs("div",{className:"wf-phase-chip",children:[s.jsx("span",{className:"wf-phase-title",children:d.title}),d.agentCount>0&&s.jsxs("span",{className:"wf-phase-desc",children:[d.agentCount," agent",d.agentCount===1?"":"s",d.models.length?` · ${d.models.map($).join(", ")}`:""]})]})]},k))})]}),t.completion&&s.jsxs("div",{className:"wf-result",children:[s.jsxs("h2",{children:["Returned result",t.completion.status&&s.jsx("span",{className:"tag task-status task-status-"+t.completion.status.toLowerCase(),children:t.completion.status})]}),t.completion.summary&&s.jsx("p",{className:"wf-result-summary",children:S(t.completion.summary)}),t.completion.result?s.jsx(ls,{raw:t.completion.result}):s.jsx("div",{className:"muted small",children:"Completed with no returned payload."}),t.completion.failures&&s.jsxs("details",{className:"wf-failures",children:[s.jsx("summary",{children:"failures"}),s.jsx("pre",{className:"code wf-result-body",children:S(t.completion.failures)})]})]}),u.length>0&&s.jsxs("details",{className:"wf-logs",open:u.length<=20,children:[s.jsxs("summary",{children:["Run log · ",u.length," line",u.length===1?"":"s"]}),s.jsx("ul",{className:"wf-log-list",children:u.map((d,k)=>s.jsx("li",{children:d},k))})]}),t.input_json?s.jsx("div",{className:"wf-result wf-launch",children:t.completion?s.jsxs("details",{children:[s.jsx("summary",{children:s.jsx("h2",{children:"Launch payload"})}),s.jsx(V,{raw:t.input_json})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Launch payload"}),a==="async_launched"&&s.jsx("p",{className:"wf-result-summary muted",children:"Launched asynchronously — results will appear here once the run reports back."}),s.jsx(V,{raw:t.input_json})]})}):!t.completion&&t.result_summary?s.jsxs("div",{className:"wf-result",children:[s.jsx("h2",{children:"Workflow launch"}),s.jsx("div",{className:"text md",children:s.jsx(K,{remarkPlugins:[q],children:t.result_summary})})]}):null,s.jsxs("div",{className:"subagents",children:[s.jsxs("h2",{children:["Agents (",t.agents.length,")"]}),t.agents.length===0?s.jsx("div",{className:"muted pad",role:"status",children:"No agent transcripts ingested for this run yet."}):s.jsx("ul",{children:t.agents.map(d=>s.jsx(cs,{a:d},d.id))})]})]})}export{hs as default};
|