cezarion 0.19.0-dev.8731 → 0.19.0-dev.8751

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/{accounts-section-DVJon113.js → accounts-section-BJPI6m7z.js} +1 -1
  3. package/web/dist/assets/{activity-motion-D_Mig_D4.js → activity-motion-C0kwg24F.js} +1 -1
  4. package/web/dist/assets/{activity-route-BvYIEdOs.js → activity-route-42fC7Mxs.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-BImy20b0.js → agent-config-section-C74gGUgR.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-D30dOTKu.js → agent-defaults-section-lpKgMMNk.js} +1 -1
  7. package/web/dist/assets/{appearance-CHsrT2VO.js → appearance-NUe0p0BF.js} +1 -1
  8. package/web/dist/assets/{automations-route-BEhmjeVF.js → automations-route-B-f1XBAk.js} +1 -1
  9. package/web/dist/assets/{commit-list-02HM16KN.js → commit-list-U-OxWHN-.js} +1 -1
  10. package/web/dist/assets/{diff-BmDcJsHL.js → diff-DZWO3IkH.js} +2 -2
  11. package/web/dist/assets/{diff-controls-HmgYRhy7.js → diff-controls-CSkIE9yB.js} +1 -1
  12. package/web/dist/assets/{diff-view-CRx2ZNOd.js → diff-view-Zt6DGbX2.js} +1 -1
  13. package/web/dist/assets/{file-preview-B361k1Oo.js → file-preview-DKpgJH2C.js} +1 -1
  14. package/web/dist/assets/{git-toolbar-DsNQUL5f.js → git-toolbar-DLTYN21M.js} +1 -1
  15. package/web/dist/assets/{github-DP2REdU5.js → github-Cn5ODryx.js} +1 -1
  16. package/web/dist/assets/{global-activity-route-Iv0uN7Wy.js → global-activity-route-5usGSS4S.js} +1 -1
  17. package/web/dist/assets/{index-mCjln54E.js → index-BEnkhnIC.js} +4 -4
  18. package/web/dist/assets/index-CHtuekzK.css +1 -0
  19. package/web/dist/assets/{markdown-DiMerfHU.js → markdown-B2ioG8t9.js} +1 -1
  20. package/web/dist/assets/{notifications-section-DGH8tp1N.js → notifications-section-1cYsj6Kt.js} +1 -1
  21. package/web/dist/assets/{preview-pane-connected-Cl_6DHNm.js → preview-pane-connected-B1k-xMeW.js} +1 -1
  22. package/web/dist/assets/{projects-section-D3h_nr6-.js → projects-section-B9MczGec.js} +1 -1
  23. package/web/dist/assets/{prompt-templates-section-DelsVm7I.js → prompt-templates-section-B6B3YiYG.js} +1 -1
  24. package/web/dist/assets/{remote-settings-notice-D2x0qeKt.js → remote-settings-notice-CNoeqtGO.js} +1 -1
  25. package/web/dist/assets/{repo-git-DKkOxBOJ.js → repo-git-DfuenTj0.js} +1 -1
  26. package/web/dist/assets/{report-reader-D2b9baRm.js → report-reader-CfpyZKZF.js} +1 -1
  27. package/web/dist/assets/{reports-CBP54u9k.js → reports-HWxwI40r.js} +1 -1
  28. package/web/dist/assets/{resources-section-D86nQvrk.js → resources-section-EsUWF8Gp.js} +1 -1
  29. package/web/dist/assets/{review-panel-BcuyfiuF.js → review-panel-my4q8xfO.js} +1 -1
  30. package/web/dist/assets/{run-header-B2AfxeyZ.js → run-header-BOp4d2LA.js} +1 -1
  31. package/web/dist/assets/{select-KMLdkF0Y.js → select-BC0GRtWk.js} +1 -1
  32. package/web/dist/assets/{session-context-section-Do5bNw8y.js → session-context-section-Cc7O57OB.js} +1 -1
  33. package/web/dist/assets/{settings-agent-picker-Dtqb26Hz.js → settings-agent-picker-2VsJyFCR.js} +1 -1
  34. package/web/dist/assets/{settings-shell-CWPwhUDh.js → settings-shell-DoYsgDvs.js} +1 -1
  35. package/web/dist/assets/{sidebar-section-pLjtUKHT.js → sidebar-section-CJg8mwiE.js} +1 -1
  36. package/web/dist/assets/{skills-CaXsJiUU.js → skills-BJicAwPH.js} +1 -1
  37. package/web/dist/assets/{task-changes-oogngDub.js → task-changes-59Qa1bEL.js} +1 -1
  38. package/web/dist/assets/{task-commits-_Aa8bkJq.js → task-commits-BGtVyWPE.js} +1 -1
  39. package/web/dist/assets/{task-file-scope-DY0ozMDn.js → task-file-scope-CYLbdb6B.js} +1 -1
  40. package/web/dist/assets/{task-files-DxFFK3zI.js → task-files-DKGtV-H2.js} +1 -1
  41. package/web/dist/assets/{task-github-item-LSzJuoiu.js → task-github-item-KzGyb9nv.js} +1 -1
  42. package/web/dist/assets/{task-thread-BlThx_dR.js → task-thread-DpmaZvjj.js} +1 -1
  43. package/web/dist/assets/{thread-state-DA2aAkKF.js → thread-state-BLwfKLzD.js} +1 -1
  44. package/web/dist/assets/{use-hand-to-agent-state-dgiJEULj.js → use-hand-to-agent-state-Dx4mIAAl.js} +1 -1
  45. package/web/dist/assets/{workflows-DNs9e08u.js → workflows-a73JJd3t.js} +1 -1
  46. package/web/dist/assets/{workspace-tools-DHek4GFd.js → workspace-tools-D1ZIqE9E.js} +1 -1
  47. package/web/dist/assets/{worktrees-section-fLfqff8U.js → worktrees-section-CJuySRx_.js} +1 -1
  48. package/web/dist/index.html +2 -2
  49. package/web/dist/assets/index-CVz-Ls8s.css +0 -1
