cogpit 2.3.0 → 2.4.2
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/cli.js +5644 -4349
- package/dist/web/assets/{CommandPaletteHost-D-VvT_HL.js → CommandPaletteHost-DJghey7B.js} +1 -1
- package/dist/web/assets/{ConfigBrowser-Cc2lrh85.js → ConfigBrowser-x0UdXG0K.js} +1 -1
- package/dist/web/assets/{HighlightedEditor-DWNz1Jcz.js → HighlightedEditor-D0TDZx8S.js} +1 -1
- package/dist/web/assets/{KeyboardShortcutsDialog-yOs1u5D6.js → KeyboardShortcutsDialog-2606YXAx.js} +1 -1
- package/dist/web/assets/{MobileFileChanges-B1dtcdSZ.js → MobileFileChanges-B4dwGXMS.js} +1 -1
- package/dist/web/assets/{PreviewPanel-BJwfunf9.js → PreviewPanel-CJdf-VLC.js} +1 -1
- package/dist/web/assets/{ProjectFilesPanel-DppuIFEt.js → ProjectFilesPanel-3GzuQyp3.js} +1 -1
- package/dist/web/assets/{ProjectSwitcherModal-DgsuH5CY.js → ProjectSwitcherModal-D8boI2Qx.js} +1 -1
- package/dist/web/assets/{TerminalOutput-DlGDS0Wx.js → TerminalOutput-C-6RWc6C.js} +1 -1
- package/dist/web/assets/{ThemeSelectorModal-oI9Vm3EH.js → ThemeSelectorModal-DZ9JuT6j.js} +1 -1
- package/dist/web/assets/{WorkflowsPanel-SKbsv_IK.js → WorkflowsPanel-i3GanFyN.js} +1 -1
- package/dist/web/assets/{WorktreePanel-CcSLupr7.js → WorktreePanel-D-BUTFL2.js} +1 -1
- package/dist/web/assets/{index-BVkjlOVU.js → index-BBKPLXTq.js} +1 -1
- package/dist/web/assets/index-CMQcske6.js +1 -0
- package/dist/web/assets/index-C_0XOtqJ.css +1 -0
- package/dist/web/assets/index-D6p4gVB_.js +154 -0
- package/dist/web/assets/{index-7FuVzOBC.js → index-ztb2qsgi.js} +1 -1
- package/dist/web/assets/{session-parser.worker-RMitC4X_.js → session-parser.worker-D3MwyNH5.js} +1 -1
- package/dist/web/assets/vendor-ui-RwWl1mlR.js +882 -0
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/dist/web/assets/index-Bw-DFQut.js +0 -1
- package/dist/web/assets/index-Du17HzQD.js +0 -151
- package/dist/web/assets/index-xdv0cIL2.css +0 -1
- package/dist/web/assets/vendor-ui-CdA11Wfh.js +0 -817
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as le,j as t,r as fe}from"./vendor-react-gGw_S5I_.js";import{aD as Ne,_ as ke,aE as ge,aF as pe,aG as je,aH as ve,B as V,aI as ye,aJ as Te,E as be,y as Ce,G as _e,H as Be,j as Me,k as we,a2 as $e,i as Ae,l as de,q as Ie,h as Se,D as Re}from"./index-
|
|
1
|
+
import{c as le,j as t,r as fe}from"./vendor-react-gGw_S5I_.js";import{aD as Ne,_ as ke,aE as ge,aF as pe,aG as je,aH as ve,B as V,aI as ye,aJ as Te,E as be,y as Ce,G as _e,H as Be,j as Me,k as we,a2 as $e,i as Ae,l as de,q as Ie,h as Se,D as Re}from"./index-D6p4gVB_.js";import{R as me,Q as Ee,U as De,C as ze}from"./vendor-ui-RwWl1mlR.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function He(a){const e=le.c(29),{branches:s,activeBranchIdx:c,branchPointTurnIndex:f}=a,g=s.length;if(g===0)return null;const j=Math.min(f+1,5);let h;e[0]!==s?(h=Math.max(...s.map(Le),1),e[0]=s,e[1]=h):h=e[1];const o=Math.min(h,6),n=20+j*25,r=Math.min(32,Math.max(20,(300-n)/(o+1))),d=18+(g-1)*27+15,m=`0 0 340 ${d}`,p=`${g} branches from turn ${f+1}`;let l;e[2]!==n?(l=t.jsx("line",{x1:20,y1:18,x2:n,y2:18,stroke:"var(--muted-foreground)",strokeWidth:2}),e[2]=n,e[3]=l):l=e[3];let u;e[4]!==j?(u=Array.from({length:j}).map(Fe),e[4]=j,e[5]=u):u=e[5];let k,b;e[6]!==n?(k=t.jsx("circle",{cx:n,cy:18,r:5,fill:"var(--background)",stroke:"var(--foreground)",strokeWidth:2}),b=t.jsx("circle",{cx:n,cy:18,r:2,fill:"var(--foreground)"}),e[6]=n,e[7]=k,e[8]=b):(k=e[7],b=e[8]);let T;if(e[9]!==c||e[10]!==n||e[11]!==s||e[12]!==o||e[13]!==r){let w;e[15]!==c||e[16]!==n||e[17]!==o||e[18]!==r?(w=(i,C)=>{const v=C===c,_=v?"var(--foreground)":"var(--border)",A=v?"var(--foreground)":"var(--border)",N=18+C*27,$=Math.min(i.graphTurnCount,o);return t.jsxs("g",{style:{opacity:v?1:.3},children:[C===0?t.jsx("line",{x1:n,y1:N,x2:n+$*r,y2:N,stroke:_,strokeWidth:2}):t.jsxs(t.Fragment,{children:[t.jsx("path",{d:`M ${n} 18 C ${n+10} ${N-5}, ${n+20} ${N}, ${n+r} ${N}`,fill:"none",stroke:_,strokeWidth:2}),$>1&&t.jsx("line",{x1:n+r,y1:N,x2:n+$*r,y2:N,stroke:_,strokeWidth:2})]}),Array.from({length:$}).map((R,I)=>t.jsxs("g",{children:[t.jsx("circle",{cx:n+(I+1)*r,cy:N,r:3.5,fill:"var(--background)",stroke:_,strokeWidth:1.5}),t.jsx("circle",{cx:n+(I+1)*r,cy:N,r:1.5,fill:A})]},I)),i.graphTurnCount>o&&t.jsxs("text",{x:n+($+.4)*r,y:N+3,fill:v?"var(--foreground)":"var(--border)",fontSize:"8",fontFamily:"monospace",children:["+",i.graphTurnCount-o]})]},i.id)},e[15]=c,e[16]=n,e[17]=o,e[18]=r,e[19]=w):w=e[19],T=s.map(w),e[9]=c,e[10]=n,e[11]=s,e[12]=o,e[13]=r,e[14]=T}else T=e[14];let M;return e[20]!==d||e[21]!==m||e[22]!==p||e[23]!==l||e[24]!==u||e[25]!==k||e[26]!==b||e[27]!==T?(M=t.jsx("div",{className:"rounded-lg border bg-muted/20 px-3 py-2",children:t.jsxs("svg",{width:"100%",height:d,viewBox:m,role:"img","aria-label":p,children:[l,u,k,b,T]})}),e[20]=d,e[21]=m,e[22]=p,e[23]=l,e[24]=u,e[25]=k,e[26]=b,e[27]=T,e[28]=M):M=e[28],M}function Fe(a,e){return t.jsxs("g",{children:[t.jsx("circle",{cx:20+e*25,cy:18,r:3.5,fill:"var(--background)",stroke:"var(--muted-foreground)",strokeWidth:1.5}),t.jsx("circle",{cx:20+e*25,cy:18,r:1.5,fill:"var(--muted-foreground)"})]},`s-${e}`)}function Le(a){return a.graphTurnCount}function Pe(a){const e=a.input.file_path??a.input.path??"";if(e)return e.split("/").pop()||e;const s=a.input.command;if(s)return s.length>40?s.slice(0,37)+"...":s;const c=a.input.pattern;if(c)return c.length>30?c.slice(0,27)+"...":c;const f=a.input.query;return f?f.length>30?f.slice(0,27)+"...":f:""}function We(a){const e=le.c(26),{turn:s,archiveIndex:c,branchId:f,onRedoToHere:g}=a;let j;e[0]!==s.userMessage?(j=typeof s.userMessage=="string"?s.userMessage:Array.isArray(s.userMessage)?s.userMessage.flatMap(qe).join(`
|
|
2
2
|
`):null,e[0]=s.userMessage,e[1]=j):j=e[1];const h=j,y=c+1;let o;e[2]!==y?(o=t.jsx(ge,{className:"border-b py-2",children:t.jsxs(pe,{children:["Turn ",y]})}),e[2]=y,e[3]=o):o=e[3];let n;e[4]!==h?(n=h&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"You"}),t.jsx("div",{className:"text-sm text-foreground",children:h})]}),e[4]=h,e[5]=n):n=e[5];let r;e[6]!==s.thinking[0]||e[7]!==s.thinking.length?(r=s.thinking.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Thinking"}),t.jsxs("div",{className:"text-xs text-muted-foreground italic",children:[s.thinking[0].thinking.slice(0,300),s.thinking[0].thinking.length>300?"...":""]})]}),e[6]=s.thinking[0],e[7]=s.thinking.length,e[8]=r):r=e[8];let d;e[9]!==s.assistantText?(d=s.assistantText.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-success",children:"Assistant"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:s.assistantText.join(`
|
|
3
3
|
`)})]}),e[9]=s.assistantText,e[10]=d):d=e[10];let m;e[11]!==s.toolCalls?(m=s.toolCalls.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Tools"}),t.jsx("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:s.toolCalls.map(Ge)})]}),e[11]=s.toolCalls,e[12]=m):m=e[12];let p;e[13]!==n||e[14]!==r||e[15]!==d||e[16]!==m?(p=t.jsxs(je,{className:"flex flex-col gap-3 py-3",children:[n,r,d,m]}),e[13]=n,e[14]=r,e[15]=d,e[16]=m,e[17]=p):p=e[17];let l;e[18]!==c||e[19]!==f||e[20]!==g?(l=g&&t.jsx(ve,{className:"justify-end py-2",children:t.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>g(f,c),children:[t.jsx(me,{"data-icon":"inline-start",className:"scale-x-[-1]"}),"Redo to here"]})}),e[18]=c,e[19]=f,e[20]=g,e[21]=l):l=e[21];let u;return e[22]!==o||e[23]!==p||e[24]!==l?(u=t.jsxs(ye,{size:"sm",className:"motion-list-item gap-0 py-0",children:[o,p,l]}),e[22]=o,e[23]=p,e[24]=l,e[25]=u):u=e[25],u}function Ge(a){const e=Ne(a),s=Pe(a)||e.summary;return t.jsxs("span",{className:ke("font-mono text-xs text-muted-foreground",a.isError&&"text-destructive"),children:[e.label,s?` ${s}`:""]},a.id)}function qe(a){return a.type==="text"?[a.text]:[]}function Oe(a){const e=le.c(27),{turn:s,archiveIndex:c,branchId:f,onRedoToHere:g}=a,j=c+1;let h;e[0]!==j?(h=t.jsx(ge,{className:"border-b py-2",children:t.jsxs(pe,{children:["Turn ",j]})}),e[0]=j,e[1]=h):h=e[1];let y;e[2]!==s.userMessage?(y=s.userMessage&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"You"}),t.jsx("div",{className:"text-sm text-foreground",children:s.userMessage})]}),e[2]=s.userMessage,e[3]=y):y=e[3];let o;e[4]!==s.thinkingBlocks[0]||e[5]!==s.thinkingBlocks.length?(o=s.thinkingBlocks.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Thinking"}),t.jsxs("div",{className:"text-xs text-muted-foreground italic",children:[s.thinkingBlocks[0].slice(0,300),"..."]})]}),e[4]=s.thinkingBlocks[0],e[5]=s.thinkingBlocks.length,e[6]=o):o=e[6];let n;e[7]!==s.assistantText?(n=s.assistantText.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-success",children:"Assistant"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:s.assistantText.join(`
|
|
4
4
|
`)})]}),e[7]=s.assistantText,e[8]=n):n=e[8];let r;e[9]!==s.toolCalls?(r=s.toolCalls.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Tools"}),t.jsx("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:s.toolCalls.map(Ye)})]}),e[9]=s.toolCalls,e[10]=r):r=e[10];let d;e[11]!==y||e[12]!==o||e[13]!==n||e[14]!==r?(d=t.jsxs(je,{className:"flex flex-col gap-3 py-3",children:[y,o,n,r]}),e[11]=y,e[12]=o,e[13]=n,e[14]=r,e[15]=d):d=e[15];let m;e[16]!==c||e[17]!==f||e[18]!==g?(m=()=>g(f,c),e[16]=c,e[17]=f,e[18]=g,e[19]=m):m=e[19];let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(me,{"data-icon":"inline-start",className:"scale-x-[-1]"}),e[20]=p):p=e[20];let l;e[21]!==m?(l=t.jsx(ve,{className:"justify-end py-2",children:t.jsxs(V,{variant:"ghost",size:"sm",onClick:m,children:[p,"Redo to here"]})}),e[21]=m,e[22]=l):l=e[22];let u;return e[23]!==l||e[24]!==h||e[25]!==d?(u=t.jsxs(ye,{size:"sm",className:"motion-list-item gap-0 py-0",children:[h,d,l]}),e[23]=l,e[24]=h,e[25]=d,e[26]=u):u=e[26],u}function Ye(a,e){return t.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[a.type," ",a.filePath.split("/").pop()]},e)}function Ve(a){var xe,he,ue;const e=le.c(88),{open:s,branches:c,branchPointTurnIndex:f,currentTurns:g,onClose:j,onCloseComplete:h,onRedoToTurn:y,onRedoEntireBranch:o}=a,n=s===void 0?!0:s;let r;if(e[0]!==c||e[1]!==g){r=[];let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=new Date().toISOString(),e[3]=x):x=e[3];let B;e[4]!==g?(B={kind:"current",id:"__current__",label:"Current branch",createdAt:x,fullTurns:g,archivedTurns:null,graphTurnCount:g.length,branch:null},e[4]=g,e[5]=B):B=e[5],r.push(B);for(const S of c){let K=null;if(S.jsonlLines.length>0)try{K=Te(S.jsonlLines.join(`
|
package/dist/web/assets/{session-parser.worker-RMitC4X_.js → session-parser.worker-D3MwyNH5.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){"use strict";const dt=["codex","copilot","claude"],pt="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";function Ee(t,e){const n=new TextEncoder().encode(e);let s="";for(const i of n)s+=String.fromCharCode(i);const o=btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${t}${o}`}function Ne(t,e){if(!e.startsWith(t))return null;try{const n=e.slice(t.length).replace(/-/g,"+").replace(/_/g,"/"),s=atob(n),o=Uint8Array.from(s,i=>i.charCodeAt(0));return new TextDecoder().decode(o)}catch{return null}}function It(t){return{lossy:!1,owns:e=>typeof e=="string"&&e.startsWith(t),encode:e=>Ee(t,e),decode:e=>Ne(t,e)}}function At(t){const e=new RegExp(`(${pt})\\.jsonl$`,"i").exec(t);return e?e[1]:null}const St={urlId:t=>t.replace(/\.jsonl$/,""),fileNameFromUrlId:t=>t.endsWith(".jsonl")?t:`${t}.jsonl`};function wt(t){return`'${t.replace(/'/g,"'\\''")}'`}function K(t,e){return e?[t,e]:[]}function tt(t,e){var n;return((n=e.exec(t))==null?void 0:n[1])??null}const et="[0-9a-f-]{36}",Mt="codex__",Et="copilot__",ve=new Set(["default","plan","acceptEdits","dontAsk","auto"]),Be={kind:"claude",displayName:"Claude Code",binName:"claude",dirName:{lossy:!0,owns:t=>typeof t=="string"&&!t.startsWith(Mt)&&!t.startsWith(Et),encode:t=>(t.replace(/[\\/]+$/,"")||t).replace(/[^a-zA-Z0-9]/g,"-"),decode:t=>{const e=/^([A-Za-z])--(.*)$/.exec(t);return e?`${e[1]}:\\${e[2].replace(/-/g,"\\")}`:"/"+t.replace(/^-/,"").replace(/-/g,"/")}},sessionFile:{name:t=>`${t}.jsonl`,sessionId:At,...St},metadataFromHead:!0,resume:{command:t=>`claude --resume ${t}`,args:t=>["--resume",t]},launchArgs:{permissions:t=>t!=null&&t.mode?t.mode==="bypassPermissions"?["--dangerously-skip-permissions"]:[...ve.has(t.mode)?["--permission-mode",t.mode]:[],...(t.allowedTools??[]).flatMap(e=>["--allowedTools",e]),...(t.disallowedTools??[]).flatMap(e=>["--disallowedTools",e])]:["--permission-mode","default"],model:t=>K("--model",t),effort:t=>K("--effort",t),fastTier:()=>[]},serviceTier:null,cli:{packageName:"@anthropic-ai/claude-code",homebrew:{name:"claude-code",cask:!1},wingetId:null,versionArgs:["--version"],selfUpdate:{args:["update"],matches:t=>t.endsWith("/.local/bin/claude")||t.endsWith("/.local/bin/claude.exe")||t.includes("/.local/share/claude/")},bundledBySdk:!0,homeDirName:".claude",homeEnvVar:null,installMarker:"projects",homeIsDiscoverable:!1,process:{by:"command",sessionIdFromCommand:t=>tt(t,new RegExp(`--resume(?:=|\\s+)(${et})`))??tt(t,new RegExp(`--session-id(?:=|\\s+)(${et})`))}},config:{rootDirName:".claude",instructions:[{in:"scope",path:"CLAUDE.md",scopes:["global","project"]},{in:"root",path:"CLAUDE.md",label:".claude/CLAUDE.md",scopes:["project"]}],settings:[{in:"root",path:"settings.json",scopes:["global"]},{in:"root",path:"settings.local.json",scopes:["project"]}],skillsDir:"skills",agentsDir:"agents",commandsDir:"commands",themesDir:"themes",pluginsDir:"plugins"},contextWindow:{defaultLimit:1e6,limits:[{match:"claude-haiku-4-5",limit:2e5},{match:"claude-haiku-4-1",limit:2e5},{match:"claude-sonnet-4-5",limit:2e5},{match:"claude-opus-4-5",limit:2e5},{match:"claude-opus-4-1",limit:2e5}],compactBuffer:33e3,extendedContext:{marker:"[1m]",limit:1e6}},capabilities:{worktrees:!0,mcp:!0,slashCommands:!0,workflows:!0,agentTeams:!0,subagentTranscripts:!0,sharing:!0,goals:"transcript",undo:!0,redo:!0,nativeRewind:!1,fileCheckpoints:!0,reasoningEffort:!0,fastTier:!0,imageInput:!0,planMode:!0,midTurnSteering:!1,stopSession:!0,ultracode:!0,contextWindow:!0,externalProcesses:!1,modelFallbackNotices:!0,autoPermissionMode:"per-model",settingsApply:"live",turnLiveness:"transcript",tokenStreaming:!0,nativeFork:!1,namedSessions:!0}},Nt={appServerValue:"priority",cliConfigValue:"fast"},Re={kind:"codex",displayName:"Codex",binName:"codex",dirName:It(Mt),sessionFile:{name:(t,e=new Date)=>{const n=String(e.getFullYear()),s=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0"),f=String(e.getSeconds()).padStart(2,"0");return`${n}/${s}/${o}/rollout-${n}-${s}-${o}T${i}-${l}-${f}-${t}.jsonl`},sessionId:At,...St},metadataFromHead:!1,resume:{command:(t,e)=>e?`codex -C ${wt(e)} resume ${t}`:`codex resume ${t}`,args:t=>["resume",t]},launchArgs:{permissions:t=>{const e=(t==null?void 0:t.mode)||"default";return e==="bypassPermissions"?["--dangerously-bypass-approvals-and-sandbox"]:["--sandbox",e==="plan"?"read-only":"workspace-write","-c",'approval_policy="never"']},model:t=>K("-m",t),effort:t=>t?["-c",`model_reasoning_effort=${JSON.stringify(t)}`]:[],fastTier:t=>t?["-c",`service_tier=${JSON.stringify(Nt.cliConfigValue)}`,"--enable","fast_mode"]:[]},serviceTier:Nt,cli:{packageName:"@openai/codex",homebrew:{name:"codex",cask:!1},wingetId:null,versionArgs:["--version"],selfUpdate:null,bundledBySdk:!1,homeDirName:".codex",homeEnvVar:"CODEX_HOME",installMarker:"",homeIsDiscoverable:!0,process:{by:"command",sessionIdFromCommand:t=>tt(t,new RegExp(`codex(?:\\s+\\S+)*\\s+exec\\s+resume\\s+(${et})`))}},config:{rootDirName:".codex",instructions:[{in:"scope",path:"AGENTS.md",scopes:["global","project"]}],settings:[{in:"root",path:"config.toml",scopes:["global","project"]}],skillsDir:"skills",agentsDir:"agents",commandsDir:"prompts",themesDir:null,pluginsDir:null},contextWindow:{defaultLimit:272e3,limits:[],compactBuffer:0,extendedContext:null},capabilities:{worktrees:!1,mcp:!1,slashCommands:!1,workflows:!1,agentTeams:!1,subagentTranscripts:!0,sharing:!1,goals:"thread-api",undo:!0,redo:!0,nativeRewind:!1,fileCheckpoints:!1,reasoningEffort:!0,fastTier:!0,imageInput:!0,planMode:!0,midTurnSteering:!0,stopSession:!1,ultracode:!1,contextWindow:!1,externalProcesses:!1,modelFallbackNotices:!1,autoPermissionMode:"never",settingsApply:"next-turn",turnLiveness:"runtime",tokenStreaming:!0,nativeFork:!1,namedSessions:!1}},Pe={kind:"copilot",displayName:"GitHub Copilot CLI",binName:"copilot",dirName:It(Et),sessionFile:{name:t=>`${t}/events.jsonl`,sessionId:t=>{const e=new RegExp(`^(${pt})/events\\.jsonl$`,"i").exec(t);return e?e[1]:null},urlId:t=>{const e=new RegExp(`^(${pt})/events\\.jsonl$`,"i").exec(t);return e?e[1]:t.replace(/\.jsonl$/,"")},fileNameFromUrlId:t=>t.endsWith(".jsonl")?t:`${t}/events.jsonl`},metadataFromHead:!0,resume:{command:(t,e)=>e?`copilot -C ${wt(e)} --resume ${t}`:`copilot --resume ${t}`,args:t=>[`--resume=${t}`]},launchArgs:{permissions:t=>(t==null?void 0:t.mode)==="bypassPermissions"||(t==null?void 0:t.mode)==="auto"?["--allow-all"]:[],model:t=>K("--model",t),effort:t=>K("--reasoning-effort",t),fastTier:()=>[]},serviceTier:null,cli:{packageName:"@github/copilot",homebrew:{name:"copilot-cli",cask:!0},wingetId:"GitHub.Copilot",versionArgs:["--version"],selfUpdate:{args:["update"],matches:t=>t.endsWith("/.local/bin/copilot")||t==="/usr/local/bin/copilot"},bundledBySdk:!1,homeDirName:".copilot",homeEnvVar:"COPILOT_HOME",installMarker:"session-state",homeIsDiscoverable:!0,process:{by:"executable",sessionIdFromCommand:t=>tt(t,new RegExp(`--resume(?:=|\\s+)(${et})`))}},config:{rootDirName:".copilot",instructions:[{in:"scope",path:"AGENTS.md",scopes:["global","project"]}],settings:[{in:"root",path:"config.json",scopes:["global"]}],skillsDir:"skills",agentsDir:null,commandsDir:null,themesDir:null,pluginsDir:null},contextWindow:{defaultLimit:2e5,limits:[],compactBuffer:0,extendedContext:null},capabilities:{worktrees:!1,mcp:!1,slashCommands:!1,workflows:!1,agentTeams:!1,subagentTranscripts:!1,sharing:!1,goals:!1,undo:!0,redo:!1,nativeRewind:!0,fileCheckpoints:!1,reasoningEffort:!1,fastTier:!1,imageInput:!1,planMode:!0,midTurnSteering:!0,stopSession:!0,ultracode:!1,contextWindow:!1,externalProcesses:!0,modelFallbackNotices:!1,autoPermissionMode:"always",settingsApply:"next-turn",turnLiveness:"runtime",tokenStreaming:!1,nativeFork:!0,namedSessions:!0}},Fe=Object.freeze({claude:Be,codex:Re,copilot:Pe});function ft(t){return Fe[t]}function mt(t){return t.type==="user"}function gt(t){return t.type==="assistant"}function vt(t){return t.type==="progress"}function Bt(t){return t.type==="system"}function Rt(t){return t.type==="summary"}function $e(t){return t.type==="queue-operation"}function Pt(t){return t.type==="attachment"}function Ue(t){return t.type==="user"&&t.isCompactSummary===!0}function Ft(t){return t.type==="system"&&t.subtype==="compact_boundary"}function $t(t,e){let n=0;for(const s of t)e[s.name]=(e[s.name]??0)+1,s.isError&&n++;return n}function Ut(t,e){t.totalInputTokens+=e.input_tokens,t.totalOutputTokens+=e.output_tokens,t.totalCacheCreationTokens+=e.cache_creation_input_tokens??0,t.totalCacheReadTokens+=e.cache_read_input_tokens??0}function nt(t){return{totalInputTokens:0,totalOutputTokens:0,totalCacheCreationTokens:0,totalCacheReadTokens:0,toolCallCounts:{},errorCount:0,totalDurationMs:0,turnCount:t}}function st(t){const e=nt(t.length);for(const n of t){n.tokenUsage&&Ut(e,n.tokenUsage),n.durationMs&&(e.totalDurationMs+=n.durationMs),e.errorCount+=$t(n.toolCalls,e.toolCallCounts);for(const s of n.subAgentActivity)e.errorCount+=$t(s.toolCalls,e.toolCallCounts),s.tokenUsage&&Ut(e,s.tokenUsage)}return e}const De=/<(agent-message|teammate-message)([^>]*)>([\s\S]*?)<\/\1>/g,Oe=[/\bteammate_id=(?:"([^"]*)"|'([^']*)')/,/\bfrom=(?:"([^"]*)"|'([^']*)')/];function je(t){for(const e of Oe){const n=t.match(e),s=(n==null?void 0:n[1])??(n==null?void 0:n[2]);if(s)return s}return null}function ht(t){let e=null,n=!1;const s=t.replace(De,(o,i,l,f)=>(n=!0,e===null&&(e=je(l)),f.trim()));return{sender:e,matched:n,body:n?s.trim():t}}function ot(t){return typeof t=="string"?t:t.filter(e=>e.type==="text").map(e=>e.text).join(`
|
|
1
|
+
(function(){"use strict";const dt=["codex","copilot","claude"],pt="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";function Ee(t,e){const n=new TextEncoder().encode(e);let s="";for(const i of n)s+=String.fromCharCode(i);const o=btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${t}${o}`}function Ne(t,e){if(!e.startsWith(t))return null;try{const n=e.slice(t.length).replace(/-/g,"+").replace(/_/g,"/"),s=atob(n),o=Uint8Array.from(s,i=>i.charCodeAt(0));return new TextDecoder().decode(o)}catch{return null}}function It(t){return{lossy:!1,owns:e=>typeof e=="string"&&e.startsWith(t),encode:e=>Ee(t,e),decode:e=>Ne(t,e)}}function At(t){const e=new RegExp(`(${pt})\\.jsonl$`,"i").exec(t);return e?e[1]:null}const St={urlId:t=>t.replace(/\.jsonl$/,""),fileNameFromUrlId:t=>t.endsWith(".jsonl")?t:`${t}.jsonl`};function wt(t){return`'${t.replace(/'/g,"'\\''")}'`}function K(t,e){return e?[t,e]:[]}function tt(t,e){var n;return((n=e.exec(t))==null?void 0:n[1])??null}const et="[0-9a-f-]{36}",Mt="codex__",Et="copilot__",ve=new Set(["default","plan","acceptEdits","dontAsk","auto"]),Be={kind:"claude",displayName:"Claude Code",binName:"claude",dirName:{lossy:!0,owns:t=>typeof t=="string"&&!t.startsWith(Mt)&&!t.startsWith(Et),encode:t=>(t.replace(/[\\/]+$/,"")||t).replace(/[^a-zA-Z0-9]/g,"-"),decode:t=>{const e=/^([A-Za-z])--(.*)$/.exec(t);return e?`${e[1]}:\\${e[2].replace(/-/g,"\\")}`:"/"+t.replace(/^-/,"").replace(/-/g,"/")}},sessionFile:{name:t=>`${t}.jsonl`,sessionId:At,...St},metadataFromHead:!0,resume:{command:t=>`claude --resume ${t}`,args:t=>["--resume",t]},launchArgs:{permissions:t=>t!=null&&t.mode?t.mode==="bypassPermissions"?["--dangerously-skip-permissions"]:[...ve.has(t.mode)?["--permission-mode",t.mode]:[],...(t.allowedTools??[]).flatMap(e=>["--allowedTools",e]),...(t.disallowedTools??[]).flatMap(e=>["--disallowedTools",e])]:["--permission-mode","default"],model:t=>K("--model",t),effort:t=>K("--effort",t),fastTier:()=>[]},serviceTier:null,cli:{packageName:"@anthropic-ai/claude-code",homebrew:{name:"claude-code",cask:!1},wingetId:null,versionArgs:["--version"],selfUpdate:{args:["update"],matches:t=>t.endsWith("/.local/bin/claude")||t.endsWith("/.local/bin/claude.exe")||t.includes("/.local/share/claude/")},bundledBySdk:!0,homeDirName:".claude",homeEnvVar:null,installMarker:"projects",homeIsDiscoverable:!1,process:{by:"command",sessionIdFromCommand:t=>tt(t,new RegExp(`--resume(?:=|\\s+)(${et})`))??tt(t,new RegExp(`--session-id(?:=|\\s+)(${et})`))}},config:{rootDirName:".claude",instructions:[{in:"scope",path:"CLAUDE.md",scopes:["global","project"]},{in:"root",path:"CLAUDE.md",label:".claude/CLAUDE.md",scopes:["project"]}],settings:[{in:"root",path:"settings.json",scopes:["global"]},{in:"root",path:"settings.local.json",scopes:["project"]}],skillsDir:"skills",agentsDir:"agents",commandsDir:"commands",themesDir:"themes",pluginsDir:"plugins"},contextWindow:{defaultLimit:1e6,limits:[{match:"claude-haiku-4-5",limit:2e5},{match:"claude-haiku-4-1",limit:2e5},{match:"claude-sonnet-4-5",limit:2e5},{match:"claude-opus-4-5",limit:2e5},{match:"claude-opus-4-1",limit:2e5}],compactBuffer:33e3,extendedContext:{marker:"[1m]",limit:1e6}},capabilities:{worktrees:!0,mcp:!0,slashCommands:!0,workflows:!0,agentTeams:!0,subagentTranscripts:!0,nestedSubagents:!1,sharing:!0,goals:"transcript",undo:!0,redo:!0,nativeRewind:!1,fileCheckpoints:!0,reasoningEffort:!0,fastTier:!0,imageInput:!0,planMode:!0,midTurnSteering:!1,stopSession:!0,ultracode:!0,contextWindow:!0,externalProcesses:!1,accountSwitching:!0,modelFallbackNotices:!0,autoPermissionMode:"per-model",settingsApply:"live",turnLiveness:"transcript",tokenStreaming:!0,nativeFork:!1,namedSessions:!0}},Nt={appServerValue:"priority",cliConfigValue:"fast"},Re={kind:"codex",displayName:"Codex",binName:"codex",dirName:It(Mt),sessionFile:{name:(t,e=new Date)=>{const n=String(e.getFullYear()),s=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0"),f=String(e.getSeconds()).padStart(2,"0");return`${n}/${s}/${o}/rollout-${n}-${s}-${o}T${i}-${l}-${f}-${t}.jsonl`},sessionId:At,...St},metadataFromHead:!1,resume:{command:(t,e)=>e?`codex -C ${wt(e)} resume ${t}`:`codex resume ${t}`,args:t=>["resume",t]},launchArgs:{permissions:t=>{const e=(t==null?void 0:t.mode)||"default";return e==="bypassPermissions"?["--dangerously-bypass-approvals-and-sandbox"]:["--sandbox",e==="plan"?"read-only":"workspace-write","-c",'approval_policy="never"']},model:t=>K("-m",t),effort:t=>t?["-c",`model_reasoning_effort=${JSON.stringify(t)}`]:[],fastTier:t=>t?["-c",`service_tier=${JSON.stringify(Nt.cliConfigValue)}`,"--enable","fast_mode"]:[]},serviceTier:Nt,cli:{packageName:"@openai/codex",homebrew:{name:"codex",cask:!1},wingetId:null,versionArgs:["--version"],selfUpdate:null,bundledBySdk:!1,homeDirName:".codex",homeEnvVar:"CODEX_HOME",installMarker:"",homeIsDiscoverable:!0,process:{by:"command",sessionIdFromCommand:t=>tt(t,new RegExp(`codex(?:\\s+\\S+)*\\s+exec\\s+resume\\s+(${et})`))}},config:{rootDirName:".codex",instructions:[{in:"scope",path:"AGENTS.md",scopes:["global","project"]}],settings:[{in:"root",path:"config.toml",scopes:["global","project"]}],skillsDir:"skills",agentsDir:"agents",commandsDir:"prompts",themesDir:null,pluginsDir:null},contextWindow:{defaultLimit:272e3,limits:[],compactBuffer:0,extendedContext:null},capabilities:{worktrees:!1,mcp:!1,slashCommands:!1,workflows:!1,agentTeams:!1,subagentTranscripts:!0,nestedSubagents:!0,sharing:!1,goals:"thread-api",undo:!0,redo:!0,nativeRewind:!1,fileCheckpoints:!1,reasoningEffort:!0,fastTier:!0,imageInput:!0,planMode:!0,midTurnSteering:!0,stopSession:!1,ultracode:!1,contextWindow:!1,externalProcesses:!1,accountSwitching:!1,modelFallbackNotices:!1,autoPermissionMode:"never",settingsApply:"next-turn",turnLiveness:"runtime",tokenStreaming:!0,nativeFork:!1,namedSessions:!1}},Pe={kind:"copilot",displayName:"GitHub Copilot CLI",binName:"copilot",dirName:It(Et),sessionFile:{name:t=>`${t}/events.jsonl`,sessionId:t=>{const e=new RegExp(`^(${pt})/events\\.jsonl$`,"i").exec(t);return e?e[1]:null},urlId:t=>{const e=new RegExp(`^(${pt})/events\\.jsonl$`,"i").exec(t);return e?e[1]:t.replace(/\.jsonl$/,"")},fileNameFromUrlId:t=>t.endsWith(".jsonl")?t:`${t}/events.jsonl`},metadataFromHead:!0,resume:{command:(t,e)=>e?`copilot -C ${wt(e)} --resume ${t}`:`copilot --resume ${t}`,args:t=>[`--resume=${t}`]},launchArgs:{permissions:t=>(t==null?void 0:t.mode)==="bypassPermissions"||(t==null?void 0:t.mode)==="auto"?["--allow-all"]:[],model:t=>K("--model",t),effort:t=>K("--reasoning-effort",t),fastTier:()=>[]},serviceTier:null,cli:{packageName:"@github/copilot",homebrew:{name:"copilot-cli",cask:!0},wingetId:"GitHub.Copilot",versionArgs:["--version"],selfUpdate:{args:["update"],matches:t=>t.endsWith("/.local/bin/copilot")||t==="/usr/local/bin/copilot"},bundledBySdk:!1,homeDirName:".copilot",homeEnvVar:"COPILOT_HOME",installMarker:"session-state",homeIsDiscoverable:!0,process:{by:"executable",sessionIdFromCommand:t=>tt(t,new RegExp(`--resume(?:=|\\s+)(${et})`))}},config:{rootDirName:".copilot",instructions:[{in:"scope",path:"AGENTS.md",scopes:["global","project"]}],settings:[{in:"root",path:"config.json",scopes:["global"]}],skillsDir:"skills",agentsDir:null,commandsDir:null,themesDir:null,pluginsDir:null},contextWindow:{defaultLimit:2e5,limits:[],compactBuffer:0,extendedContext:null},capabilities:{worktrees:!1,mcp:!1,slashCommands:!1,workflows:!1,agentTeams:!1,subagentTranscripts:!1,nestedSubagents:!1,sharing:!1,goals:!1,undo:!0,redo:!1,nativeRewind:!0,fileCheckpoints:!1,reasoningEffort:!1,fastTier:!1,imageInput:!1,planMode:!0,midTurnSteering:!0,stopSession:!0,ultracode:!1,contextWindow:!1,externalProcesses:!0,accountSwitching:!1,modelFallbackNotices:!1,autoPermissionMode:"always",settingsApply:"next-turn",turnLiveness:"runtime",tokenStreaming:!1,nativeFork:!0,namedSessions:!0}},Fe=Object.freeze({claude:Be,codex:Re,copilot:Pe});function ft(t){return Fe[t]}function mt(t){return t.type==="user"}function gt(t){return t.type==="assistant"}function vt(t){return t.type==="progress"}function Bt(t){return t.type==="system"}function Rt(t){return t.type==="summary"}function $e(t){return t.type==="queue-operation"}function Pt(t){return t.type==="attachment"}function Ue(t){return t.type==="user"&&t.isCompactSummary===!0}function Ft(t){return t.type==="system"&&t.subtype==="compact_boundary"}function $t(t,e){let n=0;for(const s of t)e[s.name]=(e[s.name]??0)+1,s.isError&&n++;return n}function Ut(t,e){t.totalInputTokens+=e.input_tokens,t.totalOutputTokens+=e.output_tokens,t.totalCacheCreationTokens+=e.cache_creation_input_tokens??0,t.totalCacheReadTokens+=e.cache_read_input_tokens??0}function nt(t){return{totalInputTokens:0,totalOutputTokens:0,totalCacheCreationTokens:0,totalCacheReadTokens:0,toolCallCounts:{},errorCount:0,totalDurationMs:0,turnCount:t}}function st(t){const e=nt(t.length);for(const n of t){n.tokenUsage&&Ut(e,n.tokenUsage),n.durationMs&&(e.totalDurationMs+=n.durationMs),e.errorCount+=$t(n.toolCalls,e.toolCallCounts);for(const s of n.subAgentActivity)e.errorCount+=$t(s.toolCalls,e.toolCallCounts),s.tokenUsage&&Ut(e,s.tokenUsage)}return e}const De=/<(agent-message|teammate-message)([^>]*)>([\s\S]*?)<\/\1>/g,Oe=[/\bteammate_id=(?:"([^"]*)"|'([^']*)')/,/\bfrom=(?:"([^"]*)"|'([^']*)')/];function je(t){for(const e of Oe){const n=t.match(e),s=(n==null?void 0:n[1])??(n==null?void 0:n[2]);if(s)return s}return null}function ht(t){let e=null,n=!1;const s=t.replace(De,(o,i,l,f)=>(n=!0,e===null&&(e=je(l)),f.trim()));return{sender:e,matched:n,body:n?s.trim():t}}function ot(t){return typeof t=="string"?t:t.filter(e=>e.type==="text").map(e=>e.text).join(`
|
|
2
2
|
`)}function Dt(t){return t?typeof t=="string"?t:t.map(e=>e.type==="text"?e.text:"").filter(Boolean).join(`
|
|
3
3
|
`):""}function Ot(t){if(!(t!=null&&t.trim()))return!1;const e=t.trimStart();return e.startsWith("<")?!e.includes("<task-notification>")&&!e.startsWith("<system-reminder>")&&!e.startsWith("<local-command-"):!0}const Le=/<task-notification>[\s\S]*?<\/task-notification>/g,We=/<[^>]*>/g;function qe(t){var n;if(((n=t.origin)==null?void 0:n.kind)==="task-notification")return!0;const e=ot(t.message.content);return e.includes("<task-notification>")?e.replace(Le,"").replace(We,"").trim()==="":!1}function ze(t){if(!Pt(t))return null;const e=t.attachment;if(!e||e.type!=="queued_command"||e.commandMode!=="prompt")return null;const n=e.prompt;if(n==null)return null;const s=typeof n=="string"?n:ot(n);if(!Ot(s))return null;const o=e.origin;if((o==null?void 0:o.kind)==="peer"){const l=o.name??o.from??null;if(l)return{raw:s,sender:l,body:o.body??ht(s).body}}if((o==null?void 0:o.kind)==="human")return{raw:s,sender:null,body:s};const i=ht(s);return{raw:s,sender:i.sender,body:i.body}}const Je=[["attributionAgent","agent"],["attributionSkill","skill"],["attributionPlugin","plugin"],["attributionMcpServer","mcpServer"],["attributionMcpTool","mcpTool"]];function Ve(t,e){let n=t;for(const[s,o]of Je){const i=e[s];typeof i!="string"||!i||(n={...n,[o]:i})}return n}function Ke(t,e){var s,o;if(!t)return{...e};const n=(((s=t.output_tokens_details)==null?void 0:s.thinking_tokens)??0)+(((o=e.output_tokens_details)==null?void 0:o.thinking_tokens)??0);return{input_tokens:t.input_tokens+e.input_tokens,output_tokens:t.output_tokens+e.output_tokens,cache_creation_input_tokens:(t.cache_creation_input_tokens??0)+(e.cache_creation_input_tokens??0),cache_read_input_tokens:(t.cache_read_input_tokens??0)+(e.cache_read_input_tokens??0),speed:e.speed??t.speed,...t.output_tokens_details||e.output_tokens_details?{output_tokens_details:{thinking_tokens:n}}:{}}}const Ge=/^This session is being continued from a previous conversation[\s\S]*?\n\nSummary:\s*\n/,Qe=/\n+(?:If you need specific details from before compaction|(?:Please c|C)ontinue the conversation from where it left off)[\s\S]*$/;function He(t){return ot(t).trim().replace(Ge,"").replace(Qe,"").trim()}function Xe(t){if(t)return{trigger:t.trigger,preTokens:t.preTokens,postTokens:t.postTokens}}function it(t,e){return{id:t.uuid??crypto.randomUUID(),userMessage:e,contentBlocks:[],thinking:[],assistantText:[],toolCalls:[],subAgentActivity:[],timestamp:t.timestamp??"",durationMs:null,tokenUsage:null,model:null}}function Ze(t){const e=[];let n=0;for(;n<t.length;){const s=t[n];if(s.kind==="tool_calls"){const o=s.toolCalls.findIndex(i=>i.name==="EnterPlanMode");if(o!==-1){const i=s.toolCalls[o],l=String(i.input.plan??""),f=s.timestamp,y=s.toolCalls.slice(0,o);y.length>0&&e.push({kind:"tool_calls",toolCalls:y,timestamp:s.timestamp});const b=[],T=s.toolCalls.slice(o+1),h=T.findIndex(k=>k.name==="ExitPlanMode");if(h!==-1){b.push(...T.slice(0,h));const k=T[h],p=k.input.path?String(k.input.path):void 0;let N="pending";k.result!==null&&(N=k.isError?"rejected":"approved"),e.push({kind:"plan_mode",plan:l,planFilePath:p,status:N,toolCalls:b,timestamp:f});const M=T.slice(h+1);M.length>0&&e.push({kind:"tool_calls",toolCalls:M,timestamp:s.timestamp}),n++;continue}else{b.push(...T);let k,p,N="pending",M=n+1;const w=[];for(;M<t.length;){const B=t[M];if(B.kind==="tool_calls"){const P=B.toolCalls.findIndex($=>$.name==="ExitPlanMode");if(P!==-1){b.push(...B.toolCalls.slice(0,P)),k=B.toolCalls[P],p=k.input.path?String(k.input.path):void 0,k.result!==null&&(N=k.isError?"rejected":"approved");const $=B.toolCalls.slice(P+1);e.push({kind:"plan_mode",plan:l,planFilePath:p,status:N,toolCalls:b,timestamp:f}),e.push(...w),$.length>0&&e.push({kind:"tool_calls",toolCalls:$,timestamp:B.timestamp}),n=M+1;break}else b.push(...B.toolCalls),M++}else if(B.kind==="hook_event"||B.kind==="text"||B.kind==="queued_prompt"||B.kind==="agent_message")w.push(B),M++;else break}k||(e.push({kind:"plan_mode",plan:l,planFilePath:void 0,status:"pending",toolCalls:b,timestamp:f}),e.push(...w),n=M);continue}}}e.push(s),n++}return e}function Ye(t){return t.contentBlocks.some(e=>e.kind==="agent_message")?{...t,contentBlocks:t.contentBlocks.map(e=>{if(e.kind!=="agent_message")return e;const{reply:n,...s}=e;return s})}:t}function jt(t){var s;const e=t.map(Ye),n=new Map;for(const o of e)for(const i of o.contentBlocks){if(i.kind==="agent_message"){const l=n.get(i.sender);l?l.push(i):n.set(i.sender,[i]);continue}if(i.kind==="tool_calls")for(const l of i.toolCalls){if(l.name!=="SendMessage")continue;const f=l.input.to;if(typeof f!="string"||!f)continue;const y=(s=n.get(f))==null?void 0:s.shift();if(!y)continue;const b=l.input.summary;y.reply={summary:typeof b=="string"?b:"",timestamp:l.timestamp||i.timestamp||""}}}return e}function tn(t){const e=[];let n=!1;for(let s=0;s<t.length;s++){const o=t[s];if(Rt(o)||Ft(o)){n=!1;continue}if(mt(o)&&!o.isMeta){const i=o.message.content;if(n&&Array.isArray(i)&&i.some(f=>f.type==="tool_result"))continue;e.push(s),n=!0;continue}gt(o)&&!n&&(e.push(s),n=!0)}return e}function Lt(t){var U,A;const e=[],n=[];let s=null,o=0,i=null,l=null;function f(a){l&&(a.compactionSummary=l.summary,a.compactionMeta=l.meta,l=null)}let y=null;const b=new Map,T=new Set,h=new Map,k=new Map,p=new Set,N=new Map,M=[],w=new Map;function B(a,c){let g=w.get(a);g||(g=new Map,w.set(a,g)),g.set(c,(g.get(c)??0)+1)}function P(a,c){const g=w.get(a),d=g==null?void 0:g.get(c);return!g||!d?!1:(d===1?g.delete(c):g.set(c,d-1),!0)}function $(){for(const a of M)a.turn.contentBlocks.push(a.sender?{kind:"agent_message",sender:a.sender,body:a.body,timestamp:a.timestamp}:{kind:"queued_prompt",content:a.content,timestamp:a.timestamp});M.length=0}function O(a){if(!i)return;const c=h.get(a);if(!c||c.length===0)return;i.subAgentActivity.push(...c),h.delete(a);const g=p.has(a)?"background_agent":"sub_agent",d=k.get(a);if(d)d.messages.push(...c);else{const r={kind:g,messages:[...c]};i.contentBlocks.push(r),k.set(a,r)}}function j(){if(i){for(const a of i.toolCalls)O(a.id);for(const[a]of h)O(a);for(const a of i.contentBlocks)if(a.kind==="hook_event")for(const c of a.events){if(!(c.eventName==="PostToolUse"||c.eventName.startsWith("PostToolUse:"))||!c.toolUseId)continue;const d=i.toolCalls.find(r=>r.id===c.toolUseId);d&&(c.updatedToolOutput&&(d.outputReplacedByHook=!0),c.durationMs!==void 0&&(d.hookDurationMs=(d.hookDurationMs??0)+c.durationMs))}i.contentBlocks=Ze(i.contentBlocks),e.push(i),s!==null&&n.push(s),s=null,i=null,k.clear()}}for(o=0;o<t.length;o++){const a=t[o];if(Rt(a)){j(),l={summary:a.summary};continue}if(Ft(a)){j(),l={meta:Xe(a.compactMetadata)};continue}if(Ue(a)){j(),s=o,i=it(a,null),i.compactionSummary=He(a.message.content),i.compactionMeta=l==null?void 0:l.meta,l=null;continue}if(Bt(a)&&a.subtype==="away_summary"&&a.content){y={content:a.content,timestamp:a.timestamp};continue}if($e(a)){if(i&&a.operation==="enqueue"&&Ot(a.content)){const c=ht(a.content);M.push({turn:i,content:a.content,timestamp:a.timestamp,sender:c.sender,body:c.body}),B(i,a.content)}continue}if(Pt(a)){const c=ze(a);i&&c!==null&&!P(i,c.raw)&&M.push({turn:i,content:c.raw,timestamp:((U=a.attachment)==null?void 0:U.timestamp)??a.timestamp,sender:c.sender,body:c.body});continue}if(M.length>0){const c=mt(a)&&!a.isMeta?a.message.content:null;if(typeof c=="string"){const g=M.findIndex(d=>d.content===c);if(g>=0){const[d]=M.splice(g,1);P(d.turn,d.content)}}$()}if(mt(a)&&!a.isMeta){const c=a.message.content;if(typeof c!="string"&&Array.isArray(c)&&c.some(d=>d.type==="tool_result")&&i){for(const r of c)if(r.type==="tool_result"){const _=b.get(r.tool_use_id);_&&(_.turn.toolCalls[_.index].result=Dt(r.content),_.turn.toolCalls[_.index].isError=r.is_error===!0,b.delete(r.tool_use_id))}const d=a.toolUseResult;if(d!=null&&d.agentId){const r=((A=c.find(S=>S.type==="tool_result"))==null?void 0:A.tool_use_id)??"",_=N.get(r),u=p.has(r),C=[];if(Array.isArray(d.content))for(const S of d.content)S.type==="text"&&C.push(S.text);const m={agentId:d.agentId,parentToolUseId:r||void 0,agentName:(_==null?void 0:_.name)??null,subagentType:(_==null?void 0:_.subagentType)??null,type:"assistant",content:d.content,toolCalls:[],thinking:[],text:C,timestamp:a.timestamp??"",tokenUsage:d.usage?{input_tokens:d.usage.input_tokens??0,output_tokens:d.usage.output_tokens??0,cache_creation_input_tokens:d.usage.cache_creation_input_tokens??0,cache_read_input_tokens:d.usage.cache_read_input_tokens??0}:null,model:null,isBackground:u,prompt:d.prompt,status:d.status,durationMs:d.totalDurationMs,toolUseCount:d.totalToolUseCount};if(!k.get(r)){i.subAgentActivity.push(m);const E={kind:u?"background_agent":"sub_agent",messages:[m]};i.contentBlocks.push(E),k.set(r,E)}}continue}if(qe(a)){const g={kind:"task_notification",content:ot(c),timestamp:a.timestamp};if(i){i.contentBlocks.push(g);continue}s=o,i=it(a,null),i.contentBlocks.push(g),f(i);continue}j(),s=o,i=it(a,a.message.content),f(i),y&&(i.contentBlocks.push({kind:"recap",content:y.content,timestamp:y.timestamp}),y=null);continue}if(gt(a)){let c=function(){u.length>0&&(C.contentBlocks.push({kind:"tool_calls",toolCalls:[...u],timestamp:r}),u.length=0)},g=function(){if(_.length>0){const m=C.contentBlocks[C.contentBlocks.length-1];m&&m.kind==="thinking"?m.blocks.push(..._):C.contentBlocks.push({kind:"thinking",blocks:[..._],timestamp:r}),_.length=0}};i||(s=o,i=it(a,null),f(i)),i.model=a.message.model,a.effort&&(i.effort=a.effort),i.attribution=Ve(i.attribution,a);const d=a.message.id;T.has(d)||(T.add(d),i.tokenUsage=Ke(i.tokenUsage,a.message.usage));const r=a.timestamp??"",_=[],u=[],C=i;for(const m of a.message.content)if(m.type==="thinking"){c();const x=m;if(!x.thinking)continue;i.thinking.push(x),_.push(x)}else if(m.type==="text"){c(),g();const x=/<thinking>([\s\S]*?)<\/thinking>/g;let S=m.text,E;for(;(E=x.exec(m.text))!==null;){const v=E[1].trim();if(v){const R={type:"thinking",thinking:v,signature:""};i.thinking.push(R),i.contentBlocks.push({kind:"thinking",blocks:[R],timestamp:r})}S=S.replace(E[0],"")}if(S=S.trim(),S){i.assistantText.push(S);const v=i.contentBlocks[i.contentBlocks.length-1];v&&v.kind==="text"?v.text.push(S):i.contentBlocks.push({kind:"text",text:[S],timestamp:r})}}else if(m.type==="tool_use"){g();const x={id:m.id,name:m.name,input:m.input,result:null,isError:!1,timestamp:a.timestamp??""},S=i.toolCalls.length;if(i.toolCalls.push(x),u.push(x),b.set(m.id,{turn:i,index:S}),m.name==="Task"||m.name==="Agent"){const E=m.input;E.run_in_background===!0&&p.add(m.id),N.set(m.id,{name:E.name??null,subagentType:E.subagent_type??null})}}g(),c();continue}if(vt(a)&&a.data.type==="agent_progress"){const c=a.data,g=a.parentToolUseID??"";let d=null;if(c.message.type==="assistant"){const m=c.message.message,x=m.id,S=m.usage;S&&x&&!T.has(x)&&(T.add(x),d={input_tokens:S.input_tokens??0,output_tokens:S.output_tokens??0,cache_creation_input_tokens:S.cache_creation_input_tokens??0,cache_read_input_tokens:S.cache_read_input_tokens??0})}const r=c.message.type==="assistant"?c.message.message.model??null:null,_=N.get(g),u={agentId:c.agentId,parentToolUseId:g||void 0,agentName:(_==null?void 0:_.name)??null,subagentType:(_==null?void 0:_.subagentType)??null,type:c.message.type,content:c.message.message.content,toolCalls:[],thinking:[],text:[],timestamp:c.message.timestamp??a.timestamp??"",tokenUsage:d,model:r,isBackground:p.has(g)};if(c.message.type==="assistant"){const m=c.message.message.content;if(Array.isArray(m))for(const x of m)x.type==="thinking"?u.thinking.push(x.thinking):x.type==="text"?u.text.push(x.text):x.type==="tool_use"&&u.toolCalls.push({id:x.id,name:x.name,input:x.input,result:null,isError:!1,timestamp:c.message.timestamp??a.timestamp??""})}else if(c.message.type==="user"){const m=c.message.message.content;if(Array.isArray(m)){for(const x of m)if(x.type==="tool_result"){const S=h.get(g);if(S)for(const E of S){const v=E.toolCalls.find(R=>R.id===x.tool_use_id);v&&(v.result=Dt(x.content),v.isError=x.is_error===!0)}}}}let C=h.get(g);C||(C=[],h.set(g,C)),C.push(u),i&&O(g);continue}if(vt(a)&&a.data.type==="hook_progress"){const c=a.data,g=String(c.hook_event_name??c.hookEvent??"unknown"),d=c.hookSpecificOutput,r={eventName:g,source:c.source!==void 0?String(c.source):void 0,toolName:c.tool_name!==void 0?String(c.tool_name):void 0,toolUseId:c.tool_use_id!==void 0?String(c.tool_use_id):void 0,command:c.command!==void 0?String(c.command):void 0,output:c.output!==void 0?String(c.output):void 0,stderr:c.stderr!==void 0?String(c.stderr):void 0,exitCode:c.exit_code!==void 0?Number(c.exit_code):void 0,decision:c.decision!==void 0?String(c.decision):void 0,durationMs:c.duration_ms!==void 0?Number(c.duration_ms):void 0,updatedToolOutput:(d==null?void 0:d.updatedToolOutput)!==void 0?String(d.updatedToolOutput):void 0,sessionTitle:(d==null?void 0:d.sessionTitle)!==void 0?String(d.sessionTitle):void 0,worktreePath:(d==null?void 0:d.worktreePath)!==void 0?String(d.worktreePath):void 0,timestamp:a.timestamp??""};if(i){const _=i.contentBlocks[i.contentBlocks.length-1];_&&_.kind==="hook_event"?_.events.push(r):i.contentBlocks.push({kind:"hook_event",events:[r],timestamp:a.timestamp})}continue}if(Bt(a)&&a.subtype==="turn_duration"&&i){a.durationMs!==void 0&&a.durationMs!==null&&(i.durationMs=(i.durationMs??0)+a.durationMs);continue}}return $(),j(),{turns:jt(e),turnStartIndices:n}}function Wt(t){return Lt(t).turns}function qt(){return!0}function zt(t){const e=[];for(const n of t){const s=n.trim();if(s)try{e.push(JSON.parse(s))}catch{}}return e}function Jt(t){return zt(t.split(`
|
|
4
4
|
`))}function Vt(t){const e={sessionId:"",version:"",gitBranch:"",cwd:"",slug:"",name:"",model:"",branchedFrom:void 0};for(const n of t)if(n.sessionId&&!e.sessionId&&(e.sessionId=n.sessionId),n.version&&!e.version&&(e.version=n.version),n.gitBranch&&!e.gitBranch&&(e.gitBranch=n.gitBranch),n.cwd&&!e.cwd&&(e.cwd=n.cwd),n.slug&&!e.slug&&(e.slug=n.slug),n.name&&!e.name&&(e.name=n.name),n.branchedFrom&&!e.branchedFrom&&(e.branchedFrom=n.branchedFrom),gt(n)&&n.message.model&&!e.model&&(e.model=n.message.model),e.sessionId&&e.version&&e.gitBranch&&e.cwd&&e.model)break;return e}function en(t){return Vt(zt(t))}function nn(t,e){const n=Jt(t),s=Vt(n),o=Wt(n),i=e!=null&&e.skipStats?nt(o.length):st(o);return{...s,turns:o,stats:i,rawMessages:e!=null&&e.skipStats?[]:n,agentKind:"claude"}}function sn(t,e){const n=Jt(e);if(n.length===0)return t;const s=t.rawMessages,o=[...s,...n],i=tn(s),l=Math.max(0,t.turns.length-i.length);let f=Math.max(0,i.length-1);const y=new Set;for(const N of n)if(N.type==="progress"){const M=N.parentToolUseID;M&&y.add(M)}if(y.size>0)for(let N=f-1;N>=0;N--){const M=t.turns[l+N];if(M!=null&&M.toolCalls.some(w=>y.has(w.id))){f=N;break}}const b=i[f]??s.length,T=t.turns.slice(0,l+f),h=Wt(o.slice(b)),k=jt([...T,...h]),p=st(k);return{sessionId:t.sessionId,version:t.version,gitBranch:t.gitBranch,cwd:t.cwd,slug:t.slug,name:t.name,model:t.model||k.length>0&&k[k.length-1].model||"",turns:k,stats:p,rawMessages:o,branchedFrom:t.branchedFrom,agentKind:t.agentKind}}const Kt="<task-notification>",on=/<task-id>([^<]+)<\/task-id>/g,rn=/<tool-use-id>([^<]+)<\/tool-use-id>/g;function L(t){return typeof t=="object"&&t!==null}function an(t){const e=L(t.message)?t.message:null,n=e==null?void 0:e.content;return typeof n=="string"?[n]:Array.isArray(n)?n.filter(s=>L(s)&&typeof s.text=="string").map(s=>s.text):[]}function ln(t){const e=[],n=new Set,s=new Set,o=new Set;function i(l,f){if(l.includes(Kt)){for(const y of l.matchAll(on))n.add(y[1]),f==null||f.add(y[1]);for(const y of l.matchAll(rn))n.add(y[1]),f==null||f.add(y[1])}}for(const l of t){if(l.type==="user"){const f=L(l.toolUseResult)?l.toolUseResult:null;if((f==null?void 0:f.status)==="async_launched"){const y=L(l.message)?l.message:null,T=(Array.isArray(y==null?void 0:y.content)?y.content:[]).filter(p=>L(p)&&p.type==="tool_result").map(p=>p.tool_use_id),h=[f.agentId,f.taskId,...T].filter(p=>typeof p=="string"&&p.length>0),k=[f.description,f.workflowName,f.summary].find(p=>typeof p=="string"&&p.length>0)??"";h.length>0&&e.push({ids:h,description:k})}for(const y of an(l))i(y,o);continue}if(l.type==="assistant"){const f=L(l.message)?l.message:null,y=Array.isArray(f==null?void 0:f.content)?f.content:[];for(const b of y){if(!L(b)||b.type!=="tool_use"||b.name!=="TaskStop")continue;const T=L(b.input)?b.input:null,h=(T==null?void 0:T.task_id)??(T==null?void 0:T.shell_id);typeof h=="string"&&n.add(h)}continue}if(l.type==="attachment"){const f=L(l.attachment)?l.attachment:null;typeof(f==null?void 0:f.prompt)=="string"&&i(f.prompt,o);continue}if(l.type==="queue-operation"&&typeof l.content=="string"){const f=l.operation;i(l.content,f==="enqueue"?s:o)}}return{pendingDescriptions:e.filter(l=>!l.ids.some(f=>n.has(f))).map(l=>l.description),undeliveredNotifications:[...s].filter(l=>!o.has(l)).length}}function cn(t,e){return{status:"awaiting_agents",pendingQueue:e,pendingAgents:t.length,pendingAgentDescriptions:t.filter(n=>n.length>0)}}function un(t){var l,f;let e=0,n=null,s=!1;function o(y,b){const T={status:y,pendingQueue:Math.max(0,e)};return b&&(T.toolName=b),T}function i(){return n??(n=ln(t))}for(let y=t.length-1;y>=0;y--){const b=t[y];if(b.type!=="queue-operation"){if(b.type==="progress"){const T=b.data;if((T==null?void 0:T.type)==="hook_progress"&&(T.decision??((l=T.hookSpecificOutput)==null?void 0:l.permissionDecision))==="defer")return o("deferred");break}break}}for(let y=t.length-1;y>=0;y--){const b=t[y];if(b.type==="queue-operation"){if(typeof b.content=="string"&&b.content.includes(Kt))continue;const T=b.operation;T==="enqueue"?e++:(T==="dequeue"||T==="remove")&&e--;continue}if(b.type==="attachment"){const T=L(b.attachment)?b.attachment:null;(T==null?void 0:T.commandMode)==="task-notification"&&(s=!0);continue}if(b.type==="assistant"){const T=b.message,h=T==null?void 0:T.stop_reason;if(h==="end_turn"){const k=i();if(s||k.undeliveredNotifications>0)return o("processing");if(k.pendingDescriptions.length>0)return cn(k.pendingDescriptions,Math.max(0,e));let p=!1;for(let N=y-1;N>=0;N--){const M=t[N];if(M.type==="user"&&!M.isMeta){p=!0;break}}return o(p?"completed":"idle")}if(h==="tool_use"){const k=T==null?void 0:T.content,p=(f=k==null?void 0:k.findLast)==null?void 0:f.call(k,N=>N.type==="tool_use");return o("tool_use",p==null?void 0:p.name)}return o("thinking")}if(b.type==="user"){if(b.isMeta)continue;return o("processing")}if(b.type==="system"&&b.subtype==="terminal_reason"){const T=b.reason;if(T)return{status:"completed",terminalReason:T,pendingQueue:Math.max(0,e)};continue}b.type!=="summary"&&b.type==="system"&&b.subtype}return{status:"idle"}}function dn(t,e,n){const s=typeof t.sessionId=="string"?t.sessionId:"";return{record:{...t,sessionId:e,branchedFrom:{sessionId:s,turnIndex:n}},originalId:s}}function pn(t){return Lt(t).turnStartIndices}function Gt(t,e,n){if(!e)return;t.assistantText.push(e);const s=t.contentBlocks[t.contentBlocks.length-1];if((s==null?void 0:s.kind)==="text"){s.text.push(e);return}t.contentBlocks.push({kind:"text",text:[e],timestamp:n})}const Qt={0:"\0",b:"\b",f:"\f",n:`
|