tarsk 0.4.30 → 0.5.32

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 (91) hide show
  1. package/dist/index.js +768 -289
  2. package/dist/public/assets/{account-view-wqPOnMfW.js → account-view-DjLjq8T6.js} +1 -1
  3. package/dist/public/assets/alert-dialog-BWqb8ENe.js +1 -0
  4. package/dist/public/assets/api-BbUzw5rb.js +1 -0
  5. package/dist/public/assets/{browser-tab-BjqSmZHm.js → browser-tab-BVsBMyo3.js} +1 -1
  6. package/dist/public/assets/chat-input-container-Dh5eJPNP.js +22 -0
  7. package/dist/public/assets/commit-dialog-CfjW1f6P.js +1 -0
  8. package/dist/public/assets/{context-menu-XD6khGRr.js → context-menu-D_gX85jr.js} +1 -1
  9. package/dist/public/assets/conversation-history-view-CKiv8CxD.js +1 -0
  10. package/dist/public/assets/create-repo-dialog-ByvOv7em.js +1 -0
  11. package/dist/public/assets/{dialogs-config-BXDglGdB.js → dialogs-config-CV8HzCCA.js} +3 -3
  12. package/dist/public/assets/diff-view-CuEdnFtI.js +3 -0
  13. package/dist/public/assets/{explorer-tab-view-DbMBihAH.js → explorer-tab-view-CiDUcvE2.js} +2 -2
  14. package/dist/public/assets/explorer-tree-cxPx2HiW.js +1 -0
  15. package/dist/public/assets/{explorer-view-CL_9lhkq.js → explorer-view-BCQNEBOZ.js} +1 -1
  16. package/dist/public/assets/git-history-dialog-DKey5IQa.js +1 -0
  17. package/dist/public/assets/history-view-DDpROJvQ.js +1 -0
  18. package/dist/public/assets/index-BZwvl9X4.js +29 -0
  19. package/dist/public/assets/index-CihB-pLh.css +1 -0
  20. package/dist/public/assets/markdown-renderer-B1teF28W.js +10 -0
  21. package/dist/public/assets/mcp-server-card-CY-VLPhS.js +1 -0
  22. package/dist/public/assets/merged-pr-dialog-BfwdsytN.js +1 -0
  23. package/dist/public/assets/onboarding-BEy4bi0g.js +1 -0
  24. package/dist/public/assets/onboarding-dialog-GjczsXqi.js +1 -0
  25. package/dist/public/assets/page-toolbar-rWocuukR.js +1 -0
  26. package/dist/public/assets/{project-settings-view-CRRJPGNL.js → project-settings-view-wlaXVds9.js} +1 -1
  27. package/dist/public/assets/providers-list-view-BJsp9sta.js +1 -0
  28. package/dist/public/assets/pull-request-dialog-DDxX2W8n.js +1 -0
  29. package/dist/public/assets/pull-with-changes-dialog-BtXHWQ3k.js +1 -0
  30. package/dist/public/assets/push-before-pr-dialog-Cs54Vb76.js +1 -0
  31. package/dist/public/assets/radio-group-D2kNbZM6.js +1 -0
  32. package/dist/public/assets/react-vendor-DV_DP0Qd.js +22 -0
  33. package/dist/public/assets/{resizable-BLhzHL_f.js → resizable-jxPFsLog.js} +1 -1
  34. package/dist/public/assets/{run-stop-button-CIuDOHFg.js → run-stop-button-N1JNjOlD.js} +2 -2
  35. package/dist/public/assets/settings-general-view-BKcgxF5z.js +1 -0
  36. package/dist/public/assets/{settings-instructions-view-B-uTQrNZ.js → settings-instructions-view-DbQ3c3f1.js} +1 -1
  37. package/dist/public/assets/settings-mcp-servers-view-D2_Brac1.js +5 -0
  38. package/dist/public/assets/{settings-models-skeleton-CffyGIvJ.js → settings-models-skeleton-BSV1GmZQ.js} +1 -1
  39. package/dist/public/assets/settings-models-view-BhFuBHAE.js +1 -0
  40. package/dist/public/assets/settings-rules-view-qL__Zcav.js +8 -0
  41. package/dist/public/assets/settings-skills-view-Ccj8tTR9.js +2 -0
  42. package/dist/public/assets/{settings-slash-commands-view-BoT1nCir.js → settings-slash-commands-view-DyXAbQIp.js} +1 -1
  43. package/dist/public/assets/settings-subagents-view-LcaON0Dq.js +2 -0
  44. package/dist/public/assets/{settings-view-CS-RnV6J.js → settings-view-cLrxaSw4.js} +2 -2
  45. package/dist/public/assets/{side-panel-container-B33_hnhc.js → side-panel-container-CCaF3ZtX.js} +2 -2
  46. package/dist/public/assets/skeleton-DNfHG6mv.js +1 -0
  47. package/dist/public/assets/standard-list-item-PWOXi212.js +1 -0
  48. package/dist/public/assets/store-9Wm6Zyve.js +4 -0
  49. package/dist/public/assets/{tab-context-BUUT3x3d.js → tab-context-BdML89mQ.js} +1 -1
  50. package/dist/public/assets/tabs-BVcV8raO.js +1 -0
  51. package/dist/public/assets/{terminal-panel-BCHLDUbD.js → terminal-panel-BG8UFUSX.js} +2 -2
  52. package/dist/public/assets/textarea-CU-XhvgE.js +1 -0
  53. package/dist/public/assets/todos-view-DLC_0wx_.js +1 -0
  54. package/dist/public/assets/use-font-size-Bqn2rvp_.js +1 -0
  55. package/dist/public/assets/{use-toast-C5s-Xnwi.js → use-toast-CGSBJJb0.js} +1 -1
  56. package/dist/public/assets/{utils-CDrGT12s.js → utils-Dt4Hs5eF.js} +1 -1
  57. package/dist/public/assets/{whisper-wasm-C_Ot631g.js → whisper-wasm-BCJQtWoU.js} +2 -2
  58. package/dist/public/busy.svg +3 -0
  59. package/dist/public/index.html +22 -22
  60. package/package.json +1 -1
  61. package/dist/public/assets/alert-dialog-Dj0hDlZC.js +0 -1
  62. package/dist/public/assets/api-RbLAI1bg.js +0 -1
  63. package/dist/public/assets/chat-input-container-BNOl7YtC.js +0 -21
  64. package/dist/public/assets/conversation-history-view-BRSNoBYn.js +0 -1
  65. package/dist/public/assets/diff-view-DiNlWcSj.js +0 -3
  66. package/dist/public/assets/explorer-tree-D0P-HUYS.js +0 -1
  67. package/dist/public/assets/history-view-i7fGKCkc.js +0 -1
  68. package/dist/public/assets/index-BeLCtY82.css +0 -1
  69. package/dist/public/assets/index-CZZ6Jb9i.js +0 -29
  70. package/dist/public/assets/markdown-renderer-CPSKOcqK.js +0 -10
  71. package/dist/public/assets/mcp-server-card-DFATg_Ie.js +0 -1
  72. package/dist/public/assets/onboarding-5CTkrfwe.js +0 -1
  73. package/dist/public/assets/onboarding-dialog-gcZ9aKKp.js +0 -1
  74. package/dist/public/assets/page-toolbar-CbwENcML.js +0 -1
  75. package/dist/public/assets/providers-list-view-D3CIB4ou.js +0 -1
  76. package/dist/public/assets/radio-group-qCcnwXV3.js +0 -1
  77. package/dist/public/assets/react-vendor-Bpg1hd5i.js +0 -22
  78. package/dist/public/assets/settings-general-view-7Y0c9534.js +0 -1
  79. package/dist/public/assets/settings-mcp-servers-view-nAMQQWHb.js +0 -5
  80. package/dist/public/assets/settings-models-view-CMZh5LlR.js +0 -1
  81. package/dist/public/assets/settings-rules-view-BaNccq1v.js +0 -8
  82. package/dist/public/assets/settings-skills-view-DBX7obT7.js +0 -2
  83. package/dist/public/assets/settings-subagents-view-Cy87X2bs.js +0 -2
  84. package/dist/public/assets/skeleton-n47_ST9G.js +0 -1
  85. package/dist/public/assets/standard-list-item-BLTOBGFa.js +0 -1
  86. package/dist/public/assets/store-B9rEO6q-.js +0 -4
  87. package/dist/public/assets/tabs--5y6mYhG.js +0 -1
  88. package/dist/public/assets/textarea-CwXpBxom.js +0 -1
  89. package/dist/public/assets/todos-view-k0k8R9NT.js +0 -1
  90. package/dist/public/assets/use-font-size-BJl84s49.js +0 -1
  91. /package/dist/public/assets/{dist-CAVGqbBm.js → dist-2eORHB3M.js} +0 -0
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Ln as n,Nr as r,_a as i,ha as a,oi as o,wr as s}from"./dialogs-config-BXDglGdB.js";import{c,l,s as u,u as d}from"./react-vendor-Bpg1hd5i.js";import{n as f}from"./use-font-size-BJl84s49.js";var p=a(),m=e(i(),1),h=r(),g=m.forwardRef((e,n)=>{let r=(0,p.c)(11),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=t(`relative flex w-full touch-none select-none items-center`,i),r[3]=i,r[4]=o);let s,f;r[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`}),r[5]=s,r[6]=f):(s=r[5],f=r[6]);let m;return r[7]!==a||r[8]!==n||r[9]!==o?(m=(0,h.jsxs)(c,{ref:n,className:o,...a,children:[s,f]}),r[7]=a,r[8]=n,r[9]=o,r[10]=m):m=r[10],m});g.displayName=c.displayName;function _(){let e=(0,p.c)(34),{scale:t,updateScale:r,resetScale:i,min:a,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)(o,{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)(s,{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]===t?b=e[8]:(b=(0,h.jsxs)(`span`,{className:`text-sm font-mono tabular-nums w-12 text-right`,children:[t,`%`]}),e[7]=t,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]===a?S=e[13]:(S=(0,h.jsxs)(`span`,{className:`text-xs text-muted-foreground w-8 text-right`,children:[a,`%`]}),e[12]=a,e[13]=S);let C;e[14]===t?C=e[15]:(C=[t],e[14]=t,e[15]=C);let w;e[16]!==d||e[17]!==c||e[18]!==a||e[19]!==C?(w=(0,h.jsx)(g,{value:C,min:a,max:c,step:5,onValueChange:d,"aria-label":`Font size`}),e[16]=d,e[17]=c,e[18]=a,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]!==t?(D=t!==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]=t,e[29]=D):D=e[29];let O;return e[30]!==E||e[31]!==D||e[32]!==x?(O=(0,h.jsx)(n,{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,5 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bn as t,Gr as n,H as r,Hn as i,Nr as a,Rr as o,Un as s,Wn as c,_a as l,bt as u,ci as d,gt as f,ha as p,ln as m,n as h,ni as g,r as _,ri as v,ui as y,wr as b}from"./dialogs-config-BXDglGdB.js";import{a as x}from"./store-B9rEO6q-.js";import{t as S}from"./textarea-CwXpBxom.js";import{c as C,l as w,s as T,u as E}from"./history-view-i7fGKCkc.js";import{t as D}from"./use-toast-C5s-Xnwi.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-Dj0hDlZC.js";import{n as F}from"./tab-context-BUUT3x3d.js";import{t as I}from"./skeleton-n47_ST9G.js";import{t as L}from"./mcp-server-card-DFATg_Ie.js";var R=p(),z=e(l(),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 f(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=()=>{u().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 m(e,t,n)}async function U(e,t){await r(e,t)}var W=a();function G({projectPath:e,serverName:n,onBack:r}){let{installedServers:a}=B(e),s=!!n,[c,l]=(0,z.useState)(``),[u,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)([]),[_,v]=(0,z.useState)(!1),[y,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&&n){let e=a.find(e=>e.name===n);if(e){l(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)},[a,n,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:u.trim(),args:e,...Object.keys(t).length>0?{env:t}:{}}},G=async()=>{w(null);let t=c.trim(),n=u.trim();if(!t){w(`Server name is required`);return}if(!n){w(`Command is required`);return}v(!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`}),r()}catch(e){w(e instanceof Error?e.message:`Failed to save server`)}finally{v(!1)}},K=async()=>{if(e){x(!0);try{await U(e,O),D({title:`Success`,description:`MCP server removed`}),r()}catch(e){w(e instanceof Error?e.message:`Failed to delete server`)}finally{x(!1)}}},q=s?u!==A||p!==ee||JSON.stringify(h)!==JSON.stringify(N):c.trim()!==``||u.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)(t,{htmlFor:`server-name`,children:`Server name`}),(0,W.jsx)(i,{id:`server-name`,placeholder:`e.g. filesystem`,value:c,onChange:e=>l(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)(t,{htmlFor:`server-command`,children:`Command`}),(0,W.jsx)(i,{id:`server-command`,placeholder:`e.g. npx`,value:u,onChange:e=>f(e.target.value),className:`text-sm`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(t,{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
- @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)(t,{children:`Environment variables`}),(0,W.jsxs)(b,{variant:`ghost`,size:`sm`,onClick:F,className:`h-6 px-2 text-xs`,children:[(0,W.jsx)(d,{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)(i,{placeholder:`KEY`,value:e.key,onChange:e=>L(t,e.target.value),className:`font-mono text-xs w-[35%]`}),(0,W.jsx)(i,{placeholder:`value`,value:e.value,onChange:e=>R(t,e.target.value),className:`font-mono text-xs flex-1`}),(0,W.jsx)(b,{variant:`ghost`,size:`icon`,onClick:()=>I(t),className:`h-9 w-9 flex-shrink-0`,children:(0,W.jsx)(o,{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:[s&&(0,W.jsx)(b,{variant:`destructive`,onClick:K,disabled:y||_,children:y?`Removing...`:`Remove`}),!s&&(0,W.jsx)(`div`,{}),(0,W.jsx)(b,{onClick:G,disabled:_||y||!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:o,loadingConfig:l,loadInstalledServers:u}=B(a),{popularServers:d}=V(),{setActiveMainTab:f,setPendingExplorerPath:p,triggerExplorerRefresh:m}=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(),m(),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,m]),re=(0,z.useCallback)(()=>{p(`.agents/mcp.json`),f(`explorer`)},[p,f]),ie=(0,z.useCallback)(async e=>{if(!a)return;let t=K(e);if(!o.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(),m(),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,o,u,m]),ae=$.trim()?d.filter(e=>e.name.toLowerCase().includes($.toLowerCase())||e.description.toLowerCase().includes($.toLowerCase())):d;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)(b,{onClick:()=>R(!0),children:`Add Server`})]}),(0,W.jsx)(`h2`,{className:`text-lg font-semibold mb-3`,children:`Installed MCP Servers`}),l?(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`})]}):o.length===0?(0,W.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,W.jsx)(g,{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:o.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)(g,{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)(b,{variant:`ghost`,size:`icon-sm`,onClick:re,children:(0,W.jsx)(y,{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)(b,{variant:`ghost`,size:`icon-sm`,onClick:()=>J(e.name),children:(0,W.jsx)(y,{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)(b,{variant:`ghost`,size:`icon-sm`,onClick:()=>X(e.name),children:(0,W.jsx)(n,{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)(v,{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)(i,{placeholder:`Search available servers...`,value:$,onChange:e=>te(e.target.value),className:`pl-8`})]}),d.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=o.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)(s,{open:S,onOpenChange:R,children:(0,W.jsx)(c,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,W.jsx)(G,{projectPath:a,onBack:()=>{R(!1),u(),m()}})})}),(0,W.jsx)(s,{open:q!==null,onOpenChange:e=>{e||J(null)},children:(0,W.jsx)(c,{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(),m()}})})}),(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};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,At as n,Ci as r,Dr as i,Hn as a,J as o,Ln as s,Nr as c,Q as ee,X as l,Xr as u,Y as d,Z as f,_a as p,jt as m,ma as h,qi as g,ri as _,wr as v}from"./dialogs-config-BXDglGdB.js";import{c as y,l as b,s as x,u as S}from"./history-view-i7fGKCkc.js";import{o as C,s as te}from"./onboarding-5CTkrfwe.js";import{i as w,n as T,r as ne,t as re}from"./tabs--5y6mYhG.js";import{t as ie}from"./settings-models-skeleton-CffyGIvJ.js";var E=e(p(),1),D=c();function O(){let[e,c]=(0,E.useState)([]),[p,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 m()).filter(e=>e.apiKey);c(e);let n={};e.forEach(e=>{n[e.slug]=`alphabetical`}),q(n);let r={},i={};await Promise.all(e.map(async e=>{try{let n=await t(e.slug);r[e.slug]=n.models,i[e.slug]=new Set(n.enabledModelIds)}catch(t){console.error(`Failed to load models for ${e.slug}:`,t),r[e.slug]=[],i[e.slug]=new Set}})),O(r),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 ee(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,t,n)=>{try{n===`image`?N[e]?.has(t)?(await o(e,t),P(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await l(e,t),P(n=>({...n,[e]:new Set([...n[e]||[],t])}))):j[e]?.has(t)?(await d(e,t),M(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await f(e,t),M(n=>({...n,[e]:new Set([...n[e]||[],t])}))),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]:p[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)(u,{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)(v,{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)(s,{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)(_,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,D.jsx)(a,{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=p[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:n(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)(v,{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)(h,{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)(v,{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)(g,{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)(v,{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)(u,{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),o=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)}),o&&(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:(o.prompt??0)===0&&(o.completion??0)===0?``:`$${i(o.prompt??0)} in | $${i(o.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)(r,{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:n(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)(v,{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)(h,{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)(v,{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)(g,{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),a=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)})}),a&&(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap flex-shrink-0`,children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${i(a.prompt??0)} in | $${i(a.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};
@@ -1,8 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bn as t,Ci as n,Er as r,Et as i,Gr as a,Hn as o,It as s,Nr as c,Un as l,Vi as u,W as d,Wn as f,Yt as p,_a as m,fn as h,ha as g,ia as _,ii as v,n as ee,q as te,r as y,ri as ne,wr as b,xt as re}from"./dialogs-config-BXDglGdB.js";import{n as x,r as S}from"./react-vendor-Bpg1hd5i.js";import{a as C}from"./store-B9rEO6q-.js";import{t as w}from"./textarea-CwXpBxom.js";import{t as T}from"./use-toast-C5s-Xnwi.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 N}from"./alert-dialog-Dj0hDlZC.js";import{n as P}from"./tab-context-BUUT3x3d.js";import{t as F}from"./skeleton-n47_ST9G.js";import{t as I}from"./mcp-server-card-DFATg_Ie.js";import{n as L,t as R}from"./radio-group-qCcnwXV3.js";var z=g(),B=e(m(),1),V=c(),H=B.forwardRef((e,t)=>{let n=(0,z.c)(10),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(`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`,i),n[3]=i,n[4]=o);let s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,V.jsx)(S,{className:r(`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]=s):s=n[5];let c;return n[6]!==a||n[7]!==t||n[8]!==o?(c=(0,V.jsx)(x,{className:o,...a,ref:t,children:s}),n[6]=a,n[7]=t,n[8]=o,n[9]=c):c=n[9],c});H.displayName=x.displayName;function U({threadId:e,onRuleCreated:r}){let[i,a]=(0,B.useState)(``),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(`local`),[p,m]=(0,B.useState)(!1),g=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),v=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)(t,{htmlFor:`ruleName`,children:`Rule Name`}),(0,V.jsx)(o,{id:`ruleName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:p}),i&&(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)(t,{htmlFor:`ruleDescription`,children:`Description`}),(0,V.jsx)(w,{id:`ruleDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:p})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(t,{htmlFor:`alwaysApply`,children:`Always Apply`}),(0,V.jsx)(H,{id:`alwaysApply`,checked:l,onCheckedChange:u,disabled:p})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l?`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)(t,{children:`Scope`}),(0,V.jsxs)(R,{value:d,onValueChange:e=>f(e),className:`flex gap-4`,disabled:p,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)(t,{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)(t,{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:d===`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)(b,{onClick:async()=>{if(!(!v||!e)){m(!0);try{let t=`---
2
- description: ${s.trim()}
3
- alwaysApply: ${l}
4
- ---
5
-
6
- Place your rule instructions here as markdown.
7
- `;await h(e,`.agents/rules/${g}.md`,t),T({title:`Rule created`,description:`Rule '${g}' was created successfully.`}),a(``),c(``),u(!1),f(`local`),r?.(g)}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to create rule`,variant:`destructive`})}finally{m(!1)}}},disabled:!v||!s.trim()||p,children:p?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,V.jsxs)(V.Fragment,{children:[`Continue`,(0,V.jsx)(_,{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}=C(),{selectedProjectId:t,selectedThreadId:n}=e,{setActiveMainTab:r,setPendingExplorerPath:c,triggerExplorerRefresh:m,setExplorerClearPath:g}=P(),[_,x]=(0,B.useState)([]),[S,w]=(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(t){w(!0);try{let e=W(await i(t));if(n)try{let t=W(await s(n)),r=new Set(e.map(e=>e.path));for(let n of t)r.has(n.path)||e.push(n)}catch{}x(e),X(new Set(e.map(e=>e.path)))}catch{x([]),X(new Set)}finally{w(!1)}}},[t,n]);(0,B.useEffect)(()=>{Q()},[Q]),(0,B.useEffect)(()=>{re().then(J).catch(()=>J([]))},[]);let ae=(0,B.useCallback)(async e=>{if(!t)return;let r=e.name,i=e.path;K(!0);try{try{await d(t,i)}catch{if(n)await te(n,i);else throw Error(`No thread selected to delete from`)}g(i),m(),X(e=>{let t=new Set(e);return t.delete(i),t}),T({title:`Rule removed`,description:r}),H(null),await Q()}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to remove rule`,variant:`destructive`})}finally{K(!1)}},[t,n,Q,m,g]),oe=(0,B.useCallback)(e=>{c(e),r(`explorer`)},[c,r]),se=(0,B.useCallback)(async e=>{let t=`.agents/rules/${e.name}.md`;if(!(!n||Y.has(t)))try{e.gitHubRepo&&e.gitHubFolder?await p(n,e.gitHubRepo,e.gitHubFolder,`.agents/rules`):await h(n,t,[`---`,`description: ${e.description}`,`alwaysApply: ${e.alwaysApply??!1}`,`---`,``,e.content].join(`
8
- `)),X(e=>new Set(e).add(t)),m(),Q(),T({title:`Rule installed`,description:e.name})}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to install rule`,variant:`destructive`})}},[n,Y,m,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return t?(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)(b,{onClick:()=>R(!0),disabled:!n,children:`Add Rule`})]}),!n&&(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`}),S?(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.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[(0,V.jsx)(v,{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:_.map(e=>(0,V.jsx)(ee,{children:(0,V.jsxs)(y,{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)(v,{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)(b,{variant:`ghost`,size:`icon-sm`,onClick:()=>oe(e.path),title:`View in explorer`,children:(0,V.jsx)(u,{className:`h-4 w-4`})}),(0,V.jsx)(b,{variant:`ghost`,size:`icon-sm`,onClick:()=>H(e),title:`Delete rule`,children:(0,V.jsx)(a,{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`})}),!n&&(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)(ne,{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)(o,{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)(l,{open:L,onOpenChange:R,children:(0,V.jsx)(f,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,V.jsx)(U,{threadId:n,onRuleCreated:()=>{R(!1),Q(),m()}})})}),(0,V.jsx)(N,{open:z!==null,onOpenChange:e=>!e&&H(null),children:(0,V.jsxs)(O,{children:[(0,V.jsxs)(M,{children:[(0,V.jsx)(D,{children:`Delete Rule`}),(0,V.jsxs)(E,{children:[`Are you sure you want to delete the rule "`,z?.name,`"? This action cannot be undone.`]})]}),(0,V.jsxs)(A,{children:[(0,V.jsx)(j,{children:`Cancel`}),(0,V.jsx)(k,{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 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{B as t,Bn as n,Ci as r,Et as i,Gr as a,Hn as o,It as s,Nr as c,St as l,Un as u,Vi as d,W as f,Wn as p,Yt as m,_a as h,fn as g,ia as _,n as v,q as y,r as b,ri as x,wr as S,zr as C}from"./dialogs-config-BXDglGdB.js";import{a as w}from"./store-B9rEO6q-.js";import{t as T}from"./textarea-CwXpBxom.js";import{t as E}from"./use-toast-C5s-Xnwi.js";import{a as D,c as O,i as k,n as ee,o as te,r as ne,s as re,t as A}from"./alert-dialog-Dj0hDlZC.js";import{n as j}from"./tab-context-BUUT3x3d.js";import{t as M}from"./skeleton-n47_ST9G.js";import{t as N}from"./mcp-server-card-DFATg_Ie.js";import{n as P,t as F}from"./radio-group-qCcnwXV3.js";var I=e(h(),1),L=c();function R({threadId:e,onSkillCreated:i}){let[a,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(`local`),[f,p]=(0,I.useState)(!1),m=a.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),h=m.length>0&&m.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)(n,{htmlFor:`skillName`,children:`Skill Name`}),(0,L.jsx)(o,{id:`skillName`,value:a,onChange:e=>s(e.target.value),placeholder:`e.g. Code Review`,disabled:f}),a&&(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Folder name: `,(0,L.jsx)(`span`,{className:`font-mono`,children:m||`...`})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(n,{htmlFor:`skillDescription`,children:`Description`}),(0,L.jsx)(T,{id:`skillDescription`,value:c,onChange:e=>l(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)(n,{children:`Scope`}),(0,L.jsxs)(F,{value:u,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)(n,{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)(n,{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:u===`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)(S,{onClick:async()=>{if(!(!h||!c.trim()||!e)){p(!0);try{let n=await t(e,m,c.trim());E({title:`Skill created`,description:`Skill '${m}' was created successfully.`}),s(``),l(``),d(`local`),i?.(n.path,`SKILL.md`)}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{p(!1)}}},disabled:!h||!c.trim()||f,children:f?(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)(_,{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:n}=e,{setActiveMainTab:r,setPendingExplorerPath:c,triggerExplorerRefresh:h,setExplorerClearPath:_}=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 i(t));if(n)try{let t=z(await s(n)),r=new Set(e.map(e=>e.path));for(let n of t)r.has(n.path)||e.push(n)}catch{}P(e),X(new Set(e.map(e=>`${e.path}/SKILL.md`)))}catch{P([]),X(new Set)}finally{B(!1)}}},[t,n]);(0,I.useEffect)(()=>{Q()},[Q]),(0,I.useEffect)(()=>{l().then(J).catch(()=>J([]))},[]);let ae=(0,I.useCallback)(async e=>{if(!t)return;let r=e.name,i=e.path;K(!0);try{try{await f(t,i)}catch{if(n)await y(n,i);else throw Error(`No thread selected to delete from`)}_(i),h(),X(e=>{let t=new Set(e);return t.delete(`${i}/SKILL.md`),t}),E({title:`Skill removed`,description:r}),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,n,Q,h,_]),oe=(0,I.useCallback)(e=>{c(`${e}/SKILL.md`),r(`explorer`)},[c,r]),se=(0,I.useCallback)(async e=>{let t=`.agents/skills/${e.id}/SKILL.md`;if(!(!n||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await m(n,e.gitHubRepo,e.gitHubFolder,`.agents/skills/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&r.push(`allowed-tools: ${e.allowedTools}`),e.license&&r.push(`license: ${e.license}`),r.push(`---`,``,e.instructions),await g(n,t,r.join(`
2
- `))}X(e=>new Set(e).add(t)),h(),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`})}},[n,Y,h,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)(S,{onClick:()=>H(!0),disabled:!n,children:`Add Skill`})]}),!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 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)(C,{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)(C,{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)(S,{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)(S,{variant:`ghost`,size:`icon-sm`,onClick:()=>W(e),title:`Delete skill`,children:(0,L.jsx)(a,{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`})}),!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 skills into your project.`}),(0,L.jsxs)(`div`,{className:`relative mb-4`,children:[(0,L.jsx)(x,{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 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)(u,{open:V,onOpenChange:H,children:(0,L.jsx)(p,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,L.jsx)(R,{threadId:n,onSkillCreated:()=>{H(!1),Q(),h()}})})}),(0,L.jsx)(A,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,L.jsxs)(k,{children:[(0,L.jsxs)(re,{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)(te,{children:[(0,L.jsx)(ne,{children:`Cancel`}),(0,L.jsx)(ee,{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,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bn as t,Br as n,Ci as r,Et as i,Gr as a,Hn as o,It as s,Nr as c,Un as l,Vi as u,W as d,Wn as f,Yt as p,_a as m,fn as h,ia as g,n as _,q as v,r as y,ri as b,wr as x,yt as ee,z as S}from"./dialogs-config-BXDglGdB.js";import{a as C}from"./store-B9rEO6q-.js";import{t as w}from"./textarea-CwXpBxom.js";import{t as T}from"./use-toast-C5s-Xnwi.js";import{a as E,c as D,i as O,n as k,o as A,r as j,s as te,t as ne}from"./alert-dialog-Dj0hDlZC.js";import{n as re}from"./tab-context-BUUT3x3d.js";import{t as M}from"./skeleton-n47_ST9G.js";import{t as N}from"./mcp-server-card-DFATg_Ie.js";import{n as P,t as F}from"./radio-group-qCcnwXV3.js";var I=e(m(),1),L=c();function R({threadId:e,onAgentCreated:n}){let[i,a]=(0,I.useState)(``),[s,c]=(0,I.useState)(``),[l,u]=(0,I.useState)(``),[d,f]=(0,I.useState)(`local`),[p,m]=(0,I.useState)(!1),h=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/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 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:p}),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:`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:p})]}),(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=>u(e.target.value),placeholder:`e.g. read grep glob`,disabled:p}),(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:d,onValueChange:e=>f(e),className:`flex gap-4`,disabled:p,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: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)(x,{onClick:async()=>{if(!(!_||!s.trim()||!e)){m(!0);try{let t=await S(e,h,s.trim(),l.trim()||void 0);T({title:`Agent created`,description:`Agent '${h}' was created successfully.`}),a(``),c(``),u(``),f(`local`),n?.(t.path,`AGENT.md`)}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{m(!1)}}},disabled:!_||!s.trim()||p,children:p?(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)(g,{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:r}=e,{setActiveMainTab:c,setPendingExplorerPath:m,triggerExplorerRefresh:g,setExplorerClearPath:S}=re(),[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 i(t));if(r)try{let t=z(await s(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}/AGENT.md`)))}catch{P([]),X(new Set)}finally{B(!1)}}},[t,r]);(0,I.useEffect)(()=>{Q()},[Q]),(0,I.useEffect)(()=>{ee().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 d(t,i)}catch{if(r)await v(r,i);else throw Error(`No thread selected to delete from`)}S(i),g(),X(e=>{let t=new Set(e);return t.delete(`${i}/AGENT.md`),t}),T({title:`Agent removed`,description:n}),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,r,Q,g,S]),oe=(0,I.useCallback)(e=>{m(`${e}/AGENT.md`),c(`explorer`)},[m,c]),se=(0,I.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!r||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await p(r,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 h(r,t,n.join(`
2
- `))}X(e=>new Set(e).add(t)),g(),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`})}},[r,Y,g,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)(x,{onClick:()=>H(!0),disabled:!r,children:`Add Subagent`})]}),!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 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)(M,{className:`h-20 w-full`}),(0,L.jsx)(M,{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)(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 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)(_,{children:(0,L.jsxs)(y,{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)(x,{variant:`ghost`,size:`icon-sm`,onClick:()=>oe(e.path),title:`View in explorer`,children:(0,L.jsx)(u,{className:`h-4 w-4`})}),(0,L.jsx)(x,{variant:`ghost`,size:`icon-sm`,onClick:()=>W(e),title:`Delete agent`,children:(0,L.jsx)(a,{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`})}),!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 subagents into your project.`}),(0,L.jsxs)(`div`,{className:`relative mb-4`,children:[(0,L.jsx)(b,{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)(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 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)(N,{name:e.name,description:e.description,installed:n,onClick:()=>{n||se(e)},showInstalledControls:!1},e.id)})})]})}),(0,L.jsx)(l,{open:V,onOpenChange:H,children:(0,L.jsx)(f,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,L.jsx)(R,{threadId:r,onAgentCreated:()=>{H(!1),Q(),g()}})})}),(0,L.jsx)(ne,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,L.jsxs)(O,{children:[(0,L.jsxs)(te,{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 +0,0 @@
1
- import{Er as e,Nr as t,ha as n}from"./dialogs-config-BXDglGdB.js";var r=n(),i=t();function a(t){let n=(0,r.c)(8),a,o;n[0]===t?(a=n[1],o=n[2]):({className:a,...o}=t,n[0]=t,n[1]=a,n[2]=o);let s;n[3]===a?s=n[4]:(s=e(`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 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Mr as n,Nr as r,_a as i,ha as a}from"./dialogs-config-BXDglGdB.js";var o=a(),s=e(i(),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,4 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{_a as t,ha as n}from"./dialogs-config-BXDglGdB.js";var r=e(t(),1),i=n();function a(e){return typeof e==`string`?e.replace(/\\n/g,`
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
-
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 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Nr as n,_a as r,ha as i}from"./dialogs-config-BXDglGdB.js";import{B as a,R as o,V as s,z as c}from"./react-vendor-Bpg1hd5i.js";var l=i(),u=e(r(),1),d=n(),f=a,p=u.forwardRef((e,n)=>{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=t(`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]!==n||r[7]!==o?(s=(0,d.jsx)(c,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});p.displayName=c.displayName;var m=u.forwardRef((e,n)=>{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=t(`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]!==n||r[7]!==o?(c=(0,d.jsx)(s,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=c):c=r[8],c});m.displayName=s.displayName;var h=u.forwardRef((e,n)=>{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=t(`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]!==n||r[7]!==s?(c=(0,d.jsx)(o,{ref:n,className:s,...a}),r[5]=a,r[6]=n,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 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Er as t,Nr as n,_a as r,ha as i}from"./dialogs-config-BXDglGdB.js";var a=i(),o=e(r(),1),s=n(),c=o.forwardRef((e,n)=>{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=t(`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]!==n||r[7]!==c?(l=(0,s.jsx)(`textarea`,{className:c,ref:n,...o}),r[5]=o,r[6]=n,r[7]=c,r[8]=l):l=r[8],l});c.displayName=`Textarea`;export{c as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./index-CZZ6Jb9i.js";export{e as TodosView};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{_a as t,m as n,x as r}from"./dialogs-config-BXDglGdB.js";var i=e(t(),1),a=75,o=125,s=100;function c(e){document.documentElement.style.fontSize=`${e}%`}function l(){let[e,t]=(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)));t(n),r(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};