cogpit 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/cli.js +4681 -4001
  2. package/dist/web/assets/{CommandPaletteHost-D-VvT_HL.js → CommandPaletteHost-DU1jhhYG.js} +1 -1
  3. package/dist/web/assets/{ConfigBrowser-Cc2lrh85.js → ConfigBrowser-CTZR8nw6.js} +1 -1
  4. package/dist/web/assets/{HighlightedEditor-DWNz1Jcz.js → HighlightedEditor-CNTtimUO.js} +1 -1
  5. package/dist/web/assets/{KeyboardShortcutsDialog-yOs1u5D6.js → KeyboardShortcutsDialog-DtTE4xjZ.js} +1 -1
  6. package/dist/web/assets/{MobileFileChanges-B1dtcdSZ.js → MobileFileChanges-DaJh6sQ7.js} +1 -1
  7. package/dist/web/assets/{PreviewPanel-BJwfunf9.js → PreviewPanel-BOL9gNaQ.js} +1 -1
  8. package/dist/web/assets/{ProjectFilesPanel-DppuIFEt.js → ProjectFilesPanel-CBFFT9qJ.js} +1 -1
  9. package/dist/web/assets/{ProjectSwitcherModal-DgsuH5CY.js → ProjectSwitcherModal-UUQMoktd.js} +1 -1
  10. package/dist/web/assets/{TerminalOutput-DlGDS0Wx.js → TerminalOutput-T82q4Tf9.js} +1 -1
  11. package/dist/web/assets/{ThemeSelectorModal-oI9Vm3EH.js → ThemeSelectorModal-rFVnzZuC.js} +1 -1
  12. package/dist/web/assets/{WorkflowsPanel-SKbsv_IK.js → WorkflowsPanel-COZwo8h-.js} +1 -1
  13. package/dist/web/assets/{WorktreePanel-CcSLupr7.js → WorktreePanel-DvZNvNhH.js} +1 -1
  14. package/dist/web/assets/{index-7FuVzOBC.js → index-BhjwMUil.js} +1 -1
  15. package/dist/web/assets/index-CghBqEmp.js +153 -0
  16. package/dist/web/assets/{index-BVkjlOVU.js → index-CpHg1sRc.js} +1 -1
  17. package/dist/web/assets/{index-Bw-DFQut.js → index-XlQRZ_Un.js} +1 -1
  18. package/dist/web/assets/index-f2DFkgKZ.css +1 -0
  19. package/dist/web/assets/{session-parser.worker-RMitC4X_.js → session-parser.worker-QY58jiXs.js} +1 -1
  20. package/dist/web/assets/vendor-ui-B9m2oOMV.js +867 -0
  21. package/dist/web/index.html +3 -3
  22. package/package.json +1 -1
  23. package/dist/web/assets/index-Du17HzQD.js +0 -151
  24. package/dist/web/assets/index-xdv0cIL2.css +0 -1
  25. package/dist/web/assets/vendor-ui-CdA11Wfh.js +0 -817
