cezarion 0.19.0-dev.8799 → 0.19.0-dev.8807
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/package.json +3 -3
- package/web/dist/assets/{accounts-section-B3XlbE9-.js → accounts-section-CnQrgrlx.js} +1 -1
- package/web/dist/assets/{activity-motion-DtSeos5G.js → activity-motion-SZyZ3Vcd.js} +1 -1
- package/web/dist/assets/{activity-route-DwLbg5TU.js → activity-route-kA927mMd.js} +1 -1
- package/web/dist/assets/{agent-config-section-TV__fszM.js → agent-config-section-DZ9lz-oU.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-CoaKPbd7.js → agent-defaults-section-CAyM93lD.js} +1 -1
- package/web/dist/assets/{appearance-BSogGq4y.js → appearance-jU-y46Hc.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-Bzuu6JUq.js → archive-on-merge-field-C5WFm3HO.js} +1 -1
- package/web/dist/assets/attention-Dt-QhJ3p.js +1 -0
- package/web/dist/assets/automations-route-DzIrboEQ.js +2 -0
- package/web/dist/assets/{commit-list-CPCMhqsH.js → commit-list-JK2MEtR0.js} +1 -1
- package/web/dist/assets/{diff-eTwHyNBm.js → diff-CC-HnvfR.js} +2 -2
- package/web/dist/assets/{diff-controls-DT8_nQ2J.js → diff-controls-CnrIcRRG.js} +1 -1
- package/web/dist/assets/{diff-view-BnO_U5xn.js → diff-view-Dzl9i4zr.js} +1 -1
- package/web/dist/assets/{file-preview-L0_fbkUZ.js → file-preview-C1Nd5SH3.js} +1 -1
- package/web/dist/assets/{folder-browser-BzYB6BT2.js → folder-browser-ZmOa9z3j.js} +1 -1
- package/web/dist/assets/{git-toolbar-ywLSmnxR.js → git-toolbar-q-HOZgdL.js} +1 -1
- package/web/dist/assets/{github-Bd3i_-h6.js → github-RqiwU49D.js} +1 -1
- package/web/dist/assets/{global-activity-route-BbgDC3wz.js → global-activity-route-DTuWu-5a.js} +1 -1
- package/web/dist/assets/index-6yHpyOyH.js +21 -0
- package/web/dist/assets/index-DNgBNd8o.css +1 -0
- package/web/dist/assets/{label-CgZJ4LAh.js → label-D91E4F0a.js} +1 -1
- package/web/dist/assets/{markdown-Dn1C5VnY.js → markdown-NDbXgnqb.js} +1 -1
- package/web/dist/assets/{notifications-section-3xWRDUrB.js → notifications-section-CQ4HSyLK.js} +1 -1
- package/web/dist/assets/{open-in-menu-C09BLcfQ.js → open-in-menu-CqNkccJr.js} +1 -1
- package/web/dist/assets/preview-pane-connected-Dm-Ga2KN.js +3 -0
- package/web/dist/assets/{project-location-CVu4xirj.js → project-location-CspXXtNm.js} +1 -1
- package/web/dist/assets/{project-router-BypHPat0.js → project-router-BifLGgRR.js} +1 -1
- package/web/dist/assets/{projects-section-Brds9YmD.js → projects-section-CKPqFZP7.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-CAuTp8gl.js → prompt-templates-section-D9Tsgav9.js} +1 -1
- package/web/dist/assets/{queries-EvENG6TN.js → queries-D0v1z40Y.js} +1 -1
- package/web/dist/assets/{reference-chip-BLHAGMsc.js → reference-chip-CV_vG2eP.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CxRBhjoN.js → remote-settings-notice-40uqklAG.js} +1 -1
- package/web/dist/assets/{repo-git-CGdMJ36u.js → repo-git-BBalirax.js} +1 -1
- package/web/dist/assets/{report-reader-BQyJblDp.js → report-reader-D3Heszz3.js} +1 -1
- package/web/dist/assets/{report-selection-CXF3VYjA.js → report-selection-CDlncYKI.js} +1 -1
- package/web/dist/assets/reports-CEaxAigM.js +1 -0
- package/web/dist/assets/{resources-section-Cbtu9i_k.js → resources-section-ohdWkreq.js} +1 -1
- package/web/dist/assets/{review-panel-DuvFn5VX.js → review-panel-CthaDvZO.js} +4 -4
- package/web/dist/assets/{run-detail-refresh-DXnE6Lc2.js → run-detail-refresh-DkwIHh-c.js} +1 -1
- package/web/dist/assets/run-header-9NNASXmJ.js +2 -0
- package/web/dist/assets/{select-D5UnnIUL.js → select-Bh7vwx79.js} +1 -1
- package/web/dist/assets/{session-context-section-CFw0aFoC.js → session-context-section-B5Ee7GbQ.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-DIEyNQVg.js → settings-agent-picker-DeczgUDV.js} +1 -1
- package/web/dist/assets/settings-shell-BvRwl06q.js +1 -0
- package/web/dist/assets/{sidebar-section-CET3Eico.js → sidebar-section-Bn1Uv9AQ.js} +1 -1
- package/web/dist/assets/{skills-oxTqCu3h.js → skills-DMyaR3WX.js} +1 -1
- package/web/dist/assets/{tab-link-Bjo_gEiX.js → tab-link-DAxoMsUp.js} +1 -1
- package/web/dist/assets/task-changes-ChM901cL.js +1 -0
- package/web/dist/assets/{task-commits-DEsRCchM.js → task-commits-DOP65FDx.js} +1 -1
- package/web/dist/assets/{task-file-scope-CkPO86PU.js → task-file-scope-emNQrzps.js} +1 -1
- package/web/dist/assets/{task-files-BuMkWb7X.js → task-files-BYPCvDCO.js} +1 -1
- package/web/dist/assets/{task-github-item-wUJ6pMdV.js → task-github-item-CHGyiC4k.js} +1 -1
- package/web/dist/assets/{task-groups-nvRvmVHf.js → task-groups-BdayPxX3.js} +1 -1
- package/web/dist/assets/{task-thread-CS88T_7I.js → task-thread-BI2pi8dZ.js} +2 -2
- package/web/dist/assets/{tasks-table-DGBiE6ux.js → tasks-table-BY5niMlY.js} +1 -1
- package/web/dist/assets/thread-state-CdKvrn7R.js +4 -0
- package/web/dist/assets/{toaster-Cer2NOxt.js → toaster-DMfiAEnw.js} +1 -1
- package/web/dist/assets/use-hand-to-agent-state-stc7Vzni.js +1 -0
- package/web/dist/assets/{workflows-D0HHVBzP.js → workflows-DagjPw_m.js} +2 -2
- package/web/dist/assets/{workspace-tools-C8GYSy1Y.js → workspace-tools-BaLORh9B.js} +1 -1
- package/web/dist/assets/{worktrees-section-Ba0hS8Ls.js → worktrees-section-CSERluzw.js} +4 -4
- package/web/dist/index.html +14 -14
- package/web/dist/assets/attention-wzzAdp4t.js +0 -1
- package/web/dist/assets/automations-route-BO4qUbj8.js +0 -2
- package/web/dist/assets/index-8eoz1i7-.js +0 -21
- package/web/dist/assets/index-nVjwJYl4.css +0 -1
- package/web/dist/assets/preview-pane-connected-BdxTm5Ky.js +0 -3
- package/web/dist/assets/reports-CPpFm0jn.js +0 -1
- package/web/dist/assets/run-header-CP_2QY0H.js +0 -2
- package/web/dist/assets/settings-shell-DUvwIPgV.js +0 -1
- package/web/dist/assets/task-changes-TvjFctCc.js +0 -1
- package/web/dist/assets/thread-state-DulSg7h8.js +0 -4
- package/web/dist/assets/use-hand-to-agent-state-8ZF3Wr1m.js +0 -1
|
@@ -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{n as r,t as i}from"./utils-DSMR_WLb.js";import{Ct as a,G as o,H as s,K as c,St as l,U as u,W as d,Wt as f,Y as p,dn as m,f as h,ln as g,lt as _,rn as v,rt as ee,tt as y,un as te,xt as b,yt as ne}from"./queries-D0v1z40Y.js";import{An as re,Fn as ie,It as ae,Lt as x,cr as oe,hi as se,n as S,or as C,tt as w,ut as ce,yr as le}from"./toaster-DMfiAEnw.js";import{a as ue,d as de,f as fe,g as pe,m as me,o as he,p as ge,s as _e}from"./tasks-table-BY5niMlY.js";import{F as ve,at as ye,ft as be,i as xe,l as Se,p as Ce,q as we,t as Te,v as T,x as Ee}from"./design-icons-CzEoMH9c.js";import{t as E}from"./createLucideIcon-BHp8sXmF.js";import{t as De}from"./app-window-CSHwDX9N.js";import{n as Oe,r as ke,t as Ae}from"./open-in-menu-CqNkccJr.js";import{t as je}from"./info-DA1x_4bz.js";import{t as Me}from"./message-square-B-MD-8rD.js";import{i as Ne,n as Pe,t as D}from"./reference-chip-CV_vG2eP.js";import{t as Fe}from"./square-terminal-B6RYYieR.js";import{t as O}from"./button-B7MKxYjT.js";import{a as k,i as A,l as j,n as M,p as N,r as P,t as F}from"./dropdown-menu-4e2iKSMT.js";import{i as Ie,r as Le,t as Re}from"./popover-CZV6tz9i.js";import{a as ze,i as Be,o as Ve,r as He,s as Ue,t as We}from"./dialog-B531GGAo.js";import{c as Ge,s as Ke,t as I}from"./project-router-BifLGgRR.js";import"./attention-Dt-QhJ3p.js";import{T as qe,f as L,u as Je}from"./task-groups-BdayPxX3.js";import{t as Ye}from"./status-dot-BRzVlF2X.js";import{t as Xe}from"./format-BU7D3IfE.js";import{B as R,Gn as Ze,Gt as z,Ht as B,Jt as V,Kt as H,On as Qe,Qt as $e,R as et,Un as tt,Ut as nt,Wn as rt,Wt as it,Yt as at,a as ot,bn as U,cn as W,en as st,in as ct,ln as G,m as lt,mr as ut,nr as dt,o as ft,or as pt,qt as mt,r as K,tr as ht,vn as gt,z as _t}from"./index-6yHpyOyH.js";import{t as vt}from"./markdown-NDbXgnqb.js";import{t as yt}from"./textarea-vJt9undk.js";import{t as bt}from"./task-file-scope-emNQrzps.js";import{t as q}from"./tab-link-DAxoMsUp.js";var xt=E(`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`}]]),St=E(`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`}]]),Ct=E(`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`}]]),J=e(t(),1),Y=n();function wt(e){let t=_();return m({mutationFn:t=>w(te(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>g()),onError:e=>S(e.message,{tone:`danger`})})}function Tt(e){return e.archived?`Unarchive`:`Archive task`}function Et({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Y.jsx)(B,{open:t,onOpenChange:n,children:(0,Y.jsxs)(z,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(at,{children:`Archive task?`}),(0,Y.jsxs)(H,{children:[`Move “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:L(e),children:L(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Y.jsxs)(mt,{children:[(0,Y.jsx)(it,{children:`Cancel`}),(0,Y.jsx)(nt,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Dt({run:e,className:t}){let[n,r]=(0,J.useState)(!1),a=wt(e.id),o=Tt(e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(O,{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:i(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):r(!0),children:[e.archived?(0,Y.jsx)(ut,{"aria-hidden":`true`}):(0,Y.jsx)(Te,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:o})]}),(0,Y.jsx)(Et,{run:e,open:n,onOpenChange:r,onConfirm:()=>{a.mutate(!0),r(!1)}})]})}function Ot({run:e,action:t,prUrl:n,patch:i}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,Y.jsx)(O,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Y.jsx)(O,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>S(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function kt({run:e,blocker:t,flags:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Y.jsx)(O,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(I,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,Y.jsx)(O,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Y.jsx)(Dt,{run:e}):null]})]})}function At({run:e}){let t=o(e.id),n=G(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let s=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,Y.jsxs)(`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:[a?(0,Y.jsx)(Ot,{run:e,action:a,prUrl:s,patch:t}):null,i?(0,Y.jsx)(kt,{run:e,blocker:i,flags:n}):null]})}var jt=[`running`,`queued`,`waiting`];function Mt(e,{queuePosition:t,now:n=new Date}){let r=re(e),i=Qe(e,r).label,a=t===void 0?i:`${i} #${t}`,o=jt.includes(e.status)?Pt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Nt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Pt(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:Xe(n,t)}}async function X(e,t){try{await navigator.clipboard.writeText(e),S(t)}catch{S(`Run manually: ${e}`)}}function Ft(e){let t=b(),n=h(),r=(0,J.useMemo)(()=>pe(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,J.useMemo)(()=>n===void 0?[]:r.filter(e=>ue(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function It(e){return m({mutationFn:()=>x(e.id),onError:e=>{if(e instanceof ie&&e.command){X(e.command,`No terminal found — command copied to clipboard.`);return}S(e.message,{tone:`danger`})}})}function Z(e,t){let n=d(),r=a(),i=v(),o=m({mutationFn:t=>ae(e.id,t),onError:e=>S(e.message,{tone:`danger`})}),s=gt(),c=qe(e),l=s.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:s.repoAccount?.[e]).runners,u=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&u(ct(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Oe(e.id);return t===void 0||i.isSuccess&&u(t)}).map(t=>({target:t,...st(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function Lt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Z(e,t),o=v().data,s=W(e);return!r&&i.length===0&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[r||i.length>0?(0,Y.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Y.jsxs)(O,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Y.jsx)(Fe,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=ke(e,o);return(0,Y.jsxs)(O,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Y.jsxs)(O,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>S(`Worktree path copied`)).catch(()=>S(`Path: ${t}`))},children:[(0,Y.jsx)(T,{}),`Copy worktree path`]}):null]}):null,s?(0,Y.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Y.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,Y.jsxs)(O,{variant:`outline`,onClick:()=>void X(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(T,{}),`Copy resume command`]})]}):null]})}function Rt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Z(e,t),o=W(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,Y.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Y.jsx)(Ae,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,Y.jsxs)(A,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)(Fe,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,className:c,onClick:()=>void X(s,`Worktree path copied`),children:[(0,Y.jsx)(T,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void X(o,`Command copied to clipboard.`),children:[(0,Y.jsx)(T,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function zt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Z(e,t);return!a&&o.length===0?null:r?(0,Y.jsx)(A,{onSelect:r,children:`Open in…`}):(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Y.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Y.jsx)(be,{})})]}),e.worktreePath?(0,Y.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(Lt,{run:e,canResume:t,onResume:n})})]})}function Bt({branch:e}){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(null);(0,J.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{S(`Could not copy branch. Select and copy: ${e}`)}};return(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Y.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,Y.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,Y.jsx)(T,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function Vt({run:e}){let t=b(),n=h(),i=r=>n===void 0?void 0:fe(n,e.id,r,t),a=(0,J.useMemo)(()=>pe(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Y.jsx)(D,{reference:t,to:i(t),taskTitle:L(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Y.jsx)($e,{run:e,prNumber:t.number})},_e(t)));let l=me(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,Y.jsx)(D,{reference:{kind:`PR`,url:l},taskTitle:L(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,Y.jsx)(D,{reference:t,to:i(t),taskTitle:L(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},_e(t)));let d=de(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=he(d);s.push((0,Y.jsx)(D,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:L(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Y.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,Y.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,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Ht(){let e=Ke(),t=l();return et(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Ut=e=>e.map(e=>`${e.name}: ${_t(e.url)}`).join(`
|
|
2
|
+
`);function Wt(e){return Ht().length>0||e.notify===!0}function Q({run:e}){let t=Ht(),n=t.length>0,r=u(e.id),[i,a]=(0,J.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,Y.jsxs)(Y.Fragment,{children:[o?(0,Y.jsxs)(F,{children:[(0,Y.jsx)(N,{asChild:!0,children:(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${R(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Ut(t):void 0,children:[(0,Y.jsx)(Ye,{tone:`success`}),(0,Y.jsx)(`span`,{children:`Notifying`}),(0,Y.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Y.jsxs)(P,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,Y.jsx)(k,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-xs font-normal text-muted-foreground`,children:t.map(e=>(0,Y.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:_t(e.url),children:e.name},e.id))}):null,n?(0,Y.jsxs)(A,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,Y.jsx)(Me,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Y.jsxs)(A,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>S(`Stopped notifying the webhook`),onError:e=>S(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Y.jsx)(xt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,Y.jsx)(ht,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,Y.jsx)(Gt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),S(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>S(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Gt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,J.useId)(),o=(0,J.useId)(),[s,c]=(0,J.useState)(``);(0,J.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=R(t);return(0,Y.jsx)(We,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,Y.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,Y.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,Y.jsxs)(Ve,{className:`text-left`,children:[(0,Y.jsx)(Ue,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Y.jsx)(Be,{children:(0,Y.jsx)(`span`,{"data-webhook-destination":``,title:Ut(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,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Y.jsx)(yt,{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,Y.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Y.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Y.jsxs)(ze,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Y.jsx)(O,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(O,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,Y.jsx)(ht,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function Kt({id:e}){return(0,Y.jsxs)(I,{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,Y.jsx)(xe,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function qt({id:e}){let t=p(e),n=t.data?L(t.data):e;return(0,Y.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,Y.jsxs)(I,{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,Y.jsx)(xe,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Y.jsx)(O,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Jt=3,$=(e,t)=>e.kind===t.kind&&e.number===t.number;function Yt(e,t,n=Jt){let r=t?e.findIndex(e=>$(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 Xt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Zt({tab:e}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(e.kind===`pr`?ve:Ce,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Y.jsx)(Pe,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Qt(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function $t({servers:e}){let t=lt();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,Y.jsx)(De,{"aria-hidden":`true`}),Qt(e,n),t.live?(0,Y.jsx)(Ye,{tone:`success`,"aria-label":`Preview is live`}):null]})}function en(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function tn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,Y.jsx)(Kt,{id:n}):(0,Y.jsx)(qt,{id:n})}function nn({isDesktop:e,desktopActivitySlot:t,attention:n,statusLine:r}){return e&&t?(0,Y.jsx)(Y.Fragment,{children:t}):(0,Y.jsx)(K,{dot:n.tone,shape:n.shape,pulse:n.pulse,className:`max-md:hidden`,children:Nt(r)})}function rn(e,t,n){return n&&!e.archiveBlocker&&t.archive?(0,Y.jsx)(Dt,{run:e}):null}function an({archived:e,className:t}){return e?(0,Y.jsx)(K,{"data-slot":`run-archived-pill`,dot:U.tone,shape:U.shape,className:t,children:U.label}):null}function on({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Y.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function sn({shown:e,run:t,previewToggle:n}){let r=Wt(t);return e&&(n||r)?(0,Y.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,(0,Y.jsx)(Q,{run:t})]}):null}function cn({isDesktop:e,phoneBar:t,run:n,previewToggle:r,mobileActivitySlot:a}){let o=Wt(n);if(e||!a)return null;let s=t&&(!!r||o);return(0,Y.jsxs)(`div`,{"data-slot":s?`run-mobile-actions`:void 0,"data-mobile-session-bar":t||void 0,className:i(`flex flex-wrap items-center gap-2 md:hidden`,t&&`border-t border-border py-1`),children:[a,s?(0,Y.jsxs)(`span`,{className:`ms-auto flex shrink-0 flex-wrap items-center gap-2`,children:[r,(0,Y.jsx)(Q,{run:n})]}):null]})}function ln({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:a,phoneBar:o,isDesktop:s}){let c=(0,J.useRef)(null),[l,u]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let e=c.current;if(!e||s){u(!1);return}let t=()=>u(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)}},[s,r,a,e.diffStat?.files]);let d=n?`${n.kind}#${n.number}`:null;return(0,J.useEffect)(()=>{!d||s||c.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[d,r.map(e=>`${e.kind}#${e.number}`).join(`,`),s]),(0,Y.jsxs)(`div`,{ref:c,"data-slot":`run-tabs`,"data-phone-bar":o||void 0,"data-overflow-end":l||void 0,className:i(`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]`,o?`mt-0`:`mt-3`),children:[(0,Y.jsx)(q,{to:`/tasks/${e.id}`,active:t===`session`,replace:o,children:`Session`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:o,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:o,children:`Commits`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:o,children:`Files`}),r.map(t=>(0,Y.jsx)(q,{to:Xt(e.id,t),active:n!==null&&$(t,n),replace:o,children:(0,Y.jsx)(Zt,{tab:t})},`${t.kind}-${t.number}`)),a.length>0?(0,Y.jsxs)(F,{children:[(0,Y.jsxs)(N,{"data-slot":`run-tabs-more`,"aria-label":`${a.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:[`+`,a.length]}),(0,Y.jsx)(P,{align:`end`,children:a.map(t=>(0,Y.jsx)(A,{asChild:!0,children:(0,Y.jsx)(I,{to:Xt(e.id,t),replace:o,children:(0,Y.jsx)(Zt,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function un({run:e,tab:t=`session`,onMarkedUnread:n,desktopActivitySlot:r,mobileActivitySlot:a}){let o=re(e),s=G(e),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),f=dn(e,n),p=ee(),m=ne(),h=Mt(e,{queuePosition:e.status===`queued`?Je(p.data??[]).get(e.id):void 0}),g=Ze(),_=rt(),v=g!==null&&!_?g:null,y=v!==null,{referenceProjectId:te,repoBase:b,requests:ie}=Ft(e),ae=(0,J.useMemo)(()=>ge(e,b),[e,b]),x=typeof t==`object`?t:null,{inline:oe,overflow:se}=Yt(ae,x),S=m.data?.capabilities?.preview===!0,C=e.worktreePath&&S?(0,Y.jsx)($t,{servers:e.previewServers??[]}):null,w=(0,Y.jsx)(hn,{run:e,actions:f,onOpenChooser:()=>d(!0),onToggleNotes:()=>l(e=>!e)}),ce=rn(e,s,_);return(0,Y.jsx)(Ne,{projectId:te,repoBase:b,requests:ie,children:(0,Y.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:i(`relative z-20 shrink-0 bg-background px-4 md:px-9 md:pt-7`,y?`pt-0`:`pt-[18px]`,t===`session`&&`border-b border-border`),children:[(0,Y.jsx)(on,{run:e}),(0,Y.jsx)(At,{run:e}),(0,Y.jsxs)(`div`,{className:`w-full`,children:[(0,Y.jsx)(tn,{run:e}),v?(0,Y.jsxs)(tt,{slot:v,children:[(0,Y.jsx)(mn,{run:e,status:(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(K,{"data-slot":`mobile-run-status`,dot:o.tone,shape:o.shape,pulse:o.pulse,className:`max-w-full self-start truncate px-2 py-px text-xs leading-4`,children:h.label}),(0,Y.jsx)(an,{archived:e.archived,className:`px-2 py-px text-xs leading-4`})]})}),(0,Y.jsx)(tn,{run:e,compact:!0}),w]}):(0,Y.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,Y.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:en(e.delegation)}),(0,Y.jsx)(pn,{run:e}),(0,Y.jsx)(nn,{isDesktop:_,desktopActivitySlot:r,attention:o,statusLine:h}),(0,Y.jsx)(an,{archived:e.archived,className:`max-md:hidden`}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[ce,C,(0,Y.jsx)(Q,{run:e}),w]})]}),(0,Y.jsx)(sn,{shown:v!==null&&!a,run:e,previewToggle:C}),(0,Y.jsx)(ln,{run:e,tab:t,activeItem:x,inlineItemTabs:oe,overflowItemTabs:se,phoneBar:y,isDesktop:_}),(0,Y.jsx)(cn,{isDesktop:_,phoneBar:y,run:e,previewToggle:C,mobileActivitySlot:a}),c?(0,Y.jsx)(vn,{runId:e.id,onClose:()=>l(!1)}):null,u?(0,Y.jsx)(zt,{run:e,canResume:G(e).terminal,onResume:()=>f.terminal.mutate(),onClose:()=>d(!1)}):null]}),(0,Y.jsx)(_n,{run:e,actions:f})]})})}function dn(e,t){let n=se(),r=Ge(),[i,a]=(0,J.useState)(null),o=()=>n.invalidateQueries({queryKey:f.runs.all}),l=e=>S(e.message,{tone:`danger`}),u=c(),d={isPending:u.isPending,mutate:()=>u.mutate({id:e.id,pinned:!e.pinned})},p=s();return{pin:d,markUnread:{isPending:p.isPending,mutate:()=>{t?.(),p.mutate(e.id,{onError:l})}},delete:m({mutationFn:()=>ce(e.id),onSuccess:()=>{o(),r(`/`)},onError:l}),terminal:It(e),confirming:i,setConfirming:a}}function fn(e){let t=o(e.id),n=L(e);return{title:n,editor:ft(n,e=>t.mutate({title:e},{onError:e=>S(e.message,{tone:`danger`})}))}}function pn({run:e}){let{title:t,editor:n}=fn(e);return n.editing?(0,Y.jsx)(ot,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Y.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Y.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,Y.jsx)(dt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function mn({run:e,status:t}){let{title:n,editor:r}=fn(e);return(0,Y.jsxs)(Re,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,Y.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,Y.jsx)(Ie,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(dt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(Le,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,Y.jsx)(ot,{editor:r,className:`text-[16px] font-semibold`})})]})}function hn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=G(e),a=W(e),s=rt(),c=wt(e.id),[l,u]=(0,J.useState)(!1),d=o(e.id),f=(0,J.useId)();return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Et,{run:e,open:l,onOpenChange:u,onConfirm:()=>{c.mutate(!0),u(!1)}}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(N,{asChild:!0,children:(0,Y.jsx)(O,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Y.jsx)(Ee,{"aria-hidden":`true`})})}),(0,Y.jsxs)(P,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Y.jsx)(k,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),!s&&i.archive&&!e.archiveBlocker?(0,Y.jsx)(A,{disabled:c.isPending,onSelect:()=>e.archived?c.mutate(!1):u(!0),children:Tt(e)}):null,(0,Y.jsxs)(A,{onSelect:n,children:[(0,Y.jsx)(pt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Y.jsx)(zt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,Y.jsxs)(A,{onSelect:()=>void X(a,`Command copied to clipboard.`),children:[(0,Y.jsx)(T,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Y.jsxs)(A,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Y.jsx)(St,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Y.jsxs)(M,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Y.jsx)(Ct,{"aria-hidden":`true`}):(0,Y.jsx)(we,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,Y.jsx)(j,{}),(0,Y.jsx)(k,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Y.jsx)(M,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:d.isPending,onCheckedChange:e=>d.mutate({archiveWhenDone:e},{onError:e=>S(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Y.jsx)(M,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:d.isPending,"aria-describedby":f,onCheckedChange:e=>d.mutate({autoMergePr:e},{onError:e=>S(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Y.jsx)(`p`,{id:f,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,Y.jsx)(gn,{run:e,patch:d}),i.deleteRun?(0,Y.jsx)(j,{}):null,i.deleteRun?(0,Y.jsxs)(A,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Y.jsx)(ye,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function gn({run:e,patch:t}){let n=(0,J.useId)(),r=(0,J.useId)(),i=(0,J.useId)(),a=e=>S(e.message,{tone:`danger`});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j,{}),(0,Y.jsx)(k,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,Y.jsx)(M,{"data-slot":`allow-workers`,className:`min-h-11`,checked:oe(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,Y.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,Y.jsx)(M,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:C(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,Y.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,Y.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 _n({run:e,actions:t}){let n=t.confirming;return(0,Y.jsx)(B,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Y.jsxs)(z,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(at,{className:`text-danger`,children:`Delete task permanently?`}),(0,Y.jsx)(H,{children:(0,Y.jsxs)(Y.Fragment,{children:[`Delete “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:L(e),children:L(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!le(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,Y.jsxs)(mt,{children:[(0,Y.jsx)(it,{children:`Cancel`}),(0,Y.jsx)(nt,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function vn({runId:e,onClose:t}){let n=y(e);return(0,Y.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,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Y.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Y.jsx)(be,{})})]}),(0,Y.jsx)(`div`,{"data-slot":`notes-panel-body`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:n.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Y.jsx)(bt,{runId:e,children:(0,Y.jsx)(vt,{children:n.data})}):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})}),(0,Y.jsxs)(`div`,{className:`mt-4 flex shrink-0 gap-3`,children:[(0,Y.jsx)(O,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void X(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Y.jsx)(O,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{It as a,Rt as i,Bt as n,Ft as o,Vt as r,Mt as s,un as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{c as a,d as o,l as s}from"./design-icons-CzEoMH9c.js";import{a as c,n as l}from"./dist-BW234Kg5.js";import{a as u,i as d,n as f,r as p,t as m}from"./dist-C5mlVBmd.js";import{h,m as g}from"./dropdown-menu-4e2iKSMT.js";import{a as _,c as v,i as y,l as b,n as x,o as S,r as C,t as w,u as T}from"./es2015-CQth82uv.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-BAoXdNsT.js";import{Qn as ee}from"./index-8eoz1i7-.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=h(R),[H,U]=d(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,x]=M.useState(null),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=g(l),[D,k]=m({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=m({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=b(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:p,trigger:y,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=W(n),o=G(ae,n),s=o.disabled||r,l=c(t,o.onTriggerChange),d=B(n),f=M.useRef(`touch`),[m,h,g]=$e(e=>{let t=d().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),_=e=>{s||(o.onOpenChange(!0),g()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...a,children:(0,F.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:l,onClick:p(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:p(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:p(i.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(_(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,l=G(se,n),{onValueNodeHasChildrenChange:d}=l,p=a!==void 0,m=c(t,l.onValueNodeChange);f(()=>{d(p)},[d,p]);let h=$(l.value);return(0,F.jsx)(u.span,{...s,asChild:!h&&s.asChild,ref:m,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?o:a},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(y,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return f(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(T,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=l(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=c(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return w(E)},[E]),C();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(x,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(S,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...b,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:p(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(J,n),o=X(J,n),[s,l]=M.useState(null),[d,p]=M.useState(null),m=c(t,p),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=o,S=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&d&&v&&y&&b){let e=a.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=h(),c=window.innerHeight-Y*2,l=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=c-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&y===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);s.style.height=n+`px`}else{let e=o.length>0&&y===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,a.trigger,a.valueNode,s,d,v,y,b,a.dir,r]);f(()=>S(),[S]);let[C,w]=M.useState();return f(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,F.jsx)(Te,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(u.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=X(De,n),o=Ee(De,n),s=c(t,a.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:p(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=b();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(u.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(u.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(Z,n),l=X(Z,n),d=s.value===r,[f,m]=M.useState(a??``),[h,g]=M.useState(!1),_=c(t,v(e=>l.itemRefCallback?.(e,r,i))),y=b(),x=M.useRef(`touch`),S=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:i,textId:y,isSelected:d,onItemTextChange:M.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,F.jsx)(u.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:p(o.onFocus,()=>g(!0)),onBlur:p(o.onBlur,()=>g(!1)),onClick:p(o.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(o.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(o.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(o.onPointerMove,e=>{x.current=e.pointerType,i?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:p(o.onKeyDown,e=>{i||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Q,n),s=X(Q,n),l=Ie(Q,n),d=re(Q,n),[p,m]=M.useState(null),h=v(e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),g=c(t,m,l.onItemTextChange,h),_=p?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:_},l.value),[l.disabled,l.value,_]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return f(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u.span,{id:l.textId,...a,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?N.createPortal(a.children,o.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),f(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(u.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:i,onValueChange:a,required:o,disabled:s,name:l,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=M.useRef(null),g=c(n,h),_=i??``,v=E(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:s,form:f,onChange:e=>a(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(p)]},m)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=v(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(s,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(a,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(o,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{c as a,d as o,l as s}from"./design-icons-CzEoMH9c.js";import{a as c,n as l}from"./dist-BW234Kg5.js";import{a as u,i as d,n as f,r as p,t as m}from"./dist-C5mlVBmd.js";import{h,m as g}from"./dropdown-menu-4e2iKSMT.js";import{a as _,c as v,i as y,l as b,n as x,o as S,r as C,t as w,u as T}from"./es2015-CQth82uv.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-BAoXdNsT.js";import{$n as ee}from"./index-6yHpyOyH.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=h(R),[H,U]=d(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,x]=M.useState(null),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=g(l),[D,k]=m({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=m({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=b(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:p,trigger:y,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=W(n),o=G(ae,n),s=o.disabled||r,l=c(t,o.onTriggerChange),d=B(n),f=M.useRef(`touch`),[m,h,g]=$e(e=>{let t=d().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),_=e=>{s||(o.onOpenChange(!0),g()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...a,children:(0,F.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:l,onClick:p(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:p(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:p(i.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(_(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,l=G(se,n),{onValueNodeHasChildrenChange:d}=l,p=a!==void 0,m=c(t,l.onValueNodeChange);f(()=>{d(p)},[d,p]);let h=$(l.value);return(0,F.jsx)(u.span,{...s,asChild:!h&&s.asChild,ref:m,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?o:a},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(y,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return f(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(T,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=l(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=c(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return w(E)},[E]),C();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(x,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(S,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...b,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:p(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(J,n),o=X(J,n),[s,l]=M.useState(null),[d,p]=M.useState(null),m=c(t,p),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=o,S=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&d&&v&&y&&b){let e=a.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=h(),c=window.innerHeight-Y*2,l=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=c-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&y===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);s.style.height=n+`px`}else{let e=o.length>0&&y===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,a.trigger,a.valueNode,s,d,v,y,b,a.dir,r]);f(()=>S(),[S]);let[C,w]=M.useState();return f(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,F.jsx)(Te,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(u.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=X(De,n),o=Ee(De,n),s=c(t,a.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:p(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=b();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(u.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(u.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(Z,n),l=X(Z,n),d=s.value===r,[f,m]=M.useState(a??``),[h,g]=M.useState(!1),_=c(t,v(e=>l.itemRefCallback?.(e,r,i))),y=b(),x=M.useRef(`touch`),S=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:i,textId:y,isSelected:d,onItemTextChange:M.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,F.jsx)(u.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:p(o.onFocus,()=>g(!0)),onBlur:p(o.onBlur,()=>g(!1)),onClick:p(o.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(o.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(o.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(o.onPointerMove,e=>{x.current=e.pointerType,i?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:p(o.onKeyDown,e=>{i||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Q,n),s=X(Q,n),l=Ie(Q,n),d=re(Q,n),[p,m]=M.useState(null),h=v(e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),g=c(t,m,l.onItemTextChange,h),_=p?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:_},l.value),[l.disabled,l.value,_]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return f(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u.span,{id:l.textId,...a,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?N.createPortal(a.children,o.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),f(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(u.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:i,onValueChange:a,required:o,disabled:s,name:l,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=M.useRef(null),g=c(n,h),_=i??``,v=E(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:s,form:f,onChange:e=>a(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(p)]},m)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=v(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(s,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(a,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(o,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt as t};
|
package/web/dist/assets/{session-context-section-CFw0aFoC.js → session-context-section-B5Ee7GbQ.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{D as i,O as a,S as o}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{t as r}from"./utils-DSMR_WLb.js";import{D as i,O as a,S as o}from"./queries-D0v1z40Y.js";import{Fn as s,n as c}from"./toaster-DMfiAEnw.js";import{t as l}from"./plus-CxRU2X8C.js";import{t as u}from"./button-B7MKxYjT.js";import{t as d}from"./badge-DQ3U69Ht.js";import{t as f}from"./centered-state-V15AR_qo.js";import{Yn as p,pn as m,sr as h}from"./index-6yHpyOyH.js";import{t as g}from"./code-editor-B4baSOhz.js";var _=e(t(),1);function v(e,t,n){let r=e.indexOf(t),i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(!(i[n]===void 0||r===-1))return e[(r+i[n]+e.length)%e.length]}var y=n(),b={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},x={"built-in":`built in`,shared:`shared`,local:`local`},S={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},C=e=>`${e.toLocaleString(`en-US`)} B`;function ee({id:e,preview:t,role:n,onRole:i,pending:a,className:o}){return(0,y.jsxs)(`section`,{id:e,"data-slot":`session-context-preview`,"aria-labelledby":`session-context-preview-title`,"aria-busy":a,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,o),children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Combined preview`}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,y.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,y.jsx)(te,{role:n,onRole:i}),(0,y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Handoff, shared, then local. Files come from the project checkout.`})]}),t?(0,y.jsx)(ne,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,y.jsx)(`div`,{className:`h-[38px]`})]}),(0,y.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,y.jsx)(T,{block:e,role:n},`${e.source}-${e.id}-${t}`))})]})}var w=[`parent`,`worker`];function te({role:e,onRole:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=v(w,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`inline-flex overflow-hidden rounded-md border border-[var(--control-border)]`,children:w.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,role:`radio`,"aria-checked":e===i,tabIndex:e===i?0:-1,"data-slot":`session-context-role`,onClick:()=>t(i),className:r(`min-h-11 px-4 text-[13px] capitalize text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,e===i&&`bg-muted text-foreground`),children:i},i))})}function ne({used:e,limit:t,blocks:n}){let r=n.filter(e=>e.status===`applied`).length,i=n.filter(e=>e.status===`skipped`).length,a=Math.min(100,e/t*100);return(0,y.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,y.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${C(e)} of ${C(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,y.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[C(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,y.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,C(t),`)`]})]})]})}function T({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status,i=e.overridesShared?`local · overrides shared`:x[e.source],a=e.source===`built-in`||e.overridesShared,o=e.reason!==null&&!(e.status===`applied`&&e.overridesShared);return(0,y.jsxs)(`li`,{"data-slot":`session-context-block`,"data-status":e.status,"data-source":e.source,className:`flex flex-col gap-1.5 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),(0,y.jsx)(d,{"data-slot":`session-context-source`,variant:`outline`,className:r(`text-xs`,a&&`border-accent-strong/40 text-link-foreground`),children:i}),e.target&&e.target!==`built-in`&&(0,y.jsx)(d,{variant:`outline`,className:`text-xs`,children:b[e.target]}),(0,y.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:C(e.bytes)}),(0,y.jsx)(d,{variant:`outline`,className:r(`text-xs`,S[e.status]),children:n})]}),o&&(0,y.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,y.jsxs)(`pre`,{tabIndex:0,"aria-label":`${e.id} text`,className:`max-h-28 overflow-auto rounded-md bg-background px-2.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[e.text,e.truncated?`
|
|
2
2
|
…`:``]})]})}var re=Symbol.for(`yaml.alias`),E=Symbol.for(`yaml.document`),D=Symbol.for(`yaml.map`),ie=Symbol.for(`yaml.pair`),O=Symbol.for(`yaml.scalar`),k=Symbol.for(`yaml.seq`),A=Symbol.for(`yaml.node.type`),j=e=>!!e&&typeof e==`object`&&e[A]===re,ae=e=>!!e&&typeof e==`object`&&e[A]===E,oe=e=>!!e&&typeof e==`object`&&e[A]===D,M=e=>!!e&&typeof e==`object`&&e[A]===ie,N=e=>!!e&&typeof e==`object`&&e[A]===O,se=e=>!!e&&typeof e==`object`&&e[A]===k;function P(e){if(e&&typeof e==`object`)switch(e[A]){case D:case k:return!0}return!1}function F(e){if(e&&typeof e==`object`)switch(e[A]){case re:case D:case O:case k:return!0}return!1}var ce=e=>(N(e)||P(e))&&!!e.anchor,I=Symbol(`break visit`),le=Symbol(`skip children`),L=Symbol(`remove node`);function ue(e,t){let n=pe(t);ae(e)?de(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):de(null,e,n,Object.freeze([]))}ue.BREAK=I,ue.SKIP=le,ue.REMOVE=L;function de(e,t,n,r){let i=me(e,t,n,r);if(F(i)||M(i))return he(e,r,i),de(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=de(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(M(t)){r=Object.freeze(r.concat(t));let e=de(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=de(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}async function fe(e,t){let n=pe(t);ae(e)?await R(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):await R(null,e,n,Object.freeze([]))}fe.BREAK=I,fe.SKIP=le,fe.REMOVE=L;async function R(e,t,n,r){let i=await me(e,t,n,r);if(F(i)||M(i))return he(e,r,i),R(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await R(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(M(t)){r=Object.freeze(r.concat(t));let e=await R(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=await R(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}function pe(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function me(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(oe(t))return n.Map?.(e,t,r);if(se(t))return n.Seq?.(e,t,r);if(M(t))return n.Pair?.(e,t,r);if(N(t))return n.Scalar?.(e,t,r);if(j(t))return n.Alias?.(e,t,r)}function he(e,t,n){let r=t[t.length-1];if(P(r))r.items[e]=n;else if(M(r))e===`key`?r.key=n:r.value=n;else if(ae(r))r.contents=n;else{let e=j(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var ge={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},_e=e=>e.replace(/[!,[\]{}]/g,e=>ge[e]),z=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+_e(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&F(e.contents)){let t={};ue(e.contents,(e,n)=>{F(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
3
3
|
`)}};z.defaultYaml={explicit:!1,version:`1.2`},z.defaultTags={"!!":`tag:yaml.org,2002:`};function ve(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function ye(e){let t=new Set;return ue(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function be(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function xe(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=ye(e);let a=be(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(N(t.node)||P(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function Se(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Se(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Se(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Se(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Se(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function B(e,t,n){if(Array.isArray(e))return e.map((e,t)=>B(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ce(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Ce=class{constructor(e){Object.defineProperty(this,A,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!ae(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=B(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Se(i,{"":o},``,o):o}},we=class extends Ce{constructor(e){super(re),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ue(e,{Node:(e,t)=>{(j(t)||ce(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(B(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Te(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ve(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Te(e,t,n){if(j(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(P(t)){let r=0;for(let i of t.items){let t=Te(e,i,n);t>r&&(r=t)}return r}else if(M(t)){let r=Te(e,t.key,n),i=Te(e,t.value,n);return Math.max(r,i)}return 1}var Ee=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends Ce{constructor(e){super(O),this.value=e}toJSON(e,t){return t?.keep?this.value:B(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var De=`tag:yaml.org,2002:`;function Oe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ke(e,t,n){if(ae(e)&&(e=e.contents),F(e))return e;if(M(e)){let t=n.schema[D].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new we(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=De+t.slice(2));let l=Oe(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[D]:Symbol.iterator in Object(e)?o[k]:o[D]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ae(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ke(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var je=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Me=class extends Ce{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>F(t)||M(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(je(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(P(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(P(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&N(i)?i.value:i:P(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!M(t))return!1;let n=t.value;return n==null||e&&N(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return P(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(P(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ne=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function H(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var U=(e,t,n)=>e.endsWith(`
|
|
4
4
|
`)?H(n,t):n.includes(`
|
package/web/dist/assets/{settings-agent-picker-DIEyNQVg.js → settings-agent-picker-DeczgUDV.js}
RENAMED
|
@@ -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{t as r}from"./utils-DSMR_WLb.js";import{$t as i,Gt as a,Zt as o,dn as s,rn as c,yt as l}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{t as r}from"./utils-DSMR_WLb.js";import{$t as i,Gt as a,Zt as o,dn as s,rn as c,yt as l}from"./queries-D0v1z40Y.js";import{In as u,Tr as d,hi as f,ii as p,zn as m}from"./toaster-DMfiAEnw.js";import{it as h,l as g}from"./design-icons-CzEoMH9c.js";import{t as _}from"./button-B7MKxYjT.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-B531GGAo.js";import{Zn as w}from"./index-6yHpyOyH.js";var T=e(t(),1),E=n();function D(e,t){return o(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.configDir?e.exists?e.configDir:`${e.configDir} — folder not created yet`:e.exists?``:`Not initialized on host yet`,missing:!e.exists,...e.isDefault||e.status===void 0?{}:{accountStatus:e.status.status}}))})}var O=(e,t)=>e.length>i(t).length;function k(e,t,n){let r=d(e.data,t),i=r!==void 0&&r.status!==`not-installed`&&(n??r.status)===`connected`,a=!e.isPending&&!e.isError&&r?.enabled===!0&&i;return{providerConnected:a,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:r?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:a?void 0:`Connect this provider before selecting it.`}}function A({rows:e,runner:t,accountFor:n,providerStatus:i,disabled:a=!1,accountDisabled:o=!1,onPick:s}){let l=c().data,u=l===void 0,d=O(e,l);return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:r(`gap-0.5 rounded-md border border-border bg-card p-0.5`,d?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let{providerConnected:l,providerReason:f}=k(i,c.runner.id,c.accountStatus),p=e.filter(e=>e.runner.id===c.runner.id).length>1,m=c.runner.id===t&&c.account===n(c.runner.id);return(0,E.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":c.runner.id,"data-account":c.account??``,title:f??c.desc,disabled:a||u||!l||p&&o,onClick:()=>s(c.runner.id,c.account,p),className:r(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,d?(0,E.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-xs text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}async function j(e,t){return m(await u.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function M(e){return m(await u.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function N(e,t){return m(await u.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function P(e){return m(await u.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function F(e,t){let n=f(),[r,i]=(0,T.useState)(!1),[o,c]=(0,T.useState)(null),[l,u]=(0,T.useState)(``),d=(0,T.useRef)(null),m=(0,T.useRef)(!0),h=(0,T.useRef)(0),g=()=>{h.current++,v.current=!1;let e=d.current;d.current=null,e?.state===`waiting`&&P(e.id).catch(()=>{}),c(null),u(``),i(!1)};(0,T.useEffect)(()=>(m.current=!0,()=>{m.current=!1,h.current++;let e=d.current;e?.state===`waiting`&&P(e.id).catch(()=>{})}),[]);let _=s({mutationFn:n=>j(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!m.current||!v.current||t!==h.current){P(e.id).catch(()=>{});return}d.current=e,c(e)}}),v=(0,T.useRef)(r);v.current=r;let y=p({queryKey:[`browser-sign-in`,o?.id],queryFn:()=>M(o.id),enabled:r&&o?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),b=y.data??o,x=s({mutationFn:()=>N(o.id,l),retry:!1,onSuccess:()=>{u(``),y.refetch()}});return(0,T.useEffect)(()=>{b?.state===`connected`&&(d.current=b,c(b),Promise.all([n.invalidateQueries({queryKey:a.agentProfiles}),n.invalidateQueries({queryKey:a.providerStatus}),n.invalidateQueries({queryKey:a.models(e)})]))},[b,n,e]),{open:r,result:b,redirect:l,setRedirect:u,start:_,replay:x,status:y,error:_.error??x.error??y.error,close:g,connect:()=>{i(!0),v.current=!0,_.reset(),x.reset(),_.mutate(++h.current)}}}function I(){return`Open the sign-in link in your browser. After Google consent, the page shows a code. Copy that code, or the full address of that page, and paste it below.`}function L({provider:e,profileId:t,label:n}){let{open:r,result:i,redirect:a,setRedirect:o,start:s,replay:c,status:u,error:d,close:f,connect:p}=F(e,t);return l().data?.capabilities?.settingsAdmin===!0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:s.isPending,onClick:p,children:`Connect`}),(0,E.jsx)(C,{open:r,onOpenChange:e=>{e||f()},children:(0,E.jsxs)(x,{children:[(0,E.jsxs)(b,{children:[(0,E.jsxs)(S,{children:[`Sign in to `,n]}),(0,E.jsx)(y,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),s.isPending?(0,E.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,i?.state===`waiting`?(0,E.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,E.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,E.jsx)(I,{})}),(0,E.jsxs)(`label`,{className:`grid gap-2`,children:[`Code or page address`,(0,E.jsx)(w,{type:`text`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value)})]}),(0,E.jsx)(_,{disabled:!a.trim()||c.isPending,onClick:()=>c.mutate(),children:`Complete sign-in`})]}):null,i?.state===`connected`?(0,E.jsx)(`p`,{role:`status`,children:`Connected.`}):null,i?.state===`failed`?(0,E.jsx)(`p`,{role:`alert`,children:i.error}):null,i?.state===`cancelled`?(0,E.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,d?(0,E.jsx)(`p`,{role:`alert`,children:d.message}):null,u.isError&&i?.state===`waiting`?(0,E.jsx)(_,{onClick:()=>void u.refetch(),children:`Retry status`}):null,(0,E.jsx)(v,{children:(0,E.jsx)(_,{variant:`outline`,onClick:f,children:i?.state===`connected`?`Done`:`Cancel`})})]})})]}):null}function R(e){let t=e.label.startsWith(e.runner.pickerLabel)?e.label.slice(e.runner.pickerLabel.length):``;return{...e,label:`${e.runner.displayName}${t}`}}function z(e){let t=(0,T.useRef)(null),n=e.rows.map(R),r=n.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id)),i=n.find(t=>t.runner.id===e.runner)?.runner.displayName;return(0,E.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,E.jsxs)(`summary`,{children:[(0,E.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:r?.label??i??e.runner}),(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,E.jsx)(A,{...e,rows:n,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}export{k as a,O as i,L as n,D as r,z as t};
|
|
@@ -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{Ft as r,It as i,Mt as a,St as o,gt as s,kt as c}from"./queries-D0v1z40Y.js";import{Cn as l,Dn as u,On as d,Sn as f,n as p,wn as m}from"./toaster-DMfiAEnw.js";import{n as h,p as g,r as _}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{l as v,u as y}from"./design-icons-CzEoMH9c.js";import{t as b}from"./plus-CxRU2X8C.js";import{t as x}from"./button-B7MKxYjT.js";import{n as ee,r as te,t as S}from"./collapsible-BEV4FO-1.js";import{t as C}from"./switch-DKqVf8-p.js";import{t as w}from"./badge-DQ3U69Ht.js";import{n as T,s as E,t as D}from"./project-router-BifLGgRR.js";import"./attention-Dt-QhJ3p.js";import{a as O,l as k}from"./page-shell-7pLJMOgh.js";import{Zn as A,dt as ne,ft as j,pn as M,pt as N,qn as re,z as ie}from"./index-6yHpyOyH.js";import{t as ae}from"./textarea-vJt9undk.js";import{n as oe,t as se}from"./saved-draft-BwzBc-_Y.js";import{ArchiveOnMergeField as ce}from"./archive-on-merge-field-C5WFm3HO.js";import{a as le,i as ue,n as de,t as fe}from"./projects-section-CKPqFZP7.js";import{n as P}from"./settings-field-DP9sYv5a.js";import{t as pe}from"./project-location-CspXXtNm.js";var F=e(t(),1),I={"needs-you":{label:`Needs you`,hint:`Asks a question, asks for permission, or waits for review`},failed:{label:`Failed`,hint:`Failed, with no scheduled resume`},done:{label:`Done`,hint:`Finished`},cancelled:{label:`Cancelled`,hint:`Was cancelled`},running:{label:`Running`,hint:`Runs an agent turn`},"waiting-workers":{label:`Waiting for agents`,hint:`Waits on its workers or their replies`},"waiting-ci":{label:`Waiting on CI`,hint:`Waits on a pull request's checks`},"waiting-timer":{label:`Waiting`,hint:`Waits on a timer`},"waiting-other":{label:`Any other wait`,hint:`Waits on anything else, including wait types added later`}},L=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e)),R={name:``,description:``,url:``,token:``,tasks:!0,triggers:u,agent:!1};function z(e){return{name:e.name,description:e.description??``,url:e.url,token:``,tasks:e.tasks,triggers:e.triggers??u,agent:e.agent}}var B=e=>d.filter(t=>e.includes(t));function me(e){let t=e.description.trim();return{name:e.name.trim(),url:e.url.trim(),...t?{description:t}:{},...e.token?{token:e.token}:{},tasks:e.tasks,...L(e.triggers,u)?{}:{triggers:B(e.triggers)},agent:e.agent}}function he(e){return e.name.trim()!==``||e.description.trim()!==``||e.url.trim()!==``||e.token!==``||e.tasks!==R.tasks||e.agent!==R.agent||!L(e.triggers,R.triggers)}function ge(e,t){let n={},r=e.name.trim(),i=e.description.trim(),a=e.url.trim();return r!==t.name&&(n.name=r),i!==(t.description??``)&&(n.description=i),a!==t.url&&(n.url=a),e.token&&(n.token=e.token),e.tasks!==t.tasks&&(n.tasks=e.tasks),L(e.triggers,t.triggers??u)||(n.triggers=B(e.triggers)),e.agent!==t.agent&&(n.agent=e.agent),n}var V=n(),H=`flex flex-col gap-1 text-[13px]`,U=`text-xs text-muted-foreground`;function W({draft:e,onChange:t,tokenSet:n}){let r=(0,F.useId)(),i=(0,F.useId)(),a=(0,F.useId)(),o=(0,F.useId)(),s=(0,F.useId)(),c=(0,F.useId)(),u=(0,F.useId)(),p=(0,F.useId)(),h=(0,F.useId)(),g=(0,F.useId)();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3`,children:[(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:r,className:U,children:`Name`}),(0,V.jsx)(A,{id:r,"data-slot":`webhook-name`,autoComplete:`off`,maxLength:80,placeholder:`e.g. Team bot`,value:e.name,onChange:e=>t({name:e.target.value})})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:o,className:U,children:`URL`}),(0,V.jsx)(A,{id:o,"data-slot":`webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,maxLength:m,placeholder:`https://bot.example/hooks/cez`,value:e.url,onChange:e=>t({url:e.target.value})})]})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:i,className:U,children:`Description`}),(0,V.jsx)(ae,{id:i,"data-slot":`webhook-description`,"aria-describedby":a,rows:2,maxLength:f,placeholder:`e.g. Posts to the #releases channel. Use it for release notes.`,value:e.description,onChange:e=>t({description:e.target.value})}),(0,V.jsx)(`span`,{id:a,className:`text-xs text-soft-foreground`,children:`Agents read the name and description to decide when to use this webhook.`})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:s,className:U,children:`Token`}),(0,V.jsx)(A,{id:s,"data-slot":`webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:l,"aria-describedby":c,placeholder:n?`Token set — type to replace`:`Optional Bearer token`,value:e.token,onChange:e=>t({token:e.target.value})}),(0,V.jsx)(`span`,{id:c,className:`text-xs text-soft-foreground`,children:n?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo. It is sent as a Bearer header.`})]}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(C,{id:u,"aria-describedby":p,"data-slot":`webhook-tasks`,checked:e.tasks,onCheckedChange:e=>t({tasks:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:u,className:`font-medium`,children:`Task notifications`}),(0,V.jsx)(`span`,{id:p,className:`text-xs text-soft-foreground`,children:`Tasks you hand off, or start with notify on, send their status here.`})]})]}),e.tasks?(0,V.jsxs)(`fieldset`,{"data-slot":`webhook-triggers`,className:`flex flex-col gap-1 sm:ps-[3.25rem]`,children:[(0,V.jsx)(`legend`,{className:`pbe-1 text-xs text-muted-foreground`,children:`Send a delivery when a task enters`}),(0,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-x-3`,children:d.map(n=>(0,V.jsxs)(`label`,{className:`flex min-h-11 items-start gap-2.5 pbs-2 text-[13px]`,children:[(0,V.jsx)(`input`,{type:`checkbox`,"data-trigger":n,checked:e.triggers.includes(n),onChange:r=>t({triggers:r.target.checked?[...e.triggers,n]:e.triggers.filter(e=>e!==n)}),className:`mbs-0.5 size-[18px] shrink-0`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:I[n].label}),(0,V.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:I[n].hint})]})]},n))}),(0,V.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Handing a task off and Send test always deliver.`})]}):null]}),(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(C,{id:h,"aria-describedby":g,"data-slot":`webhook-agent`,checked:e.agent,onCheckedChange:e=>t({agent:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:h,className:`font-medium`,children:`Let agents send reports`}),(0,V.jsx)(`span`,{id:g,className:`text-xs text-soft-foreground`,children:`Agents in this project may post a report here when the task calls for it.`})]})]})]})}var G=`max-sm:h-11`,K=(e,t)=>({tone:`alert`,text:`Not saved: ${e.message}. Fix the field and select ${t} again.`}),_e=e=>e.dryRun?{tone:`ok`,text:`Dry run: nothing was sent.`}:e.ok?{tone:`ok`,text:`Delivered (HTTP ${e.status??200}).`}:{tone:`danger`,text:`Not delivered: ${e.error??`unknown error`}.`};function q({feedback:e}){return e?(0,V.jsx)(`p`,{"data-slot":e.tone===`alert`?`webhook-error`:`webhook-result`,role:e.tone===`alert`?`alert`:`status`,className:e.tone===`ok`?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:e.text}):null}var J=`rounded-md border border-border bg-background`,Y=`flex flex-col gap-3 border-bs border-border p-3`;function ve({projectId:e,webhook:t,defaultOpen:n=!1}){let i=r(),o=c(),s=a(),[l,u]=(0,F.useState)(n),[d,f]=oe(z(t),se),[m,h]=(0,F.useState)(null),g=ge(d,t),_=Object.keys(g).length>0;M(_);let y=d.name.trim()!==``&&d.url.trim()!==``,b=i.isPending||o.isPending||s.isPending,C={projectId:e,webhookId:t.id},T=e=>i.mutate({...C,...g},{onSuccess:()=>{f(e=>({...e,token:``})),e?e():p(`${d.name.trim()} saved`)},onError:e=>h(K(e,`Save`))}),E=()=>s.mutate(C,{onSuccess:e=>h(_e(e)),onError:e=>h({tone:`danger`,text:e.message})});return(0,V.jsx)(`li`,{"data-slot":`webhook-card`,"data-webhook-id":t.id,className:J,children:(0,V.jsxs)(S,{open:l,onOpenChange:u,children:[(0,V.jsx)(te,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"data-action":`webhook-toggle`,className:`group flex min-h-11 w-full items-center gap-3 rounded-md p-3 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground pointer-hover:bg-muted/50 active:bg-muted/50`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(`span`,{"data-slot":`webhook-card-name`,className:`min-w-0 break-words text-[13px] font-medium`,children:t.name}),t.tasks?(0,V.jsx)(w,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,V.jsx)(w,{variant:`secondary`,"data-badge":`agent`,children:`Agents`}):null]}),(0,V.jsx)(`span`,{"data-slot":`webhook-card-url`,className:`truncate text-[12px] text-muted-foreground`,children:ie(t.url)})]}),(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(ee,{children:(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"data-reports-dirty":``,className:Y,onSubmit:e=>{e.preventDefault(),h(null),y&&_&&T()},children:[(0,V.jsx)(W,{draft:d,tokenSet:t.tokenSet,onChange:e=>f(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,"data-action":`webhook-save`,disabled:b||!y||!_,children:`Save`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`outline`,"data-action":`webhook-test`,disabled:b||!y,onClick:()=>{h(null),_?T(E):E()},children:`Send test`}),t.tokenSet?(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-clear-token`,disabled:b,onClick:()=>i.mutate({...C,token:``},{onSuccess:()=>p(`Webhook token cleared`),onError:e=>h({tone:`danger`,text:`Token not cleared: ${e.message}.`})}),children:`Clear token`}):null,(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`danger-ghost`,"data-action":`webhook-remove`,"aria-label":`Remove ${t.name}`,disabled:b,onClick:()=>o.mutate(C,{onSuccess:()=>p(`${t.name} removed`),onError:e=>h({tone:`danger`,text:`Not removed: ${e.message}.`})}),children:`Remove`})]}),(0,V.jsx)(q,{feedback:m})]})})]})})}function ye({projectId:e,onCreated:t,onCancel:n}){let r=s(),[i,a]=(0,F.useState)(R),[o,c]=(0,F.useState)(null),l=i.name.trim()!==``&&i.url.trim()!==``;return M(he(i)),(0,V.jsxs)(`li`,{"data-slot":`webhook-card`,"data-draft":``,className:J,children:[(0,V.jsx)(`p`,{className:`p-3 text-[13px] font-medium`,children:`New webhook`}),(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"data-reports-dirty":``,"aria-label":`New webhook`,className:Y,onSubmit:n=>{n.preventDefault(),c(null),l&&r.mutate({projectId:e,...me(i)},{onSuccess:({webhook:e})=>{p(`${e.name} created`),t(e)},onError:e=>c(K(e,`Create`))})},children:[(0,V.jsx)(W,{draft:i,tokenSet:!1,onChange:e=>a(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,"data-action":`webhook-create`,disabled:r.isPending||!l,children:`Create`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-cancel`,disabled:r.isPending,onClick:n,children:`Cancel`})]}),(0,V.jsx)(q,{feedback:o})]})]})}function be({project:e}){let t=e.webhooks??[],[n,r]=(0,F.useState)(!1),[i,a]=(0,F.useState)(null),o=t.length>=16;return(0,V.jsx)(P,{title:`Webhooks`,hint:`A webhook gets a POST from Squawk. Tasks can send their status to it, and agents can send it reports.`,children:(0,V.jsxs)(`div`,{"data-slot":`project-webhooks`,className:`flex flex-col gap-3`,children:[t.length===0&&!n?(0,V.jsx)(`p`,{"data-slot":`webhooks-empty`,className:`text-[13px] text-soft-foreground`,children:`No webhooks yet. Add one to send task updates to a bot, or to let agents post reports.`}):null,t.length>0||n?(0,V.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[t.map(t=>(0,V.jsx)(ve,{projectId:e.id,webhook:t,defaultOpen:t.id===i},t.id)),n?(0,V.jsx)(ye,{projectId:e.id,onCancel:()=>r(!1),onCreated:e=>{a(e.id),r(!1)}}):null]}):null,n?null:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`max-sm:h-11`,"data-action":`webhook-add`,disabled:o,onClick:()=>r(!0),children:[(0,V.jsx)(b,{"aria-hidden":`true`}),`Add webhook`]}),o?(0,V.jsxs)(`span`,{className:`text-xs text-soft-foreground`,children:[`A project holds at most `,16,` webhooks.`]}):null]})]})})}function X(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function xe(){let e=E(),t=o(),n=i();if(t.isPending)return(0,V.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(t.isError)return(0,V.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,t.error.message]});let r=t.data,a=r?.projects.find(t=>t.id===e);return!r||!a?null:(0,V.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,V.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,V.jsx)(pe,{}),(0,V.jsx)(Se,{project:a}),(0,V.jsx)(P,{title:`Max parallel tasks`,hint:n.data?`The workspace limit (${n.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:n.data?(0,V.jsx)(fe,{project:a,workspaceMax:n.data.resources.maxParallel}):(0,V.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,V.jsx)(be,{project:a},a.id)]}),(0,V.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,V.jsx)(Z,{project:a,bootProject:r.bootProject})})]})}function Se({project:e}){return(0,V.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Project`}),(0,V.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Branch`}),(0,V.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Status`}),(0,V.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[de[e.status],e.status===`missing`?` — remove it below, or restore the folder`:null]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Added`}),(0,V.jsxs)(`dd`,{className:`mt-1`,children:[X(e.addedAt),(0,V.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Last opened`}),(0,V.jsx)(`dd`,{className:`mt-1`,children:X(e.lastOpenedAt)})]})]})}function Z({project:e,bootProject:t}){let[n,r]=(0,F.useState)(null),i=le(),a=g(),o=e.id===t;return(0,V.jsxs)(P,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and opening it again re-registers it.`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,V.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-xs text-soft-foreground`,children:`Squawk is serving this project — it re-registers itself at every start.`}):null]}),(0,V.jsx)(ue,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function Ce(e){return e===`global`?{Link:h,NavLink:_}:{Link:D,NavLink:T}}function Q({scope:e,title:t,mobileTitle:n,description:r}){let i=re().name,a=e===`global`?`every project`:i??`this project`;return{headerSlot:`settings-main-header`,title:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`md:hidden`,children:n}),(0,V.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` `,(0,V.jsxs)(`span`,{"data-slot":`page-header-scope`,className:`font-normal text-soft-foreground`,children:[`· `,a]})]})]}),subtitle:r,hideSubtitleOnMobile:!0,headerExtra:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"data-slot":`settings-mobile-scope`,className:`mt-1 text-[13px] text-muted-foreground md:hidden`,children:e===`global`?`Applies to every project`:a}),e===`global`?(0,V.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}}function $({scope:e,activeId:t}){let{NavLink:n}=Ce(e),r=N(e);return(0,V.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,V.jsxs)(`summary`,{children:[r.find(e=>e.id===t)?.title??`General`,(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,V.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,V.jsx)(n,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,r.map(t=>(0,V.jsx)(n,{to:j(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function we({section:e,scope:t}){let n=e.component,r=Q({scope:t,title:e.title,description:e.description,mobileTitle:t===`global`?`Global settings`:`Project settings`});return(0,V.jsx)(e.id===`agent-config`?k:O,{route:t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,density:`full`,className:`settings-route`,header:r,children:(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsxs)(`div`,{"data-slot":`settings-mobile-section`,className:`flex flex-col gap-2 md:hidden`,children:[(0,V.jsx)($,{scope:t,activeId:e.id}),e.description?(0,V.jsx)(`p`,{"data-slot":`settings-mobile-section-subtitle`,className:`px-1 text-[13px] leading-normal text-muted-foreground`,children:e.description}):null]}),(0,V.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,V.jsx)(`h2`,{className:`settings-panel-title sr-only`,children:e.title}),(0,V.jsx)(n,{})]})]})})}function Te(){return(0,V.jsx)(O,{route:`settings`,density:`full`,className:`settings-route`,header:Q({scope:`project`,title:`General`,mobileTitle:`Project settings`}),children:(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsx)($,{scope:`project`,activeId:null}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,V.jsx)(xe,{}),(0,V.jsx)(`section`,{className:`rounded-lg border border-card-edge bg-card p-5 shadow-card`,children:(0,V.jsx)(ce,{})}),(0,V.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-card-edge bg-card px-5 pt-5 text-base font-semibold shadow-card md:hidden`,children:`Other project settings`}),(0,V.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:N(`project`).map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(D,{to:j(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-card-edge bg-card p-4 shadow-card transition-colors hover:bg-card-2`,children:[(0,V.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,V.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,V.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]}),(0,V.jsx)(y,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,V.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,V.jsx)(h,{to:ne,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})})}export{Te as SettingsIndexRoute,we as SettingsSectionRoute};
|
|
@@ -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{c as r}from"./utils-DSMR_WLb.js";import{dn as i,y as a}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{c as r}from"./utils-DSMR_WLb.js";import{dn as i,y as a}from"./queries-D0v1z40Y.js";import{I as o,Rr as s,hi as c,zr as l}from"./toaster-DMfiAEnw.js";import{t as u}from"./button-B7MKxYjT.js";import{pn as d}from"./index-6yHpyOyH.js";var f=e(t(),1),p=n(),m=[[`overall`,`Overall`],[`needsYou`,`Needs You`],[`finished`,`Finished`],[`working`,`Working`]];function h(){let e=r(),t=a(e);return t.isPending?(0,p.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading sidebar settings…`}):t.isError?(0,p.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,p.jsxs)(`p`,{role:`alert`,children:[`Sidebar settings did not load: `,t.error.message]}),(0,p.jsx)(u,{className:`min-h-[44px]`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,p.jsx)(g,{scope:e,initial:t.data.sidebarLimits??{}},e)}function g({scope:e,initial:t}){let n=c(),r=s(void 0),a=_(t),[h,g]=(0,f.useState)(()=>({values:a,saved:a,received:a})),{values:y,saved:b}=h,x=e=>g(t=>({...t,values:e})),S=l.safeParse(Object.fromEntries(m.map(([e])=>[e,y[e]===null?null:Number(y[e])]))),C=e=>y[e]!==null&&(y[e].trim()===``||!Number.isSafeInteger(Number(y[e]))||Number(y[e])<=0),w=m.some(([e])=>y[e]!==b[e]);d(w);let T=i({onMutate:()=>n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),mutationFn:t=>o({sidebarLimits:t},e),onSuccess:async t=>{await n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),n.setQueryData([e,`ui-state`],t);let r=_(t.sidebarLimits);g({values:r,saved:r,received:r})}});return!T.isPending&&!v(h.received,a)&&g({values:w?y:a,saved:a,received:a}),(0,p.jsxs)(`form`,{"data-slot":`sidebar-settings`,"data-reports-dirty":``,className:`flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6`,onSubmit:e=>{e.preventDefault(),S.success&&!m.some(([e])=>C(e))&&!T.isPending&&T.mutate(S.data)},children:[(0,p.jsx)(`p`,{id:`sidebar-limits-help`,className:`text-sm text-muted-foreground`,children:`Limits apply to this project on desktop and mobile. The overall budget is shared in section order: Needs You, Finished, then Working. Each section also respects its own limit. Unlimited removes only that constraint.`}),(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pinned tasks and groups containing a pin bypass both limits. A task group counts as one row. Archived uses only the overall limit; archived pins are not exempt.`}),m.map(([e,t])=>(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`label`,{htmlFor:`sidebar-${e}`,className:`text-sm font-medium`,children:t}),(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,p.jsx)(`input`,{id:`sidebar-${e}`,type:`number`,inputMode:`numeric`,min:`1`,step:`1`,value:y[e]??``,disabled:y[e]===null||T.isPending,"aria-invalid":C(e),"aria-describedby":C(e)?`sidebar-${e}-error sidebar-limits-help`:`sidebar-limits-help`,onChange:t=>x({...y,[e]:t.target.value}),className:`min-h-[44px] w-28 rounded-md border border-input bg-card px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`}),(0,p.jsxs)(`label`,{className:`flex min-h-[44px] cursor-pointer items-center gap-2 text-sm`,children:[(0,p.jsx)(`input`,{type:`checkbox`,"aria-label":`${t} Unlimited`,checked:y[e]===null,disabled:T.isPending,onChange:t=>x({...y,[e]:t.target.checked?null:String(r[e]??10)}),className:`size-4 accent-[var(--accent-strong)]`}),`Unlimited`]})]}),C(e)&&(0,p.jsx)(`p`,{id:`sidebar-${e}-error`,className:`text-sm text-danger`,children:`Enter a positive whole number or choose Unlimited.`})]},e)),(0,p.jsx)(u,{type:`submit`,className:`min-h-[44px] self-start`,variant:`primary`,disabled:!w||!S.success||m.some(([e])=>C(e))||T.isPending,children:T.isPending?`Saving…`:`Save sidebar limits`}),T.isError&&(0,p.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save sidebar limits: `,T.error.message]}),T.isSuccess&&!w&&(0,p.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Sidebar limits saved.`})]})}function _(e){let t=s(e);return Object.fromEntries(m.map(([e])=>[e,t[e]===null?null:String(t[e])]))}function v(e,t){return m.every(([n])=>e[n]===t[n])}export{h as SidebarSection};
|
|
@@ -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{t as r}from"./utils-DSMR_WLb.js";import{Jt as i,Wt as a,_ as o,nn as s,rn as c}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{t as r}from"./utils-DSMR_WLb.js";import{Jt as i,Wt as a,_ as o,nn as s,rn as c}from"./queries-D0v1z40Y.js";import{hi as l,n as u,w as d}from"./toaster-DMfiAEnw.js";import{g as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{O as p,T as m,X as h,Y as g,ct as _,l as v,ot as y,tt as b,u as x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./button-B7MKxYjT.js";import{t as C}from"./project-router-BifLGgRR.js";import{f as w,l as T}from"./skills-pM_PouEs.js";import{d as E,n as D,s as O,t as k,u as A}from"./page-shell-7pLJMOgh.js";import{Rn as j,V as M,Zn as N,_n as P}from"./index-6yHpyOyH.js";var F=e(t(),1),I=n(),L=e=>e.split(`@`)[0]||e,R={project:0,user:1,plugin:2,system:3,other:4},z={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function B(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:L(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:z[t],kind:t}}function V(e){let t=new Map;for(let n of e){let e=B(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>R[e.kind]-R[t.kind]||e.label.localeCompare(t.label))}function H(e){let t=e.plugin?`${L(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var U={project:m,user:_,plugin:p,system:p,other:p};function W({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,F.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,I.jsx)(`div`,{"data-slot":`skills-list`,className:`overflow-hidden rounded-xl border border-border bg-card`,children:e.map(e=>{let o=n||!a.has(e.key);return(0,I.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,I.jsx)(G,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,I.jsx)(K,{skill:e,open:e.id===t,runner:r,account:i},w(e))):null]},e.key)})})}function G({group:e,open:t,onToggle:n}){let i=U[e.kind];return(0,I.jsx)(`h2`,{className:`m-0`,children:(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:n,className:`flex min-h-10 w-full items-center gap-2 bg-muted/45 px-3.5 text-left text-xs font-semibold text-muted-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:text-foreground`,children:[(0,I.jsx)(x,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,I.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,I.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function K({skill:e,open:t,runner:n,account:r}){let i=j({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,I.jsxs)(`details`,{"data-slot":`skill-row`,"data-skill":e.id,"data-skill-path":e.path,name:`skill-details`,open:t||void 0,className:`group/skill border-t border-border/60 open:bg-sidebar-row-selected`,children:[(0,I.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-3 py-2 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover [&::-webkit-details-marker]:hidden`,children:[(0,I.jsxs)(`span`,{className:`grid min-w-0 flex-1 grid-cols-1 items-center gap-x-4 gap-y-0.5 sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)]`,children:[(0,I.jsx)(`span`,{className:`truncate text-[13.5px] leading-snug font-semibold text-foreground`,title:e.name,children:H(e)}),e.description?(0,I.jsx)(`span`,{className:`min-w-0 line-clamp-2 text-[13px] leading-snug text-muted-foreground [overflow-wrap:anywhere] group-open/skill:hidden`,title:e.description,children:e.description}):null]}),(0,I.jsx)(v,{"data-slot":`skill-row-cue`,"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/skill:rotate-180 motion-reduce:transition-none`})]}),(0,I.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,I.jsx)(M,{skill:e,heading:null,actions:(0,I.jsx)(S,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,I.jsx)(C,{to:i,children:`Start task`})})})})]})}function q(){let e=o(),[t,n]=(0,F.useState)(null),[a,c]=(0,F.useState)(null),[l,u]=(0,F.useState)(``),[d]=f(),p=t??e.data?.defaultRunner,{runner:m}=s(p??`claude`),_=a?.runner===m?a.id:null,v=e=>c(e===null?null:{runner:m,id:e}),y=i(p,_),b=Q(m,y.account),x=y.data??[],w=T(x,l);return(0,I.jsxs)(A,{route:`skills`,density:y.isPending?`full`:E(w.length),className:`max-md:[padding-block-end:5rem]`,bodyClassName:`gap-5`,header:{title:`Skills`,subtitle:`The skills each agent loads in this project, as its runner reports them.`,secondaryActions:(0,I.jsxs)(O,{variant:`outline`,onClick:()=>void b.run(),disabled:b.running||y.isPending,"data-slot":`skills-refresh`,children:[(0,I.jsx)(g,{"aria-hidden":`true`,className:r(`size-3.5`,b.running&&`motion-safe:animate-spin`)}),`Re-read`]})},sparseFooter:!y.isPending&&w.length>0?(0,I.jsx)(D,{summary:`${w.length} ${w.length===1?`skill`:`skills`} available for this runner. Type / in New task to invoke one, or chain them into a workflow.`,actions:(0,I.jsx)(S,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,I.jsx)(C,{to:`/workflows`,children:`Open workflows`})})}):void 0,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(Y,{runner:m,onChange:e=>{n(e),v(null)}}),(0,I.jsx)(X,{runner:m,account:_,onChange:v}),(0,I.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,"data-slot":`skills-count`,children:y.list?`${x.length} ${x.length===1?`skill`:`skills`}${y.list.source===`cache`?` · from cache`:``}`:null})]}),(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(h,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,I.jsx)(N,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:l,onChange:e=>u(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-9 text-[13px]`})]}),(0,I.jsx)(Z,{query:y}),y.isPending?(0,I.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,I.jsx)(J,{skills:x,matches:w,search:l,onClearSearch:()=>u(``),onRefresh:()=>void b.run(),openId:d.get(`skill`),runner:m,account:y.account??null,unchecked:y.unchecked})]})}function J({skills:e,matches:t,search:n,onClearSearch:r,onRefresh:i,openId:a,runner:o,account:s,unchecked:c}){return e.length===0?c?null:(0,I.jsx)(k,{icon:(0,I.jsx)(b,{}),title:`No skills reported by this runner and account.`,description:`Add a skill to this repository or your runner home, then re-read to refresh the inventory.`,actions:(0,I.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:i,children:`Re-read skills`})}):t.length===0?(0,I.jsx)(k,{icon:(0,I.jsx)(h,{}),title:`No skills match “${n.trim()}”.`,description:`Try a different keyword or clear the filter to browse every available skill.`,actions:(0,I.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:r,children:`Clear filter`})}):(0,I.jsx)(W,{groups:V(t),openId:a,searching:n.trim()!==``,runner:o,account:s})}function Y({runner:e,onChange:t}){let n=c().data;return n?(0,I.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-1 overflow-x-auto rounded-lg border border-border bg-muted/60 p-1`,children:n.runners.map(n=>(0,I.jsx)(`button`,{type:`button`,"aria-pressed":n.id===e,onClick:()=>t(n.id),className:`h-8 shrink-0 rounded-md border border-transparent px-3 text-[13px] font-normal text-muted-foreground transition-colors focus-visible:outline-2 aria-pressed:border-border aria-pressed:bg-card aria-pressed:font-semibold aria-pressed:text-foreground aria-pressed:shadow-xs pointer-hover:text-foreground max-md:h-11`,children:n.displayName},n.id))}):null}function X({runner:e,account:t,onChange:n}){let r=P().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,I.jsxs)(`div`,{className:`relative inline-flex items-center`,children:[(0,I.jsxs)(`select`,{"aria-label":`Account`,value:t??``,onChange:e=>n(e.target.value||null),className:`h-[38px] appearance-none rounded-lg border border-border bg-card pr-8 pl-3 text-[13px] text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,I.jsx)(`option`,{value:``,children:`Account: project default`}),r.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.label},e.id))]}),(0,I.jsx)(v,{"aria-hidden":`true`,className:`pointer-events-none absolute right-2.5 size-3.5 text-muted-foreground`})]})}function Z({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,I.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-pending/40 bg-pending/10 px-3.5 py-2.5 text-[13px]`,children:[e.unchecked&&!e.isPending?(0,I.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,I.jsx)(y,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,I.jsxs)(`span`,{children:[`Skill list unavailable. `,e.list?.reason??e.error?.message,` You can still type a skill id when starting a task.`]})]}):null,t.map((e,t)=>(0,I.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,I.jsx)(y,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,I.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function Q(e,t){let n=l(),[r,i]=(0,F.useState)(!1),o=a.runnerSkills(e,t);return{running:r,run:async()=>{i(!0);try{n.setQueryData(o,await d(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:o.slice(0,3)})}catch(e){u(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{i(!1)}}}}export{q as SkillsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{r as t,t as n}from"./utils-DSMR_WLb.js";import{t as r}from"./project-router-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{r as t,t as n}from"./utils-DSMR_WLb.js";import{t as r}from"./project-router-BifLGgRR.js";var i=e();function a({to:e,active:a=!1,onClick:o,count:s,replace:c,className:l,children:u}){return(0,i.jsxs)(r,{to:e,...t({replace:c}),"aria-current":a?`page`:void 0,onClick:o,className:n(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,a?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`,l),children:[u,s===void 0?null:(0,i.jsx)(`span`,{"data-slot":`tab-count`,className:`ml-1.5 text-xs font-normal text-soft-foreground`,children:s})]})}export{a as t};
|
|
@@ -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{t as r}from"./utils-DSMR_WLb.js";import{C as i,Wt as a,X as o,Y as s,dn as c,yt as l}from"./queries-D0v1z40Y.js";import{Bt as u,Fn as d,Ft as f,Ht as p,Lt as m,Tt as h,at as g,ct as _,hi as v,n as y,tr as b}from"./toaster-DMfiAEnw.js";import{h as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as S,j as C,l as w}from"./design-icons-CzEoMH9c.js";import{t as T}from"./run-header-9NNASXmJ.js";import{i as E,n as D,r as ee}from"./git-toolbar-q-HOZgdL.js";import{t as O}from"./button-B7MKxYjT.js";import{a as k,i as A,o as j,r as M,s as N,t as P}from"./dialog-B531GGAo.js";import{b as F,f as I}from"./task-groups-BdayPxX3.js";import{c as L,d as R}from"./page-shell-7pLJMOgh.js";import{t as z}from"./centered-state-V15AR_qo.js";import{C as B,Pn as V,S as H,X as U,Zt as W,an as te}from"./index-6yHpyOyH.js";import{t as G}from"./markdown-BBDDg-4t.js";import{t as K}from"./textarea-vJt9undk.js";import{t as q}from"./diff-CC-HnvfR.js";var J=e(t(),1),Y=`no worktree — this task ran directly in the repo working tree`;function X(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${Y}`)}function Z(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${Y}`)}function ne(e){let t=e=>({id:`create-pr`,label:`Draft PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Draft PR unavailable — ${Y}`):e.forge===null?t(`Draft PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?b(e.run)?t(`Draft PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):F(e.run)?t(`Draft PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Draft PR`,enabled:!0}:t(`Draft PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function re(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:X(e),n=e.prUrl?[X(e),Z(e)]:[Z(e),ne(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?F(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Q=n();function $({run:e,open:t,onOpenChange:n}){let r=v(),[i,o]=(0,J.useState)(``),s=I(e),l=(0,J.useRef)(s);l.current=s,(0,J.useEffect)(()=>{t&&o(l.current)},[t]);let u=c({mutationFn:t=>g(e.id,t),onSuccess:t=>{y(`Committed ${V(t.sha)}`),n(!1),r.invalidateQueries({queryKey:a.runs.changes(e.id)}),r.invalidateQueries({queryKey:a.runs.all})},onError:e=>y(e.message,{tone:`danger`})}),d=()=>{let e=i.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Q.jsx)(P,{open:t,onOpenChange:n,children:(0,Q.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,Q.jsxs)(j,{children:[(0,Q.jsx)(N,{children:`Commit changes`}),(0,Q.jsxs)(A,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Q.jsx)(K,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{U({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d())}}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(O,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Q.jsx)(O,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function ie(){let{id:e}=x(),t=s(e);return t.isPending?(0,Q.jsx)(B,{tab:`changes`}):t.isError?(0,Q.jsx)(H,{tab:`changes`,error:t.error}):(0,Q.jsx)(ae,{run:t.data})}function ae({run:e}){let t=l(),n=i(),r=o(e.id,F(e)),s=W(),[p,h]=(0,J.useState)(`unified`),[g,b]=(0,J.useState)(!0),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),[E,O]=(0,J.useState)(!1),k=(0,J.useRef)(null),A=v(),j=()=>A.invalidateQueries({queryKey:a.runs.all}),M=e=>y(e.message,{tone:`danger`}),N=c({mutationFn:()=>u(e.id),onSuccess:e=>y(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:M}),P=c({mutationFn:()=>_(e.id),onSuccess:e=>{y(`Draft PR created — ${e.url}`),j()},onError:M}),I=c({mutationFn:()=>m(e.id),onError:e=>{if(e instanceof d&&e.command){navigator.clipboard.writeText(e.command).then(()=>y(`No terminal found — command copied to clipboard.`)).catch(()=>y(`Run manually: ${e.command}`));return}M(e)}}),z=c({mutationFn:t=>f(e.id,t),onError:M}),B=r.isError&&r.error instanceof d&&r.error.status===409,V=re({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!B,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:te(e)!==void 0,prUrl:e.pullRequestUrl}),H=e=>{switch(e){case`commit`:O(!0);break;case`push`:N.mutate();break;case`create-pr`:P.mutate();break;case`open-terminal`:I.mutate();break;case`view-pr`:break}},U=r.data?.files??[],K=(0,J.useMemo)(()=>ee(U),[U]),q=(0,J.useMemo)(()=>U.some(G),[U]),Y=s?p:`unified`;return(0,Q.jsxs)(L,{route:`task-changes`,density:R(U.length),flushPadding:!0,children:[(0,Q.jsx)(T,{run:e,tab:`changes`}),(0,Q.jsx)(D,{bar:V,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:g,preview:x,onModeChange:h,onWrapChange:b,onPreviewChange:q?S:void 0,onAction:H}),r.data?.repointedHead?(0,Q.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Q.jsx)(oe,{changes:r,changesRefused:B,fileCount:U.length,children:(0,Q.jsx)(se,{runId:e.id,files:U,tree:K,selected:C,selectFile:e=>{w(e),k.current?.scrollToPath(e)},diffRef:k,effectiveMode:Y,effectiveWrap:g,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Q.jsx)($,{run:e,open:E,onOpenChange:O})]})}function oe({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(z,{icon:t?(0,Q.jsx)(S,{size:16}):(0,Q.jsx)(C,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Q.jsx)(z,{icon:(0,Q.jsx)(S,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function se({runId:e,files:t,tree:n,selected:i,selectFile:a,diffRef:o,effectiveMode:s,effectiveWrap:c,preview:l,localHandoff:u,onOpenInApp:d}){let[f,m]=(0,J.useState)(!1);return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-4 px-4 pb-9 pt-0 [--diff-sticky-top:0px] md:flex-row md:items-start md:gap-5 md:px-9`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_2rem)] md:w-60 md:overflow-y-auto md:overscroll-contain md:p-3.5 lg:w-[288px]`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`changes-tree-toggle`,"aria-expanded":f,onClick:()=>m(e=>!e),className:`flex min-h-11 w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-xs font-semibold text-foreground md:hidden`,children:[(0,Q.jsxs)(`span`,{children:[`Changed files`,` `,(0,Q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.length,`)`]})]}),(0,Q.jsx)(w,{size:16,"aria-hidden":`true`,className:r(`size-4 shrink-0 text-muted-foreground motion-safe:transition-transform`,f&&`rotate-180`)})]}),(0,Q.jsx)(`h2`,{className:`mb-3 hidden border-b border-border pb-3 text-xs font-semibold md:block`,children:`Changed files`}),(0,Q.jsx)(`div`,{className:r(f?`border-t border-border px-3.5 py-3 md:border-t-0 md:p-0`:`hidden md:block`),children:(0,Q.jsx)(E,{root:n,selected:i,onSelect:e=>{a(e),m(!1)}})})]}),(0,Q.jsx)(q,{files:t,viewRef:o,mode:s,wrap:c,preview:l,loadFileText:t=>ce(e,t),imageSrc:t=>p(e,t),onOpenInApp:u?e=>d(e):void 0,totals:!1,className:`min-w-0 flex-1`})]})}async function ce(e,t){try{let n=await h(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{ie as TaskChangesRoute};
|
|
@@ -1 +1 @@
|
|
|
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,Wt as i,Y as a,Z as o,fn as s}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{Q as r,Wt as i,Y as a,Z as o,fn as s}from"./queries-D0v1z40Y.js";import{Fn as c,St as l}from"./toaster-DMfiAEnw.js";import{h as u}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as d,j as f,ot as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./run-header-9NNASXmJ.js";import{n as h}from"./diff-controls-CnrIcRRG.js";import{t as g}from"./project-router-BifLGgRR.js";import{b as _}from"./task-groups-BdayPxX3.js";import{c as v,d as y}from"./page-shell-7pLJMOgh.js";import{t as b}from"./centered-state-V15AR_qo.js";import{An as x,C as S,Nn as C,S as w,Zt as T,zt as E}from"./index-6yHpyOyH.js";import{t as D}from"./diff-CC-HnvfR.js";import{t as O}from"./change-counts-npLATh-3.js";import{r as k,t as A}from"./commit-list-JK2MEtR0.js";var j=e(t(),1),M=n();function N(){let{id:e}=u(),t=a(e);return t.isPending?(0,M.jsx)(S,{tab:`changes`}):t.isError?(0,M.jsx)(w,{tab:`changes`,error:t.error}):(0,M.jsx)(P,{run:t.data})}function P({run:e}){let{sha:t}=u(),n=r(e.id,_(e)),i=n.data?.commits[0]?.sha;return(0,M.jsxs)(v,{route:`task-commits`,density:y(n.data?.commits.length??0),flushPadding:!0,children:[(0,M.jsx)(m,{run:e,tab:`commits`}),t?(0,M.jsx)(I,{runId:e.id,sha:t}):n.isPending?(0,M.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading commits…`}):n.isError?(0,M.jsx)(b,{icon:(0,M.jsx)(f,{size:16}),tone:n.error instanceof c&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof c&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,M.jsx)(b,{icon:(0,M.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,M.jsx)(F,{run:e,commits:n.data.commits,selectedSha:i})]})}function F({run:e,commits:t,selectedSha:n}){let r=o(e.id,n),i=R(e.id,t),a=(0,j.useRef)(null),s=T(),[c,l]=(0,j.useState)(`unified`),[u,d]=(0,j.useState)(!0),m=s?c:`unified`;return(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 px-4 py-5 md:px-9 lg:flex-row lg:items-start`,children:[(0,M.jsxs)(`div`,{className:`w-full shrink-0 lg:w-[380px] xl:w-[420px]`,children:[(0,M.jsx)(A,{slot:`task-commits`,selectedSha:n,heading:(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[t.length,` `,t.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:t.map(t=>({...t,href:`/tasks/${e.id}/commits/${t.sha}`,stat:i.get(t.sha)}))}),n&&r.data&&r.data.files.length>0?(0,M.jsx)(z,{runId:e.id,sha:n,files:r.data.files,onPick:e=>a.current?.scrollToPath(e)}):null]}),n?(0,M.jsx)(`section`,{"data-slot":`task-commit-preview`,"data-sha":n,className:`min-w-0 flex-1 overflow-hidden rounded-xl border border-border bg-card`,children:r.isPending?(0,M.jsx)(`p`,{className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:`Loading commit diff…`}):r.isError?(0,M.jsx)(b,{icon:(0,M.jsx)(p,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load commit diff`,subtitle:r.error.message}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 border-b border-border px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h3`,{className:`break-words text-sm leading-snug font-semibold text-foreground`,children:r.data.subject}),(0,M.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,M.jsx)(`span`,{children:r.data.author}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(`span`,{title:r.data.when,children:E(r.data.when)}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(C,{sha:r.data.sha??n,variant:`inline`}),r.data.stat?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(x,{stat:r.data.stat})]}):null]})]}),(0,M.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:(0,M.jsx)(h,{mode:c,wrap:u,onModeChange:l,onWrapChange:d})})]}),!r.data.files||r.data.files.length===0?(0,M.jsx)(b,{icon:(0,M.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,M.jsx)(`div`,{className:`p-4 [--diff-sticky-top:0px]`,children:(0,M.jsx)(D,{viewRef:a,files:r.data.files,mode:m,wrap:u,totals:!1,className:`min-w-0`})})]})}):null]})}function I({runId:e,sha:t}){return(0,M.jsx)(k,{commit:o(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:px-9`})}var L=12;function R(e,t){let n=t.length<=L,r=s({queries:t.map(t=>({queryKey:i.runs.commit(e,t.sha),queryFn:({signal:n})=>l(e,t.sha,{signal:n}),enabled:n,retry:!1}))}),a=new Map;return r.forEach((e,n)=>{let r=t[n]?.sha;r&&e.data?.stat&&a.set(r,e.data.stat)}),a}function z({runId:e,sha:t,files:n,onPick:r}){return(0,M.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-4 rounded-xl border border-border bg-card p-4`,children:[(0,M.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[n.length,` `,n.length===1?`file`:`files`,` in`,` `,(0,M.jsx)(C,{sha:t,variant:`inline`,className:`text-[13px] font-medium`})]}),(0,M.jsx)(g,{to:`/tasks/${e}/changes`,className:`text-xs text-muted-foreground hover:text-foreground`,children:`All task changes ›`})]}),(0,M.jsx)(`ul`,{className:`space-y-1`,children:n.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,"data-slot":`task-commit-file`,title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,onClick:()=>r(e.path),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,M.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:e.path}),(0,M.jsx)(O,{adds:e.adds,dels:e.dels,className:`font-mono text-xs`})]})},e.path))})]})}export{N as TaskCommitsRoute};
|
|
@@ -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{d as r,h as i}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as a}from"./markdown-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,h as i}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as a}from"./markdown-NDbXgnqb.js";var o=e(t(),1),s=n();function c({runId:e,children:t}){let n=r(),i=(0,o.useMemo)(()=>({runId:e}),[e]);return n?(0,s.jsx)(l,{runId:e,children:t}):(0,s.jsx)(a.Provider,{value:i,children:t})}function l({runId:e,children:t}){let{projectId:n}=i(),r=(0,o.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,s.jsx)(a.Provider,{value:r,children:t})}export{c as t};
|
|
@@ -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{t as r}from"./utils-DSMR_WLb.js";import{B as i,F as a,N as o,Y as s,et as c}from"./queries-EvENG6TN.js";import{Fn as l,ft as u,nt as d}from"./toaster-Cer2NOxt.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,Y as y,ot as b,u as x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./run-header-CP_2QY0H.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-L0_fbkUZ.js";import{t as k}from"./button-B7MKxYjT.js";import{c as A}from"./page-shell-7pLJMOgh.js";import{t as j}from"./centered-state-V15AR_qo.js";import{C as M,S as N,Xn as P,ar as F,jn as I}from"./index-8eoz1i7-.js";import{r as L}from"./markdown-Dn1C5VnY.js";import{t as R}from"./task-file-scope-CkPO86PU.js";var z=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),B=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),V=e(t(),1),H=n();function U({runId:e,path:t,artifactId:n,worktreePath:r}){let a=i(e,n?null:t),s=o(e,n),c=n?s:a,l=(0,V.useContext)(L),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,V.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,H.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,H.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:`Could not load this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=T(h.path,r,t);if(h.type!==`file`)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,H.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,H.jsx)(L.Provider,{value:g,children:(0,H.jsx)(E,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?d(e,v.id,`image`):u(e,t),...v?{downloadUrl:d(e,v.id,`download`),snapshot:(0,H.jsx)(I,{iso:v.createdAt})}:{}},v?.id??h.path)})}var W=new Map;function G(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var K=(0,V.createContext)(null);function q(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,V.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var J=()=>document.querySelector(`[data-slot="main"]`);function Y(e,t){let n=(0,V.useRef)(null),r=f(),i=h()===`POP`?r.key:G(r.state),[a]=(0,V.useState)(()=>{let t=i?W.get(i):void 0;return t?.runId===e?t:null}),o=(0,V.useRef)(new Set(a?.folders??[])),s=(0,V.useRef)(new Set),[c,l]=(0,V.useState)(0),u=(0,V.useRef)(a===null),d=(0,V.useCallback)(()=>{u.current&&W.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:J()?.scrollTop??0})},[r.key,e]),p=(0,V.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,V.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=J();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,V.useEffect)(()=>{d();let e=[n.current,J()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function X({runId:e,selected:t,onSelect:n}){return(0,H.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function Z({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,V.useContext)(K);return(0,V.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,H.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,H.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,H.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,H.jsx)(H.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,H.jsx)(Q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,H.jsx)($,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Q({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,V.useContext)(K),[c,l]=(0,V.useState)(()=>s?.isOpen(n)??!1);return(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,H.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function $({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?B:g;return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,H.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,H.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function ee(){let{id:e}=m(),t=s(e),n=q();return t.isPending?(0,H.jsx)(M,{tab:`files`}):t.isError?(0,H.jsx)(N,{tab:`files`,error:t.error}):(0,H.jsx)(R,{runId:t.data.id,children:(0,H.jsx)(ne,{run:t.data},`${t.data.id}:${n}`)})}function te(e,t,n,r){let a=i(e,r||n!==null?null:t),s=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?a:s).isPending}function ne({run:e}){let t=c(e.id,``),n=a(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,V.useState)(o??``);(0,V.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=te(e.id,o,s,u),_=Y(e.id,!t.isPending&&g);return(0,H.jsxs)(A,{route:`task-files`,density:re(t.isError),flushPadding:!0,children:[(0,H.jsx)(C,{run:e,tab:`files`}),(0,H.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,H.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,H.jsx)(P,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,H.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,H.jsxs)(`aside`,{ref:_.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,H.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,H.jsx)(j,{icon:h?(0,H.jsx)(z,{}):(0,H.jsx)(b,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,H.jsx)(K.Provider,{value:_.folders,children:(0,H.jsx)(X,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,H.jsx)(ie,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,H.jsx)(U,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,H.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function re(e){return e?`empty`:`full`}function ie({artifacts:e,artifactId:t,onSelect:n}){return(0,H.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,H.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,H.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,H.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,H.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,H.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,H.jsxs)(k,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,H.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{ee as TaskFilesRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{B as i,F as a,N as o,Y as s,et as c}from"./queries-D0v1z40Y.js";import{Fn as l,ft as u,nt as d}from"./toaster-DMfiAEnw.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,Y as y,ot as b,u as x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./run-header-9NNASXmJ.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-C1Nd5SH3.js";import{t as k}from"./button-B7MKxYjT.js";import{c as A}from"./page-shell-7pLJMOgh.js";import{t as j}from"./centered-state-V15AR_qo.js";import{C as M,Mn as N,S as P,Zn as F,or as I}from"./index-6yHpyOyH.js";import{r as L}from"./markdown-NDbXgnqb.js";import{t as R}from"./task-file-scope-emNQrzps.js";var z=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),B=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),V=e(t(),1),H=n();function U({runId:e,path:t,artifactId:n,worktreePath:r}){let a=i(e,n?null:t),s=o(e,n),c=n?s:a,l=(0,V.useContext)(L),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,V.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,H.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,H.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:`Could not load this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=T(h.path,r,t);if(h.type!==`file`)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,H.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,H.jsx)(L.Provider,{value:g,children:(0,H.jsx)(E,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?d(e,v.id,`image`):u(e,t),...v?{downloadUrl:d(e,v.id,`download`),snapshot:(0,H.jsx)(N,{iso:v.createdAt})}:{}},v?.id??h.path)})}var W=new Map;function G(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var K=(0,V.createContext)(null);function q(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,V.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var J=()=>document.querySelector(`[data-slot="main"]`);function Y(e,t){let n=(0,V.useRef)(null),r=f(),i=h()===`POP`?r.key:G(r.state),[a]=(0,V.useState)(()=>{let t=i?W.get(i):void 0;return t?.runId===e?t:null}),o=(0,V.useRef)(new Set(a?.folders??[])),s=(0,V.useRef)(new Set),[c,l]=(0,V.useState)(0),u=(0,V.useRef)(a===null),d=(0,V.useCallback)(()=>{u.current&&W.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:J()?.scrollTop??0})},[r.key,e]),p=(0,V.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,V.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=J();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,V.useEffect)(()=>{d();let e=[n.current,J()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function X({runId:e,selected:t,onSelect:n}){return(0,H.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function Z({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,V.useContext)(K);return(0,V.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,H.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,H.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,H.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,H.jsx)(H.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,H.jsx)(Q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,H.jsx)($,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Q({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,V.useContext)(K),[c,l]=(0,V.useState)(()=>s?.isOpen(n)??!1);return(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,H.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function $({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?B:g;return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,H.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,H.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function ee(){let{id:e}=m(),t=s(e),n=q();return t.isPending?(0,H.jsx)(M,{tab:`files`}):t.isError?(0,H.jsx)(P,{tab:`files`,error:t.error}):(0,H.jsx)(R,{runId:t.data.id,children:(0,H.jsx)(ne,{run:t.data},`${t.data.id}:${n}`)})}function te(e,t,n,r){let a=i(e,r||n!==null?null:t),s=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?a:s).isPending}function ne({run:e}){let t=c(e.id,``),n=a(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,V.useState)(o??``);(0,V.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=te(e.id,o,s,u),_=Y(e.id,!t.isPending&&g);return(0,H.jsxs)(A,{route:`task-files`,density:re(t.isError),flushPadding:!0,children:[(0,H.jsx)(C,{run:e,tab:`files`}),(0,H.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,H.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,H.jsx)(F,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,H.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,H.jsxs)(`aside`,{ref:_.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,H.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,H.jsx)(j,{icon:h?(0,H.jsx)(z,{}):(0,H.jsx)(b,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,H.jsx)(K.Provider,{value:_.folders,children:(0,H.jsx)(X,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,H.jsx)(ie,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,H.jsx)(U,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,H.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function re(e){return e?`empty`:`full`}function ie({artifacts:e,artifactId:t,onSelect:n}){return(0,H.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,H.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,H.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,H.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,H.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,H.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,H.jsxs)(k,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,H.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{ee as TaskFilesRoute};
|