tarsk 0.4.29 → 0.4.31

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 (78) hide show
  1. package/dist/index.js +746 -349
  2. package/dist/public/assets/{account-view-YvC0mymF.js → account-view-Cdp8xegU.js} +1 -1
  3. package/dist/public/assets/alert-dialog-DAJFcjdR.js +1 -0
  4. package/dist/public/assets/api-BYFUablr.js +1 -0
  5. package/dist/public/assets/{browser-tab-CCXMlmPO.js → browser-tab-Ban23pgA.js} +1 -1
  6. package/dist/public/assets/chat-input-container-Bc7nCdKX.js +21 -0
  7. package/dist/public/assets/context-menu-D93N09Jw.js +1 -0
  8. package/dist/public/assets/conversation-history-view-qm_qW0aD.js +1 -0
  9. package/dist/public/assets/{dialogs-config-B91VQpxo.js → dialogs-config-VlhyoYms.js} +14 -14
  10. package/dist/public/assets/diff-view-DUmzPmed.js +3 -0
  11. package/dist/public/assets/explorer-tab-view-Bbboiq-d.js +2 -0
  12. package/dist/public/assets/explorer-tree-CX03Vh31.js +1 -0
  13. package/dist/public/assets/{explorer-view-BCJqE1-z.js → explorer-view-CMcJFEtT.js} +1 -1
  14. package/dist/public/assets/history-view-Cub-F9g6.js +1 -0
  15. package/dist/public/assets/index-C-dv630o.css +1 -0
  16. package/dist/public/assets/index-DaJT5K7g.js +29 -0
  17. package/dist/public/assets/{markdown-renderer-9nzN0Pk3.js → markdown-renderer-BPXg5AUu.js} +4 -4
  18. package/dist/public/assets/{mcp-server-card-BSw_FlEC.js → mcp-server-card-BCZmpcVY.js} +1 -1
  19. package/dist/public/assets/onboarding-BPUo1aJX.js +1 -0
  20. package/dist/public/assets/onboarding-dialog-vqz8baom.js +1 -0
  21. package/dist/public/assets/page-toolbar-CU9dGLvm.js +1 -0
  22. package/dist/public/assets/project-settings-view-BAs5RYWR.js +1 -0
  23. package/dist/public/assets/providers-list-view-67A5O5vd.js +1 -0
  24. package/dist/public/assets/radio-group-CRwVSJCp.js +1 -0
  25. package/dist/public/assets/react-vendor-CtZx3FWA.js +22 -0
  26. package/dist/public/assets/{resizable-CEv7JjTI.js → resizable-AKojmHeo.js} +1 -1
  27. package/dist/public/assets/{run-stop-button-CrjPMC0m.js → run-stop-button-DYoC8i6e.js} +2 -2
  28. package/dist/public/assets/settings-general-view-mu1Qq8cl.js +1 -0
  29. package/dist/public/assets/{settings-instructions-view-C23spY9Y.js → settings-instructions-view-DQRSZId7.js} +1 -1
  30. package/dist/public/assets/{settings-mcp-servers-view-ZHar6YbE.js → settings-mcp-servers-view-BqJMRVZJ.js} +4 -4
  31. package/dist/public/assets/settings-models-skeleton-qdDMv5hS.js +1 -0
  32. package/dist/public/assets/settings-models-view-DSrdZZfF.js +1 -0
  33. package/dist/public/assets/settings-rules-view-Dt_lfKVv.js +8 -0
  34. package/dist/public/assets/{settings-skills-view-D60tD-OE.js → settings-skills-view-Djrk38ol.js} +2 -2
  35. package/dist/public/assets/{settings-slash-commands-view-DR-pzulT.js → settings-slash-commands-view-Cm5cy2My.js} +1 -1
  36. package/dist/public/assets/{settings-subagents-view-InXmwmw9.js → settings-subagents-view-CsGwbSvQ.js} +2 -2
  37. package/dist/public/assets/settings-view-DuTfugUO.js +2 -0
  38. package/dist/public/assets/{side-panel-container-CO3qgRvc.js → side-panel-container-Cg99BH1l.js} +2 -2
  39. package/dist/public/assets/skeleton-B1fuNMHm.js +1 -0
  40. package/dist/public/assets/{standard-list-item-DyALhVYe.js → standard-list-item-0m99qNoa.js} +1 -1
  41. package/dist/public/assets/{store-D28g9VUj.js → store-DUqJt-K-.js} +1 -1
  42. package/dist/public/assets/{tab-context-C3z7YU59.js → tab-context-BYpxvaoz.js} +1 -1
  43. package/dist/public/assets/tabs-ywSKq3qp.js +1 -0
  44. package/dist/public/assets/{terminal-panel-EifoA6G0.js → terminal-panel-C9XWZHaD.js} +2 -2
  45. package/dist/public/assets/textarea-DuuNwegn.js +1 -0
  46. package/dist/public/assets/todos-view-CRzNrsfP.js +1 -0
  47. package/dist/public/assets/{use-font-size-BCtvz0bm.js → use-font-size-D2A0_bAi.js} +1 -1
  48. package/dist/public/assets/{use-toast-BZ79E_dX.js → use-toast-BF5WtiOJ.js} +1 -1
  49. package/dist/public/assets/{utils-Bhu11Tpg.js → utils-CheqpoJ4.js} +1 -1
  50. package/dist/public/index.html +21 -21
  51. package/package.json +2 -2
  52. package/dist/public/assets/alert-dialog-BFhUZsPe.js +0 -1
  53. package/dist/public/assets/api-DSvSyBH5.js +0 -1
  54. package/dist/public/assets/chat-input-container-VwmGKJFJ.js +0 -21
  55. package/dist/public/assets/context-menu-B6K8j1ha.js +0 -1
  56. package/dist/public/assets/conversation-history-view-DrrLyMbg.js +0 -1
  57. package/dist/public/assets/diff-view-C09yOc5d.js +0 -3
  58. package/dist/public/assets/explorer-tab-view-B1DukGdo.js +0 -2
  59. package/dist/public/assets/explorer-tree-DCeud6YI.js +0 -1
  60. package/dist/public/assets/history-view-Dj4NiScy.js +0 -1
  61. package/dist/public/assets/index-7TFkb0ll.css +0 -1
  62. package/dist/public/assets/index-BLCecayZ.js +0 -29
  63. package/dist/public/assets/onboarding-ClUE_I5q.js +0 -1
  64. package/dist/public/assets/onboarding-dialog-C2jig8mT.js +0 -1
  65. package/dist/public/assets/page-toolbar-DnVFnCgq.js +0 -1
  66. package/dist/public/assets/project-settings-view-DWn0ty7b.js +0 -1
  67. package/dist/public/assets/providers-list-view-B0DqNJYK.js +0 -1
  68. package/dist/public/assets/radio-group-CM_Wwam0.js +0 -1
  69. package/dist/public/assets/react-vendor-nPkCWaAR.js +0 -22
  70. package/dist/public/assets/settings-general-view-CwQYmnI2.js +0 -1
  71. package/dist/public/assets/settings-models-view-Cg6WQ4cy.js +0 -1
  72. package/dist/public/assets/settings-rules-view-zAx5JL4w.js +0 -8
  73. package/dist/public/assets/settings-view-DLRDBuwH.js +0 -2
  74. package/dist/public/assets/skeleton-CXoVAzC1.js +0 -1
  75. package/dist/public/assets/tabs-sXgL2DZz.js +0 -1
  76. package/dist/public/assets/textarea-Bp3p1-25.js +0 -1
  77. package/dist/public/assets/todos-view-DRL4px6A.js +0 -1
  78. /package/dist/public/assets/{dist-D5DgwfYL.js → dist-CAVGqbBm.js} +0 -0
