@hearsay-tools/squawk 0.19.0-dev.8963 → 0.19.0-dev.8965

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 (88) hide show
  1. package/dist/contract/index.js +4 -1
  2. package/dist/contract/repo.d.ts +2 -0
  3. package/dist/server/git-changes.d.ts +5 -0
  4. package/dist/server/git-changes.js +17 -1
  5. package/dist/server/git-changes.js.map +1 -1
  6. package/dist/server/providers-routes.d.ts +57 -57
  7. package/dist/server/repo-routes.d.ts +34 -34
  8. package/dist/server/runner-install-routes.d.ts +10 -10
  9. package/dist/server/runs-routes.d.ts +307 -306
  10. package/dist/server/server.d.ts +2 -0
  11. package/dist/server/workspace-routes.d.ts +85 -85
  12. package/package.json +4 -4
  13. package/web/dist/assets/{accounts-section-B_pqrkm3.js → accounts-section-Db5lzinF.js} +1 -1
  14. package/web/dist/assets/{activity-motion-QlltcKiQ.js → activity-motion-DP9A-iJP.js} +1 -1
  15. package/web/dist/assets/{activity-route-Do-PSgpm.js → activity-route-CSVZG1Yk.js} +1 -1
  16. package/web/dist/assets/{agent-config-section-BWBP7bir.js → agent-config-section-BWpBfi7r.js} +1 -1
  17. package/web/dist/assets/{agent-defaults-section-BjM9dSGv.js → agent-defaults-section-B7oMQzUO.js} +1 -1
  18. package/web/dist/assets/{appearance-Y7SFgASk.js → appearance-DYSwuTmE.js} +1 -1
  19. package/web/dist/assets/{archive-on-merge-field-C5oo__jZ.js → archive-on-merge-field-Cuw5IABu.js} +1 -1
  20. package/web/dist/assets/attention-C9zoC-gL.js +1 -0
  21. package/web/dist/assets/{automations-route-CCD630VY.js → automations-route-BgdxYmqh.js} +1 -1
  22. package/web/dist/assets/{commit-list-DMTOciIo.js → commit-list-D-eUAETe.js} +1 -1
  23. package/web/dist/assets/{diff-1Cn1zY0x.js → diff-BFrqQZmo.js} +2 -2
  24. package/web/dist/assets/{diff-controls-BXaMnA8A.js → diff-controls-x4n0YQLg.js} +1 -1
  25. package/web/dist/assets/{diff-view-yJW8dQIm.js → diff-view-BUofv-IL.js} +1 -1
  26. package/web/dist/assets/{discard-changes-dialog-Dr4S8U83.js → discard-changes-dialog-CO98KAfo.js} +1 -1
  27. package/web/dist/assets/{file-preview-Cg4XNolK.js → file-preview-lIaIJUZK.js} +1 -1
  28. package/web/dist/assets/{folder-browser-BSGB9hhQ.js → folder-browser-DiQGbqCN.js} +1 -1
  29. package/web/dist/assets/git-toolbar-BlwZtWla.js +1 -0
  30. package/web/dist/assets/{github-nRn7MvQh.js → github-Dc3nfijN.js} +1 -1
  31. package/web/dist/assets/{global-activity-route-DoeccLt8.js → global-activity-route-9kNmmkcm.js} +1 -1
  32. package/web/dist/assets/{index-zhwJL4R4.js → index-CwaCfhQn.js} +5 -5
  33. package/web/dist/assets/index-j7fiJmmF.css +1 -0
  34. package/web/dist/assets/{label-CV8tuTOO.js → label-B1zf-eXb.js} +1 -1
  35. package/web/dist/assets/{markdown-C1Qn_3d6.js → markdown-CdlTRkrR.js} +1 -1
  36. package/web/dist/assets/middle-truncated-name-TQxp8NxE.js +1 -0
  37. package/web/dist/assets/{open-in-menu-BTa2aBQh.js → open-in-menu-DfTnT8YF.js} +1 -1
  38. package/web/dist/assets/{option-select-Dw55m71E.js → option-select-CpZhQQ4x.js} +1 -1
  39. package/web/dist/assets/{preferences-section-D68R2rrK.js → preferences-section-BNZaZoHj.js} +1 -1
  40. package/web/dist/assets/{preview-pane-connected-BAwDR9I-.js → preview-pane-connected-DtjCqQCW.js} +1 -1
  41. package/web/dist/assets/{project-location-CxcuM0pc.js → project-location-BkThFjg5.js} +1 -1
  42. package/web/dist/assets/{project-router-BHFXTx5l.js → project-router-onKnSy5a.js} +1 -1
  43. package/web/dist/assets/{projects-section-B6ZCAwGT.js → projects-section-BdK2iGn2.js} +1 -1
  44. package/web/dist/assets/{prompt-templates-section-FluPBVqd.js → prompt-templates-section-K8tGcjHO.js} +1 -1
  45. package/web/dist/assets/{queries-CIeJg62Y.js → queries-CII6fTHH.js} +1 -1
  46. package/web/dist/assets/{reference-chip-Br0H2srF.js → reference-chip-Cv3i1kxz.js} +1 -1
  47. package/web/dist/assets/{remote-settings-notice-C3EUZXnf.js → remote-settings-notice-BjVD9Tpd.js} +1 -1
  48. package/web/dist/assets/repo-git-83M_eSW4.js +1 -0
  49. package/web/dist/assets/{report-reader-CyXGxICd.js → report-reader-C9faqNxp.js} +1 -1
  50. package/web/dist/assets/{report-selection-dYsm1HEf.js → report-selection-CmEfaDz7.js} +1 -1
  51. package/web/dist/assets/{reports-CX7m1Fqi.js → reports-_MEq44e-.js} +1 -1
  52. package/web/dist/assets/{resources-section-DH5SlAAn.js → resources-section-B9AnYDT1.js} +1 -1
  53. package/web/dist/assets/{review-panel-ChJ_958J.js → review-panel-QkkXnNl6.js} +1 -1
  54. package/web/dist/assets/{run-detail-refresh-DTnwaDy2.js → run-detail-refresh-Caj4BPPd.js} +1 -1
  55. package/web/dist/assets/{run-header-BO93V6-R.js → run-header-C6-a8K7X.js} +1 -1
  56. package/web/dist/assets/{select-Ba45N9DZ.js → select-BG2mryTI.js} +1 -1
  57. package/web/dist/assets/{session-context-section-CB-74w_P.js → session-context-section-DoPTAAaF.js} +1 -1
  58. package/web/dist/assets/{settings-agent-picker-BASzliR9.js → settings-agent-picker-PVoldhz2.js} +1 -1
  59. package/web/dist/assets/{settings-save-bar-CJjHCAfn.js → settings-save-bar-DrJyUlGR.js} +1 -1
  60. package/web/dist/assets/{settings-shell-2HdeaM8U.js → settings-shell-C-eZ0DiM.js} +1 -1
  61. package/web/dist/assets/{sidebar-section-DFXB7Npa.js → sidebar-section-iVSpyRZ0.js} +1 -1
  62. package/web/dist/assets/{skills-DIp00-EP.js → skills-Cvskb0Fk.js} +1 -1
  63. package/web/dist/assets/{tab-link-BYYXdpLn.js → tab-link-B2k-zaeP.js} +1 -1
  64. package/web/dist/assets/task-changes-gGRvQ3NB.js +1 -0
  65. package/web/dist/assets/{task-commits-C2Kjrelj.js → task-commits-DGPH3gFX.js} +1 -1
  66. package/web/dist/assets/{task-file-scope-D4oeMbrZ.js → task-file-scope-Z2smLv09.js} +1 -1
  67. package/web/dist/assets/task-files-905jN7TA.js +1 -0
  68. package/web/dist/assets/{task-github-item-DhbqkjTN.js → task-github-item-xrfEri2x.js} +1 -1
  69. package/web/dist/assets/{task-groups-C9pTQm-2.js → task-groups-dEzH1nMg.js} +1 -1
  70. package/web/dist/assets/{task-thread-CjooERx8.js → task-thread-Dsm-48-n.js} +1 -1
  71. package/web/dist/assets/{tasks-table-CvZ2ZyCa.js → tasks-table-CPAY1N-E.js} +1 -1
  72. package/web/dist/assets/{thread-state-mMAXhvWI.js → thread-state-CrCMnkHo.js} +1 -1
  73. package/web/dist/assets/{toaster-D0HMoto5.js → toaster-Bs1mVYf9.js} +1 -1
  74. package/web/dist/assets/{use-hand-to-agent-state-D9kvXuJa.js → use-hand-to-agent-state-D2mTcKQq.js} +1 -1
  75. package/web/dist/assets/use-path-bases-DIMmnJTH.js +1 -0
  76. package/web/dist/assets/use-workspace-config-save-0Mtdwfrd.js +1 -0
  77. package/web/dist/assets/{workflows-CNpKm-Jx.js → workflows-BM4nrPVB.js} +1 -1
  78. package/web/dist/assets/{workspace-tools-B0zJqYga.js → workspace-tools-DHMaUd94.js} +1 -1
  79. package/web/dist/assets/{worktrees-section-DABGAiMK.js → worktrees-section-VBLWYgdm.js} +1 -1
  80. package/web/dist/index.html +14 -14
  81. package/web/dist/assets/attention-V1gJ7gKo.js +0 -1
  82. package/web/dist/assets/git-toolbar-C3mKb8Eo.js +0 -1
  83. package/web/dist/assets/index-DImZdID6.css +0 -1
  84. package/web/dist/assets/repo-git-BAzppU31.js +0 -1
  85. package/web/dist/assets/task-changes-Co5wTdgn.js +0 -1
  86. package/web/dist/assets/task-files-D6wwxYsU.js +0 -1
  87. package/web/dist/assets/use-path-bases-DI9Wp2bB.js +0 -1
  88. package/web/dist/assets/use-workspace-config-save-bZksgjRK.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,p as i,s as a}from"./dist-C_rn70hE.js";import{C as o,E as s,T as c,W as l,Wt as u,dn as d,j as f,n as p,qt as m,rt as h,w as g,xt as _,yt as v}from"./queries-CIeJg62Y.js";import{Fn as y,It as b,L as x,R as S,ct as C,f as w,hi as T,l as E,n as D}from"./toaster-D0HMoto5.js";import{Z as O}from"./live-protocol-DMhTnCmf.js";import{g as k,h as A}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as j}from"./tasks-table-CvZ2ZyCa.js";import{D as ee,I as M,M as te,N as ne,Q as re,S as ie,X as ae,Z as oe,c as se,ct as ce,d as le,j as ue,l as de,n as fe,st as pe,w as me,y as he}from"./design-icons-QbNMZniQ.js";import{t as ge}from"./createLucideIcon-BHp8sXmF.js";import{n as _e,t as ve}from"./circle-x-7nTlobAF.js";import{_ as ye}from"./nav-row-styles-CgP5uNp4.js";import{i as be,r as xe,t as Se}from"./git-toolbar-C3mKb8Eo.js";import{t as N}from"./info-DA1x_4bz.js";import{t as Ce}from"./loader-circle-CPBhhDbB.js";import{i as we,n as Te,r as Ee}from"./diff-controls-BXaMnA8A.js";import{c as De,i as Oe,t as ke}from"./reference-chip-Br0H2srF.js";import{t as P}from"./button-C8jUIs8Q.js";import{i as F,l as Ae,p as je,r as Me,t as Ne}from"./dropdown-menu-DjtKUK8F.js";import{t as I}from"./project-router-BHFXTx5l.js";import{t as Pe}from"./status-dot-BXf-Ubd0.js";import{a as Fe,o as Ie}from"./format-BU7D3IfE.js";import{c as Le,d as Re,f as ze,m as L,n as Be,s as R,t as Ve}from"./page-shell-Dky5crRl.js";import{t as z}from"./centered-state-BgSV4e79.js";import{$t as B,Bt as V,E as H,Ft as He,Gt as Ue,Ht as We,In as Ge,It as Ke,Jt as U,Kt as W,Ln as qe,Lt as Je,Mn as Ye,Mt as Xe,Nt as Ze,Pt as Qe,Qt as G,Rn as $e,Rt as et,T as tt,Ut as nt,Vt as rt,Wt as it,Xt as K,Yt as q,Zt as J,_r as at,gn as ot,qt as Y,rr as st,ur as ct,yr as lt,zt as ut}from"./index-zhwJL4R4.js";import{t as dt}from"./markdown-BBDDg-4t.js";import{t as ft}from"./diff-1Cn1zY0x.js";import{t as pt}from"./change-counts-wqSYI3W8.js";import{n as mt,r as ht}from"./commit-list-DMTOciIo.js";var X=e(t(),1);function gt(e,t){let n=T(t),r=n.getQueryCache();return X.useSyncExternalStore(X.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var _t=ge(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),vt=ge(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),Z=n();function yt(){let e=i(),t=o(),n=T(),a=gt({queryKey:u.repo})>0,s=t.data?.info?t.data:null,c=Xe(e,s,`screen`);return(0,Z.jsx)(Re,{route:`repo-git`,density:s?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,Z.jsx)(Le,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:a,onClick:()=>{n.invalidateQueries({queryKey:u.repo}),n.invalidateQueries({queryKey:u.worktrees})},children:(0,Z.jsx)(oe,{size:17,"aria-hidden":`true`,className:r(`size-[17px]`,a&&`motion-safe:animate-spin`)})})},children:(0,Z.jsxs)(`div`,{"data-slot":`git-screen`,children:[s?.info?(0,Z.jsx)(`div`,{className:`mb-[16px]`,children:(0,Z.jsx)(He,{scope:e,repo:s,info:s.info,variant:`screen`},e)}):t.isPending?(0,Z.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,Z.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,Z.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,Z.jsx)(Ze,{branch:s?.info?.branch??null,counts:c,variant:`screen`})]})})}function bt({entry:e}){return e.keptReason?(0,Z.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function xt(e){if(e===``)return null;if(e===`@`)return`A branch cannot be named “@”.`;if(e.startsWith(`-`))return`A branch name cannot start with “-”.`;if(/\s/.test(e))return`A branch name cannot contain spaces.`;if(/[\u0000-\u001f\u007f]/.test(e))return`A branch name cannot contain control characters.`;let t=/[~^:?*[\\]/.exec(e);if(t)return`A branch name cannot contain “${t[0]}”.`;if(e.includes(`..`))return`A branch name cannot contain “..”.`;if(e.includes(`@{`))return`A branch name cannot contain “@{”.`;if(e.startsWith(`/`)||e.endsWith(`/`))return`A branch name cannot start or end with “/”.`;if(e.includes(`//`))return`A branch name cannot contain “//”.`;if(e.endsWith(`.`))return`A branch name cannot end with “.”.`;for(let t of e.split(`/`)){if(t.startsWith(`.`))return`A part of a branch name cannot start with “.”.`;if(t.endsWith(`.lock`))return`A part of a branch name cannot end with “.lock”.`}return null}function St({repo:e,info:t}){let n=i(),a=[n,`repo`],o=[n,`health`],s=v(),c=g(),l=new Map((c.data?.branches??[]).map(e=>[e.name,e])),u=T(),f=d({mutationFn:e=>E({name:e},n),onSuccess:async e=>{D(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([u.invalidateQueries({queryKey:a}),u.invalidateQueries({queryKey:o})]),u.setQueryData(a,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),u.setQueryData(o,t=>Je(t,n,e.branch))},onError:e=>D(e.message,{tone:`danger`})}),[p,m]=(0,X.useState)(``),[h,_]=(0,X.useState)(``),y=h.trim().toLowerCase(),b=Ot(e,c.data?.branches),x=y?b.filter(e=>e.toLowerCase().includes(y)):b,S=p.trim(),C=xt(S);return(0,Z.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 md:grid-cols-[minmax(0,1fr)_290px]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Z.jsxs)(`label`,{className:`relative block`,children:[(0,Z.jsx)(re,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,Z.jsx)(st,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:h,onChange:e=>_(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,Z.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-3.5 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[x.map(e=>{let n=e===t.branch,i=l.get(e);return(0,Z.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":i?.class,className:`flex min-h-[60px] flex-col items-start justify-center gap-1.5 py-2 md:flex-row md:items-center md:justify-start md:gap-2.5`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[i?.runId?(0,Z.jsx)(I,{to:`/tasks/${i.runId}`,"data-slot":`branch-task-link`,title:i.title?`Open the task ${i.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] font-mono text-[12px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,Z.jsx)(`span`,{className:r(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),i&&!(n&&i.class===`active`)?(0,Z.jsx)(Dt,{entry:i}):null]}),i?(0,Z.jsx)(bt,{entry:i}):null,e.startsWith(`cez/`)&&!n?null:n?(0,Z.jsx)(`span`,{"data-slot":`branch-current`,className:`flex h-8 shrink-0 items-center rounded-md bg-accent-strong/10 px-2.5 text-[12px] font-medium text-accent-text md:ml-auto`,children:`Current`}):(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`h-8 max-md:h-11 no-hover:h-11 md:ml-auto`,disabled:f.isPending,onClick:()=>f.mutate(e),children:[(0,Z.jsx)(ue,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),x.length===0?(0,Z.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,h.trim(),`”.`]}):null]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Z.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-5 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=S;!t||C||f.mutate(t,{onSuccess:()=>m(``)})},children:[(0,Z.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Z.jsxs)(`p`,{"data-slot":`branch-create-base`,className:`-mt-1 text-xs text-muted-foreground`,children:[`Create from `,(0,Z.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:t.branch}),`.`]}),(0,Z.jsx)(st,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background placeholder:text-soft-foreground`,value:p,"aria-invalid":C?!0:void 0,"aria-describedby":C?`new-branch-name-hint`:void 0,onChange:e=>m(e.target.value)}),C?(0,Z.jsx)(`p`,{id:`new-branch-name-hint`,"data-slot":`branch-name-hint`,role:`alert`,className:`-mt-1 text-xs text-danger`,children:C}):null,(0,Z.jsxs)(P,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!S||C!==null||f.isPending,children:[(0,Z.jsx)(ae,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Z.jsx)(`p`,{"data-slot":`branch-create-note`,className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),s.data?.forge?.available?(0,Z.jsx)(Ct,{}):null]})}function Ct(){let e=p({limit:20});return(0,Z.jsxs)(`div`,{"data-slot":`repo-prs`,className:`min-w-0 rounded-xl border border-border bg-card p-5 md:col-span-2`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:`Open pull requests`}),e.isPending?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Loading pull requests…`}):e.isError?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`No open pull requests.`}):(0,Z.jsx)(`ul`,{className:`mt-3 flex flex-col divide-y divide-border border-t border-border`,children:e.data.prs.map(e=>(0,Z.jsx)(wt,{pr:e},e.number))}):(0,Z.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-3 text-xs text-muted-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function wt({pr:e}){let t=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Z.jsx)(Tt,{checks:e.checks}):null]}),n=`flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Z.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:a(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:r(n,`hover:bg-muted`),children:t}):(0,Z.jsx)(`span`,{className:n,children:t})})}function Tt({checks:e}){let t=e===`passing`?_e:e===`failing`?ve:at;return(0,Z.jsxs)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:r(`inline-flex shrink-0 items-center gap-1 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:[(0,Z.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var Et={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function Dt({entry:e}){return(0,Z.jsx)(`span`,{"data-slot":`branch-class`,className:r(`shrink-0 rounded-[4px] border px-1.5 py-px text-xs leading-4 font-medium`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:Et[e.class]})}function Ot(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function kt(){let e=c(),t=L(),[n,r]=(0,X.useState)(`unified`),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),f=e.isError&&e.error instanceof y&&e.error.status===409,p=e.data?.files??[],m=(0,X.useMemo)(()=>xe(p),[p]),h=(0,X.useMemo)(()=>p.some(dt),[p]),g=t?n:`unified`;return(0,Z.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`py-6 text-center text-xs text-muted-foreground`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(z,{icon:f?(0,Z.jsx)(me,{size:16}):(0,Z.jsx)(ce,{size:16}),tone:f?`neutral`:`danger`,heading:`h2`,title:f?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):p.length===0?(0,Z.jsx)(z,{icon:(0,Z.jsx)(me,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 pb-4 [&_button]:min-h-11`,children:[e.data?(0,Z.jsx)(Se,{stat:e.data.stat}):null,(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h&&o?(0,Z.jsx)(Ee,{}):null,h?(0,Z.jsx)(we,{preview:o,onPreviewChange:s}):null,(0,Z.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,Z.jsx)(Te,{mode:n,wrap:i,onModeChange:r,onWrapChange:a,disabled:h&&o})})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 [--diff-sticky-top:0px] md:flex-row md:items-start`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_2rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[288px]`,children:[(0,Z.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(be,{root:m,selected:l,onSelect:e=>{u(e),d.current?.scrollToPath(e)}})]}),(0,Z.jsx)(ft,{files:p,viewRef:d,mode:g,wrap:i,preview:o,totals:!1,className:`min-w-0 flex-1`})]})]})})}function At({repo:e,info:t}){let{sha:n}=A(),r=e.log,i=(0,X.useMemo)(()=>Ue(r),[r]);if(n)return(0,Z.jsx)(Nt,{sha:n});let a=rt(e,t),o=a&&a.behind>0?(0,Z.jsx)(Mt,{info:t,tracking:a}):null;return r.length===0?(0,Z.jsxs)(Z.Fragment,{children:[o?(0,Z.jsx)(`div`,{children:o}):null,(0,Z.jsx)(z,{icon:(0,Z.jsx)(te,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,Z.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4`,children:[o,i.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-3.5 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Z.jsxs)(I,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-0.5 px-4 py-2 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Z.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,Z.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(mt,{sha:e.hash}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,Z.jsx)(`span`,{title:it(e.when,e.at),children:nt(e.when,e.at)})]})]})]}),(0,Z.jsx)(jt,{source:e.source})]},e.hash))})]},e.label))]})}function jt({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-4 text-xs text-muted-foreground md:flex`;return e?(0,Z.jsxs)(I,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:r(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,Z.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,Z.jsx)(se,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,Z.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function Mt({info:e,tracking:t}){let n=et(i(),e),r=(0,X.useRef)(null);return(0,Z.jsxs)(`div`,{"data-slot":`git-incoming`,className:`flex min-h-[44px] items-center gap-2.5 rounded-xl border border-border bg-card px-4 py-2`,children:[(0,Z.jsx)(_t,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,Z.jsxs)(`button`,{ref:r,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[28px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,Z.jsx)(Ce,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Z.jsx)(fe,{"aria-hidden":`true`}),`Pull`]}),(0,Z.jsx)(Ke,{checkout:n,returnFocus:r})]})}function Nt({sha:e}){return(0,Z.jsx)(ht,{commit:s(e),sha:e,backTo:L()?`/git`:ut,backLabel:`All recent commits`,slot:`repo-commit`,className:`flex min-h-0 flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:px-9`})}var Pt=`Squash-merged branches may show as not landed without GitHub`;function Ft(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function It(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}function Lt(){let e=g(),t=h(),n=i(),r=_(),[a,o]=(0,X.useState)(null);if(e.isPending)return(0,Z.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`py-5 text-[13px] text-muted-foreground`,children:`Loading branches…`});if(e.isError)return(0,Z.jsx)(z,{icon:(0,Z.jsx)(ce,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=Ft(e.data.branches),c=s.reduce((e,t)=>e+t.rows.length,0),l=It(e.data.branches),u=l>0?(0,Z.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,Z.jsx)(N,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsxs)(`span`,{children:[l,` finished task`,l===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,l===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,Z.jsx)(I,{to:V.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,d=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,Z.jsxs)(Oe,{projectId:n,repoBase:r,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,Z.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[e.data.prStateKnown?null:(0,Z.jsx)(Rt,{}),u,s.length===0?(0,Z.jsx)(Ve,{icon:(0,Z.jsx)(ct,{size:16}),title:l>0?`Nothing else waiting to land`:`Everything landed`,description:l>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(I,{to:V.cleanup,children:`Check cleanup`})}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(I,{to:`/`,children:`View tasks`})})]})}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{}),(0,Z.jsx)(`span`,{children:e.note})]}):null]}),(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,Z.jsx)(zt,{entry:e,finishedAt:e.runId?d.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,Z.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-1.5 px-1 text-xs leading-snug text-muted-foreground`,children:[(0,Z.jsx)(N,{"aria-hidden":`true`,className:`mt-px size-3 shrink-0`}),`Delete a branch from its row's … menu. It confirms and names the commits it drops; nothing here is bulk-deleted.`]}),c<=3?(0,Z.jsx)(Be,{summary:`${c} ${c===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,Z.jsx)(P,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(I,{to:V.cleanup,children:`Open cleanup`})})}):null]})]}),(0,Z.jsx)(Wt,{entry:a,onClose:()=>o(null)})]})}function Rt({className:e}){return(0,Z.jsxs)(`p`,{"data-slot":`git-no-forge`,className:r(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,Z.jsx)(N,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),Pt,`.`]})}function zt({entry:e,finishedAt:t,onDelete:n}){return(0,Z.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[60px] items-center gap-3 px-4 py-3 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Z.jsx)(Ht,{entry:e,finishedAt:t}),(0,Z.jsx)(Bt,{entry:e}),(0,Z.jsx)(Vt,{entry:e,onDelete:n})]})}function Bt({entry:e}){return(0,Z.jsx)(Z.Fragment,{children:e.pr?(0,Z.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-1.5 text-xs text-muted-foreground md:flex`,children:[(0,Z.jsx)(ke,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,Z.jsx)(Ut,{entry:e})]}):null})}function Vt({entry:e,onDelete:t}){let n=T(),i=e.class===`orphan`,a=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,o=!i&&e.runId!==null&&!a,s=d({mutationFn:()=>C(e.runId),onSuccess:e=>{D(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:u.repoBranches}),n.invalidateQueries({queryKey:u.runs.all})},onError:e=>D(e instanceof y&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),[c,l]=(0,X.useState)(!1),f=(0,X.useRef)(null);(0,X.useEffect)(()=>()=>{f.current!==null&&clearTimeout(f.current)},[]);let p=()=>void navigator.clipboard.writeText(e.name).then(()=>{D(`Copied ${e.name}`),f.current!==null&&clearTimeout(f.current),l(!0),f.current=setTimeout(()=>l(!1),2e3)},()=>D(`Could not copy the branch name`,{tone:`danger`})),m=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-sm px-2.5 text-[12.5px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,Z.jsxs)(Z.Fragment,{children:[e.runId?(0,Z.jsx)(I,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:r(m,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,Z.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:s.isPending,onClick:()=>s.mutate(),className:r(m,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Z.jsx)(vt,{"aria-hidden":`true`}),s.isPending?`Creating…`:`Draft PR`]}):null,i?(0,Z.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,"data-copied":c||void 0,"aria-live":`polite`,onClick:p,className:r(m,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[c?(0,Z.jsx)(de,{"aria-hidden":`true`}):(0,Z.jsx)(he,{"aria-hidden":`true`}),c?`Copied`:`Copy branch`]}):null,(0,Z.jsxs)(Ne,{children:[(0,Z.jsx)(je,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-8 shrink-0 items-center justify-center rounded-sm text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,Z.jsx)(ie,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,Z.jsxs)(Me,{align:`end`,className:`w-52`,children:[e.runId?(0,Z.jsx)(F,{asChild:!0,className:`md:hidden`,children:(0,Z.jsx)(I,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,Z.jsx)(F,{className:`md:hidden`,disabled:s.isPending,onSelect:()=>s.mutate(),children:`Draft PR`}):null,(0,Z.jsx)(F,{className:r(!i&&`md:hidden`),onSelect:p,children:`Copy branch`}),(0,Z.jsx)(Ae,{className:`md:hidden`}),(0,Z.jsx)(F,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function Ht({entry:e,finishedAt:t}){let n=e.class===`orphan`,r=n?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,i=t??e.lastCommit.at,a=Fe(i),o=e.runStatus?Ye(e.runStatus):void 0,s=n||!o?a:`${o.label}${a?` ${a}`:``}`,c=Number.isFinite(Date.parse(i))?new Date(i).toLocaleString():void 0;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,Z.jsx)(ye,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,Z.jsx)(Pe,{tone:o?.tone??`neutral`,shape:o?.shape??`filled`,"aria-label":o?.label})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,Z.jsx)(I,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] font-medium text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,Z.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,Z.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,Z.jsx)(Q,{}),(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{}),(0,Z.jsx)(pt,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{}),(0,Z.jsx)(`span`,{className:`truncate`,title:c,children:s})]}):null]}),e.parentRunId?(0,Z.jsx)(I,{to:`/tasks/${e.parentRunId}`,"data-slot":`not-landed-parent`,className:`w-fit rounded-[2px] text-xs text-muted-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:`Worker of its parent task`}):null,(0,Z.jsx)(bt,{entry:e})]})]})}function Q(){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function Ut({entry:e}){let t=m(De(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{}),(0,Z.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function Wt({entry:e,onClose:t}){let n=T(),[r,i]=(0,X.useState)(``),a=(0,X.useId)(),o=d({mutationFn:e=>w({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;D(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:u.repo}),s()},onError:e=>D(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,Z.jsx)(W,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,Z.jsxs)(q,{"data-slot":`delete-branch-dialog`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsxs)(B,{children:[`Delete `,e?.name,`?`]}),(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,Z.jsxs)(Z.Fragment,{children:[`This drops the work of `,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,Z.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,e?.lastCommit.sha?(0,Z.jsxs)(Z.Fragment,{children:[` (`,(0,Z.jsx)($e,{sha:e.lastCommit.sha,variant:`inline`}),`)`]}):null,`.`]})]})})]}),(0,Z.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,Z.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,Z.jsx)(st,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(U,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,Z.jsx)(Y,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function Gt({base:e}){let t=g(),n=T(),[r,i]=(0,X.useState)({merged:!1,empty:!1}),[a,o]=(0,X.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],f=d({mutationFn:e=>w({names:e}),onSuccess:e=>{let t=e.refused.length;D(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:u.repo})},onError:e=>{n.invalidateQueries({queryKey:u.repo}),D(e.message,{tone:`danger`})}});if(t.isPending)return(0,Z.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,Z.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let p=l.length,m=`branch${p===1?``:`es`}`;return(0,Z.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,p]}),(0,Z.jsxs)(`p`,{className:`text-xs leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:p===0||f.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(pe,{"aria-hidden":`true`,className:`size-[12px]`}),f.isPending?`Deleting…`:`Delete ${p} ${m}`]})]}),(0,Z.jsx)(Kt,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:Pt.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,Z.jsx)(Kt,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,Z.jsx)(W,{open:a,onOpenChange:o,children:(0,Z.jsxs)(q,{children:[(0,Z.jsxs)(G,{children:[(0,Z.jsxs)(B,{children:[`Delete `,p,` `,m,`?`]}),(0,Z.jsxs)(K,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(U,{children:`Keep them`}),(0,Z.jsxs)(Y,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{f.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,p,` `,m]})]})]})})]})}function Kt({kind:e,title:t,hint:n,rows:i,open:a,onToggle:o}){let s=`cleanup-branches-${e}`;return(0,Z.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":a,"aria-controls":s,disabled:i.length===0,onClick:o,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,i.length]}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n})]}),i.length>0?(0,Z.jsx)(le,{"aria-hidden":`true`,className:r(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}):null]}),a?(0,Z.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:i.map(e=>(0,Z.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-xs`,children:[(0,Z.jsx)(Ge,{value:e.name,className:`shrink-0 text-muted-foreground`}),e.runId?(0,Z.jsx)(I,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,Z.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,Z.jsx)(qe,{iso:e.lastCommit.at,className:`shrink-0 text-soft-foreground`})]},e.name))}):null]})}function $(e){return e.some(e=>e.sizeBytes===null)?null:e.reduce((e,t)=>e+(t.sizeBytes??0),0)}function qt(e){return e.kind===`dirty`?`${e.uncommittedFiles} uncommitted`:e.kind===`detached-head`?`detached HEAD`:e.kind===`submodules`?`has submodules`:`broken worktree`}function Jt(e){if(e.kind===`dirty`){let t=`${e.uncommittedFiles} uncommitted file${e.uncommittedFiles===1?``:`s`}`;return e.detachedHead?`${t} and a detached HEAD on no branch`:t}return e.kind===`detached-head`?`a detached HEAD whose commit is on no branch`:e.kind===`submodules`?`initialized submodules that Git will not remove without force`:`an unregistered or broken Git worktree directory`}function Yt(e){let t=e.some(e=>e.reclaimBlocker?.kind===`dirty`),n=e.some(e=>e.reclaimBlocker?.kind===`detached-head`||e.reclaimBlocker?.kind===`dirty`&&e.reclaimBlocker.detachedHead),r=e.some(e=>e.reclaimBlocker?.kind===`submodules`),i=e.some(e=>e.reclaimBlocker?.kind===`invalid`),a=[...t?[`uncommitted work`]:[],...n?[`a detached HEAD`]:[],...r?[`initialized submodules`]:[],...i?[`a broken checkout`]:[]];return a.length<=1?a[0]??`uncommitted work`:`${a.slice(0,-1).join(`, `)} or ${a.at(-1)}`}function Xt(e,t,n){let r=Math.max(0,t-e);return e===0?r===0?`Nothing to reclaim — no finished worktrees exceed the keep limit`:n?`Nothing was reclaimed — the worktrees past the keep limit are in use or could not be removed`:`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Reclaimed ${e} worktree${e===1?``:`s`} (branch kept)${r>0?` · ${r} kept: ${n?`in use or could not be removed`:`uncommitted work or in use`}`:``}`}function Zt(e,t){return e===0?`Reclaim now`:t?`Reclaim ${j(t)} now`:`Reclaim ${e} now`}function Qt(e,t,n){let r=t?j(t):String(e);return n?`Discard & reclaim all ${r}`:`Discard & reclaim ${r}`}function $t(e,t){if(!e)return t>0?`No clean worktrees past the keep limit — use Discard & reclaim for blocked worktrees`:`Nothing past the keep limit to reclaim`}function en(e){return e===0?{prefix:`Retention is unlimited (`,suffix:`), so nothing is reclaimed on its own.`}:{prefix:`Retention keeps the newest ${e} finished checkout${e===1?``:`s`} (`,suffix:`) and reclaims the rest.`}}function tn({blocked:e,discardLabel:t,disabled:n,onDiscard:r}){let i=$(e),a=e.length===1?``:`s`,o=e.length===1?`it has`:`they have`;return(0,Z.jsxs)(`div`,{"data-slot":`worktrees-blocked-banner`,className:`flex flex-col gap-[10px] border-b border-border bg-muted/40 px-[14px] py-[10px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`p`,{className:`min-w-0 flex-1 text-[12px] leading-[17px] text-foreground`,children:[e.length,` worktree`,a,` past the keep limit`,i?` (${j(i)})`:``,` `,`cannot be reclaimed automatically because `,o,` `,Yt(e),`.`]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`worktrees-discard-reclaim`,disabled:n,onClick:r,className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] border border-danger/40 px-[10px] text-[12px] font-medium text-danger hover:bg-danger/10 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(lt,{"aria-hidden":`true`,className:`size-[12px]`}),t]})]})}function nn({confirmClean:e,onCloseClean:t,cleanCount:n,cleanBytes:r,reclaimLabel:i,onConfirmClean:a,discardBatch:o,onCloseDiscardBatch:s,onConfirmDiscardBatch:c,discardRow:l,onCloseRow:u,onConfirmRow:d}){let f=o?$(o):null,p=o?o.filter(e=>e.reclaimBlocker!==null).length:0,m=o?o.some(e=>!e.reclaimBlocker):!1,h=o?Qt(o.length,f,m):``;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W,{open:e,onOpenChange:e=>{e||t()},children:(0,Z.jsxs)(q,{children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(B,{children:`Reclaim old worktrees?`}),(0,Z.jsxs)(K,{children:[n,` finished worktree`,n===1?``:`s`,` beyond the keep limit`,r?` (${j(r)})`:``,` `,n===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(U,{children:`Keep them`}),(0,Z.jsx)(Y,{"data-action":`worktrees-confirm`,onClick:a,children:i})]})]})}),(0,Z.jsx)(W,{open:o!==null,onOpenChange:e=>{e||s()},children:(0,Z.jsxs)(q,{children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(B,{children:`Discard changes and reclaim worktrees?`}),(0,Z.jsx)(K,{children:o?(0,Z.jsxs)(Z.Fragment,{children:[o.length,` finished worktree`,o.length===1?``:`s`,` beyond the keep limit`,f?` (${j(f)})`:``,` will be reclaimed now.`,` `,`Uncommitted files and detached-HEAD commits in `,p,` blocked checkout`,p===1?``:`s`,` will be permanently discarded. Each task’s branch is kept.`]}):null})]}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(U,{children:`Keep them`}),(0,Z.jsx)(Y,{"data-action":`worktrees-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{o&&c(o),s()},children:h})]})]})}),(0,Z.jsx)(W,{open:l!==null,onOpenChange:e=>{e||u()},children:(0,Z.jsxs)(q,{children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(B,{children:`Discard changes and reclaim worktree?`}),(0,Z.jsx)(K,{children:l?.reclaimBlocker?(0,Z.jsxs)(Z.Fragment,{children:[l.title,` has `,Jt(l.reclaimBlocker),`. Reclaiming removes the directory and permanently discards uncommitted or unbranched changes in it. The branch (`,l.branch??l.runId.slice(0,8),`) is kept.`]}):null})]}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(U,{children:`Keep it`}),(0,Z.jsx)(Y,{"data-action":`worktree-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{l&&d(l),u()},children:`Discard & reclaim`})]})]})})]})}function rn(){let e=f(),t=l().data?.targets.find(e=>e.id===`finder`),n=d({mutationFn:e=>b(e,t.id),onError:e=>D(e.message,{tone:`danger`})}),r=T(),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(null),[c,p]=(0,X.useState)(null),m=()=>Promise.all([r.invalidateQueries({queryKey:u.worktrees}),r.invalidateQueries({queryKey:u.repoBranches})]),h=d({mutationFn:({runIds:e})=>S(e?{discardWork:!0,runIds:e}:void 0),onSuccess:(e,{expected:t,runIds:n})=>{m(),D(Xt(e.reclaimed.length,t,!!n))},onError:e=>D(e.message,{tone:`danger`})}),g=d({mutationFn:({worktree:e,discardWork:t})=>x(e.runId,t?{discardWork:!0}:void 0),onSuccess:(e,{worktree:t})=>{m(),D(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{m(),D(e.message,{tone:`danger`})}});if(e.isPending)return(0,Z.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Z.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:_,totalBytes:v,keep:y}=e.data,C=h.isPending||g.isPending,w=_.filter(e=>e.pastKeep),E=w.filter(e=>!e.reclaimBlocker),O=w.filter(e=>e.reclaimBlocker!==null),k=E.length>0,A=$(E),ee=$(w),M=Zt(E.length,A),te=Qt(w.length,ee,k),ne=v?j(v):null,re=en(y);return(0,Z.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,ne?` · ${ne}`:``]}),(0,Z.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-xs leading-[17px] text-soft-foreground`,children:[re.prefix,(0,Z.jsx)(I,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:ot(`worktrees`,` › `)}),re.suffix,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:C||!k,title:$t(k,O.length),onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(lt,{"aria-hidden":`true`,className:`size-[12px]`}),M]})]}),O.length>0?(0,Z.jsx)(tn,{blocked:O,discardLabel:te,disabled:C,onDiscard:()=>s(w)}):null,_.length===0?(0,Z.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Z.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:_.map(e=>(0,Z.jsx)(sn,{worktree:e,keep:y,disabled:C,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>{e.reclaimBlocker?p(e):g.mutate({worktree:e,discardWork:!1})}},e.runId))}),(0,Z.jsx)(nn,{confirmClean:i,onCloseClean:()=>a(!1),cleanCount:E.length,cleanBytes:A,reclaimLabel:M,onConfirmClean:()=>{h.mutate({expected:E.length}),a(!1)},discardBatch:o,onCloseDiscardBatch:()=>s(null),onConfirmDiscardBatch:e=>{h.mutate({expected:e.length,runIds:e.map(e=>e.runId)})},discardRow:c,onCloseRow:()=>p(null),onConfirmRow:e=>g.mutate({worktree:e,discardWork:!0})})]})}var an=new Set([`queued`,`running`,`waiting`,`review`]);function on(e,t){return an.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`,state:`in-use`}:e.reclaimBlocker?{label:qt(e.reclaimBlocker),tone:`blocked`,state:`blocked`}:e.pastKeep?{label:`reclaimable`,tone:`plain`,state:`reclaimable`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`,state:`kept`}}function sn({worktree:e,keep:t,disabled:n,onOpen:i,opening:a,onReclaim:o}){let s=on(e,t),c=Fe(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${Ie(c)}`:e.status,u=s.tone===`in-use`?`text-status-running`:s.tone===`blocked`?`text-danger`:`text-soft-foreground`,d=e.reclaimBlocker?`Cannot auto-reclaim: ${Jt(e.reclaimBlocker)}`:void 0,f=(0,Z.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":s.state,title:d,className:r(`text-xs`,u),children:s.label}),p=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`,m=e.reclaimBlocker?`Discard changes and reclaim the worktree of ${e.title} (branch kept)`:`Reclaim the worktree of ${e.title} (branch kept)`,h=e.reclaimBlocker?`Discard changes and reclaim the directory (branch kept)`:`Reclaim the directory (branch kept)`;return(0,Z.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,Z.jsxs)(`span`,{className:`truncate font-mono text-xs text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,Z.jsxs)(`span`,{className:`md:hidden`,children:[` · `,s.label]})]})]}),(0,Z.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:j(e.sizeBytes)||`0 kB`}),(0,Z.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:f}),i?(0,Z.jsx)(`button`,{type:`button`,className:p,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:a,onClick:i,children:(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`size-[13px]`})}):null,s.tone===`in-use`?null:(0,Z.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":m,title:h,disabled:n,onClick:o,className:r(p,e.reclaimBlocker&&`text-danger hover:text-danger`),children:(0,Z.jsx)(lt,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function cn(e){return e===`main`||e===`changes`?`Split`:`Table`}function ln({section:e,index:t=!1}){let n=o(),r=L(),[i]=k(),a=cn(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,Z.jsx)(yt,{});if(n.isPending)return(0,Z.jsx)(tt,{});if(n.isError)return(0,Z.jsx)(R,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Z.jsx)(H,{}),children:(0,Z.jsx)(z,{icon:(0,Z.jsx)(ce,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let s=n.data.info;return s?(0,Z.jsx)(un,{repo:n.data,info:s,section:e}):(0,Z.jsx)(R,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Z.jsx)(H,{}),children:(0,Z.jsx)(z,{icon:(0,Z.jsx)(ue,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`Squawk is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function un({repo:e,info:t,section:n}){let r=cn(n),i=g(),a=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?Ot(e,i.data?.branches).length:n===`not-landed`?i.data?.branches.filter(e=>e.class===`not-landed`||e.class===`orphan`).length??0:4;return(0,Z.jsx)(R,{template:r,route:`repo-git`,density:n===`not-landed`&&i.isPending?`full`:ze(a),rootProps:{"data-git-section":n},beforeHeader:(0,Z.jsx)(H,{}),header:{title:Qe(n,t.branch),headerSlot:`repo-header`,subtitle:(0,Z.jsx)(dn,{repo:e,info:t,section:n}),subtitleSlot:`repo-meta`},children:n===`main`?(0,Z.jsx)(At,{repo:e,info:t}):n===`not-landed`?(0,Z.jsx)(Lt,{}):n===`cleanup`?(0,Z.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[(0,Z.jsx)(rn,{}),(0,Z.jsx)(Gt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,Z.jsx)(St,{repo:e,info:t}):(0,Z.jsx)(kt,{})})}function dn({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,Z.jsxs)(Z.Fragment,{children:[e.log.length===0?`No commits yet`:`Latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${We(e.tracking)}`:``]});case`not-landed`:return(0,Z.jsxs)(Z.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,Z.jsx)(fn,{repo:e,info:t});case`changes`:return(0,Z.jsxs)(Z.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,Z.jsxs)(Z.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function fn({repo:e,info:t}){let n=Ot(e,g().data?.branches).length;return(0,Z.jsxs)(Z.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{ln as RepoGitRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{C as i,Wt as a,X as o,Y as s,dn as c,yt as l}from"./queries-CIeJg62Y.js";import{Bt as u,Fn as d,Ft as f,Ht as p,Lt as m,Tt as h,at as g,ct as ee,hi as _,n as v,tr as y}from"./toaster-D0HMoto5.js";import{h as b}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{M as x,u as S,w as C}from"./design-icons-QbNMZniQ.js";import{t as w}from"./run-header-BO93V6-R.js";import{i as T,n as E,r as te}from"./git-toolbar-C3mKb8Eo.js";import{t as D}from"./button-C8jUIs8Q.js";import{a as O,i as k,o as A,r as j,s as M,t as N}from"./dialog-DRZuXvul.js";import{b as P,f as F}from"./task-groups-C9pTQm-2.js";import{f as I,l as L,m as R}from"./page-shell-Dky5crRl.js";import{t as z}from"./centered-state-BgSV4e79.js";import{C as B,Q as V,S as H,ln as U,zn as W}from"./index-zhwJL4R4.js";import{t as G}from"./markdown-BBDDg-4t.js";import{t as K}from"./textarea-vEsJAUAV.js";import{t as q}from"./diff-1Cn1zY0x.js";var J=e(t(),1),Y=`no worktree — this task ran directly in the repo working tree`;function X(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${Y}`)}function Z(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${Y}`)}function ne(e){let t=e=>({id:`create-pr`,label:`Draft PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Draft PR unavailable — ${Y}`):e.forge===null?t(`Draft PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?y(e.run)?t(`Draft PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):P(e.run)?t(`Draft PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Draft PR`,enabled:!0}:t(`Draft PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function re(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:X(e),n=e.prUrl?[X(e),Z(e)]:[Z(e),ne(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?P(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Q=n();function $({run:e,open:t,onOpenChange:n}){let r=_(),[i,o]=(0,J.useState)(``),s=F(e),l=(0,J.useRef)(s);l.current=s,(0,J.useEffect)(()=>{t&&o(l.current)},[t]);let u=c({mutationFn:t=>g(e.id,t),onSuccess:t=>{v(`Committed ${W(t.sha)}`),n(!1),r.invalidateQueries({queryKey:a.runs.changes(e.id)}),r.invalidateQueries({queryKey:a.runs.all})},onError:e=>v(e.message,{tone:`danger`})}),d=()=>{let e=i.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Q.jsx)(N,{open:t,onOpenChange:n,children:(0,Q.jsxs)(j,{"data-slot":`commit-dialog`,children:[(0,Q.jsxs)(A,{children:[(0,Q.jsx)(M,{children:`Commit changes`}),(0,Q.jsxs)(k,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Q.jsx)(K,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{V({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d())}}),(0,Q.jsxs)(O,{children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Q.jsx)(D,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function ie(){let{id:e}=b(),t=s(e);return t.isPending?(0,Q.jsx)(B,{tab:`changes`}):t.isError?(0,Q.jsx)(H,{tab:`changes`,error:t.error}):(0,Q.jsx)(ae,{run:t.data})}function ae({run:e}){let t=l(),n=i(),r=o(e.id,P(e)),s=R(),[p,h]=(0,J.useState)(`unified`),[g,y]=(0,J.useState)(!0),[b,x]=(0,J.useState)(!1),[S,C]=(0,J.useState)(null),[T,D]=(0,J.useState)(!1),O=(0,J.useRef)(null),k=_(),A=()=>k.invalidateQueries({queryKey:a.runs.all}),j=e=>v(e.message,{tone:`danger`}),M=c({mutationFn:()=>u(e.id),onSuccess:e=>v(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:j}),N=c({mutationFn:()=>ee(e.id),onSuccess:e=>{v(`Draft PR created — ${e.url}`),A()},onError:j}),F=c({mutationFn:()=>m(e.id),onError:e=>{if(e instanceof d&&e.command){navigator.clipboard.writeText(e.command).then(()=>v(`No terminal found — command copied to clipboard.`)).catch(()=>v(`Run manually: ${e.command}`));return}j(e)}}),z=c({mutationFn:t=>f(e.id,t),onError:j}),B=r.isError&&r.error instanceof d&&r.error.status===409,V=re({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!B,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:U(e)!==void 0,prUrl:e.pullRequestUrl}),H=e=>{switch(e){case`commit`:D(!0);break;case`push`:M.mutate();break;case`create-pr`:N.mutate();break;case`open-terminal`:F.mutate();break;case`view-pr`:break}},W=r.data?.files??[],K=(0,J.useMemo)(()=>te(W),[W]),q=(0,J.useMemo)(()=>W.some(G),[W]),Y=s?p:`unified`;return(0,Q.jsxs)(L,{route:`task-changes`,density:I(W.length),flushPadding:!0,children:[(0,Q.jsx)(w,{run:e,tab:`changes`}),(0,Q.jsx)(E,{bar:V,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:g,preview:b,onModeChange:h,onWrapChange:y,onPreviewChange:q?x:void 0,onAction:H}),r.data?.repointedHead?(0,Q.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Q.jsx)(oe,{changes:r,changesRefused:B,fileCount:W.length,children:(0,Q.jsx)(se,{runId:e.id,files:W,tree:K,selected:S,selectFile:e=>{C(e),O.current?.scrollToPath(e)},diffRef:O,effectiveMode:Y,effectiveWrap:g,preview:b,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Q.jsx)($,{run:e,open:T,onOpenChange:D})]})}function oe({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(z,{icon:t?(0,Q.jsx)(C,{size:16}):(0,Q.jsx)(x,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Q.jsx)(z,{icon:(0,Q.jsx)(C,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function se({runId:e,files:t,tree:n,selected:i,selectFile:a,diffRef:o,effectiveMode:s,effectiveWrap:c,preview:l,localHandoff:u,onOpenInApp:d}){let[f,m]=(0,J.useState)(!1);return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-4 px-4 pb-9 pt-0 [--diff-sticky-top:0px] md:flex-row md:items-start md:gap-5 md:px-9`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_2rem)] md:w-60 md:overflow-y-auto md:overscroll-contain md:p-3.5 lg:w-[288px]`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`changes-tree-toggle`,"aria-expanded":f,onClick:()=>m(e=>!e),className:`flex min-h-11 w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-xs font-semibold text-foreground md:hidden`,children:[(0,Q.jsxs)(`span`,{children:[`Changed files`,` `,(0,Q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.length,`)`]})]}),(0,Q.jsx)(S,{size:16,"aria-hidden":`true`,className:r(`size-4 shrink-0 text-muted-foreground motion-safe:transition-transform`,f&&`rotate-180`)})]}),(0,Q.jsx)(`h2`,{className:`mb-3 hidden border-b border-border pb-3 text-xs font-semibold md:block`,children:`Changed files`}),(0,Q.jsx)(`div`,{className:r(f?`border-t border-border px-3.5 py-3 md:border-t-0 md:p-0`:`hidden md:block`),children:(0,Q.jsx)(T,{root:n,selected:i,onSelect:e=>{a(e),m(!1)}})})]}),(0,Q.jsx)(q,{files:t,viewRef:o,mode:s,wrap:c,preview:l,loadFileText:t=>ce(e,t),imageSrc:t=>p(e,t),onOpenInApp:u?e=>d(e):void 0,totals:!1,className:`min-w-0 flex-1`})]})}async function ce(e,t){try{let n=await h(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{ie as TaskChangesRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{B as i,F as a,N as o,Y as s,et as c}from"./queries-CIeJg62Y.js";import{Fn as l,ft as u,nt as d}from"./toaster-D0HMoto5.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as g,E as _,Q as v,Z as y,ct as b,d as x}from"./design-icons-QbNMZniQ.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./run-header-BO93V6-R.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-Cg4XNolK.js";import{t as k}from"./button-C8jUIs8Q.js";import{l as A}from"./page-shell-Dky5crRl.js";import{t as j}from"./centered-state-BgSV4e79.js";import{C as M,Ln as N,S as P,fr as F,rr as I}from"./index-zhwJL4R4.js";import{r as L}from"./markdown-C1Qn_3d6.js";import{t as R}from"./task-file-scope-D4oeMbrZ.js";var z=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),B=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),V=e(t(),1),H=n();function U({runId:e,path:t,artifactId:n,worktreePath:r}){let a=i(e,n?null:t),s=o(e,n),c=n?s:a,l=(0,V.useContext)(L),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,V.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,H.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,H.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:`Could not load this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=T(h.path,r,t);if(h.type!==`file`)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,H.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,H.jsx)(L.Provider,{value:g,children:(0,H.jsx)(E,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?d(e,v.id,`image`):u(e,t),...v?{downloadUrl:d(e,v.id,`download`),snapshot:(0,H.jsx)(N,{iso:v.createdAt})}:{}},v?.id??h.path)})}var W=new Map;function G(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var K=(0,V.createContext)(null);function q(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,V.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var J=()=>document.querySelector(`[data-slot="main"]`);function Y(e,t){let n=(0,V.useRef)(null),r=f(),i=h()===`POP`?r.key:G(r.state),[a]=(0,V.useState)(()=>{let t=i?W.get(i):void 0;return t?.runId===e?t:null}),o=(0,V.useRef)(new Set(a?.folders??[])),s=(0,V.useRef)(new Set),[c,l]=(0,V.useState)(0),u=(0,V.useRef)(a===null),d=(0,V.useCallback)(()=>{u.current&&W.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:J()?.scrollTop??0})},[r.key,e]),p=(0,V.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,V.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=J();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,V.useEffect)(()=>{d();let e=[n.current,J()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function X({runId:e,selected:t,onSelect:n}){return(0,H.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function Z({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,V.useContext)(K);return(0,V.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,H.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,H.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,H.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,H.jsx)(H.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,H.jsx)(Q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,H.jsx)($,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Q({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,V.useContext)(K),[c,l]=(0,V.useState)(()=>s?.isOpen(n)??!1);return(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,H.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function $({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?B:g;return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,H.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,H.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function ee(){let{id:e}=m(),t=s(e),n=q();return t.isPending?(0,H.jsx)(M,{tab:`files`}):t.isError?(0,H.jsx)(P,{tab:`files`,error:t.error}):(0,H.jsx)(R,{runId:t.data.id,children:(0,H.jsx)(ne,{run:t.data},`${t.data.id}:${n}`)})}function te(e,t,n,r){let a=i(e,r||n!==null?null:t),s=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?a:s).isPending}function ne({run:e}){let t=c(e.id,``),n=a(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,V.useState)(o??``);(0,V.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=te(e.id,o,s,u),_=Y(e.id,!t.isPending&&g);return(0,H.jsxs)(A,{route:`task-files`,density:re(t.isError),flushPadding:!0,children:[(0,H.jsx)(C,{run:e,tab:`files`}),(0,H.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,H.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,H.jsx)(I,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,H.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,H.jsxs)(`aside`,{ref:_.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,H.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,H.jsx)(j,{icon:h?(0,H.jsx)(z,{}):(0,H.jsx)(b,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,H.jsx)(K.Provider,{value:_.folders,children:(0,H.jsx)(X,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,H.jsx)(ie,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,H.jsx)(U,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,H.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function re(e){return e?`empty`:`full`}function ie({artifacts:e,artifactId:t,onSelect:n}){return(0,H.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,H.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,H.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,H.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,H.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,H.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,H.jsxs)(k,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,H.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{ee as TaskFilesRoute};
@@ -1 +0,0 @@
1
- import{It as e}from"./queries-CIeJg62Y.js";import{n as t}from"./project-location-CxcuM0pc.js";function n(){return{home:e().data?.homeDir??null,root:t()}}export{n as t};
@@ -1 +0,0 @@
1
- import{Gt as e,dn as t}from"./queries-CIeJg62Y.js";import{hi as n,n as r,sn as i}from"./toaster-D0HMoto5.js";function a(){let a=n();return t({mutationFn:e=>i(e),onSuccess:t=>a.setQueryData(e.config,t),onError:e=>r(e.message,{tone:`danger`})})}export{a as t};