@@ -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{Ft as r,It as i,Mt as a,St as o,gt as s,kt as c}from"./queries-CYWRnyM5.js";import{Cn as l,Dn as u,On as d,Sn as f,n as p,wn as m}from"./toaster-B0kvcFif.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 S,t as C}from"./collapsible-BEV4FO-1.js";import{r as w}from"./switch-SP8pw5uU.js";import{t as T}from"./badge-DQ3U69Ht.js";import{n as E,s as D,t as O}from"./project-router-BvBqllk2.js";import"./attention-CGsbqL2t.js";import{a as k,l as te}from"./page-shell-7pLJMOgh.js";import{Kn as ne,R as re,Xn as A,dt as j,fn as M,ft as N,ut as ie}from"./index-mCjln54E.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-BT4e_k9f.js";import{a as le,i as ue,n as de,t as fe}from"./projects-section-D3h_nr6-.js";import{n as P}from"./settings-field-DP9sYv5a.js";import{t as pe}from"./project-location-CZNz3wYW.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)(w,{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)(w,{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,w={projectId:e,webhookId:t.id},E=e=>i.mutate({...w,...g},{onSuccess:()=>{f(e=>({...e,token:``})),e?e():p(`${d.name.trim()} saved`)},onError:e=>h(K(e,`Save`))}),D=()=>s.mutate(w,{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)(C,{open:l,onOpenChange:u,children:[(0,V.jsx)(S,{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)(T,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,V.jsx)(T,{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:re(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&&_&&E()},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),_?E(D):D()},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({...w,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(w,{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=D(),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:O,NavLink:E}}function Q({scope:e,title:t,mobileTitle:n,description:r}){let i=ne().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`?te:k,{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)(k,{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)(O,{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:ie,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})})}export{Te as SettingsIndexRoute,we as SettingsSectionRoute};
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-CYWRnyM5.js";import{Cn as l,Dn as u,On as d,Sn as f,n as p,wn as m}from"./toaster-B0kvcFif.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 S,t as C}from"./collapsible-BEV4FO-1.js";import{r as w}from"./switch-SP8pw5uU.js";import{t as T}from"./badge-DQ3U69Ht.js";import{n as E,s as D,t as O}from"./project-router-BvBqllk2.js";import"./attention-CGsbqL2t.js";import{a as k,l as te}from"./page-shell-7pLJMOgh.js";import{Kn as ne,R as re,Xn as A,dt as j,fn as M,ft as N,ut as ie}from"./index-BEnkhnIC.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-BT4e_k9f.js";import{a as le,i as ue,n as de,t as fe}from"./projects-section-B9MczGec.js";import{n as P}from"./settings-field-DP9sYv5a.js";import{t as pe}from"./project-location-CZNz3wYW.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)(w,{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)(w,{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,w={projectId:e,webhookId:t.id},E=e=>i.mutate({...w,...g},{onSuccess:()=>{f(e=>({...e,token:``})),e?e():p(`${d.name.trim()} saved`)},onError:e=>h(K(e,`Save`))}),D=()=>s.mutate(w,{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)(C,{open:l,onOpenChange:u,children:[(0,V.jsx)(S,{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)(T,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,V.jsx)(T,{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:re(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&&_&&E()},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),_?E(D):D()},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({...w,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(w,{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=D(),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:O,NavLink:E}}function Q({scope:e,title:t,mobileTitle:n,description:r}){let i=ne().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`?te:k,{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)(k,{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)(O,{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:ie,"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-CYWRnyM5.js";import{I as o,Rr as s,hi as c,zr as l}from"./toaster-B0kvcFif.js";import{t as u}from"./button-B7MKxYjT.js";import{fn as d}from"./index-mCjln54E.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
+ 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-CYWRnyM5.js";import{I as o,Rr as s,hi as c,zr as l}from"./toaster-B0kvcFif.js";import{t as u}from"./button-B7MKxYjT.js";import{fn as d}from"./index-BEnkhnIC.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-CYWRnyM5.js";import{hi as l,n as u,w as d}from"./toaster-B0kvcFif.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-BvBqllk2.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{B as j,Ln as M,Xn as N,gn as P}from"./index-mCjln54E.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=M({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)(j,{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
+ 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-CYWRnyM5.js";import{hi as l,n as u,w as d}from"./toaster-B0kvcFif.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-BvBqllk2.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{B as j,Ln as M,Xn as N,gn as P}from"./index-BEnkhnIC.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=M({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)(j,{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{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-CYWRnyM5.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-B0kvcFif.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-B2AfxeyZ.js";import{i as E,n as D,r as ee}from"./git-toolbar-DsNQUL5f.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-lh9gz7TP.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,Nn as V,S as H,Xt as U,Y as W,in as G}from"./index-mCjln54E.js";import{t as K}from"./markdown-BBDDg-4t.js";import{t as q}from"./textarea-vJt9undk.js";import{t as J}from"./diff-BmDcJsHL.js";var Y=e(t(),1),X=`no worktree — this task ran directly in the repo working tree`;function Z(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 — ${X}`)}function Q(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 — ${X}`)}function te(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 — ${X}`):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 ne(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:Z(e),n=e.prUrl?[Z(e),Q(e)]:[Q(e),te(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 $=n();function re({run:e,open:t,onOpenChange:n}){let r=v(),[i,o]=(0,Y.useState)(``),s=I(e),l=(0,Y.useRef)(s);l.current=s,(0,Y.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,$.jsx)(P,{open:t,onOpenChange:n,children:(0,$.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,$.jsxs)(j,{children:[(0,$.jsx)(N,{children:`Commit changes`}),(0,$.jsxs)(A,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,$.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,$.jsx)(q,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{W({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,$.jsxs)(k,{children:[(0,$.jsx)(O,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,$.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,$.jsx)(B,{tab:`changes`}):t.isError?(0,$.jsx)(H,{tab:`changes`,error:t.error}):(0,$.jsx)(ae,{run:t.data})}function ae({run:e}){let t=l(),n=i(),r=o(e.id,F(e)),s=U(),[p,h]=(0,Y.useState)(`unified`),[g,b]=(0,Y.useState)(!0),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(null),[E,O]=(0,Y.useState)(!1),k=(0,Y.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=ne({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:G(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}},W=r.data?.files??[],q=(0,Y.useMemo)(()=>ee(W),[W]),J=(0,Y.useMemo)(()=>W.some(K),[W]),X=s?p:`unified`;return(0,$.jsxs)(L,{route:`task-changes`,density:R(W.length),flushPadding:!0,children:[(0,$.jsx)(T,{run:e,tab:`changes`}),(0,$.jsx)(D,{bar:V,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:X,wrap:g,preview:x,onModeChange:h,onWrapChange:b,onPreviewChange:J?S:void 0,onAction:H}),r.data?.repointedHead?(0,$.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,$.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,$.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,$.jsx)(oe,{changes:r,changesRefused:B,fileCount:W.length,children:(0,$.jsx)(se,{runId:e.id,files:W,tree:q,selected:C,selectFile:e=>{w(e),k.current?.scrollToPath(e)},diffRef:k,effectiveMode:X,effectiveWrap:g,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,$.jsx)(re,{run:e,open:E,onOpenChange:O})]})}function oe({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,$.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,$.jsx)(z,{icon:t?(0,$.jsx)(S,{size:16}):(0,$.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,$.jsx)(z,{icon:(0,$.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,Y.useState)(!1);return(0,$.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 md:[--diff-sticky-top:1rem]`,children:[(0,$.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_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain md:p-3.5 lg:w-[288px]`,children:[(0,$.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,$.jsxs)(`span`,{children:[`Changed files`,` `,(0,$.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.length,`)`]})]}),(0,$.jsx)(w,{size:16,"aria-hidden":`true`,className:r(`size-4 shrink-0 text-muted-foreground motion-safe:transition-transform`,f&&`rotate-180`)})]}),(0,$.jsx)(`h2`,{className:`mb-3 hidden border-b border-border pb-3 text-xs font-semibold md:block`,children:`Changed files`}),(0,$.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,$.jsx)(E,{root:n,selected:i,onSelect:e=>{a(e),m(!1)}})})]}),(0,$.jsx)(J,{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
+ 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-CYWRnyM5.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-B0kvcFif.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-BOp4d2LA.js";import{i as E,n as D,r as ee}from"./git-toolbar-DLTYN21M.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-lh9gz7TP.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,Nn as V,S as H,Xt as U,Y as W,in as G}from"./index-BEnkhnIC.js";import{t as K}from"./markdown-BBDDg-4t.js";import{t as q}from"./textarea-vJt9undk.js";import{t as J}from"./diff-DZWO3IkH.js";var Y=e(t(),1),X=`no worktree — this task ran directly in the repo working tree`;function Z(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 — ${X}`)}function Q(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 — ${X}`)}function te(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 — ${X}`):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 ne(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:Z(e),n=e.prUrl?[Z(e),Q(e)]:[Q(e),te(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 $=n();function re({run:e,open:t,onOpenChange:n}){let r=v(),[i,o]=(0,Y.useState)(``),s=I(e),l=(0,Y.useRef)(s);l.current=s,(0,Y.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,$.jsx)(P,{open:t,onOpenChange:n,children:(0,$.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,$.jsxs)(j,{children:[(0,$.jsx)(N,{children:`Commit changes`}),(0,$.jsxs)(A,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,$.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,$.jsx)(q,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{W({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,$.jsxs)(k,{children:[(0,$.jsx)(O,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,$.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,$.jsx)(B,{tab:`changes`}):t.isError?(0,$.jsx)(H,{tab:`changes`,error:t.error}):(0,$.jsx)(ae,{run:t.data})}function ae({run:e}){let t=l(),n=i(),r=o(e.id,F(e)),s=U(),[p,h]=(0,Y.useState)(`unified`),[g,b]=(0,Y.useState)(!0),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(null),[E,O]=(0,Y.useState)(!1),k=(0,Y.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=ne({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:G(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}},W=r.data?.files??[],q=(0,Y.useMemo)(()=>ee(W),[W]),J=(0,Y.useMemo)(()=>W.some(K),[W]),X=s?p:`unified`;return(0,$.jsxs)(L,{route:`task-changes`,density:R(W.length),flushPadding:!0,children:[(0,$.jsx)(T,{run:e,tab:`changes`}),(0,$.jsx)(D,{bar:V,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:X,wrap:g,preview:x,onModeChange:h,onWrapChange:b,onPreviewChange:J?S:void 0,onAction:H}),r.data?.repointedHead?(0,$.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,$.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,$.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,$.jsx)(oe,{changes:r,changesRefused:B,fileCount:W.length,children:(0,$.jsx)(se,{runId:e.id,files:W,tree:q,selected:C,selectFile:e=>{w(e),k.current?.scrollToPath(e)},diffRef:k,effectiveMode:X,effectiveWrap:g,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,$.jsx)(re,{run:e,open:E,onOpenChange:O})]})}function oe({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,$.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,$.jsx)(z,{icon:t?(0,$.jsx)(S,{size:16}):(0,$.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,$.jsx)(z,{icon:(0,$.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,Y.useState)(!1);return(0,$.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 md:[--diff-sticky-top:1rem]`,children:[(0,$.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_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain md:p-3.5 lg:w-[288px]`,children:[(0,$.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,$.jsxs)(`span`,{children:[`Changed files`,` `,(0,$.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.length,`)`]})]}),(0,$.jsx)(w,{size:16,"aria-hidden":`true`,className:r(`size-4 shrink-0 text-muted-foreground motion-safe:transition-transform`,f&&`rotate-180`)})]}),(0,$.jsx)(`h2`,{className:`mb-3 hidden border-b border-border pb-3 text-xs font-semibold md:block`,children:`Changed files`}),(0,$.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,$.jsx)(E,{root:n,selected:i,onSelect:e=>{a(e),m(!1)}})})]}),(0,$.jsx)(J,{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-CYWRnyM5.js";import{Fn as c,St as l}from"./toaster-B0kvcFif.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-B2AfxeyZ.js";import{n as h}from"./diff-controls-HmgYRhy7.js";import{t as g}from"./project-router-BvBqllk2.js";import{b as _}from"./task-groups-lh9gz7TP.js";import{c as v,d as y}from"./page-shell-7pLJMOgh.js";import{t as b}from"./centered-state-V15AR_qo.js";import{C as x,Mn as S,Rt as C,S as w,Xt as T,kn as E}from"./index-mCjln54E.js";import{t as D}from"./diff-BmDcJsHL.js";import{t as O}from"./change-counts-npLATh-3.js";import{r as k,t as A}from"./commit-list-02HM16KN.js";var j=e(t(),1),M=n();function N(){let{id:e}=u(),t=a(e);return t.isPending?(0,M.jsx)(x,{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:C(r.data.when)}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(S,{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)(E,{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] md:[--diff-sticky-top:1rem]`,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:[--diff-sticky-top:1rem] 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)(S,{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
+ 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-CYWRnyM5.js";import{Fn as c,St as l}from"./toaster-B0kvcFif.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-BOp4d2LA.js";import{n as h}from"./diff-controls-CSkIE9yB.js";import{t as g}from"./project-router-BvBqllk2.js";import{b as _}from"./task-groups-lh9gz7TP.js";import{c as v,d as y}from"./page-shell-7pLJMOgh.js";import{t as b}from"./centered-state-V15AR_qo.js";import{C as x,Mn as S,Rt as C,S as w,Xt as T,kn as E}from"./index-BEnkhnIC.js";import{t as D}from"./diff-DZWO3IkH.js";import{t as O}from"./change-counts-npLATh-3.js";import{r as k,t as A}from"./commit-list-U-OxWHN-.js";var j=e(t(),1),M=n();function N(){let{id:e}=u(),t=a(e);return t.isPending?(0,M.jsx)(x,{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:C(r.data.when)}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(S,{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)(E,{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] md:[--diff-sticky-top:1rem]`,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:[--diff-sticky-top:1rem] 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)(S,{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-DiMerfHU.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
+ 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-B2ioG8t9.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-CYWRnyM5.js";import{Fn as l,ft as u,nt as d}from"./toaster-B0kvcFif.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-B2AfxeyZ.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-B361k1Oo.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}from"./index-mCjln54E.js";import{r as I}from"./markdown-DiMerfHU.js";import{t as L}from"./task-file-scope-DY0ozMDn.js";var R=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`}]]),z=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`}]]),B=e(t(),1),V=n();function H({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,B.useContext)(I),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,B.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,V.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,V.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:`Could not load this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,V.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,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,V.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,V.jsx)(I.Provider,{value:g,children:(0,V.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:new Date(v.createdAt).toLocaleString()}:{}},v?.id??h.path)})}var U=new Map;function W(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var G=(0,B.createContext)(null);function K(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,B.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 q=()=>document.querySelector(`[data-slot="main"]`);function J(e,t){let n=(0,B.useRef)(null),r=f(),i=h()===`POP`?r.key:W(r.state),[a]=(0,B.useState)(()=>{let t=i?U.get(i):void 0;return t?.runId===e?t:null}),o=(0,B.useRef)(new Set(a?.folders??[])),s=(0,B.useRef)(new Set),[c,l]=(0,B.useState)(0),u=(0,B.useRef)(a===null),d=(0,B.useCallback)(()=>{u.current&&U.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:q()?.scrollTop??0})},[r.key,e]),p=(0,B.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,B.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=q();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,B.useEffect)(()=>{d();let e=[n.current,q()].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 Y({runId:e,selected:t,onSelect:n}){return(0,V.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function X({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,B.useContext)(G);return(0,B.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,V.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,V.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,V.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,V.jsx)(V.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,V.jsx)(Z,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,V.jsx)(Q,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Z({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,B.useContext)(G),[c,l]=(0,B.useState)(()=>s?.isOpen(n)??!1);return(0,V.jsxs)(`li`,{children:[(0,V.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,V.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,V.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function Q({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?z:g;return(0,V.jsx)(`li`,{children:(0,V.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,V.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,V.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function $(){let{id:e}=m(),t=s(e),n=K();return t.isPending?(0,V.jsx)(M,{tab:`files`}):t.isError?(0,V.jsx)(N,{tab:`files`,error:t.error}):(0,V.jsx)(L,{runId:t.data.id,children:(0,V.jsx)(te,{run:t.data},`${t.data.id}:${n}`)})}function ee(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 te({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,B.useState)(o??``);(0,B.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=ee(e.id,o,s,u),_=J(e.id,!t.isPending&&g);return(0,V.jsxs)(A,{route:`task-files`,density:ne(t.isError),flushPadding:!0,children:[(0,V.jsx)(C,{run:e,tab:`files`}),(0,V.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,V.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,V.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,V.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,V.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,V.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,V.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,V.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,V.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,V.jsx)(j,{icon:h?(0,V.jsx)(R,{}):(0,V.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,V.jsx)(G.Provider,{value:_.folders,children:(0,V.jsx)(Y,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,V.jsx)(re,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,V.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,V.jsx)(H,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,V.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 ne(e){return e?`empty`:`full`}function re({artifacts:e,artifactId:t,onSelect:n}){return(0,V.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,V.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,V.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,V.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,V.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,V.jsx)(`li`,{children:(0,V.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,V.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,V.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,V.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,V.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{$ 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-CYWRnyM5.js";import{Fn as l,ft as u,nt as d}from"./toaster-B0kvcFif.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-BOp4d2LA.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-DKpgJH2C.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}from"./index-BEnkhnIC.js";import{r as I}from"./markdown-B2ioG8t9.js";import{t as L}from"./task-file-scope-CYLbdb6B.js";var R=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`}]]),z=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`}]]),B=e(t(),1),V=n();function H({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,B.useContext)(I),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,B.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,V.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,V.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:`Could not load this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,V.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,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,V.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,V.jsx)(I.Provider,{value:g,children:(0,V.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:new Date(v.createdAt).toLocaleString()}:{}},v?.id??h.path)})}var U=new Map;function W(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var G=(0,B.createContext)(null);function K(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,B.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 q=()=>document.querySelector(`[data-slot="main"]`);function J(e,t){let n=(0,B.useRef)(null),r=f(),i=h()===`POP`?r.key:W(r.state),[a]=(0,B.useState)(()=>{let t=i?U.get(i):void 0;return t?.runId===e?t:null}),o=(0,B.useRef)(new Set(a?.folders??[])),s=(0,B.useRef)(new Set),[c,l]=(0,B.useState)(0),u=(0,B.useRef)(a===null),d=(0,B.useCallback)(()=>{u.current&&U.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:q()?.scrollTop??0})},[r.key,e]),p=(0,B.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,B.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=q();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,B.useEffect)(()=>{d();let e=[n.current,q()].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 Y({runId:e,selected:t,onSelect:n}){return(0,V.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function X({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,B.useContext)(G);return(0,B.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,V.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,V.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,V.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,V.jsx)(V.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,V.jsx)(Z,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,V.jsx)(Q,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Z({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,B.useContext)(G),[c,l]=(0,B.useState)(()=>s?.isOpen(n)??!1);return(0,V.jsxs)(`li`,{children:[(0,V.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,V.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,V.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function Q({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?z:g;return(0,V.jsx)(`li`,{children:(0,V.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,V.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,V.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function $(){let{id:e}=m(),t=s(e),n=K();return t.isPending?(0,V.jsx)(M,{tab:`files`}):t.isError?(0,V.jsx)(N,{tab:`files`,error:t.error}):(0,V.jsx)(L,{runId:t.data.id,children:(0,V.jsx)(te,{run:t.data},`${t.data.id}:${n}`)})}function ee(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 te({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,B.useState)(o??``);(0,B.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=ee(e.id,o,s,u),_=J(e.id,!t.isPending&&g);return(0,V.jsxs)(A,{route:`task-files`,density:ne(t.isError),flushPadding:!0,children:[(0,V.jsx)(C,{run:e,tab:`files`}),(0,V.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,V.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,V.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,V.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,V.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,V.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,V.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,V.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,V.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,V.jsx)(j,{icon:h?(0,V.jsx)(R,{}):(0,V.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,V.jsx)(G.Provider,{value:_.folders,children:(0,V.jsx)(Y,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,V.jsx)(re,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,V.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,V.jsx)(H,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,V.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 ne(e){return e?`empty`:`full`}function re({artifacts:e,artifactId:t,onSelect:n}){return(0,V.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,V.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,V.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,V.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,V.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,V.jsx)(`li`,{children:(0,V.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,V.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,V.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,V.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,V.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{$ as TaskFilesRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{n as t}from"./utils-DSMR_WLb.js";import{St as n,Wt as r,Y as i,dn as a,o,r as s,xt as c,yt as l}from"./queries-CYWRnyM5.js";import{hi as u,q as d}from"./toaster-B0kvcFif.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{g as p,p as m}from"./tasks-table-k18AuMR5.js";import{F as h,ot as g,p as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./run-header-B2AfxeyZ.js";import{t as y}from"./external-link-BE6y205O.js";import{l as b}from"./reference-chip-BdikRjql.js";import{t as x}from"./button-B7MKxYjT.js";import{t as S}from"./project-router-BvBqllk2.js";import{c as C}from"./page-shell-7pLJMOgh.js";import{t as w}from"./centered-state-V15AR_qo.js";import{S as T,nr as E,x as D}from"./index-mCjln54E.js";import{n as O,o as k,t as A}from"./use-hand-to-agent-state-dgiJEULj.js";var j=e(),M={issue:`Issue`,pr:`Pull request`};function N({kind:e}){let{id:t}=f(),n=i(t);return n.isPending?(0,j.jsx)(D,{kind:e}):n.isError?(0,j.jsx)(T,{tab:`github-item`,error:n.error}):(0,j.jsx)(P,{run:n.data,kind:e})}function P({run:e,kind:t}){let{n:r}=f(),i=Number(r),a=c(),s=n(),u=l(),d=s.isPending||u.isPending,p=m(e,a).some(e=>e.kind===t&&e.number===i),h=o(t,i,p);return(0,j.jsxs)(C,{route:`task-github-item`,density:p?`full`:`empty`,flushPadding:!0,children:[(0,j.jsx)(v,{run:e,tab:{kind:t,number:i}}),p?(0,j.jsx)(H,{run:e,kind:t,number:i,repoBase:a,item:h}):d?(0,j.jsx)(D,{kind:t,number:i,heading:`h2`}):(0,j.jsx)(w,{icon:(0,j.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${r} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function F(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function I(e,t,n,r){return e===`pr`?n?.[t]??r:r}function L({retry:e,kind:t,number:n}){return(0,j.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(r.githubItem(t,n)),children:`Retry`})}function R({kind:e,number:t,error:n,retryButton:r}){return(0,j.jsx)(w,{icon:(0,j.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${M[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function z({run:e,kind:n,number:r,repoBase:i,reason:a,retryError:o,retryButton:s}){let c=n===`pr`?h:_,l=p(e,i).find(e=>e.kind===`PR`==(n===`pr`)&&e.number===r)?.url;return(0,j.jsx)(w,{icon:(0,j.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:o?.message??a,actions:(0,j.jsxs)(j.Fragment,{children:[s,l&&t(l)?(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,j.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function B({label:e,repoBase:t}){return(0,j.jsx)(w,{icon:(0,j.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${U(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function V({kind:e,item:t,labelColors:n,checks:r}){return(0,j.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,j.jsx)(k,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,j.jsx)(W,{item:t},t.url):null})})}function H({run:e,kind:t,number:n,repoBase:r,item:i}){let o=u(),c=a({mutationFn:e=>d(t,n,{refresh:!0}),onSuccess:(e,t)=>o.setQueryData(t,e)}),l=F(t,i),f=s(l?[n]:[],l),p=f.data?.available?f.data.checks:void 0,m=`${M[t]} #${n}`,h=(0,j.jsx)(L,{retry:c,kind:t,number:n});if(i.isPending)return(0,j.jsx)(D,{kind:t,number:n,heading:`h2`});if(i.isError)return(0,j.jsx)(R,{kind:t,number:n,error:c.error??i.error,retryButton:h});let g=i.data;return g.available?g.item?(0,j.jsx)(V,{kind:t,item:g.item,labelColors:g.labelColors,checks:I(t,n,p,g.item.checks)}):(0,j.jsx)(B,{label:m,repoBase:r}):(0,j.jsx)(z,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function U(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function W({item:e}){let t=A();return(0,j.jsx)(O,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{N as TaskGithubItemRoute};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{n as t}from"./utils-DSMR_WLb.js";import{St as n,Wt as r,Y as i,dn as a,o,r as s,xt as c,yt as l}from"./queries-CYWRnyM5.js";import{hi as u,q as d}from"./toaster-B0kvcFif.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{g as p,p as m}from"./tasks-table-k18AuMR5.js";import{F as h,ot as g,p as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./run-header-BOp4d2LA.js";import{t as y}from"./external-link-BE6y205O.js";import{l as b}from"./reference-chip-BdikRjql.js";import{t as x}from"./button-B7MKxYjT.js";import{t as S}from"./project-router-BvBqllk2.js";import{c as C}from"./page-shell-7pLJMOgh.js";import{t as w}from"./centered-state-V15AR_qo.js";import{S as T,nr as E,x as D}from"./index-BEnkhnIC.js";import{n as O,o as k,t as A}from"./use-hand-to-agent-state-Dx4mIAAl.js";var j=e(),M={issue:`Issue`,pr:`Pull request`};function N({kind:e}){let{id:t}=f(),n=i(t);return n.isPending?(0,j.jsx)(D,{kind:e}):n.isError?(0,j.jsx)(T,{tab:`github-item`,error:n.error}):(0,j.jsx)(P,{run:n.data,kind:e})}function P({run:e,kind:t}){let{n:r}=f(),i=Number(r),a=c(),s=n(),u=l(),d=s.isPending||u.isPending,p=m(e,a).some(e=>e.kind===t&&e.number===i),h=o(t,i,p);return(0,j.jsxs)(C,{route:`task-github-item`,density:p?`full`:`empty`,flushPadding:!0,children:[(0,j.jsx)(v,{run:e,tab:{kind:t,number:i}}),p?(0,j.jsx)(H,{run:e,kind:t,number:i,repoBase:a,item:h}):d?(0,j.jsx)(D,{kind:t,number:i,heading:`h2`}):(0,j.jsx)(w,{icon:(0,j.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${r} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function F(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function I(e,t,n,r){return e===`pr`?n?.[t]??r:r}function L({retry:e,kind:t,number:n}){return(0,j.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(r.githubItem(t,n)),children:`Retry`})}function R({kind:e,number:t,error:n,retryButton:r}){return(0,j.jsx)(w,{icon:(0,j.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${M[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function z({run:e,kind:n,number:r,repoBase:i,reason:a,retryError:o,retryButton:s}){let c=n===`pr`?h:_,l=p(e,i).find(e=>e.kind===`PR`==(n===`pr`)&&e.number===r)?.url;return(0,j.jsx)(w,{icon:(0,j.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:o?.message??a,actions:(0,j.jsxs)(j.Fragment,{children:[s,l&&t(l)?(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,j.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function B({label:e,repoBase:t}){return(0,j.jsx)(w,{icon:(0,j.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${U(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function V({kind:e,item:t,labelColors:n,checks:r}){return(0,j.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,j.jsx)(k,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,j.jsx)(W,{item:t},t.url):null})})}function H({run:e,kind:t,number:n,repoBase:r,item:i}){let o=u(),c=a({mutationFn:e=>d(t,n,{refresh:!0}),onSuccess:(e,t)=>o.setQueryData(t,e)}),l=F(t,i),f=s(l?[n]:[],l),p=f.data?.available?f.data.checks:void 0,m=`${M[t]} #${n}`,h=(0,j.jsx)(L,{retry:c,kind:t,number:n});if(i.isPending)return(0,j.jsx)(D,{kind:t,number:n,heading:`h2`});if(i.isError)return(0,j.jsx)(R,{kind:t,number:n,error:c.error??i.error,retryButton:h});let g=i.data;return g.available?g.item?(0,j.jsx)(V,{kind:t,item:g.item,labelColors:g.labelColors,checks:I(t,n,p,g.item.checks)}):(0,j.jsx)(B,{label:m,repoBase:r}):(0,j.jsx)(z,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function U(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function W({item:e}){let t=A();return(0,j.jsx)(O,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{N as TaskGithubItemRoute};