@@ -1 +1 @@
1
- import{$n as e,Fi as t,Mr as n,Sa as r}from"./dialogs-config-B91VQpxo.js";import{F as i,I as a,L as o}from"./react-vendor-nPkCWaAR.js";var s=r(),c=n(),l=t=>{let n=(0,s.c)(8),r,i;n[0]===t?(r=n[1],i=n[2]):({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i);let o;n[3]===r?o=n[4]:(o=e(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,r),n[3]=r,n[4]=o);let l;return n[5]!==i||n[6]!==o?(l=(0,c.jsx)(a,{className:o,...i}),n[5]=i,n[6]=o,n[7]=l):l=n[7],l},u=i,d=n=>{let r=(0,s.c)(12),i,a,l;r[0]===n?(i=r[1],a=r[2],l=r[3]):({withHandle:l,className:i,...a}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=l);let u;r[4]===i?u=r[5]:(u=e(`relative flex w-px items-center justify-center bg-transparent after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90`,i),r[4]=i,r[5]=u);let d;r[6]===l?d=r[7]:(d=l&&(0,c.jsx)(`div`,{className:`hidden z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border`,children:(0,c.jsx)(t,{className:`h-2.5 w-2.5`})}),r[6]=l,r[7]=d);let f;return r[8]!==a||r[9]!==u||r[10]!==d?(f=(0,c.jsx)(o,{className:u,...a,children:d}),r[8]=a,r[9]=u,r[10]=d,r[11]=f):f=r[11],f};export{u as n,l as r,d as t};
1
+ import{Fr as e,Mi as t,Or as n,_a as r}from"./dialogs-config-VlhyoYms.js";import{F as i,I as a,L as o}from"./react-vendor-CtZx3FWA.js";var s=r(),c=e(),l=e=>{let t=(0,s.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let o;t[3]===r?o=t[4]:(o=n(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,r),t[3]=r,t[4]=o);let l;return t[5]!==i||t[6]!==o?(l=(0,c.jsx)(a,{className:o,...i}),t[5]=i,t[6]=o,t[7]=l):l=t[7],l},u=i,d=e=>{let r=(0,s.c)(12),i,a,l;r[0]===e?(i=r[1],a=r[2],l=r[3]):({withHandle:l,className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=l);let u;r[4]===i?u=r[5]:(u=n(`relative flex w-px items-center justify-center bg-transparent after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90`,i),r[4]=i,r[5]=u);let d;r[6]===l?d=r[7]:(d=l&&(0,c.jsx)(`div`,{className:`hidden z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border`,children:(0,c.jsx)(t,{className:`h-2.5 w-2.5`})}),r[6]=l,r[7]=d);let f;return r[8]!==a||r[9]!==u||r[10]!==d?(f=(0,c.jsx)(o,{className:u,...a,children:d}),r[8]=a,r[9]=u,r[10]=d,r[11]=f):f=r[11],f};export{u as n,l as r,d as t};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Di as t,Mr as n,Qr as r,Un as i,Zt as a,_n as o,di as s,hn as c,wa as l}from"./dialogs-config-B91VQpxo.js";import{a as u,o as d,t as f}from"./store-D28g9VUj.js";import{c as p,l as m,s as h,u as g}from"./history-view-Dj4NiScy.js";import{t as _}from"./use-toast-BZ79E_dX.js";import{n as v}from"./tab-context-C3z7YU59.js";var y=e(l(),1);function b(){let{state:e}=u(),{selectedThreadId:t}=e,{dispatch:n}=d(t),{setActiveMainTab:r,setDevServerUrl:i,setDevServerRunning:a,setDevServerLoading:o}=v();return{startServer:async e=>{if(!e?.runCommand||!e?.projectId)return;o(!0),n({type:f.ClearTerminalOutput}),n({type:f.SetTerminalOpen,open:!1}),n({type:f.AppendTerminalLine,line:{type:`system`,content:`Starting dev server: ${e.runCommand}`}});let s=!1,l=setTimeout(()=>{s=!0,n({type:f.SetTerminalOpen,open:!0})},3e3);try{let u=await c(e.projectId,t??void 0);if(!u){clearTimeout(l),n({type:f.AppendTerminalLine,line:{type:`error`,content:`Failed to start dev server`}}),o(!1);return}let d=u.getReader(),p=new TextDecoder;a(!0),o(!1);let m=!1,h=!1;for(;;){let{done:e,value:t}=await d.read();if(e)break;let a=p.decode(t,{stream:!0});try{let e=a.split(`
2
- `).filter(e=>e.trim());for(let t of e)try{let e=JSON.parse(t);h||(h=!0,o(!1)),e.type===`url`&&e.url&&(clearTimeout(l),n({type:f.AppendTerminalLine,line:{type:`system`,content:`✓ Server running at: ${e.url}`}}),i(e.url),r(`browser`),s&&setTimeout(()=>{n({type:f.SetTerminalOpen,open:!1})},100),m=!0)}catch{}}catch{}}m||n({type:f.AppendTerminalLine,line:{type:`system`,content:`Server is running but URL could not be detected`}})}catch(e){console.error(`Failed to start dev server:`,e),o(!1),n({type:f.AppendTerminalLine,line:{type:`error`,content:`Failed to start dev server`}})}},setServerUrl:i}}var x=n();function S({projectId:e,runCommand:n,large:c}){let{state:l}=u(),{selectedThreadId:S}=l,{dispatch:C}=d(S),{setDevServerUrl:w,devServerRunning:T,setDevServerRunning:E,devServerLoading:D,setDevServerLoading:O}=v(),{startServer:k}=b(),A=(0,y.useRef)(!1);(0,y.useEffect)(()=>{(async()=>{try{E((await a(e)).isRunning)}catch{E(!1)}})()},[e]);let j=()=>{k({projectId:e,runCommand:n||``})},M=async()=>{A.current=!0,O(!0);try{await o(e),E(!1),w(null),C({type:f.AppendTerminalLine,line:{type:`system`,content:`Server stopped`}})}catch(e){let t=e instanceof Error?e.message:`Failed to stop dev server`;C({type:f.AppendTerminalLine,line:{type:`error`,content:t}}),_({title:`Error`,description:t,variant:`destructive`})}finally{O(!1)}},N=!!n;return c?(0,x.jsxs)(`button`,{onClick:T?M:j,disabled:D||!T&&!N,className:`flex flex-col items-center gap-3 group disabled:opacity-40 disabled:cursor-not-allowed ${T?`text-orange-500`:`text-muted-foreground`}`,children:[D?(0,x.jsx)(t,{className:`h-10 w-10 animate-spin`}):T?(0,x.jsx)(r,{className:`h-10 w-10 fill-current`}):(0,x.jsx)(s,{className:`h-10 w-10 fill-current group-hover:text-foreground transition-colors`}),(0,x.jsx)(`span`,{className:`text-sm group-hover:text-foreground transition-colors`,children:D?`Starting...`:T?`Stop dev server`:`Start dev server`})]}):(0,x.jsx)(x.Fragment,{children:(0,x.jsx)(m,{children:(0,x.jsxs)(h,{children:[(0,x.jsx)(g,{asChild:!0,children:(0,x.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 ${T?`text-orange-500 bg-orange-500/10`:`text-muted-foreground`}`,onClick:T?M:j,disabled:D||!T&&!N,children:[D?(0,x.jsx)(t,{className:`h-4 w-4 animate-spin`}):T?(0,x.jsx)(r,{className:`h-4 w-4 fill-current`}):(0,x.jsx)(s,{className:`h-4 w-4`}),(0,x.jsx)(`span`,{className:`sr-only`,children:T?`Stop dev server`:`Start dev server`})]})}),(0,x.jsx)(p,{children:T?`Stop dev server`:N?`Start dev server: ${n}`:`Set run command in project settings`})]})})})}export{b as n,S as t};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$r as t,$t as n,Er as r,Fr as i,Ti as a,_n as o,di as s,ya as c,yn as l}from"./dialogs-config-VlhyoYms.js";import{a as u,o as d,t as f}from"./store-DUqJt-K-.js";import{c as p,l as m,s as h,u as g}from"./history-view-Cub-F9g6.js";import{t as _}from"./use-toast-BF5WtiOJ.js";import{n as v}from"./tab-context-BYpxvaoz.js";var y=e(c(),1);function b(){let{state:e}=u(),{selectedThreadId:t}=e,{dispatch:n}=d(t),{setActiveMainTab:r,setDevServerUrl:i,setDevServerRunning:a,setDevServerLoading:s}=v();return{startServer:async e=>{if(!e?.runCommand||!e?.projectId)return;s(!0),n({type:f.ClearTerminalOutput}),n({type:f.SetTerminalOpen,open:!1}),n({type:f.AppendTerminalLine,line:{type:`system`,content:`Starting dev server: ${e.runCommand}`}});let c=!1,l=setTimeout(()=>{c=!0,n({type:f.SetTerminalOpen,open:!0})},3e3);try{let u=await o(e.projectId,t??void 0);if(!u){clearTimeout(l),n({type:f.AppendTerminalLine,line:{type:`error`,content:`Failed to start dev server`}}),s(!1);return}let d=u.getReader(),p=new TextDecoder;a(!0),s(!1);let m=!1,h=!1;for(;;){let{done:e,value:t}=await d.read();if(e)break;let a=p.decode(t,{stream:!0});try{let e=a.split(`
2
+ `).filter(e=>e.trim());for(let t of e)try{let e=JSON.parse(t);h||(h=!0,s(!1)),e.type===`url`&&e.url&&(clearTimeout(l),n({type:f.AppendTerminalLine,line:{type:`system`,content:`✓ Server running at: ${e.url}`}}),i(e.url),r(`browser`),c&&setTimeout(()=>{n({type:f.SetTerminalOpen,open:!1})},100),m=!0)}catch{}}catch{}}m||n({type:f.AppendTerminalLine,line:{type:`system`,content:`Server is running but URL could not be detected`}})}catch(e){console.error(`Failed to start dev server:`,e),s(!1),n({type:f.AppendTerminalLine,line:{type:`error`,content:`Failed to start dev server`}})}},setServerUrl:i}}var x=i();function S({projectId:e,runCommand:i,large:o}){let{state:c}=u(),{selectedThreadId:S}=c,{dispatch:C}=d(S),{setDevServerUrl:w,devServerRunning:T,setDevServerRunning:E,devServerLoading:D,setDevServerLoading:O}=v(),{startServer:k}=b(),A=(0,y.useRef)(!1);(0,y.useEffect)(()=>{(async()=>{try{E((await n(e)).isRunning)}catch{E(!1)}})()},[e]);let j=()=>{k({projectId:e,runCommand:i||``})},M=async()=>{A.current=!0,O(!0);try{await l(e),E(!1),w(null),C({type:f.AppendTerminalLine,line:{type:`system`,content:`Server stopped`}})}catch(e){let t=e instanceof Error?e.message:`Failed to stop dev server`;C({type:f.AppendTerminalLine,line:{type:`error`,content:t}}),_({title:`Error`,description:t,variant:`destructive`})}finally{O(!1)}},N=!!i;return o?(0,x.jsxs)(`button`,{onClick:T?M:j,disabled:D||!T&&!N,className:`flex flex-col items-center gap-3 group disabled:opacity-40 disabled:cursor-not-allowed ${T?`text-orange-500`:`text-muted-foreground`}`,children:[D?(0,x.jsx)(a,{className:`h-10 w-10 animate-spin`}):T?(0,x.jsx)(t,{className:`h-10 w-10 fill-current`}):(0,x.jsx)(s,{className:`h-10 w-10 fill-current group-hover:text-foreground transition-colors`}),(0,x.jsx)(`span`,{className:`text-sm group-hover:text-foreground transition-colors`,children:D?`Starting...`:T?`Stop dev server`:`Start dev server`})]}):(0,x.jsx)(x.Fragment,{children:(0,x.jsx)(m,{children:(0,x.jsxs)(h,{children:[(0,x.jsx)(g,{asChild:!0,children:(0,x.jsxs)(r,{variant:`ghost`,size:`icon`,className:`h-8 w-8 ${T?`text-orange-500 bg-orange-500/10`:`text-muted-foreground`}`,onClick:T?M:j,disabled:D||!T&&!N,children:[D?(0,x.jsx)(a,{className:`h-4 w-4 animate-spin`}):T?(0,x.jsx)(t,{className:`h-4 w-4 fill-current`}):(0,x.jsx)(s,{className:`h-4 w-4`}),(0,x.jsx)(`span`,{className:`sr-only`,children:T?`Stop dev server`:`Start dev server`})]})}),(0,x.jsx)(p,{children:T?`Stop dev server`:N?`Start dev server: ${i}`:`Set run command in project settings`})]})})})}export{b as n,S as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Fr as n,Or as r,_a as i,ci as a,ya as o,zn as s}from"./dialogs-config-VlhyoYms.js";import{c,l,s as u,u as d}from"./react-vendor-CtZx3FWA.js";import{n as f}from"./use-font-size-D2A0_bAi.js";var p=i(),m=e(o(),1),h=n(),g=m.forwardRef((e,t)=>{let n=(0,p.c)(11),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`relative flex w-full touch-none select-none items-center`,i),n[3]=i,n[4]=o);let s,f;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,h.jsx)(d,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,h.jsx)(u,{className:`absolute h-full bg-primary`})}),f=(0,h.jsx)(l,{className:`block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`}),n[5]=s,n[6]=f):(s=n[5],f=n[6]);let m;return n[7]!==a||n[8]!==t||n[9]!==o?(m=(0,h.jsxs)(c,{ref:t,className:o,...a,children:[s,f]}),n[7]=a,n[8]=t,n[9]=o,n[10]=m):m=n[10],m});g.displayName=c.displayName;function _(){let e=(0,p.c)(34),{scale:n,updateScale:r,resetScale:i,min:o,max:c,default:l}=f(),u;e[0]===r?u=e[1]:(u=function(e){e.length>0&&r(e[0])},e[0]=r,e[1]=u);let d=u,m;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,h.jsxs)(`div`,{className:`mb-6`,children:[(0,h.jsx)(`h1`,{className:`text-2xl font-bold`,children:`General`}),(0,h.jsx)(`p`,{className:`text-muted-foreground`,children:`Customize the appearance and behavior of Tarsk.`})]}),e[2]=m):m=e[2];let _;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h3`,{className:`text-sm font-medium`,children:`Font Size`}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Adjust the text size across the entire application.`})]}),e[3]=_):_=e[3];let v;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,h.jsx)(a,{className:`h-3.5 w-3.5`}),e[4]=v):v=e[4];let y;e[5]===i?y=e[6]:(y=(0,h.jsx)(t,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:i,title:`Reset to default`,children:v}),e[5]=i,e[6]=y);let b;e[7]===n?b=e[8]:(b=(0,h.jsxs)(`span`,{className:`text-sm font-mono tabular-nums w-12 text-right`,children:[n,`%`]}),e[7]=n,e[8]=b);let x;e[9]!==y||e[10]!==b?(x=(0,h.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[_,(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]})]}),e[9]=y,e[10]=b,e[11]=x):x=e[11];let S;e[12]===o?S=e[13]:(S=(0,h.jsxs)(`span`,{className:`text-xs text-muted-foreground w-8 text-right`,children:[o,`%`]}),e[12]=o,e[13]=S);let C;e[14]===n?C=e[15]:(C=[n],e[14]=n,e[15]=C);let w;e[16]!==d||e[17]!==c||e[18]!==o||e[19]!==C?(w=(0,h.jsx)(g,{value:C,min:o,max:c,step:5,onValueChange:d,"aria-label":`Font size`}),e[16]=d,e[17]=c,e[18]=o,e[19]=C,e[20]=w):w=e[20];let T;e[21]===c?T=e[22]:(T=(0,h.jsxs)(`span`,{className:`text-xs text-muted-foreground w-9`,children:[c,`%`]}),e[21]=c,e[22]=T);let E;e[23]!==T||e[24]!==S||e[25]!==w?(E=(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[S,w,T]}),e[23]=T,e[24]=S,e[25]=w,e[26]=E):E=e[26];let D;e[27]!==l||e[28]!==n?(D=n!==l&&(0,h.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:[`Font size has been changed from the default (`,l,`%).`]}),e[27]=l,e[28]=n,e[29]=D):D=e[29];let O;return e[30]!==E||e[31]!==D||e[32]!==x?(O=(0,h.jsx)(s,{className:`flex-1`,children:(0,h.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[m,(0,h.jsx)(`div`,{className:`space-y-8`,children:(0,h.jsxs)(`div`,{children:[x,E,D]})})]})}),e[30]=E,e[31]=D,e[32]=x,e[33]=O):O=e[33],O}export{_ as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Di as t,Mr as n,Pt as r,Un as i,fn as a,wa as o}from"./dialogs-config-B91VQpxo.js";import{a as s}from"./store-D28g9VUj.js";import{t as c}from"./textarea-Bp3p1-25.js";import{t as l}from"./use-toast-BZ79E_dX.js";var u=e(o(),1),d=n();function f(){let{state:e}=s(),{selectedThreadId:n}=e,[o,f]=(0,u.useState)(``),[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(!1);(0,u.useEffect)(()=>{n&&(m(!0),r(n,`AGENTS.md`).then(e=>f(e.content)).catch(()=>f(``)).finally(()=>m(!1)))},[n]);async function _(){if(n){g(!0);try{await a(n,`AGENTS.md`,o),l({title:`Instructions saved`})}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to save instructions`,variant:`destructive`})}finally{g(!1)}}}return n?(0,d.jsx)(`div`,{className:`h-full flex flex-col overflow-hidden`,children:(0,d.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 w-full flex-1 flex flex-col min-h-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Instructions`}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:`Add context like coding guidelines and expectations. Stored in AGENTS.md file.`})]}),(0,d.jsx)(i,{onClick:_,disabled:p||h,children:h?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(t,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})]}),p?(0,d.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,d.jsx)(t,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,d.jsx)(c,{value:o,onChange:e=>f(e.target.value),className:`flex-1 min-h-0 font-mono text-sm resize-none`,placeholder:`Add instructions for your agent in AGENTS.md...`,disabled:h})]})}):(0,d.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a thread to edit instructions.`})})}export{f as SettingsInstructionsView,f as default};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Fr as n,Lt as r,Ti as i,mn as a,ya as o}from"./dialogs-config-VlhyoYms.js";import{a as s}from"./store-DUqJt-K-.js";import{t as c}from"./textarea-DuuNwegn.js";import{t as l}from"./use-toast-BF5WtiOJ.js";var u=e(o(),1),d=n();function f(){let{state:e}=s(),{selectedThreadId:n}=e,[o,f]=(0,u.useState)(``),[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(!1);(0,u.useEffect)(()=>{n&&(m(!0),r(n,`AGENTS.md`).then(e=>f(e.content)).catch(()=>f(``)).finally(()=>m(!1)))},[n]);async function _(){if(n){g(!0);try{await a(n,`AGENTS.md`,o),l({title:`Instructions saved`})}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to save instructions`,variant:`destructive`})}finally{g(!1)}}}return n?(0,d.jsx)(`div`,{className:`h-full flex flex-col overflow-hidden`,children:(0,d.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 w-full flex-1 flex flex-col min-h-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Instructions`}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:`Add context like coding guidelines and expectations. Stored in AGENTS.md file.`})]}),(0,d.jsx)(t,{onClick:_,disabled:p||h,children:h?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})]}),p?(0,d.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,d.jsx)(i,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,d.jsx)(c,{value:o,onChange:e=>f(e.target.value),className:`flex-1 min-h-0 font-mono text-sm resize-none`,placeholder:`Add instructions for your agent in AGENTS.md...`,disabled:h})]})}):(0,d.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a thread to edit instructions.`})})}export{f as SettingsInstructionsView,f as default};
@@ -1,5 +1,5 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{B as t,Bn as n,Hn as r,Jn as i,Kr as a,Mr as o,Rr as s,Sa as c,Un as l,ai as u,fi as d,ii as f,ln as p,mt as m,n as h,qn as g,r as _,ui as v,wa as y,yt as b}from"./dialogs-config-B91VQpxo.js";import{a as x}from"./store-D28g9VUj.js";import{t as S}from"./textarea-Bp3p1-25.js";import{c as C,l as w,s as T,u as E}from"./history-view-Dj4NiScy.js";import{t as D}from"./use-toast-BZ79E_dX.js";import{a as O,c as k,i as A,n as ee,o as j,r as M,s as N,t as P}from"./alert-dialog-BFhUZsPe.js";import{n as F}from"./tab-context-C3z7YU59.js";import{t as I}from"./skeleton-CXoVAzC1.js";import{t as L}from"./mcp-server-card-BSw_FlEC.js";var R=c(),z=e(y(),1);function B(e){let[t,n]=(0,z.useState)([]),[r,i]=(0,z.useState)(!1),a=(0,z.useCallback)(async()=>{if(e){i(!0);try{let t=await m(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,z.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function V(){let e=(0,R.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,z.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{b().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,z.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function H(e,t,n){await p(e,t,n)}async function U(e,n){await t(e,n)}var W=o();function G({projectPath:e,serverName:t,onBack:i}){let{installedServers:a}=B(e),o=!!t,[c,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)([]),[_,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(!1),[C,w]=(0,z.useState)(null),[T,E]=(0,z.useState)(o),[O,k]=(0,z.useState)(``),[A,ee]=(0,z.useState)(``),[j,M]=(0,z.useState)(``),[N,P]=(0,z.useState)([]);(0,z.useEffect)(()=>{if(o&&t){let e=a.find(e=>e.name===t);if(e){u(e.name),f(e.config.command);let t=e.config.args.join(`
2
- `);m(t);let n=Object.entries(e.config.env??{}).map(([e,t])=>({key:e,value:t}));g(n),k(e.name),ee(e.config.command),M(t),P(n),E(!1)}}else E(!1)},[a,t,o]);let F=(0,z.useCallback)(()=>{g(e=>[...e,{key:``,value:``}])},[]),I=(0,z.useCallback)(e=>{g(t=>t.filter((t,n)=>n!==e))},[]),L=(0,z.useCallback)((e,t)=>{g(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),R=(0,z.useCallback)((e,t)=>{g(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),V=()=>{let e=p.split(`
3
- `).map(e=>e.trim()).filter(Boolean),t={};for(let{key:e,value:n}of h)e.trim()&&(t[e.trim()]=n);return{command:d.trim(),args:e,...Object.keys(t).length>0?{env:t}:{}}},G=async()=>{w(null);let t=c.trim(),n=d.trim();if(!t){w(`Server name is required`);return}if(!n){w(`Command is required`);return}y(!0);try{if(!e)throw Error(`No project path`);await H(e,O||t,V()),D({title:`Success`,description:o?`MCP server configuration saved`:`MCP server added`}),i()}catch(e){w(e instanceof Error?e.message:`Failed to save server`)}finally{y(!1)}},K=async()=>{if(e){x(!0);try{await U(e,O),D({title:`Success`,description:`MCP server removed`}),i()}catch(e){w(e instanceof Error?e.message:`Failed to delete server`)}finally{x(!1)}}},q=o?d!==A||p!==j||JSON.stringify(h)!==JSON.stringify(N):c.trim()!==``||d.trim()!==``||p.trim()!==``||h.length>0;return T?(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading server configuration...`})}):(0,W.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,W.jsxs)(`div`,{className:`mb-6`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-bold`,children:o?c:`Add MCP Server`}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:o?`Edit MCP Server configuration.`:`Configure a new MCP Server.`})]}),(0,W.jsxs)(`div`,{className:`space-y-6`,children:[(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(n,{htmlFor:`server-name`,children:`Server name`}),(0,W.jsx)(r,{id:`server-name`,placeholder:`e.g. filesystem`,value:c,onChange:e=>u(e.target.value),disabled:o}),o&&(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Server name cannot be changed`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(n,{htmlFor:`server-command`,children:`Command`}),(0,W.jsx)(r,{id:`server-command`,placeholder:`e.g. npx`,value:d,onChange:e=>f(e.target.value),className:`text-sm`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(n,{htmlFor:`server-args`,children:[`Arguments `,(0,W.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(one per line)`})]}),(0,W.jsx)(S,{id:`server-args`,placeholder:`-y
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Br as t,Er as n,Fr as r,Gn as i,Hn as a,Kn as o,St as s,W as c,Wn as l,_a as u,ai as d,dn as f,fi as p,ii as m,n as h,qr as g,r as _,ui as v,vt as y,ya as b}from"./dialogs-config-VlhyoYms.js";import{a as x}from"./store-DUqJt-K-.js";import{t as S}from"./textarea-DuuNwegn.js";import{c as C,l as w,s as T,u as E}from"./history-view-Cub-F9g6.js";import{t as D}from"./use-toast-BF5WtiOJ.js";import{a as O,c as k,i as A,n as j,o as ee,r as M,s as N,t as P}from"./alert-dialog-DAJFcjdR.js";import{n as F}from"./tab-context-BYpxvaoz.js";import{t as I}from"./skeleton-B1fuNMHm.js";import{t as L}from"./mcp-server-card-BCZmpcVY.js";var R=u(),z=e(b(),1);function B(e){let[t,n]=(0,z.useState)([]),[r,i]=(0,z.useState)(!1),a=(0,z.useCallback)(async()=>{if(e){i(!0);try{let t=await y(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,z.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function V(){let e=(0,R.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,z.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{s().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,z.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function H(e,t,n){await f(e,t,n)}async function U(e,t){await c(e,t)}var W=r();function G({projectPath:e,serverName:r,onBack:i}){let{installedServers:o}=B(e),s=!!r,[c,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)([]),[_,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(!1),[C,w]=(0,z.useState)(null),[T,E]=(0,z.useState)(s),[O,k]=(0,z.useState)(``),[A,j]=(0,z.useState)(``),[ee,M]=(0,z.useState)(``),[N,P]=(0,z.useState)([]);(0,z.useEffect)(()=>{if(s&&r){let e=o.find(e=>e.name===r);if(e){u(e.name),f(e.config.command);let t=e.config.args.join(`
2
+ `);m(t);let n=Object.entries(e.config.env??{}).map(([e,t])=>({key:e,value:t}));g(n),k(e.name),j(e.config.command),M(t),P(n),E(!1)}}else E(!1)},[o,r,s]);let F=(0,z.useCallback)(()=>{g(e=>[...e,{key:``,value:``}])},[]),I=(0,z.useCallback)(e=>{g(t=>t.filter((t,n)=>n!==e))},[]),L=(0,z.useCallback)((e,t)=>{g(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),R=(0,z.useCallback)((e,t)=>{g(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),V=()=>{let e=p.split(`
3
+ `).map(e=>e.trim()).filter(Boolean),t={};for(let{key:e,value:n}of h)e.trim()&&(t[e.trim()]=n);return{command:d.trim(),args:e,...Object.keys(t).length>0?{env:t}:{}}},G=async()=>{w(null);let t=c.trim(),n=d.trim();if(!t){w(`Server name is required`);return}if(!n){w(`Command is required`);return}y(!0);try{if(!e)throw Error(`No project path`);await H(e,O||t,V()),D({title:`Success`,description:s?`MCP server configuration saved`:`MCP server added`}),i()}catch(e){w(e instanceof Error?e.message:`Failed to save server`)}finally{y(!1)}},K=async()=>{if(e){x(!0);try{await U(e,O),D({title:`Success`,description:`MCP server removed`}),i()}catch(e){w(e instanceof Error?e.message:`Failed to delete server`)}finally{x(!1)}}},q=s?d!==A||p!==ee||JSON.stringify(h)!==JSON.stringify(N):c.trim()!==``||d.trim()!==``||p.trim()!==``||h.length>0;return T?(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading server configuration...`})}):(0,W.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,W.jsxs)(`div`,{className:`mb-6`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-bold`,children:s?c:`Add MCP Server`}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:s?`Edit MCP Server configuration.`:`Configure a new MCP Server.`})]}),(0,W.jsxs)(`div`,{className:`space-y-6`,children:[(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(a,{htmlFor:`server-name`,children:`Server name`}),(0,W.jsx)(l,{id:`server-name`,placeholder:`e.g. filesystem`,value:c,onChange:e=>u(e.target.value),disabled:s}),s&&(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Server name cannot be changed`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(a,{htmlFor:`server-command`,children:`Command`}),(0,W.jsx)(l,{id:`server-command`,placeholder:`e.g. npx`,value:d,onChange:e=>f(e.target.value),className:`text-sm`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(a,{htmlFor:`server-args`,children:[`Arguments `,(0,W.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(one per line)`})]}),(0,W.jsx)(S,{id:`server-args`,placeholder:`-y
4
4
  @modelcontextprotocol/server-filesystem
5
- /path/to/dir`,value:p,onChange:e=>m(e.target.value),className:`font-mono text-xs min-h-[80px] resize-none`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(n,{children:`Environment variables`}),(0,W.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:F,className:`h-6 px-2 text-xs`,children:[(0,W.jsx)(v,{className:`h-3 w-3 mr-1`}),`Add variable`]})]}),h.length===0?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground py-1`,children:`No environment variables configured`}):(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:h.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(r,{placeholder:`KEY`,value:e.key,onChange:e=>L(t,e.target.value),className:`font-mono text-xs w-[35%]`}),(0,W.jsx)(r,{placeholder:`value`,value:e.value,onChange:e=>R(t,e.target.value),className:`font-mono text-xs flex-1`}),(0,W.jsx)(l,{variant:`ghost`,size:`icon`,onClick:()=>I(t),className:`h-9 w-9 flex-shrink-0`,children:(0,W.jsx)(s,{className:`h-3.5 w-3.5`})})]},t))})]}),C&&(0,W.jsx)(`p`,{className:`text-sm text-destructive`,children:C}),(0,W.jsxs)(`div`,{className:`border-t pt-4 flex items-center justify-between`,children:[o&&(0,W.jsx)(l,{variant:`destructive`,onClick:K,disabled:b||_,children:b?`Removing...`:`Remove`}),!o&&(0,W.jsx)(`div`,{}),(0,W.jsx)(l,{onClick:G,disabled:_||b||!q,children:_?o?`Saving...`:`Adding...`:o?`Save`:`Add`})]})]})]})}function K(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function q(){let{state:e}=x(),{selectedProjectId:t,projects:n}=e,o=n.find(e=>e.projectId===t)?.projectPath,{installedServers:s,loadingConfig:c,loadInstalledServers:p}=B(o),{popularServers:m}=V(),{setActiveMainTab:v,setPendingExplorerPath:y,triggerExplorerRefresh:b}=F(),[S,R]=(0,z.useState)(!1),[q,J]=(0,z.useState)(null),[Y,X]=(0,z.useState)(null),[Z,Q]=(0,z.useState)(!1),[$,te]=(0,z.useState)(``),ne=(0,z.useCallback)(async e=>{if(o){Q(!0);try{await U(o,e),await p(),b(),D({title:`MCP server removed`,description:e}),X(null)}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{Q(!1)}}},[o,p,b]),re=(0,z.useCallback)(()=>{y(`.agents/mcp.json`),v(`explorer`)},[y,v]),ie=(0,z.useCallback)(async e=>{if(!o)return;let t=K(e);if(!s.some(n=>n.name===t||n.name===e.id))try{await H(o,t,{command:e.command,args:e.args,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await p(),b(),D({title:`MCP server installed`,description:e.name})}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}},[o,s,p,b]),ae=$.trim()?m.filter(e=>e.name.toLowerCase().includes($.toLowerCase())||e.description.toLowerCase().includes($.toLowerCase())):m;return t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,W.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h1`,{className:`text-2xl font-bold`,children:`MCP Servers`}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage Model Context Protocol servers for your project.`})]}),(0,W.jsx)(l,{onClick:()=>R(!0),children:`Add Server`})]}),(0,W.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed MCP Servers`}),c?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(I,{className:`h-20 w-full`}),(0,W.jsx)(I,{className:`h-20 w-full`})]}):s.length===0?(0,W.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,W.jsx)(f,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),(0,W.jsx)(`h3`,{className:`text-base font-semibold text-muted-foreground mb-1`,children:`No MCP servers installed`}),(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:`Add an MCP server to extend agent capabilities.`})]}):(0,W.jsx)(`div`,{className:`space-y-3 mb-8`,children:s.map(e=>(0,W.jsx)(h,{children:(0,W.jsxs)(_,{className:`flex items-center justify-between p-4`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(f,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,W.jsx)(`h3`,{className:`font-medium truncate`,children:e.name})]}),(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-1 truncate font-mono`,children:[e.config.command,` `,e.config.args?.join(` `)]})]}),(0,W.jsx)(w,{delayDuration:300,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:[(0,W.jsxs)(T,{children:[(0,W.jsx)(E,{asChild:!0,children:(0,W.jsx)(l,{variant:`ghost`,size:`icon-sm`,onClick:re,children:(0,W.jsx)(d,{className:`h-4 w-4`})})}),(0,W.jsx)(C,{children:`View config file`})]}),(0,W.jsxs)(T,{children:[(0,W.jsx)(E,{asChild:!0,children:(0,W.jsx)(l,{variant:`ghost`,size:`icon-sm`,onClick:()=>J(e.name),children:(0,W.jsx)(d,{className:`h-4 w-4`})})}),(0,W.jsx)(C,{children:`Edit server`})]}),(0,W.jsxs)(T,{children:[(0,W.jsx)(E,{asChild:!0,children:(0,W.jsx)(l,{variant:`ghost`,size:`icon-sm`,onClick:()=>X(e.name),children:(0,W.jsx)(a,{className:`h-4 w-4 text-destructive`})})}),(0,W.jsx)(C,{children:`Delete server`})]})]})})]})},e.name))}),(0,W.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,W.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Available MCP Servers`})}),(0,W.jsxs)(`div`,{className:`relative mb-4`,children:[(0,W.jsx)(u,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,W.jsx)(r,{placeholder:`Search available servers...`,value:$,onChange:e=>te(e.target.value),className:`pl-8`})]}),m.length===0?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(I,{className:`h-20 w-full`}),(0,W.jsx)(I,{className:`h-20 w-full`})]}):ae.length===0?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:$.trim()?`No results for "${$}"`:`No available servers found.`}):(0,W.jsx)(`div`,{className:`grid gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(220px,100%),1fr))]`,children:ae.map(e=>{let t=K(e),n=s.some(n=>n.name===t||n.name===e.id);return(0,W.jsx)(L,{name:e.name,description:e.description,installed:n,onClick:()=>{n||ie(e)},showInstalledControls:!1},e.id)})})]})}),(0,W.jsx)(g,{open:S,onOpenChange:R,children:(0,W.jsx)(i,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,W.jsx)(G,{projectPath:o,onBack:()=>{R(!1),p(),b()}})})}),(0,W.jsx)(g,{open:q!==null,onOpenChange:e=>{e||J(null)},children:(0,W.jsx)(i,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,W.jsx)(G,{projectPath:o,serverName:q??void 0,onBack:()=>{J(null),p(),b()}})})}),(0,W.jsx)(P,{open:Y!==null,onOpenChange:e=>!e&&X(null),children:(0,W.jsxs)(A,{children:[(0,W.jsxs)(N,{children:[(0,W.jsx)(k,{children:`Delete MCP Server`}),(0,W.jsxs)(O,{children:[`Are you sure you want to delete the server "`,Y,`"? This action cannot be undone.`]})]}),(0,W.jsxs)(j,{children:[(0,W.jsx)(M,{children:`Cancel`}),(0,W.jsx)(ee,{onClick:()=>Y&&void ne(Y),disabled:Z,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:Z?`Deleting...`:`Delete`})]})]})})]}):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a project to manage MCP servers.`})})}export{q as SettingsMCPServersView,q as default};
5
+ /path/to/dir`,value:p,onChange:e=>m(e.target.value),className:`font-mono text-xs min-h-[80px] resize-none`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(a,{children:`Environment variables`}),(0,W.jsxs)(n,{variant:`ghost`,size:`sm`,onClick:F,className:`h-6 px-2 text-xs`,children:[(0,W.jsx)(v,{className:`h-3 w-3 mr-1`}),`Add variable`]})]}),h.length===0?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground py-1`,children:`No environment variables configured`}):(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:h.map((e,r)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(l,{placeholder:`KEY`,value:e.key,onChange:e=>L(r,e.target.value),className:`font-mono text-xs w-[35%]`}),(0,W.jsx)(l,{placeholder:`value`,value:e.value,onChange:e=>R(r,e.target.value),className:`font-mono text-xs flex-1`}),(0,W.jsx)(n,{variant:`ghost`,size:`icon`,onClick:()=>I(r),className:`h-9 w-9 flex-shrink-0`,children:(0,W.jsx)(t,{className:`h-3.5 w-3.5`})})]},r))})]}),C&&(0,W.jsx)(`p`,{className:`text-sm text-destructive`,children:C}),(0,W.jsxs)(`div`,{className:`border-t pt-4 flex items-center justify-between`,children:[s&&(0,W.jsx)(n,{variant:`destructive`,onClick:K,disabled:b||_,children:b?`Removing...`:`Remove`}),!s&&(0,W.jsx)(`div`,{}),(0,W.jsx)(n,{onClick:G,disabled:_||b||!q,children:_?s?`Saving...`:`Adding...`:s?`Save`:`Add`})]})]})]})}function K(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function q(){let{state:e}=x(),{selectedProjectId:t,projects:r}=e,a=r.find(e=>e.projectId===t)?.projectPath,{installedServers:s,loadingConfig:c,loadInstalledServers:u}=B(a),{popularServers:f}=V(),{setActiveMainTab:v,setPendingExplorerPath:y,triggerExplorerRefresh:b}=F(),[S,R]=(0,z.useState)(!1),[q,J]=(0,z.useState)(null),[Y,X]=(0,z.useState)(null),[Z,Q]=(0,z.useState)(!1),[$,te]=(0,z.useState)(``),ne=(0,z.useCallback)(async e=>{if(a){Q(!0);try{await U(a,e),await u(),b(),D({title:`MCP server removed`,description:e}),X(null)}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{Q(!1)}}},[a,u,b]),re=(0,z.useCallback)(()=>{y(`.agents/mcp.json`),v(`explorer`)},[y,v]),ie=(0,z.useCallback)(async e=>{if(!a)return;let t=K(e);if(!s.some(n=>n.name===t||n.name===e.id))try{await H(a,t,{command:e.command,args:e.args,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await u(),b(),D({title:`MCP server installed`,description:e.name})}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}},[a,s,u,b]),ae=$.trim()?f.filter(e=>e.name.toLowerCase().includes($.toLowerCase())||e.description.toLowerCase().includes($.toLowerCase())):f;return t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,W.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h1`,{className:`text-2xl font-bold`,children:`MCP Servers`}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage Model Context Protocol servers for your project.`})]}),(0,W.jsx)(n,{onClick:()=>R(!0),children:`Add Server`})]}),(0,W.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed MCP Servers`}),c?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(I,{className:`h-20 w-full`}),(0,W.jsx)(I,{className:`h-20 w-full`})]}):s.length===0?(0,W.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,W.jsx)(m,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),(0,W.jsx)(`h3`,{className:`text-base font-semibold text-muted-foreground mb-1`,children:`No MCP servers installed`}),(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:`Add an MCP server to extend agent capabilities.`})]}):(0,W.jsx)(`div`,{className:`space-y-3 mb-8`,children:s.map(e=>(0,W.jsx)(h,{children:(0,W.jsxs)(_,{className:`flex items-center justify-between p-4`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(m,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,W.jsx)(`h3`,{className:`font-medium truncate`,children:e.name})]}),(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-1 truncate font-mono`,children:[e.config.command,` `,e.config.args?.join(` `)]})]}),(0,W.jsx)(w,{delayDuration:300,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:[(0,W.jsxs)(T,{children:[(0,W.jsx)(E,{asChild:!0,children:(0,W.jsx)(n,{variant:`ghost`,size:`icon-sm`,onClick:re,children:(0,W.jsx)(p,{className:`h-4 w-4`})})}),(0,W.jsx)(C,{children:`View config file`})]}),(0,W.jsxs)(T,{children:[(0,W.jsx)(E,{asChild:!0,children:(0,W.jsx)(n,{variant:`ghost`,size:`icon-sm`,onClick:()=>J(e.name),children:(0,W.jsx)(p,{className:`h-4 w-4`})})}),(0,W.jsx)(C,{children:`Edit server`})]}),(0,W.jsxs)(T,{children:[(0,W.jsx)(E,{asChild:!0,children:(0,W.jsx)(n,{variant:`ghost`,size:`icon-sm`,onClick:()=>X(e.name),children:(0,W.jsx)(g,{className:`h-4 w-4 text-destructive`})})}),(0,W.jsx)(C,{children:`Delete server`})]})]})})]})},e.name))}),(0,W.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,W.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Available MCP Servers`})}),(0,W.jsxs)(`div`,{className:`relative mb-4`,children:[(0,W.jsx)(d,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,W.jsx)(l,{placeholder:`Search available servers...`,value:$,onChange:e=>te(e.target.value),className:`pl-8`})]}),f.length===0?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(I,{className:`h-20 w-full`}),(0,W.jsx)(I,{className:`h-20 w-full`})]}):ae.length===0?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:$.trim()?`No results for "${$}"`:`No available servers found.`}):(0,W.jsx)(`div`,{className:`grid gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(220px,100%),1fr))]`,children:ae.map(e=>{let t=K(e),n=s.some(n=>n.name===t||n.name===e.id);return(0,W.jsx)(L,{name:e.name,description:e.description,installed:n,onClick:()=>{n||ie(e)},showInstalledControls:!1},e.id)})})]})}),(0,W.jsx)(i,{open:S,onOpenChange:R,children:(0,W.jsx)(o,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,W.jsx)(G,{projectPath:a,onBack:()=>{R(!1),u(),b()}})})}),(0,W.jsx)(i,{open:q!==null,onOpenChange:e=>{e||J(null)},children:(0,W.jsx)(o,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,W.jsx)(G,{projectPath:a,serverName:q??void 0,onBack:()=>{J(null),u(),b()}})})}),(0,W.jsx)(P,{open:Y!==null,onOpenChange:e=>!e&&X(null),children:(0,W.jsxs)(A,{children:[(0,W.jsxs)(N,{children:[(0,W.jsx)(k,{children:`Delete MCP Server`}),(0,W.jsxs)(O,{children:[`Are you sure you want to delete the server "`,Y,`"? This action cannot be undone.`]})]}),(0,W.jsxs)(ee,{children:[(0,W.jsx)(M,{children:`Cancel`}),(0,W.jsx)(j,{onClick:()=>Y&&void ne(Y),disabled:Z,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:Z?`Deleting...`:`Delete`})]})]})})]}):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a project to manage MCP servers.`})})}export{q as SettingsMCPServersView,q as default};
@@ -0,0 +1 @@
1
+ import{Fr as e,_a as t}from"./dialogs-config-VlhyoYms.js";import{t as n}from"./skeleton-B1fuNMHm.js";var r=t(),i=e();function a(){let e=(0,r.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsxs)(`div`,{className:`mb-6`,children:[(0,i.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,i.jsx)(`div`,{className:`h-4 w-80 bg-muted rounded animate-pulse`})]}),e[0]=t):t=e[0];let a,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,i.jsx)(n,{className:`h-10 w-full`}),s=(0,i.jsx)(n,{className:`h-9 w-48`}),e[1]=a,e[2]=s):(a=e[1],s=e[2]);let c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,i.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,i.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[t,(0,i.jsxs)(`div`,{className:`space-y-6`,children:[a,s,(0,i.jsx)(`div`,{className:`space-y-6`,children:[1,2].map(o)})]})]})}),e[3]=c):c=e[3],c}function o(e){return(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,i.jsx)(n,{className:`h-8 w-8 rounded-full`}),(0,i.jsx)(n,{className:`h-6 w-36`})]}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,i.jsx)(n,{className:`h-5 w-32`}),(0,i.jsx)(n,{className:`h-8 w-28`})]}),(0,i.jsx)(`div`,{className:`border border-border rounded-md overflow-hidden`,children:[1,2,3,4,5].map(s)})]},e)}function s(e){return(0,i.jsxs)(`div`,{className:`flex items-center gap-3 p-3 border-b border-border last:border-b-0`,children:[(0,i.jsx)(n,{className:`h-4 w-4 rounded-sm`}),(0,i.jsx)(n,{className:`h-4 flex-1 max-w-xs`}),(0,i.jsx)(n,{className:`h-3 w-24`})]},e)}export{a as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,Er as n,Fr as r,Mt as i,Nt as a,Q as o,Qr as s,Ti as c,Wn as ee,X as l,Yi as u,Z as d,ai as f,et as p,ga as m,kr as h,tt as g,ya as _,zn as v}from"./dialogs-config-VlhyoYms.js";import{c as y,l as b,s as x,u as S}from"./history-view-Cub-F9g6.js";import{o as C,s as te}from"./onboarding-BPUo1aJX.js";import{i as w,n as T,r as ne,t as re}from"./tabs-ywSKq3qp.js";import{t as ie}from"./settings-models-skeleton-qdDMv5hS.js";var E=e(_(),1),D=r();function O(){let[e,r]=(0,E.useState)([]),[_,O]=(0,E.useState)({}),[k,A]=(0,E.useState)({}),[j,M]=(0,E.useState)({}),[N,P]=(0,E.useState)({}),[F,I]=(0,E.useState)(!0),[L,R]=(0,E.useState)(!1),[z,B]=(0,E.useState)(``),[V,H]=(0,E.useState)(`coding`),U=(0,E.useRef)(!1),[W,G]=(0,E.useState)(``),[K,q]=(0,E.useState)({}),[J,Y]=(0,E.useState)(``),X=e=>te(e.id);(0,E.useEffect)(()=>{(async()=>{I(!0),B(``);try{let e=(await a()).filter(e=>e.apiKey);r(e);let t={};e.forEach(e=>{t[e.slug]=`alphabetical`}),q(t);let n={},i={};await Promise.all(e.map(async e=>{try{let t=await g(e.slug);n[e.slug]=t.models,i[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load models for ${e.slug}:`,t),n[e.slug]=[],i[e.slug]=new Set}})),O(n),M(i)}catch(e){B(e instanceof Error?e.message:`Failed to load models`)}finally{I(!1)}})()},[]),(0,E.useEffect)(()=>{if(V!==`image`||U.current||e.length===0)return;let t=e.filter(e=>e.name.toLowerCase()===`openrouter`);if(t.length===0){U.current=!0;return}(async()=>{R(!0);try{let e={},n={};await Promise.all(t.map(async t=>{try{let r=await p(t.slug);e[t.slug]=r.models,n[t.slug]=new Set(r.enabledModelIds)}catch(r){console.error(`Failed to load image models for ${t.slug}:`,r),e[t.slug]=[],n[t.slug]=new Set}})),A(e),P(n),U.current=!0}finally{R(!1)}})()},[V,e]);let Z=async(e,n,r)=>{try{r===`image`?N[e]?.has(n)?(await l(e,n),P(t=>{let r=new Set(t[e]??[]);return r.delete(n),{...t,[e]:r}})):(await o(e,n),P(t=>({...t,[e]:new Set([...t[e]||[],n])}))):j[e]?.has(n)?(await d(e,n),M(t=>{let r=new Set(t[e]??[]);return r.delete(n),{...t,[e]:r}})):(await t(e,n),M(t=>({...t,[e]:new Set([...t[e]||[],n])}))),Y(`Model preferences saved successfully`),setTimeout(()=>Y(``),3e3)}catch(e){Y(e instanceof Error?e.message:`Failed to save model changes`)}},Q=async(e,t,n)=>{let r=n===`image`?k[e]:_[e],i=n===`image`?N[e]:j[e];if(r)for(let a of r)i?.has(a.id)!==t&&await Z(e,a.id,n)},ae=e=>e?e<20?1:e<30?2:e<40?3:e<50?4:5:0,oe=({codingIndex:e,modelName:t})=>{let n=ae(e);return n===0?null:(0,D.jsx)(b,{children:(0,D.jsxs)(x,{children:[(0,D.jsx)(S,{asChild:!0,children:(0,D.jsx)(`div`,{className:`flex items-center gap-0.5`,children:[1,2,3,4,5].map(e=>(0,D.jsx)(s,{className:`h-3 w-3 ${e<=n?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),(0,D.jsx)(y,{children:(0,D.jsxs)(`p`,{className:`text-sm`,children:[t,` was indexed `,e,` for coding intelligence`]})})]})})},$=(e,t,n)=>{let r=W.toLowerCase();return e.filter(e=>{let t=X(e);return e.name.toLowerCase().includes(r)||e.id.toLowerCase().includes(r)||t.toLowerCase().includes(r)}).sort((e,r)=>{let i=+!t.has(e.id),a=+!t.has(r.id);if(i!==a)return i-a;if(n===`price-low`){let t=!!e.pricing;return t===!!r.pricing?!e.pricing||!r.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((r.pricing.prompt??0)+(r.pricing.completion??0))/2:t?-1:1}if(n===`price-high`){let t=!!e.pricing;if(t!==!!r.pricing)return t?-1:1;if(!e.pricing||!r.pricing)return 0;let n=((e.pricing.prompt??0)+(e.pricing.completion??0))/2;return((r.pricing.prompt??0)+(r.pricing.completion??0))/2-n}if(n===`coding-index`){let t=e.coding_index!==void 0&&e.coding_index!==null;return t===(r.coding_index!==void 0&&r.coding_index!==null)?e.coding_index==null||r.coding_index==null?0:r.coding_index-e.coding_index:t?-1:1}return X(e).localeCompare(X(r))})};return F?(0,D.jsx)(ie,{}):z?(0,D.jsx)(`div`,{className:`flex flex-1 items-center justify-center h-full`,children:(0,D.jsxs)(`div`,{className:`text-center`,children:[(0,D.jsx)(`p`,{className:`text-sm text-destructive mb-2`,children:z}),(0,D.jsx)(n,{variant:`outline`,size:`sm`,onClick:()=>window.location.reload(),children:`Retry`})]})}):e.length===0?(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,D.jsxs)(`div`,{className:`text-center`,children:[(0,D.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Providers Configured`}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Configure a provider with an API key to view available models.`})]})}):(0,D.jsx)(v,{className:`flex-1`,children:(0,D.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,D.jsxs)(`div`,{className:`mb-6`,children:[(0,D.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Models`}),(0,D.jsx)(`p`,{className:`text-muted-foreground`,children:`View and manage available models from your configured providers.`})]}),(0,D.jsxs)(`div`,{className:`space-y-6`,children:[(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(f,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,D.jsx)(ee,{placeholder:`Search models across all providers...`,className:`pl-10`,value:W,onChange:e=>G(e.target.value)})]}),(0,D.jsxs)(re,{value:V,onValueChange:e=>{H(e),G(``)},children:[(0,D.jsxs)(ne,{className:`mb-4`,children:[(0,D.jsx)(w,{value:`coding`,children:`Coding`}),e.some(e=>e.name.toLowerCase()===`openrouter`)&&(0,D.jsx)(w,{value:`image`,children:`Image`})]}),(0,D.jsx)(T,{value:`coding`,children:(0,D.jsx)(`div`,{className:`space-y-6`,children:e.map(e=>{let t=_[e.slug]||[],r=j[e.slug]||new Set,a=K[e.slug]||`alphabetical`,o=$(t,r,a);return o.length===0&&W?null:(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,D.jsx)(`img`,{src:i(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,D.jsx)(`h3`,{className:`text-lg font-semibold`,children:e.name})]}),o.length>0&&(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(C,{id:`select-all-${e.slug}`,checked:o.every(e=>r.has(e.id)),onCheckedChange:t=>Q(e.slug,t===!0,`coding`)}),(0,D.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:`text-sm cursor-pointer whitespace-nowrap`,children:`Select all models`})]}),(0,D.jsx)(b,{children:(0,D.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,D.jsxs)(x,{children:[(0,D.jsx)(S,{asChild:!0,children:(0,D.jsx)(n,{type:`button`,variant:a===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>q(t=>({...t,[e.slug]:`alphabetical`})),children:(0,D.jsx)(m,{className:`h-4 w-4`})})}),(0,D.jsx)(y,{children:`Sort A–Z`})]}),(0,D.jsxs)(x,{children:[(0,D.jsx)(S,{asChild:!0,children:(0,D.jsx)(n,{type:`button`,variant:a===`price-low`||a===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>q(t=>({...t,[e.slug]:`price-low`})),children:(0,D.jsx)(u,{className:`h-4 w-4`})})}),(0,D.jsx)(y,{children:`Sort by price`})]}),(0,D.jsxs)(x,{children:[(0,D.jsx)(S,{asChild:!0,children:(0,D.jsx)(n,{type:`button`,variant:a===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>q(t=>({...t,[e.slug]:`coding-index`})),children:(0,D.jsx)(s,{className:`h-4 w-4`})})}),(0,D.jsx)(y,{children:`Sort by coding intelligence`})]})]})})]}),o.length===0?(0,D.jsx)(`div`,{className:`text-center py-4 border border-border rounded-md`,children:(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:W?`No models matching your search.`:`No models available for this provider.`})}):(0,D.jsx)(b,{children:(0,D.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:o.map(t=>{let n=r.has(t.id),i=t.pricing;return(0,D.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,children:[(0,D.jsx)(C,{id:t.id,checked:n,onCheckedChange:()=>Z(e.slug,t.id,`coding`),className:`mt-0`}),(0,D.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,D.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,D.jsx)(`label`,{htmlFor:t.id,className:`text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`,children:X(t)})}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[a===`coding-index`&&(0,D.jsx)(oe,{codingIndex:t.coding_index,modelName:X(t)}),i&&(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:(i.prompt??0)===0&&(i.completion??0)===0?``:`$${h(i.prompt??0)} in | $${h(i.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,D.jsx)(T,{value:`image`,children:L?(0,D.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,D.jsx)(c,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):(0,D.jsx)(`div`,{className:`space-y-6`,children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let t=k[e.slug]||[],r=N[e.slug]||new Set,a=K[e.slug]||`alphabetical`,o=$(t,r,a);return o.length===0&&W?null:(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,D.jsx)(`img`,{src:i(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,D.jsx)(`h3`,{className:`text-lg font-semibold`,children:e.name})]}),o.length>0&&(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(C,{id:`select-all-image-${e.slug}`,checked:o.every(e=>r.has(e.id)),onCheckedChange:t=>Q(e.slug,t===!0,`image`)}),(0,D.jsx)(`label`,{htmlFor:`select-all-image-${e.slug}`,className:`text-sm cursor-pointer whitespace-nowrap`,children:`Select all models`})]}),(0,D.jsx)(b,{children:(0,D.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,D.jsxs)(x,{children:[(0,D.jsx)(S,{asChild:!0,children:(0,D.jsx)(n,{type:`button`,variant:a===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>q(t=>({...t,[e.slug]:`alphabetical`})),children:(0,D.jsx)(m,{className:`h-4 w-4`})})}),(0,D.jsx)(y,{children:`Sort A–Z`})]}),(0,D.jsxs)(x,{children:[(0,D.jsx)(S,{asChild:!0,children:(0,D.jsx)(n,{type:`button`,variant:a===`price-low`||a===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>q(t=>({...t,[e.slug]:`price-low`})),children:(0,D.jsx)(u,{className:`h-4 w-4`})})}),(0,D.jsx)(y,{children:`Sort by price`})]})]})})]}),o.length===0?(0,D.jsx)(`div`,{className:`text-center py-4 border border-border rounded-md`,children:(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:W?`No models matching your search.`:`No image models available for this provider.`})}):(0,D.jsx)(b,{children:(0,D.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:o.map(t=>{let n=r.has(t.id),i=t.pricing;return(0,D.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,children:[(0,D.jsx)(C,{id:`image-${t.id}`,checked:n,onCheckedChange:()=>Z(e.slug,t.id,`image`),className:`mt-0`}),(0,D.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,D.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,D.jsx)(`label`,{htmlFor:`image-${t.id}`,className:`text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`,children:X(t)})}),i&&(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap flex-shrink-0`,children:(i.prompt??0)===0&&(i.completion??0)===0?``:`$${h(i.prompt??0)} in | $${h(i.completion??0)} out`})]})]},t.id)})})})]},e.slug)})})})]}),J&&(0,D.jsx)(`div`,{className:`text-sm p-2 rounded-md ${J.includes(`error`)||J.includes(`Failed`)?`text-destructive bg-destructive/10`:`text-green-600 bg-green-50`}`,children:J})]})]})})}export{O as SettingsModelsView,O as default};
@@ -0,0 +1,8 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ct as t,Er as n,Fr as r,Gn as i,Hn as a,K as o,Kn as s,Or as c,Ot as l,Rt as u,Ti as d,Ui as f,Wn as p,Y as m,Zt as h,_a as g,ai as _,mn as v,n as y,oa as b,oi as x,qr as S,r as ee,ya as C}from"./dialogs-config-VlhyoYms.js";import{n as w,r as T}from"./react-vendor-CtZx3FWA.js";import{a as E}from"./store-DUqJt-K-.js";import{t as D}from"./textarea-DuuNwegn.js";import{t as O}from"./use-toast-BF5WtiOJ.js";import{a as k,c as A,i as j,n as M,o as N,r as te,s as ne,t as re}from"./alert-dialog-DAJFcjdR.js";import{n as P}from"./tab-context-BYpxvaoz.js";import{t as F}from"./skeleton-B1fuNMHm.js";import{t as I}from"./mcp-server-card-BCZmpcVY.js";import{n as L,t as R}from"./radio-group-CRwVSJCp.js";var z=g(),B=e(C(),1),V=r(),H=B.forwardRef((e,t)=>{let n=(0,z.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=c(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,V.jsx)(T,{className:c(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,V.jsx)(w,{className:a,...i,ref:t,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});H.displayName=w.displayName;function U({threadId:e,onRuleCreated:t}){let[r,i]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1),[u,f]=(0,B.useState)(`local`),[m,h]=(0,B.useState)(!1),g=r.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),_=g.length>0&&g.length<=64;return e?(0,V.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,V.jsxs)(`div`,{className:`mb-6`,children:[(0,V.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Rule`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new agent rule. The rule will be saved as a .md file in the .agents/rules folder.`})]}),(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(a,{htmlFor:`ruleName`,children:`Rule Name`}),(0,V.jsx)(p,{id:`ruleName`,value:r,onChange:e=>i(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:m}),r&&(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`File name: `,(0,V.jsxs)(`span`,{className:`font-mono`,children:[g||`...`,`.md`]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(a,{htmlFor:`ruleDescription`,children:`Description`}),(0,V.jsx)(D,{id:`ruleDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:m})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(a,{htmlFor:`alwaysApply`,children:`Always Apply`}),(0,V.jsx)(H,{id:`alwaysApply`,checked:c,onCheckedChange:l,disabled:m})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c?`This rule will be automatically added to context for all conversations.`:`Only the rule description will be added to context, allowing the agent to read the rule file when needed.`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(a,{children:`Scope`}),(0,V.jsxs)(R,{value:u,onValueChange:e=>f(e),className:`flex gap-4`,disabled:m,children:[(0,V.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,V.jsx)(L,{value:`local`,id:`scope-local`}),(0,V.jsx)(a,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,V.jsx)(L,{value:`global`,id:`scope-global`,disabled:!0}),(0,V.jsx)(a,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u===`local`?`This rule will only be available for this project.`:`This rule will be available across all projects (coming soon).`})]}),(0,V.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,V.jsx)(n,{onClick:async()=>{if(!(!_||!e)){h(!0);try{let n=`---
2
+ description: ${o.trim()}
3
+ alwaysApply: ${c}
4
+ ---
5
+
6
+ Place your rule instructions here as markdown.
7
+ `;await v(e,`.agents/rules/${g}.md`,n),O({title:`Rule created`,description:`Rule '${g}' was created successfully.`}),i(``),s(``),l(!1),f(`local`),t?.(g)}catch(e){O({title:`Error`,description:e instanceof Error?e.message:`Failed to create rule`,variant:`destructive`})}finally{h(!1)}}},disabled:!_||!o.trim()||m,children:m?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(d,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,V.jsxs)(V.Fragment,{children:[`Continue`,(0,V.jsx)(b,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,V.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Thread Selected`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a thread to add a rule.`})]})})}function W(e){let t=[];for(let n of e)n.type===`file`&&n.path.startsWith(`.agents/rules/`)&&t.push(n),n.children&&n.children.length>0&&t.push(...W(n.children));return t}function G(){let{state:e}=E(),{selectedProjectId:r,selectedThreadId:a}=e,{setActiveMainTab:c,setPendingExplorerPath:d,triggerExplorerRefresh:g,setExplorerClearPath:b}=P(),[C,w]=(0,B.useState)([]),[T,D]=(0,B.useState)(!1),[L,R]=(0,B.useState)(!1),[z,H]=(0,B.useState)(null),[G,K]=(0,B.useState)(!1),[q,J]=(0,B.useState)([]),[Y,X]=(0,B.useState)(new Set),[Z,ie]=(0,B.useState)(``),Q=(0,B.useCallback)(async()=>{if(r){D(!0);try{let e=W(await l(r));if(a)try{let t=W(await u(a)),n=new Set(e.map(e=>e.path));for(let r of t)n.has(r.path)||e.push(r)}catch{}w(e),X(new Set(e.map(e=>e.path)))}catch{w([]),X(new Set)}finally{D(!1)}}},[r,a]);(0,B.useEffect)(()=>{Q()},[Q]),(0,B.useEffect)(()=>{t().then(J).catch(()=>J([]))},[]);let ae=(0,B.useCallback)(async e=>{if(!r)return;let t=e.name,n=e.path;K(!0);try{try{await o(r,n)}catch{if(a)await m(a,n);else throw Error(`No thread selected to delete from`)}b(n),g(),X(e=>{let t=new Set(e);return t.delete(n),t}),O({title:`Rule removed`,description:t}),H(null),await Q()}catch(e){O({title:`Error`,description:e instanceof Error?e.message:`Failed to remove rule`,variant:`destructive`})}finally{K(!1)}},[r,a,Q,g,b]),oe=(0,B.useCallback)(e=>{d(e),c(`explorer`)},[d,c]),se=(0,B.useCallback)(async e=>{let t=`.agents/rules/${e.name}.md`;if(!(!a||Y.has(t)))try{e.gitHubRepo&&e.gitHubFolder?await h(a,e.gitHubRepo,e.gitHubFolder,`.agents/rules`):await v(a,t,[`---`,`description: ${e.description}`,`alwaysApply: ${e.alwaysApply??!1}`,`---`,``,e.content].join(`
8
+ `)),X(e=>new Set(e).add(t)),g(),Q(),O({title:`Rule installed`,description:e.name})}catch(e){O({title:`Error`,description:e instanceof Error?e.message:`Failed to install rule`,variant:`destructive`})}},[a,Y,g,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return r?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Rules`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage agent rules. Rules define coding standards and project-wide guidelines.`})]}),(0,V.jsx)(n,{onClick:()=>R(!0),disabled:!a,children:`Add Rule`})]}),!a&&(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to add rules to your project.`}),(0,V.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed Rules`}),T?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(F,{className:`h-20 w-full`}),(0,V.jsx)(F,{className:`h-20 w-full`})]}):C.length===0?(0,V.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,V.jsx)(x,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),(0,V.jsx)(`h3`,{className:`text-base font-semibold text-muted-foreground mb-1`,children:`No rules installed`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:`Add rules to enforce coding standards and project conventions.`})]}):(0,V.jsx)(`div`,{className:`space-y-3 mb-8`,children:C.map(e=>(0,V.jsx)(y,{children:(0,V.jsxs)(ee,{className:`flex items-center justify-between p-4`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(x,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,V.jsx)(`h3`,{className:`font-medium truncate`,children:e.name})]}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 truncate font-mono`,children:e.path})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:[(0,V.jsx)(n,{variant:`ghost`,size:`icon-sm`,onClick:()=>oe(e.path),title:`View in explorer`,children:(0,V.jsx)(f,{className:`h-4 w-4`})}),(0,V.jsx)(n,{variant:`ghost`,size:`icon-sm`,onClick:()=>H(e),title:`Delete rule`,children:(0,V.jsx)(S,{className:`h-4 w-4 text-destructive`})})]})]})},e.id))}),(0,V.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Available Rules`})}),!a&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to install rules into your project.`}),(0,V.jsxs)(`div`,{className:`relative mb-4`,children:[(0,V.jsx)(_,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,V.jsx)(p,{placeholder:`Search available rules...`,value:Z,onChange:e=>ie(e.target.value),className:`pl-8`})]}),q.length===0?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(F,{className:`h-20 w-full`}),(0,V.jsx)(F,{className:`h-20 w-full`})]}):$.length===0?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:Z.trim()?`No results for "${Z}"`:`No available rules found.`}):(0,V.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(220px, 100%), 1fr))`},children:$.map(e=>{let t=`.agents/rules/${e.name}.md`,n=Y.has(t);return(0,V.jsx)(I,{name:e.name,description:e.description,installed:n,onClick:()=>{n||se(e)},showInstalledControls:!1},e.id)})})]})}),(0,V.jsx)(i,{open:L,onOpenChange:R,children:(0,V.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,V.jsx)(U,{threadId:a,onRuleCreated:()=>{R(!1),Q(),g()}})})}),(0,V.jsx)(re,{open:z!==null,onOpenChange:e=>!e&&H(null),children:(0,V.jsxs)(j,{children:[(0,V.jsxs)(ne,{children:[(0,V.jsx)(A,{children:`Delete Rule`}),(0,V.jsxs)(k,{children:[`Are you sure you want to delete the rule "`,z?.name,`"? This action cannot be undone.`]})]}),(0,V.jsxs)(N,{children:[(0,V.jsx)(te,{children:`Cancel`}),(0,V.jsx)(M,{onClick:()=>z&&void ae(z),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,V.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a project to manage rules.`})})}export{G as SettingsRulesView,G as default};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bn as t,Br as n,Di as r,Ft as i,G as a,H as o,Hn as s,Jn as c,Ki as l,Kr as u,Mr as d,R as f,Tt as p,Un as m,Yt as h,ai as g,fn as _,n as v,qn as y,r as b,ua as x,wa as S,xt as C}from"./dialogs-config-B91VQpxo.js";import{a as w}from"./store-D28g9VUj.js";import{t as T}from"./textarea-Bp3p1-25.js";import{t as E}from"./use-toast-BZ79E_dX.js";import{a as D,c as O,i as k,n as A,o as ee,r as te,s as ne,t as re}from"./alert-dialog-BFhUZsPe.js";import{n as j}from"./tab-context-C3z7YU59.js";import{t as M}from"./skeleton-CXoVAzC1.js";import{t as N}from"./mcp-server-card-BSw_FlEC.js";import{n as P,t as F}from"./radio-group-CM_Wwam0.js";var I=e(S(),1),L=d();function R({threadId:e,onSkillCreated:n}){let[i,a]=(0,I.useState)(``),[o,c]=(0,I.useState)(``),[l,u]=(0,I.useState)(`local`),[d,p]=(0,I.useState)(!1),h=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),g=h.length>0&&h.length<=64;return e?(0,L.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,L.jsxs)(`div`,{className:`mb-6`,children:[(0,L.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Skill`}),(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new agent skill. The skill will be saved as a SKILL.md file in the .agents/skills folder.`})]}),(0,L.jsxs)(`div`,{className:`space-y-6`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(t,{htmlFor:`skillName`,children:`Skill Name`}),(0,L.jsx)(s,{id:`skillName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Code Review`,disabled:d}),i&&(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Folder name: `,(0,L.jsx)(`span`,{className:`font-mono`,children:h||`...`})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(t,{htmlFor:`skillDescription`,children:`Description`}),(0,L.jsx)(T,{id:`skillDescription`,value:o,onChange:e=>c(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:d})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(t,{children:`Scope`}),(0,L.jsxs)(F,{value:l,onValueChange:e=>u(e),className:`flex gap-4`,disabled:d,children:[(0,L.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,L.jsx)(P,{value:`local`,id:`scope-local`}),(0,L.jsx)(t,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,L.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,L.jsx)(P,{value:`global`,id:`scope-global`,disabled:!0}),(0,L.jsx)(t,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l===`local`?`This skill will only be available for this project.`:`This skill will be available across all projects (coming soon).`})]}),(0,L.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,L.jsx)(m,{onClick:async()=>{if(!(!g||!o.trim()||!e)){p(!0);try{let t=await f(e,h,o.trim());E({title:`Skill created`,description:`Skill '${h}' was created successfully.`}),a(``),c(``),u(`local`),n?.(t.path,`SKILL.md`)}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{p(!1)}}},disabled:!g||!o.trim()||d,children:d?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(r,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,L.jsxs)(L.Fragment,{children:[`Continue`,(0,L.jsx)(x,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Thread Selected`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a thread to add a skill.`})]})})}function z(e){let t=[];for(let n of e)n.path.startsWith(`.agents/skills/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...z(n.children));return t}function B(){let{state:e}=w(),{selectedProjectId:t,selectedThreadId:r}=e,{setActiveMainTab:d,setPendingExplorerPath:f,triggerExplorerRefresh:x,setExplorerClearPath:S}=j(),[T,P]=(0,I.useState)([]),[F,B]=(0,I.useState)(!1),[V,H]=(0,I.useState)(!1),[U,W]=(0,I.useState)(null),[G,K]=(0,I.useState)(!1),[q,J]=(0,I.useState)([]),[Y,X]=(0,I.useState)(new Set),[Z,ie]=(0,I.useState)(``),Q=(0,I.useCallback)(async()=>{if(t){B(!0);try{let e=z(await p(t));if(r)try{let t=z(await i(r)),n=new Set(e.map(e=>e.path));for(let r of t)n.has(r.path)||e.push(r)}catch{}P(e),X(new Set(e.map(e=>`${e.path}/SKILL.md`)))}catch{P([]),X(new Set)}finally{B(!1)}}},[t,r]);(0,I.useEffect)(()=>{Q()},[Q]),(0,I.useEffect)(()=>{C().then(J).catch(()=>J([]))},[]);let ae=(0,I.useCallback)(async e=>{if(!t)return;let n=e.name,i=e.path;K(!0);try{try{await o(t,i)}catch{if(r)await a(r,i);else throw Error(`No thread selected to delete from`)}S(i),x(),X(e=>{let t=new Set(e);return t.delete(`${i}/SKILL.md`),t}),E({title:`Skill removed`,description:n}),W(null),await Q()}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to remove skill`,variant:`destructive`})}finally{K(!1)}},[t,r,Q,x,S]),oe=(0,I.useCallback)(e=>{f(`${e}/SKILL.md`),d(`explorer`)},[f,d]),se=(0,I.useCallback)(async e=>{let t=`.agents/skills/${e.id}/SKILL.md`;if(!(!r||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await h(r,e.gitHubRepo,e.gitHubFolder,`.agents/skills/${e.id}`);else{let n=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&n.push(`allowed-tools: ${e.allowedTools}`),e.license&&n.push(`license: ${e.license}`),n.push(`---`,``,e.instructions),await _(r,t,n.join(`
2
- `))}X(e=>new Set(e).add(t)),x(),Q(),E({title:`Skill installed`,description:e.name})}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`})}},[r,Y,x,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,L.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Skills`}),(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage agent skills. Skills are reusable instruction sets that guide agent behavior.`})]}),(0,L.jsx)(m,{onClick:()=>H(!0),disabled:!r,children:`Add Skill`})]}),!r&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to add skills to your project.`}),(0,L.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed Skills`}),F?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(M,{className:`h-20 w-full`}),(0,L.jsx)(M,{className:`h-20 w-full`})]}):T.length===0?(0,L.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,L.jsx)(n,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),(0,L.jsx)(`h3`,{className:`text-base font-semibold text-muted-foreground mb-1`,children:`No skills installed`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:`Add skills to extend agent capabilities with reusable instructions.`})]}):(0,L.jsx)(`div`,{className:`space-y-3 mb-8`,children:T.map(e=>(0,L.jsx)(v,{children:(0,L.jsxs)(b,{className:`flex items-center justify-between p-4`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(n,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,L.jsx)(`h3`,{className:`font-medium truncate`,children:e.name})]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 truncate font-mono`,children:e.path})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:[(0,L.jsx)(m,{variant:`ghost`,size:`icon-sm`,onClick:()=>oe(e.path),title:`View in explorer`,children:(0,L.jsx)(l,{className:`h-4 w-4`})}),(0,L.jsx)(m,{variant:`ghost`,size:`icon-sm`,onClick:()=>W(e),title:`Delete skill`,children:(0,L.jsx)(u,{className:`h-4 w-4 text-destructive`})})]})]})},e.id))}),(0,L.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Available Skills`})}),!r&&(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to install skills into your project.`}),(0,L.jsxs)(`div`,{className:`relative mb-4`,children:[(0,L.jsx)(g,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,L.jsx)(s,{placeholder:`Search available skills...`,value:Z,onChange:e=>ie(e.target.value),className:`pl-8`})]}),q.length===0?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(M,{className:`h-20 w-full`}),(0,L.jsx)(M,{className:`h-20 w-full`})]}):$.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:Z.trim()?`No results for "${Z}"`:`No available skills found.`}):(0,L.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(220px, 100%), 1fr))`},children:$.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=Y.has(t);return(0,L.jsx)(N,{name:e.name,description:e.description,installed:n,onClick:()=>{n||se(e)},showInstalledControls:!1},e.id)})})]})}),(0,L.jsx)(y,{open:V,onOpenChange:H,children:(0,L.jsx)(c,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,L.jsx)(R,{threadId:r,onSkillCreated:()=>{H(!1),Q(),x()}})})}),(0,L.jsx)(re,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,L.jsxs)(k,{children:[(0,L.jsxs)(ne,{children:[(0,L.jsx)(O,{children:`Delete Skill`}),(0,L.jsxs)(D,{children:[`Are you sure you want to delete the skill "`,U?.name,`"? This action cannot be undone.`]})]}),(0,L.jsxs)(ee,{children:[(0,L.jsx)(te,{children:`Cancel`}),(0,L.jsx)(A,{onClick:()=>U&&void ae(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a project to manage skills.`})})}export{B as SettingsSkillsView,B as default};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Fr as n,Gn as r,H as i,Hn as a,K as o,Kn as s,Ot as c,Rt as l,Ti as u,Ui as d,Vr as f,Wn as p,Y as m,Zt as h,ai as g,mn as _,n as v,oa as y,qr as b,r as x,wt as S,ya as C}from"./dialogs-config-VlhyoYms.js";import{a as w}from"./store-DUqJt-K-.js";import{t as T}from"./textarea-DuuNwegn.js";import{t as E}from"./use-toast-BF5WtiOJ.js";import{a as D,c as O,i as k,n as A,o as ee,r as te,s as ne,t as re}from"./alert-dialog-DAJFcjdR.js";import{n as j}from"./tab-context-BYpxvaoz.js";import{t as M}from"./skeleton-B1fuNMHm.js";import{t as N}from"./mcp-server-card-BCZmpcVY.js";import{n as P,t as F}from"./radio-group-CRwVSJCp.js";var I=e(C(),1),L=n();function R({threadId:e,onSkillCreated:n}){let[r,o]=(0,I.useState)(``),[s,c]=(0,I.useState)(``),[l,d]=(0,I.useState)(`local`),[f,m]=(0,I.useState)(!1),h=r.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),g=h.length>0&&h.length<=64;return e?(0,L.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,L.jsxs)(`div`,{className:`mb-6`,children:[(0,L.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Skill`}),(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new agent skill. The skill will be saved as a SKILL.md file in the .agents/skills folder.`})]}),(0,L.jsxs)(`div`,{className:`space-y-6`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(a,{htmlFor:`skillName`,children:`Skill Name`}),(0,L.jsx)(p,{id:`skillName`,value:r,onChange:e=>o(e.target.value),placeholder:`e.g. Code Review`,disabled:f}),r&&(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Folder name: `,(0,L.jsx)(`span`,{className:`font-mono`,children:h||`...`})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(a,{htmlFor:`skillDescription`,children:`Description`}),(0,L.jsx)(T,{id:`skillDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:f})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(a,{children:`Scope`}),(0,L.jsxs)(F,{value:l,onValueChange:e=>d(e),className:`flex gap-4`,disabled:f,children:[(0,L.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,L.jsx)(P,{value:`local`,id:`scope-local`}),(0,L.jsx)(a,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,L.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,L.jsx)(P,{value:`global`,id:`scope-global`,disabled:!0}),(0,L.jsx)(a,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l===`local`?`This skill will only be available for this project.`:`This skill will be available across all projects (coming soon).`})]}),(0,L.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,L.jsx)(t,{onClick:async()=>{if(!(!g||!s.trim()||!e)){m(!0);try{let t=await i(e,h,s.trim());E({title:`Skill created`,description:`Skill '${h}' was created successfully.`}),o(``),c(``),d(`local`),n?.(t.path,`SKILL.md`)}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{m(!1)}}},disabled:!g||!s.trim()||f,children:f?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,L.jsxs)(L.Fragment,{children:[`Continue`,(0,L.jsx)(y,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Thread Selected`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a thread to add a skill.`})]})})}function z(e){let t=[];for(let n of e)n.path.startsWith(`.agents/skills/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...z(n.children));return t}function B(){let{state:e}=w(),{selectedProjectId:n,selectedThreadId:i}=e,{setActiveMainTab:a,setPendingExplorerPath:u,triggerExplorerRefresh:y,setExplorerClearPath:C}=j(),[T,P]=(0,I.useState)([]),[F,B]=(0,I.useState)(!1),[V,H]=(0,I.useState)(!1),[U,W]=(0,I.useState)(null),[G,K]=(0,I.useState)(!1),[q,J]=(0,I.useState)([]),[Y,X]=(0,I.useState)(new Set),[Z,ie]=(0,I.useState)(``),Q=(0,I.useCallback)(async()=>{if(n){B(!0);try{let e=z(await c(n));if(i)try{let t=z(await l(i)),n=new Set(e.map(e=>e.path));for(let r of t)n.has(r.path)||e.push(r)}catch{}P(e),X(new Set(e.map(e=>`${e.path}/SKILL.md`)))}catch{P([]),X(new Set)}finally{B(!1)}}},[n,i]);(0,I.useEffect)(()=>{Q()},[Q]),(0,I.useEffect)(()=>{S().then(J).catch(()=>J([]))},[]);let ae=(0,I.useCallback)(async e=>{if(!n)return;let t=e.name,r=e.path;K(!0);try{try{await o(n,r)}catch{if(i)await m(i,r);else throw Error(`No thread selected to delete from`)}C(r),y(),X(e=>{let t=new Set(e);return t.delete(`${r}/SKILL.md`),t}),E({title:`Skill removed`,description:t}),W(null),await Q()}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to remove skill`,variant:`destructive`})}finally{K(!1)}},[n,i,Q,y,C]),oe=(0,I.useCallback)(e=>{u(`${e}/SKILL.md`),a(`explorer`)},[u,a]),se=(0,I.useCallback)(async e=>{let t=`.agents/skills/${e.id}/SKILL.md`;if(!(!i||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await h(i,e.gitHubRepo,e.gitHubFolder,`.agents/skills/${e.id}`);else{let n=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&n.push(`allowed-tools: ${e.allowedTools}`),e.license&&n.push(`license: ${e.license}`),n.push(`---`,``,e.instructions),await _(i,t,n.join(`
2
+ `))}X(e=>new Set(e).add(t)),y(),Q(),E({title:`Skill installed`,description:e.name})}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`})}},[i,Y,y,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,L.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Skills`}),(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage agent skills. Skills are reusable instruction sets that guide agent behavior.`})]}),(0,L.jsx)(t,{onClick:()=>H(!0),disabled:!i,children:`Add Skill`})]}),!i&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to add skills to your project.`}),(0,L.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed Skills`}),F?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(M,{className:`h-20 w-full`}),(0,L.jsx)(M,{className:`h-20 w-full`})]}):T.length===0?(0,L.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,L.jsx)(f,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),(0,L.jsx)(`h3`,{className:`text-base font-semibold text-muted-foreground mb-1`,children:`No skills installed`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:`Add skills to extend agent capabilities with reusable instructions.`})]}):(0,L.jsx)(`div`,{className:`space-y-3 mb-8`,children:T.map(e=>(0,L.jsx)(v,{children:(0,L.jsxs)(x,{className:`flex items-center justify-between p-4`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(f,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,L.jsx)(`h3`,{className:`font-medium truncate`,children:e.name})]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 truncate font-mono`,children:e.path})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:[(0,L.jsx)(t,{variant:`ghost`,size:`icon-sm`,onClick:()=>oe(e.path),title:`View in explorer`,children:(0,L.jsx)(d,{className:`h-4 w-4`})}),(0,L.jsx)(t,{variant:`ghost`,size:`icon-sm`,onClick:()=>W(e),title:`Delete skill`,children:(0,L.jsx)(b,{className:`h-4 w-4 text-destructive`})})]})]})},e.id))}),(0,L.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Available Skills`})}),!i&&(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to install skills into your project.`}),(0,L.jsxs)(`div`,{className:`relative mb-4`,children:[(0,L.jsx)(g,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,L.jsx)(p,{placeholder:`Search available skills...`,value:Z,onChange:e=>ie(e.target.value),className:`pl-8`})]}),q.length===0?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(M,{className:`h-20 w-full`}),(0,L.jsx)(M,{className:`h-20 w-full`})]}):$.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:Z.trim()?`No results for "${Z}"`:`No available skills found.`}):(0,L.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(220px, 100%), 1fr))`},children:$.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=Y.has(t);return(0,L.jsx)(N,{name:e.name,description:e.description,installed:n,onClick:()=>{n||se(e)},showInstalledControls:!1},e.id)})})]})}),(0,L.jsx)(r,{open:V,onOpenChange:H,children:(0,L.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,L.jsx)(R,{threadId:i,onSkillCreated:()=>{H(!1),Q(),y()}})})}),(0,L.jsx)(re,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,L.jsxs)(k,{children:[(0,L.jsxs)(ne,{children:[(0,L.jsx)(O,{children:`Delete Skill`}),(0,L.jsxs)(D,{children:[`Are you sure you want to delete the skill "`,U?.name,`"? This action cannot be undone.`]})]}),(0,L.jsxs)(ee,{children:[(0,L.jsx)(te,{children:`Cancel`}),(0,L.jsx)(A,{onClick:()=>U&&void ae(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a project to manage skills.`})})}export{B as SettingsSkillsView,B as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bn as t,Di as n,F as r,Hn as i,Jn as a,Jr as o,Ki as s,Kr as c,Mr as l,St as u,U as d,Un as f,Yt as p,ai as m,jt as h,n as g,qn as _,r as v,ua as y,wa as b}from"./dialogs-config-B91VQpxo.js";import{a as x}from"./store-D28g9VUj.js";import{t as S}from"./use-toast-BZ79E_dX.js";import{a as C,c as w,i as T,n as E,o as ee,r as D,s as O,t as k}from"./alert-dialog-BFhUZsPe.js";import{n as A}from"./tab-context-C3z7YU59.js";import{t as j}from"./skeleton-CXoVAzC1.js";import{t as M}from"./mcp-server-card-BSw_FlEC.js";import{n as N,t as P}from"./radio-group-CM_Wwam0.js";var F=e(b(),1),I=l();function L({projectId:e,threadId:a,onCommandCreated:o}){let[s,c]=(0,F.useState)(``),[l,u]=(0,F.useState)(``),[d,p]=(0,F.useState)(``),[m,h]=(0,F.useState)(`default`),[g,_]=(0,F.useState)(`local`),[v,b]=(0,F.useState)(!1),x=s.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),C=x.length>0&&x.length<=64;return e?(0,I.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,I.jsxs)(`div`,{className:`mb-6`,children:[(0,I.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Slash Command`}),(0,I.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new slash command. The command will be saved as a .md file in the ~/.agents/commands folder.`})]}),(0,I.jsxs)(`div`,{className:`space-y-6`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(t,{htmlFor:`commandName`,children:`Command Name`}),(0,I.jsx)(i,{id:`commandName`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g. review`,disabled:v}),s&&(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Command: `,(0,I.jsxs)(`span`,{className:`font-mono`,children:[`/`,x||`...`]})]})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(t,{htmlFor:`commandDescription`,children:`Description`}),(0,I.jsx)(i,{id:`commandDescription`,value:l,onChange:e=>u(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:v})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(t,{htmlFor:`argumentHint`,children:`Argument Hint (optional)`}),(0,I.jsx)(i,{id:`argumentHint`,value:d,onChange:e=>p(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:v}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Shows after the command name to guide users what to type`})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(t,{children:`Mode`}),(0,I.jsxs)(P,{value:m,onValueChange:e=>h(e),className:`flex gap-4`,disabled:v,children:[(0,I.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,I.jsx)(N,{value:`default`,id:`mode-default`}),(0,I.jsx)(t,{htmlFor:`mode-default`,className:`font-normal cursor-pointer`,children:`Default`})]}),(0,I.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,I.jsx)(N,{value:`plan`,id:`mode-plan`}),(0,I.jsx)(t,{htmlFor:`mode-plan`,className:`font-normal cursor-pointer`,children:`Plan`})]})]}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:m===`default`?`Standard chat mode`:`Activates plan mode when this command is used`})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(t,{children:`Scope`}),(0,I.jsxs)(P,{value:g,onValueChange:e=>_(e),className:`flex gap-4`,disabled:v,children:[(0,I.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,I.jsx)(N,{value:`local`,id:`scope-local`}),(0,I.jsx)(t,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,I.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,I.jsx)(N,{value:`global`,id:`scope-global`,disabled:!0}),(0,I.jsx)(t,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:g===`local`?`This command will only be available for this project.`:`This command will be available across all projects (coming soon).`})]}),(0,I.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,I.jsx)(f,{onClick:async()=>{if(!(!C||!e)){b(!0);try{await r(x,``,{description:l.trim()||void 0,argumentHint:d.trim()||void 0,mode:m===`plan`?`plan`:void 0},g===`global`?`global`:`project`,a??void 0),S({title:`Command created`,description:`Command '/${x}' was created successfully.`}),c(``),u(``),p(``),h(`default`),_(`local`),o?.(x)}catch(e){S({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{b(!1)}}},disabled:!C||v,children:v?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,I.jsxs)(I.Fragment,{children:[`Continue`,(0,I.jsx)(y,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,I.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,I.jsxs)(`div`,{className:`text-center`,children:[(0,I.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Project Selected`}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a project to add a slash command.`})]})})}function R(){let{state:e}=x(),{selectedProjectId:t,selectedThreadId:n}=e,{setActiveMainTab:l,setPendingExplorerPath:y,triggerExplorerRefresh:b,setExplorerClearPath:N}=A(),[P,R]=(0,F.useState)([]),[z,B]=(0,F.useState)(!1),[V,H]=(0,F.useState)(!1),[U,W]=(0,F.useState)(null),[G,K]=(0,F.useState)(!1),[q,J]=(0,F.useState)([]),[Y,X]=(0,F.useState)(new Map),[Z,te]=(0,F.useState)(``),Q=(0,F.useCallback)(async()=>{if(n){B(!0);try{let e=await h(n);R(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{R([]),X(new Map)}finally{B(!1)}}},[n]);(0,F.useEffect)(()=>{Q()},[Q]),(0,F.useEffect)(()=>{u().then(J).catch(()=>J([]))},[]);let ne=(0,F.useCallback)(async e=>{K(!0);try{await d(e.filePath),N(e.filePath),b(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),S({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){S({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,b,N]),re=(0,F.useCallback)(e=>{y(e),l(`explorer`)},[y,l]),ie=(0,F.useCallback)(async e=>{if(!(!n||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await p(n,e.gitHubRepo,e.gitHubFolder,t);let r=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,r))}else{let t=await r(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,n);X(n=>new Map(n).set(e.name,t.filePath))}b(),Q(),S({title:`Command installed`,description:`/${e.name}`})}catch(e){S({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[n,Y,b,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return t?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,I.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Slash Commands`}),(0,I.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage slash commands. Commands are quick actions available via / in chat.`})]}),(0,I.jsx)(f,{onClick:()=>H(!0),disabled:!n,children:`Add Command`})]}),!n&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to add slash commands to your project.`}),(0,I.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed Slash Commands`}),z?(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(j,{className:`h-20 w-full`}),(0,I.jsx)(j,{className:`h-20 w-full`})]}):P.length===0?(0,I.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,I.jsx)(o,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),(0,I.jsx)(`h3`,{className:`text-base font-semibold text-muted-foreground mb-1`,children:`No slash commands installed`}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:`Add slash commands to create quick actions in chat.`})]}):(0,I.jsx)(`div`,{className:`space-y-3 mb-8`,children:P.map(e=>(0,I.jsx)(g,{children:(0,I.jsxs)(v,{className:`flex items-center justify-between p-4`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(o,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,I.jsxs)(`h3`,{className:`font-medium truncate`,children:[`/`,e.name]}),e.metadata?.mode&&(0,I.jsx)(`span`,{className:`text-xs bg-muted px-1.5 py-0.5 rounded flex-shrink-0`,children:e.metadata.mode})]}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 truncate`,children:e.metadata?.description||`No description`})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:[(0,I.jsx)(f,{variant:`ghost`,size:`icon-sm`,onClick:()=>re(e.filePath),title:`View in explorer`,children:(0,I.jsx)(s,{className:`h-4 w-4`})}),(0,I.jsx)(f,{variant:`ghost`,size:`icon-sm`,onClick:()=>W(e),title:`Delete command`,children:(0,I.jsx)(c,{className:`h-4 w-4 text-destructive`})})]})]})},e.filePath))}),(0,I.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,I.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Available Slash Commands`})}),!n&&(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to install slash commands into your project.`}),(0,I.jsxs)(`div`,{className:`relative mb-4`,children:[(0,I.jsx)(m,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,I.jsx)(i,{placeholder:`Search available commands...`,value:Z,onChange:e=>te(e.target.value),className:`pl-8`})]}),q.length===0?(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(j,{className:`h-20 w-full`}),(0,I.jsx)(j,{className:`h-20 w-full`})]}):$.length===0?(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:Z.trim()?`No results for "${Z}"`:`No available commands found.`}):(0,I.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(220px, 100%), 1fr))`},children:$.map(e=>{let t=Y.has(e.name);return(0,I.jsx)(M,{name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||ie(e)},showInstalledControls:!1},e.id)})})]})}),(0,I.jsx)(_,{open:V,onOpenChange:H,children:(0,I.jsx)(a,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,I.jsx)(L,{projectId:t,threadId:n,onCommandCreated:()=>{H(!1),Q(),b()}})})}),(0,I.jsx)(k,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,I.jsxs)(T,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(w,{children:`Delete Slash Command`}),(0,I.jsxs)(C,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,I.jsxs)(ee,{children:[(0,I.jsx)(D,{children:`Cancel`}),(0,I.jsx)(E,{onClick:()=>U&&void ne(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,I.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,I.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a project to manage slash commands.`})})}export{R as SettingsSlashCommandsView,R as default};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Fr as n,Gn as r,Hn as i,Kn as a,Pt as o,Ti as s,Tt as c,Ui as l,Wn as u,Yr as d,Zt as f,ai as p,n as m,oa as h,q as g,qr as _,r as v,ya as y,z as b}from"./dialogs-config-VlhyoYms.js";import{a as x}from"./store-DUqJt-K-.js";import{t as S}from"./use-toast-BF5WtiOJ.js";import{a as C,c as w,i as ee,n as T,o as E,r as D,s as O,t as k}from"./alert-dialog-DAJFcjdR.js";import{n as A}from"./tab-context-BYpxvaoz.js";import{t as j}from"./skeleton-B1fuNMHm.js";import{t as M}from"./mcp-server-card-BCZmpcVY.js";import{n as N,t as P}from"./radio-group-CRwVSJCp.js";var F=e(y(),1),I=n();function L({projectId:e,threadId:n,onCommandCreated:r}){let[a,o]=(0,F.useState)(``),[c,l]=(0,F.useState)(``),[d,f]=(0,F.useState)(``),[p,m]=(0,F.useState)(`default`),[g,_]=(0,F.useState)(`local`),[v,y]=(0,F.useState)(!1),x=a.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),C=x.length>0&&x.length<=64;return e?(0,I.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,I.jsxs)(`div`,{className:`mb-6`,children:[(0,I.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Slash Command`}),(0,I.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new slash command. The command will be saved as a .md file in the ~/.agents/commands folder.`})]}),(0,I.jsxs)(`div`,{className:`space-y-6`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(i,{htmlFor:`commandName`,children:`Command Name`}),(0,I.jsx)(u,{id:`commandName`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g. review`,disabled:v}),a&&(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Command: `,(0,I.jsxs)(`span`,{className:`font-mono`,children:[`/`,x||`...`]})]})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(i,{htmlFor:`commandDescription`,children:`Description`}),(0,I.jsx)(u,{id:`commandDescription`,value:c,onChange:e=>l(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:v})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(i,{htmlFor:`argumentHint`,children:`Argument Hint (optional)`}),(0,I.jsx)(u,{id:`argumentHint`,value:d,onChange:e=>f(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:v}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Shows after the command name to guide users what to type`})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(i,{children:`Mode`}),(0,I.jsxs)(P,{value:p,onValueChange:e=>m(e),className:`flex gap-4`,disabled:v,children:[(0,I.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,I.jsx)(N,{value:`default`,id:`mode-default`}),(0,I.jsx)(i,{htmlFor:`mode-default`,className:`font-normal cursor-pointer`,children:`Default`})]}),(0,I.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,I.jsx)(N,{value:`plan`,id:`mode-plan`}),(0,I.jsx)(i,{htmlFor:`mode-plan`,className:`font-normal cursor-pointer`,children:`Plan`})]})]}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:p===`default`?`Standard chat mode`:`Activates plan mode when this command is used`})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(i,{children:`Scope`}),(0,I.jsxs)(P,{value:g,onValueChange:e=>_(e),className:`flex gap-4`,disabled:v,children:[(0,I.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,I.jsx)(N,{value:`local`,id:`scope-local`}),(0,I.jsx)(i,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,I.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,I.jsx)(N,{value:`global`,id:`scope-global`,disabled:!0}),(0,I.jsx)(i,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:g===`local`?`This command will only be available for this project.`:`This command will be available across all projects (coming soon).`})]}),(0,I.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,I.jsx)(t,{onClick:async()=>{if(!(!C||!e)){y(!0);try{await b(x,``,{description:c.trim()||void 0,argumentHint:d.trim()||void 0,mode:p===`plan`?`plan`:void 0},g===`global`?`global`:`project`,n??void 0),S({title:`Command created`,description:`Command '/${x}' was created successfully.`}),o(``),l(``),f(``),m(`default`),_(`local`),r?.(x)}catch(e){S({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{y(!1)}}},disabled:!C||v,children:v?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,I.jsxs)(I.Fragment,{children:[`Continue`,(0,I.jsx)(h,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,I.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,I.jsxs)(`div`,{className:`text-center`,children:[(0,I.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Project Selected`}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a project to add a slash command.`})]})})}function R(){let{state:e}=x(),{selectedProjectId:n,selectedThreadId:i}=e,{setActiveMainTab:s,setPendingExplorerPath:h,triggerExplorerRefresh:y,setExplorerClearPath:N}=A(),[P,R]=(0,F.useState)([]),[z,B]=(0,F.useState)(!1),[V,H]=(0,F.useState)(!1),[U,W]=(0,F.useState)(null),[G,K]=(0,F.useState)(!1),[q,J]=(0,F.useState)([]),[Y,X]=(0,F.useState)(new Map),[Z,te]=(0,F.useState)(``),Q=(0,F.useCallback)(async()=>{if(i){B(!0);try{let e=await o(i);R(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{R([]),X(new Map)}finally{B(!1)}}},[i]);(0,F.useEffect)(()=>{Q()},[Q]),(0,F.useEffect)(()=>{c().then(J).catch(()=>J([]))},[]);let ne=(0,F.useCallback)(async e=>{K(!0);try{await g(e.filePath),N(e.filePath),y(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),S({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){S({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,y,N]),re=(0,F.useCallback)(e=>{h(e),s(`explorer`)},[h,s]),ie=(0,F.useCallback)(async e=>{if(!(!i||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await f(i,e.gitHubRepo,e.gitHubFolder,t);let n=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,n))}else{let t=await b(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,i);X(n=>new Map(n).set(e.name,t.filePath))}y(),Q(),S({title:`Command installed`,description:`/${e.name}`})}catch(e){S({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[i,Y,y,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return n?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,I.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Slash Commands`}),(0,I.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage slash commands. Commands are quick actions available via / in chat.`})]}),(0,I.jsx)(t,{onClick:()=>H(!0),disabled:!i,children:`Add Command`})]}),!i&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to add slash commands to your project.`}),(0,I.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed Slash Commands`}),z?(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(j,{className:`h-20 w-full`}),(0,I.jsx)(j,{className:`h-20 w-full`})]}):P.length===0?(0,I.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,I.jsx)(d,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),(0,I.jsx)(`h3`,{className:`text-base font-semibold text-muted-foreground mb-1`,children:`No slash commands installed`}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:`Add slash commands to create quick actions in chat.`})]}):(0,I.jsx)(`div`,{className:`space-y-3 mb-8`,children:P.map(e=>(0,I.jsx)(m,{children:(0,I.jsxs)(v,{className:`flex items-center justify-between p-4`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(d,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,I.jsxs)(`h3`,{className:`font-medium truncate`,children:[`/`,e.name]}),e.metadata?.mode&&(0,I.jsx)(`span`,{className:`text-xs bg-muted px-1.5 py-0.5 rounded flex-shrink-0`,children:e.metadata.mode})]}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 truncate`,children:e.metadata?.description||`No description`})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:[(0,I.jsx)(t,{variant:`ghost`,size:`icon-sm`,onClick:()=>re(e.filePath),title:`View in explorer`,children:(0,I.jsx)(l,{className:`h-4 w-4`})}),(0,I.jsx)(t,{variant:`ghost`,size:`icon-sm`,onClick:()=>W(e),title:`Delete command`,children:(0,I.jsx)(_,{className:`h-4 w-4 text-destructive`})})]})]})},e.filePath))}),(0,I.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,I.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Available Slash Commands`})}),!i&&(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to install slash commands into your project.`}),(0,I.jsxs)(`div`,{className:`relative mb-4`,children:[(0,I.jsx)(p,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,I.jsx)(u,{placeholder:`Search available commands...`,value:Z,onChange:e=>te(e.target.value),className:`pl-8`})]}),q.length===0?(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(j,{className:`h-20 w-full`}),(0,I.jsx)(j,{className:`h-20 w-full`})]}):$.length===0?(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:Z.trim()?`No results for "${Z}"`:`No available commands found.`}):(0,I.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(220px, 100%), 1fr))`},children:$.map(e=>{let t=Y.has(e.name);return(0,I.jsx)(M,{name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||ie(e)},showInstalledControls:!1},e.id)})})]})}),(0,I.jsx)(r,{open:V,onOpenChange:H,children:(0,I.jsx)(a,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,I.jsx)(L,{projectId:n,threadId:i,onCommandCreated:()=>{H(!1),Q(),y()}})})}),(0,I.jsx)(k,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,I.jsxs)(ee,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(w,{children:`Delete Slash Command`}),(0,I.jsxs)(C,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,I.jsxs)(E,{children:[(0,I.jsx)(D,{children:`Cancel`}),(0,I.jsx)(T,{onClick:()=>U&&void ne(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,I.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,I.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a project to manage slash commands.`})})}export{R as SettingsSlashCommandsView,R as default};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bn as t,Di as n,Ft as r,G as i,H as a,Hn as o,Jn as s,Ki as c,Kr as l,L as u,Mr as d,Tt as f,Un as p,Vr as m,Yt as h,ai as g,fn as _,n as v,qn as y,r as ee,ua as b,vt as x,wa as S}from"./dialogs-config-B91VQpxo.js";import{a as C}from"./store-D28g9VUj.js";import{t as w}from"./textarea-Bp3p1-25.js";import{t as T}from"./use-toast-BZ79E_dX.js";import{a as E,c as D,i as O,n as k,o as A,r as j,s as M,t as te}from"./alert-dialog-BFhUZsPe.js";import{n as ne}from"./tab-context-C3z7YU59.js";import{t as N}from"./skeleton-CXoVAzC1.js";import{t as re}from"./mcp-server-card-BSw_FlEC.js";import{n as P,t as F}from"./radio-group-CM_Wwam0.js";var I=e(S(),1),L=d();function R({threadId:e,onAgentCreated:r}){let[i,a]=(0,I.useState)(``),[s,c]=(0,I.useState)(``),[l,d]=(0,I.useState)(``),[f,m]=(0,I.useState)(`local`),[h,g]=(0,I.useState)(!1),_=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),v=_.length>0&&_.length<=64;return e?(0,L.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,L.jsxs)(`div`,{className:`mb-6`,children:[(0,L.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Agent`}),(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new subagent. The agent will be saved as an AGENT.md file in the .agents/agents folder.`})]}),(0,L.jsxs)(`div`,{className:`space-y-6`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(t,{htmlFor:`agentName`,children:`Agent Name`}),(0,L.jsx)(o,{id:`agentName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Security Reviewer`,disabled:h}),i&&(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Folder name: `,(0,L.jsx)(`span`,{className:`font-mono`,children:_||`...`})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(t,{htmlFor:`agentDescription`,children:`Description`}),(0,L.jsx)(w,{id:`agentDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Describe what this agent does and when it should be invoked`,className:`resize-none min-h-[120px]`,disabled:h})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(t,{htmlFor:`agentTools`,children:`Allowed Tools (optional)`}),(0,L.jsx)(o,{id:`agentTools`,value:l,onChange:e=>d(e.target.value),placeholder:`e.g. read grep glob`,disabled:h}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Space-separated list of tools this agent can use. Leave empty to allow all coding tools.`})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(t,{children:`Scope`}),(0,L.jsxs)(F,{value:f,onValueChange:e=>m(e),className:`flex gap-4`,disabled:h,children:[(0,L.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,L.jsx)(P,{value:`local`,id:`scope-local`}),(0,L.jsx)(t,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,L.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,L.jsx)(P,{value:`global`,id:`scope-global`,disabled:!0}),(0,L.jsx)(t,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f===`local`?`This agent will only be available for this project.`:`This agent will be available across all projects (coming soon).`})]}),(0,L.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,L.jsx)(p,{onClick:async()=>{if(!(!v||!s.trim()||!e)){g(!0);try{let t=await u(e,_,s.trim(),l.trim()||void 0);T({title:`Agent created`,description:`Agent '${_}' was created successfully.`}),a(``),c(``),d(``),m(`local`),r?.(t.path,`AGENT.md`)}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{g(!1)}}},disabled:!v||!s.trim()||h,children:h?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,L.jsxs)(L.Fragment,{children:[`Continue`,(0,L.jsx)(b,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Thread Selected`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a thread to add an agent.`})]})})}function z(e){let t=[];for(let n of e)n.path.startsWith(`.agents/agents/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...z(n.children));return t}function B(){let{state:e}=C(),{selectedProjectId:t,selectedThreadId:n}=e,{setActiveMainTab:u,setPendingExplorerPath:d,triggerExplorerRefresh:b,setExplorerClearPath:S}=ne(),[w,P]=(0,I.useState)([]),[F,B]=(0,I.useState)(!1),[V,H]=(0,I.useState)(!1),[U,W]=(0,I.useState)(null),[G,K]=(0,I.useState)(!1),[q,J]=(0,I.useState)([]),[Y,X]=(0,I.useState)(new Set),[Z,ie]=(0,I.useState)(``),Q=(0,I.useCallback)(async()=>{if(t){B(!0);try{let e=z(await f(t));if(n)try{let t=z(await r(n)),i=new Set(e.map(e=>e.path));for(let n of t)i.has(n.path)||e.push(n)}catch{}P(e),X(new Set(e.map(e=>`${e.path}/AGENT.md`)))}catch{P([]),X(new Set)}finally{B(!1)}}},[t,n]);(0,I.useEffect)(()=>{Q()},[Q]),(0,I.useEffect)(()=>{x().then(J).catch(()=>J([]))},[]);let ae=(0,I.useCallback)(async e=>{if(!t)return;let r=e.name,o=e.path;K(!0);try{try{await a(t,o)}catch{if(n)await i(n,o);else throw Error(`No thread selected to delete from`)}S(o),b(),X(e=>{let t=new Set(e);return t.delete(`${o}/AGENT.md`),t}),T({title:`Agent removed`,description:r}),W(null),await Q()}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{K(!1)}},[t,n,Q,b,S]),oe=(0,I.useCallback)(e=>{d(`${e}/AGENT.md`),u(`explorer`)},[d,u]),se=(0,I.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!n||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await h(n,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&r.push(`tools: ${e.tools}`),r.push(`---`,``,e.systemPrompt),await _(n,t,r.join(`
2
- `))}X(e=>new Set(e).add(t)),b(),Q(),T({title:`Agent installed`,description:e.name})}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[n,Y,b,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,L.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Subagents`}),(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage subagents. Subagents are specialized agents for focused tasks.`})]}),(0,L.jsx)(p,{onClick:()=>H(!0),disabled:!n,children:`Add Subagent`})]}),!n&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to add subagents to your project.`}),(0,L.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed Subagents`}),F?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(N,{className:`h-20 w-full`}),(0,L.jsx)(N,{className:`h-20 w-full`})]}):w.length===0?(0,L.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,L.jsx)(m,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),(0,L.jsx)(`h3`,{className:`text-base font-semibold text-muted-foreground mb-1`,children:`No subagents installed`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:`Add subagents for specialized, focused tasks.`})]}):(0,L.jsx)(`div`,{className:`space-y-3 mb-8`,children:w.map(e=>(0,L.jsx)(v,{children:(0,L.jsxs)(ee,{className:`flex items-center justify-between p-4`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(m,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,L.jsx)(`h3`,{className:`font-medium truncate`,children:e.name})]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 truncate font-mono`,children:e.path})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:[(0,L.jsx)(p,{variant:`ghost`,size:`icon-sm`,onClick:()=>oe(e.path),title:`View in explorer`,children:(0,L.jsx)(c,{className:`h-4 w-4`})}),(0,L.jsx)(p,{variant:`ghost`,size:`icon-sm`,onClick:()=>W(e),title:`Delete agent`,children:(0,L.jsx)(l,{className:`h-4 w-4 text-destructive`})})]})]})},e.id))}),(0,L.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Available Subagents`})}),!n&&(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to install subagents into your project.`}),(0,L.jsxs)(`div`,{className:`relative mb-4`,children:[(0,L.jsx)(g,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,L.jsx)(o,{placeholder:`Search available subagents...`,value:Z,onChange:e=>ie(e.target.value),className:`pl-8`})]}),q.length===0?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(N,{className:`h-20 w-full`}),(0,L.jsx)(N,{className:`h-20 w-full`})]}):$.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:Z.trim()?`No results for "${Z}"`:`No available subagents found.`}):(0,L.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(220px, 100%), 1fr))`},children:$.map(e=>{let t=`.agents/agents/${e.id}/AGENT.md`,n=Y.has(t);return(0,L.jsx)(re,{name:e.name,description:e.description,installed:n,onClick:()=>{n||se(e)},showInstalledControls:!1},e.id)})})]})}),(0,L.jsx)(y,{open:V,onOpenChange:H,children:(0,L.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,L.jsx)(R,{threadId:n,onAgentCreated:()=>{H(!1),Q(),b()}})})}),(0,L.jsx)(te,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,L.jsxs)(O,{children:[(0,L.jsxs)(M,{children:[(0,L.jsx)(D,{children:`Delete Subagent`}),(0,L.jsxs)(E,{children:[`Are you sure you want to delete the subagent "`,U?.name,`"? This action cannot be undone.`]})]}),(0,L.jsxs)(A,{children:[(0,L.jsx)(j,{children:`Cancel`}),(0,L.jsx)(k,{onClick:()=>U&&void ae(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a project to manage subagents.`})})}export{B as SettingsSubagentsView,B as default};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Fr as n,Gn as r,Hn as i,Hr as a,K as o,Kn as s,Ot as c,Rt as l,Ti as u,Ui as d,V as f,Wn as p,Y as m,Zt as h,ai as g,mn as _,n as v,oa as y,qr as ee,r as b,xt as x,ya as S}from"./dialogs-config-VlhyoYms.js";import{a as C}from"./store-DUqJt-K-.js";import{t as w}from"./textarea-DuuNwegn.js";import{t as T}from"./use-toast-BF5WtiOJ.js";import{a as E,c as D,i as O,n as k,o as A,r as j,s as M,t as te}from"./alert-dialog-DAJFcjdR.js";import{n as ne}from"./tab-context-BYpxvaoz.js";import{t as N}from"./skeleton-B1fuNMHm.js";import{t as re}from"./mcp-server-card-BCZmpcVY.js";import{n as P,t as F}from"./radio-group-CRwVSJCp.js";var I=e(S(),1),L=n();function R({threadId:e,onAgentCreated:n}){let[r,a]=(0,I.useState)(``),[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),[d,m]=(0,I.useState)(`local`),[h,g]=(0,I.useState)(!1),_=r.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),v=_.length>0&&_.length<=64;return e?(0,L.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,L.jsxs)(`div`,{className:`mb-6`,children:[(0,L.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Agent`}),(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new subagent. The agent will be saved as an AGENT.md file in the .agents/agents folder.`})]}),(0,L.jsxs)(`div`,{className:`space-y-6`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(i,{htmlFor:`agentName`,children:`Agent Name`}),(0,L.jsx)(p,{id:`agentName`,value:r,onChange:e=>a(e.target.value),placeholder:`e.g. Security Reviewer`,disabled:h}),r&&(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Folder name: `,(0,L.jsx)(`span`,{className:`font-mono`,children:_||`...`})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(i,{htmlFor:`agentDescription`,children:`Description`}),(0,L.jsx)(w,{id:`agentDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe what this agent does and when it should be invoked`,className:`resize-none min-h-[120px]`,disabled:h})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(i,{htmlFor:`agentTools`,children:`Allowed Tools (optional)`}),(0,L.jsx)(p,{id:`agentTools`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g. read grep glob`,disabled:h}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Space-separated list of tools this agent can use. Leave empty to allow all coding tools.`})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(i,{children:`Scope`}),(0,L.jsxs)(F,{value:d,onValueChange:e=>m(e),className:`flex gap-4`,disabled:h,children:[(0,L.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,L.jsx)(P,{value:`local`,id:`scope-local`}),(0,L.jsx)(i,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,L.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,L.jsx)(P,{value:`global`,id:`scope-global`,disabled:!0}),(0,L.jsx)(i,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d===`local`?`This agent will only be available for this project.`:`This agent will be available across all projects (coming soon).`})]}),(0,L.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,L.jsx)(t,{onClick:async()=>{if(!(!v||!o.trim()||!e)){g(!0);try{let t=await f(e,_,o.trim(),c.trim()||void 0);T({title:`Agent created`,description:`Agent '${_}' was created successfully.`}),a(``),s(``),l(``),m(`local`),n?.(t.path,`AGENT.md`)}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{g(!1)}}},disabled:!v||!o.trim()||h,children:h?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,L.jsxs)(L.Fragment,{children:[`Continue`,(0,L.jsx)(y,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Thread Selected`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a thread to add an agent.`})]})})}function z(e){let t=[];for(let n of e)n.path.startsWith(`.agents/agents/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...z(n.children));return t}function B(){let{state:e}=C(),{selectedProjectId:n,selectedThreadId:i}=e,{setActiveMainTab:u,setPendingExplorerPath:f,triggerExplorerRefresh:y,setExplorerClearPath:S}=ne(),[w,P]=(0,I.useState)([]),[F,B]=(0,I.useState)(!1),[V,H]=(0,I.useState)(!1),[U,W]=(0,I.useState)(null),[G,K]=(0,I.useState)(!1),[q,J]=(0,I.useState)([]),[Y,X]=(0,I.useState)(new Set),[Z,ie]=(0,I.useState)(``),Q=(0,I.useCallback)(async()=>{if(n){B(!0);try{let e=z(await c(n));if(i)try{let t=z(await l(i)),n=new Set(e.map(e=>e.path));for(let r of t)n.has(r.path)||e.push(r)}catch{}P(e),X(new Set(e.map(e=>`${e.path}/AGENT.md`)))}catch{P([]),X(new Set)}finally{B(!1)}}},[n,i]);(0,I.useEffect)(()=>{Q()},[Q]),(0,I.useEffect)(()=>{x().then(J).catch(()=>J([]))},[]);let ae=(0,I.useCallback)(async e=>{if(!n)return;let t=e.name,r=e.path;K(!0);try{try{await o(n,r)}catch{if(i)await m(i,r);else throw Error(`No thread selected to delete from`)}S(r),y(),X(e=>{let t=new Set(e);return t.delete(`${r}/AGENT.md`),t}),T({title:`Agent removed`,description:t}),W(null),await Q()}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{K(!1)}},[n,i,Q,y,S]),oe=(0,I.useCallback)(e=>{f(`${e}/AGENT.md`),u(`explorer`)},[f,u]),se=(0,I.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!i||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await h(i,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let n=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&n.push(`tools: ${e.tools}`),n.push(`---`,``,e.systemPrompt),await _(i,t,n.join(`
2
+ `))}X(e=>new Set(e).add(t)),y(),Q(),T({title:`Agent installed`,description:e.name})}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[i,Y,y,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,L.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Subagents`}),(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage subagents. Subagents are specialized agents for focused tasks.`})]}),(0,L.jsx)(t,{onClick:()=>H(!0),disabled:!i,children:`Add Subagent`})]}),!i&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to add subagents to your project.`}),(0,L.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed Subagents`}),F?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(N,{className:`h-20 w-full`}),(0,L.jsx)(N,{className:`h-20 w-full`})]}):w.length===0?(0,L.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,L.jsx)(a,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),(0,L.jsx)(`h3`,{className:`text-base font-semibold text-muted-foreground mb-1`,children:`No subagents installed`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:`Add subagents for specialized, focused tasks.`})]}):(0,L.jsx)(`div`,{className:`space-y-3 mb-8`,children:w.map(e=>(0,L.jsx)(v,{children:(0,L.jsxs)(b,{className:`flex items-center justify-between p-4`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(a,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,L.jsx)(`h3`,{className:`font-medium truncate`,children:e.name})]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 truncate font-mono`,children:e.path})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:[(0,L.jsx)(t,{variant:`ghost`,size:`icon-sm`,onClick:()=>oe(e.path),title:`View in explorer`,children:(0,L.jsx)(d,{className:`h-4 w-4`})}),(0,L.jsx)(t,{variant:`ghost`,size:`icon-sm`,onClick:()=>W(e),title:`Delete agent`,children:(0,L.jsx)(ee,{className:`h-4 w-4 text-destructive`})})]})]})},e.id))}),(0,L.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Available Subagents`})}),!i&&(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground bg-muted rounded-md px-3 py-2 mb-4`,children:`Select a thread to install subagents into your project.`}),(0,L.jsxs)(`div`,{className:`relative mb-4`,children:[(0,L.jsx)(g,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,L.jsx)(p,{placeholder:`Search available subagents...`,value:Z,onChange:e=>ie(e.target.value),className:`pl-8`})]}),q.length===0?(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(N,{className:`h-20 w-full`}),(0,L.jsx)(N,{className:`h-20 w-full`})]}):$.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:Z.trim()?`No results for "${Z}"`:`No available subagents found.`}):(0,L.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(220px, 100%), 1fr))`},children:$.map(e=>{let t=`.agents/agents/${e.id}/AGENT.md`,n=Y.has(t);return(0,L.jsx)(re,{name:e.name,description:e.description,installed:n,onClick:()=>{n||se(e)},showInstalledControls:!1},e.id)})})]})}),(0,L.jsx)(r,{open:V,onOpenChange:H,children:(0,L.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,L.jsx)(R,{threadId:i,onAgentCreated:()=>{H(!1),Q(),y()}})})}),(0,L.jsx)(te,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,L.jsxs)(O,{children:[(0,L.jsxs)(M,{children:[(0,L.jsx)(D,{children:`Delete Subagent`}),(0,L.jsxs)(E,{children:[`Are you sure you want to delete the subagent "`,U?.name,`"? This action cannot be undone.`]})]}),(0,L.jsxs)(A,{children:[(0,L.jsx)(j,{children:`Cancel`}),(0,L.jsx)(k,{onClick:()=>U&&void ae(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,L.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Select a project to manage subagents.`})})}export{B as SettingsSubagentsView,B as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-general-view-mu1Qq8cl.js","assets/rolldown-runtime-B1FJdls4.js","assets/dialogs-config-VlhyoYms.js","assets/use-font-size-D2A0_bAi.js","assets/react-vendor-CtZx3FWA.js","assets/monaco-BGyhgQtx.js","assets/monaco-Br_kD0ds.css","assets/history-view-Cub-F9g6.js","assets/project-settings-view-BAs5RYWR.js","assets/textarea-DuuNwegn.js","assets/use-toast-BF5WtiOJ.js","assets/providers-list-view-67A5O5vd.js","assets/onboarding-BPUo1aJX.js","assets/skeleton-B1fuNMHm.js","assets/tabs-ywSKq3qp.js","assets/settings-models-view-DSrdZZfF.js","assets/settings-models-skeleton-qdDMv5hS.js","assets/settings-mcp-servers-view-BqJMRVZJ.js","assets/mcp-server-card-BCZmpcVY.js","assets/alert-dialog-DAJFcjdR.js","assets/store-DUqJt-K-.js","assets/tab-context-BYpxvaoz.js","assets/settings-skills-view-Djrk38ol.js","assets/radio-group-CRwVSJCp.js","assets/settings-rules-view-Dt_lfKVv.js","assets/settings-slash-commands-view-Cm5cy2My.js","assets/settings-subagents-view-CsGwbSvQ.js","assets/settings-instructions-view-DQRSZId7.js","assets/account-view-Cdp8xegU.js","assets/conversation-history-view-qm_qW0aD.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ai as t,At as n,Fr as r,Hr as i,Or as a,Qt as o,Ur as s,Vr as c,Yr as l,Zi as u,_a as d,an as f,fa as p,ii as m,ni as h,oi as g,ua as _,ya as v}from"./dialogs-config-VlhyoYms.js";import{Ct as y,St as b,t as x,wt as S}from"./react-vendor-CtZx3FWA.js";import{Pt as C}from"./monaco-BGyhgQtx.js";import{a as w,t as T}from"./store-DUqJt-K-.js";import{t as E}from"./standard-list-item-0m99qNoa.js";import{t as ee}from"./side-panel-container-Cg99BH1l.js";import{n as D,r as O,t as k}from"./resizable-AKojmHeo.js";import{t as te}from"./settings-models-skeleton-qdDMv5hS.js";var A=d(),j=e(v(),1),M=r(),ne=(0,j.forwardRef)(function(e,t){let n=(0,A.c)(20),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:s,minContentSize:c,collapsible:l,collapsedSize:u,className:d,onCollapse:f,onExpand:p}=e,m=a===void 0?25:a,h=o===void 0?20:o,g=s===void 0?30:s,_=c===void 0?40:c,v=l===void 0?!1:l,y=u===void 0?0:u,b=`h-full ${d===void 0?``:d}`,x;n[0]!==y||n[1]!==v||n[2]!==m||n[3]!==g||n[4]!==h||n[5]!==f||n[6]!==p||n[7]!==t||n[8]!==r?(x=(0,M.jsx)(D,{ref:t,defaultSize:m,minSize:h,maxSize:g,collapsible:v,collapsedSize:y,onCollapse:f,onExpand:p,className:`border-r border-transparent`,children:r}),n[0]=y,n[1]=v,n[2]=m,n[3]=g,n[4]=h,n[5]=f,n[6]=p,n[7]=t,n[8]=r,n[9]=x):x=n[9];let S;n[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,M.jsx)(k,{withHandle:!0,className:`ml-[-40px]`}),n[10]=S):S=n[10];let C;n[11]!==i||n[12]!==_?(C=(0,M.jsx)(D,{minSize:_,className:`overflow-hidden`,children:i}),n[11]=i,n[12]=_,n[13]=C):C=n[13];let w;n[14]!==C||n[15]!==x?(w=(0,M.jsxs)(O,{direction:`horizontal`,className:`h-full`,children:[x,S,C]}),n[14]=C,n[15]=x,n[16]=w):w=n[16];let T;return n[17]!==w||n[18]!==b?(T=(0,M.jsx)(`div`,{className:b,children:w}),n[17]=w,n[18]=b,n[19]=T):T=n[19],T}),N=j.forwardRef((e,t)=>{let n=(0,A.c)(14),r,i,o,s;n[0]===e?(r=n[1],i=n[2],o=n[3],s=n[4]):({className:r,orientation:o,decorative:s,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o,n[4]=s);let c=o===void 0?`horizontal`:o,l=s===void 0?!0:s,u=c===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,d;n[5]!==r||n[6]!==u?(d=a(`shrink-0 bg-border`,u,r),n[5]=r,n[6]=u,n[7]=d):d=n[7];let f;return n[8]!==l||n[9]!==c||n[10]!==i||n[11]!==t||n[12]!==d?(f=(0,M.jsx)(x,{ref:t,decorative:l,orientation:c,className:d,...i}),n[8]=l,n[9]=c,n[10]=i,n[11]=t,n[12]=d,n[13]=f):f=n[13],f});N.displayName=x.displayName;var P=[{id:`general`,label:`General`,icon:(0,M.jsx)(h,{className:`h-4 w-4`}),route:`/settings/general`},{id:`providers`,label:`Providers`,icon:(0,M.jsx)(u,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,M.jsx)(_,{className:`h-4 w-4`}),route:`/settings/models`},{id:`skills`,label:`Skills`,icon:(0,M.jsx)(c,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`rules`,label:`Rules`,icon:(0,M.jsx)(g,{className:`h-4 w-4`}),route:`/settings/rules`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,M.jsx)(l,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,M.jsx)(i,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`instructions`,label:`Instructions`,icon:(0,M.jsx)(p,{className:`h-4 w-4`}),route:`/settings/instructions`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,M.jsx)(m,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`history`,label:`History`,icon:(0,M.jsx)(t,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,M.jsx)(s,{className:`h-4 w-4`}),route:`/settings/account`}];function re(e){let t=(0,A.c)(8),{className:n}=e,r=y(),i=b(),a;t[0]===i.pathname?a=t[1]:(a=function(){let e=i.pathname;for(let t of P)if(e.startsWith(t.route))return t.id;return`general`}(),t[0]=i.pathname,t[1]=a);let o=a,s=`space-y-1${n?` ${n}`:``}`,c;t[2]!==o||t[3]!==r?(c=P.map((e,t)=>(0,M.jsxs)(j.Fragment,{children:[t===P.length-1&&(0,M.jsx)(N,{className:`my-2 bg-sidebar-border`}),(0,M.jsx)(E,{selected:o===e.id,asChild:!0,children:(0,M.jsx)(`button`,{className:`justify-start`,onClick:()=>void r(e.route),children:(0,M.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,(0,M.jsx)(`span`,{children:e.label})]})})})]},e.id)),t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;return t[5]!==s||t[6]!==c?(l=(0,M.jsx)(`div`,{className:s,children:c}),t[5]=s,t[6]=c,t[7]=l):l=t[7],l}var ie=(0,j.lazy)(()=>C(()=>import(`./settings-general-view-mu1Qq8cl.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),F=(0,j.lazy)(()=>C(()=>import(`./project-settings-view-BAs5RYWR.js`),__vite__mapDeps([8,1,2,9,10,4,5,6,7]))),I=(0,j.lazy)(()=>C(()=>import(`./providers-list-view-67A5O5vd.js`),__vite__mapDeps([11,1,7,2,12,13,14,4,5,6]))),L=(0,j.lazy)(()=>C(()=>import(`./settings-models-view-DSrdZZfF.js`),__vite__mapDeps([15,1,7,2,12,16,13,14,4,5,6]))),R=(0,j.lazy)(()=>C(()=>import(`./settings-mcp-servers-view-BqJMRVZJ.js`),__vite__mapDeps([17,1,7,2,18,19,4,5,6,13,9,10,20,21]))),z=(0,j.lazy)(()=>C(()=>import(`./settings-skills-view-Djrk38ol.js`),__vite__mapDeps([22,1,2,18,7,19,4,5,6,23,13,9,10,20,21]))),B=(0,j.lazy)(()=>C(()=>import(`./settings-rules-view-Dt_lfKVv.js`),__vite__mapDeps([24,1,2,18,7,19,4,5,6,23,13,9,10,20,21]))),ae=(0,j.lazy)(()=>C(()=>import(`./settings-slash-commands-view-Cm5cy2My.js`),__vite__mapDeps([25,1,2,18,7,19,4,5,6,23,13,10,20,21]))),oe=(0,j.lazy)(()=>C(()=>import(`./settings-subagents-view-CsGwbSvQ.js`),__vite__mapDeps([26,1,2,18,7,19,4,5,6,23,13,9,10,20,21]))),se=(0,j.lazy)(()=>C(()=>import(`./settings-instructions-view-DQRSZId7.js`),__vite__mapDeps([27,1,2,9,10,20]))),ce=(0,j.lazy)(()=>C(()=>import(`./account-view-Cdp8xegU.js`),__vite__mapDeps([28,1,2,13,10]))),le=(0,j.lazy)(()=>C(()=>import(`./conversation-history-view-qm_qW0aD.js`),__vite__mapDeps([29,7,1,2]))),V=[`general`,`providers`,`models`,`skills`,`rules`,`slash-commands`,`subagents`,`instructions`,`mcp-servers`,`history`,`account`];function H(e){let t=(0,A.c)(5),{title:n}=e,r;t[0]===n?r=t[1]:(r=(0,M.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:n}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Content coming soon...`}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,M.jsxs)(`div`,{className:`text-center`,children:[r,i]})}),t[3]=r,t[4]=a),a}function ue(){let e=(0,A.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,M.jsx)(`div`,{className:`h-4 w-64 bg-muted rounded animate-pulse`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,M.jsx)(`div`,{className:`mb-6`,children:(0,M.jsx)(`div`,{className:`h-10 w-full bg-muted rounded animate-pulse`})}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,M.jsx)(`div`,{className:`h-4 w-36 bg-muted rounded animate-pulse mb-3`}),e[2]=r):r=e[2];let i,a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,M.jsxs)(`div`,{children:[r,(0,M.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,M.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,M.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]}),a=(0,M.jsx)(`div`,{className:`h-4 w-40 bg-muted rounded animate-pulse mb-3`}),e[3]=i,e[4]=a):(i=e[3],a=e[4]);let o;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,M.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,M.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6`,children:[t,n,(0,M.jsxs)(`div`,{className:`space-y-8`,children:[i,(0,M.jsxs)(`div`,{children:[a,(0,M.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,M.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,M.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,M.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,M.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]})]})]})}),e[5]=o):o=e[5],o}function de(e){return e.startsWith(`/settings/general`)?`general`:e.startsWith(`/settings/providers`)?`providers`:e.startsWith(`/settings/models`)?`models`:e.startsWith(`/settings/skills`)?`skills`:e.startsWith(`/settings/rules`)?`rules`:e.startsWith(`/settings/slash-commands`)?`slash-commands`:e.startsWith(`/settings/subagents`)?`subagents`:e.startsWith(`/settings/instructions`)?`instructions`:e.startsWith(`/settings/mcp-servers`)?`mcp-servers`:e.startsWith(`/settings/history`)?`history`:e.startsWith(`/settings/account`)?`account`:`general`}function U(){let e=(0,A.c)(41),{tab:t,projectId:r}=S(),i=y(),a=b(),{state:s,dispatch:c}=w(),l;e[0]!==a.pathname||e[1]!==r?(l=!!r&&a.pathname.startsWith(`/settings/project/`),e[0]=a.pathname,e[1]=r,e[2]=l):l=e[2];let u=l,d;if(e[3]!==a.pathname||e[4]!==a.search||e[5]!==t){let n=new URLSearchParams(a.search).get(`tab`);d=n&&V.includes(n)?n:t&&V.includes(t)?t:de(a.pathname),e[3]=a.pathname,e[4]=a.search,e[5]=t,e[6]=d}else d=e[6];let f=d,[p,m]=(0,j.useState)(!1),h=(0,j.useRef)(null),g=fe,_;e[7]===i?_=e[8]:(_=()=>{i(`/`)},e[7]=i,e[8]=_);let v=_,x;e[9]===s.selectedProjectId?x=e[10]:(x=s.selectedProjectId?{type:`project`,id:s.selectedProjectId}:void 0,e[9]=s.selectedProjectId,e[10]=x);let C=x,E;e[11]===i?E=e[12]:(E=()=>{i(`/settings/general`)},e[11]=i,e[12]=E);let D=E,O;e[13]===c?O=e[14]:(O=async()=>{o();try{let e=await n();c({type:T.SetProjects,projects:e.projects})}catch(e){console.error(`Failed to refresh projects after settings update:`,e)}},e[13]=c,e[14]=O);let k=O,N,P;e[15]!==a.pathname||e[16]!==i?(N=()=>{(a.pathname===`/settings`||a.pathname===`/settings/project`||[`/settings/mcp-server-edit`,`/settings/add-skill`,`/settings/add-command`,`/settings/add-rule`,`/settings/add-agent`].some(e=>a.pathname.startsWith(e)))&&i(`/settings/general`,{replace:!0})},P=[a.pathname,i],e[15]=a.pathname,e[16]=i,e[17]=N,e[18]=P):(N=e[17],P=e[18]),(0,j.useEffect)(N,P);let U;e[19]===v?U=e[20]:(U=()=>(0,M.jsx)(ee,{onTitleClose:v,subtitle:`Settings`,onResetOnboarding:g,children:(0,M.jsx)(`div`,{className:`px-2 py-2`,children:(0,M.jsx)(re,{})})}),e[19]=v,e[20]=U);let W=U,G;e[21]!==f||e[22]!==D||e[23]!==k||e[24]!==C||e[25]!==u||e[26]!==r||e[27]!==s.projects?(G=()=>{if(u&&r)return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`Project Settings`}),children:(0,M.jsx)(F,{projectId:r,onProjectUpdated:k})});switch(f){case`general`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`General`}),children:(0,M.jsx)(ie,{})});case`providers`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(ue,{}),children:(0,M.jsx)(I,{})});case`models`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(te,{}),children:(0,M.jsx)(L,{})});case`skills`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`Skills`}),children:(0,M.jsx)(z,{})});case`rules`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`Rules`}),children:(0,M.jsx)(B,{})});case`slash-commands`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`Slash Commands`}),children:(0,M.jsx)(ae,{})});case`subagents`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`Subagents`}),children:(0,M.jsx)(oe,{})});case`instructions`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`Instructions`}),children:(0,M.jsx)(se,{})});case`mcp-servers`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`MCP Servers`}),children:(0,M.jsx)(R,{})});case`history`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`History`}),children:(0,M.jsx)(le,{isOpen:!0,onClose:D,initialFilter:C,projects:s.projects,inline:!0})});case`account`:return(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(H,{title:`Account`}),children:(0,M.jsx)(ce,{})});default:return(0,M.jsx)(H,{title:`Settings`})}},e[21]=f,e[22]=D,e[23]=k,e[24]=C,e[25]=u,e[26]=r,e[27]=s.projects,e[28]=G):G=e[28];let K=G,q,J;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>m(!0),J=()=>m(!1),e[29]=q,e[30]=J):(q=e[29],J=e[30]);let Y;e[31]===W?Y=e[32]:(Y=W(),e[31]=W,e[32]=Y);let X=`h-full overflow-auto ${p?`ml-[40px]`:``}`,Z;e[33]===K?Z=e[34]:(Z=K(),e[33]=K,e[34]=Z);let Q;e[35]!==X||e[36]!==Z?(Q=(0,M.jsx)(`div`,{className:X,children:Z}),e[35]=X,e[36]=Z,e[37]=Q):Q=e[37];let $;return e[38]!==Y||e[39]!==Q?($=(0,M.jsx)(ne,{ref:h,collapsible:!0,onCollapse:q,onExpand:J,sidebar:Y,children:Q}),e[38]=Y,e[39]=Q,e[40]=$):$=e[40],$}async function fe(){try{await f()}catch(e){console.error(`Failed to reset onboarding:`,e)}}export{U as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialogs-config-B91VQpxo.js","assets/rolldown-runtime-B1FJdls4.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ln as t,Mr as n,Rr as r,Un as i,ua as a,wa as o}from"./dialogs-config-B91VQpxo.js";import{Pt as s}from"./monaco-BGyhgQtx.js";var c=e(o(),1),l=n();function u({children:e,collapsed:n,title:o,onTitleClose:u,subtitle:d,headerAction:f,footer:p,onResetOnboarding:m,onLogoClick:h}){let g=(0,c.useRef)(0),_=(0,c.useRef)(null);return(0,c.useEffect)(()=>()=>{_.current&&clearTimeout(_.current)},[]),(0,l.jsxs)(`div`,{className:`flex flex-col bg-sidebar text-sidebar-foreground mx-2.5 mt-8 mr-10 rounded-3xl shadow-2xl overflow-hidden`,style:{containerType:`inline-size`,height:`calc(100% - 32px)`},children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-3 h-[61px]`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`div`,{className:`flex h-7 w-7 items-center justify-center overflow-hidden rounded-md border border-sidebar-border shadow-sm`,children:(0,l.jsx)(`img`,{src:`/tarsk.svg`,alt:`Tarsk`,className:`h-full w-full cursor-pointer`,onClick:m||h?async()=>{if(h?.(),m)if(_.current&&clearTimeout(_.current),g.current+=1,g.current>=3){g.current=0;let{resetOnboarding:e}=await s(async()=>{let{resetOnboarding:e}=await import(`./dialogs-config-B91VQpxo.js`).then(e=>e.w);return{resetOnboarding:e}},__vite__mapDeps([0,1]));e()}else _.current=setTimeout(()=>{g.current=0},500)}:void 0})}),!n&&(0,l.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,l.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,children:`Tarsk`}),d&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a,{className:`h-3 w-3 text-sidebar-foreground/60`}),(0,l.jsx)(`span`,{className:`text-sm font-medium text-sidebar-foreground/80`,children:d})]})]})]}),(o??u??f)&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[f&&!n&&f,o&&(0,l.jsx)(`span`,{className:`text-xs font-medium text-sidebar-foreground/80`,children:o}),u&&(0,l.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-7 w-7 text-sidebar-foreground`,onClick:u,children:[(0,l.jsx)(r,{className:`h-4 w-4`}),(0,l.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}),(0,l.jsx)(t,{className:`flex-1`,children:e}),p&&(0,l.jsx)(`div`,{className:`border-t border-sidebar-border`,children:p})]})}export{u as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialogs-config-VlhyoYms.js","assets/rolldown-runtime-B1FJdls4.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Br as t,Er as n,Fr as r,oa as i,ya as a,zn as o}from"./dialogs-config-VlhyoYms.js";import{Pt as s}from"./monaco-BGyhgQtx.js";var c=e(a(),1),l=r();function u({children:e,collapsed:r,title:a,onTitleClose:u,subtitle:d,headerAction:f,footer:p,onResetOnboarding:m,onLogoClick:h}){let g=(0,c.useRef)(0),_=(0,c.useRef)(null);return(0,c.useEffect)(()=>()=>{_.current&&clearTimeout(_.current)},[]),(0,l.jsxs)(`div`,{className:`flex flex-col bg-sidebar text-sidebar-foreground mx-2.5 mt-8 mr-10 rounded-3xl shadow-2xl overflow-hidden`,style:{containerType:`inline-size`,height:`calc(100% - 32px)`},children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-3 h-[61px]`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`div`,{className:`flex h-7 w-7 items-center justify-center overflow-hidden rounded-md border border-sidebar-border shadow-sm`,children:(0,l.jsx)(`img`,{src:`/tarsk.svg`,alt:`Tarsk`,className:`h-full w-full cursor-pointer`,onClick:m||h?async()=>{if(h?.(),m)if(_.current&&clearTimeout(_.current),g.current+=1,g.current>=3){g.current=0;let{resetOnboarding:e}=await s(async()=>{let{resetOnboarding:e}=await import(`./dialogs-config-VlhyoYms.js`).then(e=>e.O);return{resetOnboarding:e}},__vite__mapDeps([0,1]));e()}else _.current=setTimeout(()=>{g.current=0},500)}:void 0})}),!r&&(0,l.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,l.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,children:`Tarsk`}),d&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i,{className:`h-3 w-3 text-sidebar-foreground/60`}),(0,l.jsx)(`span`,{className:`text-sm font-medium text-sidebar-foreground/80`,children:d})]})]})]}),(a??u??f)&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[f&&!r&&f,a&&(0,l.jsx)(`span`,{className:`text-xs font-medium text-sidebar-foreground/80`,children:a}),u&&(0,l.jsxs)(n,{variant:`ghost`,size:`icon`,className:`h-7 w-7 text-sidebar-foreground`,onClick:u,children:[(0,l.jsx)(t,{className:`h-4 w-4`}),(0,l.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}),(0,l.jsx)(o,{className:`flex-1`,children:e}),p&&(0,l.jsx)(`div`,{className:`border-t border-sidebar-border`,children:p})]})}export{u as t};
@@ -0,0 +1 @@
1
+ import{Fr as e,Or as t,_a as n}from"./dialogs-config-VlhyoYms.js";var r=n(),i=e();function a(e){let n=(0,r.c)(8),a,o;n[0]===e?(a=n[1],o=n[2]):({className:a,...o}=e,n[0]=e,n[1]=a,n[2]=o);let s;n[3]===a?s=n[4]:(s=t(`animate-pulse rounded-md bg-muted`,a),n[3]=a,n[4]=s);let c;return n[5]!==o||n[6]!==s?(c=(0,i.jsx)(`div`,{className:s,...o}),n[5]=o,n[6]=s,n[7]=c):c=n[7],c}export{a as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$n as t,Kn as n,Mr as r,Sa as i,wa as a}from"./dialogs-config-B91VQpxo.js";var o=i(),s=e(a(),1),c=r(),l=s.forwardRef((e,r)=>{let i=(0,o.c)(23),a,s,l,u,d,f,p,m,h;i[0]===e?(a=i[1],s=i[2],l=i[3],u=i[4],d=i[5],f=i[6],p=i[7],m=i[8],h=i[9]):({className:s,selected:f,noBackground:u,level:l,basePadding:a,indentSize:m,asChild:h,style:p,...d}=e,i[0]=e,i[1]=a,i[2]=s,i[3]=l,i[4]=u,i[5]=d,i[6]=f,i[7]=p,i[8]=m,i[9]=h);let g=m===void 0?20:m,_=h===void 0?!1:h,v=l===void 0?void 0:(a??12)+l*g,y=_?n:`div`,b=f&&!u&&`bg-sidebar-accent text-sidebar-accent-foreground font-medium`,x=f&&u&&`font-bold text-foreground`,S;i[10]!==s||i[11]!==b||i[12]!==x?(S=t(`flex items-center gap-2 w-full min-w-0 justify-start px-3 py-2 cursor-pointer rounded-full text-sm transition-colors group overflow-hidden`,`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,b,x,s),i[10]=s,i[11]=b,i[12]=x,i[13]=S):S=i[13];let C=v===void 0?void 0:`${v}px`,w;i[14]!==p||i[15]!==C?(w={paddingLeft:C,...p},i[14]=p,i[15]=C,i[16]=w):w=i[16];let T;return i[17]!==y||i[18]!==d||i[19]!==r||i[20]!==S||i[21]!==w?(T=(0,c.jsx)(y,{ref:r,className:S,style:w,...d}),i[17]=y,i[18]=d,i[19]=r,i[20]=S,i[21]=w,i[22]=T):T=i[22],T});l.displayName=`StandardListItem`;export{l as t};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Fr as t,Or as n,Pr as r,_a as i,ya as a}from"./dialogs-config-VlhyoYms.js";var o=i(),s=e(a(),1),c=t(),l=s.forwardRef((e,t)=>{let i=(0,o.c)(23),a,s,l,u,d,f,p,m,h;i[0]===e?(a=i[1],s=i[2],l=i[3],u=i[4],d=i[5],f=i[6],p=i[7],m=i[8],h=i[9]):({className:s,selected:f,noBackground:u,level:l,basePadding:a,indentSize:m,asChild:h,style:p,...d}=e,i[0]=e,i[1]=a,i[2]=s,i[3]=l,i[4]=u,i[5]=d,i[6]=f,i[7]=p,i[8]=m,i[9]=h);let g=m===void 0?20:m,_=h===void 0?!1:h,v=l===void 0?void 0:(a??12)+l*g,y=_?r:`div`,b=f&&!u&&`bg-sidebar-accent text-sidebar-accent-foreground font-medium`,x=f&&u&&`font-bold text-foreground`,S;i[10]!==s||i[11]!==b||i[12]!==x?(S=n(`flex items-center gap-2 w-full min-w-0 justify-start px-3 py-2 cursor-pointer rounded-full text-sm transition-colors group overflow-hidden`,`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,b,x,s),i[10]=s,i[11]=b,i[12]=x,i[13]=S):S=i[13];let C=v===void 0?void 0:`${v}px`,w;i[14]!==p||i[15]!==C?(w={paddingLeft:C,...p},i[14]=p,i[15]=C,i[16]=w):w=i[16];let T;return i[17]!==y||i[18]!==d||i[19]!==t||i[20]!==S||i[21]!==w?(T=(0,c.jsx)(y,{ref:t,className:S,style:w,...d}),i[17]=y,i[18]=d,i[19]=t,i[20]=S,i[21]=w,i[22]=T):T=i[22],T});l.displayName=`StandardListItem`;export{l as t};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Sa as t,wa as n}from"./dialogs-config-B91VQpxo.js";var r=e(n(),1),i=t();function a(e){return typeof e==`string`?e.replace(/\\n/g,`
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{_a as t,ya as n}from"./dialogs-config-VlhyoYms.js";var r=e(n(),1),i=t();function a(e){return typeof e==`string`?e.replace(/\\n/g,`
2
2
  `).replace(/✅/g,`✓`):``}function o(e){if(!e||typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=/\[([A-Za-z]+)\]\s*/g,r,i=0;for(let e of t.matchAll(n))r=e[1],i=e.index+e[0].length;let a=r,o=a?t.slice(i):t;if(a&&o)return[{type:`reasoning`,text:o,label:a}];let s=[],c=0;for(;c<t.length;){let e=t.indexOf(`[`,c);if(e===-1){let e=t.slice(c).trim();e&&s.push({type:`reasoning`,text:e});break}let n=t.slice(c,e).trim();n&&s.push({type:`reasoning`,text:n});let r=0,i=-1;for(let n=e;n<t.length;n++)if(t[n]===`[`)r++;else if(t[n]===`]`&&(r--,r===0)){i=n;break}if(i===-1){let n=t.slice(e).trim();n&&s.push({type:`reasoning`,text:n});break}try{let n=JSON.parse(t.slice(e,i+1));if(Array.isArray(n)){for(let e of n)if(e&&typeof e==`object`&&`type`in e){let t=e.type;(t===`tool-result`||t===`tool_use`)&&s.push(e)}}}catch{let n=t.slice(e,i+1).trim();n&&s.push({type:`reasoning`,text:n})}c=i+1}return s.length>0?s:null}function s(e){return e.map(e=>{if(typeof e==`object`&&e&&!(`type`in e)){let t=e;if(t.reasoning)return{type:`reasoning`,text:typeof t.reasoning==`string`?t.reasoning:JSON.stringify(t.reasoning)};let n=t.text??t.content??t.answer;if(n)return{type:`text`,text:typeof n==`string`?n:JSON.stringify(n)}}return e})}function c(e){let t=[];e.reasoning&&typeof e.reasoning==`string`&&t.push({type:`reasoning`,text:e.reasoning});let n=(typeof e.text==`string`?e.text:null)??(typeof e.content==`string`?e.content:null)??(typeof e.answer==`string`?e.answer:null);return n&&t.push({type:`text`,text:n}),t.length===0&&Object.keys(e).length>0&&t.push({type:`text`,text:JSON.stringify(e,null,2)}),t}function l(e){if(!e)return null;let t=e.trim();if(t.startsWith(`{`)||t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return s(e);if(typeof e==`object`&&e)return c(e)}catch{}let n=[],r=e.indexOf(`{`),i=e.indexOf(`[`),a=r===-1?i:i===-1?r:Math.min(r,i);if(a!==-1){let t=e.slice(a),r=Math.max(t.lastIndexOf(`]`),t.lastIndexOf(`}`));if(r!==-1){let e=t.substring(0,r+1);try{let i=JSON.parse(e);Array.isArray(i)?n.push(...s(i)):n.push(...c(i));let a=t.substring(r+1).trim();return a&&n.push({type:`text`,text:a}),n}catch{}}}return null}function u(e,t,n){let r=e[e.length-1];return r?.type===t?[...e.slice(0,-1),{type:t,chunks:[...r.chunks,n]}]:[...e,{type:t,chunks:[n]}]}function d(e,t){return e[e.length-1]?.type===`content`?[...e.slice(0,-1),{type:`content`,chunks:[t]}]:[...e,{type:`content`,chunks:[t]}]}function f(e){let t=[];for(let n of e){let e=n.chunks.join(``);if(n.type===`thinking`){let n=o(e)??[];t.push(...n)}else{let n=l(e)??(e.trim()?[{type:`text`,text:e}]:[]);t.push(...n)}}return t}function p(e,t=!1){let n=[],r=[],i=()=>{r.length>0&&(n.push({type:`thinking-group`,text:r.join(`
3
3
 
4
4
  `),isCurrentlyStreaming:!1}),r=[])};for(let t of e)t.type===`reasoning`&&`text`in t?r.push(t.text):(i(),n.push(t));if(i(),t&&n.length>0){let e=n[n.length-1];e.type===`thinking-group`&&(e.isCurrentlyStreaming=!0)}return n}function m(e){let t=f(e);return t.length===0?`...`:t.length===1&&t[0]?.type===`text`&&`text`in t[0]?t[0].text:JSON.stringify(t)}var h=function(e){return e.SetProjects=`SET_PROJECTS`,e.SetProjectsLoading=`SET_PROJECTS_LOADING`,e.SelectThread=`SELECT_THREAD`,e.SetMessages=`SET_MESSAGES`,e.AddMessage=`ADD_MESSAGE`,e.EnqueueChatMessage=`ENQUEUE_CHAT_MESSAGE`,e.RemoveQueuedChatMessage=`REMOVE_QUEUED_CHAT_MESSAGE`,e.SetStreaming=`SET_STREAMING`,e.AppendStreamContent=`APPEND_STREAM_CONTENT`,e.SetStreamContent=`SET_STREAM_CONTENT`,e.AppendStreamThinking=`APPEND_STREAM_THINKING`,e.AppendStreamChunk=`APPEND_STREAM_CHUNK`,e.SetStreamModel=`SET_STREAM_MODEL`,e.SetProjectModel=`SET_PROJECT_MODEL`,e.ResetStream=`RESET_STREAM`,e.StopStream=`STOP_STREAM`,e.ToggleSidebar=`TOGGLE_SIDEBAR`,e.SetCreatingProject=`SET_CREATING_PROJECT`,e.ConfigUpdated=`CONFIG_UPDATED`,e.SetProcessingThreads=`SET_PROCESSING_THREADS`,e.AddProcessingThread=`ADD_PROCESSING_THREAD`,e.RemoveProcessingThread=`REMOVE_PROCESSING_THREAD`,e.AddCreatingProject=`ADD_CREATING_PROJECT`,e.AddCreatingThread=`ADD_CREATING_THREAD`,e.RemoveCreatingProject=`REMOVE_CREATING_PROJECT`,e.RemoveCreatingThread=`REMOVE_CREATING_THREAD`,e.MarkThreadCompleted=`MARK_THREAD_COMPLETED`,e.ClearThreadCompleted=`CLEAR_THREAD_COMPLETED`,e.AddDeletingThread=`ADD_DELETING_THREAD`,e.RemoveDeletingThread=`REMOVE_DELETING_THREAD`,e.AddDeletingProject=`ADD_DELETING_PROJECT`,e.RemoveDeletingProject=`REMOVE_DELETING_PROJECT`,e.AppendCommandOutput=`APPEND_COMMAND_OUTPUT`,e.SetRunningCommand=`SET_RUNNING_COMMAND`,e.ClearCommandOutput=`CLEAR_COMMAND_OUTPUT`,e.ToggleTerminal=`TOGGLE_TERMINAL`,e.SetTerminalOpen=`SET_TERMINAL_OPEN`,e.QueueTerminalCommand=`QUEUE_TERMINAL_COMMAND`,e.ClearQueuedTerminalCommand=`CLEAR_QUEUED_TERMINAL_COMMAND`,e.AppendTerminalLine=`APPEND_TERMINAL_LINE`,e.ClearTerminalOutput=`CLEAR_TERMINAL_OUTPUT`,e.SetTerminalHeight=`SET_TERMINAL_HEIGHT`,e.SetTerminalCwd=`SET_TERMINAL_CWD`,e.SetTerminalRunning=`SET_TERMINAL_RUNNING`,e.SetTerminalHistory=`SET_TERMINAL_HISTORY`,e.SetTerminalHistoryIndex=`SET_TERMINAL_HISTORY_INDEX`,e.UpdateThreadTitle=`UPDATE_THREAD_TITLE`,e.ClearFocusChatInput=`CLEAR_FOCUS_CHAT_INPUT`,e.ClearMessages=`CLEAR_MESSAGES`,e.UpdateToolCallProgress=`UPDATE_TOOL_CALL_PROGRESS`,e.SetPendingChatMessage=`SET_PENDING_CHAT_MESSAGE`,e.ClearPendingChatMessage=`CLEAR_PENDING_CHAT_MESSAGE`,e.IncrementStreamEventCount=`INCREMENT_STREAM_EVENT_COUNT`,e.SetDiffComments=`SET_DIFF_COMMENTS`,e.ClearSelection=`CLEAR_SELECTION`,e.SetChatInputDraft=`SET_CHAT_INPUT_DRAFT`,e.ClearChatInputDraft=`CLEAR_CHAT_INPUT_DRAFT`,e}({}),g={isStreaming:!1,streamingContent:``,streamingThinking:``,streamingSegments:[],streamingModel:``,streamingEventCount:0};function _(){return{...g,streamingSegments:[]}}function v(e,t){return t?e[t]??_():_()}function y(e,t){return t.threadId??e.selectedThreadId}function b(e,t,n,r=!1){if(!t)return{...e,...n,toolCallProgress:r?{}:e.toolCallProgress};let i={...e.threadStreamingStates,[t]:n};return t===e.selectedThreadId?{...e,...n,threadStreamingStates:i,toolCallProgress:r?{}:e.toolCallProgress}:{...e,threadStreamingStates:i}}var x={projects:[],projectsLoading:!0,selectedThreadId:null,selectedProjectId:null,messages:[],messagesLoaded:!1,queuedChatMessages:[],isStreaming:!1,streamingContent:``,streamingThinking:``,streamingSegments:[],streamingModel:``,streamingEventCount:0,threadStreamingStates:{},projectModelSelections:{},sidebarOpen:!0,isCreatingProject:!1,configUpdatedAt:0,processingThreadIds:[],completedThreadIds:[],deletingThreadIds:[],deletingProjectIds:[],commandOutput:``,isRunningCommand:!1,terminalStates:{},focusChatInput:!1,toolCallProgress:{},pendingChatMessage:null,diffComments:{},chatInputDrafts:{}};function S(e,t){switch(t.type){case h.SetProjects:{let n={...e.projectModelSelections};for(let e of t.projects)for(let t of e.threads){if(!t.model)continue;let e=n[t.threadId];n[t.threadId]={id:t.model,provider:t.modelProvider,name:e?.name??t.model,description:e?.description??``,context_length:e?.context_length,contextWindow:e?.contextWindow,features:e?.features,input_modalities:e?.input_modalities,max_output:e?.max_output,pricing:e?.pricing,tarsk_use:e?.tarsk_use,coding_index:e?.coding_index,supportsImages:e?.supportsImages}}return{...e,projects:t.projects,projectModelSelections:n}}case h.SetProjectsLoading:return{...e,projectsLoading:t.projectsLoading};case h.SelectThread:{let n=v(e.threadStreamingStates,t.threadId);return{...e,...n,selectedThreadId:t.threadId,selectedProjectId:t.projectId,messages:t.initialMessages??[],messagesLoaded:!1,focusChatInput:t.focusInput??!1}}case h.ClearSelection:return{...e,..._(),selectedThreadId:null,selectedProjectId:null,messages:[],messagesLoaded:!1};case h.SetMessages:return{...e,messages:t.messages,messagesLoaded:!0};case h.AddMessage:return t.threadId&&t.threadId!==e.selectedThreadId?e:{...e,messages:[...e.messages,t.message]};case h.EnqueueChatMessage:return{...e,queuedChatMessages:[...e.queuedChatMessages,t.message]};case h.RemoveQueuedChatMessage:return{...e,queuedChatMessages:e.queuedChatMessages.filter(e=>e.id!==t.queuedMessageId)};case h.SetStreaming:{let n=y(e,t);return b(e,n,{...v(e.threadStreamingStates,n),isStreaming:t.isStreaming})}case h.AppendStreamContent:{let n=y(e,t),r=v(e.threadStreamingStates,n);return b(e,n,{...r,streamingContent:r.streamingContent+t.content})}case h.SetStreamContent:{let n=y(e,t),r=v(e.threadStreamingStates,n),i=d(r.streamingSegments,t.content);return b(e,n,{...r,streamingContent:t.content,streamingSegments:i})}case h.AppendStreamThinking:{let n=y(e,t),r=v(e.threadStreamingStates,n);return b(e,n,{...r,streamingThinking:r.streamingThinking+t.content})}case h.IncrementStreamEventCount:{let n=y(e,t),r=v(e.threadStreamingStates,n);return b(e,n,{...r,streamingEventCount:r.streamingEventCount+1})}case h.AppendStreamChunk:{let n=y(e,t),r=v(e.threadStreamingStates,n);return b(e,n,{...r,streamingSegments:t.segments,streamingContent:t.chunkType===`content`?r.streamingContent+t.content:r.streamingContent,streamingThinking:t.chunkType===`thinking`?r.streamingThinking+t.content:r.streamingThinking})}case h.SetStreamModel:{let n=y(e,t);return b(e,n,{...v(e.threadStreamingStates,n),streamingModel:t.model})}case h.SetProjectModel:return console.log(`[Store] SetProjectModel action:`,{threadId:t.threadId,model:{id:t.model.id,provider:t.model.provider}}),{...e,projects:e.projects.map(e=>({...e,threads:e.threads.map(e=>e.threadId===t.threadId?{...e,model:t.model.id,modelProvider:t.model.provider}:e)})),projectModelSelections:{...e.projectModelSelections,[t.threadId]:t.model}};case h.ResetStream:return b(e,y(e,t),_(),!0);case h.StopStream:{let n=y(e,t);return b(e,n,{...v(e.threadStreamingStates,n),isStreaming:!1})}case h.ToggleSidebar:return{...e,sidebarOpen:!e.sidebarOpen};case h.SetCreatingProject:return{...e,isCreatingProject:t.isCreating};case h.ConfigUpdated:return{...e,configUpdatedAt:Date.now()};case h.SetProcessingThreads:return{...e,processingThreadIds:t.threadIds};case h.AddProcessingThread:return{...e,processingThreadIds:e.processingThreadIds.includes(t.threadId)?e.processingThreadIds:[...e.processingThreadIds,t.threadId]};case h.RemoveProcessingThread:return{...e,processingThreadIds:e.processingThreadIds.filter(e=>e!==t.threadId)};case h.AddCreatingProject:return{...e,projects:[...e.projects,{projectId:t.projectId,name:t.projectName,gitUrl:t.gitUrl,threads:[{threadId:t.threadId,title:`thread-1`,path:``,currentBranch:``}]}]};case h.AddCreatingThread:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:[...e.threads,{threadId:t.threadId,title:t.title,path:``,currentBranch:``}]}:e)};case h.RemoveCreatingProject:return{...e,projects:e.projects.filter(e=>e.projectId!==t.projectId)};case h.RemoveCreatingThread:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:e.threads.filter(e=>e.threadId!==t.threadId)}:e)};case h.MarkThreadCompleted:return{...e,completedThreadIds:e.completedThreadIds.includes(t.threadId)?e.completedThreadIds:[...e.completedThreadIds,t.threadId]};case h.ClearThreadCompleted:return{...e,completedThreadIds:e.completedThreadIds.filter(e=>e!==t.threadId)};case h.AddDeletingThread:return{...e,deletingThreadIds:e.deletingThreadIds.includes(t.threadId)?e.deletingThreadIds:[...e.deletingThreadIds,t.threadId]};case h.RemoveDeletingThread:return{...e,deletingThreadIds:e.deletingThreadIds.filter(e=>e!==t.threadId)};case h.AddDeletingProject:return{...e,deletingProjectIds:e.deletingProjectIds.includes(t.projectId)?e.deletingProjectIds:[...e.deletingProjectIds,t.projectId]};case h.RemoveDeletingProject:return{...e,deletingProjectIds:e.deletingProjectIds.filter(e=>e!==t.projectId)};case h.AppendCommandOutput:return{...e,commandOutput:e.commandOutput+t.content};case h.SetRunningCommand:return{...e,isRunningCommand:t.isRunning};case h.ClearCommandOutput:return{...e,commandOutput:``};case h.ToggleTerminal:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,open:!r.open}}}}case h.SetTerminalOpen:{let n=t.threadId??`default`,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,open:t.open}}}}case h.QueueTerminalCommand:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,queuedRelativeFolder:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,queuedCommand:t.command,queuedRelativeFolder:t.relativeFolder??null,open:!0}}}}case h.ClearQueuedTerminalCommand:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,queuedCommand:null}}}}case h.AppendTerminalLine:{let n=t.threadId??`default`,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,outputLines:[...r.outputLines,t.line]}}}}case h.ClearTerminalOutput:{let n=t.threadId??`default`,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,outputLines:[]}}}}case h.SetTerminalHeight:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,height:t.height}}}}case h.SetTerminalCwd:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,cwd:t.cwd}}}}case h.SetTerminalRunning:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,isRunning:t.isRunning}}}}case h.SetTerminalHistory:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,history:t.history}}}}case h.SetTerminalHistoryIndex:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,historyIndex:t.index}}}}case h.UpdateThreadTitle:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:e.threads.map(e=>e.threadId===t.threadId?{...e,title:t.title}:e)}:e)};case h.ClearFocusChatInput:return{...e,focusChatInput:!1};case h.ClearMessages:return{...e,messages:[]};case h.UpdateToolCallProgress:return{...e,toolCallProgress:{...e.toolCallProgress,[t.toolCallId]:t.progress}};case h.SetPendingChatMessage:return{...e,pendingChatMessage:t.message};case h.ClearPendingChatMessage:return{...e,pendingChatMessage:null};case h.SetDiffComments:return{...e,diffComments:{...e.diffComments,[t.threadId]:t.comments}};case h.SetChatInputDraft:return{...e,chatInputDrafts:{...e.chatInputDrafts,[t.threadId]:t.draft}};case h.ClearChatInputDraft:{let{[t.threadId]:n,...r}=e.chatInputDrafts;return{...e,chatInputDrafts:r}}default:return e}}var C=(0,r.createContext)({state:x,dispatch:()=>{}});function w(){return(0,r.useContext)(C)}function T(e){let t=(0,i.c)(11),{state:n,dispatch:r}=w();if(!e){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n={terminalState:{open:!1,queuedCommand:null,queuedRelativeFolder:null,outputLines:e,height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1},dispatch:E},t[1]=n):n=t[1],n}let a;t[2]!==n.terminalStates||t[3]!==e?(a=n.terminalStates[e]||{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1},t[2]=n.terminalStates,t[3]=e,t[4]=a):a=t[4];let o=a,s;t[5]!==r||t[6]!==e?(s=t=>{r({...t,threadId:e})},t[5]=r,t[6]=e,t[7]=s):s=t[7];let c=s,l;return t[8]!==c||t[9]!==o?(l={terminalState:o,dispatch:c},t[8]=c,t[9]=o,t[10]=l):l=t[10],l}function E(){}export{w as a,f as c,p as d,a as f,x as i,u as l,o as m,C as n,T as o,l as p,S as r,m as s,h as t,d as u};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{wa as t}from"./dialogs-config-B91VQpxo.js";var n=e(t(),1),r=(0,n.createContext)({activeMainTab:`chat`,setActiveMainTab:()=>{},devServerUrl:null,setDevServerUrl:()=>{},devServerRunning:!1,setDevServerRunning:()=>{},devServerLoading:!1,setDevServerLoading:()=>{},terminalNotification:!1,setTerminalNotification:()=>{},pendingExplorerPath:null,setPendingExplorerPath:()=>{},explorerRefreshTick:0,triggerExplorerRefresh:()=>{},explorerClearPath:null,setExplorerClearPath:()=>{},browserResetTrigger:0,triggerBrowserReset:()=>{}});function i(){return(0,n.useContext)(r)}export{i as n,r as t};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{ya as t}from"./dialogs-config-VlhyoYms.js";var n=e(t(),1),r=(0,n.createContext)({activeMainTab:`chat`,setActiveMainTab:()=>{},devServerUrl:null,setDevServerUrl:()=>{},devServerRunning:!1,setDevServerRunning:()=>{},devServerLoading:!1,setDevServerLoading:()=>{},terminalNotification:!1,setTerminalNotification:()=>{},pendingExplorerPath:null,setPendingExplorerPath:()=>{},explorerRefreshTick:0,triggerExplorerRefresh:()=>{},explorerClearPath:null,setExplorerClearPath:()=>{},browserResetTrigger:0,triggerBrowserReset:()=>{}});function i(){return(0,n.useContext)(r)}export{i as n,r as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Fr as t,Or as n,_a as r,ya as i}from"./dialogs-config-VlhyoYms.js";import{B as a,R as o,V as s,z as c}from"./react-vendor-CtZx3FWA.js";var l=r(),u=e(i(),1),d=t(),f=a,p=u.forwardRef((e,t)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,d.jsx)(c,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});p.displayName=c.displayName;var m=u.forwardRef((e,t)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm`,i),r[3]=i,r[4]=o);let c;return r[5]!==a||r[6]!==t||r[7]!==o?(c=(0,d.jsx)(s,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=c):c=r[8],c});m.displayName=s.displayName;var h=u.forwardRef((e,t)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let s;r[3]===i?s=r[4]:(s=n(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,i),r[3]=i,r[4]=s);let c;return r[5]!==a||r[6]!==t||r[7]!==s?(c=(0,d.jsx)(o,{ref:t,className:s,...a}),r[5]=a,r[6]=t,r[7]=s,r[8]=c):c=r[8],c});h.displayName=o.displayName;export{m as i,h as n,p as r,f as t};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Mr as t,an as n,ta as r,ua as i,wa as a}from"./dialogs-config-B91VQpxo.js";import{a as o,o as s,t as c}from"./store-D28g9VUj.js";import{n as l}from"./tab-context-C3z7YU59.js";var u=e(a(),1),d=t();function f(){let e=o().state,{selectedProjectId:t,selectedThreadId:a}=e,{terminalState:f,dispatch:p}=s(a),{queuedCommand:m,queuedRelativeFolder:h,outputLines:g,history:_,historyIndex:v,cwd:y,isRunning:b}=f,[x,S]=(0,u.useState)(``),[C,w]=(0,u.useState)([]),T=e.projects.flatMap(e=>e.threads).find(e=>e.threadId===a)?.path??null,E=!y||y===`.`||y===`./`?T:y,D=!E||E===T,{activeMainTab:O}=l(),k=(0,u.useRef)(null),A=(0,u.useRef)(null),j=(0,u.useRef)(0);(0,u.useEffect)(()=>{k.current&&(k.current.scrollTop=k.current.scrollHeight)},[C]),(0,u.useEffect)(()=>{w(g),j.current=g.length},[a,g]),(0,u.useEffect)(()=>{if(g.length===0)w([]),j.current=0;else if(g.length>j.current){let e=g.slice(j.current);w(t=>[...t,...e]),j.current=g.length}},[g]),(0,u.useEffect)(()=>{b||A.current?.focus()},[b]),(0,u.useEffect)(()=>{O===`terminal`&&A.current?.focus()},[O]);let M=(0,u.useCallback)(async(e,r)=>{if(!(!t||!a||!e.trim())){p({type:c.AppendTerminalLine,line:{type:`input`,content:e}}),p({type:c.SetTerminalHistory,history:[e,..._.filter(t=>t!==e)].slice(0,50)}),p({type:c.SetTerminalHistoryIndex,index:-1}),S(``),p({type:c.SetTerminalRunning,isRunning:!0});try{let i=await n(t,a,e,r??void 0);if(!i){p({type:c.AppendTerminalLine,line:{type:`system`,content:`Command started but no output stream received.`}}),p({type:c.SetTerminalRunning,isRunning:!1});return}let o=i.getReader(),s=new TextDecoder,l=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;l+=s.decode(t,{stream:!0});let n=l.split(`
2
- `);l=n.pop()??``;for(let e of n)if(e.trim())try{let t=JSON.parse(e);typeof t==`string`?p({type:c.AppendTerminalLine,line:{type:`output`,content:t}}):t.type===`error`?p({type:c.AppendTerminalLine,line:{type:`error`,content:t.message}}):t.type===`cwd`&&p({type:c.SetTerminalCwd,cwd:t.path})}catch{p({type:c.AppendTerminalLine,line:{type:`output`,content:e}})}}if(l.trim())try{let e=JSON.parse(l);typeof e==`string`?p({type:c.AppendTerminalLine,line:{type:`output`,content:e}}):e.type===`error`?p({type:c.AppendTerminalLine,line:{type:`error`,content:e.message}}):e.type===`cwd`&&p({type:c.SetTerminalCwd,cwd:e.path})}catch{p({type:c.AppendTerminalLine,line:{type:`output`,content:l}})}}catch(e){p({type:c.AppendTerminalLine,line:{type:`error`,content:e instanceof Error?e.message:`Failed to run command`}})}finally{p({type:c.SetTerminalRunning,isRunning:!1})}}},[t,a,p,_]);return(0,u.useEffect)(()=>{m&&!b&&(M(m,h??void 0),p({type:c.ClearQueuedTerminalCommand}))},[m,h,b,p,M]),(0,d.jsxs)(`div`,{className:`flex flex-col h-full bg-neutral-950 text-neutral-200 font-mono text-sm overflow-hidden`,children:[(0,d.jsxs)(`div`,{ref:k,className:`flex-1 overflow-y-auto p-4 space-y-0.5 terminal-scrollbar`,onClick:e=>{e.target===e.currentTarget&&A.current?.focus()},children:[C.length===0&&!b&&(0,d.jsx)(`div`,{className:`text-neutral-600 italic text-xs`,children:`Enter your commands below...`}),C.map((e,t)=>(0,d.jsxs)(`div`,{className:`whitespace-pre-wrap break-all leading-6 ${e.type===`input`?`flex items-start gap-2 text-neutral-200`:e.type===`error`?`text-red-400`:e.type===`system`?`text-blue-400`:``}`,children:[e.type===`input`&&(0,d.jsx)(i,{className:`h-4 w-4 mt-1 shrink-0 text-blue-400/70`}),(0,d.jsx)(`span`,{children:e.content})]},t))]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-t border-white/5 bg-white/5`,children:[!D&&(0,d.jsx)(`span`,{className:`text-blue-400 text-xs font-bold whitespace-nowrap`,children:E.split(`/`).pop()}),(0,d.jsx)(i,{className:`h-4 w-4 text-blue-400 ${D?``:`-ml-1`}`}),(0,d.jsx)(`input`,{ref:A,type:`text`,className:`flex-1 bg-transparent border-none outline-none text-neutral-200 placeholder:text-neutral-700 h-6`,placeholder:b?`Running...`:`Type a command...`,value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)M(x);else if(e.key===`ArrowUp`){e.preventDefault();let t=v+1;t<_.length&&(p({type:c.SetTerminalHistoryIndex,index:t}),S(_[t]))}else if(e.key===`ArrowDown`){e.preventDefault();let t=v-1;t>=0?(p({type:c.SetTerminalHistoryIndex,index:t}),S(_[t])):(p({type:c.SetTerminalHistoryIndex,index:-1}),S(``))}},disabled:b}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 rounded border border-white/10 bg-white/5`,children:[(0,d.jsx)(r,{className:`h-3 w-3 text-neutral-600`}),(0,d.jsx)(`span`,{className:`text-[10px] text-neutral-600 uppercase font-bold`,children:`Enter`})]})]})]})}export{f as TerminalPanel};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Fr as t,Qi as n,oa as r,sn as i,ya as a}from"./dialogs-config-VlhyoYms.js";import{a as o,o as s,t as c}from"./store-DUqJt-K-.js";import{n as l}from"./tab-context-BYpxvaoz.js";var u=e(a(),1),d=t();function f(){let e=o().state,{selectedProjectId:t,selectedThreadId:a}=e,{terminalState:f,dispatch:p}=s(a),{queuedCommand:m,queuedRelativeFolder:h,outputLines:g,history:_,historyIndex:v,cwd:y,isRunning:b}=f,[x,S]=(0,u.useState)(``),[C,w]=(0,u.useState)([]),T=e.projects.flatMap(e=>e.threads).find(e=>e.threadId===a)?.path??null,E=!y||y===`.`||y===`./`?T:y,D=!E||E===T,{activeMainTab:O}=l(),k=(0,u.useRef)(null),A=(0,u.useRef)(null),j=(0,u.useRef)(0);(0,u.useEffect)(()=>{k.current&&(k.current.scrollTop=k.current.scrollHeight)},[C]),(0,u.useEffect)(()=>{w(g),j.current=g.length},[a,g]),(0,u.useEffect)(()=>{if(g.length===0)w([]),j.current=0;else if(g.length>j.current){let e=g.slice(j.current);w(t=>[...t,...e]),j.current=g.length}},[g]),(0,u.useEffect)(()=>{b||A.current?.focus()},[b]),(0,u.useEffect)(()=>{O===`terminal`&&A.current?.focus()},[O]);let M=(0,u.useCallback)(async(e,n)=>{if(!(!t||!a||!e.trim())){p({type:c.AppendTerminalLine,line:{type:`input`,content:e}}),p({type:c.SetTerminalHistory,history:[e,..._.filter(t=>t!==e)].slice(0,50)}),p({type:c.SetTerminalHistoryIndex,index:-1}),S(``),p({type:c.SetTerminalRunning,isRunning:!0});try{let r=await i(t,a,e,n??void 0);if(!r){p({type:c.AppendTerminalLine,line:{type:`system`,content:`Command started but no output stream received.`}}),p({type:c.SetTerminalRunning,isRunning:!1});return}let o=r.getReader(),s=new TextDecoder,l=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;l+=s.decode(t,{stream:!0});let n=l.split(`
2
+ `);l=n.pop()??``;for(let e of n)if(e.trim())try{let t=JSON.parse(e);typeof t==`string`?p({type:c.AppendTerminalLine,line:{type:`output`,content:t}}):t.type===`error`?p({type:c.AppendTerminalLine,line:{type:`error`,content:t.message}}):t.type===`cwd`&&p({type:c.SetTerminalCwd,cwd:t.path})}catch{p({type:c.AppendTerminalLine,line:{type:`output`,content:e}})}}if(l.trim())try{let e=JSON.parse(l);typeof e==`string`?p({type:c.AppendTerminalLine,line:{type:`output`,content:e}}):e.type===`error`?p({type:c.AppendTerminalLine,line:{type:`error`,content:e.message}}):e.type===`cwd`&&p({type:c.SetTerminalCwd,cwd:e.path})}catch{p({type:c.AppendTerminalLine,line:{type:`output`,content:l}})}}catch(e){p({type:c.AppendTerminalLine,line:{type:`error`,content:e instanceof Error?e.message:`Failed to run command`}})}finally{p({type:c.SetTerminalRunning,isRunning:!1})}}},[t,a,p,_]);return(0,u.useEffect)(()=>{m&&!b&&(M(m,h??void 0),p({type:c.ClearQueuedTerminalCommand}))},[m,h,b,p,M]),(0,d.jsxs)(`div`,{className:`flex flex-col h-full bg-neutral-950 text-neutral-200 font-mono text-sm overflow-hidden`,children:[(0,d.jsxs)(`div`,{ref:k,className:`flex-1 overflow-y-auto p-4 space-y-0.5 terminal-scrollbar`,onClick:e=>{e.target===e.currentTarget&&A.current?.focus()},children:[C.length===0&&!b&&(0,d.jsx)(`div`,{className:`text-neutral-600 italic text-xs`,children:`Enter your commands below...`}),C.map((e,t)=>(0,d.jsxs)(`div`,{className:`whitespace-pre-wrap break-all leading-6 ${e.type===`input`?`flex items-start gap-2 text-neutral-200`:e.type===`error`?`text-red-400`:e.type===`system`?`text-blue-400`:``}`,children:[e.type===`input`&&(0,d.jsx)(r,{className:`h-4 w-4 mt-1 shrink-0 text-blue-400/70`}),(0,d.jsx)(`span`,{children:e.content})]},t))]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-t border-white/5 bg-white/5`,children:[!D&&(0,d.jsx)(`span`,{className:`text-blue-400 text-xs font-bold whitespace-nowrap`,children:E.split(`/`).pop()}),(0,d.jsx)(r,{className:`h-4 w-4 text-blue-400 ${D?``:`-ml-1`}`}),(0,d.jsx)(`input`,{ref:A,type:`text`,className:`flex-1 bg-transparent border-none outline-none text-neutral-200 placeholder:text-neutral-700 h-6`,placeholder:b?`Running...`:`Type a command...`,value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)M(x);else if(e.key===`ArrowUp`){e.preventDefault();let t=v+1;t<_.length&&(p({type:c.SetTerminalHistoryIndex,index:t}),S(_[t]))}else if(e.key===`ArrowDown`){e.preventDefault();let t=v-1;t>=0?(p({type:c.SetTerminalHistoryIndex,index:t}),S(_[t])):(p({type:c.SetTerminalHistoryIndex,index:-1}),S(``))}},disabled:b}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 rounded border border-white/10 bg-white/5`,children:[(0,d.jsx)(n,{className:`h-3 w-3 text-neutral-600`}),(0,d.jsx)(`span`,{className:`text-[10px] text-neutral-600 uppercase font-bold`,children:`Enter`})]})]})]})}export{f as TerminalPanel};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Fr as t,Or as n,_a as r,ya as i}from"./dialogs-config-VlhyoYms.js";var a=r(),o=e(i(),1),s=t(),c=o.forwardRef((e,t)=>{let r=(0,a.c)(9),i,o;r[0]===e?(i=r[1],o=r[2]):({className:i,...o}=e,r[0]=e,r[1]=i,r[2]=o);let c;r[3]===i?c=r[4]:(c=n(`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,i),r[3]=i,r[4]=c);let l;return r[5]!==o||r[6]!==t||r[7]!==c?(l=(0,s.jsx)(`textarea`,{className:c,ref:t,...o}),r[5]=o,r[6]=t,r[7]=c,r[8]=l):l=r[8],l});c.displayName=`Textarea`;export{c as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./index-DaJT5K7g.js";export{e as TodosView};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{b as t,m as n,wa as r}from"./dialogs-config-B91VQpxo.js";var i=e(r(),1),a=75,o=125,s=100;function c(e){document.documentElement.style.fontSize=`${e}%`}function l(){let[e,r]=(0,i.useState)(()=>n(s));(0,i.useEffect)(()=>{c(e)},[e]);function l(e){let n=Math.max(a,Math.min(o,Math.round(e)));r(n),t(n)}return{scale:e,updateScale:l,resetScale:(0,i.useCallback)(()=>{l(s)},[]),min:a,max:o,default:s}}function u(){c(n(s))}export{l as n,u as t};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{b as t,p as n,ya as r}from"./dialogs-config-VlhyoYms.js";var i=e(r(),1),a=75,o=125,s=100;function c(e){document.documentElement.style.fontSize=`${e}%`}function l(){let[e,r]=(0,i.useState)(()=>n(s));(0,i.useEffect)(()=>{c(e)},[e]);function l(e){let n=Math.max(a,Math.min(o,Math.round(e)));r(n),t(n)}return{scale:e,updateScale:l,resetScale:(0,i.useCallback)(()=>{l(s)},[]),min:a,max:o,default:s}}function u(){c(n(s))}export{l as n,u as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Sa as t,wa as n}from"./dialogs-config-B91VQpxo.js";var r=t(),i=e(n(),1),a=1,o=1e6,s=0;function c(){return s=(s+1)%(2**53-1),s.toString()}var l=new Map,u=e=>{if(l.has(e))return;let t=setTimeout(()=>{l.delete(e),m({type:`REMOVE_TOAST`,toastId:e})},o);l.set(e,t)},d=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,a)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?u(n):e.toasts.forEach(e=>{u(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},f=[],p={toasts:[]};function m(e){p=d(p,e),f.forEach(e=>{e(p)})}function h({...e}){let t=c(),n=e=>m({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>m({type:`DISMISS_TOAST`,toastId:t});return m({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function g(){let e=(0,r.c)(5),[t,n]=i.useState(p),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>(f.push(n),()=>{let e=f.indexOf(n);e>-1&&f.splice(e,1)}),e[0]=a):a=e[0];let o;e[1]===t?o=e[2]:(o=[t],e[1]=t,e[2]=o),i.useEffect(a,o);let s;return e[3]===t?s=e[4]:(s={...t,toast:h,dismiss:_},e[3]=t,e[4]=s),s}function _(e){return m({type:`DISMISS_TOAST`,toastId:e})}export{g as n,h as t};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{_a as t,ya as n}from"./dialogs-config-VlhyoYms.js";var r=t(),i=e(n(),1),a=1,o=1e6,s=0;function c(){return s=(s+1)%(2**53-1),s.toString()}var l=new Map,u=e=>{if(l.has(e))return;let t=setTimeout(()=>{l.delete(e),m({type:`REMOVE_TOAST`,toastId:e})},o);l.set(e,t)},d=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,a)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?u(n):e.toasts.forEach(e=>{u(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},f=[],p={toasts:[]};function m(e){p=d(p,e),f.forEach(e=>{e(p)})}function h({...e}){let t=c(),n=e=>m({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>m({type:`DISMISS_TOAST`,toastId:t});return m({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function g(){let e=(0,r.c)(5),[t,n]=i.useState(p),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>(f.push(n),()=>{let e=f.indexOf(n);e>-1&&f.splice(e,1)}),e[0]=a):a=e[0];let o;e[1]===t?o=e[2]:(o=[t],e[1]=t,e[2]=o),i.useEffect(a,o);let s;return e[3]===t?s=e[4]:(s={...t,toast:h,dismiss:_},e[3]=t,e[4]=s),s}function _(e){return m({type:`DISMISS_TOAST`,toastId:e})}export{g as n,h as t};