codeharden 2026.1122.2133 → 2026.1122.2302

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 (108) hide show
  1. package/README.md +48 -3
  2. package/dist/{args-B0i5tyjE.js → args-BJ0ric8X.js} +5 -5
  3. package/dist/args-BJ0ric8X.js.map +1 -0
  4. package/dist/cli.js +2 -2
  5. package/dist/{commands-CvAvyECH.js → commands-BPobEsBP.js} +33 -14
  6. package/dist/commands-BPobEsBP.js.map +1 -0
  7. package/dist/{env-wDgRchH9.js → env-CMkse2o0.js} +2 -2
  8. package/dist/{env-wDgRchH9.js.map → env-CMkse2o0.js.map} +1 -1
  9. package/dist/{harden-channel-2IT0Y7p3.js → harden-channel-D7h06kQ_.js} +41 -3
  10. package/dist/harden-channel-D7h06kQ_.js.map +1 -0
  11. package/dist/{launcher-D17oQovS.js → launcher-CvQZcEIC.js} +3 -3
  12. package/dist/launcher-CvQZcEIC.js.map +1 -0
  13. package/dist/{lock-DxXcNd2w.js → lock-iovTSSb0.js} +2 -2
  14. package/dist/{lock-DxXcNd2w.js.map → lock-iovTSSb0.js.map} +1 -1
  15. package/dist/{main-BRHfJHGf.js → main-BFo94KOF.js} +6 -6
  16. package/dist/{main-BRHfJHGf.js.map → main-BFo94KOF.js.map} +1 -1
  17. package/dist/{main-CJdbWeA_.js → main-B_ui4G93.js} +3 -3
  18. package/dist/{main-CJdbWeA_.js.map → main-B_ui4G93.js.map} +1 -1
  19. package/dist/{mediaType-e66mt7Cb.js → mediaType-DHbUOwRj.js} +2 -2
  20. package/dist/{mediaType-e66mt7Cb.js.map → mediaType-DHbUOwRj.js.map} +1 -1
  21. package/dist/{runner-CKo8zFVx.js → runner-agAgr2qn.js} +5 -5
  22. package/dist/{runner-CKo8zFVx.js.map → runner-agAgr2qn.js.map} +1 -1
  23. package/dist/{runner-link-CGefyJ5U.js → runner-link-B7SsTYaz.js} +3 -3
  24. package/dist/{runner-link-CGefyJ5U.js.map → runner-link-B7SsTYaz.js.map} +1 -1
  25. package/dist/runner.js +1 -1
  26. package/dist/{server-test-aa-ENBUk.js → server-test-Cad_bM68.js} +4 -4
  27. package/dist/{server-test-aa-ENBUk.js.map → server-test-Cad_bM68.js.map} +1 -1
  28. package/dist/{src-CwV8i4Mj.js → src-BPcdaWEw.js} +4 -6
  29. package/dist/{src-CwV8i4Mj.js.map → src-BPcdaWEw.js.map} +1 -1
  30. package/dist/web/assets/{add-project-dialog-VBi3WXnh.js → add-project-dialog-BHbgORVh.js} +1 -1
  31. package/dist/web/assets/{agent-tabs-BNgrQWDq.js → agent-tabs-B6uUKAXD.js} +1 -1
  32. package/dist/web/assets/{agents-Ir1aHz-I.js → agents-NbcZbVrc.js} +1 -1
  33. package/dist/web/assets/{api-jkvqht5P.js → api-B9OffDXw.js} +1 -1
  34. package/dist/web/assets/{api-B620HpC2.js → api-yvn34iKU.js} +27 -27
  35. package/dist/web/assets/{archived-sessions-D4fJHB37.js → archived-sessions-C1-stU7x.js} +1 -1
  36. package/dist/web/assets/{automation-B91XTDIM.js → automation-Co7V1tcW.js} +1 -1
  37. package/dist/web/assets/{automation-new-CN7YhryW.js → automation-new-hCV8HoK1.js} +1 -1
  38. package/dist/web/assets/{automations-CLzVG-zc.js → automations-7GJxGbPp.js} +1 -1
  39. package/dist/web/assets/{composer-Dd8joSgj.js → composer-B1tdNGSi.js} +1 -1
  40. package/dist/web/assets/{conflict-card-BN9kNMVL.js → conflict-card-Bx8tT_d5.js} +1 -1
  41. package/dist/web/assets/{dialog-Dyw3b_Tu.js → dialog-Cvj_lHPY.js} +1 -1
  42. package/dist/web/assets/{diff-panel-CQ2XZMk2.js → diff-panel-BHhM9z93.js} +1 -1
  43. package/dist/web/assets/{draft-BmnE6-7J.js → draft-JkaN3nCS.js} +1 -1
  44. package/dist/web/assets/{dropdown-menu-C4XI7F63.js → dropdown-menu-Bflkx6wY.js} +1 -1
  45. package/dist/web/assets/{engines-Chq2ih3x.js → engines-pLQJYIu_.js} +1 -1
  46. package/dist/web/assets/{factory-BBYEYI9i.js → factory-DVCs5zxg.js} +1 -1
  47. package/dist/web/assets/{factory-columns-CtJOpFim.js → factory-columns-DExb6gW2.js} +1 -1
  48. package/dist/web/assets/{factory-item-BjydL6AH.js → factory-item-efMFkxnv.js} +1 -1
  49. package/dist/web/assets/{factory-view-BU2AKcD8.js → factory-view-Cot7flHA.js} +1 -1
  50. package/dist/web/assets/{files-panel-B6_6pSo9.js → files-panel-BIkR_seN.js} +1 -1
  51. package/dist/web/assets/{floor-scene-DCpEq0j7.js → floor-scene-DGy8i_5R.js} +1 -1
  52. package/dist/web/assets/{form-bits-BSfnSmQ7.js → form-bits-5XojWhBG.js} +1 -1
  53. package/dist/web/assets/{format-D1ma_o2D.js → format-D3kairnQ.js} +1 -1
  54. package/dist/web/assets/{home-_m_Aihwv.js → home-BtFPGjza.js} +1 -1
  55. package/dist/web/assets/{inbox-FDD5FMWW.js → inbox-CUPkJ4WC.js} +1 -1
  56. package/dist/web/assets/{index-BkpVvQrC.js → index-C0C9GyeX.js} +4 -4
  57. package/dist/web/assets/{item-parts-BhDFWsT1.js → item-parts-DZ3TQad4.js} +1 -1
  58. package/dist/web/assets/{kill-switch-Dvqaozhz.js → kill-switch-BDAFCjui.js} +1 -1
  59. package/dist/web/assets/{label-DcWfyglU.js → label-Bm_8Eqe2.js} +1 -1
  60. package/dist/web/assets/{local-whisper-test-DPTOEA1M.js → local-whisper-test-CqGlAOvK.js} +1 -1
  61. package/dist/web/assets/{markdown-ad2jia51.js → markdown-DGHfubu-.js} +1 -1
  62. package/dist/web/assets/{mobile-nav-D8FZcJzG.js → mobile-nav-CrjrDJZ5.js} +1 -1
  63. package/dist/web/assets/{model-picker-4yoJPkRY.js → model-picker-DnKv2cbc.js} +1 -1
  64. package/dist/web/assets/{new-session-ddLbjOoZ.js → new-session-Bc93-xJK.js} +1 -1
  65. package/dist/web/assets/{new-session-GpxXZWbB.js → new-session-CUpOffXI.js} +1 -1
  66. package/dist/web/assets/{new-session-CwbgcYzY.js → new-session-DVYesr8z.js} +1 -1
  67. package/dist/web/assets/{now-next-D-6j1g_S.js → now-next-x8fwFm7p.js} +1 -1
  68. package/dist/web/assets/{on-demand-Cvu5D9uT.js → on-demand-Cvi90jRi.js} +2 -2
  69. package/dist/web/assets/{open-pr-controls--EtUvzD2.js → open-pr-controls-CYypJCKQ.js} +1 -1
  70. package/dist/web/assets/{orchestration-pknfiYFr.js → orchestration-BZj0HlxR.js} +1 -1
  71. package/dist/web/assets/{page-header-BqPf-jRo.js → page-header-t9HzSrxd.js} +1 -1
  72. package/dist/web/assets/{pm-fMuSJMPP.js → pm-DJfHcB90.js} +1 -1
  73. package/dist/web/assets/{popover-OrzLEhHL.js → popover-BqwWmyWQ.js} +1 -1
  74. package/dist/web/assets/{pr-details-BBVM9Kll.js → pr-details-1hhbiFWa.js} +1 -1
  75. package/dist/web/assets/{project-ws85aDq4.js → project-dy2_DT0H.js} +1 -1
  76. package/dist/web/assets/{question-card-4aNx5IRX.js → question-card-ldxLXNS_.js} +1 -1
  77. package/dist/web/assets/{remote-check-BAPXUznK.js → remote-check-CQktPgyp.js} +2 -2
  78. package/dist/web/assets/{reports-BZj5_wsp.js → reports-D0GAsXFv.js} +1 -1
  79. package/dist/web/assets/{role-chat-CeJXMsYB.js → role-chat-nIyzM-vQ.js} +1 -1
  80. package/dist/web/assets/{run-conflict-CPr9OWa3.js → run-conflict-BlgKVpOG.js} +1 -1
  81. package/dist/web/assets/{runs-table-DpBJ4ZeQ.js → runs-table-DMPF5_D6.js} +1 -1
  82. package/dist/web/assets/{search-BFTvT67N.js → search-gwjIEGis.js} +1 -1
  83. package/dist/web/assets/{search-Da3B5-lr.js → search-hK5b8Xwb.js} +1 -1
  84. package/dist/web/assets/{select-B4LGxZQI.js → select-B1ES0hhy.js} +1 -1
  85. package/dist/web/assets/{session-_62x2rSZ.js → session-CPUTlq1O.js} +1 -1
  86. package/dist/web/assets/{settings-CUYuBL-5.js → settings-DRd0b0Kz.js} +1 -1
  87. package/dist/web/assets/{settings-ui-Ux8rPFol.js → settings-ui-Bc6ymtc_.js} +1 -1
  88. package/dist/web/assets/{setup-BKOOV6vX.js → setup-Bn2CFYAt.js} +1 -1
  89. package/dist/web/assets/{shallow-CbfSRfYC.js → shallow-BUNpybIA.js} +1 -1
  90. package/dist/web/assets/{spec-approval-9S-jPMrI.js → spec-approval-CmC6QBSh.js} +1 -1
  91. package/dist/web/assets/{spot-check-actions-5CmYjt8A.js → spot-check-actions-DzMUED1O.js} +1 -1
  92. package/dist/web/assets/{spot-checks-BadmkHuG.js → spot-checks-CDZxwwu0.js} +1 -1
  93. package/dist/web/assets/{storeys-OlWmOmqA.js → storeys-BEgFUsix.js} +1 -1
  94. package/dist/web/assets/{switch-DuBpF2_h.js → switch-BHplnCdo.js} +1 -1
  95. package/dist/web/assets/{terminal-view-ChO1pNp0.js → terminal-view-WNT8FI6K.js} +1 -1
  96. package/dist/web/assets/{theme-DsW-i9mD.js → theme-3eeE0sp4.js} +1 -1
  97. package/dist/web/assets/{thread-view-CPlJsMhl.js → thread-view-AQKzJlKb.js} +1 -1
  98. package/dist/web/assets/{update-banner-CNYd8gAf.js → update-banner-CZGRgiG8.js} +1 -1
  99. package/dist/web/assets/{updates-CQZDqpFF.js → updates-4l7pwDq1.js} +1 -1
  100. package/dist/web/assets/{use-retry-item-CWwb3JGo.js → use-retry-item-3n4BD_3J.js} +1 -1
  101. package/dist/web/assets/{vision-7gkgZ-Ap.js → vision-Z1sLHr_c.js} +1 -1
  102. package/dist/web/assets/{wip-chip-D5-cZcfN.js → wip-chip-DXwuAo3A.js} +1 -1
  103. package/dist/web/index.html +34 -34
  104. package/package.json +1 -1
  105. package/dist/args-B0i5tyjE.js.map +0 -1
  106. package/dist/commands-CvAvyECH.js.map +0 -1
  107. package/dist/harden-channel-2IT0Y7p3.js.map +0 -1
  108. package/dist/launcher-D17oQovS.js.map +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{_ as t,j as n,m as r,yt as i}from"./format-D1ma_o2D.js";import{F as a,t as o}from"./useQuery-VSotSwry.js";import{d as s,o as c,r as l}from"./switch-DuBpF2_h.js";import{Dr as u,Sn as d,_n as f,en as p,mn as m,ur as h,xn as g}from"./icons-COCLuOtb.js";import{n as _,t as v}from"./jsx-runtime-C3cWAN_r.js";import{a as y,c as b,i as x,n as S,r as C,t as w}from"./dialog-Dyw3b_Tu.js";import{t as T}from"./input-CPpbtC2H.js";import{i as E,o as D}from"./api-B620HpC2.js";import{t as O}from"./dist-wxbqfqV1.js";import{t as k}from"./skeleton-D8Sbd2jT.js";var A=e(_(),1),j=v();function M({value:e,onChange:t}){let n=E(),[i,a]=(0,A.useState)(null),[s,c]=(0,A.useState)(!1),[l,m]=(0,A.useState)(null),{data:g,isLoading:_,error:v}=o({queryKey:[`fs`,i,s],queryFn:()=>n.listDirectory(i,{showHidden:s}),placeholderData:e=>e}),y=g?.path??``,b=y.split(/[\\/]/).filter(Boolean),x=y.includes(`\\`)||/^[A-Za-z]:/.test(y)?`\\`:`/`,S=(g?.entries??[]).filter(e=>s||!e.hidden),C=g?[{label:`Home`,path:g.home},...g.roots.map(e=>({label:e.name,path:e.path}))]:[];return(0,j.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border px-2 py-1.5`,children:[(0,j.jsx)(r,{variant:`ghost`,size:`icon-xs`,disabled:!g?.parent,onClick:()=>g?.parent&&a(g.parent),"aria-label":`Up one folder`,children:(0,j.jsx)(u,{})}),(0,j.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto font-mono text-2xs text-muted-foreground scroll-thin`,children:b.map((e,t)=>{let n=b.slice(0,t+1).join(x)+(t===0&&x===`\\`?`\\`:``);return(0,j.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5`,children:[t>0&&(0,j.jsx)(h,{className:`size-3 opacity-50`}),(0,j.jsx)(`button`,{type:`button`,className:`rounded px-1 hover:bg-accent hover:text-foreground`,onClick:()=>a(x===`/`?`/${n}`:n.replace(/\\$/,t===0?`\\`:``)),children:e})]},n)})}),(0,j.jsxs)(`label`,{className:`flex shrink-0 items-center gap-1 text-3xs text-muted-foreground`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),className:`accent-primary`}),` `,`hidden`]})]}),(0,j.jsxs)(`div`,{className:`flex`,children:[(0,j.jsx)(`div`,{className:`w-32 shrink-0 space-y-0.5 border-r border-border p-1.5`,children:C.map(e=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>a(e.path),className:O(`flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground`,y===e.path&&`bg-accent text-foreground`),children:[(0,j.jsx)(p,{className:`size-3`}),` `,e.label]},e.path))}),(0,j.jsxs)(`div`,{className:`h-64 min-w-0 flex-1 overflow-y-auto p-1 scroll-thin`,children:[_&&(0,j.jsx)(`div`,{className:`space-y-1.5 p-2`,children:[0,1,2,3].map(e=>(0,j.jsx)(k,{className:`h-5`},e))}),v&&(0,j.jsx)(`div`,{className:`p-3 text-xs text-status-failed`,children:v.message}),!_&&!v&&S.length===0&&(0,j.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`No folders here.`}),S.map(n=>(0,j.jsxs)(`div`,{className:O(`group flex h-8 w-full items-center rounded-md text-[13px] hover:bg-accent/70`,e===n.path&&`bg-primary/10 ring-1 ring-primary/40`),children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>t(n.path),onDoubleClick:()=>a(n.path),className:`flex h-full min-w-0 flex-1 items-center gap-2 px-2 text-left`,children:[n.isGitRepo?(0,j.jsx)(d,{className:`size-4 shrink-0 text-primary`}):(0,j.jsx)(f,{className:`size-4 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`flex-1 truncate`,children:n.name}),n.isGitRepo&&(0,j.jsx)(`span`,{className:`rounded bg-muted px-1.5 text-3xs text-muted-foreground`,children:`git`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>a(n.path),className:`mr-1 flex size-6 shrink-0 items-center justify-center rounded opacity-0 group-hover:opacity-100 hover:bg-background focus-visible:opacity-100 touch:opacity-100`,"aria-label":`Open ${n.name}`,children:(0,j.jsx)(h,{className:`size-3.5`})})]},n.path))]})]}),(0,j.jsx)(`form`,{className:`border-t border-border bg-muted/30`,onSubmit:e=>{e.preventDefault();let n=l?.trim();n&&(a(n),t(n),m(null))},children:(0,j.jsx)(`input`,{value:l??e??``,onChange:e=>m(e.target.value),placeholder:`Select a folder · double-click to open · or paste a path and press Enter`,"aria-label":`Folder path`,className:`w-full bg-transparent px-3 py-1.5 font-mono text-2xs text-muted-foreground outline-none placeholder:text-muted-foreground/70 focus:text-foreground`})})]})}function N({value:e,onChange:t}){let[n,i]=(0,A.useState)(!1),[a,o]=(0,A.useState)(!1),s=async()=>{o(!0);try{let n=await c.pickFolder({title:`Choose a project folder`,defaultPath:e??void 0});n&&t(n)}finally{o(!1)}};return n?(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(M,{value:e,onChange:t}),(0,j.jsx)(r,{variant:`link`,size:`xs`,className:`px-0`,onClick:()=>i(!1),children:`Use the system folder picker instead`})]}):(0,j.jsxs)(`div`,{className:`space-y-2`,"data-testid":`native-folder-field`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-border bg-card p-3`,children:[(0,j.jsx)(d,{className:`size-5 shrink-0 text-muted-foreground`}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:e?(0,j.jsx)(`div`,{className:`truncate font-mono text-[13px]`,title:e,children:e}):(0,j.jsx)(`div`,{className:`text-[13px] text-muted-foreground`,children:`No folder chosen yet`})}),(0,j.jsxs)(r,{size:`sm`,variant:`outline`,onClick:()=>void s(),disabled:a,children:[(0,j.jsx)(g,{}),` `,e?`Change...`:`Choose folder...`]})]}),(0,j.jsx)(r,{variant:`link`,size:`xs`,className:`px-0`,onClick:()=>i(!0),children:`Browse folders in CodeDen instead`})]})}function P({onCreated:e,submitLabel:o=`Add project`}){let s=E(),l=a(),[u,d]=(0,A.useState)(`folder`),[f,p]=(0,A.useState)(null),[h,_]=(0,A.useState)(``),v=i({mutationFn:e=>s.createProject(e),onSuccess:({project:r,detected:i})=>{l.setQueryData(t,e=>e&&D(e,r));let a=[i.github?`GitHub ${i.github.owner}/${i.github.repo}`:null,i.packageManager?`Detected ${i.packageManager}`:null,i.suggestedSetupCommands.length?`suggested setup: ${i.suggestedSetupCommands.join(` && `)}`:null].filter(Boolean);n.success(`Added ${r.name}`,{description:a.length?a.join(` · `):void 0}),e(r.id)},onError:e=>n.error(`Couldn't add the project`,{description:e.message})}),y=u===`folder`?!!f:/^((https:\/\/|git@)github\.com[:/].+\/.+|[\w.-]+\/[\w.-]+)$/.test(h.trim());return(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[[`folder`,g,`Local folder`,`Any folder; GitHub features turn on when it has a GitHub remote.`],[`clone`,m,`Clone from GitHub`,`Paste a repository URL and CodeDen clones it.`]].map(([e,t,n,r])=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>d(e),className:O(`rounded-xl border p-3 text-left transition-colors`,u===e?`border-primary/50 bg-primary/[0.06]`:`border-border hover:bg-accent/40`),children:[(0,j.jsx)(t,{className:O(`mb-2 size-4`,u===e?`text-primary`:`text-muted-foreground`)}),(0,j.jsx)(`div`,{className:`text-[13px] font-medium`,children:n}),(0,j.jsx)(`div`,{className:`mt-0.5 text-2xs leading-snug text-muted-foreground`,children:r})]},e))}),u===`folder`?c.capabilities.folderPicker?(0,j.jsx)(N,{value:f,onChange:p}):(0,j.jsx)(M,{value:f,onChange:p}):(0,j.jsx)(T,{value:h,onChange:e=>_(e.target.value),placeholder:`https://github.com/owner/repo`,className:`font-mono text-[13px]`,autoFocus:!0}),(0,j.jsx)(`div`,{className:`flex justify-end`,children:(0,j.jsx)(r,{disabled:!y||v.isPending,onClick:()=>v.mutate(u===`folder`?{source:{type:`local`,path:f??``}}:{source:{type:`clone`,url:h.trim()}}),children:v.isPending?u===`clone`?`Cloning…`:`Adding…`:o})})]})}function F(){let e=l(e=>e.addProjectOpen),t=l(e=>e.setAddProjectOpen),n=s();return(0,j.jsx)(w,{open:e,onOpenChange:t,children:(0,j.jsxs)(S,{className:`sm:max-w-xl`,children:[(0,j.jsxs)(y,{children:[(0,j.jsx)(b,{children:`Add a project`}),(0,j.jsx)(C,{children:`GitHub repos get issues, PRs and evidence. Local folders work too.`})]}),(0,j.jsx)(P,{onCreated:e=>{t(!1),n({to:`/projects/$projectId/new`,params:{projectId:e}})}}),(0,j.jsx)(x,{className:`hidden`})]})})}export{P as n,F as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{_ as t,j as n,m as r,yt as i}from"./format-D3kairnQ.js";import{F as a,t as o}from"./useQuery-VSotSwry.js";import{d as s,o as c,r as l}from"./switch-BHplnCdo.js";import{Dr as u,Sn as d,_n as f,en as p,mn as m,ur as h,xn as g}from"./icons-COCLuOtb.js";import{n as _,t as v}from"./jsx-runtime-C3cWAN_r.js";import{a as y,c as b,i as x,n as S,r as C,t as w}from"./dialog-Cvj_lHPY.js";import{t as T}from"./input-CPpbtC2H.js";import{i as E,o as D}from"./api-yvn34iKU.js";import{t as O}from"./dist-wxbqfqV1.js";import{t as k}from"./skeleton-D8Sbd2jT.js";var A=e(_(),1),j=v();function M({value:e,onChange:t}){let n=E(),[i,a]=(0,A.useState)(null),[s,c]=(0,A.useState)(!1),[l,m]=(0,A.useState)(null),{data:g,isLoading:_,error:v}=o({queryKey:[`fs`,i,s],queryFn:()=>n.listDirectory(i,{showHidden:s}),placeholderData:e=>e}),y=g?.path??``,b=y.split(/[\\/]/).filter(Boolean),x=y.includes(`\\`)||/^[A-Za-z]:/.test(y)?`\\`:`/`,S=(g?.entries??[]).filter(e=>s||!e.hidden),C=g?[{label:`Home`,path:g.home},...g.roots.map(e=>({label:e.name,path:e.path}))]:[];return(0,j.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border px-2 py-1.5`,children:[(0,j.jsx)(r,{variant:`ghost`,size:`icon-xs`,disabled:!g?.parent,onClick:()=>g?.parent&&a(g.parent),"aria-label":`Up one folder`,children:(0,j.jsx)(u,{})}),(0,j.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto font-mono text-2xs text-muted-foreground scroll-thin`,children:b.map((e,t)=>{let n=b.slice(0,t+1).join(x)+(t===0&&x===`\\`?`\\`:``);return(0,j.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5`,children:[t>0&&(0,j.jsx)(h,{className:`size-3 opacity-50`}),(0,j.jsx)(`button`,{type:`button`,className:`rounded px-1 hover:bg-accent hover:text-foreground`,onClick:()=>a(x===`/`?`/${n}`:n.replace(/\\$/,t===0?`\\`:``)),children:e})]},n)})}),(0,j.jsxs)(`label`,{className:`flex shrink-0 items-center gap-1 text-3xs text-muted-foreground`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),className:`accent-primary`}),` `,`hidden`]})]}),(0,j.jsxs)(`div`,{className:`flex`,children:[(0,j.jsx)(`div`,{className:`w-32 shrink-0 space-y-0.5 border-r border-border p-1.5`,children:C.map(e=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>a(e.path),className:O(`flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground`,y===e.path&&`bg-accent text-foreground`),children:[(0,j.jsx)(p,{className:`size-3`}),` `,e.label]},e.path))}),(0,j.jsxs)(`div`,{className:`h-64 min-w-0 flex-1 overflow-y-auto p-1 scroll-thin`,children:[_&&(0,j.jsx)(`div`,{className:`space-y-1.5 p-2`,children:[0,1,2,3].map(e=>(0,j.jsx)(k,{className:`h-5`},e))}),v&&(0,j.jsx)(`div`,{className:`p-3 text-xs text-status-failed`,children:v.message}),!_&&!v&&S.length===0&&(0,j.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`No folders here.`}),S.map(n=>(0,j.jsxs)(`div`,{className:O(`group flex h-8 w-full items-center rounded-md text-[13px] hover:bg-accent/70`,e===n.path&&`bg-primary/10 ring-1 ring-primary/40`),children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>t(n.path),onDoubleClick:()=>a(n.path),className:`flex h-full min-w-0 flex-1 items-center gap-2 px-2 text-left`,children:[n.isGitRepo?(0,j.jsx)(d,{className:`size-4 shrink-0 text-primary`}):(0,j.jsx)(f,{className:`size-4 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`flex-1 truncate`,children:n.name}),n.isGitRepo&&(0,j.jsx)(`span`,{className:`rounded bg-muted px-1.5 text-3xs text-muted-foreground`,children:`git`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>a(n.path),className:`mr-1 flex size-6 shrink-0 items-center justify-center rounded opacity-0 group-hover:opacity-100 hover:bg-background focus-visible:opacity-100 touch:opacity-100`,"aria-label":`Open ${n.name}`,children:(0,j.jsx)(h,{className:`size-3.5`})})]},n.path))]})]}),(0,j.jsx)(`form`,{className:`border-t border-border bg-muted/30`,onSubmit:e=>{e.preventDefault();let n=l?.trim();n&&(a(n),t(n),m(null))},children:(0,j.jsx)(`input`,{value:l??e??``,onChange:e=>m(e.target.value),placeholder:`Select a folder · double-click to open · or paste a path and press Enter`,"aria-label":`Folder path`,className:`w-full bg-transparent px-3 py-1.5 font-mono text-2xs text-muted-foreground outline-none placeholder:text-muted-foreground/70 focus:text-foreground`})})]})}function N({value:e,onChange:t}){let[n,i]=(0,A.useState)(!1),[a,o]=(0,A.useState)(!1),s=async()=>{o(!0);try{let n=await c.pickFolder({title:`Choose a project folder`,defaultPath:e??void 0});n&&t(n)}finally{o(!1)}};return n?(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(M,{value:e,onChange:t}),(0,j.jsx)(r,{variant:`link`,size:`xs`,className:`px-0`,onClick:()=>i(!1),children:`Use the system folder picker instead`})]}):(0,j.jsxs)(`div`,{className:`space-y-2`,"data-testid":`native-folder-field`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-border bg-card p-3`,children:[(0,j.jsx)(d,{className:`size-5 shrink-0 text-muted-foreground`}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:e?(0,j.jsx)(`div`,{className:`truncate font-mono text-[13px]`,title:e,children:e}):(0,j.jsx)(`div`,{className:`text-[13px] text-muted-foreground`,children:`No folder chosen yet`})}),(0,j.jsxs)(r,{size:`sm`,variant:`outline`,onClick:()=>void s(),disabled:a,children:[(0,j.jsx)(g,{}),` `,e?`Change...`:`Choose folder...`]})]}),(0,j.jsx)(r,{variant:`link`,size:`xs`,className:`px-0`,onClick:()=>i(!0),children:`Browse folders in CodeDen instead`})]})}function P({onCreated:e,submitLabel:o=`Add project`}){let s=E(),l=a(),[u,d]=(0,A.useState)(`folder`),[f,p]=(0,A.useState)(null),[h,_]=(0,A.useState)(``),v=i({mutationFn:e=>s.createProject(e),onSuccess:({project:r,detected:i})=>{l.setQueryData(t,e=>e&&D(e,r));let a=[i.github?`GitHub ${i.github.owner}/${i.github.repo}`:null,i.packageManager?`Detected ${i.packageManager}`:null,i.suggestedSetupCommands.length?`suggested setup: ${i.suggestedSetupCommands.join(` && `)}`:null].filter(Boolean);n.success(`Added ${r.name}`,{description:a.length?a.join(` · `):void 0}),e(r.id)},onError:e=>n.error(`Couldn't add the project`,{description:e.message})}),y=u===`folder`?!!f:/^((https:\/\/|git@)github\.com[:/].+\/.+|[\w.-]+\/[\w.-]+)$/.test(h.trim());return(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[[`folder`,g,`Local folder`,`Any folder; GitHub features turn on when it has a GitHub remote.`],[`clone`,m,`Clone from GitHub`,`Paste a repository URL and CodeDen clones it.`]].map(([e,t,n,r])=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>d(e),className:O(`rounded-xl border p-3 text-left transition-colors`,u===e?`border-primary/50 bg-primary/[0.06]`:`border-border hover:bg-accent/40`),children:[(0,j.jsx)(t,{className:O(`mb-2 size-4`,u===e?`text-primary`:`text-muted-foreground`)}),(0,j.jsx)(`div`,{className:`text-[13px] font-medium`,children:n}),(0,j.jsx)(`div`,{className:`mt-0.5 text-2xs leading-snug text-muted-foreground`,children:r})]},e))}),u===`folder`?c.capabilities.folderPicker?(0,j.jsx)(N,{value:f,onChange:p}):(0,j.jsx)(M,{value:f,onChange:p}):(0,j.jsx)(T,{value:h,onChange:e=>_(e.target.value),placeholder:`https://github.com/owner/repo`,className:`font-mono text-[13px]`,autoFocus:!0}),(0,j.jsx)(`div`,{className:`flex justify-end`,children:(0,j.jsx)(r,{disabled:!y||v.isPending,onClick:()=>v.mutate(u===`folder`?{source:{type:`local`,path:f??``}}:{source:{type:`clone`,url:h.trim()}}),children:v.isPending?u===`clone`?`Cloning…`:`Adding…`:o})})]})}function F(){let e=l(e=>e.addProjectOpen),t=l(e=>e.setAddProjectOpen),n=s();return(0,j.jsx)(w,{open:e,onOpenChange:t,children:(0,j.jsxs)(S,{className:`sm:max-w-xl`,children:[(0,j.jsxs)(y,{children:[(0,j.jsx)(b,{children:`Add a project`}),(0,j.jsx)(C,{children:`GitHub repos get issues, PRs and evidence. Local folders work too.`})]}),(0,j.jsx)(P,{onCreated:e=>{t(!1),n({to:`/projects/$projectId/new`,params:{projectId:e}})}}),(0,j.jsx)(x,{className:`hidden`})]})})}export{P as n,F as t};
@@ -1 +1 @@
1
- import{Ot as e,Tt as t,wt as n}from"./api-B620HpC2.js";function r(e){return e.enabled?e.visibility===`name-only`?`name-only`:e.visibility===`user-invocable-only`?`user-only`:null:`off`}function i(e){let t=e.enabled?e.visibility===`name-only`?`On, name only: the agent sees its name without the description`:e.visibility===`user-invocable-only`?`On for you only: the agent doesn't see it, but you can type /name`:`On`:`Off: the agent doesn't see it and / doesn't offer it`;return e.setIn?`${t}. Set in ${e.setIn}`:t}var a={user:`Written to your user settings, so it applies in every project.`,project:`Written to the project's shared settings, so it applies to everyone using the repository.`,local:`Written to your local settings for this project, so it applies only to you, here.`},o={command:{label:`Command`,field:`Command`},http:{label:`HTTP`,field:`URL`},prompt:{label:`Prompt`,field:`Prompt`},agent:{label:`Agent`,field:`Prompt`}},s=e=>Object.hasOwn(n,e.type),c={event:`PreToolUse`,matcher:``,type:`command`,value:``,timeout:``};function l(e){let t=s(e.handler)?e.handler.type:`command`;return{event:e.event,matcher:e.matcher??``,type:t,value:e.handler[n[t]]??``,timeout:e.handler.timeout===void 0?``:String(e.handler.timeout)}}var u={command:[`command`,`args`,`async`,`asyncRewake`,`shell`],http:[`url`,`headers`,`allowedEnvVars`],prompt:[`prompt`,`model`],agent:[`prompt`,`model`]};function d(e,t){let r=n[e.type],i=t&&s(t)?t.type:void 0,a=i?u[i].filter(t=>!u[e.type].includes(t)):[],o={type:e.type,[r]:``};for(let[e,n]of Object.entries(t??{}))a.includes(e)||(o[e]=n);o.type=e.type,o[r]=e.value.trim();let c=Number(e.timeout);return e.timeout.trim()&&c>0?o.timeout=c:delete o.timeout,o}function f(e){let n=e.timeout.trim();return t.safeParse(e.event).success&&e.value.trim()!==``&&(n===``||Number(n)>0)}function p(e){let t=e.command??e.url??e.prompt;if(t)return t;if(typeof e.server==`string`&&typeof e.tool==`string`)return`${e.server} · ${e.tool}`;let{type:n,timeout:r,...i}=e;return JSON.stringify(i)}var m=[{id:`memory`,label:`Memory`},{id:`skills`,label:`Skills`},{id:`subagents`,label:`Subagents`},{id:`mcp`,label:`MCP servers`},...e(`hooks`).length>0?[{id:`hooks`,label:`Hooks`}]:[]];export{d as a,s as c,i as d,l as i,a as l,o as n,f as o,c as r,p as s,m as t,r as u};
1
+ import{Ot as e,Tt as t,wt as n}from"./api-yvn34iKU.js";function r(e){return e.enabled?e.visibility===`name-only`?`name-only`:e.visibility===`user-invocable-only`?`user-only`:null:`off`}function i(e){let t=e.enabled?e.visibility===`name-only`?`On, name only: the agent sees its name without the description`:e.visibility===`user-invocable-only`?`On for you only: the agent doesn't see it, but you can type /name`:`On`:`Off: the agent doesn't see it and / doesn't offer it`;return e.setIn?`${t}. Set in ${e.setIn}`:t}var a={user:`Written to your user settings, so it applies in every project.`,project:`Written to the project's shared settings, so it applies to everyone using the repository.`,local:`Written to your local settings for this project, so it applies only to you, here.`},o={command:{label:`Command`,field:`Command`},http:{label:`HTTP`,field:`URL`},prompt:{label:`Prompt`,field:`Prompt`},agent:{label:`Agent`,field:`Prompt`}},s=e=>Object.hasOwn(n,e.type),c={event:`PreToolUse`,matcher:``,type:`command`,value:``,timeout:``};function l(e){let t=s(e.handler)?e.handler.type:`command`;return{event:e.event,matcher:e.matcher??``,type:t,value:e.handler[n[t]]??``,timeout:e.handler.timeout===void 0?``:String(e.handler.timeout)}}var u={command:[`command`,`args`,`async`,`asyncRewake`,`shell`],http:[`url`,`headers`,`allowedEnvVars`],prompt:[`prompt`,`model`],agent:[`prompt`,`model`]};function d(e,t){let r=n[e.type],i=t&&s(t)?t.type:void 0,a=i?u[i].filter(t=>!u[e.type].includes(t)):[],o={type:e.type,[r]:``};for(let[e,n]of Object.entries(t??{}))a.includes(e)||(o[e]=n);o.type=e.type,o[r]=e.value.trim();let c=Number(e.timeout);return e.timeout.trim()&&c>0?o.timeout=c:delete o.timeout,o}function f(e){let n=e.timeout.trim();return t.safeParse(e.event).success&&e.value.trim()!==``&&(n===``||Number(n)>0)}function p(e){let t=e.command??e.url??e.prompt;if(t)return t;if(typeof e.server==`string`&&typeof e.tool==`string`)return`${e.server} · ${e.tool}`;let{type:n,timeout:r,...i}=e;return JSON.stringify(i)}var m=[{id:`memory`,label:`Memory`},{id:`skills`,label:`Skills`},{id:`subagents`,label:`Subagents`},{id:`mcp`,label:`MCP servers`},...e(`hooks`).length>0?[{id:`hooks`,label:`Hooks`}]:[]];export{d as a,s as c,i as d,l as i,a as l,o as n,f as o,c as r,p as s,m as t,r as u};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{d as t,t as n}from"./switch-DuBpF2_h.js";import{$ as r,A as i,An as a,F as o,Lt as s,On as c,Q as l,W as u,et as d,h as f,jr as p,m,n as h,nt as g,o as _,ot as v,q as y,sr as b,tr as x,tt as S,xn as C}from"./icons-COCLuOtb.js";import{D as w,j as T,m as E,t as D,yt as O}from"./format-D1ma_o2D.js";import{F as k,t as A}from"./useQuery-VSotSwry.js";import{n as j,t as M}from"./jsx-runtime-C3cWAN_r.js";import{a as N,t as P}from"./bits-B2GRjm37.js";import{C as ee,S as te,_ as ne,b as F,k as re,v as ie,w as ae,x as oe,y as se}from"./mobile-nav-D8FZcJzG.js";import{t as ce}from"./skeleton-D8Sbd2jT.js";import{Dt as le,Et as ue,i as I,v as de}from"./api-B620HpC2.js";import{t as L}from"./dist-wxbqfqV1.js";import{t as fe}from"./number-field-Bzzs0k9i.js";import{t as R}from"./settings-ui-Ux8rPFol.js";import{a as pe,c as z,i as B,n as V,r as H,t as U}from"./dialog-Dyw3b_Tu.js";import{t as W}from"./input-CPpbtC2H.js";import{t as G}from"./label-DcWfyglU.js";import{a as me,i as he,n as ge,r as _e,t as ve}from"./select-B4LGxZQI.js";import{t as K}from"./textarea-gD4G5Znx.js";import{a as ye,c as be,d as xe,i as Se,l as Ce,n as we,o as Te,r as Ee,s as De,t as Oe,u as ke}from"./agent-tabs-BNgrQWDq.js";import{t as Ae}from"./on-demand-Cvu5D9uT.js";import{t as je}from"./page-header-BqPf-jRo.js";var q=e(j(),1),J=M();function Me({patch:e}){let t=e.replace(/\n$/,``).split(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{d as t,t as n}from"./switch-BHplnCdo.js";import{$ as r,A as i,An as a,F as o,Lt as s,On as c,Q as l,W as u,et as d,h as f,jr as p,m,n as h,nt as g,o as _,ot as v,q as y,sr as b,tr as x,tt as S,xn as C}from"./icons-COCLuOtb.js";import{D as w,j as T,m as E,t as D,yt as O}from"./format-D3kairnQ.js";import{F as k,t as A}from"./useQuery-VSotSwry.js";import{n as j,t as M}from"./jsx-runtime-C3cWAN_r.js";import{a as N,t as P}from"./bits-B2GRjm37.js";import{C as ee,S as te,_ as ne,b as F,k as re,v as ie,w as ae,x as oe,y as se}from"./mobile-nav-CrjrDJZ5.js";import{t as ce}from"./skeleton-D8Sbd2jT.js";import{Dt as le,Et as ue,i as I,v as de}from"./api-yvn34iKU.js";import{t as L}from"./dist-wxbqfqV1.js";import{t as fe}from"./number-field-Bzzs0k9i.js";import{t as R}from"./settings-ui-Bc6ymtc_.js";import{a as pe,c as z,i as B,n as V,r as H,t as U}from"./dialog-Cvj_lHPY.js";import{t as W}from"./input-CPpbtC2H.js";import{t as G}from"./label-Bm_8Eqe2.js";import{a as me,i as he,n as ge,r as _e,t as ve}from"./select-B1ES0hhy.js";import{t as K}from"./textarea-gD4G5Znx.js";import{a as ye,c as be,d as xe,i as Se,l as Ce,n as we,o as Te,r as Ee,s as De,t as Oe,u as ke}from"./agent-tabs-B6uUKAXD.js";import{t as Ae}from"./on-demand-Cvi90jRi.js";import{t as je}from"./page-header-t9HzSrxd.js";var q=e(j(),1),J=M();function Me({patch:e}){let t=e.replace(/\n$/,``).split(`
2
2
  `);return(0,J.jsx)(`pre`,{className:`min-w-max py-1 font-mono text-[11.5px] leading-5`,"data-testid":`patch-view`,children:t.map((e,t)=>(0,J.jsx)(`div`,{className:L(`px-3`,e.startsWith(`+++`)||e.startsWith(`---`)?`text-muted-foreground`:e.startsWith(`@@`)?`bg-primary/8 text-primary`:e.startsWith(`+`)?`bg-status-done/12 text-status-done`:e.startsWith(`-`)?`bg-status-failed/12 text-status-failed`:`text-foreground/80`),children:e||` `},t))})}function Y({open:e,onOpenChange:t,title:n,diff:r,error:i,onConfirm:a,saving:c,confirmLabel:l=`Save to file`,note:u}){return(0,J.jsx)(U,{open:e,onOpenChange:t,children:(0,J.jsxs)(V,{className:`sm:max-w-3xl`,"data-testid":`patch-dialog`,children:[(0,J.jsxs)(pe,{children:[(0,J.jsx)(z,{children:n}),(0,J.jsxs)(H,{className:`font-mono text-2xs break-all`,children:[r?.absolutePath??`Preparing the diff…`,r&&(0,J.jsxs)(`span`,{className:`ml-2 font-sans`,children:[(0,J.jsxs)(`span`,{className:`text-status-done`,children:[`+`,r.additions]}),` `,(0,J.jsxs)(`span`,{className:`text-status-failed`,children:[`−`,r.deletions]}),!r.exists&&` · new file`]})]})]}),u&&(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),(0,J.jsx)(`div`,{className:`max-h-[55dvh] min-h-24 overflow-auto rounded-lg border border-border bg-background/60 scroll-thin`,children:i?(0,J.jsx)(`p`,{className:`p-4 text-xs text-status-failed`,children:i}):r?r.changed?(0,J.jsx)(Me,{patch:r.patch}):(0,J.jsx)(`p`,{className:`p-4 text-xs text-muted-foreground`,children:`No changes to write.`}):(0,J.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-xs text-muted-foreground`,children:[(0,J.jsx)(s,{className:`size-3.5 animate-spin`}),` Asking the server for the diff…`]})}),(0,J.jsxs)(B,{className:`items-center sm:justify-between`,children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-2xs text-muted-foreground`,children:[(0,J.jsx)(o,{className:`size-3.5 text-status-done`}),r?.exists===!1?`Creates the file in place.`:`The current file is backed up to CodeDen's backups folder first.`]}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(E,{variant:`ghost`,onClick:()=>t(!1),children:`Keep editing`}),(0,J.jsx)(E,{onClick:a,disabled:c||!r?.changed,children:c?`Saving…`:l})]})]})]})})}var Ne={user:`User`,project:`Project (shared)`,local:`Local (private)`},Pe={claude:`Claude Code`,codex:`Codex`};function Fe(e){return{provider:e.provider,scope:e.scope,...e.projectId?{projectId:e.projectId}:{},event:e.event,groupIndex:e.groupIndex??0,handlerIndex:e.handlerIndex??0,expected:e.handler}}function X({id:e,label:t,hint:n,children:r}){return(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(G,{htmlFor:e,className:`text-xs`,children:t}),r,n&&(0,J.jsx)(`p`,{className:`text-3xs text-muted-foreground`,children:n})]})}function Ie({open:e,onOpenChange:t,projectId:n,sources:r,editing:i,onSaved:a}){let o=I(),s=r.filter(e=>!e.error),[c,l]=(0,q.useState)(s[0]),[u,d]=(0,q.useState)(Ee),[f,p]=(0,q.useState)(),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1);(0,q.useEffect)(()=>{e&&(d(i?Se(i):Ee),l(s[0]))},[e,i]);let v=e=>d(t=>({...t,...e})),y=[...new Set(s.map(e=>e.provider))],b=s.filter(e=>e.provider===c?.provider),x=ye(u,i?.handler),S=()=>{let e={event:u.event,matcher:u.matcher===``?void 0:u.matcher,handler:x,...n?{listProjectId:n}:{}};return i?{action:`update`,target:Fe(i),...e}:c?{action:`add`,provider:c.provider,scope:c.scope,...c.projectId?{projectId:c.projectId}:{},...e}:null},C=Te(u)&&(i!==null||c!==void 0),w=[...ue];w.includes(u.event)||w.unshift(u.event);let D=async()=>{let e=S();if(e){p(void 0),h(null),_(!0);try{p(await o.agentConfig.diffHook(e))}catch(e){h(e instanceof Error?e.message:String(e))}}},k=O({mutationFn:async()=>{let e=S();if(!e)throw Error(`Pick a settings file`);return o.agentConfig.changeHook(e)},onSuccess:e=>{T.success(`Saved the ${u.event} hook`,{description:e.backupPath?`Backup: ${e.backupPath}`:e.file??void 0}),_(!1),t(!1),a(e.hooks)},onError:e=>T.error(`Not saved`,{description:e.message})}),A=we[u.type];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{open:e,onOpenChange:t,children:(0,J.jsxs)(V,{className:`sm:max-w-xl`,"data-testid":`hook-dialog`,children:[(0,J.jsxs)(pe,{children:[(0,J.jsx)(z,{children:i?`Edit ${i.event} hook`:`Add hook`}),(0,J.jsx)(H,{className:`break-all`,children:i?i.file:`Written to the hooks key of the settings file, with a diff preview and a backup first.`})]}),(0,J.jsxs)(`div`,{className:`space-y-4`,children:[!i&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[y.length>1&&c&&(0,J.jsx)(R,{value:c.provider,onChange:e=>l(s.find(t=>t.provider===e)),options:y.map(e=>({value:e,label:Pe[e]}))}),c&&(0,J.jsx)(R,{value:c.scope,onChange:e=>l(b.find(t=>t.scope===e)),options:b.map(e=>({value:e.scope,label:Ne[e.scope]}))}),c&&(0,J.jsx)(`p`,{className:`w-full truncate font-mono text-3xs text-muted-foreground`,children:c.file}),b.length===1&&(0,J.jsx)(`p`,{className:`text-3xs text-muted-foreground`,children:`Pick a project at the top for project and local hooks.`})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,J.jsx)(X,{id:`hook-event`,label:`Event`,children:(0,J.jsxs)(ve,{value:u.event,onValueChange:e=>v({event:e}),children:[(0,J.jsx)(he,{id:`hook-event`,className:`w-full font-mono text-xs`,children:(0,J.jsx)(me,{})}),(0,J.jsx)(ge,{children:w.map(e=>(0,J.jsx)(_e,{value:e,className:`font-mono text-xs`,children:e},e))})]})}),(0,J.jsx)(X,{id:`hook-matcher`,label:`Matcher (optional)`,hint:`Tool name or regex. Empty matches everything; some events ignore it.`,children:(0,J.jsx)(W,{id:`hook-matcher`,value:u.matcher,onChange:e=>v({matcher:e.target.value}),placeholder:`Edit|Write`,className:`font-mono text-xs`})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,J.jsx)(R,{value:u.type,onChange:e=>v({type:e}),options:Object.entries(we).map(([e,t])=>({value:e,label:t.label}))}),(0,J.jsx)(`div`,{className:`w-32`,children:(0,J.jsx)(X,{id:`hook-timeout`,label:`Timeout (seconds)`,children:(0,J.jsx)(fe,{id:`hook-timeout`,optional:!0,min:1,value:u.timeout===``?null:Number(u.timeout),onChange:e=>v({timeout:e===null?``:String(e)}),placeholder:`Default`,className:`font-mono text-xs`})})})]}),(0,J.jsx)(X,{id:`hook-value`,label:A.field,children:u.type===`command`||u.type===`http`?(0,J.jsx)(W,{id:`hook-value`,value:u.value,onChange:e=>v({value:e.target.value}),placeholder:u.type===`command`?`./scripts/format.sh`:`http://localhost:8080/hooks`,className:`font-mono text-xs`}):(0,J.jsx)(K,{id:`hook-value`,rows:3,value:u.value,onChange:e=>v({value:e.target.value}),placeholder:`Check that the tests were run before stopping.`,className:`text-xs`})})]}),(0,J.jsxs)(B,{children:[(0,J.jsx)(E,{variant:`ghost`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(E,{disabled:!C,onClick:()=>void D(),children:`Review & save`})]})]})}),(0,J.jsx)(Y,{open:g,onOpenChange:_,title:`Review the ${u.event} hook`,diff:f,error:m,onConfirm:()=>k.mutate(),saving:k.isPending})]})}var Le=`rounded-full border border-border px-1.5 py-px text-3xs text-muted-foreground`,Re=e=>`${e.provider}:${e.scope}:${e.projectId??``}`,ze=e=>e.shelfId??`${Re(e)}:${e.event}:${e.groupIndex}:${e.handlerIndex}`;function Be({projectId:e}){let t=I(),n=k(),r=[`agent-config-hooks`,e],i=A({queryKey:r,queryFn:()=>t.agentConfig.listHooks(e)}),a=e=>n.setQueryData(r,e),o=e?{listProjectId:e}:{},[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(),[p,h]=(0,q.useState)(null),[g,v]=(0,q.useState)(null),y=async e=>{u(e),f(void 0),h(null);try{f(await t.agentConfig.diffHook(e.req))}catch(e){h(e instanceof Error?e.message:String(e))}},b=O({mutationFn:e=>t.agentConfig.changeHook(e.req),onSuccess:(e,t)=>{u(null),v(null),a(e.hooks),T.success(t.done,{description:e.backupPath?`Backup: ${e.backupPath}`:e.file??void 0})},onError:e=>T.error(`Not changed`,{description:e.message})}),x=i.data?.sources??[],C=i.data?.hooks??[],w=e=>`${e.event} hook${e.matcher?` (${e.matcher})`:``}`,D=e=>{e.shelfId?v(e):y({title:`Delete the ${w(e)}`,confirmLabel:`Delete hook`,done:`Deleted the ${w(e)}`,req:{action:`remove`,target:Fe(e),...o}})},j=e=>void y(e.shelfId?{title:`Enable the ${w(e)}`,confirmLabel:`Enable hook`,done:`Enabled the ${w(e)}`,req:{action:`enable`,target:{shelfId:e.shelfId},...o}}:{title:`Disable the ${w(e)}`,confirmLabel:`Disable hook`,done:`Disabled the ${w(e)}`,req:{action:`disable`,target:Fe(e),...o}});return(0,J.jsxs)(`div`,{"data-testid":`hooks-list`,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-end justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:`Hooks`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Commands your agents run on lifecycle events, from each settings file's hooks key, edited in place.`})]}),(0,J.jsxs)(E,{size:`sm`,variant:`outline`,disabled:!x.some(e=>!e.error),onClick:()=>c({editing:null}),children:[(0,J.jsx)(S,{}),` Add hook`]})]}),i.isLoading&&(0,J.jsx)(ce,{className:`h-24 rounded-xl`}),i.error&&(0,J.jsx)(`p`,{className:`p-4 text-xs text-status-failed`,children:i.error.message}),i.data&&C.length===0&&x.every(e=>!e.error)&&(0,J.jsx)(`div`,{className:`rounded-xl border border-border bg-card`,children:(0,J.jsx)(P,{icon:(0,J.jsx)(_,{}),title:`No hooks configured`,children:`Add one to run a command before or after a tool call, when a prompt is sent or when the agent stops.`})}),(0,J.jsx)(`div`,{className:`space-y-4`,children:x.map(e=>{let t=C.filter(t=>Re(t)===Re(e)),n=e.error||e.disableAllHooks;return t.length===0&&!n&&C.length===0?null:(0,J.jsxs)(`section`,{"data-hook-source":e.scope,className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,J.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border bg-muted/30 px-4 py-2`,children:[(0,J.jsx)(N,{provider:e.provider,className:`size-4`}),(0,J.jsx)(`span`,{className:`text-[13px] font-medium`,children:Ne[e.scope]}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-3xs text-muted-foreground`,children:e.file}),(0,J.jsx)(`span`,{className:`hidden text-2xs text-muted-foreground lg:inline`,children:Pe[e.provider]})]}),e.error&&(0,J.jsxs)(`p`,{className:`flex items-center gap-2 px-4 py-2 text-xs text-status-failed`,children:[(0,J.jsx)(m,{className:`size-3.5 shrink-0`}),` `,e.error]}),e.disableAllHooks&&(0,J.jsxs)(`p`,{className:`flex items-center gap-2 border-b border-border px-4 py-2 text-xs text-status-waiting`,children:[(0,J.jsx)(m,{className:`size-3.5 shrink-0`}),` This file sets disableAllHooks: none of its hooks run.`]}),!e.error&&t.length===0&&(0,J.jsxs)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:[`No hooks in this file`,e.exists?``:` (it doesn't exist yet)`,`.`]}),t.map(t=>(0,J.jsx)(Ve,{hook:t,offByFile:e.disableAllHooks,onEdit:()=>c({editing:t}),onToggle:()=>j(t),onRemove:()=>D(t)},ze(t)))]},Re(e))})}),(0,J.jsx)(Ie,{open:s!==null,onOpenChange:e=>!e&&c(null),projectId:e,sources:x,editing:s?.editing??null,onSaved:a}),(0,J.jsx)(Y,{open:l!==null,onOpenChange:e=>!e&&u(null),title:l?.title??``,diff:d,error:p,onConfirm:()=>l&&b.mutate(l),saving:b.isPending,confirmLabel:l?.confirmLabel}),(0,J.jsx)(ne,{open:g!==null,onOpenChange:e=>!e&&v(null),children:(0,J.jsxs)(F,{children:[(0,J.jsxs)(ee,{children:[(0,J.jsx)(ae,{children:`Delete this disabled hook?`}),(0,J.jsxs)(oe,{children:[`It is no longer in `,g?.file??`its settings file`,`, so only CodeDen's copy is removed. This can't be undone.`]})]}),(0,J.jsxs)(te,{children:[(0,J.jsx)(se,{children:`Cancel`}),(0,J.jsx)(ie,{variant:`destructive`,onClick:()=>g?.shelfId&&b.mutate({title:``,confirmLabel:``,done:`Deleted the ${w(g)}`,req:{action:`remove`,target:{shelfId:g.shelfId},...o}}),children:`Delete`})]})]})})]})}function Ve({hook:e,offByFile:t,onEdit:n,onToggle:i,onRemove:a}){let o=!e.enabled||t,s=`${e.event} ${e.matcher??``}`.trim();return(0,J.jsxs)(`div`,{"data-hook":e.event,className:`flex items-center gap-3 border-b border-border px-4 py-3 last:border-0`,children:[(0,J.jsx)(_,{className:`size-4 shrink-0 text-muted-foreground`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13.5px] font-medium`,children:[(0,J.jsx)(`span`,{className:L(o&&`text-muted-foreground`,!e.enabled&&`line-through`),children:e.event}),(0,J.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-px font-mono text-3xs font-normal text-muted-foreground`,children:e.matcher??`all`}),(0,J.jsx)(`span`,{className:Le,children:e.handler.type}),e.handler.timeout!==void 0&&(0,J.jsxs)(`span`,{className:Le,children:[e.handler.timeout,`s`]}),!e.enabled&&(0,J.jsx)(`span`,{className:Le,children:`disabled`})]}),(0,J.jsx)(`div`,{className:`truncate font-mono text-3xs text-muted-foreground`,children:De(e.handler)})]}),(0,J.jsxs)(`div`,{className:`flex gap-1`,children:[e.enabled&&be(e.handler)&&(0,J.jsx)(E,{size:`icon-sm`,variant:`ghost`,"aria-label":`Edit ${s}`,onClick:n,children:(0,J.jsx)(v,{})}),(0,J.jsx)(E,{size:`icon-sm`,variant:`ghost`,"aria-label":`${e.enabled?`Disable`:`Enable`} ${s}`,title:e.enabled?`Disable (keeps a copy in CodeDen)`:`Enable`,onClick:i,children:e.enabled?(0,J.jsx)(r,{}):(0,J.jsx)(l,{})}),(0,J.jsx)(E,{size:`icon-sm`,variant:`ghost`,"aria-label":`Delete ${s}`,onClick:a,children:(0,J.jsx)(f,{})})]})]})}var He={type:`stdio`,command:``,args:``,env:``,cwd:``,url:``,headers:``,bearerTokenEnvVar:``,enabled:!0},Ue=e=>e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);function We(e,t){let n={};for(let r of Ue(e)){let e=r.indexOf(t);e<=0||(n[r.slice(0,e).trim()]=r.slice(e+1).trim())}return Object.keys(n).length?n:void 0}var Ge=(e,t)=>Object.entries(e??{}).map(([e,n])=>`${e}${t}${n}`).join(`
3
3
  `);function Ke(e){return e.type===`stdio`?{...He,type:`stdio`,command:e.command,args:(e.args??[]).join(`
4
4
  `),env:Ge(e.env,`=`),cwd:e.cwd??``,enabled:e.enabled!==!1}:{...He,type:e.type,url:e.url,headers:Ge(e.headers,`: `),bearerTokenEnvVar:e.bearerTokenEnvVar??``,enabled:e.enabled!==!1}}function qe(e,t){let n=t.previous?.extra,r=t.supportsEnabled&&!e.enabled?{enabled:!1}:{};if(e.type===`stdio`){let t=Ue(e.args);return{type:`stdio`,command:e.command.trim(),...t.length?{args:t}:{},...We(e.env,`=`)?{env:We(e.env,`=`)}:{},...e.cwd.trim()?{cwd:e.cwd.trim()}:{},...r,...n?{extra:n}:{}}}return{type:e.type,url:e.url.trim(),...We(e.headers,`:`)?{headers:We(e.headers,`:`)}:{},...e.bearerTokenEnvVar.trim()?{bearerTokenEnvVar:e.bearerTokenEnvVar.trim()}:{},...r,...n?{extra:n}:{}}}function Je(e){return e.type===`stdio`?e.command.trim().length>0:/^https?:\/\//.test(e.url.trim())}function Ye(e){return e.type===`stdio`?[e.command,...e.args??[]].join(` `):e.url}var Xe=12,Ze={start:`Couldn't start or reach the server`,connect:`Handshake failed`,list_tools:`Couldn't list its tools`},Qe=e=>e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`;function $e(){let e=I(),[t,n]=(0,q.useState)(null),r=(0,q.useRef)(0);return{state:t,run:(0,q.useCallback)(async t=>{let i=++r.current;n({status:`running`});try{let a=await e.agentConfig.testMcp(t);i===r.current&&n({status:`done`,result:a})}catch(e){let t=e instanceof Error?e.message:String(e);i===r.current&&n({status:`error`,message:t})}},[e]),reset:(0,q.useCallback)(()=>{r.current++,n(null)},[])}}function et({state:e,onDismiss:t,className:n}){let[r,i]=(0,q.useState)(!1),a,o,c=null;if(e.status===`running`)a=(0,J.jsx)(s,{className:`size-4 animate-spin text-muted-foreground`}),o=(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Connecting and listing tools…`});else if(e.status===`error`)a=(0,J.jsx)(x,{className:`size-4 text-status-failed`}),o=(0,J.jsx)(`span`,{children:`The test didn't run`}),c=(0,J.jsx)(`p`,{className:`text-2xs text-status-failed/90`,children:e.message});else if(e.result.ok){let t=e.result,n=r?t.tools:t.tools.slice(0,Xe),s=t.tools.length-n.length;a=(0,J.jsx)(b,{className:`size-4 text-status-done`}),o=(0,J.jsxs)(`span`,{children:[`Connected ·`,` `,(0,J.jsx)(`span`,{className:`font-medium`,children:t.server.title||t.server.name||`server`}),t.server.version&&(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,t.server.version]}),` · `,t.morePages?`more than ${t.toolCount} tools`:t.toolCount===1?`1 tool`:`${t.toolCount} tools`,(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,Qe(t.durationMs)]})]}),c=t.toolCount===0&&!t.morePages?(0,J.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:`The server offers no tools.`}):(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[t.morePages&&(0,J.jsxs)(`p`,{className:`w-full text-2xs text-muted-foreground`,children:[`The test read the first `,100,` pages of tools; the server has more.`]}),n.map(e=>(0,J.jsx)(`span`,{title:e.description,className:`rounded bg-muted px-1.5 py-px font-mono text-3xs text-muted-foreground`,children:e.name},e.name)),s>0&&(0,J.jsxs)(`button`,{type:`button`,className:`px-1 text-3xs text-primary hover:underline`,onClick:()=>i(!0),children:[`+`,s,` more`]}),r&&t.toolCount>t.tools.length&&(0,J.jsxs)(`span`,{className:`px-1 text-3xs text-muted-foreground`,children:[`and `,t.toolCount-t.tools.length,t.morePages?`+`:``,` not listed`]})]})}else{let t=e.result;a=(0,J.jsx)(x,{className:`size-4 text-status-failed`}),o=(0,J.jsxs)(`span`,{children:[t.timedOut?`Timed out`:Ze[t.stage],(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,Qe(t.durationMs)]})]}),c=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`break-words text-2xs text-status-failed/90`,children:t.error}),t.stderrTail&&(0,J.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted px-2 py-1.5 font-mono text-3xs text-muted-foreground`,children:t.stderrTail}),t.note&&(0,J.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:t.note})]})}return(0,J.jsxs)(`div`,{"data-testid":`mcp-test-result`,className:L(`space-y-1.5 rounded-lg border border-border bg-background/50 px-3 py-2`,n),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[a,(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:o}),t&&e.status!==`running`&&(0,J.jsx)(E,{size:`icon-xs`,variant:`ghost`,"aria-label":`Dismiss test result`,onClick:t,children:(0,J.jsx)(h,{})})]}),c&&(0,J.jsx)(`div`,{className:`space-y-1.5 pl-6`,children:c})]})}var tt={claude:[{value:`user`,label:`User`},{value:`local`,label:`Local (this project, private)`},{value:`project`,label:`Project (.mcp.json)`}],codex:[{value:`user`,label:`User (config.toml)`}]};function Z({id:e,label:t,children:n}){return(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(G,{htmlFor:e,className:`text-xs`,children:t}),n]})}function nt({open:e,onOpenChange:t,projectId:r,editing:i,onSaved:a}){let o=I(),[c,l]=(0,q.useState)(`claude`),[u,d]=(0,q.useState)(`user`),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(He),[_,v]=(0,q.useState)(),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(!1);(0,q.useEffect)(()=>{e&&(i&&i.provider!==`codeden`?(l(i.provider),d(i.scope),p(i.name),h(Ke(i.spec))):(l(`claude`),d(`user`),p(``),h(He)))},[e,i]);let C=e=>h(t=>({...t,...e})),w={provider:c,scope:u,name:f,...u!==`user`&&r?{projectId:r}:{}},D=qe(m,{supportsEnabled:c===`codex`,previous:i?.provider===c?i.spec:void 0}),k=u!==`user`&&!r,A=/^[A-Za-z0-9_.-]+$/.test(f),j=A&&Je(m)&&!k,M=Je(m)&&!k,N=$e(),P=N.reset;(0,q.useEffect)(()=>P(),[e,c,u,m,P]);let ee=()=>void N.run({...w,name:A?f:`unsaved`,spec:D}),te=async()=>{v(void 0),b(null),S(!0);try{v(await o.agentConfig.diffMcp({...w,spec:D}))}catch(e){b(e instanceof Error?e.message:String(e))}},ne=O({mutationFn:()=>o.agentConfig.upsertMcp({...w,spec:D}),onSuccess:e=>{T.success(`Saved ${f}`,{description:e.backupPath?`Backup: ${e.backupPath}`:e.file}),S(!1),t(!1),a()},onError:e=>T.error(`Not saved`,{description:e.message})}),F=i!==null;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{open:e,onOpenChange:t,children:(0,J.jsxs)(V,{className:`sm:max-w-xl`,"data-testid":`mcp-server-dialog`,children:[(0,J.jsxs)(pe,{children:[(0,J.jsx)(z,{children:F?`Edit ${i.name}`:`Add MCP server`}),(0,J.jsx)(H,{children:`Written to the provider's own config, with a diff preview and a backup first. Test the connection before you save.`})]}),(0,J.jsxs)(`div`,{className:`space-y-4`,children:[!F&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(R,{value:c,onChange:e=>{l(e),d(`user`),e===`codex`&&m.type===`sse`&&C({type:`http`})},options:[{value:`claude`,label:`Claude Code`},{value:`codex`,label:`Codex`}]}),(0,J.jsx)(R,{value:u,onChange:d,options:tt[c]})]}),k&&(0,J.jsx)(`p`,{className:`text-2xs text-status-waiting`,children:`Pick a project above to use this scope.`}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-end gap-3`,children:[(0,J.jsx)(Z,{id:`mcp-name`,label:`Name`,children:(0,J.jsx)(W,{id:`mcp-name`,value:f,disabled:F,onChange:e=>p(e.target.value.trim()),placeholder:`playwright`,className:`font-mono`})}),(0,J.jsx)(R,{value:m.type,onChange:e=>C({type:e}),options:[{value:`stdio`,label:`Command`},{value:`http`,label:`HTTP`},...c===`claude`?[{value:`sse`,label:`SSE`}]:[]]})]}),m.type===`stdio`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{id:`mcp-command`,label:`Command`,children:(0,J.jsx)(W,{id:`mcp-command`,value:m.command,onChange:e=>C({command:e.target.value}),placeholder:`npx`,className:`font-mono text-xs`})}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,J.jsx)(Z,{id:`mcp-args`,label:`Arguments (one per line)`,children:(0,J.jsx)(K,{id:`mcp-args`,rows:3,value:m.args,onChange:e=>C({args:e.target.value}),placeholder:`@playwright/mcp@latest`,className:`font-mono text-xs`})}),(0,J.jsx)(Z,{id:`mcp-env`,label:`Environment (KEY=value)`,children:(0,J.jsx)(K,{id:`mcp-env`,rows:3,value:m.env,onChange:e=>C({env:e.target.value}),placeholder:`DEBUG=1`,className:`font-mono text-xs`})})]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{id:`mcp-url`,label:`URL`,children:(0,J.jsx)(W,{id:`mcp-url`,value:m.url,onChange:e=>C({url:e.target.value}),placeholder:`https://example.com/mcp`,className:`font-mono text-xs`})}),(0,J.jsx)(Z,{id:`mcp-headers`,label:`Headers (Name: value)`,children:(0,J.jsx)(K,{id:`mcp-headers`,rows:2,value:m.headers,onChange:e=>C({headers:e.target.value}),placeholder:"Authorization: Bearer ${TOKEN}",className:`font-mono text-xs`})}),c===`codex`&&(0,J.jsx)(Z,{id:`mcp-bearer`,label:`Bearer token environment variable`,children:(0,J.jsx)(W,{id:`mcp-bearer`,value:m.bearerTokenEnvVar,onChange:e=>C({bearerTokenEnvVar:e.target.value}),placeholder:`MY_SERVICE_TOKEN`,className:`font-mono text-xs`})})]}),c===`codex`&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(n,{id:`mcp-enabled`,checked:m.enabled,onCheckedChange:e=>C({enabled:e})}),(0,J.jsx)(G,{htmlFor:`mcp-enabled`,className:`text-xs`,children:`Enabled`})]}),N.state&&(0,J.jsx)(et,{state:N.state,onDismiss:N.reset})]}),(0,J.jsxs)(B,{children:[(0,J.jsxs)(E,{variant:`outline`,className:`sm:mr-auto`,disabled:!M||N.state?.status===`running`,title:`Start or reach the server with these values and list its tools`,onClick:ee,children:[N.state?.status===`running`?(0,J.jsx)(s,{className:`animate-spin`}):(0,J.jsx)(g,{}),`Test`]}),(0,J.jsx)(E,{variant:`ghost`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(E,{disabled:!j,onClick:()=>void te(),children:`Review & save`})]})]})}),(0,J.jsx)(Y,{open:x,onOpenChange:S,title:`Review ${f||`server`}`,diff:_,error:y,onConfirm:()=>ne.mutate(),saving:ne.isPending})]})}var rt=`rounded-full border border-border px-1.5 py-px text-3xs capitalize text-muted-foreground`,it={claude:`Claude Code`,codex:`Codex`,codeden:`CodeDen`},at=e=>`${e.provider}:${e.scope}:${e.projectId??``}:${e.name}`;function ot({projectId:e}){let t=I(),n=A({queryKey:[`agent-config-mcp`,e],queryFn:()=>t.agentConfig.listMcp(e)}),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(),[l,u]=(0,q.useState)(null),f=e=>({provider:e.provider===`codex`?`codex`:`claude`,scope:e.scope,name:e.name,...e.projectId?{projectId:e.projectId}:{}}),p=async e=>{o(e),c(void 0),u(null);try{c(await t.agentConfig.diffMcp(f(e)))}catch(e){u(e instanceof Error?e.message:String(e))}},m=O({mutationFn:e=>t.agentConfig.removeMcp(f(e)),onSuccess:(e,t)=>{o(null),n.refetch(),T.success(`Removed ${t.name}`,{description:e.backupPath?`Backup: ${e.backupPath}`:e.file})},onError:e=>T.error(`Not removed`,{description:e.message})}),h=n.data?.servers??[];return(0,J.jsxs)(`div`,{"data-testid":`mcp-servers`,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-end justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:`MCP servers`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`.mcp.json, Claude's user config and ~/.codex/config.toml, edited in place.`})]}),(0,J.jsxs)(E,{size:`sm`,variant:`outline`,onClick:()=>i({editing:null}),children:[(0,J.jsx)(S,{}),` Add server`]})]}),(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[n.isLoading&&(0,J.jsx)(ce,{className:`m-3 h-10`}),n.error&&(0,J.jsx)(`p`,{className:`p-4 text-xs text-status-failed`,children:n.error.message}),n.data&&h.length===0&&(0,J.jsx)(P,{icon:(0,J.jsx)(d,{}),title:`No MCP servers configured`,children:`Add one to give your agents extra tools.`}),h.map(e=>(0,J.jsx)(st,{server:e,testTarget:f(e),onEdit:()=>i({editing:e}),onRemove:()=>void p(e)},`${at(e)}:${JSON.stringify(e.spec)}`))]}),(0,J.jsx)(nt,{open:r!==null,onOpenChange:e=>!e&&i(null),projectId:e,editing:r?.editing??null,onSaved:()=>void n.refetch()}),(0,J.jsx)(Y,{open:a!==null,onOpenChange:e=>!e&&o(null),title:`Remove ${a?.name??`server`}`,diff:s,error:l,onConfirm:()=>a&&m.mutate(a),saving:m.isPending,confirmLabel:`Remove server`})]})}function st({server:e,testTarget:t,onEdit:n,onRemove:r}){let i=$e(),a=i.state?.status===`running`;return(0,J.jsxs)(`div`,{"data-mcp":e.name,className:`border-b border-border px-4 py-3 last:border-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(d,{className:`size-4 shrink-0 text-muted-foreground`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-[13.5px] font-medium`,children:[(0,J.jsx)(`span`,{className:L(e.spec.enabled===!1&&`text-muted-foreground line-through`),children:e.name}),(0,J.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-px font-mono text-3xs font-normal text-muted-foreground`,children:e.spec.type}),(0,J.jsx)(`span`,{className:rt,children:e.scope}),e.provider===`codeden`&&(0,J.jsx)(`span`,{className:rt,children:`built in`}),e.spec.enabled===!1&&(0,J.jsx)(`span`,{className:rt,children:`disabled`})]}),(0,J.jsx)(`div`,{className:`truncate font-mono text-3xs text-muted-foreground`,children:Ye(e.spec)}),(0,J.jsxs)(`div`,{className:`truncate text-3xs text-muted-foreground/70`,children:[`from `,e.file]})]}),(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-2xs text-muted-foreground`,children:[(0,J.jsx)(N,{provider:e.provider,className:`size-5`}),(0,J.jsx)(`span`,{className:`hidden lg:inline`,children:it[e.provider]})]}),e.provider!==`codeden`&&(0,J.jsxs)(`div`,{className:`flex gap-1`,children:[(0,J.jsx)(E,{size:`icon-sm`,variant:`ghost`,"aria-label":`Test ${e.name}`,title:`Test the connection`,disabled:a,onClick:()=>void i.run(t),children:a?(0,J.jsx)(s,{className:`animate-spin`}):(0,J.jsx)(g,{})}),(0,J.jsx)(E,{size:`icon-sm`,variant:`ghost`,"aria-label":`Edit ${e.name}`,onClick:n,children:(0,J.jsx)(v,{})}),(0,J.jsx)(E,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove ${e.name}`,onClick:r,children:(0,J.jsx)(f,{})})]})]}),i.state&&(0,J.jsx)(et,{state:i.state,onDismiss:i.reset,className:`mt-2 ml-7`})]})}var ct=e=>({root:e.root,projectId:e.projectId,path:e.path}),Q=e=>e instanceof Error?e.message:String(e);function lt({file:e,placeholder:t,onChanged:n,hidden:r,onBack:i}){let a=I(),o=k(),s=ct(e),c=[`agent-config-file`,s.root,s.projectId??``,s.path],l=A({queryKey:c,queryFn:()=>a.agentConfig.read(s)}),[d,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(!1);(0,q.useEffect)(()=>m(l.data?.content??``),[l.data]);let w=l.data!==void 0&&d!==l.data.content,j=async()=>{v(void 0),x(null),g(!0);try{v(await a.agentConfig.diff({...s,content:d}))}catch(e){x(Q(e))}},M=O({mutationFn:()=>a.agentConfig.write({...s,content:d,expectedSha256:l.data?.sha256??null}),onSuccess:t=>{o.setQueryData(c,t.file),g(!1),n(),T.success(`Saved ${e.name}`,{description:t.backupPath?`Backup: ${t.backupPath}`:`New file created`})},onError:e=>{e instanceof de&&e.code===`file_changed`?(g(!1),T.error(`The file changed on disk`,{description:`Reload it to see the latest version; your draft is kept until you do.`,action:{label:`Reload`,onClick:()=>void l.refetch()}})):T.error(`Not saved`,{description:Q(e)})}}),N=O({mutationFn:()=>a.agentConfig.remove(s,{folder:e.kind===`skill`}),onSuccess:t=>{l.refetch(),n(),T.success(`Deleted ${e.name}`,{description:t.backupPath?`Backup: ${t.backupPath}`:void 0})},onError:e=>T.error(`Not deleted`,{description:Q(e)})}),P=l.data?.exists??e.exists;return(0,J.jsxs)(`div`,{hidden:r,className:`flex min-w-0 flex-1 flex-col`,"data-testid":`config-file-editor`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-border px-4 max-md:h-auto max-md:flex-wrap max-md:gap-y-1 max-md:px-2 max-md:py-1`,children:[i&&(0,J.jsx)(E,{size:`icon-sm`,variant:`ghost`,onClick:i,"aria-label":`Back to files`,title:`Back to files`,children:(0,J.jsx)(p,{})}),(0,J.jsx)(`code`,{className:`truncate font-mono text-xs max-md:min-w-0 max-md:flex-1 max-md:break-all max-md:whitespace-normal`,title:e.absolutePath,children:e.absolutePath}),!P&&(0,J.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 text-3xs text-muted-foreground`,children:`new file`}),w&&(0,J.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-status-waiting`,title:`Unsaved changes`}),(0,J.jsx)(`span`,{"aria-hidden":!0,className:`hidden max-md:block max-md:basis-full`}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 text-3xs text-muted-foreground`,children:e.modifiedAt?`edited ${D(e.modifiedAt)} ago`:``}),(0,J.jsxs)(E,{size:`xs`,variant:`ghost`,disabled:!w,onClick:()=>m(l.data?.content??``),children:[(0,J.jsx)(y,{}),` Revert`]}),P&&(0,J.jsx)(E,{size:`xs`,variant:`ghost`,className:`pointer-coarse:min-w-10`,onClick:()=>C(!0),"aria-label":`Delete ${e.name}`,children:(0,J.jsx)(f,{})}),(0,J.jsxs)(E,{size:`xs`,disabled:!w,onClick:()=>void j(),children:[(0,J.jsx)(u,{}),` Review & save`]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1`,children:l.data?(0,J.jsx)(Ae,{docKey:`${e.absolutePath}-${l.dataUpdatedAt}`,path:e.path,value:d,onChange:m,onSave:()=>w&&void j(),placeholder:t??`Write instructions every session should follow…`}):l.error?(0,J.jsx)(`p`,{className:`p-5 text-xs text-status-failed`,children:Q(l.error)}):(0,J.jsx)(`div`,{className:`space-y-2 p-5`,children:[0,1,2].map(e=>(0,J.jsx)(ce,{className:`h-4`,style:{width:`${70-e*15}%`}},e))})}),(0,J.jsx)(Y,{open:h,onOpenChange:g,title:`Review changes to ${e.name}`,diff:_,error:b,onConfirm:()=>M.mutate(),saving:M.isPending}),(0,J.jsx)(ne,{open:S,onOpenChange:C,children:(0,J.jsxs)(F,{children:[(0,J.jsxs)(ee,{children:[(0,J.jsxs)(ae,{children:[`Delete `,e.name,`?`]}),(0,J.jsxs)(oe,{children:[e.kind===`skill`?`The whole skill folder is removed`:`The file is removed`,` `,`from `,(0,J.jsx)(`code`,{className:`font-mono text-2xs`,children:e.absolutePath}),`. A backup copy is kept in CodeDen's backups folder.`]})]}),(0,J.jsxs)(te,{children:[(0,J.jsx)(se,{children:`Cancel`}),(0,J.jsx)(ie,{variant:`destructive`,onClick:()=>N.mutate(),children:`Delete`})]})]})})]})}function ut(e,t,n,r,i){let a=n===`user`?`home`:`project`,o=a===`project`?{projectId:i??void 0}:{};if(e===`skill`){let e=t===`claude`?`.claude/skills`:n===`user`?`.codex/skills`:`.agents/skills`;return{root:a,...o,path:`${e}/${r}/SKILL.md`}}let s=t===`claude`?`.claude/agents`:`.codex/agents`,c=t===`claude`?`md`:`toml`;return{root:a,...o,path:`${s}/${r}.${c}`}}function dt(e,t,n,r){let i=r.trim()||`What ${n} does and when to use it`;return e===`skill`?`---\nname: ${n}\ndescription: ${i}\n---\n\n# ${n}\n\nSteps the agent should follow when this skill applies.\n`:t===`claude`?`---\nname: ${n}\ndescription: ${i}\ntools: Read, Grep, Glob\n---\n\nYou are ${n}. Describe how this subagent works and what it returns.\n`:`name = "${n}"\ndescription = "${i.replaceAll(`"`,`\\"`)}"\ndeveloper_instructions = """\nDescribe how this agent works and what it returns.\n"""\n`}var ft=/^[a-z0-9][a-z0-9_-]{0,63}$/i;function pt({kind:e,projectId:t,open:n,onOpenChange:r,onCreated:i}){let a=I(),[o,s]=(0,q.useState)(`claude`),[c,l]=(0,q.useState)(t?`project`:`user`),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),m=ft.test(u)&&(c===`user`||t!==null),h=ut(e,o,c,u||`<name>`,t),g=e===`skill`?`skill`:`subagent`,_=O({mutationFn:()=>a.agentConfig.write({...ut(e,o,c,u,t),content:dt(e,o,u,f)},{create:!0}),onSuccess:e=>{T.success(`Created ${u}`,{description:e.file.absolutePath}),i(e.file),r(!1),d(``),p(``)},onError:e=>T.error(`Couldn't create the ${g}`,{description:e.message})});return(0,J.jsx)(U,{open:n,onOpenChange:r,children:(0,J.jsxs)(V,{className:`sm:max-w-lg`,children:[(0,J.jsxs)(pe,{children:[(0,J.jsxs)(z,{children:[`New `,g]}),(0,J.jsx)(H,{children:`Written to the provider's own folder, so the CLI picks it up too.`})]}),(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(R,{value:o,onChange:s,options:[{value:`claude`,label:`Claude Code`},{value:`codex`,label:`Codex`}]}),(0,J.jsx)(R,{value:c,onChange:l,options:[{value:`user`,label:`Everywhere (user)`},...t?[{value:`project`,label:`This project`}]:[]]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(G,{htmlFor:`new-config-name`,children:`Name`}),(0,J.jsx)(W,{id:`new-config-name`,value:u,onChange:e=>d(e.target.value.trim()),placeholder:e===`skill`?`release-notes`:`code-reviewer`,className:`font-mono`})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(G,{htmlFor:`new-config-desc`,children:`Description`}),(0,J.jsx)(W,{id:`new-config-desc`,value:f,onChange:e=>p(e.target.value),placeholder:`When the agent should use it`})]}),(0,J.jsxs)(`p`,{className:`font-mono text-3xs break-all text-muted-foreground`,children:[h.root===`home`?`~/`:`<project>/`,h.path]})]}),(0,J.jsxs)(B,{children:[(0,J.jsx)(E,{variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,J.jsx)(E,{disabled:!m||_.isPending,onClick:()=>_.mutate(),children:_.isPending?`Creating…`:`Create ${g}`})]})]})})}var mt=[{id:`claude`,label:`Claude Code`},{id:`codex`,label:`Codex`}],ht={user:0,project:1,local:2},gt={user:`text-chart-2`,project:`text-primary`,local:`text-chart-4`},_t={user:`user`,project:`project`,local:`local`},$=e=>`${e.root}:${e.projectId??``}:${e.path}`;function vt(e){let t=I();return A({queryKey:[`agent-config-files`,e],queryFn:()=>t.agentConfig.list({projectId:e??void 0})})}function yt({projectId:e,kinds:t,create:n,placeholder:r,emptyText:i,rowAddon:a,onFilesChanged:o}){let s=vt(e),l=()=>{s.refetch(),o?.()},[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(!1),{phone:m}=re(),[h,g]=(0,q.useState)(!1),_=e=>{d(e),g(!0)},v=(s.data?.files??[]).filter(e=>t.includes(e.kind)).sort((e,t)=>ht[e.scope]-ht[t.scope]||e.path.localeCompare(t.path)),y=v.find(e=>$(e)===u)??v.find(e=>e.exists)??v[0]??null,b=!m||!h||!y,x=!m||!b;return(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden rounded-xl border border-border bg-card`,children:[(0,J.jsxs)(`aside`,{hidden:!b,className:L(`flex flex-col`,m?`min-w-0 flex-1`:`w-72 shrink-0 border-r border-border`),children:[n&&(0,J.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,J.jsxs)(E,{size:`sm`,variant:`outline`,className:`w-full`,onClick:()=>p(!0),children:[(0,J.jsx)(S,{}),` New `,n===`skill`?`skill`:`subagent`]})}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 scroll-thin`,children:[s.isLoading&&(0,J.jsx)(`div`,{className:`space-y-2 p-2`,children:[0,1,2,3].map(e=>(0,J.jsx)(ce,{className:`h-8`},e))}),s.error&&(0,J.jsx)(`p`,{className:`p-2 text-xs text-status-failed`,children:s.error.message}),mt.map(e=>{let t=v.filter(t=>t.provider===e.id);return t.length===0?null:(0,J.jsxs)(`div`,{className:`mb-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 text-2xs font-medium text-muted-foreground`,children:[(0,J.jsx)(N,{provider:e.id}),` `,e.label]}),t.map(e=>(0,J.jsx)(bt,{file:e,active:y?$(y)===$(e):!1,onSelect:()=>_($(e)),addon:a?.(e)},$(e)))]},e.id)}),s.data&&v.length===0&&(0,J.jsx)(`p`,{className:`p-3 text-xs text-muted-foreground`,children:i}),s.data?.autoMemoryDir&&t.includes(`auto_memory`)&&(0,J.jsxs)(`p`,{className:`mt-2 flex items-start gap-1.5 px-2 text-3xs break-all text-muted-foreground/80`,children:[(0,J.jsx)(C,{className:`mt-px size-3 shrink-0`}),` Auto memory:`,` `,s.data.autoMemoryDir]})]})]}),y?(0,J.jsx)(lt,{file:y,placeholder:r,onChanged:l,hidden:!x,onBack:m?()=>g(!1):void 0},$(y)):(0,J.jsx)(`div`,{hidden:!x,className:`flex flex-1 items-center justify-center`,children:(0,J.jsx)(P,{icon:(0,J.jsx)(c,{}),title:`Nothing selected`,children:i})}),n&&(0,J.jsx)(pt,{kind:n,projectId:e,open:f,onOpenChange:p,onCreated:e=>{_($(e)),l()}})]})}function bt({file:e,active:t,onSelect:n,addon:r}){let i=e.kind===`skill`||e.kind===`subagent`?e.name:e.path;return(0,J.jsxs)(`div`,{className:L(`flex items-start rounded-md hover:bg-accent/60`,t&&`bg-accent`),"data-muted":r?.muted?`true`:void 0,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:n,"data-config-path":e.path,className:L(`flex min-w-0 flex-1 items-start gap-2 rounded-md px-2 py-1.5 text-left`,r?.muted&&`opacity-55`),children:[e.exists?(0,J.jsx)(c,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):(0,J.jsx)(a,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground/60`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:L(`block truncate text-[13px]`,!e.exists&&`text-muted-foreground`),children:i}),(0,J.jsx)(`span`,{className:`block truncate text-3xs text-muted-foreground`,children:e.description??(e.root===`home`?`~/${e.path}`:e.path)})]}),(0,J.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 flex-col items-end gap-0.5 text-3xs`,children:[(0,J.jsx)(`span`,{className:gt[e.scope],children:_t[e.scope]}),e.onDemand&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`on demand`}),e.kind===`auto_memory`&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`auto`}),r?.chip]})]}),r?.end&&(0,J.jsx)(`span`,{className:`flex shrink-0 items-center py-2 pr-2`,children:r.end})]})}var xt=[[`agent-config-loaded`],[`commands`]];function St(e){let t=I(),r=k(),i=[`agent-config-skills`,e],a=A({queryKey:i,queryFn:()=>t.agentConfig.listSkills(e)}),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(),[u,d]=(0,q.useState)(null),f=new Map((a.data?.skills??[]).map(e=>[$(e.file),e])),p=async(n,r)=>{let{root:i,projectId:a,path:o}=n.file,c={root:i,...a?{projectId:a}:{},path:o,provider:n.provider,enabled:r,...e?{listProjectId:e}:{}};s({skill:n,req:c}),l(void 0),d(null);try{l(await t.agentConfig.diffSkillSwitch(c))}catch(e){d(e instanceof Error?e.message:String(e))}},m=O({mutationFn:e=>t.agentConfig.switchSkill(e.req),onSuccess:(e,t)=>{s(null),r.setQueryData(i,{skills:e.skills});for(let e of xt)r.invalidateQueries({queryKey:e});T.success(`Switched ${t.req.enabled?`on`:`off`} ${t.skill.name}`,{description:e.backupPath?`Backup: ${e.backupPath}`:e.file??void 0})},onError:e=>T.error(`Not changed`,{description:e.message})}),h=e=>{let t=f.get($(e));if(!t||!le[t.provider].skillSwitches)return;let r=ke(t),i=xe(t);return{muted:!t.enabled,chip:r?(0,J.jsx)(`span`,{className:`text-muted-foreground`,title:i,children:r}):void 0,end:(0,J.jsx)(n,{size:`sm`,className:`pointer-coarse:after:-inset-y-3.5`,checked:t.enabled,onCheckedChange:e=>void p(t,e),"aria-label":`${t.name}: ${t.enabled?`on`:`off`}`,title:i,"data-testid":`skill-switch`})}},g=o?.req.enabled?`on`:`off`;return{addon:h,dialog:(0,J.jsx)(Y,{open:o!==null,onOpenChange:e=>!e&&s(null),title:o?`Switch ${g} the ${o.skill.name} skill`:``,note:c?.changed?Ce[c.scope]:void 0,diff:c,error:u,saving:m.isPending,confirmLabel:`Switch ${g}`,onConfirm:()=>o&&m.mutate(o)}),refetch:()=>a.refetch()}}function Ct({projectId:e}){return(0,J.jsx)(yt,{projectId:e,kinds:[`memory`,`rule`,`auto_memory`],emptyText:`No memory files found.`})}function wt({projectId:e}){let t=St(e);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(yt,{projectId:e,kinds:[`skill`],create:`skill`,placeholder:`Describe when the skill applies and the steps to follow…`,emptyText:`No skills yet. Create one to teach agents a repeatable workflow.`,rowAddon:t.addon,onFilesChanged:()=>void t.refetch()}),t.dialog]})}function Tt({projectId:e}){return(0,J.jsx)(yt,{projectId:e,kinds:[`subagent`],create:`subagent`,placeholder:`Describe the subagent's role, tools and what it returns…`,emptyText:`No subagents yet.`})}var Et=`global`;function Dt(e){e?.scrollIntoView({block:`nearest`,inline:`nearest`})}function Ot({tab:e,projectId:n}){let r=t(),a=w(e=>e.projects,[]),o=n===Et?null:a.find(e=>e.id===n)?.id??a[0]?.id??null,s=t=>void r({to:`/agents`,search:{tab:t.tab??e,project:t.project===void 0?o??Et:t.project??Et},replace:!0});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(je,{icon:(0,J.jsx)(i,{}),title:`Agent configuration`,meta:`Native files are the source of truth — edits show up in the CLI too`,actions:(0,J.jsxs)(ve,{value:o??`global`,onValueChange:e=>s({project:e===`global`?null:e}),children:[(0,J.jsx)(he,{size:`sm`,className:`w-48`,children:(0,J.jsx)(me,{})}),(0,J.jsxs)(ge,{children:[(0,J.jsx)(_e,{value:`global`,children:`Global only`}),a.map(e=>(0,J.jsx)(_e,{value:e.id,children:e.name},e.id))]})]})}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col px-4 pt-4 pb-6 sm:px-6`,children:[(0,J.jsx)(`div`,{className:`mb-4 flex shrink-0 items-center gap-1 border-b border-border scroll-thin max-md:overflow-x-auto`,children:Oe.map(t=>(0,J.jsx)(`button`,{ref:e===t.id?Dt:void 0,type:`button`,onClick:()=>s({tab:t.id}),className:L(`-mb-px shrink-0 border-b-2 px-3 py-2 text-[13px] whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground`,e===t.id?`border-primary text-foreground`:`border-transparent`),children:t.label},t.id))}),e===`memory`&&(0,J.jsx)(Ct,{projectId:o}),e===`skills`&&(0,J.jsx)(wt,{projectId:o}),e===`subagents`&&(0,J.jsx)(Tt,{projectId:o}),e===`mcp`&&(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:(0,J.jsx)(`div`,{className:`mx-auto max-w-4xl`,children:(0,J.jsx)(ot,{projectId:o})})}),e===`hooks`&&(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:(0,J.jsx)(`div`,{className:`mx-auto max-w-4xl`,children:(0,J.jsx)(Be,{projectId:o})})})]})]})}export{Ot as AgentsPage};
@@ -1 +1 @@
1
- import{At as e,C as t,S as n,T as r,b as i,i as a,r as o,w as s,x as c,y as l}from"./api-B620HpC2.js";import{yt as u}from"./format-D1ma_o2D.js";import{F as d,t as f}from"./useQuery-VSotSwry.js";var p=[{key:`claude-opus-5-5`,provider:`claude`,weight:.46},{key:`claude-sonnet-5-5`,provider:`claude`,weight:.28},{key:`gpt-5.3-codex`,provider:`codex`,weight:.2},{key:`claude-haiku-5-5`,provider:`claude`,weight:.06}];function m(e,t){let n=[];for(let r=new Date(`${e}T00:00:00Z`);r.toISOString().slice(0,10)<=t;)n.push(r.toISOString().slice(0,10)),r.setUTCDate(r.getUTCDate()+1);return n}function h(e,t){let n=new Date(`${e}T00:00:00Z`).getUTCDay();return Math.round(((n===0||n===6?3:11)+t*7919%13*.9)*100)/100}function g(e,t){let n=e.map(h);return t.map(e=>{let t=n.map(t=>Math.round(t*e.weight*100)/100);return{key:e.key,label:e.label,costUsd:t.reduce((e,t)=>e+t,0),estimatedCostUsd:e.key.startsWith(`gpt`)?t.reduce((e,t)=>e+t,0):0,tokens:Math.round(t.reduce((e,t)=>e+t,0)*41e4),turns:Math.round(t.reduce((e,t)=>e+t,0)*3),sessions:Math.round(t.reduce((e,t)=>e+t,0)/2),dailyCostUsd:t,dailyTokens:t.map(e=>Math.round(e*41e4))}})}function _(e){return{inputTokens:Math.round(e*9e3),outputTokens:Math.round(e*21e3),cacheReadTokens:Math.round(e*36e4),cacheWriteTokens:Math.round(e*2e4),reasoningTokens:Math.round(e*6e3),costUsd:e,estimatedCostUsd:e*.2,unpricedTurns:0,turns:Math.round(e*3),sessions:Math.round(e/2),cacheHitRate:.88}}function v(e){let t=m(e.from,e.to),n={model:g(t,p.map(e=>({...e,label:e.key}))),provider:g(t,[{key:`claude`,label:`Claude`,weight:.8},{key:`codex`,label:`Codex`,weight:.2}]),project:g(t,[{key:`p-web`,label:`storefront`,weight:.55},{key:`p-api`,label:`payments-api`,weight:.35},{key:``,label:`No project`,weight:.1}]),role:g(t,[{key:`agent`,label:`Agent`,weight:.82},{key:`pm`,label:`Project manager`,weight:.12},{key:`orchestrator`,label:`Orchestrator`,weight:.06}]),source:g(t,[{key:`user`,label:`You`,weight:.7},{key:`automation`,label:`Automations`,weight:.18},{key:`factory`,label:`Factory`,weight:.12}])},r=n.provider.reduce((e,t)=>e+t.costUsd,0);return{query:e,timezone:`UTC`,days:t,totals:_(r),previousTotals:_(r*.86),series:n,topSessions:[[`Fix checkout race on retry`,`storefront`,`claude-opus-5-5`,9.12],[`Stripe webhook idempotency`,`payments-api`,`gpt-5.3-codex`,6.4],[`Nightly security audit`,`payments-api`,`claude-sonnet-5-5`,3.95]].map(([e,t,n,r],i)=>({sessionId:`mock-s${i}`,title:String(e),projectId:null,projectName:String(t),provider:String(n).startsWith(`gpt`)?`codex`:`claude`,model:String(n),role:`agent`,source:i===2?`automation`:`user`,costUsd:Number(r),estimated:String(n).startsWith(`gpt`),tokens:Math.round(Number(r)*4e5),turns:12-i*3,lastAt:new Date().toISOString(),pr:null})),automations:{manualCostUsd:r*.7,automationCostUsd:r*.18,factoryCostUsd:r*.12,byAutomation:[{automationId:`a1`,name:`Security audit`,costUsd:r*.11,sessions:6},{automationId:`a2`,name:`Dependency updates`,costUsd:r*.07,sessions:9}]},averages:{perSessionUsd:2.1,perMergedPrUsd:6.8,mergedPrs:11},billing:{claude:`subscription`,codex:`subscription`}}}var y={prices:[],budgets:[],rateLimitWarnPercent:85,timezone:null},b={report:async e=>v(e),session:async e=>({sessionId:e,totals:_(1.84),billing:`subscription`,turns:[],subagents:[{itemId:`ck-explore`,costUsd:.19173,costSource:`estimated`,models:[{model:`claude-sonnet-5-5`,label:`Sonnet 5.5`,inputTokens:1240,outputTokens:3180,cacheReadTokens:412e3,cacheWriteTokens:46500,reasoningTokens:0,costUsd:.19173,costSource:`estimated`}]}]}),project:async e=>({projectId:e,todayUsd:4.2,last7Usd:38.6,monthUsd:61.1,estimated:!1,dailyUsd:Array.from({length:14},(e,t)=>h(`2026-11-02`,t)*.5),topModel:`claude-opus-5-5`,budgets:[],billing:{claude:`subscription`}}),limits:async()=>({windows:[{provider:`claude`,windowId:`5h`,label:`5-hour window`,status:`ok`,usedPercent:42,usedPercentAt:new Date().toISOString(),resetsAt:new Date(Date.now()+9e6).toISOString(),observedAt:new Date().toISOString(),stale:!1},{provider:`claude`,windowId:`weekly`,label:`Weekly`,status:`ok`,usedPercent:null,usedPercentAt:null,resetsAt:new Date(Date.now()+3456e5).toISOString(),observedAt:new Date(Date.now()-6e4).toISOString(),stale:!1},{provider:`claude`,windowId:`weekly-opus`,label:`Weekly (Opus)`,status:`ok`,usedPercent:18,usedPercentAt:new Date(Date.now()-12e5).toISOString(),resetsAt:new Date(Date.now()+3456e5).toISOString(),observedAt:new Date(Date.now()-6e4).toISOString(),stale:!1}],warnPercent:y.rateLimitWarnPercent,billing:{claude:`subscription`}}),budgets:async()=>({budgets:[]}),settings:async()=>({settings:y,bundledPrices:[]}),saveSettings:async e=>(y=e,{settings:y,bundledPrices:[]}),csvUrl:()=>`data:text/csv,timestamp`};function x(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,String(r));return t.toString()}function S(a){let o=l(a,t=>e.getState().setAuth(t===`sign_in_required`?`signin`:`unauthorized`)),u=encodeURIComponent;return{report:e=>o.get(`/usage/report?${x(e)}`,e=>s.parse(e)),session:e=>o.get(`/usage/sessions/${u(e)}`,e=>t.parse(e)),project:e=>o.get(`/usage/projects/${u(e)}`,e=>c.parse(e)),limits:()=>o.get(`/usage/limits`,e=>n.parse(e)),budgets:()=>o.get(`/usage/budgets`,e=>i.parse(e)),settings:()=>o.get(`/usage/settings`,e=>r.parse(e)),saveSettings:e=>o.call(`PUT`,`/usage/settings`,e,e=>r.parse(e)),csvUrl:e=>`${a}/api/usage/export.csv?${x(e)}`}}var C;function w(){return a().kind===`mock`?b:(C??=S(o),C)}var T={all:[`usage`],report:e=>[`usage`,`report`,e],session:e=>[`usage`,`session`,e],project:e=>[`usage`,`project`,e],limits:[`usage`,`limits`],budgets:[`usage`,`budgets`],settings:[`usage`,`settings`]};function E(e){let t=w();return f({queryKey:e?T.report(e):[`usage`,`report`,`none`],queryFn:()=>t.report(e),enabled:e!==null,placeholderData:e=>e,staleTime:3e4})}function D(e){let t=w();return f({queryKey:T.session(e??``),queryFn:()=>t.session(e??``),enabled:!!e,staleTime:1e4})}function O(e){let t=w();return f({queryKey:T.project(e),queryFn:()=>t.project(e),staleTime:3e4})}function k(){let e=w();return f({queryKey:T.limits,queryFn:()=>e.limits(),refetchInterval:6e4})}function A(){let e=w();return f({queryKey:T.budgets,queryFn:()=>e.budgets()})}function j(){let e=w();return f({queryKey:T.settings,queryFn:()=>e.settings()})}function M(){let e=w(),t=d();return u({mutationFn:t=>e.saveSettings(t),onSuccess:e=>{t.setQueryData(T.settings,e),t.invalidateQueries({queryKey:T.all})}})}export{M as a,E as c,k as i,j as l,A as n,D as o,O as r,w as s,T as t};
1
+ import{At as e,C as t,S as n,T as r,b as i,i as a,r as o,w as s,x as c,y as l}from"./api-yvn34iKU.js";import{yt as u}from"./format-D3kairnQ.js";import{F as d,t as f}from"./useQuery-VSotSwry.js";var p=[{key:`claude-opus-5-5`,provider:`claude`,weight:.46},{key:`claude-sonnet-5-5`,provider:`claude`,weight:.28},{key:`gpt-5.3-codex`,provider:`codex`,weight:.2},{key:`claude-haiku-5-5`,provider:`claude`,weight:.06}];function m(e,t){let n=[];for(let r=new Date(`${e}T00:00:00Z`);r.toISOString().slice(0,10)<=t;)n.push(r.toISOString().slice(0,10)),r.setUTCDate(r.getUTCDate()+1);return n}function h(e,t){let n=new Date(`${e}T00:00:00Z`).getUTCDay();return Math.round(((n===0||n===6?3:11)+t*7919%13*.9)*100)/100}function g(e,t){let n=e.map(h);return t.map(e=>{let t=n.map(t=>Math.round(t*e.weight*100)/100);return{key:e.key,label:e.label,costUsd:t.reduce((e,t)=>e+t,0),estimatedCostUsd:e.key.startsWith(`gpt`)?t.reduce((e,t)=>e+t,0):0,tokens:Math.round(t.reduce((e,t)=>e+t,0)*41e4),turns:Math.round(t.reduce((e,t)=>e+t,0)*3),sessions:Math.round(t.reduce((e,t)=>e+t,0)/2),dailyCostUsd:t,dailyTokens:t.map(e=>Math.round(e*41e4))}})}function _(e){return{inputTokens:Math.round(e*9e3),outputTokens:Math.round(e*21e3),cacheReadTokens:Math.round(e*36e4),cacheWriteTokens:Math.round(e*2e4),reasoningTokens:Math.round(e*6e3),costUsd:e,estimatedCostUsd:e*.2,unpricedTurns:0,turns:Math.round(e*3),sessions:Math.round(e/2),cacheHitRate:.88}}function v(e){let t=m(e.from,e.to),n={model:g(t,p.map(e=>({...e,label:e.key}))),provider:g(t,[{key:`claude`,label:`Claude`,weight:.8},{key:`codex`,label:`Codex`,weight:.2}]),project:g(t,[{key:`p-web`,label:`storefront`,weight:.55},{key:`p-api`,label:`payments-api`,weight:.35},{key:``,label:`No project`,weight:.1}]),role:g(t,[{key:`agent`,label:`Agent`,weight:.82},{key:`pm`,label:`Project manager`,weight:.12},{key:`orchestrator`,label:`Orchestrator`,weight:.06}]),source:g(t,[{key:`user`,label:`You`,weight:.7},{key:`automation`,label:`Automations`,weight:.18},{key:`factory`,label:`Factory`,weight:.12}])},r=n.provider.reduce((e,t)=>e+t.costUsd,0);return{query:e,timezone:`UTC`,days:t,totals:_(r),previousTotals:_(r*.86),series:n,topSessions:[[`Fix checkout race on retry`,`storefront`,`claude-opus-5-5`,9.12],[`Stripe webhook idempotency`,`payments-api`,`gpt-5.3-codex`,6.4],[`Nightly security audit`,`payments-api`,`claude-sonnet-5-5`,3.95]].map(([e,t,n,r],i)=>({sessionId:`mock-s${i}`,title:String(e),projectId:null,projectName:String(t),provider:String(n).startsWith(`gpt`)?`codex`:`claude`,model:String(n),role:`agent`,source:i===2?`automation`:`user`,costUsd:Number(r),estimated:String(n).startsWith(`gpt`),tokens:Math.round(Number(r)*4e5),turns:12-i*3,lastAt:new Date().toISOString(),pr:null})),automations:{manualCostUsd:r*.7,automationCostUsd:r*.18,factoryCostUsd:r*.12,byAutomation:[{automationId:`a1`,name:`Security audit`,costUsd:r*.11,sessions:6},{automationId:`a2`,name:`Dependency updates`,costUsd:r*.07,sessions:9}]},averages:{perSessionUsd:2.1,perMergedPrUsd:6.8,mergedPrs:11},billing:{claude:`subscription`,codex:`subscription`}}}var y={prices:[],budgets:[],rateLimitWarnPercent:85,timezone:null},b={report:async e=>v(e),session:async e=>({sessionId:e,totals:_(1.84),billing:`subscription`,turns:[],subagents:[{itemId:`ck-explore`,costUsd:.19173,costSource:`estimated`,models:[{model:`claude-sonnet-5-5`,label:`Sonnet 5.5`,inputTokens:1240,outputTokens:3180,cacheReadTokens:412e3,cacheWriteTokens:46500,reasoningTokens:0,costUsd:.19173,costSource:`estimated`}]}]}),project:async e=>({projectId:e,todayUsd:4.2,last7Usd:38.6,monthUsd:61.1,estimated:!1,dailyUsd:Array.from({length:14},(e,t)=>h(`2026-11-02`,t)*.5),topModel:`claude-opus-5-5`,budgets:[],billing:{claude:`subscription`}}),limits:async()=>({windows:[{provider:`claude`,windowId:`5h`,label:`5-hour window`,status:`ok`,usedPercent:42,usedPercentAt:new Date().toISOString(),resetsAt:new Date(Date.now()+9e6).toISOString(),observedAt:new Date().toISOString(),stale:!1},{provider:`claude`,windowId:`weekly`,label:`Weekly`,status:`ok`,usedPercent:null,usedPercentAt:null,resetsAt:new Date(Date.now()+3456e5).toISOString(),observedAt:new Date(Date.now()-6e4).toISOString(),stale:!1},{provider:`claude`,windowId:`weekly-opus`,label:`Weekly (Opus)`,status:`ok`,usedPercent:18,usedPercentAt:new Date(Date.now()-12e5).toISOString(),resetsAt:new Date(Date.now()+3456e5).toISOString(),observedAt:new Date(Date.now()-6e4).toISOString(),stale:!1}],warnPercent:y.rateLimitWarnPercent,billing:{claude:`subscription`}}),budgets:async()=>({budgets:[]}),settings:async()=>({settings:y,bundledPrices:[]}),saveSettings:async e=>(y=e,{settings:y,bundledPrices:[]}),csvUrl:()=>`data:text/csv,timestamp`};function x(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,String(r));return t.toString()}function S(a){let o=l(a,t=>e.getState().setAuth(t===`sign_in_required`?`signin`:`unauthorized`)),u=encodeURIComponent;return{report:e=>o.get(`/usage/report?${x(e)}`,e=>s.parse(e)),session:e=>o.get(`/usage/sessions/${u(e)}`,e=>t.parse(e)),project:e=>o.get(`/usage/projects/${u(e)}`,e=>c.parse(e)),limits:()=>o.get(`/usage/limits`,e=>n.parse(e)),budgets:()=>o.get(`/usage/budgets`,e=>i.parse(e)),settings:()=>o.get(`/usage/settings`,e=>r.parse(e)),saveSettings:e=>o.call(`PUT`,`/usage/settings`,e,e=>r.parse(e)),csvUrl:e=>`${a}/api/usage/export.csv?${x(e)}`}}var C;function w(){return a().kind===`mock`?b:(C??=S(o),C)}var T={all:[`usage`],report:e=>[`usage`,`report`,e],session:e=>[`usage`,`session`,e],project:e=>[`usage`,`project`,e],limits:[`usage`,`limits`],budgets:[`usage`,`budgets`],settings:[`usage`,`settings`]};function E(e){let t=w();return f({queryKey:e?T.report(e):[`usage`,`report`,`none`],queryFn:()=>t.report(e),enabled:e!==null,placeholderData:e=>e,staleTime:3e4})}function D(e){let t=w();return f({queryKey:T.session(e??``),queryFn:()=>t.session(e??``),enabled:!!e,staleTime:1e4})}function O(e){let t=w();return f({queryKey:T.project(e),queryFn:()=>t.project(e),staleTime:3e4})}function k(){let e=w();return f({queryKey:T.limits,queryFn:()=>e.limits(),refetchInterval:6e4})}function A(){let e=w();return f({queryKey:T.budgets,queryFn:()=>e.budgets()})}function j(){let e=w();return f({queryKey:T.settings,queryFn:()=>e.settings()})}function M(){let e=w(),t=d();return u({mutationFn:t=>e.saveSettings(t),onSuccess:e=>{t.setQueryData(T.settings,e),t.invalidateQueries({queryKey:T.all})}})}export{M as a,E as c,k as i,j as l,A as n,D as o,O as r,w as s,T as t};