takotrace 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { userMessageSummary } from './user-message.js';
1
2
  function record(value) {
2
3
  return value && typeof value === 'object' ? value : {};
3
4
  }
@@ -30,15 +31,11 @@ function summaryFor(method, params) {
30
31
  ?? stringAt(firstText, ['text'])
31
32
  ?? stringAt(values, ['thread', 'name'], ['thread', 'preview']);
32
33
  if (text) {
33
- const summary = item.type === 'userMessage' ? extractUserRequest(text) : text;
34
+ const summary = item.type === 'userMessage' ? userMessageSummary(text) : text;
34
35
  return summary.length > 160 ? `${summary.slice(0, 157)}...` : summary;
35
36
  }
36
37
  return method.replaceAll('/', ' ');
37
38
  }
38
- function extractUserRequest(text) {
39
- const marker = /## My request:\s*/i.exec(text);
40
- return marker ? text.slice(marker.index + marker[0].length).trim() : text;
41
- }
42
39
  function eventStatus(method, params) {
43
40
  const explicit = stringAt(params, ['status'], ['turn', 'status'], ['item', 'status']);
44
41
  if (explicit === 'failed' || explicit === 'error' || explicit === 'cancelled' || explicit === 'systemError')
@@ -1 +1 @@
1
- {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../src/shared/trace.ts"],"names":[],"mappings":"AAMA,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAE,KAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,GAAG,KAAiB;IACpD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAO,GAAY,KAAK,CAAC;QAC7B,KAAK,MAAM,GAAG,IAAI,IAAI;YAAE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;QACvD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OA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,EAAE;QAC7E,MAAM,EAAE,kBAAkB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc;QAC5F,WAAW,EAAE,MAAM,CAAC,WAAW,KAAK,IAAI;QACxC,aAAa,EAAE,MAAM,CAAC,aAAa,KAAK,cAAc,IAAI,MAAM,CAAC,aAAa,KAAK,YAAY;YAC7F,CAAC,CAAC,MAAM,CAAC,aAAa;YACtB,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9D,QAAQ;QACR,SAAS;QACT,SAAS;QACT,GAAG;QACH,aAAa;QACb,SAAS,EAAE,OAAO,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QAC/E,aAAa,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,eAAe,CAAC,CAAC;QAClD,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC;QACjC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,YAAY,EAAE,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC;QACjD,aAAa;QACb,SAAS;QACT,SAAS;QACT,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC;QACtE,UAAU;QACV,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface QuestionReply {
2
+ question: string;
3
+ answer: string;
4
+ }
5
+ export declare function parseQuestionReply(text: string): QuestionReply[] | undefined;
6
+ export declare function extractUserRequest(text: string): string;
7
+ export declare function userMessageSummary(text: string): string;
8
+ export declare function userMessageText(raw: Record<string, unknown>): string | undefined;
@@ -0,0 +1,41 @@
1
+ export function parseQuestionReply(text) {
2
+ const match = /^\s*<send_user_message_question_reply>\s*([\s\S]*?)\s*<\/send_user_message_question_reply>\s*$/.exec(text);
3
+ if (!match)
4
+ return undefined;
5
+ try {
6
+ const value = JSON.parse(match[1]);
7
+ if (!Array.isArray(value) || !value.length)
8
+ return undefined;
9
+ const replies = [];
10
+ for (const entry of value) {
11
+ if (!entry || typeof entry !== 'object'
12
+ || typeof entry.question !== 'string' || typeof entry.answer !== 'string')
13
+ return undefined;
14
+ replies.push({ question: entry.question, answer: entry.answer });
15
+ }
16
+ return replies;
17
+ }
18
+ catch {
19
+ return undefined;
20
+ }
21
+ }
22
+ export function extractUserRequest(text) {
23
+ if (parseQuestionReply(text))
24
+ return text.trim();
25
+ const marker = /## My request:\s*/i.exec(text);
26
+ return marker ? text.slice(marker.index + marker[0].length).trim() : text;
27
+ }
28
+ export function userMessageSummary(text) {
29
+ const request = extractUserRequest(text);
30
+ const replies = parseQuestionReply(request);
31
+ return replies
32
+ ? `Answer: ${replies.map(({ answer }) => answer.trim() || '(empty)').join('; ')}`
33
+ : request;
34
+ }
35
+ export function userMessageText(raw) {
36
+ const content = Array.isArray(raw.content)
37
+ ? raw.content.map((entry) => entry && typeof entry.text === 'string' ? entry.text : '').filter(Boolean).join('\n\n')
38
+ : typeof raw.text === 'string' ? raw.text : '';
39
+ return extractUserRequest(content).trim() || undefined;
40
+ }
41
+ //# sourceMappingURL=user-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-message.js","sourceRoot":"","sources":["../../src/shared/user-message.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,MAAM,KAAK,GAAG,gGAAgG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1H,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IA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C5C,OAAO,OAAO;QACZ,CAAC,CAAC,WAAW,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACjF,CAAC,CAAC,OAAO,CAAC;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAA4B;IAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;QACxC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;QACpH,CAAC,CAAC,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;AACzD,CAAC"}
@@ -1,8 +1,10 @@
1
- import{n as b,a as A,t as k,e as C,b as B,c as je,w as se,d as pe,f as N,r as q,j as r,g as Ae,S as J,I as L,h as Ie,i as ae,k as ie,E as oe,H as Ne,u as Te,l as Ce,m as Ee}from"./index-DAKYA9eR.js";function ge(e){var n;const t=(n=b(e))==null?void 0:n.replaceAll("\\","/");if(!(!t||!t.includes("/skills/")&&!t.startsWith("skills/")||!t.endsWith("/SKILL.md")))return t.split("/").at(-2)}function Pe(e){return(Array.isArray(e.commandActions)?e.commandActions:Array.isArray(e.parsed_cmd)?e.parsed_cmd:[]).map(A)}function Le(e){return((b(e)??(Array.isArray(e)?e.filter(i=>typeof i=="string").join(" "):"")).match(/(?:file:\/\/)?[^\s"'`]*skills\/[^\s"'`]+\/SKILL\.md/g)??[]).map(ge).filter(i=>!!i)}function Re(e){const t=Pe(e).filter(a=>{var s;return((s=b(a.type))==null?void 0:s.toLowerCase())==="read"}).map(a=>ge(a.path)),n=[...new Set([...t,...Le(e.command)].filter(a=>!!a))];if(!n.length)return;const i=n.length>1?` +${n.length-1}`:"";return{names:n,displayTitle:`Skill load · ${n[0]}${i} (inferred)`}}function re(e){const i=(Array.isArray(e.receiverAgents)?e.receiverAgents:Array.isArray(e.receiver_agents)?e.receiver_agents:[]).map(A).map(a=>b(a.agentNickname)??b(a.agent_nickname)??b(a.agentPath)??b(a.agent_path)).find(Boolean)??b(e.agentPath)??b(e.agent_path);return i==null?void 0:i.split("/").filter(Boolean).pop()}function Be(e){const t=e.content;if(!Array.isArray(t))return;const n=t.map(s=>b(A(s).text)).filter(Boolean).join(`
1
+ import{n as b,a as I,t as k,e as C,u as je,p as Ae,b as Ie,c as B,d as Ne,w as se,f as pe,g as N,r as q,j as r,h as Te,S as Q,I as L,i as Ce,k as ae,l as ie,E as oe,H as Ee,m as Pe,o as Le,q as Re}from"./index-B3iTjFZs.js";function ge(e){var n;const t=(n=b(e))==null?void 0:n.replaceAll("\\","/");if(!(!t||!t.includes("/skills/")&&!t.startsWith("skills/")||!t.endsWith("/SKILL.md")))return t.split("/").at(-2)}function Be(e){return(Array.isArray(e.commandActions)?e.commandActions:Array.isArray(e.parsed_cmd)?e.parsed_cmd:[]).map(I)}function We(e){return((b(e)??(Array.isArray(e)?e.filter(i=>typeof i=="string").join(" "):"")).match(/(?:file:\/\/)?[^\s"'`]*skills\/[^\s"'`]+\/SKILL\.md/g)??[]).map(ge).filter(i=>!!i)}function De(e){const t=Be(e).filter(a=>{var s;return((s=b(a.type))==null?void 0:s.toLowerCase())==="read"}).map(a=>ge(a.path)),n=[...new Set([...t,...We(e.command)].filter(a=>!!a))];if(!n.length)return;const i=n.length>1?` +${n.length-1}`:"";return{names:n,displayTitle:`Skill load · ${n[0]}${i} (inferred)`}}function re(e){const i=(Array.isArray(e.receiverAgents)?e.receiverAgents:Array.isArray(e.receiver_agents)?e.receiver_agents:[]).map(I).map(a=>b(a.agentNickname)??b(a.agent_nickname)??b(a.agentPath)??b(a.agent_path)).find(Boolean)??b(e.agentPath)??b(e.agent_path);return i==null?void 0:i.split("/").filter(Boolean).pop()}function Fe(e){if(Array.isArray(e.summary))return e.summary.map(b).filter(Boolean).join(`
2
+ `)||void 0}function Oe(e){if(e!=null)try{const t=JSON.stringify(e,null,2);return t.length>1200?`${t.slice(0,1200)}
3
+ …`:t}catch{return String(e)}}function He(e){return(Array.isArray(e.changes)?e.changes.map(n=>{const i=I(n),a=b(I(i.kind).type)??b(i.kind)??b(i.type)??"changed",s=b(i.path);return s?`${a} · ${s}`:void 0}):Object.entries(I(e.changes)).map(([n,i])=>{const a=I(i);return`${b(a.type)??b(I(a.kind).type)??b(a.kind)??"changed"} · ${n}`})).join(`
4
+ `)||void 0}function F(e){const t=C(e);let i=(b(t.type)??e.type).toLowerCase();i==="item"&&(e.method.includes("agentMessage")?i="agentmessage":e.method.includes("reasoning")?i="reasoning":e.method.includes("commandExecution")?i="commandexecution":e.method.includes("mcpToolCall")&&(i="mcptoolcall"));const a=e.summary&&e.summary!=="item started"&&e.summary!=="item completed"?e.summary:"No additional detail";if(i==="usermessage"){const s=je(t)??a,l=Ae(s);return l?{kind:"user",label:"User",title:"Answer",summary:Ie(s),detail:l.map(({question:c,answer:p})=>`Question: ${c}
2
5
 
3
- `),i="## My request:",a=n.indexOf(i);return(a>=0?n.slice(a+i.length):n).trim()||void 0}function We(e){if(Array.isArray(e.summary))return e.summary.map(b).filter(Boolean).join(`
4
- `)||void 0}function De(e){if(e!=null)try{const t=JSON.stringify(e,null,2);return t.length>1200?`${t.slice(0,1200)}
5
- …`:t}catch{return String(e)}}function Fe(e){return(Array.isArray(e.changes)?e.changes.map(n=>{const i=A(n),a=b(A(i.kind).type)??b(i.kind)??b(i.type)??"changed",s=b(i.path);return s?`${a} · ${s}`:void 0}):Object.entries(A(e.changes)).map(([n,i])=>{const a=A(i);return`${b(a.type)??b(A(a.kind).type)??b(a.kind)??"changed"} · ${n}`})).join(`
6
- `)||void 0}function F(e){const t=C(e);let i=(b(t.type)??e.type).toLowerCase();i==="item"&&(e.method.includes("agentMessage")?i="agentmessage":e.method.includes("reasoning")?i="reasoning":e.method.includes("commandExecution")?i="commandexecution":e.method.includes("mcpToolCall")&&(i="mcptoolcall"));const a=e.summary&&e.summary!=="item started"&&e.summary!=="item completed"?e.summary:"No additional detail";if(i==="usermessage")return{kind:"user",label:"User",title:"Request",detail:Be(t)??a};if(i==="agentmessage"){const s=b(t.phase);return{kind:"agent",label:"Agent",title:s==="commentary"?"Update":s==="final_answer"?"Final response":"Message",detail:b(t.text)??a,meta:s}}if(i==="reasoning")return{kind:"reasoning",label:"Agent",title:"Reasoning",detail:We(t)??a};if(i==="subagentactivity"){const s=b(t.kind)??"activity",d=B(s),c=b(t.agentPath)??b(t.agent_path)??"Subagent",p=re(t)??"Subagent",m={started:{label:"Start",title:"Started",direction:"call"},interacted:{label:"Update",title:"Update",direction:"return"},completed:{label:"Result",title:"Result",direction:"return"},interrupted:{label:"Interrupted",title:"Interrupted",direction:"return"},failed:{label:"Failed",title:"Failed",direction:"return"}}[d],g=`${s[0].toUpperCase()}${s.slice(1)}`;return{kind:"subagent",label:(m==null?void 0:m.label)??"Subagent",title:`${(m==null?void 0:m.title)??g} · ${p}`,detail:c,meta:b(t.agentThreadId)??b(t.agent_thread_id),sequenceDirection:(m==null?void 0:m.direction)??"call"}}if(i==="collabagenttoolcall"){const s=b(t.tool)??"collaboration",d=B(s),c={spawnagent:"Fork",sendinput:"Message",sendmessage:"Message",followuptask:"Message",resumeagent:"Resume",wait:"Wait",waitagent:"Wait",interruptagent:"Interrupt",closeagent:"Close"}[d]??s,m=(Array.isArray(t.receiverThreadIds)?t.receiverThreadIds:Array.isArray(t.receiver_thread_ids)?t.receiver_thread_ids:[]).filter(x=>typeof x=="string"),v=re(t)??(m.length>1?`${m.length} subagents`:void 0),f=c==="Wait",o=f?`Wait for ${v??"subagents"}`:v?`${c} · ${v}`:c,l=A(t.result),h=b(l.message),_=l.timed_out===!0||l.timedOut===!0;return{kind:"subagent",label:c,title:o,detail:h??b(t.prompt)??(m.length?`Targets: ${m.join(", ")}`:a),meta:b(t.model)??void 0,showStatus:!0,statusLabel:_?"Timed out":f&&e.status==="completed"?"Wait ended":void 0,sequenceDirection:"call"}}if(i==="commandexecution"){const s=typeof t.exitCode=="number"?`exit ${t.exitCode}`:void 0,d=je(t.command),c=Re(t);return c?{kind:"skill",label:"Skill",title:c.displayTitle,detail:d??a,meta:[se(t.cwd),s].filter(Boolean).join(" · ")||void 0,showStatus:!0}:{kind:"tool",label:"Tool",title:d?`Shell · ${d.split(`
7
- `,1)[0].slice(0,112)}`:"Shell",detail:d??a,meta:[se(t.cwd),s].filter(Boolean).join(" · ")||void 0,showStatus:!0}}if(i.includes("skill"))return{kind:"skill",label:"Skill",title:`Skill · ${b(t.name)??b(t.skill)??e.summary??"Skill"}`,detail:b(t.prompt)??b(t.path)??a,showStatus:!0};if(i==="mcptoolcall"){const s=b(t.server),d=b(t.tool)??e.summary??"MCP tool",c=pe(t);return{kind:"mcp",label:"MCP",title:(c==null?void 0:c.displayTitle)??[s,d].filter(Boolean).join(" · "),participantName:s,detail:De(t.arguments)??a,showStatus:!0}}return i==="filechange"?{kind:"file",label:"Tool",title:"File change",detail:Fe(t)??a,showStatus:!0}:i.includes("websearch")?{kind:"web",label:"Tool",title:"Web search",detail:a,showStatus:!0}:i.includes("tool")||i.includes("image")||i.includes("browser")?{kind:"tool",label:"Tool",title:e.type,detail:a,showStatus:!0}:{kind:"system",label:"System",title:e.type||e.method,detail:a}}function fe(e){const t=new Map;for(const n of e){const i=n.method.includes("started"),a=n.method.includes("completed")||n.method.includes("failed"),s={...n,startedSeq:n.startedSeq??(i?n.seq:void 0),completedSeq:n.completedSeq??(a?n.seq:void 0),startedAt:n.startedAt??(i?n.at:void 0),completedAt:n.completedAt??(a?n.at:void 0)},d=s.itemId?`item:${s.threadId}:${s.turnId??""}:${s.itemId}`:`event:${s.threadId}:${s.turnId??""}:${s.seq}`,c=t.get(d);if(!c){t.set(d,s);continue}const p=s.method.includes("completed")||s.method.includes("failed"),m=c.method.includes("completed")||c.method.includes("failed"),g=p||!m?s:c,v=g===s?c:s;t.set(d,{...v,...g,seq:Math.min(c.seq,s.seq),at:c.at<s.at?c.at:s.at,startedSeq:c.startedSeq??s.startedSeq,completedSeq:s.completedSeq??c.completedSeq,startedAt:c.startedAt??s.startedAt,completedAt:s.completedAt??c.completedAt,parentItemId:s.parentItemId??c.parentItemId,durationMs:s.durationMs??c.durationMs})}return[...t.values()].sort((n,i)=>{const a=k(n.startedAt)??k(n.at)??k(n.completedAt),s=k(i.startedAt)??k(i.at)??k(i.completedAt);return a!==void 0&&s!==void 0&&a!==s?a-s:n.seq-i.seq})}function I(e){return e==="user"?"user":e==="agent"||e==="reasoning"?"agent":e==="mcp"?"mcp":e==="subagent"?"subagent":e==="skill"?"skill":e==="file"?"file":e==="web"?"web":e==="tool"?"tool":"activity"}function W(e){return N(e)}function Oe(e){return e.filter(t=>{const n=F(t).kind;return n!=="user"&&n!=="agent"&&n!=="reasoning"&&n!=="system"})}function He(e){return e.flatMap(t=>{if(t.timingSource==="turn-fallback")return[];const n=k(t.startedAt),i=k(t.completedAt);return n!==void 0&&i!==void 0&&i>n?[{id:W(t),start:n,end:i}]:[]})}function Ue(e){const t=Math.max(0,...e.map(n=>n.completedSeq??n.startedSeq??n.seq))+1;return e.flatMap(n=>{const i=n.startedSeq,a=n.completedSeq??(n.status==="running"?t:void 0);return i!==void 0&&a!==void 0&&a>i?[{id:W(n),start:i,end:a}]:[]})}function ce(e,t,n){const i=[...e].sort((p,m)=>p.start-m.start||p.end-m.end),a=[];let s=[],d=Number.NEGATIVE_INFINITY;const c=()=>{if(s.length<2)return;const p=s.flatMap(f=>[{at:f.start,delta:1},{at:f.end,delta:-1}]).sort((f,o)=>f.at-o.at||f.delta-o.delta);let m=0,g=0;for(const f of p)m+=f.delta,g=Math.max(g,m);if(g<2)return;const v=s.map(f=>f.id);a.push({id:`parallel-${t}-${v.join("-")}`,eventIds:v,maxConcurrency:g,evidence:t,confidence:n})};for(const p of i)s.length&&p.start>=d&&(c(),s=[],d=Number.NEGATIVE_INFINITY),s.push(p),d=Math.max(d,p.end);return c(),a}function le(e){return(Array.isArray(e.receiverThreadIds)?e.receiverThreadIds:Array.isArray(e.receiver_thread_ids)?e.receiver_thread_ids:[]).filter(n=>typeof n=="string"&&!!n.trim())}function ze(e){const t=[];let n=[];const i=(a=n)=>{if(!a.length)return;const s=new Set(a.flatMap(c=>c.targets)),d=Math.max(s.size,a.length===1?0:a.length);if(d>1){const c=a.map(p=>p.id);t.push({id:`parallel-fork-join-${c.join("-")}`,eventIds:c,maxConcurrency:d,evidence:"fork-join",confidence:"structured"})}};for(const a of e){const s=C(a),d=B(s.type??a.type);if(d==="subagentactivity"){const p=B(s.kind),m=typeof(s.agentThreadId??s.agent_thread_id)=="string"?String(s.agentThreadId??s.agent_thread_id).trim():"";m&&["completed","failed","interrupted"].includes(p)&&(n=n.filter(g=>!g.targets.includes(m)));continue}if(d!=="collabagenttoolcall")continue;const c=B(s.tool);if(c==="spawnagent"||c==="resumeagent")n.push({id:W(a),targets:le(s)});else if(c==="wait"||c==="waitagent"){const p=new Set(le(s)),m=p.size?n.filter(v=>v.targets.some(f=>p.has(f))):n;i(m);const g=new Set(m.map(v=>v.id));n=n.filter(v=>!g.has(v.id))}}return i(),t}function Ve(e){return[...e.eventIds].sort().join("\0")}function he(e){const t=Oe(e),n=[...ce(He(t),"timestamp","confirmed"),...ce(Ue(t),"lifecycle","confirmed"),...ze(t)],i={timestamp:3,lifecycle:2,"fork-join":1},a=new Map;for(const s of n){const d=Ve(s),c=a.get(d);(!c||i[s.evidence]>i[c.evidence])&&a.set(d,s)}return[...a.values()]}function Ke(e){return e.evidence==="fork-join"?`Parallel dispatch ×${e.maxConcurrency}`:`Parallel ×${e.maxConcurrency}`}function Ge(e){if(e.timingSource==="turn-fallback")return{timing:"order"};const t=k(e.startedAt),n=k(e.completedAt);if(t!==void 0&&n!==void 0&&n>=t)return{startedAtMs:t,completedAtMs:n,timing:"observed"};if(e.durationMs!==void 0&&e.durationMs>0){const i=n??(e.method.includes("completed")||e.method.includes("failed")?k(e.at):void 0);if(i!==void 0)return{startedAtMs:i-e.durationMs,completedAtMs:i,timing:"inferred"}}return{timing:"order"}}function de(e,t,n,i){const a=t.kind==="mcp",s=Ge(e),d=C(e),c=t.kind==="tool"&&typeof d.exitCode=="number"&&d.exitCode!==0;return{id:N(e),batch:n,event:e,kind:t.kind,label:a?"Tool":t.label,title:a?`MCP · ${t.title}`:t.title,detail:t.detail,meta:t.meta,status:c?"failed":e.status,statusLabel:c?void 0:t.statusLabel,durationMs:e.durationMs,parallel:i,...s}}function Je(e){const t=fe(e).map(c=>({event:c,node:F(c)})),n=new Map;for(const c of he(t.map(({event:p})=>p)))for(const p of c.eventIds)n.has(p)||n.set(p,c);const i=[];let a,s=!0,d=0;for(const c of t){if(c.node.kind==="user"||c.node.kind==="agent"){const g=N(c.event);i.push({type:"message",id:g,event:c.event,node:c.node}),a=c.node.kind==="agent"?g:void 0,s=!0,d=0;continue}(c.node.kind==="reasoning"||c.node.kind==="system")&&(d+=1);const p=i[i.length-1],m=n.get(W(c.event));!s&&(p==null?void 0:p.type)==="execution"?p.actions.push(de(c.event,c.node,d,m)):i.push({type:"execution",id:`execution-${N(c.event)}`,ownerAgentId:a,actions:[de(c.event,c.node,d,m)]}),s=!1}return{blocks:i}}const X=[{key:"user",label:"Input"},{key:"agent",label:"Agent"},{key:"tools",label:"Tools"},{key:"mcp",label:"MCP"},{key:"subagents",label:"Subagents"}],R=.8,V=8;function ue(e){return e==="user"?"user":e==="agent"||e==="reasoning"?"agent":e==="mcp"?"mcp":e==="subagent"?"subagents":"tools"}function Xe(e){if(e.timingSource==="turn-fallback")return{startedAtMs:e.seq,completedAtMs:e.seq,timing:"order"};const t=k(e.startedAt),n=k(e.completedAt);if(t!==void 0&&n!==void 0&&n>=t)return{startedAtMs:t,completedAtMs:n,timing:"observed"};const i=n??k(e.at)??e.seq;return e.durationMs!==void 0&&e.durationMs>0?{startedAtMs:i-e.durationMs,completedAtMs:i,timing:"inferred"}:{startedAtMs:i,completedAtMs:i,timing:"order"}}function Ye(e){const t=[];for(const n of Je(e).blocks){if(n.type==="execution"){for(const a of n.actions){const s=a.startedAtMs??k(a.event.startedAt)??k(a.event.at)??a.event.seq,d=a.completedAtMs??k(a.event.completedAt)??(a.durationMs===void 0?s:s+a.durationMs);t.push({id:a.id,kind:a.kind,label:`${a.label} · ${a.title}`,lane:ue(a.kind),startedAtMs:s,completedAtMs:Math.max(s,d),timing:a.timing})}continue}const i=Xe(n.event);t.push({id:n.id,kind:n.node.kind,label:`${n.node.label} · ${n.node.title}`,lane:ue(n.node.kind),...i})}return t}function Qe(e,t){if(!e.length)return[];const n=Math.min(...e.map(m=>m.startedAtMs)),i=Math.max(...e.map(m=>m.completedAtMs)),a=Math.max(1,i-n),s=new Map(X.map(m=>[m.key,Math.max(1,...e.filter(g=>g.lane===m.key).map(g=>g.completedAtMs-g.startedAtMs))])),d=100/e.length,c=Math.min(1,d*.15),p=e.map((m,g)=>{const v=Math.max(0,m.completedAtMs-m.startedAtMs);if(t==="logical"){const h=Math.max(R,d-c),_=v===0?0:Math.sqrt(v/s.get(m.lane)),x=R+(h-R)*_;return{...m,left:g*d,width:x,track:0}}const f=Math.min(100-R,(m.startedAtMs-n)/a*100),o=v/a*100,l=Math.min(100-f,Math.max(0,o));return{...m,left:f,width:l,track:0}});for(const m of X){const g=[],v=p.filter(f=>f.lane===m.key).sort((f,o)=>f.left-o.left);for(const f of v){const o=t==="logical"?0:Math.max(0,g.findIndex(l=>l<=f.left));f.track=o===-1?g.length:o,g[f.track]=f.left+f.width}}return p}function Ze(e){const t=e.filter(i=>i.timing!=="order");if(t.length<2||t.every(i=>i.timing==="inferred")&&new Set(t.map(i=>i.completedAtMs)).size===1)return!1;const n=t.map(i=>i.startedAtMs);return new Set(n).size>1&&Math.max(...t.map(i=>i.completedAtMs))>Math.min(...n)}function et({items:e,onSelect:t,selectedId:n}){const i=q.useMemo(()=>Ye(e),[e]);if(!i.length)return null;const a=Ze(i)?"actual":"logical",s=Qe(i,a),d=X.filter(o=>s.some(l=>l.lane===o.key)),c=new Map,p=new Map;let m=0;for(const o of d){const l=s.filter(x=>x.lane===o.key),h=Math.max(1,...l.map(x=>x.track+1)),_=Math.max(18,h*V+6);p.set(o.key,m),c.set(o.key,_),m+=_}const v=(a==="actual"?[...s].sort((o,l)=>o.startedAtMs-l.startedAtMs):s).map(o=>({x:o.left+Math.min(o.width/2,R/2),y:p.get(o.lane)+o.track*V+7})),f=v.reduce((o,l,h)=>h===0?`M ${l.x} ${l.y}`:`${o} H ${l.x} V ${l.y}`,"");return r.jsx("div",{"aria-label":"Trace overview",className:"vbg-custom-replay-overview",title:a==="actual"?"Bar width represents duration":"Bar width represents relative duration",children:r.jsxs("div",{className:"vbg-custom-replay-overview__plot",style:{height:`${m}px`},children:[a==="logical"&&v.length>1&&r.jsxs("svg",{"aria-hidden":"true",className:"vbg-custom-replay-overview__sequence",preserveAspectRatio:"none",viewBox:`0 0 100 ${m}`,children:[r.jsx("defs",{children:r.jsx("marker",{id:"vbg-replay-arrow",markerHeight:"5",markerWidth:"5",orient:"auto",refX:"4",refY:"2.5",children:r.jsx("path",{d:"M 0 0 L 5 2.5 L 0 5 z"})})}),r.jsx("path",{d:f,markerEnd:"url(#vbg-replay-arrow)"})]}),d.map(o=>{const l=s.filter(h=>h.lane===o.key);return r.jsxs("div",{className:"vbg-custom-replay-overview__lane",style:{height:`${c.get(o.key)}px`},children:[r.jsx("span",{children:o.label}),r.jsx("div",{className:"vbg-custom-replay-overview__track",children:l.map(h=>{const _=Ae(Math.max(0,h.completedAtMs-h.startedAtMs)),x=h.timing==="observed"?"Observed timing":h.timing==="inferred"?"Estimated timing":"Order only",$=`${h.label} · ${_} · ${x}`,w=h.timing==="order"||h.completedAtMs===h.startedAtMs;return r.jsx("button",{"aria-label":$,"aria-pressed":n===h.id,className:`vbg-custom-replay-overview__bar vbg-custom-replay-overview__bar--${h.kind}${w?" vbg-custom-replay-overview__bar--point":""}`,"data-timing":h.timing,onClick:()=>t(h.id),style:{left:`${h.left}%`,top:`${h.track*V+3}px`,width:w?"8px":`max(6px, ${h.width}%)`},title:$,type:"button"},h.id)})})]},o.key)})]})})}function me({duration:e,durationLabel:t="Duration",from:n,startedAt:i,startedAtLabel:a,startedAtTitle:s,to:d,type:c}){const p=!!(n&&d);return r.jsx("section",{"aria-label":p?`Execution from ${n} to ${d}`:"Execution timing",className:"vbg-custom-execution-meta",children:r.jsxs("dl",{className:"vbg-custom-execution-meta__facts",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Started"}),r.jsx("dd",{children:r.jsx("time",{dateTime:i,title:s,children:a})})]}),r.jsxs("div",{children:[r.jsx("dt",{children:t}),r.jsx("dd",{children:e??"Not recorded"})]}),p&&r.jsxs("div",{children:[r.jsx("dt",{children:"Direction"}),r.jsxs("dd",{className:"vbg-custom-execution-meta__route",children:[r.jsx("code",{title:n,children:n}),r.jsx("span",{"aria-hidden":"true",className:"vbg-custom-execution-meta__arrow",children:"→"}),r.jsx("code",{title:d,children:d})]})]}),c&&r.jsxs("div",{children:[r.jsx("dt",{children:"Type"}),r.jsx("dd",{children:r.jsx("span",{className:"vbg-custom-execution-meta__type",children:c})})]})]})})}function tt(e){window.requestAnimationFrame(()=>{var t;return(t=document.getElementById(e))==null?void 0:t.focus()})}function nt({value:e}){const t=typeof e=="string";let n;try{n=t?e:JSON.stringify(e,null,2)}catch{n=String(e)}return r.jsx(Ne,{className:"vbg-custom-sequence__inspector-value",code:n,language:t?"plaintext":"json"})}function st({autoFocusClose:e=!0,item:t,onClose:n,onOpenSubagent:i}){const a=`execution-inspector-title-${t.seq}`,[s,d]=q.useState("overview"),c=[{id:"overview",label:"Overview"},{id:"raw",label:"Raw event"}],p=t.kind==="file"||t.kind==="web"?"tool":t.kind,m=p==="reasoning"?"Agent":p,g=p==="subagent",v=F(t.event).statusLabel??t.status,f=t.event.startedAt??t.at;return r.jsxs("aside",{className:"vbg-custom-sequence__inspector vbg-custom-sequence__inspector--tabbed",id:"execution-inspector","aria-labelledby":a,children:[r.jsxs("header",{className:"vbg-custom-sequence__inspector-header",children:[r.jsxs("div",{className:"vbg-custom-sequence__inspector-title",id:a,"aria-live":"polite",children:[r.jsxs("div",{className:"vbg-custom-sequence__inspector-title-meta",children:[r.jsx("span",{className:`vbg-custom-sequence__inspector-kind vbg-custom-sequence__inspector-kind--${p}`,children:m.toUpperCase()}),r.jsxs("span",{"aria-label":`Step ${t.seq}`,className:"vbg-custom-sequence__inspector-step",children:["#",t.seq]})]}),r.jsx("strong",{title:t.fullTitle??t.title,children:t.title})]}),r.jsxs("div",{className:"vbg-custom-sequence__inspector-actions",children:[r.jsx(J,{status:v}),r.jsx("button",{autoFocus:e,type:"button",className:"vbg-custom-sequence__inspector-close",onClick:n,"aria-label":"Close execution details",title:"Close details",children:r.jsx(L,{name:"close"})})]})]}),!g&&r.jsx("div",{"aria-label":"Execution details",className:"vbg-custom-sequence__inspector-tabs",role:"tablist",children:c.map(o=>r.jsx("button",{"aria-controls":"execution-inspector-panel","aria-selected":s===o.id,className:s===o.id?"is-active":void 0,id:`execution-inspector-tab-${o.id}`,onClick:()=>d(o.id),onKeyDown:Ie,role:"tab",tabIndex:s===o.id?0:-1,type:"button",children:o.label},o.id))}),r.jsx("div",{"aria-labelledby":g?a:`execution-inspector-tab-${s}`,className:"vbg-custom-sequence__inspector-panel",id:"execution-inspector-panel",role:g?void 0:"tabpanel",children:g?r.jsxs("div",{className:"vbg-custom-sequence__inspector-summary vbg-custom-sequence__inspector-summary--subagent",children:[r.jsx(me,{duration:t.durationMs===void 0?void 0:`${t.durationMs}ms`,durationLabel:"Event latency",startedAt:f,startedAtLabel:ie(f),startedAtTitle:ae(f)}),r.jsx(oe,{autoLoadSubagent:!0,event:t.event,expandResult:!0,fallback:t.detail,onOpenSubagent:i})]}):s==="overview"?r.jsxs("div",{className:"vbg-custom-sequence__inspector-summary",children:[r.jsx(me,{duration:t.durationMs===void 0?void 0:`${t.durationMs}ms`,from:t.from,startedAt:f,startedAtLabel:ie(f),startedAtTitle:ae(f),to:t.to,type:t.type}),r.jsxs("section",{className:"vbg-custom-sequence__inspector-section","aria-label":"Execution content",children:[r.jsx("h3",{children:"Content"}),r.jsx(oe,{autoLoadSubagent:!0,event:t.event,expandResult:!0,fallback:t.detail,onOpenSubagent:i})]})]}):r.jsx(nt,{value:C(t.event)})})]})}const be={user:{key:"user",label:"User",subtext:"Prompt / Feedback",iconName:I("user")},agent:{key:"agent",label:"Agent",subtext:"Orchestrator",iconName:I("agent")},tool:{key:"tool",label:"Tools",subtext:"Shell / Files",iconName:I("tool")},mcp:{key:"mcp",label:"MCP",subtext:"Protocol Tools",iconName:I("mcp")},subagent:{key:"subagent",label:"Subagent",subtext:"Collaborators",iconName:I("subagent")}},at={...be,user:{key:"user",label:"Parent Agent",subtext:"Orchestrator",iconName:I("agent")},agent:{key:"agent",label:"Subagent",subtext:"Current worker",iconName:I("subagent")},subagent:{key:"subagent",label:"Child Subagent",subtext:"Delegated worker",iconName:I("subagent")}};function it(e){return e==="user"?"user":e==="agent"||e==="reasoning"?"agent":e==="mcp"?"mcp":e==="subagent"?"subagent":"tool"}function ot(e,t){if(!t)return!1;const n=C(e),i=typeof n.agentThreadId=="string"?n.agentThreadId:typeof n.agent_thread_id=="string"?n.agent_thread_id:void 0;if(t.parentThreadId&&i===t.parentThreadId)return!0;const a=typeof n.agentPath=="string"?n.agentPath:typeof n.agent_path=="string"?n.agent_path:void 0;return!a||!t.agentPath||a===t.agentPath?!1:t.agentPath.startsWith(`${a.replace(/\/$/,"")}/`)}const rt=/^(?:(?:\/usr)?\/bin\/)?(?:zsh|bash|sh)\s+-(?:lc|c)\s+/i;function ct(e){const t=e.trim(),n=t[0];if(n!=='"'&&n!=="'"||t.at(-1)!==n)return;if(n==='"'){let a=0;for(let s=t.length-2;s>=0&&t[s]==="\\";s-=1)a+=1;if(a%2===1)return}const i=t.slice(1,-1);return n==='"'?i.replace(/\\(["'\\])/g,"$1"):i.replace(/'\\''/g,"'")}function lt(e){var n;const t=e.match(/^((?:node|cat)\s+)(["']?)([^"'\s]*\/)([^/"'\s]+)\2(?=$|\s)/);return!t||(((n=t[3].match(/\//g))==null?void 0:n.length)??0)<2?e:e.replace(t[0],`${t[1]}${t[2]}…/${t[4]}${t[2]}`)}function ve(e){let t=e.trim().split(/\r?\n/,1)[0]??"";for(let n=0;n<4;n+=1){const i=t.match(rt);if(!i)break;const a=ct(t.slice(i[0].length));if(a===void 0)break;t=a}return t.replace(/\s+/g," ").trim()||e.trim()}function dt(e,t){let n=ve(e);if(t!=null&&t.startsWith("/")){const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp(`${i}(?=$|[\\s/"'])`,"g"),".")}return n=n.replace(/\/Users\/[^/\s"'\\]+/g,"~"),n=lt(n),n||e.trim()}function ut(e){return e.type.toLowerCase()==="commandexecution"||e.method.toLowerCase().includes("commandexecution")}function mt(e){return e.replace(/^Skill(?: load)? · /,"").replace(/ \(inferred\)$/,"")}function pt(e,t){const n=e.split(/\r?\n/).map(a=>a.trim()).find(a=>a&&!/^```/.test(a));return!n||n==="No additional detail"?t:n.replace(/^#{1,6}\s+/,"").replace(/^>\s*/,"").replace(/^[-+*]\s+/,"").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/~~([^~]+)~~/g,"$1").replace(/[*_]/g,"").replace(/\s+/g," ").trim()||t}function gt(e){if(!(e.kind!=="user"&&e.kind!=="agent"&&e.kind!=="reasoning"))return pt(e.detail,e.title)}function ft(e,t,n){return t?"terminal":e.kind==="agent"?"message":e.kind==="reasoning"?"activity":n??I(e.kind)}function D(e,t){var g;const n=e.kind==="tool"&&ut(t),i=e.kind==="skill",a=e.kind==="mcp"?pe(C(t)):void 0,s=(a==null?void 0:a.kind)==="browser"?"web":(a==null?void 0:a.kind)==="computer-use"?"monitor":(a==null?void 0:a.kind)==="javascript"?"braces":void 0,d=(g=e.meta)==null?void 0:g.split(" · ",1)[0],c=n?dt(e.detail,d):void 0,p=n?ve(e.detail):void 0,m=gt(e);return{displayIcon:ft(e,n,s),displayTitle:c??m??(i?mt(e.title):(a==null?void 0:a.title)??e.title),detailTitle:p?`Shell · ${p}`:m&&m!==e.title?`${e.title} · ${m}`:e.title,exportTitle:c?`Shell · ${c}`:e.title,isCommand:n}}function ht(e,t="main",n){const i=fe(e).map(o=>({event:o,node:F(o)})),a=[],s=new Set(["user","agent"]);let d=1;for(const{event:o,node:l}of i)if(l.kind==="user")s.add("user"),s.add("agent"),a.push({id:`seq-${N(o)}`,seq:d++,from:"user",to:"agent",type:"call",label:t==="subagent"?"Task input":"User prompt",title:l.title,...D(l,o),detail:l.detail,meta:l.meta,status:o.status,durationMs:o.durationMs,at:o.at,event:o,node:l});else if(l.kind==="agent"){s.add("agent"),s.add("user");const h=l.meta==="final_answer";a.push({id:`seq-${N(o)}`,seq:d++,from:"agent",to:"user",type:h?"return":"call",label:h?t==="subagent"?"Result":"Final Answer":t==="subagent"?"Progress update":"Commentary / Update",title:l.title,...D(l,o),detail:l.detail,meta:l.meta,status:o.status,durationMs:o.durationMs,at:o.at,event:o,node:l})}else if(l.kind==="reasoning"||l.kind==="skill"){s.add("agent");const h=l.kind==="skill";a.push({id:`seq-${N(o)}`,seq:d++,from:"agent",to:"agent",type:"self",label:h?"Skill load":"Think & Plan",title:l.title,...D(l,o),detail:l.detail,meta:l.meta,status:o.status,durationMs:o.durationMs,at:o.at,event:o,node:l})}else{const h=it(l.kind),_=t==="subagent"&&h==="subagent"&&ot(o,n);s.add(_?"user":h),s.add("agent");const x=h==="subagent"&&l.sequenceDirection==="return",$=_?x?"agent":"user":x?"subagent":"agent",w=_?x?"user":"agent":x?"agent":h;a.push({id:`seq-${N(o)}`,seq:d++,from:$,to:w,toLabel:w==="mcp"?l.participantName:void 0,type:x?"return":"call",label:`${l.label} execution`,title:l.title,...D(l,o),detail:l.detail,meta:l.meta,status:o.status,durationMs:o.durationMs,at:o.at,event:o,node:l})}const c=[];if(a.length>0){c.push({participant:"agent",startStepIndex:0,endStepIndex:a.length-1,status:"completed"});const o=new Map;a.forEach((l,h)=>{const _=l.to!=="agent"&&l.to!=="user"?l.to:l.from!=="agent"&&l.from!=="user"?l.from:null;if(_){const x=o.get(_);x?(x.end=h,(l.status==="failed"||l.status==="error")&&(x.status="failed")):o.set(_,{start:h,end:h,status:l.status})}}),o.forEach((l,h)=>{c.push({participant:h,startStepIndex:l.start,endStepIndex:l.end,status:l.status})})}const p=["user","agent","tool","mcp","subagent"],m=t==="subagent"?at:be,g=p.filter(o=>s.has(o)).map(o=>m[o]),v=new Map(a.map((o,l)=>[W(o.event),l])),f=he(i.map(({event:o})=>o)).flatMap(o=>{const l=o.eventIds.flatMap(x=>{const $=v.get(x);return $===void 0?[]:[$]});if(!l.length)return[];const h=Math.min(...l),_=Math.max(...l);return[{id:o.id,stepIds:l.map(x=>a[x].id),startStepIndex:h,endStepIndex:_,maxConcurrency:o.maxConcurrency,evidence:o.evidence,label:Ke(o)}]});return{participants:g,steps:a,activations:c,parallelGroups:f}}function K(e){return e.replace(/["\n\r;]/g," ").slice(0,80).trim()}function bt(e){const t=["sequenceDiagram"," autonumber"];for(const s of e.participants)t.push(` participant ${s.key} as ${s.label}`);t.push("");const n=new Map(e.parallelGroups.map(s=>[s.startStepIndex,s])),i=new Map(e.parallelGroups.map(s=>[s.endStepIndex,s])),a=new Map(e.parallelGroups.flatMap(s=>s.stepIds.map((d,c)=>[d,{group:s,index:c}])));for(const[s,d]of e.steps.entries()){const c=n.get(s),p=a.get(d.id);c?t.push(` par ${K(c.label)}`):p&&p.index>0&&t.push(` and ${K(d.exportTitle)}`);const m=K(d.exportTitle||d.label),g=d.durationMs!==void 0?` (${d.durationMs}ms)`:"",v=`${m}${g}`;d.type==="self"?t.push(` ${d.from}->>${d.to}: ${v}`):d.type==="return"?t.push(` ${d.from}-->>${d.to}: ${v}`):t.push(` ${d.from}->>+${d.to}: ${v}`),i.has(s)&&t.push(" end")}return t.join(`
8
- `)}function vt(e,t){return{seq:e.seq,kind:e.node.kind,title:e.displayTitle,fullTitle:e.detailTitle,detail:e.detail,status:e.status,durationMs:e.durationMs,at:e.at,from:t.get(e.from)??e.from,to:e.toLabel??t.get(e.to)??e.to,type:e.type,event:e.event}}function xt(e,t){const a=Math.max(1,Math.min(480,t.width-24))/2,s=Math.max(0,t.height-e.bottom-12),d=Math.max(0,e.top-12),c=s<Math.min(240,d);return{above:c,left:Math.min(Math.max(e.left+e.width/2,12+a),t.width-12-a),maxHeight:Math.max(24,Math.min(320,c?d:s)),top:c?e.top-8:e.bottom+8}}function G(e){return e.detail.trim()||e.detailTitle}function yt(e,t,n){return t<=0?null:n==="Home"?0:n==="End"?t-1:n==="ArrowUp"?Math.max(0,e-1):n==="ArrowDown"?Math.min(t-1,e+1):null}function kt({initialSelectedStepId:e,items:t,onOpenSubagent:n,scope:i="main",threadContext:a}){const[s,d]=q.useState(e??null),{copy:c,state:p}=Te(t,2e3),[m,g]=q.useState(null),v=q.useRef(null),f=q.useRef(null),o=q.useMemo(()=>ht(t,i,a),[t,i,a]),l=q.useMemo(()=>o.steps.find(u=>u.id===s),[o.steps,s]),h=u=>{const M=o.steps.find(y=>y.id===`seq-${u}`);M&&(g(null),d(y=>y===M.id?null:M.id))};q.useEffect(()=>{s&&!l&&d(null)},[l,s]),q.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),q.useLayoutEffect(()=>{if(!l)return;const u=v.current,M=document.getElementById(`sequence-step-${l.seq}`);if(!u||!M)return;const y=u.getBoundingClientRect(),S=M.getBoundingClientRect(),T=12;S.bottom>y.bottom-T?u.scrollTop+=S.bottom-y.bottom+T:S.top<y.top+T&&(u.scrollTop-=y.top-S.top+T)},[l]);const _=()=>{if(!l)return;const u=`sequence-step-${l.seq}`;d(null),tt(u)},x=()=>{f.current&&(clearTimeout(f.current),f.current=null)},$=(u=0)=>{if(x(),u===0){g(null);return}f.current=setTimeout(()=>{f.current=null,g(null)},u)},w=(u,M)=>{x();const y=u.getBoundingClientRect(),S=xt(y,{height:window.innerHeight,width:window.innerWidth});g({stepId:M.id,text:G(M),...S})},Y=q.useMemo(()=>{const u=new Map;return o.participants.forEach((M,y)=>{u.set(M.key,y)}),u},[o.participants]),O=q.useMemo(()=>new Map(o.participants.map(u=>[u.key,u.label])),[o.participants]),xe=q.useMemo(()=>new Map(o.parallelGroups.flatMap(u=>u.stepIds.map(M=>[M,u]))),[o.parallelGroups]),ye={"--vbg-sequence-columns":o.participants.length,minWidth:`${Math.max(420,o.participants.length*156)}px`};return r.jsxs("section",{"aria-label":"Run sequence diagram",className:"vbg-custom-sequence",onKeyDown:u=>{u.key==="Escape"&&l&&(u.preventDefault(),_())},children:[o.steps.length===0?r.jsx("div",{className:"vbg-custom-sequence__empty",children:r.jsx("p",{children:"No sequence events to display for this run."})}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"vbg-custom-sequence__overview",children:r.jsx(et,{items:t,onSelect:h,selectedId:l==null?void 0:l.id.replace(/^seq-/,"")})}),r.jsxs("div",{className:`vbg-custom-sequence__workspace${l?" vbg-custom-sequence__workspace--with-inspector":""}`,children:[r.jsxs("button",{type:"button","aria-label":p==="copied"?"Mermaid copied":p==="error"?"Copy Mermaid failed":"Copy Mermaid",className:"vbg-custom-sequence__copy-btn",onClick:()=>void c(bt(o)),title:p==="copied"?"Mermaid copied":p==="error"?"Copy failed":"Copy Mermaid sequence syntax",children:[r.jsx(L,{name:p==="copied"?"check":p==="error"?"alert":"copy"},p),r.jsx("span",{"aria-live":"polite",className:"vbg-custom-sr-only",children:p==="copied"?"Copied":p==="error"?"Copy failed":"Copy Mermaid"})]}),r.jsx("div",{ref:v,className:"vbg-custom-sequence__canvas","aria-label":"Sequence interaction flow",onScroll:()=>$(),children:r.jsxs("div",{className:"vbg-custom-sequence__diagram",style:ye,children:[r.jsx("div",{className:"vbg-custom-sequence__lifelines-header",children:o.participants.map(u=>r.jsx("div",{className:`vbg-custom-sequence__participant vbg-custom-sequence__participant--${u.key}`,children:r.jsxs("div",{className:"vbg-custom-sequence__participant-box",children:[r.jsx("span",{className:"vbg-custom-sequence__participant-icon",children:r.jsx(L,{name:u.iconName})}),r.jsxs("div",{className:"vbg-custom-sequence__participant-info",children:[r.jsx("strong",{children:u.label}),r.jsx("span",{children:u.subtext})]})]})},u.key))}),r.jsxs("div",{className:"vbg-custom-sequence__body",children:[r.jsx("div",{className:"vbg-custom-sequence__lifelines-bg",children:o.participants.map(u=>r.jsx("div",{className:"vbg-custom-sequence__lifeline-col",children:r.jsx("div",{className:"vbg-custom-sequence__lifeline-wire"})},u.key))}),r.jsx("div",{className:"vbg-custom-sequence__steps",children:o.steps.map((u,M)=>{const y=xe.get(u.id),S=(y==null?void 0:y.startStepIndex)===M,T=(y==null?void 0:y.endStepIndex)===M,H=Y.get(u.from)??0,U=Y.get(u.to)??0,_e=u.type==="self"||H===U,Me=u.type==="return",Q=100/o.participants.length,E=s===u.id,Z=u.status==="completed"||u.status==="complete"||u.status==="approved",ke=`sequence-step-${u.seq}`,qe=u.node.kind==="file"||u.node.kind==="web"?"tool":u.node.kind==="reasoning"?"agent":u.node.kind,z=(H+.5)*Q,ee=(U+.5)*Q,$e=Math.min(z,ee),we=Math.abs(ee-z),Se=U>=H?"right":"left";return r.jsxs("button",{id:ke,className:`vbg-custom-sequence__step-row vbg-custom-sequence__step-row--role-${qe} vbg-custom-sequence__step-row--status-${u.status}${y?" vbg-custom-sequence__step-row--parallel":""}${S?" vbg-custom-sequence__step-row--parallel-start":""}${T?" vbg-custom-sequence__step-row--parallel-end":""} ${E?"vbg-custom-sequence__step-row--selected":""}`,onClick:()=>{if(E){_();return}d(u.id)},onKeyDown:j=>{const P=yt(M,o.steps.length,j.key);if(P===null)return;j.preventDefault();const te=o.steps[P];g(null),d(te.id),window.requestAnimationFrame(()=>{var ne;(ne=document.getElementById(`sequence-step-${te.seq}`))==null||ne.focus()})},type:"button",tabIndex:s?E?0:-1:M===0?0:-1,"aria-expanded":E,"aria-controls":E?"execution-inspector":void 0,"aria-describedby":(m==null?void 0:m.stepId)===u.id?"sequence-step-tooltip":void 0,"aria-label":`Step ${u.seq}: ${u.label} - ${u.detailTitle}, ${O.get(u.from)??u.from} to ${u.toLabel??O.get(u.to)??u.to}${y?`, ${y.label}`:""}`,onBlur:()=>$(),onFocus:j=>{if(!j.currentTarget.matches(":focus-visible"))return;const P=j.currentTarget.querySelector(".vbg-custom-sequence__step-title");P&&w(P,u)},children:[y&&S&&r.jsxs("span",{className:"vbg-custom-sequence__parallel-label",children:[r.jsx("strong",{children:y.label}),r.jsx("small",{children:y.evidence==="lifecycle"?"lifecycle overlap":y.evidence.replace("-"," ")})]}),r.jsx("div",{className:"vbg-custom-sequence__step-line-container",children:_e?r.jsxs("div",{className:"vbg-custom-sequence__self-loop",style:{left:`${z}%`},children:[r.jsx("span",{"aria-hidden":"true",className:"vbg-custom-sequence__self-path"}),r.jsxs("span",{className:"vbg-custom-sequence__self-badge",children:[r.jsx("span",{className:"vbg-custom-sequence__step-num",children:u.seq}),u.displayIcon&&r.jsx("span",{"aria-hidden":"true",className:"vbg-custom-sequence__step-icon",children:r.jsx(L,{name:u.displayIcon})}),r.jsx("strong",{className:`vbg-custom-sequence__step-title${u.isCommand?" vbg-custom-sequence__step-title--command":""}`,"data-tooltip":G(u),onMouseEnter:j=>w(j.currentTarget,u),onMouseLeave:()=>$(100),children:u.displayTitle}),!Z&&r.jsx(J,{status:u.status})]})]}):r.jsxs("div",{className:`vbg-custom-sequence__arrow vbg-custom-sequence__arrow--${Se} ${Me?"vbg-custom-sequence__arrow--return":"vbg-custom-sequence__arrow--call"} vbg-custom-sequence__arrow--status-${u.status}`,style:{left:`${$e}%`,width:`${we}%`},children:[r.jsx("div",{className:"vbg-custom-sequence__arrow-line"}),r.jsx("div",{className:"vbg-custom-sequence__arrow-head"}),r.jsxs("div",{className:"vbg-custom-sequence__arrow-label",children:[r.jsx("span",{className:"vbg-custom-sequence__step-num",children:u.seq}),u.displayIcon&&r.jsx("span",{"aria-hidden":"true",className:"vbg-custom-sequence__step-icon",children:r.jsx(L,{name:u.displayIcon})}),r.jsx("strong",{className:`vbg-custom-sequence__step-title${u.isCommand?" vbg-custom-sequence__step-title--command":""}`,"data-tooltip":G(u),onMouseEnter:j=>w(j.currentTarget,u),onMouseLeave:()=>$(100),children:u.displayTitle}),!Z&&r.jsx(J,{status:u.status})]})]})})]},u.id)})})]})]})}),l&&r.jsx(st,{autoFocusClose:!1,item:vt(l,O),onClose:_,onOpenSubagent:n},l.id)]})]}),m&&typeof document<"u"&&Ce.createPortal(r.jsx("div",{className:`vbg-custom-sequence__tooltip${m.above?" vbg-custom-sequence__tooltip--above":""}`,id:"sequence-step-tooltip",onMouseEnter:x,onMouseLeave:()=>$(),role:"tooltip",style:{left:m.left,maxHeight:m.maxHeight,top:m.top},children:r.jsx(Ee,{children:m.text})}),document.body)]})}export{kt as SequenceDiagram,yt as nextSequenceStepIndex,G as sequenceTooltipContent,xt as sequenceTooltipLayout};
6
+ Answer: ${p}`).join(`
7
+
8
+ `)}:{kind:"user",label:"User",title:"Request",detail:s}}if(i==="agentmessage"){const s=b(t.phase);return{kind:"agent",label:"Agent",title:s==="commentary"?"Update":s==="final_answer"?"Final response":"Message",detail:b(t.text)??a,meta:s}}if(i==="reasoning")return{kind:"reasoning",label:"Agent",title:"Reasoning",detail:Fe(t)??a};if(i==="subagentactivity"){const s=b(t.kind)??"activity",l=B(s),c=b(t.agentPath)??b(t.agent_path)??"Subagent",p=re(t)??"Subagent",m={started:{label:"Start",title:"Started",direction:"call"},interacted:{label:"Update",title:"Update",direction:"return"},completed:{label:"Result",title:"Result",direction:"return"},interrupted:{label:"Interrupted",title:"Interrupted",direction:"return"},failed:{label:"Failed",title:"Failed",direction:"return"}}[l],g=`${s[0].toUpperCase()}${s.slice(1)}`;return{kind:"subagent",label:(m==null?void 0:m.label)??"Subagent",title:`${(m==null?void 0:m.title)??g} · ${p}`,detail:c,meta:b(t.agentThreadId)??b(t.agent_thread_id),sequenceDirection:(m==null?void 0:m.direction)??"call"}}if(i==="collabagenttoolcall"){const s=b(t.tool)??"collaboration",l=B(s),c={spawnagent:"Fork",sendinput:"Message",sendmessage:"Message",followuptask:"Message",resumeagent:"Resume",wait:"Wait",waitagent:"Wait",interruptagent:"Interrupt",closeagent:"Close"}[l]??s,m=(Array.isArray(t.receiverThreadIds)?t.receiverThreadIds:Array.isArray(t.receiver_thread_ids)?t.receiver_thread_ids:[]).filter(x=>typeof x=="string"),v=re(t)??(m.length>1?`${m.length} subagents`:void 0),f=c==="Wait",o=f?`Wait for ${v??"subagents"}`:v?`${c} · ${v}`:c,d=I(t.result),h=b(d.message),_=d.timed_out===!0||d.timedOut===!0;return{kind:"subagent",label:c,title:o,detail:h??b(t.prompt)??(m.length?`Targets: ${m.join(", ")}`:a),meta:b(t.model)??void 0,showStatus:!0,statusLabel:_?"Timed out":f&&e.status==="completed"?"Wait ended":void 0,sequenceDirection:"call"}}if(i==="commandexecution"){const s=typeof t.exitCode=="number"?`exit ${t.exitCode}`:void 0,l=Ne(t.command),c=De(t);return c?{kind:"skill",label:"Skill",title:c.displayTitle,detail:l??a,meta:[se(t.cwd),s].filter(Boolean).join(" · ")||void 0,showStatus:!0}:{kind:"tool",label:"Tool",title:l?`Shell · ${l.split(`
9
+ `,1)[0].slice(0,112)}`:"Shell",detail:l??a,meta:[se(t.cwd),s].filter(Boolean).join(" · ")||void 0,showStatus:!0}}if(i.includes("skill"))return{kind:"skill",label:"Skill",title:`Skill · ${b(t.name)??b(t.skill)??e.summary??"Skill"}`,detail:b(t.prompt)??b(t.path)??a,showStatus:!0};if(i==="mcptoolcall"){const s=b(t.server),l=b(t.tool)??e.summary??"MCP tool",c=pe(t);return{kind:"mcp",label:"MCP",title:(c==null?void 0:c.displayTitle)??[s,l].filter(Boolean).join(" · "),participantName:s,detail:Oe(t.arguments)??a,showStatus:!0}}return i==="filechange"?{kind:"file",label:"Tool",title:"File change",detail:He(t)??a,showStatus:!0}:i.includes("websearch")?{kind:"web",label:"Tool",title:"Web search",detail:a,showStatus:!0}:i.includes("tool")||i.includes("image")||i.includes("browser")?{kind:"tool",label:"Tool",title:e.type,detail:a,showStatus:!0}:{kind:"system",label:"System",title:e.type||e.method,detail:a}}function fe(e){const t=new Map;for(const n of e){const i=n.method.includes("started"),a=n.method.includes("completed")||n.method.includes("failed"),s={...n,startedSeq:n.startedSeq??(i?n.seq:void 0),completedSeq:n.completedSeq??(a?n.seq:void 0),startedAt:n.startedAt??(i?n.at:void 0),completedAt:n.completedAt??(a?n.at:void 0)},l=s.itemId?`item:${s.threadId}:${s.turnId??""}:${s.itemId}`:`event:${s.threadId}:${s.turnId??""}:${s.seq}`,c=t.get(l);if(!c){t.set(l,s);continue}const p=s.method.includes("completed")||s.method.includes("failed"),m=c.method.includes("completed")||c.method.includes("failed"),g=p||!m?s:c,v=g===s?c:s;t.set(l,{...v,...g,seq:Math.min(c.seq,s.seq),at:c.at<s.at?c.at:s.at,startedSeq:c.startedSeq??s.startedSeq,completedSeq:s.completedSeq??c.completedSeq,startedAt:c.startedAt??s.startedAt,completedAt:s.completedAt??c.completedAt,parentItemId:s.parentItemId??c.parentItemId,durationMs:s.durationMs??c.durationMs})}return[...t.values()].sort((n,i)=>{const a=k(n.startedAt)??k(n.at)??k(n.completedAt),s=k(i.startedAt)??k(i.at)??k(i.completedAt);return a!==void 0&&s!==void 0&&a!==s?a-s:n.seq-i.seq})}function A(e){return e==="user"?"user":e==="agent"||e==="reasoning"?"agent":e==="mcp"?"mcp":e==="subagent"?"subagent":e==="skill"?"skill":e==="file"?"file":e==="web"?"web":e==="tool"?"tool":"activity"}function W(e){return N(e)}function Ue(e){return e.filter(t=>{const n=F(t).kind;return n!=="user"&&n!=="agent"&&n!=="reasoning"&&n!=="system"})}function ze(e){return e.flatMap(t=>{if(t.timingSource==="turn-fallback")return[];const n=k(t.startedAt),i=k(t.completedAt);return n!==void 0&&i!==void 0&&i>n?[{id:W(t),start:n,end:i}]:[]})}function Ve(e){const t=Math.max(0,...e.map(n=>n.completedSeq??n.startedSeq??n.seq))+1;return e.flatMap(n=>{const i=n.startedSeq,a=n.completedSeq??(n.status==="running"?t:void 0);return i!==void 0&&a!==void 0&&a>i?[{id:W(n),start:i,end:a}]:[]})}function ce(e,t,n){const i=[...e].sort((p,m)=>p.start-m.start||p.end-m.end),a=[];let s=[],l=Number.NEGATIVE_INFINITY;const c=()=>{if(s.length<2)return;const p=s.flatMap(f=>[{at:f.start,delta:1},{at:f.end,delta:-1}]).sort((f,o)=>f.at-o.at||f.delta-o.delta);let m=0,g=0;for(const f of p)m+=f.delta,g=Math.max(g,m);if(g<2)return;const v=s.map(f=>f.id);a.push({id:`parallel-${t}-${v.join("-")}`,eventIds:v,maxConcurrency:g,evidence:t,confidence:n})};for(const p of i)s.length&&p.start>=l&&(c(),s=[],l=Number.NEGATIVE_INFINITY),s.push(p),l=Math.max(l,p.end);return c(),a}function le(e){return(Array.isArray(e.receiverThreadIds)?e.receiverThreadIds:Array.isArray(e.receiver_thread_ids)?e.receiver_thread_ids:[]).filter(n=>typeof n=="string"&&!!n.trim())}function Ke(e){const t=[];let n=[];const i=(a=n)=>{if(!a.length)return;const s=new Set(a.flatMap(c=>c.targets)),l=Math.max(s.size,a.length===1?0:a.length);if(l>1){const c=a.map(p=>p.id);t.push({id:`parallel-fork-join-${c.join("-")}`,eventIds:c,maxConcurrency:l,evidence:"fork-join",confidence:"structured"})}};for(const a of e){const s=C(a),l=B(s.type??a.type);if(l==="subagentactivity"){const p=B(s.kind),m=typeof(s.agentThreadId??s.agent_thread_id)=="string"?String(s.agentThreadId??s.agent_thread_id).trim():"";m&&["completed","failed","interrupted"].includes(p)&&(n=n.filter(g=>!g.targets.includes(m)));continue}if(l!=="collabagenttoolcall")continue;const c=B(s.tool);if(c==="spawnagent"||c==="resumeagent")n.push({id:W(a),targets:le(s)});else if(c==="wait"||c==="waitagent"){const p=new Set(le(s)),m=p.size?n.filter(v=>v.targets.some(f=>p.has(f))):n;i(m);const g=new Set(m.map(v=>v.id));n=n.filter(v=>!g.has(v.id))}}return i(),t}function Ge(e){return[...e.eventIds].sort().join("\0")}function he(e){const t=Ue(e),n=[...ce(ze(t),"timestamp","confirmed"),...ce(Ve(t),"lifecycle","confirmed"),...Ke(t)],i={timestamp:3,lifecycle:2,"fork-join":1},a=new Map;for(const s of n){const l=Ge(s),c=a.get(l);(!c||i[s.evidence]>i[c.evidence])&&a.set(l,s)}return[...a.values()]}function Qe(e){return e.evidence==="fork-join"?`Parallel dispatch ×${e.maxConcurrency}`:`Parallel ×${e.maxConcurrency}`}function Je(e){if(e.timingSource==="turn-fallback")return{timing:"order"};const t=k(e.startedAt),n=k(e.completedAt);if(t!==void 0&&n!==void 0&&n>=t)return{startedAtMs:t,completedAtMs:n,timing:"observed"};if(e.durationMs!==void 0&&e.durationMs>0){const i=n??(e.method.includes("completed")||e.method.includes("failed")?k(e.at):void 0);if(i!==void 0)return{startedAtMs:i-e.durationMs,completedAtMs:i,timing:"inferred"}}return{timing:"order"}}function de(e,t,n,i){const a=t.kind==="mcp",s=Je(e),l=C(e),c=t.kind==="tool"&&typeof l.exitCode=="number"&&l.exitCode!==0;return{id:N(e),batch:n,event:e,kind:t.kind,label:a?"Tool":t.label,title:a?`MCP · ${t.title}`:t.title,detail:t.detail,meta:t.meta,status:c?"failed":e.status,statusLabel:c?void 0:t.statusLabel,durationMs:e.durationMs,parallel:i,...s}}function Xe(e){const t=fe(e).map(c=>({event:c,node:F(c)})),n=new Map;for(const c of he(t.map(({event:p})=>p)))for(const p of c.eventIds)n.has(p)||n.set(p,c);const i=[];let a,s=!0,l=0;for(const c of t){if(c.node.kind==="user"||c.node.kind==="agent"){const g=N(c.event);i.push({type:"message",id:g,event:c.event,node:c.node}),a=c.node.kind==="agent"?g:void 0,s=!0,l=0;continue}(c.node.kind==="reasoning"||c.node.kind==="system")&&(l+=1);const p=i[i.length-1],m=n.get(W(c.event));!s&&(p==null?void 0:p.type)==="execution"?p.actions.push(de(c.event,c.node,l,m)):i.push({type:"execution",id:`execution-${N(c.event)}`,ownerAgentId:a,actions:[de(c.event,c.node,l,m)]}),s=!1}return{blocks:i}}const J=[{key:"user",label:"Input"},{key:"agent",label:"Agent"},{key:"tools",label:"Tools"},{key:"mcp",label:"MCP"},{key:"subagents",label:"Subagents"}],R=.8,V=8;function ue(e){return e==="user"?"user":e==="agent"||e==="reasoning"?"agent":e==="mcp"?"mcp":e==="subagent"?"subagents":"tools"}function Ye(e){if(e.timingSource==="turn-fallback")return{startedAtMs:e.seq,completedAtMs:e.seq,timing:"order"};const t=k(e.startedAt),n=k(e.completedAt);if(t!==void 0&&n!==void 0&&n>=t)return{startedAtMs:t,completedAtMs:n,timing:"observed"};const i=n??k(e.at)??e.seq;return e.durationMs!==void 0&&e.durationMs>0?{startedAtMs:i-e.durationMs,completedAtMs:i,timing:"inferred"}:{startedAtMs:i,completedAtMs:i,timing:"order"}}function Ze(e){const t=[];for(const n of Xe(e).blocks){if(n.type==="execution"){for(const a of n.actions){const s=a.startedAtMs??k(a.event.startedAt)??k(a.event.at)??a.event.seq,l=a.completedAtMs??k(a.event.completedAt)??(a.durationMs===void 0?s:s+a.durationMs);t.push({id:a.id,kind:a.kind,label:`${a.label} · ${a.title}`,lane:ue(a.kind),startedAtMs:s,completedAtMs:Math.max(s,l),timing:a.timing})}continue}const i=Ye(n.event);t.push({id:n.id,kind:n.node.kind,label:`${n.node.label} · ${n.node.title}`,lane:ue(n.node.kind),...i})}return t}function et(e,t){if(!e.length)return[];const n=Math.min(...e.map(m=>m.startedAtMs)),i=Math.max(...e.map(m=>m.completedAtMs)),a=Math.max(1,i-n),s=new Map(J.map(m=>[m.key,Math.max(1,...e.filter(g=>g.lane===m.key).map(g=>g.completedAtMs-g.startedAtMs))])),l=100/e.length,c=Math.min(1,l*.15),p=e.map((m,g)=>{const v=Math.max(0,m.completedAtMs-m.startedAtMs);if(t==="logical"){const h=Math.max(R,l-c),_=v===0?0:Math.sqrt(v/s.get(m.lane)),x=R+(h-R)*_;return{...m,left:g*l,width:x,track:0}}const f=Math.min(100-R,(m.startedAtMs-n)/a*100),o=v/a*100,d=Math.min(100-f,Math.max(0,o));return{...m,left:f,width:d,track:0}});for(const m of J){const g=[],v=p.filter(f=>f.lane===m.key).sort((f,o)=>f.left-o.left);for(const f of v){const o=t==="logical"?0:Math.max(0,g.findIndex(d=>d<=f.left));f.track=o===-1?g.length:o,g[f.track]=f.left+f.width}}return p}function tt(e){const t=e.filter(i=>i.timing!=="order");if(t.length<2||t.every(i=>i.timing==="inferred")&&new Set(t.map(i=>i.completedAtMs)).size===1)return!1;const n=t.map(i=>i.startedAtMs);return new Set(n).size>1&&Math.max(...t.map(i=>i.completedAtMs))>Math.min(...n)}function nt({items:e,onSelect:t,selectedId:n}){const i=q.useMemo(()=>Ze(e),[e]);if(!i.length)return null;const a=tt(i)?"actual":"logical",s=et(i,a),l=J.filter(o=>s.some(d=>d.lane===o.key)),c=new Map,p=new Map;let m=0;for(const o of l){const d=s.filter(x=>x.lane===o.key),h=Math.max(1,...d.map(x=>x.track+1)),_=Math.max(18,h*V+6);p.set(o.key,m),c.set(o.key,_),m+=_}const v=(a==="actual"?[...s].sort((o,d)=>o.startedAtMs-d.startedAtMs):s).map(o=>({x:o.left+Math.min(o.width/2,R/2),y:p.get(o.lane)+o.track*V+7})),f=v.reduce((o,d,h)=>h===0?`M ${d.x} ${d.y}`:`${o} H ${d.x} V ${d.y}`,"");return r.jsx("div",{"aria-label":"Trace overview",className:"vbg-custom-replay-overview",title:a==="actual"?"Bar width represents duration":"Bar width represents relative duration",children:r.jsxs("div",{className:"vbg-custom-replay-overview__plot",style:{height:`${m}px`},children:[a==="logical"&&v.length>1&&r.jsxs("svg",{"aria-hidden":"true",className:"vbg-custom-replay-overview__sequence",preserveAspectRatio:"none",viewBox:`0 0 100 ${m}`,children:[r.jsx("defs",{children:r.jsx("marker",{id:"vbg-replay-arrow",markerHeight:"5",markerWidth:"5",orient:"auto",refX:"4",refY:"2.5",children:r.jsx("path",{d:"M 0 0 L 5 2.5 L 0 5 z"})})}),r.jsx("path",{d:f,markerEnd:"url(#vbg-replay-arrow)"})]}),l.map(o=>{const d=s.filter(h=>h.lane===o.key);return r.jsxs("div",{className:"vbg-custom-replay-overview__lane",style:{height:`${c.get(o.key)}px`},children:[r.jsx("span",{children:o.label}),r.jsx("div",{className:"vbg-custom-replay-overview__track",children:d.map(h=>{const _=Te(Math.max(0,h.completedAtMs-h.startedAtMs)),x=h.timing==="observed"?"Observed timing":h.timing==="inferred"?"Estimated timing":"Order only",$=`${h.label} · ${_} · ${x}`,w=h.timing==="order"||h.completedAtMs===h.startedAtMs;return r.jsx("button",{"aria-label":$,"aria-pressed":n===h.id,className:`vbg-custom-replay-overview__bar vbg-custom-replay-overview__bar--${h.kind}${w?" vbg-custom-replay-overview__bar--point":""}`,"data-timing":h.timing,onClick:()=>t(h.id),style:{left:`${h.left}%`,top:`${h.track*V+3}px`,width:w?"8px":`max(6px, ${h.width}%)`},title:$,type:"button"},h.id)})})]},o.key)})]})})}function me({duration:e,durationLabel:t="Duration",from:n,startedAt:i,startedAtLabel:a,startedAtTitle:s,to:l,type:c}){const p=!!(n&&l);return r.jsx("section",{"aria-label":p?`Execution from ${n} to ${l}`:"Execution timing",className:"vbg-custom-execution-meta",children:r.jsxs("dl",{className:"vbg-custom-execution-meta__facts",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Started"}),r.jsx("dd",{children:r.jsx("time",{dateTime:i,title:s,children:a})})]}),r.jsxs("div",{children:[r.jsx("dt",{children:t}),r.jsx("dd",{children:e??"Not recorded"})]}),p&&r.jsxs("div",{children:[r.jsx("dt",{children:"Direction"}),r.jsxs("dd",{className:"vbg-custom-execution-meta__route",children:[r.jsx("code",{title:n,children:n}),r.jsx("span",{"aria-hidden":"true",className:"vbg-custom-execution-meta__arrow",children:"→"}),r.jsx("code",{title:l,children:l})]})]}),c&&r.jsxs("div",{children:[r.jsx("dt",{children:"Type"}),r.jsx("dd",{children:r.jsx("span",{className:"vbg-custom-execution-meta__type",children:c})})]})]})})}function st(e){window.requestAnimationFrame(()=>{var t;return(t=document.getElementById(e))==null?void 0:t.focus()})}function at({value:e}){const t=typeof e=="string";let n;try{n=t?e:JSON.stringify(e,null,2)}catch{n=String(e)}return r.jsx(Ee,{className:"vbg-custom-sequence__inspector-value",code:n,language:t?"plaintext":"json"})}function it({autoFocusClose:e=!0,item:t,onClose:n,onOpenSubagent:i}){const a=`execution-inspector-title-${t.seq}`,[s,l]=q.useState("overview"),c=[{id:"overview",label:"Overview"},{id:"raw",label:"Raw event"}],p=t.kind==="file"||t.kind==="web"?"tool":t.kind,m=p==="reasoning"?"Agent":p,g=p==="subagent",v=F(t.event).statusLabel??t.status,f=t.event.startedAt??t.at;return r.jsxs("aside",{className:"vbg-custom-sequence__inspector vbg-custom-sequence__inspector--tabbed",id:"execution-inspector","aria-labelledby":a,children:[r.jsxs("header",{className:"vbg-custom-sequence__inspector-header",children:[r.jsxs("div",{className:"vbg-custom-sequence__inspector-title",id:a,"aria-live":"polite",children:[r.jsxs("div",{className:"vbg-custom-sequence__inspector-title-meta",children:[r.jsx("span",{className:`vbg-custom-sequence__inspector-kind vbg-custom-sequence__inspector-kind--${p}`,children:m.toUpperCase()}),r.jsxs("span",{"aria-label":`Step ${t.seq}`,className:"vbg-custom-sequence__inspector-step",children:["#",t.seq]})]}),r.jsx("strong",{title:t.fullTitle??t.title,children:t.title})]}),r.jsxs("div",{className:"vbg-custom-sequence__inspector-actions",children:[r.jsx(Q,{status:v}),r.jsx("button",{autoFocus:e,type:"button",className:"vbg-custom-sequence__inspector-close",onClick:n,"aria-label":"Close execution details",title:"Close details",children:r.jsx(L,{name:"close"})})]})]}),!g&&r.jsx("div",{"aria-label":"Execution details",className:"vbg-custom-sequence__inspector-tabs",role:"tablist",children:c.map(o=>r.jsx("button",{"aria-controls":"execution-inspector-panel","aria-selected":s===o.id,className:s===o.id?"is-active":void 0,id:`execution-inspector-tab-${o.id}`,onClick:()=>l(o.id),onKeyDown:Ce,role:"tab",tabIndex:s===o.id?0:-1,type:"button",children:o.label},o.id))}),r.jsx("div",{"aria-labelledby":g?a:`execution-inspector-tab-${s}`,className:"vbg-custom-sequence__inspector-panel",id:"execution-inspector-panel",role:g?void 0:"tabpanel",children:g?r.jsxs("div",{className:"vbg-custom-sequence__inspector-summary vbg-custom-sequence__inspector-summary--subagent",children:[r.jsx(me,{duration:t.durationMs===void 0?void 0:`${t.durationMs}ms`,durationLabel:"Event latency",startedAt:f,startedAtLabel:ie(f),startedAtTitle:ae(f)}),r.jsx(oe,{autoLoadSubagent:!0,event:t.event,expandResult:!0,fallback:t.detail,onOpenSubagent:i})]}):s==="overview"?r.jsxs("div",{className:"vbg-custom-sequence__inspector-summary",children:[r.jsx(me,{duration:t.durationMs===void 0?void 0:`${t.durationMs}ms`,from:t.from,startedAt:f,startedAtLabel:ie(f),startedAtTitle:ae(f),to:t.to,type:t.type}),r.jsxs("section",{className:"vbg-custom-sequence__inspector-section","aria-label":"Execution content",children:[r.jsx("h3",{children:"Content"}),r.jsx(oe,{autoLoadSubagent:!0,event:t.event,expandResult:!0,fallback:t.detail,onOpenSubagent:i})]})]}):r.jsx(at,{value:C(t.event)})})]})}const be={user:{key:"user",label:"User",subtext:"Prompt / Feedback",iconName:A("user")},agent:{key:"agent",label:"Agent",subtext:"Orchestrator",iconName:A("agent")},tool:{key:"tool",label:"Tools",subtext:"Shell / Files",iconName:A("tool")},mcp:{key:"mcp",label:"MCP",subtext:"Protocol Tools",iconName:A("mcp")},subagent:{key:"subagent",label:"Subagent",subtext:"Collaborators",iconName:A("subagent")}},ot={...be,user:{key:"user",label:"Parent Agent",subtext:"Orchestrator",iconName:A("agent")},agent:{key:"agent",label:"Subagent",subtext:"Current worker",iconName:A("subagent")},subagent:{key:"subagent",label:"Child Subagent",subtext:"Delegated worker",iconName:A("subagent")}};function rt(e){return e==="user"?"user":e==="agent"||e==="reasoning"?"agent":e==="mcp"?"mcp":e==="subagent"?"subagent":"tool"}function ct(e,t){if(!t)return!1;const n=C(e),i=typeof n.agentThreadId=="string"?n.agentThreadId:typeof n.agent_thread_id=="string"?n.agent_thread_id:void 0;if(t.parentThreadId&&i===t.parentThreadId)return!0;const a=typeof n.agentPath=="string"?n.agentPath:typeof n.agent_path=="string"?n.agent_path:void 0;return!a||!t.agentPath||a===t.agentPath?!1:t.agentPath.startsWith(`${a.replace(/\/$/,"")}/`)}const lt=/^(?:(?:\/usr)?\/bin\/)?(?:zsh|bash|sh)\s+-(?:lc|c)\s+/i;function dt(e){const t=e.trim(),n=t[0];if(n!=='"'&&n!=="'"||t.at(-1)!==n)return;if(n==='"'){let a=0;for(let s=t.length-2;s>=0&&t[s]==="\\";s-=1)a+=1;if(a%2===1)return}const i=t.slice(1,-1);return n==='"'?i.replace(/\\(["'\\])/g,"$1"):i.replace(/'\\''/g,"'")}function ut(e){var n;const t=e.match(/^((?:node|cat)\s+)(["']?)([^"'\s]*\/)([^/"'\s]+)\2(?=$|\s)/);return!t||(((n=t[3].match(/\//g))==null?void 0:n.length)??0)<2?e:e.replace(t[0],`${t[1]}${t[2]}…/${t[4]}${t[2]}`)}function ve(e){let t=e.trim().split(/\r?\n/,1)[0]??"";for(let n=0;n<4;n+=1){const i=t.match(lt);if(!i)break;const a=dt(t.slice(i[0].length));if(a===void 0)break;t=a}return t.replace(/\s+/g," ").trim()||e.trim()}function mt(e,t){let n=ve(e);if(t!=null&&t.startsWith("/")){const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp(`${i}(?=$|[\\s/"'])`,"g"),".")}return n=n.replace(/\/Users\/[^/\s"'\\]+/g,"~"),n=ut(n),n||e.trim()}function pt(e){return e.type.toLowerCase()==="commandexecution"||e.method.toLowerCase().includes("commandexecution")}function gt(e){return e.replace(/^Skill(?: load)? · /,"").replace(/ \(inferred\)$/,"")}function ft(e,t){const n=e.split(/\r?\n/).map(a=>a.trim()).find(a=>a&&!/^```/.test(a));return!n||n==="No additional detail"?t:n.replace(/^#{1,6}\s+/,"").replace(/^>\s*/,"").replace(/^[-+*]\s+/,"").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/~~([^~]+)~~/g,"$1").replace(/[*_]/g,"").replace(/\s+/g," ").trim()||t}function ht(e){if(!(e.kind!=="user"&&e.kind!=="agent"&&e.kind!=="reasoning"))return e.summary?e.summary.replace(/\s+/g," ").trim():ft(e.detail,e.title)}function bt(e,t,n){return t?"terminal":e.kind==="agent"?"message":e.kind==="reasoning"?"activity":n??A(e.kind)}function D(e,t){var g;const n=e.kind==="tool"&&pt(t),i=e.kind==="skill",a=e.kind==="mcp"?pe(C(t)):void 0,s=(a==null?void 0:a.kind)==="browser"?"web":(a==null?void 0:a.kind)==="computer-use"?"monitor":(a==null?void 0:a.kind)==="javascript"?"braces":void 0,l=(g=e.meta)==null?void 0:g.split(" · ",1)[0],c=n?mt(e.detail,l):void 0,p=n?ve(e.detail):void 0,m=ht(e);return{displayIcon:bt(e,n,s),displayTitle:c??m??(i?gt(e.title):(a==null?void 0:a.title)??e.title),detailTitle:p?`Shell · ${p}`:m&&m!==e.title?`${e.title} · ${m}`:e.title,exportTitle:c?`Shell · ${c}`:e.title,isCommand:n}}function vt(e,t="main",n){const i=fe(e).map(o=>({event:o,node:F(o)})),a=[],s=new Set(["user","agent"]);let l=1;for(const{event:o,node:d}of i)if(d.kind==="user")s.add("user"),s.add("agent"),a.push({id:`seq-${N(o)}`,seq:l++,from:"user",to:"agent",type:"call",label:t==="subagent"?"Task input":"User prompt",title:d.title,...D(d,o),detail:d.detail,meta:d.meta,status:o.status,durationMs:o.durationMs,at:o.at,event:o,node:d});else if(d.kind==="agent"){s.add("agent"),s.add("user");const h=d.meta==="final_answer";a.push({id:`seq-${N(o)}`,seq:l++,from:"agent",to:"user",type:h?"return":"call",label:h?t==="subagent"?"Result":"Final Answer":t==="subagent"?"Progress update":"Commentary / Update",title:d.title,...D(d,o),detail:d.detail,meta:d.meta,status:o.status,durationMs:o.durationMs,at:o.at,event:o,node:d})}else if(d.kind==="reasoning"||d.kind==="skill"){s.add("agent");const h=d.kind==="skill";a.push({id:`seq-${N(o)}`,seq:l++,from:"agent",to:"agent",type:"self",label:h?"Skill load":"Think & Plan",title:d.title,...D(d,o),detail:d.detail,meta:d.meta,status:o.status,durationMs:o.durationMs,at:o.at,event:o,node:d})}else{const h=rt(d.kind),_=t==="subagent"&&h==="subagent"&&ct(o,n);s.add(_?"user":h),s.add("agent");const x=h==="subagent"&&d.sequenceDirection==="return",$=_?x?"agent":"user":x?"subagent":"agent",w=_?x?"user":"agent":x?"agent":h;a.push({id:`seq-${N(o)}`,seq:l++,from:$,to:w,toLabel:w==="mcp"?d.participantName:void 0,type:x?"return":"call",label:`${d.label} execution`,title:d.title,...D(d,o),detail:d.detail,meta:d.meta,status:o.status,durationMs:o.durationMs,at:o.at,event:o,node:d})}const c=[];if(a.length>0){c.push({participant:"agent",startStepIndex:0,endStepIndex:a.length-1,status:"completed"});const o=new Map;a.forEach((d,h)=>{const _=d.to!=="agent"&&d.to!=="user"?d.to:d.from!=="agent"&&d.from!=="user"?d.from:null;if(_){const x=o.get(_);x?(x.end=h,(d.status==="failed"||d.status==="error")&&(x.status="failed")):o.set(_,{start:h,end:h,status:d.status})}}),o.forEach((d,h)=>{c.push({participant:h,startStepIndex:d.start,endStepIndex:d.end,status:d.status})})}const p=["user","agent","tool","mcp","subagent"],m=t==="subagent"?ot:be,g=p.filter(o=>s.has(o)).map(o=>m[o]),v=new Map(a.map((o,d)=>[W(o.event),d])),f=he(i.map(({event:o})=>o)).flatMap(o=>{const d=o.eventIds.flatMap(x=>{const $=v.get(x);return $===void 0?[]:[$]});if(!d.length)return[];const h=Math.min(...d),_=Math.max(...d);return[{id:o.id,stepIds:d.map(x=>a[x].id),startStepIndex:h,endStepIndex:_,maxConcurrency:o.maxConcurrency,evidence:o.evidence,label:Qe(o)}]});return{participants:g,steps:a,activations:c,parallelGroups:f}}function K(e){return e.replace(/["\n\r;]/g," ").slice(0,80).trim()}function xt(e){const t=["sequenceDiagram"," autonumber"];for(const s of e.participants)t.push(` participant ${s.key} as ${s.label}`);t.push("");const n=new Map(e.parallelGroups.map(s=>[s.startStepIndex,s])),i=new Map(e.parallelGroups.map(s=>[s.endStepIndex,s])),a=new Map(e.parallelGroups.flatMap(s=>s.stepIds.map((l,c)=>[l,{group:s,index:c}])));for(const[s,l]of e.steps.entries()){const c=n.get(s),p=a.get(l.id);c?t.push(` par ${K(c.label)}`):p&&p.index>0&&t.push(` and ${K(l.exportTitle)}`);const m=K(l.exportTitle||l.label),g=l.durationMs!==void 0?` (${l.durationMs}ms)`:"",v=`${m}${g}`;l.type==="self"?t.push(` ${l.from}->>${l.to}: ${v}`):l.type==="return"?t.push(` ${l.from}-->>${l.to}: ${v}`):t.push(` ${l.from}->>+${l.to}: ${v}`),i.has(s)&&t.push(" end")}return t.join(`
10
+ `)}function yt(e,t){return{seq:e.seq,kind:e.node.kind,title:e.displayTitle,fullTitle:e.detailTitle,detail:e.detail,status:e.status,durationMs:e.durationMs,at:e.at,from:t.get(e.from)??e.from,to:e.toLabel??t.get(e.to)??e.to,type:e.type,event:e.event}}function _t(e,t){const a=Math.max(1,Math.min(480,t.width-24))/2,s=Math.max(0,t.height-e.bottom-12),l=Math.max(0,e.top-12),c=s<Math.min(240,l);return{above:c,left:Math.min(Math.max(e.left+e.width/2,12+a),t.width-12-a),maxHeight:Math.max(24,Math.min(320,c?l:s)),top:c?e.top-8:e.bottom+8}}function G(e){return e.detail.trim()||e.detailTitle}function Mt(e,t,n){return t<=0?null:n==="Home"?0:n==="End"?t-1:n==="ArrowUp"?Math.max(0,e-1):n==="ArrowDown"?Math.min(t-1,e+1):null}function $t({initialSelectedStepId:e,items:t,onOpenSubagent:n,scope:i="main",threadContext:a}){const[s,l]=q.useState(e??null),{copy:c,state:p}=Pe(t,2e3),[m,g]=q.useState(null),v=q.useRef(null),f=q.useRef(null),o=q.useMemo(()=>vt(t,i,a),[t,i,a]),d=q.useMemo(()=>o.steps.find(u=>u.id===s),[o.steps,s]),h=u=>{const M=o.steps.find(y=>y.id===`seq-${u}`);M&&(g(null),l(y=>y===M.id?null:M.id))};q.useEffect(()=>{s&&!d&&l(null)},[d,s]),q.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),q.useLayoutEffect(()=>{if(!d)return;const u=v.current,M=document.getElementById(`sequence-step-${d.seq}`);if(!u||!M)return;const y=u.getBoundingClientRect(),S=M.getBoundingClientRect(),T=12;S.bottom>y.bottom-T?u.scrollTop+=S.bottom-y.bottom+T:S.top<y.top+T&&(u.scrollTop-=y.top-S.top+T)},[d]);const _=()=>{if(!d)return;const u=`sequence-step-${d.seq}`;l(null),st(u)},x=()=>{f.current&&(clearTimeout(f.current),f.current=null)},$=(u=0)=>{if(x(),u===0){g(null);return}f.current=setTimeout(()=>{f.current=null,g(null)},u)},w=(u,M)=>{x();const y=u.getBoundingClientRect(),S=_t(y,{height:window.innerHeight,width:window.innerWidth});g({stepId:M.id,text:G(M),...S})},X=q.useMemo(()=>{const u=new Map;return o.participants.forEach((M,y)=>{u.set(M.key,y)}),u},[o.participants]),O=q.useMemo(()=>new Map(o.participants.map(u=>[u.key,u.label])),[o.participants]),xe=q.useMemo(()=>new Map(o.parallelGroups.flatMap(u=>u.stepIds.map(M=>[M,u]))),[o.parallelGroups]),ye={"--vbg-sequence-columns":o.participants.length,minWidth:`${Math.max(420,o.participants.length*156)}px`};return r.jsxs("section",{"aria-label":"Run sequence diagram",className:"vbg-custom-sequence",onKeyDown:u=>{u.key==="Escape"&&d&&(u.preventDefault(),_())},children:[o.steps.length===0?r.jsx("div",{className:"vbg-custom-sequence__empty",children:r.jsx("p",{children:"No sequence events to display for this run."})}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"vbg-custom-sequence__overview",children:r.jsx(nt,{items:t,onSelect:h,selectedId:d==null?void 0:d.id.replace(/^seq-/,"")})}),r.jsxs("div",{className:`vbg-custom-sequence__workspace${d?" vbg-custom-sequence__workspace--with-inspector":""}`,children:[r.jsxs("button",{type:"button","aria-label":p==="copied"?"Mermaid copied":p==="error"?"Copy Mermaid failed":"Copy Mermaid",className:"vbg-custom-sequence__copy-btn",onClick:()=>void c(xt(o)),title:p==="copied"?"Mermaid copied":p==="error"?"Copy failed":"Copy Mermaid sequence syntax",children:[r.jsx(L,{name:p==="copied"?"check":p==="error"?"alert":"copy"},p),r.jsx("span",{"aria-live":"polite",className:"vbg-custom-sr-only",children:p==="copied"?"Copied":p==="error"?"Copy failed":"Copy Mermaid"})]}),r.jsx("div",{ref:v,className:"vbg-custom-sequence__canvas","aria-label":"Sequence interaction flow",onScroll:()=>$(),children:r.jsxs("div",{className:"vbg-custom-sequence__diagram",style:ye,children:[r.jsx("div",{className:"vbg-custom-sequence__lifelines-header",children:o.participants.map(u=>r.jsx("div",{className:`vbg-custom-sequence__participant vbg-custom-sequence__participant--${u.key}`,children:r.jsxs("div",{className:"vbg-custom-sequence__participant-box",children:[r.jsx("span",{className:"vbg-custom-sequence__participant-icon",children:r.jsx(L,{name:u.iconName})}),r.jsxs("div",{className:"vbg-custom-sequence__participant-info",children:[r.jsx("strong",{children:u.label}),r.jsx("span",{children:u.subtext})]})]})},u.key))}),r.jsxs("div",{className:"vbg-custom-sequence__body",children:[r.jsx("div",{className:"vbg-custom-sequence__lifelines-bg",children:o.participants.map(u=>r.jsx("div",{className:"vbg-custom-sequence__lifeline-col",children:r.jsx("div",{className:"vbg-custom-sequence__lifeline-wire"})},u.key))}),r.jsx("div",{className:"vbg-custom-sequence__steps",children:o.steps.map((u,M)=>{const y=xe.get(u.id),S=(y==null?void 0:y.startStepIndex)===M,T=(y==null?void 0:y.endStepIndex)===M,H=X.get(u.from)??0,U=X.get(u.to)??0,_e=u.type==="self"||H===U,Me=u.type==="return",Y=100/o.participants.length,E=s===u.id,Z=u.status==="completed"||u.status==="complete"||u.status==="approved",ke=`sequence-step-${u.seq}`,qe=u.node.kind==="file"||u.node.kind==="web"?"tool":u.node.kind==="reasoning"?"agent":u.node.kind,z=(H+.5)*Y,ee=(U+.5)*Y,$e=Math.min(z,ee),we=Math.abs(ee-z),Se=U>=H?"right":"left";return r.jsxs("button",{id:ke,className:`vbg-custom-sequence__step-row vbg-custom-sequence__step-row--role-${qe} vbg-custom-sequence__step-row--status-${u.status}${y?" vbg-custom-sequence__step-row--parallel":""}${S?" vbg-custom-sequence__step-row--parallel-start":""}${T?" vbg-custom-sequence__step-row--parallel-end":""} ${E?"vbg-custom-sequence__step-row--selected":""}`,onClick:()=>{if(E){_();return}l(u.id)},onKeyDown:j=>{const P=Mt(M,o.steps.length,j.key);if(P===null)return;j.preventDefault();const te=o.steps[P];g(null),l(te.id),window.requestAnimationFrame(()=>{var ne;(ne=document.getElementById(`sequence-step-${te.seq}`))==null||ne.focus()})},type:"button",tabIndex:s?E?0:-1:M===0?0:-1,"aria-expanded":E,"aria-controls":E?"execution-inspector":void 0,"aria-describedby":(m==null?void 0:m.stepId)===u.id?"sequence-step-tooltip":void 0,"aria-label":`Step ${u.seq}: ${u.label} - ${u.detailTitle}, ${O.get(u.from)??u.from} to ${u.toLabel??O.get(u.to)??u.to}${y?`, ${y.label}`:""}`,onBlur:()=>$(),onFocus:j=>{if(!j.currentTarget.matches(":focus-visible"))return;const P=j.currentTarget.querySelector(".vbg-custom-sequence__step-title");P&&w(P,u)},children:[y&&S&&r.jsxs("span",{className:"vbg-custom-sequence__parallel-label",children:[r.jsx("strong",{children:y.label}),r.jsx("small",{children:y.evidence==="lifecycle"?"lifecycle overlap":y.evidence.replace("-"," ")})]}),r.jsx("div",{className:"vbg-custom-sequence__step-line-container",children:_e?r.jsxs("div",{className:"vbg-custom-sequence__self-loop",style:{left:`${z}%`},children:[r.jsx("span",{"aria-hidden":"true",className:"vbg-custom-sequence__self-path"}),r.jsxs("span",{className:"vbg-custom-sequence__self-badge",children:[r.jsx("span",{className:"vbg-custom-sequence__step-num",children:u.seq}),u.displayIcon&&r.jsx("span",{"aria-hidden":"true",className:"vbg-custom-sequence__step-icon",children:r.jsx(L,{name:u.displayIcon})}),r.jsx("strong",{className:`vbg-custom-sequence__step-title${u.isCommand?" vbg-custom-sequence__step-title--command":""}`,"data-tooltip":G(u),onMouseEnter:j=>w(j.currentTarget,u),onMouseLeave:()=>$(100),children:u.displayTitle}),!Z&&r.jsx(Q,{status:u.status})]})]}):r.jsxs("div",{className:`vbg-custom-sequence__arrow vbg-custom-sequence__arrow--${Se} ${Me?"vbg-custom-sequence__arrow--return":"vbg-custom-sequence__arrow--call"} vbg-custom-sequence__arrow--status-${u.status}`,style:{left:`${$e}%`,width:`${we}%`},children:[r.jsx("div",{className:"vbg-custom-sequence__arrow-line"}),r.jsx("div",{className:"vbg-custom-sequence__arrow-head"}),r.jsxs("div",{className:"vbg-custom-sequence__arrow-label",children:[r.jsx("span",{className:"vbg-custom-sequence__step-num",children:u.seq}),u.displayIcon&&r.jsx("span",{"aria-hidden":"true",className:"vbg-custom-sequence__step-icon",children:r.jsx(L,{name:u.displayIcon})}),r.jsx("strong",{className:`vbg-custom-sequence__step-title${u.isCommand?" vbg-custom-sequence__step-title--command":""}`,"data-tooltip":G(u),onMouseEnter:j=>w(j.currentTarget,u),onMouseLeave:()=>$(100),children:u.displayTitle}),!Z&&r.jsx(Q,{status:u.status})]})]})})]},u.id)})})]})]})}),d&&r.jsx(it,{autoFocusClose:!1,item:yt(d,O),onClose:_,onOpenSubagent:n},d.id)]})]}),m&&typeof document<"u"&&Le.createPortal(r.jsx("div",{className:`vbg-custom-sequence__tooltip${m.above?" vbg-custom-sequence__tooltip--above":""}`,id:"sequence-step-tooltip",onMouseEnter:x,onMouseLeave:()=>$(),role:"tooltip",style:{left:m.left,maxHeight:m.maxHeight,top:m.top},children:r.jsx(Re,{children:m.text})}),document.body)]})}export{$t as SequenceDiagram,Mt as nextSequenceStepIndex,G as sequenceTooltipContent,_t as sequenceTooltipLayout};