@open-mercato/cezar 0.9.2 → 0.9.3

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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -2
  3. package/dist/contract/health.d.ts +2 -0
  4. package/dist/contract/index.js +23 -10
  5. package/dist/git-diff-base.d.ts +51 -26
  6. package/dist/git-diff-base.js +163 -37
  7. package/dist/git-diff-base.js.map +1 -1
  8. package/dist/git-worktree.d.ts +15 -6
  9. package/dist/git-worktree.js +10 -3
  10. package/dist/git-worktree.js.map +1 -1
  11. package/dist/server/capabilities.d.ts +15 -1
  12. package/dist/server/capabilities.js +16 -1
  13. package/dist/server/capabilities.js.map +1 -1
  14. package/dist/server/git-changes.d.ts +7 -5
  15. package/dist/server/git-changes.js +15 -10
  16. package/dist/server/git-changes.js.map +1 -1
  17. package/dist/server/server.d.ts +59 -58
  18. package/dist/server/server.js +54 -3
  19. package/dist/server/server.js.map +1 -1
  20. package/dist/workflows/run.d.ts +27 -7
  21. package/dist/workflows/run.js +106 -43
  22. package/dist/workflows/run.js.map +1 -1
  23. package/dist/workspace/config.d.ts +8 -0
  24. package/dist/workspace/config.js +29 -2
  25. package/dist/workspace/config.js.map +1 -1
  26. package/dist/workspace/semaphore.d.ts +7 -1
  27. package/dist/workspace/semaphore.js +10 -4
  28. package/dist/workspace/semaphore.js.map +1 -1
  29. package/dist/workspace/ui-state.d.ts +3 -2
  30. package/dist/workspace/ui-state.js +3 -2
  31. package/dist/workspace/ui-state.js.map +1 -1
  32. package/package.json +3 -3
  33. package/web/dist/assets/{alert-dialog-ghffK6g9.js → alert-dialog-V9cigyAO.js} +1 -1
  34. package/web/dist/assets/arrow-down-DflHdNlN.js +1 -0
  35. package/web/dist/assets/arrow-left-IIL4uR-C.js +1 -0
  36. package/web/dist/assets/centered-state-BkAJVLJE.js +43 -0
  37. package/web/dist/assets/chevron-right-CxAoD1eD.js +1 -0
  38. package/web/dist/assets/circle-check-CdwcIbkx.js +1 -0
  39. package/web/dist/assets/{circle-x-C3EFZ3xf.js → circle-x-Cnc43xJ2.js} +1 -1
  40. package/web/dist/assets/{collapsible-B0JVzd0B.js → collapsible-BlF-7CeC.js} +1 -1
  41. package/web/dist/assets/{commit-list-wm6DPHNs.js → commit-list-D2mKElUx.js} +1 -1
  42. package/web/dist/assets/{compare-variants-DbdP4Y5T.js → compare-variants-CFBY16Rc.js} +1 -1
  43. package/web/dist/assets/{diff-Bizc96qe.js → diff-DE6u5dTe.js} +2 -2
  44. package/web/dist/assets/{diff-stat-Dyfg3ltF.js → diff-stat-B1j6L7C6.js} +1 -1
  45. package/web/dist/assets/{diff-view-CG8ek6tC.js → diff-view-Gb2kk3Le.js} +1 -1
  46. package/web/dist/assets/{dropdown-menu-C1Dlf35P.js → dropdown-menu-Ns-rY6sm.js} +1 -1
  47. package/web/dist/assets/editable-title-BGuiDxFT.js +1 -0
  48. package/web/dist/assets/{ellipsis-vertical-DpGTRqC2.js → ellipsis-vertical-BbxtXb6s.js} +1 -1
  49. package/web/dist/assets/{file-DlUGpUlb.js → file-j5O4NryU.js} +1 -1
  50. package/web/dist/assets/{folder-BAY6Vddy.js → folder-w9Lwj9x9.js} +1 -1
  51. package/web/dist/assets/{git-pull-request-agOG0iGM.js → git-pull-request-DlSop3Ch.js} +1 -1
  52. package/web/dist/assets/{git-toolbar-DGiNMmtY.js → git-toolbar-BdJ8XSxI.js} +1 -1
  53. package/web/dist/assets/github-CCLn2OAU.js +1 -0
  54. package/web/dist/assets/{image-preview-BWGk5fPX.js → image-preview-CcFdkZXW.js} +1 -1
  55. package/web/dist/assets/index-BmHHLbwc.js +6 -0
  56. package/web/dist/assets/index-u8OAnq0r.css +2 -0
  57. package/web/dist/assets/{markdown-BGBOGCA_.js → markdown-q9lm7kQ2.js} +1 -1
  58. package/web/dist/assets/{new-task-form-BpAw_Dks.js → new-task-form-BuYxAWN7.js} +1 -1
  59. package/web/dist/assets/{pill-Dvs-P0xy.js → pill-t97MvPW_.js} +1 -1
  60. package/web/dist/assets/{project-router-Cx8NPoqn.js → project-router-DudOmkHf.js} +1 -1
  61. package/web/dist/assets/{prompt-templates-CSBYBR1I.js → prompt-templates-C5iO3Lda.js} +1 -1
  62. package/web/dist/assets/{refresh-cw-BoGdAykg.js → refresh-cw-_C2EGJK5.js} +1 -1
  63. package/web/dist/assets/{repo-git-PmX-BNMo.js → repo-git-DqQzj33d.js} +1 -1
  64. package/web/dist/assets/{run-diff-EcOkf3ti.js → run-diff-BLoKEnTx.js} +1 -1
  65. package/web/dist/assets/run-header-Dho4eurS.js +1 -0
  66. package/web/dist/assets/{search-x-X3EpVhgs.js → search-x-BgxaJgro.js} +1 -1
  67. package/web/dist/assets/{skill-empty-hint-CZLALx6l.js → skill-empty-hint-D5MOmycv.js} +1 -1
  68. package/web/dist/assets/skills-B5g064CC.js +1 -0
  69. package/web/dist/assets/{sparkles-Dt4q7pbG.js → sparkles-ANSka5bH.js} +1 -1
  70. package/web/dist/assets/{square-terminal-hwBL8XsC.js → square-terminal-qojq20cH.js} +1 -1
  71. package/web/dist/assets/{tab-link-DIlR5T07.js → tab-link-CIcwFJtC.js} +1 -1
  72. package/web/dist/assets/task-changes-yRfsEsnh.js +1 -0
  73. package/web/dist/assets/{task-commits-BTTA5k5T.js → task-commits-yXmDrCoE.js} +1 -1
  74. package/web/dist/assets/{task-files-Da8_4C9g.js → task-files-BDRmCCPN.js} +2 -2
  75. package/web/dist/assets/task-thread-C9AnIz4Z.js +9 -0
  76. package/web/dist/assets/{textarea-CUdokhkv.js → textarea-DVO7pg8Y.js} +1 -1
  77. package/web/dist/assets/{thread-loading-B8q8ukXJ.js → thread-loading-DJDl701Z.js} +1 -1
  78. package/web/dist/assets/{trash-2-DhVIdWv8.js → trash-2-DKcnmg6e.js} +1 -1
  79. package/web/dist/assets/{triangle-alert-XYT0DGCI.js → triangle-alert-CPUEVSZ3.js} +1 -1
  80. package/web/dist/assets/{upload-BKjN59-1.js → upload-D5Jrq7QK.js} +1 -1
  81. package/web/dist/assets/{use-desktop-Bf5LS_P4.js → use-desktop-CXae6uyk.js} +1 -1
  82. package/web/dist/assets/{use-submit-shortcut-CzVyoAMd.js → use-submit-shortcut-RKJLKdsW.js} +1 -1
  83. package/web/dist/assets/{utils-DsLuRXwV.js → utils-Wtkd5E6j.js} +1 -1
  84. package/web/dist/assets/{workflows-o2QU_pvU.js → workflows-CGyTdyds.js} +3 -3
  85. package/web/dist/assets/{zoomable-image-7WyUiaVD.js → zoomable-image-hcqwUIlQ.js} +1 -1
  86. package/web/dist/index.html +22 -22
  87. package/web/dist/assets/arrow-down-Cz8qb71e.js +0 -1
  88. package/web/dist/assets/arrow-left-wcYKQXI_.js +0 -1
  89. package/web/dist/assets/centered-state-ZtnFHA-n.js +0 -43
  90. package/web/dist/assets/chevron-right-G4caF2QV.js +0 -1
  91. package/web/dist/assets/circle-check--KvBxXWp.js +0 -1
  92. package/web/dist/assets/editable-title-5rC_QRBZ.js +0 -1
  93. package/web/dist/assets/github-Vp7lxYGQ.js +0 -1
  94. package/web/dist/assets/index-DSxyJpuK.css +0 -2
  95. package/web/dist/assets/index-DiawI6RX.js +0 -6
  96. package/web/dist/assets/run-header-BGiv6_qX.js +0 -1
  97. package/web/dist/assets/skills-CC91ouGH.js +0 -1
  98. package/web/dist/assets/task-changes-XkHDxzQA.js +0 -1
  99. package/web/dist/assets/task-thread-DoNXUsHr.js +0 -9
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{r as t}from"./utils-DsLuRXwV.js";var n=t(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),r=e(),i=[`.ai/cezar/skills/`,`.ai/skills/`,`.agents/skills/`];function a({children:e}){return(0,r.jsx)(`span`,{className:`font-mono`,children:e})}function o(){return(0,r.jsx)(r.Fragment,{children:i.map((e,t)=>(0,r.jsxs)(`span`,{children:[t>0?t===i.length-1?`, or `:`, `:``,(0,r.jsx)(a,{children:e})]},e))})}function s(){return(0,r.jsxs)(r.Fragment,{children:[`No skills yet. Drop Markdown files into `,(0,r.jsx)(o,{}),` (agent mirrors like`,` `,(0,r.jsx)(a,{children:`.claude/skills/`}),` work too) — optional frontmatter: `,(0,r.jsx)(a,{children:`name`}),`,`,` `,(0,r.jsx)(a,{children:`description`}),`. Global (`,(0,r.jsx)(a,{children:`~/.agents/skills`}),`) and team-repo skills appear here too — try Refresh.`]})}function c(){return(0,r.jsxs)(r.Fragment,{children:[`No skills yet — drop Markdown files into `,(0,r.jsx)(o,{}),` (or a global/team-repo skill source).`]})}export{c as n,n as r,s as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{r as t}from"./utils-Wtkd5E6j.js";var n=t(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),r=e(),i=[`.ai/cezar/skills/`,`.ai/skills/`,`.agents/skills/`];function a({children:e}){return(0,r.jsx)(`span`,{className:`font-mono`,children:e})}function o(){return(0,r.jsx)(r.Fragment,{children:i.map((e,t)=>(0,r.jsxs)(`span`,{children:[t>0?t===i.length-1?`, or `:`, `:``,(0,r.jsx)(a,{children:e})]},e))})}function s(){return(0,r.jsxs)(r.Fragment,{children:[`No skills yet. Drop Markdown files into `,(0,r.jsx)(o,{}),` (agent mirrors like`,` `,(0,r.jsx)(a,{children:`.claude/skills/`}),` work too) — optional frontmatter: `,(0,r.jsx)(a,{children:`name`}),`,`,` `,(0,r.jsx)(a,{children:`description`}),`. Global (`,(0,r.jsx)(a,{children:`~/.agents/skills`}),`) and team-repo skills appear here too — try Refresh.`]})}function c(){return(0,r.jsxs)(r.Fragment,{children:[`No skills yet — drop Markdown files into `,(0,r.jsx)(o,{}),` (or a global/team-repo skill source).`]})}export{c as n,n as r,s as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,A as i,Bn as a,Et as o,G as s,Ot as c,Q as l,Rn as u,Zt as d,a as f,bt as p,dr as m,i as h,in as g,mr as _,t as v,un as y,ur as b,wt as x,yt as S}from"./centered-state-BkAJVLJE.js";import{t as C}from"./utils-Wtkd5E6j.js";import{t as w}from"./arrow-left-IIL4uR-C.js";import{d as T,f as E}from"./new-task-form-BuYxAWN7.js";import{t as D}from"./circle-check-CdwcIbkx.js";import{r as O,t as k}from"./skill-empty-hint-D5MOmycv.js";import{t as A}from"./refresh-cw-_C2EGJK5.js";import{t as j}from"./sparkles-ANSka5bH.js";import{t as M}from"./triangle-alert-CPUEVSZ3.js";import{a as N,c as P,l as F,o as I,r as L,s as R}from"./use-submit-shortcut-RKJLKdsW.js";import{c as z,t as B}from"./project-router-DudOmkHf.js";import{f as V,i as ee,n as te,o as ne}from"./skills-BiWfHmCR.js";import{c as H,g as U,o as W,t as G}from"./index-BmHHLbwc.js";var K=e(t(),1),q=n(),J=`https://github.com/open-mercato/skills`;function Y(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function X(e,t){return Y(e)??[...t]}function re({projectId:e}){let t=_(),n=o(),r=s(),[a,l]=(0,K.useState)(``),d=p(e,!!e),f=r.data??[],m=(0,K.useMemo)(()=>f.map(e=>e.name),[f]),g=(0,K.useRef)([]);g.current=m;let y=(0,K.useMemo)(()=>new Set(X(n.data,m)),[n.data,m]),b=(0,K.useRef)(Promise.resolve()),x=(0,K.useRef)(0),S=(0,K.useCallback)(e=>{let n=c.uiState,r=t.getQueryData(n),a=e(X(r,g.current));t.setQueryData(n,{...r,importedSkills:a});let o=++x.current;b.current=b.current.then(async()=>{try{let e=await u({importedSkills:a});o===x.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:i.skills}))}catch(e){h(e instanceof Error?e.message:String(e),{tone:`danger`}),o===x.current&&t.invalidateQueries({queryKey:n})}})},[t]),w=(0,K.useCallback)(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S]),T=m.length>0&&m.every(e=>y.has(e)),E=(0,K.useCallback)(()=>{if(T){let e=new Set(g.current);S(t=>t.filter(t=>!e.has(t)))}else S(e=>[...new Set([...e,...g.current])])},[T,S]);if(r.isError)return(0,q.jsx)(v,{icon:(0,q.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:r.error.message});let D=a.trim().toLowerCase(),O=D?f.filter(e=>e.name.toLowerCase().includes(D)||(e.description??``).toLowerCase().includes(D)):f;return(0,q.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Manage skills`}),(0,q.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Reusable, technology-agnostic agent skills from`,` `,(0,q.jsx)(`a`,{href:J,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`open-mercato/skills`}),` `,`— PR creation, code review, CI stabilisation, spec writing and more. They're all in your catalog and the composer picker by default; uncheck any you don't want.`]}),(0,q.jsx)(ie,{projectId:e,state:d.data,loadError:d.error}),(0,q.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`These checkboxes choose what cezar shows; updates refresh installed skill files.`}),(0,q.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,q.jsx)(U,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:a,onChange:e=>l(e.target.value),className:`h-8 text-[13px]`}),(0,q.jsx)(`button`,{type:`button`,"data-slot":`import-all`,disabled:m.length===0||n.isPending,onClick:E,className:`h-8 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:T?`Remove all`:`Enable all`})]}),(0,q.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:r.isPending?(0,q.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):O.length>0?O.map(e=>{let t=y.has(e.name);return(0,q.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:C(`flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,q.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>w(e.name),className:`mt-0.5 size-3.5 shrink-0`}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),e.description?(0,q.jsx)(`span`,{className:`mt-0.5 block pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,q.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:f.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ie({projectId:e,state:t,loadError:n}){let a=_(),o=z(),s=(0,K.useRef)(0),[l,u]=(0,K.useState)(!1),d=m({mutationFn:()=>y({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{u(!1),o(T(e))},onError:e=>h(e.message,{tone:`danger`})}),p=(t,n)=>{n.seq===s.current&&(a.setQueryData(c.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(a.invalidateQueries({queryKey:i.skills}),h(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),u(!0)))},v=(e,t)=>{t.seq===s.current&&h(e.message,{tone:`danger`})},b=m({mutationFn:t=>g(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>p(e,t),onError:(e,t)=>v(e,t)}),x=m({mutationFn:t=>r(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>p(e,t),onError:(e,t)=>v(e,t)}),S=e=>{let n=++s.current;e===`apply`?x.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):b.mutate({action:e,seq:n})},w=t?.scopes.some(e=>e.skills.length>0)??!1,E=t?.status===`error`,O=w&&(t?.available||E),k=x.isPending||t?.status===`updating`,j=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],M=t?.scopes.filter(e=>e.updatedAt&&!j.includes(e))??[],B=`Checking installed Open Mercato skills…`;return n?B=`Update status is unavailable right now.`:t?.status===`available`?B=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?B=`Updating installed Open Mercato skills…`:t?.status===`current`?B=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?B=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(B=`The update did not finish for every installation.`),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,q.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,q.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,j.length>0?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,j.map(e=>Z(e.scope)).join(`, `),M.length?`; updated: ${M.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),O?(0,q.jsxs)(f,{"data-action":`skills-update-apply`,size:`sm`,disabled:k,onClick:()=>S(`apply`),children:[(0,q.jsx)(A,{"aria-hidden":`true`,className:C(`size-3.5`,k&&`motion-safe:animate-spin`)}),k?`Updating…`:E?`Retry`:`Update now`]}):t?.status===`current`?(0,q.jsx)(f,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:b.isPending,onClick:()=>S(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,q.jsx)(f,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:b.isPending,onClick:()=>S(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,q.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,q.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,q.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,q.jsx)(D,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,q.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,q.jsx)(L,{open:l,onOpenChange:e=>d.isPending?void 0:u(e),children:(0,q.jsxs)(N,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,q.jsxs)(P,{children:[(0,q.jsx)(F,{children:`Apply the upgrade notes now?`}),(0,q.jsxs)(I,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,q.jsxs)(R,{children:[(0,q.jsx)(f,{type:`button`,variant:`outline`,disabled:d.isPending,onClick:()=>u(!1),children:`No`}),(0,q.jsx)(f,{type:`button`,disabled:d.isPending,onClick:()=>d.mutate(),children:d.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function ae(){return(0,q.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,q.jsx)(oe,{})]})}function oe(){let e=S(),t=x(),n=s(),[r]=b(),[o,c]=(0,K.useState)(``),u=_(),f=l(),p=d().projectId??f.data?.bootProject??``,g=m({mutationFn:()=>a(),onSuccess:e=>{u.setQueryData(i.skills,e),h(`Team skills refreshed.`)},onError:e=>h(e.message,{tone:`danger`})});if(e.isError)return(0,q.jsx)(v,{icon:(0,q.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let y=ne(e.data??[]),T=(n.data?.length??0)>0,D=r.get(`skill`),N=D===Q||D===$||D!==null&&y.some(e=>e.name===D)?D:y[0]?.name??(T?$:Q),P=y.find(e=>e.name===N)??null,F=te(y,o);return(0,q.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,q.jsxs)(`section`,{"data-slot":`skills-list`,className:C(`w-full flex-col border-border md:flex md:w-[320px] md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,D===null?`flex`:`hidden md:flex`),children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,q.jsx)(U,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:o,onChange:e=>c(e.target.value),className:`h-8 text-[13px]`}),(0,q.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:g.isPending,onClick:()=>g.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,q.jsx)(A,{"aria-hidden":`true`,className:C(`size-3`,g.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,q.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,children:e.isPending?(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):F.length>0?F.map(e=>(0,q.jsx)(se,{skill:e,active:N===e.name},e.path)):(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:y.length>0?`(no skills match)`:(0,q.jsx)(k,{})})}),(0,q.jsxs)(`div`,{className:`shrink-0 border-t border-border p-2`,children:[T?(0,q.jsxs)(B,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":N===$?`page`:void 0,className:C(`mb-1 flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===$&&`bg-muted`),children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Manage skills`}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`open-mercato`})]}),(0,q.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`Choose which open-mercato skills appear in your catalog.`})]}):null,(0,q.jsxs)(B,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":N===Q?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===Q&&`bg-muted`),children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(E,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Run from GitHub`}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`bookmarklets`})]}),(0,q.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`One-click skill launch from any GitHub PR or issue.`})]})]})]}),(0,q.jsx)(`section`,{"data-slot":`skills-detail`,className:C(`min-w-0 flex-1 flex-col`,D===null?`hidden md:flex`:`flex`),children:(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:[(0,q.jsxs)(B,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,q.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),N===$?(0,q.jsx)(re,{projectId:p}):N===Q?(0,q.jsx)(G,{skills:y}):P?(0,q.jsx)(W,{skill:P,usedBy:V(t.data?.workflows??[],P.name)}):e.isPending?null:(0,q.jsx)(v,{icon:(0,q.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})}function se({skill:e,active:t}){let n=ee(e);return(0,q.jsx)(`li`,{children:(0,q.jsxs)(B,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":n?`true`:void 0,"aria-current":t?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(j,{"aria-hidden":`true`,className:C(`size-3.5 shrink-0`,n?`text-violet`:`text-soft-foreground`)}),(0,q.jsx)(`span`,{className:C(`min-w-0 truncate font-mono text-[13px]`,n?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,q.jsx)(H,{source:e.source,className:`ml-auto`})]}),e.description?(0,q.jsx)(`span`,{className:`line-clamp-2 pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})})}export{ae as SkillsRoute};
@@ -1 +1 @@
1
- import{r as e}from"./utils-DsLuRXwV.js";var t=e(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]);export{t};
1
+ import{r as e}from"./utils-Wtkd5E6j.js";var t=e(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-DsLuRXwV.js";var t=e(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]);export{t};
1
+ import{r as e}from"./utils-Wtkd5E6j.js";var t=e(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]);export{t};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{r as t,t as n}from"./utils-DsLuRXwV.js";import{t as r}from"./project-router-Cx8NPoqn.js";var i=t(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),a=e();function o({to:e,active:t=!1,onClick:i,children:o}){return(0,a.jsx)(r,{to:e,"aria-current":t?`page`:void 0,onClick:i,className:n(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,t?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`),children:o})}export{i as n,o as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{r as t,t as n}from"./utils-Wtkd5E6j.js";import{t as r}from"./project-router-DudOmkHf.js";var i=t(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),a=e();function o({to:e,active:t=!1,onClick:i,children:o}){return(0,a.jsx)(r,{to:e,"aria-current":t?`page`:void 0,onClick:i,className:n(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,t?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`),children:o})}export{i as n,o as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,Dn as i,Pn as a,Qt as o,U as s,Un as c,a as l,an as u,at as d,dn as f,dr as p,i as m,kn as ee,lr as h,lt as g,mr as _,qt as v,t as y,ut as b,wn as x}from"./centered-state-BkAJVLJE.js";import{a as S,o as C,t as w}from"./run-header-Dho4eurS.js";import{a as T,i as E,n as D,r as O}from"./git-toolbar-BdJ8XSxI.js";import{i as k,t as A}from"./use-desktop-CXae6uyk.js";import{t as j}from"./textarea-DVO7pg8Y.js";import{a as M,c as N,l as P,o as F,r as I,s as L,t as R}from"./use-submit-shortcut-RKJLKdsW.js";import{n as z,r as B}from"./index-BmHHLbwc.js";import{t as te}from"./diff-DE6u5dTe.js";var V=e(t(),1),H=e=>e===`running`||e===`queued`||e===`waiting`,U=`no worktree — this task ran directly in the repo working tree`;function W(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.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 — ${U}`)}function G(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.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${U}`)}function K(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${U}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?H(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function q(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:W(e),n=e.prUrl?[W(e),G(e)]:[G(e),K(e)],r=[];if(e.localHandoff){let t=e.hasSession?H(e.status)?{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 J=n();function Y({run:e,open:t,onOpenChange:n}){let i=_(),[a,o]=(0,V.useState)(``),s=v(e),c=(0,V.useRef)(s);c.current=s,(0,V.useEffect)(()=>{t&&o(c.current)},[t]);let d=p({mutationFn:t=>u(e.id,t),onSuccess:t=>{m(`Committed ${t.sha.slice(0,7)}`),n(!1),i.invalidateQueries({queryKey:r.runs.changes(e.id)}),i.invalidateQueries({queryKey:r.runs.all})},onError:e=>m(e.message,{tone:`danger`})}),f=()=>{let e=a.trim();e.length===0||d.isPending||d.mutate(e)};return(0,J.jsx)(I,{open:t,onOpenChange:n,children:(0,J.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,J.jsxs)(N,{children:[(0,J.jsx)(P,{children:`Commit changes`}),(0,J.jsxs)(F,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,J.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,J.jsx)(j,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{R({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(),f())}}),(0,J.jsxs)(L,{children:[(0,J.jsx)(l,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,J.jsx)(l,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||d.isPending,onClick:f,children:d.isPending?`Committing…`:`Commit`})]})]})})}function X(){let{id:e}=h(),t=g(e);return t.isPending?(0,J.jsx)(B,{tab:`changes`}):t.isError?(0,J.jsx)(z,{tab:`changes`,error:t.error}):(0,J.jsx)(Z,{run:t.data})}function Z({run:e}){let t=s(),n=d(),l=b(e.id,S(e.status)),u=A(),[h,g]=(0,V.useState)(`unified`),[v,x]=(0,V.useState)(!1),[j,M]=(0,V.useState)(null),[N,P]=(0,V.useState)(!1),F=(0,V.useRef)(null),I=_(),L=()=>I.invalidateQueries({queryKey:r.runs.all}),R=e=>m(e.message,{tone:`danger`}),z=p({mutationFn:()=>a(e.id),onSuccess:e=>m(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:R}),B=p({mutationFn:()=>f(e.id),onSuccess:e=>{m(`Draft PR created — ${e.url}`),L()},onError:R}),H=p({mutationFn:()=>ee(e.id),onError:e=>{if(e instanceof o&&e.command){navigator.clipboard.writeText(e.command).then(()=>m(`No terminal found — command copied to clipboard.`)).catch(()=>m(`Run manually: ${e.command}`));return}R(e)}}),U=p({mutationFn:t=>i(e.id,t),onError:R}),W=l.isError&&l.error instanceof o&&l.error.status===409,G=q({status:e.status,hasWorktree:!!e.worktreePath&&!W,branch:e.branch,changedFiles:l.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:C(e)!==void 0,prUrl:e.pullRequestUrl}),K=e=>{switch(e){case`commit`:P(!0);break;case`push`:z.mutate();break;case`create-pr`:B.mutate();break;case`open-terminal`:H.mutate();break;case`view-pr`:break}},X=l.data?.files??[],Z=(0,V.useMemo)(()=>O(X),[X]),Q=u?h:`unified`,$=!u||v;return(0,J.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,J.jsx)(w,{run:e,tab:`changes`}),(0,J.jsx)(D,{bar:G,branch:e.branch,stat:l.data?.stat,mode:Q,wrap:$,onModeChange:g,onWrapChange:x,onAction:K}),l.data?.repointedHead?(0,J.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-6`,children:[`HEAD is on `,(0,J.jsx)(`code`,{children:l.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,J.jsx)(`code`,{children:l.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,l.isPending?(0,J.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):l.isError?(0,J.jsx)(y,{icon:W?(0,J.jsx)(T,{}):(0,J.jsx)(k,{}),tone:W?`neutral`:`danger`,heading:`h2`,title:W?`No changes to show`:`Could not load the changes`,subtitle:l.error.message}):X.length===0?(0,J.jsx)(y,{icon:(0,J.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-5 px-4 py-4 [--diff-sticky-top:10rem] md:px-6`,children:[(0,J.jsx)(`aside`,{className:`sticky top-40 hidden w-60 shrink-0 md:block lg:w-72`,children:(0,J.jsx)(E,{root:Z,selected:j,onSelect:e=>{M(e),F.current?.scrollToPath(e)}})}),(0,J.jsx)(te,{files:X,viewRef:F,mode:Q,wrap:$,loadFileText:t=>ne(e.id,t),imageSrc:t=>c(e.id,t),onOpenInApp:t.data?.capabilities.localHandoff?e=>U.mutate(e):void 0,className:`min-w-0 flex-1`})]}),(0,J.jsx)(Y,{run:e,open:N,onOpenChange:P})]})}async function ne(e,t){try{let n=await x(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{X 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{Xt as r,a as i,dt as a,ft as o,lt as s,sr as c,t as l}from"./centered-state-ZtnFHA-n.js";import{a as u,t as d}from"./run-header-BGiv6_qX.js";import{t as f}from"./arrow-left-wcYKQXI_.js";import{i as p,r as m,t as h}from"./use-desktop-Bf5LS_P4.js";import{t as g}from"./search-x-X3EpVhgs.js";import{t as _}from"./triangle-alert-XYT0DGCI.js";import{t as v}from"./project-router-Cx8NPoqn.js";import{t as y}from"./diff-stat-Dyfg3ltF.js";import{n as b,r as x}from"./index-DiawI6RX.js";import{t as S}from"./diff-Bizc96qe.js";import{t as C}from"./commit-list-wm6DPHNs.js";var w=e(t(),1),T=n();function E(){let{id:e}=c(),t=s(e);return t.isPending?(0,T.jsx)(x,{tab:`changes`}):t.isError?(0,T.jsx)(b,{tab:`changes`,error:t.error}):(0,T.jsx)(D,{run:t.data})}function D({run:e}){let{sha:t}=c(),n=o(e.id,u(e.status));return(0,T.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,T.jsx)(d,{run:e,tab:`commits`}),t?(0,T.jsx)(O,{runId:e.id,sha:t}):n.isPending?(0,T.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,T.jsx)(l,{icon:(0,T.jsx)(p,{}),tone:n.error instanceof r&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof r&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,T.jsx)(l,{icon:(0,T.jsx)(p,{}),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,T.jsx)(C,{slot:`task-commits`,className:`mx-auto w-full max-w-[var(--measure)]`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))})]})}function O({runId:e,sha:t}){let n=a(e,t),o=h(),[s,c]=(0,w.useState)(`unified`),[u,d]=(0,w.useState)(!1),b=n.isError&&n.error instanceof r&&n.error.status===409,x=o?s:`unified`,C=!o||u;return(0,T.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,T.jsx)(i,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,T.jsxs)(v,{to:`/tasks/${e}/commits`,children:[(0,T.jsx)(f,{"aria-hidden":`true`}),`All commits`]})}),n.data?(0,T.jsx)(y,{stat:n.data.stat}):null,(0,T.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,T.jsx)(m,{mode:s,wrap:u,onModeChange:c,onWrapChange:d})})]}),n.isPending?(0,T.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,T.jsx)(l,{icon:b?(0,T.jsx)(g,{}):(0,T.jsx)(_,{}),tone:b?`neutral`:`danger`,heading:`h2`,title:b?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,T.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,T.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,T.jsx)(l,{icon:(0,T.jsx)(p,{}),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,T.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:10rem] md:px-6`,children:(0,T.jsx)(S,{files:n.data.files,mode:x,wrap:C,className:`min-w-0`})})]})]})}export{E 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{Qt as r,a as i,dt as a,ft as o,lr as s,lt as c,t as l}from"./centered-state-BkAJVLJE.js";import{a as u,t as d}from"./run-header-Dho4eurS.js";import{t as f}from"./arrow-left-IIL4uR-C.js";import{i as p,r as m,t as h}from"./use-desktop-CXae6uyk.js";import{t as g}from"./search-x-BgxaJgro.js";import{t as _}from"./triangle-alert-CPUEVSZ3.js";import{t as v}from"./project-router-DudOmkHf.js";import{t as y}from"./diff-stat-B1j6L7C6.js";import{n as b,r as x}from"./index-BmHHLbwc.js";import{t as S}from"./diff-DE6u5dTe.js";import{t as C}from"./commit-list-D2mKElUx.js";var w=e(t(),1),T=n();function E(){let{id:e}=s(),t=c(e);return t.isPending?(0,T.jsx)(x,{tab:`changes`}):t.isError?(0,T.jsx)(b,{tab:`changes`,error:t.error}):(0,T.jsx)(D,{run:t.data})}function D({run:e}){let{sha:t}=s(),n=o(e.id,u(e.status));return(0,T.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,T.jsx)(d,{run:e,tab:`commits`}),t?(0,T.jsx)(O,{runId:e.id,sha:t}):n.isPending?(0,T.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,T.jsx)(l,{icon:(0,T.jsx)(p,{}),tone:n.error instanceof r&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof r&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,T.jsx)(l,{icon:(0,T.jsx)(p,{}),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,T.jsx)(C,{slot:`task-commits`,className:`mx-auto w-full max-w-[var(--measure)]`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))})]})}function O({runId:e,sha:t}){let n=a(e,t),o=h(),[s,c]=(0,w.useState)(`unified`),[u,d]=(0,w.useState)(!1),b=n.isError&&n.error instanceof r&&n.error.status===409,x=o?s:`unified`,C=!o||u;return(0,T.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,T.jsx)(i,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,T.jsxs)(v,{to:`/tasks/${e}/commits`,children:[(0,T.jsx)(f,{"aria-hidden":`true`}),`All commits`]})}),n.data?(0,T.jsx)(y,{stat:n.data.stat}):null,(0,T.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,T.jsx)(m,{mode:s,wrap:u,onModeChange:c,onWrapChange:d})})]}),n.isPending?(0,T.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,T.jsx)(l,{icon:b?(0,T.jsx)(g,{}):(0,T.jsx)(_,{}),tone:b?`neutral`:`danger`,heading:`h2`,title:b?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,T.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,T.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,T.jsx)(l,{icon:(0,T.jsx)(p,{}),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,T.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:10rem] md:px-6`,children:(0,T.jsx)(S,{files:n.data.files,mode:x,wrap:C,className:`min-w-0`})})]})]})}export{E as TaskCommitsRoute};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Vn as r,Xt as i,lt as a,mt as o,sr as s,t as c}from"./centered-state-ZtnFHA-n.js";import{r as l,t as u}from"./utils-DsLuRXwV.js";import{t as d}from"./run-header-BGiv6_qX.js";import{t as f}from"./chevron-right-G4caF2QV.js";import{t as p}from"./file-DlUGpUlb.js";import{t as m}from"./folder-BAY6Vddy.js";import{t as h}from"./triangle-alert-XYT0DGCI.js";import{a as g,i as _,r as v}from"./highlighter-CdHqIwFr.js";import{n as y,r as b}from"./index-DiawI6RX.js";var x=l(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),S=l(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),C=l(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),w=l(`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`}]]),T=l(`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`}]]),E=l(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),D=e(t(),1),O=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function k(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:O.has(t.slice(n+1).toLowerCase())}function A(e){return e.tooLarge?`too-large`:k(e.path)?`image`:e.binary?`binary`:`text`}function j(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var M=n();function N({runId:e,path:t,className:n}){let r=o(e,t??void 0);if(t===null)return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(c,{icon:(0,M.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from the tree to preview it here.`})});if(r.isPending)return(0,M.jsx)(F,{className:n,children:(0,M.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof i&&r.error.status===409;return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(c,{icon:e?(0,M.jsx)(C,{}):(0,M.jsx)(h,{}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,M.jsx)(P,{runId:e,entry:r.data,className:n}):null}function P({runId:e,entry:t,className:n}){let i=A(t);return(0,M.jsxs)(F,{className:n,children:[(0,M.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:j(t.size)})]}),i===`image`?(0,M.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,M.jsx)(`img`,{"data-slot":`file-preview-image`,src:r(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):i===`too-large`?(0,M.jsx)(c,{icon:(0,M.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${j(t.size)} — past the preview cap. Open it in your editor instead.`}):i===`binary`?(0,M.jsx)(c,{icon:(0,M.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${j(t.size)} of binary data — no text preview.`}):(0,M.jsx)(R,{path:t.path,text:t.content??``})]})}function F({className:e,children:t}){return(0,M.jsx)(`section`,{"data-slot":`file-preview`,className:u(`overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var I=1500;function L(e,t){let n=(0,D.useMemo)(()=>t.split(`
2
- `).map(e=>[{content:e}]),[t]),r=(0,D.useMemo)(()=>g(e),[e]),i=n.length>I,[a,o]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(r===null||i)return;let n=!1;return v(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:_(t,r)?.tokens??n}function R({path:e,text:t}){let n=L(e,t);return(0,M.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":g(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex px-4`,children:[(0,M.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,M.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function z({runId:e,selected:t,onSelect:n}){return(0,M.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function B({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=o(e,t);return a.isPending?(0,M.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Loading…`}):a.isError?(0,M.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${24+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,M.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Empty directory`}):(0,M.jsx)(M.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,M.jsx)(V,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,M.jsx)(H,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function V({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[o,s]=(0,D.useState)(!1);return(0,M.jsxs)(`li`,{children:[(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":o?`open`:`closed`,"aria-expanded":o,onClick:()=>s(e=>!e),className:`flex 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+r*14}px`},children:[(0,M.jsx)(f,{"aria-hidden":`true`,className:u(`size-3.5 shrink-0 transition-transform`,o&&`rotate-90`)}),(0,M.jsx)(m,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t})]}),o?(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function H({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=k(t)?T:p;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:u(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+r*14}px`},children:[(0,M.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,M.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:j(n)})]})})}function U(){let{id:e}=s(),t=a(e);return t.isPending?(0,M.jsx)(b,{tab:`files`}):t.isError?(0,M.jsx)(y,{tab:`files`,error:t.error}):(0,M.jsx)(W,{run:t.data})}function W({run:e}){let t=o(e.id,``),[n,r]=(0,D.useState)(null),a=t.isError&&t.error instanceof i&&t.error.status===409;return(0,M.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,M.jsx)(d,{run:e,tab:`files`}),t.isPending?(0,M.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`}):t.isError?(0,M.jsx)(c,{icon:a?(0,M.jsx)(w,{}):(0,M.jsx)(h,{}),tone:a?`neutral`:`danger`,heading:`h2`,title:a?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 md:flex-row md:items-start md:px-6`,children:[(0,M.jsx)(`aside`,{className:`w-full shrink-0 md:sticky md:top-28 md:w-60 lg:w-72`,children:(0,M.jsx)(z,{runId:e.id,selected:n,onSelect:r})}),(0,M.jsx)(N,{runId:e.id,path:n,className:`min-w-0 flex-1`})]})]})}export{U 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{Qt as r,Un as i,lr as a,lt as o,mt as s,t as c}from"./centered-state-BkAJVLJE.js";import{r as l,t as u}from"./utils-Wtkd5E6j.js";import{t as d}from"./run-header-Dho4eurS.js";import{t as f}from"./chevron-right-CxAoD1eD.js";import{t as p}from"./file-j5O4NryU.js";import{t as m}from"./folder-w9Lwj9x9.js";import{t as h}from"./triangle-alert-CPUEVSZ3.js";import{a as g,i as _,r as v}from"./highlighter-CdHqIwFr.js";import{n as y,r as b}from"./index-BmHHLbwc.js";var x=l(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),S=l(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),C=l(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),w=l(`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`}]]),T=l(`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`}]]),E=l(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),D=e(t(),1),O=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function k(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:O.has(t.slice(n+1).toLowerCase())}function A(e){return e.tooLarge?`too-large`:k(e.path)?`image`:e.binary?`binary`:`text`}function j(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var M=n();function N({runId:e,path:t,className:n}){let i=s(e,t??void 0);if(t===null)return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(c,{icon:(0,M.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from the tree to preview it here.`})});if(i.isPending)return(0,M.jsx)(F,{className:n,children:(0,M.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(i.isError){let e=i.error instanceof r&&i.error.status===409;return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(c,{icon:e?(0,M.jsx)(C,{}):(0,M.jsx)(h,{}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:i.error.message})})}return i.data.type===`file`?(0,M.jsx)(P,{runId:e,entry:i.data,className:n}):null}function P({runId:e,entry:t,className:n}){let r=A(t);return(0,M.jsxs)(F,{className:n,children:[(0,M.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:j(t.size)})]}),r===`image`?(0,M.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,M.jsx)(`img`,{"data-slot":`file-preview-image`,src:i(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,M.jsx)(c,{icon:(0,M.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${j(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,M.jsx)(c,{icon:(0,M.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${j(t.size)} of binary data — no text preview.`}):(0,M.jsx)(R,{path:t.path,text:t.content??``})]})}function F({className:e,children:t}){return(0,M.jsx)(`section`,{"data-slot":`file-preview`,className:u(`overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var I=1500;function L(e,t){let n=(0,D.useMemo)(()=>t.split(`
2
+ `).map(e=>[{content:e}]),[t]),r=(0,D.useMemo)(()=>g(e),[e]),i=n.length>I,[a,o]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(r===null||i)return;let n=!1;return v(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:_(t,r)?.tokens??n}function R({path:e,text:t}){let n=L(e,t);return(0,M.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":g(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex px-4`,children:[(0,M.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,M.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function z({runId:e,selected:t,onSelect:n}){return(0,M.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function B({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=s(e,t);return a.isPending?(0,M.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Loading…`}):a.isError?(0,M.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${24+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,M.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Empty directory`}):(0,M.jsx)(M.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,M.jsx)(V,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,M.jsx)(H,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function V({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[o,s]=(0,D.useState)(!1);return(0,M.jsxs)(`li`,{children:[(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":o?`open`:`closed`,"aria-expanded":o,onClick:()=>s(e=>!e),className:`flex 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+r*14}px`},children:[(0,M.jsx)(f,{"aria-hidden":`true`,className:u(`size-3.5 shrink-0 transition-transform`,o&&`rotate-90`)}),(0,M.jsx)(m,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t})]}),o?(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function H({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=k(t)?T:p;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:u(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+r*14}px`},children:[(0,M.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,M.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:j(n)})]})})}function U(){let{id:e}=a(),t=o(e);return t.isPending?(0,M.jsx)(b,{tab:`files`}):t.isError?(0,M.jsx)(y,{tab:`files`,error:t.error}):(0,M.jsx)(W,{run:t.data})}function W({run:e}){let t=s(e.id,``),[n,i]=(0,D.useState)(null),a=t.isError&&t.error instanceof r&&t.error.status===409;return(0,M.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,M.jsx)(d,{run:e,tab:`files`}),t.isPending?(0,M.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`}):t.isError?(0,M.jsx)(c,{icon:a?(0,M.jsx)(w,{}):(0,M.jsx)(h,{}),tone:a?`neutral`:`danger`,heading:`h2`,title:a?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 md:flex-row md:items-start md:px-6`,children:[(0,M.jsx)(`aside`,{className:`w-full shrink-0 md:sticky md:top-28 md:w-60 lg:w-72`,children:(0,M.jsx)(z,{runId:e.id,selected:n,onSelect:i})}),(0,M.jsx)(N,{runId:e.id,path:n,className:`min-w-0 flex-1`})]})]})}export{U as TaskFilesRoute};
@@ -0,0 +1,9 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,A as i,F as a,I as o,It as s,Lt as c,O as l,P as u,Qt as d,X as f,Y as p,Zn as m,_t as h,a as g,dn as _,dr as v,gt as y,i as b,it as x,k as ee,lr as te,lt as ne,mr as S,n as C,q as re,sn as w,sr as ie,t as ae,vt as oe}from"./centered-state-BkAJVLJE.js";import{a as se,n as T,r as E,t as D}from"./utils-Wtkd5E6j.js";import{a as ce,c as O,i as k,l as le,n as A,o as ue,r as j,s as de,t as fe,u as pe}from"./run-header-Dho4eurS.js";import{a as M}from"./editable-title-BGuiDxFT.js";import{t as me}from"./arrow-down-DflHdNlN.js";import{a as he,d as ge,f as _e,l as ve,n as ye,s as be,t as xe,u as Se}from"./thread-loading-DJDl701Z.js";import{a as Ce,i as we,m as Te,s as Ee}from"./new-task-form-BuYxAWN7.js";import{t as N}from"./chevron-right-CxAoD1eD.js";import{n as De,t as Oe}from"./trash-2-DKcnmg6e.js";import{n as ke}from"./tab-link-CIcwFJtC.js";import{E as Ae,T as je,d as Me,f as Ne,p as Pe}from"./prompt-templates-C5iO3Lda.js";import{t as Fe}from"./git-pull-request-DlSop3Ch.js";import{t as Ie}from"./search-x-BgxaJgro.js";import{t as Le}from"./square-terminal-qojq20cH.js";import{t as Re}from"./textarea-DVO7pg8Y.js";import{n as P,r as F,t as I}from"./collapsible-BlF-7CeC.js";import{t as ze}from"./use-submit-shortcut-RKJLKdsW.js";import{t as L}from"./project-router-DudOmkHf.js";import{s as Be}from"./pill-t97MvPW_.js";import{t as R}from"./markdown-q9lm7kQ2.js";import{t as Ve}from"./lib-BQXq3kEf.js";import{t as He}from"./zoomable-image-hcqwUIlQ.js";import{t as Ue}from"./run-diff-BLoKEnTx.js";var We=120;function z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function B(e){let t=e.replace(/\s+/g,` `).trim();return t.length>We?`${t.slice(0,We-1)}…`:t}function V(e,...t){if(z(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return B(t)}}function Ge(e){if(!z(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return B(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return B(e.join(` `))}}function Ke(e){if(!z(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)z(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function qe(e){return V(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function H(e,t){return t?`${e} ${t}`:e}function Je(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:H(`Ran`,Ge(t)),subtitle:V(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:H(`Edit`,V(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:H(`Write`,V(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:H(`Edit`,V(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Ke(t);return{toolKind:`edit`,title:H(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:H(`Read`,V(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:H(`View image`,V(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:H(`Search`,V(t,`pattern`,`query`)),subtitle:V(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:H(`Fetch`,V(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:H(`Web search`,V(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=V(t,`subagent_type`,`subagentType`),i=V(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=V(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:V(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=V(t,`server`),n=V(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:qe(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?B(e):`Tool`,subtitle:qe(t)}}var Ye=E(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Xe=E(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Ze=E(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Qe=E(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),$e=E(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),et=E(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),tt=E(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),U=e(t(),1),nt=[`run-event`,`ui-event`];function rt(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function it(e){let[t,n]=(0,U.useState)([]);return(0,U.useEffect)(()=>{if(n([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let r=0,i=null,a,o=!1,s=Date.now(),c,l=e=>{s=Date.now();let t=rt(e.data);!t||!(t.seq>r)||(r=t.seq,n(e=>[...e,t]))},u=()=>{s=Date.now()},d=()=>{o||a!==void 0||(a=setTimeout(()=>{a=void 0,o||f()},1500))},f=()=>{i?.close(),s=Date.now(),i=new t(se(`/runs/${encodeURIComponent(e)}/events`),{withCredentials:!0});for(let e of nt)i.addEventListener(e,l);i.addEventListener(`ping`,u),i.addEventListener(`error`,()=>{i?.readyState===2&&d()})},p=()=>{document.visibilityState===`visible`&&(!i||i.readyState===2)&&(clearTimeout(a),a=void 0,f())},m=()=>{clearTimeout(a),a=void 0,i?.close()},h=e=>{e.persisted&&f()};return c=setInterval(()=>{o||document.visibilityState!==`visible`||Date.now()-s<=4e4||(clearTimeout(a),a=void 0,f())},1e4),document.addEventListener(`visibilitychange`,p),window.addEventListener(`pagehide`,m),window.addEventListener(`pageshow`,h),f(),()=>{o=!0,clearTimeout(a),clearInterval(c),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),window.removeEventListener(`pageshow`,h),i?.close()}},[e]),t}var at=e=>e.kind===`tool`,ot=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,st=(e,t,n)=>`${e} ${e===1?t:n}`;function ct(e,t){let n=[];return e>0&&n.push(st(e,`file`,`files`)),t>0&&n.push(st(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function lt(e){return`${e} earlier tool call${e===1?``:`s`}`}var ut=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function dt(e){for(let t of ut)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function ft(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(at).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:ct(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)at(e)&&ot(e)&&!r.has(e.id)?o.push(e):(s(),at(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var W=n(),G=new Map,pt=(0,U.createContext)(null);function mt(){return(0,U.useContext)(pt)}function ht({runId:e,children:t}){let n=(0,U.useMemo)(()=>({get:t=>G.get(e)?.get(t),set:(t,n)=>{let r=G.get(e)??new Map;r.set(t,n),G.set(e,r)}}),[e]);return(0,W.jsx)(pt.Provider,{value:n,children:t})}function K(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function gt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var _t=new Map;function vt(e,t){_t.set(e,t)}function yt(e){return _t.get(e)}var bt=new Map;function xt(e,t){bt.set(e,t)}function St(e,t){let n=bt.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function Ct({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(e),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(),_=()=>{f(e),g(void 0),u(!0)},v=async()=>{let t=d.trim();if(!t||t===e){u(!1);return}m(!0),g(void 0);try{await r?.(t),u(!1)}catch(e){g(e instanceof Error?e.message:`Could not save the message`)}finally{m(!1)}},y=async()=>{m(!0),g(void 0);try{await i?.()}catch(e){g(e instanceof Error?e.message:`Could not remove the message`)}finally{m(!1)}};return c?(0,W.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,W.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),u(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),v())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,W.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>u(!1),disabled:p,className:`rounded-sm px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>void v(),disabled:p,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:p?(0,W.jsx)(l,{className:`size-3.5 animate-spin`}):`Save`})]}),h?(0,W.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:h}):null]}):(0,W.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[r||i?(0,W.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,W.jsx)(`button`,{type:`button`,"aria-label":a,onClick:_,disabled:p,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,W.jsx)(et,{className:`size-3.5`})}):null,i?(0,W.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void y(),disabled:p,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,W.jsx)(Oe,{className:`size-3.5`})}):null]}):null,h?(0,W.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:h}):null,(0,W.jsx)(R,{breaks:!0,children:e}),n.length>0?(0,W.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:n.map(e=>(0,W.jsx)(He,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e))}):null,s>0?(0,W.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function wt({text:e}){return(0,W.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,W.jsx)(R,{children:e})})}function Tt({note:e}){return(0,W.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:D(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var Et={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`};function Dt({incident:e}){let t=Et[e.provider];return(0,W.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,W.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,W.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,W.jsx)(L,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Ot({text:e}){let t=(0,U.useId)();if(e.trim()===``)return null;let n=e.split(`
2
+ `,1)[0]??``,r=n.length<e.length;return(0,W.jsxs)(I,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,W.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,W.jsx)(N,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,W.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,W.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,W.jsx)(R,{inline:!0,children:n})}),r?(0,W.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,W.jsx)(F,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,W.jsx)(P,{children:(0,W.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,W.jsx)(R,{children:e})})})]})}function kt(){return(0,W.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,W.jsx)(l,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,W.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var At={read:pe,edit:et,delete:Oe,move:Ze,search:je,execute:Le,think:Ye,fetch:le,task:M,plan:Qe,other:tt},jt=e=>e.split(`
3
+ `).length;function Mt({text:e,streaming:t}){let[n,r]=(0,U.useState)(!1),i=(0,U.useRef)(null),a=(0,U.useRef)(!0);(0,U.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=jt(e),s=!t&&!n&&o>12;return(0,W.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=K(e.currentTarget)}:void 0,className:D(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,W.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,W.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,W.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function Nt({diffs:e}){return(0,W.jsx)(W.Fragment,{children:e.map((e,t)=>(0,W.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,W.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,W.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Pt(e.oldText).map((e,t)=>(0,W.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Pt(e.newText).map((e,t)=>(0,W.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
4
+ `).map((e,t)=>(0,W.jsx)(Ft,{text:e},t))})]},`${e.path}:${t}`))})}function Pt(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
5
+ `)}function Ft({text:e}){return(0,W.jsx)(`span`,{className:D(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function It(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function q({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=mt(),[a,o]=(0,U.useState)(()=>n===void 0?null:i?.get(n)??null),s=e=>{n!==void 0&&i?.set(n,e),o(e)},c=e.status===`running`||e.status===`pending`,u=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,d=u&&(a??It(e)),{verb:f,detail:p}=dt(e.title),m=At[e.toolKind]??tt;return(0,W.jsxs)(I,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:d,onOpenChange:s,className:D(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,W.jsxs)(F,{disabled:!u,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,W.jsx)(N,{"aria-hidden":!0,className:D(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!u&&`invisible`)}),(0,W.jsx)(m,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`span`,{className:D(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:f}),p===void 0?null:(0,W.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:p}),(0,W.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,W.jsx)(l,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,W.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,W.jsx)(`span`,{"data-slot":`tool-exit`,className:D(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,W.jsx)(P,{children:(0,W.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,W.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,W.jsx)(Nt,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,W.jsx)(Mt,{text:e.output,streaming:c}):null,t.length>0?(0,W.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:r?.(t,n??e.id)}):null]})})]})}function Lt({group:e,scope:t}){return(0,W.jsxs)(I,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,W.jsxs)(F,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,W.jsx)(N,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,W.jsx)(P,{children:(0,W.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,W.jsx)(q,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function Rt({count:e,children:t}){return(0,W.jsxs)(I,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,W.jsxs)(F,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,W.jsx)(N,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),lt(e)]}),(0,W.jsx)(P,{children:(0,W.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function zt({image:e}){return(0,W.jsx)(He,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function Bt(e){let t=S(),n=O(e).continueRun,r=u(),a=y(n),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null),d=j(e,o),{runners:f,canContinue:p,currentRunner:m,runner:h}=d,g=h===m&&e.model?{...r.data?.defaultModels,[h]:e.model}:r.data?.defaultModels,_=Ce(h,a.data,[c,g?.[h]]),b=Ee(c,h,g,a.data),x=v({mutationFn:({text:t,images:n})=>p?w(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:d.runnerOverride,model:c===null?void 0:b}):Promise.reject(Error(d.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:i.runs.all})});return{available:n,canContinue:p,reason:d.reason,providerPending:d.providerPending,pills:(0,W.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[f.length>1?(0,W.jsx)(Pe,{runners:f,value:h,onPick:e=>{s(e),l(null)}}):null,(0,W.jsx)(Ne,{slot:`follow-up-model-pill`,ariaLabel:`Model`,label:_.find(e=>e.id===b)?.label??`auto`,value:b,onPick:e=>l(e),options:_.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:we(h,a.data,a.isError)})]}),continueWith:(e,t)=>x.mutateAsync({text:e,images:t})}}var Vt=120,J=e=>e!==`pending`&&e!==`running`,Ht=e=>e.kind===`tool`&&e.toolKind===`task`,Y=e=>Ht(e)&&e.parentItemId===void 0,Ut=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function Wt(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>Y(e)&&t.has(e.id)))return n;return 0}function Gt(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function Kt(e){if(e.kind===`tool`)return qt(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
6
+ `);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return qt(n)}}}function qt(e){return e.length>Vt?`${e.slice(0,Vt-1).trimEnd()}…`:e}function Jt(e,t=!1){let n=$t(e,e=>e.items.some(Y));if(n===-1)return[];let r=e=>!t&&!J(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(Y);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(Y)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?Wt(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!Ut(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>Yt(e,c.get(e.id)??[],t))}function Yt(e,t,n){let r={id:e.id,title:dt(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=Gt(e);i!==void 0&&(r.agentType=i),n&&!J(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=Kt(t[e]);if(n!==void 0){r.activity=n;break}}return r}function Xt(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function Zt(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function Qt(e){return e.find(e=>!J(e.status))??e[0]}function $t(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function en(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&Y(e));if(i!==void 0)return Yt(i,tn(e,t),n)}}function tn(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&Y(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)Ut(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var nn=new Map,rn=!1;function an({runId:e,agents:t,onSelect:n}){let[r,i]=(0,U.useState)(()=>nn.get(e)??rn);if(t.length===0)return null;let{done:a,total:o}=Xt(t),s=Qt(t);return(0,W.jsxs)(`section`,{"data-slot":`agents-dock`,"data-state":r?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,W.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(nn.set(e,!t),!t)),"aria-expanded":r,className:D(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,W.jsx)(M,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,W.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,W.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),!r&&s!==void 0?(0,W.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,Zt(s)]}):null,(0,W.jsx)(Te,{"aria-hidden":!0,className:D(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,W.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,W.jsx)(on,{agent:e,onSelect:n},e.id))}):null]})}function on({agent:e,onSelect:t}){let n=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(sn,{status:e.status,stalled:e.stalled===!0}),(0,W.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,W.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,W.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:Zt(e)}),(0,W.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,W.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,W.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,W.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function sn({status:e,stalled:t=!1}){return t?(0,W.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,W.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,W.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,W.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,W.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,W.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,W.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,W.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var cn=new Map;function ln(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function un(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function dn(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function fn({runId:e,entries:t}){let[n,r]=(0,U.useState)(()=>cn.get(e)??ln());if(t.length===0)return null;let{done:i,total:a}=un(t),o=dn(t);return(0,W.jsxs)(`section`,{"data-slot":`plan-dock`,"data-state":n?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,W.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>r(t=>(cn.set(e,!t),!t)),"aria-expanded":n,className:D(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,n?`pt-2 pb-1.5`:`py-2`),children:[(0,W.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,W.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,i,`/`,a]}),!n&&o!==void 0?(0,W.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,o.activeForm??o.content]}):null,(0,W.jsx)(Te,{"aria-hidden":!0,className:D(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!n&&`rotate-180`)})]}),n?(0,W.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,W.jsx)(pn,{entry:e},`${t}:${e.content}`))}):null]})}function pn({entry:e}){return(0,W.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:D(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,W.jsx)(mn,{status:e.status}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,W.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function mn({status:e}){return e===`cancelled`?(0,W.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,W.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,W.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,W.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,W.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,W.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,W.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,W.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function hn(e,t=`document`){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(!0),c=(0,U.useRef)(null),l=(0,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useCallback)(e=>{i(e),e&&(n.current=e.closest(t===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`))},[t]),f=(0,U.useCallback)(e=>{let t=n.current;if(!t)return;let r=u.current;r?r.scrollTo(e):t.scrollTop=e},[]),p=(0,U.useCallback)(()=>{let e=n.current;e&&f(e.scrollHeight-e.clientHeight)},[f]),m=(0,U.useCallback)(()=>{s.current&&p()},[p]),h=(0,U.useCallback)(()=>{let e=n.current;e&&(c.current=null,s.current=!0,e.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:`smooth`}))},[]);return(0,U.useEffect)(()=>{let t=n.current,i=r;if(!t||!i)return;if(l.current!==e){l.current=e;let n=yt(e);n&&!n.atBottom?(s.current=!1,c.current=n.top,t.scrollTop=n.top):(s.current=!0,p())}let a=0,u=null,d=()=>{c.current=null,s.current=!1,a=0},m=()=>{a=Date.now()},h=e=>{e.deltaY<0?d():m()},g=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?d():[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&m()},_=()=>{K(t,80)||(d(),m())},v=e=>{u=e.touches[0]?.clientY??null},y=e=>{let t=e.touches[0]?.clientY;t!==void 0&&(u!==null&&t>u+1?d():u!==null&&t<u-1&&m(),u=t)},b=()=>{let n=K(t,80);n&&c.current===null&&(s.current||Date.now()-a<2e3)&&(s.current=!0),o(!n),c.current===null&&vt(e,{top:t.scrollTop,atBottom:n})};t.addEventListener(`scroll`,b,{passive:!0}),t.addEventListener(`wheel`,h,{passive:!0}),t.addEventListener(`touchstart`,v,{passive:!0}),t.addEventListener(`touchmove`,y,{passive:!0}),t.addEventListener(`pointerdown`,_,{passive:!0}),t.addEventListener(`keydown`,g);let x;return typeof ResizeObserver<`u`&&(x=new ResizeObserver(()=>{let e=c.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;f(Math.min(e,n)),n>=e&&(c.current=null)}else s.current&&p()}),x.observe(i)),()=>{t.removeEventListener(`scroll`,b),t.removeEventListener(`wheel`,h),t.removeEventListener(`touchstart`,v),t.removeEventListener(`touchmove`,y),t.removeEventListener(`pointerdown`,_),t.removeEventListener(`keydown`,g),x?.disconnect()}},[e,r,f,p]),{attachContent:d,scrollElRef:n,virtualizerRef:u,pillVisible:a,jumpToLatest:h,restickIfStuck:m}}function gn({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,W.jsx)(_n,{runId:e,rows:t,controls:r}):(0,W.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,children:t.map(e=>(0,W.jsx)(`div`,{"data-slot":`thread-row`,className:`flex w-full flex-col pb-2.5 [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`,children:e.node},e.key))})}function _n({runId:e,rows:t,controls:n}){let r=(0,U.useRef)(null),[i]=(0,U.useState)(()=>St(e,t.length)),a=(0,U.useRef)(t.length);a.current=t.length;let o=(0,U.useRef)(null),s=(0,U.useCallback)(t=>{n.virtualizerRef.current=t,t?o.current=t:o.current&&=(xt(e,{rows:a.current,cache:o.current.cache}),null)},[e,n.virtualizerRef]),[c,l]=(0,U.useState)(0);return(0,U.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||l(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,W.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,children:(0,W.jsx)(Ve,{ref:s,scrollRef:n.scrollElRef,startMargin:c,...i===void 0?{}:{cache:i},children:t.map(e=>(0,W.jsx)(`div`,{"data-slot":`thread-row`,className:`flex w-full flex-col pb-2.5`,children:e.node},e.key))})})}function vn({onJump:e}){return(0,W.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-8 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,W.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function yn(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[]},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[]},entries:[]});for(let e of t.turns)n.push({id:e.id,userMessageKey:`${e.id}:user`,...e.userMessage===void 0?{}:{userMessage:{text:e.userMessage.text,imageCount:e.userMessage.imageCount,images:e.userMessage.images}},entries:e.items});return n}function bn(e,t){return[{id:`agent:${e}`,entries:t}]}function xn(e,t){let n=[];for(let t of e){t.userMessage!==void 0&&n.push({key:t.userMessageKey??`${t.id}:user`,scope:t.id,content:{kind:`user-message`,message:t.userMessage}});for(let e of ft([...t.entries]))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}})}return n}function Sn({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c}){let l=(0,U.useMemo)(()=>xn(n,e),[n,e]),u=hn(`${e}:${t}`,r),d=s??u,f=(0,U.useMemo)(()=>l.map(e=>({key:e.key,node:e.content.kind===`user-message`?(0,W.jsx)(Cn,{message:e.content.message,actions:o?.[e.key]}):(0,W.jsx)(X,{block:e.content.block,scope:e.scope,renderAsk:a})})),[o,a,l]),p=c??gt(``,f.length),m=f.length===0?i??null:(0,W.jsx)(gn,{runId:`${e}:${t}`,rows:f,mode:p,controls:d});return(0,W.jsx)(ht,{runId:e,children:r===`panel`?(0,W.jsxs)(`div`,{"data-slot":`transcript-viewport`,"aria-label":`Agent transcript`,role:`region`,tabIndex:0,className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,W.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:m}),d.pillVisible?(0,W.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,W.jsx)(vn,{onJump:d.jumpToLatest})}):null]}):m})}function Cn({message:e,actions:t}){return(0,W.jsx)(Ct,{text:e.text,imageCount:e.imageCount,images:e.images,onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel})}function X({block:e,scope:t,renderAsk:n}){switch(e.kind){case`entry`:return(0,W.jsx)(Tn,{entry:e.entry,scope:t,renderAsk:n});case`tool-card`:return(0,W.jsx)(q,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,W.jsx)(wn,{entries:e,scope:t,renderAsk:n})});case`context-group`:return(0,W.jsx)(Lt,{group:e,scope:t});case`streak`:return(0,W.jsx)(Rt,{count:e.count,children:e.blocks.map(e=>(0,W.jsx)(X,{block:e,scope:t,renderAsk:n},e.id))});default:return En(e)}}function wn({entries:e,scope:t,renderAsk:n}){return ft([...e]).map(e=>(0,W.jsx)(X,{block:e,scope:t,renderAsk:n},e.id))}function Tn({entry:e,scope:t,renderAsk:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,W.jsx)(wt,{text:e.text}):(0,W.jsx)(Ct,{text:e.text});case`reasoning`:return(0,W.jsx)(Ot,{text:e.text});case`tool`:return(0,W.jsx)(q,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return(0,W.jsx)(Tt,{note:e});case`image`:return(0,W.jsx)(zt,{image:e});case`ask`:return n===void 0?(0,W.jsx)(`div`,{"data-slot":`ask-card`,className:`rounded-lg border border-border bg-card px-4 py-3 text-sm`,children:`The agent asked a question. Open the main session to answer it.`}):n(e);case`provider-auth-required`:return(0,W.jsx)(Dt,{incident:e});default:return En(e)}}function En(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function Dn({runId:e,renderAsk:t,agent:n,entries:r,onClose:i}){return(0,W.jsx)(be,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,W.jsx)(ve,{"data-slot":`subagent-sheet`,side:`right`,className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:n===void 0?null:(0,W.jsx)(On,{runId:e,renderAsk:t,agent:n,entries:r})})})}function On({runId:e,renderAsk:t,agent:n,entries:r}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(ge,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,W.jsxs)(_e,{className:`flex min-w-0 items-center gap-2 pr-8 text-[15px]`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,W.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,W.jsxs)(Se,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,W.jsx)(kn,{status:n.status}),(0,W.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,W.jsx)(Sn,{runId:e,viewId:`agent:${n.id}`,sections:bn(n.id,r),mode:`panel`,renderAsk:t,empty:(0,W.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function kn({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,W.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:D(`rounded-full px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}function An({run:e}){return(0,W.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-violet/30 bg-violet/10 px-3.5 py-2.5`,children:[(0,W.jsx)(Ae,{className:`size-4 shrink-0 text-violet`,"aria-hidden":`true`}),(0,W.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,W.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,W.jsx)(Ue,{runId:e.id}),(0,W.jsx)(jn,{run:e})]})}function jn({run:e}){let t=S(),n=(0,U.useRef)(null),[r,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(null),c=A(e.id),l=j(e),u=()=>t.invalidateQueries({queryKey:i.runs.all}),f=v({mutationFn:async t=>l.canContinue?w(e.id,{text:`Review feedback:\n${t}`,runner:l.runnerOverride}):null,onSuccess:e=>{e!==null&&(a(``),u())},onError:e=>b(e.message,{tone:`danger`})}),p=v({mutationFn:()=>_(e.id),onSuccess:e=>{b(`Draft PR created — ${e.url}`),u()},onError:e=>{e instanceof d&&e.manual!==void 0&&s(e.manual),b(e.message,{tone:`danger`})}}),m=()=>{let e=r.trim();if(e.length===0){b(`Write what to change first.`),n.current?.focus();return}f.mutate(e)};return(0,W.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,W.jsx)(Re,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:r,onChange:e=>a(e.target.value),onKeyDown:e=>{ze({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(),m())},className:`min-h-[52px] text-[13px]`}),l.canContinue?null:(0,W.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,W.jsx)(`span`,{children:l.reason}),l.providerPending?null:(0,W.jsx)(L,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsxs)(g,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:l.reason??`Send the notes back into the agent's session`,"aria-describedby":l.canContinue?void 0:`review-provider-guidance`,disabled:f.isPending||!l.canContinue,onClick:m,children:[(0,W.jsx)(Xe,{"aria-hidden":`true`}),`Send back`]}),T(e.pullRequestUrl)?(0,W.jsx)(g,{asChild:!0,variant:`outline`,size:`sm`,children:(0,W.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,W.jsx)(ke,{"aria-hidden":`true`}),`PR ↗`]})}):(0,W.jsxs)(g,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:p.isPending,onClick:()=>p.mutate(),children:[(0,W.jsx)(Fe,{"aria-hidden":`true`}),`Draft PR`]}),(0,W.jsxs)(g,{"data-slot":`review-accept`,variant:`contrast`,size:`sm`,className:`ml-auto`,title:k(`review`),disabled:c.isPending,onClick:()=>c.mutate(),children:[(0,W.jsx)(ee,{"aria-hidden":`true`}),`Accept`]})]}),o===null?null:(0,W.jsx)(Mn,{command:o})]})}function Mn({command:e}){return(0,W.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>b(`Command copied to clipboard.`)).catch(()=>b(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,W.jsx)(De,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,W.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Nn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Pn=1500;function Fn({status:e}){let t=(0,U.useRef)(e),[n,r]=(0,U.useState)(!1);return(0,U.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Nn())return;r(!0);let i=setTimeout(()=>r(!1),Pn);return()=>clearTimeout(i)},[e]),n?(0,W.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,W.jsx)(C,{}),(0,W.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,W.jsx)(`span`,{className:`rounded-full border border-violet/30 bg-violet/15 px-4 py-1.5 text-[13px] font-medium text-violet shadow-modal`,children:`✓ Changes accepted`})})]}):null}var In={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`};function Ln(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function Rn(e){return e.runner??`claude`}function zn(e,t){let n=m(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${In[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${In[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function Bn(e,t){return zn(Ln(e),t)}function Vn(e,t){return zn(Rn(e),t)}function Hn(e){let t=r(),n=Ln(e);return t.isSuccess&&t.data?Bn(e,t.data):{provider:n,usable:!0}}function Un(e){let t=r(),n=Rn(e);return t.isSuccess&&t.data?Vn(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}function Wn(e){return ce(e.status)?`live`:O(e).continueRun?`resume`:`unavailable`}function Gn(e){let t=oe(e.id),n=a(e.id),r=Hn(e),i=Un(e),[o,s]=(0,U.useState)(void 0),c=Wn(e),l=c===`resume`?!i.usable:c===`live`&&!r.usable,u=c===`unavailable`?`no-session`:l?`provider`:void 0,f=u===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:u===`provider`?c===`resume`?i.reason:r.reason:void 0,p=e=>i.usable?n.mutateAsync({text:e}):Promise.reject(Error(i.reason??`The run provider is unavailable.`));return{mode:c,blockedBy:u,reason:f,isPending:t.isPending||n.isPending,error:o,send:async n=>{if(!u){if(s(void 0),c===`resume`){try{await p(n)}catch(e){s(e instanceof Error?e.message:String(e))}return}try{await t.mutateAsync({text:n})}catch(t){if(t instanceof d&&t.status===409&&ue(e)!==void 0)try{await p(n);return}catch(e){s(e instanceof Error?e.message:String(e));return}s(t instanceof Error?t.message:String(t))}}}}}function Kn(e,t){return`${e.header}: ${t.join(`, `)}`}function qn({ask:e,run:t}){return e.resolved?(0,W.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,W.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,W.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):(0,W.jsx)(Jn,{ask:e,run:t})}function Jn({ask:e,run:t}){let n=Gn(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,U.useState)({}),c=(e,t)=>s(n=>({...n,[e]:t})),l=i.every((e,t)=>(o[t]?.length??0)>0),u=()=>void n.send(i.map((e,t)=>Kn(e,o[t]??[])).join(`
7
+ `)),d=n.mode===`resume`;return(0,W.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-delivery":n.mode,className:`rounded-lg border border-primary/25 bg-primary/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,W.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,W.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:`The agent is asking`})}),(0,W.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,W.jsx)(Yn,{question:e,disabled:n.isPending||r,selected:o[t]??[],onSelect:i=>{r||(a?n.send(Kn(e,i)):c(t,i))}},e.id??t))}),a?d?(0,W.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11.5px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,W.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,W.jsx)(g,{size:`sm`,disabled:n.isPending||r||!l,onClick:u,children:d?`Send answer & reopen`:`Send answer`}),(0,W.jsx)(`span`,{"data-slot":d?`ask-resume-hint`:`ask-hint`,className:`text-[11.5px] text-soft-foreground`,children:d?`the session has ended — sending reopens it`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),n.blockedBy===`provider`?(0,W.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,W.jsx)(`span`,{children:n.reason}),(0,W.jsx)(L,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,W.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,W.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function Yn({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,W.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,W.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`rounded-md bg-primary px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground`,children:e.header}),i?(0,W.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,W.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,W.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:D(`flex w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-primary/50 hover:bg-primary/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-primary/60 bg-primary/[0.06]`:`border-border bg-card`),children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,W.jsx)(`span`,{"aria-hidden":!0,className:D(`flex size-4 shrink-0 items-center justify-center rounded border text-[10px]`,r?`border-primary bg-primary text-primary-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,W.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,W.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var Xn=2e3;function Zn(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`session.ended`&&r.seq>t&&(t=r.seq),(r.type===`session.started`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function Qn(e,t){let n=S(),r=(0,U.useMemo)(()=>Zn(t),[t]),a=e?.id,o=e?.status;(0,U.useEffect)(()=>{if(r===0||a===void 0||o!==`running`&&o!==`waiting`)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:i.runs.detail(a)}),n.invalidateQueries({queryKey:i.runs.list()})},Xn);return()=>clearTimeout(e)},[r,a,o,n])}function $n(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function er(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function tr(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`string`?e:void 0}function nr(e){return e===`claude`||e===`codex`||e===`opencode`?e:void 0}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);return t&&(n=n.replace(/\s*CEZ:ASK[ \t]+\{[\s\S]*\}\s*$/,``)),n.includes(`CEZ:`)?n.split(`
8
+ `).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
9
+ `):n}function rr(e){let t=e=>$(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function ir(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var ar=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,or=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function sr(e){if(!Z(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!Z(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:or.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function cr(e,t={}){let n=[],r=new Map,i,a=0,o,s=()=>{a+=1;let e={id:`turn-${a}`,entries:[],v2Items:!1};return n.push(e),e},c=()=>n.at(-1)??s(),l=(e,t)=>{let n=Q(e.stepId);return n===void 0?t:`${n}:${t}`},u=(e,t,n)=>{let i={...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`tool`&&r.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}let a=r.get(n);if(a&&a.turn===e){a.entry.entry=i,r.set(n,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),r.set(n,{turn:e,entry:o})};for(let t of e)switch(t.type){case`user-message`:{let e=Q(t.text)??``;o&&!o.resolved&&(o.resolved=!0,e!==``&&(o.answer=e),o=void 0);let n=s();n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[]};break}case`turn.started`:{let e=Q(t.turnId),r=n.at(-1);r&&r.turnId===void 0&&!r.v2Items?r.turnId=e:s().turnId=e;break}case`turn.completed`:{let e=Q(t.turnId),r;for(let t=n.length-1;t>=0&&!r;--t)n[t].turnId===e&&(r=n[t]);let i=r??n.at(-1);i&&(i.completed={stopReason:Q(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{}});break}case`item.started`:case`item.updated`:case`item.completed`:{if(!Z(t.item))break;let e=t.item.kind,n=t.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof n!=`string`||n===``)break;let i=t.item,a=l(t,i.id);u(r.get(a)?.turn??c(),i,a);break}case`item.delta`:{let e=Q(t.itemId)??``,n=r.get(l(t,e)),i=Q(t.delta)??``;if(!n||i===``||!ar(n.entry.entry))break;let a=n.entry.entry;t.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+i:t.field!==`output`&&a.kind!==`tool`&&(a.text+=i);break}case`text`:{let e=c(),n=Q(t.text)??``;if(n===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n}});break}case`tool-call`:{let e=c();if(e.v2Items)break;let n=Q(t.tool)??`Tool`;if(lr.has(n))break;let i=Je(n,t.input);if(i.toolKind===`plan`){let n=sr(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:Q(t.id)??`v1:${t.seq}`,name:n,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},o={origin:`v1`,entry:a};e.entries.push(o),r.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=r.get(Q(t.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let n=e.entry.entry;if(n.kind!==`tool`)break;n.status=`completed`,n.output=ir(t.result);break}case`note`:case`lifecycle`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`dim`}});break}case`error`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(t.status!==`failed`)break;let e=Q(t.error)?` — ${Q(t.error)}`:``;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${Q(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=Q(t.command)??`check`,n=typeof t.exitCode==`number`?t.exitCode:-1,r={kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:n===0?`completed`:`failed`,output:Q(t.text)??``,exitCode:n};c().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=nr(t.provider),n=Q(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;c().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n}});break}case`image`:{let e=Q(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=Q(t.name);r!==void 0&&(n.name=r),c().entries.push({origin:`meta`,entry:n});break}case`plan.updated`:Array.isArray(t.entries)&&(c().planEntries=t.entries);break;case`session.ended`:i={reason:Q(t.reason)??`end_turn`,...Q(t.message)===void 0?{}:{message:Q(t.message)}};break;case`ask.requested`:{let e=Q(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions.filter(e=>Z(e)&&typeof e.header==`string`&&Array.isArray(e.options));if(n.length===0)break;let r={kind:`ask`,id:e,questions:n,resolved:!1};c().entries.push({origin:`meta`,entry:r}),o=r;break}case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}for(let e of n){if(!e.v2Items)continue;let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add($(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has($(e.entry.text,!0).trim()))),rr(e))}return{turns:n.map((e,r)=>{let i=e.entries.some(({entry:e})=>e.kind===`ask`),a=t.activeTurn===!0&&r===n.length-1;return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:$(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i}}}var lr=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function ur(){let{id:e}=te(),t=ne(e),n=it(e),r=t.data?.status,i=(0,U.useMemo)(()=>cr(n,{activeTurn:r===`running`}),[n,r]),{mutate:a}=re();if((0,U.useEffect)(()=>{t.data&&he(t.data)&&a(t.data.id)},[a,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),Qn(t.data,n),t.isPending)return(0,W.jsx)(xe,{});if(t.isError){let e=t.error instanceof d&&t.error.status===404;return(0,W.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(ae,{icon:e?(0,W.jsx)(Ie,{}):(0,W.jsx)($e,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,W.jsx)(g,{asChild:!0,variant:`outline`,children:(0,W.jsx)(L,{to:`/`,children:`Back to tasks`})})})})}return(0,W.jsx)(dr,{run:t.data,thread:i})}function dr({run:e,thread:t}){let n=tr(e.status,e.error),r=$n(t),i=r!==void 0&&r.length>0?un(r):void 0,a=e.status===`running`||e.status===`waiting`,l=e.status===`queued`,u=Bt(e),d=!a&&!l&&u.available,m=d&&u.canContinue,h=!a&&e.status!==`queued`,g=(0,U.useMemo)(()=>Jt(t.turns,h),[t.turns,h]),[_,v]=(0,U.useState)(void 0),[y,b]=(0,U.useState)(e.id);y!==e.id&&(b(e.id),v(void 0));let ee=(0,U.useMemo)(()=>_===void 0?void 0:en(t.turns,_,h),[t.turns,_,h]),te=(0,U.useMemo)(()=>_===void 0?[]:tn(t.turns,_),[t.turns,_]),ne=oe(e.id),S=Hn(e),C=a&&!S.usable,re=d&&!u.canContinue,w=C||re,ae=C?S.reason:u.reason,{mutateAsync:se}=p(e.id),{mutateAsync:E}=o(e.id),{mutateAsync:ce}=x(e.id),O=(0,U.useMemo)(()=>l?{onEditTask:async e=>{await se({task:e})},onEditMessage:(e,t)=>E({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>ce(e).then(()=>void 0)}:void 0,[l,se,E,ce]),k=(0,U.useMemo)(()=>yn(e,t),[e,t]),le=(0,U.useMemo)(()=>xn(k,e.id),[k,e.id]),A=(0,U.useCallback)(t=>(0,W.jsx)(qn,{ask:t,run:e}),[e]),ue=(0,U.useMemo)(()=>{if(O===void 0)return;let t={task:{onEdit:O.onEditTask,editLabel:`Edit the prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>O.onEditMessage(n.id,e),onRemove:()=>O.onRemoveMessage(n.id)};return t},[O,e.queuedMessages]),j=s(e,f()),{search:de}=ie(),pe=gt(de,le.length),M=hn(`${e.id}:main`);return Me(M.restickIfStuck),(0,W.jsxs)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:[(0,W.jsx)(fe,{run:e,planTally:i}),(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-3.5 px-4 py-5 md:px-6`,children:[(0,W.jsx)(Sn,{runId:e.id,viewId:`main`,sections:k,mode:`document`,renderAsk:A,messageActions:ue,scrollControls:M,renderMode:pe}),t.turns.length===0?e.status===`queued`?(0,W.jsx)(fr,{run:e}):(0,W.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`?(0,W.jsx)(kt,{}):null,n&&n.state===`closed`?(0,W.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":n.state,className:D(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,n.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[n.label,T(c(e))?(0,W.jsx)(`a`,{"data-slot":`pr-link`,href:c(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,T(j)?(0,W.jsx)(`a`,{"data-slot":`issue-link`,href:j,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,W.jsx)(An,{run:e}):null]}),(0,W.jsx)(Fn,{status:e.status}),(0,W.jsx)(Dn,{runId:e.id,renderAsk:A,agent:ee,entries:te,onClose:()=>v(void 0)}),(0,W.jsxs)(`div`,{"data-slot":`thread-dock`,className:`sticky bottom-[var(--kb,0px)] z-10 bg-background px-4 pt-1.5 pb-3 max-md:border-t max-md:border-border md:px-6 md:pb-4`,children:[M.pillVisible?(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 -top-12 flex justify-center`,children:(0,W.jsx)(vn,{onJump:M.jumpToLatest})}):null,(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-2.5`,children:[(0,W.jsx)(an,{runId:e.id,agents:g,onSelect:v},`agents:${e.id}`),r!==void 0&&r.length>0?(0,W.jsx)(fn,{runId:e.id,entries:r},e.id):null,e.status===`waiting`?(0,W.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,W.jsx)(Be,{tone:`pending`,pulse:!0}),`The agent is paused, waiting for your reply`]}):null,l?(0,W.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,W.jsx)(Be,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,(0,W.jsx)(ye,{onSubmit:m?(e,t)=>u.continueWith(e,t):(e,t)=>ne.mutateAsync({text:e,images:t}),disabled:w||!a&&!l&&!m,disabledReason:w?ae:`Session closed — no session to resume.`,footerEnd:w&&!u.providerPending?(0,W.jsx)(L,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):m?u.pills:void 0,allowEmptySubmit:m,sendAriaLabel:m?`Continue`:`Send`,placeholder:l?`Add to the prompt — sent when the run starts…`:m?`Continue — add a prompt, or send to just reopen the session…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>er(t)})]})]})]})}function fr({run:e}){let t=de(h().data??[],e.id);return(0,W.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,W.jsx)(Be,{tone:`pending`,pulse:!0}),(0,W.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,W.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{ur as TaskThreadRoute};
@@ -1 +1 @@
1
- import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{r as n,t as r}from"./utils-DsLuRXwV.js";var i=n(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);e();var a=t();function o({className:e,...t}){return(0,a.jsx)(`textarea`,{"data-slot":`textarea`,className:r(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-card px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm`,e),...t})}export{i as n,o as t};
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{r as n,t as r}from"./utils-Wtkd5E6j.js";var i=n(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);e();var a=t();function o({className:e,...t}){return(0,a.jsx)(`textarea`,{"data-slot":`textarea`,className:r(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-card px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm`,e),...t})}export{i as n,o 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{A as r,O as i,Pn as a,St as o,a as s,fr as ee,i as c,k as l,t as u,yt as te}from"./centered-state-ZtnFHA-n.js";import{r as d,t as f}from"./utils-DsLuRXwV.js";import{S as ne,c as re,g as ie,l as ae,r as oe,s as se,x as ce}from"./prompt-templates-CSBYBR1I.js";import{n as p}from"./textarea-CUdokhkv.js";import{d as m,f as h,g,h as _,l as le,m as v,p as y,u as b}from"./alert-dialog-ghffK6g9.js";import{t as ue}from"./use-submit-shortcut-CzVyoAMd.js";import{i as de,n as fe,r as pe,t as me}from"./skills-BiWfHmCR.js";var x=d(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),he=d(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),S=d(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),C=e(t(),1),w=n();function T({...e}){return(0,w.jsx)(le,{"data-slot":`sheet`,...e})}function E({...e}){return(0,w.jsx)(g,{"data-slot":`sheet-trigger`,...e})}function D({...e}){return(0,w.jsx)(b,{"data-slot":`sheet-close`,...e})}function O({...e}){return(0,w.jsx)(v,{"data-slot":`sheet-portal`,...e})}function k({className:e,...t}){return(0,w.jsx)(y,{"data-slot":`sheet-overlay`,className:f(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function A({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,w.jsxs)(O,{children:[(0,w.jsx)(k,{}),(0,w.jsxs)(m,{"data-slot":`sheet-content`,className:f(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,w.jsxs)(b,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,w.jsx)(p,{className:`size-4`}),(0,w.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function j({className:e,...t}){return(0,w.jsx)(`div`,{"data-slot":`sheet-header`,className:f(`flex flex-col gap-1.5 p-4`,e),...t})}function M({className:e,...t}){return(0,w.jsx)(_,{"data-slot":`sheet-title`,className:f(`font-semibold text-foreground`,e),...t})}function N({className:e,...t}){return(0,w.jsx)(h,{"data-slot":`sheet-description`,className:f(`text-sm text-muted-foreground`,e),...t})}var P=[`done`,`failed`,`cancelled`],F=[`done`,`failed`];function I(e){return P.includes(e)}function L(e){return e.archived||!F.includes(e.status)||e.finishedAt===void 0?!1:e.seenAt===void 0||e.seenAt<e.finishedAt}function R(e){return I(e.status)&&!L(e)}function z(e){return e.reduce((e,t)=>L(t)?e+1:e,0)}function B(e){let[t,n]=C.useState(()=>Date.now());return C.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}async function ge(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n);return{mediaType:e.type,data:r,preview:`data:${e.type};base64,${r}`,name:e.name||`pasted image`}}function _e(e,t){let n=[],r=[],i=t;for(let t of e)if(t.type.startsWith(`image/`)){if(t.size>5242880){r.push(`${t.name||`image`} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${t.name||`image`} skipped — max 4 images per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var V=new Set([`/`,`@`]);function ve(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(V.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function ye(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function H(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function U(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function be(e){let[t,n]=C.useState(null),r=C.useRef(null),i=C.useRef(``),[a]=C.useState(()=>H()!==void 0),o=C.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return C.useEffect(()=>o,[o]),{supported:a,recording:t,start:C.useCallback(()=>{if(r.current)return;let t=H();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=U(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:C.useCallback(()=>o(),[o]),finish:C.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function W(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var xe={KeyA:`Yes, approved.`,KeyC:`Continue.`};function G({onSubmit:e,value:t,onValueChange:n,autoFocus:i=!1,footerStart:l,footerEnd:u,sendAriaLabel:d=`Send`,disabled:m=!1,disabledReason:h=`Session closed — Continue to reopen.`,allowEmptySubmit:g=!1,placeholder:_=`Reply — / for skills, @ for files…`,ariaLabel:le=`Reply to the agent`,autocompleteSkills:v=!0,quickReplies:y=!1,getMentionCandidates:b,ref:S}){let[T,E]=(0,C.useState)(``),D=t??T,O=(0,C.useRef)(D);O.current=D;let k=(0,C.useRef)(n);k.current=n;let A=(0,C.useCallback)(e=>{let t=typeof e==`function`?e(O.current):e;E(t),k.current?.(t)},[]),[j,M]=(0,C.useState)([]),N=(0,C.useRef)(j);N.current=j;let[P,F]=(0,C.useState)(!1),[I,L]=(0,C.useState)(null),[R,z]=(0,C.useState)(``),[B,V]=(0,C.useState)(!1),H=(0,C.useRef)(null),U=(0,C.useRef)(null),W=(0,C.useRef)(null),G=te(v&&B),K=o(),we=ee(),q=be(e=>c(e,{tone:`danger`}));(0,C.useEffect)(()=>{i&&H.current?.focus()},[]),(0,C.useImperativeHandle)(S,()=>({insertAtCaret:e=>{let t=H.current,n=oe(O.current,t?.selectionStart??O.current.length,e);A(n.text),W.current=n.caret,t?.focus()}}),[A]);let Te=(0,C.useCallback)(()=>{let e=H.current;if(!e||m){L(null);return}let t=ve(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!v||t?.trigger===`@`&&b===void 0)return L(null);t?.trigger===`/`&&V(!0),L(t)},[v,m,b]),J=(0,C.useMemo)(()=>I===null?[]:I.trigger===`/`?fe(G.data??[],I.query,K.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:de(e)})):(b?.()??[]).filter(e=>pe(e,I.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[b,G.data,I,K.data?.skillUsage]),Y=J.some(e=>e.value===R)?R:J[0]?.value,Ee=I!==null,X=(0,C.useCallback)(()=>L(null),[]),De=e=>{let t=H.current;if(!t||I===null)return;let n=t.selectionStart??t.value.length,i=ye(t.value,I,n,e.insert);I.trigger===`/`&&K.data!==void 0&&a({skillUsage:me(K.data.skillUsage,e.insert)}).then(()=>we.invalidateQueries({queryKey:r.uiState})).catch(()=>{}),A(i.text),W.current=i.caret,L(null),t.focus()};(0,C.useLayoutEffect)(()=>{let e=W.current,t=H.current;e!==null&&t&&(t.setSelectionRange(e,e),W.current=null)},[D]),(0,C.useLayoutEffect)(()=>{let e=H.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[D]);let Z=(0,C.useCallback)(e=>{if(m)return;let t=_e(e,N.current.length);for(let e of t.rejected)c(e,{tone:`danger`});for(let e of t.accepted)ge(e).then(e=>M(t=>t.length>=4?t:[...t,e]))},[m]),Oe=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),Z(t))},ke=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),Z(t))},Q=(0,C.useCallback)(async(t,n,r)=>{let i=t.trim();if(!(m||P)&&!(i===``&&n.length===0&&!g)){F(!0);try{await e(i,n.map(({mediaType:e,data:t})=>({mediaType:e,data:t})))}catch(e){c(e instanceof Error?e.message:String(e),{tone:`danger`}),r&&(A(e=>e===``?t:`${t}\n${e}`),M(e=>[...n,...e].slice(0,4)))}finally{F(!1)}}},[g,P,m,e]),Ae=(0,C.useCallback)(()=>{if(D.trim()===``&&j.length===0&&!g)return;let e=D,t=j;A(``),M([]),L(null),Q(e,t,!0)},[g,j,Q,D]),je=e=>{if(Ee){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),J.length===0)return;let t=J.findIndex(e=>e.value===Y),n=e.key===`ArrowDown`?1:-1,r=J[(t+n+J.length)%J.length];z(r.value);return}if(e.key===`Escape`){e.preventDefault(),X();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=J.find(e=>e.value===Y);if(t){e.preventDefault(),De(t);return}X()}}ue({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Ae())};(0,C.useEffect)(()=>{if(!y||m)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat)return;let t=xe[e.code];t!==void 0&&(e.preventDefault(),Q(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,y,Q]);let Me=e=>{let t=q.finish();if(t===``)return;let n=D.trim()===``?t:`${D.replace(/\s*$/,``)} ${t}`;if(e){A(``),M([]),Q(n,j,!0);return}A(n),W.current=n.length,H.current?.focus()},$=q.recording;return(0,w.jsxs)(se,{open:Ee,onOpenChange:e=>e?void 0:X(),children:[(0,w.jsx)(re,{asChild:!0,children:(0,w.jsxs)(`div`,{ref:U,"data-slot":`composer`,"data-disabled":m||void 0,onDrop:ke,onDragOver:e=>e.preventDefault(),className:f(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,m&&`opacity-80`),children:[j.length>0?(0,w.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap gap-2 px-4 pt-3`,children:j.map((e,t)=>(0,w.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:`group relative size-12 overflow-hidden rounded-md border border-border`,onClick:()=>M(e=>e.filter((e,n)=>n!==t)),children:[(0,w.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}),(0,w.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,w.jsx)(p,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,w.jsx)(`textarea`,{ref:H,rows:2,value:D,disabled:m,"aria-label":le,placeholder:m?h:_,className:`block max-h-[220px] min-h-[54px] w-full resize-none bg-transparent px-4 pt-3 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:text-sm`,onChange:e=>{A(e.target.value),Te()},onKeyDown:je,onSelect:Te,onPaste:Oe}),$?(0,w.jsx)(Ce,{transcript:$.transcript,startedAt:$.startedAt,onCancel:q.cancel,onInsert:()=>Me(!1),onInsertAndSend:()=>Me(!0)}):(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1.5 px-2 pt-1.5 pb-2`,children:[(0,w.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,w.jsx)(Se,{disabled:m,onFiles:Z}),l]}),(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[q.supported?(0,w.jsxs)(s,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:q.start,children:[(0,w.jsx)(he,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,u?(0,w.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:u}):null,(0,w.jsx)(s,{type:`button`,size:`icon-sm`,"aria-label":d,disabled:m||P||D.trim()===``&&j.length===0&&!g,className:`size-8`,onClick:Ae,children:(0,w.jsx)(x,{"aria-hidden":`true`})})]})]})]})}),(0,w.jsx)(ae,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{U.current?.contains(e.target)&&e.preventDefault()},children:(0,w.jsx)(ie,{shouldFilter:!1,value:Y??``,onValueChange:z,children:(0,w.jsx)(ne,{"data-slot":`composer-menu`,"data-trigger":I?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:J.length===0?(0,w.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:I?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:G.isPending?`Loading skills…`:`No matching skills.`}):J.map(e=>(0,w.jsxs)(ce,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>De(e),children:[(0,w.jsx)(`span`,{className:f(`shrink-0 truncate`,e.emphasized&&`font-semibold`,I?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,w.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Se({disabled:e,onFiles:t}){let n=(0,C.useRef)(null);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach images`,title:`Attach an image (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,w.jsx)(S,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,w.jsx)(`input`,{ref:n,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Ce({transcript:e,startedAt:t,onCancel:n,onInsert:r,onInsertAndSend:i}){let a=B(1e3);return(0,w.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,w.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:W(t,a)}),(0,w.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,w.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,w.jsx)(p,{"aria-hidden":`true`})}),(0,w.jsx)(s,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:r,children:(0,w.jsx)(l,{"aria-hidden":`true`})}),(0,w.jsx)(s,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:i,children:(0,w.jsx)(x,{"aria-hidden":`true`})})]})}function K(){return(0,w.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,w.jsx)(u,{icon:(0,w.jsx)(i,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{L as a,D as c,j as d,M as f,R as i,A as l,x as m,G as n,z as o,E as p,B as r,T as s,K as t,N as u};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,In as i,O as a,St as o,a as s,i as c,k as l,mr as ee,t as u,yt as te}from"./centered-state-BkAJVLJE.js";import{r as d,t as f}from"./utils-Wtkd5E6j.js";import{S as ne,c as re,g as ie,l as ae,r as oe,s as se,x as ce}from"./prompt-templates-C5iO3Lda.js";import{n as p}from"./textarea-DVO7pg8Y.js";import{d as m,f as h,g,h as _,l as le,m as v,p as y,u as b}from"./alert-dialog-V9cigyAO.js";import{t as ue}from"./use-submit-shortcut-RKJLKdsW.js";import{i as de,n as fe,r as pe,t as me}from"./skills-BiWfHmCR.js";var x=d(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),he=d(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),S=d(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),C=e(t(),1),w=n();function T({...e}){return(0,w.jsx)(le,{"data-slot":`sheet`,...e})}function E({...e}){return(0,w.jsx)(g,{"data-slot":`sheet-trigger`,...e})}function D({...e}){return(0,w.jsx)(b,{"data-slot":`sheet-close`,...e})}function O({...e}){return(0,w.jsx)(v,{"data-slot":`sheet-portal`,...e})}function k({className:e,...t}){return(0,w.jsx)(y,{"data-slot":`sheet-overlay`,className:f(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function A({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,w.jsxs)(O,{children:[(0,w.jsx)(k,{}),(0,w.jsxs)(m,{"data-slot":`sheet-content`,className:f(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,w.jsxs)(b,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,w.jsx)(p,{className:`size-4`}),(0,w.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function j({className:e,...t}){return(0,w.jsx)(`div`,{"data-slot":`sheet-header`,className:f(`flex flex-col gap-1.5 p-4`,e),...t})}function M({className:e,...t}){return(0,w.jsx)(_,{"data-slot":`sheet-title`,className:f(`font-semibold text-foreground`,e),...t})}function N({className:e,...t}){return(0,w.jsx)(h,{"data-slot":`sheet-description`,className:f(`text-sm text-muted-foreground`,e),...t})}var P=[`done`,`failed`,`cancelled`],F=[`done`,`failed`];function I(e){return P.includes(e)}function L(e){return e.archived||!F.includes(e.status)||e.finishedAt===void 0?!1:e.seenAt===void 0||e.seenAt<e.finishedAt}function R(e){return I(e.status)&&!L(e)}function z(e){return e.reduce((e,t)=>L(t)?e+1:e,0)}function B(e){let[t,n]=C.useState(()=>Date.now());return C.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}async function ge(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n);return{mediaType:e.type,data:r,preview:`data:${e.type};base64,${r}`,name:e.name||`pasted image`}}function _e(e,t){let n=[],r=[],i=t;for(let t of e)if(t.type.startsWith(`image/`)){if(t.size>5242880){r.push(`${t.name||`image`} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${t.name||`image`} skipped — max 4 images per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var V=new Set([`/`,`@`]);function ve(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(V.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function ye(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function H(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function U(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function be(e){let[t,n]=C.useState(null),r=C.useRef(null),i=C.useRef(``),[a]=C.useState(()=>H()!==void 0),o=C.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return C.useEffect(()=>o,[o]),{supported:a,recording:t,start:C.useCallback(()=>{if(r.current)return;let t=H();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=U(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:C.useCallback(()=>o(),[o]),finish:C.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function W(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var xe={KeyA:`Yes, approved.`,KeyC:`Continue.`};function G({onSubmit:e,value:t,onValueChange:n,autoFocus:a=!1,footerStart:l,footerEnd:u,sendAriaLabel:d=`Send`,disabled:m=!1,disabledReason:h=`Session closed — Continue to reopen.`,allowEmptySubmit:g=!1,placeholder:_=`Reply — / for skills, @ for files…`,ariaLabel:le=`Reply to the agent`,autocompleteSkills:v=!0,quickReplies:y=!1,getMentionCandidates:b,ref:S}){let[T,E]=(0,C.useState)(``),D=t??T,O=(0,C.useRef)(D);O.current=D;let k=(0,C.useRef)(n);k.current=n;let A=(0,C.useCallback)(e=>{let t=typeof e==`function`?e(O.current):e;E(t),k.current?.(t)},[]),[j,M]=(0,C.useState)([]),N=(0,C.useRef)(j);N.current=j;let[P,F]=(0,C.useState)(!1),[I,L]=(0,C.useState)(null),[R,z]=(0,C.useState)(``),[B,V]=(0,C.useState)(!1),H=(0,C.useRef)(null),U=(0,C.useRef)(null),W=(0,C.useRef)(null),G=te(v&&B),K=o(),we=ee(),q=be(e=>c(e,{tone:`danger`}));(0,C.useEffect)(()=>{a&&H.current?.focus()},[]),(0,C.useImperativeHandle)(S,()=>({insertAtCaret:e=>{let t=H.current,n=oe(O.current,t?.selectionStart??O.current.length,e);A(n.text),W.current=n.caret,t?.focus()}}),[A]);let Te=(0,C.useCallback)(()=>{let e=H.current;if(!e||m){L(null);return}let t=ve(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!v||t?.trigger===`@`&&b===void 0)return L(null);t?.trigger===`/`&&V(!0),L(t)},[v,m,b]),J=(0,C.useMemo)(()=>I===null?[]:I.trigger===`/`?fe(G.data??[],I.query,K.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:de(e)})):(b?.()??[]).filter(e=>pe(e,I.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[b,G.data,I,K.data?.skillUsage]),Y=J.some(e=>e.value===R)?R:J[0]?.value,Ee=I!==null,X=(0,C.useCallback)(()=>L(null),[]),De=e=>{let t=H.current;if(!t||I===null)return;let n=t.selectionStart??t.value.length,a=ye(t.value,I,n,e.insert);I.trigger===`/`&&K.data!==void 0&&i({skillUsage:me(K.data.skillUsage,e.insert)}).then(()=>we.invalidateQueries({queryKey:r.uiState})).catch(()=>{}),A(a.text),W.current=a.caret,L(null),t.focus()};(0,C.useLayoutEffect)(()=>{let e=W.current,t=H.current;e!==null&&t&&(t.setSelectionRange(e,e),W.current=null)},[D]),(0,C.useLayoutEffect)(()=>{let e=H.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[D]);let Z=(0,C.useCallback)(e=>{if(m)return;let t=_e(e,N.current.length);for(let e of t.rejected)c(e,{tone:`danger`});for(let e of t.accepted)ge(e).then(e=>M(t=>t.length>=4?t:[...t,e]))},[m]),Oe=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),Z(t))},ke=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),Z(t))},Q=(0,C.useCallback)(async(t,n,r)=>{let i=t.trim();if(!(m||P)&&!(i===``&&n.length===0&&!g)){F(!0);try{await e(i,n.map(({mediaType:e,data:t})=>({mediaType:e,data:t})))}catch(e){c(e instanceof Error?e.message:String(e),{tone:`danger`}),r&&(A(e=>e===``?t:`${t}\n${e}`),M(e=>[...n,...e].slice(0,4)))}finally{F(!1)}}},[g,P,m,e]),Ae=(0,C.useCallback)(()=>{if(D.trim()===``&&j.length===0&&!g)return;let e=D,t=j;A(``),M([]),L(null),Q(e,t,!0)},[g,j,Q,D]),je=e=>{if(Ee){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),J.length===0)return;let t=J.findIndex(e=>e.value===Y),n=e.key===`ArrowDown`?1:-1,r=J[(t+n+J.length)%J.length];z(r.value);return}if(e.key===`Escape`){e.preventDefault(),X();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=J.find(e=>e.value===Y);if(t){e.preventDefault(),De(t);return}X()}}ue({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Ae())};(0,C.useEffect)(()=>{if(!y||m)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat)return;let t=xe[e.code];t!==void 0&&(e.preventDefault(),Q(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,y,Q]);let Me=e=>{let t=q.finish();if(t===``)return;let n=D.trim()===``?t:`${D.replace(/\s*$/,``)} ${t}`;if(e){A(``),M([]),Q(n,j,!0);return}A(n),W.current=n.length,H.current?.focus()},$=q.recording;return(0,w.jsxs)(se,{open:Ee,onOpenChange:e=>e?void 0:X(),children:[(0,w.jsx)(re,{asChild:!0,children:(0,w.jsxs)(`div`,{ref:U,"data-slot":`composer`,"data-disabled":m||void 0,onDrop:ke,onDragOver:e=>e.preventDefault(),className:f(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,m&&`opacity-80`),children:[j.length>0?(0,w.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap gap-2 px-4 pt-3`,children:j.map((e,t)=>(0,w.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:`group relative size-12 overflow-hidden rounded-md border border-border`,onClick:()=>M(e=>e.filter((e,n)=>n!==t)),children:[(0,w.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}),(0,w.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,w.jsx)(p,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,w.jsx)(`textarea`,{ref:H,rows:2,value:D,disabled:m,"aria-label":le,placeholder:m?h:_,className:`block max-h-[220px] min-h-[54px] w-full resize-none bg-transparent px-4 pt-3 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:text-sm`,onChange:e=>{A(e.target.value),Te()},onKeyDown:je,onSelect:Te,onPaste:Oe}),$?(0,w.jsx)(Ce,{transcript:$.transcript,startedAt:$.startedAt,onCancel:q.cancel,onInsert:()=>Me(!1),onInsertAndSend:()=>Me(!0)}):(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1.5 px-2 pt-1.5 pb-2`,children:[(0,w.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,w.jsx)(Se,{disabled:m,onFiles:Z}),l]}),(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[q.supported?(0,w.jsxs)(s,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:q.start,children:[(0,w.jsx)(he,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,u?(0,w.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:u}):null,(0,w.jsx)(s,{type:`button`,size:`icon-sm`,"aria-label":d,disabled:m||P||D.trim()===``&&j.length===0&&!g,className:`size-8`,onClick:Ae,children:(0,w.jsx)(x,{"aria-hidden":`true`})})]})]})]})}),(0,w.jsx)(ae,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{U.current?.contains(e.target)&&e.preventDefault()},children:(0,w.jsx)(ie,{shouldFilter:!1,value:Y??``,onValueChange:z,children:(0,w.jsx)(ne,{"data-slot":`composer-menu`,"data-trigger":I?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:J.length===0?(0,w.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:I?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:G.isPending?`Loading skills…`:`No matching skills.`}):J.map(e=>(0,w.jsxs)(ce,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>De(e),children:[(0,w.jsx)(`span`,{className:f(`shrink-0 truncate`,e.emphasized&&`font-semibold`,I?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,w.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Se({disabled:e,onFiles:t}){let n=(0,C.useRef)(null);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach images`,title:`Attach an image (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,w.jsx)(S,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,w.jsx)(`input`,{ref:n,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Ce({transcript:e,startedAt:t,onCancel:n,onInsert:r,onInsertAndSend:i}){let a=B(1e3);return(0,w.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,w.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:W(t,a)}),(0,w.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,w.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,w.jsx)(p,{"aria-hidden":`true`})}),(0,w.jsx)(s,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:r,children:(0,w.jsx)(l,{"aria-hidden":`true`})}),(0,w.jsx)(s,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:i,children:(0,w.jsx)(x,{"aria-hidden":`true`})})]})}function K(){return(0,w.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,w.jsx)(u,{icon:(0,w.jsx)(a,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{L as a,D as c,j as d,M as f,R as i,A as l,x as m,G as n,z as o,E as p,B as r,T as s,K as t,N as u};
@@ -1 +1 @@
1
- import{r as e}from"./utils-DsLuRXwV.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),n=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t as n,n as t};
1
+ import{r as e}from"./utils-Wtkd5E6j.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),n=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t as n,n as t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-DsLuRXwV.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
1
+ import{r as e}from"./utils-Wtkd5E6j.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-DsLuRXwV.js";var t=e(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);export{t};
1
+ import{r as e}from"./utils-Wtkd5E6j.js";var t=e(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);export{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{a as r}from"./centered-state-ZtnFHA-n.js";import{r as i,t as a}from"./utils-DsLuRXwV.js";import{x as o}from"./index-DiawI6RX.js";var s=i(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=n();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:i}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,l.jsx)(d,{current:e,value:`unified`,onModeChange:n}),(0,l.jsx)(d,{current:e,value:`split`,onModeChange:n})]}),(0,l.jsx)(r,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:a(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,l.jsx)(c,{"aria-hidden":`true`})})]})}function d({current:e,value:t,onModeChange:n}){let r=e===t;return(0,l.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:a(`rounded-[5px] px-2 py-0.5 text-[11px] font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function f({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}var p=e(t(),1);function m(){let[e,t]=(0,p.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,p.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{s as i,f as n,u as r,m 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{a as r}from"./centered-state-BkAJVLJE.js";import{r as i,t as a}from"./utils-Wtkd5E6j.js";import{x as o}from"./index-BmHHLbwc.js";var s=i(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=n();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:i}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,l.jsx)(d,{current:e,value:`unified`,onModeChange:n}),(0,l.jsx)(d,{current:e,value:`split`,onModeChange:n})]}),(0,l.jsx)(r,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:a(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,l.jsx)(c,{"aria-hidden":`true`})})]})}function d({current:e,value:t,onModeChange:n}){let r=e===t;return(0,l.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:a(`rounded-[5px] px-2 py-0.5 text-[11px] font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function f({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}var p=e(t(),1);function m(){let[e,t]=(0,p.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,p.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{s as i,f as n,u as r,m as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{a as n}from"./centered-state-ZtnFHA-n.js";import{t as r}from"./utils-DsLuRXwV.js";import{n as i}from"./textarea-CUdokhkv.js";import{d as a,f as o,h as s,l as c,m as l,p as u,u as d}from"./alert-dialog-ghffK6g9.js";e();var f=t();function p({...e}){return(0,f.jsx)(c,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(l,{"data-slot":`dialog-portal`,...e})}function h({...e}){return(0,f.jsx)(d,{"data-slot":`dialog-close`,...e})}function g({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _({className:e,children:t,showCloseButton:n=!0,...o}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(g,{}),(0,f.jsxs)(a,{"data-slot":`dialog-content`,className:r(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...o,children:[t,n&&(0,f.jsxs)(d,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(i,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:r(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function y({className:e,showCloseButton:t=!1,children:i,...a}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:r(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[i,t&&(0,f.jsx)(d,{asChild:!0,children:(0,f.jsx)(n,{variant:`outline`,children:`Close`})})]})}function b({className:e,...t}){return(0,f.jsx)(s,{"data-slot":`dialog-title`,className:r(`text-lg leading-none font-semibold`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function S(e){return!(e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing)}function C(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}export{_ as a,v as c,h as i,b as l,C as n,x as o,p as r,y as s,S as t};
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{a as n}from"./centered-state-BkAJVLJE.js";import{t as r}from"./utils-Wtkd5E6j.js";import{n as i}from"./textarea-DVO7pg8Y.js";import{d as a,f as o,h as s,l as c,m as l,p as u,u as d}from"./alert-dialog-V9cigyAO.js";e();var f=t();function p({...e}){return(0,f.jsx)(c,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(l,{"data-slot":`dialog-portal`,...e})}function h({...e}){return(0,f.jsx)(d,{"data-slot":`dialog-close`,...e})}function g({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _({className:e,children:t,showCloseButton:n=!0,...o}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(g,{}),(0,f.jsxs)(a,{"data-slot":`dialog-content`,className:r(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...o,children:[t,n&&(0,f.jsxs)(d,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(i,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:r(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function y({className:e,showCloseButton:t=!1,children:i,...a}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:r(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[i,t&&(0,f.jsx)(d,{asChild:!0,children:(0,f.jsx)(n,{variant:`outline`,children:`Close`})})]})}function b({className:e,...t}){return(0,f.jsx)(s,{"data-slot":`dialog-title`,className:r(`text-lg leading-none font-semibold`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function S(e){return!(e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing)}function C(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}export{_ as a,v as c,h as i,b as l,C as n,x as o,p as r,y as s,S as t};