@hearsay-tools/squawk 0.19.0-dev.9143 → 0.19.0-dev.9160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/hosts/index.d.ts +1 -1
- package/dist/features/hosts/index.js +1 -1
- package/dist/features/hosts/index.js.map +1 -1
- package/dist/features/hosts/routes.d.ts +2 -2
- package/dist/features/hosts/routes.js +4 -4
- package/dist/features/hosts/routes.js.map +1 -1
- package/dist/server/repo-routes.d.ts +13 -13
- package/dist/server/runs-routes.d.ts +16 -16
- package/dist/server/server.d.ts +58 -58
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-m_1ntZJh.js +1 -0
- package/web/dist/assets/activity-motion-DDqgr8eF.js +1 -0
- package/web/dist/assets/activity-route-BlEZZxyI.js +1 -0
- package/web/dist/assets/agent-accounts-D_ZKAmaW.js +1 -0
- package/web/dist/assets/{agent-config-section-D8pxNy2V.js → agent-config-section-wICtFVks.js} +2 -2
- package/web/dist/assets/agent-defaults-section-BC9Ypg0g.js +1 -0
- package/web/dist/assets/{appearance-D_t3wCjY.js → appearance-fkDdWPlG.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-C63xRNFZ.js → archive-on-merge-field-B6kX09p-.js} +1 -1
- package/web/dist/assets/{ask-card-kqWOqKIc.js → ask-card-Cue5EajQ.js} +5 -5
- package/web/dist/assets/attention-BI6592lk.js +1 -0
- package/web/dist/assets/{automation-format-DB34jUyF.js → automation-format-jKMOXcHS.js} +1 -1
- package/web/dist/assets/automations-route-BfOpJjLK.js +2 -0
- package/web/dist/assets/{badge-DVxxThpb.js → badge-DAnkqD7i.js} +1 -1
- package/web/dist/assets/{button-B22ANdCY.js → button-BV_AiLj2.js} +1 -1
- package/web/dist/assets/{centered-state-BgSV4e79.js → centered-state-N8vWM_Hw.js} +1 -1
- package/web/dist/assets/{cez-idle-CdswdDRd.js → cez-idle-C0drOeLs.js} +1 -1
- package/web/dist/assets/{change-counts-wqSYI3W8.js → change-counts-BLLRvt46.js} +1 -1
- package/web/dist/assets/chunk-KS7C4IRE-BdLLx37K.js +3 -0
- package/web/dist/assets/{code-editor-GfQChdgl.js → code-editor-DZMD1guX.js} +1 -1
- package/web/dist/assets/{code-workbench-CUkiQ1pF.js → code-workbench-B0GIezrD.js} +1 -1
- package/web/dist/assets/{collapsible-Bx2vViFx.js → collapsible-D5i3hm2L.js} +1 -1
- package/web/dist/assets/{command-B2Y0By1v.js → command-4D8sPZJy.js} +1 -1
- package/web/dist/assets/{commit-list-Bjc-pQxv.js → commit-list-StLehTiQ.js} +1 -1
- package/web/dist/assets/{dialog-rpNyAWGb.js → dialog-DKr-j9S6.js} +1 -1
- package/web/dist/assets/diff-DEw-tkVq.js +3 -0
- package/web/dist/assets/{diff-controls-CaCUSyxs.js → diff-controls-CSO8HgZ0.js} +1 -1
- package/web/dist/assets/{diff-stat-Dy4uLuyP.js → diff-stat-DCO_BkZB.js} +1 -1
- package/web/dist/assets/{diff-view-4wxDvYXE.js → diff-view-BcU4Rnuo.js} +3 -3
- package/web/dist/assets/discard-changes-dialog-BEsdWdyJ.js +1 -0
- package/web/dist/assets/{dist-BSUJIXeE.js → dist-B2_vvox1.js} +1 -1
- package/web/dist/assets/dist-CCX8mhHc.js +1 -0
- package/web/dist/assets/{dist-BuF3mvCA.js → dist-ClMNSUvT.js} +1 -1
- package/web/dist/assets/{dist--f2yFdPY.js → dist-CyFJ-9Ex.js} +1 -1
- package/web/dist/assets/{dist-DudPJH39.js → dist-Du6flkGD.js} +1 -1
- package/web/dist/assets/{dropdown-menu-DjtKUK8F.js → dropdown-menu-NJZfnQCU.js} +1 -1
- package/web/dist/assets/{es2015-CUEfzDjB.js → es2015-BHonSvOU.js} +1 -1
- package/web/dist/assets/file-preview-_4nAs_Ai.js +2 -0
- package/web/dist/assets/{folder-browser-Civftk0W.js → folder-browser-CFd1U5hn.js} +1 -1
- package/web/dist/assets/{git-toolbar-CepvG0Ng.js → git-toolbar-DXnIUFi1.js} +1 -1
- package/web/dist/assets/github-g-Ykk4uE.js +1 -0
- package/web/dist/assets/{global-activity-route-DhmrWj31.js → global-activity-route-OsAvUny-.js} +2 -2
- package/web/dist/assets/highlighter-Crq-WTmN.js +3 -0
- package/web/dist/assets/host-context-DDbYAKpm.js +1 -0
- package/web/dist/assets/host-storage-B72yoDU1.js +1 -0
- package/web/dist/assets/hosts-CpDMDiQW.js +1 -0
- package/web/dist/assets/{html-report-frame-Ck76gKfA.js → html-report-frame-Bk6UkqKa.js} +1 -1
- package/web/dist/assets/{image-preview-CeEKI2T5.js → image-preview-CdL9a1Zj.js} +1 -1
- package/web/dist/assets/index-D_WkVdwL.css +1 -0
- package/web/dist/assets/index-Dp7K74Jw.js +21 -0
- package/web/dist/assets/label-CgU9vxuM.js +1 -0
- package/web/dist/assets/{live-protocol-DMhTnCmf.js → live-protocol-CNUmr-VT.js} +1 -1
- package/web/dist/assets/markdown-BB-PN03o.js +2 -0
- package/web/dist/assets/{middle-truncated-name-D41ibfXD.js → middle-truncated-name-jUQS2QzL.js} +1 -1
- package/web/dist/assets/{nav-row-styles-CgP5uNp4.js → nav-row-styles-CIedRn3A.js} +1 -1
- package/web/dist/assets/{open-in-menu-CbQWVBD0.js → open-in-menu-BI7mnPPf.js} +1 -1
- package/web/dist/assets/{option-select-BwSkbCrQ.js → option-select-Bmm4ktgQ.js} +1 -1
- package/web/dist/assets/{page-shell-BgabWJ3w.js → page-shell-BdjH5hyc.js} +1 -1
- package/web/dist/assets/{popover-CvL6hQ5c.js → popover-BQolmvDR.js} +1 -1
- package/web/dist/assets/{preferences-section-Cvh644K0.js → preferences-section-dKDCZSWD.js} +1 -1
- package/web/dist/assets/preview-EtD19mg1.js +1 -0
- package/web/dist/assets/preview-pane-connected-DBbCXW1b.js +3 -0
- package/web/dist/assets/{project-location-DR8go8oL.js → project-location-DJjcFmsE.js} +1 -1
- package/web/dist/assets/project-router-Dc6KBQsv.js +1 -0
- package/web/dist/assets/projects-section-CVFyzORg.js +1 -0
- package/web/dist/assets/{prompt-templates-section-DcxD28iA.js → prompt-templates-section-Jj1YbCwG.js} +2 -2
- package/web/dist/assets/queries-IlC9MZgh.js +1 -0
- package/web/dist/assets/{read-state-c_RNJaXO.js → read-state-BeVNfGkB.js} +1 -1
- package/web/dist/assets/{reference-chip-z7dZJVH-.js → reference-chip-BjerVjzM.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-Dtaa3ovl.js → remote-settings-notice-Czl9yS5W.js} +1 -1
- package/web/dist/assets/repo-git-C9N9wa5l.js +1 -0
- package/web/dist/assets/{report-reader-mbkd2DKt.js → report-reader-Ci4sWoe1.js} +1 -1
- package/web/dist/assets/report-selection-CZ8eb9QP.js +1 -0
- package/web/dist/assets/reports-CQPRtR5G.js +1 -0
- package/web/dist/assets/{resources-section-g5XRlefz.js → resources-section-lLpdP6MD.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-BdBvLP6E.js → review-notes-drafts-BjXqp0gY.js} +1 -1
- package/web/dist/assets/{review-panel-Ba8yb8Fu.js → review-panel-B4dp-Rol.js} +1 -1
- package/web/dist/assets/{review-strip-CdlMeV2i.js → review-strip-BE71YjB6.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-C5qmRdgD.js → run-detail-refresh-CE0vyYYA.js} +1 -1
- package/web/dist/assets/{run-diff-BDMdnSv7.js → run-diff-ClfLRsHF.js} +3 -3
- package/web/dist/assets/run-header-DvbVw3uo.js +2 -0
- package/web/dist/assets/{select-DdH25sWT.js → select-CYo1lo6a.js} +1 -1
- package/web/dist/assets/{session-context-section-BqEdLdTv.js → session-context-section-B_NEOGby.js} +2 -2
- package/web/dist/assets/{settings-agent-picker-b4M6fQ8m.js → settings-agent-picker-DeAST7qR.js} +1 -1
- package/web/dist/assets/{settings-field-Bhh8I9fJ.js → settings-field-AyinSFR_.js} +1 -1
- package/web/dist/assets/{settings-list-detail-D3ibaYUj.js → settings-list-detail-BlEEuyae.js} +1 -1
- package/web/dist/assets/settings-save-bar-Dd3bTznK.js +1 -0
- package/web/dist/assets/{settings-shell-BUwdvhI9.js → settings-shell-Bt7NYun7.js} +1 -1
- package/web/dist/assets/sidebar-section-DdrFJBTL.js +1 -0
- package/web/dist/assets/{skills-BLkPhZO8.js → skills-DNCuhhKf.js} +1 -1
- package/web/dist/assets/status-dot-Bmn4xhch.js +1 -0
- package/web/dist/assets/{switch-CAKeV99j.js → switch-B9OfOEzC.js} +1 -1
- package/web/dist/assets/{tab-link-BKlpD9sn.js → tab-link-6TltE1jl.js} +1 -1
- package/web/dist/assets/{task-changes-Drvnew5P.js → task-changes-CdAzeh9M.js} +2 -2
- package/web/dist/assets/{task-commits-1MJHuX1i.js → task-commits-CzZJZj2x.js} +1 -1
- package/web/dist/assets/{task-file-scope-CB3L3KQl.js → task-file-scope-BuFeMG6a.js} +1 -1
- package/web/dist/assets/task-files-BFdMVAb3.js +1 -0
- package/web/dist/assets/{task-github-item-CMNk7FxR.js → task-github-item-Dv0Uflz7.js} +1 -1
- package/web/dist/assets/{task-groups-CGCnVqHE.js → task-groups-DCg4iOB9.js} +1 -1
- package/web/dist/assets/task-thread-C98mqSie.js +2 -0
- package/web/dist/assets/{textarea-vEsJAUAV.js → textarea-BGp28xFr.js} +1 -1
- package/web/dist/assets/thread-state-DqBwIoCM.js +4 -0
- package/web/dist/assets/toaster-DNnL8v10.js +4 -0
- package/web/dist/assets/{tool-display-B9NN44oU.js → tool-display-CTbToGmi.js} +1 -1
- package/web/dist/assets/use-finish-run-CFEVvqeg.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-BYN578_s.js +1 -0
- package/web/dist/assets/use-path-bases-B238cLk1.js +1 -0
- package/web/dist/assets/{use-search-params-writer-ClMScnNe.js → use-search-params-writer-DD5PEEZw.js} +1 -1
- package/web/dist/assets/use-workspace-config-save-DScW6_8J.js +1 -0
- package/web/dist/assets/{workflows-BUcx-n8J.js → workflows-IT5WTfLr.js} +3 -3
- package/web/dist/assets/{workspace-tools-dbiR1fzO.js → workspace-tools-D_opTe6D.js} +1 -1
- package/web/dist/assets/{worktrees-section-Dyb_QkSd.js → worktrees-section-B8ycJMoK.js} +4 -4
- package/web/dist/assets/zoomable-image-CULOtYYp.js +1 -0
- package/web/dist/index.html +41 -37
- package/web/dist/live-worker.js +2 -2
- package/web/dist/assets/accounts-section-BsgnDmow.js +0 -1
- package/web/dist/assets/activity-motion-Ckq9kC3I.js +0 -1
- package/web/dist/assets/activity-route-5S9WhN9U.js +0 -1
- package/web/dist/assets/agent-accounts-D_7QcFSx.js +0 -1
- package/web/dist/assets/agent-defaults-section-et5LHv9W.js +0 -1
- package/web/dist/assets/attention-DnxGjw_R.js +0 -1
- package/web/dist/assets/automations-route-B5YBpGMc.js +0 -2
- package/web/dist/assets/chunk-KS7C4IRE-Cg8l-LDN.js +0 -3
- package/web/dist/assets/diff-lwWO-At7.js +0 -3
- package/web/dist/assets/discard-changes-dialog-B3gvm7lX.js +0 -1
- package/web/dist/assets/dist-C_rn70hE.js +0 -1
- package/web/dist/assets/file-preview-98pJhZJj.js +0 -2
- package/web/dist/assets/github-4Jhl7lLG.js +0 -1
- package/web/dist/assets/highlighter-Cfo7mLVB.js +0 -3
- package/web/dist/assets/index-BK1FcZrA.css +0 -1
- package/web/dist/assets/index-DJB0lid-.js +0 -21
- package/web/dist/assets/label-feCJ3WOT.js +0 -1
- package/web/dist/assets/markdown-BAPhDASs.js +0 -2
- package/web/dist/assets/preview-pane-connected-B08ZdGux.js +0 -3
- package/web/dist/assets/project-router-j0uBi7Ep.js +0 -1
- package/web/dist/assets/projects-section-XDboHBFP.js +0 -1
- package/web/dist/assets/queries-CchoEEzj.js +0 -1
- package/web/dist/assets/repo-git-Dp9R2TuI.js +0 -1
- package/web/dist/assets/report-selection-BdGxjISG.js +0 -1
- package/web/dist/assets/reports-ya2OW-iR.js +0 -1
- package/web/dist/assets/run-header-BTRXYB4W.js +0 -2
- package/web/dist/assets/settings-save-bar-DFY_Km4X.js +0 -1
- package/web/dist/assets/sidebar-section-CcucfASN.js +0 -1
- package/web/dist/assets/status-dot-Drd4-nfa.js +0 -1
- package/web/dist/assets/task-files-B9okW1TC.js +0 -1
- package/web/dist/assets/task-thread-_2ch8BRt.js +0 -2
- package/web/dist/assets/thread-state-qNczqxZQ.js +0 -4
- package/web/dist/assets/toaster-zMN8cNZQ.js +0 -4
- package/web/dist/assets/use-finish-run-Dvm4JnAH.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-CBJvP-US.js +0 -1
- package/web/dist/assets/use-path-bases-C9yvZF5B.js +0 -1
- package/web/dist/assets/use-workspace-config-save-9jm9qV6u.js +0 -1
- package/web/dist/assets/zoomable-image-BUTgYpld.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,C as i,S as a,T as o,U as s,Vt as c,Wt as l,bt as u,nt as d,un as f,w as p}from"./queries-IlC9MZgh.js";import{p as m}from"./host-context-DDbYAKpm.js";import{B as h,Fi as g,T as _,Yn as v,f as y,n as b,ut as ee,w as x,z as te,zt as ne}from"./toaster-DNnL8v10.js";import{Z as S}from"./live-protocol-CNUmr-VT.js";import{_ as C,g as w}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as T,s as E}from"./dist-CCX8mhHc.js";import{c as re,f as D,i as ie,t as O}from"./reference-chip-BjerVjzM.js";import{D as ae,F as k,I as A,M as oe,N as se,P as ce,Q as le,S as ue,X as de,Z as fe,c as pe,ct as j,d as me,j as he,l as ge,n as _e,st as ve,w as ye,y as be}from"./design-icons-QbNMZniQ.js";import{t as xe}from"./createLucideIcon-BHp8sXmF.js";import{n as Se,t as Ce}from"./circle-x-7nTlobAF.js";import{_ as we}from"./nav-row-styles-CIedRn3A.js";import{i as Te,r as Ee,t as De}from"./git-toolbar-DXnIUFi1.js";import{t as M}from"./info-DA1x_4bz.js";import{t as Oe}from"./loader-circle-CPBhhDbB.js";import{a as ke,i as Ae,n as je,r as Me}from"./diff-controls-CSO8HgZ0.js";import{t as N}from"./button-BV_AiLj2.js";import{i as P,l as Ne,p as Pe,r as Fe,t as Ie}from"./dropdown-menu-NJZfnQCU.js";import{a as Le,i as Re,n as ze,o as Be,r as Ve,s as He,t as Ue}from"./dialog-DKr-j9S6.js";import{t as F}from"./project-router-Dc6KBQsv.js";import{t as We}from"./status-dot-Bmn4xhch.js";import{c as Ge,d as Ke,f as qe,m as I,n as Je,s as Ye,t as Xe}from"./page-shell-BdjH5hyc.js";import{a as Ze,o as Qe}from"./format-BU7D3IfE.js";import{t as $e}from"./control-locations-kCPVEtOM.js";import{t as L}from"./centered-state-N8vWM_Hw.js";import{$t as R,A as z,Bn as et,Bt as tt,Cr as nt,Gt as B,Ht as rt,Jt as it,Kt as at,Pn as ot,Qt as st,Rn as ct,Rt as lt,Tr as V,Ut as ut,Vt as dt,Wt as ft,Xt as pt,Yt as mt,Zt as ht,an as H,en as U,gr as gt,in as W,k as _t,lr as vt,nn as G,on as K,qt as yt,rn as q,tn as J,zn as bt,zt as xt}from"./index-Dp7K74Jw.js";import{t as St}from"./markdown-BBDDg-4t.js";import{t as Ct}from"./diff-DEw-tkVq.js";import{t as wt}from"./change-counts-BLLRvt46.js";import{t as Tt}from"./code-workbench-B0GIezrD.js";import{t as Et}from"./file-text-nGpo7MVd.js";import{i as Dt,n as Ot,r as kt}from"./commit-list-StLehTiQ.js";var Y=e(t(),1);function At(e,t){let n=g(t),r=n.getQueryCache();return Y.useSyncExternalStore(Y.useCallback(e=>r.subscribe(S.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var jt=xe(`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`}]]),Mt=xe(`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`}]]),X=n();function Nt(){let e=m(),t=a(),n=g(),r=At({queryKey:c.repo})>0,i=t.data?.info?t.data:null,o=lt(e,i,`screen`);return(0,X.jsx)(Ke,{route:`repo-git`,density:i?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,X.jsx)(Ge,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:r,onClick:()=>{n.invalidateQueries({queryKey:c.repo}),n.invalidateQueries({queryKey:c.worktrees})},children:(0,X.jsx)(fe,{size:17,"aria-hidden":`true`,className:T(`size-[17px]`,r&&`motion-safe:animate-spin`)})})},children:(0,X.jsxs)(`div`,{"data-slot":`git-screen`,children:[i?.info?(0,X.jsx)(`div`,{className:`mb-[16px]`,children:(0,X.jsx)(dt,{scope:e,repo:i,info:i.info,variant:`screen`},e)}):t.isPending?(0,X.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,X.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,X.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,X.jsx)(xt,{branch:i?.info?.branch??null,counts:o,variant:`screen`})]})})}function Pt(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 Ft({from:e}){let[t,n]=(0,Y.useState)(!1),r=(0,Y.useRef)(null);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Ge,{ref:r,variant:`primary`,"data-action":`new-branch`,disabled:B(m())&&!t,onClick:()=>n(!0),children:[(0,X.jsx)(de,{size:16,"aria-hidden":`true`}),`New branch`]}),t?(0,X.jsx)(It,{from:e,returnFocus:r,onClose:()=>n(!1)}):null]})}function It({from:e,returnFocus:t,onClose:n}){let r=ft(m()),i=B(m()),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(null),l=a.trim(),u=Pt(l),d=u??s;return(0,X.jsx)(Ue,{open:!0,onOpenChange:e=>{!e&&!r.isPending&&n()},children:(0,X.jsx)(Ve,{"data-slot":`new-branch-dialog`,className:`sm:max-w-md`,onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-4`,onSubmit:e=>{e.preventDefault(),!(!l||u||i)&&(c(null),r.mutate(l,{onSuccess:n,onError:e=>c(e.message)}))},children:[(0,X.jsxs)(Be,{children:[(0,X.jsx)(He,{children:`New branch`}),(0,X.jsxs)(Re,{"data-slot":`new-branch-base`,children:[`Create from `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e}),` and switch to it. Switching changes your working tree.`]})]}),(0,X.jsxs)(ze,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,X.jsx)(vt,{id:`new-branch-name`,autoComplete:`off`,spellCheck:!1,placeholder:`new-branch-name`,className:`h-11 bg-background font-mono md:text-base placeholder:text-soft-foreground`,value:a,"aria-invalid":d?!0:void 0,"aria-describedby":d?`new-branch-name-hint`:void 0,onChange:e=>{o(e.target.value),c(null)}}),d?(0,X.jsx)(`p`,{id:`new-branch-name-hint`,"data-slot":u?`branch-name-hint`:`branch-create-refusal`,role:`alert`,className:`text-xs text-danger`,children:d}):null]}),(0,X.jsxs)(Le,{children:[(0,X.jsx)(N,{type:`button`,variant:`outline`,disabled:r.isPending,onClick:n,children:`Cancel`}),(0,X.jsx)(N,{type:`submit`,variant:`primary`,"data-action":`create-branch`,disabled:!l||u!==null||i,children:r.isPending?`Creating…`:`Create`})]})]})})})}function Lt({entry:e}){return e.keptReason?(0,X.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function Rt({repo:e,info:t}){let n=i(),r=new Map((n.data?.branches??[]).map(e=>[e.name,e])),a=n.data?.base??e.baseBranch??t.branch,o=ft(m(),e=>b(e.message,{tone:`danger`})),s=B(m()),[c,l]=(0,Y.useState)(``),u=c.trim().toLowerCase(),d=Gt(e,n.data?.branches),f=u?d.filter(e=>e.toLowerCase().includes(u)):d;return(0,X.jsx)(`section`,{"data-slot":`repo-branches`,className:`min-w-0`,children:(0,X.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(le,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,X.jsx)(vt,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:c,onChange:e=>l(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,X.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:[f.map(e=>{let n=e===t.branch,i=r.get(e);return(0,X.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,X.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-[8px]`,children:[i?.runId?(0,X.jsx)(F,{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,X.jsx)(`span`,{className:T(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),i&&!(n&&i.class===`active`)?(0,X.jsx)(Wt,{entry:i}):null]}),i?(0,X.jsx)(zt,{entry:i,base:a}):null,i?(0,X.jsx)(Lt,{entry:i}):null,e.startsWith(`cez/`)&&!n?null:n?(0,X.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,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto`,disabled:s,onClick:()=>o.mutate(e),children:[(0,X.jsx)(he,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),f.length===0?(0,X.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,c.trim(),`”.`]}):null]})]})})}function zt({entry:e,base:t}){let n=e.pr?.state===`open`||e.pr?.state===`draft`;return(0,X.jsxs)(`span`,{"data-slot":`branch-facts`,className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsxs)(`span`,{"data-slot":`branch-counts`,title:`${Z(e.ahead)} ahead of ${t}, ${Z(e.behind)} behind`,className:`shrink-0 font-mono tabular-nums`,children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,children:[`↑`,e.ahead,` ↓`,e.behind]}),(0,X.jsxs)(`span`,{className:`sr-only`,children:[Z(e.ahead),` ahead of `,t,`, `,Z(e.behind),` behind`]})]}),e.pr?(0,X.jsx)(Vt,{pr:e.pr}):null,n&&e.pr?.checks?(0,X.jsx)(Ht,{checks:e.pr.checks}):null]})}var Z=e=>`${e} commit${e===1?``:`s`}`,Bt={open:{icon:A,className:`border-success/40 text-semantic-green`},draft:{icon:k,className:`border-border text-muted-foreground`},merged:{icon:se,className:`border-merged-strong/35 text-merged-text`},closed:{icon:ce,className:`border-danger/40 text-semantic-red`}};function Vt({pr:e}){let{icon:t,className:n}=Bt[e.state],r=(0,X.jsxs)(`span`,{className:T(`inline-flex h-6 items-center gap-1 rounded-[4px] border px-1.5 text-xs font-medium group-hover:bg-muted`,n),children:[(0,X.jsx)(t,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,X.jsxs)(`span`,{className:`font-mono`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{children:e.state})]}),i=`inline-flex shrink-0 items-center rounded-[4px] max-md:min-h-11 no-hover:min-h-11`;return E(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`branch-pr`,"data-pr-state":e.state,title:`Open pull request #${e.number}`,className:T(i,`group focus-visible:outline-2 focus-visible:outline-ring`),children:r}):(0,X.jsx)(`span`,{"data-slot":`branch-pr`,"data-pr-state":e.state,className:i,children:r})}function Ht({checks:e}){let t=e===`passing`?Se:e===`failing`?Ce:nt;return(0,X.jsxs)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:T(`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,X.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var Ut={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function Wt({entry:e}){return(0,X.jsx)(`span`,{"data-slot":`branch-class`,className:T(`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:Ut[e.class]})}function Gt(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=p(),t=I(),[n,r]=(0,Y.useState)(`unified`),[i,a]=(0,Y.useState)(!0),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(null),d=e.isError&&e.error instanceof v&&e.error.status===409,f=e.data?.files??[],m=(0,Y.useMemo)(()=>Ee(f),[f]),h=(0,Y.useMemo)(()=>f.some(St),[f]),g=t?n:`unified`;return(0,X.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,X.jsx)(`p`,{"data-slot":`changes-loading`,className:`py-6 text-center text-xs text-muted-foreground`,children:`Loading changes…`}):e.isError?(0,X.jsx)(L,{icon:d?(0,X.jsx)(ye,{size:16}):(0,X.jsx)(j,{size:16}),tone:d?`neutral`:`danger`,heading:`h2`,title:d?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):f.length===0?(0,X.jsx)(L,{icon:(0,X.jsx)(ye,{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,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 pb-4 [&_button:not([data-button-size])]:min-h-11`,children:[e.data?(0,X.jsx)(De,{stat:e.data.stat}):null,(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h&&o?(0,X.jsx)(Ae,{}):null,h?(0,X.jsx)(`span`,{className:`max-md:hidden`,children:(0,X.jsx)(ke,{preview:o,onPreviewChange:s})}):null,(0,X.jsx)(Me,{mode:n,wrap:i,onModeChange:r,onWrapChange:a,disabled:h&&o}),(0,X.jsx)(je,{wrap:i,onWrapChange:a,preview:o,onPreviewChange:h?s:void 0,disabled:h&&o})]})]}),(0,X.jsx)(Tt,{className:`gap-5 [--diff-sticky-top:0px] md:gap-0`,treeSlot:`changes-tree-pane`,treeClassName:`overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_2rem)]`,tree:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,X.jsx)(Te,{root:m,selected:c,onSelect:e=>{l(e),u.current?.scrollToPath(e)}})]}),children:(0,X.jsx)(Ct,{files:f,viewRef:u,mode:g,wrap:i,preview:o,loadFileText:e=>Et(()=>_(e)),totals:!1,className:`min-w-0 flex-1`})})]})})}function qt({repo:e,info:t}){let{sha:n}=w(),r=I(),i=e.log,a=(0,Y.useMemo)(()=>st(i),[i]);if(n&&(!r||i.length===0))return(0,X.jsx)(Qt,{sha:n});let o=it(e,t),s=o&&o.behind>0?(0,X.jsx)(Xt,{info:t,tracking:o}):null;if(i.length===0)return(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsx)(`div`,{children:s}):null,(0,X.jsx)(L,{icon:(0,X.jsx)(oe,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]});let c=(0,X.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4`,children:[s,a.map(e=>(0,X.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,X.jsx)(Jt,{commit:e,selected:r&&e.hash===(n??i[0]?.hash),stacked:r},e.hash))})]},e.label))]});return r?(0,X.jsx)(Tt,{className:`flex-none`,treeSlot:`repo-commits-pane`,tree:c,children:(0,X.jsx)(Zt,{sha:n??i[0]?.hash})}):c}function Jt({commit:e,selected:t,stacked:n}){return(0,X.jsxs)(`li`,{"data-selected":t?`true`:void 0,className:T(`flex min-h-[52px] gap-3.5 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,n?`flex-col items-stretch gap-0`:`items-center`,t&&`bg-muted/70`),children:[(0,X.jsxs)(F,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,"aria-current":t?`true`:void 0,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,X.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,X.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(Ot,{sha:e.hash}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,X.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,X.jsx)(`span`,{title:ht(e.when,e.at),children:pt(e.when,e.at)})]})]})]}),(0,X.jsx)(Yt,{source:e.source,stacked:n})]})}function Yt({source:e,stacked:t}){let n=T(`hidden shrink-0 items-center gap-[5px] text-xs text-muted-foreground md:flex`,t?`-mt-1.5 max-w-full self-start px-4 pb-2.5`:`max-w-[45%] pr-4`);return e?(0,X.jsxs)(F,{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:T(n,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(se,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,X.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,X.jsx)(pe,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,X.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:n,children:`no task found`})}function Xt({info:e,tracking:t}){let n=ut(m(),e),r=(0,Y.useRef)(null);return(0,X.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,X.jsx)(jt,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,X.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,X.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,X.jsx)(Oe,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(_e,{"aria-hidden":`true`}),`Pull`]}),(0,X.jsx)(rt,{checkout:n,returnFocus:r})]})}function Zt({sha:e}){return(0,X.jsx)(Dt,{commit:o(e),sha:e,slot:`repo-commit-preview`,loadFileText:t=>Et(()=>x(e,t))})}function Qt({sha:e}){return(0,X.jsx)(kt,{commit:o(e),sha:e,backTo:at,backLabel:`All recent commits`,slot:`repo-commit`,loadFileText:t=>Et(()=>x(e,t))})}var $t=`Squash-merged branches may show as not landed without GitHub`;function en(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 tn(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 nn(){let e=i(),t=d(),n=m(),r=u(),[a,o]=(0,Y.useState)(null);if(e.isPending)return(0,X.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,X.jsx)(L,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=en(e.data.branches),c=s.reduce((e,t)=>e+t.rows.length,0),l=tn(e.data.branches),f=l>0?(0,X.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsx)(M,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,X.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,X.jsx)(F,{to:yt.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,p=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,X.jsxs)(ie,{projectId:n,repoBase:r,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,X.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,X.jsx)(rn,{}),f,s.length===0?(0,X.jsx)(Xe,{icon:(0,X.jsx)(gt,{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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsx)(F,{to:yt.cleanup,children:`Check cleanup`})}),(0,X.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsx)(F,{to:`/`,children:`View tasks`})})]})}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,X.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{children:e.note})]}):null]}),(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,X.jsx)(an,{entry:e,finishedAt:e.runId?p.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,X.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,X.jsx)(M,{"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,X.jsx)(Je,{summary:`${c} ${c===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,X.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsx)(F,{to:yt.cleanup,children:`Open cleanup`})})}):null]})]}),(0,X.jsx)(un,{entry:a,onClose:()=>o(null)})]})}function rn({className:e}){return(0,X.jsxs)(`p`,{"data-slot":`git-no-forge`,className:T(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,X.jsx)(M,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),$t,`.`]})}function an({entry:e,finishedAt:t,onDelete:n}){return(0,X.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,X.jsx)(cn,{entry:e,finishedAt:t}),(0,X.jsx)(on,{entry:e}),(0,X.jsx)(sn,{entry:e,onDelete:n})]})}function on({entry:e}){return(0,X.jsx)(X.Fragment,{children:e.pr?(0,X.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,X.jsx)(O,{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,X.jsx)(ln,{entry:e})]}):null})}function sn({entry:e,onDelete:t}){let n=g(),r=e.class===`orphan`,i=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,a=!r&&e.runId!==null&&!i,o=f({mutationFn:()=>ee(e.runId),onSuccess:e=>{b(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:c.repoBranches}),n.invalidateQueries({queryKey:c.runs.all})},onError:e=>b(e instanceof v&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),[s,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]);let d=()=>void navigator.clipboard.writeText(e.name).then(()=>{b(`Copied ${e.name}`),u.current!==null&&clearTimeout(u.current),l(!0),u.current=setTimeout(()=>l(!1),2e3)},()=>b(`Could not copy the branch name`,{tone:`danger`})),p=`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,X.jsxs)(X.Fragment,{children:[e.runId?(0,X.jsx)(F,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:T(p,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,a?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:o.isPending,onClick:()=>o.mutate(),className:T(p,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(Mt,{"aria-hidden":`true`}),o.isPending?`Creating…`:`Draft PR`]}):null,r?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,"data-copied":s||void 0,"aria-live":`polite`,onClick:d,className:T(p,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[s?(0,X.jsx)(ge,{"aria-hidden":`true`}):(0,X.jsx)(be,{"aria-hidden":`true`}),s?`Copied`:`Copy branch`]}):null,(0,X.jsxs)(Ie,{children:[(0,X.jsx)(Pe,{"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,X.jsx)(ue,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,X.jsxs)(Fe,{align:`end`,className:`w-52`,children:[e.runId?(0,X.jsx)(P,{asChild:!0,className:`md:hidden`,children:(0,X.jsx)(F,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,a?(0,X.jsx)(P,{className:`md:hidden`,disabled:o.isPending,onSelect:()=>o.mutate(),children:`Draft PR`}):null,(0,X.jsx)(P,{className:T(!r&&`md:hidden`),onSelect:d,children:`Copy branch`}),(0,X.jsx)(Ne,{className:`md:hidden`}),(0,X.jsx)(P,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function cn({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=Ze(i),o=e.runStatus?ot(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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,X.jsx)(we,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,X.jsx)(We,{tone:o?.tone??`neutral`,shape:o?.shape??`filled`,"aria-label":o?.label})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,X.jsx)(F,{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,X.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,X.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,X.jsx)(Q,{}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(wt,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{className:`truncate`,title:c,children:s})]}):null]}),e.parentRunId?(0,X.jsx)(F,{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,X.jsx)(Lt,{entry:e})]})]})}function Q(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function ln({entry:e}){let t=l(re(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function un({entry:e,onClose:t}){let n=g(),[r,i]=(0,Y.useState)(``),a=(0,Y.useId)(),o=f({mutationFn:e=>y({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;b(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:c.repo}),s()},onError:e=>b(e.message,{tone:`danger`})}),s=()=>{i(``),t()},l=e!==null&&r.trim()===e.name,u=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,X.jsx)(R,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,X.jsxs)(G,{"data-slot":`delete-branch-dialog`,children:[(0,X.jsxs)(H,{children:[(0,X.jsxs)(K,{children:[`Delete `,e?.name,`?`]}),(0,X.jsx)(q,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,X.jsxs)(X.Fragment,{children:[`This drops the work of `,(0,X.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,X.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[u,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,e?.lastCommit.sha?(0,X.jsxs)(X.Fragment,{children:[` (`,(0,X.jsx)(et,{sha:e.lastCommit.sha,variant:`inline`}),`)`]}):null,`.`]})]})})]}),(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),l&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,X.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,X.jsx)(vt,{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,X.jsxs)(W,{children:[(0,X.jsx)(J,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,X.jsx)(U,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!l||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function dn({base:e}){let t=i(),n=g(),[r,a]=(0,Y.useState)({merged:!1,empty:!1}),[o,s]=(0,Y.useState)(!1),l=(t.data?.branches??[]).filter(e=>e.class===`merged`),u=(t.data?.branches??[]).filter(e=>e.class===`empty`),d=[...l,...u],p=f({mutationFn:e=>y({names:e}),onSuccess:e=>{let t=e.refused.length;b(`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:c.repo})},onError:e=>{n.invalidateQueries({queryKey:c.repo}),b(e.message,{tone:`danger`})}});if(t.isPending)return(0,X.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,X.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let m=d.length,h=`branch${m===1?``:`es`}`;return(0,X.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,m]}),(0,X.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,X.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:m===0||p.isPending,onClick:()=>s(!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,X.jsx)(ve,{"aria-hidden":`true`,className:`size-[12px]`}),p.isPending?`Deleting…`:`Delete ${m} ${h}`]})]}),(0,X.jsx)(fn,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:$t.toLowerCase(),rows:l,open:r.merged,onToggle:()=>a(e=>({...e,merged:!e.merged}))}),(0,X.jsx)(fn,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:u,open:r.empty,onToggle:()=>a(e=>({...e,empty:!e.empty}))}),(0,X.jsx)(R,{open:o,onOpenChange:s,children:(0,X.jsxs)(G,{children:[(0,X.jsxs)(H,{children:[(0,X.jsxs)(K,{children:[`Delete `,m,` `,h,`?`]}),(0,X.jsxs)(q,{children:[l.length,` merged into `,e,` and `,u.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,X.jsxs)(W,{children:[(0,X.jsx)(J,{children:`Keep them`}),(0,X.jsxs)(U,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{p.mutate(d.map(e=>e.name)),s(!1)},children:[`Delete `,m,` `,h]})]})]})})]})}function fn({kind:e,title:t,hint:n,rows:r,open:i,onToggle:a}){let o=`cleanup-branches-${e}`;return(0,X.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":o,disabled:r.length===0,onClick:a,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,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,X.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n})]}),r.length>0?(0,X.jsx)(me,{"aria-hidden":`true`,className:T(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,X.jsx)(`ul`,{id:o,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,X.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,X.jsx)(ct,{value:e.name,className:`shrink-0 text-muted-foreground`}),e.runId?(0,X.jsx)(F,{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,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,X.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,X.jsx)(bt,{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 pn(e){return e.kind===`dirty`?`${e.uncommittedFiles} uncommitted`:e.kind===`detached-head`?`detached HEAD`:e.kind===`submodules`?`has submodules`:`broken worktree`}function mn(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 hn(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 gn(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 _n(e,t){return e===0?`Reclaim now`:t?`Reclaim ${D(t)} now`:`Reclaim ${e} now`}function vn(e,t,n){let r=t?D(t):String(e);return n?`Discard & reclaim all ${r}`:`Discard & reclaim ${r}`}function yn(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 bn(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 xn({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,X.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,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-[12px] leading-[17px] text-foreground`,children:[e.length,` worktree`,a,` past the keep limit`,i?` (${D(i)})`:``,` `,`cannot be reclaimed automatically because `,o,` `,hn(e),`.`]}),(0,X.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,X.jsx)(V,{"aria-hidden":`true`,className:`size-[12px]`}),t]})]})}function Sn({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?vn(o.length,f,m):``;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(R,{open:e,onOpenChange:e=>{e||t()},children:(0,X.jsxs)(G,{children:[(0,X.jsxs)(H,{children:[(0,X.jsx)(K,{children:`Reclaim old worktrees?`}),(0,X.jsxs)(q,{children:[n,` finished worktree`,n===1?``:`s`,` beyond the keep limit`,r?` (${D(r)})`:``,` `,n===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,X.jsxs)(W,{children:[(0,X.jsx)(J,{children:`Keep them`}),(0,X.jsx)(U,{"data-action":`worktrees-confirm`,onClick:a,children:i})]})]})}),(0,X.jsx)(R,{open:o!==null,onOpenChange:e=>{e||s()},children:(0,X.jsxs)(G,{children:[(0,X.jsxs)(H,{children:[(0,X.jsx)(K,{children:`Discard changes and reclaim worktrees?`}),(0,X.jsx)(q,{children:o?(0,X.jsxs)(X.Fragment,{children:[o.length,` finished worktree`,o.length===1?``:`s`,` beyond the keep limit`,f?` (${D(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,X.jsxs)(W,{children:[(0,X.jsx)(J,{children:`Keep them`}),(0,X.jsx)(U,{"data-action":`worktrees-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{o&&c(o),s()},children:h})]})]})}),(0,X.jsx)(R,{open:l!==null,onOpenChange:e=>{e||u()},children:(0,X.jsxs)(G,{children:[(0,X.jsxs)(H,{children:[(0,X.jsx)(K,{children:`Discard changes and reclaim worktree?`}),(0,X.jsx)(q,{children:l?.reclaimBlocker?(0,X.jsxs)(X.Fragment,{children:[l.title,` has `,mn(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,X.jsxs)(W,{children:[(0,X.jsx)(J,{children:`Keep it`}),(0,X.jsx)(U,{"data-action":`worktree-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{l&&d(l),u()},children:`Discard & reclaim`})]})]})})]})}function Cn(){let e=r(),t=s().data?.targets.find(e=>e.id===`finder`),n=f({mutationFn:e=>ne(e,t.id),onError:e=>b(e.message,{tone:`danger`})}),i=g(),[a,o]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,p]=(0,Y.useState)(null),m=()=>Promise.all([i.invalidateQueries({queryKey:c.worktrees}),i.invalidateQueries({queryKey:c.repoBranches})]),_=f({mutationFn:({runIds:e})=>h(e?{discardWork:!0,runIds:e}:void 0),onSuccess:(e,{expected:t,runIds:n})=>{m(),b(gn(e.reclaimed.length,t,!!n))},onError:e=>b(e.message,{tone:`danger`})}),v=f({mutationFn:({worktree:e,discardWork:t})=>te(e.runId,t?{discardWork:!0}:void 0),onSuccess:(e,{worktree:t})=>{m(),b(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{m(),b(e.message,{tone:`danger`})}});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:y,totalBytes:ee,keep:x}=e.data,S=_.isPending||v.isPending,C=y.filter(e=>e.pastKeep),w=C.filter(e=>!e.reclaimBlocker),T=C.filter(e=>e.reclaimBlocker!==null),E=w.length>0,re=$(w),ie=$(C),O=_n(w.length,re),ae=vn(C.length,ie,E),k=ee?D(ee):null,A=bn(x);return(0,X.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,k?` · ${k}`:``]}),(0,X.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-xs leading-[17px] text-soft-foreground`,children:[A.prefix,(0,X.jsx)(F,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:$e(`worktrees`,` › `)}),A.suffix,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:S||!E,title:yn(E,T.length),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,X.jsx)(V,{"aria-hidden":`true`,className:`size-[12px]`}),O]})]}),T.length>0?(0,X.jsx)(xn,{blocked:T,discardLabel:ae,disabled:S,onDiscard:()=>u(C)}):null,y.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:y.map(e=>(0,X.jsx)(En,{worktree:e,keep:x,disabled:S,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>{e.reclaimBlocker?p(e):v.mutate({worktree:e,discardWork:!1})}},e.runId))}),(0,X.jsx)(Sn,{confirmClean:a,onCloseClean:()=>o(!1),cleanCount:w.length,cleanBytes:re,reclaimLabel:O,onConfirmClean:()=>{_.mutate({expected:w.length}),o(!1)},discardBatch:l,onCloseDiscardBatch:()=>u(null),onConfirmDiscardBatch:e=>{_.mutate({expected:e.length,runIds:e.map(e=>e.runId)})},discardRow:d,onCloseRow:()=>p(null),onConfirmRow:e=>v.mutate({worktree:e,discardWork:!0})})]})}var wn=new Set([`queued`,`running`,`waiting`,`review`]);function Tn(e,t){return wn.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`,state:`in-use`}:e.reclaimBlocker?{label:pn(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 En({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:a}){let o=Tn(e,t),s=Ze(e.finishedAt??void 0),c=e.status===`review`?`at review`:s?`${e.status} ${Qe(s)}`:e.status,l=o.tone===`in-use`?`text-status-running`:o.tone===`blocked`?`text-danger`:`text-soft-foreground`,u=e.reclaimBlocker?`Cannot auto-reclaim: ${mn(e.reclaimBlocker)}`:void 0,d=(0,X.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":o.state,title:u,className:T(`text-xs`,l),children:o.label}),f=`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`,p=e.reclaimBlocker?`Discard changes and reclaim the worktree of ${e.title} (branch kept)`:`Reclaim the worktree of ${e.title} (branch kept)`,m=e.reclaimBlocker?`Discard changes and reclaim the directory (branch kept)`:`Reclaim the directory (branch kept)`;return(0,X.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,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,X.jsxs)(`span`,{className:`truncate font-mono text-xs text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,c,(0,X.jsxs)(`span`,{className:`md:hidden`,children:[` · `,o.label]})]})]}),(0,X.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:D(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:d}),r?(0,X.jsx)(`button`,{type:`button`,className:f,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-[13px]`})}):null,o.tone===`in-use`?null:(0,X.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":p,title:m,disabled:n,onClick:a,className:T(f,e.reclaimBlocker&&`text-danger hover:text-danger`),children:(0,X.jsx)(V,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function Dn(e){return e===`main`||e===`changes`?`Split`:`Table`}function On({section:e,index:t=!1}){let n=a(),r=I(),[i]=C(),o=Dn(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,X.jsx)(Nt,{});if(n.isPending)return(0,X.jsx)(_t,{});if(n.isError)return(0,X.jsx)(Ye,{template:o,route:`repo-git`,density:`empty`,beforeHeader:(0,X.jsx)(z,{}),children:(0,X.jsx)(L,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let s=n.data.info;return s?(0,X.jsx)(kn,{repo:n.data,info:s,section:e}):(0,X.jsx)(Ye,{template:o,route:`repo-git`,density:`empty`,beforeHeader:(0,X.jsx)(z,{}),children:(0,X.jsx)(L,{icon:(0,X.jsx)(he,{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 kn({repo:e,info:t,section:n}){let r=Dn(n),a=i(),o=An(n),s=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?Gt(e,a.data?.branches).length:n===`not-landed`?a.data?.branches.filter(e=>e.class===`not-landed`||e.class===`orphan`).length??0:4;return(0,X.jsx)(Ye,{template:r,route:`repo-git`,density:n===`not-landed`&&a.isPending?`full`:qe(s),rootProps:{"data-git-section":n},beforeHeader:(0,X.jsx)(z,{}),header:{title:o?.title??tt(n,t.branch),headerSlot:`repo-header`,subtitle:o?(0,X.jsxs)(X.Fragment,{children:[`Commit `,o.shortSha,` on `,t.branch]}):(0,X.jsx)(jn,{repo:e,info:t,section:n}),subtitleSlot:`repo-meta`,...n===`branches`?{primaryAction:(0,X.jsx)(Ft,{from:t.branch})}:{}},children:n===`main`?(0,X.jsx)(qt,{repo:e,info:t}):n===`not-landed`?(0,X.jsx)(nn,{}):n===`cleanup`?(0,X.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,X.jsx)(Cn,{}),(0,X.jsx)(dn,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,X.jsx)(Rt,{repo:e,info:t}):(0,X.jsx)(Kt,{})})}function An(e){let{sha:t}=w(),n=I(),r=e===`main`&&!n?t:void 0,i=o(r);if(!r)return;let a=r.slice(0,8);return{title:i.data?.subject??`Commit ${a}`,shortSha:a}}function jn({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,X.jsxs)(X.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?` · ${mt(e.tracking)}`:``]});case`not-landed`:return(0,X.jsxs)(X.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,X.jsx)(Mn,{repo:e,info:t});case`changes`:return(0,X.jsxs)(X.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,X.jsxs)(X.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function Mn({repo:e,info:t}){let n=Gt(e,i().data?.branches).length;return(0,X.jsxs)(X.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{On as RepoGitRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,z as i}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,z as i}from"./queries-IlC9MZgh.js";import{Yn as a,it as o}from"./toaster-DNnL8v10.js";import{_ as s,g as c,i as l,m as u,n as d,p as f}from"./chunk-KS7C4IRE-BdLLx37K.js";import{ct as p,r as m}from"./design-icons-QbNMZniQ.js";import{a as h,c as g,l as _,s as v,t as y}from"./file-preview-_4nAs_Ai.js";import{t as b}from"./button-BV_AiLj2.js";import{t as x}from"./centered-state-N8vWM_Hw.js";import{r as S}from"./html-report-BX3msvci.js";import{_ as C,g as w,v as T,zn as E}from"./index-Dp7K74Jw.js";import{t as D}from"./html-report-frame-Bk6UkqKa.js";var O=e(t(),1),k=n();function A(){let e=f(),t=u();return()=>{if(e.key==="default"||window.history.state?.idx===0){t({pathname:e.pathname.replace(/\/report\/?$/,``)},{replace:!0});return}let n=window.navigation,r=j(e.state);n?.canGoBack?n.back():r?t(r,{state:{filesRestoreKey:e.state?.filesRestoreKey}}):t(-1)}}function j(e){let t=e?.readerFrom;return typeof t==`string`&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}function M(e){return e?.type===`file`?e:null}function N(){let[e]=s(),t=e.get(`path`),n=e.get(`artifact`);return{path:t,artifactId:n,conflict:e.getAll(`path`).length>1||e.getAll(`artifact`).length>1||t!==null&&n!==null||t===``||n===``}}function P(){let{id:e=``}=c(),t=N(),n=f(),r=A();return(0,k.jsx)(F,{runId:e,selection:t,fragment:n.hash,onBack:r,variant:`route`})}function F({runId:e,selection:t,fragment:n,onBack:r,variant:i,sourceLookup:a}){let{path:o,conflict:s,selected:c,result:u}=L(e,t,a),d=T(w,!0),p=T(C,!1),m=f(),[h,g]=(0,O.useState)(!1),_=M(u.data);if(i===`route`&&R(_))return(0,k.jsx)(l,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=B(_,o),y=i===`pane`&&!p&&!d?`Conversation`:`Back`,b=i===`pane`&&!h&&z(_),x=I(m.pathname,e,t);return(0,k.jsxs)(`div`,{"data-route":`task-report`,"data-variant":i,onKeyDown:e=>{i!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),r())},className:i===`route`?`fixed inset-0 z-50 flex flex-col bg-background [padding-block-start:env(safe-area-inset-top)] [padding-inline-end:env(safe-area-inset-right)] [padding-block-end:env(safe-area-inset-bottom)] [padding-inline-start:env(safe-area-inset-left)] md:static md:z-auto md:h-full md:p-0`:`flex h-full min-h-0 flex-col bg-background max-md:[padding-block-start:env(safe-area-inset-top)] max-md:[padding-inline-start:env(safe-area-inset-left)] max-md:[padding-inline-end:env(safe-area-inset-right)]`,children:[(0,k.jsx)(V,{runId:e,file:_,name:v,source:h,onSource:()=>g(e=>!e),onBack:r,backLabel:y,hideDownload:i===`pane`&&p,focusBack:i===`pane`}),(0,k.jsx)(`div`,{"data-slot":`report-body`,className:b?`flex min-h-0 flex-1 flex-col overflow-clip`:`flex min-h-0 flex-1 flex-col overflow-auto`,children:(0,k.jsx)(H,{conflict:s,selected:c,result:u,source:h,name:v,fragment:n,pane:i===`pane`,filesHref:x})})]})}function I(e,t,n){let r=/^\/p\/[^/]+/.exec(e)?.[0]??``,i=n.artifactId?new URLSearchParams({artifact:n.artifactId}):new URLSearchParams({path:n.path??``});return`${r}/tasks/${encodeURIComponent(t)}/files?${i}`}function L(e,t,n){let{path:a=null,artifactId:o=null,conflict:s=!1}=t,c=n?.isPending||n?.isError,l=i(e,o||s||c?null:a),u=r(e,s||c?null:o),d=c&&n?{...n,data:void 0}:o?u:l;return{path:a,conflict:s,selected:a!==null||o!==null,result:d}}function R(e){return e!==null&&(!S(e.path)||!e.artifact&&(e.tooLarge||e.binary))}function z(e){return e!==null&&!e.tooLarge&&!e.binary}function B(e,t){return e?e.artifact?.name??e.path.split(/[\\/]/).at(-1)??e.path:t??`Report`}function V({runId:e,file:t,name:n,source:r,onSource:i,onBack:a,backLabel:s,hideDownload:c,focusBack:l}){let u=(0,O.useRef)(null);(0,O.useEffect)(()=>{l&&u.current?.focus({preventScroll:!0})},[l]);let d=t?.artifact;return(0,k.jsxs)(`header`,{"data-slot":`report-bar`,className:`flex min-h-14 shrink-0 items-center gap-2 border-b border-border bg-card px-2 md:px-4`,children:[(0,k.jsxs)(b,{ref:u,variant:`ghost`,className:`gap-1.5 px-2`,onClick:a,"aria-label":s,children:[(0,k.jsx)(m,{size:18,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`max-sm:sr-only`,children:s})]}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`h1`,{className:`truncate text-sm font-medium`,children:n}),t?(0,k.jsxs)(`p`,{className:`truncate text-xs text-soft-foreground`,children:[d?(0,k.jsxs)(k.Fragment,{children:[`Published snapshot · `,(0,k.jsx)(E,{iso:d.createdAt})]}):`Live file`,` · `,h(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,k.jsx)(b,{variant:`ghost`,className:`px-3 text-accent-text`,onClick:i,children:r?`Preview`:`Source`}):null,d&&!c?(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline focus-visible:ring-2`,href:o(e,d.id,`download`),children:`Download`}):null]})}function H({conflict:e,selected:t,result:n,source:r,name:i,fragment:a,pane:o,filesHref:s}){if(e)return(0,k.jsx)(W,{icon:(0,k.jsx)(v,{}),title:`Invalid report link`,subtitle:`Choose either a path or a published artifact.`});if(!t)return(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`No report selected`,subtitle:`Open a report from a link in the conversation or from Files.`});if(n.isPending)return(0,k.jsx)(`p`,{role:`status`,"data-slot":`report-loading`,className:`px-4 py-6 text-center text-sm text-soft-foreground`,children:`Loading report…`});if(n.isError)return(0,k.jsx)(U,{result:n});let c=n.data;return c.type===`file`?o&&!S(c.path)?(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`Not an HTML report`,subtitle:`Open this published file in Files.`,action:(0,k.jsx)(d,{to:s,className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Open in Files`})}):c.tooLarge?(0,k.jsx)(W,{icon:(0,k.jsx)(_,{}),title:`Too large to preview`,subtitle:`${h(c.size)} is past the 500 kB preview limit. Download it to read it.`}):c.binary?(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`Binary file`,subtitle:`This file holds binary data, not readable HTML.`}):r?(0,k.jsx)(`div`,{className:`bg-card`,children:(0,k.jsx)(y,{path:c.path,text:c.content??``})}):(0,k.jsx)(D,{html:c.content??``,title:`Report: ${i}`,fragment:a,className:o?`min-h-0 flex-1`:`min-h-[60dvh] flex-1`}):(0,k.jsx)(W,{icon:(0,k.jsx)(v,{}),title:c.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:c.reason})}function U({result:e}){let t=e.error instanceof a&&e.error.status===404;return(0,k.jsx)(W,{icon:t?(0,k.jsx)(v,{}):(0,k.jsx)(p,{size:16}),tone:t?`neutral`:`danger`,title:t?`Report missing or deleted`:`Could not load this report`,subtitle:e.error?.message??`Try again.`,action:(0,k.jsx)(b,{variant:`outline`,onClick:()=>void e.refetch(),children:`Retry`})})}function W({icon:e,title:t,subtitle:n,tone:r=`neutral`,action:i}){return(0,k.jsxs)(`div`,{"data-slot":`report-state`,className:`flex flex-col items-center gap-3 p-6`,children:[(0,k.jsx)(x,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{F as ReportReader,P as TaskReportRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{sn as r}from"./queries-IlC9MZgh.js";import{m as i,p as a}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o}from"./dist-CCX8mhHc.js";import{mt as s}from"./design-icons-QbNMZniQ.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CyFJ-9Ex.js";import{t as g}from"./use-search-params-writer-DD5PEEZw.js";var _=e(t(),1),v=n();function y({...e}){return(0,v.jsx)(h,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-trigger`,...e})}function x({...e}){return(0,v.jsx)(d,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,v.jsx)(f,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,v.jsx)(c,{"data-slot":`sheet-overlay`,className:o(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function w({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,v.jsxs)(S,{children:[(0,v.jsx)(C,{className:i}),(0,v.jsxs)(p,{"data-slot":`sheet-content`,className:o(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,v.jsxs)(d,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,v.jsx)(s,{className:`size-4`}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function T({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-1.5 p-4`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:o(`font-semibold text-foreground`,e),...t})}function D({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function O(e){let[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{if(r())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var k=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function A(e){let t=e.get(`report`);return!t||!k.test(t)||e.getAll(`report`).length!==1||e.getAll(`card`).length>1?null:{artifactId:t,card:e.get(`card`)||null}}var j=(0,_.createContext)(null);function M(e){let t=a(),n=i(),[r,o]=g(),s=A(r),[c,l]=(0,_.useState)(()=>({runId:e,entries:new Map}));c.runId!==e&&l({runId:e,entries:new Map});let u=(0,_.useCallback)((t,n)=>(l(r=>{if(r.runId===e&&r.entries.get(t)===n)return r;let i=new Map(r.runId===e?r.entries:[]);return i.set(t,n),{runId:e,entries:i}}),()=>void 0),[e]),d=(0,_.useRef)({runId:e,callbacks:new Map});d.current.runId!==e&&(d.current={runId:e,callbacks:new Map});let f=(0,_.useCallback)((e,t)=>(d.current.callbacks.set(e,t),()=>{d.current.callbacks.get(e)===t&&d.current.callbacks.delete(e)}),[]),p=(0,_.useMemo)(()=>({register:u,registerOpener:f}),[u,f]),m=(0,_.useRef)(null);return(0,_.useEffect)(()=>{r.has(`report`)&&!s&&o(e=>(e.delete(`report`),e.delete(`card`),e))},[r,s,o]),(0,_.useEffect)(()=>{let n=m.current;!s&&n&&n.runId===e&&n.card&&d.current.callbacks.get(n.card)?.(n.artifactId,n.scrollTop),m.current=s?{...s,runId:e,scrollTop:t.state?.reportScrollTop}:null},[e,s,t.state]),{selection:s,sourceRunId:c.runId===e&&s?c.entries.get(s.artifactId)??(s.card?void 0:e):void 0,registry:p,close:()=>{let e=t.state,r=window.navigation;if(e?.reportReturnKey&&r){r.traverseTo(e.reportReturnKey);return}if(e?.reportReturnTo){n(e.reportReturnTo,{replace:!0});return}o(e=>(e.delete(`report`),e.delete(`card`),e))}}}export{x as a,T as c,y as i,E as l,M as n,w as o,O as r,D as s,j as t,b as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Lt as r,M as i,st as a,vt as o}from"./queries-IlC9MZgh.js";import{p as s}from"./host-context-DDbYAKpm.js";import{Ci as c,Er as l,Fi as u,Ni as d,Xn as f,Zn as p,_i as m,er as h,wr as g}from"./toaster-DNnL8v10.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-CNUmr-VT.js";import{h as T,p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as D}from"./dist-CCX8mhHc.js";import{Q as O}from"./design-icons-QbNMZniQ.js";import{t as ee}from"./arrow-up-right-DKGzsMqY.js";import{t as te}from"./chevron-right-BENZ-1ZN.js";import{t as k}from"./eye-B8okNWXU.js";import{t as A}from"./button-BV_AiLj2.js";import{t as j}from"./project-router-Dc6KBQsv.js";import{f as M,i as N,n as ne,r as re,t as P,u as F}from"./page-shell-BdjH5hyc.js";import{t as I}from"./use-search-params-writer-DD5PEEZw.js";import{Tn as L,j as R,lr as z,qn as B,vr as V,zn as H}from"./index-Dp7K74Jw.js";import{t as U}from"./report-title-D4Mbu2Er.js";import{t as W}from"./html-report-frame-Bk6UkqKa.js";var G=e(t(),1),K=1e3,q=S().min(1).max(1024);_({q:S().max(K).optional(),before:q.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var J=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:m}).strict()),nextCursor:q.nullable(),total:w().int().nonnegative()}).strict(),Y=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),ie=_({runId:b(),taskTitle:S(),taskStatus:m}).strict(),ae=v(`type`,[Y.extend({type:y(`snapshot`)}),Y.extend({type:y(`content`)}),Y.extend({type:y(`metadata`),runs:x(ie)})]),X=new WeakMap;function oe(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var se=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=oe(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function ce(e,t){let n=X.get(e);n||(n=new Map,X.set(e,n));let r=n.get(t);return r||(r=new se(e,t),n.set(t,r)),r}async function le(e,t){let n=await f.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},p({signal:t}));return Y.parse(await h(n,`/reports/state`))}function ue(e){let t=ce(u(),e);return(0,G.useEffect)(()=>{let n=r(`reports:project:${e}`,e=>{let n=ae.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),i,o,s=()=>{if(g()===`finite`&&!i){o=new AbortController;let n=o.signal;le(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),i=a({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=Y.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else g()!==`finite`&&(o?.abort(),i?.(),i=void 0)};s();let c=l(s);return()=>{c(),o?.abort(),i?.(),n()}},[t,e]),t}async function de(e,t,n,r){let i=await f.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,K),...n?{before:n}:{}}},p(r?{signal:r}:void 0));return J.parse(await h(i,`/reports`))}function fe(e){let t=s(),n=ue(t);return c({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>de(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Z=n(),Q=new Map,$={title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`};function pe(){let e=B(),t=o();return e===`unknown`?(0,Z.jsx)(F,{route:`reports`,density:`full`,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsx)(`div`,{"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:t.isError&&!t.isFetching?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.error instanceof Error?t.error.message:`Could not reach the server`}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})})}):e===`absent`?(0,Z.jsx)(R,{}):(0,Z.jsx)(me,{})}function me(){let e=E(),t=T(),[n,r]=I(),i=(n.get(`q`)??``).slice(0,K),a=fe(i),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(``),l=e.pathname+e.search,u=a.data?.pages.flatMap(e=>e.reports)??[],d=e=>{Q.set(l,{scroll:s.current?.scrollTop??0,row:e,pages:a.data?.pages.length??1})},[f,p]=(0,G.useState)(null),m=N(o);(0,G.useLayoutEffect)(()=>{if(!a.data||c.current===l)return;let n=Q.get(l),r=e.state?.filesRestoreKey===l;if(!n||!s.current||t!==`POP`&&!r){c.current=l;return}let i=s.current.querySelector(`[data-report-id="${n.row}"]`);if(a.isFetchNextPageError){c.current=l,s.current.scrollTop=0;return}if((!i||a.data.pages.length<n.pages)&&a.hasNextPage){a.isFetchingNextPage||a.fetchNextPage();return}c.current=l,s.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[l,a.data,a.hasNextPage,a.isFetchingNextPage,a.isFetchNextPageError,a.fetchNextPage,e.state,t]);let h=t=>r(n=>(t?n.set(`q`,t.slice(0,K)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),g=u.find(e=>e.id===f)??u[0]??null,_=a.isPending?`full`:M(u.length);return(0,Z.jsx)(F,{route:`reports`,density:_,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsxs)(`div`,{ref:o,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Z.jsx)(O,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(z,{maxLength:K,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:i,onChange:e=>h(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),a.isPending?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):a.isError&&u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.error.message}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void a.refetch(),children:`Retry`})]})}):u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(P,{icon:(0,Z.jsx)(V,{}),title:i?`No matching reports`:`No published reports yet`,description:i?`Try a different keyword or clear the search filter.`:(0,Z.jsxs)(Z.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Z.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[L(),` artifact publish`]}),` `,`to list it here.`]}),actions:i?(0,Z.jsx)(A,{"data-slot":`reports-clear-search`,variant:`outline`,onClick:()=>h(``),children:`Clear search`}):(0,Z.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(j,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(re,{list:(0,Z.jsxs)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:u.map(e=>{let t=g?.id===e.id;return(0,Z.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":m&&t?`true`:void 0,className:D(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,m&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Z.jsx)(V,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Z.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:U(e),children:(0,Z.jsx)(j,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:l,filesRestoreKey:l},onClick:()=>d(e.id),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:U(e)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Z.jsx)(j,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsx)(H,{className:`shrink-0`,iso:e.createdAt,prefix:`Published · `})]})]}),m?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${U(e)}`,"aria-pressed":t,onClick:()=>p(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Z.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(te,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),a.hasNextPage?(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(A,{variant:`outline`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:`Load more reports`})}):null,_===`sparse`?(0,Z.jsx)(ne,{summary:`${u.length} published ${u.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:m&&g?(0,Z.jsx)(he,{report:g,restoreKey:l,onOpenReader:()=>d(g.id)}):null})]})})}function he({report:e,restoreKey:t,onOpenReader:n}){let r=(0,G.useContext)(d)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${U(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:U(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,(0,Z.jsx)(H,{iso:e.createdAt,prefix:`Published · `})]})]}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`shrink-0 py-1.5`,children:(0,Z.jsxs)(j,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Z.jsx)(ge,{report:e}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function ge({report:e}){let t=i(e.runId,e.id);if(t.isPending)return(0,Z.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Z.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Z.jsx)(W,{html:n.content,title:U(e),className:`min-h-0 flex-1`})}export{pe as ReportsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Ft as t}from"./queries-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Ft as t}from"./queries-IlC9MZgh.js";import{n}from"./chunk-KS7C4IRE-BdLLx37K.js";import{A as r}from"./design-icons-QbNMZniQ.js";import{t as i}from"./switch-B9OfOEzC.js";import{t as a}from"./centered-state-N8vWM_Hw.js";import{t as o}from"./option-select-Bmm4ktgQ.js";import{n as s}from"./save-cue-CpHgT93o.js";import{n as c,t as l}from"./settings-field-AyinSFR_.js";import{t as u}from"./use-workspace-config-save-DScW6_8J.js";import{r as d}from"./settings-save-bar-Dd3bTznK.js";import{n as f}from"./saved-draft-BwzBc-_Y.js";var p=e(),m=1,h=16,g=16,_=1,v=60,y=5,b=256;function x(){let e=t();return e.isPending?(0,p.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,p.jsx)(a,{icon:(0,p.jsx)(r,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,p.jsx)(S,{config:e.data})}function S({config:e}){let t=u(),n=s(),r=s(),a=s(),o=s(),l=s(),m=(e,n)=>t.mutate(e,{onSuccess:n}),h=e.resources.monitoringWakeIntervalMinutes??null,g=h===null?`park`:`interval`,[x,S]=f(String(h??y)),D=Number(x),O=!Number.isInteger(D)||D<_||D>v,k=g===`interval`&&O,j=e=>m({resources:{monitoringWakeIntervalMinutes:e===`park`?null:y}},()=>{S(String(y)),a.flash()});d({dirty:h!==null&&x!==String(h),invalid:O,busy:t.isPending,save:()=>t.mutateAsync({resources:{monitoringWakeIntervalMinutes:D}}),discard:()=>S(String(h??y))});let M=e.resources.autoResumeOnUsageLimit??!0,N=e=>m({resources:{autoResumeOnUsageLimit:e}},o.flash),P=e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``,[F,I]=f(P),L=F.trim()===``?0:Number(F),R=F.trim()!==``&&(!Number.isInteger(L)||L<b);d({dirty:(e.resources.memoryLimitMb??0)!==(R?-1:L),invalid:R,busy:t.isPending,save:()=>t.mutateAsync({resources:{memoryLimitMb:L===0?null:L}}),discard:()=>I(P)});let z=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,p.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,p.jsx)(C,{maxParallel:e.resources.maxParallel,onSelect:e=>m({resources:{maxParallel:e}},n.flash),disabled:t.isPending,saved:n.saved}),(0,p.jsx)(w,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>m({resources:{maxMonitoringSessions:e}},r.flash),disabled:t.isPending,saved:r.saved}),(0,p.jsx)(T,{wakeMode:g,setWakeMode:j,wakeInterval:x,setWakeInterval:S,showInvalid:k,saved:a.saved,saveIsPending:t.isPending}),(0,p.jsx)(c,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,saved:o.saved,children:(0,p.jsx)(i,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:t.isPending,onCheckedChange:N})}),(0,p.jsx)(E,{memory:F,setMemory:I,memoryInvalid:R,saveIsPending:t.isPending}),(0,p.jsx)(A,{composerDefaults:z,saveComposerDefault:(e,t)=>m({composerDefaults:{[e]:t===`inherit`?null:t===`on`}},l.flash),saveIsPending:t.isPending,saved:l.saved})]})}function C({maxParallel:e,onSelect:t,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:r,onValueChange:e=>t(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(m,h)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,p.jsx)(n,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function w({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onValueChange:e=>n(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(0,g)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function T({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:a,saved:o,saveIsPending:s}){return(0,p.jsxs)(c,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,saved:o,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(i,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${l}`,children:`Wake interval`}),(0,p.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:_,max:v,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null]}),a?(0,p.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function E({memory:e,setMemory:t,memoryInvalid:n,saveIsPending:r}){return(0,p.jsxs)(c,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:b,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:r,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`})]}),n?(0,p.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,b,` MiB, or leave empty for no limit.`]}):null]})}var D=[{value:`inherit`,label:`Inherit environment`},{value:`on`,label:`On`},{value:`off`,label:`Off`}];function O(e,t){return Array.from({length:t-e+1},(t,n)=>({value:String(e+n),label:String(e+n)}))}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n,saved:r}){return(0,p.jsxs)(c,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,saved:r,children:[(0,p.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Autonomous by default`}),(0,p.jsx)(o,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onValueChange:e=>t(`autonomous`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Use a worktree by default`}),(0,p.jsx)(o,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onValueChange:e=>t(`worktree`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{x as ResourcesSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Cn as n}from"./index-Dp7K74Jw.js";var r=e(t(),1),i={open:!1,notes:``},a=new Map,o=new Set,s=null;function c(){let e=[...a.values()].some(e=>e.notes.trim()!==``);e&&s===null&&(s=n()),!e&&s!==null&&(s(),s=null);for(let e of o)e()}function l(e){return o.add(e),()=>{o.delete(e)}}function u(e){return a.get(e)??i}function d(e,t){let n={...u(e),...t};!n.open&&n.notes===``?a.delete(e):a.set(e,n),c()}function f(e){a.delete(e)&&c()}function p(e){let t=(0,r.useSyncExternalStore)(l,()=>u(e)),n=(0,r.useCallback)(t=>d(e,t),[e]),i=(0,r.useCallback)(()=>f(e),[e]);return{...t,update:n,clear:i}}export{d as n,p as r,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./review-strip-
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./review-strip-BE71YjB6.js";import{t as a}from"./eye-B8okNWXU.js";import{n as o}from"./centered-state-N8vWM_Hw.js";import{t as s}from"./run-diff-ClfLRsHF.js";var c=e({AcceptCelebration:()=>h,ReviewGateBanner:()=>d,ReviewPanel:()=>f,prefersReducedMotion:()=>p}),l=t(n(),1),u=r();function d({run:e,projectId:t,onResolved:n}){return(0,u.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-xl border border-info/35 bg-info/10 px-3.5 py-2.5`,children:[(0,u.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,u.jsx)(a,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,u.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,u.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,u.jsx)(`span`,{className:`block text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,u.jsx)(i,{run:e,projectId:t,onResolved:n})]})}function f({run:e,projectId:t,onResolved:n,showDiff:r=!0}){return(0,u.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,u.jsx)(d,{run:e,projectId:t,onResolved:n}),r?(0,u.jsx)(s,{runId:e.id,projectId:t}):null]})}function p(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var m=1500;function h({status:e}){let t=(0,l.useRef)(e),[n,r]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||p())return;r(!0);let i=setTimeout(()=>r(!1),m);return()=>clearTimeout(i)},[e]),n?(0,u.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,u.jsx)(o,{}),(0,u.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,u.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}export{c as n,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Vt as i,ct as a,ln as o,un as s}from"./queries-IlC9MZgh.js";import{Fi as c,Yn as l,ct as u,n as d,ut as f}from"./toaster-DNnL8v10.js";import{n as p}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as m,s as h}from"./dist-CCX8mhHc.js";import{I as g,l as _,y as v}from"./design-icons-QbNMZniQ.js";import{t as y}from"./createLucideIcon-BHp8sXmF.js";import{t as b}from"./external-link-BE6y205O.js";import{t as x}from"./eye-B8okNWXU.js";import{t as S}from"./button-BV_AiLj2.js";import{t as C}from"./project-router-Dc6KBQsv.js";import{Ln as w,fn as T,rt as E,y as D}from"./index-Dp7K74Jw.js";import{t as O}from"./textarea-BGp28xFr.js";import{n as k,t as A}from"./use-finish-run-CFEVvqeg.js";import{r as j,t as M}from"./review-notes-drafts-BjXqp0gY.js";var N=y(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),P=e({ReviewActions:()=>R,ReviewStrip:()=>L}),F=t(n(),1),I=r();function L({run:e,projectId:t}){let n=D(e);return(0,I.jsx)(`section`,{"data-slot":`review-strip`,"aria-label":`Review the changes`,className:`sticky bottom-0 z-20 shrink-0 border-t border-info/35 bg-background`,children:(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 bg-info/10 px-4 py-2 md:flex-row md:items-start md:gap-4 md:px-9`,children:[(0,I.jsxs)(`p`,{"data-slot":`review-evidence`,className:`flex min-h-11 min-w-0 shrink-0 items-center gap-2 text-xs text-muted-foreground max-md:hidden`,children:[(0,I.jsx)(x,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Needs review`}),n.diff?(0,I.jsxs)(`span`,{"data-slot":`review-evidence-diff`,className:`flex items-center gap-1.5`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),n.diff.files,` `,n.diff.files===1?`file`:`files`,(0,I.jsx)(w,{stat:n.diff})]}):null,n.checks?(0,I.jsxs)(`span`,{"data-slot":`review-evidence-checks`,className:m(`flex items-center gap-1.5`,n.checks.failed&&`font-medium text-semantic-red`),children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),n.checks.label]}):null]}),(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(R,{run:e,projectId:t,reviewLink:!1})})]})})}function R({run:e,projectId:t,onResolved:n,reviewLink:r=!0}){let m=a(),v=c(),y=(0,F.useRef)(null),w=j(e.id),{notes:D,open:P,clear:L}=w,R=e=>w.update({notes:e}),[B,V]=(0,F.useState)(null),[H,U]=(0,F.useState)(null),W=A(e.id,{projectId:t,onSuccess:()=>{L(),n?.()}}),G=k(e,null,t),K=()=>v.invalidateQueries({queryKey:i.runs.all}),q=s({mutationFn:async n=>G.canContinue?u(o(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:G.runnerOverride}):null,onMutate:()=>o(e.id,{projectId:t}),onSuccess:(t,r,i)=>{t!==null&&(M(e.id).notes.trim()===r&&L(),m.invalidateAfter(`continue`,i),n?.())},onError:e=>d(e.message,{tone:`danger`})}),J=s({mutationFn:()=>f(e.id,t),onSuccess:e=>{d(`Draft PR created — ${e.url}`),L(),K(),n?.()},onError:e=>{e instanceof l&&e.manual!==void 0&&U(e.manual),d(e.message,{tone:`danger`})}}),Y=()=>{if(!P){w.update({open:!0}),requestAnimationFrame(()=>y.current?.focus());return}let e=D.trim();if(e.length===0){V(`Write what to change first.`),y.current?.focus();return}V(null),q.mutate(e)};return(0,I.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[G.canContinue?null:(0,I.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,I.jsx)(`span`,{children:G.reason}),G.providerPending?null:(0,I.jsx)(C,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button:not([data-button-size])]:min-h-11 [&_a:not([data-button-size])]:min-h-11`,children:[r?(0,I.jsx)(S,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,I.jsxs)(p,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,I.jsx)(x,{"aria-hidden":`true`}),`Review changes`]}):(0,I.jsxs)(C,{to:`/tasks/${e.id}/changes`,children:[(0,I.jsx)(x,{"aria-hidden":`true`}),`Review changes`]})}):null,(0,I.jsxs)(S,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:G.reason??(P?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":G.canContinue?void 0:`review-provider-guidance`,"aria-expanded":P,"aria-controls":P?`review-notes`:void 0,disabled:q.isPending||!G.canContinue,onClick:Y,children:[(0,I.jsx)(N,{"aria-hidden":`true`}),P?`Send back with notes`:`Send back`]}),h(e.pullRequestUrl)?(0,I.jsx)(S,{asChild:!0,variant:`outline`,size:`sm`,children:(0,I.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,I.jsx)(b,{"aria-hidden":`true`}),`PR ↗`]})}):(0,I.jsxs)(S,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:J.isPending,onClick:()=>J.mutate(),children:[(0,I.jsx)(g,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,I.jsxs)(S,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:T(`review`),disabled:W.isPending,onClick:()=>W.mutate(),children:[(0,I.jsx)(_,{"aria-hidden":`true`}),`Accept`]}):null]}),P?(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(O,{ref:y,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,"aria-invalid":B!==null||void 0,"aria-describedby":B===null?void 0:`review-notes-error`,placeholder:`Notes for the agent — what should change?`,rows:1,value:D,onChange:e=>{let t=e.target.value;R(t),B!==null&&t.trim().length>0&&V(null)},onKeyDown:e=>{E(e)&&(e.preventDefault(),Y())},className:`max-h-[min(24dvh,180px)] min-h-11 overflow-y-auto overscroll-contain text-base md:text-[13px]`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[B===null?(0,I.jsx)(`span`,{}):(0,I.jsx)(`p`,{id:`review-notes-error`,"data-slot":`review-notes-error`,role:`alert`,className:`text-xs font-medium text-semantic-red`,children:B}),(0,I.jsx)(S,{"data-slot":`review-notes-cancel`,variant:`ghost`,size:`sm`,title:`Fold the notes box and drop the notes`,onClick:()=>{V(null),L()},children:`Cancel`})]})]}):null,H===null?null:(0,I.jsx)(z,{command:H})]})}function z({command:e}){return(0,I.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>d(`Command copied to clipboard.`)).catch(()=>d(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-xs text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,I.jsx)(v,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}export{P as n,R as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Vt as e}from"./queries-IlC9MZgh.js";function t(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function n(n){let r=new Map,i=e=>n.getQueryCache().find({queryKey:e,exact:!0}),a=e=>{if(!e.owed||e.timer!==void 0)return;let t=i(e.key);if(!t){e.owed=!1;return}if(!t.isActive()){e.owed=!1,n.invalidateQueries({queryKey:e.key,exact:!0,refetchType:`none`});return}if(t.state.fetchStatus!==`idle`)return;let r=e.lastStart+400-Date.now();if(r>0){e.timer=setTimeout(()=>{e.timer=void 0,a(e)},r);return}e.owed=!1,e.lastStart=Date.now(),n.refetchQueries({queryKey:e.key,exact:!0,type:`active`},{cancelRefetch:!1})},o=n.getQueryCache().subscribe(e=>{if(e.type!==`updated`||r.size===0)return;let i=r.get(JSON.stringify(e.query.queryKey));if(i){if(e.action.type===`success`&&!e.action.manual){let r=e.query.promise;r&&i.preEvent.has(r)&&(i.preEvent.delete(r),t(n,i.key),i.owed=!0)}e.query.state.fetchStatus===`idle`&&a(i)}}),s=(t,n)=>n?[n,`runs`,`detail`,t]:e.runs.detail(t);return{onEvent(e,o){let c=s(e,o),l=i(c);if(!l)return;let u=JSON.stringify(c),d=r.get(u);d||(d={key:c,owed:!1,lastStart:0,preEvent:new WeakSet},r.set(u,d)),l.state.fetchStatus!==`idle`&&l.promise&&d.preEvent.add(l.promise),t(n,c),d.owed=!0,a(d)},forget(e,t){let n=JSON.stringify(s(e,t));clearTimeout(r.get(n)?.timer),r.delete(n)},cancel(){o();for(let e of r.values())clearTimeout(e.timer);r.clear()}}}function r(t){let n=new Map;return{refresh(r,i){let a=i?[i,`runs`,`detail`,r]:e.runs.detail(r);if(!t.getQueryState(a))return;let o=JSON.stringify(a);clearTimeout(n.get(o)),t.cancelQueries({queryKey:a}),n.set(o,setTimeout(()=>{n.delete(o),t.invalidateQueries({queryKey:a})},400))},cancel(){for(let e of n.values())clearTimeout(e);n.clear()}}}export{r as n,t as r,n as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{
|
|
2
|
-
`)){if(h.test(i)){n=y(i),t.push(n),r=!1;continue}if(n){if(!r){i.startsWith(`@@`)?(r=!0,n.lines.push(i)):b(n,i);continue}x(n,i)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function C(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var w=n(),T=20,E=300;function D({runId:e,projectId:t}){let n=
|
|
3
|
-
`),[
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Q as r,Vt as i}from"./queries-IlC9MZgh.js";import{Fi as a}from"./toaster-DNnL8v10.js";import{o}from"./dist-CCX8mhHc.js";import{t as s}from"./chevron-right-BENZ-1ZN.js";import{t as c}from"./button-BV_AiLj2.js";import{n as l,r as u,t as d}from"./collapsible-D5i3hm2L.js";import{i as f,r as p}from"./highlighter-Crq-WTmN.js";var m=e(t(),1),h=/^diff --git /;function g(e){let t=e.replace(h,``),n=t.lastIndexOf(` b/`);return _(n>=0?t.slice(n+3):t)}function _(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function v(e){let t=_(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function y(e){return{path:g(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function b(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=_(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=_(t.slice(10));else if(t.startsWith(`new file mode`))e.status=`added`;else if(t.startsWith(`deleted file mode`))e.status=`deleted`;else if(t.startsWith(`Binary files `)||t===`GIT binary patch`)e.binary=!0;else if(t.startsWith(`+++ `)){let n=v(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=v(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function x(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function S(e){let t=[],n=null,r=!1;for(let i of e.split(`
|
|
2
|
+
`)){if(h.test(i)){n=y(i),t.push(n),r=!1;continue}if(n){if(!r){i.startsWith(`@@`)?(r=!0,n.lines.push(i)):b(n,i);continue}x(n,i)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function C(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var w=n(),T=20,E=300;function D({runId:e,projectId:t}){let n=a(),o=r(e,t);(0,m.useEffect)(()=>{let r=t?[t,`runs`,`diff`,e]:i.runs.diff(e);n.invalidateQueries({queryKey:r})},[t,n,e]);let s=(0,m.useMemo)(()=>S(o.data??``),[o.data]),[l,u]=(0,m.useState)(!1);if(o.isPending)return(0,w.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(o.isError)return(0,w.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:o.error.message});if(s.length===0)return(0,w.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:o.data.trim()||`(no changes)`});let d=C(s),f=l?s:s.slice(0,T);return(0,w.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,w.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,w.jsxs)(`span`,{children:[d.files,` `,d.files===1?`file`:`files`,` changed`]}),(0,w.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,w.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,d.additions]}),` `,(0,w.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,d.deletions]})]})]}),f.map(e=>(0,w.jsx)(k,{file:e},`${e.oldPath??``}→${e.path}`)),s.length>f.length?(0,w.jsxs)(c,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>u(!0),children:[`Show `,s.length-f.length,` more files`]}):null]})}var O={added:`added`,deleted:`deleted`,renamed:`renamed`};function k({file:e}){let[t,n]=(0,m.useState)(!0),r=O[e.status],i=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,w.jsxs)(d,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-card-edge bg-card shadow-card`,children:[(0,w.jsxs)(u,{className:`flex w-full items-start gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,w.jsx)(s,{className:o(`mbs-[1px] size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,w.jsx)(`span`,{"data-slot":`diff-file-path`,title:i,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:e.oldPath?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,w.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,w.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,w.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-xs font-semibold tabular-nums`,children:[(0,w.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e.additions]}),` `,(0,w.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,e.deletions]})]})]}),(0,w.jsx)(l,{children:(0,w.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,w.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,w.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,w.jsx)(A,{lines:e.lines})})})]})}function A({lines:e}){let[t,n]=(0,m.useState)(!1),r=t?e:e.slice(0,E),i=r.join(`
|
|
3
|
+
`),[a,s]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=!1;return p(i,`diff`).then(t=>{e||s({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=a?.text===i?a.tokens:f(i,`diff`)?.tokens??null;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,w.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:o(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,w.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>E?(0,w.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}export{D as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{G as r,H as i,J as a,St as o,U as s,V as c,Vt as l,W as u,bt as d,cn as f,ct as p,d as m,en as h,et as g,ln as _,nt as ee,un as v,vt as te,xt as y}from"./queries-IlC9MZgh.js";import{Bt as b,Fi as ne,Hr as re,Yn as x,dn as ie,ft as ae,gi as S,ln as oe,n as C,oi as se,rt as ce,zt as w}from"./toaster-DNnL8v10.js";import{o as T,s as E}from"./dist-CCX8mhHc.js";import{C as D,S as le,T as O,b as ue,g as de,i as fe,m as pe,n as me,p as he,t as k,x as ge}from"./reference-chip-BjerVjzM.js";import{I as _e,S as ve,Y as ye,Z as be,a as xe,ct as Se,m as Ce,mt as we,o as Te,st as Ee,t as De,u as Oe,y as A}from"./design-icons-QbNMZniQ.js";import{t as j}from"./createLucideIcon-BHp8sXmF.js";import{t as ke}from"./app-window-CSHwDX9N.js";import{n as Ae,r as je,t as Me}from"./open-in-menu-BI7mnPPf.js";import{t as Ne}from"./info-DA1x_4bz.js";import{t as Pe}from"./message-square-B-MD-8rD.js";import{t as Fe}from"./square-terminal-B6RYYieR.js";import{t as M}from"./button-BV_AiLj2.js";import{a as N,i as P,l as F,n as I,p as L,r as R,t as z}from"./dropdown-menu-NJZfnQCU.js";import{n as Ie,r as Le,t as Re}from"./popover-BQolmvDR.js";import{a as ze,i as Be,o as Ve,r as He,s as Ue,t as We}from"./dialog-DKr-j9S6.js";import{c as Ge,s as Ke,t as B}from"./project-router-Dc6KBQsv.js";import"./attention-BI6592lk.js";import{T as qe,f as V,u as Je}from"./task-groups-DCg4iOB9.js";import{t as H}from"./status-dot-Bmn4xhch.js";import{t as Ye}from"./format-BU7D3IfE.js";import{a as Xe}from"./agent-accounts-D_ZKAmaW.js";import{$t as Ze,Dn as U,Er as Qe,Fn as $e,G as et,Jn as tt,K as W,W as nt,Wn as rt,a as it,an as at,bn as G,dn as ot,en as st,er as ct,h as lt,hn as ut,i as dt,in as ft,ir as K,ln as pt,m as mt,mr as ht,nn as gt,nr as _t,on as vt,pr as q,rn as yt,tn as bt,tr as J,vr as xt,yn as St}from"./index-Dp7K74Jw.js";import{t as Ct}from"./textarea-BGp28xFr.js";import{t as wt}from"./markdown-BB-PN03o.js";import{t as Tt}from"./task-file-scope-BuFeMG6a.js";import{t as Y}from"./tab-link-6TltE1jl.js";var Et=j(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),Dt=j(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Ot=j(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),kt=j(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),X=e(t(),1),Z=n();function At(e){let t=p();return v({mutationFn:t=>ce(_(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>f()),onError:e=>C(e.message,{tone:`danger`})})}var jt={archive:{full:`Archive task`,compact:`Archive`},unarchive:{full:`Unarchive`,compact:`Unarchive`}};function Mt(e){return jt[e.archived?`unarchive`:`archive`].full}function Nt(e){return jt[e.archived?`unarchive`:`archive`].compact}function Pt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Z.jsx)(Ze,{open:t,onOpenChange:n,children:(0,Z.jsxs)(gt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Z.jsxs)(at,{children:[(0,Z.jsx)(vt,{children:`Archive task?`}),(0,Z.jsxs)(yt,{children:[`Move “`,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,title:V(e),children:V(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Z.jsxs)(ft,{children:[(0,Z.jsx)(bt,{children:`Cancel`}),(0,Z.jsx)(st,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Ft({run:e,className:t,compact:n=!1}){let[r,i]=(0,X.useState)(!1),a=At(e.id),o=Mt(e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(M,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:T(`gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):i(!0),children:[e.archived?(0,Z.jsx)(Qe,{"aria-hidden":`true`}):(0,Z.jsx)(De,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:n?Nt(e):o})]}),(0,Z.jsx)(Pt,{run:e,open:r,onOpenChange:i,onConfirm:()=>{a.mutate(!0),i(!1)}})]})}function It({phone:e}){return e?(0,Z.jsx)(Te,{"aria-hidden":`true`}):null}function Lt({run:e,action:t,prUrl:n,patch:r,phone:i}){let a=t.phase===`blocked`;return{key:`completion`,heading:a?`Completion blocked`:`Completion pending`,reason:t.message||(a?`Completion needs attention.`:`Checking completion actions.`),pending:!a,actions:(0,Z.jsxs)(Z.Fragment,{children:[n&&E(n)?(0,Z.jsx)(M,{variant:`outline`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:[`Open PR`,(0,Z.jsx)(It,{phone:i})]})}):null,e.autoMergePr?(0,Z.jsx)(M,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>C(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})}}function Rt({run:e,blocker:t,flags:n,phone:r}){return{key:`archive`,heading:`Archive blocked`,reason:t.message,actions:(0,Z.jsxs)(Z.Fragment,{children:[t.runId?(0,Z.jsx)(M,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(B,{to:`/tasks/${t.runId}`,"aria-label":r?`Open task that blocks the archive`:void 0,children:r?`Open task`:`Open blocking task`})}):null,t.pullRequestUrl&&E(t.pullRequestUrl)?(0,Z.jsx)(M,{variant:`outline`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,"aria-label":r?`Open PR that blocks the archive`:void 0,children:[r?`Open PR`:`Open blocking PR`,(0,Z.jsx)(It,{phone:r})]})}):null,n.archive?(0,Z.jsx)(Ft,{run:e,compact:r}):null]})}}function zt({heading:e,reason:t,className:n,hideHeading:r}){return(0,Z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:T(`text-sm [overflow-wrap:anywhere]`,n),children:[r?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[e,` · `]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e}),` · `]}),t]})}function Bt({blocks:e}){return(0,Z.jsx)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-card-edge bg-card p-3 shadow-card [margin-block:0.75rem]`,children:e.map(e=>(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsx)(zt,{heading:e.heading,reason:e.reason}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.actions})]},e.key))})}function Vt({blocks:e}){let[t,n]=(0,X.useState)(!1),r=(0,X.useId)(),[i]=e;if(!i)return null;let a=e.length-1;return(0,Z.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`-mx-4 min-w-0 border-b border-card-edge bg-card`,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`completion-status-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),className:`flex min-h-11 w-full items-center gap-2 px-4 text-start text-sm outline-hidden focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-ring/50`,children:[i.pending?(0,Z.jsx)(be,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Se,{"aria-hidden":`true`,className:`size-4 shrink-0 text-semantic-amber`}),(0,Z.jsx)(`span`,{className:`shrink-0 font-medium`,children:i.heading}),t?(0,Z.jsx)(`span`,{className:`flex-1`}):(0,Z.jsxs)(`span`,{"aria-hidden":`true`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:[`· `,i.reason]}),a>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-muted-foreground`,children:[`+`,a]}),(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`and `,a,` more`]})]}):null,(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:T(`size-4 shrink-0 text-muted-foreground`,t&&`rotate-180`)})]}),(0,Z.jsx)(`div`,{id:r,className:T(t&&`grid gap-2 px-4 pb-3`),children:e.map((e,n)=>(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsx)(zt,{heading:e.heading,reason:e.reason,className:T(!t&&`sr-only`),hideHeading:n===0}),t?(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.actions}):null]},e.key))})]})}function Ht({run:e}){let t=u(e.id),n=J(),r=G(e),i=e.status===`done`?e.completionAction:void 0,a=r.archive?e.archiveBlocker:void 0,o=i&&i.phase!==`complete`?i:void 0;if(!o&&!a)return null;let s=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url,c=!n,l=[o?Lt({run:e,action:o,prUrl:s,patch:t,phone:c}):void 0,a?Rt({run:e,blocker:a,flags:r,phone:c}):void 0].filter(e=>e!==void 0);return n?(0,Z.jsx)(Bt,{blocks:l}):(0,Z.jsx)(Vt,{blocks:l})}var Ut=[`running`,`queued`,`waiting`];function Wt(e,{queuePosition:t,now:n=new Date}){let r=se(e),i=$e(e,r).label,a=t===void 0?i:`${i} #${t}`,o=Ut.includes(e.status)?Kt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Gt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Kt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ye(n,t)}}async function Q(e,t){try{await navigator.clipboard.writeText(e),C(t)}catch{C(`Run manually: ${e}`)}}function qt(e){let t=d(),n=m(),r=(0,X.useMemo)(()=>O(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,X.useMemo)(()=>n===void 0?[]:r.filter(e=>he(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Jt(e){return v({mutationFn:()=>b(e.id),onError:e=>{if(e instanceof x&&e.command){Q(e.command,`No terminal found — command copied to clipboard.`);return}C(e.message,{tone:`danger`})}})}function Yt(e,t){let n=s(),r=o(),i=h(),a=v({mutationFn:t=>w(e.id,t),onError:e=>C(e.message,{tone:`danger`})}),c=Xe(),l=qe(e),u=c.runnersOn(e=>t&&l.sessionId!==void 0&&e===l.backend?l.profileId??`default`:c.repoAccount?.[e]).runners,d=e=>!r.isSuccess||!i.isSuccess||u.includes(e??`claude`);return{canResumeHere:t&&d(ut(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Ae(e.id);return t===void 0||i.isSuccess&&d(t)}).map(t=>({target:t,...ot(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:a}}function Xt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Yt(e,t),o=h().data,s=St(e);return!r&&i.length===0&&!s?null:(0,Z.jsxs)(Z.Fragment,{children:[r||i.length>0?(0,Z.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Z.jsxs)(M,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Z.jsx)(Fe,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=je(e,o);return(0,Z.jsxs)(M,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Z.jsxs)(M,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>C(`Worktree path copied`)).catch(()=>C(`Path: ${t}`))},children:[(0,Z.jsx)(A,{}),`Copy worktree path`]}):null]}):null,s?(0,Z.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Z.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Z.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,Z.jsxs)(M,{variant:`outline`,onClick:()=>void Q(s,`Command copied to clipboard.`),children:[(0,Z.jsx)(A,{}),`Copy resume command`]})]}):null]})}function Zt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Yt(e,t),o=St(e),s=e.worktreePath;return!r&&i.length===0&&!o&&!s?null:(0,Z.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Z.jsx)(Me,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,leading:r?(0,Z.jsxs)(P,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Z.jsx)(Fe,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,Z.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void Q(s,`Worktree path copied`),children:[(0,Z.jsx)(A,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,Z.jsxs)(M,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,onClick:()=>void Q(o,`Command copied to clipboard.`),children:[(0,Z.jsx)(A,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Qt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Yt(e,t);return!a&&o.length===0?null:r?(0,Z.jsx)(P,{onSelect:r,children:`Open in…`}):(0,Z.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Z.jsx)(we,{})})]}),e.worktreePath?(0,Z.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(Xt,{run:e,canResume:t,onResume:n})})]})}function $t({branch:e}){let[t,n]=(0,X.useState)(null),r=(0,X.useRef)(null);(0,X.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{C(`Could not copy branch. Select and copy: ${e}`)}};return(0,Z.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Z.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium break-all`,children:e}),(0,Z.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,Z.jsx)(A,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function en({run:e}){let t=d(),n=m(),r=r=>n===void 0?void 0:ge(n,e.id,r,t),i=(0,X.useMemo)(()=>O(e,t),[e,t]),a=[],o=[],s=i.filter(e=>e.kind===`PR`);for(let t of s)a.push((0,Z.jsx)(k,{reference:t,to:r(t),taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Z.jsx)(pt,{run:e,prNumber:t.number})},de(t)));let c=D(e);c&&E(c)&&!s.some(e=>e.url===c)&&a.push((0,Z.jsx)(k,{reference:{kind:`PR`,url:c},taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let l=i.filter(e=>e.kind===`Issue`);for(let t of l)o.push((0,Z.jsx)(k,{reference:t,to:r(t),taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},de(t)));let u=ue(e,t);if(u&&E(u)&&!l.some(e=>e.url===u)){let t=pe(u);o.push((0,Z.jsx)(k,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:u},to:t?r({kind:`Issue`,number:Number(t),url:u}):void 0,taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return a.length===0&&o.length===0?null:(0,Z.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,a],[`Issue`,`Issues`,o]].map(([e,t,n])=>n.length>0?(0,Z.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function tn(){let e=Ke(),t=y();return nt(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var $=e=>e.map(e=>`${e.name}: ${et(e.url)}`).join(`
|
|
2
|
+
`);function nn(e){let t=tt(),n=tn(),r=n.length>0,a=i(e.id),[o,s]=(0,X.useState)(null),c=e.notify===!0,l=()=>a.mutate({notify:!1},{onSuccess:()=>C(`Stopped notifying the webhook`),onError:e=>C(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),u=r?(0,Z.jsx)(sn,{mode:o,targets:n,pending:a.isPending,onOpenChange:e=>!e&&s(null),onSubmit:e=>a.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{s(null),C(o===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>C(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null;return{visible:t!==`absent`&&(r||c),notifying:c,reachable:r,targets:n,pending:a.isPending,open:s,stop:l,dialog:u}}function rn({run:e}){let t=nn(e);if(!t.visible)return null;let{notifying:n,reachable:r,targets:i}=t;return(0,Z.jsxs)(Z.Fragment,{children:[n?(0,Z.jsxs)(z,{children:[(0,Z.jsx)(L,{asChild:!0,children:(0,Z.jsxs)(M,{variant:`outline`,"data-slot":`notifying-chip`,className:`gap-1.5`,"aria-label":r?`Notifying ${W(i)} — webhook actions`:`Notifying — webhook actions`,title:r?$(i):void 0,children:[(0,Z.jsx)(H,{tone:`success`}),(0,Z.jsx)(`span`,{children:`Notifying`}),(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Z.jsxs)(R,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[r?(0,Z.jsx)(N,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-xs font-normal text-muted-foreground`,children:i.map(e=>(0,Z.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:et(e.url),children:e.name},e.id))}):null,r?(0,Z.jsxs)(P,{className:`min-h-11`,onSelect:()=>t.open(`note`),children:[(0,Z.jsx)(Pe,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Z.jsxs)(P,{variant:`destructive`,className:`min-h-11`,disabled:t.pending,onSelect:t.stop,children:[(0,Z.jsx)(Et,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Z.jsxs)(M,{variant:`outline`,"data-action":`handoff`,className:`max-md:px-0`,"aria-label":`Hand off to webhook`,onClick:()=>t.open(`handoff`),children:[(0,Z.jsx)(q,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),t.dialog]})}function an({handoff:e}){if(!e.visible)return null;let{notifying:t,reachable:n,targets:r}=e;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{}),(0,Z.jsx)(N,{"data-slot":`handoff-menu-label`,className:`truncate px-2 py-3 text-[12px] font-normal text-muted-foreground uppercase`,title:n?$(r):void 0,children:n?`Webhook · ${W(r)}`:`Webhook`}),t?(0,Z.jsxs)(Z.Fragment,{children:[n?(0,Z.jsx)(P,{"data-action":`handoff-note`,className:`min-h-11`,onSelect:()=>e.open(`note`),children:`Send a note…`}):null,(0,Z.jsx)(P,{"data-action":`handoff-stop`,variant:`destructive`,className:`min-h-11`,disabled:e.pending,onSelect:e.stop,children:`Stop notifying`})]}):(0,Z.jsx)(P,{"data-action":`handoff`,className:`min-h-11`,onSelect:()=>e.open(`handoff`),children:`Hand off to webhook…`})]})}function on({run:e}){let t=tt(),n=tn();return e.notify!==!0||t===`absent`?null:(0,Z.jsx)(K,{"data-slot":`notifying-status`,role:`img`,"aria-label":n.length>0?`Notifying ${W(n)}`:`Notifying`,title:n.length>0?$(n):void 0,className:`shrink-0 px-2 py-px leading-4`,children:(0,Z.jsx)(q,{"aria-hidden":`true`,className:`size-3 text-success`})})}function sn({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,X.useId)(),o=(0,X.useId)(),[s,c]=(0,X.useState)(``);(0,X.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=W(t);return(0,Z.jsx)(We,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,Z.jsx)(He,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,Z.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,Z.jsxs)(Ve,{className:`text-left`,children:[(0,Z.jsx)(Ue,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Z.jsx)(Be,{children:(0,Z.jsx)(`span`,{"data-webhook-destination":``,title:$(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Z.jsx)(Ct,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Z.jsx)(Ne,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Z.jsxs)(ze,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:w-full`,children:[(0,Z.jsx)(M,{type:`button`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,Z.jsxs)(M,{type:`submit`,variant:`contrast`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,Z.jsx)(q,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function cn({id:e}){return(0,Z.jsxs)(B,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,Z.jsx)(xe,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function ln({id:e}){let t=a(e),n=t.data?V(t.data):e;return(0,Z.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,Z.jsxs)(B,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,Z.jsx)(xe,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Z.jsx)(M,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var un=3,dn=(e,t)=>e.kind===t.kind&&e.number===t.number;function fn(e,t,n=un){let r=t?e.findIndex(e=>dn(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var pn=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function mn({tab:e}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(e.kind===`pr`?_e:Ce,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Z.jsx)(me,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function hn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function gn({servers:e,icon:t=!1}){let n=mt();if(n===null)return null;let r=n.agentLive===!0,i=e[0],a=e.length+ +!!r,o=a===1?i?{port:i.port}:{agent:!0}:{};return t?(0,Z.jsxs)(M,{variant:`ghost`,size:`icon`,"data-slot":`preview-toggle`,"data-entries":a,"aria-pressed":n.open,"aria-label":hn(e,r),className:T(`relative`,a>0?`text-foreground`:`text-soft-foreground`),onClick:()=>n.openPane(o),children:[(0,Z.jsx)(ke,{"aria-hidden":`true`}),n.live?(0,Z.jsx)(H,{tone:`success`,"aria-hidden":`true`,"data-slot":`preview-live-dot`,className:`absolute top-2 right-2`}):null]}):(0,Z.jsxs)(M,{variant:`outline`,"data-slot":`preview-toggle`,"aria-pressed":n.open,onClick:()=>n.openPane(o),children:[(0,Z.jsx)(ke,{"aria-hidden":`true`}),hn(e,r),n.live?(0,Z.jsx)(H,{tone:`success`,"aria-label":`Preview is live`}):null]})}function _n({tab:e}){let t=lt();return!t?.available||e!==`session`&&e!==`changes`?null:(0,Z.jsxs)(M,{variant:`outline`,"data-slot":`split-view-toggle`,className:T(t.showing&&`border-accent-text/40 bg-muted text-accent-text`),"aria-pressed":t.showing,title:t.showing?`Show Session alone`:`Show Changes beside Session`,onClick:()=>t.setOn(!t.showing),children:[(0,Z.jsx)(Ot,{"aria-hidden":`true`}),`Split view`]})}function vn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function yn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,Z.jsx)(cn,{id:n}):(0,Z.jsx)(ln,{id:n})}function bn({isDesktop:e,desktopActivitySlot:t,attention:n,statusLine:r,hostOffline:i}){return e&&t?(0,Z.jsx)(Z.Fragment,{children:t}):(0,Z.jsx)(`span`,{"data-slot":`run-status-slot`,className:`hidden`,children:(0,Z.jsx)(K,{dot:n.tone,shape:n.shape,pulse:n.pulse&&!i,children:Gt(r)})})}function xn(e,t,n){return e.worktreePath&&t?(0,Z.jsx)(gn,{servers:e.previewServers??[],icon:n}):null}function Sn(e,t,n){return n&&!e.archiveBlocker&&t.archive?(0,Z.jsx)(Ft,{run:e}):null}function Cn({offline:e,className:t}){return e?(0,Z.jsx)(K,{"data-slot":`host-not-live-pill`,dot:`neutral`,shape:`ring`,className:t,children:`Not live`}):null}function wn({archived:e,className:t}){return e?(0,Z.jsx)(K,{"data-slot":`run-archived-pill`,dot:U.tone,shape:U.shape,className:t,children:U.label}):null}function Tn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Z.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function En({run:e,statusLine:t,activityTrigger:n,hostOffline:r}){let{attention:i}=t;return(0,Z.jsx)(`span`,{"data-slot":`mobile-status-room`,className:`flex min-w-0`,children:(0,Z.jsxs)(`span`,{className:`inline-flex max-w-full min-w-0 items-center gap-1.5`,children:[n??(0,Z.jsx)(K,{"data-slot":`mobile-run-status`,dot:i.tone,shape:i.shape,pulse:i.pulse&&!r,className:`min-w-0 px-2 py-px text-xs leading-4`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})}),(0,Z.jsx)(Cn,{offline:r,className:`shrink-0 px-2 py-px text-xs leading-4`}),(0,Z.jsx)(wn,{archived:e.archived,className:`shrink-0 px-2 py-px text-xs leading-4`}),(0,Z.jsx)(on,{run:e})]})})}function Dn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,X.useRef)(null),[c,l]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=s.current;if(!e||o){l(!1);return}let t=()=>l(e.scrollWidth-e.clientWidth-e.scrollLeft>1),n=new ResizeObserver(t);n.observe(e);for(let t of e.children)n.observe(t);return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{n.disconnect(),e.removeEventListener(`scroll`,t)}},[o,r,i,e.diffStat?.files]);let u=n?`${n.kind}#${n.number}`:null;return(0,X.useEffect)(()=>{!u||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[u,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,Z.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,"data-overflow-end":c||void 0,className:T(`flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-2 max-md:[&>a]:text-[13.5px]`,a?`mt-0`:`mt-3`),children:[(0,Z.jsx)(Y,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,Z.jsx)(Y,{to:pn(e.id,t),active:n!==null&&dn(t,n),replace:a,children:(0,Z.jsx)(mn,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,Z.jsxs)(z,{children:[(0,Z.jsxs)(L,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,Z.jsx)(R,{align:`end`,children:i.map(t=>(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsx)(B,{to:pn(e.id,t),replace:a,children:(0,Z.jsx)(mn,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function On({run:e,tab:t=`session`,onMarkedUnread:n,desktopActivitySlot:r,mobileActivitySlot:i}){let a=se(e),o=G(e),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(!1),d=kn(e,n),f=An(e),p=(0,X.useRef)(null),m=ee(),h=te(),g=Wt(e,{queuePosition:e.status===`queued`?Je(m.data??[]).get(e.id):void 0}),_=_t(),v=J(),y=_!==null&&!v?_:null,b=y!==null,{referenceProjectId:ne,repoBase:x,requests:ie}=qt(e),ae=(0,X.useMemo)(()=>le(e,x),[e,x]),S=typeof t==`object`?t:null,{inline:oe,overflow:C}=fn(ae,S),ce=rt(h.data),w=re(),E=xn(e,ce,!1),D=(0,Z.jsx)(Nn,{run:e,actions:d,triggerRef:p,onRename:b?f.editor.begin:void 0,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)}),O=Sn(e,o,v);return(0,Z.jsx)(fe,{projectId:ne,repoBase:x,requests:ie,children:(0,Z.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:T(`relative z-20 shrink-0 bg-background px-4 md:px-9 md:pt-7`,b?`pt-0`:`pt-[18px]`,t===`session`&&`border-b border-border`),children:[(0,Z.jsx)(Tn,{run:e}),(0,Z.jsx)(Ht,{run:e}),(0,Z.jsxs)(`div`,{className:`w-full`,children:[(0,Z.jsx)(yn,{run:e}),y?(0,Z.jsxs)(ct,{slot:y,children:[(0,Z.jsx)(Mn,{run:e,title:f,returnFocus:p,status:(0,Z.jsx)(En,{run:e,statusLine:g,activityTrigger:i,hostOffline:w})}),xn(e,ce,!0),(0,Z.jsx)(yn,{run:e,compact:!0}),D]}):(0,Z.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,Z.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:vn(e.delegation)}),(0,Z.jsx)(jn,{run:e}),(0,Z.jsx)(bn,{isDesktop:v,desktopActivitySlot:r,attention:a,statusLine:g,hostOffline:w}),(0,Z.jsx)(Cn,{offline:w,className:`max-md:hidden`}),(0,Z.jsx)(wn,{archived:e.archived,className:`max-md:hidden`}),(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[O,(0,Z.jsx)(_n,{tab:t}),E,(0,Z.jsx)(rn,{run:e}),D]})]}),(0,Z.jsx)(Dn,{run:e,tab:t,activeItem:S,inlineItemTabs:oe,overflowItemTabs:C,phoneBar:b,isDesktop:v}),s?(0,Z.jsx)(In,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,Z.jsx)(Qt,{run:e,canResume:G(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,Z.jsx)(Fn,{run:e,actions:d})]})})}function kn(e,t){let n=ne(),i=Ge(),[a,o]=(0,X.useState)(null),s=()=>n.invalidateQueries({queryKey:l.runs.all}),u=e=>C(e.message,{tone:`danger`}),d=r(),f={isPending:d.isPending,mutate:()=>d.mutate({id:e.id,pinned:!e.pinned})},p=c();return{pin:f,markUnread:{isPending:p.isPending,mutate:()=>{t?.(),p.mutate(e.id,{onError:u})}},delete:v({mutationFn:()=>ae(e.id),onSuccess:()=>{s(),i(`/`)},onError:u}),terminal:Jt(e),confirming:a,setConfirming:o}}function An(e){let t=u(e.id),n=V(e);return{title:n,editor:it(n,e=>t.mutate({title:e},{onError:e=>C(e.message,{tone:`danger`})}))}}function jn({run:e}){let{title:t,editor:n}=An(e);return n.editing?(0,Z.jsx)(dt,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Z.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(ht,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Mn({run:e,title:{title:t,editor:n},returnFocus:r,status:i}){return(0,Z.jsxs)(Re,{open:n.editing,onOpenChange:e=>{e||n.commit()},children:[(0,Z.jsx)(Ie,{asChild:!0,children:(0,Z.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:t}),i]})}),(0,Z.jsx)(Le,{align:`start`,sideOffset:12,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},onCloseAutoFocus:e=>{e.preventDefault(),r.current?.focus()},children:(0,Z.jsx)(dt,{editor:n,className:`text-[16px] font-semibold`})})]})}function Nn({run:e,actions:t,triggerRef:n,onRename:r,onToggleNotes:i,onOpenChooser:a}){let o=G(e),s=St(e),c=J(),l=At(e.id),[d,f]=(0,X.useState)(!1),p=u(e.id),m=(0,X.useId)(),h=nn(e),g=(0,X.useRef)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pt,{run:e,open:d,onOpenChange:f,onConfirm:()=>{l.mutate(!0),f(!1)}}),c?null:h.dialog,(0,Z.jsxs)(z,{children:[(0,Z.jsx)(L,{asChild:!0,children:(0,Z.jsx)(M,{ref:n,variant:`ghost`,size:`icon`,"aria-label":`Run actions`,children:(0,Z.jsx)(ve,{"aria-hidden":`true`})})}),(0,Z.jsxs)(R,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,onCloseAutoFocus:e=>{g.current&&(g.current=!1,e.preventDefault(),r?.())},children:[(0,Z.jsx)(N,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),r?(0,Z.jsxs)(P,{"data-action":`rename-task`,className:`min-h-11`,onSelect:()=>{g.current=!0},children:[(0,Z.jsx)(ht,{"aria-hidden":`true`}),` Rename`]}):null,!c&&o.archive&&!e.archiveBlocker?(0,Z.jsx)(P,{disabled:l.isPending,onSelect:()=>e.archived?l.mutate(!1):f(!0),children:Mt(e)}):null,(0,Z.jsxs)(P,{onSelect:i,children:[(0,Z.jsx)(xt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Z.jsx)(Qt,{run:e,canResume:o.terminal,onResume:()=>t.terminal.mutate(),onOpen:a}),s?(0,Z.jsxs)(P,{onSelect:()=>void Q(s,`Command copied to clipboard.`),children:[(0,Z.jsx)(A,{"aria-hidden":`true`}),` Copy resume command`]}):null,o.markUnread?(0,Z.jsxs)(P,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Z.jsx)(Dt,{"aria-hidden":`true`}),` Mark unread`]}):null,o.pin?(0,Z.jsxs)(I,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Z.jsx)(kt,{"aria-hidden":`true`}):(0,Z.jsx)(ye,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,c?null:(0,Z.jsx)(an,{handoff:h}),(0,Z.jsx)(F,{}),(0,Z.jsx)(N,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Z.jsx)(I,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:p.isPending,onCheckedChange:e=>p.mutate({archiveWhenDone:e},{onError:e=>C(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Z.jsx)(I,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:p.isPending,"aria-describedby":m,onCheckedChange:e=>p.mutate({autoMergePr:e},{onError:e=>C(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Z.jsx)(`p`,{id:m,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,Z.jsx)(Pn,{run:e,patch:p}),o.deleteRun?(0,Z.jsx)(F,{}):null,o.deleteRun?(0,Z.jsxs)(P,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Z.jsx)(Ee,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function Pn({run:e,patch:t}){let n=(0,X.useId)(),r=(0,X.useId)(),i=(0,X.useId)(),a=e=>C(e.message,{tone:`danger`});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{}),(0,Z.jsx)(N,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,Z.jsx)(I,{"data-slot":`allow-workers`,className:`min-h-11`,checked:ie(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,Z.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,Z.jsx)(I,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:oe(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,Z.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,Z.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function Fn({run:e,actions:t}){let n=t.confirming;return(0,Z.jsx)(Ze,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Z.jsxs)(gt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Z.jsxs)(at,{children:[(0,Z.jsx)(vt,{className:`text-danger`,children:`Delete task permanently?`}),(0,Z.jsx)(yt,{children:(0,Z.jsxs)(Z.Fragment,{children:[`Delete “`,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,title:V(e),children:V(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!S(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,Z.jsxs)(ft,{children:[(0,Z.jsx)(bt,{children:`Cancel`}),(0,Z.jsx)(st,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function In({runId:e,onClose:t}){let n=g(e);return(0,Z.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 flex max-h-[min(45dvh,420px)] flex-col overflow-hidden rounded-xl border border-border bg-card p-6`,children:[(0,Z.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Z.jsx)(we,{})})]}),(0,Z.jsx)(`div`,{"data-slot":`notes-panel-body`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:n.isPending?(0,Z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Z.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Z.jsx)(Tt,{runId:e,children:(0,Z.jsx)(wt,{children:n.data})}):(0,Z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})}),(0,Z.jsxs)(`div`,{className:`mt-4 flex shrink-0 gap-3`,children:[(0,Z.jsx)(M,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Q(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Z.jsx)(M,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{Jt as a,Zt as i,$t as n,qt as o,en as r,Wt as s,On as t};
|