@@ -1 +1 @@
1
- import{r as h,j as e}from"./vendor-react-gGw_S5I_.js";import{ak as K,B as d,_ as A,l as Q,E as V,y as Y,z as Z,G as _,H as ee,a2 as se,al as ne,am as te,an as ae,ao as re,a9 as R,aa as z,ab as E,ap as ie,ac as S,ad as U,ae as F,af as T,ag as $,w as u,aq as c}from"./index-Du17HzQD.js";import{G as P,m as le,b as oe,X as ce,c as de,n as me,o as O,C as he,l as xe}from"./vendor-ui-CdA11Wfh.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const ue={M:"text-warning",A:"text-success",D:"text-destructive",R:"text-info"};function ve({worktrees:v,loading:p,dirName:r,onRefetch:g,onOpenSession:I,onClose:M}){const o=K("hostFiles"),[B,y]=h.useState(null),[G,b]=h.useState(null),[H,x]=h.useState(!1),[n,m]=h.useState(null),[a,j]=h.useState(null),C=async s=>{if(!(!o||!r)){y(s.name);try{await u(`/api/worktrees/${encodeURIComponent(r)}/${encodeURIComponent(s.name)}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:s.isDirty})}),g()}catch(t){c.error(`Failed to delete worktree: ${t instanceof Error?t.message:"Unknown error"}`)}finally{y(null)}}},J=s=>{if(!(!o||!r)){if(s.isDirty){m({worktree:s,reason:"dirty"});return}if(s.commitsAhead>0){m({worktree:s,reason:"unpushed"});return}C(s)}},W=()=>{if(!n)return;const{worktree:s,reason:t}=n;if(t==="dirty"&&s.commitsAhead>0){m({worktree:s,reason:"unpushed"});return}m(null),C(s)},L=async s=>{if(!(!o||!r)){b(s.name);try{const t=await u(`/api/worktrees/${encodeURIComponent(r)}/create-pr`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeName:s.name,title:s.name.replace(/-/g," ")})});if(t.ok){const l=await t.json();l.url?window.open(l.url,"_blank","noopener,noreferrer"):c.warning("PR created but no URL was returned")}else{const l=await t.json().catch(()=>({error:"Unknown error"}));c.error(`Failed to create PR: ${l.error||"Unknown error"}`)}}catch(t){c.error(`Error creating PR: ${t instanceof Error?t.message:"Unknown error"}`)}finally{b(null)}}},q=async()=>{if(!(!o||!r)){x(!0);try{const s=await u(`/api/worktrees/${encodeURIComponent(r)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(s.ok){const{stale:t}=await s.json();t.length===0?c.info("No stale worktrees found"):j(t.map(l=>l.name))}}catch(s){c.error(`Cleanup failed: ${s instanceof Error?s.message:"Unknown error"}`)}finally{x(!1)}}},X=async()=>{if(!o||!r||!a)return;const s=a;j(null),x(!0);try{await u(`/api/worktrees/${encodeURIComponent(r)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0,names:s})}),g()}catch(t){c.error(`Cleanup failed: ${t instanceof Error?t.message:"Unknown error"}`)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{"aria-label":"Worktrees",className:"flex size-full min-h-0 flex-col bg-background",children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[e.jsx(P,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Worktrees"}),e.jsx("div",{className:"flex-1"}),o&&e.jsx(d,{variant:"ghost",size:"icon-sm",onClick:q,disabled:H,"aria-label":"Cleanup stale worktrees",children:e.jsx(le,{"data-icon":"inline-start"})}),e.jsx(d,{variant:"ghost",size:"icon-sm",onClick:g,disabled:p,"aria-label":"Refresh worktrees",children:e.jsx(oe,{"data-icon":"inline-start",className:A(p&&"animate-spin")})}),e.jsx(d,{variant:"ghost",size:"icon-sm",onClick:M,"aria-label":"Close worktrees",children:e.jsx(ce,{"data-icon":"inline-start"})})]}),e.jsx(Q,{}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[!r&&e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select a project to view worktrees"}),r&&v.length===0&&!p&&e.jsx(V,{className:"border-0 py-16",children:e.jsxs(Y,{children:[e.jsx(Z,{variant:"icon",children:e.jsx(P,{})}),e.jsx(_,{children:"No worktrees"}),e.jsx(ee,{children:"Create a new session with “Isolate in worktree” enabled"})]})}),v.map(s=>{var N,w,D;const t=((N=s.changedFiles)==null?void 0:N.reduce((i,k)=>i+k.additions,0))??0,l=((w=s.changedFiles)==null?void 0:w.reduce((i,k)=>i+k.deletions,0))??0,f=((D=s.changedFiles)==null?void 0:D.length)??0;return e.jsxs("div",{className:"rounded-lg border bg-card p-3 transition-colors hover:bg-accent/40",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.name}),s.isDirty&&e.jsx("span",{className:"flex size-2 shrink-0 rounded-full bg-warning",title:"Uncommitted changes"}),s.commitsAhead>0&&e.jsxs(se,{variant:"outline",className:"h-5 shrink-0 px-1.5 text-xs",children:[s.commitsAhead," ahead"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[s.linkedSessions.length>0&&e.jsx(d,{variant:"ghost",size:"icon-xs",onClick:()=>I(s.linkedSessions[0]),"aria-label":"Open session",children:e.jsx(de,{"data-icon":"inline-start"})}),o&&e.jsxs(e.Fragment,{children:[e.jsx(d,{variant:"ghost",size:"icon-xs",onClick:()=>L(s),disabled:G===s.name||s.commitsAhead===0,"aria-label":"Create PR",children:e.jsx(me,{"data-icon":"inline-start"})}),e.jsx(d,{variant:"ghost",size:"icon-xs",onClick:()=>J(s),disabled:B===s.name,className:"text-destructive hover:bg-destructive/10 hover:text-destructive","aria-label":"Delete worktree",children:e.jsx(O,{"data-icon":"inline-start"})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"shrink-0 font-mono",children:s.head}),e.jsx("span",{className:"truncate",children:s.headMessage})]}),s.createdAt&&e.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:ne(s.createdAt)}),f>0&&e.jsxs(te,{className:"mt-2",children:[e.jsxs(ae,{className:"group flex w-full items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(he,{"data-icon":"inline-start",className:"size-3 transition-transform group-data-panel-open:rotate-90 motion-reduce:transition-none"}),e.jsx(xe,{"data-icon":"inline-start",className:"size-3"}),e.jsxs("span",{children:[f," file",f!==1?"s":""," changed"]}),e.jsxs("span",{className:"ml-1",children:[e.jsxs("span",{className:"text-success",children:["+",t]})," ",e.jsxs("span",{className:"text-destructive",children:["-",l]})]})]}),e.jsx(re,{children:e.jsx("div",{className:"mt-1.5 flex flex-col gap-px rounded-md bg-muted/40 p-1.5",children:s.changedFiles.map(i=>e.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5 font-mono text-xs",children:[e.jsx("span",{className:A("shrink-0 w-3 text-center",ue[i.status]??"text-muted-foreground"),children:i.status}),e.jsx("span",{className:"truncate text-foreground/80",children:i.path}),e.jsxs("span",{className:"ml-auto shrink-0 text-muted-foreground",children:[e.jsxs("span",{className:"text-success",children:["+",i.additions]})," ",e.jsxs("span",{className:"text-destructive",children:["-",i.deletions]})]})]},i.path))})})]})]},s.name)})]})]}),e.jsx(R,{open:n!==null,onOpenChange:s=>{s||m(null)},children:e.jsxs(z,{size:"sm",children:[e.jsxs(E,{children:[e.jsx(ie,{className:"bg-destructive/10 text-destructive",children:e.jsx(O,{})}),e.jsx(S,{children:(n==null?void 0:n.reason)==="dirty"?"Delete worktree with uncommitted changes?":"Delete worktree with unpushed commits?"}),e.jsxs(U,{children:[(n==null?void 0:n.reason)==="dirty"?`"${n.worktree.name}" has uncommitted changes.`:`"${n==null?void 0:n.worktree.name}" has ${n==null?void 0:n.worktree.commitsAhead} unpushed commit(s).`," "," ","Deleting it cannot be undone."]})]}),e.jsxs(F,{children:[e.jsx(T,{size:"sm",children:"Cancel"}),e.jsx($,{variant:"destructive",size:"sm",onClick:W,children:(n==null?void 0:n.reason)==="dirty"&&n.worktree.commitsAhead>0?"Continue":"Delete worktree"})]})]})}),e.jsx(R,{open:a!==null,onOpenChange:s=>{s||j(null)},children:e.jsxs(z,{children:[e.jsxs(E,{children:[e.jsx(S,{children:"Remove stale worktrees?"}),e.jsxs(U,{children:[a==null?void 0:a.length," stale worktree",(a==null?void 0:a.length)===1?"":"s"," will be removed: ",a==null?void 0:a.join(", "),"."]})]}),e.jsxs(F,{children:[e.jsx(T,{size:"sm",children:"Cancel"}),e.jsx($,{variant:"destructive",size:"sm",onClick:()=>void X(),children:"Remove worktrees"})]})]})})]})}export{ve as WorktreePanel};
1
+ import{r as h,j as e}from"./vendor-react-gGw_S5I_.js";import{ak as K,B as d,_ as A,l as Q,E as V,y as Y,z as Z,G as _,H as ee,a2 as se,al as ne,am as te,an as ae,ao as re,a9 as R,aa as z,ab as E,ap as ie,ac as S,ad as U,ae as F,af as T,ag as $,w as u,aq as c}from"./index-CghBqEmp.js";import{G as P,m as le,b as oe,X as ce,c as de,n as me,o as O,C as he,l as xe}from"./vendor-ui-B9m2oOMV.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const ue={M:"text-warning",A:"text-success",D:"text-destructive",R:"text-info"};function ve({worktrees:v,loading:p,dirName:r,onRefetch:g,onOpenSession:I,onClose:M}){const o=K("hostFiles"),[B,y]=h.useState(null),[G,b]=h.useState(null),[H,x]=h.useState(!1),[n,m]=h.useState(null),[a,j]=h.useState(null),C=async s=>{if(!(!o||!r)){y(s.name);try{await u(`/api/worktrees/${encodeURIComponent(r)}/${encodeURIComponent(s.name)}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:s.isDirty})}),g()}catch(t){c.error(`Failed to delete worktree: ${t instanceof Error?t.message:"Unknown error"}`)}finally{y(null)}}},J=s=>{if(!(!o||!r)){if(s.isDirty){m({worktree:s,reason:"dirty"});return}if(s.commitsAhead>0){m({worktree:s,reason:"unpushed"});return}C(s)}},W=()=>{if(!n)return;const{worktree:s,reason:t}=n;if(t==="dirty"&&s.commitsAhead>0){m({worktree:s,reason:"unpushed"});return}m(null),C(s)},L=async s=>{if(!(!o||!r)){b(s.name);try{const t=await u(`/api/worktrees/${encodeURIComponent(r)}/create-pr`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeName:s.name,title:s.name.replace(/-/g," ")})});if(t.ok){const l=await t.json();l.url?window.open(l.url,"_blank","noopener,noreferrer"):c.warning("PR created but no URL was returned")}else{const l=await t.json().catch(()=>({error:"Unknown error"}));c.error(`Failed to create PR: ${l.error||"Unknown error"}`)}}catch(t){c.error(`Error creating PR: ${t instanceof Error?t.message:"Unknown error"}`)}finally{b(null)}}},q=async()=>{if(!(!o||!r)){x(!0);try{const s=await u(`/api/worktrees/${encodeURIComponent(r)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(s.ok){const{stale:t}=await s.json();t.length===0?c.info("No stale worktrees found"):j(t.map(l=>l.name))}}catch(s){c.error(`Cleanup failed: ${s instanceof Error?s.message:"Unknown error"}`)}finally{x(!1)}}},X=async()=>{if(!o||!r||!a)return;const s=a;j(null),x(!0);try{await u(`/api/worktrees/${encodeURIComponent(r)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0,names:s})}),g()}catch(t){c.error(`Cleanup failed: ${t instanceof Error?t.message:"Unknown error"}`)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{"aria-label":"Worktrees",className:"flex size-full min-h-0 flex-col bg-background",children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[e.jsx(P,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Worktrees"}),e.jsx("div",{className:"flex-1"}),o&&e.jsx(d,{variant:"ghost",size:"icon-sm",onClick:q,disabled:H,"aria-label":"Cleanup stale worktrees",children:e.jsx(le,{"data-icon":"inline-start"})}),e.jsx(d,{variant:"ghost",size:"icon-sm",onClick:g,disabled:p,"aria-label":"Refresh worktrees",children:e.jsx(oe,{"data-icon":"inline-start",className:A(p&&"animate-spin")})}),e.jsx(d,{variant:"ghost",size:"icon-sm",onClick:M,"aria-label":"Close worktrees",children:e.jsx(ce,{"data-icon":"inline-start"})})]}),e.jsx(Q,{}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[!r&&e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select a project to view worktrees"}),r&&v.length===0&&!p&&e.jsx(V,{className:"border-0 py-16",children:e.jsxs(Y,{children:[e.jsx(Z,{variant:"icon",children:e.jsx(P,{})}),e.jsx(_,{children:"No worktrees"}),e.jsx(ee,{children:"Create a new session with “Isolate in worktree” enabled"})]})}),v.map(s=>{var N,w,D;const t=((N=s.changedFiles)==null?void 0:N.reduce((i,k)=>i+k.additions,0))??0,l=((w=s.changedFiles)==null?void 0:w.reduce((i,k)=>i+k.deletions,0))??0,f=((D=s.changedFiles)==null?void 0:D.length)??0;return e.jsxs("div",{className:"rounded-lg border bg-card p-3 transition-colors hover:bg-accent/40",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.name}),s.isDirty&&e.jsx("span",{className:"flex size-2 shrink-0 rounded-full bg-warning",title:"Uncommitted changes"}),s.commitsAhead>0&&e.jsxs(se,{variant:"outline",className:"h-5 shrink-0 px-1.5 text-xs",children:[s.commitsAhead," ahead"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[s.linkedSessions.length>0&&e.jsx(d,{variant:"ghost",size:"icon-xs",onClick:()=>I(s.linkedSessions[0]),"aria-label":"Open session",children:e.jsx(de,{"data-icon":"inline-start"})}),o&&e.jsxs(e.Fragment,{children:[e.jsx(d,{variant:"ghost",size:"icon-xs",onClick:()=>L(s),disabled:G===s.name||s.commitsAhead===0,"aria-label":"Create PR",children:e.jsx(me,{"data-icon":"inline-start"})}),e.jsx(d,{variant:"ghost",size:"icon-xs",onClick:()=>J(s),disabled:B===s.name,className:"text-destructive hover:bg-destructive/10 hover:text-destructive","aria-label":"Delete worktree",children:e.jsx(O,{"data-icon":"inline-start"})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"shrink-0 font-mono",children:s.head}),e.jsx("span",{className:"truncate",children:s.headMessage})]}),s.createdAt&&e.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:ne(s.createdAt)}),f>0&&e.jsxs(te,{className:"mt-2",children:[e.jsxs(ae,{className:"group flex w-full items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(he,{"data-icon":"inline-start",className:"size-3 transition-transform group-data-panel-open:rotate-90 motion-reduce:transition-none"}),e.jsx(xe,{"data-icon":"inline-start",className:"size-3"}),e.jsxs("span",{children:[f," file",f!==1?"s":""," changed"]}),e.jsxs("span",{className:"ml-1",children:[e.jsxs("span",{className:"text-success",children:["+",t]})," ",e.jsxs("span",{className:"text-destructive",children:["-",l]})]})]}),e.jsx(re,{children:e.jsx("div",{className:"mt-1.5 flex flex-col gap-px rounded-md bg-muted/40 p-1.5",children:s.changedFiles.map(i=>e.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5 font-mono text-xs",children:[e.jsx("span",{className:A("shrink-0 w-3 text-center",ue[i.status]??"text-muted-foreground"),children:i.status}),e.jsx("span",{className:"truncate text-foreground/80",children:i.path}),e.jsxs("span",{className:"ml-auto shrink-0 text-muted-foreground",children:[e.jsxs("span",{className:"text-success",children:["+",i.additions]})," ",e.jsxs("span",{className:"text-destructive",children:["-",i.deletions]})]})]},i.path))})})]})]},s.name)})]})]}),e.jsx(R,{open:n!==null,onOpenChange:s=>{s||m(null)},children:e.jsxs(z,{size:"sm",children:[e.jsxs(E,{children:[e.jsx(ie,{className:"bg-destructive/10 text-destructive",children:e.jsx(O,{})}),e.jsx(S,{children:(n==null?void 0:n.reason)==="dirty"?"Delete worktree with uncommitted changes?":"Delete worktree with unpushed commits?"}),e.jsxs(U,{children:[(n==null?void 0:n.reason)==="dirty"?`"${n.worktree.name}" has uncommitted changes.`:`"${n==null?void 0:n.worktree.name}" has ${n==null?void 0:n.worktree.commitsAhead} unpushed commit(s).`," "," ","Deleting it cannot be undone."]})]}),e.jsxs(F,{children:[e.jsx(T,{size:"sm",children:"Cancel"}),e.jsx($,{variant:"destructive",size:"sm",onClick:W,children:(n==null?void 0:n.reason)==="dirty"&&n.worktree.commitsAhead>0?"Continue":"Delete worktree"})]})]})}),e.jsx(R,{open:a!==null,onOpenChange:s=>{s||j(null)},children:e.jsxs(z,{children:[e.jsxs(E,{children:[e.jsx(S,{children:"Remove stale worktrees?"}),e.jsxs(U,{children:[a==null?void 0:a.length," stale worktree",(a==null?void 0:a.length)===1?"":"s"," will be removed: ",a==null?void 0:a.join(", "),"."]})]}),e.jsxs(F,{children:[e.jsx(T,{size:"sm",children:"Cancel"}),e.jsx($,{variant:"destructive",size:"sm",onClick:()=>void X(),children:"Remove worktrees"})]})]})})]})}export{ve as WorktreePanel};
@@ -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-Du17HzQD.js";import{R as me,Q as Ee,U as De,C as ze}from"./vendor-ui-CdA11Wfh.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(`
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-CghBqEmp.js";import{R as me,Q as Ee,U as De,C as ze}from"./vendor-ui-B9m2oOMV.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(`